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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.hasNull | public static boolean hasNull(Object bean) {
final Field[] fields = ClassUtil.getDeclaredFields(bean.getClass());
Object fieldValue = null;
for (Field field : fields) {
field.setAccessible(true);
try {
fieldValue = field.get(bean);
} catch (Exception e) {
//ignore
}
if (null == fieldValue) {
return true;
}
}
return false;
} | java | public static boolean hasNull(Object bean) {
final Field[] fields = ClassUtil.getDeclaredFields(bean.getClass());
Object fieldValue = null;
for (Field field : fields) {
field.setAccessible(true);
try {
fieldValue = field.get(bean);
} catch (Exception e) {
//ignore
}
if (null == fieldValue) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasNull",
"(",
"Object",
"bean",
")",
"{",
"final",
"Field",
"[",
"]",
"fields",
"=",
"ClassUtil",
".",
"getDeclaredFields",
"(",
"bean",
".",
"getClass",
"(",
")",
")",
";",
"Object",
"fieldValue",
"=",
"null",
";",
"for"... | 判断Bean中是否有值为null的字段
@param bean Bean
@return 是否有值为null的字段 | [
"判断Bean中是否有值为null的字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L126-L142 | train | Returns true if the specified object has null fields. | [
30522,
2270,
10763,
22017,
20898,
8440,
18083,
1006,
4874,
14068,
1007,
1063,
2345,
2492,
1031,
1033,
4249,
1027,
2465,
21823,
2140,
1012,
2131,
3207,
20464,
12069,
20952,
12891,
2015,
1006,
14068,
1012,
2131,
26266,
1006,
1007,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.crossWithHuge | public <R> CrossOperator.DefaultCross<T, R> crossWithHuge(DataSet<R> other) {
return new CrossOperator.DefaultCross<>(this, other, CrossHint.FIRST_IS_SMALL, Utils.getCallLocationName());
} | java | public <R> CrossOperator.DefaultCross<T, R> crossWithHuge(DataSet<R> other) {
return new CrossOperator.DefaultCross<>(this, other, CrossHint.FIRST_IS_SMALL, Utils.getCallLocationName());
} | [
"public",
"<",
"R",
">",
"CrossOperator",
".",
"DefaultCross",
"<",
"T",
",",
"R",
">",
"crossWithHuge",
"(",
"DataSet",
"<",
"R",
">",
"other",
")",
"{",
"return",
"new",
"CrossOperator",
".",
"DefaultCross",
"<>",
"(",
"this",
",",
"other",
",",
"Cro... | Initiates a Cross transformation.
<p>A Cross transformation combines the elements of two
{@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
both DataSets, i.e., it builds a Cartesian product.
This method also gives the hint to the optimizer that the second DataSet to cross is much
larger than the first one.
<p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
the element of the first input being the first field of the tuple and the element of the
second input being the second field of the tuple.
<p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
{@link org.apache.flink.api.common.functions.CrossFunction} which is called for
each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
@param other The other DataSet with which this DataSet is crossed.
@return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
@see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
@see org.apache.flink.api.common.functions.CrossFunction
@see DataSet
@see Tuple2 | [
"Initiates",
"a",
"Cross",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1118-L1120 | train | Cross with huge data set. | [
30522,
2270,
1026,
1054,
1028,
2892,
25918,
8844,
1012,
12398,
16458,
1026,
1056,
1010,
1054,
1028,
2892,
24415,
6979,
3351,
1006,
2951,
13462,
1026,
1054,
1028,
2060,
1007,
1063,
2709,
2047,
2892,
25918,
8844,
1012,
12398,
16458,
1026,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/TransformMatrixDictionary.java | TransformMatrixDictionary.getFrequency | public int getFrequency(String from, String to)
{
return getFrequency(convert(from), convert(to));
} | java | public int getFrequency(String from, String to)
{
return getFrequency(convert(from), convert(to));
} | [
"public",
"int",
"getFrequency",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"return",
"getFrequency",
"(",
"convert",
"(",
"from",
")",
",",
"convert",
"(",
"to",
")",
")",
";",
"}"
] | 获取转移频次
@param from
@param to
@return | [
"获取转移频次"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/TransformMatrixDictionary.java#L43-L46 | train | Gets the frequency of a sequence from a sequence of tokens to a sequence of tokens. | [
30522,
2270,
20014,
2131,
19699,
2063,
4226,
9407,
1006,
5164,
2013,
1010,
5164,
2000,
1007,
1063,
2709,
2131,
19699,
2063,
4226,
9407,
1006,
10463,
1006,
2013,
1007,
1010,
10463,
1006,
2000,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/BufferFileChannelReader.java | BufferFileChannelReader.readBufferFromFileChannel | public boolean readBufferFromFileChannel(Buffer buffer) throws IOException {
checkArgument(fileChannel.size() - fileChannel.position() > 0);
// Read header
header.clear();
fileChannel.read(header);
header.flip();
final boolean isBuffer = header.getInt() == 1;
final int size = header.getInt();
if (size > buffer.getMaxCapacity()) {
throw new IllegalStateException("Buffer is too small for data: " + buffer.getMaxCapacity() + " bytes available, but " + size + " needed. This is most likely due to an serialized event, which is larger than the buffer size.");
}
checkArgument(buffer.getSize() == 0, "Buffer not empty");
fileChannel.read(buffer.getNioBuffer(0, size));
buffer.setSize(size);
if (!isBuffer) {
buffer.tagAsEvent();
}
return fileChannel.size() - fileChannel.position() == 0;
} | java | public boolean readBufferFromFileChannel(Buffer buffer) throws IOException {
checkArgument(fileChannel.size() - fileChannel.position() > 0);
// Read header
header.clear();
fileChannel.read(header);
header.flip();
final boolean isBuffer = header.getInt() == 1;
final int size = header.getInt();
if (size > buffer.getMaxCapacity()) {
throw new IllegalStateException("Buffer is too small for data: " + buffer.getMaxCapacity() + " bytes available, but " + size + " needed. This is most likely due to an serialized event, which is larger than the buffer size.");
}
checkArgument(buffer.getSize() == 0, "Buffer not empty");
fileChannel.read(buffer.getNioBuffer(0, size));
buffer.setSize(size);
if (!isBuffer) {
buffer.tagAsEvent();
}
return fileChannel.size() - fileChannel.position() == 0;
} | [
"public",
"boolean",
"readBufferFromFileChannel",
"(",
"Buffer",
"buffer",
")",
"throws",
"IOException",
"{",
"checkArgument",
"(",
"fileChannel",
".",
"size",
"(",
")",
"-",
"fileChannel",
".",
"position",
"(",
")",
">",
"0",
")",
";",
"// Read header",
"head... | Reads data from the object's file channel into the given buffer.
@param buffer the buffer to read into
@return whether the end of the file has been reached (<tt>true</tt>) or not (<tt>false</tt>) | [
"Reads",
"data",
"from",
"the",
"object",
"s",
"file",
"channel",
"into",
"the",
"given",
"buffer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/BufferFileChannelReader.java#L47-L71 | train | Read data from the file channel into the given buffer. | [
30522,
2270,
22017,
20898,
3191,
30524,
17698,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
2906,
22850,
4765,
1006,
5371,
26058,
1012,
2946,
1006,
1007,
1011,
5371,
26058,
1012,
2597,
1006,
1007,
1028,
1014,
1007,
1025,
1013,
1013,
3191,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExcelBase.java | ExcelBase.close | @Override
public void close() {
IoUtil.close(this.workbook);
this.sheet = null;
this.workbook = null;
this.isClosed = true;
} | java | @Override
public void close() {
IoUtil.close(this.workbook);
this.sheet = null;
this.workbook = null;
this.isClosed = true;
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"IoUtil",
".",
"close",
"(",
"this",
".",
"workbook",
")",
";",
"this",
".",
"sheet",
"=",
"null",
";",
"this",
".",
"workbook",
"=",
"null",
";",
"this",
".",
"isClosed",
"=",
"true",
";",... | 关闭工作簿<br>
如果用户设定了目标文件,先写出目标文件后给关闭工作簿 | [
"关闭工作簿<br",
">",
"如果用户设定了目标文件,先写出目标文件后给关闭工作簿"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L302-L308 | train | Closes the related resources. | [
30522,
1030,
2058,
15637,
2270,
11675,
2485,
1006,
1007,
1063,
22834,
21823,
2140,
1012,
2485,
1006,
2023,
1012,
2147,
8654,
1007,
1025,
2023,
1012,
7123,
1027,
19701,
1025,
2023,
1012,
2147,
8654,
1027,
19701,
1025,
2023,
1012,
2003,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.hasField | public static boolean hasField(Class<?> beanClass, String name) throws SecurityException {
return null != getField(beanClass, name);
} | java | public static boolean hasField(Class<?> beanClass, String name) throws SecurityException {
return null != getField(beanClass, name);
} | [
"public",
"static",
"boolean",
"hasField",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"String",
"name",
")",
"throws",
"SecurityException",
"{",
"return",
"null",
"!=",
"getField",
"(",
"beanClass",
",",
"name",
")",
";",
"}"
] | 查找指定类中是否包含指定名称对应的字段,包括所有字段(包括非public字段),也包括父类和Object类的字段
@param beanClass 被查找字段的类,不能为null
@param name 字段名
@return 是否包含字段
@throws SecurityException 安全异常
@since 4.1.21 | [
"查找指定类中是否包含指定名称对应的字段,包括所有字段(包括非public字段),也包括父类和Object类的字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L103-L105 | train | Checks if the specified field is present in the specified class. | [
30522,
2270,
10763,
22017,
20898,
2038,
3790,
1006,
2465,
1026,
1029,
1028,
14068,
26266,
1010,
5164,
2171,
1007,
11618,
3036,
10288,
24422,
1063,
2709,
19701,
999,
1027,
2131,
3790,
1006,
14068,
26266,
1010,
2171,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/embedded/EmbeddedChannel.java | EmbeddedChannel.runPendingTasks | public void runPendingTasks() {
try {
loop.runTasks();
} catch (Exception e) {
recordException(e);
}
try {
loop.runScheduledTasks();
} catch (Exception e) {
recordException(e);
}
} | java | public void runPendingTasks() {
try {
loop.runTasks();
} catch (Exception e) {
recordException(e);
}
try {
loop.runScheduledTasks();
} catch (Exception e) {
recordException(e);
}
} | [
"public",
"void",
"runPendingTasks",
"(",
")",
"{",
"try",
"{",
"loop",
".",
"runTasks",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"recordException",
"(",
"e",
")",
";",
"}",
"try",
"{",
"loop",
".",
"runScheduledTasks",
"(",
")",... | Run all tasks (which also includes scheduled tasks) that are pending in the {@link EventLoop}
for this {@link Channel} | [
"Run",
"all",
"tasks",
"(",
"which",
"also",
"includes",
"scheduled",
"tasks",
")",
"that",
"are",
"pending",
"in",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java#L576-L588 | train | Run pending tasks. | [
30522,
2270,
11675,
2448,
11837,
4667,
10230,
5705,
1006,
1007,
1063,
3046,
1063,
7077,
1012,
2448,
10230,
5705,
1006,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
1007,
1063,
2501,
10288,
24422,
1006,
1041,
1007,
1025,
1065,
3046,
1063,
7077,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/TwoInputUdfOperator.java | TwoInputUdfOperator.withParameters | @Override
public O withParameters(Configuration parameters) {
this.parameters = parameters;
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} | java | @Override
public O withParameters(Configuration parameters) {
this.parameters = parameters;
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} | [
"@",
"Override",
"public",
"O",
"withParameters",
"(",
"Configuration",
"parameters",
")",
"{",
"this",
".",
"parameters",
"=",
"parameters",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"O",
"returnType",
"=",
"(",
"O",
")",
"this",
";",
"return... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/TwoInputUdfOperator.java#L87-L94 | train | Sets the parameters for the exception. | [
30522,
1030,
2058,
15637,
2270,
1051,
2007,
28689,
22828,
2015,
1006,
9563,
11709,
1007,
1063,
2023,
1012,
11709,
1027,
11709,
1025,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1051,
2709,
13874,
1027,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hcatalog/src/main/java/org/apache/flink/hcatalog/HCatInputFormatBase.java | HCatInputFormatBase.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeInt(this.fieldNames.length);
for (String fieldName : this.fieldNames) {
out.writeUTF(fieldName);
}
this.configuration.write(out);
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeInt(this.fieldNames.length);
for (String fieldName : this.fieldNames) {
out.writeUTF(fieldName);
}
this.configuration.write(out);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"this",
".",
"fieldNames",
".",
"length",
")",
";",
"for",
"(",
"String",
"fieldName",
":",
"this",
".",
"fieldNames",
")",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hcatalog/src/main/java/org/apache/flink/hcatalog/HCatInputFormatBase.java#L368-L374 | train | Writes the object to the stream. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
18447,
1006,
2023,
1012,
2492,
18442,
2015,
1012,
3091,
1007,
1025,
2005,
1006,
5164,
2492,
18442,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/spdy/SpdyCodecUtil.java | SpdyCodecUtil.validateHeaderName | static void validateHeaderName(CharSequence name) {
if (name == null) {
throw new NullPointerException("name");
}
if (name.length() == 0) {
throw new IllegalArgumentException(
"name cannot be length zero");
}
// Since name may only contain ascii characters, for valid names
// name.length() returns the number of bytes when UTF-8 encoded.
if (name.length() > SPDY_MAX_NV_LENGTH) {
throw new IllegalArgumentException(
"name exceeds allowable length: " + name);
}
for (int i = 0; i < name.length(); i ++) {
char c = name.charAt(i);
if (c == 0) {
throw new IllegalArgumentException(
"name contains null character: " + name);
}
if (c >= 'A' && c <= 'Z') {
throw new IllegalArgumentException("name must be all lower case.");
}
if (c > 127) {
throw new IllegalArgumentException(
"name contains non-ascii character: " + name);
}
}
} | java | static void validateHeaderName(CharSequence name) {
if (name == null) {
throw new NullPointerException("name");
}
if (name.length() == 0) {
throw new IllegalArgumentException(
"name cannot be length zero");
}
// Since name may only contain ascii characters, for valid names
// name.length() returns the number of bytes when UTF-8 encoded.
if (name.length() > SPDY_MAX_NV_LENGTH) {
throw new IllegalArgumentException(
"name exceeds allowable length: " + name);
}
for (int i = 0; i < name.length(); i ++) {
char c = name.charAt(i);
if (c == 0) {
throw new IllegalArgumentException(
"name contains null character: " + name);
}
if (c >= 'A' && c <= 'Z') {
throw new IllegalArgumentException("name must be all lower case.");
}
if (c > 127) {
throw new IllegalArgumentException(
"name contains non-ascii character: " + name);
}
}
} | [
"static",
"void",
"validateHeaderName",
"(",
"CharSequence",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name\"",
")",
";",
"}",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")"... | Validate a SPDY header name. | [
"Validate",
"a",
"SPDY",
"header",
"name",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java#L288-L316 | train | Validate the name of a header. | [
30522,
10763,
11675,
9398,
3686,
4974,
11795,
14074,
1006,
25869,
3366,
4226,
5897,
2171,
1007,
1063,
2065,
1006,
2171,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
2171,
1000,
1007,
1025,
1065,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ByteArrayBuffer.java | ByteArrayBuffer.setLength | public void setLength(final int len) {
if (len < 0 || len > this.array.length) {
throw new IndexOutOfBoundsException("len: "+len+" < 0 or > buffer len: "+this.array.length);
}
this.len = len;
} | java | public void setLength(final int len) {
if (len < 0 || len > this.array.length) {
throw new IndexOutOfBoundsException("len: "+len+" < 0 or > buffer len: "+this.array.length);
}
this.len = len;
} | [
"public",
"void",
"setLength",
"(",
"final",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"<",
"0",
"||",
"len",
">",
"this",
".",
"array",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"len: \"",
"+",
"len",
"+",
"\" < 0 or... | Sets the length of the buffer. The new length value is expected to be
less than the current capacity and greater than or equal to
{@code 0}.
@param len the new length
@throws IndexOutOfBoundsException if the
{@code len} argument is greater than the current
capacity of the buffer or less than {@code 0}. | [
"Sets",
"the",
"length",
"of",
"the",
"buffer",
".",
"The",
"new",
"length",
"value",
"is",
"expected",
"to",
"be",
"less",
"than",
"the",
"current",
"capacity",
"and",
"greater",
"than",
"or",
"equal",
"to",
"{",
"@code",
"0",
"}",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java#L259-L264 | train | Sets the length of the buffer. | [
30522,
2270,
11675,
2275,
7770,
13512,
2232,
1006,
2345,
20014,
18798,
1007,
1063,
2065,
1006,
18798,
1026,
1014,
30524,
1012,
18798,
1027,
18798,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.discardReadComponents | public CompositeByteBuf discardReadComponents() {
ensureAccessible();
final int readerIndex = readerIndex();
if (readerIndex == 0) {
return this;
}
// Discard everything if (readerIndex = writerIndex = capacity).
int writerIndex = writerIndex();
if (readerIndex == writerIndex && writerIndex == capacity()) {
for (int i = 0, size = componentCount; i < size; i++) {
components[i].free();
}
lastAccessed = null;
clearComps();
setIndex(0, 0);
adjustMarkers(readerIndex);
return this;
}
// Remove read components.
int firstComponentId = 0;
Component c = null;
for (int size = componentCount; firstComponentId < size; firstComponentId++) {
c = components[firstComponentId];
if (c.endOffset > readerIndex) {
break;
}
c.free();
}
if (firstComponentId == 0) {
return this; // Nothing to discard
}
Component la = lastAccessed;
if (la != null && la.endOffset <= readerIndex) {
lastAccessed = null;
}
removeCompRange(0, firstComponentId);
// Update indexes and markers.
int offset = c.offset;
updateComponentOffsets(0);
setIndex(readerIndex - offset, writerIndex - offset);
adjustMarkers(offset);
return this;
} | java | public CompositeByteBuf discardReadComponents() {
ensureAccessible();
final int readerIndex = readerIndex();
if (readerIndex == 0) {
return this;
}
// Discard everything if (readerIndex = writerIndex = capacity).
int writerIndex = writerIndex();
if (readerIndex == writerIndex && writerIndex == capacity()) {
for (int i = 0, size = componentCount; i < size; i++) {
components[i].free();
}
lastAccessed = null;
clearComps();
setIndex(0, 0);
adjustMarkers(readerIndex);
return this;
}
// Remove read components.
int firstComponentId = 0;
Component c = null;
for (int size = componentCount; firstComponentId < size; firstComponentId++) {
c = components[firstComponentId];
if (c.endOffset > readerIndex) {
break;
}
c.free();
}
if (firstComponentId == 0) {
return this; // Nothing to discard
}
Component la = lastAccessed;
if (la != null && la.endOffset <= readerIndex) {
lastAccessed = null;
}
removeCompRange(0, firstComponentId);
// Update indexes and markers.
int offset = c.offset;
updateComponentOffsets(0);
setIndex(readerIndex - offset, writerIndex - offset);
adjustMarkers(offset);
return this;
} | [
"public",
"CompositeByteBuf",
"discardReadComponents",
"(",
")",
"{",
"ensureAccessible",
"(",
")",
";",
"final",
"int",
"readerIndex",
"=",
"readerIndex",
"(",
")",
";",
"if",
"(",
"readerIndex",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"// Discard ... | Discard all {@link ByteBuf}s which are read. | [
"Discard",
"all",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L1733-L1778 | train | Discards all read components from this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5860,
4232,
16416,
16409,
25377,
5643,
7666,
1006,
1007,
1063,
5676,
6305,
9623,
19307,
1006,
1007,
1025,
2345,
20014,
8068,
22254,
10288,
1027,
8068,
22254,
10288,
1006,
1007,
1025,
2065,
1006,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONArray.java | JSONArray.join | public String join(String separator) throws JSONException {
int len = this.rawList.size();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(InternalJSONUtil.valueToString(this.rawList.get(i)));
}
return sb.toString();
} | java | public String join(String separator) throws JSONException {
int len = this.rawList.size();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(InternalJSONUtil.valueToString(this.rawList.get(i)));
}
return sb.toString();
} | [
"public",
"String",
"join",
"(",
"String",
"separator",
")",
"throws",
"JSONException",
"{",
"int",
"len",
"=",
"this",
".",
"rawList",
".",
"size",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i... | JSONArray转为以<code>separator</code>为分界符的字符串
@param separator 分界符
@return a string.
@throws JSONException If the array contains an invalid number. | [
"JSONArray转为以<code",
">",
"separator<",
"/",
"code",
">",
"为分界符的字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONArray.java#L178-L189 | train | Returns a string containing the contents of this list joined with the given separator. | [
30522,
2270,
5164,
3693,
1006,
5164,
19802,
25879,
2953,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
20014,
18798,
1027,
2023,
1012,
6315,
9863,
1012,
2946,
1006,
1007,
1025,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java | KvStateSerializer.deserializeKeyAndNamespace | public static <K, N> Tuple2<K, N> deserializeKeyAndNamespace(
byte[] serializedKeyAndNamespace,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer) throws IOException {
DataInputDeserializer dis = new DataInputDeserializer(
serializedKeyAndNamespace,
0,
serializedKeyAndNamespace.length);
try {
K key = keySerializer.deserialize(dis);
byte magicNumber = dis.readByte();
if (magicNumber != MAGIC_NUMBER) {
throw new IOException("Unexpected magic number " + magicNumber + ".");
}
N namespace = namespaceSerializer.deserialize(dis);
if (dis.available() > 0) {
throw new IOException("Unconsumed bytes in the serialized key and namespace.");
}
return new Tuple2<>(key, namespace);
} catch (IOException e) {
throw new IOException("Unable to deserialize key " +
"and namespace. This indicates a mismatch in the key/namespace " +
"serializers used by the KvState instance and this access.", e);
}
} | java | public static <K, N> Tuple2<K, N> deserializeKeyAndNamespace(
byte[] serializedKeyAndNamespace,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer) throws IOException {
DataInputDeserializer dis = new DataInputDeserializer(
serializedKeyAndNamespace,
0,
serializedKeyAndNamespace.length);
try {
K key = keySerializer.deserialize(dis);
byte magicNumber = dis.readByte();
if (magicNumber != MAGIC_NUMBER) {
throw new IOException("Unexpected magic number " + magicNumber + ".");
}
N namespace = namespaceSerializer.deserialize(dis);
if (dis.available() > 0) {
throw new IOException("Unconsumed bytes in the serialized key and namespace.");
}
return new Tuple2<>(key, namespace);
} catch (IOException e) {
throw new IOException("Unable to deserialize key " +
"and namespace. This indicates a mismatch in the key/namespace " +
"serializers used by the KvState instance and this access.", e);
}
} | [
"public",
"static",
"<",
"K",
",",
"N",
">",
"Tuple2",
"<",
"K",
",",
"N",
">",
"deserializeKeyAndNamespace",
"(",
"byte",
"[",
"]",
"serializedKeyAndNamespace",
",",
"TypeSerializer",
"<",
"K",
">",
"keySerializer",
",",
"TypeSerializer",
"<",
"N",
">",
"... | Deserializes the key and namespace into a {@link Tuple2}.
@param serializedKeyAndNamespace Serialized key and namespace
@param keySerializer Serializer for the key
@param namespaceSerializer Serializer for the namespace
@param <K> Key type
@param <N> Namespace
@return Tuple2 holding deserialized key and namespace
@throws IOException if the deserialization fails for any reason | [
"Deserializes",
"the",
"key",
"and",
"namespace",
"into",
"a",
"{",
"@link",
"Tuple2",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java#L85-L113 | train | Deserializes the given serialized key and namespace. | [
30522,
2270,
10763,
1026,
1047,
1010,
1050,
1028,
10722,
10814,
2475,
1026,
1047,
1010,
1050,
1028,
4078,
11610,
3669,
24506,
3240,
5685,
18442,
23058,
1006,
24880,
1031,
1033,
27289,
14839,
5685,
18442,
23058,
1010,
4127,
11610,
28863,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitMapBloomFilter.java | BitMapBloomFilter.add | @Override
public boolean add(String str) {
boolean flag = true;
for (BloomFilter filter : filters) {
flag |= filter.add(str);
}
return flag;
} | java | @Override
public boolean add(String str) {
boolean flag = true;
for (BloomFilter filter : filters) {
flag |= filter.add(str);
}
return flag;
} | [
"@",
"Override",
"public",
"boolean",
"add",
"(",
"String",
"str",
")",
"{",
"boolean",
"flag",
"=",
"true",
";",
"for",
"(",
"BloomFilter",
"filter",
":",
"filters",
")",
"{",
"flag",
"|=",
"filter",
".",
"add",
"(",
"str",
")",
";",
"}",
"return",
... | 增加字符串到Filter映射中
@param str 字符串 | [
"增加字符串到Filter映射中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitMapBloomFilter.java#L54-L61 | train | Add a string to the list of filters. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
5587,
1006,
5164,
2358,
2099,
1007,
1063,
22017,
20898,
5210,
1027,
2995,
1025,
2005,
1006,
13426,
8873,
21928,
11307,
1024,
17736,
1007,
1063,
5210,
1064,
1027,
11307,
1012,
5587,
1006,
2358,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java | FromElementsFunction.snapshotState | @Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
Preconditions.checkState(this.checkpointedState != null,
"The " + getClass().getSimpleName() + " has not been properly initialized.");
this.checkpointedState.clear();
this.checkpointedState.add(this.numElementsEmitted);
} | java | @Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
Preconditions.checkState(this.checkpointedState != null,
"The " + getClass().getSimpleName() + " has not been properly initialized.");
this.checkpointedState.clear();
this.checkpointedState.add(this.numElementsEmitted);
} | [
"@",
"Override",
"public",
"void",
"snapshotState",
"(",
"FunctionSnapshotContext",
"context",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"checkpointedState",
"!=",
"null",
",",
"\"The \"",
"+",
"getClass",
"(",
")",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java#L198-L205 | train | This method is called to snapshot the state of the sequence. | [
30522,
1030,
2058,
15637,
2270,
11675,
20057,
12326,
9153,
2618,
1006,
4972,
2532,
4523,
12326,
8663,
18209,
6123,
1007,
11618,
6453,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
2023,
1012,
26520,
2098,
9153,
2618,
999,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.createMessageDigest | public static MessageDigest createMessageDigest(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
MessageDigest messageDigest;
try {
messageDigest = (null == provider) ? MessageDigest.getInstance(algorithm) : MessageDigest.getInstance(algorithm, provider);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
return messageDigest;
} | java | public static MessageDigest createMessageDigest(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
MessageDigest messageDigest;
try {
messageDigest = (null == provider) ? MessageDigest.getInstance(algorithm) : MessageDigest.getInstance(algorithm, provider);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
return messageDigest;
} | [
"public",
"static",
"MessageDigest",
"createMessageDigest",
"(",
"String",
"algorithm",
")",
"{",
"final",
"Provider",
"provider",
"=",
"GlobalBouncyCastleProvider",
".",
"INSTANCE",
".",
"getProvider",
"(",
")",
";",
"MessageDigest",
"messageDigest",
";",
"try",
"{... | 创建{@link MessageDigest}
@param algorithm 算法
@since 4.5.2 | [
"创建",
"{",
"@link",
"MessageDigest",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L995-L1006 | train | Creates a MessageDigest object based on the algorithm name. | [
30522,
2270,
10763,
4471,
4305,
8449,
2102,
3443,
7834,
3736,
5999,
25538,
3367,
1006,
5164,
9896,
1007,
1063,
2345,
10802,
10802,
1027,
3795,
5092,
4609,
5666,
23662,
21572,
17258,
2121,
1012,
6013,
1012,
2131,
21572,
17258,
2121,
1006,
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/FileUtil.java | FileUtil.readUtf8Lines | public static <T extends Collection<String>> T readUtf8Lines(String path, T collection) throws IORuntimeException {
return readLines(path, CharsetUtil.CHARSET_UTF_8, collection);
} | java | public static <T extends Collection<String>> T readUtf8Lines(String path, T collection) throws IORuntimeException {
return readLines(path, CharsetUtil.CHARSET_UTF_8, collection);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readUtf8Lines",
"(",
"String",
"path",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"path",
",",
"CharsetUtil",
".",
"CHARS... | 从文件中读取每一行的UTF-8编码数据
@param <T> 集合类型
@param path 文件路径
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常
@since 3.1.1 | [
"从文件中读取每一行的UTF",
"-",
"8编码数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2164-L2166 | train | Reads a collection of UTF - 8 lines from a file. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
4904,
2546,
2620,
12735,
1006,
5164,
4130,
1010,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
12735,
1006,
4130,
1010,
25869,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONTokener.java | JSONTokener.next | public String next(int n) throws JSONException {
if (n == 0) {
return "";
}
char[] chars = new char[n];
int pos = 0;
while (pos < n) {
chars[pos] = this.next();
if (this.end()) {
throw this.syntaxError("Substring bounds error");
}
pos += 1;
}
return new String(chars);
} | java | public String next(int n) throws JSONException {
if (n == 0) {
return "";
}
char[] chars = new char[n];
int pos = 0;
while (pos < n) {
chars[pos] = this.next();
if (this.end()) {
throw this.syntaxError("Substring bounds error");
}
pos += 1;
}
return new String(chars);
} | [
"public",
"String",
"next",
"(",
"int",
"n",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"n",
"]",
";",
"int",
"pos",
"=",
"0",
";",
... | 获得接下来的n个字符
@param n 字符数
@return 获得的n个字符组成的字符串
@throws JSONException 如果源中余下的字符数不足以提供所需的字符数,抛出此异常 | [
"获得接下来的n个字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONTokener.java#L159-L174 | train | Returns the next n characters. | [
30522,
2270,
5164,
2279,
1006,
20014,
1050,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
1050,
1027,
1027,
1014,
1007,
1063,
2709,
1000,
1000,
1025,
1065,
25869,
1031,
1033,
25869,
2015,
1027,
2047,
25869,
1031,
1050,
1033,
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-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java | MutableHashTable.buildInitialTable | protected void buildInitialTable(final MutableObjectIterator<BT> input) throws IOException {
// create the partitions
final int partitionFanOut = getPartitioningFanOutNoEstimates(this.availableMemory.size());
if (partitionFanOut > MAX_NUM_PARTITIONS) {
throw new RuntimeException("Hash join partitions estimate exeeds maximum number of partitions.");
}
createPartitions(partitionFanOut, 0);
// set up the table structure. the write behind buffers are taken away, as are one buffer per partition
final int numBuckets = getInitialTableSize(this.availableMemory.size(), this.segmentSize,
partitionFanOut, this.avgRecordLen);
initTable(numBuckets, (byte) partitionFanOut);
final TypeComparator<BT> buildTypeComparator = this.buildSideComparator;
BT record = this.buildSideSerializer.createInstance();
// go over the complete input and insert every element into the hash table
while (this.running && ((record = input.next(record)) != null)) {
final int hashCode = hash(buildTypeComparator.hash(record), 0);
insertIntoTable(record, hashCode);
}
if (!this.running) {
return;
}
// finalize the partitions
for (int i = 0; i < this.partitionsBeingBuilt.size(); i++) {
HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(i);
p.finalizeBuildPhase(this.ioManager, this.currentEnumerator, this.writeBehindBuffers);
}
} | java | protected void buildInitialTable(final MutableObjectIterator<BT> input) throws IOException {
// create the partitions
final int partitionFanOut = getPartitioningFanOutNoEstimates(this.availableMemory.size());
if (partitionFanOut > MAX_NUM_PARTITIONS) {
throw new RuntimeException("Hash join partitions estimate exeeds maximum number of partitions.");
}
createPartitions(partitionFanOut, 0);
// set up the table structure. the write behind buffers are taken away, as are one buffer per partition
final int numBuckets = getInitialTableSize(this.availableMemory.size(), this.segmentSize,
partitionFanOut, this.avgRecordLen);
initTable(numBuckets, (byte) partitionFanOut);
final TypeComparator<BT> buildTypeComparator = this.buildSideComparator;
BT record = this.buildSideSerializer.createInstance();
// go over the complete input and insert every element into the hash table
while (this.running && ((record = input.next(record)) != null)) {
final int hashCode = hash(buildTypeComparator.hash(record), 0);
insertIntoTable(record, hashCode);
}
if (!this.running) {
return;
}
// finalize the partitions
for (int i = 0; i < this.partitionsBeingBuilt.size(); i++) {
HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(i);
p.finalizeBuildPhase(this.ioManager, this.currentEnumerator, this.writeBehindBuffers);
}
} | [
"protected",
"void",
"buildInitialTable",
"(",
"final",
"MutableObjectIterator",
"<",
"BT",
">",
"input",
")",
"throws",
"IOException",
"{",
"// create the partitions",
"final",
"int",
"partitionFanOut",
"=",
"getPartitioningFanOutNoEstimates",
"(",
"this",
".",
"availa... | Creates the initial hash table. This method sets up partitions, hash index, and inserts
the data from the given iterator.
@param input The iterator with the build side data.
@throws IOException Thrown, if an element could not be fetched and deserialized from
the iterator, or if serialization fails. | [
"Creates",
"the",
"initial",
"hash",
"table",
".",
"This",
"method",
"sets",
"up",
"partitions",
"hash",
"index",
"and",
"inserts",
"the",
"data",
"from",
"the",
"given",
"iterator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java#L785-L816 | train | Build the initial table. | [
30522,
5123,
11675,
3857,
5498,
20925,
10880,
1006,
2345,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
18411,
1028,
7953,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
3443,
1996,
13571,
2015,
2345,
20014,
13571,
15143,
5833,
1027,
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... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.writeMediumBE | @SuppressWarnings("deprecation")
public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue);
} | java | @SuppressWarnings("deprecation")
public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"ByteBuf",
"writeMediumBE",
"(",
"ByteBuf",
"buf",
",",
"int",
"mediumValue",
")",
"{",
"return",
"buf",
".",
"order",
"(",
")",
"==",
"ByteOrder",
".",
"BIG_ENDIAN",
"?",
"buf",
".",
... | Writes a big-endian 24-bit medium integer to the buffer. | [
"Writes",
"a",
"big",
"-",
"endian",
"24",
"-",
"bit",
"medium",
"integer",
"to",
"the",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L434-L437 | train | Write medium value to buffer in big - endian order. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2270,
10763,
24880,
8569,
2546,
4339,
7583,
5007,
4783,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
5396,
10175,
5657,
1007,
1063,
2709,
20934,
2546,
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-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java | KafkaConsumerThread.run | @Override
public void run() {
// early exit check
if (!running) {
return;
}
// this is the means to talk to FlinkKafkaConsumer's main thread
final Handover handover = this.handover;
// This method initializes the KafkaConsumer and guarantees it is torn down properly.
// This is important, because the consumer has multi-threading issues,
// including concurrent 'close()' calls.
try {
this.consumer = getConsumer(kafkaProperties);
}
catch (Throwable t) {
handover.reportError(t);
return;
}
// from here on, the consumer is guaranteed to be closed properly
try {
// register Kafka's very own metrics in Flink's metric reporters
if (useMetrics) {
// register Kafka metrics to Flink
Map<MetricName, ? extends Metric> metrics = consumer.metrics();
if (metrics == null) {
// MapR's Kafka implementation returns null here.
log.info("Consumer implementation does not support metrics");
} else {
// we have Kafka metrics, register them
for (Map.Entry<MetricName, ? extends Metric> metric: metrics.entrySet()) {
consumerMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue()));
// TODO this metric is kept for compatibility purposes; should remove in the future
subtaskMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue()));
}
}
}
// early exit check
if (!running) {
return;
}
// the latest bulk of records. May carry across the loop if the thread is woken up
// from blocking on the handover
ConsumerRecords<byte[], byte[]> records = null;
// reused variable to hold found unassigned new partitions.
// found partitions are not carried across loops using this variable;
// they are carried across via re-adding them to the unassigned partitions queue
List<KafkaTopicPartitionState<TopicPartition>> newPartitions;
// main fetch loop
while (running) {
// check if there is something to commit
if (!commitInProgress) {
// get and reset the work-to-be committed, so we don't repeatedly commit the same
final Tuple2<Map<TopicPartition, OffsetAndMetadata>, KafkaCommitCallback> commitOffsetsAndCallback =
nextOffsetsToCommit.getAndSet(null);
if (commitOffsetsAndCallback != null) {
log.debug("Sending async offset commit request to Kafka broker");
// also record that a commit is already in progress
// the order here matters! first set the flag, then send the commit command.
commitInProgress = true;
consumer.commitAsync(commitOffsetsAndCallback.f0, new CommitCallback(commitOffsetsAndCallback.f1));
}
}
try {
if (hasAssignedPartitions) {
newPartitions = unassignedPartitionsQueue.pollBatch();
}
else {
// if no assigned partitions block until we get at least one
// instead of hot spinning this loop. We rely on a fact that
// unassignedPartitionsQueue will be closed on a shutdown, so
// we don't block indefinitely
newPartitions = unassignedPartitionsQueue.getBatchBlocking();
}
if (newPartitions != null) {
reassignPartitions(newPartitions);
}
} catch (AbortedReassignmentException e) {
continue;
}
if (!hasAssignedPartitions) {
// Without assigned partitions KafkaConsumer.poll will throw an exception
continue;
}
// get the next batch of records, unless we did not manage to hand the old batch over
if (records == null) {
try {
records = consumer.poll(pollTimeout);
}
catch (WakeupException we) {
continue;
}
}
try {
handover.produce(records);
records = null;
}
catch (Handover.WakeupException e) {
// fall through the loop
}
}
// end main fetch loop
}
catch (Throwable t) {
// let the main thread know and exit
// it may be that this exception comes because the main thread closed the handover, in
// which case the below reporting is irrelevant, but does not hurt either
handover.reportError(t);
}
finally {
// make sure the handover is closed if it is not already closed or has an error
handover.close();
// make sure the KafkaConsumer is closed
try {
consumer.close();
}
catch (Throwable t) {
log.warn("Error while closing Kafka consumer", t);
}
}
} | java | @Override
public void run() {
// early exit check
if (!running) {
return;
}
// this is the means to talk to FlinkKafkaConsumer's main thread
final Handover handover = this.handover;
// This method initializes the KafkaConsumer and guarantees it is torn down properly.
// This is important, because the consumer has multi-threading issues,
// including concurrent 'close()' calls.
try {
this.consumer = getConsumer(kafkaProperties);
}
catch (Throwable t) {
handover.reportError(t);
return;
}
// from here on, the consumer is guaranteed to be closed properly
try {
// register Kafka's very own metrics in Flink's metric reporters
if (useMetrics) {
// register Kafka metrics to Flink
Map<MetricName, ? extends Metric> metrics = consumer.metrics();
if (metrics == null) {
// MapR's Kafka implementation returns null here.
log.info("Consumer implementation does not support metrics");
} else {
// we have Kafka metrics, register them
for (Map.Entry<MetricName, ? extends Metric> metric: metrics.entrySet()) {
consumerMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue()));
// TODO this metric is kept for compatibility purposes; should remove in the future
subtaskMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue()));
}
}
}
// early exit check
if (!running) {
return;
}
// the latest bulk of records. May carry across the loop if the thread is woken up
// from blocking on the handover
ConsumerRecords<byte[], byte[]> records = null;
// reused variable to hold found unassigned new partitions.
// found partitions are not carried across loops using this variable;
// they are carried across via re-adding them to the unassigned partitions queue
List<KafkaTopicPartitionState<TopicPartition>> newPartitions;
// main fetch loop
while (running) {
// check if there is something to commit
if (!commitInProgress) {
// get and reset the work-to-be committed, so we don't repeatedly commit the same
final Tuple2<Map<TopicPartition, OffsetAndMetadata>, KafkaCommitCallback> commitOffsetsAndCallback =
nextOffsetsToCommit.getAndSet(null);
if (commitOffsetsAndCallback != null) {
log.debug("Sending async offset commit request to Kafka broker");
// also record that a commit is already in progress
// the order here matters! first set the flag, then send the commit command.
commitInProgress = true;
consumer.commitAsync(commitOffsetsAndCallback.f0, new CommitCallback(commitOffsetsAndCallback.f1));
}
}
try {
if (hasAssignedPartitions) {
newPartitions = unassignedPartitionsQueue.pollBatch();
}
else {
// if no assigned partitions block until we get at least one
// instead of hot spinning this loop. We rely on a fact that
// unassignedPartitionsQueue will be closed on a shutdown, so
// we don't block indefinitely
newPartitions = unassignedPartitionsQueue.getBatchBlocking();
}
if (newPartitions != null) {
reassignPartitions(newPartitions);
}
} catch (AbortedReassignmentException e) {
continue;
}
if (!hasAssignedPartitions) {
// Without assigned partitions KafkaConsumer.poll will throw an exception
continue;
}
// get the next batch of records, unless we did not manage to hand the old batch over
if (records == null) {
try {
records = consumer.poll(pollTimeout);
}
catch (WakeupException we) {
continue;
}
}
try {
handover.produce(records);
records = null;
}
catch (Handover.WakeupException e) {
// fall through the loop
}
}
// end main fetch loop
}
catch (Throwable t) {
// let the main thread know and exit
// it may be that this exception comes because the main thread closed the handover, in
// which case the below reporting is irrelevant, but does not hurt either
handover.reportError(t);
}
finally {
// make sure the handover is closed if it is not already closed or has an error
handover.close();
// make sure the KafkaConsumer is closed
try {
consumer.close();
}
catch (Throwable t) {
log.warn("Error while closing Kafka consumer", t);
}
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"// early exit check",
"if",
"(",
"!",
"running",
")",
"{",
"return",
";",
"}",
"// this is the means to talk to FlinkKafkaConsumer's main thread",
"final",
"Handover",
"handover",
"=",
"this",
".",
"handover"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java#L153-L288 | train | This method is called by the main thread of the FlinkKafkaConsumer. It is called by the FlinkKafkaConsumer s main thread to run the FlinkConsumer s main thread. | [
30522,
1030,
2058,
15637,
2270,
11675,
2448,
1006,
1007,
1063,
1013,
1013,
2220,
6164,
4638,
2065,
1006,
999,
2770,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2023,
2003,
1996,
2965,
2000,
2831,
2000,
13109,
19839,
2912,
24316,
22684,
3619,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java | MessageAcknowledgingSourceBase.snapshotState | @Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
Preconditions.checkState(this.checkpointedState != null,
"The " + getClass().getSimpleName() + " has not been properly initialized.");
if (LOG.isDebugEnabled()) {
LOG.debug("{} checkpointing: Messages: {}, checkpoint id: {}, timestamp: {}",
idsForCurrentCheckpoint, context.getCheckpointId(), context.getCheckpointTimestamp());
}
pendingCheckpoints.addLast(new Tuple2<>(context.getCheckpointId(), idsForCurrentCheckpoint));
idsForCurrentCheckpoint = new HashSet<>(64);
this.checkpointedState.clear();
this.checkpointedState.add(SerializedCheckpointData.fromDeque(pendingCheckpoints, idSerializer));
} | java | @Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
Preconditions.checkState(this.checkpointedState != null,
"The " + getClass().getSimpleName() + " has not been properly initialized.");
if (LOG.isDebugEnabled()) {
LOG.debug("{} checkpointing: Messages: {}, checkpoint id: {}, timestamp: {}",
idsForCurrentCheckpoint, context.getCheckpointId(), context.getCheckpointTimestamp());
}
pendingCheckpoints.addLast(new Tuple2<>(context.getCheckpointId(), idsForCurrentCheckpoint));
idsForCurrentCheckpoint = new HashSet<>(64);
this.checkpointedState.clear();
this.checkpointedState.add(SerializedCheckpointData.fromDeque(pendingCheckpoints, idSerializer));
} | [
"@",
"Override",
"public",
"void",
"snapshotState",
"(",
"FunctionSnapshotContext",
"context",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"checkpointedState",
"!=",
"null",
",",
"\"The \"",
"+",
"getClass",
"(",
")",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java#L206-L221 | train | This method is called by the snapshot manager to snapshot the state of the checkpoint. | [
30522,
1030,
2058,
15637,
2270,
11675,
20057,
12326,
9153,
2618,
1006,
4972,
2532,
4523,
12326,
8663,
18209,
6123,
1007,
11618,
6453,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
2023,
1012,
26520,
2098,
9153,
2618,
999,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createModify | public static WatchMonitor createModify(URL url, int maxDepth, Watcher watcher) {
return createModify(URLUtil.toURI(url), maxDepth, watcher);
} | java | public static WatchMonitor createModify(URL url, int maxDepth, Watcher watcher) {
return createModify(URLUtil.toURI(url), maxDepth, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createModify",
"(",
"URL",
"url",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createModify",
"(",
"URLUtil",
".",
"toURI",
"(",
"url",
")",
",",
"maxDepth",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听修改事件
@param url URL
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor}
@since 4.5.2 | [
"创建并初始化监听,监听修改事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L275-L277 | train | Creates a watch monitor that will modify the given URL. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
5302,
4305,
12031,
1006,
24471,
2140,
24471,
2140,
1010,
20014,
4098,
3207,
13876,
2232,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
2709,
3443,
5302,
4305,
12031,
1006,
24471,
7630,
3775,
2140,
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/map/MapBuilder.java | MapBuilder.putAll | public MapBuilder<K, V> putAll(Map<K, V> map) {
this.map.putAll(map);
return this;
} | java | public MapBuilder<K, V> putAll(Map<K, V> map) {
this.map.putAll(map);
return this;
} | [
"public",
"MapBuilder",
"<",
"K",
",",
"V",
">",
"putAll",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"this",
".",
"map",
".",
"putAll",
"(",
"map",
")",
";",
"return",
"this",
";",
"}"
] | 链式Map创建
@param map 合并map
@return 当前类 | [
"链式Map创建"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java#L55-L58 | train | Adds all entries from the given map to the map. | [
30522,
2270,
4949,
8569,
23891,
2099,
1026,
1047,
1010,
1058,
1028,
2404,
8095,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1007,
1063,
2023,
1012,
4949,
1012,
2404,
8095,
1006,
4949,
1007,
1025,
2709,
2023,
1025,
1065,
102,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.findAllGroup0 | public static List<String> findAllGroup0(Pattern pattern, CharSequence content) {
return findAll(pattern, content, 0);
} | java | public static List<String> findAllGroup0(Pattern pattern, CharSequence content) {
return findAll(pattern, content, 0);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"findAllGroup0",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"return",
"findAll",
"(",
"pattern",
",",
"content",
",",
"0",
")",
";",
"}"
] | 取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容
@param pattern 编译后的正则模式
@param content 被查找的内容
@return 结果列表
@since 3.1.2 | [
"取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L418-L420 | train | Finds all groups of the given content that match the given pattern. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2424,
8095,
17058,
2692,
1006,
5418,
5418,
1010,
25869,
3366,
4226,
5897,
4180,
1007,
1063,
2709,
2424,
8095,
1006,
5418,
1010,
4180,
1010,
1014,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.releaseAndTryRemove | @Nullable
public boolean releaseAndTryRemove(String pathInZooKeeper) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node {}.", path, e);
}
release(pathInZooKeeper);
try {
client.delete().forPath(path);
} catch (KeeperException.NotEmptyException ignored) {
LOG.debug("Could not delete znode {} because it is still locked.", path);
return false;
}
if (stateHandle != null) {
stateHandle.discardState();
}
return true;
} | java | @Nullable
public boolean releaseAndTryRemove(String pathInZooKeeper) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node {}.", path, e);
}
release(pathInZooKeeper);
try {
client.delete().forPath(path);
} catch (KeeperException.NotEmptyException ignored) {
LOG.debug("Could not delete znode {} because it is still locked.", path);
return false;
}
if (stateHandle != null) {
stateHandle.discardState();
}
return true;
} | [
"@",
"Nullable",
"public",
"boolean",
"releaseAndTryRemove",
"(",
"String",
"pathInZooKeeper",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"pathInZooKeeper",
",",
"\"Path in ZooKeeper\"",
")",
";",
"final",
"String",
"path",
"=",
"normalizePath",
"(",
"pat... | Releases the lock for the given state node and tries to remove the state node if it is no longer locked.
It returns the {@link RetrievableStateHandle} stored under the given state node if any.
@param pathInZooKeeper Path of state handle to remove
@return True if the state handle could be released
@throws Exception If the ZooKeeper operation or discarding the state handle fails | [
"Releases",
"the",
"lock",
"for",
"the",
"given",
"state",
"node",
"and",
"tries",
"to",
"remove",
"the",
"state",
"node",
"if",
"it",
"is",
"no",
"longer",
"locked",
".",
"It",
"returns",
"the",
"{",
"@link",
"RetrievableStateHandle",
"}",
"stored",
"unde... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L331-L359 | train | Release and try remove the state handle for the given path. | [
30522,
1030,
19701,
3085,
2270,
22017,
20898,
2713,
5685,
11129,
28578,
21818,
1006,
5164,
4130,
2378,
23221,
13106,
1007,
11618,
6453,
1063,
4638,
17048,
11231,
3363,
1006,
4130,
2378,
23221,
13106,
1010,
1000,
4130,
1999,
9201,
13106,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/classification/utilities/CollectionUtility.java | CollectionUtility.splitMap | public static Map<String, String[]> splitMap(Map<String, String[]> src, double rate)
{
assert 0 <= rate && rate <= 1;
Map<String, String[]> output = new TreeMap<String, String[]>();
for (Map.Entry<String, String[]> entry : src.entrySet())
{
String[][] array = spiltArray(entry.getValue(), rate);
output.put(entry.getKey(), array[0]);
entry.setValue(array[1]);
}
return output;
} | java | public static Map<String, String[]> splitMap(Map<String, String[]> src, double rate)
{
assert 0 <= rate && rate <= 1;
Map<String, String[]> output = new TreeMap<String, String[]>();
for (Map.Entry<String, String[]> entry : src.entrySet())
{
String[][] array = spiltArray(entry.getValue(), rate);
output.put(entry.getKey(), array[0]);
entry.setValue(array[1]);
}
return output;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"splitMap",
"(",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"src",
",",
"double",
"rate",
")",
"{",
"assert",
"0",
"<=",
"rate",
"&&",
"rate",
"<=",
"1",
";",
"Map",... | 分割Map,其中旧map直接被改变
@param src
@param rate
@return | [
"分割Map",
"其中旧map直接被改变"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/utilities/CollectionUtility.java#L86-L98 | train | Splits a map of strings into two maps of strings of the same type. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
5164,
1031,
1033,
1028,
3975,
2863,
2361,
1006,
4949,
1026,
5164,
1010,
5164,
1031,
1033,
1028,
5034,
2278,
1010,
3313,
3446,
1007,
1063,
20865,
1014,
1026,
1027,
3446,
1004,
1004,
3446,
1026,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/crf/CRFModel.java | CRFModel.load | public static CRFModel load(String path)
{
CRFModel model = loadBin(path + BIN_EXT);
if (model != null) return model;
return loadTxt(path, new CRFModel(new DoubleArrayTrie<FeatureFunction>()));
} | java | public static CRFModel load(String path)
{
CRFModel model = loadBin(path + BIN_EXT);
if (model != null) return model;
return loadTxt(path, new CRFModel(new DoubleArrayTrie<FeatureFunction>()));
} | [
"public",
"static",
"CRFModel",
"load",
"(",
"String",
"path",
")",
"{",
"CRFModel",
"model",
"=",
"loadBin",
"(",
"path",
"+",
"BIN_EXT",
")",
";",
"if",
"(",
"model",
"!=",
"null",
")",
"return",
"model",
";",
"return",
"loadTxt",
"(",
"path",
",",
... | 加载CRF++模型<br>
如果存在缓存的话,优先读取缓存,否则读取txt,并且建立缓存
@param path txt的路径,即使不存在.txt,只存在.bin,也应传入txt的路径,方法内部会自动加.bin后缀
@return | [
"加载CRF",
"++",
"模型<br",
">",
"如果存在缓存的话,优先读取缓存,否则读取txt,并且建立缓存"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/CRFModel.java#L414-L419 | train | Load a CRFModel from a file. | [
30522,
2270,
10763,
13675,
16715,
10244,
2140,
7170,
1006,
5164,
4130,
1007,
1063,
13675,
16715,
10244,
2140,
2944,
1027,
7170,
8428,
1006,
4130,
1009,
8026,
1035,
4654,
2102,
1007,
1025,
2065,
1006,
2944,
999,
1027,
19701,
1007,
2709,
2944... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapAggregatingState.java | HeapAggregatingState.get | @Override
public OUT get() {
ACC accumulator = getInternal();
return accumulator != null ? aggregateTransformation.aggFunction.getResult(accumulator) : null;
} | java | @Override
public OUT get() {
ACC accumulator = getInternal();
return accumulator != null ? aggregateTransformation.aggFunction.getResult(accumulator) : null;
} | [
"@",
"Override",
"public",
"OUT",
"get",
"(",
")",
"{",
"ACC",
"accumulator",
"=",
"getInternal",
"(",
")",
";",
"return",
"accumulator",
"!=",
"null",
"?",
"aggregateTransformation",
".",
"aggFunction",
".",
"getResult",
"(",
"accumulator",
")",
":",
"null"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapAggregatingState.java#L89-L93 | train | Returns the result of the aggregate operation. | [
30522,
1030,
2058,
15637,
2270,
2041,
2131,
1006,
1007,
1063,
16222,
16222,
2819,
20350,
1027,
2131,
18447,
11795,
2389,
1006,
1007,
1025,
2709,
16222,
2819,
20350,
999,
1027,
19701,
1029,
9572,
6494,
3619,
14192,
3370,
1012,
12943,
25708,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java | DynaBean.get | @SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | java | @SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"fieldName",
")",
"throws",
"BeanException",
"{",
"if",
"(",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",
"beanClass",
")",
")",
"{",
"return",
... | 获得字段对应值
@param <T> 属性值类型
@param fieldName 字段名
@return 字段值
@throws BeanException 反射获取属性值或字段值导致的异常 | [
"获得字段对应值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java#L74-L89 | train | Gets the value of the specified field from the underlying map. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
1028,
1056,
2131,
1006,
5164,
2492,
18442,
1007,
11618,
14068,
10288,
24422,
1063,
2065,
1006,
4949,
1012,
2465,
1012,
18061,
18719,
16989,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.build | public int build(List<String> _key, int _length[], int _value[],
int _keySize)
{
if (_key == null || _keySize > _key.size())
return 0;
// progress_func_ = progress_func;
key = _key;
length = _length;
keySize = _keySize;
value = _value;
progress = 0;
allocSize = 0;
resize(65536 * 32); // 32个双字节
base[0] = 1;
nextCheckPos = 0;
Node root_node = new Node();
root_node.left = 0;
root_node.right = keySize;
root_node.depth = 0;
List<Node> siblings = new ArrayList<Node>();
fetch(root_node, siblings);
insert(siblings, new BitSet());
shrink();
// size += (1 << 8 * 2) + 1; // ???
// if (size >= allocSize) resize (size);
key = null;
length = null;
return error_;
} | java | public int build(List<String> _key, int _length[], int _value[],
int _keySize)
{
if (_key == null || _keySize > _key.size())
return 0;
// progress_func_ = progress_func;
key = _key;
length = _length;
keySize = _keySize;
value = _value;
progress = 0;
allocSize = 0;
resize(65536 * 32); // 32个双字节
base[0] = 1;
nextCheckPos = 0;
Node root_node = new Node();
root_node.left = 0;
root_node.right = keySize;
root_node.depth = 0;
List<Node> siblings = new ArrayList<Node>();
fetch(root_node, siblings);
insert(siblings, new BitSet());
shrink();
// size += (1 << 8 * 2) + 1; // ???
// if (size >= allocSize) resize (size);
key = null;
length = null;
return error_;
} | [
"public",
"int",
"build",
"(",
"List",
"<",
"String",
">",
"_key",
",",
"int",
"_length",
"[",
"]",
",",
"int",
"_value",
"[",
"]",
",",
"int",
"_keySize",
")",
"{",
"if",
"(",
"_key",
"==",
"null",
"||",
"_keySize",
">",
"_key",
".",
"size",
"("... | 唯一的构建方法
@param _key 值set,必须字典序
@param _length 对应每个key的长度,留空动态获取
@param _value 每个key对应的值,留空使用key的下标作为值
@param _keySize key的长度,应该设为_key.size
@return 是否出错 | [
"唯一的构建方法"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L387-L423 | train | Build a new key - value pair. | [
30522,
2270,
20014,
3857,
1006,
2862,
1026,
5164,
1028,
1035,
3145,
1010,
20014,
1035,
3091,
1031,
1033,
1010,
20014,
1035,
3643,
1031,
1033,
1010,
20014,
1035,
6309,
4697,
1007,
1063,
2065,
1006,
1035,
3145,
1027,
1027,
19701,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.checkTransactionSupported | protected void checkTransactionSupported(Connection conn) throws SQLException, DbRuntimeException {
if (null == isSupportTransaction) {
isSupportTransaction = conn.getMetaData().supportsTransactions();
}
if (false == isSupportTransaction) {
throw new DbRuntimeException("Transaction not supported for current database!");
}
} | java | protected void checkTransactionSupported(Connection conn) throws SQLException, DbRuntimeException {
if (null == isSupportTransaction) {
isSupportTransaction = conn.getMetaData().supportsTransactions();
}
if (false == isSupportTransaction) {
throw new DbRuntimeException("Transaction not supported for current database!");
}
} | [
"protected",
"void",
"checkTransactionSupported",
"(",
"Connection",
"conn",
")",
"throws",
"SQLException",
",",
"DbRuntimeException",
"{",
"if",
"(",
"null",
"==",
"isSupportTransaction",
")",
"{",
"isSupportTransaction",
"=",
"conn",
".",
"getMetaData",
"(",
")",
... | 检查数据库是否支持事务,此项检查同一个数据源只检查一次,如果不支持抛出DbRuntimeException异常
@param conn Connection
@throws SQLException 获取元数据信息失败
@throws DbRuntimeException 不支持事务 | [
"检查数据库是否支持事务,此项检查同一个数据源只检查一次,如果不支持抛出DbRuntimeException异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L853-L860 | train | Check if transaction support for current database. | [
30522,
5123,
11675,
4638,
6494,
3619,
18908,
8496,
6279,
6442,
2098,
1006,
4434,
9530,
2078,
1007,
11618,
29296,
10288,
24422,
1010,
16962,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
26354,
6279,
6442,
6494,
3619,
18908,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CharUtils.java | CharUtils.unicodeEscaped | public static String unicodeEscaped(final Character ch) {
if (ch == null) {
return null;
}
return unicodeEscaped(ch.charValue());
} | java | public static String unicodeEscaped(final Character ch) {
if (ch == null) {
return null;
}
return unicodeEscaped(ch.charValue());
} | [
"public",
"static",
"String",
"unicodeEscaped",
"(",
"final",
"Character",
"ch",
")",
"{",
"if",
"(",
"ch",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"unicodeEscaped",
"(",
"ch",
".",
"charValue",
"(",
")",
")",
";",
"}"
] | <p>Converts the string to the Unicode format '\u0020'.</p>
<p>This format is the Java source code format.</p>
<p>If {@code null} is passed in, {@code null} will be returned.</p>
<pre>
CharUtils.unicodeEscaped(null) = null
CharUtils.unicodeEscaped(' ') = "\u0020"
CharUtils.unicodeEscaped('A') = "\u0041"
</pre>
@param ch the character to convert, may be null
@return the escaped Unicode string, null if null input | [
"<p",
">",
"Converts",
"the",
"string",
"to",
"the",
"Unicode",
"format",
"\\",
"u0020",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CharUtils.java#L318-L323 | train | Unicode escaped. | [
30522,
2270,
10763,
5164,
27260,
2229,
19464,
2094,
1006,
2345,
2839,
10381,
1007,
1063,
2065,
1006,
10381,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
27260,
2229,
19464,
2094,
1006,
10381,
1012,
25869,
10175,
5657,
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-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java | SqlClient.openCli | private void openCli(SessionContext context, Executor executor) {
CliClient cli = null;
try {
cli = new CliClient(context, executor);
// interactive CLI mode
if (options.getUpdateStatement() == null) {
cli.open();
}
// execute single update statement
else {
final boolean success = cli.submitUpdate(options.getUpdateStatement());
if (!success) {
throw new SqlClientException("Could not submit given SQL update statement to cluster.");
}
}
} finally {
if (cli != null) {
cli.close();
}
}
} | java | private void openCli(SessionContext context, Executor executor) {
CliClient cli = null;
try {
cli = new CliClient(context, executor);
// interactive CLI mode
if (options.getUpdateStatement() == null) {
cli.open();
}
// execute single update statement
else {
final boolean success = cli.submitUpdate(options.getUpdateStatement());
if (!success) {
throw new SqlClientException("Could not submit given SQL update statement to cluster.");
}
}
} finally {
if (cli != null) {
cli.close();
}
}
} | [
"private",
"void",
"openCli",
"(",
"SessionContext",
"context",
",",
"Executor",
"executor",
")",
"{",
"CliClient",
"cli",
"=",
"null",
";",
"try",
"{",
"cli",
"=",
"new",
"CliClient",
"(",
"context",
",",
"executor",
")",
";",
"// interactive CLI mode",
"if... | Opens the CLI client for executing SQL statements.
@param context session context
@param executor executor | [
"Opens",
"the",
"CLI",
"client",
"for",
"executing",
"SQL",
"statements",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java#L117-L137 | train | Opens the CLI mode. | [
30522,
2797,
11675,
2330,
20464,
2072,
1006,
5219,
8663,
18209,
6123,
1010,
4654,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1007,
1063,
18856,
2594,
8751,
3372,
18856,
2072,
1027,
19701,
1025,
3046,
1063,
18856,
2072,
1027,
2047,
18856,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.floor | public Decimal floor() {
BigDecimal bd = toBigDecimal().setScale(0, RoundingMode.FLOOR);
return fromBigDecimal(bd, bd.precision(), 0);
} | java | public Decimal floor() {
BigDecimal bd = toBigDecimal().setScale(0, RoundingMode.FLOOR);
return fromBigDecimal(bd, bd.precision(), 0);
} | [
"public",
"Decimal",
"floor",
"(",
")",
"{",
"BigDecimal",
"bd",
"=",
"toBigDecimal",
"(",
")",
".",
"setScale",
"(",
"0",
",",
"RoundingMode",
".",
"FLOOR",
")",
";",
"return",
"fromBigDecimal",
"(",
"bd",
",",
"bd",
".",
"precision",
"(",
")",
",",
... | note that result may exceed the original precision. | [
"note",
"that",
"result",
"may",
"exceed",
"the",
"original",
"precision",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L258-L261 | train | Floor the decimal value. | [
30522,
2270,
26066,
2723,
1006,
1007,
1063,
2502,
3207,
6895,
9067,
1038,
2094,
1027,
2000,
5638,
2290,
3207,
6895,
9067,
1006,
1007,
1012,
4520,
9289,
2063,
1006,
1014,
1010,
26939,
5302,
3207,
1012,
2723,
30524,
1038,
2094,
1012,
11718,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/writer/RecordWriter.java | RecordWriter.tryFinishCurrentBufferBuilder | private void tryFinishCurrentBufferBuilder(int targetChannel) {
if (!bufferBuilders[targetChannel].isPresent()) {
return;
}
BufferBuilder bufferBuilder = bufferBuilders[targetChannel].get();
bufferBuilders[targetChannel] = Optional.empty();
numBytesOut.inc(bufferBuilder.finish());
numBuffersOut.inc();
} | java | private void tryFinishCurrentBufferBuilder(int targetChannel) {
if (!bufferBuilders[targetChannel].isPresent()) {
return;
}
BufferBuilder bufferBuilder = bufferBuilders[targetChannel].get();
bufferBuilders[targetChannel] = Optional.empty();
numBytesOut.inc(bufferBuilder.finish());
numBuffersOut.inc();
} | [
"private",
"void",
"tryFinishCurrentBufferBuilder",
"(",
"int",
"targetChannel",
")",
"{",
"if",
"(",
"!",
"bufferBuilders",
"[",
"targetChannel",
"]",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
";",
"}",
"BufferBuilder",
"bufferBuilder",
"=",
"bufferBuilde... | Marks the current {@link BufferBuilder} as finished and clears the state for next one. | [
"Marks",
"the",
"current",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java#L231-L239 | train | Tries to finish the current buffer builder. | [
30522,
2797,
11675,
3046,
16294,
4509,
10841,
14343,
3372,
8569,
12494,
8569,
23891,
2099,
1006,
20014,
4539,
26058,
1007,
1063,
2065,
1006,
999,
17698,
8569,
23891,
2869,
1031,
4539,
26058,
1033,
1012,
2003,
28994,
4765,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/suggest/Suggester.java | Suggester.sortScoreMap | private static TreeMap<Double ,Set<String>> sortScoreMap(TreeMap<String, Double> scoreMap)
{
TreeMap<Double, Set<String>> result = new TreeMap<Double, Set<String>>(Collections.reverseOrder());
for (Map.Entry<String, Double> entry : scoreMap.entrySet())
{
Set<String> sentenceSet = result.get(entry.getValue());
if (sentenceSet == null)
{
sentenceSet = new HashSet<String>();
result.put(entry.getValue(), sentenceSet);
}
sentenceSet.add(entry.getKey());
}
return result;
} | java | private static TreeMap<Double ,Set<String>> sortScoreMap(TreeMap<String, Double> scoreMap)
{
TreeMap<Double, Set<String>> result = new TreeMap<Double, Set<String>>(Collections.reverseOrder());
for (Map.Entry<String, Double> entry : scoreMap.entrySet())
{
Set<String> sentenceSet = result.get(entry.getValue());
if (sentenceSet == null)
{
sentenceSet = new HashSet<String>();
result.put(entry.getValue(), sentenceSet);
}
sentenceSet.add(entry.getKey());
}
return result;
} | [
"private",
"static",
"TreeMap",
"<",
"Double",
",",
"Set",
"<",
"String",
">",
">",
"sortScoreMap",
"(",
"TreeMap",
"<",
"String",
",",
"Double",
">",
"scoreMap",
")",
"{",
"TreeMap",
"<",
"Double",
",",
"Set",
"<",
"String",
">",
">",
"result",
"=",
... | 将分数map排序折叠
@param scoreMap
@return | [
"将分数map排序折叠"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/suggest/Suggester.java#L109-L124 | train | Sort the score map. | [
30522,
2797,
10763,
3392,
2863,
2361,
1026,
3313,
1010,
2275,
1026,
5164,
1028,
1028,
11901,
17345,
2863,
2361,
1006,
3392,
2863,
2361,
1026,
5164,
1010,
3313,
1028,
3556,
2863,
2361,
1007,
1063,
3392,
2863,
2361,
1026,
3313,
1010,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ReflectUtil.java | ReflectUtil.getConstructorsDirectly | public static Constructor<?>[] getConstructorsDirectly(Class<?> beanClass) throws SecurityException {
Assert.notNull(beanClass);
return beanClass.getDeclaredConstructors();
} | java | public static Constructor<?>[] getConstructorsDirectly(Class<?> beanClass) throws SecurityException {
Assert.notNull(beanClass);
return beanClass.getDeclaredConstructors();
} | [
"public",
"static",
"Constructor",
"<",
"?",
">",
"[",
"]",
"getConstructorsDirectly",
"(",
"Class",
"<",
"?",
">",
"beanClass",
")",
"throws",
"SecurityException",
"{",
"Assert",
".",
"notNull",
"(",
"beanClass",
")",
";",
"return",
"beanClass",
".",
"getDe... | 获得一个类中所有字段列表,直接反射获取,无缓存
@param beanClass 类
@return 字段列表
@throws SecurityException 安全检查异常 | [
"获得一个类中所有字段列表,直接反射获取,无缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L88-L91 | train | Get the constructors directly from the specified class. | [
30522,
2270,
10763,
9570,
2953,
1026,
1029,
1028,
1031,
1033,
2131,
8663,
3367,
6820,
24817,
4305,
2890,
6593,
2135,
1006,
2465,
1026,
1029,
1028,
14068,
26266,
1007,
11618,
3036,
10288,
24422,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Rot.java | Rot.decode | public static String decode(String rot, int offset, boolean isDecodeNumber) {
final int len = rot.length();
final char[] chars = new char[len];
for (int i = 0; i < len; i++) {
chars[i] = decodeChar(rot.charAt(i), offset, isDecodeNumber);
}
return new String(chars);
} | java | public static String decode(String rot, int offset, boolean isDecodeNumber) {
final int len = rot.length();
final char[] chars = new char[len];
for (int i = 0; i < len; i++) {
chars[i] = decodeChar(rot.charAt(i), offset, isDecodeNumber);
}
return new String(chars);
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"rot",
",",
"int",
"offset",
",",
"boolean",
"isDecodeNumber",
")",
"{",
"final",
"int",
"len",
"=",
"rot",
".",
"length",
"(",
")",
";",
"final",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"... | RotN解码
@param rot 被解码的消息密文
@param offset 位移,常用位移13
@param isDecodeNumber 是否解码数字
@return 解码后的字符串 | [
"RotN解码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java#L87-L95 | train | Decodes a String with the given offset. | [
30522,
2270,
10763,
5164,
21933,
3207,
1006,
5164,
18672,
1010,
20014,
16396,
1010,
22017,
20898,
2003,
3207,
16044,
19172,
5677,
1007,
1063,
2345,
20014,
18798,
1027,
18672,
1012,
3091,
1006,
1007,
1025,
2345,
25869,
1031,
1033,
25869,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.substring | public UTF8String substring(final int start, final int until) {
if (until <= start || start >= numBytes) {
return EMPTY_UTF8;
}
int i = 0;
int c = 0;
while (i < numBytes && c < start) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
int j = i;
while (i < numBytes && c < until) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
if (i > j) {
byte[] bytes = new byte[i - j];
copyMemory(base, offset + j, bytes, BYTE_ARRAY_OFFSET, i - j);
return fromBytes(bytes);
} else {
return EMPTY_UTF8;
}
} | java | public UTF8String substring(final int start, final int until) {
if (until <= start || start >= numBytes) {
return EMPTY_UTF8;
}
int i = 0;
int c = 0;
while (i < numBytes && c < start) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
int j = i;
while (i < numBytes && c < until) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
if (i > j) {
byte[] bytes = new byte[i - j];
copyMemory(base, offset + j, bytes, BYTE_ARRAY_OFFSET, i - j);
return fromBytes(bytes);
} else {
return EMPTY_UTF8;
}
} | [
"public",
"UTF8String",
"substring",
"(",
"final",
"int",
"start",
",",
"final",
"int",
"until",
")",
"{",
"if",
"(",
"until",
"<=",
"start",
"||",
"start",
">=",
"numBytes",
")",
"{",
"return",
"EMPTY_UTF8",
";",
"}",
"int",
"i",
"=",
"0",
";",
"int... | Returns a substring of this.
@param start the position of first code point
@param until the position after last code point, exclusive. | [
"Returns",
"a",
"substring",
"of",
"this",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L308-L333 | train | Returns a substring of this string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
4942,
3367,
4892,
1006,
2345,
20014,
2707,
1010,
2345,
20014,
2127,
1007,
1063,
2065,
1006,
2127,
1026,
1027,
2707,
1064,
1064,
2707,
1028,
1027,
15903,
17250,
2015,
1007,
1063,
2709,
4064,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java | UserAgentParser.parseEngineVersion | private static String parseEngineVersion(Engine engine, String userAgentString) {
final String regexp = engine.getName() + "[\\/\\- ]([\\d\\w\\.\\-]+)";
final Pattern pattern = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
return ReUtil.getGroup1(pattern, userAgentString);
} | java | private static String parseEngineVersion(Engine engine, String userAgentString) {
final String regexp = engine.getName() + "[\\/\\- ]([\\d\\w\\.\\-]+)";
final Pattern pattern = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
return ReUtil.getGroup1(pattern, userAgentString);
} | [
"private",
"static",
"String",
"parseEngineVersion",
"(",
"Engine",
"engine",
",",
"String",
"userAgentString",
")",
"{",
"final",
"String",
"regexp",
"=",
"engine",
".",
"getName",
"(",
")",
"+",
"\"[\\\\/\\\\- ]([\\\\d\\\\w\\\\.\\\\-]+)\"",
";",
"final",
"Pattern"... | 解析引擎版本
@param engine 引擎
@param userAgentString User-Agent字符串
@return 引擎版本 | [
"解析引擎版本"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java#L79-L83 | train | Parse the engine version from the user agent string. | [
30522,
2797,
10763,
5164,
11968,
19763,
3070,
3170,
27774,
1006,
3194,
3194,
1010,
5164,
5310,
4270,
7666,
18886,
3070,
1007,
1063,
2345,
5164,
19723,
10288,
2361,
1027,
3194,
1012,
2131,
18442,
1006,
1007,
1009,
1000,
1031,
1032,
1032,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java | DnsNameResolverBuilder.searchDomains | public DnsNameResolverBuilder searchDomains(Iterable<String> searchDomains) {
checkNotNull(searchDomains, "searchDomains");
final List<String> list = new ArrayList<String>(4);
for (String f : searchDomains) {
if (f == null) {
break;
}
// Avoid duplicate entries.
if (list.contains(f)) {
continue;
}
list.add(f);
}
this.searchDomains = list.toArray(new String[0]);
return this;
} | java | public DnsNameResolverBuilder searchDomains(Iterable<String> searchDomains) {
checkNotNull(searchDomains, "searchDomains");
final List<String> list = new ArrayList<String>(4);
for (String f : searchDomains) {
if (f == null) {
break;
}
// Avoid duplicate entries.
if (list.contains(f)) {
continue;
}
list.add(f);
}
this.searchDomains = list.toArray(new String[0]);
return this;
} | [
"public",
"DnsNameResolverBuilder",
"searchDomains",
"(",
"Iterable",
"<",
"String",
">",
"searchDomains",
")",
"{",
"checkNotNull",
"(",
"searchDomains",
",",
"\"searchDomains\"",
")",
";",
"final",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"... | Set the list of search domains of the resolver.
@param searchDomains the search domains
@return {@code this} | [
"Set",
"the",
"list",
"of",
"search",
"domains",
"of",
"the",
"resolver",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java#L345-L365 | train | Sets the search domains. | [
30522,
2270,
1040,
3619,
18442,
30524,
1000,
1007,
1025,
2345,
2862,
1026,
5164,
1028,
2862,
1027,
2047,
9140,
9863,
1026,
5164,
1028,
1006,
1018,
1007,
1025,
2005,
1006,
5164,
1042,
1024,
3945,
9527,
28247,
1007,
1063,
2065,
1006,
1042,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java | HtmlUtil.unwrapHtmlTag | public static String unwrapHtmlTag(String content, String... tagNames) {
return removeHtmlTag(content, false, tagNames);
} | java | public static String unwrapHtmlTag(String content, String... tagNames) {
return removeHtmlTag(content, false, tagNames);
} | [
"public",
"static",
"String",
"unwrapHtmlTag",
"(",
"String",
"content",
",",
"String",
"...",
"tagNames",
")",
"{",
"return",
"removeHtmlTag",
"(",
"content",
",",
"false",
",",
"tagNames",
")",
";",
"}"
] | 清除指定HTML标签,不包括内容<br>
不区分大小写
@param content 文本
@param tagNames 要清除的标签
@return 去除标签后的文本 | [
"清除指定HTML标签,不包括内容<br",
">",
"不区分大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java#L109-L111 | train | Unwraps the HTML tag with the given names. | [
30522,
2270,
10763,
5164,
4895,
13088,
9331,
11039,
19968,
15900,
1006,
5164,
4180,
1010,
5164,
1012,
1012,
1012,
6415,
18442,
2015,
1007,
1063,
2709,
6366,
11039,
19968,
15900,
1006,
4180,
1010,
6270,
1010,
6415,
18442,
2015,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/common/RegistrationRequest.java | RegistrationRequest.build | public static RegistrationRequest build(GridNodeConfiguration configuration, String name) {
return RegistrationRequest.build(configuration, name, null);
} | java | public static RegistrationRequest build(GridNodeConfiguration configuration, String name) {
return RegistrationRequest.build(configuration, name, null);
} | [
"public",
"static",
"RegistrationRequest",
"build",
"(",
"GridNodeConfiguration",
"configuration",
",",
"String",
"name",
")",
"{",
"return",
"RegistrationRequest",
".",
"build",
"(",
"configuration",
",",
"name",
",",
"null",
")",
";",
"}"
] | Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided
name. This is different than {@code new RegistrationRequest(GridNodeConfiguration, String)}
because it will first load any specified {@link GridNodeConfiguration#nodeConfigFile} and then
merge the provided configuration onto it.
@param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
GridNodeConfiguration()} if a {@code null} value is provided since a
request without configuration is not valid.
@param name the name for the remote | [
"Build",
"a",
"RegistrationRequest",
"from",
"the",
"provided",
"{",
"@link",
"GridNodeConfiguration",
"}",
"use",
"the",
"provided",
"name",
".",
"This",
"is",
"different",
"than",
"{",
"@code",
"new",
"RegistrationRequest",
"(",
"GridNodeConfiguration",
"String",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/common/RegistrationRequest.java#L178-L180 | train | Build a RegistrationRequest object from the given configuration and name. | [
30522,
2270,
10763,
8819,
2890,
15500,
3857,
1006,
8370,
3630,
3207,
8663,
8873,
27390,
3370,
9563,
1010,
5164,
2171,
1007,
1063,
2709,
8819,
2890,
15500,
1012,
3857,
1006,
9563,
1010,
2171,
1010,
19701,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Bzip2HuffmanAllocator.java | Bzip2HuffmanAllocator.allocateNodeLengthsWithRelocation | private static void allocateNodeLengthsWithRelocation(final int[] array,
final int nodesToMove, final int insertDepth) {
int firstNode = array.length - 2;
int nextNode = array.length - 1;
int currentDepth = insertDepth == 1 ? 2 : 1;
int nodesLeftToMove = insertDepth == 1 ? nodesToMove - 2 : nodesToMove;
for (int availableNodes = currentDepth << 1; availableNodes > 0; currentDepth++) {
final int lastNode = firstNode;
firstNode = firstNode <= nodesToMove ? firstNode : first(array, lastNode - 1, nodesToMove);
int offset = 0;
if (currentDepth >= insertDepth) {
offset = Math.min(nodesLeftToMove, 1 << (currentDepth - insertDepth));
} else if (currentDepth == insertDepth - 1) {
offset = 1;
if (array[firstNode] == lastNode) {
firstNode++;
}
}
for (int i = availableNodes - (lastNode - firstNode + offset); i > 0; i--) {
array[nextNode--] = currentDepth;
}
nodesLeftToMove -= offset;
availableNodes = (lastNode - firstNode + offset) << 1;
}
} | java | private static void allocateNodeLengthsWithRelocation(final int[] array,
final int nodesToMove, final int insertDepth) {
int firstNode = array.length - 2;
int nextNode = array.length - 1;
int currentDepth = insertDepth == 1 ? 2 : 1;
int nodesLeftToMove = insertDepth == 1 ? nodesToMove - 2 : nodesToMove;
for (int availableNodes = currentDepth << 1; availableNodes > 0; currentDepth++) {
final int lastNode = firstNode;
firstNode = firstNode <= nodesToMove ? firstNode : first(array, lastNode - 1, nodesToMove);
int offset = 0;
if (currentDepth >= insertDepth) {
offset = Math.min(nodesLeftToMove, 1 << (currentDepth - insertDepth));
} else if (currentDepth == insertDepth - 1) {
offset = 1;
if (array[firstNode] == lastNode) {
firstNode++;
}
}
for (int i = availableNodes - (lastNode - firstNode + offset); i > 0; i--) {
array[nextNode--] = currentDepth;
}
nodesLeftToMove -= offset;
availableNodes = (lastNode - firstNode + offset) << 1;
}
} | [
"private",
"static",
"void",
"allocateNodeLengthsWithRelocation",
"(",
"final",
"int",
"[",
"]",
"array",
",",
"final",
"int",
"nodesToMove",
",",
"final",
"int",
"insertDepth",
")",
"{",
"int",
"firstNode",
"=",
"array",
".",
"length",
"-",
"2",
";",
"int",... | A final allocation pass that relocates nodes in order to achieve a maximum code length limit.
@param array The code length array
@param nodesToMove The number of internal nodes to be relocated
@param insertDepth The depth at which to insert relocated nodes | [
"A",
"final",
"allocation",
"pass",
"that",
"relocates",
"nodes",
"in",
"order",
"to",
"achieve",
"a",
"maximum",
"code",
"length",
"limit",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java#L122-L150 | train | Allocate node lengths with relocation. | [
30522,
2797,
10763,
11675,
2035,
24755,
6528,
10244,
7770,
13512,
7898,
24415,
16570,
23909,
1006,
2345,
20014,
1031,
1033,
9140,
1010,
2345,
20014,
14164,
20389,
21818,
1010,
2345,
20014,
19274,
3207,
13876,
2232,
1007,
1063,
20014,
2034,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java | TaskSlot.markInactive | public boolean markInactive() {
if (TaskSlotState.ACTIVE == state || TaskSlotState.ALLOCATED == state) {
state = TaskSlotState.ALLOCATED;
return true;
} else {
return false;
}
} | java | public boolean markInactive() {
if (TaskSlotState.ACTIVE == state || TaskSlotState.ALLOCATED == state) {
state = TaskSlotState.ALLOCATED;
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"markInactive",
"(",
")",
"{",
"if",
"(",
"TaskSlotState",
".",
"ACTIVE",
"==",
"state",
"||",
"TaskSlotState",
".",
"ALLOCATED",
"==",
"state",
")",
"{",
"state",
"=",
"TaskSlotState",
".",
"ALLOCATED",
";",
"return",
"true",
";",
"}"... | Mark the slot as inactive/allocated. A slot can only be marked as inactive/allocated if it's
in state allocated or active.
@return True if the new state of the slot is allocated; otherwise false | [
"Mark",
"the",
"slot",
"as",
"inactive",
"/",
"allocated",
".",
"A",
"slot",
"can",
"only",
"be",
"marked",
"as",
"inactive",
"/",
"allocated",
"if",
"it",
"s",
"in",
"state",
"allocated",
"or",
"active",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java#L253-L261 | train | Mark this slot as inactive. | [
30522,
2270,
22017,
20898,
2928,
3981,
15277,
1006,
1007,
1063,
2065,
1006,
8518,
10994,
9153,
2618,
1012,
3161,
1027,
1027,
2110,
1064,
1064,
8518,
10994,
9153,
2618,
1012,
11095,
1027,
1027,
2110,
1007,
1063,
2110,
1027,
8518,
10994,
9153... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java | StateAssignmentOperation.extractIntersectingState | private static void extractIntersectingState(
Collection<KeyedStateHandle> originalSubtaskStateHandles,
KeyGroupRange rangeToExtract,
List<KeyedStateHandle> extractedStateCollector) {
for (KeyedStateHandle keyedStateHandle : originalSubtaskStateHandles) {
if (keyedStateHandle != null) {
KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(rangeToExtract);
if (intersectedKeyedStateHandle != null) {
extractedStateCollector.add(intersectedKeyedStateHandle);
}
}
}
} | java | private static void extractIntersectingState(
Collection<KeyedStateHandle> originalSubtaskStateHandles,
KeyGroupRange rangeToExtract,
List<KeyedStateHandle> extractedStateCollector) {
for (KeyedStateHandle keyedStateHandle : originalSubtaskStateHandles) {
if (keyedStateHandle != null) {
KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(rangeToExtract);
if (intersectedKeyedStateHandle != null) {
extractedStateCollector.add(intersectedKeyedStateHandle);
}
}
}
} | [
"private",
"static",
"void",
"extractIntersectingState",
"(",
"Collection",
"<",
"KeyedStateHandle",
">",
"originalSubtaskStateHandles",
",",
"KeyGroupRange",
"rangeToExtract",
",",
"List",
"<",
"KeyedStateHandle",
">",
"extractedStateCollector",
")",
"{",
"for",
"(",
"... | Extracts certain key group ranges from the given state handles and adds them to the collector. | [
"Extracts",
"certain",
"key",
"group",
"ranges",
"from",
"the",
"given",
"state",
"handles",
"and",
"adds",
"them",
"to",
"the",
"collector",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java#L464-L480 | train | Extract the intersection of the given range to extract into the given list of state handles. | [
30522,
2797,
10763,
11675,
14817,
18447,
2545,
22471,
8613,
12259,
1006,
3074,
1026,
3145,
2098,
9153,
2618,
11774,
2571,
1028,
23728,
12083,
10230,
5705,
12259,
11774,
4244,
1010,
3145,
17058,
24388,
2063,
2846,
3406,
10288,
6494,
6593,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronNameGenderClassifier.java | PerceptronNameGenderClassifier.extractGivenName | public static String extractGivenName(String name)
{
if (name.length() <= 2)
return "_" + name.substring(name.length() - 1);
else
return name.substring(name.length() - 2);
} | java | public static String extractGivenName(String name)
{
if (name.length() <= 2)
return "_" + name.substring(name.length() - 1);
else
return name.substring(name.length() - 2);
} | [
"public",
"static",
"String",
"extractGivenName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"<=",
"2",
")",
"return",
"\"_\"",
"+",
"name",
".",
"substring",
"(",
"name",
".",
"length",
"(",
")",
"-",
"1",
")",
";... | 去掉姓氏,截取中国人名中的名字
@param name 姓名
@return 名 | [
"去掉姓氏,截取中国人名中的名字"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronNameGenderClassifier.java#L63-L70 | train | Extract a name from a name of a CID SECTYPE. | [
30522,
2270,
10763,
5164,
14817,
5856,
8159,
18442,
1006,
5164,
2171,
1007,
1063,
2065,
1006,
2171,
1012,
3091,
1006,
1007,
1026,
1027,
1016,
1007,
2709,
1000,
1035,
1000,
1009,
2171,
1012,
4942,
3367,
4892,
1006,
2171,
1012,
3091,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/comparator/VersionComparator.java | VersionComparator.compare | @Override
public int compare(String version1, String version2) {
if(version1 == version2) {
return 0;
}
if (version1 == null && version2 == null) {
return 0;
} else if (version1 == null) {// null视为最小版本,排在前
return -1;
} else if (version2 == null) {
return 1;
}
final List<String> v1s = StrUtil.split(version1, CharUtil.DOT);
final List<String> v2s = StrUtil.split(version2, CharUtil.DOT);
int diff = 0;
int minLength = Math.min(v1s.size(), v2s.size());// 取最小长度值
String v1;
String v2;
for (int i = 0; i < minLength; i++) {
v1 = v1s.get(i);
v2 = v2s.get(i);
// 先比较长度
diff = v1.length() - v2.length();
if (0 == diff) {
diff = v1.compareTo(v2);
}
if(diff != 0) {
//已有结果,结束
break;
}
}
// 如果已经分出大小,则直接返回,如果未分出大小,则再比较位数,有子版本的为大;
return (diff != 0) ? diff : v1s.size() - v2s.size();
} | java | @Override
public int compare(String version1, String version2) {
if(version1 == version2) {
return 0;
}
if (version1 == null && version2 == null) {
return 0;
} else if (version1 == null) {// null视为最小版本,排在前
return -1;
} else if (version2 == null) {
return 1;
}
final List<String> v1s = StrUtil.split(version1, CharUtil.DOT);
final List<String> v2s = StrUtil.split(version2, CharUtil.DOT);
int diff = 0;
int minLength = Math.min(v1s.size(), v2s.size());// 取最小长度值
String v1;
String v2;
for (int i = 0; i < minLength; i++) {
v1 = v1s.get(i);
v2 = v2s.get(i);
// 先比较长度
diff = v1.length() - v2.length();
if (0 == diff) {
diff = v1.compareTo(v2);
}
if(diff != 0) {
//已有结果,结束
break;
}
}
// 如果已经分出大小,则直接返回,如果未分出大小,则再比较位数,有子版本的为大;
return (diff != 0) ? diff : v1s.size() - v2s.size();
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"String",
"version1",
",",
"String",
"version2",
")",
"{",
"if",
"(",
"version1",
"==",
"version2",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"version1",
"==",
"null",
"&&",
"version2",
"==",
"null"... | 比较两个版本<br>
null版本排在最小:既:
<pre>
compare(null, "v1") < 0
compare("v1", "v1") = 0
compare(null, null) = 0
compare("v1", null) > 0
compare("1.0.0", "1.0.2") < 0
compare("1.0.2", "1.0.2a") < 0
compare("1.13.0", "1.12.1c") > 0
compare("V0.0.20170102", "V0.0.20170101") > 0
</pre>
@param version1 版本1
@param version2 版本2 | [
"比较两个版本<br",
">",
"null版本排在最小:既:",
"<pre",
">",
"compare",
"(",
"null",
"v1",
")",
"<",
";",
"0",
"compare",
"(",
"v1",
"v1",
")",
"=",
"0",
"compare",
"(",
"null",
"null",
")",
"=",
"0",
"compare",
"(",
"v1",
"null",
")",
">",
";",
"0",
"com... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/VersionComparator.java#L50-L86 | train | Compares two version strings. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
1006,
5164,
2544,
2487,
1010,
5164,
2544,
2475,
1007,
1063,
2065,
1006,
2544,
2487,
1027,
1027,
2544,
2475,
1007,
1063,
2709,
1014,
1025,
1065,
2065,
1006,
2544,
2487,
1027,
1027,
19701,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java | RemoteEnvironment.installShutdownHook | private void installShutdownHook() {
if (shutdownHook == null) {
this.shutdownHook = ShutdownHookUtil.addShutdownHook(this::dispose, getClass().getSimpleName(), LOG);
}
} | java | private void installShutdownHook() {
if (shutdownHook == null) {
this.shutdownHook = ShutdownHookUtil.addShutdownHook(this::dispose, getClass().getSimpleName(), LOG);
}
} | [
"private",
"void",
"installShutdownHook",
"(",
")",
"{",
"if",
"(",
"shutdownHook",
"==",
"null",
")",
"{",
"this",
".",
"shutdownHook",
"=",
"ShutdownHookUtil",
".",
"addShutdownHook",
"(",
"this",
"::",
"dispose",
",",
"getClass",
"(",
")",
".",
"getSimple... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java#L252-L256 | train | Installs a shutdown hook. | [
30522,
2797,
11675,
16500,
14235,
2102,
7698,
6806,
6559,
1006,
1007,
1063,
2065,
1006,
3844,
7698,
6806,
6559,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
3844,
7698,
6806,
6559,
1027,
3844,
7698,
6806,
21940,
3775,
2140,
1012,
9909,
6979,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.copy | public static File copy(String srcPath, String destPath, boolean isOverride) throws IORuntimeException {
return copy(file(srcPath), file(destPath), isOverride);
} | java | public static File copy(String srcPath, String destPath, boolean isOverride) throws IORuntimeException {
return copy(file(srcPath), file(destPath), isOverride);
} | [
"public",
"static",
"File",
"copy",
"(",
"String",
"srcPath",
",",
"String",
"destPath",
",",
"boolean",
"isOverride",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"file",
"(",
"srcPath",
")",
",",
"file",
"(",
"destPath",
")",
",",
"is... | 复制文件或目录<br>
如果目标文件为目录,则将源文件以相同文件名拷贝到目标目录
@param srcPath 源文件或目录
@param destPath 目标文件或目录,目标不存在会自动创建(目录、文件都创建)
@param isOverride 是否覆盖目标文件
@return 目标目录或文件
@throws IORuntimeException IO异常 | [
"复制文件或目录<br",
">",
"如果目标文件为目录,则将源文件以相同文件名拷贝到目标目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L983-L985 | train | Copy a file from srcPath to destPath. | [
30522,
2270,
10763,
5371,
6100,
1006,
5164,
5034,
21906,
8988,
1010,
5164,
4078,
25856,
8988,
1010,
30524,
6100,
1006,
5371,
1006,
5034,
21906,
8988,
1007,
1010,
5371,
1006,
4078,
25856,
8988,
1007,
1010,
11163,
6299,
15637,
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/incubator-shardingsphere | sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/ShardingExecutorService.java | ShardingExecutorService.close | public void close() {
SHUTDOWN_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
try {
executorService.shutdown();
while (!executorService.awaitTermination(5, TimeUnit.SECONDS)) {
executorService.shutdownNow();
}
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
});
} | java | public void close() {
SHUTDOWN_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
try {
executorService.shutdown();
while (!executorService.awaitTermination(5, TimeUnit.SECONDS)) {
executorService.shutdownNow();
}
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
});
} | [
"public",
"void",
"close",
"(",
")",
"{",
"SHUTDOWN_EXECUTOR",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"executorService",
".",
"shutdown",
"(",
")",
";",
"while",
"(",
... | Close executor service. | [
"Close",
"executor",
"service",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/ShardingExecutorService.java#L61-L76 | train | Close the application. | [
30522,
2270,
11675,
2485,
1006,
1007,
1063,
3844,
7698,
1035,
4654,
8586,
16161,
2099,
1012,
15389,
1006,
2047,
2448,
22966,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
11675,
2448,
1006,
1007,
1063,
3046,
1063,
4654,
8586,
16161,
22573,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/iterative/task/AbstractIterativeTask.java | AbstractIterativeTask.createWorksetUpdateOutputCollector | protected Collector<OT> createWorksetUpdateOutputCollector(Collector<OT> delegate) {
DataOutputView outputView = worksetBackChannel.getWriteEnd();
TypeSerializer<OT> serializer = getOutputSerializer();
return new WorksetUpdateOutputCollector<OT>(outputView, serializer, delegate);
} | java | protected Collector<OT> createWorksetUpdateOutputCollector(Collector<OT> delegate) {
DataOutputView outputView = worksetBackChannel.getWriteEnd();
TypeSerializer<OT> serializer = getOutputSerializer();
return new WorksetUpdateOutputCollector<OT>(outputView, serializer, delegate);
} | [
"protected",
"Collector",
"<",
"OT",
">",
"createWorksetUpdateOutputCollector",
"(",
"Collector",
"<",
"OT",
">",
"delegate",
")",
"{",
"DataOutputView",
"outputView",
"=",
"worksetBackChannel",
".",
"getWriteEnd",
"(",
")",
";",
"TypeSerializer",
"<",
"OT",
">",
... | Creates a new {@link WorksetUpdateOutputCollector}.
<p>This collector is used by {@link IterationIntermediateTask} or {@link IterationTailTask} to update the
workset.
<p>If a non-null delegate is given, the new {@link Collector} will write to the solution set and also call
collect(T) of the delegate.
@param delegate null -OR- the delegate on which to call collect() by the newly created collector
@return a new {@link WorksetUpdateOutputCollector} | [
"Creates",
"a",
"new",
"{",
"@link",
"WorksetUpdateOutputCollector",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/task/AbstractIterativeTask.java#L316-L320 | train | Create a workset update output collector. | [
30522,
5123,
10018,
1026,
27178,
1028,
3443,
9316,
3388,
6279,
13701,
5833,
18780,
26895,
22471,
2953,
1006,
10018,
1026,
27178,
1028,
11849,
1007,
1063,
2951,
5833,
18780,
8584,
6434,
8584,
1027,
2573,
3388,
5963,
26058,
1012,
2131,
26373,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java | HttpConversionUtil.toFullHttpRequest | public static FullHttpRequest toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
boolean validateHttpHeaders)
throws Http2Exception {
// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.
final CharSequence method = checkNotNull(http2Headers.method(),
"method header cannot be null in conversion to HTTP/1.x");
final CharSequence path = checkNotNull(http2Headers.path(),
"path header cannot be null in conversion to HTTP/1.x");
FullHttpRequest msg = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method
.toString()), path.toString(), alloc.buffer(), validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg, false);
} catch (Http2Exception e) {
msg.release();
throw e;
} catch (Throwable t) {
msg.release();
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | java | public static FullHttpRequest toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
boolean validateHttpHeaders)
throws Http2Exception {
// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.
final CharSequence method = checkNotNull(http2Headers.method(),
"method header cannot be null in conversion to HTTP/1.x");
final CharSequence path = checkNotNull(http2Headers.path(),
"path header cannot be null in conversion to HTTP/1.x");
FullHttpRequest msg = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method
.toString()), path.toString(), alloc.buffer(), validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg, false);
} catch (Http2Exception e) {
msg.release();
throw e;
} catch (Throwable t) {
msg.release();
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | [
"public",
"static",
"FullHttpRequest",
"toFullHttpRequest",
"(",
"int",
"streamId",
",",
"Http2Headers",
"http2Headers",
",",
"ByteBufAllocator",
"alloc",
",",
"boolean",
"validateHttpHeaders",
")",
"throws",
"Http2Exception",
"{",
"// HTTP/2 does not define a way to carry th... | Create a new object to contain the request data
@param streamId The stream associated with the request
@param http2Headers The initial set of HTTP/2 headers to create the request with
@param alloc The {@link ByteBufAllocator} to use to generate the content of the message
@param validateHttpHeaders <ul>
<li>{@code true} to validate HTTP headers in the http-codec</li>
<li>{@code false} not to validate HTTP headers in the http-codec</li>
</ul>
@return A new request object which represents headers/data
@throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)} | [
"Create",
"a",
"new",
"object",
"to",
"contain",
"the",
"request",
"data"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L246-L266 | train | Convert a HTTP2 request to a FullHttpRequest. | [
30522,
2270,
10763,
2440,
11039,
25856,
2890,
15500,
2000,
3993,
2140,
11039,
25856,
2890,
15500,
1006,
20014,
5460,
3593,
1010,
8299,
2475,
4974,
2545,
8299,
2475,
4974,
2545,
1010,
24880,
8569,
13976,
24755,
4263,
2035,
10085,
1010,
22017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java | IOManager.createChannel | public FileIOChannel.ID createChannel() {
final int num = getNextPathNum();
return new FileIOChannel.ID(this.paths[num], num, this.random);
} | java | public FileIOChannel.ID createChannel() {
final int num = getNextPathNum();
return new FileIOChannel.ID(this.paths[num], num, this.random);
} | [
"public",
"FileIOChannel",
".",
"ID",
"createChannel",
"(",
")",
"{",
"final",
"int",
"num",
"=",
"getNextPathNum",
"(",
")",
";",
"return",
"new",
"FileIOChannel",
".",
"ID",
"(",
"this",
".",
"paths",
"[",
"num",
"]",
",",
"num",
",",
"this",
".",
... | Creates a new {@link FileIOChannel.ID} in one of the temp directories. Multiple
invocations of this method spread the channels evenly across the different directories.
@return A channel to a temporary directory. | [
"Creates",
"a",
"new",
"{",
"@link",
"FileIOChannel",
".",
"ID",
"}",
"in",
"one",
"of",
"the",
"temp",
"directories",
".",
"Multiple",
"invocations",
"of",
"this",
"method",
"spread",
"the",
"channels",
"evenly",
"across",
"the",
"different",
"directories",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java#L128-L131 | train | Creates a new file channel. | [
30522,
2270,
5371,
3695,
26058,
1012,
8909,
3443,
26058,
1006,
1007,
1063,
2345,
20014,
16371,
2213,
1027,
2131,
2638,
18413,
15069,
19172,
1006,
1007,
1025,
2709,
2047,
5371,
3695,
26058,
1012,
8909,
1006,
2023,
1012,
10425,
1031,
16371,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.fromBigDecimal | public static Decimal fromBigDecimal(BigDecimal bd, int precision, int scale) {
bd = bd.setScale(scale, RoundingMode.HALF_UP);
if (bd.precision() > precision) {
return null;
}
long longVal = -1;
if (precision <= MAX_COMPACT_PRECISION) {
longVal = bd.movePointRight(scale).longValueExact();
}
return new Decimal(precision, scale, longVal, bd);
} | java | public static Decimal fromBigDecimal(BigDecimal bd, int precision, int scale) {
bd = bd.setScale(scale, RoundingMode.HALF_UP);
if (bd.precision() > precision) {
return null;
}
long longVal = -1;
if (precision <= MAX_COMPACT_PRECISION) {
longVal = bd.movePointRight(scale).longValueExact();
}
return new Decimal(precision, scale, longVal, bd);
} | [
"public",
"static",
"Decimal",
"fromBigDecimal",
"(",
"BigDecimal",
"bd",
",",
"int",
"precision",
",",
"int",
"scale",
")",
"{",
"bd",
"=",
"bd",
".",
"setScale",
"(",
"scale",
",",
"RoundingMode",
".",
"HALF_UP",
")",
";",
"if",
"(",
"bd",
".",
"prec... | then `precision` is checked. if precision overflow, it will return `null` | [
"then",
"precision",
"is",
"checked",
".",
"if",
"precision",
"overflow",
"it",
"will",
"return",
"null"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L158-L169 | train | Create a Decimal from a BigDecimal. | [
30522,
2270,
10763,
26066,
2013,
5638,
2290,
3207,
6895,
9067,
1006,
2502,
3207,
6895,
9067,
1038,
2094,
1010,
20014,
11718,
1010,
20014,
4094,
1007,
1063,
1038,
2094,
1027,
1038,
2094,
1012,
4520,
9289,
2063,
1006,
4094,
1010,
26939,
5302,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java | Shell.handleSigInt | protected void handleSigInt() {
if (this.commandRunner.handleSigInt()) {
return;
}
System.out.println(String.format("%nThanks for using Spring Boot"));
System.exit(1);
} | java | protected void handleSigInt() {
if (this.commandRunner.handleSigInt()) {
return;
}
System.out.println(String.format("%nThanks for using Spring Boot"));
System.exit(1);
} | [
"protected",
"void",
"handleSigInt",
"(",
")",
"{",
"if",
"(",
"this",
".",
"commandRunner",
".",
"handleSigInt",
"(",
")",
")",
"{",
"return",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"String",
".",
"format",
"(",
"\"%nThanks for using Spring ... | Final handle an interrupt signal (CTRL-C). | [
"Final",
"handle",
"an",
"interrupt",
"signal",
"(",
"CTRL",
"-",
"C",
")",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java#L175-L181 | train | Handle the sigint. | [
30522,
5123,
11675,
16024,
8004,
18447,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
3094,
23195,
1012,
16024,
8004,
18447,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
5164,
1012,
4289,
1006,
1000,
1003... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/IterativeDataSet.java | IterativeDataSet.translateToDataFlow | @Override
protected org.apache.flink.api.common.operators.SingleInputOperator<T, T, ?> translateToDataFlow(Operator<T> input) {
// All the translation magic happens when the iteration end is encountered.
throw new InvalidProgramException("A data set that is part of an iteration was used as a sink or action."
+ " Did you forget to close the iteration?");
} | java | @Override
protected org.apache.flink.api.common.operators.SingleInputOperator<T, T, ?> translateToDataFlow(Operator<T> input) {
// All the translation magic happens when the iteration end is encountered.
throw new InvalidProgramException("A data set that is part of an iteration was used as a sink or action."
+ " Did you forget to close the iteration?");
} | [
"@",
"Override",
"protected",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"operators",
".",
"SingleInputOperator",
"<",
"T",
",",
"T",
",",
"?",
">",
"translateToDataFlow",
"(",
"Operator",
"<",
"T",
">",
"input",
")",
"{",
"// ... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/IterativeDataSet.java#L150-L155 | train | This method is used to translate a single input operator to a data flow. | [
30522,
1030,
2058,
15637,
5123,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
17928,
1012,
2691,
1012,
9224,
1012,
2309,
2378,
18780,
25918,
8844,
1026,
1056,
1010,
1056,
1010,
1029,
1028,
17637,
3406,
2850,
2696,
12314,
1006,
6872,
1026,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.bufferToArray | public static byte[] bufferToArray(ByteBuffer buffer) {
if (buffer.hasArray() && buffer.arrayOffset() == 0 &&
buffer.array().length == buffer.remaining()) {
return buffer.array();
} else {
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
return bytes;
}
} | java | public static byte[] bufferToArray(ByteBuffer buffer) {
if (buffer.hasArray() && buffer.arrayOffset() == 0 &&
buffer.array().length == buffer.remaining()) {
return buffer.array();
} else {
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
return bytes;
}
} | [
"public",
"static",
"byte",
"[",
"]",
"bufferToArray",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
"&&",
"buffer",
".",
"arrayOffset",
"(",
")",
"==",
"0",
"&&",
"buffer",
".",
"array",
"(",
")",
".",
"lengt... | Returns a byte array with the buffer's contents, trying to avoid copying the data if
possible. | [
"Returns",
"a",
"byte",
"array",
"with",
"the",
"buffer",
"s",
"contents",
"trying",
"to",
"avoid",
"copying",
"the",
"data",
"if",
"possible",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L354-L363 | train | Get the bytes from the given ByteBuffer. | [
30522,
2270,
10763,
24880,
1031,
1033,
17698,
3406,
2906,
9447,
1006,
24880,
8569,
12494,
17698,
1007,
1063,
2065,
1006,
17698,
1012,
2038,
2906,
9447,
1006,
1007,
1004,
1004,
17698,
1012,
9140,
27475,
3388,
1006,
1007,
1027,
1027,
1014,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
if (length == 0) {
return EMPTY_BUFFER;
}
return copiedBuffer(CharBuffer.wrap(array, offset, length), charset);
} | java | public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
if (length == 0) {
return EMPTY_BUFFER;
}
return copiedBuffer(CharBuffer.wrap(array, offset, length), charset);
} | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ar... | Creates a new big-endian buffer whose content is a subregion of
the specified {@code array} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the length of the encoded string respectively. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"whose",
"content",
"is",
"a",
"subregion",
"of",
"the",
"specified",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L641-L649 | train | Create a new byte buffer that wraps the specified char array. | [
30522,
2270,
10763,
24880,
8569,
2546,
15826,
8569,
12494,
1006,
25869,
1031,
1033,
9140,
1010,
20014,
16396,
1010,
20014,
3091,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
9140,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java | RC4.decrypt | public String decrypt(byte[] message, Charset charset) throws CryptoException {
return StrUtil.str(crypt(message), charset);
} | java | public String decrypt(byte[] message, Charset charset) throws CryptoException {
return StrUtil.str(crypt(message), charset);
} | [
"public",
"String",
"decrypt",
"(",
"byte",
"[",
"]",
"message",
",",
"Charset",
"charset",
")",
"throws",
"CryptoException",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"crypt",
"(",
"message",
")",
",",
"charset",
")",
";",
"}"
] | 解密
@param message 消息
@param charset 编码
@return 明文
@throws CryptoException key长度小于5或者大于255抛出此异常 | [
"解密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L72-L74 | train | Decrypt a byte array. | [
30522,
2270,
5164,
11703,
2854,
13876,
1006,
24880,
1031,
1033,
4471,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
19888,
8913,
2595,
24422,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
19888,
1006,
4471,
1007,
1010,
25869,
13462,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java | Execution.triggerSynchronousSavepoint | public void triggerSynchronousSavepoint(long checkpointId, long timestamp, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) {
triggerCheckpointHelper(checkpointId, timestamp, checkpointOptions, advanceToEndOfEventTime);
} | java | public void triggerSynchronousSavepoint(long checkpointId, long timestamp, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) {
triggerCheckpointHelper(checkpointId, timestamp, checkpointOptions, advanceToEndOfEventTime);
} | [
"public",
"void",
"triggerSynchronousSavepoint",
"(",
"long",
"checkpointId",
",",
"long",
"timestamp",
",",
"CheckpointOptions",
"checkpointOptions",
",",
"boolean",
"advanceToEndOfEventTime",
")",
"{",
"triggerCheckpointHelper",
"(",
"checkpointId",
",",
"timestamp",
",... | Trigger a new checkpoint on the task of this execution.
@param checkpointId of th checkpoint to trigger
@param timestamp of the checkpoint to trigger
@param checkpointOptions of the checkpoint to trigger
@param advanceToEndOfEventTime Flag indicating if the source should inject a {@code MAX_WATERMARK} in the pipeline
to fire any registered event-time timers | [
"Trigger",
"a",
"new",
"checkpoint",
"on",
"the",
"task",
"of",
"this",
"execution",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L881-L883 | train | Trigger a synchronous savepoint. | [
30522,
2270,
11675,
27099,
6038,
2818,
4948,
3560,
3736,
3726,
8400,
1006,
2146,
26520,
3593,
1010,
2146,
2335,
15464,
2361,
1010,
26520,
7361,
9285,
26520,
7361,
9285,
1010,
22017,
20898,
5083,
3406,
10497,
11253,
18697,
3372,
7292,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readLines | public static <T extends Collection<String>> T readLines(InputStream in, String charsetName, T collection) throws IORuntimeException {
return readLines(in, CharsetUtil.charset(charsetName), collection);
} | java | public static <T extends Collection<String>> T readLines(InputStream in, String charsetName, T collection) throws IORuntimeException {
return readLines(in, CharsetUtil.charset(charsetName), collection);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"InputStream",
"in",
",",
"String",
"charsetName",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"in",
",",... | 从流中读取内容
@param <T> 集合类型
@param in 输入流
@param charsetName 字符集
@param collection 返回集合
@return 内容
@throws IORuntimeException IO异常 | [
"从流中读取内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L644-L646 | train | Reads the contents of the given input stream into the given collection using the specified encoding. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
30524,
1012,
25869,
13462,
1006,
25869,
13462,
18442,
1007,
1010,
3074,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/MethodlessRouter.java | MethodlessRouter.anyMatched | public boolean anyMatched(String[] requestPathTokens) {
Map<String, String> pathParams = new HashMap<>();
for (PathPattern pattern : routes.keySet()) {
if (pattern.match(requestPathTokens, pathParams)) {
return true;
}
// Reset for the next loop
pathParams.clear();
}
return false;
} | java | public boolean anyMatched(String[] requestPathTokens) {
Map<String, String> pathParams = new HashMap<>();
for (PathPattern pattern : routes.keySet()) {
if (pattern.match(requestPathTokens, pathParams)) {
return true;
}
// Reset for the next loop
pathParams.clear();
}
return false;
} | [
"public",
"boolean",
"anyMatched",
"(",
"String",
"[",
"]",
"requestPathTokens",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"pathParams",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"PathPattern",
"pattern",
":",
"routes",
".",
"keyS... | Checks if there's any matching route. | [
"Checks",
"if",
"there",
"s",
"any",
"matching",
"route",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/MethodlessRouter.java#L108-L120 | train | Checks if any of the routes match the request path tokens. | [
30522,
2270,
22017,
20898,
2151,
18900,
7690,
1006,
5164,
1031,
1033,
5227,
15069,
18715,
6132,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
4130,
28689,
5244,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
2005,
1006,
4130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.clearAllMemory | public void clearAllMemory(List<MemorySegment> target) {
// return the overflow segments
if (this.overflowSegments != null) {
for (int k = 0; k < this.numOverflowSegments; k++) {
target.add(this.overflowSegments[k]);
}
}
// return the partition buffers
target.addAll(this.partitionPages);
this.partitionPages.clear();
} | java | public void clearAllMemory(List<MemorySegment> target) {
// return the overflow segments
if (this.overflowSegments != null) {
for (int k = 0; k < this.numOverflowSegments; k++) {
target.add(this.overflowSegments[k]);
}
}
// return the partition buffers
target.addAll(this.partitionPages);
this.partitionPages.clear();
} | [
"public",
"void",
"clearAllMemory",
"(",
"List",
"<",
"MemorySegment",
">",
"target",
")",
"{",
"// return the overflow segments",
"if",
"(",
"this",
".",
"overflowSegments",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"this",
... | releases all of the partition's segments (pages and overflow buckets)
@param target memory pool to release segments to | [
"releases",
"all",
"of",
"the",
"partition",
"s",
"segments",
"(",
"pages",
"and",
"overflow",
"buckets",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L267-L277 | train | Clear all memory. | [
30522,
2270,
11675,
3154,
8095,
4168,
5302,
2854,
1006,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
4539,
1007,
1063,
1013,
1013,
2709,
1996,
2058,
12314,
9214,
2065,
1006,
2023,
1012,
2058,
12314,
3366,
21693,
11187,
999,
1027,
19701,
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/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.mapOf | public static <K, V> Bindable<Map<K, V>> mapOf(Class<K> keyType, Class<V> valueType) {
return of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType));
} | java | public static <K, V> Bindable<Map<K, V>> mapOf(Class<K> keyType, Class<V> valueType) {
return of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Bindable",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"mapOf",
"(",
"Class",
"<",
"K",
">",
"keyType",
",",
"Class",
"<",
"V",
">",
"valueType",
")",
"{",
"return",
"of",
"(",
"ResolvableType",
".",
... | Create a new {@link Bindable} {@link Map} of the specified key and value type.
@param <K> the key type
@param <V> the value type
@param keyType the map key type
@param valueType the map value type
@return a {@link Bindable} instance | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L235-L237 | train | Create a map binding for the given key and value types. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
14187,
3085,
1026,
4949,
1026,
1047,
1010,
1058,
1028,
1028,
4949,
11253,
1006,
2465,
1026,
1047,
1028,
3145,
13874,
1010,
2465,
1026,
1058,
1028,
3643,
13874,
1007,
1063,
2709,
1997,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.storeEmits | private void storeEmits(int position, int currentState, List<Hit<V>> collectedEmits)
{
int[] hitArray = output[currentState];
if (hitArray != null)
{
for (int hit : hitArray)
{
collectedEmits.add(new Hit<V>(position - l[hit], position, v[hit]));
}
}
} | java | private void storeEmits(int position, int currentState, List<Hit<V>> collectedEmits)
{
int[] hitArray = output[currentState];
if (hitArray != null)
{
for (int hit : hitArray)
{
collectedEmits.add(new Hit<V>(position - l[hit], position, v[hit]));
}
}
} | [
"private",
"void",
"storeEmits",
"(",
"int",
"position",
",",
"int",
"currentState",
",",
"List",
"<",
"Hit",
"<",
"V",
">",
">",
"collectedEmits",
")",
"{",
"int",
"[",
"]",
"hitArray",
"=",
"output",
"[",
"currentState",
"]",
";",
"if",
"(",
"hitArra... | 保存输出
@param position
@param currentState
@param collectedEmits | [
"保存输出"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L414-L424 | train | Stores the hits in the Hit array for the current state. | [
30522,
2797,
11675,
3573,
23238,
3215,
1006,
20014,
2597,
1010,
20014,
14731,
12259,
1010,
2862,
1026,
2718,
1026,
1058,
1028,
1028,
5067,
23238,
3215,
1007,
1063,
20014,
1031,
1033,
2718,
2906,
9447,
1027,
6434,
1031,
14731,
12259,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/ListValue.java | ListValue.addAll | @Override
public boolean addAll(final int index, final Collection<? extends V> c) {
return this.list.addAll(index, c);
} | java | @Override
public boolean addAll(final int index, final Collection<? extends V> c) {
return this.list.addAll(index, c);
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"final",
"int",
"index",
",",
"final",
"Collection",
"<",
"?",
"extends",
"V",
">",
"c",
")",
"{",
"return",
"this",
".",
"list",
".",
"addAll",
"(",
"index",
",",
"c",
")",
";",
"}"
] | /*
(non-Javadoc)
@see java.util.List#addAll(int, java.util.Collection) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/ListValue.java#L185-L188 | train | Add all elements in the collection at the specified index. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
5587,
8095,
1006,
2345,
20014,
5950,
1010,
2345,
3074,
1026,
1029,
8908,
1058,
1028,
1039,
1007,
1063,
2709,
2023,
1012,
2862,
1012,
5587,
8095,
1006,
5950,
1010,
1039,
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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java | HadoopInputs.readHadoopFile | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath) {
return readHadoopFile(mapredInputFormat, key, value, inputPath, new JobConf());
} | java | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath) {
return readHadoopFile(mapredInputFormat, key, value, inputPath, new JobConf());
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HadoopInputFormat",
"<",
"K",
",",
"V",
">",
"readHadoopFile",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"<",
"K",
",",
"V",
">",
"mapredInputFormat",
",",
"Class",
"<... | Creates a Flink {@link InputFormat} that wraps the given Hadoop {@link org.apache.hadoop.mapred.FileInputFormat}.
@return A Flink InputFormat that wraps the Hadoop FileInputFormat. | [
"Creates",
"a",
"Flink",
"{",
"@link",
"InputFormat",
"}",
"that",
"wraps",
"the",
"given",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java#L62-L64 | train | Read hadoop file. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2018,
18589,
2378,
18780,
14192,
4017,
1026,
1047,
1010,
1058,
1028,
3191,
16102,
18589,
8873,
2571,
1006,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
4949,
5596,
1012,
5371,
2378,
18780,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java | ClusterAnalyzer.addDocument | public Document<K> addDocument(K id, String document)
{
return addDocument(id, preprocess(document));
} | java | public Document<K> addDocument(K id, String document)
{
return addDocument(id, preprocess(document));
} | [
"public",
"Document",
"<",
"K",
">",
"addDocument",
"(",
"K",
"id",
",",
"String",
"document",
")",
"{",
"return",
"addDocument",
"(",
"id",
",",
"preprocess",
"(",
"document",
")",
")",
";",
"}"
] | 添加文档
@param id 文档id
@param document 文档内容
@return 文档对象 | [
"添加文档"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java#L114-L117 | train | Add a document to the cache. | [
30522,
2270,
6254,
1026,
1047,
1028,
5587,
3527,
24894,
4765,
1006,
1047,
8909,
1010,
5164,
6254,
1007,
1063,
2709,
5587,
3527,
24894,
4765,
1006,
8909,
1010,
17463,
3217,
9623,
2015,
1006,
6254,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/graph/ConnectedComponents.java | ConnectedComponents.main | public static void main(String... args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
final int maxIterations = params.getInt("iterations", 10);
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// read vertex and edge data
DataSet<Long> vertices = getVertexDataSet(env, params);
DataSet<Tuple2<Long, Long>> edges = getEdgeDataSet(env, params).flatMap(new UndirectEdge());
// assign the initial components (equal to the vertex id)
DataSet<Tuple2<Long, Long>> verticesWithInitialId =
vertices.map(new DuplicateValue<Long>());
// open a delta iteration
DeltaIteration<Tuple2<Long, Long>, Tuple2<Long, Long>> iteration =
verticesWithInitialId.iterateDelta(verticesWithInitialId, maxIterations, 0);
// apply the step logic: join with the edges, select the minimum neighbor, update if the component of the candidate is smaller
DataSet<Tuple2<Long, Long>> changes = iteration.getWorkset().join(edges).where(0).equalTo(0).with(new NeighborWithComponentIDJoin())
.groupBy(0).aggregate(Aggregations.MIN, 1)
.join(iteration.getSolutionSet()).where(0).equalTo(0)
.with(new ComponentIdFilter());
// close the delta iteration (delta and new workset are identical)
DataSet<Tuple2<Long, Long>> result = iteration.closeWith(changes, changes);
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", " ");
// execute program
env.execute("Connected Components Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | java | public static void main(String... args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
final int maxIterations = params.getInt("iterations", 10);
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// read vertex and edge data
DataSet<Long> vertices = getVertexDataSet(env, params);
DataSet<Tuple2<Long, Long>> edges = getEdgeDataSet(env, params).flatMap(new UndirectEdge());
// assign the initial components (equal to the vertex id)
DataSet<Tuple2<Long, Long>> verticesWithInitialId =
vertices.map(new DuplicateValue<Long>());
// open a delta iteration
DeltaIteration<Tuple2<Long, Long>, Tuple2<Long, Long>> iteration =
verticesWithInitialId.iterateDelta(verticesWithInitialId, maxIterations, 0);
// apply the step logic: join with the edges, select the minimum neighbor, update if the component of the candidate is smaller
DataSet<Tuple2<Long, Long>> changes = iteration.getWorkset().join(edges).where(0).equalTo(0).with(new NeighborWithComponentIDJoin())
.groupBy(0).aggregate(Aggregations.MIN, 1)
.join(iteration.getSolutionSet()).where(0).equalTo(0)
.with(new ComponentIdFilter());
// close the delta iteration (delta and new workset are identical)
DataSet<Tuple2<Long, Long>> result = iteration.closeWith(changes, changes);
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", " ");
// execute program
env.execute("Connected Components Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"...",
"args",
")",
"throws",
"Exception",
"{",
"// Checking input parameters",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"// set up execution environment",
"E... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/graph/ConnectedComponents.java#L76-L119 | train | Main method to run the Sequence Engine. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1012,
1012,
1012,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
9361,
7953,
11709,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toFile | public static void toFile(VelocityEngine ve, String templateFileName, VelocityContext context, String destPath) {
toFile(ve.getTemplate(templateFileName), context, destPath);
} | java | public static void toFile(VelocityEngine ve, String templateFileName, VelocityContext context, String destPath) {
toFile(ve.getTemplate(templateFileName), context, destPath);
} | [
"public",
"static",
"void",
"toFile",
"(",
"VelocityEngine",
"ve",
",",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"String",
"destPath",
")",
"{",
"toFile",
"(",
"ve",
".",
"getTemplate",
"(",
"templateFileName",
")",
",",
"context",
... | 生成文件
@param ve 模板引擎
@param templateFileName 模板文件名
@param context 上下文
@param destPath 目标路径(绝对) | [
"生成文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L141-L143 | train | Write the Velocity template to a file. | [
30522,
2270,
10763,
11675,
2000,
8873,
2571,
1006,
10146,
13159,
3170,
2310,
1010,
5164,
23561,
8873,
20844,
4168,
1010,
10146,
8663,
18209,
6123,
1010,
5164,
4078,
25856,
8988,
1007,
1063,
2000,
8873,
2571,
1006,
2310,
1012,
2131,
18532,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.close | @Override
public void close() throws HiveSQLException {
try {
acquire(true);
cancelDelegationToken();
} finally {
try {
super.close();
} finally {
try {
FileSystem.closeAllForUGI(sessionUgi);
} catch (IOException ioe) {
throw new HiveSQLException("Could not clean up file-system handles for UGI: "
+ sessionUgi, ioe);
}
}
}
} | java | @Override
public void close() throws HiveSQLException {
try {
acquire(true);
cancelDelegationToken();
} finally {
try {
super.close();
} finally {
try {
FileSystem.closeAllForUGI(sessionUgi);
} catch (IOException ioe) {
throw new HiveSQLException("Could not clean up file-system handles for UGI: "
+ sessionUgi, ioe);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"acquire",
"(",
"true",
")",
";",
"cancelDelegationToken",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"super",
".",
"close",
"(",
")",
";",
"}",
... | Close the file systems for the session and remove it from the FileSystem cache.
Cancel the session's delegation token and close the metastore connection | [
"Close",
"the",
"file",
"systems",
"for",
"the",
"session",
"and",
"remove",
"it",
"from",
"the",
"FileSystem",
"cache",
".",
"Cancel",
"the",
"session",
"s",
"delegation",
"token",
"and",
"close",
"the",
"metastore",
"connection"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L102-L119 | train | Close the session. | [
30522,
1030,
2058,
15637,
2270,
11675,
2485,
1006,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
1063,
9878,
1006,
2995,
1007,
1025,
17542,
9247,
29107,
3508,
18715,
2368,
1006,
1007,
1025,
1065,
2633,
1063,
3046,
1063,
356... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/partition/consumer/InputGateMetrics.java | InputGateMetrics.refreshAndGetMin | int refreshAndGetMin() {
int min = Integer.MAX_VALUE;
Collection<InputChannel> channels = inputGate.getInputChannels().values();
for (InputChannel channel : channels) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
min = Math.min(min, size);
}
}
if (min == Integer.MAX_VALUE) { // in case all channels are local, or the channel collection was empty
return 0;
}
return min;
} | java | int refreshAndGetMin() {
int min = Integer.MAX_VALUE;
Collection<InputChannel> channels = inputGate.getInputChannels().values();
for (InputChannel channel : channels) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
min = Math.min(min, size);
}
}
if (min == Integer.MAX_VALUE) { // in case all channels are local, or the channel collection was empty
return 0;
}
return min;
} | [
"int",
"refreshAndGetMin",
"(",
")",
"{",
"int",
"min",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"Collection",
"<",
"InputChannel",
">",
"channels",
"=",
"inputGate",
".",
"getInputChannels",
"(",
")",
".",
"values",
"(",
")",
";",
"for",
"(",
"InputChannel"... | Iterates over all input channels and collects the minimum number of queued buffers in a
channel in a best-effort way.
@return minimum number of queued buffers per channel (<tt>0</tt> if no channels exist) | [
"Iterates",
"over",
"all",
"input",
"channels",
"and",
"collects",
"the",
"minimum",
"number",
"of",
"queued",
"buffers",
"in",
"a",
"channel",
"in",
"a",
"best",
"-",
"effort",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java#L71-L89 | train | This method is used to refresh the internal state of the input gate and return the minimum number of queued buffers in the input gate. | [
30522,
20014,
25416,
21898,
5685,
18150,
10020,
1006,
1007,
1063,
20014,
8117,
1027,
16109,
1012,
4098,
1035,
3643,
1025,
3074,
1026,
7953,
26058,
1028,
6833,
1027,
7953,
5867,
1012,
2131,
2378,
18780,
26058,
2015,
1006,
1007,
1012,
5300,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java | PemX509Certificate.append | private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect,
X509Certificate cert, int count, ByteBuf pem) throws CertificateEncodingException {
ByteBuf encoded = Unpooled.wrappedBuffer(cert.getEncoded());
try {
ByteBuf base64 = SslUtils.toBase64(allocator, encoded);
try {
if (pem == null) {
// We try to approximate the buffer's initial size. The sizes of
// certificates can vary a lot so it'll be off a bit depending
// on the number of elements in the array (count argument).
pem = newBuffer(allocator, useDirect,
(BEGIN_CERT.length + base64.readableBytes() + END_CERT.length) * count);
}
pem.writeBytes(BEGIN_CERT);
pem.writeBytes(base64);
pem.writeBytes(END_CERT);
} finally {
base64.release();
}
} finally {
encoded.release();
}
return pem;
} | java | private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect,
X509Certificate cert, int count, ByteBuf pem) throws CertificateEncodingException {
ByteBuf encoded = Unpooled.wrappedBuffer(cert.getEncoded());
try {
ByteBuf base64 = SslUtils.toBase64(allocator, encoded);
try {
if (pem == null) {
// We try to approximate the buffer's initial size. The sizes of
// certificates can vary a lot so it'll be off a bit depending
// on the number of elements in the array (count argument).
pem = newBuffer(allocator, useDirect,
(BEGIN_CERT.length + base64.readableBytes() + END_CERT.length) * count);
}
pem.writeBytes(BEGIN_CERT);
pem.writeBytes(base64);
pem.writeBytes(END_CERT);
} finally {
base64.release();
}
} finally {
encoded.release();
}
return pem;
} | [
"private",
"static",
"ByteBuf",
"append",
"(",
"ByteBufAllocator",
"allocator",
",",
"boolean",
"useDirect",
",",
"X509Certificate",
"cert",
",",
"int",
"count",
",",
"ByteBuf",
"pem",
")",
"throws",
"CertificateEncodingException",
"{",
"ByteBuf",
"encoded",
"=",
... | Appends the {@link X509Certificate} value to the {@link ByteBuf} (last arg) and returns it.
If the {@link ByteBuf} didn't exist yet it'll create it using the {@link ByteBufAllocator}. | [
"Appends",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java#L123-L149 | train | Append a certificate to a byte buffer. | [
30522,
2797,
10763,
24880,
8569,
2546,
10439,
10497,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
22017,
20898,
2109,
7442,
6593,
1010,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
8292,
5339,
1010,
20014,
4175,
1010,
24880... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ClassLoaderUtil.java | ClassLoaderUtil.getUserCodeClassLoaderInfo | public static String getUserCodeClassLoaderInfo(ClassLoader loader) {
if (loader instanceof URLClassLoader) {
URLClassLoader cl = (URLClassLoader) loader;
try {
StringBuilder bld = new StringBuilder();
if (cl == ClassLoader.getSystemClassLoader()) {
bld.append("System ClassLoader: ");
}
else {
bld.append("URL ClassLoader:");
}
for (URL url : cl.getURLs()) {
bld.append("\n ");
if (url == null) {
bld.append("(null)");
}
else if ("file".equals(url.getProtocol())) {
String filePath = url.getPath();
File fileFile = new File(filePath);
bld.append("file: '").append(filePath).append('\'');
if (fileFile.exists()) {
if (fileFile.isDirectory()) {
bld.append(" (directory)");
}
else {
JarFile jar = null;
try {
jar = new JarFile(filePath);
bld.append(" (valid JAR)");
}
catch (Exception e) {
bld.append(" (invalid JAR: ").append(e.getMessage()).append(')');
}
finally {
if (jar != null) {
jar.close();
}
}
}
}
else {
bld.append(" (missing)");
}
}
else {
bld.append("url: ").append(url);
}
}
return bld.toString();
}
catch (Throwable t) {
return "Cannot access classloader info due to an exception.\n"
+ ExceptionUtils.stringifyException(t);
}
}
else {
return "No user code ClassLoader";
}
} | java | public static String getUserCodeClassLoaderInfo(ClassLoader loader) {
if (loader instanceof URLClassLoader) {
URLClassLoader cl = (URLClassLoader) loader;
try {
StringBuilder bld = new StringBuilder();
if (cl == ClassLoader.getSystemClassLoader()) {
bld.append("System ClassLoader: ");
}
else {
bld.append("URL ClassLoader:");
}
for (URL url : cl.getURLs()) {
bld.append("\n ");
if (url == null) {
bld.append("(null)");
}
else if ("file".equals(url.getProtocol())) {
String filePath = url.getPath();
File fileFile = new File(filePath);
bld.append("file: '").append(filePath).append('\'');
if (fileFile.exists()) {
if (fileFile.isDirectory()) {
bld.append(" (directory)");
}
else {
JarFile jar = null;
try {
jar = new JarFile(filePath);
bld.append(" (valid JAR)");
}
catch (Exception e) {
bld.append(" (invalid JAR: ").append(e.getMessage()).append(')');
}
finally {
if (jar != null) {
jar.close();
}
}
}
}
else {
bld.append(" (missing)");
}
}
else {
bld.append("url: ").append(url);
}
}
return bld.toString();
}
catch (Throwable t) {
return "Cannot access classloader info due to an exception.\n"
+ ExceptionUtils.stringifyException(t);
}
}
else {
return "No user code ClassLoader";
}
} | [
"public",
"static",
"String",
"getUserCodeClassLoaderInfo",
"(",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"loader",
"instanceof",
"URLClassLoader",
")",
"{",
"URLClassLoader",
"cl",
"=",
"(",
"URLClassLoader",
")",
"loader",
";",
"try",
"{",
"StringBuilder",
... | Gets information about URL class loaders. The returned info string contains all URLs of the
class loader. For file URLs, it contains in addition whether the referenced file exists,
is a valid JAR file, or is a directory.
<p>NOTE: This method makes a best effort to provide information about the classloader, and
never throws an exception.</p>
@param loader The classloader to get the info string for.
@return The classloader information string. | [
"Gets",
"information",
"about",
"URL",
"class",
"loaders",
".",
"The",
"returned",
"info",
"string",
"contains",
"all",
"URLs",
"of",
"the",
"class",
"loader",
".",
"For",
"file",
"URLs",
"it",
"contains",
"in",
"addition",
"whether",
"the",
"referenced",
"f... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ClassLoaderUtil.java#L45-L109 | train | Get the user code classloader info. | [
30522,
2270,
10763,
5164,
2131,
20330,
16044,
26266,
11066,
23282,
14876,
1006,
2465,
11066,
2121,
7170,
2121,
1007,
1063,
2065,
1006,
7170,
2121,
6013,
11253,
24471,
15472,
27102,
11066,
2121,
1007,
1063,
24471,
15472,
27102,
11066,
2121,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java | ThreadExecutorMap.apply | public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) {
ObjectUtil.checkNotNull(threadFactory, "command");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return threadFactory.newThread(apply(r, eventExecutor));
}
};
} | java | public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) {
ObjectUtil.checkNotNull(threadFactory, "command");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return threadFactory.newThread(apply(r, eventExecutor));
}
};
} | [
"public",
"static",
"ThreadFactory",
"apply",
"(",
"final",
"ThreadFactory",
"threadFactory",
",",
"final",
"EventExecutor",
"eventExecutor",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"threadFactory",
",",
"\"command\"",
")",
";",
"ObjectUtil",
".",
"checkNo... | Decorate the given {@link ThreadFactory} and ensure {@link #currentExecutor()} will return {@code eventExecutor}
when called from within the {@link Runnable} during execution. | [
"Decorate",
"the",
"given",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L86-L95 | train | Create a thread factory that will create a new thread using the specified command and event executor. | [
30522,
2270,
10763,
11689,
21450,
6611,
1006,
2345,
11689,
21450,
11689,
21450,
1010,
2345,
2724,
10288,
8586,
16161,
2099,
2724,
10288,
8586,
16161,
2099,
1007,
1063,
4874,
21823,
2140,
1012,
4638,
17048,
11231,
3363,
1006,
11689,
21450,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateGeneral | public static <T extends CharSequence> T validateGeneral(T value, String errorMsg) throws ValidateException {
if (false == isGeneral(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateGeneral(T value, String errorMsg) throws ValidateException {
if (false == isGeneral(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateGeneral",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isGeneral",
"(",
"value",
")",
")",
"{",
"throw",
"new",... | 验证是否为英文字母 、数字和下划线
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为英文字母",
"、数字和下划线"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L358-L363 | train | Validate a string for a
value. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
6914,
21673,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
6914,
21673... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java | SimpleConsumerThread.requestAndSetSpecificTimeOffsetsFromKafka | private static void requestAndSetSpecificTimeOffsetsFromKafka(
SimpleConsumer consumer,
List<KafkaTopicPartitionState<TopicAndPartition>> partitions,
long whichTime) throws IOException {
Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<>();
for (KafkaTopicPartitionState<TopicAndPartition> part : partitions) {
requestInfo.put(part.getKafkaPartitionHandle(), new PartitionOffsetRequestInfo(whichTime, 1));
}
requestAndSetOffsetsFromKafka(consumer, partitions, requestInfo);
} | java | private static void requestAndSetSpecificTimeOffsetsFromKafka(
SimpleConsumer consumer,
List<KafkaTopicPartitionState<TopicAndPartition>> partitions,
long whichTime) throws IOException {
Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<>();
for (KafkaTopicPartitionState<TopicAndPartition> part : partitions) {
requestInfo.put(part.getKafkaPartitionHandle(), new PartitionOffsetRequestInfo(whichTime, 1));
}
requestAndSetOffsetsFromKafka(consumer, partitions, requestInfo);
} | [
"private",
"static",
"void",
"requestAndSetSpecificTimeOffsetsFromKafka",
"(",
"SimpleConsumer",
"consumer",
",",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"TopicAndPartition",
">",
">",
"partitions",
",",
"long",
"whichTime",
")",
"throws",
"IOException",
"{",
"Map... | Request offsets before a specific time for a set of partitions, via a Kafka consumer.
@param consumer The consumer connected to lead broker
@param partitions The list of partitions we need offsets for
@param whichTime The type of time we are requesting. -1 and -2 are special constants (See OffsetRequest) | [
"Request",
"offsets",
"before",
"a",
"specific",
"time",
"for",
"a",
"set",
"of",
"partitions",
"via",
"a",
"Kafka",
"consumer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java#L442-L452 | train | Request and set specific time offsets from Kafka. | [
30522,
2797,
10763,
11675,
5227,
29560,
8454,
5051,
6895,
8873,
6593,
14428,
27475,
8454,
19699,
5358,
2912,
24316,
2050,
1006,
3722,
8663,
23545,
2099,
7325,
1010,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
8476,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jobgraph/JobVertex.java | JobVertex.setStrictlyCoLocatedWith | public void setStrictlyCoLocatedWith(JobVertex strictlyCoLocatedWith) {
if (this.slotSharingGroup == null || this.slotSharingGroup != strictlyCoLocatedWith.slotSharingGroup) {
throw new IllegalArgumentException("Strict co-location requires that both vertices are in the same slot sharing group.");
}
CoLocationGroup thisGroup = this.coLocationGroup;
CoLocationGroup otherGroup = strictlyCoLocatedWith.coLocationGroup;
if (otherGroup == null) {
if (thisGroup == null) {
CoLocationGroup group = new CoLocationGroup(this, strictlyCoLocatedWith);
this.coLocationGroup = group;
strictlyCoLocatedWith.coLocationGroup = group;
}
else {
thisGroup.addVertex(strictlyCoLocatedWith);
strictlyCoLocatedWith.coLocationGroup = thisGroup;
}
}
else {
if (thisGroup == null) {
otherGroup.addVertex(this);
this.coLocationGroup = otherGroup;
}
else {
// both had yet distinct groups, we need to merge them
thisGroup.mergeInto(otherGroup);
}
}
} | java | public void setStrictlyCoLocatedWith(JobVertex strictlyCoLocatedWith) {
if (this.slotSharingGroup == null || this.slotSharingGroup != strictlyCoLocatedWith.slotSharingGroup) {
throw new IllegalArgumentException("Strict co-location requires that both vertices are in the same slot sharing group.");
}
CoLocationGroup thisGroup = this.coLocationGroup;
CoLocationGroup otherGroup = strictlyCoLocatedWith.coLocationGroup;
if (otherGroup == null) {
if (thisGroup == null) {
CoLocationGroup group = new CoLocationGroup(this, strictlyCoLocatedWith);
this.coLocationGroup = group;
strictlyCoLocatedWith.coLocationGroup = group;
}
else {
thisGroup.addVertex(strictlyCoLocatedWith);
strictlyCoLocatedWith.coLocationGroup = thisGroup;
}
}
else {
if (thisGroup == null) {
otherGroup.addVertex(this);
this.coLocationGroup = otherGroup;
}
else {
// both had yet distinct groups, we need to merge them
thisGroup.mergeInto(otherGroup);
}
}
} | [
"public",
"void",
"setStrictlyCoLocatedWith",
"(",
"JobVertex",
"strictlyCoLocatedWith",
")",
"{",
"if",
"(",
"this",
".",
"slotSharingGroup",
"==",
"null",
"||",
"this",
".",
"slotSharingGroup",
"!=",
"strictlyCoLocatedWith",
".",
"slotSharingGroup",
")",
"{",
"thr... | Tells this vertex to strictly co locate its subtasks with the subtasks of the given vertex.
Strict co-location implies that the n'th subtask of this vertex will run on the same parallel computing
instance (TaskManager) as the n'th subtask of the given vertex.
NOTE: Co-location is only possible between vertices in a slot sharing group.
NOTE: This vertex must (transitively) depend on the vertex to be co-located with. That means that the
respective vertex must be a (transitive) input of this vertex.
@param strictlyCoLocatedWith The vertex whose subtasks to co-locate this vertex's subtasks with.
@throws IllegalArgumentException Thrown, if this vertex and the vertex to co-locate with are not in a common
slot sharing group.
@see #setSlotSharingGroup(SlotSharingGroup) | [
"Tells",
"this",
"vertex",
"to",
"strictly",
"co",
"locate",
"its",
"subtasks",
"with",
"the",
"subtasks",
"of",
"the",
"given",
"vertex",
".",
"Strict",
"co",
"-",
"location",
"implies",
"that",
"the",
"n",
"th",
"subtask",
"of",
"this",
"vertex",
"will",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java#L405-L434 | train | Sets the strictly - co - located with vertex. | [
30522,
2270,
11675,
4520,
12412,
14626,
25778,
24755,
3064,
24415,
1006,
3105,
16874,
10288,
9975,
25778,
24755,
3064,
24415,
1007,
1063,
2065,
1006,
2023,
1012,
19832,
18428,
3070,
17058,
1027,
1027,
19701,
1064,
1064,
2023,
1012,
19832,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java | MDAG.addStringInternal | private void addStringInternal(String str)
{
String prefixString = determineLongestPrefixInMDAG(str);
String suffixString = str.substring(prefixString.length());
//Retrive the data related to the first confluence node (a node with two or more incoming transitions)
//in the _transition path from sourceNode corresponding to prefixString.
HashMap<String, Object> firstConfluenceNodeDataHashMap = getTransitionPathFirstConfluenceNodeData(sourceNode, prefixString);
MDAGNode firstConfluenceNodeInPrefix = (MDAGNode) firstConfluenceNodeDataHashMap.get("confluenceNode");
Integer toFirstConfluenceNodeTransitionCharIndex = (Integer) firstConfluenceNodeDataHashMap.get("toConfluenceNodeTransitionCharIndex");
/////
//Remove the register entries of all the nodes in the prefixString _transition path up to the first confluence node
//(those past the confluence node will not need to be removed since they will be cloned and unaffected by the
//addition of suffixString). If there is no confluence node in prefixString, then remove the register entries in prefixString's entire _transition path
removeTransitionPathRegisterEntries((toFirstConfluenceNodeTransitionCharIndex == null ? prefixString : prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex)));
//If there is a confluence node in the prefix, we must duplicate the _transition path
//of the prefix starting from that node, before we add suffixString (to the duplicate path).
//This ensures that we do not disturb the other _transition paths containing this node.
if (firstConfluenceNodeInPrefix != null)
{
String transitionStringOfPathToFirstConfluenceNode = prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex + 1);
String transitionStringOfToBeDuplicatedPath = prefixString.substring(toFirstConfluenceNodeTransitionCharIndex + 1);
cloneTransitionPath(firstConfluenceNodeInPrefix, transitionStringOfPathToFirstConfluenceNode, transitionStringOfToBeDuplicatedPath);
}
/////
//Add the _transition based on suffixString to the end of the (possibly duplicated) _transition path corresponding to prefixString
addTransitionPath(sourceNode.transition(prefixString), suffixString);
} | java | private void addStringInternal(String str)
{
String prefixString = determineLongestPrefixInMDAG(str);
String suffixString = str.substring(prefixString.length());
//Retrive the data related to the first confluence node (a node with two or more incoming transitions)
//in the _transition path from sourceNode corresponding to prefixString.
HashMap<String, Object> firstConfluenceNodeDataHashMap = getTransitionPathFirstConfluenceNodeData(sourceNode, prefixString);
MDAGNode firstConfluenceNodeInPrefix = (MDAGNode) firstConfluenceNodeDataHashMap.get("confluenceNode");
Integer toFirstConfluenceNodeTransitionCharIndex = (Integer) firstConfluenceNodeDataHashMap.get("toConfluenceNodeTransitionCharIndex");
/////
//Remove the register entries of all the nodes in the prefixString _transition path up to the first confluence node
//(those past the confluence node will not need to be removed since they will be cloned and unaffected by the
//addition of suffixString). If there is no confluence node in prefixString, then remove the register entries in prefixString's entire _transition path
removeTransitionPathRegisterEntries((toFirstConfluenceNodeTransitionCharIndex == null ? prefixString : prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex)));
//If there is a confluence node in the prefix, we must duplicate the _transition path
//of the prefix starting from that node, before we add suffixString (to the duplicate path).
//This ensures that we do not disturb the other _transition paths containing this node.
if (firstConfluenceNodeInPrefix != null)
{
String transitionStringOfPathToFirstConfluenceNode = prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex + 1);
String transitionStringOfToBeDuplicatedPath = prefixString.substring(toFirstConfluenceNodeTransitionCharIndex + 1);
cloneTransitionPath(firstConfluenceNodeInPrefix, transitionStringOfPathToFirstConfluenceNode, transitionStringOfToBeDuplicatedPath);
}
/////
//Add the _transition based on suffixString to the end of the (possibly duplicated) _transition path corresponding to prefixString
addTransitionPath(sourceNode.transition(prefixString), suffixString);
} | [
"private",
"void",
"addStringInternal",
"(",
"String",
"str",
")",
"{",
"String",
"prefixString",
"=",
"determineLongestPrefixInMDAG",
"(",
"str",
")",
";",
"String",
"suffixString",
"=",
"str",
".",
"substring",
"(",
"prefixString",
".",
"length",
"(",
")",
"... | Adds a String to the MDAG (called by addString to do actual MDAG manipulation).
@param str the String to be added to the MDAG | [
"Adds",
"a",
"String",
"to",
"the",
"MDAG",
"(",
"called",
"by",
"addString",
"to",
"do",
"actual",
"MDAG",
"manipulation",
")",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L682-L712 | train | Add a string to the CRA | [
30522,
2797,
11675,
9909,
18886,
3070,
18447,
11795,
2389,
1006,
5164,
2358,
2099,
1007,
1063,
5164,
17576,
3367,
4892,
1027,
5646,
10052,
4355,
28139,
8873,
20303,
26876,
8490,
1006,
2358,
2099,
1007,
1025,
5164,
16809,
3367,
4892,
1027,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/PemPrivateKey.java | PemPrivateKey.toPEM | static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, PrivateKey key) {
// We can take a shortcut if the private key happens to be already
// PEM/PKCS#8 encoded. This is the ideal case and reason why all
// this exists. It allows the user to pass pre-encoded bytes straight
// into OpenSSL without having to do any of the extra work.
if (key instanceof PemEncoded) {
return ((PemEncoded) key).retain();
}
byte[] bytes = key.getEncoded();
if (bytes == null) {
throw new IllegalArgumentException(key.getClass().getName() + " does not support encoding");
}
return toPEM(allocator, useDirect, bytes);
} | java | static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, PrivateKey key) {
// We can take a shortcut if the private key happens to be already
// PEM/PKCS#8 encoded. This is the ideal case and reason why all
// this exists. It allows the user to pass pre-encoded bytes straight
// into OpenSSL without having to do any of the extra work.
if (key instanceof PemEncoded) {
return ((PemEncoded) key).retain();
}
byte[] bytes = key.getEncoded();
if (bytes == null) {
throw new IllegalArgumentException(key.getClass().getName() + " does not support encoding");
}
return toPEM(allocator, useDirect, bytes);
} | [
"static",
"PemEncoded",
"toPEM",
"(",
"ByteBufAllocator",
"allocator",
",",
"boolean",
"useDirect",
",",
"PrivateKey",
"key",
")",
"{",
"// We can take a shortcut if the private key happens to be already",
"// PEM/PKCS#8 encoded. This is the ideal case and reason why all",
"// this e... | Creates a {@link PemEncoded} value from the {@link PrivateKey}. | [
"Creates",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/PemPrivateKey.java#L54-L69 | train | Returns the PEM encoded form of the passed in private key. | [
30522,
10763,
21877,
3549,
16044,
2094,
2327,
6633,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
22017,
20898,
2109,
7442,
6593,
1010,
2797,
14839,
3145,
1007,
1063,
1013,
1013,
2057,
2064,
2202,
1037,
2460,
12690,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TimerService.java | TimerService.unregisterAllTimeouts | protected void unregisterAllTimeouts() {
for (Timeout<K> timeout : timeouts.values()) {
timeout.cancel();
}
timeouts.clear();
} | java | protected void unregisterAllTimeouts() {
for (Timeout<K> timeout : timeouts.values()) {
timeout.cancel();
}
timeouts.clear();
} | [
"protected",
"void",
"unregisterAllTimeouts",
"(",
")",
"{",
"for",
"(",
"Timeout",
"<",
"K",
">",
"timeout",
":",
"timeouts",
".",
"values",
"(",
")",
")",
"{",
"timeout",
".",
"cancel",
"(",
")",
";",
"}",
"timeouts",
".",
"clear",
"(",
")",
";",
... | Unregister all timeouts. | [
"Unregister",
"all",
"timeouts",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TimerService.java#L128-L133 | train | Unregister all timeouts. | [
30522,
5123,
11675,
4895,
2890,
24063,
21673,
7096,
14428,
12166,
1006,
1007,
1063,
2005,
1006,
2051,
5833,
1026,
1047,
1028,
2051,
5833,
1024,
2051,
12166,
1012,
5300,
1006,
1007,
1007,
1063,
2051,
5833,
1012,
17542,
1006,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java | PackedRecordPointer.packPointer | public static long packPointer(long recordPointer, int partitionId) {
assert (partitionId <= MAXIMUM_PARTITION_ID);
// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.
// Also note that this relies on some internals of how TaskMemoryManager encodes its addresses.
final long pageNumber = (recordPointer & MASK_LONG_UPPER_13_BITS) >>> 24;
final long compressedAddress = pageNumber | (recordPointer & MASK_LONG_LOWER_27_BITS);
return (((long) partitionId) << 40) | compressedAddress;
} | java | public static long packPointer(long recordPointer, int partitionId) {
assert (partitionId <= MAXIMUM_PARTITION_ID);
// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.
// Also note that this relies on some internals of how TaskMemoryManager encodes its addresses.
final long pageNumber = (recordPointer & MASK_LONG_UPPER_13_BITS) >>> 24;
final long compressedAddress = pageNumber | (recordPointer & MASK_LONG_LOWER_27_BITS);
return (((long) partitionId) << 40) | compressedAddress;
} | [
"public",
"static",
"long",
"packPointer",
"(",
"long",
"recordPointer",
",",
"int",
"partitionId",
")",
"{",
"assert",
"(",
"partitionId",
"<=",
"MAXIMUM_PARTITION_ID",
")",
";",
"// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.",
"// A... | Pack a record address and partition id into a single word.
@param recordPointer a record pointer encoded by TaskMemoryManager.
@param partitionId a shuffle partition id (maximum value of 2^24).
@return a packed pointer that can be decoded using the {@link PackedRecordPointer} class. | [
"Pack",
"a",
"record",
"address",
"and",
"partition",
"id",
"into",
"a",
"single",
"word",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java#L77-L84 | train | Pack a record pointer | [
30522,
2270,
10763,
2146,
5308,
8400,
2121,
1006,
2146,
2501,
8400,
2121,
1010,
20014,
13571,
3593,
1007,
1063,
20865,
1006,
13571,
3593,
1026,
1027,
4555,
1035,
13571,
1035,
8909,
1007,
1025,
1013,
1013,
3602,
2008,
2302,
2773,
12139,
2057... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/SortPartitionOperator.java | SortPartitionOperator.sortPartition | public SortPartitionOperator<T> sortPartition(int field, Order order) {
if (useKeySelector) {
throw new InvalidProgramException("Expression keys cannot be appended after a KeySelector");
}
ensureSortableKey(field);
keys.add(new Keys.ExpressionKeys<>(field, getType()));
orders.add(order);
return this;
} | java | public SortPartitionOperator<T> sortPartition(int field, Order order) {
if (useKeySelector) {
throw new InvalidProgramException("Expression keys cannot be appended after a KeySelector");
}
ensureSortableKey(field);
keys.add(new Keys.ExpressionKeys<>(field, getType()));
orders.add(order);
return this;
} | [
"public",
"SortPartitionOperator",
"<",
"T",
">",
"sortPartition",
"(",
"int",
"field",
",",
"Order",
"order",
")",
"{",
"if",
"(",
"useKeySelector",
")",
"{",
"throw",
"new",
"InvalidProgramException",
"(",
"\"Expression keys cannot be appended after a KeySelector\"",
... | Appends an additional sort order with the specified field in the specified order to the
local partition sorting of the DataSet.
@param field The field index of the additional sort order of the local partition sorting.
@param order The order of the additional sort order of the local partition sorting.
@return The DataSet with sorted local partitions. | [
"Appends",
"an",
"additional",
"sort",
"order",
"with",
"the",
"specified",
"field",
"in",
"the",
"specified",
"order",
"to",
"the",
"local",
"partition",
"sorting",
"of",
"the",
"DataSet",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/SortPartitionOperator.java#L106-L116 | train | Appends a sort partition to the current partition. | [
30522,
2270,
4066,
19362,
3775,
3508,
25918,
8844,
1026,
1056,
1028,
4066,
19362,
3775,
3508,
1006,
20014,
2492,
1010,
2344,
2344,
1007,
1063,
2065,
1006,
2224,
14839,
11246,
22471,
2953,
1007,
1063,
5466,
2047,
19528,
21572,
13113,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java | NioServer.registerChannel | private void registerChannel(Selector selector, SelectableChannel channel, Operation ops) {
if (channel == null) {
return;
}
try {
channel.configureBlocking(false);
// 注册通道
channel.register(selector, ops.getValue());
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | private void registerChannel(Selector selector, SelectableChannel channel, Operation ops) {
if (channel == null) {
return;
}
try {
channel.configureBlocking(false);
// 注册通道
channel.register(selector, ops.getValue());
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"private",
"void",
"registerChannel",
"(",
"Selector",
"selector",
",",
"SelectableChannel",
"channel",
",",
"Operation",
"ops",
")",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"channel",
".",
"configureBlocking",
"(",... | 注册通道到指定Selector上
@param selector Selector
@param channel 通道
@param ops 注册的通道监听类型 | [
"注册通道到指定Selector上"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java#L161-L173 | train | Register a SelectableChannel with the SelectableChannelService. | [
30522,
2797,
11675,
4236,
26058,
1006,
27000,
27000,
1010,
7276,
3085,
26058,
3149,
1010,
3169,
23092,
1007,
1063,
2065,
1006,
3149,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
3046,
1063,
3149,
1012,
9530,
8873,
27390,
15878,
7878,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromDataSet | public static <K, VV, EV> Graph<K, VV, EV> fromDataSet(DataSet<Vertex<K, VV>> vertices,
DataSet<Edge<K, EV>> edges, ExecutionEnvironment context) {
return new Graph<>(vertices, edges, context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromDataSet(DataSet<Vertex<K, VV>> vertices,
DataSet<Edge<K, EV>> edges, ExecutionEnvironment context) {
return new Graph<>(vertices, edges, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromDataSet",
"(",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"vertices",
",",
"DataSet",
"<",
"Edge",
"<",
"K",
",",
"EV",
... | Creates a graph from a DataSet of vertices and a DataSet of edges.
@param vertices a DataSet of vertices.
@param edges a DataSet of edges.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"vertices",
"and",
"a",
"DataSet",
"of",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L161-L165 | train | Creates a graph from a DataSet of Vertex objects and a DataSet of Edge objects. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2013,
2850,
18260,
2102,
1006,
2951,
13462,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
18984,
1010,
295... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java | PythonDataStream.union | @SafeVarargs
@SuppressWarnings("unchecked")
public final PythonDataStream union(PythonDataStream... streams) {
ArrayList<DataStream<PyObject>> dsList = new ArrayList<>();
for (PythonDataStream ps : streams) {
dsList.add(ps.stream);
}
DataStream<PyObject>[] dsArray = new DataStream[dsList.size()];
return new PythonDataStream(stream.union(dsList.toArray(dsArray)));
} | java | @SafeVarargs
@SuppressWarnings("unchecked")
public final PythonDataStream union(PythonDataStream... streams) {
ArrayList<DataStream<PyObject>> dsList = new ArrayList<>();
for (PythonDataStream ps : streams) {
dsList.add(ps.stream);
}
DataStream<PyObject>[] dsArray = new DataStream[dsList.size()];
return new PythonDataStream(stream.union(dsList.toArray(dsArray)));
} | [
"@",
"SafeVarargs",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"PythonDataStream",
"union",
"(",
"PythonDataStream",
"...",
"streams",
")",
"{",
"ArrayList",
"<",
"DataStream",
"<",
"PyObject",
">>",
"dsList",
"=",
"new",
"ArrayList",
... | A thin wrapper layer over {@link DataStream#union(DataStream[])}.
@param streams The Python DataStreams to union output with.
@return The {@link PythonDataStream}. | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"DataStream#union",
"(",
"DataStream",
"[]",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java#L74-L83 | train | Union the given data streams. | [
30522,
1030,
3647,
24516,
10623,
2015,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2345,
18750,
2850,
10230,
25379,
2586,
1006,
18750,
2850,
10230,
25379,
1012,
1012,
1012,
9199,
1007,
1063,
9140,
9863,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.addWord | public void addWord(String word) {
WordTree parent = null;
WordTree current = this;
WordTree child;
char currentChar = 0;
int length = word.length();
for(int i = 0; i < length; i++){
currentChar = word.charAt(i);
if(false == StopChar.isStopChar(currentChar)){//只处理合法字符
child = current.get(currentChar);
if(child == null){
//无子类,新建一个子节点后存放下一个字符
child = new WordTree();
current.put(currentChar, child);
}
parent = current;
current = child;
}
}
if(null != parent){
parent.setEnd(currentChar);
}
} | java | public void addWord(String word) {
WordTree parent = null;
WordTree current = this;
WordTree child;
char currentChar = 0;
int length = word.length();
for(int i = 0; i < length; i++){
currentChar = word.charAt(i);
if(false == StopChar.isStopChar(currentChar)){//只处理合法字符
child = current.get(currentChar);
if(child == null){
//无子类,新建一个子节点后存放下一个字符
child = new WordTree();
current.put(currentChar, child);
}
parent = current;
current = child;
}
}
if(null != parent){
parent.setEnd(currentChar);
}
} | [
"public",
"void",
"addWord",
"(",
"String",
"word",
")",
"{",
"WordTree",
"parent",
"=",
"null",
";",
"WordTree",
"current",
"=",
"this",
";",
"WordTree",
"child",
";",
"char",
"currentChar",
"=",
"0",
";",
"int",
"length",
"=",
"word",
".",
"length",
... | 添加单词,使用默认类型
@param word 单词 | [
"添加单词,使用默认类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L73-L95 | train | Add a word to the tree. | [
30522,
2270,
11675,
5587,
18351,
1006,
5164,
2773,
1007,
1063,
2773,
13334,
6687,
1027,
19701,
1025,
2773,
13334,
2783,
1027,
2023,
1025,
2773,
13334,
2775,
1025,
25869,
2783,
7507,
2099,
1027,
1014,
1025,
20014,
3091,
1027,
2773,
1012,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java | SensitiveUtil.getFindedAllSensitive | public static List<String> getFindedAllSensitive(String text, boolean isDensityMatch, boolean isGreedMatch){
return sensitiveTree.matchAll(text, -1, isDensityMatch, isGreedMatch);
} | java | public static List<String> getFindedAllSensitive(String text, boolean isDensityMatch, boolean isGreedMatch){
return sensitiveTree.matchAll(text, -1, isDensityMatch, isGreedMatch);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getFindedAllSensitive",
"(",
"String",
"text",
",",
"boolean",
"isDensityMatch",
",",
"boolean",
"isGreedMatch",
")",
"{",
"return",
"sensitiveTree",
".",
"matchAll",
"(",
"text",
",",
"-",
"1",
",",
"isDensityM... | 查找敏感词,返回找到的所有敏感词<br>
密集匹配原则:假如关键词有 ab,b,文本是abab,将匹配 [ab,b,ab]<br>
贪婪匹配(最长匹配)原则:假如关键字a,ab,最长匹配将匹配[a, ab]
@param text 文本
@param isDensityMatch 是否使用密集匹配原则
@param isGreedMatch 是否使用贪婪匹配(最长匹配)原则
@return 敏感词 | [
"查找敏感词,返回找到的所有敏感词<br",
">",
"密集匹配原则:假如关键词有",
"ab",
"b,文本是abab,将匹配",
"[",
"ab",
"b",
"ab",
"]",
"<br",
">",
"贪婪匹配(最长匹配)原则:假如关键字a",
"ab,最长匹配将匹配",
"[",
"a",
"ab",
"]"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java#L135-L137 | train | Gets the matched words in the sensitive tree. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
16294,
5732,
8095,
5054,
28032,
3512,
1006,
5164,
3793,
1010,
22017,
20898,
2003,
4181,
17759,
18900,
2818,
1010,
22017,
20898,
2003,
28637,
22117,
4017,
2818,
1007,
1063,
2709,
7591,
13334,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SqlConnRunner.java | SqlConnRunner.findIn | public List<Entity> findIn(Connection conn, String tableName, String field, Object... values) throws SQLException{
return findAll(conn, Entity.create(tableName).set(field, values));
} | java | public List<Entity> findIn(Connection conn, String tableName, String field, Object... values) throws SQLException{
return findAll(conn, Entity.create(tableName).set(field, values));
} | [
"public",
"List",
"<",
"Entity",
">",
"findIn",
"(",
"Connection",
"conn",
",",
"String",
"tableName",
",",
"String",
"field",
",",
"Object",
"...",
"values",
")",
"throws",
"SQLException",
"{",
"return",
"findAll",
"(",
"conn",
",",
"Entity",
".",
"create... | 根据某个字段名条件查询数据列表,返回所有字段
@param conn 数据库连接对象
@param tableName 表名
@param field 字段名
@param values 字段值列表
@return 数据对象列表
@throws SQLException SQL执行异常 | [
"根据某个字段名条件查询数据列表,返回所有字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L428-L430 | train | Find all entities in a table. | [
30522,
2270,
2862,
1026,
9178,
1028,
2424,
2378,
1006,
4434,
9530,
2078,
1010,
5164,
2795,
18442,
1010,
5164,
2492,
1010,
4874,
1012,
1012,
1012,
5300,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2424,
8095,
1006,
9530,
2078,
1010,
9178,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.containsAny | public static boolean containsAny(Collection<?> coll1, Collection<?> coll2) {
if (isEmpty(coll1) || isEmpty(coll2)) {
return false;
}
if (coll1.size() < coll2.size()) {
for (Object object : coll1) {
if (coll2.contains(object)) {
return true;
}
}
} else {
for (Object object : coll2) {
if (coll1.contains(object)) {
return true;
}
}
}
return false;
} | java | public static boolean containsAny(Collection<?> coll1, Collection<?> coll2) {
if (isEmpty(coll1) || isEmpty(coll2)) {
return false;
}
if (coll1.size() < coll2.size()) {
for (Object object : coll1) {
if (coll2.contains(object)) {
return true;
}
}
} else {
for (Object object : coll2) {
if (coll1.contains(object)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsAny",
"(",
"Collection",
"<",
"?",
">",
"coll1",
",",
"Collection",
"<",
"?",
">",
"coll2",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"coll1",
")",
"||",
"isEmpty",
"(",
"coll2",
")",
")",
"{",
"return",
"false",
";... | 其中一个集合在另一个集合中是否至少包含一个元素,既是两个集合是否至少有一个共同的元素
@param coll1 集合1
@param coll2 集合2
@return 其中一个集合在另一个集合中是否至少包含一个元素
@since 2.1
@see #intersection | [
"其中一个集合在另一个集合中是否至少包含一个元素,既是两个集合是否至少有一个共同的元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L229-L247 | train | Checks if any of the objects in the given collections is contained in any of the objects in the other collections. | [
30522,
2270,
10763,
22017,
20898,
3397,
19092,
1006,
3074,
1026,
1029,
1028,
8902,
2140,
2487,
1010,
3074,
1026,
1029,
1028,
8902,
2140,
2475,
1007,
1063,
2065,
1006,
2003,
6633,
13876,
2100,
1006,
8902,
2140,
2487,
1007,
1064,
1064,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSinkTask.java | DataSinkTask.getLogString | private String getLogString(String message) {
return BatchTask.constructLogString(message, this.getEnvironment().getTaskInfo().getTaskName(), this);
} | java | private String getLogString(String message) {
return BatchTask.constructLogString(message, this.getEnvironment().getTaskInfo().getTaskName(), this);
} | [
"private",
"String",
"getLogString",
"(",
"String",
"message",
")",
"{",
"return",
"BatchTask",
".",
"constructLogString",
"(",
"message",
",",
"this",
".",
"getEnvironment",
"(",
")",
".",
"getTaskInfo",
"(",
")",
".",
"getTaskName",
"(",
")",
",",
"this",
... | Utility function that composes a string for logging purposes. The string includes the given message and
the index of the task in its task group together with the number of tasks in the task group.
@param message The main message for the log.
@return The string ready for logging. | [
"Utility",
"function",
"that",
"composes",
"a",
"string",
"for",
"logging",
"purposes",
".",
"The",
"string",
"includes",
"the",
"given",
"message",
"and",
"the",
"index",
"of",
"the",
"task",
"in",
"its",
"task",
"group",
"together",
"with",
"the",
"number"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSinkTask.java#L403-L405 | train | Returns the log string for the given message. | [
30522,
2797,
5164,
2131,
21197,
3367,
4892,
1006,
5164,
4471,
1007,
1063,
2709,
14108,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JobResult.java | JobResult.createFrom | public static JobResult createFrom(AccessExecutionGraph accessExecutionGraph) {
final JobID jobId = accessExecutionGraph.getJobID();
final JobStatus jobStatus = accessExecutionGraph.getState();
checkArgument(
jobStatus.isGloballyTerminalState(),
"The job " + accessExecutionGraph.getJobName() + '(' + jobId + ") is not in a globally " +
"terminal state. It is in state " + jobStatus + '.');
final JobResult.Builder builder = new JobResult.Builder();
builder.jobId(jobId);
builder.applicationStatus(ApplicationStatus.fromJobStatus(accessExecutionGraph.getState()));
final long netRuntime = accessExecutionGraph.getStatusTimestamp(jobStatus) - accessExecutionGraph.getStatusTimestamp(JobStatus.CREATED);
// guard against clock changes
final long guardedNetRuntime = Math.max(netRuntime, 0L);
builder.netRuntime(guardedNetRuntime);
builder.accumulatorResults(accessExecutionGraph.getAccumulatorsSerialized());
if (jobStatus != JobStatus.FINISHED) {
final ErrorInfo errorInfo = accessExecutionGraph.getFailureInfo();
if (errorInfo != null) {
builder.serializedThrowable(errorInfo.getException());
}
}
return builder.build();
} | java | public static JobResult createFrom(AccessExecutionGraph accessExecutionGraph) {
final JobID jobId = accessExecutionGraph.getJobID();
final JobStatus jobStatus = accessExecutionGraph.getState();
checkArgument(
jobStatus.isGloballyTerminalState(),
"The job " + accessExecutionGraph.getJobName() + '(' + jobId + ") is not in a globally " +
"terminal state. It is in state " + jobStatus + '.');
final JobResult.Builder builder = new JobResult.Builder();
builder.jobId(jobId);
builder.applicationStatus(ApplicationStatus.fromJobStatus(accessExecutionGraph.getState()));
final long netRuntime = accessExecutionGraph.getStatusTimestamp(jobStatus) - accessExecutionGraph.getStatusTimestamp(JobStatus.CREATED);
// guard against clock changes
final long guardedNetRuntime = Math.max(netRuntime, 0L);
builder.netRuntime(guardedNetRuntime);
builder.accumulatorResults(accessExecutionGraph.getAccumulatorsSerialized());
if (jobStatus != JobStatus.FINISHED) {
final ErrorInfo errorInfo = accessExecutionGraph.getFailureInfo();
if (errorInfo != null) {
builder.serializedThrowable(errorInfo.getException());
}
}
return builder.build();
} | [
"public",
"static",
"JobResult",
"createFrom",
"(",
"AccessExecutionGraph",
"accessExecutionGraph",
")",
"{",
"final",
"JobID",
"jobId",
"=",
"accessExecutionGraph",
".",
"getJobID",
"(",
")",
";",
"final",
"JobStatus",
"jobStatus",
"=",
"accessExecutionGraph",
".",
... | Creates the {@link JobResult} from the given {@link AccessExecutionGraph} which
must be in a globally terminal state.
@param accessExecutionGraph to create the JobResult from
@return JobResult of the given AccessExecutionGraph | [
"Creates",
"the",
"{",
"@link",
"JobResult",
"}",
"from",
"the",
"given",
"{",
"@link",
"AccessExecutionGraph",
"}",
"which",
"must",
"be",
"in",
"a",
"globally",
"terminal",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobResult.java#L215-L244 | train | Create a JobResult from an access execution graph. | [
30522,
2270,
10763,
3105,
6072,
11314,
3443,
19699,
5358,
1006,
3229,
10288,
8586,
13700,
14413,
3229,
10288,
8586,
13700,
14413,
1007,
1063,
2345,
3105,
3593,
3105,
3593,
1027,
3229,
10288,
8586,
13700,
14413,
1012,
2131,
5558,
17062,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java | Bzip2DivSufSort.trGetC | private int trGetC(final int isa, final int isaD, final int isaN, final int p) {
return isaD + p < isaN ?
SA[isaD + p]
: SA[isa + ((isaD - isa + p) % (isaN - isa))];
} | java | private int trGetC(final int isa, final int isaD, final int isaN, final int p) {
return isaD + p < isaN ?
SA[isaD + p]
: SA[isa + ((isaD - isa + p) % (isaN - isa))];
} | [
"private",
"int",
"trGetC",
"(",
"final",
"int",
"isa",
",",
"final",
"int",
"isaD",
",",
"final",
"int",
"isaN",
",",
"final",
"int",
"p",
")",
"{",
"return",
"isaD",
"+",
"p",
"<",
"isaN",
"?",
"SA",
"[",
"isaD",
"+",
"p",
"]",
":",
"SA",
"["... | /*---------------------------------------------------------------------------- | [
"/",
"*",
"----------------------------------------------------------------------------"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java#L915-L919 | train | Tr Get C. | [
30522,
2797,
20014,
19817,
18150,
2278,
1006,
2345,
20014,
18061,
1010,
2345,
20014,
18061,
2094,
1010,
2345,
20014,
18061,
2078,
1010,
2345,
20014,
1052,
1007,
1063,
2709,
18061,
2094,
1009,
1052,
1026,
18061,
2078,
1029,
7842,
1031,
18061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.getSortedIterator | public UnsafeSorterIterator getSortedIterator() throws IOException {
assert(recordComparatorSupplier != null);
if (spillWriters.isEmpty()) {
assert(inMemSorter != null);
readingIterator = new SpillableIterator(inMemSorter.getSortedIterator());
return readingIterator;
} else {
final UnsafeSorterSpillMerger spillMerger = new UnsafeSorterSpillMerger(
recordComparatorSupplier.get(), prefixComparator, spillWriters.size());
for (UnsafeSorterSpillWriter spillWriter : spillWriters) {
spillMerger.addSpillIfNotEmpty(spillWriter.getReader(serializerManager));
}
if (inMemSorter != null) {
readingIterator = new SpillableIterator(inMemSorter.getSortedIterator());
spillMerger.addSpillIfNotEmpty(readingIterator);
}
return spillMerger.getSortedIterator();
}
} | java | public UnsafeSorterIterator getSortedIterator() throws IOException {
assert(recordComparatorSupplier != null);
if (spillWriters.isEmpty()) {
assert(inMemSorter != null);
readingIterator = new SpillableIterator(inMemSorter.getSortedIterator());
return readingIterator;
} else {
final UnsafeSorterSpillMerger spillMerger = new UnsafeSorterSpillMerger(
recordComparatorSupplier.get(), prefixComparator, spillWriters.size());
for (UnsafeSorterSpillWriter spillWriter : spillWriters) {
spillMerger.addSpillIfNotEmpty(spillWriter.getReader(serializerManager));
}
if (inMemSorter != null) {
readingIterator = new SpillableIterator(inMemSorter.getSortedIterator());
spillMerger.addSpillIfNotEmpty(readingIterator);
}
return spillMerger.getSortedIterator();
}
} | [
"public",
"UnsafeSorterIterator",
"getSortedIterator",
"(",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"recordComparatorSupplier",
"!=",
"null",
")",
";",
"if",
"(",
"spillWriters",
".",
"isEmpty",
"(",
")",
")",
"{",
"assert",
"(",
"inMemSorter",
"!=",
... | Returns a sorted iterator. It is the caller's responsibility to call `cleanupResources()`
after consuming this iterator. | [
"Returns",
"a",
"sorted",
"iterator",
".",
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"call",
"cleanupResources",
"()",
"after",
"consuming",
"this",
"iterator",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L465-L483 | train | Get a sorted iterator for this reader. | [
30522,
2270,
25135,
21748,
3334,
21646,
8844,
4152,
15613,
21646,
8844,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
1006,
2501,
9006,
28689,
6591,
6279,
24759,
3771,
999,
1027,
19701,
1007,
1025,
2065,
1006,
14437,
15994,
2015,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java | TfIdf.tfs | public static <TERM> Iterable<Map<TERM, Double>> tfs(Iterable<Collection<TERM>> documents)
{
return tfs(documents, TfType.NATURAL);
} | java | public static <TERM> Iterable<Map<TERM, Double>> tfs(Iterable<Collection<TERM>> documents)
{
return tfs(documents, TfType.NATURAL);
} | [
"public",
"static",
"<",
"TERM",
">",
"Iterable",
"<",
"Map",
"<",
"TERM",
",",
"Double",
">",
">",
"tfs",
"(",
"Iterable",
"<",
"Collection",
"<",
"TERM",
">",
">",
"documents",
")",
"{",
"return",
"tfs",
"(",
"documents",
",",
"TfType",
".",
"NATUR... | 多文档词频
@param documents 多个文档,每个文档都是一个词袋
@param <TERM> 词语类型
@return 一个包含词频的Map的列表 | [
"多文档词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L118-L121 | train | Returns an iterable of map of term to distance from the document to the document. | [
30522,
2270,
10763,
1026,
2744,
1028,
2009,
6906,
3468,
1026,
4949,
1026,
2744,
1010,
3313,
1028,
1028,
1056,
10343,
1006,
2009,
6906,
3468,
1026,
3074,
1026,
2744,
1028,
1028,
5491,
1007,
1063,
2709,
1056,
10343,
1006,
5491,
1010,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fromAddress | public static UTF8String fromAddress(Object base, long offset, int numBytes) {
return new UTF8String(base, offset, numBytes);
} | java | public static UTF8String fromAddress(Object base, long offset, int numBytes) {
return new UTF8String(base, offset, numBytes);
} | [
"public",
"static",
"UTF8String",
"fromAddress",
"(",
"Object",
"base",
",",
"long",
"offset",
",",
"int",
"numBytes",
")",
"{",
"return",
"new",
"UTF8String",
"(",
"base",
",",
"offset",
",",
"numBytes",
")",
";",
"}"
] | Creates an UTF8String from given address (base and offset) and length. | [
"Creates",
"an",
"UTF8String",
"from",
"given",
"address",
"(",
"base",
"and",
"offset",
")",
"and",
"length",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L134-L136 | train | Creates a UTF8String from a byte array of bytes starting at the given offset. | [
30522,
2270,
10763,
21183,
2546,
2620,
3367,
4892,
2013,
4215,
16200,
4757,
1006,
4874,
2918,
1010,
2146,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2709,
2047,
21183,
2546,
2620,
3367,
4892,
1006,
2918,
1010,
16396,
1010,
15903,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateRegistry.java | KvStateRegistry.unregisterKvState | public void unregisterKvState(
JobID jobId,
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId) {
KvStateEntry<?, ?, ?> entry = registeredKvStates.remove(kvStateId);
if (entry != null) {
entry.clear();
final KvStateRegistryListener listener = getKvStateRegistryListener(jobId);
if (listener != null) {
listener.notifyKvStateUnregistered(
jobId,
jobVertexId,
keyGroupRange,
registrationName);
}
}
} | java | public void unregisterKvState(
JobID jobId,
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId) {
KvStateEntry<?, ?, ?> entry = registeredKvStates.remove(kvStateId);
if (entry != null) {
entry.clear();
final KvStateRegistryListener listener = getKvStateRegistryListener(jobId);
if (listener != null) {
listener.notifyKvStateUnregistered(
jobId,
jobVertexId,
keyGroupRange,
registrationName);
}
}
} | [
"public",
"void",
"unregisterKvState",
"(",
"JobID",
"jobId",
",",
"JobVertexID",
"jobVertexId",
",",
"KeyGroupRange",
"keyGroupRange",
",",
"String",
"registrationName",
",",
"KvStateID",
"kvStateId",
")",
"{",
"KvStateEntry",
"<",
"?",
",",
"?",
",",
"?",
">",... | Unregisters the KvState instance identified by the given KvStateID.
@param jobId JobId the KvState instance belongs to
@param kvStateId KvStateID to identify the KvState instance
@param keyGroupRange Key group range the KvState instance belongs to | [
"Unregisters",
"the",
"KvState",
"instance",
"identified",
"by",
"the",
"given",
"KvStateID",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateRegistry.java#L118-L138 | train | Unregister a KvState. | [
30522,
2270,
11675,
4895,
2890,
24063,
2121,
2243,
15088,
12259,
1006,
3105,
3593,
3105,
3593,
1010,
3105,
16874,
10288,
3593,
3105,
16874,
10288,
3593,
1010,
3145,
17058,
24388,
2063,
3145,
17058,
24388,
2063,
1010,
5164,
8819,
18442,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.