repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyProtocol.java | NettyProtocol.getServerChannelHandlers | public ChannelHandler[] getServerChannelHandlers() {
PartitionRequestQueue queueOfPartitionQueues = new PartitionRequestQueue();
PartitionRequestServerHandler serverHandler = new PartitionRequestServerHandler(
partitionProvider, taskEventPublisher, queueOfPartitionQueues, creditBasedEnabled);
return new ChannelHandler[] {
messageEncoder,
new NettyMessage.NettyMessageDecoder(!creditBasedEnabled),
serverHandler,
queueOfPartitionQueues
};
} | java | public ChannelHandler[] getServerChannelHandlers() {
PartitionRequestQueue queueOfPartitionQueues = new PartitionRequestQueue();
PartitionRequestServerHandler serverHandler = new PartitionRequestServerHandler(
partitionProvider, taskEventPublisher, queueOfPartitionQueues, creditBasedEnabled);
return new ChannelHandler[] {
messageEncoder,
new NettyMessage.NettyMessageDecoder(!creditBasedEnabled),
serverHandler,
queueOfPartitionQueues
};
} | [
"public",
"ChannelHandler",
"[",
"]",
"getServerChannelHandlers",
"(",
")",
"{",
"PartitionRequestQueue",
"queueOfPartitionQueues",
"=",
"new",
"PartitionRequestQueue",
"(",
")",
";",
"PartitionRequestServerHandler",
"serverHandler",
"=",
"new",
"PartitionRequestServerHandler... | Returns the server channel handlers.
<pre>
+-------------------------------------------------------------------+
| SERVER CHANNEL PIPELINE |
| |
| +----------+----------+ (3) write +----------------------+ |
| | Queue of queues +----------->| Message encoder | |
| +----------+----------+ +-----------+----------+ |
| /|\ \|/ |
| | (2) enqueue | |
| +----------+----------+ | |
| | Request handler | | |
| +----------+----------+ | |
| /|\ | |
| | | |
| +-----------+-----------+ | |
| | Message+Frame decoder | | |
| +-----------+-----------+ | |
| /|\ | |
+---------------+-----------------------------------+---------------+
| | (1) client request \|/
+---------------+-----------------------------------+---------------+
| | | |
| [ Socket.read() ] [ Socket.write() ] |
| |
| Netty Internal I/O Threads (Transport Implementation) |
+-------------------------------------------------------------------+
</pre>
@return channel handlers | [
"Returns",
"the",
"server",
"channel",
"handlers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyProtocol.java#L79-L90 | train | Returns an array of channel handlers for the server. | [
30522,
2270,
3149,
11774,
3917,
1031,
1033,
4152,
2121,
6299,
26058,
11774,
12910,
1006,
1007,
1063,
13571,
2890,
15500,
4226,
5657,
24240,
11253,
19362,
3775,
3508,
4226,
15808,
1027,
2047,
13571,
2890,
15500,
4226,
5657,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java | RadixSort.getCounts | private static long[][] getCounts(
LongArray array, long numRecords, int startByteIndex, int endByteIndex) {
long[][] counts = new long[8][];
// Optimization: do a fast pre-pass to determine which byte indices we can skip for sorting.
// If all the byte values at a particular index are the same we don't need to count it.
long bitwiseMax = 0;
long bitwiseMin = -1L;
long maxOffset = array.getBaseOffset() + numRecords * 8L;
Object baseObject = array.getBaseObject();
for (long offset = array.getBaseOffset(); offset < maxOffset; offset += 8) {
long value = Platform.getLong(baseObject, offset);
bitwiseMax |= value;
bitwiseMin &= value;
}
long bitsChanged = bitwiseMin ^ bitwiseMax;
// Compute counts for each byte index.
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (((bitsChanged >>> (i * 8)) & 0xff) != 0) {
counts[i] = new long[256];
// TODO(ekl) consider computing all the counts in one pass.
for (long offset = array.getBaseOffset(); offset < maxOffset; offset += 8) {
counts[i][(int)((Platform.getLong(baseObject, offset) >>> (i * 8)) & 0xff)]++;
}
}
}
return counts;
} | java | private static long[][] getCounts(
LongArray array, long numRecords, int startByteIndex, int endByteIndex) {
long[][] counts = new long[8][];
// Optimization: do a fast pre-pass to determine which byte indices we can skip for sorting.
// If all the byte values at a particular index are the same we don't need to count it.
long bitwiseMax = 0;
long bitwiseMin = -1L;
long maxOffset = array.getBaseOffset() + numRecords * 8L;
Object baseObject = array.getBaseObject();
for (long offset = array.getBaseOffset(); offset < maxOffset; offset += 8) {
long value = Platform.getLong(baseObject, offset);
bitwiseMax |= value;
bitwiseMin &= value;
}
long bitsChanged = bitwiseMin ^ bitwiseMax;
// Compute counts for each byte index.
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (((bitsChanged >>> (i * 8)) & 0xff) != 0) {
counts[i] = new long[256];
// TODO(ekl) consider computing all the counts in one pass.
for (long offset = array.getBaseOffset(); offset < maxOffset; offset += 8) {
counts[i][(int)((Platform.getLong(baseObject, offset) >>> (i * 8)) & 0xff)]++;
}
}
}
return counts;
} | [
"private",
"static",
"long",
"[",
"]",
"[",
"]",
"getCounts",
"(",
"LongArray",
"array",
",",
"long",
"numRecords",
",",
"int",
"startByteIndex",
",",
"int",
"endByteIndex",
")",
"{",
"long",
"[",
"]",
"[",
"]",
"counts",
"=",
"new",
"long",
"[",
"8",
... | Computes a value histogram for each byte in the given array.
@param array array to count records in.
@param numRecords number of data records in the array.
@param startByteIndex the first byte to compute counts for (the prior are skipped).
@param endByteIndex the last byte to compute counts for.
@return an array of eight 256-byte count arrays, one for each byte starting from the least
significant byte. If the byte does not need sorting the array will be null. | [
"Computes",
"a",
"value",
"histogram",
"for",
"each",
"byte",
"in",
"the",
"given",
"array",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L110-L136 | train | Get the counts for a given range of bytes. | [
30522,
2797,
10763,
2146,
1031,
1033,
1031,
1033,
2131,
3597,
16671,
2015,
1006,
2146,
2906,
9447,
9140,
1010,
2146,
16371,
2213,
2890,
27108,
5104,
1010,
20014,
2707,
3762,
9589,
3207,
2595,
1010,
20014,
2203,
3762,
9589,
3207,
2595,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java | DateTimeUtils.parseDateFormat | public static Calendar parseDateFormat(String s, DateFormat dateFormat,
TimeZone tz) {
ParsePosition pp = new ParsePosition(0);
Calendar ret = parseDateFormat(s, dateFormat, tz, pp);
if (pp.getIndex() != s.length()) {
// Didn't consume entire string - not good
return null;
}
return ret;
} | java | public static Calendar parseDateFormat(String s, DateFormat dateFormat,
TimeZone tz) {
ParsePosition pp = new ParsePosition(0);
Calendar ret = parseDateFormat(s, dateFormat, tz, pp);
if (pp.getIndex() != s.length()) {
// Didn't consume entire string - not good
return null;
}
return ret;
} | [
"public",
"static",
"Calendar",
"parseDateFormat",
"(",
"String",
"s",
",",
"DateFormat",
"dateFormat",
",",
"TimeZone",
"tz",
")",
"{",
"ParsePosition",
"pp",
"=",
"new",
"ParsePosition",
"(",
"0",
")",
";",
"Calendar",
"ret",
"=",
"parseDateFormat",
"(",
"... | Parses a string using {@link SimpleDateFormat} and a given pattern. The
entire string must match the pattern specified.
@param s string to be parsed
@param dateFormat Date format
@param tz time zone in which to interpret string. Defaults to the Java
default time zone
@return a Calendar initialized with the parsed value, or null if parsing
failed. If returned, the Calendar is configured to the UTC time zone. | [
"Parses",
"a",
"string",
"using",
"{",
"@link",
"SimpleDateFormat",
"}",
"and",
"a",
"given",
"pattern",
".",
"The",
"entire",
"string",
"must",
"match",
"the",
"pattern",
"specified",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L182-L191 | train | Parse a date format from a string. | [
30522,
2270,
10763,
8094,
11968,
6924,
3686,
14192,
4017,
1006,
5164,
1055,
1010,
3058,
14192,
4017,
3058,
14192,
4017,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
11968,
3366,
26994,
4903,
1027,
2047,
11968,
3366,
26994,
1006,
1014,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java | Utils.ports | public static Protos.Resource ports(Protos.Value.Range... ranges) {
return ports(UNRESERVED_ROLE, ranges);
} | java | public static Protos.Resource ports(Protos.Value.Range... ranges) {
return ports(UNRESERVED_ROLE, ranges);
} | [
"public",
"static",
"Protos",
".",
"Resource",
"ports",
"(",
"Protos",
".",
"Value",
".",
"Range",
"...",
"ranges",
")",
"{",
"return",
"ports",
"(",
"UNRESERVED_ROLE",
",",
"ranges",
")",
";",
"}"
] | Construct a port resource. | [
"Construct",
"a",
"port",
"resource",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java#L171-L173 | train | Returns a resource representing the ports of the node. | [
30522,
2270,
10763,
15053,
2015,
1012,
7692,
8831,
1006,
15053,
2015,
1012,
3643,
1012,
2846,
1012,
1012,
1012,
8483,
1007,
1063,
2709,
8831,
1006,
4895,
6072,
25944,
1035,
2535,
1010,
8483,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.loadClass | @SuppressWarnings("unchecked")
public static <T> Class<T> loadClass(String className, boolean isInitialized) {
return (Class<T>) ClassLoaderUtil.loadClass(className, isInitialized);
} | java | @SuppressWarnings("unchecked")
public static <T> Class<T> loadClass(String className, boolean isInitialized) {
return (Class<T>) ClassLoaderUtil.loadClass(className, isInitialized);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"loadClass",
"(",
"String",
"className",
",",
"boolean",
"isInitialized",
")",
"{",
"return",
"(",
"Class",
"<",
"T",
">",
")",
"ClassLoaderUtil"... | 加载类
@param <T> 对象类型
@param className 类名
@param isInitialized 是否初始化
@return 类 | [
"加载类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L591-L594 | train | Load a class from the classpath. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
2465,
1026,
1056,
30524,
5498,
20925,
3550,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/common/CommonDictionary.java | CommonDictionary.load | public boolean load(String path)
{
trie = new DoubleArrayTrie<V>();
long start = System.currentTimeMillis();
if (loadDat(ByteArray.createByteArray(path + BIN_EXT)))
{
return true;
}
TreeMap<String, V> map = new TreeMap<String, V>();
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
String line;
while ((line = br.readLine()) != null)
{
String[] paramArray = line.split("\\s");
map.put(paramArray[0], createValue(paramArray));
}
br.close();
}
catch (Exception e)
{
logger.warning("读取" + path + "失败" + e);
return false;
}
onLoaded(map);
Set<Map.Entry<String, V>> entrySet = map.entrySet();
List<String> keyList = new ArrayList<String>(entrySet.size());
List<V> valueList = new ArrayList<V>(entrySet.size());
for (Map.Entry<String, V> entry : entrySet)
{
keyList.add(entry.getKey());
valueList.add(entry.getValue());
}
int resultCode = trie.build(keyList, valueList);
if (resultCode != 0)
{
logger.warning("trie建立失败");
return false;
}
logger.info(path + "加载成功,耗时" + (System.currentTimeMillis() - start) + "ms");
saveDat(path + BIN_EXT, valueList);
return true;
} | java | public boolean load(String path)
{
trie = new DoubleArrayTrie<V>();
long start = System.currentTimeMillis();
if (loadDat(ByteArray.createByteArray(path + BIN_EXT)))
{
return true;
}
TreeMap<String, V> map = new TreeMap<String, V>();
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
String line;
while ((line = br.readLine()) != null)
{
String[] paramArray = line.split("\\s");
map.put(paramArray[0], createValue(paramArray));
}
br.close();
}
catch (Exception e)
{
logger.warning("读取" + path + "失败" + e);
return false;
}
onLoaded(map);
Set<Map.Entry<String, V>> entrySet = map.entrySet();
List<String> keyList = new ArrayList<String>(entrySet.size());
List<V> valueList = new ArrayList<V>(entrySet.size());
for (Map.Entry<String, V> entry : entrySet)
{
keyList.add(entry.getKey());
valueList.add(entry.getValue());
}
int resultCode = trie.build(keyList, valueList);
if (resultCode != 0)
{
logger.warning("trie建立失败");
return false;
}
logger.info(path + "加载成功,耗时" + (System.currentTimeMillis() - start) + "ms");
saveDat(path + BIN_EXT, valueList);
return true;
} | [
"public",
"boolean",
"load",
"(",
"String",
"path",
")",
"{",
"trie",
"=",
"new",
"DoubleArrayTrie",
"<",
"V",
">",
"(",
")",
";",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"loadDat",
"(",
"ByteArray",
".",
"... | 从txt路径加载
@param path
@return | [
"从txt路径加载"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/common/CommonDictionary.java#L48-L91 | train | Load a single language file. | [
30522,
2270,
22017,
20898,
7170,
1006,
5164,
4130,
1007,
1063,
13012,
2063,
1027,
2047,
3313,
2906,
9447,
18886,
2063,
1026,
1058,
1028,
1006,
1007,
1025,
2146,
2707,
1027,
2291,
1012,
2783,
7292,
19912,
2483,
1006,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java | CryptoUtils.toCryptoConf | public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) {
Properties props = new Properties();
for (Map.Entry<String, String> e : conf) {
String key = e.getKey();
if (key.startsWith(prefix)) {
props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substring(prefix.length()),
e.getValue());
}
}
return props;
} | java | public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) {
Properties props = new Properties();
for (Map.Entry<String, String> e : conf) {
String key = e.getKey();
if (key.startsWith(prefix)) {
props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substring(prefix.length()),
e.getValue());
}
}
return props;
} | [
"public",
"static",
"Properties",
"toCryptoConf",
"(",
"String",
"prefix",
",",
"Iterable",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"conf",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
... | Extract the commons-crypto configuration embedded in a list of config values.
@param prefix Prefix in the given configuration that identifies the commons-crypto configs.
@param conf List of configuration values. | [
"Extract",
"the",
"commons",
"-",
"crypto",
"configuration",
"embedded",
"in",
"a",
"list",
"of",
"config",
"values",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java#L37-L47 | train | Converts a list of map entries to a Properties object. | [
30522,
2270,
10763,
5144,
2000,
26775,
22571,
3406,
8663,
2546,
1006,
5164,
17576,
1010,
2009,
6906,
3468,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
5164,
1028,
1028,
9530,
2546,
1007,
1063,
5144,
24387,
1027,
2047,
5144,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/classification/utilities/TextProcessUtility.java | TextProcessUtility.getKeywordCounts | public static Map<String, Integer> getKeywordCounts(String[] keywordArray)
{
Map<String, Integer> counts = new HashMap<String, Integer>();
Integer counter;
for (int i = 0; i < keywordArray.length; ++i)
{
counter = counts.get(keywordArray[i]);
if (counter == null)
{
counter = 0;
}
counts.put(keywordArray[i], ++counter); //增加词频
}
return counts;
} | java | public static Map<String, Integer> getKeywordCounts(String[] keywordArray)
{
Map<String, Integer> counts = new HashMap<String, Integer>();
Integer counter;
for (int i = 0; i < keywordArray.length; ++i)
{
counter = counts.get(keywordArray[i]);
if (counter == null)
{
counter = 0;
}
counts.put(keywordArray[i], ++counter); //增加词频
}
return counts;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"getKeywordCounts",
"(",
"String",
"[",
"]",
"keywordArray",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"counts",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
"... | 统计每个词的词频
@param keywordArray
@return | [
"统计每个词的词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/utilities/TextProcessUtility.java#L52-L68 | train | Get the count of all the words in the array of words. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
16109,
1028,
2131,
14839,
18351,
3597,
16671,
2015,
1006,
5164,
1031,
1033,
3145,
18351,
2906,
9447,
1007,
1063,
4949,
1026,
5164,
1010,
16109,
30524,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java | SpringApplicationBuilder.child | public SpringApplicationBuilder child(Class<?>... sources) {
SpringApplicationBuilder child = new SpringApplicationBuilder();
child.sources(sources);
// Copy environment stuff from parent to child
child.properties(this.defaultProperties).environment(this.environment)
.additionalProfiles(this.additionalProfiles);
child.parent = this;
// It's not possible if embedded web server are enabled to support web contexts as
// parents because the servlets cannot be initialized at the right point in
// lifecycle.
web(WebApplicationType.NONE);
// Probably not interested in multiple banners
bannerMode(Banner.Mode.OFF);
// Make sure sources get copied over
this.application.addPrimarySources(this.sources);
return child;
} | java | public SpringApplicationBuilder child(Class<?>... sources) {
SpringApplicationBuilder child = new SpringApplicationBuilder();
child.sources(sources);
// Copy environment stuff from parent to child
child.properties(this.defaultProperties).environment(this.environment)
.additionalProfiles(this.additionalProfiles);
child.parent = this;
// It's not possible if embedded web server are enabled to support web contexts as
// parents because the servlets cannot be initialized at the right point in
// lifecycle.
web(WebApplicationType.NONE);
// Probably not interested in multiple banners
bannerMode(Banner.Mode.OFF);
// Make sure sources get copied over
this.application.addPrimarySources(this.sources);
return child;
} | [
"public",
"SpringApplicationBuilder",
"child",
"(",
"Class",
"<",
"?",
">",
"...",
"sources",
")",
"{",
"SpringApplicationBuilder",
"child",
"=",
"new",
"SpringApplicationBuilder",
"(",
")",
";",
"child",
".",
"sources",
"(",
"sources",
")",
";",
"// Copy enviro... | Create a child application with the provided sources. Default args and environment
are copied down into the child, but everything else is a clean sheet.
@param sources the sources for the application (Spring configuration)
@return the child application builder | [
"Create",
"a",
"child",
"application",
"with",
"the",
"provided",
"sources",
".",
"Default",
"args",
"and",
"environment",
"are",
"copied",
"down",
"into",
"the",
"child",
"but",
"everything",
"else",
"is",
"a",
"clean",
"sheet",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java#L182-L203 | train | Create a child application builder. | [
30522,
2270,
3500,
29098,
19341,
3508,
8569,
23891,
2099,
2775,
1006,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
4216,
1007,
1063,
3500,
29098,
19341,
3508,
8569,
23891,
2099,
2775,
1027,
2047,
3500,
29098,
19341,
3508,
8569,
23891,
2099,
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 | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.openSession | @Override
public SessionHandle openSession(String username, String password, Map<String, String> configuration)
throws HiveSQLException {
SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION, username, password, null, configuration, false, null);
LOG.debug(sessionHandle + ": openSession()");
return sessionHandle;
} | java | @Override
public SessionHandle openSession(String username, String password, Map<String, String> configuration)
throws HiveSQLException {
SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION, username, password, null, configuration, false, null);
LOG.debug(sessionHandle + ": openSession()");
return sessionHandle;
} | [
"@",
"Override",
"public",
"SessionHandle",
"openSession",
"(",
"String",
"username",
",",
"String",
"password",
",",
"Map",
"<",
"String",
",",
"String",
">",
"configuration",
")",
"throws",
"HiveSQLException",
"{",
"SessionHandle",
"sessionHandle",
"=",
"session... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#openSession(java.lang.String, java.lang.String, java.util.Map) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L211-L217 | train | Override openSession to create a new session | [
30522,
1030,
2058,
15637,
2270,
5219,
11774,
2571,
7480,
7971,
3258,
1006,
5164,
5310,
18442,
1010,
5164,
20786,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
9563,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
5219,
11774,
2571,
521... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java | DefaultCookie.validateValue | @Deprecated
protected String validateValue(String name, String value) {
return validateAttributeValue(name, value);
} | java | @Deprecated
protected String validateValue(String name, String value) {
return validateAttributeValue(name, value);
} | [
"@",
"Deprecated",
"protected",
"String",
"validateValue",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"return",
"validateAttributeValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Validate a cookie attribute value, throws a {@link IllegalArgumentException} otherwise.
Only intended to be used by {@link io.netty.handler.codec.http.DefaultCookie}.
@param name attribute name
@param value attribute value
@return the trimmed, validated attribute value
@deprecated CookieUtil is package private, will be removed once old Cookie API is dropped | [
"Validate",
"a",
"cookie",
"attribute",
"value",
"throws",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java#L205-L208 | train | Validate a value for a resource attribute. | [
30522,
1030,
2139,
28139,
12921,
5123,
5164,
9398,
3686,
10175,
5657,
1006,
5164,
2171,
1010,
5164,
3643,
1007,
1063,
2709,
9398,
3686,
19321,
3089,
8569,
2618,
10175,
5657,
1006,
2171,
1010,
3643,
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/spark | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TOperationHandle.java | TOperationHandle.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case OPERATION_ID:
return isSetOperationId();
case OPERATION_TYPE:
return isSetOperationType();
case HAS_RESULT_SET:
return isSetHasResultSet();
case MODIFIED_ROW_COUNT:
return isSetModifiedRowCount();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case OPERATION_ID:
return isSetOperationId();
case OPERATION_TYPE:
return isSetOperationType();
case HAS_RESULT_SET:
return isSetHasResultSet();
case MODIFIED_ROW_COUNT:
return isSetModifiedRowCount();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"OPERATION_ID",
":",
"return",
"isSetOp... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TOperationHandle.java#L342-L358 | train | Checks if field is set to the value of a CRA_CARTECT_SPECIFIC_RESULT_SET object. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
3169... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.addSource | @SuppressWarnings("unchecked")
public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, String sourceName, TypeInformation<OUT> typeInfo) {
if (typeInfo == null) {
if (function instanceof ResultTypeQueryable) {
typeInfo = ((ResultTypeQueryable<OUT>) function).getProducedType();
} else {
try {
typeInfo = TypeExtractor.createTypeInfo(
SourceFunction.class,
function.getClass(), 0, null, null);
} catch (final InvalidTypesException e) {
typeInfo = (TypeInformation<OUT>) new MissingTypeInfo(sourceName, e);
}
}
}
boolean isParallel = function instanceof ParallelSourceFunction;
clean(function);
final StreamSource<OUT, ?> sourceOperator = new StreamSource<>(function);
return new DataStreamSource<>(this, typeInfo, sourceOperator, isParallel, sourceName);
} | java | @SuppressWarnings("unchecked")
public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, String sourceName, TypeInformation<OUT> typeInfo) {
if (typeInfo == null) {
if (function instanceof ResultTypeQueryable) {
typeInfo = ((ResultTypeQueryable<OUT>) function).getProducedType();
} else {
try {
typeInfo = TypeExtractor.createTypeInfo(
SourceFunction.class,
function.getClass(), 0, null, null);
} catch (final InvalidTypesException e) {
typeInfo = (TypeInformation<OUT>) new MissingTypeInfo(sourceName, e);
}
}
}
boolean isParallel = function instanceof ParallelSourceFunction;
clean(function);
final StreamSource<OUT, ?> sourceOperator = new StreamSource<>(function);
return new DataStreamSource<>(this, typeInfo, sourceOperator, isParallel, sourceName);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"addSource",
"(",
"SourceFunction",
"<",
"OUT",
">",
"function",
",",
"String",
"sourceName",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo... | Ads a data source with a custom type information thus opening a
{@link DataStream}. Only in very special cases does the user need to
support type information. Otherwise use
{@link #addSource(org.apache.flink.streaming.api.functions.source.SourceFunction)}
@param function
the user defined function
@param sourceName
Name of the data source
@param <OUT>
type of the returned stream
@param typeInfo
the user defined type information for the stream
@return the data stream constructed | [
"Ads",
"a",
"data",
"source",
"with",
"a",
"custom",
"type",
"information",
"thus",
"opening",
"a",
"{",
"@link",
"DataStream",
"}",
".",
"Only",
"in",
"very",
"special",
"cases",
"does",
"the",
"user",
"need",
"to",
"support",
"type",
"information",
".",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1449-L1472 | train | Add a source to the data stream. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
9909,
8162,
3401,
1006,
3120,
11263,
27989,
1026,
2041,
1028,
3853,
1010,
5164,
3120,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.digestHex | public String digestHex(String data, String charset) {
return HexUtil.encodeHexStr(digest(data, charset));
} | java | public String digestHex(String data, String charset) {
return HexUtil.encodeHexStr(digest(data, charset));
} | [
"public",
"String",
"digestHex",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"HexUtil",
".",
"encodeHexStr",
"(",
"digest",
"(",
"data",
",",
"charset",
")",
")",
";",
"}"
] | 生成文件摘要,并转为16进制字符串
@param data 被摘要数据
@param charset 编码
@return 摘要 | [
"生成文件摘要,并转为16进制字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L124-L126 | train | Returns the hex encoded digest of the input string. | [
30522,
2270,
5164,
17886,
5369,
2595,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
4372,
16044,
5369,
2595,
3367,
2099,
1006,
17886,
1006,
2951,
1010,
25869,
13462,
1007,
1007,
1025,
1065,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/MathUtil.java | MathUtil.isOutOfBounds | public static boolean isOutOfBounds(int index, int length, int capacity) {
return (index | length | (index + length) | (capacity - (index + length))) < 0;
} | java | public static boolean isOutOfBounds(int index, int length, int capacity) {
return (index | length | (index + length) | (capacity - (index + length))) < 0;
} | [
"public",
"static",
"boolean",
"isOutOfBounds",
"(",
"int",
"index",
",",
"int",
"length",
",",
"int",
"capacity",
")",
"{",
"return",
"(",
"index",
"|",
"length",
"|",
"(",
"index",
"+",
"length",
")",
"|",
"(",
"capacity",
"-",
"(",
"index",
"+",
"... | Determine if the requested {@code index} and {@code length} will fit within {@code capacity}.
@param index The starting index.
@param length The length which will be utilized (starting from {@code index}).
@param capacity The capacity that {@code index + length} is allowed to be within.
@return {@code true} if the requested {@code index} and {@code length} will fit within {@code capacity}.
{@code false} if this would result in an index out of bounds exception. | [
"Determine",
"if",
"the",
"requested",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/MathUtil.java#L63-L65 | train | Checks if the index is out of bounds. | [
30522,
2270,
10763,
22017,
20898,
11163,
16161,
26337,
28819,
2015,
1006,
20014,
5950,
1010,
20014,
3091,
1010,
20014,
3977,
1007,
1063,
2709,
1006,
5950,
1064,
3091,
1064,
1006,
5950,
1009,
3091,
1007,
1064,
1006,
3977,
1011,
1006,
5950,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/SummarizationData.java | SummarizationData.getEdges | public static DataSet<Edge<Long, String>> getEdges(ExecutionEnvironment env) {
List<Edge<Long, String>> edges = new ArrayList<>(INPUT_EDGES.length);
for (String edge : INPUT_EDGES) {
String[] tokens = edge.split(";");
edges.add(new Edge<>(Long.parseLong(tokens[0]), Long.parseLong(tokens[1]), tokens[2]));
}
return env.fromCollection(edges);
} | java | public static DataSet<Edge<Long, String>> getEdges(ExecutionEnvironment env) {
List<Edge<Long, String>> edges = new ArrayList<>(INPUT_EDGES.length);
for (String edge : INPUT_EDGES) {
String[] tokens = edge.split(";");
edges.add(new Edge<>(Long.parseLong(tokens[0]), Long.parseLong(tokens[1]), tokens[2]));
}
return env.fromCollection(edges);
} | [
"public",
"static",
"DataSet",
"<",
"Edge",
"<",
"Long",
",",
"String",
">",
">",
"getEdges",
"(",
"ExecutionEnvironment",
"env",
")",
"{",
"List",
"<",
"Edge",
"<",
"Long",
",",
"String",
">",
">",
"edges",
"=",
"new",
"ArrayList",
"<>",
"(",
"INPUT_E... | Creates a set of edges with attached {@link String} values.
@param env execution environment
@return edge data set with string values | [
"Creates",
"a",
"set",
"of",
"edges",
"with",
"attached",
"{",
"@link",
"String",
"}",
"values",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/SummarizationData.java#L139-L147 | train | Get edges from input data set. | [
30522,
2270,
10763,
2951,
13462,
1026,
3341,
1026,
2146,
1010,
5164,
1028,
1028,
2131,
24225,
2015,
1006,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1007,
1063,
2862,
1026,
3341,
1026,
2146,
1010,
5164,
1028,
1028,
7926,
1027,
2047,
9140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java | UnixResolverDnsServerAddressStreamProvider.parseSilently | static DnsServerAddressStreamProvider parseSilently() {
try {
UnixResolverDnsServerAddressStreamProvider nameServerCache =
new UnixResolverDnsServerAddressStreamProvider(ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR);
return nameServerCache.mayOverrideNameServers() ? nameServerCache
: DefaultDnsServerAddressStreamProvider.INSTANCE;
} catch (Exception e) {
logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e);
return DefaultDnsServerAddressStreamProvider.INSTANCE;
}
} | java | static DnsServerAddressStreamProvider parseSilently() {
try {
UnixResolverDnsServerAddressStreamProvider nameServerCache =
new UnixResolverDnsServerAddressStreamProvider(ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR);
return nameServerCache.mayOverrideNameServers() ? nameServerCache
: DefaultDnsServerAddressStreamProvider.INSTANCE;
} catch (Exception e) {
logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e);
return DefaultDnsServerAddressStreamProvider.INSTANCE;
}
} | [
"static",
"DnsServerAddressStreamProvider",
"parseSilently",
"(",
")",
"{",
"try",
"{",
"UnixResolverDnsServerAddressStreamProvider",
"nameServerCache",
"=",
"new",
"UnixResolverDnsServerAddressStreamProvider",
"(",
"ETC_RESOLV_CONF_FILE",
",",
"ETC_RESOLVER_DIR",
")",
";",
"re... | Attempt to parse {@code /etc/resolv.conf} and files in the {@code /etc/resolver} directory by default.
A failure to parse will return {@link DefaultDnsServerAddressStreamProvider}. | [
"Attempt",
"to",
"parse",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java#L68-L78 | train | Parse the DNS server address stream provider without throwing an exception. | [
30522,
10763,
1040,
3619,
8043,
26061,
14141,
8303,
21422,
21572,
17258,
2121,
11968,
8583,
9463,
20630,
1006,
1007,
1063,
3046,
1063,
19998,
6072,
4747,
6299,
2094,
3619,
8043,
26061,
14141,
8303,
21422,
21572,
17258,
2121,
3415,
2121,
6299,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.not | public static ExpectedCondition<Boolean> not(final ExpectedCondition<?> condition) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
Object result = condition.apply(driver);
return result == null || result.equals(Boolean.FALSE);
}
@Override
public String toString() {
return "condition to not be valid: " + condition;
}
};
} | java | public static ExpectedCondition<Boolean> not(final ExpectedCondition<?> condition) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
Object result = condition.apply(driver);
return result == null || result.equals(Boolean.FALSE);
}
@Override
public String toString() {
return "condition to not be valid: " + condition;
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"not",
"(",
"final",
"ExpectedCondition",
"<",
"?",
">",
"condition",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"app... | An expectation with the logical opposite condition of the given condition.
Note that if the Condition you are inverting throws an exception that is caught by the Ignored
Exceptions, the inversion will not take place and lead to confusing results.
@param condition ExpectedCondition to be inverted
@return true once the condition is satisfied | [
"An",
"expectation",
"with",
"the",
"logical",
"opposite",
"condition",
"of",
"the",
"given",
"condition",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L846-L859 | train | An expectation for checking that a page is not valid. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
2025,
1006,
2345,
3517,
8663,
20562,
1026,
1029,
1028,
4650,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/util/WebLogDataGenerator.java | WebLogDataGenerator.main | public static void main(String[] args) {
// parse parameters
if (args.length < 2) {
System.out.println("WebLogDataGenerator <numberOfDocuments> <numberOfVisits>");
System.exit(1);
}
int noDocs = Integer.parseInt(args[0]);
int noVisits = Integer.parseInt(args[1]);
String[] filterKWs = { "editors", "oscillations", "convection" };
String[] words = { "Lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "sed", "diam", "nonummy",
"nibh", "euismod", "tincidunt", "ut", "laoreet", "dolore",
"magna", "aliquam", "erat", "volutpat", "Ut", "wisi", "enim",
"ad", "minim", "veniam", "quis", "nostrud", "exerci", "tation",
"ullamcorper", "suscipit", "lobortis", "nisl", "ut", "aliquip",
"ex", "ea", "commodo" };
final String outPath = System.getProperty("java.io.tmpdir");
System.out.println("Generating documents files...");
genDocs(noDocs, filterKWs, words, outPath + "/documents");
System.out.println("Generating ranks files...");
genRanks(noDocs, outPath + "/ranks");
System.out.println("Generating visits files...");
genVisits(noVisits, noDocs, outPath + "/visits");
System.out.println("Done!");
} | java | public static void main(String[] args) {
// parse parameters
if (args.length < 2) {
System.out.println("WebLogDataGenerator <numberOfDocuments> <numberOfVisits>");
System.exit(1);
}
int noDocs = Integer.parseInt(args[0]);
int noVisits = Integer.parseInt(args[1]);
String[] filterKWs = { "editors", "oscillations", "convection" };
String[] words = { "Lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "sed", "diam", "nonummy",
"nibh", "euismod", "tincidunt", "ut", "laoreet", "dolore",
"magna", "aliquam", "erat", "volutpat", "Ut", "wisi", "enim",
"ad", "minim", "veniam", "quis", "nostrud", "exerci", "tation",
"ullamcorper", "suscipit", "lobortis", "nisl", "ut", "aliquip",
"ex", "ea", "commodo" };
final String outPath = System.getProperty("java.io.tmpdir");
System.out.println("Generating documents files...");
genDocs(noDocs, filterKWs, words, outPath + "/documents");
System.out.println("Generating ranks files...");
genRanks(noDocs, outPath + "/ranks");
System.out.println("Generating visits files...");
genVisits(noVisits, noDocs, outPath + "/visits");
System.out.println("Done!");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// parse parameters",
"if",
"(",
"args",
".",
"length",
"<",
"2",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"WebLogDataGenerator <numberOfDocuments> <numberOfVisits>\"",... | Main method to generate data for the {@link WebLogAnalysis} example program.
<p>The generator creates to files:
<ul>
<li><code>{tmp.dir}/documents</code> for the web documents
<li><code>{tmp.dir}/ranks</code> for the ranks of the web documents
<li><code>{tmp.dir}/visits</code> for the logged visits of web documents
</ul>
@param args
<ol>
<li>Int: Number of web documents
<li>Int: Number of visits
</ol> | [
"Main",
"method",
"to",
"generate",
"data",
"for",
"the",
"{",
"@link",
"WebLogAnalysis",
"}",
"example",
"program",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/util/WebLogDataGenerator.java#L51-L82 | train | Main method for generating the data. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
1013,
1013,
11968,
3366,
11709,
2065,
1006,
12098,
5620,
1012,
3091,
1026,
1016,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
1000,
4773,
21197,
285... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedScheduledExecutorService.java | InstrumentedScheduledExecutorService.invokeAny | @Nonnull
@Override
public <T> T invokeAny(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
submitted.mark(tasks.size());
Collection<? extends Callable<T>> instrumented = instrument(tasks);
return delegate.invokeAny(instrumented);
} | java | @Nonnull
@Override
public <T> T invokeAny(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
submitted.mark(tasks.size());
Collection<? extends Callable<T>> instrumented = instrument(tasks);
return delegate.invokeAny(instrumented);
} | [
"@",
"Nonnull",
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"invokeAny",
"(",
"@",
"Nonnull",
"Collection",
"<",
"?",
"extends",
"Callable",
"<",
"T",
">",
">",
"tasks",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"submitted",
... | {@inheritDoc} | [
"{"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedScheduledExecutorService.java#L216-L222 | train | Invokes a collection of Callable objects. | [
30522,
1030,
2512,
11231,
3363,
1030,
2058,
15637,
2270,
1026,
1056,
1028,
1056,
1999,
6767,
3489,
19092,
1006,
1030,
2512,
11231,
3363,
3074,
1026,
1029,
8908,
2655,
3085,
1026,
1056,
1028,
1028,
8518,
1007,
11618,
7153,
10288,
24422,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java | AbstractLauncher.setDeployMode | public T setDeployMode(String mode) {
checkNotNull(mode, "mode");
builder.deployMode = mode;
return self();
} | java | public T setDeployMode(String mode) {
checkNotNull(mode, "mode");
builder.deployMode = mode;
return self();
} | [
"public",
"T",
"setDeployMode",
"(",
"String",
"mode",
")",
"{",
"checkNotNull",
"(",
"mode",
",",
"\"mode\"",
")",
";",
"builder",
".",
"deployMode",
"=",
"mode",
";",
"return",
"self",
"(",
")",
";",
"}"
] | Set the deploy mode for the application.
@param mode Deploy mode.
@return This launcher. | [
"Set",
"the",
"deploy",
"mode",
"for",
"the",
"application",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L96-L100 | train | Sets the deploy mode. | [
30522,
2270,
1056,
2275,
3207,
24759,
6977,
5302,
3207,
1006,
5164,
5549,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
5549,
1010,
1000,
5549,
1000,
1007,
1025,
12508,
1012,
21296,
5302,
3207,
1027,
5549,
1025,
2709,
2969,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.toByteArray | public byte[] toByteArray(int start, int end) {
return Arrays.copyOfRange(value, start + offset, end + offset);
} | java | public byte[] toByteArray(int start, int end) {
return Arrays.copyOfRange(value, start + offset, end + offset);
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"Arrays",
".",
"copyOfRange",
"(",
"value",
",",
"start",
"+",
"offset",
",",
"end",
"+",
"offset",
")",
";",
"}"
] | Converts a subset of this string to a byte array.
The subset is defined by the range [{@code start}, {@code end}). | [
"Converts",
"a",
"subset",
"of",
"this",
"string",
"to",
"a",
"byte",
"array",
".",
"The",
"subset",
"is",
"defined",
"by",
"the",
"range",
"[",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L398-L400 | train | Returns a byte array containing the specified range of the value. | [
30522,
2270,
24880,
1031,
1033,
11291,
27058,
11335,
2100,
1006,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
2709,
27448,
1012,
6100,
11253,
24388,
2063,
1006,
3643,
1010,
2707,
1009,
16396,
1010,
2203,
1009,
16396,
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... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java | Util.sqlRS | public static Object sqlRS(DataSource ds, String sql, Function<ResultSet, Object> fun) {
try (Connection conn = ds.getConnection();
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
stmt.setFetchSize(Integer.MIN_VALUE);
try (ResultSet rs = stmt.executeQuery(sql)) {
return fun.apply(rs);
}
} catch (Exception e) {
logger.error("sqlRs has error, sql: {} ", sql);
throw new RuntimeException(e);
}
} | java | public static Object sqlRS(DataSource ds, String sql, Function<ResultSet, Object> fun) {
try (Connection conn = ds.getConnection();
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
stmt.setFetchSize(Integer.MIN_VALUE);
try (ResultSet rs = stmt.executeQuery(sql)) {
return fun.apply(rs);
}
} catch (Exception e) {
logger.error("sqlRs has error, sql: {} ", sql);
throw new RuntimeException(e);
}
} | [
"public",
"static",
"Object",
"sqlRS",
"(",
"DataSource",
"ds",
",",
"String",
"sql",
",",
"Function",
"<",
"ResultSet",
",",
"Object",
">",
"fun",
")",
"{",
"try",
"(",
"Connection",
"conn",
"=",
"ds",
".",
"getConnection",
"(",
")",
";",
"Statement",
... | 通过DS执行sql | [
"通过DS执行sql"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java#L36-L47 | train | sqlRs is a utility method that is used to execute a SQL statement. | [
30522,
2270,
10763,
4874,
29296,
2869,
1006,
2951,
6499,
3126,
3401,
16233,
1010,
5164,
29296,
1010,
3853,
1026,
3463,
3388,
1010,
30524,
20492,
1027,
9530,
2078,
1012,
9005,
12259,
3672,
1006,
3463,
3388,
1012,
2828,
1035,
2830,
1035,
2069... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/runtime/operators/windowing/KeyMap.java | KeyMap.putIfAbsent | public final V putIfAbsent(K key, LazyFactory<V> factory) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
return entry.value;
}
}
// no match, insert a new value
V value = factory.create();
insertNewEntry(hash, key, value, slot);
// return the created value
return value;
} | java | public final V putIfAbsent(K key, LazyFactory<V> factory) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
return entry.value;
}
}
// no match, insert a new value
V value = factory.create();
insertNewEntry(hash, key, value, slot);
// return the created value
return value;
} | [
"public",
"final",
"V",
"putIfAbsent",
"(",
"K",
"key",
",",
"LazyFactory",
"<",
"V",
">",
"factory",
")",
"{",
"final",
"int",
"hash",
"=",
"hash",
"(",
"key",
")",
";",
"final",
"int",
"slot",
"=",
"indexOf",
"(",
"hash",
")",
";",
"// search the c... | Inserts a value for the given key, if no value is yet contained for that key. Otherwise,
returns the value currently contained for the key.
<p>The value that is inserted in case that the key is not contained, yet, is lazily created
using the given factory.
@param key The key to insert.
@param factory The factory that produces the value, if no value is contained, yet, for the key.
@return The value in the map after this operation (either the previously contained value, or the
newly created value).
@throws java.lang.NullPointerException Thrown, if the key is null. | [
"Inserts",
"a",
"value",
"for",
"the",
"given",
"key",
"if",
"no",
"value",
"is",
"yet",
"contained",
"for",
"that",
"key",
".",
"Otherwise",
"returns",
"the",
"value",
"currently",
"contained",
"for",
"the",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java#L157-L175 | train | Put the value associated with the specified key in this map. | [
30522,
2270,
2345,
1058,
2404,
10128,
7875,
5054,
2102,
1006,
1047,
3145,
1010,
13971,
21450,
1026,
1058,
1028,
4713,
1007,
1063,
2345,
20014,
23325,
1027,
23325,
1006,
3145,
1007,
1025,
2345,
20014,
10453,
1027,
5950,
11253,
1006,
23325,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliInputView.java | CliInputView.insert | private void insert(String binding) {
currentInput.insert(cursorPos, binding);
cursorPos += binding.length();
// reset view
resetMainPart();
} | java | private void insert(String binding) {
currentInput.insert(cursorPos, binding);
cursorPos += binding.length();
// reset view
resetMainPart();
} | [
"private",
"void",
"insert",
"(",
"String",
"binding",
")",
"{",
"currentInput",
".",
"insert",
"(",
"cursorPos",
",",
"binding",
")",
";",
"cursorPos",
"+=",
"binding",
".",
"length",
"(",
")",
";",
"// reset view",
"resetMainPart",
"(",
")",
";",
"}"
] | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliInputView.java#L182-L188 | train | Insert a string into the input. | [
30522,
2797,
11675,
19274,
1006,
5164,
8031,
1007,
1063,
2783,
2378,
18780,
1012,
19274,
1006,
12731,
25301,
14536,
2891,
1010,
8031,
1007,
1025,
12731,
25301,
14536,
2891,
1009,
1027,
8031,
1012,
3091,
1006,
1007,
1025,
1013,
1013,
25141,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putLong | public void putLong(String key, long l) {
checkNotNull(key);
put(key, Long.toString(l));
} | java | public void putLong(String key, long l) {
checkNotNull(key);
put(key, Long.toString(l));
} | [
"public",
"void",
"putLong",
"(",
"String",
"key",
",",
"long",
"l",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"put",
"(",
"key",
",",
"Long",
".",
"toString",
"(",
"l",
")",
")",
";",
"}"
] | Adds a long under the given key. | [
"Adds",
"a",
"long",
"under",
"the",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L139-L142 | train | Put a long value into the mapping. | [
30522,
2270,
11675,
2404,
10052,
1006,
5164,
3145,
1010,
2146,
1048,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3145,
1007,
1025,
2404,
1006,
3145,
1010,
2146,
1012,
2000,
3367,
4892,
1006,
1048,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java | SqlLikeUtils.sqlToRegexSimilar | static String sqlToRegexSimilar(
String sqlPattern,
char escapeChar) {
similarEscapeRuleChecking(sqlPattern, escapeChar);
boolean insideCharacterEnumeration = false;
final StringBuilder javaPattern =
new StringBuilder(sqlPattern.length() * 2);
final int len = sqlPattern.length();
for (int i = 0; i < len; i++) {
char c = sqlPattern.charAt(i);
if (c == escapeChar) {
if (i == (len - 1)) {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
char nextChar = sqlPattern.charAt(i + 1);
if (SQL_SIMILAR_SPECIALS.indexOf(nextChar) >= 0) {
// special character, use \ to replace the escape char.
if (JAVA_REGEX_SPECIALS.indexOf(nextChar) >= 0) {
javaPattern.append('\\');
}
javaPattern.append(nextChar);
} else if (nextChar == escapeChar) {
javaPattern.append(nextChar);
} else {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
i++; // we already process the next char.
} else {
switch (c) {
case '_':
javaPattern.append('.');
break;
case '%':
javaPattern.append("(?s:.*)");
break;
case '[':
javaPattern.append('[');
insideCharacterEnumeration = true;
i = sqlSimilarRewriteCharEnumeration(
sqlPattern,
javaPattern,
i,
escapeChar);
break;
case ']':
if (!insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, i);
}
insideCharacterEnumeration = false;
javaPattern.append(']');
break;
case '\\':
javaPattern.append("\\\\");
break;
case '$':
// $ is special character in java regex, but regular in
// SQL regex.
javaPattern.append("\\$");
break;
default:
javaPattern.append(c);
}
}
}
if (insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, len);
}
return javaPattern.toString();
} | java | static String sqlToRegexSimilar(
String sqlPattern,
char escapeChar) {
similarEscapeRuleChecking(sqlPattern, escapeChar);
boolean insideCharacterEnumeration = false;
final StringBuilder javaPattern =
new StringBuilder(sqlPattern.length() * 2);
final int len = sqlPattern.length();
for (int i = 0; i < len; i++) {
char c = sqlPattern.charAt(i);
if (c == escapeChar) {
if (i == (len - 1)) {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
char nextChar = sqlPattern.charAt(i + 1);
if (SQL_SIMILAR_SPECIALS.indexOf(nextChar) >= 0) {
// special character, use \ to replace the escape char.
if (JAVA_REGEX_SPECIALS.indexOf(nextChar) >= 0) {
javaPattern.append('\\');
}
javaPattern.append(nextChar);
} else if (nextChar == escapeChar) {
javaPattern.append(nextChar);
} else {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
i++; // we already process the next char.
} else {
switch (c) {
case '_':
javaPattern.append('.');
break;
case '%':
javaPattern.append("(?s:.*)");
break;
case '[':
javaPattern.append('[');
insideCharacterEnumeration = true;
i = sqlSimilarRewriteCharEnumeration(
sqlPattern,
javaPattern,
i,
escapeChar);
break;
case ']':
if (!insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, i);
}
insideCharacterEnumeration = false;
javaPattern.append(']');
break;
case '\\':
javaPattern.append("\\\\");
break;
case '$':
// $ is special character in java regex, but regular in
// SQL regex.
javaPattern.append("\\$");
break;
default:
javaPattern.append(c);
}
}
}
if (insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, len);
}
return javaPattern.toString();
} | [
"static",
"String",
"sqlToRegexSimilar",
"(",
"String",
"sqlPattern",
",",
"char",
"escapeChar",
")",
"{",
"similarEscapeRuleChecking",
"(",
"sqlPattern",
",",
"escapeChar",
")",
";",
"boolean",
"insideCharacterEnumeration",
"=",
"false",
";",
"final",
"StringBuilder"... | Translates SQL SIMILAR pattern to Java regex pattern. | [
"Translates",
"SQL",
"SIMILAR",
"pattern",
"to",
"Java",
"regex",
"pattern",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java#L231-L306 | train | Converts SQL pattern to regular expression similar. | [
30522,
10763,
5164,
29296,
19277,
3351,
2595,
5332,
4328,
8017,
1006,
5164,
29296,
4502,
12079,
2078,
1010,
25869,
4019,
7507,
2099,
1007,
1063,
2714,
2229,
19464,
6820,
2571,
5403,
23177,
1006,
29296,
4502,
12079,
2078,
1010,
4019,
7507,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java | HadoopInputFormatBase.configure | @Override
public void configure(Configuration parameters) {
// enforce sequential configuration() calls
synchronized (CONFIGURE_MUTEX) {
if (mapreduceInputFormat instanceof Configurable) {
((Configurable) mapreduceInputFormat).setConf(configuration);
}
}
} | java | @Override
public void configure(Configuration parameters) {
// enforce sequential configuration() calls
synchronized (CONFIGURE_MUTEX) {
if (mapreduceInputFormat instanceof Configurable) {
((Configurable) mapreduceInputFormat).setConf(configuration);
}
}
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"Configuration",
"parameters",
")",
"{",
"// enforce sequential configuration() calls",
"synchronized",
"(",
"CONFIGURE_MUTEX",
")",
"{",
"if",
"(",
"mapreduceInputFormat",
"instanceof",
"Configurable",
")",
"{",
"(",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java#L102-L111 | train | Override this method to configure the input format with the given configuration. | [
30522,
1030,
2058,
15637,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
9563,
11709,
1007,
1063,
1013,
1013,
16306,
25582,
9563,
1006,
1007,
4455,
25549,
1006,
9530,
8873,
27390,
2063,
1035,
20101,
2595,
1007,
1063,
2065,
1006,
4949,
5596,
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... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/result/CollectStreamResult.java | CollectStreamResult.handleMissingResult | protected <T> TypedResult<T> handleMissingResult() {
// check if the monitoring thread is still there
// we need to wait until we know what is going on
if (monitoringThread.isAlive()) {
return TypedResult.empty();
}
// the job finished with an exception
else if (executionException != null) {
throw executionException;
}
// we assume that a bounded job finished
else {
return TypedResult.endOfStream();
}
} | java | protected <T> TypedResult<T> handleMissingResult() {
// check if the monitoring thread is still there
// we need to wait until we know what is going on
if (monitoringThread.isAlive()) {
return TypedResult.empty();
}
// the job finished with an exception
else if (executionException != null) {
throw executionException;
}
// we assume that a bounded job finished
else {
return TypedResult.endOfStream();
}
} | [
"protected",
"<",
"T",
">",
"TypedResult",
"<",
"T",
">",
"handleMissingResult",
"(",
")",
"{",
"// check if the monitoring thread is still there",
"// we need to wait until we know what is going on",
"if",
"(",
"monitoringThread",
".",
"isAlive",
"(",
")",
")",
"{",
"r... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/result/CollectStreamResult.java#L112-L126 | train | This method is called by the job when the job is missing a result. | [
30522,
5123,
1026,
1056,
1028,
21189,
6072,
11314,
1026,
1056,
1028,
5047,
15630,
7741,
6072,
11314,
1006,
1007,
1063,
1013,
1013,
4638,
2065,
1996,
8822,
11689,
2003,
2145,
2045,
1013,
1013,
2057,
2342,
2000,
3524,
2127,
2057,
2113,
2054,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/traffic/AbstractTrafficShapingHandler.java | AbstractTrafficShapingHandler.configure | public void configure(long newWriteLimit, long newReadLimit) {
writeLimit = newWriteLimit;
readLimit = newReadLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | java | public void configure(long newWriteLimit, long newReadLimit) {
writeLimit = newWriteLimit;
readLimit = newReadLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | [
"public",
"void",
"configure",
"(",
"long",
"newWriteLimit",
",",
"long",
"newReadLimit",
")",
"{",
"writeLimit",
"=",
"newWriteLimit",
";",
"readLimit",
"=",
"newReadLimit",
";",
"if",
"(",
"trafficCounter",
"!=",
"null",
")",
"{",
"trafficCounter",
".",
"res... | Change the underlying limitations.
<p>Note the change will be taken as best effort, meaning
that all already scheduled traffics will not be
changed, but only applied to new traffics.</p>
<p>So the expected usage of this method is to be used not too often,
accordingly to the traffic shaping configuration.</p>
@param newWriteLimit The new write limit (in bytes)
@param newReadLimit The new read limit (in bytes) | [
"Change",
"the",
"underlying",
"limitations",
".",
"<p",
">",
"Note",
"the",
"change",
"will",
"be",
"taken",
"as",
"best",
"effort",
"meaning",
"that",
"all",
"already",
"scheduled",
"traffics",
"will",
"not",
"be",
"changed",
"but",
"only",
"applied",
"to"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L253-L259 | train | Sets the write and read limits for this class. | [
30522,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
2146,
2047,
26373,
17960,
4183,
1010,
2146,
2047,
16416,
19422,
27605,
2102,
1007,
1063,
4339,
17960,
4183,
1027,
2047,
26373,
17960,
4183,
1025,
3191,
17960,
4183,
1027,
2047,
16416,
19422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.asIterator | public static <E> Iterator<E> asIterator(Enumeration<E> e) {
return IterUtil.asIterator(e);
} | java | public static <E> Iterator<E> asIterator(Enumeration<E> e) {
return IterUtil.asIterator(e);
} | [
"public",
"static",
"<",
"E",
">",
"Iterator",
"<",
"E",
">",
"asIterator",
"(",
"Enumeration",
"<",
"E",
">",
"e",
")",
"{",
"return",
"IterUtil",
".",
"asIterator",
"(",
"e",
")",
";",
"}"
] | Enumeration转换为Iterator
<p>
Adapt the specified <code>Enumeration</code> to the <code>Iterator</code> interface
@param <E> 集合元素类型
@param e {@link Enumeration}
@return {@link Iterator}
@see IterUtil#asIterator(Enumeration) | [
"Enumeration转换为Iterator",
"<p",
">",
"Adapt",
"the",
"specified",
"<code",
">",
"Enumeration<",
"/",
"code",
">",
"to",
"the",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"interface"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1583-L1585 | train | Returns an iterator that iterates over the elements in the given enumeration. | [
30522,
2270,
10763,
1026,
1041,
1028,
2009,
6906,
4263,
1026,
1041,
1028,
2004,
21646,
8844,
1006,
4372,
17897,
8156,
1026,
1041,
1028,
1041,
1007,
1063,
2709,
2009,
2121,
21823,
2140,
1012,
2004,
21646,
8844,
1006,
1041,
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/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getInts | public int[] getInts(String name) {
String[] strings = getTrimmedStrings(name);
int[] ints = new int[strings.length];
for (int i = 0; i < strings.length; i++) {
ints[i] = Integer.parseInt(strings[i]);
}
return ints;
} | java | public int[] getInts(String name) {
String[] strings = getTrimmedStrings(name);
int[] ints = new int[strings.length];
for (int i = 0; i < strings.length; i++) {
ints[i] = Integer.parseInt(strings[i]);
}
return ints;
} | [
"public",
"int",
"[",
"]",
"getInts",
"(",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"strings",
"=",
"getTrimmedStrings",
"(",
"name",
")",
";",
"int",
"[",
"]",
"ints",
"=",
"new",
"int",
"[",
"strings",
".",
"length",
"]",
";",
"for",
"(",
... | Get the value of the <code>name</code> property as a set of comma-delimited
<code>int</code> values.
If no such property exists, an empty array is returned.
@param name property name
@return property value interpreted as an array of comma-delimited
<code>int</code> values | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"set",
"of",
"comma",
"-",
"delimited",
"<code",
">",
"int<",
"/",
"code",
">",
"values",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1374-L1381 | train | Get the integer values for the given name. | [
30522,
2270,
20014,
1031,
1033,
2131,
18447,
2015,
1006,
5164,
2171,
1007,
1063,
5164,
1031,
1033,
7817,
1027,
2131,
18886,
20058,
5104,
18886,
3070,
2015,
1006,
2171,
1007,
1025,
20014,
1031,
1033,
20014,
2015,
1027,
2047,
20014,
1031,
781... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.closeSession | @Override
public void closeSession(SessionHandle sessionHandle)
throws HiveSQLException {
sessionManager.closeSession(sessionHandle);
LOG.debug(sessionHandle + ": closeSession()");
} | java | @Override
public void closeSession(SessionHandle sessionHandle)
throws HiveSQLException {
sessionManager.closeSession(sessionHandle);
LOG.debug(sessionHandle + ": closeSession()");
} | [
"@",
"Override",
"public",
"void",
"closeSession",
"(",
"SessionHandle",
"sessionHandle",
")",
"throws",
"HiveSQLException",
"{",
"sessionManager",
".",
"closeSession",
"(",
"sessionHandle",
")",
";",
"LOG",
".",
"debug",
"(",
"sessionHandle",
"+",
"\": closeSession... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#closeSession(org.apache.hive.service.cli.SessionHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L234-L239 | train | Close the session handle. | [
30522,
1030,
2058,
15637,
2270,
11675,
14572,
7971,
3258,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
5219,
24805,
4590,
1012,
14572,
7971,
3258,
1006,
5219,
11774,
2571,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/StatementUtil.java | StatementUtil.getGeneratedKeys | public static List<Object> getGeneratedKeys(PreparedStatement ps) throws SQLException {
List<Object> keys = new ArrayList<Object>();
ResultSet rs = null;
int i = 1;
try {
rs = ps.getGeneratedKeys();
if (rs != null && rs.next()) {
keys.add(rs.getObject(i++));
}
return keys;
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(rs);
}
} | java | public static List<Object> getGeneratedKeys(PreparedStatement ps) throws SQLException {
List<Object> keys = new ArrayList<Object>();
ResultSet rs = null;
int i = 1;
try {
rs = ps.getGeneratedKeys();
if (rs != null && rs.next()) {
keys.add(rs.getObject(i++));
}
return keys;
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(rs);
}
} | [
"public",
"static",
"List",
"<",
"Object",
">",
"getGeneratedKeys",
"(",
"PreparedStatement",
"ps",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Object",
">",
"keys",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"ResultSet",
"rs",
"=",
... | 获得所有主键<br>
@param ps PreparedStatement
@return 所有主键
@throws SQLException SQL执行异常 | [
"获得所有主键<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L245-L260 | train | Gets the generated keys from the given PreparedStatement. | [
30522,
2270,
10763,
2862,
1026,
4874,
1028,
2131,
6914,
16848,
14839,
2015,
1006,
4810,
9153,
18532,
4765,
8827,
30524,
1006,
1007,
1025,
3463,
3388,
12667,
1027,
19701,
1025,
20014,
1045,
1027,
1015,
1025,
3046,
1063,
12667,
1027,
8827,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/cache/AbstractCacheMap.java | AbstractCacheMap.containsKey | @Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException();
}
CachedValue<K, V> entry = map.get(key);
if (entry == null) {
return false;
}
if (isValueExpired(entry)) {
if (map.remove(key, entry)) {
onValueRemove(entry);
return false;
}
return containsKey(key);
}
return true;
} | java | @Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException();
}
CachedValue<K, V> entry = map.get(key);
if (entry == null) {
return false;
}
if (isValueExpired(entry)) {
if (map.remove(key, entry)) {
onValueRemove(entry);
return false;
}
return containsKey(key);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"containsKey",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"CachedValue",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"map",
".... | /*
(non-Javadoc)
@see java.util.Map#containsKey(java.lang.Object) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/cache/AbstractCacheMap.java#L85-L103 | train | Override the method to check if the key is present in the cache. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3397,
14839,
1006,
4874,
3145,
1007,
1063,
2065,
1006,
3145,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1007,
1025,
1065,
17053,
2094,
10175,
5657,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java | CsvParser.readLine | private List<String> readLine() throws IORuntimeException {
final List<String> currentFields = new ArrayList<>(maxFieldCount > 0 ? maxFieldCount : DEFAULT_ROW_CAPACITY);
final StrBuilder localCurrentField = currentField;
final char[] localBuf = this.buf;
int localBufPos = bufPos;//当前位置
int localPreChar = preChar;//前一个特殊分界字符
int localCopyStart = copyStart;//拷贝起始位置
int copyLen = 0; //拷贝长度
while (true) {
if (bufLen == localBufPos) {
// 此Buffer读取结束,开始读取下一段
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
try {
bufLen = reader.read(localBuf);
} catch (IOException e) {
throw new IORuntimeException(e);
}
if (bufLen < 0) {
// CSV读取结束
finished = true;
if (localPreChar == config.fieldSeparator || localCurrentField.hasContent()) {
//剩余部分作为一个字段
currentFields.add(localCurrentField.toStringAndReset());
}
break;
}
//重置
localCopyStart = localBufPos = copyLen = 0;
}
final char c = localBuf[localBufPos++];
if (inQuotes) {
//引号内,做为内容,直到引号结束
if (c == config.textDelimiter) {
// End of quoted text
inQuotes = false;
} else {
if ((c == CharUtil.CR || c == CharUtil.LF) && localPreChar != CharUtil.CR) {
lineNo++;
}
}
copyLen++;
} else {
if (c == config.fieldSeparator) {
//一个字段结束
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
copyLen = 0;
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localCopyStart = localBufPos;
} else if (c == config.textDelimiter) {
// 引号开始
inQuotes = true;
copyLen++;
} else if (c == CharUtil.CR) {
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localPreChar = c;
localCopyStart = localBufPos;
break;
} else if (c == CharUtil.LF) {
if (localPreChar != CharUtil.CR) {
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localPreChar = c;
localCopyStart = localBufPos;
break;
}
localCopyStart = localBufPos;
} else {
copyLen++;
}
}
localPreChar = c;
}
// restore fields
bufPos = localBufPos;
preChar = localPreChar;
copyStart = localCopyStart;
return currentFields;
} | java | private List<String> readLine() throws IORuntimeException {
final List<String> currentFields = new ArrayList<>(maxFieldCount > 0 ? maxFieldCount : DEFAULT_ROW_CAPACITY);
final StrBuilder localCurrentField = currentField;
final char[] localBuf = this.buf;
int localBufPos = bufPos;//当前位置
int localPreChar = preChar;//前一个特殊分界字符
int localCopyStart = copyStart;//拷贝起始位置
int copyLen = 0; //拷贝长度
while (true) {
if (bufLen == localBufPos) {
// 此Buffer读取结束,开始读取下一段
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
try {
bufLen = reader.read(localBuf);
} catch (IOException e) {
throw new IORuntimeException(e);
}
if (bufLen < 0) {
// CSV读取结束
finished = true;
if (localPreChar == config.fieldSeparator || localCurrentField.hasContent()) {
//剩余部分作为一个字段
currentFields.add(localCurrentField.toStringAndReset());
}
break;
}
//重置
localCopyStart = localBufPos = copyLen = 0;
}
final char c = localBuf[localBufPos++];
if (inQuotes) {
//引号内,做为内容,直到引号结束
if (c == config.textDelimiter) {
// End of quoted text
inQuotes = false;
} else {
if ((c == CharUtil.CR || c == CharUtil.LF) && localPreChar != CharUtil.CR) {
lineNo++;
}
}
copyLen++;
} else {
if (c == config.fieldSeparator) {
//一个字段结束
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
copyLen = 0;
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localCopyStart = localBufPos;
} else if (c == config.textDelimiter) {
// 引号开始
inQuotes = true;
copyLen++;
} else if (c == CharUtil.CR) {
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localPreChar = c;
localCopyStart = localBufPos;
break;
} else if (c == CharUtil.LF) {
if (localPreChar != CharUtil.CR) {
if (copyLen > 0) {
localCurrentField.append(localBuf, localCopyStart, copyLen);
}
currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
localPreChar = c;
localCopyStart = localBufPos;
break;
}
localCopyStart = localBufPos;
} else {
copyLen++;
}
}
localPreChar = c;
}
// restore fields
bufPos = localBufPos;
preChar = localPreChar;
copyStart = localCopyStart;
return currentFields;
} | [
"private",
"List",
"<",
"String",
">",
"readLine",
"(",
")",
"throws",
"IORuntimeException",
"{",
"final",
"List",
"<",
"String",
">",
"currentFields",
"=",
"new",
"ArrayList",
"<>",
"(",
"maxFieldCount",
">",
"0",
"?",
"maxFieldCount",
":",
"DEFAULT_ROW_CAPAC... | 读取一行数据
@return 一行数据
@throws IORuntimeException IO异常 | [
"读取一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java#L161-L258 | train | Read a line from the input stream. | [
30522,
2797,
2862,
1026,
5164,
1028,
3191,
4179,
1006,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2345,
2862,
1026,
5164,
1028,
2783,
15155,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
4098,
3790,
3597,
16671,
1028,
1014,
1029,
4098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getPrintWriter | public static PrintWriter getPrintWriter(String path, String charset, boolean isAppend) throws IORuntimeException {
return new PrintWriter(getWriter(path, charset, isAppend));
} | java | public static PrintWriter getPrintWriter(String path, String charset, boolean isAppend) throws IORuntimeException {
return new PrintWriter(getWriter(path, charset, isAppend));
} | [
"public",
"static",
"PrintWriter",
"getPrintWriter",
"(",
"String",
"path",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"new",
"PrintWriter",
"(",
"getWriter",
"(",
"path",
",",
"charset",
",",
"isApp... | 获得一个打印写入对象,可以有print
@param path 输出路径,绝对路径
@param charset 字符集
@param isAppend 是否追加
@return 打印对象
@throws IORuntimeException IO异常 | [
"获得一个打印写入对象,可以有print"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2637-L2639 | train | Get a PrintWriter for a file. | [
30522,
2270,
10763,
6140,
15994,
2131,
16550,
15994,
1006,
5164,
4130,
1010,
5164,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
2047,
6140,
15994,
1006,
2131,
15994,
1006,
41... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java | SuffixDictionary.endsWith | public boolean endsWith(String word)
{
word = reverse(word);
return trie.commonPrefixSearchWithValue(word).size() > 0;
} | java | public boolean endsWith(String word)
{
word = reverse(word);
return trie.commonPrefixSearchWithValue(word).size() > 0;
} | [
"public",
"boolean",
"endsWith",
"(",
"String",
"word",
")",
"{",
"word",
"=",
"reverse",
"(",
"word",
")",
";",
"return",
"trie",
".",
"commonPrefixSearchWithValue",
"(",
"word",
")",
".",
"size",
"(",
")",
">",
"0",
";",
"}"
] | 词语是否以该词典中的某个单词结尾
@param word
@return | [
"词语是否以该词典中的某个单词结尾"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java#L76-L80 | train | Returns true if the sequence contains the word. | [
30522,
2270,
22017,
20898,
4515,
24415,
1006,
5164,
2773,
1007,
1063,
2773,
1027,
7901,
1006,
2773,
1007,
1025,
2709,
13012,
2063,
1012,
2691,
28139,
8873,
2595,
17310,
11140,
24415,
10175,
5657,
1006,
2773,
1007,
1012,
2946,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | config/src/main/java/com/networknt/config/ConfigInjection.java | ConfigInjection.getValue | private static Object getValue(String content) {
InjectionPattern injectionPattern = getInjectionPattern(content);
Object value = null;
if (injectionPattern != null) {
// Use key of injectionPattern to get value from both environment variables and "values.yaml"
Object envValue = typeCast(System.getenv(injectionPattern.getKey()));
Map<String, Object> valueMap = Config.getInstance().getJsonMapConfig(CENTRALIZED_MANAGEMENT);
Object fileValue = (valueMap != null) ? valueMap.get(injectionPattern.getKey()) : null;
// Return different value from different sources based on injection order defined before
if ((INJECTION_ORDER_CODE.equals("2") && envValue != null) || (INJECTION_ORDER_CODE.equals("1") && fileValue == null)) {
value = envValue;
} else {
value = fileValue;
}
// Return default value when no matched value found from environment variables and "values.yaml"
if (value == null || value.equals("")) {
value = typeCast(injectionPattern.getDefaultValue());
// Throw exception when error text provided
if (value == null || value.equals("")) {
String error_text = injectionPattern.getErrorText();
if (error_text != null && !error_text.equals("")) {
throw new ConfigException(error_text);
}
}
}
// Throw exception when no parsing result found
if (value == null && valueMap != null && !valueMap.containsKey(injectionPattern.getKey())) {
throw new ConfigException("\"${" + content + "}\" appears in config file cannot be expanded");
}
}
return value;
} | java | private static Object getValue(String content) {
InjectionPattern injectionPattern = getInjectionPattern(content);
Object value = null;
if (injectionPattern != null) {
// Use key of injectionPattern to get value from both environment variables and "values.yaml"
Object envValue = typeCast(System.getenv(injectionPattern.getKey()));
Map<String, Object> valueMap = Config.getInstance().getJsonMapConfig(CENTRALIZED_MANAGEMENT);
Object fileValue = (valueMap != null) ? valueMap.get(injectionPattern.getKey()) : null;
// Return different value from different sources based on injection order defined before
if ((INJECTION_ORDER_CODE.equals("2") && envValue != null) || (INJECTION_ORDER_CODE.equals("1") && fileValue == null)) {
value = envValue;
} else {
value = fileValue;
}
// Return default value when no matched value found from environment variables and "values.yaml"
if (value == null || value.equals("")) {
value = typeCast(injectionPattern.getDefaultValue());
// Throw exception when error text provided
if (value == null || value.equals("")) {
String error_text = injectionPattern.getErrorText();
if (error_text != null && !error_text.equals("")) {
throw new ConfigException(error_text);
}
}
}
// Throw exception when no parsing result found
if (value == null && valueMap != null && !valueMap.containsKey(injectionPattern.getKey())) {
throw new ConfigException("\"${" + content + "}\" appears in config file cannot be expanded");
}
}
return value;
} | [
"private",
"static",
"Object",
"getValue",
"(",
"String",
"content",
")",
"{",
"InjectionPattern",
"injectionPattern",
"=",
"getInjectionPattern",
"(",
"content",
")",
";",
"Object",
"value",
"=",
"null",
";",
"if",
"(",
"injectionPattern",
"!=",
"null",
")",
... | Method used to parse the content inside pattern "${}" | [
"Method",
"used",
"to",
"parse",
"the",
"content",
"inside",
"pattern",
"$",
"{}"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/ConfigInjection.java#L87-L118 | train | Get value from content | [
30522,
2797,
10763,
4874,
2131,
10175,
5657,
1006,
5164,
4180,
1007,
1063,
13341,
4502,
12079,
2078,
13341,
4502,
12079,
2078,
1027,
2131,
2378,
20614,
3258,
4502,
12079,
2078,
1006,
4180,
1007,
1025,
4874,
3643,
1027,
19701,
1025,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/WrappingProxyUtil.java | WrappingProxyUtil.stripProxy | @SuppressWarnings("unchecked")
public static <T> T stripProxy(@Nullable final WrappingProxy<T> wrappingProxy) {
if (wrappingProxy == null) {
return null;
}
T delegate = wrappingProxy.getWrappedDelegate();
int numProxiesStripped = 0;
while (delegate instanceof WrappingProxy) {
throwIfSafetyNetExceeded(++numProxiesStripped);
delegate = ((WrappingProxy<T>) delegate).getWrappedDelegate();
}
return delegate;
} | java | @SuppressWarnings("unchecked")
public static <T> T stripProxy(@Nullable final WrappingProxy<T> wrappingProxy) {
if (wrappingProxy == null) {
return null;
}
T delegate = wrappingProxy.getWrappedDelegate();
int numProxiesStripped = 0;
while (delegate instanceof WrappingProxy) {
throwIfSafetyNetExceeded(++numProxiesStripped);
delegate = ((WrappingProxy<T>) delegate).getWrappedDelegate();
}
return delegate;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"stripProxy",
"(",
"@",
"Nullable",
"final",
"WrappingProxy",
"<",
"T",
">",
"wrappingProxy",
")",
"{",
"if",
"(",
"wrappingProxy",
"==",
"null",
")",
"{",
"return"... | Expects a proxy, and returns the unproxied delegate.
@param wrappingProxy The initial proxy.
@param <T> The type of the delegate. Note that all proxies in the chain must be assignable to T.
@return The unproxied delegate. | [
"Expects",
"a",
"proxy",
"and",
"returns",
"the",
"unproxied",
"delegate",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/WrappingProxyUtil.java#L48-L63 | train | Strip a wrapping proxy. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
6167,
21572,
18037,
1006,
1030,
19701,
3085,
2345,
12252,
21572,
18037,
1026,
1056,
1028,
12252,
21572,
18037,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.hexDump | public static String hexDump(ByteBuf buffer, int fromIndex, int length) {
return HexUtil.hexDump(buffer, fromIndex, length);
} | java | public static String hexDump(ByteBuf buffer, int fromIndex, int length) {
return HexUtil.hexDump(buffer, fromIndex, length);
} | [
"public",
"static",
"String",
"hexDump",
"(",
"ByteBuf",
"buffer",
",",
"int",
"fromIndex",
",",
"int",
"length",
")",
"{",
"return",
"HexUtil",
".",
"hexDump",
"(",
"buffer",
",",
"fromIndex",
",",
"length",
")",
";",
"}"
] | Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
of the specified buffer's sub-region. | [
"Returns",
"a",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Hex_dump",
">",
"hex",
"dump<",
"/",
"a",
">",
"of",
"the",
"specified",
"buffer",
"s",
"sub",
"-",
"region",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L121-L123 | train | Hex dump of a byte buffer. | [
30522,
2270,
10763,
5164,
2002,
2595,
8566,
8737,
1006,
24880,
8569,
2546,
17698,
1010,
20014,
2013,
22254,
10288,
1010,
20014,
3091,
1007,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
2002,
2595,
8566,
8737,
1006,
17698,
1010,
2013,
22254,
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/operators/sort/UnilateralSortMerger.java | UnilateralSortMerger.startThreads | protected void startThreads() {
if (this.readThread != null) {
this.readThread.start();
}
if (this.sortThread != null) {
this.sortThread.start();
}
if (this.spillThread != null) {
this.spillThread.start();
}
} | java | protected void startThreads() {
if (this.readThread != null) {
this.readThread.start();
}
if (this.sortThread != null) {
this.sortThread.start();
}
if (this.spillThread != null) {
this.spillThread.start();
}
} | [
"protected",
"void",
"startThreads",
"(",
")",
"{",
"if",
"(",
"this",
".",
"readThread",
"!=",
"null",
")",
"{",
"this",
".",
"readThread",
".",
"start",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"sortThread",
"!=",
"null",
")",
"{",
"this",
"."... | Starts all the threads that are used by this sort-merger. | [
"Starts",
"all",
"the",
"threads",
"that",
"are",
"used",
"by",
"this",
"sort",
"-",
"merger",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java#L434-L444 | train | Start the threads. | [
30522,
5123,
11675,
2707,
2705,
16416,
5104,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
3191,
2705,
16416,
2094,
999,
1027,
30524,
16416,
2094,
999,
1027,
19701,
1007,
1063,
2023,
1012,
4066,
2705,
16416,
2094,
1012,
2707,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/Environment.java | Environment.parse | public static Environment parse(String content) throws IOException {
try {
return new ConfigUtil.LowerCaseYamlMapper().readValue(content, Environment.class);
} catch (JsonMappingException e) {
throw new SqlClientException("Could not parse environment file. Cause: " + e.getMessage());
}
} | java | public static Environment parse(String content) throws IOException {
try {
return new ConfigUtil.LowerCaseYamlMapper().readValue(content, Environment.class);
} catch (JsonMappingException e) {
throw new SqlClientException("Could not parse environment file. Cause: " + e.getMessage());
}
} | [
"public",
"static",
"Environment",
"parse",
"(",
"String",
"content",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"new",
"ConfigUtil",
".",
"LowerCaseYamlMapper",
"(",
")",
".",
"readValue",
"(",
"content",
",",
"Environment",
".",
"class",
")",
... | Parses an environment file from an String. | [
"Parses",
"an",
"environment",
"file",
"from",
"an",
"String",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/Environment.java#L153-L159 | train | Parses the environment from the given content. | [
30522,
2270,
10763,
4044,
11968,
3366,
1006,
5164,
4180,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
2709,
2047,
9530,
8873,
27920,
4014,
1012,
2896,
18382,
14852,
19145,
18620,
1006,
1007,
1012,
3191,
10175,
5657,
1006,
4180,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/api/CronSchedule.java | CronSchedule.dailyAtHourAndMinute | public static CronSchedule dailyAtHourAndMinute(int hour, int minute) {
String expression = String.format("0 %d %d ? * *", minute, hour);
return of(expression);
} | java | public static CronSchedule dailyAtHourAndMinute(int hour, int minute) {
String expression = String.format("0 %d %d ? * *", minute, hour);
return of(expression);
} | [
"public",
"static",
"CronSchedule",
"dailyAtHourAndMinute",
"(",
"int",
"hour",
",",
"int",
"minute",
")",
"{",
"String",
"expression",
"=",
"String",
".",
"format",
"(",
"\"0 %d %d ? * *\"",
",",
"minute",
",",
"hour",
")",
";",
"return",
"of",
"(",
"expres... | Creates cron expression which schedule task execution
every day at the given time
@param hour of schedule
@param minute of schedule
@return object
@throws IllegalArgumentException
wrapping a ParseException if the expression is invalid | [
"Creates",
"cron",
"expression",
"which",
"schedule",
"task",
"execution",
"every",
"day",
"at",
"the",
"given",
"time"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/CronSchedule.java#L60-L63 | train | Create a CronSchedule for a single day at a given hour and minute. | [
30522,
2270,
10763,
13675,
5644,
7690,
9307,
3679,
8988,
8162,
5685,
10020,
10421,
1006,
20014,
3178,
1010,
20014,
3371,
1007,
1063,
5164,
3670,
1027,
5164,
1012,
4289,
1006,
1000,
1014,
1003,
1040,
1003,
1040,
1029,
1008,
1008,
1000,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/swing/RobotUtil.java | RobotUtil.keyPressWithShift | public static void keyPressWithShift(int key) {
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(key);
robot.keyRelease(key);
robot.keyRelease(KeyEvent.VK_SHIFT);
delay();
} | java | public static void keyPressWithShift(int key) {
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(key);
robot.keyRelease(key);
robot.keyRelease(KeyEvent.VK_SHIFT);
delay();
} | [
"public",
"static",
"void",
"keyPressWithShift",
"(",
"int",
"key",
")",
"{",
"robot",
".",
"keyPress",
"(",
"KeyEvent",
".",
"VK_SHIFT",
")",
";",
"robot",
".",
"keyPress",
"(",
"key",
")",
";",
"robot",
".",
"keyRelease",
"(",
"key",
")",
";",
"robot... | shift+ 按键
@param key 按键 | [
"shift",
"+",
"按键"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/RobotUtil.java#L122-L128 | train | Shortcut method for pressing a key with shift. | [
30522,
2270,
10763,
11675,
3145,
20110,
24415,
6182,
6199,
1006,
20014,
3145,
1007,
1063,
8957,
1012,
3145,
20110,
1006,
3145,
18697,
3372,
1012,
1058,
2243,
1035,
5670,
1007,
1025,
8957,
1012,
3145,
20110,
1006,
3145,
1007,
1025,
8957,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java | NestedSerializersSnapshotDelegate.writeNestedSerializerSnapshots | public final void writeNestedSerializerSnapshots(DataOutputView out) throws IOException {
out.writeInt(MAGIC_NUMBER);
out.writeInt(VERSION);
out.writeInt(nestedSnapshots.length);
for (TypeSerializerSnapshot<?> snap : nestedSnapshots) {
TypeSerializerSnapshot.writeVersionedSnapshot(out, snap);
}
} | java | public final void writeNestedSerializerSnapshots(DataOutputView out) throws IOException {
out.writeInt(MAGIC_NUMBER);
out.writeInt(VERSION);
out.writeInt(nestedSnapshots.length);
for (TypeSerializerSnapshot<?> snap : nestedSnapshots) {
TypeSerializerSnapshot.writeVersionedSnapshot(out, snap);
}
} | [
"public",
"final",
"void",
"writeNestedSerializerSnapshots",
"(",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"MAGIC_NUMBER",
")",
";",
"out",
".",
"writeInt",
"(",
"VERSION",
")",
";",
"out",
".",
"writeInt",
"(",
... | Writes the composite snapshot of all the contained serializers. | [
"Writes",
"the",
"composite",
"snapshot",
"of",
"all",
"the",
"contained",
"serializers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java#L153-L161 | train | Writes the nested serializer snapshots. | [
30522,
2270,
2345,
11675,
4339,
5267,
3064,
8043,
4818,
17629,
2015,
2532,
4523,
12326,
2015,
1006,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
18447,
1006,
3894,
1035,
2193,
1007,
1025,
2041,
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-aop/src/main/java/cn/hutool/aop/ProxyUtil.java | ProxyUtil.proxy | public static <T> T proxy(T target, Aspect aspect){
return ProxyFactory.createProxy(target, aspect);
} | java | public static <T> T proxy(T target, Aspect aspect){
return ProxyFactory.createProxy(target, aspect);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"proxy",
"(",
"T",
"target",
",",
"Aspect",
"aspect",
")",
"{",
"return",
"ProxyFactory",
".",
"createProxy",
"(",
"target",
",",
"aspect",
")",
";",
"}"
] | 使用切面代理对象
@param <T> 被代理对象类型
@param aspect 切面对象
@return 代理对象 | [
"使用切面代理对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java#L36-L38 | train | Creates a proxy object that implements the interface for the given target object and aspect. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
24540,
1006,
1056,
4539,
1010,
7814,
7814,
1007,
1063,
2709,
24540,
21450,
1012,
3443,
21572,
18037,
1006,
4539,
1010,
7814,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/WordNet.java | WordNet.push | public void push(int line, Vertex vertex)
{
Iterator<Vertex> iterator = vertexes[line].iterator();
while (iterator.hasNext())
{
if (iterator.next().realWord.length() == vertex.realWord.length())
{
iterator.remove();
--size;
break;
}
}
vertexes[line].add(vertex);
++size;
} | java | public void push(int line, Vertex vertex)
{
Iterator<Vertex> iterator = vertexes[line].iterator();
while (iterator.hasNext())
{
if (iterator.next().realWord.length() == vertex.realWord.length())
{
iterator.remove();
--size;
break;
}
}
vertexes[line].add(vertex);
++size;
} | [
"public",
"void",
"push",
"(",
"int",
"line",
",",
"Vertex",
"vertex",
")",
"{",
"Iterator",
"<",
"Vertex",
">",
"iterator",
"=",
"vertexes",
"[",
"line",
"]",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
... | 强行添加,替换已有的顶点
@param line
@param vertex | [
"强行添加,替换已有的顶点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/WordNet.java#L118-L132 | train | Push a new CRS element to the stack. | [
30522,
2270,
11675,
5245,
1006,
20014,
2240,
1010,
19449,
19449,
1007,
1063,
2009,
6906,
4263,
1026,
19449,
1028,
2009,
6906,
4263,
1027,
19449,
2229,
1031,
2240,
1033,
1012,
2009,
6906,
4263,
1006,
1007,
1025,
2096,
1006,
2009,
6906,
4263,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java | FileInputFormat.addFilesInDir | private long addFilesInDir(Path path, List<FileStatus> files, boolean logExcludedFiles)
throws IOException {
final FileSystem fs = path.getFileSystem();
long length = 0;
for(FileStatus dir: fs.listStatus(path)) {
if (dir.isDir()) {
if (acceptFile(dir) && enumerateNestedFiles) {
length += addFilesInDir(dir.getPath(), files, logExcludedFiles);
} else {
if (logExcludedFiles && LOG.isDebugEnabled()) {
LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
}
}
}
else {
if(acceptFile(dir)) {
files.add(dir);
length += dir.getLen();
testForUnsplittable(dir);
} else {
if (logExcludedFiles && LOG.isDebugEnabled()) {
LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
}
}
}
}
return length;
} | java | private long addFilesInDir(Path path, List<FileStatus> files, boolean logExcludedFiles)
throws IOException {
final FileSystem fs = path.getFileSystem();
long length = 0;
for(FileStatus dir: fs.listStatus(path)) {
if (dir.isDir()) {
if (acceptFile(dir) && enumerateNestedFiles) {
length += addFilesInDir(dir.getPath(), files, logExcludedFiles);
} else {
if (logExcludedFiles && LOG.isDebugEnabled()) {
LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
}
}
}
else {
if(acceptFile(dir)) {
files.add(dir);
length += dir.getLen();
testForUnsplittable(dir);
} else {
if (logExcludedFiles && LOG.isDebugEnabled()) {
LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
}
}
}
}
return length;
} | [
"private",
"long",
"addFilesInDir",
"(",
"Path",
"path",
",",
"List",
"<",
"FileStatus",
">",
"files",
",",
"boolean",
"logExcludedFiles",
")",
"throws",
"IOException",
"{",
"final",
"FileSystem",
"fs",
"=",
"path",
".",
"getFileSystem",
"(",
")",
";",
"long... | Enumerate all files in the directory and recursive if enumerateNestedFiles is true.
@return the total length of accepted files. | [
"Enumerate",
"all",
"files",
"in",
"the",
"directory",
"and",
"recursive",
"if",
"enumerateNestedFiles",
"is",
"true",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L701-L730 | train | Add files in a directory. | [
30522,
2797,
2146,
5587,
8873,
4244,
22254,
4313,
1006,
4130,
4130,
1010,
2862,
1026,
6764,
29336,
2271,
1028,
6764,
1010,
22017,
20898,
8833,
10288,
20464,
13936,
8873,
4244,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
6764,
27268,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java | MysqlEventParser.findTransactionBeginPosition | private Long findTransactionBeginPosition(ErosaConnection mysqlConnection, final EntryPosition entryPosition)
throws IOException {
// 针对开始的第一条为非Begin记录,需要从该binlog扫描
final java.util.concurrent.atomic.AtomicLong preTransactionStartPosition = new java.util.concurrent.atomic.AtomicLong(0L);
mysqlConnection.reconnect();
mysqlConnection.seek(entryPosition.getJournalName(), 4L, entryPosition.getGtid(), new SinkFunction<LogEvent>() {
private LogPosition lastPosition;
public boolean sink(LogEvent event) {
try {
CanalEntry.Entry entry = parseAndProfilingIfNecessary(event, true);
if (entry == null) {
return true;
}
// 直接查询第一条业务数据,确认是否为事务Begin
// 记录一下transaction begin position
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
&& entry.getHeader().getLogfileOffset() < entryPosition.getPosition()) {
preTransactionStartPosition.set(entry.getHeader().getLogfileOffset());
}
if (entry.getHeader().getLogfileOffset() >= entryPosition.getPosition()) {
return false;// 退出
}
lastPosition = buildLastPosition(entry);
} catch (Exception e) {
processSinkError(e, lastPosition, entryPosition.getJournalName(), entryPosition.getPosition());
return false;
}
return running;
}
});
// 判断一下找到的最接近position的事务头的位置
if (preTransactionStartPosition.get() > entryPosition.getPosition()) {
logger.error("preTransactionEndPosition greater than startPosition from zk or localconf, maybe lost data");
throw new CanalParseException("preTransactionStartPosition greater than startPosition from zk or localconf, maybe lost data");
}
return preTransactionStartPosition.get();
} | java | private Long findTransactionBeginPosition(ErosaConnection mysqlConnection, final EntryPosition entryPosition)
throws IOException {
// 针对开始的第一条为非Begin记录,需要从该binlog扫描
final java.util.concurrent.atomic.AtomicLong preTransactionStartPosition = new java.util.concurrent.atomic.AtomicLong(0L);
mysqlConnection.reconnect();
mysqlConnection.seek(entryPosition.getJournalName(), 4L, entryPosition.getGtid(), new SinkFunction<LogEvent>() {
private LogPosition lastPosition;
public boolean sink(LogEvent event) {
try {
CanalEntry.Entry entry = parseAndProfilingIfNecessary(event, true);
if (entry == null) {
return true;
}
// 直接查询第一条业务数据,确认是否为事务Begin
// 记录一下transaction begin position
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
&& entry.getHeader().getLogfileOffset() < entryPosition.getPosition()) {
preTransactionStartPosition.set(entry.getHeader().getLogfileOffset());
}
if (entry.getHeader().getLogfileOffset() >= entryPosition.getPosition()) {
return false;// 退出
}
lastPosition = buildLastPosition(entry);
} catch (Exception e) {
processSinkError(e, lastPosition, entryPosition.getJournalName(), entryPosition.getPosition());
return false;
}
return running;
}
});
// 判断一下找到的最接近position的事务头的位置
if (preTransactionStartPosition.get() > entryPosition.getPosition()) {
logger.error("preTransactionEndPosition greater than startPosition from zk or localconf, maybe lost data");
throw new CanalParseException("preTransactionStartPosition greater than startPosition from zk or localconf, maybe lost data");
}
return preTransactionStartPosition.get();
} | [
"private",
"Long",
"findTransactionBeginPosition",
"(",
"ErosaConnection",
"mysqlConnection",
",",
"final",
"EntryPosition",
"entryPosition",
")",
"throws",
"IOException",
"{",
"// 针对开始的第一条为非Begin记录,需要从该binlog扫描",
"final",
"java",
".",
"util",
".",
"concurrent",
".",
"ato... | 主要考虑一个事务执行时间可能会几秒种,如果仅仅按照timestamp相同,则可能会丢失事务的前半部分数据 | [
"主要考虑一个事务执行时间可能会几秒种,如果仅仅按照timestamp相同,则可能会丢失事务的前半部分数据"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L525-L568 | train | Find transaction begin position. | [
30522,
2797,
2146,
2424,
30524,
100,
100,
100,
100,
8026,
21197,
100,
100,
2345,
9262,
1012,
21183,
4014,
1012,
16483,
1012,
9593,
1012,
9593,
10052,
3653,
6494,
3619,
18908,
8496,
7559,
25856,
19234,
1027,
2047,
9262,
1012,
21183,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.isUrl | public static boolean isUrl(CharSequence value) {
try {
new java.net.URL(StrUtil.str(value));
} catch (MalformedURLException e) {
return false;
}
return true;
} | java | public static boolean isUrl(CharSequence value) {
try {
new java.net.URL(StrUtil.str(value));
} catch (MalformedURLException e) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isUrl",
"(",
"CharSequence",
"value",
")",
"{",
"try",
"{",
"new",
"java",
".",
"net",
".",
"URL",
"(",
"StrUtil",
".",
"str",
"(",
"value",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"re... | 验证是否为URL
@param value 值
@return 是否为URL | [
"验证是否为URL"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L904-L911 | train | Checks if the specified char sequence is a valid URL. | [
30522,
2270,
10763,
22017,
20898,
2003,
3126,
2140,
1006,
25869,
3366,
4226,
5897,
3643,
1007,
1063,
3046,
1063,
2047,
9262,
1012,
5658,
30524,
1006,
3643,
1007,
1007,
1025,
1065,
4608,
1006,
15451,
29021,
3126,
2571,
2595,
24422,
1041,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java | ExcelSaxUtil.formatCellContent | public static String formatCellContent(String value, int numFmtIndex, String numFmtString) {
if (null != numFmtString) {
try {
value = new DataFormatter().formatRawCellContents(Double.parseDouble(value), numFmtIndex, numFmtString);
} catch (NumberFormatException e) {
// ignore
}
}
return value;
} | java | public static String formatCellContent(String value, int numFmtIndex, String numFmtString) {
if (null != numFmtString) {
try {
value = new DataFormatter().formatRawCellContents(Double.parseDouble(value), numFmtIndex, numFmtString);
} catch (NumberFormatException e) {
// ignore
}
}
return value;
} | [
"public",
"static",
"String",
"formatCellContent",
"(",
"String",
"value",
",",
"int",
"numFmtIndex",
",",
"String",
"numFmtString",
")",
"{",
"if",
"(",
"null",
"!=",
"numFmtString",
")",
"{",
"try",
"{",
"value",
"=",
"new",
"DataFormatter",
"(",
")",
".... | 格式化数字或日期值
@param value 值
@param numFmtIndex 数字格式索引
@param numFmtString 数字格式名
@return 格式化后的值 | [
"格式化数字或日期值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L85-L94 | train | Format a cell value. | [
30522,
2270,
10763,
5164,
4289,
29109,
22499,
10111,
3372,
1006,
5164,
3643,
1010,
20014,
16371,
2213,
16715,
7629,
3207,
2595,
1010,
5164,
16371,
2213,
16715,
3215,
18886,
3070,
1007,
1063,
2065,
1006,
19701,
30524,
11968,
6924,
7140,
3468,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java | TypeSerializerSerializationUtil.tryReadSerializer | public static <T> TypeSerializer<T> tryReadSerializer(
DataInputView in,
ClassLoader userCodeClassLoader,
boolean useDummyPlaceholder) throws IOException {
final TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<T> proxy =
new TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<>(userCodeClassLoader);
try {
proxy.read(in);
return proxy.getTypeSerializer();
} catch (UnloadableTypeSerializerException e) {
if (useDummyPlaceholder) {
LOG.warn("Could not read a requested serializer. Replaced with a UnloadableDummyTypeSerializer.", e.getCause());
return new UnloadableDummyTypeSerializer<>(e.getSerializerBytes(), e.getCause());
} else {
throw e;
}
}
} | java | public static <T> TypeSerializer<T> tryReadSerializer(
DataInputView in,
ClassLoader userCodeClassLoader,
boolean useDummyPlaceholder) throws IOException {
final TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<T> proxy =
new TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<>(userCodeClassLoader);
try {
proxy.read(in);
return proxy.getTypeSerializer();
} catch (UnloadableTypeSerializerException e) {
if (useDummyPlaceholder) {
LOG.warn("Could not read a requested serializer. Replaced with a UnloadableDummyTypeSerializer.", e.getCause());
return new UnloadableDummyTypeSerializer<>(e.getSerializerBytes(), e.getCause());
} else {
throw e;
}
}
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializer",
"<",
"T",
">",
"tryReadSerializer",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"userCodeClassLoader",
",",
"boolean",
"useDummyPlaceholder",
")",
"throws",
"IOException",
"{",
"final",
"TypeSerializerSerializat... | Reads from a data input view a {@link TypeSerializer} that was previously
written using {@link #writeSerializer(DataOutputView, TypeSerializer)}.
<p>If deserialization fails due to any exception, users can opt to use a dummy
{@link UnloadableDummyTypeSerializer} to hold the serializer bytes, otherwise an {@link IOException} is thrown.
@param in the data input view.
@param userCodeClassLoader the user code class loader to use.
@param useDummyPlaceholder whether or not to use a dummy {@link UnloadableDummyTypeSerializer} to hold the
serializer bytes in the case of a {@link ClassNotFoundException} or
{@link InvalidClassException}.
@param <T> Data type of the serializer.
@return the deserialized serializer. | [
"Reads",
"from",
"a",
"data",
"input",
"view",
"a",
"{",
"@link",
"TypeSerializer",
"}",
"that",
"was",
"previously",
"written",
"using",
"{",
"@link",
"#writeSerializer",
"(",
"DataOutputView",
"TypeSerializer",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java#L107-L126 | train | Try to read a serializer from the given input view. | [
30522,
2270,
10763,
1026,
1056,
1028,
4127,
11610,
28863,
1026,
1056,
1028,
3046,
16416,
5104,
11610,
28863,
1006,
2951,
2378,
18780,
8584,
1999,
1010,
2465,
11066,
2121,
5310,
16044,
26266,
11066,
2121,
1010,
22017,
20898,
2109,
2819,
8029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java | StatementExecutor.executeUpdate | public int executeUpdate() throws SQLException {
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | java | public int executeUpdate() throws SQLException {
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | [
"public",
"int",
"executeUpdate",
"(",
")",
"throws",
"SQLException",
"{",
"return",
"executeUpdate",
"(",
"new",
"Updater",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"executeUpdate",
"(",
"final",
"Statement",
"statement",
",",
"final",
"String",
"sql"... | Execute update.
@return effected records count
@throws SQLException SQL exception | [
"Execute",
"update",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L116-L124 | train | Execute an SQL update. | [
30522,
2270,
20014,
15389,
6279,
13701,
1006,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
15389,
6279,
13701,
1006,
2047,
10651,
2099,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
20014,
15389,
6279,
13701,
1006,
2345,
4861,
4861,
1010,
2345,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.mainName | public static String mainName(String fileName) {
if (null == fileName) {
return fileName;
}
int len = fileName.length();
if (0 == len) {
return fileName;
}
if (CharUtil.isFileSeparator(fileName.charAt(len - 1))) {
len--;
}
int begin = 0;
int end = len;
char c;
for (int i = len - 1; i > -1; i--) {
c = fileName.charAt(i);
if (len == end && CharUtil.DOT == c) {
// 查找最后一个文件名和扩展名的分隔符:.
end = i;
}
if (0 == begin || begin > end) {
if (CharUtil.isFileSeparator(c)) {
// 查找最后一个路径分隔符(/或者\),如果这个分隔符在.之后,则继续查找,否则结束
begin = i + 1;
break;
}
}
}
return fileName.substring(begin, end);
} | java | public static String mainName(String fileName) {
if (null == fileName) {
return fileName;
}
int len = fileName.length();
if (0 == len) {
return fileName;
}
if (CharUtil.isFileSeparator(fileName.charAt(len - 1))) {
len--;
}
int begin = 0;
int end = len;
char c;
for (int i = len - 1; i > -1; i--) {
c = fileName.charAt(i);
if (len == end && CharUtil.DOT == c) {
// 查找最后一个文件名和扩展名的分隔符:.
end = i;
}
if (0 == begin || begin > end) {
if (CharUtil.isFileSeparator(c)) {
// 查找最后一个路径分隔符(/或者\),如果这个分隔符在.之后,则继续查找,否则结束
begin = i + 1;
break;
}
}
}
return fileName.substring(begin, end);
} | [
"public",
"static",
"String",
"mainName",
"(",
"String",
"fileName",
")",
"{",
"if",
"(",
"null",
"==",
"fileName",
")",
"{",
"return",
"fileName",
";",
"}",
"int",
"len",
"=",
"fileName",
".",
"length",
"(",
")",
";",
"if",
"(",
"0",
"==",
"len",
... | 返回主文件名
@param fileName 完整文件名
@return 主文件名 | [
"返回主文件名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1767-L1798 | train | Returns the main name of the file with the specified name. | [
30522,
2270,
10763,
5164,
2364,
18442,
1006,
5164,
5371,
18442,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5371,
18442,
1007,
1063,
2709,
5371,
18442,
1025,
1065,
20014,
18798,
1027,
5371,
18442,
1012,
3091,
1006,
1007,
1025,
2065,
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-core/src/main/java/org/apache/flink/configuration/ConfigOption.java | ConfigOption.withDeprecatedKeys | public ConfigOption<T> withDeprecatedKeys(String... deprecatedKeys) {
final Stream<FallbackKey> newDeprecatedKeys = Arrays.stream(deprecatedKeys).map(FallbackKey::createDeprecatedKey);
final Stream<FallbackKey> currentAlternativeKeys = Arrays.stream(this.fallbackKeys);
// put deprecated keys last so that they are de-prioritized
final FallbackKey[] mergedAlternativeKeys = Stream.concat(currentAlternativeKeys, newDeprecatedKeys)
.toArray(FallbackKey[]::new);
return new ConfigOption<>(key, description, defaultValue, mergedAlternativeKeys);
} | java | public ConfigOption<T> withDeprecatedKeys(String... deprecatedKeys) {
final Stream<FallbackKey> newDeprecatedKeys = Arrays.stream(deprecatedKeys).map(FallbackKey::createDeprecatedKey);
final Stream<FallbackKey> currentAlternativeKeys = Arrays.stream(this.fallbackKeys);
// put deprecated keys last so that they are de-prioritized
final FallbackKey[] mergedAlternativeKeys = Stream.concat(currentAlternativeKeys, newDeprecatedKeys)
.toArray(FallbackKey[]::new);
return new ConfigOption<>(key, description, defaultValue, mergedAlternativeKeys);
} | [
"public",
"ConfigOption",
"<",
"T",
">",
"withDeprecatedKeys",
"(",
"String",
"...",
"deprecatedKeys",
")",
"{",
"final",
"Stream",
"<",
"FallbackKey",
">",
"newDeprecatedKeys",
"=",
"Arrays",
".",
"stream",
"(",
"deprecatedKeys",
")",
".",
"map",
"(",
"Fallba... | Creates a new config option, using this option's key and default value, and
adding the given deprecated keys.
<p>When obtaining a value from the configuration via {@link Configuration#getValue(ConfigOption)},
the deprecated keys will be checked in the order provided to this method. The first key for which
a value is found will be used - that value will be returned.
@param deprecatedKeys The deprecated keys, in the order in which they should be checked.
@return A new config options, with the given deprecated keys. | [
"Creates",
"a",
"new",
"config",
"option",
"using",
"this",
"option",
"s",
"key",
"and",
"default",
"value",
"and",
"adding",
"the",
"given",
"deprecated",
"keys",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/ConfigOption.java#L140-L148 | train | Returns a new config option with the given deprecated keys. | [
30522,
2270,
9530,
8873,
3995,
16790,
1026,
1056,
1028,
2007,
3207,
28139,
12921,
14839,
2015,
1006,
5164,
1012,
1012,
1012,
2139,
28139,
12921,
14839,
2015,
1007,
1063,
2345,
5460,
1026,
2991,
5963,
14839,
1028,
2047,
3207,
28139,
12921,
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/configuration/Configuration.java | Configuration.setInteger | @PublicEvolving
public void setInteger(ConfigOption<Integer> key, int value) {
setValueInternal(key.key(), value);
} | java | @PublicEvolving
public void setInteger(ConfigOption<Integer> key, int value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setInteger",
"(",
"ConfigOption",
"<",
"Integer",
">",
"key",
",",
"int",
"value",
")",
"{",
"setValueInternal",
"(",
"key",
".",
"key",
"(",
")",
",",
"value",
")",
";",
"}"
] | Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"configuration",
"object",
".",
"The",
"main",
"key",
"of",
"the",
"config",
"option",
"will",
"be",
"used",
"to",
"map",
"the",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L264-L267 | train | Sets the value associated with the given key. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
11675,
2275,
18447,
26320,
1006,
9530,
8873,
3995,
16790,
1026,
16109,
1028,
3145,
1010,
20014,
3643,
1007,
1063,
2275,
10175,
5657,
18447,
11795,
2389,
1006,
3145,
1012,
3145,
1006,
1007,
1010,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.select | public SqlBuilder select(boolean isDistinct, Collection<String> fields) {
sql.append("SELECT ");
if (isDistinct) {
sql.append("DISTINCT ");
}
if (CollectionUtil.isEmpty(fields)) {
sql.append("*");
} else {
if (null != wrapper) {
// 包装字段名
fields = wrapper.wrap(fields);
}
sql.append(CollectionUtil.join(fields, StrUtil.COMMA));
}
return this;
} | java | public SqlBuilder select(boolean isDistinct, Collection<String> fields) {
sql.append("SELECT ");
if (isDistinct) {
sql.append("DISTINCT ");
}
if (CollectionUtil.isEmpty(fields)) {
sql.append("*");
} else {
if (null != wrapper) {
// 包装字段名
fields = wrapper.wrap(fields);
}
sql.append(CollectionUtil.join(fields, StrUtil.COMMA));
}
return this;
} | [
"public",
"SqlBuilder",
"select",
"(",
"boolean",
"isDistinct",
",",
"Collection",
"<",
"String",
">",
"fields",
")",
"{",
"sql",
".",
"append",
"(",
"\"SELECT \"",
")",
";",
"if",
"(",
"isDistinct",
")",
"{",
"sql",
".",
"append",
"(",
"\"DISTINCT \"",
... | 查询
@param isDistinct 是否添加DISTINCT关键字(查询唯一结果)
@param fields 查询的字段
@return 自己 | [
"查询"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L225-L242 | train | Create a SELECT statement. | [
30522,
2270,
29296,
8569,
23891,
2099,
7276,
1006,
22017,
20898,
2003,
10521,
7629,
6593,
1010,
3074,
1026,
5164,
1028,
4249,
1007,
1063,
29296,
1012,
10439,
10497,
1006,
1000,
7276,
1000,
1007,
1025,
2065,
1006,
2003,
10521,
7629,
6593,
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/NettyUtils.java | NettyUtils.getClientChannelClass | public static Class<? extends Channel> getClientChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioSocketChannel.class;
case EPOLL:
return EpollSocketChannel.class;
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}
} | java | public static Class<? extends Channel> getClientChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioSocketChannel.class;
case EPOLL:
return EpollSocketChannel.class;
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}
} | [
"public",
"static",
"Class",
"<",
"?",
"extends",
"Channel",
">",
"getClientChannelClass",
"(",
"IOMode",
"mode",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"NIO",
":",
"return",
"NioSocketChannel",
".",
"class",
";",
"case",
"EPOLL",
":",
"return"... | Returns the correct (client) SocketChannel class based on IOMode. | [
"Returns",
"the",
"correct",
"(",
"client",
")",
"SocketChannel",
"class",
"based",
"on",
"IOMode",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L75-L84 | train | Gets the client channel class. | [
30522,
2270,
10763,
2465,
1026,
1029,
8908,
3149,
1028,
2131,
20464,
11638,
26058,
26266,
1006,
22834,
5302,
3207,
5549,
1007,
1063,
6942,
1006,
5549,
1007,
1063,
2553,
9152,
2080,
1024,
2709,
9152,
19137,
19869,
10649,
20147,
2140,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java | RowUtil.getOrCreateRow | public static Row getOrCreateRow(Sheet sheet, int rowIndex) {
Row row = sheet.getRow(rowIndex);
if (null == row) {
row = sheet.createRow(rowIndex);
}
return row;
} | java | public static Row getOrCreateRow(Sheet sheet, int rowIndex) {
Row row = sheet.getRow(rowIndex);
if (null == row) {
row = sheet.createRow(rowIndex);
}
return row;
} | [
"public",
"static",
"Row",
"getOrCreateRow",
"(",
"Sheet",
"sheet",
",",
"int",
"rowIndex",
")",
"{",
"Row",
"row",
"=",
"sheet",
".",
"getRow",
"(",
"rowIndex",
")",
";",
"if",
"(",
"null",
"==",
"row",
")",
"{",
"row",
"=",
"sheet",
".",
"createRow... | 获取已有行或创建新行
@param sheet Excel表
@param rowIndex 行号
@return {@link Row}
@since 4.0.2 | [
"获取已有行或创建新行"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java#L29-L35 | train | Gets or creates a row from a sheet. | [
30522,
2270,
10763,
5216,
2131,
2953,
16748,
24932,
5004,
1006,
7123,
7123,
1010,
20014,
5216,
22254,
10288,
1007,
1063,
5216,
5216,
1027,
7123,
1012,
2131,
10524,
1006,
5216,
22254,
10288,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
5216,
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... |
networknt/light-4j | consul/src/main/java/com/networknt/consul/ConsulUtils.java | ConsulUtils.getPathFromServiceId | public static String getPathFromServiceId(String serviceId) {
return serviceId.substring(serviceId.indexOf(":") + 1, serviceId.lastIndexOf(":"));
} | java | public static String getPathFromServiceId(String serviceId) {
return serviceId.substring(serviceId.indexOf(":") + 1, serviceId.lastIndexOf(":"));
} | [
"public",
"static",
"String",
"getPathFromServiceId",
"(",
"String",
"serviceId",
")",
"{",
"return",
"serviceId",
".",
"substring",
"(",
"serviceId",
".",
"indexOf",
"(",
"\":\"",
")",
"+",
"1",
",",
"serviceId",
".",
"lastIndexOf",
"(",
"\":\"",
")",
")",
... | get path of url from service id in consul
@param serviceId service id
@return path | [
"get",
"path",
"of",
"url",
"from",
"service",
"id",
"in",
"consul"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L139-L141 | train | Get the path from the service id. | [
30522,
2270,
10763,
5164,
2131,
15069,
19699,
22225,
2121,
7903,
7416,
2094,
1006,
5164,
2326,
3593,
1007,
1063,
2709,
2326,
3593,
1012,
4942,
3367,
4892,
1006,
2326,
3593,
1012,
5950,
11253,
1006,
1000,
1024,
1000,
1007,
1009,
1015,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.begin | public static <X> Pattern<X, X> begin(final String name) {
return new Pattern<>(name, null, ConsumingStrategy.STRICT, AfterMatchSkipStrategy.noSkip());
} | java | public static <X> Pattern<X, X> begin(final String name) {
return new Pattern<>(name, null, ConsumingStrategy.STRICT, AfterMatchSkipStrategy.noSkip());
} | [
"public",
"static",
"<",
"X",
">",
"Pattern",
"<",
"X",
",",
"X",
">",
"begin",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Pattern",
"<>",
"(",
"name",
",",
"null",
",",
"ConsumingStrategy",
".",
"STRICT",
",",
"AfterMatchSkipStrategy",
... | Starts a new pattern sequence. The provided name is the one of the initial pattern
of the new sequence. Furthermore, the base type of the event sequence is set.
@param name The name of starting pattern of the new pattern sequence
@param <X> Base type of the event pattern
@return The first pattern of a pattern sequence | [
"Starts",
"a",
"new",
"pattern",
"sequence",
".",
"The",
"provided",
"name",
"is",
"the",
"one",
"of",
"the",
"initial",
"pattern",
"of",
"the",
"new",
"sequence",
".",
"Furthermore",
"the",
"base",
"type",
"of",
"the",
"event",
"sequence",
"is",
"set",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L128-L130 | train | Creates a new pattern with a strict strict | [
30522,
2270,
10763,
1026,
1060,
1028,
5418,
1026,
1060,
1010,
1060,
1028,
4088,
1006,
2345,
5164,
2171,
1007,
1063,
2709,
2047,
5418,
1026,
1028,
1006,
2171,
1010,
19701,
1010,
15077,
20528,
2618,
6292,
1012,
9384,
1010,
2044,
18900,
18069,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TColumnDesc.java | TColumnDesc.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAME:
return isSetColumnName();
case TYPE_DESC:
return isSetTypeDesc();
case POSITION:
return isSetPosition();
case COMMENT:
return isSetComment();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAME:
return isSetColumnName();
case TYPE_DESC:
return isSetTypeDesc();
case POSITION:
return isSetPosition();
case COMMENT:
return isSetComment();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"COLUMN_NAME",
":",
"return",
"isSetCol... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TColumnDesc.java#L331-L347 | train | Checks if field is set to a value of a CRAS_CTYPE object. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
5930... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java | CepOperator.processEvent | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | java | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | [
"private",
"void",
"processEvent",
"(",
"NFAState",
"nfaState",
",",
"IN",
"event",
",",
"long",
"timestamp",
")",
"throws",
"Exception",
"{",
"try",
"(",
"SharedBufferAccessor",
"<",
"IN",
">",
"sharedBufferAccessor",
"=",
"partialMatches",
".",
"getAccessor",
... | Process the given event by giving it to the NFA and outputting the produced set of matched
event sequences.
@param nfaState Our NFAState object
@param event The current event to be processed
@param timestamp The timestamp of the event | [
"Process",
"the",
"given",
"event",
"by",
"giving",
"it",
"to",
"the",
"NFA",
"and",
"outputting",
"the",
"produced",
"set",
"of",
"matched",
"event",
"sequences",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java#L422-L428 | train | Process the event. | [
30522,
2797,
11675,
2832,
18697,
3372,
1006,
1050,
24333,
3686,
1050,
24333,
3686,
1010,
1999,
2724,
1010,
2146,
2335,
15464,
2361,
1007,
11618,
6453,
1063,
3046,
1006,
4207,
8569,
12494,
6305,
9623,
21748,
1026,
1999,
1028,
4207,
8569,
124... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java | Scheduler.getInstance | @VisibleForTesting
@Nullable
public Instance getInstance(ResourceID resourceId) {
for (Instance instance : allInstances) {
if (Objects.equals(resourceId, instance.getTaskManagerID())) {
return instance;
}
}
return null;
} | java | @VisibleForTesting
@Nullable
public Instance getInstance(ResourceID resourceId) {
for (Instance instance : allInstances) {
if (Objects.equals(resourceId, instance.getTaskManagerID())) {
return instance;
}
}
return null;
} | [
"@",
"VisibleForTesting",
"@",
"Nullable",
"public",
"Instance",
"getInstance",
"(",
"ResourceID",
"resourceId",
")",
"{",
"for",
"(",
"Instance",
"instance",
":",
"allInstances",
")",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"resourceId",
",",
"instance... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L877-L886 | train | Gets the instance with the given resource id. | [
30522,
1030,
5710,
13028,
4355,
2075,
1030,
19701,
3085,
2270,
6013,
2131,
7076,
26897,
1006,
7692,
3593,
7692,
3593,
1007,
1063,
2005,
1006,
6013,
6013,
1024,
2035,
7076,
26897,
2015,
1007,
1063,
2065,
1006,
5200,
1012,
19635,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.removeTask | public Task removeTask(ExecutionAttemptID executionAttemptID) {
checkInit();
TaskSlotMapping taskSlotMapping = taskSlotMappings.remove(executionAttemptID);
if (taskSlotMapping != null) {
Task task = taskSlotMapping.getTask();
TaskSlot taskSlot = taskSlotMapping.getTaskSlot();
taskSlot.remove(task.getExecutionId());
if (taskSlot.isReleasing() && taskSlot.isEmpty()) {
slotActions.freeSlot(taskSlot.getAllocationId());
}
return task;
} else {
return null;
}
} | java | public Task removeTask(ExecutionAttemptID executionAttemptID) {
checkInit();
TaskSlotMapping taskSlotMapping = taskSlotMappings.remove(executionAttemptID);
if (taskSlotMapping != null) {
Task task = taskSlotMapping.getTask();
TaskSlot taskSlot = taskSlotMapping.getTaskSlot();
taskSlot.remove(task.getExecutionId());
if (taskSlot.isReleasing() && taskSlot.isEmpty()) {
slotActions.freeSlot(taskSlot.getAllocationId());
}
return task;
} else {
return null;
}
} | [
"public",
"Task",
"removeTask",
"(",
"ExecutionAttemptID",
"executionAttemptID",
")",
"{",
"checkInit",
"(",
")",
";",
"TaskSlotMapping",
"taskSlotMapping",
"=",
"taskSlotMappings",
".",
"remove",
"(",
"executionAttemptID",
")",
";",
"if",
"(",
"taskSlotMapping",
"!... | Remove the task with the given execution attempt id from its task slot. If the owning task
slot is in state releasing and empty after removing the task, the slot is freed via the
slot actions.
@param executionAttemptID identifying the task to remove
@return The removed task if there is any for the given execution attempt id; otherwise null | [
"Remove",
"the",
"task",
"with",
"the",
"given",
"execution",
"attempt",
"id",
"from",
"its",
"task",
"slot",
".",
"If",
"the",
"owning",
"task",
"slot",
"is",
"in",
"state",
"releasing",
"and",
"empty",
"after",
"removing",
"the",
"task",
"the",
"slot",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L501-L520 | train | Removes a task from the task slot. | [
30522,
2270,
4708,
6366,
10230,
2243,
1006,
7781,
19321,
6633,
13876,
3593,
7781,
19321,
6633,
13876,
3593,
1007,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
8518,
10994,
2863,
14853,
8518,
10994,
2863,
14853,
1027,
8518,
10994,
2863,
14853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-api-java/src/main/java/org/apache/flink/table/api/OverWindowPartitionedOrderedPreceding.java | OverWindowPartitionedOrderedPreceding.as | public OverWindow as(Expression alias) {
return new OverWindow(alias, partitionBy, orderBy, preceding, optionalFollowing);
} | java | public OverWindow as(Expression alias) {
return new OverWindow(alias, partitionBy, orderBy, preceding, optionalFollowing);
} | [
"public",
"OverWindow",
"as",
"(",
"Expression",
"alias",
")",
"{",
"return",
"new",
"OverWindow",
"(",
"alias",
",",
"partitionBy",
",",
"orderBy",
",",
"preceding",
",",
"optionalFollowing",
")",
";",
"}"
] | Assigns an alias for this window that the following {@code select()} clause can refer to.
@param alias alias for this over window
@return the fully defined over window | [
"Assigns",
"an",
"alias",
"for",
"this",
"window",
"that",
"the",
"following",
"{",
"@code",
"select",
"()",
"}",
"clause",
"can",
"refer",
"to",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/OverWindowPartitionedOrderedPreceding.java#L64-L66 | train | Create an alias for this OverWindow. | [
30522,
2270,
2058,
11101,
5004,
2004,
1006,
3670,
14593,
1007,
1063,
2709,
2047,
2058,
11101,
5004,
1006,
14593,
1010,
13571,
3762,
1010,
2344,
3762,
1010,
11003,
1010,
11887,
14876,
7174,
9328,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java | Utils.resources | public static List<Protos.Resource> resources(Protos.Resource... resources) {
checkNotNull(resources);
return Arrays.asList(resources);
} | java | public static List<Protos.Resource> resources(Protos.Resource... resources) {
checkNotNull(resources);
return Arrays.asList(resources);
} | [
"public",
"static",
"List",
"<",
"Protos",
".",
"Resource",
">",
"resources",
"(",
"Protos",
".",
"Resource",
"...",
"resources",
")",
"{",
"checkNotNull",
"(",
"resources",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"resources",
")",
";",
"}"
] | Construct a list of resources. | [
"Construct",
"a",
"list",
"of",
"resources",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java#L93-L96 | train | Returns a list of resources. | [
30522,
2270,
10763,
2862,
1026,
15053,
2015,
1012,
7692,
1028,
4219,
1006,
15053,
2015,
1012,
7692,
1012,
1012,
1012,
4219,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
4219,
1007,
1025,
2709,
27448,
1012,
2004,
9863,
1006,
4219,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/DelegatingConfiguration.java | DelegatingConfiguration.read | @Override
public void read(DataInputView in) throws IOException {
this.prefix = in.readUTF();
this.backingConfig.read(in);
} | java | @Override
public void read(DataInputView in) throws IOException {
this.prefix = in.readUTF();
this.backingConfig.read(in);
} | [
"@",
"Override",
"public",
"void",
"read",
"(",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"this",
".",
"prefix",
"=",
"in",
".",
"readUTF",
"(",
")",
";",
"this",
".",
"backingConfig",
".",
"read",
"(",
"in",
")",
";",
"}"
] | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/DelegatingConfiguration.java#L337-L341 | train | Read the bytes of the bytes of the bytes of the bytes of the bytes. | [
30522,
1030,
2058,
15637,
2270,
11675,
3191,
1006,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
17576,
1027,
1999,
1012,
3191,
4904,
2546,
1006,
1007,
1025,
2023,
1012,
5150,
8663,
8873,
2290,
1012,
319... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.addSource | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, TypeInformation<OUT> typeInfo) {
return addSource(function, "Custom Source", typeInfo);
} | java | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, TypeInformation<OUT> typeInfo) {
return addSource(function, "Custom Source", typeInfo);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"addSource",
"(",
"SourceFunction",
"<",
"OUT",
">",
"function",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
")",
"{",
"return",
"addSource",
"(",
"function",
",",
"\"Custom Source\"",
... | Ads a data source with a custom type information thus opening a
{@link DataStream}. Only in very special cases does the user need to
support type information. Otherwise use
{@link #addSource(org.apache.flink.streaming.api.functions.source.SourceFunction)}
@param function
the user defined function
@param <OUT>
type of the returned stream
@param typeInfo
the user defined type information for the stream
@return the data stream constructed | [
"Ads",
"a",
"data",
"source",
"with",
"a",
"custom",
"type",
"information",
"thus",
"opening",
"a",
"{",
"@link",
"DataStream",
"}",
".",
"Only",
"in",
"very",
"special",
"cases",
"does",
"the",
"user",
"need",
"to",
"support",
"type",
"information",
".",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1429-L1431 | train | Add a custom source to the data stream. | [
30522,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
9909,
8162,
3401,
1006,
3120,
11263,
27989,
1026,
2041,
1028,
3853,
1010,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2828,
2378,
14876,
1007,
1063,
2709,
9909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putMemorySize | public void putMemorySize(String key, MemorySize size) {
checkNotNull(key);
checkNotNull(size);
put(key, size.toString());
} | java | public void putMemorySize(String key, MemorySize size) {
checkNotNull(key);
checkNotNull(size);
put(key, size.toString());
} | [
"public",
"void",
"putMemorySize",
"(",
"String",
"key",
",",
"MemorySize",
"size",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"checkNotNull",
"(",
"size",
")",
";",
"put",
"(",
"key",
",",
"size",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Adds a Flink {@link MemorySize} under the given key. | [
"Adds",
"a",
"Flink",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L184-L188 | train | Sets the value of the MemorySize property. | [
30522,
2270,
11675,
2404,
4168,
5302,
24769,
4697,
1006,
5164,
3145,
1010,
3638,
5332,
4371,
2946,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3145,
1007,
1025,
4638,
17048,
11231,
3363,
1006,
2946,
1007,
1025,
2404,
1006,
3145,
1010,
2946,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onHttpServerUpgrade | public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception {
if (!connection().isServer()) {
throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client");
}
if (!prefaceSent()) {
// If the preface was not sent yet it most likely means the handler was not added to the pipeline before
// calling this method.
throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
}
if (decoder.prefaceReceived()) {
throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
}
// Apply the settings but no ACK is necessary.
encoder.remoteSettings(settings);
// Create a stream in the half-closed state.
connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true);
} | java | public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception {
if (!connection().isServer()) {
throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client");
}
if (!prefaceSent()) {
// If the preface was not sent yet it most likely means the handler was not added to the pipeline before
// calling this method.
throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
}
if (decoder.prefaceReceived()) {
throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
}
// Apply the settings but no ACK is necessary.
encoder.remoteSettings(settings);
// Create a stream in the half-closed state.
connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true);
} | [
"public",
"void",
"onHttpServerUpgrade",
"(",
"Http2Settings",
"settings",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"!",
"connection",
"(",
")",
".",
"isServer",
"(",
")",
")",
"{",
"throw",
"connectionError",
"(",
"PROTOCOL_ERROR",
",",
"\"Server-side H... | Handles the server-side (cleartext) upgrade from HTTP to HTTP/2.
@param settings the settings for the remote endpoint. | [
"Handles",
"the",
"server",
"-",
"side",
"(",
"cleartext",
")",
"upgrade",
"from",
"HTTP",
"to",
"HTTP",
"/",
"2",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L164-L182 | train | Called when an HTTP upgrade is received from the server. | [
30522,
2270,
11675,
2006,
11039,
25856,
8043,
6299,
6279,
24170,
1006,
8299,
2475,
21678,
8613,
10906,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
2065,
1006,
999,
4434,
1006,
1007,
1012,
26354,
2121,
6299,
1006,
1007,
1007,
1063,
5466,
44... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StringUtil.java | StringUtil.toHexString | public static String toHexString(byte[] src, int offset, int length) {
return toHexString(new StringBuilder(length << 1), src, offset, length).toString();
} | java | public static String toHexString(byte[] src, int offset, int length) {
return toHexString(new StringBuilder(length << 1), src, offset, length).toString();
} | [
"public",
"static",
"String",
"toHexString",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"toHexString",
"(",
"new",
"StringBuilder",
"(",
"length",
"<<",
"1",
")",
",",
"src",
",",
"offset",
",",
"lengt... | Converts the specified byte array into a hexadecimal value. | [
"Converts",
"the",
"specified",
"byte",
"array",
"into",
"a",
"hexadecimal",
"value",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L167-L169 | train | Convert a byte array to a hexidecimal string. | [
30522,
2270,
10763,
5164,
2000,
5369,
2595,
3367,
4892,
1006,
24880,
1031,
1033,
5034,
2278,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
1063,
2709,
2000,
5369,
2595,
3367,
4892,
1006,
2047,
5164,
8569,
23891,
2099,
1006,
3091,
1026,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerSnapshot.java | CompositeTypeSerializerSnapshot.internalWriteOuterSnapshot | private void internalWriteOuterSnapshot(DataOutputView out) throws IOException {
out.writeInt(MAGIC_NUMBER);
out.writeInt(getCurrentOuterSnapshotVersion());
writeOuterSnapshot(out);
} | java | private void internalWriteOuterSnapshot(DataOutputView out) throws IOException {
out.writeInt(MAGIC_NUMBER);
out.writeInt(getCurrentOuterSnapshotVersion());
writeOuterSnapshot(out);
} | [
"private",
"void",
"internalWriteOuterSnapshot",
"(",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"MAGIC_NUMBER",
")",
";",
"out",
".",
"writeInt",
"(",
"getCurrentOuterSnapshotVersion",
"(",
")",
")",
";",
"writeOuterS... | ------------------------------------------------------------------------------------------ | [
"------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerSnapshot.java#L283-L288 | train | Write the outer snapshot. | [
30522,
2797,
11675,
4722,
26373,
5833,
2545,
2532,
4523,
12326,
1006,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
30524,
2532,
4523,
12326,
27774,
1006,
1007,
1007,
1025,
4339,
5833,
2545,
2532,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/taskmanager/Task.java | Task.isCanceledOrFailed | public boolean isCanceledOrFailed() {
return executionState == ExecutionState.CANCELING ||
executionState == ExecutionState.CANCELED ||
executionState == ExecutionState.FAILED;
} | java | public boolean isCanceledOrFailed() {
return executionState == ExecutionState.CANCELING ||
executionState == ExecutionState.CANCELED ||
executionState == ExecutionState.FAILED;
} | [
"public",
"boolean",
"isCanceledOrFailed",
"(",
")",
"{",
"return",
"executionState",
"==",
"ExecutionState",
".",
"CANCELING",
"||",
"executionState",
"==",
"ExecutionState",
".",
"CANCELED",
"||",
"executionState",
"==",
"ExecutionState",
".",
"FAILED",
";",
"}"
] | Checks whether the task has failed, is canceled, or is being canceled at the moment.
@return True is the task in state FAILED, CANCELING, or CANCELED, false otherwise. | [
"Checks",
"whether",
"the",
"task",
"has",
"failed",
"is",
"canceled",
"or",
"is",
"being",
"canceled",
"at",
"the",
"moment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L513-L517 | train | Returns true if the task is in canceled or failed state. | [
30522,
2270,
22017,
20898,
2003,
9336,
29109,
26010,
12881,
17440,
1006,
1007,
1063,
2709,
22679,
12259,
1027,
1027,
22679,
12259,
1012,
17542,
2075,
1064,
1064,
22679,
12259,
1027,
1027,
22679,
12259,
1012,
13261,
1064,
1064,
22679,
12259,
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-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java | JschUtil.createSession | public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) {
if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) {
return null;
}
Session session;
try {
session = new JSch().getSession(sshUser, sshHost, sshPort);
session.setPassword(sshPass);
// 设置第一次登陆的时候提示,可选值:(ask | yes | no)
session.setConfig("StrictHostKeyChecking", "no");
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return session;
} | java | public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) {
if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) {
return null;
}
Session session;
try {
session = new JSch().getSession(sshUser, sshHost, sshPort);
session.setPassword(sshPass);
// 设置第一次登陆的时候提示,可选值:(ask | yes | no)
session.setConfig("StrictHostKeyChecking", "no");
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return session;
} | [
"public",
"static",
"Session",
"createSession",
"(",
"String",
"sshHost",
",",
"int",
"sshPort",
",",
"String",
"sshUser",
",",
"String",
"sshPass",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"sshHost",
")",
"||",
"sshPort",
"<",
"0",
"||",
"St... | 新建一个新的SSH会话
@param sshHost 主机
@param sshPort 端口
@param sshUser 机用户名
@param sshPass 密码
@return SSH会话
@since 4.5.2 | [
"新建一个新的SSH会话"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java#L89-L104 | train | Creates a new Session object. | [
30522,
2270,
10763,
5219,
9005,
7971,
3258,
1006,
5164,
7020,
23644,
14122,
1010,
20014,
7020,
22269,
11589,
1010,
5164,
7020,
9825,
2121,
1010,
5164,
7020,
22269,
12054,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.shutdown | public void shutdown(JobStatus jobStatus) throws Exception {
synchronized (lock) {
if (!shutdown) {
shutdown = true;
LOG.info("Stopping checkpoint coordinator for job {}.", job);
periodicScheduling = false;
triggerRequestQueued = false;
// shut down the hooks
MasterHooks.close(masterHooks.values(), LOG);
masterHooks.clear();
// shut down the thread that handles the timeouts and pending triggers
timer.shutdownNow();
// clear and discard all pending checkpoints
for (PendingCheckpoint pending : pendingCheckpoints.values()) {
pending.abort(CheckpointFailureReason.CHECKPOINT_COORDINATOR_SHUTDOWN);
}
pendingCheckpoints.clear();
completedCheckpointStore.shutdown(jobStatus);
checkpointIdCounter.shutdown(jobStatus);
}
}
} | java | public void shutdown(JobStatus jobStatus) throws Exception {
synchronized (lock) {
if (!shutdown) {
shutdown = true;
LOG.info("Stopping checkpoint coordinator for job {}.", job);
periodicScheduling = false;
triggerRequestQueued = false;
// shut down the hooks
MasterHooks.close(masterHooks.values(), LOG);
masterHooks.clear();
// shut down the thread that handles the timeouts and pending triggers
timer.shutdownNow();
// clear and discard all pending checkpoints
for (PendingCheckpoint pending : pendingCheckpoints.values()) {
pending.abort(CheckpointFailureReason.CHECKPOINT_COORDINATOR_SHUTDOWN);
}
pendingCheckpoints.clear();
completedCheckpointStore.shutdown(jobStatus);
checkpointIdCounter.shutdown(jobStatus);
}
}
} | [
"public",
"void",
"shutdown",
"(",
"JobStatus",
"jobStatus",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"shutdown",
")",
"{",
"shutdown",
"=",
"true",
";",
"LOG",
".",
"info",
"(",
"\"Stopping checkpoint coordinat... | Shuts down the checkpoint coordinator.
<p>After this method has been called, the coordinator does not accept
and further messages and cannot trigger any further checkpoints. | [
"Shuts",
"down",
"the",
"checkpoint",
"coordinator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L323-L349 | train | Shutdown the coordinator for the given job. | [
30522,
2270,
11675,
3844,
7698,
1006,
5841,
29336,
2271,
5841,
29336,
2271,
1007,
11618,
6453,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
999,
3844,
7698,
1007,
1063,
3844,
7698,
1027,
2995,
1025,
8833,
1012,
18558,
1006,
1000,
7458,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.contains | @Override
public boolean contains(String str) {
for (BloomFilter filter : filters) {
if (filter.contains(str) == false) {
return false;
}
}
return true;
} | java | @Override
public boolean contains(String str) {
for (BloomFilter filter : filters) {
if (filter.contains(str) == false) {
return false;
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"contains",
"(",
"String",
"str",
")",
"{",
"for",
"(",
"BloomFilter",
"filter",
":",
"filters",
")",
"{",
"if",
"(",
"filter",
".",
"contains",
"(",
"str",
")",
"==",
"false",
")",
"{",
"return",
"false",
";",
"... | 是否可能包含此字符串,此处存在误判
@param str 字符串
@return 是否存在 | [
"是否可能包含此字符串,此处存在误判"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitMapBloomFilter.java#L68-L76 | train | Returns true if the string is contained in the BloomFilter. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3397,
1006,
5164,
2358,
2099,
1007,
1063,
2005,
1006,
13426,
8873,
21928,
11307,
1024,
17736,
1007,
1063,
2065,
1006,
11307,
1012,
3397,
1006,
2358,
2099,
1007,
1027,
1027,
6270,
1007,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/concurrent/DefaultPromise.java | DefaultPromise.notifyProgressiveListeners | @SuppressWarnings("unchecked")
void notifyProgressiveListeners(final long progress, final long total) {
final Object listeners = progressiveListeners();
if (listeners == null) {
return;
}
final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this;
EventExecutor executor = executor();
if (executor.inEventLoop()) {
if (listeners instanceof GenericProgressiveFutureListener[]) {
notifyProgressiveListeners0(
self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total);
} else {
notifyProgressiveListener0(
self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total);
}
} else {
if (listeners instanceof GenericProgressiveFutureListener[]) {
final GenericProgressiveFutureListener<?>[] array =
(GenericProgressiveFutureListener<?>[]) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListeners0(self, array, progress, total);
}
});
} else {
final GenericProgressiveFutureListener<ProgressiveFuture<V>> l =
(GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListener0(self, l, progress, total);
}
});
}
}
} | java | @SuppressWarnings("unchecked")
void notifyProgressiveListeners(final long progress, final long total) {
final Object listeners = progressiveListeners();
if (listeners == null) {
return;
}
final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this;
EventExecutor executor = executor();
if (executor.inEventLoop()) {
if (listeners instanceof GenericProgressiveFutureListener[]) {
notifyProgressiveListeners0(
self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total);
} else {
notifyProgressiveListener0(
self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total);
}
} else {
if (listeners instanceof GenericProgressiveFutureListener[]) {
final GenericProgressiveFutureListener<?>[] array =
(GenericProgressiveFutureListener<?>[]) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListeners0(self, array, progress, total);
}
});
} else {
final GenericProgressiveFutureListener<ProgressiveFuture<V>> l =
(GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListener0(self, l, progress, total);
}
});
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"notifyProgressiveListeners",
"(",
"final",
"long",
"progress",
",",
"final",
"long",
"total",
")",
"{",
"final",
"Object",
"listeners",
"=",
"progressiveListeners",
"(",
")",
";",
"if",
"(",
"listeners... | Notify all progressive listeners.
<p>
No attempt is made to ensure notification order if multiple calls are made to this method before
the original invocation completes.
<p>
This will do an iteration over all listeners to get all of type {@link GenericProgressiveFutureListener}s.
@param progress the new progress.
@param total the total progress. | [
"Notify",
"all",
"progressive",
"listeners",
".",
"<p",
">",
"No",
"attempt",
"is",
"made",
"to",
"ensure",
"notification",
"order",
"if",
"multiple",
"calls",
"are",
"made",
"to",
"this",
"method",
"before",
"the",
"original",
"invocation",
"completes",
".",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L641-L680 | train | Notify the progressive listeners. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
11675,
2025,
8757,
21572,
17603,
18719,
15985,
27870,
16912,
1006,
2345,
2146,
5082,
1010,
2345,
2146,
2561,
1007,
1063,
2345,
4874,
13810,
1027,
6555,
9863,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.getDouble | public static Double getDouble(Map<?, ?> map, Object key) {
return get(map, key, Double.class);
} | java | public static Double getDouble(Map<?, ?> map, Object key) {
return get(map, key, Double.class);
} | [
"public",
"static",
"Double",
"getDouble",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Object",
"key",
")",
"{",
"return",
"get",
"(",
"map",
",",
"key",
",",
"Double",
".",
"class",
")",
";",
"}"
] | 获取Map指定key的值,并转换为Double
@param map Map
@param key 键
@return 值
@since 4.0.6 | [
"获取Map指定key的值,并转换为Double"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L780-L782 | train | Gets the Double value from the map. | [
30522,
2270,
10763,
3313,
2131,
26797,
3468,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
4874,
3145,
1007,
1063,
2709,
2131,
1006,
4949,
1010,
3145,
1010,
3313,
1012,
2465,
1007,
1025,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | handler/src/main/java/com/networknt/handler/config/PathChain.java | PathChain.validate | public void validate(String origin) {
List<String> problems = new ArrayList<>();
if(source == null) {
if(path == null) {
problems.add("You must specify either path or source");
} else if(method == null) {
problems.add("You must specify method along with path: " + path);
}
} else {
if(path != null) {
problems.add("Conflicting source: " + source + " and path: " + path);
}
if(method != null) {
problems.add("Conflicting source: " + source + " and method: " + method);
}
}
if(method != null && !Util.METHODS.contains(method.toUpperCase())) {
problems.add("Invalid HTTP method: " + method);
}
if(!problems.isEmpty()) {
throw new RuntimeException("Bad paths element in " + origin + " [ " + String.join(" | ", problems) + " ]");
}
} | java | public void validate(String origin) {
List<String> problems = new ArrayList<>();
if(source == null) {
if(path == null) {
problems.add("You must specify either path or source");
} else if(method == null) {
problems.add("You must specify method along with path: " + path);
}
} else {
if(path != null) {
problems.add("Conflicting source: " + source + " and path: " + path);
}
if(method != null) {
problems.add("Conflicting source: " + source + " and method: " + method);
}
}
if(method != null && !Util.METHODS.contains(method.toUpperCase())) {
problems.add("Invalid HTTP method: " + method);
}
if(!problems.isEmpty()) {
throw new RuntimeException("Bad paths element in " + origin + " [ " + String.join(" | ", problems) + " ]");
}
} | [
"public",
"void",
"validate",
"(",
"String",
"origin",
")",
"{",
"List",
"<",
"String",
">",
"problems",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"problems... | Validate the settings and raise Exception on error.
The origin is used to help locate problems.
@param origin the origin | [
"Validate",
"the",
"settings",
"and",
"raise",
"Exception",
"on",
"error",
".",
"The",
"origin",
"is",
"used",
"to",
"help",
"locate",
"problems",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/config/PathChain.java#L74-L96 | train | Validate the request. | [
30522,
2270,
11675,
9398,
3686,
1006,
5164,
4761,
1007,
1063,
2862,
1026,
5164,
1028,
3471,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2065,
1006,
3120,
1027,
1027,
19701,
1007,
1063,
2065,
1006,
4130,
1027,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java | JobLeaderService.start | public void start(
final String initialOwnerAddress,
final RpcService initialRpcService,
final HighAvailabilityServices initialHighAvailabilityServices,
final JobLeaderListener initialJobLeaderListener) {
if (JobLeaderService.State.CREATED != state) {
throw new IllegalStateException("The service has already been started.");
} else {
LOG.info("Start job leader service.");
this.ownerAddress = Preconditions.checkNotNull(initialOwnerAddress);
this.rpcService = Preconditions.checkNotNull(initialRpcService);
this.highAvailabilityServices = Preconditions.checkNotNull(initialHighAvailabilityServices);
this.jobLeaderListener = Preconditions.checkNotNull(initialJobLeaderListener);
state = JobLeaderService.State.STARTED;
}
} | java | public void start(
final String initialOwnerAddress,
final RpcService initialRpcService,
final HighAvailabilityServices initialHighAvailabilityServices,
final JobLeaderListener initialJobLeaderListener) {
if (JobLeaderService.State.CREATED != state) {
throw new IllegalStateException("The service has already been started.");
} else {
LOG.info("Start job leader service.");
this.ownerAddress = Preconditions.checkNotNull(initialOwnerAddress);
this.rpcService = Preconditions.checkNotNull(initialRpcService);
this.highAvailabilityServices = Preconditions.checkNotNull(initialHighAvailabilityServices);
this.jobLeaderListener = Preconditions.checkNotNull(initialJobLeaderListener);
state = JobLeaderService.State.STARTED;
}
} | [
"public",
"void",
"start",
"(",
"final",
"String",
"initialOwnerAddress",
",",
"final",
"RpcService",
"initialRpcService",
",",
"final",
"HighAvailabilityServices",
"initialHighAvailabilityServices",
",",
"final",
"JobLeaderListener",
"initialJobLeaderListener",
")",
"{",
"... | Start the job leader service with the given services.
@param initialOwnerAddress to be used for establishing connections (source address)
@param initialRpcService to be used to create rpc connections
@param initialHighAvailabilityServices to create leader retrieval services for the different jobs
@param initialJobLeaderListener listening for job leader changes | [
"Start",
"the",
"job",
"leader",
"service",
"with",
"the",
"given",
"services",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java#L116-L133 | train | Start the job leader service. | [
30522,
2270,
11675,
2707,
1006,
2345,
5164,
3988,
12384,
6906,
14141,
8303,
1010,
2345,
1054,
15042,
8043,
7903,
2063,
3988,
14536,
6169,
2121,
7903,
2063,
1010,
2345,
2152,
12462,
11733,
8553,
8043,
7903,
2229,
3988,
4048,
5603,
12462,
117... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.add_sink | @PublicEvolving
public void add_sink(SinkFunction<PyObject> sink_func) throws IOException {
stream.addSink(new PythonSinkFunction(sink_func));
} | java | @PublicEvolving
public void add_sink(SinkFunction<PyObject> sink_func) throws IOException {
stream.addSink(new PythonSinkFunction(sink_func));
} | [
"@",
"PublicEvolving",
"public",
"void",
"add_sink",
"(",
"SinkFunction",
"<",
"PyObject",
">",
"sink_func",
")",
"throws",
"IOException",
"{",
"stream",
".",
"addSink",
"(",
"new",
"PythonSinkFunction",
"(",
"sink_func",
")",
")",
";",
"}"
] | A thin wrapper layer over {@link DataStream#addSink(SinkFunction)}.
@param sink_func The object containing the sink's invoke function. | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"DataStream#addSink",
"(",
"SinkFunction",
")",
"}",
"."
] | 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#L186-L189 | train | Adds a sink to the stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
11675,
5587,
1035,
7752,
1006,
7752,
11263,
27989,
1026,
1052,
7677,
2497,
20614,
1028,
7752,
1035,
4569,
2278,
1007,
11618,
22834,
10288,
24422,
1063,
5460,
1012,
9909,
19839,
1006,
2047,
18750,
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/io/network/TaskEventDispatcher.java | TaskEventDispatcher.subscribeToEvent | public void subscribeToEvent(
ResultPartitionID partitionId,
EventListener<TaskEvent> eventListener,
Class<? extends TaskEvent> eventType) {
checkNotNull(partitionId);
checkNotNull(eventListener);
checkNotNull(eventType);
TaskEventHandler taskEventHandler;
synchronized (registeredHandlers) {
taskEventHandler = registeredHandlers.get(partitionId);
}
if (taskEventHandler == null) {
throw new IllegalStateException(
"Partition " + partitionId + " not registered at task event dispatcher.");
}
taskEventHandler.subscribe(eventListener, eventType);
} | java | public void subscribeToEvent(
ResultPartitionID partitionId,
EventListener<TaskEvent> eventListener,
Class<? extends TaskEvent> eventType) {
checkNotNull(partitionId);
checkNotNull(eventListener);
checkNotNull(eventType);
TaskEventHandler taskEventHandler;
synchronized (registeredHandlers) {
taskEventHandler = registeredHandlers.get(partitionId);
}
if (taskEventHandler == null) {
throw new IllegalStateException(
"Partition " + partitionId + " not registered at task event dispatcher.");
}
taskEventHandler.subscribe(eventListener, eventType);
} | [
"public",
"void",
"subscribeToEvent",
"(",
"ResultPartitionID",
"partitionId",
",",
"EventListener",
"<",
"TaskEvent",
">",
"eventListener",
",",
"Class",
"<",
"?",
"extends",
"TaskEvent",
">",
"eventType",
")",
"{",
"checkNotNull",
"(",
"partitionId",
")",
";",
... | Subscribes a listener to this dispatcher for events on a partition.
@param partitionId
ID of the partition to subscribe for (must be registered via {@link
#registerPartition(ResultPartitionID)} first!)
@param eventListener
the event listener to subscribe
@param eventType
event type to subscribe to | [
"Subscribes",
"a",
"listener",
"to",
"this",
"dispatcher",
"for",
"events",
"on",
"a",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/TaskEventDispatcher.java#L97-L114 | train | Subscribes an event listener to an event type. | [
30522,
2270,
11675,
4942,
29234,
3406,
18697,
3372,
1006,
2765,
19362,
3775,
3508,
3593,
13571,
3593,
1010,
2724,
9863,
24454,
1026,
4708,
18697,
3372,
1028,
2724,
9863,
24454,
1010,
2465,
1026,
1029,
8908,
4708,
18697,
3372,
1028,
2724,
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... |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputStreamer.java | PythonDualInputStreamer.streamBufferWithGroups | public final void streamBufferWithGroups(Iterator<IN1> iterator1, Iterator<IN2> iterator2, Collector<OUT> c) {
SingleElementPushBackIterator<IN1> i1 = new SingleElementPushBackIterator<>(iterator1);
SingleElementPushBackIterator<IN2> i2 = new SingleElementPushBackIterator<>(iterator2);
try {
int size;
if (i1.hasNext() || i2.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST_G0:
if (i1.hasNext()) {
size = sender.sendBuffer1(i1);
sendWriteNotification(size, i1.hasNext());
}
break;
case SIGNAL_BUFFER_REQUEST_G1:
if (i2.hasNext()) {
size = sender.sendBuffer2(i2);
sendWriteNotification(size, i2.hasNext());
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join();
} catch (InterruptedException e) {
outPrinter.interrupt();
}
try {
errorPrinter.join();
} catch (InterruptedException e) {
errorPrinter.interrupt();
}
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg);
} catch (Exception e) {
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
}
} | java | public final void streamBufferWithGroups(Iterator<IN1> iterator1, Iterator<IN2> iterator2, Collector<OUT> c) {
SingleElementPushBackIterator<IN1> i1 = new SingleElementPushBackIterator<>(iterator1);
SingleElementPushBackIterator<IN2> i2 = new SingleElementPushBackIterator<>(iterator2);
try {
int size;
if (i1.hasNext() || i2.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST_G0:
if (i1.hasNext()) {
size = sender.sendBuffer1(i1);
sendWriteNotification(size, i1.hasNext());
}
break;
case SIGNAL_BUFFER_REQUEST_G1:
if (i2.hasNext()) {
size = sender.sendBuffer2(i2);
sendWriteNotification(size, i2.hasNext());
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join();
} catch (InterruptedException e) {
outPrinter.interrupt();
}
try {
errorPrinter.join();
} catch (InterruptedException e) {
errorPrinter.interrupt();
}
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg);
} catch (Exception e) {
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
}
} | [
"public",
"final",
"void",
"streamBufferWithGroups",
"(",
"Iterator",
"<",
"IN1",
">",
"iterator1",
",",
"Iterator",
"<",
"IN2",
">",
"iterator2",
",",
"Collector",
"<",
"OUT",
">",
"c",
")",
"{",
"SingleElementPushBackIterator",
"<",
"IN1",
">",
"i1",
"=",
... | Sends all values contained in both iterators to the external process and collects all results.
@param iterator1 first input stream
@param iterator2 second input stream
@param c collector | [
"Sends",
"all",
"values",
"contained",
"in",
"both",
"iterators",
"to",
"the",
"external",
"process",
"and",
"collects",
"all",
"results",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputStreamer.java#L50-L98 | train | Stream the data from the given iterators into the given collector. | [
30522,
2270,
2345,
11675,
5460,
8569,
12494,
24415,
17058,
2015,
1006,
2009,
6906,
4263,
1026,
1999,
2487,
1028,
2009,
6906,
4263,
2487,
1010,
2009,
6906,
4263,
1026,
1999,
2475,
1028,
2009,
6906,
4263,
2475,
1010,
10018,
1026,
2041,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readString | public static String readString(URL url, String charset) throws IORuntimeException {
if (url == null) {
throw new NullPointerException("Empty url provided!");
}
InputStream in = null;
try {
in = url.openStream();
return IoUtil.read(in, charset);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | java | public static String readString(URL url, String charset) throws IORuntimeException {
if (url == null) {
throw new NullPointerException("Empty url provided!");
}
InputStream in = null;
try {
in = url.openStream();
return IoUtil.read(in, charset);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"String",
"readString",
"(",
"URL",
"url",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Empty url provided!\"",
")",
";",
"}",
... | 读取文件内容
@param url 文件URL
@param charset 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"读取文件内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2138-L2152 | train | Reads a string from the specified URL. | [
30522,
2270,
10763,
5164,
9631,
18886,
3070,
1006,
24471,
2140,
24471,
2140,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
24471,
2140,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.query | public static <T> T query(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException {
StatementUtil.fillParams(ps, params);
return executeQuery(ps, rsh);
} | java | public static <T> T query(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException {
StatementUtil.fillParams(ps, params);
return executeQuery(ps, rsh);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"query",
"(",
"PreparedStatement",
"ps",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"StatementUtil",
".",
"fillParams",
"(",
"ps",
",",
"params",
")"... | 执行查询语句<br>
此方法不会关闭PreparedStatement
@param <T> 处理结果类型
@param ps PreparedStatement
@param rsh 结果集处理对象
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"执行查询语句<br",
">",
"此方法不会关闭PreparedStatement"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L312-L315 | train | Query a SQL statement. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
23032,
1006,
4810,
9153,
18532,
4765,
8827,
1010,
12667,
11774,
3917,
1026,
1056,
1028,
12667,
2232,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
4861,
21823,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.privateCreateTypeInfo | @SuppressWarnings("unchecked")
private <IN1, IN2, OUT> TypeInformation<OUT> privateCreateTypeInfo(Class<?> baseClass, Class<?> clazz, int returnParamPos,
TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type) {
ArrayList<Type> typeHierarchy = new ArrayList<Type>();
Type returnType = getParameterType(baseClass, typeHierarchy, clazz, returnParamPos);
TypeInformation<OUT> typeInfo;
// return type is a variable -> try to get the type info from the input directly
if (returnType instanceof TypeVariable<?>) {
typeInfo = (TypeInformation<OUT>) createTypeInfoFromInputs((TypeVariable<?>) returnType, typeHierarchy, in1Type, in2Type);
if (typeInfo != null) {
return typeInfo;
}
}
// get info from hierarchy
return (TypeInformation<OUT>) createTypeInfoWithTypeHierarchy(typeHierarchy, returnType, in1Type, in2Type);
} | java | @SuppressWarnings("unchecked")
private <IN1, IN2, OUT> TypeInformation<OUT> privateCreateTypeInfo(Class<?> baseClass, Class<?> clazz, int returnParamPos,
TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type) {
ArrayList<Type> typeHierarchy = new ArrayList<Type>();
Type returnType = getParameterType(baseClass, typeHierarchy, clazz, returnParamPos);
TypeInformation<OUT> typeInfo;
// return type is a variable -> try to get the type info from the input directly
if (returnType instanceof TypeVariable<?>) {
typeInfo = (TypeInformation<OUT>) createTypeInfoFromInputs((TypeVariable<?>) returnType, typeHierarchy, in1Type, in2Type);
if (typeInfo != null) {
return typeInfo;
}
}
// get info from hierarchy
return (TypeInformation<OUT>) createTypeInfoWithTypeHierarchy(typeHierarchy, returnType, in1Type, in2Type);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"IN1",
",",
"IN2",
",",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"privateCreateTypeInfo",
"(",
"Class",
"<",
"?",
">",
"baseClass",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"int... | for (Rich)Functions | [
"for",
"(",
"Rich",
")",
"Functions"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L785-L804 | train | Private helper method to create the type information for the
operation. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2797,
1026,
1999,
2487,
1010,
1999,
2475,
1010,
2041,
1028,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2797,
16748,
3686,
13874,
2378,
14876,
1006,
2465,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java | FailoverRegion.restart | private void restart(long globalModVersionOfFailover) {
try {
if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) {
// if we have checkpointed state, reload it into the executions
if (executionGraph.getCheckpointCoordinator() != null) {
// we restart the checkpoint scheduler for
// i) enable new checkpoint could be triggered without waiting for last checkpoint expired.
// ii) ensure the EXACTLY_ONCE semantics if needed.
executionGraph.getCheckpointCoordinator().abortPendingCheckpoints(
new CheckpointException(CheckpointFailureReason.JOB_FAILOVER_REGION));
executionGraph.getCheckpointCoordinator().restoreLatestCheckpointedState(
tasks, false, true);
}
HashSet<AllocationID> previousAllocationsInRegion = new HashSet<>(connectedExecutionVertexes.size());
for (ExecutionVertex connectedExecutionVertex : connectedExecutionVertexes) {
AllocationID latestPriorAllocation = connectedExecutionVertex.getLatestPriorAllocation();
if (latestPriorAllocation != null) {
previousAllocationsInRegion.add(latestPriorAllocation);
}
}
//TODO, use restart strategy to schedule them.
//restart all connected ExecutionVertexes
for (ExecutionVertex ev : connectedExecutionVertexes) {
try {
ev.scheduleForExecution(
executionGraph.getSlotProvider(),
executionGraph.isQueuedSchedulingAllowed(),
LocationPreferenceConstraint.ANY,
previousAllocationsInRegion); // some inputs not belonging to the failover region might have failed concurrently
}
catch (Throwable e) {
failover(globalModVersionOfFailover);
}
}
}
else {
LOG.info("FailoverRegion {} switched from CREATED to RUNNING fail, will fail this region again.", id);
failover(globalModVersionOfFailover);
}
} catch (Exception e) {
LOG.info("FailoverRegion {} restart failed, failover again.", id, e);
failover(globalModVersionOfFailover);
}
} | java | private void restart(long globalModVersionOfFailover) {
try {
if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) {
// if we have checkpointed state, reload it into the executions
if (executionGraph.getCheckpointCoordinator() != null) {
// we restart the checkpoint scheduler for
// i) enable new checkpoint could be triggered without waiting for last checkpoint expired.
// ii) ensure the EXACTLY_ONCE semantics if needed.
executionGraph.getCheckpointCoordinator().abortPendingCheckpoints(
new CheckpointException(CheckpointFailureReason.JOB_FAILOVER_REGION));
executionGraph.getCheckpointCoordinator().restoreLatestCheckpointedState(
tasks, false, true);
}
HashSet<AllocationID> previousAllocationsInRegion = new HashSet<>(connectedExecutionVertexes.size());
for (ExecutionVertex connectedExecutionVertex : connectedExecutionVertexes) {
AllocationID latestPriorAllocation = connectedExecutionVertex.getLatestPriorAllocation();
if (latestPriorAllocation != null) {
previousAllocationsInRegion.add(latestPriorAllocation);
}
}
//TODO, use restart strategy to schedule them.
//restart all connected ExecutionVertexes
for (ExecutionVertex ev : connectedExecutionVertexes) {
try {
ev.scheduleForExecution(
executionGraph.getSlotProvider(),
executionGraph.isQueuedSchedulingAllowed(),
LocationPreferenceConstraint.ANY,
previousAllocationsInRegion); // some inputs not belonging to the failover region might have failed concurrently
}
catch (Throwable e) {
failover(globalModVersionOfFailover);
}
}
}
else {
LOG.info("FailoverRegion {} switched from CREATED to RUNNING fail, will fail this region again.", id);
failover(globalModVersionOfFailover);
}
} catch (Exception e) {
LOG.info("FailoverRegion {} restart failed, failover again.", id, e);
failover(globalModVersionOfFailover);
}
} | [
"private",
"void",
"restart",
"(",
"long",
"globalModVersionOfFailover",
")",
"{",
"try",
"{",
"if",
"(",
"transitionState",
"(",
"JobStatus",
".",
"CREATED",
",",
"JobStatus",
".",
"RUNNING",
")",
")",
"{",
"// if we have checkpointed state, reload it into the execut... | restart all executions in this sub graph | [
"restart",
"all",
"executions",
"in",
"this",
"sub",
"graph"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java#L207-L253 | train | restart the failover region | [
30522,
2797,
11675,
23818,
1006,
2146,
3795,
5302,
2094,
27774,
7245,
12502,
7840,
1007,
1063,
3046,
1063,
2065,
1006,
22166,
12259,
1006,
5841,
29336,
2271,
1012,
2580,
1010,
5841,
29336,
2271,
1012,
2770,
1007,
1007,
1063,
1013,
1013,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/RedissonSpringCacheManager.java | RedissonSpringCacheManager.setConfig | public void setConfig(Map<String, ? extends CacheConfig> config) {
this.configMap = (Map<String, CacheConfig>) config;
} | java | public void setConfig(Map<String, ? extends CacheConfig> config) {
this.configMap = (Map<String, CacheConfig>) config;
} | [
"public",
"void",
"setConfig",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"config",
")",
"{",
"this",
".",
"configMap",
"=",
"(",
"Map",
"<",
"String",
",",
"CacheConfig",
">",
")",
"config",
";",
"}"
] | Set cache config mapped by cache name
@param config object | [
"Set",
"cache",
"config",
"mapped",
"by",
"cache",
"name"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/RedissonSpringCacheManager.java#L175-L177 | train | Sets the cache configuration. | [
30522,
2270,
11675,
2275,
8663,
8873,
2290,
1006,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
9530,
8873,
2290,
1007,
1063,
2023,
1012,
9530,
8873,
21693,
9331,
1027,
1006,
4949,
1026,
5164,
1010,
17053,
8663,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java | BinaryInMemorySortBuffer.write | public boolean write(BaseRow record) throws IOException {
//check whether we need a new memory segment for the sort index
if (!checkNextIndexOffset()) {
return false;
}
// serialize the record into the data buffers
int skip;
try {
skip = this.inputSerializer.serializeToPages(record, this.recordCollector);
} catch (EOFException e) {
return false;
}
final long newOffset = this.recordCollector.getCurrentOffset();
long currOffset = currentDataBufferOffset + skip;
writeIndexAndNormalizedKey(record, currOffset);
this.currentDataBufferOffset = newOffset;
return true;
} | java | public boolean write(BaseRow record) throws IOException {
//check whether we need a new memory segment for the sort index
if (!checkNextIndexOffset()) {
return false;
}
// serialize the record into the data buffers
int skip;
try {
skip = this.inputSerializer.serializeToPages(record, this.recordCollector);
} catch (EOFException e) {
return false;
}
final long newOffset = this.recordCollector.getCurrentOffset();
long currOffset = currentDataBufferOffset + skip;
writeIndexAndNormalizedKey(record, currOffset);
this.currentDataBufferOffset = newOffset;
return true;
} | [
"public",
"boolean",
"write",
"(",
"BaseRow",
"record",
")",
"throws",
"IOException",
"{",
"//check whether we need a new memory segment for the sort index",
"if",
"(",
"!",
"checkNextIndexOffset",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// serialize the recor... | Writes a given record to this sort buffer. The written record will be appended and take
the last logical position.
@param record The record to be written.
@return True, if the record was successfully written, false, if the sort buffer was full.
@throws IOException Thrown, if an error occurred while serializing the record into the buffers. | [
"Writes",
"a",
"given",
"record",
"to",
"this",
"sort",
"buffer",
".",
"The",
"written",
"record",
"will",
"be",
"appended",
"and",
"take",
"the",
"last",
"logical",
"position",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java#L150-L172 | train | Write a record to the output. | [
30522,
2270,
22017,
20898,
4339,
1006,
2918,
10524,
2501,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
3251,
2057,
2342,
1037,
2047,
3638,
6903,
2005,
1996,
4066,
5950,
2065,
1006,
999,
4638,
2638,
18413,
22254,
10288,
27475,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java | WebFluxTags.uri | public static Tag uri(ServerWebExchange exchange) {
PathPattern pathPattern = exchange
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
if (pathPattern != null) {
return Tag.of("uri", pathPattern.getPatternString());
}
HttpStatus status = exchange.getResponse().getStatusCode();
if (status != null) {
if (status.is3xxRedirection()) {
return URI_REDIRECTION;
}
if (status == HttpStatus.NOT_FOUND) {
return URI_NOT_FOUND;
}
}
String path = getPathInfo(exchange);
if (path.isEmpty()) {
return URI_ROOT;
}
return URI_UNKNOWN;
} | java | public static Tag uri(ServerWebExchange exchange) {
PathPattern pathPattern = exchange
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
if (pathPattern != null) {
return Tag.of("uri", pathPattern.getPatternString());
}
HttpStatus status = exchange.getResponse().getStatusCode();
if (status != null) {
if (status.is3xxRedirection()) {
return URI_REDIRECTION;
}
if (status == HttpStatus.NOT_FOUND) {
return URI_NOT_FOUND;
}
}
String path = getPathInfo(exchange);
if (path.isEmpty()) {
return URI_ROOT;
}
return URI_UNKNOWN;
} | [
"public",
"static",
"Tag",
"uri",
"(",
"ServerWebExchange",
"exchange",
")",
"{",
"PathPattern",
"pathPattern",
"=",
"exchange",
".",
"getAttribute",
"(",
"HandlerMapping",
".",
"BEST_MATCHING_PATTERN_ATTRIBUTE",
")",
";",
"if",
"(",
"pathPattern",
"!=",
"null",
"... | Creates a {@code uri} tag based on the URI of the given {@code exchange}. Uses the
{@link HandlerMapping#BEST_MATCHING_PATTERN_ATTRIBUTE} best matching pattern if
available. Falling back to {@code REDIRECTION} for 3xx responses, {@code NOT_FOUND}
for 404 responses, {@code root} for requests with no path info, and {@code UNKNOWN}
for all other requests.
@param exchange the exchange
@return the uri tag derived from the exchange | [
"Creates",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java#L98-L118 | train | Returns the URI of the request. | [
30522,
2270,
10763,
6415,
24471,
2072,
1006,
8241,
8545,
4783,
2595,
22305,
2063,
3863,
1007,
1063,
4130,
4502,
12079,
2078,
4130,
4502,
12079,
2078,
1027,
3863,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
28213,
2863,
14853,
1012,
2190,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java | SparkLauncher.findSparkSubmit | String findSparkSubmit() {
String script = isWindows() ? "spark-submit.cmd" : "spark-submit";
return join(File.separator, builder.getSparkHome(), "bin", script);
} | java | String findSparkSubmit() {
String script = isWindows() ? "spark-submit.cmd" : "spark-submit";
return join(File.separator, builder.getSparkHome(), "bin", script);
} | [
"String",
"findSparkSubmit",
"(",
")",
"{",
"String",
"script",
"=",
"isWindows",
"(",
")",
"?",
"\"spark-submit.cmd\"",
":",
"\"spark-submit\"",
";",
"return",
"join",
"(",
"File",
".",
"separator",
",",
"builder",
".",
"getSparkHome",
"(",
")",
",",
"\"bin... | Visible for testing. | [
"Visible",
"for",
"testing",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java#L461-L464 | train | Find SparkSubmit script in SparkHome | [
30522,
5164,
4858,
14432,
6342,
25526,
4183,
1006,
1007,
1063,
5164,
5896,
1027,
2003,
11101,
15568,
1006,
1007,
1029,
1000,
12125,
1011,
12040,
1012,
4642,
2094,
1000,
1024,
1000,
12125,
1011,
30524,
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/ml/LinearRegression.java | LinearRegression.main | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
final int iterations = params.getInt("iterations", 10);
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// get input x data from elements
DataSet<Data> data;
if (params.has("input")) {
// read data from CSV file
data = env.readCsvFile(params.get("input"))
.fieldDelimiter(" ")
.includeFields(true, true)
.pojoType(Data.class);
} else {
System.out.println("Executing LinearRegression example with default input data set.");
System.out.println("Use --input to specify file input.");
data = LinearRegressionData.getDefaultDataDataSet(env);
}
// get the parameters from elements
DataSet<Params> parameters = LinearRegressionData.getDefaultParamsDataSet(env);
// set number of bulk iterations for SGD linear Regression
IterativeDataSet<Params> loop = parameters.iterate(iterations);
DataSet<Params> newParameters = data
// compute a single step using every sample
.map(new SubUpdate()).withBroadcastSet(loop, "parameters")
// sum up all the steps
.reduce(new UpdateAccumulator())
// average the steps and update all parameters
.map(new Update());
// feed new parameters back into next iteration
DataSet<Params> result = loop.closeWith(newParameters);
// emit result
if (params.has("output")) {
result.writeAsText(params.get("output"));
// execute program
env.execute("Linear Regression 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 {
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
final int iterations = params.getInt("iterations", 10);
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// get input x data from elements
DataSet<Data> data;
if (params.has("input")) {
// read data from CSV file
data = env.readCsvFile(params.get("input"))
.fieldDelimiter(" ")
.includeFields(true, true)
.pojoType(Data.class);
} else {
System.out.println("Executing LinearRegression example with default input data set.");
System.out.println("Use --input to specify file input.");
data = LinearRegressionData.getDefaultDataDataSet(env);
}
// get the parameters from elements
DataSet<Params> parameters = LinearRegressionData.getDefaultParamsDataSet(env);
// set number of bulk iterations for SGD linear Regression
IterativeDataSet<Params> loop = parameters.iterate(iterations);
DataSet<Params> newParameters = data
// compute a single step using every sample
.map(new SubUpdate()).withBroadcastSet(loop, "parameters")
// sum up all the steps
.reduce(new UpdateAccumulator())
// average the steps and update all parameters
.map(new Update());
// feed new parameters back into next iteration
DataSet<Params> result = loop.closeWith(newParameters);
// emit result
if (params.has("output")) {
result.writeAsText(params.get("output"));
// execute program
env.execute("Linear Regression 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",
"{",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"// set up execution environment",
"final",
"ExecutionEnvironmen... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/ml/LinearRegression.java#L69-L121 | train | Main method to run the LinearRegression example. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
1007,
1025,
1013,
1013,
2275,
2039,
778... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getMethod | public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException {
if (null == clazz || StrUtil.isBlank(methodName)) {
return null;
}
final Method[] methods = getMethods(clazz);
if (ArrayUtil.isNotEmpty(methods)) {
for (Method method : methods) {
if (StrUtil.equals(methodName, method.getName(), ignoreCase)) {
if (ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)) {
return method;
}
}
}
}
return null;
} | java | public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException {
if (null == clazz || StrUtil.isBlank(methodName)) {
return null;
}
final Method[] methods = getMethods(clazz);
if (ArrayUtil.isNotEmpty(methods)) {
for (Method method : methods) {
if (StrUtil.equals(methodName, method.getName(), ignoreCase)) {
if (ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)) {
return method;
}
}
}
}
return null;
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"ignoreCase",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"throws",
"SecurityException",
"{",
"if",
"(",
"null",
"==",
... | 查找指定方法 如果找不到对应的方法则返回<code>null</code>
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param ignoreCase 是否忽略大小写
@param methodName 方法名,如果为空字符串返回{@code null}
@param paramTypes 参数类型,指定参数类型如果是方法的子类也算
@return 方法
@throws SecurityException 无权访问抛出异常
@since 3.2.0 | [
"查找指定方法",
"如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L450-L466 | train | Gets the method with the specified name and parameter types from the specified class. | [
30522,
2270,
10763,
4118,
2131,
11368,
6806,
2094,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
22017,
20898,
8568,
18382,
1010,
5164,
4118,
18442,
1010,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
11498,
20492,
18863,
2015,
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/util/ArrayUtil.java | ArrayUtil.wrap | public static Boolean[] wrap(boolean... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Boolean[0];
}
final Boolean[] array = new Boolean[length];
for (int i = 0; i < length; i++) {
array[i] = Boolean.valueOf(values[i]);
}
return array;
} | java | public static Boolean[] wrap(boolean... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Boolean[0];
}
final Boolean[] array = new Boolean[length];
for (int i = 0; i < length; i++) {
array[i] = Boolean.valueOf(values[i]);
}
return array;
} | [
"public",
"static",
"Boolean",
"[",
"]",
"wrap",
"(",
"boolean",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
... | 将原始类型数组包装为包装类型
@param values 原始类型数组
@return 包装类型数组 | [
"将原始类型数组包装为包装类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1707-L1721 | train | Wraps the specified boolean array in a single array. | [
30522,
2270,
10763,
22017,
20898,
1031,
1033,
10236,
1006,
22017,
20898,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5300,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
20014,
3091,
1027,
5300,
1012,
3091,
1025,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/io/SplitDataProperties.java | SplitDataProperties.splitsPartitionedBy | public SplitDataProperties<T> splitsPartitionedBy(String partitionMethodId, String partitionFields) {
if (partitionFields == null) {
throw new InvalidProgramException("PartitionFields may not be null.");
}
String[] partitionKeysA = partitionFields.split(";");
if (partitionKeysA.length == 0) {
throw new InvalidProgramException("PartitionFields may not be empty.");
}
this.splitPartitionKeys = getAllFlatKeys(partitionKeysA);
if (partitionMethodId != null) {
this.splitPartitioner = new SourcePartitionerMarker<>(partitionMethodId);
}
else {
this.splitPartitioner = null;
}
return this;
} | java | public SplitDataProperties<T> splitsPartitionedBy(String partitionMethodId, String partitionFields) {
if (partitionFields == null) {
throw new InvalidProgramException("PartitionFields may not be null.");
}
String[] partitionKeysA = partitionFields.split(";");
if (partitionKeysA.length == 0) {
throw new InvalidProgramException("PartitionFields may not be empty.");
}
this.splitPartitionKeys = getAllFlatKeys(partitionKeysA);
if (partitionMethodId != null) {
this.splitPartitioner = new SourcePartitionerMarker<>(partitionMethodId);
}
else {
this.splitPartitioner = null;
}
return this;
} | [
"public",
"SplitDataProperties",
"<",
"T",
">",
"splitsPartitionedBy",
"(",
"String",
"partitionMethodId",
",",
"String",
"partitionFields",
")",
"{",
"if",
"(",
"partitionFields",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidProgramException",
"(",
"\"PartitionF... | Defines that data is partitioned using an identifiable method
across input splits on the fields defined by field expressions.
Multiple field expressions must be separated by the semicolon ';' character.
All records sharing the same key (combination) must be contained in a single input split.
<p><b>
IMPORTANT: Providing wrong information with SplitDataProperties can cause wrong results!
</b>
@param partitionMethodId An ID for the method that was used to partition the data across splits.
@param partitionFields The field expressions of the partitioning keys.
@return This SplitDataProperties object. | [
"Defines",
"that",
"data",
"is",
"partitioned",
"using",
"an",
"identifiable",
"method",
"across",
"input",
"splits",
"on",
"the",
"fields",
"defined",
"by",
"field",
"expressions",
".",
"Multiple",
"field",
"expressions",
"must",
"be",
"separated",
"by",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/SplitDataProperties.java#L166-L186 | train | Splits the data by partitioning by the given method ID. | [
30522,
2270,
3975,
2850,
2696,
21572,
4842,
7368,
1026,
1056,
1028,
19584,
19362,
3775,
3508,
2098,
3762,
1006,
5164,
13571,
11368,
6806,
4305,
2094,
1010,
5164,
13571,
15155,
1007,
1063,
2065,
1006,
13571,
15155,
1027,
1027,
19701,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CoreSynonymDictionary.java | CoreSynonymDictionary.convert | public static List<CommonSynonymDictionary.SynonymItem> convert(List<Term> sentence, boolean withUndefinedItem)
{
List<CommonSynonymDictionary.SynonymItem> synonymItemList = new ArrayList<CommonSynonymDictionary.SynonymItem>(sentence.size());
for (Term term : sentence)
{
CommonSynonymDictionary.SynonymItem item = get(term.word);
if (item == null)
{
if (withUndefinedItem)
{
item = CommonSynonymDictionary.SynonymItem.createUndefined(term.word);
synonymItemList.add(item);
}
}
else
{
synonymItemList.add(item);
}
}
return synonymItemList;
} | java | public static List<CommonSynonymDictionary.SynonymItem> convert(List<Term> sentence, boolean withUndefinedItem)
{
List<CommonSynonymDictionary.SynonymItem> synonymItemList = new ArrayList<CommonSynonymDictionary.SynonymItem>(sentence.size());
for (Term term : sentence)
{
CommonSynonymDictionary.SynonymItem item = get(term.word);
if (item == null)
{
if (withUndefinedItem)
{
item = CommonSynonymDictionary.SynonymItem.createUndefined(term.word);
synonymItemList.add(item);
}
}
else
{
synonymItemList.add(item);
}
}
return synonymItemList;
} | [
"public",
"static",
"List",
"<",
"CommonSynonymDictionary",
".",
"SynonymItem",
">",
"convert",
"(",
"List",
"<",
"Term",
">",
"sentence",
",",
"boolean",
"withUndefinedItem",
")",
"{",
"List",
"<",
"CommonSynonymDictionary",
".",
"SynonymItem",
">",
"synonymItemL... | 将分词结果转换为同义词列表
@param sentence 句子
@param withUndefinedItem 是否保留词典中没有的词语
@return | [
"将分词结果转换为同义词列表"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreSynonymDictionary.java#L118-L140 | train | Convert a list of terms to a list of CommonSynonymDictionary. SynonymItem objects. | [
30522,
2270,
10763,
2862,
1026,
7674,
6038,
16585,
26876,
28097,
5649,
1012,
10675,
4221,
2213,
1028,
10463,
1006,
2862,
1026,
2744,
1028,
6251,
1010,
22017,
20898,
2007,
8630,
28344,
4221,
2213,
1007,
1063,
2862,
1026,
7674,
6038,
16585,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.textToBePresentInElementValue | public static ExpectedCondition<Boolean> textToBePresentInElementValue(final WebElement element,
final String text) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
try {
String elementText = element.getAttribute("value");
if (elementText != null) {
return elementText.contains(text);
}
return false;
} catch (StaleElementReferenceException e) {
return null;
}
}
@Override
public String toString() {
return String.format("text ('%s') to be the value of element %s", text, element);
}
};
} | java | public static ExpectedCondition<Boolean> textToBePresentInElementValue(final WebElement element,
final String text) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
try {
String elementText = element.getAttribute("value");
if (elementText != null) {
return elementText.contains(text);
}
return false;
} catch (StaleElementReferenceException e) {
return null;
}
}
@Override
public String toString() {
return String.format("text ('%s') to be the value of element %s", text, element);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"textToBePresentInElementValue",
"(",
"final",
"WebElement",
"element",
",",
"final",
"String",
"text",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Overri... | An expectation for checking if the given text is present in the specified elements value
attribute.
@param element the WebElement
@param text to be present in the element's value attribute
@return true once the element's value attribute contains the given text | [
"An",
"expectation",
"for",
"checking",
"if",
"the",
"given",
"text",
"is",
"present",
"in",
"the",
"specified",
"elements",
"value",
"attribute",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L405-L427 | train | An expectation for checking WebElement s text to be present in element value. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
3793,
3406,
4783,
28994,
4765,
3170,
16930,
4765,
10175,
5657,
1006,
2345,
4773,
12260,
3672,
5783,
1010,
2345,
5164,
3793,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java | FlinkKafkaProducer011.createTransactionalProducer | private FlinkKafkaProducer<byte[], byte[]> createTransactionalProducer() throws FlinkKafka011Exception {
String transactionalId = availableTransactionalIds.poll();
if (transactionalId == null) {
throw new FlinkKafka011Exception(
FlinkKafka011ErrorCode.PRODUCERS_POOL_EMPTY,
"Too many ongoing snapshots. Increase kafka producers pool size or decrease number of concurrent checkpoints.");
}
FlinkKafkaProducer<byte[], byte[]> producer = initTransactionalProducer(transactionalId, true);
producer.initTransactions();
return producer;
} | java | private FlinkKafkaProducer<byte[], byte[]> createTransactionalProducer() throws FlinkKafka011Exception {
String transactionalId = availableTransactionalIds.poll();
if (transactionalId == null) {
throw new FlinkKafka011Exception(
FlinkKafka011ErrorCode.PRODUCERS_POOL_EMPTY,
"Too many ongoing snapshots. Increase kafka producers pool size or decrease number of concurrent checkpoints.");
}
FlinkKafkaProducer<byte[], byte[]> producer = initTransactionalProducer(transactionalId, true);
producer.initTransactions();
return producer;
} | [
"private",
"FlinkKafkaProducer",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"createTransactionalProducer",
"(",
")",
"throws",
"FlinkKafka011Exception",
"{",
"String",
"transactionalId",
"=",
"availableTransactionalIds",
".",
"poll",
"(",
")",
";",
"if",
... | For each checkpoint we create new {@link FlinkKafkaProducer} so that new transactions will not clash
with transactions created during previous checkpoints ({@code producer.initTransactions()} assures that we
obtain new producerId and epoch counters). | [
"For",
"each",
"checkpoint",
"we",
"create",
"new",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java#L918-L928 | train | Creates a transactional producer. | [
30522,
2797,
13109,
19839,
2912,
24316,
9331,
14127,
18796,
2099,
1026,
24880,
1031,
1033,
1010,
24880,
1031,
1033,
1028,
3443,
6494,
3619,
18908,
19301,
21572,
8566,
17119,
1006,
1007,
11618,
13109,
19839,
2912,
24316,
2050,
24096,
2487,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.