repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.getMillis | private static int getMillis(String dateStr) {
int length = dateStr.length();
if (length == 19) {
// "1999-12-31 12:34:56", no milli second left
return 0;
} else if (length == 21) {
// "1999-12-31 12:34:56.7", return 7
return Integer.parseInt(dateStr.substring(20)) * 100;
} else if (length == 22) {
// "1999-12-31 12:34:56.78", return 78
return Integer.parseInt(dateStr.substring(20)) * 10;
} else if (length >= 23 && length <= 26) {
// "1999-12-31 12:34:56.123" ~ "1999-12-31 12:34:56.123456"
return Integer.parseInt(dateStr.substring(20, 23)) * 10;
} else {
return 0;
}
} | java | private static int getMillis(String dateStr) {
int length = dateStr.length();
if (length == 19) {
// "1999-12-31 12:34:56", no milli second left
return 0;
} else if (length == 21) {
// "1999-12-31 12:34:56.7", return 7
return Integer.parseInt(dateStr.substring(20)) * 100;
} else if (length == 22) {
// "1999-12-31 12:34:56.78", return 78
return Integer.parseInt(dateStr.substring(20)) * 10;
} else if (length >= 23 && length <= 26) {
// "1999-12-31 12:34:56.123" ~ "1999-12-31 12:34:56.123456"
return Integer.parseInt(dateStr.substring(20, 23)) * 10;
} else {
return 0;
}
} | [
"private",
"static",
"int",
"getMillis",
"(",
"String",
"dateStr",
")",
"{",
"int",
"length",
"=",
"dateStr",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"==",
"19",
")",
"{",
"// \"1999-12-31 12:34:56\", no milli second left",
"return",
"0",
";",
"}"... | Returns the milli second part of the datetime. | [
"Returns",
"the",
"milli",
"second",
"part",
"of",
"the",
"datetime",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L476-L493 | train | get milliseconds from a date string | [
30522,
2797,
10763,
20014,
2131,
19912,
2483,
1006,
5164,
5246,
16344,
1007,
1063,
20014,
3091,
1027,
5246,
16344,
1012,
3091,
1006,
1007,
1025,
2065,
1006,
3091,
1027,
1027,
2539,
1007,
1063,
1013,
1013,
1000,
2639,
1011,
2260,
1011,
2861,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CustomDictionary.java | CustomDictionary.parseLongestText | public static void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
final int[] lengthArray = new int[text.length()];
final CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[text.length()];
char[] charArray = text.toCharArray();
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(charArray, 0);
while (searcher.next())
{
lengthArray[searcher.begin] = searcher.length;
attributeArray[searcher.begin] = searcher.value;
}
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
int length = end - begin;
if (length > lengthArray[begin])
{
lengthArray[begin] = length;
attributeArray[begin] = value;
}
}
});
for (int i = 0; i < charArray.length;)
{
if (lengthArray[i] == 0)
{
++i;
}
else
{
processor.hit(i, i + lengthArray[i], attributeArray[i]);
i += lengthArray[i];
}
}
}
else
dat.parseLongestText(text, processor);
} | java | public static void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
final int[] lengthArray = new int[text.length()];
final CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[text.length()];
char[] charArray = text.toCharArray();
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(charArray, 0);
while (searcher.next())
{
lengthArray[searcher.begin] = searcher.length;
attributeArray[searcher.begin] = searcher.value;
}
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
int length = end - begin;
if (length > lengthArray[begin])
{
lengthArray[begin] = length;
attributeArray[begin] = value;
}
}
});
for (int i = 0; i < charArray.length;)
{
if (lengthArray[i] == 0)
{
++i;
}
else
{
processor.hit(i, i + lengthArray[i], attributeArray[i]);
i += lengthArray[i];
}
}
}
else
dat.parseLongestText(text, processor);
} | [
"public",
"static",
"void",
"parseLongestText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"processor",
")",
"{",
"if",
"(",
"trie",
"!=",
"null",
")",
"{",
"final",
"int",
"[",
"]",
... | 最长匹配
@param text 文本
@param processor 处理器 | [
"最长匹配"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L604-L645 | train | Parses the text using the Longest Text Method. | [
30522,
2270,
10763,
11675,
11968,
11246,
5063,
4355,
18209,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
13151,
1007,
1063,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassLoaderUtil.java | ClassLoaderUtil.loadClass | public static Class<?> loadClass(File jarOrDir, String name) {
try {
return getJarClassLoader(jarOrDir).loadClass(name);
} catch (ClassNotFoundException e) {
throw new UtilException(e);
}
} | java | public static Class<?> loadClass(File jarOrDir, String name) {
try {
return getJarClassLoader(jarOrDir).loadClass(name);
} catch (ClassNotFoundException e) {
throw new UtilException(e);
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"loadClass",
"(",
"File",
"jarOrDir",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"getJarClassLoader",
"(",
"jarOrDir",
")",
".",
"loadClass",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"ClassNotFound... | 加载外部类
@param jarOrDir jar文件或者包含jar和class文件的目录
@param name 类名
@return 类
@since 4.4.2 | [
"加载外部类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassLoaderUtil.java#L230-L236 | train | Load a class from a jar or directory. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
7170,
26266,
1006,
5371,
15723,
8551,
4313,
1010,
5164,
2171,
1007,
1063,
3046,
1063,
2709,
2131,
16084,
26266,
11066,
2121,
1006,
15723,
8551,
4313,
1007,
1012,
7170,
26266,
1006,
2171,
1007,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.addDefaultKryoSerializer | public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) {
config.addDefaultKryoSerializer(type, serializerClass);
} | java | public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) {
config.addDefaultKryoSerializer(type, serializerClass);
} | [
"public",
"void",
"addDefaultKryoSerializer",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
"extends",
"Serializer",
"<",
"?",
">",
">",
"serializerClass",
")",
"{",
"config",
".",
"addDefaultKryoSerializer",
"(",
"type",
",",
"serializerClass",... | Adds a new Kryo default serializer to the Runtime.
@param type
The class of the types serialized with the given serializer.
@param serializerClass
The class of the serializer to use. | [
"Adds",
"a",
"new",
"Kryo",
"default",
"serializer",
"to",
"the",
"Runtime",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L566-L568 | train | Add a default serializer for the given type. | [
30522,
2270,
11675,
5587,
3207,
7011,
11314,
21638,
7677,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
2465,
1026,
1029,
8908,
7642,
17629,
1026,
1029,
1028,
1028,
7642,
17629,
26266,
1007,
1063,
9530,
8873,
2290,
1012,
5587... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.toStr | public static String toStr(Number number) {
if (null == number) {
throw new NullPointerException("Number is null !");
}
if (false == ObjectUtil.isValidIfNumber(number)) {
throw new IllegalArgumentException("Number is non-finite!");
}
// 去掉小数点儿后多余的0
String string = number.toString();
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) {
while (string.endsWith("0")) {
string = string.substring(0, string.length() - 1);
}
if (string.endsWith(".")) {
string = string.substring(0, string.length() - 1);
}
}
return string;
} | java | public static String toStr(Number number) {
if (null == number) {
throw new NullPointerException("Number is null !");
}
if (false == ObjectUtil.isValidIfNumber(number)) {
throw new IllegalArgumentException("Number is non-finite!");
}
// 去掉小数点儿后多余的0
String string = number.toString();
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) {
while (string.endsWith("0")) {
string = string.substring(0, string.length() - 1);
}
if (string.endsWith(".")) {
string = string.substring(0, string.length() - 1);
}
}
return string;
} | [
"public",
"static",
"String",
"toStr",
"(",
"Number",
"number",
")",
"{",
"if",
"(",
"null",
"==",
"number",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Number is null !\"",
")",
";",
"}",
"if",
"(",
"false",
"==",
"ObjectUtil",
".",
"isValid... | 数字转字符串<br>
调用{@link Number#toString()},并去除尾小数点儿后多余的0
@param number A Number
@return A String. | [
"数字转字符串<br",
">",
"调用",
"{",
"@link",
"Number#toString",
"()",
"}",
",并去除尾小数点儿后多余的0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1867-L1887 | train | Converts a Number object to a String. | [
30522,
2270,
10763,
5164,
2000,
3367,
2099,
1006,
2193,
2193,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2193,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
2193,
2003,
19701,
999,
1000,
1007,
1025,
1065,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.getInfo | @Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType)
throws HiveSQLException {
try {
// FIXME extract the right info type
TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType());
TGetInfoResp resp = cliService.GetInfo(req);
checkStatus(resp.getStatus());
return new GetInfoValue(resp.getInfoValue());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType)
throws HiveSQLException {
try {
// FIXME extract the right info type
TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType());
TGetInfoResp resp = cliService.GetInfo(req);
checkStatus(resp.getStatus());
return new GetInfoValue(resp.getInfoValue());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"GetInfoValue",
"getInfo",
"(",
"SessionHandle",
"sessionHandle",
",",
"GetInfoType",
"infoType",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"// FIXME extract the right info type",
"TGetInfoReq",
"req",
"=",
"new",
"TGetInfoReq",
"(",... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getInfo(org.apache.hive.service.cli.SessionHandle, java.util.List) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L95-L109 | train | Get the value of a single info element. | [
30522,
1030,
2058,
15637,
2270,
2131,
2378,
14876,
10175,
5657,
2131,
2378,
14876,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
2131,
2378,
14876,
13874,
18558,
13874,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java | Rowtime.timestampsFromField | public Rowtime timestampsFromField(String fieldName) {
internalProperties.putString(ROWTIME_TIMESTAMPS_TYPE, ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD);
internalProperties.putString(ROWTIME_TIMESTAMPS_FROM, fieldName);
return this;
} | java | public Rowtime timestampsFromField(String fieldName) {
internalProperties.putString(ROWTIME_TIMESTAMPS_TYPE, ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD);
internalProperties.putString(ROWTIME_TIMESTAMPS_FROM, fieldName);
return this;
} | [
"public",
"Rowtime",
"timestampsFromField",
"(",
"String",
"fieldName",
")",
"{",
"internalProperties",
".",
"putString",
"(",
"ROWTIME_TIMESTAMPS_TYPE",
",",
"ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD",
")",
";",
"internalProperties",
".",
"putString",
"(",
"ROWTIME_TIMESTA... | Sets a built-in timestamp extractor that converts an existing {@link Long} or
{@link Types#SQL_TIMESTAMP} field into the rowtime attribute.
@param fieldName The field to convert into a rowtime attribute. | [
"Sets",
"a",
"built",
"-",
"in",
"timestamp",
"extractor",
"that",
"converts",
"an",
"existing",
"{",
"@link",
"Long",
"}",
"or",
"{",
"@link",
"Types#SQL_TIMESTAMP",
"}",
"field",
"into",
"the",
"rowtime",
"attribute",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java#L62-L66 | train | Sets the value of the rowtime_timestamps_from property. | [
30522,
2270,
5216,
7292,
2335,
15464,
4523,
19699,
5358,
3790,
1006,
5164,
2492,
18442,
1007,
1063,
4722,
21572,
4842,
7368,
1012,
8509,
18886,
3070,
1006,
5216,
7292,
1035,
2335,
15464,
4523,
1035,
2828,
1010,
5216,
7292,
1035,
2335,
15464... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.doWriteMultiple | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | java | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | [
"private",
"int",
"doWriteMultiple",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"final",
"long",
"maxBytesPerGatheringWrite",
"=",
"config",
"(",
")",
".",
"getMaxBytesPerGatheringWrite",
"(",
")",
";",
"IovArray",
"array",
"=",
"(",
"(",... | Attempt to write multiple {@link ByteBuf} objects.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul>
@throws Exception If an I/O error occurs. | [
"Attempt",
"to",
"write",
"multiple",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L511-L524 | train | Write multiple messages. | [
30522,
2797,
20014,
23268,
17625,
12274,
7096,
11514,
2571,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1007,
11618,
6453,
1063,
2345,
2146,
4098,
3762,
4570,
4842,
20697,
22658,
26373,
1027,
9530,
8873,
2290,
1006,
1007,
1012,
2131,
17848,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/java/hadoop/mapred/HadoopOutputFormatBase.java | HadoopOutputFormatBase.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
super.write(out);
out.writeUTF(mapredOutputFormat.getClass().getName());
jobConf.write(out);
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
super.write(out);
out.writeUTF(mapredOutputFormat.getClass().getName());
jobConf.write(out);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"super",
".",
"write",
"(",
"out",
")",
";",
"out",
".",
"writeUTF",
"(",
"mapredOutputFormat",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopOutputFormatBase.java#L178-L182 | train | Write the object to the stream. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
3565,
1012,
4339,
1006,
2041,
1007,
1025,
2041,
1012,
4339,
4904,
2546,
1006,
4949,
23417,
4904,
18780,
14192,
4017,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/api/TransactionOptions.java | TransactionOptions.timeout | public TransactionOptions timeout(long timeout, TimeUnit timeoutUnit) {
if (timeout == -1) {
this.timeout = timeout;
return this;
}
this.timeout = timeoutUnit.toMillis(timeout);
return this;
} | java | public TransactionOptions timeout(long timeout, TimeUnit timeoutUnit) {
if (timeout == -1) {
this.timeout = timeout;
return this;
}
this.timeout = timeoutUnit.toMillis(timeout);
return this;
} | [
"public",
"TransactionOptions",
"timeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeoutUnit",
")",
"{",
"if",
"(",
"timeout",
"==",
"-",
"1",
")",
"{",
"this",
".",
"timeout",
"=",
"timeout",
";",
"return",
"this",
";",
"}",
"this",
".",
"timeout",
... | If transaction hasn't been committed within <code>timeout</code> it will rollback automatically.
Set <code>-1</code> to disable.
<p>
Default is <code>5000 milliseconds</code>
@param timeout in milliseconds
@param timeoutUnit timeout time unit
@return self instance | [
"If",
"transaction",
"hasn",
"t",
"been",
"committed",
"within",
"<code",
">",
"timeout<",
"/",
"code",
">",
"it",
"will",
"rollback",
"automatically",
".",
"Set",
"<code",
">",
"-",
"1<",
"/",
"code",
">",
"to",
"disable",
".",
"<p",
">",
"Default",
"... | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/TransactionOptions.java#L129-L136 | train | Sets the timeout for the transaction. | [
30522,
2270,
12598,
7361,
9285,
2051,
5833,
1006,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
2051,
5833,
19496,
2102,
1007,
1063,
2065,
1006,
2051,
5833,
1027,
1027,
1011,
1015,
1007,
1063,
2023,
1012,
2051,
5833,
1027,
2051,
5833,
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... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/RelaxedDataBinder.java | RelaxedDataBinder.sortPropertyNames | private void sortPropertyNames(List<String> names) {
for (String name : new ArrayList<String>(names)) {
int propertyIndex = names.indexOf(name);
RelaxedDataBinder.BeanPath path = new RelaxedDataBinder.BeanPath(name);
for (String prefix : path.prefixes()) {
int prefixIndex = names.indexOf(prefix);
if (prefixIndex >= propertyIndex) {
// The child property has a parent in the list in the wrong order
names.remove(name);
names.add(prefixIndex, name);
}
}
}
} | java | private void sortPropertyNames(List<String> names) {
for (String name : new ArrayList<String>(names)) {
int propertyIndex = names.indexOf(name);
RelaxedDataBinder.BeanPath path = new RelaxedDataBinder.BeanPath(name);
for (String prefix : path.prefixes()) {
int prefixIndex = names.indexOf(prefix);
if (prefixIndex >= propertyIndex) {
// The child property has a parent in the list in the wrong order
names.remove(name);
names.add(prefixIndex, name);
}
}
}
} | [
"private",
"void",
"sortPropertyNames",
"(",
"List",
"<",
"String",
">",
"names",
")",
"{",
"for",
"(",
"String",
"name",
":",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"names",
")",
")",
"{",
"int",
"propertyIndex",
"=",
"names",
".",
"indexOf",
"(... | Sort by name so that parent properties get processed first (e.g. 'foo.bar'
before 'foo.bar.spam'). Don't use Collections.sort() because the order might
be significant for other property names (it shouldn't be but who knows what
people might be relying on, e.g. HSQL has a JDBCXADataSource where
"databaseName" is a synonym for "url").
@param names the names to sort | [
"Sort",
"by",
"name",
"so",
"that",
"parent",
"properties",
"get",
"processed",
"first",
"(",
"e",
".",
"g",
".",
"foo",
".",
"bar",
"before",
"foo",
".",
"bar",
".",
"spam",
")",
".",
"Don",
"t",
"use",
"Collections",
".",
"sort",
"()",
"because",
... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/RelaxedDataBinder.java#L163-L176 | train | Sort the list of property names in the correct order. | [
30522,
2797,
11675,
4066,
21572,
4842,
25680,
14074,
2015,
1006,
2862,
1026,
5164,
1028,
3415,
1007,
1063,
2005,
1006,
5164,
2171,
1024,
2047,
9140,
9863,
1026,
5164,
1028,
1006,
3415,
1007,
30524,
1012,
14068,
15069,
4130,
1027,
2047,
8363... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/builder/EqualsBuilder.java | EqualsBuilder.reflectionEquals | public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass,
final String... excludeFields) {
if (lhs == rhs) {
return true;
}
if (lhs == null || rhs == null) {
return false;
}
// Find the leaf class since there may be transients in the leaf
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
final Class<?> lhsClass = lhs.getClass();
final Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
if (!rhsClass.isInstance(lhs)) {
// rhsClass is a subclass of lhsClass
testClass = rhsClass;
}
} else if (rhsClass.isInstance(lhs)) {
testClass = rhsClass;
if (!lhsClass.isInstance(rhs)) {
// lhsClass is a subclass of rhsClass
testClass = lhsClass;
}
} else {
// The two classes are not related.
return false;
}
final EqualsBuilder equalsBuilder = new EqualsBuilder();
try {
if (testClass.isArray()) {
equalsBuilder.append(lhs, rhs);
} else {
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
testClass = testClass.getSuperclass();
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
}
}
} catch (final IllegalArgumentException e) {
// In this case, we tried to test a subclass vs. a superclass and
// the subclass has ivars or the ivars are transient and
// we are testing transients.
// If a subclass has ivars that we are trying to test them, we get an
// exception and we know that the objects are not equal.
return false;
}
return equalsBuilder.isEquals();
} | java | public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass,
final String... excludeFields) {
if (lhs == rhs) {
return true;
}
if (lhs == null || rhs == null) {
return false;
}
// Find the leaf class since there may be transients in the leaf
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
final Class<?> lhsClass = lhs.getClass();
final Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
if (!rhsClass.isInstance(lhs)) {
// rhsClass is a subclass of lhsClass
testClass = rhsClass;
}
} else if (rhsClass.isInstance(lhs)) {
testClass = rhsClass;
if (!lhsClass.isInstance(rhs)) {
// lhsClass is a subclass of rhsClass
testClass = lhsClass;
}
} else {
// The two classes are not related.
return false;
}
final EqualsBuilder equalsBuilder = new EqualsBuilder();
try {
if (testClass.isArray()) {
equalsBuilder.append(lhs, rhs);
} else {
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
testClass = testClass.getSuperclass();
reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields);
}
}
} catch (final IllegalArgumentException e) {
// In this case, we tried to test a subclass vs. a superclass and
// the subclass has ivars or the ivars are transient and
// we are testing transients.
// If a subclass has ivars that we are trying to test them, we get an
// exception and we know that the objects are not equal.
return false;
}
return equalsBuilder.isEquals();
} | [
"public",
"static",
"boolean",
"reflectionEquals",
"(",
"final",
"Object",
"lhs",
",",
"final",
"Object",
"rhs",
",",
"final",
"boolean",
"testTransients",
",",
"final",
"Class",
"<",
"?",
">",
"reflectUpToClass",
",",
"final",
"String",
"...",
"excludeFields",
... | <p>This method uses reflection to determine if the two <code>Object</code>s
are equal.</p>
<p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
fields. This means that it will throw a security exception if run under
a security manager, if the permissions are not set up correctly. It is also
not as efficient as testing explicitly. Non-primitive fields are compared using
<code>equals()</code>.</p>
<p>If the testTransients parameter is set to <code>true</code>, transient
members will be tested, otherwise they are ignored, as they are likely
derived fields, and not part of the value of the <code>Object</code>.</p>
<p>Static fields will not be included. Superclass fields will be appended
up to and including the specified superclass. A null superclass is treated
as java.lang.Object.</p>
@param lhs <code>this</code> object
@param rhs the other object
@param testTransients whether to include transient fields
@param reflectUpToClass the superclass to reflect up to (inclusive),
may be <code>null</code>
@param excludeFields array of field names to exclude from testing
@return <code>true</code> if the two Objects have tested equals.
@since 2.0 | [
"<p",
">",
"This",
"method",
"uses",
"reflection",
"to",
"determine",
"if",
"the",
"two",
"<code",
">",
"Object<",
"/",
"code",
">",
"s",
"are",
"equal",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/EqualsBuilder.java#L313-L364 | train | Checks if two objects are equal. | [
30522,
2270,
10763,
22017,
20898,
9185,
2063,
26426,
2015,
1006,
2345,
4874,
1048,
7898,
1010,
2345,
4874,
1054,
7898,
1010,
2345,
22017,
20898,
3231,
6494,
3619,
11638,
2015,
1010,
2345,
2465,
1026,
1029,
1028,
8339,
29441,
10085,
27102,
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-optimizer/src/main/java/org/apache/flink/optimizer/dag/SingleInputNode.java | SingleInputNode.accept | @Override
public void accept(Visitor<OptimizerNode> visitor) {
if (visitor.preVisit(this)) {
if (getPredecessorNode() != null) {
getPredecessorNode().accept(visitor);
} else {
throw new CompilerException();
}
for (DagConnection connection : getBroadcastConnections()) {
connection.getSource().accept(visitor);
}
visitor.postVisit(this);
}
} | java | @Override
public void accept(Visitor<OptimizerNode> visitor) {
if (visitor.preVisit(this)) {
if (getPredecessorNode() != null) {
getPredecessorNode().accept(visitor);
} else {
throw new CompilerException();
}
for (DagConnection connection : getBroadcastConnections()) {
connection.getSource().accept(visitor);
}
visitor.postVisit(this);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"Visitor",
"<",
"OptimizerNode",
">",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"preVisit",
"(",
"this",
")",
")",
"{",
"if",
"(",
"getPredecessorNode",
"(",
")",
"!=",
"null",
")",
"{",
"getPrede... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/SingleInputNode.java#L511-L524 | train | Visit this node. | [
30522,
1030,
2058,
15637,
2270,
11675,
5138,
1006,
10367,
1026,
23569,
27605,
6290,
3630,
3207,
1028,
10367,
1007,
1063,
2065,
1006,
10367,
1012,
3653,
11365,
4183,
1006,
2023,
1007,
1007,
1063,
2065,
1006,
2131,
28139,
3207,
9623,
21748,
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... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.numChars | public int numChars() {
int len = 0;
for (int i = 0; i < numBytes; i += numBytesForFirstByte(getByte(i))) {
len += 1;
}
return len;
} | java | public int numChars() {
int len = 0;
for (int i = 0; i < numBytes; i += numBytesForFirstByte(getByte(i))) {
len += 1;
}
return len;
} | [
"public",
"int",
"numChars",
"(",
")",
"{",
"int",
"len",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numBytes",
";",
"i",
"+=",
"numBytesForFirstByte",
"(",
"getByte",
"(",
"i",
")",
")",
")",
"{",
"len",
"+=",
"1",
";",
... | Returns the number of code points in it. | [
"Returns",
"the",
"number",
"of",
"code",
"points",
"in",
"it",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L237-L243 | train | Returns the number of characters in this string. | [
30522,
2270,
20014,
16371,
12458,
8167,
2015,
1006,
1007,
1063,
20014,
18798,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
15903,
17250,
2015,
1025,
1045,
1009,
1027,
15903,
17250,
22747,
16347,
18894,
2102,
30524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.scheduleRunAsync | protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) {
componentMainThreadExecutor.schedule(runnable, delay, unit);
} | java | protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) {
componentMainThreadExecutor.schedule(runnable, delay, unit);
} | [
"protected",
"void",
"scheduleRunAsync",
"(",
"Runnable",
"runnable",
",",
"long",
"delay",
",",
"TimeUnit",
"unit",
")",
"{",
"componentMainThreadExecutor",
".",
"schedule",
"(",
"runnable",
",",
"delay",
",",
"unit",
")",
";",
"}"
] | Execute the runnable in the main thread of the underlying RPC endpoint, with
a delay of the given number of milliseconds.
@param runnable Runnable to be executed
@param delay The delay after which the runnable will be executed | [
"Execute",
"the",
"runnable",
"in",
"the",
"main",
"thread",
"of",
"the",
"underlying",
"RPC",
"endpoint",
"with",
"a",
"delay",
"of",
"the",
"given",
"number",
"of",
"milliseconds",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L889-L891 | train | Schedules the given runnable to be run asynchronously. | [
30522,
5123,
11675,
6134,
26605,
6508,
12273,
1006,
2448,
22966,
2448,
22966,
1010,
2146,
8536,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
6922,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
2099,
1012,
6134,
1006,
2448,
22966,
1010,
8536,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java | AbstractMysqlEventParser.processTableMeta | protected boolean processTableMeta(EntryPosition position) {
if (tableMetaTSDB != null) {
if (position.getTimestamp() == null || position.getTimestamp() <= 0) {
throw new CanalParseException("use gtid and TableMeta TSDB should be config timestamp > 0");
}
return tableMetaTSDB.rollback(position);
}
return true;
} | java | protected boolean processTableMeta(EntryPosition position) {
if (tableMetaTSDB != null) {
if (position.getTimestamp() == null || position.getTimestamp() <= 0) {
throw new CanalParseException("use gtid and TableMeta TSDB should be config timestamp > 0");
}
return tableMetaTSDB.rollback(position);
}
return true;
} | [
"protected",
"boolean",
"processTableMeta",
"(",
"EntryPosition",
"position",
")",
"{",
"if",
"(",
"tableMetaTSDB",
"!=",
"null",
")",
"{",
"if",
"(",
"position",
".",
"getTimestamp",
"(",
")",
"==",
"null",
"||",
"position",
".",
"getTimestamp",
"(",
")",
... | 回滚到指定位点
@param position
@return | [
"回滚到指定位点"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java#L100-L110 | train | Process the TableMeta entry. | [
30522,
5123,
22017,
20898,
2832,
10880,
11368,
2050,
1006,
4443,
26994,
2597,
1007,
1063,
2065,
1006,
2795,
11368,
11149,
18939,
999,
1027,
19701,
1007,
1063,
2065,
1006,
2597,
1012,
2131,
7292,
9153,
8737,
1006,
1007,
1027,
1027,
19701,
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... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.isAscii | private static boolean isAscii(ByteBuf buf, int index, int length) {
return buf.forEachByte(index, length, FIND_NON_ASCII) == -1;
} | java | private static boolean isAscii(ByteBuf buf, int index, int length) {
return buf.forEachByte(index, length, FIND_NON_ASCII) == -1;
} | [
"private",
"static",
"boolean",
"isAscii",
"(",
"ByteBuf",
"buf",
",",
"int",
"index",
",",
"int",
"length",
")",
"{",
"return",
"buf",
".",
"forEachByte",
"(",
"index",
",",
"length",
",",
"FIND_NON_ASCII",
")",
"==",
"-",
"1",
";",
"}"
] | Returns {@code true} if the specified {@link ByteBuf} starting at {@code index} with {@code length} is valid
ASCII text, otherwise return {@code false}.
@param buf The given {@link ByteBuf}.
@param index The start index of the specified buffer.
@param length The length of the specified buffer. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"specified",
"{",
"@link",
"ByteBuf",
"}",
"starting",
"at",
"{",
"@code",
"index",
"}",
"with",
"{",
"@code",
"length",
"}",
"is",
"valid",
"ASCII",
"text",
"otherwise",
"return",
"{",
"@code",
"false",... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L1269-L1271 | train | Returns true if the buffer contains ASCII characters. | [
30522,
2797,
10763,
22017,
20898,
18061,
11020,
6137,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
5950,
1010,
20014,
3091,
1007,
1063,
2709,
20934,
2546,
1012,
18921,
6776,
3762,
2618,
1006,
5950,
1010,
3091,
1010,
2424,
1035,
2512,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UUID.java | UUID.randomUUID | public static UUID randomUUID(boolean isSecure) {
final Random ng = isSecure ? Holder.numberGenerator : RandomUtil.getRandom();
byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
return new UUID(randomBytes);
} | java | public static UUID randomUUID(boolean isSecure) {
final Random ng = isSecure ? Holder.numberGenerator : RandomUtil.getRandom();
byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
return new UUID(randomBytes);
} | [
"public",
"static",
"UUID",
"randomUUID",
"(",
"boolean",
"isSecure",
")",
"{",
"final",
"Random",
"ng",
"=",
"isSecure",
"?",
"Holder",
".",
"numberGenerator",
":",
"RandomUtil",
".",
"getRandom",
"(",
")",
";",
"byte",
"[",
"]",
"randomBytes",
"=",
"new"... | 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。
@param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能
@return 随机生成的 {@code UUID} | [
"获取类型",
"4(伪随机生成的)UUID",
"的静态工厂。",
"使用加密的强伪随机数生成器生成该",
"UUID。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/UUID.java#L117-L127 | train | Creates a random UUID from the given parameters. | [
30522,
2270,
10763,
1057,
21272,
6721,
2226,
21272,
1006,
22017,
20898,
26354,
29150,
1007,
1063,
2345,
6721,
12835,
1027,
26354,
29150,
1029,
9111,
1012,
2193,
6914,
6906,
4263,
1024,
6721,
21823,
2140,
1012,
2131,
13033,
5358,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java | CustomWebFluxSecurityExample.springSecurityFilterChain | @Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
return http
.authorizeExchange()
.matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.pathMatchers("/foo", "/bar")
.authenticated().and()
.formLogin().and()
.build();
} | java | @Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
return http
.authorizeExchange()
.matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.pathMatchers("/foo", "/bar")
.authenticated().and()
.formLogin().and()
.build();
} | [
"@",
"Bean",
"public",
"SecurityWebFilterChain",
"springSecurityFilterChain",
"(",
"ServerHttpSecurity",
"http",
")",
"{",
"return",
"http",
".",
"authorizeExchange",
"(",
")",
".",
"matchers",
"(",
"PathRequest",
".",
"toStaticResources",
"(",
")",
".",
"atCommonLo... | tag::configuration[] | [
"tag",
"::",
"configuration",
"[]"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java#L35-L44 | train | Spring security filter chain. | [
30522,
1030,
14068,
2270,
3036,
8545,
29292,
4014,
3334,
24925,
2078,
6076,
8586,
25137,
8873,
21928,
24925,
2078,
1006,
8241,
11039,
25856,
3366,
10841,
15780,
8299,
1007,
1063,
2709,
8299,
1012,
3166,
4697,
10288,
22305,
2063,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.attributeContains | public static ExpectedCondition<Boolean> attributeContains(final WebElement element,
final String attribute,
final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
return getAttributeOrCssValue(element, attribute)
.map(seen -> seen.contains(value))
.orElse(false);
}
@Override
public String toString() {
return String.format("value to contain \"%s\". Current value: \"%s\"", value, currentValue);
}
};
} | java | public static ExpectedCondition<Boolean> attributeContains(final WebElement element,
final String attribute,
final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
return getAttributeOrCssValue(element, attribute)
.map(seen -> seen.contains(value))
.orElse(false);
}
@Override
public String toString() {
return String.format("value to contain \"%s\". Current value: \"%s\"", value, currentValue);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"attributeContains",
"(",
"final",
"WebElement",
"element",
",",
"final",
"String",
"attribute",
",",
"final",
"String",
"value",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"... | An expectation for checking WebElement with given locator has attribute which contains specific
value
@param element used to check its parameters
@param attribute used to define css or html attribute
@param value used as expected attribute value
@return Boolean true when element has css or html attribute which contains the value | [
"An",
"expectation",
"for",
"checking",
"WebElement",
"with",
"given",
"locator",
"has",
"attribute",
"which",
"contains",
"specific",
"value"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1076-L1094 | train | An expectation for checking WebElement that has attribute contains value | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
17961,
8663,
18249,
2015,
1006,
2345,
4773,
12260,
3672,
5783,
1010,
2345,
5164,
17961,
1010,
2345,
5164,
3643,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowSerializationSchema.java | AvroRowSerializationSchema.convertRowToAvroRecord | private GenericRecord convertRowToAvroRecord(Schema schema, Row row) {
final List<Schema.Field> fields = schema.getFields();
final int length = fields.size();
final GenericRecord record = new GenericData.Record(schema);
for (int i = 0; i < length; i++) {
final Schema.Field field = fields.get(i);
record.put(i, convertFlinkType(field.schema(), row.getField(i)));
}
return record;
} | java | private GenericRecord convertRowToAvroRecord(Schema schema, Row row) {
final List<Schema.Field> fields = schema.getFields();
final int length = fields.size();
final GenericRecord record = new GenericData.Record(schema);
for (int i = 0; i < length; i++) {
final Schema.Field field = fields.get(i);
record.put(i, convertFlinkType(field.schema(), row.getField(i)));
}
return record;
} | [
"private",
"GenericRecord",
"convertRowToAvroRecord",
"(",
"Schema",
"schema",
",",
"Row",
"row",
")",
"{",
"final",
"List",
"<",
"Schema",
".",
"Field",
">",
"fields",
"=",
"schema",
".",
"getFields",
"(",
")",
";",
"final",
"int",
"length",
"=",
"fields"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowSerializationSchema.java#L170-L179 | train | Convert a Row to an Avro Record. | [
30522,
2797,
12391,
2890,
27108,
2094,
10463,
10524,
3406,
11431,
29165,
8586,
8551,
1006,
8040,
28433,
8040,
28433,
1010,
5216,
5216,
1007,
1063,
2345,
2862,
1026,
8040,
28433,
1012,
2492,
1028,
4249,
1027,
8040,
28433,
1012,
2131,
15155,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.getAllGroups | public static List<String> getAllGroups(Pattern pattern, CharSequence content) {
return getAllGroups(pattern, content, true);
} | java | public static List<String> getAllGroups(Pattern pattern, CharSequence content) {
return getAllGroups(pattern, content, true);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getAllGroups",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"return",
"getAllGroups",
"(",
"pattern",
",",
"content",
",",
"true",
")",
";",
"}"
] | 获得匹配的字符串匹配到的所有分组
@param pattern 编译后的正则模式
@param content 被匹配的内容
@return 匹配后得到的字符串数组,按照分组顺序依次列出,未匹配到返回空列表,任何一个参数为null返回null
@since 3.1.0 | [
"获得匹配的字符串匹配到的所有分组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L131-L133 | train | Returns a list of all groups that match the given pattern. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
8095,
17058,
2015,
1006,
5418,
5418,
1010,
25869,
3366,
4226,
5897,
4180,
1007,
1063,
2709,
2131,
8095,
17058,
2015,
1006,
5418,
1010,
4180,
1010,
2995,
1007,
1025,
1065,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isBasicType | public static boolean isBasicType(Class<?> clazz) {
if (null == clazz) {
return false;
}
return (clazz.isPrimitive() || isPrimitiveWrapper(clazz));
} | java | public static boolean isBasicType(Class<?> clazz) {
if (null == clazz) {
return false;
}
return (clazz.isPrimitive() || isPrimitiveWrapper(clazz));
} | [
"public",
"static",
"boolean",
"isBasicType",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"clazz",
".",
"isPrimitive",
"(",
")",
"||",
"isPrimitiveWrapper",
"("... | 是否为基本类型(包括包装类和原始类)
@param clazz 类
@return 是否为基本类型 | [
"是否为基本类型(包括包装类和原始类)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L719-L724 | train | Returns true if the given class is a basic type. | [
30522,
2270,
10763,
22017,
20898,
2003,
22083,
2594,
13874,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
18856,
10936,
2480,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
1006,
18856,
10936,
2480,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/GlobalDSFactory.java | GlobalDSFactory.set | synchronized public static DSFactory set(DSFactory customDSFactory) {
if (null != factory) {
if (factory.equals(customDSFactory)) {
return factory;// 数据源工厂不变时返回原数据源工厂
}
// 自定义数据源工厂前关闭之前的数据源
factory.destroy();
}
StaticLog.debug("Custom use [{}] datasource.", customDSFactory.dataSourceName);
factory = customDSFactory;
return factory;
} | java | synchronized public static DSFactory set(DSFactory customDSFactory) {
if (null != factory) {
if (factory.equals(customDSFactory)) {
return factory;// 数据源工厂不变时返回原数据源工厂
}
// 自定义数据源工厂前关闭之前的数据源
factory.destroy();
}
StaticLog.debug("Custom use [{}] datasource.", customDSFactory.dataSourceName);
factory = customDSFactory;
return factory;
} | [
"synchronized",
"public",
"static",
"DSFactory",
"set",
"(",
"DSFactory",
"customDSFactory",
")",
"{",
"if",
"(",
"null",
"!=",
"factory",
")",
"{",
"if",
"(",
"factory",
".",
"equals",
"(",
"customDSFactory",
")",
")",
"{",
"return",
"factory",
";",
"// 数... | 设置全局的数据源工厂<br>
在项目中存在多个连接池库的情况下,我们希望使用低优先级的库时使用此方法自定义之<br>
重新定义全局的数据源工厂此方法可在以下两种情况下调用:
<pre>
1. 在get方法调用前调用此方法来自定义全局的数据源工厂
2. 替换已存在的全局数据源工厂,当已存在时会自动关闭
</pre>
@param customDSFactory 自定义数据源工厂
@return 自定义的数据源工厂 | [
"设置全局的数据源工厂<br",
">",
"在项目中存在多个连接池库的情况下,我们希望使用低优先级的库时使用此方法自定义之<br",
">",
"重新定义全局的数据源工厂此方法可在以下两种情况下调用:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/GlobalDSFactory.java#L66-L78 | train | Sets the DSFactory instance. | [
30522,
25549,
2270,
10763,
16233,
21450,
2275,
1006,
16233,
21450,
7661,
5104,
21450,
1007,
1063,
2065,
1006,
19701,
999,
1027,
4713,
1007,
1063,
2065,
1006,
4713,
1012,
19635,
1006,
7661,
5104,
21450,
1007,
1007,
1063,
2709,
4713,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java | OpenSslSessionStats.accept | public long accept() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionAccept(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long accept() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionAccept(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"accept",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionAccept",
"(",
"context",
".",
"c... | Returns the number of started SSL/TLS handshakes in server mode. | [
"Returns",
"the",
"number",
"of",
"started",
"SSL",
"/",
"TLS",
"handshakes",
"in",
"server",
"mode",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L95-L103 | train | Returns the number of accepted sessions. | [
30522,
2270,
2146,
5138,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
1012,
5219,
6305,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.tryFulfillSlotRequestOrMakeAvailable | private void tryFulfillSlotRequestOrMakeAvailable(AllocatedSlot allocatedSlot) {
Preconditions.checkState(!allocatedSlot.isUsed(), "Provided slot is still in use.");
final PendingRequest pendingRequest = pollMatchingPendingRequest(allocatedSlot);
if (pendingRequest != null) {
log.debug("Fulfilling pending slot request [{}] early with returned slot [{}]",
pendingRequest.getSlotRequestId(), allocatedSlot.getAllocationId());
allocatedSlots.add(pendingRequest.getSlotRequestId(), allocatedSlot);
pendingRequest.getAllocatedSlotFuture().complete(allocatedSlot);
} else {
log.debug("Adding returned slot [{}] to available slots", allocatedSlot.getAllocationId());
availableSlots.add(allocatedSlot, clock.relativeTimeMillis());
}
} | java | private void tryFulfillSlotRequestOrMakeAvailable(AllocatedSlot allocatedSlot) {
Preconditions.checkState(!allocatedSlot.isUsed(), "Provided slot is still in use.");
final PendingRequest pendingRequest = pollMatchingPendingRequest(allocatedSlot);
if (pendingRequest != null) {
log.debug("Fulfilling pending slot request [{}] early with returned slot [{}]",
pendingRequest.getSlotRequestId(), allocatedSlot.getAllocationId());
allocatedSlots.add(pendingRequest.getSlotRequestId(), allocatedSlot);
pendingRequest.getAllocatedSlotFuture().complete(allocatedSlot);
} else {
log.debug("Adding returned slot [{}] to available slots", allocatedSlot.getAllocationId());
availableSlots.add(allocatedSlot, clock.relativeTimeMillis());
}
} | [
"private",
"void",
"tryFulfillSlotRequestOrMakeAvailable",
"(",
"AllocatedSlot",
"allocatedSlot",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"allocatedSlot",
".",
"isUsed",
"(",
")",
",",
"\"Provided slot is still in use.\"",
")",
";",
"final",
"PendingRequ... | Tries to fulfill with the given allocated slot a pending slot request or add the
allocated slot to the set of available slots if no matching request is available.
@param allocatedSlot which shall be returned | [
"Tries",
"to",
"fulfill",
"with",
"the",
"given",
"allocated",
"slot",
"a",
"pending",
"slot",
"request",
"or",
"add",
"the",
"allocated",
"slot",
"to",
"the",
"set",
"of",
"available",
"slots",
"if",
"no",
"matching",
"request",
"is",
"available",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L466-L481 | train | Tries to fulfill the slot request or make available slot. | [
30522,
2797,
11675,
3046,
3993,
8873,
12718,
10994,
2890,
15500,
2953,
2863,
3489,
12462,
11733,
3468,
1006,
11095,
14540,
4140,
11095,
14540,
4140,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
999,
11095,
14540,
4140,
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-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java | RollingSink.setFSConfig | public RollingSink<T> setFSConfig(Configuration config) {
this.fsConfig = new Configuration();
fsConfig.addAll(config);
return this;
} | java | public RollingSink<T> setFSConfig(Configuration config) {
this.fsConfig = new Configuration();
fsConfig.addAll(config);
return this;
} | [
"public",
"RollingSink",
"<",
"T",
">",
"setFSConfig",
"(",
"Configuration",
"config",
")",
"{",
"this",
".",
"fsConfig",
"=",
"new",
"Configuration",
"(",
")",
";",
"fsConfig",
".",
"addAll",
"(",
"config",
")",
";",
"return",
"this",
";",
"}"
] | Specify a custom {@code Configuration} that will be used when creating
the {@link FileSystem} for writing. | [
"Specify",
"a",
"custom",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java#L310-L314 | train | Sets the FS configuration for this sink. | [
30522,
2270,
5291,
11493,
2243,
1026,
1056,
1028,
2275,
10343,
8663,
8873,
2290,
1006,
9563,
9530,
8873,
2290,
1007,
1063,
2023,
1012,
1042,
9363,
2078,
8873,
2290,
1027,
2047,
9563,
1006,
1007,
1025,
1042,
9363,
2078,
8873,
2290,
1012,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.javaScriptThrowsNoExceptions | public static ExpectedCondition<Boolean> javaScriptThrowsNoExceptions(final String javaScript) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
try {
((JavascriptExecutor) driver).executeScript(javaScript);
return true;
} catch (WebDriverException e) {
return false;
}
}
@Override
public String toString() {
return String.format("js %s to be executable", javaScript);
}
};
} | java | public static ExpectedCondition<Boolean> javaScriptThrowsNoExceptions(final String javaScript) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
try {
((JavascriptExecutor) driver).executeScript(javaScript);
return true;
} catch (WebDriverException e) {
return false;
}
}
@Override
public String toString() {
return String.format("js %s to be executable", javaScript);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"javaScriptThrowsNoExceptions",
"(",
"final",
"String",
"javaScript",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"apply",
... | An expectation to check if js executable.
Useful when you know that there should be a Javascript value or something at the stage.
@param javaScript used as executable script
@return true once javaScript executed without errors | [
"An",
"expectation",
"to",
"check",
"if",
"js",
"executable",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1446-L1463 | train | An expectation for checking that a javascript script throws no exceptions. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
9262,
22483,
2705,
10524,
2015,
3630,
10288,
24422,
2015,
1006,
2345,
5164,
9262,
22483,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static void generate(String content, QrConfig config, String imageType, OutputStream out) {
final BufferedImage image = generate(content, config);
ImgUtil.write(image, imageType, out);
} | java | public static void generate(String content, QrConfig config, String imageType, OutputStream out) {
final BufferedImage image = generate(content, config);
ImgUtil.write(image, imageType, out);
} | [
"public",
"static",
"void",
"generate",
"(",
"String",
"content",
",",
"QrConfig",
"config",
",",
"String",
"imageType",
",",
"OutputStream",
"out",
")",
"{",
"final",
"BufferedImage",
"image",
"=",
"generate",
"(",
"content",
",",
"config",
")",
";",
"ImgUt... | 生成二维码到输出流
@param content 文本内容
@param config 二维码配置,包括长、宽、边距、颜色等
@param imageType 图片类型(图片扩展名),见{@link ImgUtil}
@param out 目标流
@since 4.1.2 | [
"生成二维码到输出流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L120-L123 | train | Generates a
image from a string content and QrConfig. | [
30522,
2270,
10763,
11675,
9699,
1006,
5164,
4180,
1010,
1053,
29566,
2078,
8873,
2290,
9530,
8873,
2290,
1010,
5164,
3746,
13874,
1010,
27852,
25379,
2041,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
3746,
1027,
9699,
1006,
4180,
1010,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java | MqttDecoder.decodeFixedHeader | private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) {
short b1 = buffer.readUnsignedByte();
MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4);
boolean dupFlag = (b1 & 0x08) == 0x08;
int qosLevel = (b1 & 0x06) >> 1;
boolean retain = (b1 & 0x01) != 0;
int remainingLength = 0;
int multiplier = 1;
short digit;
int loops = 0;
do {
digit = buffer.readUnsignedByte();
remainingLength += (digit & 127) * multiplier;
multiplier *= 128;
loops++;
} while ((digit & 128) != 0 && loops < 4);
// MQTT protocol limits Remaining Length to 4 bytes
if (loops == 4 && (digit & 128) != 0) {
throw new DecoderException("remaining length exceeds 4 digits (" + messageType + ')');
}
MqttFixedHeader decodedFixedHeader =
new MqttFixedHeader(messageType, dupFlag, MqttQoS.valueOf(qosLevel), retain, remainingLength);
return validateFixedHeader(resetUnusedFields(decodedFixedHeader));
} | java | private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) {
short b1 = buffer.readUnsignedByte();
MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4);
boolean dupFlag = (b1 & 0x08) == 0x08;
int qosLevel = (b1 & 0x06) >> 1;
boolean retain = (b1 & 0x01) != 0;
int remainingLength = 0;
int multiplier = 1;
short digit;
int loops = 0;
do {
digit = buffer.readUnsignedByte();
remainingLength += (digit & 127) * multiplier;
multiplier *= 128;
loops++;
} while ((digit & 128) != 0 && loops < 4);
// MQTT protocol limits Remaining Length to 4 bytes
if (loops == 4 && (digit & 128) != 0) {
throw new DecoderException("remaining length exceeds 4 digits (" + messageType + ')');
}
MqttFixedHeader decodedFixedHeader =
new MqttFixedHeader(messageType, dupFlag, MqttQoS.valueOf(qosLevel), retain, remainingLength);
return validateFixedHeader(resetUnusedFields(decodedFixedHeader));
} | [
"private",
"static",
"MqttFixedHeader",
"decodeFixedHeader",
"(",
"ByteBuf",
"buffer",
")",
"{",
"short",
"b1",
"=",
"buffer",
".",
"readUnsignedByte",
"(",
")",
";",
"MqttMessageType",
"messageType",
"=",
"MqttMessageType",
".",
"valueOf",
"(",
"b1",
">>",
"4",... | Decodes the fixed header. It's one byte for the flags and then variable bytes for the remaining length.
@param buffer the buffer to decode from
@return the fixed header | [
"Decodes",
"the",
"fixed",
"header",
".",
"It",
"s",
"one",
"byte",
"for",
"the",
"flags",
"and",
"then",
"variable",
"bytes",
"for",
"the",
"remaining",
"length",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L145-L171 | train | Decodes a fixed header from the buffer. | [
30522,
2797,
10763,
1049,
4160,
30524,
8569,
2546,
17698,
1007,
1063,
2460,
29491,
1027,
17698,
1012,
3191,
4609,
5332,
19225,
3762,
2618,
1006,
1007,
1025,
1049,
4160,
4779,
7834,
3736,
18150,
18863,
4471,
13874,
1027,
1049,
4160,
4779,
78... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/servlet/MultipartConfigFactory.java | MultipartConfigFactory.convertToBytes | private long convertToBytes(DataSize size, int defaultValue) {
if (size != null && !size.isNegative()) {
return size.toBytes();
}
return defaultValue;
} | java | private long convertToBytes(DataSize size, int defaultValue) {
if (size != null && !size.isNegative()) {
return size.toBytes();
}
return defaultValue;
} | [
"private",
"long",
"convertToBytes",
"(",
"DataSize",
"size",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"size",
"!=",
"null",
"&&",
"!",
"size",
".",
"isNegative",
"(",
")",
")",
"{",
"return",
"size",
".",
"toBytes",
"(",
")",
";",
"}",
"retu... | Return the amount of bytes from the specified {@link DataSize size}. If the size is
{@code null} or negative, returns {@code defaultValue}.
@param size the data size to handle
@param defaultValue the default value if the size is {@code null} or negative
@return the amount of bytes to use | [
"Return",
"the",
"amount",
"of",
"bytes",
"from",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java#L92-L97 | train | Converts data size to bytes. | [
30522,
2797,
2146,
10463,
3406,
3762,
4570,
1006,
2951,
5332,
4371,
2946,
1010,
20014,
12398,
10175,
5657,
1007,
1063,
2065,
1006,
2946,
999,
1027,
19701,
1004,
1004,
999,
2946,
1012,
3475,
29107,
6024,
1006,
1007,
1007,
1063,
2709,
2946,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CompositeByteBuf.java | CompositeByteBuf.consolidateIfNeeded | private void consolidateIfNeeded() {
// Consolidate if the number of components will exceed the allowed maximum by the current
// operation.
int size = componentCount;
if (size > maxNumComponents) {
final int capacity = components[size - 1].endOffset;
ByteBuf consolidated = allocBuffer(capacity);
lastAccessed = null;
// We're not using foreach to avoid creating an iterator.
for (int i = 0; i < size; i ++) {
components[i].transferTo(consolidated);
}
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, size);
}
} | java | private void consolidateIfNeeded() {
// Consolidate if the number of components will exceed the allowed maximum by the current
// operation.
int size = componentCount;
if (size > maxNumComponents) {
final int capacity = components[size - 1].endOffset;
ByteBuf consolidated = allocBuffer(capacity);
lastAccessed = null;
// We're not using foreach to avoid creating an iterator.
for (int i = 0; i < size; i ++) {
components[i].transferTo(consolidated);
}
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, size);
}
} | [
"private",
"void",
"consolidateIfNeeded",
"(",
")",
"{",
"// Consolidate if the number of components will exceed the allowed maximum by the current",
"// operation.",
"int",
"size",
"=",
"componentCount",
";",
"if",
"(",
"size",
">",
"maxNumComponents",
")",
"{",
"final",
"... | This should only be called as last operation from a method as this may adjust the underlying
array of components and so affect the index etc. | [
"This",
"should",
"only",
"be",
"called",
"as",
"last",
"operation",
"from",
"a",
"method",
"as",
"this",
"may",
"adjust",
"the",
"underlying",
"array",
"of",
"components",
"and",
"so",
"affect",
"the",
"index",
"etc",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L520-L538 | train | Consolidate if necessary. | [
30522,
2797,
11675,
24939,
10128,
24045,
5732,
1006,
1007,
1063,
1013,
1013,
24939,
2065,
1996,
2193,
1997,
6177,
2097,
13467,
1996,
3039,
4555,
2011,
1996,
2783,
1013,
1013,
3169,
1012,
20014,
2946,
1027,
6922,
3597,
16671,
1025,
2065,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java | MurmurHashUtil.hashUnsafeBytes | public static int hashUnsafeBytes(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytes(base, offset, lengthInBytes, DEFAULT_SEED);
} | java | public static int hashUnsafeBytes(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytes(base, offset, lengthInBytes, DEFAULT_SEED);
} | [
"public",
"static",
"int",
"hashUnsafeBytes",
"(",
"Object",
"base",
",",
"long",
"offset",
",",
"int",
"lengthInBytes",
")",
"{",
"return",
"hashUnsafeBytes",
"(",
"base",
",",
"offset",
",",
"lengthInBytes",
",",
"DEFAULT_SEED",
")",
";",
"}"
] | Hash unsafe bytes.
@param base base unsafe object
@param offset offset for unsafe object
@param lengthInBytes length in bytes
@return hash code | [
"Hash",
"unsafe",
"bytes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L51-L53 | train | Hash unsafe bytes. | [
30522,
2270,
10763,
20014,
23325,
4609,
3736,
7959,
3762,
4570,
1006,
4874,
2918,
1010,
2146,
16396,
1010,
20014,
3091,
2378,
3762,
4570,
1007,
1063,
2709,
23325,
4609,
3736,
7959,
3762,
4570,
1006,
2918,
1010,
16396,
1010,
3091,
2378,
3762... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/XmlUtil.java | XmlUtil.write | public static void write(Node node, Writer writer, String charset, int indent) {
transform(new DOMSource(node), new StreamResult(writer), charset, indent);
} | java | public static void write(Node node, Writer writer, String charset, int indent) {
transform(new DOMSource(node), new StreamResult(writer), charset, indent);
} | [
"public",
"static",
"void",
"write",
"(",
"Node",
"node",
",",
"Writer",
"writer",
",",
"String",
"charset",
",",
"int",
"indent",
")",
"{",
"transform",
"(",
"new",
"DOMSource",
"(",
"node",
")",
",",
"new",
"StreamResult",
"(",
"writer",
")",
",",
"c... | 将XML文档写出
@param node {@link Node} XML文档节点或文档本身
@param writer 写出的Writer,Writer决定了输出XML的编码
@param charset 编码
@param indent 格式化输出中缩进量,小于1表示不格式化输出
@since 3.0.9 | [
"将XML文档写出"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L324-L326 | train | Write a DOM node to a Writer. | [
30522,
2270,
10763,
11675,
4339,
1006,
13045,
13045,
1010,
3213,
3213,
1010,
5164,
25869,
13462,
1010,
20014,
27427,
4765,
1007,
1063,
10938,
1006,
2047,
14383,
6499,
3126,
3401,
1006,
13045,
1007,
1010,
2047,
5460,
6072,
11314,
1006,
3213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.validateNotEmpty | public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException {
if (isEmpty(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException {
if (isEmpty(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"validateNotEmpty",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"isEmpty",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"ValidateException",
"(",
"errorMsg",
")",... | 验证是否为非空,为空时抛出异常<br>
对于String类型判定是否为empty(null 或 "")<br>
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值,验证通过返回此值,非空值
@throws ValidateException 验证异常 | [
"验证是否为非空,为空时抛出异常<br",
">",
"对于String类型判定是否为empty",
"(",
"null",
"或",
")",
"<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L220-L225 | train | ValidateNotEmpty method. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
9398,
3686,
22074,
27718,
2100,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
2003,
6633,
13876,
2100,
1006,
3643,
1007,
1007,
1063,
5466... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java | EpollEventLoop.remove | void remove(AbstractEpollChannel ch) throws IOException {
assert inEventLoop();
if (ch.isOpen()) {
int fd = ch.socket.intValue();
if (channels.remove(fd) != null) {
// Remove the epoll. This is only needed if it's still open as otherwise it will be automatically
// removed once the file-descriptor is closed.
Native.epollCtlDel(epollFd.intValue(), ch.fd().intValue());
}
}
} | java | void remove(AbstractEpollChannel ch) throws IOException {
assert inEventLoop();
if (ch.isOpen()) {
int fd = ch.socket.intValue();
if (channels.remove(fd) != null) {
// Remove the epoll. This is only needed if it's still open as otherwise it will be automatically
// removed once the file-descriptor is closed.
Native.epollCtlDel(epollFd.intValue(), ch.fd().intValue());
}
}
} | [
"void",
"remove",
"(",
"AbstractEpollChannel",
"ch",
")",
"throws",
"IOException",
"{",
"assert",
"inEventLoop",
"(",
")",
";",
"if",
"(",
"ch",
".",
"isOpen",
"(",
")",
")",
"{",
"int",
"fd",
"=",
"ch",
".",
"socket",
".",
"intValue",
"(",
")",
";",... | Deregister the given epoll from this {@link EventLoop}. | [
"Deregister",
"the",
"given",
"epoll",
"from",
"this",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java#L192-L203 | train | Remove a channel from the list of channels. | [
30522,
11675,
6366,
1006,
10061,
13699,
14511,
26058,
10381,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
2065,
1006,
10381,
1012,
11163,
11837,
1006,
1007,
1007,
1063,
20014,
1042,
2094,
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... |
alibaba/canal | client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/service/HbaseSyncService.java | HbaseSyncService.typeConvert | private static byte[] typeConvert(MappingConfig.ColumnItem columnItem, MappingConfig.HbaseMapping hbaseMapping,
Object value) {
if (value == null) {
return null;
}
byte[] bytes = null;
if (columnItem == null || columnItem.getType() == null || "".equals(columnItem.getType())) {
if (MappingConfig.Mode.STRING == hbaseMapping.getMode()) {
bytes = Bytes.toBytes(value.toString());
} else if (MappingConfig.Mode.NATIVE == hbaseMapping.getMode()) {
bytes = TypeUtil.toBytes(value);
} else if (MappingConfig.Mode.PHOENIX == hbaseMapping.getMode()) {
PhType phType = PhType.getType(value.getClass());
bytes = PhTypeUtil.toBytes(value, phType);
}
} else {
if (hbaseMapping.getMode() == MappingConfig.Mode.STRING) {
bytes = Bytes.toBytes(value.toString());
} else if (hbaseMapping.getMode() == MappingConfig.Mode.NATIVE) {
Type type = Type.getType(columnItem.getType());
bytes = TypeUtil.toBytes(value, type);
} else if (hbaseMapping.getMode() == MappingConfig.Mode.PHOENIX) {
PhType phType = PhType.getType(columnItem.getType());
bytes = PhTypeUtil.toBytes(value, phType);
}
}
return bytes;
} | java | private static byte[] typeConvert(MappingConfig.ColumnItem columnItem, MappingConfig.HbaseMapping hbaseMapping,
Object value) {
if (value == null) {
return null;
}
byte[] bytes = null;
if (columnItem == null || columnItem.getType() == null || "".equals(columnItem.getType())) {
if (MappingConfig.Mode.STRING == hbaseMapping.getMode()) {
bytes = Bytes.toBytes(value.toString());
} else if (MappingConfig.Mode.NATIVE == hbaseMapping.getMode()) {
bytes = TypeUtil.toBytes(value);
} else if (MappingConfig.Mode.PHOENIX == hbaseMapping.getMode()) {
PhType phType = PhType.getType(value.getClass());
bytes = PhTypeUtil.toBytes(value, phType);
}
} else {
if (hbaseMapping.getMode() == MappingConfig.Mode.STRING) {
bytes = Bytes.toBytes(value.toString());
} else if (hbaseMapping.getMode() == MappingConfig.Mode.NATIVE) {
Type type = Type.getType(columnItem.getType());
bytes = TypeUtil.toBytes(value, type);
} else if (hbaseMapping.getMode() == MappingConfig.Mode.PHOENIX) {
PhType phType = PhType.getType(columnItem.getType());
bytes = PhTypeUtil.toBytes(value, phType);
}
}
return bytes;
} | [
"private",
"static",
"byte",
"[",
"]",
"typeConvert",
"(",
"MappingConfig",
".",
"ColumnItem",
"columnItem",
",",
"MappingConfig",
".",
"HbaseMapping",
"hbaseMapping",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"n... | 根据对应的类型进行转换
@param columnItem 列项配置
@param hbaseMapping hbase映射配置
@param value 值
@return 复合字段rowKey | [
"根据对应的类型进行转换"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/service/HbaseSyncService.java#L385-L412 | train | typeConvert Method. | [
30522,
2797,
10763,
24880,
1031,
1033,
2828,
8663,
16874,
1006,
12375,
8663,
8873,
2290,
1012,
5930,
4221,
2213,
5930,
4221,
2213,
1010,
12375,
8663,
8873,
2290,
1012,
1044,
15058,
2863,
14853,
1044,
15058,
2863,
14853,
1010,
4874,
3643,
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-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.socket_text_stream | public PythonDataStream socket_text_stream(String host, int port) {
return new PythonDataStream<>(env.socketTextStream(host, port).map(new AdapterMap<String>()));
} | java | public PythonDataStream socket_text_stream(String host, int port) {
return new PythonDataStream<>(env.socketTextStream(host, port).map(new AdapterMap<String>()));
} | [
"public",
"PythonDataStream",
"socket_text_stream",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"socketTextStream",
"(",
"host",
",",
"port",
")",
".",
"map",
"(",
"new",
"AdapterMap",
"<",... | A thin wrapper layer over {@link StreamExecutionEnvironment#socketTextStream(java.lang.String, int)}.
@param host The host name which a server socket binds
@param port The port number which a server socket binds. A port number of 0 means that the port number is automatically
allocated.
@return A python data stream containing the strings received from the socket | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#socketTextStream",
"(",
"java",
".",
"lang",
".",
"String",
"int",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L200-L202 | train | socket text stream | [
30522,
2270,
18750,
2850,
10230,
25379,
22278,
1035,
3793,
1035,
5460,
1006,
5164,
3677,
1010,
20014,
3417,
1007,
1063,
2709,
2047,
18750,
2850,
10230,
25379,
1026,
1028,
1006,
4372,
2615,
1012,
22278,
18209,
21422,
1006,
3677,
1010,
3417,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.addAndLock | public RetrievableStateHandle<T> addAndLock(
String pathInZooKeeper,
T state) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
checkNotNull(state, "State");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> storeHandle = storage.store(state);
boolean success = false;
try {
// Serialize the state handle. This writes the state to the backend.
byte[] serializedStoreHandle = InstantiationUtil.serializeObject(storeHandle);
// Write state handle (not the actual state) to ZooKeeper. This is expected to be
// smaller than the state itself. This level of indirection makes sure that data in
// ZooKeeper is small, because ZooKeeper is designed for data in the KB range, but
// the state can be larger.
// Create the lock node in a transaction with the actual state node. That way we can prevent
// race conditions with a concurrent delete operation.
client.inTransaction().create().withMode(CreateMode.PERSISTENT).forPath(path, serializedStoreHandle)
.and().create().withMode(CreateMode.EPHEMERAL).forPath(getLockPath(path))
.and().commit();
success = true;
return storeHandle;
}
catch (KeeperException.NodeExistsException e) {
throw new ConcurrentModificationException("ZooKeeper unexpectedly modified", e);
}
finally {
if (!success) {
// Cleanup the state handle if it was not written to ZooKeeper.
if (storeHandle != null) {
storeHandle.discardState();
}
}
}
} | java | public RetrievableStateHandle<T> addAndLock(
String pathInZooKeeper,
T state) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
checkNotNull(state, "State");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> storeHandle = storage.store(state);
boolean success = false;
try {
// Serialize the state handle. This writes the state to the backend.
byte[] serializedStoreHandle = InstantiationUtil.serializeObject(storeHandle);
// Write state handle (not the actual state) to ZooKeeper. This is expected to be
// smaller than the state itself. This level of indirection makes sure that data in
// ZooKeeper is small, because ZooKeeper is designed for data in the KB range, but
// the state can be larger.
// Create the lock node in a transaction with the actual state node. That way we can prevent
// race conditions with a concurrent delete operation.
client.inTransaction().create().withMode(CreateMode.PERSISTENT).forPath(path, serializedStoreHandle)
.and().create().withMode(CreateMode.EPHEMERAL).forPath(getLockPath(path))
.and().commit();
success = true;
return storeHandle;
}
catch (KeeperException.NodeExistsException e) {
throw new ConcurrentModificationException("ZooKeeper unexpectedly modified", e);
}
finally {
if (!success) {
// Cleanup the state handle if it was not written to ZooKeeper.
if (storeHandle != null) {
storeHandle.discardState();
}
}
}
} | [
"public",
"RetrievableStateHandle",
"<",
"T",
">",
"addAndLock",
"(",
"String",
"pathInZooKeeper",
",",
"T",
"state",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"pathInZooKeeper",
",",
"\"Path in ZooKeeper\"",
")",
";",
"checkNotNull",
"(",
"state",
","... | Creates a state handle, stores it in ZooKeeper and locks it. A locked node cannot be removed by
another {@link ZooKeeperStateHandleStore} instance as long as this instance remains connected
to ZooKeeper.
<p><strong>Important</strong>: This will <em>not</em> store the actual state in
ZooKeeper, but create a state handle and store it in ZooKeeper. This level of indirection
makes sure that data in ZooKeeper is small.
<p>The operation will fail if there is already an node under the given path
@param pathInZooKeeper Destination path in ZooKeeper (expected to *not* exist yet)
@param state State to be added
@return The Created {@link RetrievableStateHandle}.
@throws Exception If a ZooKeeper or state handle operation fails | [
"Creates",
"a",
"state",
"handle",
"stores",
"it",
"in",
"ZooKeeper",
"and",
"locks",
"it",
".",
"A",
"locked",
"node",
"cannot",
"be",
"removed",
"by",
"another",
"{",
"@link",
"ZooKeeperStateHandleStore",
"}",
"instance",
"as",
"long",
"as",
"this",
"insta... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L129-L169 | train | Add and lock the given state to ZooKeeper. | [
30522,
2270,
2128,
18886,
13331,
13510,
12259,
11774,
2571,
1026,
1056,
1028,
5587,
5685,
7878,
1006,
5164,
4130,
2378,
23221,
13106,
1010,
1056,
2110,
1007,
11618,
6453,
1063,
4638,
17048,
11231,
3363,
1006,
4130,
2378,
23221,
13106,
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-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.init | public HMac init(String algorithm, byte[] key){
return init(algorithm, (null == key) ? null : new SecretKeySpec(key, algorithm));
} | java | public HMac init(String algorithm, byte[] key){
return init(algorithm, (null == key) ? null : new SecretKeySpec(key, algorithm));
} | [
"public",
"HMac",
"init",
"(",
"String",
"algorithm",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"return",
"init",
"(",
"algorithm",
",",
"(",
"null",
"==",
"key",
")",
"?",
"null",
":",
"new",
"SecretKeySpec",
"(",
"key",
",",
"algorithm",
")",
")",
... | 初始化
@param algorithm 算法
@param key 密钥
@return {@link HMac}
@throws CryptoException Cause by IOException | [
"初始化"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L69-L71 | train | Initializes the HMac with the given algorithm and key. | [
30522,
2270,
20287,
6305,
1999,
4183,
1006,
5164,
9896,
1010,
24880,
1031,
1033,
3145,
1007,
1063,
2709,
1999,
4183,
1006,
9896,
1010,
1006,
19701,
1027,
1027,
3145,
1007,
1029,
19701,
1024,
2047,
3595,
14839,
13102,
8586,
1006,
3145,
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/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.deleteRecursively | public static void deleteRecursively(File file, FilenameFilter filter) throws IOException {
if (file == null) { return; }
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
if (SystemUtils.IS_OS_UNIX && filter == null) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
} catch (IOException e) {
logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
"Falling back to Java IO way", file.getAbsolutePath(), e);
}
}
deleteRecursivelyUsingJavaIO(file, filter);
} | java | public static void deleteRecursively(File file, FilenameFilter filter) throws IOException {
if (file == null) { return; }
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
if (SystemUtils.IS_OS_UNIX && filter == null) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
} catch (IOException e) {
logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
"Falling back to Java IO way", file.getAbsolutePath(), e);
}
}
deleteRecursivelyUsingJavaIO(file, filter);
} | [
"public",
"static",
"void",
"deleteRecursively",
"(",
"File",
"file",
",",
"FilenameFilter",
"filter",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// On Unix systems, use operating system command to run faster",
... | Delete a file or directory and its contents recursively.
Don't follow directories if they are symlinks.
@param file Input file / dir to be deleted
@param filter A filename filter that make sure only files / dirs with the satisfied filenames
are deleted.
@throws IOException if deletion is unsuccessful | [
"Delete",
"a",
"file",
"or",
"directory",
"and",
"its",
"contents",
"recursively",
".",
"Don",
"t",
"follow",
"directories",
"if",
"they",
"are",
"symlinks",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L103-L119 | train | Delete the file recursively. | [
30522,
2270,
10763,
11675,
3972,
15141,
8586,
9236,
14547,
1006,
5371,
5371,
1010,
5371,
18442,
8873,
21928,
11307,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
5371,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.getSessionLog | public synchronized LogEntries getSessionLog(SessionId sessionId) throws IOException {
List<LogEntry> entries = new ArrayList<>();
for (LogRecord record : records(sessionId)) {
if (record.getLevel().intValue() >= serverLogLevel.intValue())
entries.add(new LogEntry(record.getLevel(), record.getMillis(), record.getMessage()));
}
return new LogEntries(entries);
} | java | public synchronized LogEntries getSessionLog(SessionId sessionId) throws IOException {
List<LogEntry> entries = new ArrayList<>();
for (LogRecord record : records(sessionId)) {
if (record.getLevel().intValue() >= serverLogLevel.intValue())
entries.add(new LogEntry(record.getLevel(), record.getMillis(), record.getMessage()));
}
return new LogEntries(entries);
} | [
"public",
"synchronized",
"LogEntries",
"getSessionLog",
"(",
"SessionId",
"sessionId",
")",
"throws",
"IOException",
"{",
"List",
"<",
"LogEntry",
">",
"entries",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"LogRecord",
"record",
":",
"records",... | Returns the server log for the given session id.
@param sessionId The session id.
@return The available server log entries for the session.
@throws IOException If there was a problem reading from file. | [
"Returns",
"the",
"server",
"log",
"for",
"the",
"given",
"session",
"id",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L220-L227 | train | Gets the session log. | [
30522,
2270,
25549,
8833,
4765,
5134,
4152,
7971,
3258,
21197,
1006,
5219,
3593,
5219,
3593,
1007,
11618,
22834,
10288,
24422,
1063,
2862,
1026,
8833,
4765,
2854,
1028,
10445,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2005,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java | ClassScaner.scanPackageBySuper | public static Set<Class<?>> scanPackageBySuper(String packageName, final Class<?> superClass) {
return scanPackage(packageName, new Filter<Class<?>>() {
@Override
public boolean accept(Class<?> clazz) {
return superClass.isAssignableFrom(clazz) && !superClass.equals(clazz);
}
});
} | java | public static Set<Class<?>> scanPackageBySuper(String packageName, final Class<?> superClass) {
return scanPackage(packageName, new Filter<Class<?>>() {
@Override
public boolean accept(Class<?> clazz) {
return superClass.isAssignableFrom(clazz) && !superClass.equals(clazz);
}
});
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scanPackageBySuper",
"(",
"String",
"packageName",
",",
"final",
"Class",
"<",
"?",
">",
"superClass",
")",
"{",
"return",
"scanPackage",
"(",
"packageName",
",",
"new",
"Filter",
"<",
"Class",
... | 扫描指定包路径下所有指定类或接口的子类或实现类
@param packageName 包路径
@param superClass 父类或接口
@return 类集合 | [
"扫描指定包路径下所有指定类或接口的子类或实现类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L74-L81 | train | Scans a package for classes that are assignable from the given super class. | [
30522,
2270,
10763,
2275,
1026,
2465,
1026,
1029,
1028,
1028,
13594,
23947,
4270,
3762,
6342,
4842,
1006,
5164,
7427,
18442,
1010,
2345,
2465,
1026,
1029,
1028,
3565,
26266,
1007,
1063,
2709,
13594,
23947,
4270,
1006,
7427,
18442,
1010,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java | DeferredLog.replayTo | public void replayTo(Log destination) {
synchronized (this.lines) {
for (Line line : this.lines) {
logTo(destination, line.getLevel(), line.getMessage(),
line.getThrowable());
}
this.lines.clear();
}
} | java | public void replayTo(Log destination) {
synchronized (this.lines) {
for (Line line : this.lines) {
logTo(destination, line.getLevel(), line.getMessage(),
line.getThrowable());
}
this.lines.clear();
}
} | [
"public",
"void",
"replayTo",
"(",
"Log",
"destination",
")",
"{",
"synchronized",
"(",
"this",
".",
"lines",
")",
"{",
"for",
"(",
"Line",
"line",
":",
"this",
".",
"lines",
")",
"{",
"logTo",
"(",
"destination",
",",
"line",
".",
"getLevel",
"(",
"... | Replay deferred logging to the specified destination.
@param destination the destination for the deferred log messages | [
"Replay",
"deferred",
"logging",
"to",
"the",
"specified",
"destination",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java#L184-L192 | train | Replay the log to the specified destination. | [
30522,
2270,
11675,
15712,
3406,
1006,
8833,
7688,
1007,
1063,
25549,
1006,
2023,
1012,
3210,
1007,
1063,
2005,
1006,
2240,
2240,
1024,
2023,
1012,
3210,
1007,
1063,
8833,
3406,
1006,
7688,
1010,
2240,
1012,
2131,
20414,
2884,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.append | public void append(final String str) {
final String s = str != null ? str : "null";
final int strlen = s.length();
final int newlen = this.len + strlen;
if (newlen > this.array.length) {
expand(newlen);
}
s.getChars(0, strlen, this.array, this.len);
this.len = newlen;
} | java | public void append(final String str) {
final String s = str != null ? str : "null";
final int strlen = s.length();
final int newlen = this.len + strlen;
if (newlen > this.array.length) {
expand(newlen);
}
s.getChars(0, strlen, this.array, this.len);
this.len = newlen;
} | [
"public",
"void",
"append",
"(",
"final",
"String",
"str",
")",
"{",
"final",
"String",
"s",
"=",
"str",
"!=",
"null",
"?",
"str",
":",
"\"null\"",
";",
"final",
"int",
"strlen",
"=",
"s",
".",
"length",
"(",
")",
";",
"final",
"int",
"newlen",
"="... | Appends chars of the given string to this buffer. The capacity of the
buffer is increased, if necessary, to accommodate all chars.
@param str the string. | [
"Appends",
"chars",
"of",
"the",
"given",
"string",
"to",
"this",
"buffer",
".",
"The",
"capacity",
"of",
"the",
"buffer",
"is",
"increased",
"if",
"necessary",
"to",
"accommodate",
"all",
"chars",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L102-L111 | train | Append a string to the end of the array. | [
30522,
2270,
11675,
10439,
10497,
1006,
2345,
5164,
2358,
2099,
1007,
1063,
2345,
5164,
1055,
1027,
2358,
2099,
999,
1027,
19701,
1029,
2358,
2099,
1024,
1000,
19701,
1000,
1025,
2345,
20014,
2358,
20927,
2078,
1027,
1055,
1012,
3091,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.getFileUpload | protected InterfaceHttpData getFileUpload(String delimiter) {
// eventually restart from existing FileUpload
// Now get value according to Content-Type and Charset
Attribute encoding = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TRANSFER_ENCODING);
Charset localCharset = charset;
// Default
TransferEncodingMechanism mechanism = TransferEncodingMechanism.BIT7;
if (encoding != null) {
String code;
try {
code = encoding.getValue().toLowerCase();
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
}
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value())) {
localCharset = CharsetUtil.US_ASCII;
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value())) {
localCharset = CharsetUtil.ISO_8859_1;
mechanism = TransferEncodingMechanism.BIT8;
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
// no real charset, so let the default
mechanism = TransferEncodingMechanism.BINARY;
} else {
throw new ErrorDataDecoderException("TransferEncoding Unknown: " + code);
}
}
Attribute charsetAttribute = currentFieldAttributes.get(HttpHeaderValues.CHARSET);
if (charsetAttribute != null) {
try {
localCharset = Charset.forName(charsetAttribute.getValue());
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
} catch (UnsupportedCharsetException e) {
throw new ErrorDataDecoderException(e);
}
}
if (currentFileUpload == null) {
Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME);
Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);
Attribute contentTypeAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TYPE);
Attribute lengthAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_LENGTH);
long size;
try {
size = lengthAttribute != null ? Long.parseLong(lengthAttribute.getValue()) : 0L;
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
} catch (NumberFormatException ignored) {
size = 0;
}
try {
String contentType;
if (contentTypeAttribute != null) {
contentType = contentTypeAttribute.getValue();
} else {
contentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE;
}
currentFileUpload = factory.createFileUpload(request,
cleanString(nameAttribute.getValue()), cleanString(filenameAttribute.getValue()),
contentType, mechanism.value(), localCharset,
size);
} catch (NullPointerException e) {
throw new ErrorDataDecoderException(e);
} catch (IllegalArgumentException e) {
throw new ErrorDataDecoderException(e);
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
}
}
// load data as much as possible
if (!loadDataMultipart(undecodedChunk, delimiter, currentFileUpload)) {
// Delimiter is not found. Need more chunks.
return null;
}
if (currentFileUpload.isCompleted()) {
// ready to load the next one
if (currentStatus == MultiPartStatus.FILEUPLOAD) {
currentStatus = MultiPartStatus.HEADERDELIMITER;
currentFieldAttributes = null;
} else {
currentStatus = MultiPartStatus.MIXEDDELIMITER;
cleanMixedAttributes();
}
FileUpload fileUpload = currentFileUpload;
currentFileUpload = null;
return fileUpload;
}
// do not change the buffer position
// since some can be already saved into FileUpload
// So do not change the currentStatus
return null;
} | java | protected InterfaceHttpData getFileUpload(String delimiter) {
// eventually restart from existing FileUpload
// Now get value according to Content-Type and Charset
Attribute encoding = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TRANSFER_ENCODING);
Charset localCharset = charset;
// Default
TransferEncodingMechanism mechanism = TransferEncodingMechanism.BIT7;
if (encoding != null) {
String code;
try {
code = encoding.getValue().toLowerCase();
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
}
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value())) {
localCharset = CharsetUtil.US_ASCII;
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value())) {
localCharset = CharsetUtil.ISO_8859_1;
mechanism = TransferEncodingMechanism.BIT8;
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
// no real charset, so let the default
mechanism = TransferEncodingMechanism.BINARY;
} else {
throw new ErrorDataDecoderException("TransferEncoding Unknown: " + code);
}
}
Attribute charsetAttribute = currentFieldAttributes.get(HttpHeaderValues.CHARSET);
if (charsetAttribute != null) {
try {
localCharset = Charset.forName(charsetAttribute.getValue());
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
} catch (UnsupportedCharsetException e) {
throw new ErrorDataDecoderException(e);
}
}
if (currentFileUpload == null) {
Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME);
Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);
Attribute contentTypeAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TYPE);
Attribute lengthAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_LENGTH);
long size;
try {
size = lengthAttribute != null ? Long.parseLong(lengthAttribute.getValue()) : 0L;
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
} catch (NumberFormatException ignored) {
size = 0;
}
try {
String contentType;
if (contentTypeAttribute != null) {
contentType = contentTypeAttribute.getValue();
} else {
contentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE;
}
currentFileUpload = factory.createFileUpload(request,
cleanString(nameAttribute.getValue()), cleanString(filenameAttribute.getValue()),
contentType, mechanism.value(), localCharset,
size);
} catch (NullPointerException e) {
throw new ErrorDataDecoderException(e);
} catch (IllegalArgumentException e) {
throw new ErrorDataDecoderException(e);
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
}
}
// load data as much as possible
if (!loadDataMultipart(undecodedChunk, delimiter, currentFileUpload)) {
// Delimiter is not found. Need more chunks.
return null;
}
if (currentFileUpload.isCompleted()) {
// ready to load the next one
if (currentStatus == MultiPartStatus.FILEUPLOAD) {
currentStatus = MultiPartStatus.HEADERDELIMITER;
currentFieldAttributes = null;
} else {
currentStatus = MultiPartStatus.MIXEDDELIMITER;
cleanMixedAttributes();
}
FileUpload fileUpload = currentFileUpload;
currentFileUpload = null;
return fileUpload;
}
// do not change the buffer position
// since some can be already saved into FileUpload
// So do not change the currentStatus
return null;
} | [
"protected",
"InterfaceHttpData",
"getFileUpload",
"(",
"String",
"delimiter",
")",
"{",
"// eventually restart from existing FileUpload",
"// Now get value according to Content-Type and Charset",
"Attribute",
"encoding",
"=",
"currentFieldAttributes",
".",
"get",
"(",
"HttpHeaderN... | Get the FileUpload (new one or current one)
@param delimiter
the delimiter to use
@return the InterfaceHttpData if any
@throws ErrorDataDecoderException | [
"Get",
"the",
"FileUpload",
"(",
"new",
"one",
"or",
"current",
"one",
")"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L838-L928 | train | Gets the file upload data. | [
30522,
5123,
8278,
11039,
25856,
2850,
2696,
2131,
8873,
2571,
6279,
11066,
1006,
5164,
3972,
27605,
3334,
1007,
1063,
1013,
1013,
2776,
23818,
30524,
2015,
1012,
4180,
1035,
4651,
1035,
17181,
1007,
1025,
25869,
13462,
2334,
7507,
22573,
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-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java | BaseAsymmetric.initKeys | @SuppressWarnings("unchecked")
public T initKeys() {
KeyPair keyPair = SecureUtil.generateKeyPair(this.algorithm);
this.publicKey = keyPair.getPublic();
this.privateKey = keyPair.getPrivate();
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T initKeys() {
KeyPair keyPair = SecureUtil.generateKeyPair(this.algorithm);
this.publicKey = keyPair.getPublic();
this.privateKey = keyPair.getPrivate();
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"initKeys",
"(",
")",
"{",
"KeyPair",
"keyPair",
"=",
"SecureUtil",
".",
"generateKeyPair",
"(",
"this",
".",
"algorithm",
")",
";",
"this",
".",
"publicKey",
"=",
"keyPair",
".",
"getPublic"... | 生成公钥和私钥
@return this | [
"生成公钥和私钥"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java#L80-L86 | train | Initializes the public and private key of the object. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1056,
1999,
4183,
14839,
2015,
1006,
1007,
1063,
3145,
4502,
4313,
3145,
4502,
4313,
1027,
5851,
21823,
2140,
1012,
9699,
14839,
4502,
4313,
1006,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java | RMatGraph.setConstants | public RMatGraph<T> setConstants(float a, float b, float c) {
Preconditions.checkArgument(a >= 0.0f && b >= 0.0f && c >= 0.0f && a + b + c <= 1.0f,
"RMat parameters A, B, and C must be non-negative and sum to less than or equal to one");
this.a = a;
this.b = b;
this.c = c;
return this;
} | java | public RMatGraph<T> setConstants(float a, float b, float c) {
Preconditions.checkArgument(a >= 0.0f && b >= 0.0f && c >= 0.0f && a + b + c <= 1.0f,
"RMat parameters A, B, and C must be non-negative and sum to less than or equal to one");
this.a = a;
this.b = b;
this.c = c;
return this;
} | [
"public",
"RMatGraph",
"<",
"T",
">",
"setConstants",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"a",
">=",
"0.0f",
"&&",
"b",
">=",
"0.0f",
"&&",
"c",
">=",
"0.0f",
"&&",
"a",
"+"... | The parameters for recursively subdividing the adjacency matrix.
<p>Setting A = B = C = 0.25 emulates the Erdős–Rényi model.
<p>Graph500 uses A = 0.57, B = C = 0.19.
@param a likelihood of source bit = 0, target bit = 0
@param b likelihood of source bit = 0, target bit = 1
@param c likelihood of source bit = 1, target bit = 0
@return this | [
"The",
"parameters",
"for",
"recursively",
"subdividing",
"the",
"adjacency",
"matrix",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java#L112-L121 | train | Sets the constant values of the RMatGraph. | [
30522,
2270,
28549,
4017,
14413,
1026,
1056,
1028,
2275,
8663,
12693,
3215,
1006,
14257,
1037,
1010,
14257,
1038,
1010,
14257,
1039,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
1037,
1028,
1027,
1014,
1012,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java | MiniCluster.shutDownResourceManagerComponents | @GuardedBy("lock")
private CompletableFuture<Void> shutDownResourceManagerComponents() {
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(dispatcherResourceManagerComponents.size());
for (DispatcherResourceManagerComponent<?> dispatcherResourceManagerComponent : dispatcherResourceManagerComponents) {
terminationFutures.add(dispatcherResourceManagerComponent.closeAsync());
}
final FutureUtils.ConjunctFuture<Void> dispatcherTerminationFuture = FutureUtils.completeAll(terminationFutures);
return FutureUtils.runAfterwards(
dispatcherTerminationFuture,
() -> {
Exception exception = null;
synchronized (lock) {
if (resourceManagerLeaderRetriever != null) {
try {
resourceManagerLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
resourceManagerLeaderRetriever = null;
}
if (dispatcherLeaderRetriever != null) {
try {
dispatcherLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
dispatcherLeaderRetriever = null;
}
if (webMonitorLeaderRetrievalService != null) {
try {
webMonitorLeaderRetrievalService.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
webMonitorLeaderRetrievalService = null;
}
}
if (exception != null) {
throw exception;
}
});
} | java | @GuardedBy("lock")
private CompletableFuture<Void> shutDownResourceManagerComponents() {
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(dispatcherResourceManagerComponents.size());
for (DispatcherResourceManagerComponent<?> dispatcherResourceManagerComponent : dispatcherResourceManagerComponents) {
terminationFutures.add(dispatcherResourceManagerComponent.closeAsync());
}
final FutureUtils.ConjunctFuture<Void> dispatcherTerminationFuture = FutureUtils.completeAll(terminationFutures);
return FutureUtils.runAfterwards(
dispatcherTerminationFuture,
() -> {
Exception exception = null;
synchronized (lock) {
if (resourceManagerLeaderRetriever != null) {
try {
resourceManagerLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
resourceManagerLeaderRetriever = null;
}
if (dispatcherLeaderRetriever != null) {
try {
dispatcherLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
dispatcherLeaderRetriever = null;
}
if (webMonitorLeaderRetrievalService != null) {
try {
webMonitorLeaderRetrievalService.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
webMonitorLeaderRetrievalService = null;
}
}
if (exception != null) {
throw exception;
}
});
} | [
"@",
"GuardedBy",
"(",
"\"lock\"",
")",
"private",
"CompletableFuture",
"<",
"Void",
">",
"shutDownResourceManagerComponents",
"(",
")",
"{",
"final",
"Collection",
"<",
"CompletableFuture",
"<",
"Void",
">",
">",
"terminationFutures",
"=",
"new",
"ArrayList",
"<>... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L739-L791 | train | Shuts down all the resource manager components. | [
30522,
1030,
13802,
3762,
1006,
1000,
5843,
1000,
1007,
2797,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
3844,
7698,
6072,
8162,
3401,
24805,
4590,
9006,
29513,
7666,
1006,
1007,
1063,
2345,
3074,
1026,
4012,
10814,
10880,
11263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/types/valuearray/IntValueArray.java | IntValueArray.compareTo | @Override
public int compareTo(ValueArray<IntValue> o) {
IntValueArray other = (IntValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Integer.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | java | @Override
public int compareTo(ValueArray<IntValue> o) {
IntValueArray other = (IntValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Integer.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"IntValue",
">",
"o",
")",
"{",
"IntValueArray",
"other",
"=",
"(",
"IntValueArray",
")",
"o",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"position",
",",
"other",
".",
"posit... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/IntValueArray.java#L224-L238 | train | Compares two IntValueArrays. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
20014,
10175,
5657,
1028,
1051,
1007,
1063,
20014,
10175,
5657,
2906,
9447,
2060,
1027,
30524,
1007,
1063,
20014,
4642,
2361,
1027,
16109,
1012,
12826,
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-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getLong | public Long getLong(String key, String group, Long defaultValue) {
return Convert.toLong(getByGroup(key, group), defaultValue);
} | java | public Long getLong(String key, String group, Long defaultValue) {
return Convert.toLong(getByGroup(key, group), defaultValue);
} | [
"public",
"Long",
"getLong",
"(",
"String",
"key",
",",
"String",
"group",
",",
"Long",
"defaultValue",
")",
"{",
"return",
"Convert",
".",
"toLong",
"(",
"getByGroup",
"(",
"key",
",",
"group",
")",
",",
"defaultValue",
")",
";",
"}"
] | 获取long类型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值 | [
"获取long类型属性值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L212-L214 | train | Get a Long value from the database by key and group. | [
30522,
2270,
2146,
2131,
10052,
1006,
5164,
3145,
1010,
5164,
2177,
1010,
2146,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1012,
2000,
10052,
1006,
2131,
3762,
17058,
1006,
3145,
1010,
2177,
1007,
1010,
12398,
10175,
5657,
1007,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/TupleComparatorBase.java | TupleComparatorBase.privateDuplicate | protected void privateDuplicate(TupleComparatorBase<T> toClone) {
// copy fields and serializer factories
this.keyPositions = toClone.keyPositions;
this.serializers = new TypeSerializer[toClone.serializers.length];
for (int i = 0; i < toClone.serializers.length; i++) {
this.serializers[i] = toClone.serializers[i].duplicate();
}
this.comparators = new TypeComparator[toClone.comparators.length];
for (int i = 0; i < toClone.comparators.length; i++) {
this.comparators[i] = toClone.comparators[i].duplicate();
}
this.normalizedKeyLengths = toClone.normalizedKeyLengths;
this.numLeadingNormalizableKeys = toClone.numLeadingNormalizableKeys;
this.normalizableKeyPrefixLen = toClone.normalizableKeyPrefixLen;
this.invertNormKey = toClone.invertNormKey;
} | java | protected void privateDuplicate(TupleComparatorBase<T> toClone) {
// copy fields and serializer factories
this.keyPositions = toClone.keyPositions;
this.serializers = new TypeSerializer[toClone.serializers.length];
for (int i = 0; i < toClone.serializers.length; i++) {
this.serializers[i] = toClone.serializers[i].duplicate();
}
this.comparators = new TypeComparator[toClone.comparators.length];
for (int i = 0; i < toClone.comparators.length; i++) {
this.comparators[i] = toClone.comparators[i].duplicate();
}
this.normalizedKeyLengths = toClone.normalizedKeyLengths;
this.numLeadingNormalizableKeys = toClone.numLeadingNormalizableKeys;
this.normalizableKeyPrefixLen = toClone.normalizableKeyPrefixLen;
this.invertNormKey = toClone.invertNormKey;
} | [
"protected",
"void",
"privateDuplicate",
"(",
"TupleComparatorBase",
"<",
"T",
">",
"toClone",
")",
"{",
"// copy fields and serializer factories",
"this",
".",
"keyPositions",
"=",
"toClone",
".",
"keyPositions",
";",
"this",
".",
"serializers",
"=",
"new",
"TypeSe... | ScalaTupleComparator | [
"ScalaTupleComparator"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/TupleComparatorBase.java#L117-L135 | train | Duplicate the fields of the tuple comparator. | [
30522,
5123,
11675,
2797,
8566,
24759,
24695,
1006,
10722,
10814,
9006,
28689,
4263,
15058,
1026,
1056,
1028,
2000,
20464,
5643,
1007,
1063,
1013,
1013,
6100,
4249,
1998,
7642,
17629,
11123,
2023,
1012,
3145,
26994,
2015,
1027,
2000,
20464,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TFetchResultsReq.java | TFetchResultsReq.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case OPERATION_HANDLE:
return isSetOperationHandle();
case ORIENTATION:
return isSetOrientation();
case MAX_ROWS:
return isSetMaxRows();
case FETCH_TYPE:
return isSetFetchType();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case OPERATION_HANDLE:
return isSetOperationHandle();
case ORIENTATION:
return isSetOrientation();
case MAX_ROWS:
return isSetMaxRows();
case FETCH_TYPE:
return isSetFetchType();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"OPERATION_HANDLE",
":",
"return",
"isS... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TFetchResultsReq.java#L347-L363 | train | Checks if field is set to a value of a CRAS_CORRECT_ELEMENT_SPECIFIC | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
3169... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java | HttpTunnelPayload.toHexString | public String toHexString() {
byte[] bytes = this.data.array();
char[] hex = new char[this.data.remaining() * 2];
for (int i = this.data.position(); i < this.data.remaining(); i++) {
int b = bytes[i] & 0xFF;
hex[i * 2] = HEX_CHARS[b >>> 4];
hex[i * 2 + 1] = HEX_CHARS[b & 0x0F];
}
return new String(hex);
} | java | public String toHexString() {
byte[] bytes = this.data.array();
char[] hex = new char[this.data.remaining() * 2];
for (int i = this.data.position(); i < this.data.remaining(); i++) {
int b = bytes[i] & 0xFF;
hex[i * 2] = HEX_CHARS[b >>> 4];
hex[i * 2 + 1] = HEX_CHARS[b & 0x0F];
}
return new String(hex);
} | [
"public",
"String",
"toHexString",
"(",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"this",
".",
"data",
".",
"array",
"(",
")",
";",
"char",
"[",
"]",
"hex",
"=",
"new",
"char",
"[",
"this",
".",
"data",
".",
"remaining",
"(",
")",
"*",
"2",
"]"... | Return the payload as a hexadecimal string.
@return the payload as a hex string | [
"Return",
"the",
"payload",
"as",
"a",
"hexadecimal",
"string",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java#L175-L184 | train | Converts the data in this buffer to a hex string. | [
30522,
2270,
5164,
2000,
5369,
2595,
3367,
4892,
1006,
1007,
1063,
24880,
1031,
1033,
27507,
1027,
2023,
1012,
2951,
1012,
9140,
1006,
1007,
1025,
25869,
1031,
1033,
2002,
2595,
1027,
2047,
25869,
1031,
2023,
1012,
2951,
1012,
3588,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java | EventSerializer.toBuffer | public static Buffer toBuffer(AbstractEvent event) throws IOException {
final ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event);
MemorySegment data = MemorySegmentFactory.wrap(serializedEvent.array());
final Buffer buffer = new NetworkBuffer(data, FreeingBufferRecycler.INSTANCE, false);
buffer.setSize(serializedEvent.remaining());
return buffer;
} | java | public static Buffer toBuffer(AbstractEvent event) throws IOException {
final ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event);
MemorySegment data = MemorySegmentFactory.wrap(serializedEvent.array());
final Buffer buffer = new NetworkBuffer(data, FreeingBufferRecycler.INSTANCE, false);
buffer.setSize(serializedEvent.remaining());
return buffer;
} | [
"public",
"static",
"Buffer",
"toBuffer",
"(",
"AbstractEvent",
"event",
")",
"throws",
"IOException",
"{",
"final",
"ByteBuffer",
"serializedEvent",
"=",
"EventSerializer",
".",
"toSerializedEvent",
"(",
"event",
")",
";",
"MemorySegment",
"data",
"=",
"MemorySegme... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java#L276-L285 | train | Converts an event to a buffer. | [
30522,
2270,
10763,
17698,
2000,
8569,
12494,
1006,
10061,
18697,
3372,
2724,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
24880,
8569,
12494,
27289,
18697,
3372,
1027,
2824,
11610,
28863,
1012,
2000,
8043,
4818,
3550,
18697,
3372,
30524,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java | SM2.getCipherParameters | private CipherParameters getCipherParameters(KeyType keyType) {
switch (keyType) {
case PublicKey:
return this.publicKeyParams;
case PrivateKey:
return this.privateKeyParams;
}
return null;
} | java | private CipherParameters getCipherParameters(KeyType keyType) {
switch (keyType) {
case PublicKey:
return this.publicKeyParams;
case PrivateKey:
return this.privateKeyParams;
}
return null;
} | [
"private",
"CipherParameters",
"getCipherParameters",
"(",
"KeyType",
"keyType",
")",
"{",
"switch",
"(",
"keyType",
")",
"{",
"case",
"PublicKey",
":",
"return",
"this",
".",
"publicKeyParams",
";",
"case",
"PrivateKey",
":",
"return",
"this",
".",
"privateKeyP... | 获取密钥类型对应的加密参数对象{@link CipherParameters}
@param keyType Key类型枚举,包括私钥或公钥
@return {@link CipherParameters} | [
"获取密钥类型对应的加密参数对象",
"{",
"@link",
"CipherParameters",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L278-L287 | train | Returns the CipherParameters object for the specified key type. | [
30522,
2797,
27715,
28689,
22828,
2015,
2131,
6895,
27921,
28689,
22828,
2015,
1006,
3145,
13874,
3145,
13874,
1007,
1063,
6942,
1006,
3145,
13874,
1007,
1063,
2553,
2270,
14839,
1024,
2709,
2023,
1012,
2270,
14839,
28689,
5244,
1025,
2553,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.putAll | public GroupedMap putAll(String group, Map<? extends String, ? extends String> m) {
for (Entry<? extends String, ? extends String> entry : m.entrySet()) {
this.put(group, entry.getKey(), entry.getValue());
}
return this;
} | java | public GroupedMap putAll(String group, Map<? extends String, ? extends String> m) {
for (Entry<? extends String, ? extends String> entry : m.entrySet()) {
this.put(group, entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"GroupedMap",
"putAll",
"(",
"String",
"group",
",",
"Map",
"<",
"?",
"extends",
"String",
",",
"?",
"extends",
"String",
">",
"m",
")",
"{",
"for",
"(",
"Entry",
"<",
"?",
"extends",
"String",
",",
"?",
"extends",
"String",
">",
"entry",
"... | 加入多个键值对到某个分组下
@param group 分组
@param m 键值对
@return this | [
"加入多个键值对到某个分组下"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L112-L117 | train | Adds all entries from the given map to this map. | [
30522,
2270,
15131,
2863,
2361,
2404,
8095,
1006,
5164,
2177,
1010,
4949,
1026,
1029,
8908,
5164,
1010,
1029,
8908,
5164,
1028,
1049,
1007,
1063,
2005,
1006,
4443,
1026,
1029,
8908,
5164,
1010,
1029,
8908,
5164,
1028,
4443,
1024,
1049,
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... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java | UnixResolverDnsServerAddressStreamProvider.parseEtcResolverFirstNdots | static int parseEtcResolverFirstNdots(File etcResolvConf) throws IOException {
FileReader fr = new FileReader(etcResolvConf);
BufferedReader br = null;
try {
br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith(OPTIONS_ROW_LABEL)) {
int i = line.indexOf(NDOTS_LABEL);
if (i >= 0) {
i += NDOTS_LABEL.length();
final int j = line.indexOf(' ', i);
return Integer.parseInt(line.substring(i, j < 0 ? line.length() : j));
}
break;
}
}
} finally {
if (br == null) {
fr.close();
} else {
br.close();
}
}
return DEFAULT_NDOTS;
} | java | static int parseEtcResolverFirstNdots(File etcResolvConf) throws IOException {
FileReader fr = new FileReader(etcResolvConf);
BufferedReader br = null;
try {
br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith(OPTIONS_ROW_LABEL)) {
int i = line.indexOf(NDOTS_LABEL);
if (i >= 0) {
i += NDOTS_LABEL.length();
final int j = line.indexOf(' ', i);
return Integer.parseInt(line.substring(i, j < 0 ? line.length() : j));
}
break;
}
}
} finally {
if (br == null) {
fr.close();
} else {
br.close();
}
}
return DEFAULT_NDOTS;
} | [
"static",
"int",
"parseEtcResolverFirstNdots",
"(",
"File",
"etcResolvConf",
")",
"throws",
"IOException",
"{",
"FileReader",
"fr",
"=",
"new",
"FileReader",
"(",
"etcResolvConf",
")",
";",
"BufferedReader",
"br",
"=",
"null",
";",
"try",
"{",
"br",
"=",
"new"... | Parse a file of the format <a href="https://linux.die.net/man/5/resolver">/etc/resolv.conf</a> and return the
value corresponding to the first ndots in an options configuration.
@param etcResolvConf a file of the format <a href="https://linux.die.net/man/5/resolver">/etc/resolv.conf</a>.
@return the value corresponding to the first ndots in an options configuration, or {@link #DEFAULT_NDOTS} if not
found.
@throws IOException If a failure occurs parsing the file. | [
"Parse",
"a",
"file",
"of",
"the",
"format",
"<a",
"href",
"=",
"https",
":",
"//",
"linux",
".",
"die",
".",
"net",
"/",
"man",
"/",
"5",
"/",
"resolver",
">",
"/",
"etc",
"/",
"resolv",
".",
"conf<",
"/",
"a",
">",
"and",
"return",
"the",
"va... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java#L265-L290 | train | Parses the etcResolvConf file to get the first NDOTS option. | [
30522,
10763,
20014,
11968,
19763,
13535,
6072,
4747,
6299,
8873,
12096,
15482,
3215,
1006,
5371,
4385,
6072,
4747,
25465,
2239,
2546,
1007,
11618,
22834,
10288,
24422,
1063,
5371,
16416,
4063,
10424,
1027,
2047,
5371,
16416,
4063,
1006,
4385... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.keyBy | public KeyedStream<T, Tuple> keyBy(String... fields) {
return keyBy(new Keys.ExpressionKeys<>(fields, getType()));
} | java | public KeyedStream<T, Tuple> keyBy(String... fields) {
return keyBy(new Keys.ExpressionKeys<>(fields, getType()));
} | [
"public",
"KeyedStream",
"<",
"T",
",",
"Tuple",
">",
"keyBy",
"(",
"String",
"...",
"fields",
")",
"{",
"return",
"keyBy",
"(",
"new",
"Keys",
".",
"ExpressionKeys",
"<>",
"(",
"fields",
",",
"getType",
"(",
")",
")",
")",
";",
"}"
] | Partitions the operator state of a {@link DataStream} using field expressions.
A field expression is either the name of a public field or a getter method with parentheses
of the {@link DataStream}'s underlying type. A dot can be used to drill
down into objects, as in {@code "field1.getInnerField2()" }.
@param fields
One or more field expressions on which the state of the {@link DataStream} operators will be
partitioned.
@return The {@link DataStream} with partitioned state (i.e. KeyedStream) | [
"Partitions",
"the",
"operator",
"state",
"of",
"a",
"{",
"@link",
"DataStream",
"}",
"using",
"field",
"expressions",
".",
"A",
"field",
"expression",
"is",
"either",
"the",
"name",
"of",
"a",
"public",
"field",
"or",
"a",
"getter",
"method",
"with",
"par... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L336-L338 | train | Key by expression. | [
30522,
2270,
3145,
2098,
21422,
1026,
1056,
1010,
10722,
10814,
1028,
3145,
3762,
1006,
5164,
1012,
1012,
1012,
4249,
1007,
1063,
2709,
3145,
3762,
1006,
2047,
6309,
1012,
3670,
14839,
2015,
1026,
1028,
1006,
4249,
1010,
2131,
13874,
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-db/src/main/java/cn/hutool/db/handler/HandleHelper.java | HandleHelper.handleRs | public static <T extends Collection<Entity>> T handleRs(ResultSet rs, T collection) throws SQLException {
final ResultSetMetaData meta = rs.getMetaData();
final int columnCount = meta.getColumnCount();
while (rs.next()) {
collection.add(HandleHelper.handleRow(columnCount, meta, rs));
}
return collection;
} | java | public static <T extends Collection<Entity>> T handleRs(ResultSet rs, T collection) throws SQLException {
final ResultSetMetaData meta = rs.getMetaData();
final int columnCount = meta.getColumnCount();
while (rs.next()) {
collection.add(HandleHelper.handleRow(columnCount, meta, rs));
}
return collection;
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"Entity",
">",
">",
"T",
"handleRs",
"(",
"ResultSet",
"rs",
",",
"T",
"collection",
")",
"throws",
"SQLException",
"{",
"final",
"ResultSetMetaData",
"meta",
"=",
"rs",
".",
"getMetaData",
"(",
"... | 处理多条数据
@param <T> 集合类型
@param rs 数据集
@param collection 数据集
@return Entity列表
@throws SQLException SQL执行异常 | [
"处理多条数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java#L165-L174 | train | Handles a ResultSet object and returns a Collection of entities. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
9178,
1028,
1028,
1056,
28213,
2015,
1006,
3463,
3388,
12667,
1010,
1056,
3074,
1007,
11618,
29296,
10288,
24422,
1063,
2345,
3463,
3388,
11368,
8447,
2696,
18804,
1027,
12667,
1012,
2131,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/service/HbaseEtlService.java | HbaseEtlService.createTable | private void createTable() {
try {
// 判断hbase表是否存在,不存在则建表
MappingConfig.HbaseMapping hbaseMapping = config.getHbaseMapping();
if (!hbaseTemplate.tableExists(hbaseMapping.getHbaseTable())) {
hbaseTemplate.createTable(hbaseMapping.getHbaseTable(), hbaseMapping.getFamily());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
} | java | private void createTable() {
try {
// 判断hbase表是否存在,不存在则建表
MappingConfig.HbaseMapping hbaseMapping = config.getHbaseMapping();
if (!hbaseTemplate.tableExists(hbaseMapping.getHbaseTable())) {
hbaseTemplate.createTable(hbaseMapping.getHbaseTable(), hbaseMapping.getFamily());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
} | [
"private",
"void",
"createTable",
"(",
")",
"{",
"try",
"{",
"// 判断hbase表是否存在,不存在则建表",
"MappingConfig",
".",
"HbaseMapping",
"hbaseMapping",
"=",
"config",
".",
"getHbaseMapping",
"(",
")",
";",
"if",
"(",
"!",
"hbaseTemplate",
".",
"tableExists",
"(",
"hbaseMap... | 建表 | [
"建表"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/service/HbaseEtlService.java#L43-L54 | train | create a table if it does not exist | [
30522,
2797,
11675,
3443,
10880,
1006,
1007,
1063,
3046,
1063,
1013,
1013,
100,
100,
1044,
15058,
100,
100,
100,
100,
100,
1989,
1744,
100,
100,
100,
100,
100,
12375,
8663,
8873,
2290,
1012,
1044,
15058,
2863,
14853,
1044,
15058,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java | GSAConfiguration.addBroadcastSetForApplyFunction | public void addBroadcastSetForApplyFunction(String name, DataSet<?> data) {
this.bcVarsApply.add(new Tuple2<>(name, data));
} | java | public void addBroadcastSetForApplyFunction(String name, DataSet<?> data) {
this.bcVarsApply.add(new Tuple2<>(name, data));
} | [
"public",
"void",
"addBroadcastSetForApplyFunction",
"(",
"String",
"name",
",",
"DataSet",
"<",
"?",
">",
"data",
")",
"{",
"this",
".",
"bcVarsApply",
".",
"add",
"(",
"new",
"Tuple2",
"<>",
"(",
"name",
",",
"data",
")",
")",
";",
"}"
] | Adds a data set as a broadcast set to the apply function.
@param name The name under which the broadcast data is available in the apply function.
@param data The data set to be broadcast. | [
"Adds",
"a",
"data",
"set",
"as",
"a",
"broadcast",
"set",
"to",
"the",
"apply",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java#L80-L82 | train | Adds a data set to the broadcast set for apply function. | [
30522,
2270,
11675,
5587,
12618,
4215,
10526,
13462,
29278,
29098,
2135,
11263,
27989,
1006,
5164,
2171,
1010,
2951,
13462,
1026,
1029,
1028,
2951,
1007,
1063,
2023,
1012,
4647,
10755,
3736,
9397,
2135,
1012,
5587,
1006,
2047,
10722,
10814,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/description/TextElement.java | TextElement.text | public static TextElement text(String format, InlineElement... elements) {
return new TextElement(format, Arrays.asList(elements));
} | java | public static TextElement text(String format, InlineElement... elements) {
return new TextElement(format, Arrays.asList(elements));
} | [
"public",
"static",
"TextElement",
"text",
"(",
"String",
"format",
",",
"InlineElement",
"...",
"elements",
")",
"{",
"return",
"new",
"TextElement",
"(",
"format",
",",
"Arrays",
".",
"asList",
"(",
"elements",
")",
")",
";",
"}"
] | Creates a block of text with placeholders ("%s") that will be replaced with proper string representation of
given {@link InlineElement}. For example:
<p>{@code text("This is a text with a link %s", link("https://somepage", "to here"))}
@param format text with placeholders for elements
@param elements elements to be put in the text
@return block of text | [
"Creates",
"a",
"block",
"of",
"text",
"with",
"placeholders",
"(",
"%s",
")",
"that",
"will",
"be",
"replaced",
"with",
"proper",
"string",
"representation",
"of",
"given",
"{",
"@link",
"InlineElement",
"}",
".",
"For",
"example",
":"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/description/TextElement.java#L44-L46 | train | Create a TextElement with the given format and inline elements. | [
30522,
2270,
10763,
3793,
12260,
3672,
3793,
1006,
5164,
4289,
1010,
23881,
12260,
3672,
1012,
1012,
1012,
3787,
1007,
1063,
2709,
2047,
3793,
12260,
3672,
1006,
4289,
1010,
27448,
1012,
2004,
9863,
1006,
3787,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.pause | public Actions pause(long pause) {
if (isBuildingActions()) {
action.addAction(new PauseAction(pause));
}
return tick(new Pause(defaultMouse, Duration.ofMillis(pause)));
} | java | public Actions pause(long pause) {
if (isBuildingActions()) {
action.addAction(new PauseAction(pause));
}
return tick(new Pause(defaultMouse, Duration.ofMillis(pause)));
} | [
"public",
"Actions",
"pause",
"(",
"long",
"pause",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"PauseAction",
"(",
"pause",
")",
")",
";",
"}",
"return",
"tick",
"(",
"new",
"Pause",
"(",
"de... | Performs a pause.
@param pause pause duration, in milliseconds.
@return A self reference. | [
"Performs",
"a",
"pause",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L489-L495 | train | Pause the application. | [
30522,
2270,
4506,
8724,
1006,
2146,
8724,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
8724,
18908,
3258,
1006,
8724,
1007,
1007,
1025,
1065,
2709,
16356,
1006,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/files/StaticFileServerHandler.java | StaticFileServerHandler.sendNotModified | public static void sendNotModified(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
setDateHeader(response);
// close the connection as soon as the error message is sent.
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
} | java | public static void sendNotModified(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
setDateHeader(response);
// close the connection as soon as the error message is sent.
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
} | [
"public",
"static",
"void",
"sendNotModified",
"(",
"ChannelHandlerContext",
"ctx",
")",
"{",
"FullHttpResponse",
"response",
"=",
"new",
"DefaultFullHttpResponse",
"(",
"HTTP_1_1",
",",
"NOT_MODIFIED",
")",
";",
"setDateHeader",
"(",
"response",
")",
";",
"// close... | Send the "304 Not Modified" response. This response can be used when the
file timestamp is the same as what the browser is sending up.
@param ctx The channel context to write the response to. | [
"Send",
"the",
"304",
"Not",
"Modified",
"response",
".",
"This",
"response",
"can",
"be",
"used",
"when",
"the",
"file",
"timestamp",
"is",
"the",
"same",
"as",
"what",
"the",
"browser",
"is",
"sending",
"up",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/files/StaticFileServerHandler.java#L324-L330 | train | Sends a 304 Not Modified response. | [
30522,
2270,
10763,
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,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/utility/TextUtility.java | TextUtility.isAllNum | public static boolean isAllNum(String str)
{
if (str == null)
return false;
int i = 0;
/** 判断开头是否是+-之类的符号 */
if ("±+-+-—".indexOf(str.charAt(0)) != -1)
i++;
/** 如果是全角的0123456789 字符* */
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
// Get middle delimiter such as .
if (i > 0 && i < str.length())
{
char ch = str.charAt(i);
if ("·∶:,,..//".indexOf(ch) != -1)
{// 98.1%
i++;
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
}
}
if (i >= str.length())
return true;
/** 如果是半角的0123456789字符* */
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
// Get middle delimiter such as .
if (i > 0 && i < str.length())
{
char ch = str.charAt(i);
if (',' == ch || '.' == ch || '/' == ch || ':' == ch || "∶·,./".indexOf(ch) != -1)
{// 98.1%
i++;
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
}
}
if (i < str.length())
{
if ("百千万亿佰仟%%‰".indexOf(str.charAt(i)) != -1)
i++;
}
if (i >= str.length())
return true;
return false;
} | java | public static boolean isAllNum(String str)
{
if (str == null)
return false;
int i = 0;
/** 判断开头是否是+-之类的符号 */
if ("±+-+-—".indexOf(str.charAt(0)) != -1)
i++;
/** 如果是全角的0123456789 字符* */
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
// Get middle delimiter such as .
if (i > 0 && i < str.length())
{
char ch = str.charAt(i);
if ("·∶:,,..//".indexOf(ch) != -1)
{// 98.1%
i++;
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
}
}
if (i >= str.length())
return true;
/** 如果是半角的0123456789字符* */
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
// Get middle delimiter such as .
if (i > 0 && i < str.length())
{
char ch = str.charAt(i);
if (',' == ch || '.' == ch || '/' == ch || ':' == ch || "∶·,./".indexOf(ch) != -1)
{// 98.1%
i++;
while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
i++;
}
}
if (i < str.length())
{
if ("百千万亿佰仟%%‰".indexOf(str.charAt(i)) != -1)
i++;
}
if (i >= str.length())
return true;
return false;
} | [
"public",
"static",
"boolean",
"isAllNum",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"false",
";",
"int",
"i",
"=",
"0",
";",
"/** 判断开头是否是+-之类的符号 */",
"if",
"(",
"\"±+-+-—\".indexO",
"f",
"(str.ch",
"a",
"rAt",
"(",
... | 是否全是数字
@param str
@return | [
"是否全是数字"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L153-L203 | train | is all num. | [
30522,
2270,
10763,
22017,
20898,
18061,
3363,
19172,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
2358,
2099,
1027,
1027,
19701,
1007,
2709,
6270,
1025,
20014,
1045,
1027,
1014,
1025,
1013,
1008,
1008,
100,
100,
100,
100,
100,
100,
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/io/file/Tailer.java | Tailer.checkFile | private static void checkFile(File file) {
if (false == file.exists()) {
throw new UtilException("File [{}] not exist !", file.getAbsolutePath());
}
if (false == file.isFile()) {
throw new UtilException("Path [{}] is not a file !", file.getAbsolutePath());
}
} | java | private static void checkFile(File file) {
if (false == file.exists()) {
throw new UtilException("File [{}] not exist !", file.getAbsolutePath());
}
if (false == file.isFile()) {
throw new UtilException("Path [{}] is not a file !", file.getAbsolutePath());
}
} | [
"private",
"static",
"void",
"checkFile",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"UtilException",
"(",
"\"File [{}] not exist !\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
... | 检查文件有效性
@param file 文件 | [
"检查文件有效性"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/Tailer.java#L182-L189 | train | Checks if the file exists and is a file. | [
30522,
2797,
10763,
11675,
4638,
8873,
2571,
1006,
5371,
5371,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
5371,
1012,
6526,
1006,
1007,
1007,
1063,
5466,
2047,
21183,
9463,
2595,
24422,
1006,
1000,
5371,
1031,
1063,
1065,
1033,
2025,
4839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tunnel/payload/HttpTunnelPayload.java | HttpTunnelPayload.writeTo | public void writeTo(WritableByteChannel channel) throws IOException {
Assert.notNull(channel, "Channel must not be null");
while (this.data.hasRemaining()) {
channel.write(this.data);
}
} | java | public void writeTo(WritableByteChannel channel) throws IOException {
Assert.notNull(channel, "Channel must not be null");
while (this.data.hasRemaining()) {
channel.write(this.data);
}
} | [
"public",
"void",
"writeTo",
"(",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull",
"(",
"channel",
",",
"\"Channel must not be null\"",
")",
";",
"while",
"(",
"this",
".",
"data",
".",
"hasRemaining",
"(",
")",
")... | Write the content of this payload to the given target channel.
@param channel the channel to write to
@throws IOException in case of I/O errors | [
"Write",
"the",
"content",
"of",
"this",
"payload",
"to",
"the",
"given",
"target",
"channel",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java#L99-L104 | train | Write the contents of this buffer to the given channel. | [
30522,
2270,
11675,
4339,
3406,
1006,
25697,
3085,
3762,
15007,
20147,
2140,
3149,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
3149,
1010,
1000,
3149,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
2096,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java | ProjectGenerationRequest.resolveArtifactId | protected String resolveArtifactId() {
if (this.artifactId != null) {
return this.artifactId;
}
if (this.output != null) {
int i = this.output.lastIndexOf('.');
return (i != -1) ? this.output.substring(0, i) : this.output;
}
return null;
} | java | protected String resolveArtifactId() {
if (this.artifactId != null) {
return this.artifactId;
}
if (this.output != null) {
int i = this.output.lastIndexOf('.');
return (i != -1) ? this.output.substring(0, i) : this.output;
}
return null;
} | [
"protected",
"String",
"resolveArtifactId",
"(",
")",
"{",
"if",
"(",
"this",
".",
"artifactId",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"artifactId",
";",
"}",
"if",
"(",
"this",
".",
"output",
"!=",
"null",
")",
"{",
"int",
"i",
"=",
"this",... | Resolve the artifactId to use or {@code null} if it should not be customized.
@return the artifactId | [
"Resolve",
"the",
"artifactId",
"to",
"use",
"or",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java#L413-L422 | train | Resolve the artifact id. | [
30522,
5123,
5164,
10663,
8445,
10128,
18908,
3593,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
20785,
3593,
999,
1027,
19701,
1007,
1063,
2709,
2023,
1012,
20785,
3593,
1025,
1065,
2065,
1006,
2023,
1012,
6434,
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... |
netty/netty | microbench/src/main/java/io/netty/handler/codec/http2/HpackHeader.java | HpackHeader.createHeaders | static List<HpackHeader> createHeaders(int numHeaders, int nameLength, int valueLength,
boolean limitToAscii) {
List<HpackHeader> hpackHeaders = new ArrayList<HpackHeader>(numHeaders);
for (int i = 0; i < numHeaders; ++i) {
byte[] name = randomBytes(new byte[nameLength], limitToAscii);
byte[] value = randomBytes(new byte[valueLength], limitToAscii);
hpackHeaders.add(new HpackHeader(name, value));
}
return hpackHeaders;
} | java | static List<HpackHeader> createHeaders(int numHeaders, int nameLength, int valueLength,
boolean limitToAscii) {
List<HpackHeader> hpackHeaders = new ArrayList<HpackHeader>(numHeaders);
for (int i = 0; i < numHeaders; ++i) {
byte[] name = randomBytes(new byte[nameLength], limitToAscii);
byte[] value = randomBytes(new byte[valueLength], limitToAscii);
hpackHeaders.add(new HpackHeader(name, value));
}
return hpackHeaders;
} | [
"static",
"List",
"<",
"HpackHeader",
">",
"createHeaders",
"(",
"int",
"numHeaders",
",",
"int",
"nameLength",
",",
"int",
"valueLength",
",",
"boolean",
"limitToAscii",
")",
"{",
"List",
"<",
"HpackHeader",
">",
"hpackHeaders",
"=",
"new",
"ArrayList",
"<",
... | Creates a number of random headers with the given name/value lengths. | [
"Creates",
"a",
"number",
"of",
"random",
"headers",
"with",
"the",
"given",
"name",
"/",
"value",
"lengths",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/microbench/src/main/java/io/netty/handler/codec/http2/HpackHeader.java#L58-L67 | train | Create a list of HpackHeaders. | [
30522,
10763,
2862,
1026,
6522,
8684,
4974,
2121,
1028,
3443,
4974,
2545,
1006,
20014,
16371,
2213,
4974,
2545,
1010,
20014,
2171,
7770,
13512,
2232,
1010,
20014,
3643,
7770,
13512,
2232,
1010,
22017,
20898,
5787,
3406,
3022,
6895,
2072,
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/ZipUtil.java | ZipUtil.zip | public static File zip(String srcPath, String zipPath) throws UtilException {
return zip(srcPath, zipPath, false);
} | java | public static File zip(String srcPath, String zipPath) throws UtilException {
return zip(srcPath, zipPath, false);
} | [
"public",
"static",
"File",
"zip",
"(",
"String",
"srcPath",
",",
"String",
"zipPath",
")",
"throws",
"UtilException",
"{",
"return",
"zip",
"(",
"srcPath",
",",
"zipPath",
",",
"false",
")",
";",
"}"
] | 对文件或文件目录进行压缩<br>
不包含被打包目录
@param srcPath 要压缩的源文件路径。如果压缩一个文件,则为该文件的全路径;如果压缩一个目录,则为该目录的顶层目录路径
@param zipPath 压缩文件保存的路径,包括文件名。注意:zipPath不能是srcPath路径下的子文件夹
@return 压缩好的Zip文件
@throws UtilException IO异常 | [
"对文件或文件目录进行压缩<br",
">",
"不包含被打包目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L98-L100 | train | Creates a zip file from the source file and writes it to the zip file. | [
30522,
2270,
10763,
5371,
14101,
1006,
5164,
5034,
21906,
8988,
1010,
5164,
14101,
15069,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
14101,
1006,
5034,
21906,
8988,
1010,
14101,
15069,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/trainer/ArcEagerBeamTrainer.java | ArcEagerBeamTrainer.zeroCostDynamicOracle | private Configuration zeroCostDynamicOracle(Instance instance, Collection<Configuration> oracles, Collection<Configuration> newOracles)
{
float bestScore = Float.NEGATIVE_INFINITY;
Configuration bestScoringOracle = null;
for (Configuration configuration : oracles)
{
if (!configuration.state.isTerminalState())
{
State currentState = configuration.state;
Object[] features = FeatureExtractor.extractAllParseFeatures(configuration, featureLength);
// I only assumed that we need zero cost ones
if (instance.actionCost(Action.Shift, -1, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = classifier.shiftScore(features, false);
ArcEager.shift(newConfig.state);
newConfig.addAction(0);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
if (ArcEager.canDo(Action.RightArc, currentState))
{
float[] rightArcScores = classifier.rightArcScores(features, false);
for (int dependency : dependencyRelations)
{
if (instance.actionCost(Action.RightArc, dependency, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = rightArcScores[dependency];
ArcEager.rightArc(newConfig.state, dependency);
newConfig.addAction(3 + dependency);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
}
if (ArcEager.canDo(Action.LeftArc, currentState))
{
float[] leftArcScores = classifier.leftArcScores(features, false);
for (int dependency : dependencyRelations)
{
if (instance.actionCost(Action.LeftArc, dependency, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = leftArcScores[dependency];
ArcEager.leftArc(newConfig.state, dependency);
newConfig.addAction(3 + dependencyRelations.size() + dependency);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
}
if (instance.actionCost(Action.Reduce, -1, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = classifier.reduceScore(features, false);
ArcEager.reduce(newConfig.state);
newConfig.addAction(1);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
else
{
newOracles.add(configuration);
}
}
return bestScoringOracle;
} | java | private Configuration zeroCostDynamicOracle(Instance instance, Collection<Configuration> oracles, Collection<Configuration> newOracles)
{
float bestScore = Float.NEGATIVE_INFINITY;
Configuration bestScoringOracle = null;
for (Configuration configuration : oracles)
{
if (!configuration.state.isTerminalState())
{
State currentState = configuration.state;
Object[] features = FeatureExtractor.extractAllParseFeatures(configuration, featureLength);
// I only assumed that we need zero cost ones
if (instance.actionCost(Action.Shift, -1, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = classifier.shiftScore(features, false);
ArcEager.shift(newConfig.state);
newConfig.addAction(0);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
if (ArcEager.canDo(Action.RightArc, currentState))
{
float[] rightArcScores = classifier.rightArcScores(features, false);
for (int dependency : dependencyRelations)
{
if (instance.actionCost(Action.RightArc, dependency, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = rightArcScores[dependency];
ArcEager.rightArc(newConfig.state, dependency);
newConfig.addAction(3 + dependency);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
}
if (ArcEager.canDo(Action.LeftArc, currentState))
{
float[] leftArcScores = classifier.leftArcScores(features, false);
for (int dependency : dependencyRelations)
{
if (instance.actionCost(Action.LeftArc, dependency, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = leftArcScores[dependency];
ArcEager.leftArc(newConfig.state, dependency);
newConfig.addAction(3 + dependencyRelations.size() + dependency);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
}
if (instance.actionCost(Action.Reduce, -1, currentState) == 0)
{
Configuration newConfig = configuration.clone();
float score = classifier.reduceScore(features, false);
ArcEager.reduce(newConfig.state);
newConfig.addAction(1);
newConfig.addScore(score);
newOracles.add(newConfig);
if (newConfig.getScore(true) > bestScore)
{
bestScore = newConfig.getScore(true);
bestScoringOracle = newConfig;
}
}
}
else
{
newOracles.add(configuration);
}
}
return bestScoringOracle;
} | [
"private",
"Configuration",
"zeroCostDynamicOracle",
"(",
"Instance",
"instance",
",",
"Collection",
"<",
"Configuration",
">",
"oracles",
",",
"Collection",
"<",
"Configuration",
">",
"newOracles",
")",
"{",
"float",
"bestScore",
"=",
"Float",
".",
"NEGATIVE_INFINI... | 获取 zero cost oracle
@param instance 训练实例
@param oracles 当前的oracle
@param newOracles 储存新oracle
@return 这些 oracles 中在模型看来分数最大的那个
@throws Exception | [
"获取",
"zero",
"cost",
"oracle"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/trainer/ArcEagerBeamTrainer.java#L422-L517 | train | Zero cost dynamic oracle. | [
30522,
2797,
9563,
5717,
13186,
2102,
5149,
28987,
27108,
18630,
1006,
6013,
6013,
1010,
3074,
1026,
30524,
18954,
1007,
1063,
14257,
2190,
9363,
2890,
1027,
14257,
1012,
4997,
1035,
15579,
1025,
9563,
2190,
9363,
4892,
6525,
14321,
1027,
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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java | HadoopOutputFormatBase.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
super.write(out);
out.writeUTF(this.mapreduceOutputFormat.getClass().getName());
this.configuration.write(out);
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
super.write(out);
out.writeUTF(this.mapreduceOutputFormat.getClass().getName());
this.configuration.write(out);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"super",
".",
"write",
"(",
"out",
")",
";",
"out",
".",
"writeUTF",
"(",
"this",
".",
"mapreduceOutputFormat",
".",
"getClass",
"(",
")",
".",
"getName",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java#L224-L228 | train | Write the object to the stream. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
3565,
1012,
4339,
1006,
2041,
1007,
1025,
2041,
1012,
4339,
4904,
2546,
1006,
2023,
1012,
4949,
5596,
18796,
5833,
18780,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java | NetworkEnvironment.shutdown | public void shutdown() {
synchronized (lock) {
if (isShutdown) {
return;
}
LOG.info("Shutting down the network environment and its components.");
// terminate all network connections
try {
LOG.debug("Shutting down network connection manager");
connectionManager.shutdown();
}
catch (Throwable t) {
LOG.warn("Cannot shut down the network connection manager.", t);
}
// shutdown all intermediate results
try {
LOG.debug("Shutting down intermediate result partition manager");
resultPartitionManager.shutdown();
}
catch (Throwable t) {
LOG.warn("Cannot shut down the result partition manager.", t);
}
// make sure that the global buffer pool re-acquires all buffers
networkBufferPool.destroyAllBufferPools();
// destroy the buffer pool
try {
networkBufferPool.destroy();
}
catch (Throwable t) {
LOG.warn("Network buffer pool did not shut down properly.", t);
}
isShutdown = true;
}
} | java | public void shutdown() {
synchronized (lock) {
if (isShutdown) {
return;
}
LOG.info("Shutting down the network environment and its components.");
// terminate all network connections
try {
LOG.debug("Shutting down network connection manager");
connectionManager.shutdown();
}
catch (Throwable t) {
LOG.warn("Cannot shut down the network connection manager.", t);
}
// shutdown all intermediate results
try {
LOG.debug("Shutting down intermediate result partition manager");
resultPartitionManager.shutdown();
}
catch (Throwable t) {
LOG.warn("Cannot shut down the result partition manager.", t);
}
// make sure that the global buffer pool re-acquires all buffers
networkBufferPool.destroyAllBufferPools();
// destroy the buffer pool
try {
networkBufferPool.destroy();
}
catch (Throwable t) {
LOG.warn("Network buffer pool did not shut down properly.", t);
}
isShutdown = true;
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isShutdown",
")",
"{",
"return",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Shutting down the network environment and its components.\"",
")",
";",
"// terminate all network... | Tries to shut down all network I/O components. | [
"Tries",
"to",
"shut",
"down",
"all",
"network",
"I",
"/",
"O",
"components",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java#L241-L280 | train | Shutdown all network environment and its components. | [
30522,
2270,
11675,
3844,
7698,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
26354,
6979,
2102,
7698,
1007,
1063,
2709,
1025,
1065,
8833,
1012,
18558,
1006,
1000,
17521,
2091,
1996,
2897,
4044,
1998,
2049,
6177,
1012,
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... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/CharSequenceUtils.java | CharSequenceUtils.indexOf | static int indexOf(final CharSequence cs, final int searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
}
final int sz = cs.length();
if (start < 0) {
start = 0;
}
if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
for (int i = start; i < sz; i++) {
if (cs.charAt(i) == searchChar) {
return i;
}
}
}
//supplementary characters (LANG1300)
if (searchChar <= Character.MAX_CODE_POINT) {
final char[] chars = Character.toChars(searchChar);
for (int i = start; i < sz - 1; i++) {
final char high = cs.charAt(i);
final char low = cs.charAt(i + 1);
if (high == chars[0] && low == chars[1]) {
return i;
}
}
}
return NOT_FOUND;
} | java | static int indexOf(final CharSequence cs, final int searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
}
final int sz = cs.length();
if (start < 0) {
start = 0;
}
if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
for (int i = start; i < sz; i++) {
if (cs.charAt(i) == searchChar) {
return i;
}
}
}
//supplementary characters (LANG1300)
if (searchChar <= Character.MAX_CODE_POINT) {
final char[] chars = Character.toChars(searchChar);
for (int i = start; i < sz - 1; i++) {
final char high = cs.charAt(i);
final char low = cs.charAt(i + 1);
if (high == chars[0] && low == chars[1]) {
return i;
}
}
}
return NOT_FOUND;
} | [
"static",
"int",
"indexOf",
"(",
"final",
"CharSequence",
"cs",
",",
"final",
"int",
"searchChar",
",",
"int",
"start",
")",
"{",
"if",
"(",
"cs",
"instanceof",
"String",
")",
"{",
"return",
"(",
"(",
"String",
")",
"cs",
")",
".",
"indexOf",
"(",
"s... | Returns the index within <code>cs</code> of the first occurrence of the
specified character, starting the search at the specified index.
<p>
If a character with value <code>searchChar</code> occurs in the
character sequence represented by the <code>cs</code>
object at an index no smaller than <code>start</code>, then
the index of the first such occurrence is returned. For values
of <code>searchChar</code> in the range from 0 to 0xFFFF (inclusive),
this is the smallest value <i>k</i> such that:
<blockquote><pre>
(this.charAt(<i>k</i>) == searchChar) && (<i>k</i> >= start)
</pre></blockquote>
is true. For other values of <code>searchChar</code>, it is the
smallest value <i>k</i> such that:
<blockquote><pre>
(this.codePointAt(<i>k</i>) == searchChar) && (<i>k</i> >= start)
</pre></blockquote>
is true. In either case, if no such character occurs inm <code>cs</code>
at or after position <code>start</code>, then
<code>-1</code> is returned.
<p>
There is no restriction on the value of <code>start</code>. If it
is negative, it has the same effect as if it were zero: the entire
<code>CharSequence</code> may be searched. If it is greater than
the length of <code>cs</code>, it has the same effect as if it were
equal to the length of <code>cs</code>: <code>-1</code> is returned.
<p>All indices are specified in <code>char</code> values
(Unicode code units).
@param cs the {@code CharSequence} to be processed, not null
@param searchChar the char to be searched for
@param start the start index, negative starts at the string start
@return the index where the search char was found, -1 if not found
@since 3.6 updated to behave more like <code>String</code> | [
"Returns",
"the",
"index",
"within",
"<code",
">",
"cs<",
"/",
"code",
">",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"character",
"starting",
"the",
"search",
"at",
"the",
"specified",
"index",
".",
"<p",
">",
"If",
"a",
"character",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CharSequenceUtils.java#L99-L126 | train | Gets the index of the first occurrence of the specified character in the specified CharSequence. | [
30522,
10763,
20014,
5950,
11253,
1006,
2345,
25869,
3366,
4226,
5897,
20116,
1010,
2345,
20014,
3945,
7507,
2099,
1010,
20014,
2707,
1007,
1063,
2065,
1006,
20116,
6013,
11253,
5164,
1007,
1063,
2709,
1006,
1006,
5164,
1007,
20116,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java | HexUtil.toUnicodeHex | public static String toUnicodeHex(char ch) {
StringBuilder sb = new StringBuilder(6);
sb.append("\\u");
sb.append(DIGITS_LOWER[(ch >> 12) & 15]);
sb.append(DIGITS_LOWER[(ch >> 8) & 15]);
sb.append(DIGITS_LOWER[(ch >> 4) & 15]);
sb.append(DIGITS_LOWER[(ch) & 15]);
return sb.toString();
} | java | public static String toUnicodeHex(char ch) {
StringBuilder sb = new StringBuilder(6);
sb.append("\\u");
sb.append(DIGITS_LOWER[(ch >> 12) & 15]);
sb.append(DIGITS_LOWER[(ch >> 8) & 15]);
sb.append(DIGITS_LOWER[(ch >> 4) & 15]);
sb.append(DIGITS_LOWER[(ch) & 15]);
return sb.toString();
} | [
"public",
"static",
"String",
"toUnicodeHex",
"(",
"char",
"ch",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"6",
")",
";",
"sb",
".",
"append",
"(",
"\"\\\\u\"",
")",
";",
"sb",
".",
"append",
"(",
"DIGITS_LOWER",
"[",
"(",
"ch"... | 将指定char值转换为Unicode字符串形式,常用于特殊字符(例如汉字)转Unicode形式<br>
转换的字符串如果u后不足4位,则前面用0填充,例如:
<pre>
'我' =》\u4f60
</pre>
@param ch char值
@return Unicode表现形式
@since 4.0.1 | [
"将指定char值转换为Unicode字符串形式,常用于特殊字符(例如汉字)转Unicode形式<br",
">",
"转换的字符串如果u后不足4位,则前面用0填充,例如:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L291-L299 | train | Converts a Unicode character to a hexidecimal string. | [
30522,
2270,
10763,
5164,
2000,
19496,
16044,
5369,
2595,
1006,
25869,
10381,
1007,
1063,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1020,
1007,
1025,
24829,
1012,
10439,
10497,
1006,
1000,
1032,
1032,
1057,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.putOpt | public JSONObject putOpt(String name, Object value) throws JSONException {
if (name == null || value == null) {
return this;
}
return put(name, value);
} | java | public JSONObject putOpt(String name, Object value) throws JSONException {
if (name == null || value == null) {
return this;
}
return put(name, value);
} | [
"public",
"JSONObject",
"putOpt",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"return",
"put",
"(",
"name",
",",... | Equivalent to {@code put(name, value)} when both parameters are non-null; does
nothing otherwise.
@param name the name of the property
@param value the value of the property
@return this object.
@throws JSONException if an error occurs | [
"Equivalent",
"to",
"{"
] | 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#L284-L289 | train | Add an option to this JSONObject. | [
30522,
2270,
1046,
3385,
16429,
20614,
2404,
7361,
2102,
1006,
5164,
2171,
1010,
4874,
3643,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
2171,
1027,
1027,
19701,
1064,
1064,
3643,
1027,
1027,
19701,
1007,
1063,
2709,
2023,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/util/TableConnectorUtil.java | TableConnectorUtil.generateRuntimeName | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
return TableConnectorUtils.generateRuntimeName(clazz, fields);
} | java | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
return TableConnectorUtils.generateRuntimeName(clazz, fields);
} | [
"public",
"static",
"String",
"generateRuntimeName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"[",
"]",
"fields",
")",
"{",
"return",
"TableConnectorUtils",
".",
"generateRuntimeName",
"(",
"clazz",
",",
"fields",
")",
";",
"}"
] | Returns the table connector name used for log and web UI. | [
"Returns",
"the",
"table",
"connector",
"name",
"used",
"for",
"log",
"and",
"web",
"UI",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/util/TableConnectorUtil.java#L34-L36 | train | Generate a runtime name for the given class. | [
30522,
2270,
10763,
5164,
9699,
15532,
7292,
18442,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
1031,
1033,
4249,
1007,
1063,
2709,
2795,
8663,
2638,
16761,
21823,
4877,
1012,
9699,
15532,
7292,
18442,
1006,
18856,
10936,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-script/src/main/java/cn/hutool/script/ScriptUtil.java | ScriptUtil.compile | public static CompiledScript compile(ScriptEngine engine, String script) throws ScriptException {
if (engine instanceof Compilable) {
Compilable compEngine = (Compilable) engine;
return compEngine.compile(script);
}
return null;
} | java | public static CompiledScript compile(ScriptEngine engine, String script) throws ScriptException {
if (engine instanceof Compilable) {
Compilable compEngine = (Compilable) engine;
return compEngine.compile(script);
}
return null;
} | [
"public",
"static",
"CompiledScript",
"compile",
"(",
"ScriptEngine",
"engine",
",",
"String",
"script",
")",
"throws",
"ScriptException",
"{",
"if",
"(",
"engine",
"instanceof",
"Compilable",
")",
"{",
"Compilable",
"compEngine",
"=",
"(",
"Compilable",
")",
"e... | 编译脚本
@param engine 引擎
@param script 脚本内容
@return {@link CompiledScript}
@throws ScriptException 脚本异常 | [
"编译脚本"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-script/src/main/java/cn/hutool/script/ScriptUtil.java#L112-L118 | train | Compiles the given script using the given engine. | [
30522,
2270,
30524,
2063,
1027,
1006,
4012,
8197,
20470,
2571,
1007,
3194,
1025,
2709,
4012,
11837,
11528,
2063,
1012,
4012,
22090,
1006,
5896,
1007,
1025,
1065,
2709,
19701,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java | MultipartConfigFactory.createMultipartConfig | public MultipartConfigElement createMultipartConfig() {
long maxFileSizeBytes = convertToBytes(this.maxFileSize, -1);
long maxRequestSizeBytes = convertToBytes(this.maxRequestSize, -1);
long fileSizeThresholdBytes = convertToBytes(this.fileSizeThreshold, 0);
return new MultipartConfigElement(this.location, maxFileSizeBytes,
maxRequestSizeBytes, (int) fileSizeThresholdBytes);
} | java | public MultipartConfigElement createMultipartConfig() {
long maxFileSizeBytes = convertToBytes(this.maxFileSize, -1);
long maxRequestSizeBytes = convertToBytes(this.maxRequestSize, -1);
long fileSizeThresholdBytes = convertToBytes(this.fileSizeThreshold, 0);
return new MultipartConfigElement(this.location, maxFileSizeBytes,
maxRequestSizeBytes, (int) fileSizeThresholdBytes);
} | [
"public",
"MultipartConfigElement",
"createMultipartConfig",
"(",
")",
"{",
"long",
"maxFileSizeBytes",
"=",
"convertToBytes",
"(",
"this",
".",
"maxFileSize",
",",
"-",
"1",
")",
";",
"long",
"maxRequestSizeBytes",
"=",
"convertToBytes",
"(",
"this",
".",
"maxReq... | Create a new {@link MultipartConfigElement} instance.
@return the multipart config element | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java#L77-L83 | train | Create a MultipartConfigElement. | [
30522,
2270,
4800,
19362,
13535,
2239,
8873,
12439,
13665,
3443,
12274,
7096,
11514,
8445,
8663,
8873,
2290,
1006,
1007,
1063,
2146,
4098,
8873,
4244,
4697,
3762,
4570,
1027,
10463,
3406,
3762,
4570,
1006,
2023,
1012,
4098,
8873,
4244,
4697... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java | MutablePropertySources.addBefore | public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'");
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} | java | public void addBefore(String relativePropertySourceName, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Adding PropertySource '" + propertySource.getName()
+ "' with search precedence immediately higher than '" + relativePropertySourceName + "'");
}
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
removeIfPresent(propertySource);
int index = assertPresentAndGetIndex(relativePropertySourceName);
addAtIndex(index, propertySource);
} | [
"public",
"void",
"addBefore",
"(",
"String",
"relativePropertySourceName",
",",
"PropertySource",
"<",
"?",
">",
"propertySource",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Adding PropertySource '\... | Add the given property source object with precedence immediately higher than
the named relative property source. | [
"Add",
"the",
"given",
"property",
"source",
"object",
"with",
"precedence",
"immediately",
"higher",
"than",
"the",
"named",
"relative",
"property",
"source",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L104-L113 | train | Add a property source with search precedence immediately higher than the specified relative property source. | [
30522,
2270,
11675,
5587,
4783,
29278,
2063,
1006,
5164,
5816,
21572,
4842,
3723,
6499,
3126,
27524,
14074,
1010,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3200,
6499,
3126,
3401,
1007,
1063,
2065,
1006,
8833,
4590,
1012,
2003,
3207,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CustomDictionary.java | CustomDictionary.insert | public static boolean insert(String word, String natureWithFrequency)
{
if (word == null) return false;
if (HanLP.Config.Normalization) word = CharTable.convert(word);
CoreDictionary.Attribute att = natureWithFrequency == null ? new CoreDictionary.Attribute(Nature.nz, 1) : CoreDictionary.Attribute.create(natureWithFrequency);
if (att == null) return false;
if (dat.set(word, att)) return true;
if (trie == null) trie = new BinTrie<CoreDictionary.Attribute>();
trie.put(word, att);
return true;
} | java | public static boolean insert(String word, String natureWithFrequency)
{
if (word == null) return false;
if (HanLP.Config.Normalization) word = CharTable.convert(word);
CoreDictionary.Attribute att = natureWithFrequency == null ? new CoreDictionary.Attribute(Nature.nz, 1) : CoreDictionary.Attribute.create(natureWithFrequency);
if (att == null) return false;
if (dat.set(word, att)) return true;
if (trie == null) trie = new BinTrie<CoreDictionary.Attribute>();
trie.put(word, att);
return true;
} | [
"public",
"static",
"boolean",
"insert",
"(",
"String",
"word",
",",
"String",
"natureWithFrequency",
")",
"{",
"if",
"(",
"word",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"HanLP",
".",
"Config",
".",
"Normalization",
")",
"word",
"=",
"Char... | 往自定义词典中插入一个新词(覆盖模式)<br>
动态增删不会持久化到词典文件
@param word 新词 如“裸婚”
@param natureWithFrequency 词性和其对应的频次,比如“nz 1 v 2”,null时表示“nz 1”。
@return 是否插入成功(失败的原因可能是natureWithFrequency问题,可以通过调试模式了解原因) | [
"往自定义词典中插入一个新词(覆盖模式)<br",
">",
"动态增删不会持久化到词典文件"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L293-L303 | train | Insert a word into the database. | [
30522,
2270,
10763,
22017,
20898,
19274,
1006,
5164,
2773,
1010,
5164,
3267,
24415,
19699,
2063,
4226,
9407,
1007,
1063,
2065,
1006,
2773,
1027,
1027,
19701,
1007,
30524,
2063,
4226,
9407,
1027,
1027,
19701,
1029,
2047,
4563,
29201,
3258,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.loadMainDictionary | public static boolean loadMainDictionary(String mainPath, String path[], DoubleArrayTrie<CoreDictionary.Attribute> dat, boolean isCache)
{
logger.info("自定义词典开始加载:" + mainPath);
if (loadDat(mainPath, dat)) return true;
TreeMap<String, CoreDictionary.Attribute> map = new TreeMap<String, CoreDictionary.Attribute>();
LinkedHashSet<Nature> customNatureCollector = new LinkedHashSet<Nature>();
try
{
//String path[] = HanLP.Config.CustomDictionaryPath;
for (String p : path)
{
Nature defaultNature = Nature.n;
File file = new File(p);
String fileName = file.getName();
int cut = fileName.lastIndexOf(' ');
if (cut > 0)
{
// 有默认词性
String nature = fileName.substring(cut + 1);
p = file.getParent() + File.separator + fileName.substring(0, cut);
try
{
defaultNature = LexiconUtility.convertStringToNature(nature, customNatureCollector);
}
catch (Exception e)
{
logger.severe("配置文件【" + p + "】写错了!" + e);
continue;
}
}
logger.info("以默认词性[" + defaultNature + "]加载自定义词典" + p + "中……");
boolean success = load(p, defaultNature, map, customNatureCollector);
if (!success) logger.warning("失败:" + p);
}
if (map.size() == 0)
{
logger.warning("没有加载到任何词条");
map.put(Predefine.TAG_OTHER, null); // 当作空白占位符
}
logger.info("正在构建DoubleArrayTrie……");
dat.build(map);
if (isCache)
{
// 缓存成dat文件,下次加载会快很多
logger.info("正在缓存词典为dat文件……");
// 缓存值文件
List<CoreDictionary.Attribute> attributeList = new LinkedList<CoreDictionary.Attribute>();
for (Map.Entry<String, CoreDictionary.Attribute> entry : map.entrySet())
{
attributeList.add(entry.getValue());
}
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(mainPath + Predefine.BIN_EXT)));
// 缓存用户词性
if (customNatureCollector.isEmpty()) // 热更新
{
for (int i = Nature.begin.ordinal() + 1; i < Nature.values().length; ++i)
{
customNatureCollector.add(Nature.values()[i]);
}
}
IOUtil.writeCustomNature(out, customNatureCollector);
// 缓存正文
out.writeInt(attributeList.size());
for (CoreDictionary.Attribute attribute : attributeList)
{
attribute.save(out);
}
dat.save(out);
out.close();
}
}
catch (FileNotFoundException e)
{
logger.severe("自定义词典" + mainPath + "不存在!" + e);
return false;
}
catch (IOException e)
{
logger.severe("自定义词典" + mainPath + "读取错误!" + e);
return false;
}
catch (Exception e)
{
logger.warning("自定义词典" + mainPath + "缓存失败!\n" + TextUtility.exceptionToString(e));
}
return true;
} | java | public static boolean loadMainDictionary(String mainPath, String path[], DoubleArrayTrie<CoreDictionary.Attribute> dat, boolean isCache)
{
logger.info("自定义词典开始加载:" + mainPath);
if (loadDat(mainPath, dat)) return true;
TreeMap<String, CoreDictionary.Attribute> map = new TreeMap<String, CoreDictionary.Attribute>();
LinkedHashSet<Nature> customNatureCollector = new LinkedHashSet<Nature>();
try
{
//String path[] = HanLP.Config.CustomDictionaryPath;
for (String p : path)
{
Nature defaultNature = Nature.n;
File file = new File(p);
String fileName = file.getName();
int cut = fileName.lastIndexOf(' ');
if (cut > 0)
{
// 有默认词性
String nature = fileName.substring(cut + 1);
p = file.getParent() + File.separator + fileName.substring(0, cut);
try
{
defaultNature = LexiconUtility.convertStringToNature(nature, customNatureCollector);
}
catch (Exception e)
{
logger.severe("配置文件【" + p + "】写错了!" + e);
continue;
}
}
logger.info("以默认词性[" + defaultNature + "]加载自定义词典" + p + "中……");
boolean success = load(p, defaultNature, map, customNatureCollector);
if (!success) logger.warning("失败:" + p);
}
if (map.size() == 0)
{
logger.warning("没有加载到任何词条");
map.put(Predefine.TAG_OTHER, null); // 当作空白占位符
}
logger.info("正在构建DoubleArrayTrie……");
dat.build(map);
if (isCache)
{
// 缓存成dat文件,下次加载会快很多
logger.info("正在缓存词典为dat文件……");
// 缓存值文件
List<CoreDictionary.Attribute> attributeList = new LinkedList<CoreDictionary.Attribute>();
for (Map.Entry<String, CoreDictionary.Attribute> entry : map.entrySet())
{
attributeList.add(entry.getValue());
}
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(mainPath + Predefine.BIN_EXT)));
// 缓存用户词性
if (customNatureCollector.isEmpty()) // 热更新
{
for (int i = Nature.begin.ordinal() + 1; i < Nature.values().length; ++i)
{
customNatureCollector.add(Nature.values()[i]);
}
}
IOUtil.writeCustomNature(out, customNatureCollector);
// 缓存正文
out.writeInt(attributeList.size());
for (CoreDictionary.Attribute attribute : attributeList)
{
attribute.save(out);
}
dat.save(out);
out.close();
}
}
catch (FileNotFoundException e)
{
logger.severe("自定义词典" + mainPath + "不存在!" + e);
return false;
}
catch (IOException e)
{
logger.severe("自定义词典" + mainPath + "读取错误!" + e);
return false;
}
catch (Exception e)
{
logger.warning("自定义词典" + mainPath + "缓存失败!\n" + TextUtility.exceptionToString(e));
}
return true;
} | [
"public",
"static",
"boolean",
"loadMainDictionary",
"(",
"String",
"mainPath",
",",
"String",
"path",
"[",
"]",
",",
"DoubleArrayTrie",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"dat",
",",
"boolean",
"isCache",
")",
"{",
"logger",
".",
"info",
"(",
"\"... | 加载词典
@param mainPath 缓存文件文件名
@param path 自定义词典
@param isCache 是否缓存结果 | [
"加载词典"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L67-L153 | train | Load main dictionary. | [
30522,
2270,
10763,
22017,
20898,
7170,
24238,
29201,
3258,
5649,
1006,
30524,
5164,
4130,
1031,
1033,
1010,
3313,
2906,
9447,
18886,
2063,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
23755,
1010,
22017,
20898,
2003,
3540,
5403,
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/img/ImgUtil.java | ImgUtil.scale | public static Image scale(Image srcImg, float scale) {
return Img.from(srcImg).scale(scale).getImg();
} | java | public static Image scale(Image srcImg, float scale) {
return Img.from(srcImg).scale(scale).getImg();
} | [
"public",
"static",
"Image",
"scale",
"(",
"Image",
"srcImg",
",",
"float",
"scale",
")",
"{",
"return",
"Img",
".",
"from",
"(",
"srcImg",
")",
".",
"scale",
"(",
"scale",
")",
".",
"getImg",
"(",
")",
";",
"}"
] | 缩放图像(按比例缩放)
@param srcImg 源图像来源流
@param scale 缩放比例。比例大于1时为放大,小于1大于0为缩小
@return {@link Image}
@since 3.1.0 | [
"缩放图像(按比例缩放)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L155-L157 | train | Scale an image. | [
30522,
2270,
10763,
3746,
4094,
1006,
3746,
5034,
6895,
24798,
1010,
14257,
4094,
1007,
1063,
2709,
10047,
2290,
1012,
2013,
1006,
5034,
6895,
24798,
1007,
1012,
4094,
1006,
4094,
1007,
1012,
2131,
5714,
2290,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClientConfiguration.java | RestClientConfiguration.fromConfiguration | public static RestClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
Preconditions.checkNotNull(config);
final SSLHandlerFactory sslHandlerFactory;
if (SSLUtils.isRestSSLEnabled(config)) {
try {
sslHandlerFactory = SSLUtils.createRestClientSSLEngineFactory(config);
} catch (Exception e) {
throw new ConfigurationException("Failed to initialize SSLContext for the REST client", e);
}
} else {
sslHandlerFactory = null;
}
final long connectionTimeout = config.getLong(RestOptions.CONNECTION_TIMEOUT);
final long idlenessTimeout = config.getLong(RestOptions.IDLENESS_TIMEOUT);
int maxContentLength = config.getInteger(RestOptions.CLIENT_MAX_CONTENT_LENGTH);
return new RestClientConfiguration(sslHandlerFactory, connectionTimeout, idlenessTimeout, maxContentLength);
} | java | public static RestClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
Preconditions.checkNotNull(config);
final SSLHandlerFactory sslHandlerFactory;
if (SSLUtils.isRestSSLEnabled(config)) {
try {
sslHandlerFactory = SSLUtils.createRestClientSSLEngineFactory(config);
} catch (Exception e) {
throw new ConfigurationException("Failed to initialize SSLContext for the REST client", e);
}
} else {
sslHandlerFactory = null;
}
final long connectionTimeout = config.getLong(RestOptions.CONNECTION_TIMEOUT);
final long idlenessTimeout = config.getLong(RestOptions.IDLENESS_TIMEOUT);
int maxContentLength = config.getInteger(RestOptions.CLIENT_MAX_CONTENT_LENGTH);
return new RestClientConfiguration(sslHandlerFactory, connectionTimeout, idlenessTimeout, maxContentLength);
} | [
"public",
"static",
"RestClientConfiguration",
"fromConfiguration",
"(",
"Configuration",
"config",
")",
"throws",
"ConfigurationException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"config",
")",
";",
"final",
"SSLHandlerFactory",
"sslHandlerFactory",
";",
"if",
... | Creates and returns a new {@link RestClientConfiguration} from the given {@link Configuration}.
@param config configuration from which the REST client endpoint configuration should be created from
@return REST client endpoint configuration
@throws ConfigurationException if SSL was configured incorrectly | [
"Creates",
"and",
"returns",
"a",
"new",
"{",
"@link",
"RestClientConfiguration",
"}",
"from",
"the",
"given",
"{",
"@link",
"Configuration",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClientConfiguration.java#L100-L121 | train | Creates a new RestClientConfiguration from the given configuration. | [
30522,
2270,
10763,
2717,
20464,
11638,
8663,
8873,
27390,
3370,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9530,
8873,
2290,
1007,
11618,
9563,
10288,
24422,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
9530,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.indexOf | public static <T> int indexOf(T[] array, Object value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (ObjectUtil.equal(value, array[i])) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | java | public static <T> int indexOf(T[] array, Object value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (ObjectUtil.equal(value, array[i])) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"indexOf",
"(",
"T",
"[",
"]",
"array",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",... | 返回数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@param <T> 数组类型
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.0.7 | [
"返回数组中指定元素所在位置,未找到返回",
"{",
"@link",
"#INDEX_NOT_FOUND",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L897-L906 | train | Gets the index of the specified object in the array. | [
30522,
2270,
10763,
1026,
1056,
1028,
20014,
5950,
11253,
1006,
1056,
1031,
1033,
9140,
1010,
4874,
3643,
1007,
1063,
2065,
1006,
19701,
999,
1027,
9140,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
9140,
1012,
3091,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java | KafkaProperties.buildStreamsProperties | public Map<String, Object> buildStreamsProperties() {
Map<String, Object> properties = buildCommonProperties();
properties.putAll(this.streams.buildProperties());
return properties;
} | java | public Map<String, Object> buildStreamsProperties() {
Map<String, Object> properties = buildCommonProperties();
properties.putAll(this.streams.buildProperties());
return properties;
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"buildStreamsProperties",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"buildCommonProperties",
"(",
")",
";",
"properties",
".",
"putAll",
"(",
"this",
".",
"streams",
".",... | Create an initial map of streams properties from the state of this instance.
<p>
This allows you to add additional properties, if necessary.
@return the streams properties initialized with the customizations defined on this
instance | [
"Create",
"an",
"initial",
"map",
"of",
"streams",
"properties",
"from",
"the",
"state",
"of",
"this",
"instance",
".",
"<p",
">",
"This",
"allows",
"you",
"to",
"add",
"additional",
"properties",
"if",
"necessary",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java#L210-L214 | train | Build properties for streams. | [
30522,
2270,
4949,
1026,
5164,
1010,
4874,
1028,
16473,
25379,
13102,
18981,
8743,
3111,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
5144,
1027,
3857,
9006,
8202,
21572,
4842,
7368,
1006,
1007,
1025,
5144,
1012,
2404,
8095,
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-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java | MesosConfiguration.withFrameworkInfo | public MesosConfiguration withFrameworkInfo(Protos.FrameworkInfo.Builder frameworkInfo) {
return new MesosConfiguration(masterUrl, frameworkInfo, credential);
} | java | public MesosConfiguration withFrameworkInfo(Protos.FrameworkInfo.Builder frameworkInfo) {
return new MesosConfiguration(masterUrl, frameworkInfo, credential);
} | [
"public",
"MesosConfiguration",
"withFrameworkInfo",
"(",
"Protos",
".",
"FrameworkInfo",
".",
"Builder",
"frameworkInfo",
")",
"{",
"return",
"new",
"MesosConfiguration",
"(",
"masterUrl",
",",
"frameworkInfo",
",",
"credential",
")",
";",
"}"
] | Revise the configuration with updated framework info. | [
"Revise",
"the",
"configuration",
"with",
"updated",
"framework",
"info",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java#L90-L92 | train | Creates a new MesosConfiguration with the specified framework info. | [
30522,
2270,
2033,
17063,
8663,
8873,
27390,
3370,
2007,
15643,
6198,
2378,
14876,
1006,
15053,
2015,
1012,
7705,
2378,
14876,
1012,
12508,
7705,
2378,
14876,
1007,
1063,
2709,
2047,
2033,
17063,
8663,
8873,
27390,
3370,
1006,
3040,
3126,
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/lang/Validator.java | Validator.validateChinese | public static <T extends CharSequence> T validateChinese(T value, String errorMsg) throws ValidateException {
if (false == isChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateChinese(T value, String errorMsg) throws ValidateException {
if (false == isChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateChinese",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isChinese",
"(",
"value",
")",
")",
"{",
"throw",
"new",... | 验证是否为汉字
@param <T> 字符串类型
@param value 表单值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为汉字"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L948-L953 | train | Validate Chinese. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
17231,
6810,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
17231,
6810... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cell/CellUtil.java | CellUtil.getCellValue | public static Object getCellValue(Cell cell, CellType cellType, final boolean isTrimCellValue) {
return getCellValue(cell, cellType, isTrimCellValue ? new TrimEditor() : null);
} | java | public static Object getCellValue(Cell cell, CellType cellType, final boolean isTrimCellValue) {
return getCellValue(cell, cellType, isTrimCellValue ? new TrimEditor() : null);
} | [
"public",
"static",
"Object",
"getCellValue",
"(",
"Cell",
"cell",
",",
"CellType",
"cellType",
",",
"final",
"boolean",
"isTrimCellValue",
")",
"{",
"return",
"getCellValue",
"(",
"cell",
",",
"cellType",
",",
"isTrimCellValue",
"?",
"new",
"TrimEditor",
"(",
... | 获取单元格值
@param cell {@link Cell}单元格
@param cellType 单元格值类型{@link CellType}枚举
@param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符
@return 值,类型可能为:Date、Double、Boolean、String | [
"获取单元格值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L65-L67 | train | Gets the cell value. | [
30522,
2270,
10763,
4874,
2131,
29109,
22144,
7630,
2063,
1006,
3526,
3526,
1010,
3526,
13874,
3526,
13874,
1010,
2345,
22017,
20898,
21541,
20026,
29109,
22144,
7630,
2063,
1007,
1063,
2709,
2131,
29109,
22144,
7630,
2063,
1006,
3526,
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... |
netty/netty | transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java | ChannelOutboundBuffer.current | public Object current() {
Entry entry = flushedEntry;
if (entry == null) {
return null;
}
return entry.msg;
} | java | public Object current() {
Entry entry = flushedEntry;
if (entry == null) {
return null;
}
return entry.msg;
} | [
"public",
"Object",
"current",
"(",
")",
"{",
"Entry",
"entry",
"=",
"flushedEntry",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"entry",
".",
"msg",
";",
"}"
] | Return the current message to write or {@code null} if nothing was flushed before and so is ready to be written. | [
"Return",
"the",
"current",
"message",
"to",
"write",
"or",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java#L214-L221 | train | Returns the current message. | [
30522,
2270,
4874,
2783,
1006,
1007,
1063,
4443,
4443,
1027,
12953,
4765,
2854,
1025,
2065,
1006,
4443,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
4443,
1012,
5796,
2290,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java | Bzip2HuffmanStageEncoder.assignHuffmanCodeSymbols | private void assignHuffmanCodeSymbols() {
final int[][] huffmanMergedCodeSymbols = this.huffmanMergedCodeSymbols;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mtfAlphabetSize = this.mtfAlphabetSize;
final int totalTables = huffmanCodeLengths.length;
for (int i = 0; i < totalTables; i++) {
final int[] tableLengths = huffmanCodeLengths[i];
int minimumLength = 32;
int maximumLength = 0;
for (int j = 0; j < mtfAlphabetSize; j++) {
final int length = tableLengths[j];
if (length > maximumLength) {
maximumLength = length;
}
if (length < minimumLength) {
minimumLength = length;
}
}
int code = 0;
for (int j = minimumLength; j <= maximumLength; j++) {
for (int k = 0; k < mtfAlphabetSize; k++) {
if ((huffmanCodeLengths[i][k] & 0xff) == j) {
huffmanMergedCodeSymbols[i][k] = (j << 24) | code;
code++;
}
}
code <<= 1;
}
}
} | java | private void assignHuffmanCodeSymbols() {
final int[][] huffmanMergedCodeSymbols = this.huffmanMergedCodeSymbols;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mtfAlphabetSize = this.mtfAlphabetSize;
final int totalTables = huffmanCodeLengths.length;
for (int i = 0; i < totalTables; i++) {
final int[] tableLengths = huffmanCodeLengths[i];
int minimumLength = 32;
int maximumLength = 0;
for (int j = 0; j < mtfAlphabetSize; j++) {
final int length = tableLengths[j];
if (length > maximumLength) {
maximumLength = length;
}
if (length < minimumLength) {
minimumLength = length;
}
}
int code = 0;
for (int j = minimumLength; j <= maximumLength; j++) {
for (int k = 0; k < mtfAlphabetSize; k++) {
if ((huffmanCodeLengths[i][k] & 0xff) == j) {
huffmanMergedCodeSymbols[i][k] = (j << 24) | code;
code++;
}
}
code <<= 1;
}
}
} | [
"private",
"void",
"assignHuffmanCodeSymbols",
"(",
")",
"{",
"final",
"int",
"[",
"]",
"[",
"]",
"huffmanMergedCodeSymbols",
"=",
"this",
".",
"huffmanMergedCodeSymbols",
";",
"final",
"int",
"[",
"]",
"[",
"]",
"huffmanCodeLengths",
"=",
"this",
".",
"huffma... | Assigns Canonical Huffman codes based on the calculated lengths. | [
"Assigns",
"Canonical",
"Huffman",
"codes",
"based",
"on",
"the",
"calculated",
"lengths",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java#L263-L296 | train | Assigns the Huffman Code Symbols to the Huffman Code Symbols. | [
30522,
2797,
11675,
23911,
6979,
4246,
2386,
23237,
24335,
14956,
2015,
1006,
1007,
1063,
2345,
20014,
1031,
1033,
1031,
1033,
21301,
2386,
5017,
5999,
23237,
24335,
14956,
2015,
1027,
2023,
1012,
21301,
2386,
5017,
5999,
23237,
24335,
14956,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/accumulators/StringifiedAccumulatorResult.java | StringifiedAccumulatorResult.stringifyAccumulatorResults | public static StringifiedAccumulatorResult[] stringifyAccumulatorResults(Map<String, OptionalFailure<Accumulator<?, ?>>> accs) {
if (accs == null || accs.isEmpty()) {
return new StringifiedAccumulatorResult[0];
}
else {
StringifiedAccumulatorResult[] results = new StringifiedAccumulatorResult[accs.size()];
int i = 0;
for (Map.Entry<String, OptionalFailure<Accumulator<?, ?>>> entry : accs.entrySet()) {
results[i++] = stringifyAccumulatorResult(entry.getKey(), entry.getValue());
}
return results;
}
} | java | public static StringifiedAccumulatorResult[] stringifyAccumulatorResults(Map<String, OptionalFailure<Accumulator<?, ?>>> accs) {
if (accs == null || accs.isEmpty()) {
return new StringifiedAccumulatorResult[0];
}
else {
StringifiedAccumulatorResult[] results = new StringifiedAccumulatorResult[accs.size()];
int i = 0;
for (Map.Entry<String, OptionalFailure<Accumulator<?, ?>>> entry : accs.entrySet()) {
results[i++] = stringifyAccumulatorResult(entry.getKey(), entry.getValue());
}
return results;
}
} | [
"public",
"static",
"StringifiedAccumulatorResult",
"[",
"]",
"stringifyAccumulatorResults",
"(",
"Map",
"<",
"String",
",",
"OptionalFailure",
"<",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
">",
"accs",
")",
"{",
"if",
"(",
"accs",
"==",
"null",
"||",
... | Flatten a map of accumulator names to Accumulator instances into an array of StringifiedAccumulatorResult values. | [
"Flatten",
"a",
"map",
"of",
"accumulator",
"names",
"to",
"Accumulator",
"instances",
"into",
"an",
"array",
"of",
"StringifiedAccumulatorResult",
"values",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/accumulators/StringifiedAccumulatorResult.java#L69-L82 | train | Converts a map of accumulators into a StringifiedAccumulatorResult array. | [
30522,
2270,
10763,
5164,
7810,
6305,
24894,
20350,
6072,
11314,
1031,
1033,
5164,
8757,
6305,
24894,
20350,
6072,
11314,
2015,
1006,
4949,
1026,
5164,
1010,
11887,
7011,
4014,
5397,
1026,
16222,
2819,
20350,
1026,
1029,
1010,
1029,
1028,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.nonNegativeHash | public static int nonNegativeHash(Object obj) {
if (obj == null) { return 0; }
int hash = obj.hashCode();
return hash != Integer.MIN_VALUE ? Math.abs(hash) : 0;
} | java | public static int nonNegativeHash(Object obj) {
if (obj == null) { return 0; }
int hash = obj.hashCode();
return hash != Integer.MIN_VALUE ? Math.abs(hash) : 0;
} | [
"public",
"static",
"int",
"nonNegativeHash",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"int",
"hash",
"=",
"obj",
".",
"hashCode",
"(",
")",
";",
"return",
"hash",
"!=",
"Integer",
".",
"MIN... | Returns a hash consistent with Spark's Utils.nonNegativeHash(). | [
"Returns",
"a",
"hash",
"consistent",
"with",
"Spark",
"s",
"Utils",
".",
"nonNegativeHash",
"()",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L61-L65 | train | Returns the non negative hash code of the object. | [
30522,
2270,
10763,
20014,
2512,
2638,
26792,
14949,
2232,
1006,
4874,
27885,
3501,
1007,
1063,
2065,
1006,
27885,
3501,
1027,
1027,
19701,
1007,
1063,
2709,
1014,
1025,
1065,
20014,
23325,
1027,
27885,
3501,
1012,
23325,
16044,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java | DateTimeUtils.unixDateToString | public static String unixDateToString(int date) {
final StringBuilder buf = new StringBuilder(10);
unixDateToString(buf, date);
return buf.toString();
} | java | public static String unixDateToString(int date) {
final StringBuilder buf = new StringBuilder(10);
unixDateToString(buf, date);
return buf.toString();
} | [
"public",
"static",
"String",
"unixDateToString",
"(",
"int",
"date",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"10",
")",
";",
"unixDateToString",
"(",
"buf",
",",
"date",
")",
";",
"return",
"buf",
".",
"toString",
"(",... | Helper for CAST({date} AS VARCHAR(n)). | [
"Helper",
"for",
"CAST",
"(",
"{",
"date",
"}",
"AS",
"VARCHAR",
"(",
"n",
"))",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L390-L394 | train | Convert unix date to string. | [
30522,
2270,
10763,
5164,
19998,
13701,
13122,
18886,
3070,
1006,
20014,
3058,
1007,
1063,
2345,
5164,
8569,
23891,
2099,
20934,
2546,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
2184,
1007,
1025,
19998,
13701,
13122,
18886,
3070,
1006,
20934,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Handover.java | Handover.pollNext | @Nonnull
public ConsumerRecords<byte[], byte[]> pollNext() throws Exception {
synchronized (lock) {
while (next == null && error == null) {
lock.wait();
}
ConsumerRecords<byte[], byte[]> n = next;
if (n != null) {
next = null;
lock.notifyAll();
return n;
}
else {
ExceptionUtils.rethrowException(error, error.getMessage());
// this statement cannot be reached since the above method always throws an exception
// this is only here to silence the compiler and any warnings
return ConsumerRecords.empty();
}
}
} | java | @Nonnull
public ConsumerRecords<byte[], byte[]> pollNext() throws Exception {
synchronized (lock) {
while (next == null && error == null) {
lock.wait();
}
ConsumerRecords<byte[], byte[]> n = next;
if (n != null) {
next = null;
lock.notifyAll();
return n;
}
else {
ExceptionUtils.rethrowException(error, error.getMessage());
// this statement cannot be reached since the above method always throws an exception
// this is only here to silence the compiler and any warnings
return ConsumerRecords.empty();
}
}
} | [
"@",
"Nonnull",
"public",
"ConsumerRecords",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"pollNext",
"(",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"while",
"(",
"next",
"==",
"null",
"&&",
"error",
"==",
"null",
... | Polls the next element from the Handover, possibly blocking until the next element is
available. This method behaves similar to polling from a blocking queue.
<p>If an exception was handed in by the producer ({@link #reportError(Throwable)}), then
that exception is thrown rather than an element being returned.
@return The next element (buffer of records, never null).
@throws ClosedException Thrown if the Handover was {@link #close() closed}.
@throws Exception Rethrows exceptions from the {@link #reportError(Throwable)} method. | [
"Polls",
"the",
"next",
"element",
"from",
"the",
"Handover",
"possibly",
"blocking",
"until",
"the",
"next",
"element",
"is",
"available",
".",
"This",
"method",
"behaves",
"similar",
"to",
"polling",
"from",
"a",
"blocking",
"queue",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Handover.java#L70-L91 | train | Polls the next consumer record. | [
30522,
1030,
2512,
11231,
3363,
2270,
7325,
2890,
27108,
5104,
1026,
24880,
1031,
1033,
1010,
24880,
1031,
1033,
1028,
8554,
2638,
18413,
1006,
1007,
11618,
6453,
1063,
25549,
1006,
5843,
1007,
1063,
2096,
1006,
2279,
1027,
1027,
19701,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java | SuffixDictionary.getLongestSuffixLength | public int getLongestSuffixLength(String word)
{
word = reverse(word);
LinkedList<Map.Entry<String, Integer>> suffixList = trie.commonPrefixSearchWithValue(word);
if (suffixList.size() == 0) return 0;
return suffixList.getLast().getValue();
} | java | public int getLongestSuffixLength(String word)
{
word = reverse(word);
LinkedList<Map.Entry<String, Integer>> suffixList = trie.commonPrefixSearchWithValue(word);
if (suffixList.size() == 0) return 0;
return suffixList.getLast().getValue();
} | [
"public",
"int",
"getLongestSuffixLength",
"(",
"String",
"word",
")",
"{",
"word",
"=",
"reverse",
"(",
"word",
")",
";",
"LinkedList",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"suffixList",
"=",
"trie",
".",
"commonPrefixSearchW... | 获取最长的后缀
@param word
@return | [
"获取最长的后缀"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java#L87-L93 | train | Gets the longest suffix length of a word. | [
30522,
2270,
20014,
2131,
10052,
4355,
6342,
26989,
2595,
7770,
13512,
2232,
1006,
5164,
2773,
1007,
1063,
2773,
1027,
7901,
1006,
2773,
1007,
1025,
5799,
9863,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
16109,
1028,
1028,
16809,
9863,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java | GraphGeneratorUtils.vertexSequence | public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
Preconditions.checkArgument(vertexCount >= 0, "Vertex count must be non-negative");
if (vertexCount == 0) {
return env
.fromCollection(Collections.emptyList(), TypeInformation.of(new TypeHint<Vertex<LongValue, NullValue>>(){}))
.setParallelism(parallelism)
.name("Empty vertex set");
} else {
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
DataSource<LongValue> vertexLabels = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Vertex indices");
return vertexLabels
.map(new CreateVertex())
.setParallelism(parallelism)
.name("Vertex sequence");
}
} | java | public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
Preconditions.checkArgument(vertexCount >= 0, "Vertex count must be non-negative");
if (vertexCount == 0) {
return env
.fromCollection(Collections.emptyList(), TypeInformation.of(new TypeHint<Vertex<LongValue, NullValue>>(){}))
.setParallelism(parallelism)
.name("Empty vertex set");
} else {
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
DataSource<LongValue> vertexLabels = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Vertex indices");
return vertexLabels
.map(new CreateVertex())
.setParallelism(parallelism)
.name("Vertex sequence");
}
} | [
"public",
"static",
"DataSet",
"<",
"Vertex",
"<",
"LongValue",
",",
"NullValue",
">",
">",
"vertexSequence",
"(",
"ExecutionEnvironment",
"env",
",",
"int",
"parallelism",
",",
"long",
"vertexCount",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"vertex... | Generates {@link Vertex Vertices} with sequential, numerical labels.
@param env the Flink execution environment.
@param parallelism operator parallelism
@param vertexCount number of sequential vertex labels
@return {@link DataSet} of sequentially labeled {@link Vertex vertices} | [
"Generates",
"{",
"@link",
"Vertex",
"Vertices",
"}",
"with",
"sequential",
"numerical",
"labels",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java#L56-L77 | train | Create a DataSet of vertices in the given environment using the given parallelism and vertex count. | [
30522,
2270,
10763,
2951,
13462,
1026,
19449,
1026,
2146,
10175,
5657,
1010,
19701,
10175,
5657,
1028,
1028,
19449,
3366,
4226,
5897,
1006,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1010,
20014,
5903,
2964,
1010,
2146,
19449,
3597,
16671,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java | Wrapper.wrap | public Collection<String> wrap(Collection<String> fields){
if(CollectionUtil.isEmpty(fields)) {
return fields;
}
return Arrays.asList(wrap(fields.toArray(new String[fields.size()])));
} | java | public Collection<String> wrap(Collection<String> fields){
if(CollectionUtil.isEmpty(fields)) {
return fields;
}
return Arrays.asList(wrap(fields.toArray(new String[fields.size()])));
} | [
"public",
"Collection",
"<",
"String",
">",
"wrap",
"(",
"Collection",
"<",
"String",
">",
"fields",
")",
"{",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"fields",
")",
")",
"{",
"return",
"fields",
";",
"}",
"return",
"Arrays",
".",
"asList",
"... | 包装字段名<br>
有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突
@param fields 字段名
@return 包装后的字段名 | [
"包装字段名<br",
">",
"有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L138-L144 | train | Wrap a collection of strings into a collection of strings. | [
30522,
2270,
3074,
1026,
5164,
1028,
10236,
1006,
3074,
1026,
5164,
1028,
4249,
1007,
1063,
2065,
1006,
3074,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
4249,
1007,
1007,
1063,
2709,
4249,
1025,
1065,
2709,
27448,
1012,
2004,
9863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/QueryableStateConfiguration.java | QueryableStateConfiguration.fromConfiguration | public static QueryableStateConfiguration fromConfiguration(Configuration config) {
if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
return null;
}
final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.SERVER_PORT_RANGE));
final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);
final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);
return new QueryableStateConfiguration(
proxyPorts,
serverPorts,
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
numStateServerNetworkThreads,
numStateServerQueryThreads);
} | java | public static QueryableStateConfiguration fromConfiguration(Configuration config) {
if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
return null;
}
final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.SERVER_PORT_RANGE));
final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);
final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);
return new QueryableStateConfiguration(
proxyPorts,
serverPorts,
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
numStateServerNetworkThreads,
numStateServerQueryThreads);
} | [
"public",
"static",
"QueryableStateConfiguration",
"fromConfiguration",
"(",
"Configuration",
"config",
")",
"{",
"if",
"(",
"!",
"config",
".",
"getBoolean",
"(",
"QueryableStateOptions",
".",
"ENABLE_QUERYABLE_STATE_PROXY_SERVER",
")",
")",
"{",
"return",
"null",
";... | Creates the {@link QueryableStateConfiguration} from the given Configuration. | [
"Creates",
"the",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/QueryableStateConfiguration.java#L145-L168 | train | Creates a new QueryableStateConfiguration from the given configuration. | [
30522,
2270,
10763,
23032,
3085,
9153,
26557,
2239,
8873,
27390,
3370,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
999,
9530,
8873,
2290,
1012,
2131,
5092,
9890,
2319,
1006,
23032,
3085,
9153,
2618,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.