repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.having | public SqlBuilder having(String having) {
if (StrUtil.isNotBlank(having)) {
sql.append(" HAVING ").append(having);
}
return this;
} | java | public SqlBuilder having(String having) {
if (StrUtil.isNotBlank(having)) {
sql.append(" HAVING ").append(having);
}
return this;
} | [
"public",
"SqlBuilder",
"having",
"(",
"String",
"having",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"having",
")",
")",
"{",
"sql",
".",
"append",
"(",
"\" HAVING \"",
")",
".",
"append",
"(",
"having",
")",
";",
"}",
"return",
"this",
... | 添加Having语句
@param having 条件语句
@return 自己 | [
"添加Having语句"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L387-L392 | train | Add a HAVING clause to the query. | [
30522,
2270,
29296,
8569,
23891,
2099,
2383,
1006,
5164,
2383,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
2383,
1007,
1007,
1063,
29296,
1012,
10439,
10497,
1006,
1000,
2383,
1000,
1007,
1012,
10439,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherImpl.java | MetricFetcherImpl.retrieveAndQueryMetrics | private void retrieveAndQueryMetrics(String queryServiceAddress) {
LOG.debug("Retrieve metric query service gateway for {}", queryServiceAddress);
final CompletableFuture<MetricQueryServiceGateway> queryServiceGatewayFuture = queryServiceRetriever.retrieveService(queryServiceAddress);
queryServiceGatewayFuture.whenCompleteAsync(
(MetricQueryServiceGateway queryServiceGateway, Throwable t) -> {
if (t != null) {
LOG.debug("Could not retrieve QueryServiceGateway.", t);
} else {
queryMetrics(queryServiceGateway);
}
},
executor);
} | java | private void retrieveAndQueryMetrics(String queryServiceAddress) {
LOG.debug("Retrieve metric query service gateway for {}", queryServiceAddress);
final CompletableFuture<MetricQueryServiceGateway> queryServiceGatewayFuture = queryServiceRetriever.retrieveService(queryServiceAddress);
queryServiceGatewayFuture.whenCompleteAsync(
(MetricQueryServiceGateway queryServiceGateway, Throwable t) -> {
if (t != null) {
LOG.debug("Could not retrieve QueryServiceGateway.", t);
} else {
queryMetrics(queryServiceGateway);
}
},
executor);
} | [
"private",
"void",
"retrieveAndQueryMetrics",
"(",
"String",
"queryServiceAddress",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Retrieve metric query service gateway for {}\"",
",",
"queryServiceAddress",
")",
";",
"final",
"CompletableFuture",
"<",
"MetricQueryServiceGateway",
... | Retrieves and queries the specified QueryServiceGateway.
@param queryServiceAddress specifying the QueryServiceGateway | [
"Retrieves",
"and",
"queries",
"the",
"specified",
"QueryServiceGateway",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherImpl.java#L187-L201 | train | Retrieve and query metrics. | [
30522,
2797,
11675,
12850,
5685,
4226,
2854,
12589,
2015,
1006,
5164,
23032,
8043,
7903,
13775,
16200,
4757,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
12850,
12046,
23032,
2326,
11909,
2005,
1063,
1065,
1000,
1010,
23032,
8043,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.duplicate | public final LogBuffer duplicate(final int pos, final int len) {
if (pos + len > limit) throw new IllegalArgumentException("limit excceed: " + (pos + len));
// XXX: Do momery copy avoid buffer modified.
final int off = origin + pos;
byte[] buf = Arrays.copyOfRange(buffer, off, off + len);
return new LogBuffer(buf, 0, len);
} | java | public final LogBuffer duplicate(final int pos, final int len) {
if (pos + len > limit) throw new IllegalArgumentException("limit excceed: " + (pos + len));
// XXX: Do momery copy avoid buffer modified.
final int off = origin + pos;
byte[] buf = Arrays.copyOfRange(buffer, off, off + len);
return new LogBuffer(buf, 0, len);
} | [
"public",
"final",
"LogBuffer",
"duplicate",
"(",
"final",
"int",
"pos",
",",
"final",
"int",
"len",
")",
"{",
"if",
"(",
"pos",
"+",
"len",
">",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"pos",
"+",
... | Return n bytes in this buffer. | [
"Return",
"n",
"bytes",
"in",
"this",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L40-L47 | train | Creates a duplicate of this buffer. | [
30522,
2270,
2345,
8833,
8569,
12494,
24473,
1006,
2345,
20014,
13433,
2015,
1010,
2345,
20014,
18798,
1007,
1063,
2065,
1006,
13433,
2015,
1009,
18798,
1028,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlEngine.java | BeetlEngine.getTemplate | @Override
public Template getTemplate(String resource) {
return BeetlTemplate.wrap(engine.getTemplate(resource));
} | java | @Override
public Template getTemplate(String resource) {
return BeetlTemplate.wrap(engine.getTemplate(resource));
} | [
"@",
"Override",
"public",
"Template",
"getTemplate",
"(",
"String",
"resource",
")",
"{",
"return",
"BeetlTemplate",
".",
"wrap",
"(",
"engine",
".",
"getTemplate",
"(",
"resource",
")",
")",
";",
"}"
] | --------------------------------------------------------------------------------- Constructor end | [
"---------------------------------------------------------------------------------",
"Constructor",
"end"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlEngine.java#L55-L58 | train | Override this method to return a BeetlTemplate object that wraps the template in BeetlTemplate. | [
30522,
1030,
2058,
15637,
2270,
23561,
2131,
18532,
15725,
1006,
5164,
7692,
1007,
1063,
2709,
10506,
19646,
18532,
15725,
1012,
10236,
1006,
3194,
1012,
2131,
18532,
15725,
1006,
7692,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.setField | public DateTime setField(int field, int value) {
final Calendar calendar = toCalendar();
calendar.set(field, value);
DateTime dt = this;
if (false == mutable) {
dt = ObjectUtil.clone(this);
}
return dt.setTimeInternal(calendar.getTimeInMillis());
} | java | public DateTime setField(int field, int value) {
final Calendar calendar = toCalendar();
calendar.set(field, value);
DateTime dt = this;
if (false == mutable) {
dt = ObjectUtil.clone(this);
}
return dt.setTimeInternal(calendar.getTimeInMillis());
} | [
"public",
"DateTime",
"setField",
"(",
"int",
"field",
",",
"int",
"value",
")",
"{",
"final",
"Calendar",
"calendar",
"=",
"toCalendar",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"field",
",",
"value",
")",
";",
"DateTime",
"dt",
"=",
"this",
";",
... | 设置日期的某个部分<br>
如果此对象为可变对象,返回自身,否则返回新对象,设置是否可变对象见{@link #setMutable(boolean)}
@param field 表示日期的哪个部分的int值 {@link Calendar}
@param value 值
@return {@link DateTime} | [
"设置日期的某个部分<br",
">",
"如果此对象为可变对象,返回自身,否则返回新对象,设置是否可变对象见",
"{",
"@link",
"#setMutable",
"(",
"boolean",
")",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L263-L272 | train | Sets the value of the specified field in this date time. | [
30522,
2270,
3058,
7292,
2275,
3790,
1006,
20014,
2492,
1010,
20014,
3643,
1007,
1063,
2345,
8094,
8094,
1027,
2000,
9289,
10497,
2906,
1006,
1007,
1025,
8094,
1012,
2275,
1006,
2492,
1010,
3643,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java | Singleton.get | @SuppressWarnings("unchecked")
public static <T> T get(Class<T> clazz, Object... params) {
T obj = (T) pool.get(clazz);
if (null == obj) {
synchronized (Singleton.class) {
obj = (T) pool.get(clazz);
if (null == obj) {
obj = ReflectUtil.newInstance(clazz, params);
pool.put(clazz, obj);
}
}
}
return obj;
} | java | @SuppressWarnings("unchecked")
public static <T> T get(Class<T> clazz, Object... params) {
T obj = (T) pool.get(clazz);
if (null == obj) {
synchronized (Singleton.class) {
obj = (T) pool.get(clazz);
if (null == obj) {
obj = ReflectUtil.newInstance(clazz, params);
pool.put(clazz, obj);
}
}
}
return obj;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Object",
"...",
"params",
")",
"{",
"T",
"obj",
"=",
"(",
"T",
")",
"pool",
".",
"get",
"(",
"clazz",
"... | 获得指定类的单例对象<br>
对象存在于池中返回,否则创建,每次调用此方法获得的对象为同一个对象<br>
注意:单例针对的是类和对象,因此get方法第一次调用时创建的对象始终唯一,也就是说就算参数变更,返回的依旧是第一次创建的对象
@param <T> 单例对象类型
@param clazz 类
@param params 构造方法参数
@return 单例对象 | [
"获得指定类的单例对象<br",
">",
"对象存在于池中返回,否则创建,每次调用此方法获得的对象为同一个对象<br",
">",
"注意:单例针对的是类和对象,因此get方法第一次调用时创建的对象始终唯一,也就是说就算参数变更,返回的依旧是第一次创建的对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Singleton.java#L33-L48 | train | Gets a managed object from the managed object pool. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
2131,
1006,
2465,
1026,
1056,
1028,
18856,
10936,
2480,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
1063,
1056,
27885... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.socketTextStream | @Deprecated
public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter, long maxRetry) {
return socketTextStream(hostname, port, String.valueOf(delimiter), maxRetry);
} | java | @Deprecated
public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter, long maxRetry) {
return socketTextStream(hostname, port, String.valueOf(delimiter), maxRetry);
} | [
"@",
"Deprecated",
"public",
"DataStreamSource",
"<",
"String",
">",
"socketTextStream",
"(",
"String",
"hostname",
",",
"int",
"port",
",",
"char",
"delimiter",
",",
"long",
"maxRetry",
")",
"{",
"return",
"socketTextStream",
"(",
"hostname",
",",
"port",
","... | Creates a new data stream that contains the strings received infinitely from a socket. Received strings are
decoded by the system's default character set. On the termination of the socket server connection retries can be
initiated.
<p>Let us note that the socket itself does not report on abort and as a consequence retries are only initiated when
the socket was gracefully terminated.
@param hostname
The host name which a server socket binds
@param port
The port number which a server socket binds. A port number of 0 means that the port number is automatically
allocated.
@param delimiter
A character which splits received strings into records
@param maxRetry
The maximal retry interval in seconds while the program waits for a socket that is temporarily down.
Reconnection is initiated every second. A number of 0 means that the reader is immediately terminated,
while
a negative value ensures retrying forever.
@return A data stream containing the strings received from the socket
@deprecated Use {@link #socketTextStream(String, int, String, long)} instead. | [
"Creates",
"a",
"new",
"data",
"stream",
"that",
"contains",
"the",
"strings",
"received",
"infinitely",
"from",
"a",
"socket",
".",
"Received",
"strings",
"are",
"decoded",
"by",
"the",
"system",
"s",
"default",
"character",
"set",
".",
"On",
"the",
"termin... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1187-L1190 | train | Returns a DataStreamSource that reads from the specified socket address using the specified delimiter. | [
30522,
1030,
2139,
28139,
12921,
2270,
2951,
21422,
6499,
3126,
3401,
1026,
5164,
1028,
22278,
18209,
21422,
1006,
5164,
3677,
18442,
1010,
20014,
3417,
1010,
25869,
3972,
27605,
3334,
1010,
2146,
4098,
13465,
2854,
1007,
1063,
2709,
22278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractStatementExecutor.java | AbstractStatementExecutor.clear | public void clear() throws SQLException {
clearStatements();
statements.clear();
parameterSets.clear();
connections.clear();
resultSets.clear();
executeGroups.clear();
} | java | public void clear() throws SQLException {
clearStatements();
statements.clear();
parameterSets.clear();
connections.clear();
resultSets.clear();
executeGroups.clear();
} | [
"public",
"void",
"clear",
"(",
")",
"throws",
"SQLException",
"{",
"clearStatements",
"(",
")",
";",
"statements",
".",
"clear",
"(",
")",
";",
"parameterSets",
".",
"clear",
"(",
")",
";",
"connections",
".",
"clear",
"(",
")",
";",
"resultSets",
".",
... | Clear data.
@throws SQLException sql exception | [
"Clear",
"data",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/AbstractStatementExecutor.java#L142-L149 | train | Clear all the caches. | [
30522,
2270,
11675,
3154,
1006,
1007,
11618,
29296,
10288,
24422,
1063,
28837,
12259,
8163,
1006,
1007,
1025,
8635,
1012,
3154,
1006,
1007,
1025,
11709,
8454,
1012,
3154,
1006,
1007,
1025,
7264,
1012,
3154,
1006,
1007,
1025,
3463,
8454,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/StandaloneLeaderRetrievalService.java | StandaloneLeaderRetrievalService.start | @Override
public void start(LeaderRetrievalListener listener) {
checkNotNull(listener, "Listener must not be null.");
synchronized (startStopLock) {
checkState(!started, "StandaloneLeaderRetrievalService can only be started once.");
started = true;
// directly notify the listener, because we already know the leading JobManager's address
listener.notifyLeaderAddress(leaderAddress, leaderId);
}
} | java | @Override
public void start(LeaderRetrievalListener listener) {
checkNotNull(listener, "Listener must not be null.");
synchronized (startStopLock) {
checkState(!started, "StandaloneLeaderRetrievalService can only be started once.");
started = true;
// directly notify the listener, because we already know the leading JobManager's address
listener.notifyLeaderAddress(leaderAddress, leaderId);
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
"LeaderRetrievalListener",
"listener",
")",
"{",
"checkNotNull",
"(",
"listener",
",",
"\"Listener must not be null.\"",
")",
";",
"synchronized",
"(",
"startStopLock",
")",
"{",
"checkState",
"(",
"!",
"started",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/StandaloneLeaderRetrievalService.java#L76-L87 | train | Start the stand alone leader retrieval service. | [
30522,
1030,
2058,
15637,
2270,
11675,
2707,
1006,
3003,
13465,
7373,
10175,
9863,
24454,
19373,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
19373,
1010,
1000,
19373,
2442,
2025,
2022,
19701,
1012,
1000,
1007,
1025,
25549,
1006,
4627,
14399,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java | BeanCopier.create | public static <T> BeanCopier<T> create(Object source, T dest, Type destType, CopyOptions copyOptions) {
return new BeanCopier<>(source, dest, destType, copyOptions);
} | java | public static <T> BeanCopier<T> create(Object source, T dest, Type destType, CopyOptions copyOptions) {
return new BeanCopier<>(source, dest, destType, copyOptions);
} | [
"public",
"static",
"<",
"T",
">",
"BeanCopier",
"<",
"T",
">",
"create",
"(",
"Object",
"source",
",",
"T",
"dest",
",",
"Type",
"destType",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"return",
"new",
"BeanCopier",
"<>",
"(",
"source",
",",
"dest",
... | 创建BeanCopier
@param <T> 目标Bean类型
@param source 来源对象,可以是Bean或者Map
@param dest 目标Bean对象
@param destType 目标的泛型类型,用于标注有泛型参数的Bean对象
@param copyOptions 拷贝属性选项
@return BeanCopier | [
"创建BeanCopier"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L68-L70 | train | Creates a new instance of a BeanCopier. | [
30522,
2270,
10763,
1026,
1056,
1028,
14068,
3597,
14756,
2099,
1026,
1056,
1028,
3443,
1006,
4874,
3120,
1010,
1056,
4078,
2102,
1010,
2828,
4078,
15353,
5051,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2709,
2047,
14068,
3597,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/windowing/triggers/ContinuousProcessingTimeTrigger.java | ContinuousProcessingTimeTrigger.of | public static <W extends Window> ContinuousProcessingTimeTrigger<W> of(Time interval) {
return new ContinuousProcessingTimeTrigger<>(interval.toMilliseconds());
} | java | public static <W extends Window> ContinuousProcessingTimeTrigger<W> of(Time interval) {
return new ContinuousProcessingTimeTrigger<>(interval.toMilliseconds());
} | [
"public",
"static",
"<",
"W",
"extends",
"Window",
">",
"ContinuousProcessingTimeTrigger",
"<",
"W",
">",
"of",
"(",
"Time",
"interval",
")",
"{",
"return",
"new",
"ContinuousProcessingTimeTrigger",
"<>",
"(",
"interval",
".",
"toMilliseconds",
"(",
")",
")",
... | Creates a trigger that continuously fires based on the given interval.
@param interval The time interval at which to fire.
@param <W> The type of {@link Window Windows} on which this trigger can operate. | [
"Creates",
"a",
"trigger",
"that",
"continuously",
"fires",
"based",
"on",
"the",
"given",
"interval",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/ContinuousProcessingTimeTrigger.java#L121-L123 | train | Create a new continuous processing time trigger. | [
30522,
2270,
10763,
1026,
1059,
8908,
3332,
1028,
7142,
21572,
9623,
7741,
7292,
18886,
13327,
1026,
1059,
1028,
1997,
1006,
2051,
13483,
1007,
1063,
2709,
2047,
7142,
21572,
9623,
7741,
7292,
18886,
13327,
1026,
1028,
1006,
13483,
1012,
34... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getResource | public static URL getResource(String resource, Class<?> baseClass) {
return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
} | java | public static URL getResource(String resource, Class<?> baseClass) {
return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
} | [
"public",
"static",
"URL",
"getResource",
"(",
"String",
"resource",
",",
"Class",
"<",
"?",
">",
"baseClass",
")",
"{",
"return",
"(",
"null",
"!=",
"baseClass",
")",
"?",
"baseClass",
".",
"getResource",
"(",
"resource",
")",
":",
"ClassLoaderUtil",
".",... | 获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL} | [
"获得资源相对路径对应的URL"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L159-L161 | train | Get the URL of the resource. | [
30522,
2270,
10763,
24471,
2140,
2131,
6072,
8162,
3401,
1006,
5164,
7692,
1010,
2465,
1026,
1029,
1028,
2918,
26266,
1007,
1063,
2709,
1006,
19701,
999,
1027,
2918,
26266,
1007,
1029,
2918,
26266,
1012,
2131,
6072,
8162,
3401,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static BufferedImage cut(Image srcImage, int x, int y) {
return cut(srcImage, x, y, -1);
} | java | public static BufferedImage cut(Image srcImage, int x, int y) {
return cut(srcImage, x, y, -1);
} | [
"public",
"static",
"BufferedImage",
"cut",
"(",
"Image",
"srcImage",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"return",
"cut",
"(",
"srcImage",
",",
"x",
",",
"y",
",",
"-",
"1",
")",
";",
"}"
] | 图像切割(按指定起点坐标和宽高切割),填充满整个图片(直径取长宽最小值)
@param srcImage 源图像
@param x 原图的x坐标起始位置
@param y 原图的y坐标起始位置
@return {@link BufferedImage}
@since 4.1.15 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")",
",填充满整个图片(直径取长宽最小值)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L344-L346 | train | Cut the image around the specified coordinates. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
3013,
1006,
3746,
5034,
6895,
26860,
1010,
20014,
1060,
1010,
20014,
1061,
1007,
1063,
2709,
3013,
1006,
5034,
6895,
26860,
1010,
1060,
1010,
1061,
1010,
1011,
1015,
1007,
1025,
1065,
102,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/websocketx/WebSocketClientHandshaker.java | WebSocketClientHandshaker.close | public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
if (channel == null) {
throw new NullPointerException("channel");
}
channel.writeAndFlush(frame, promise);
applyForceCloseTimeout(channel, promise);
return promise;
} | java | public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
if (channel == null) {
throw new NullPointerException("channel");
}
channel.writeAndFlush(frame, promise);
applyForceCloseTimeout(channel, promise);
return promise;
} | [
"public",
"ChannelFuture",
"close",
"(",
"Channel",
"channel",
",",
"CloseWebSocketFrame",
"frame",
",",
"ChannelPromise",
"promise",
")",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"channel\"",
")",
";",
... | Performs the closing handshake
@param channel
Channel
@param frame
Closing Frame that was received
@param promise
the {@link ChannelPromise} to be notified when the closing handshake is done | [
"Performs",
"the",
"closing",
"handshake"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L490-L497 | train | Sends a CloseWebSocketFrame to the channel. | [
30522,
2270,
3149,
11263,
11244,
2485,
1006,
3149,
3149,
1010,
2485,
8545,
5910,
7432,
3388,
15643,
4853,
1010,
3149,
21572,
28732,
4872,
1007,
1063,
2065,
1006,
3149,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
2442... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java | SourceStreamTask.triggerCheckpoint | @Override
public boolean triggerCheckpoint(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) throws Exception {
if (!externallyInducedCheckpoints) {
return super.triggerCheckpoint(checkpointMetaData, checkpointOptions, advanceToEndOfEventTime);
}
else {
// we do not trigger checkpoints here, we simply state whether we can trigger them
synchronized (getCheckpointLock()) {
return isRunning();
}
}
} | java | @Override
public boolean triggerCheckpoint(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) throws Exception {
if (!externallyInducedCheckpoints) {
return super.triggerCheckpoint(checkpointMetaData, checkpointOptions, advanceToEndOfEventTime);
}
else {
// we do not trigger checkpoints here, we simply state whether we can trigger them
synchronized (getCheckpointLock()) {
return isRunning();
}
}
} | [
"@",
"Override",
"public",
"boolean",
"triggerCheckpoint",
"(",
"CheckpointMetaData",
"checkpointMetaData",
",",
"CheckpointOptions",
"checkpointOptions",
",",
"boolean",
"advanceToEndOfEventTime",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"externallyInducedCheckpoin... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java#L121-L132 | train | This method is used to trigger a checkpoint. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
9495,
5403,
3600,
8400,
1006,
26520,
11368,
8447,
2696,
26520,
11368,
8447,
2696,
1010,
26520,
7361,
9285,
26520,
7361,
9285,
1010,
22017,
20898,
5083,
3406,
10497,
11253,
18697,
3372,
7292,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setMethod | public SoapClient setMethod(QName name, Map<String, Object> params, boolean useMethodPrefix) {
setMethod(name);
final String prefix = name.getPrefix();
final SOAPBodyElement methodEle = this.methodEle;
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(methodEle, entry.getKey(), entry.getValue(), prefix);
}
return this;
} | java | public SoapClient setMethod(QName name, Map<String, Object> params, boolean useMethodPrefix) {
setMethod(name);
final String prefix = name.getPrefix();
final SOAPBodyElement methodEle = this.methodEle;
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(methodEle, entry.getKey(), entry.getValue(), prefix);
}
return this;
} | [
"public",
"SoapClient",
"setMethod",
"(",
"QName",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"boolean",
"useMethodPrefix",
")",
"{",
"setMethod",
"(",
"name",
")",
";",
"final",
"String",
"prefix",
"=",
"name",
".",
"getPrefix",... | 设置请求方法
@param name 方法名及其命名空间
@param params 参数
@param useMethodPrefix 是否使用方法的命名空间前缀
@return this | [
"设置请求方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L236-L245 | train | Sets the SOAP method. | [
30522,
2270,
7815,
20464,
11638,
2275,
11368,
6806,
2094,
1006,
1053,
18442,
2171,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
11498,
5244,
1010,
22017,
20898,
2224,
11368,
6806,
18927,
2890,
8873,
2595,
1007,
1063,
2275,
11368,
6806,
2094,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.registerNamespace | protected void registerNamespace(
SqlValidatorScope usingScope,
String alias,
SqlValidatorNamespace ns,
boolean forceNullable) {
namespaces.put(ns.getNode(), ns);
if (usingScope != null) {
usingScope.addChild(ns, alias, forceNullable);
}
} | java | protected void registerNamespace(
SqlValidatorScope usingScope,
String alias,
SqlValidatorNamespace ns,
boolean forceNullable) {
namespaces.put(ns.getNode(), ns);
if (usingScope != null) {
usingScope.addChild(ns, alias, forceNullable);
}
} | [
"protected",
"void",
"registerNamespace",
"(",
"SqlValidatorScope",
"usingScope",
",",
"String",
"alias",
",",
"SqlValidatorNamespace",
"ns",
",",
"boolean",
"forceNullable",
")",
"{",
"namespaces",
".",
"put",
"(",
"ns",
".",
"getNode",
"(",
")",
",",
"ns",
"... | Registers a new namespace, and adds it as a child of its parent scope.
Derived class can override this method to tinker with namespaces as they
are created.
@param usingScope Parent scope (which will want to look for things in
this namespace)
@param alias Alias by which parent will refer to this namespace
@param ns Namespace
@param forceNullable Whether to force the type of namespace to be nullable | [
"Registers",
"a",
"new",
"namespace",
"and",
"adds",
"it",
"as",
"a",
"child",
"of",
"its",
"parent",
"scope",
".",
"Derived",
"class",
"can",
"override",
"this",
"method",
"to",
"tinker",
"with",
"namespaces",
"as",
"they",
"are",
"created",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1939-L1948 | train | Registers a namespace with the namespace manager. | [
30522,
5123,
11675,
4236,
18442,
23058,
1006,
29296,
10175,
8524,
6591,
16186,
2478,
26127,
1010,
5164,
14593,
1010,
29296,
10175,
8524,
4263,
18442,
23058,
24978,
1010,
22017,
20898,
2486,
11231,
4571,
3468,
1007,
1063,
3415,
15327,
2015,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java | BinTrie.commonPrefixSearchWithValue | public LinkedList<Map.Entry<String, V>> commonPrefixSearchWithValue(String key)
{
char[] chars = key.toCharArray();
return commonPrefixSearchWithValue(chars, 0);
} | java | public LinkedList<Map.Entry<String, V>> commonPrefixSearchWithValue(String key)
{
char[] chars = key.toCharArray();
return commonPrefixSearchWithValue(chars, 0);
} | [
"public",
"LinkedList",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"commonPrefixSearchWithValue",
"(",
"String",
"key",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"key",
".",
"toCharArray",
"(",
")",
";",
"return",
"commonPrefixSearchWithV... | 前缀查询,包含值
@param key 键
@return 键值对列表 | [
"前缀查询,包含值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L241-L245 | train | Returns a list of entries that are common to all the keys in the cache. | [
30522,
2270,
5799,
9863,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
2691,
28139,
8873,
2595,
17310,
11140,
24415,
10175,
5657,
1006,
5164,
3145,
1007,
1063,
25869,
1031,
1033,
25869,
2015,
1027,
3145,
1012,
2000,
7507,
1984... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.removeAll | public static String removeAll(final String text, final Pattern regex) {
return replaceAll(text, regex, StringUtils.EMPTY);
} | java | public static String removeAll(final String text, final Pattern regex) {
return replaceAll(text, regex, StringUtils.EMPTY);
} | [
"public",
"static",
"String",
"removeAll",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
")",
"{",
"return",
"replaceAll",
"(",
"text",
",",
"regex",
",",
"StringUtils",
".",
"EMPTY",
")",
";",
"}"
] | <p>Removes each substring of the text String that matches the given regular expression pattern.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceAll(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.removeAll(null, *) = null
StringUtils.removeAll("any", (Pattern) null) = "any"
StringUtils.removeAll("any", Pattern.compile("")) = "any"
StringUtils.removeAll("any", Pattern.compile(".*")) = ""
StringUtils.removeAll("any", Pattern.compile(".+")) = ""
StringUtils.removeAll("abc", Pattern.compile(".?")) = ""
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123"
</pre>
@param text text to remove from, may be null
@param regex the regular expression to which this string is to be matched
@return the text with any removes processed,
{@code null} if null String input
@see #replaceAll(String, Pattern, String)
@see java.util.regex.Matcher#replaceAll(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Removes",
"each",
"substring",
"of",
"the",
"text",
"String",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"pattern",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L60-L62 | train | Removes all occurrences of the given regular expression from the given text. | [
30522,
2270,
10763,
5164,
6366,
8095,
1006,
2345,
5164,
3793,
1010,
2345,
5418,
19723,
10288,
1007,
1063,
2709,
5672,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.trimStrFields | public static <T> T trimStrFields(T bean, String... ignoreFields) {
if (bean == null) {
return bean;
}
final Field[] fields = ReflectUtil.getFields(bean.getClass());
for (Field field : fields) {
if (ignoreFields != null && ArrayUtil.containsIgnoreCase(ignoreFields, field.getName())) {
// 不处理忽略的Fields
continue;
}
if (String.class.equals(field.getType())) {
// 只有String的Field才处理
final String val = (String) ReflectUtil.getFieldValue(bean, field);
if (null != val) {
final String trimVal = StrUtil.trim(val);
if (false == val.equals(trimVal)) {
// Field Value不为null,且首尾有空格才处理
ReflectUtil.setFieldValue(bean, field, trimVal);
}
}
}
}
return bean;
} | java | public static <T> T trimStrFields(T bean, String... ignoreFields) {
if (bean == null) {
return bean;
}
final Field[] fields = ReflectUtil.getFields(bean.getClass());
for (Field field : fields) {
if (ignoreFields != null && ArrayUtil.containsIgnoreCase(ignoreFields, field.getName())) {
// 不处理忽略的Fields
continue;
}
if (String.class.equals(field.getType())) {
// 只有String的Field才处理
final String val = (String) ReflectUtil.getFieldValue(bean, field);
if (null != val) {
final String trimVal = StrUtil.trim(val);
if (false == val.equals(trimVal)) {
// Field Value不为null,且首尾有空格才处理
ReflectUtil.setFieldValue(bean, field, trimVal);
}
}
}
}
return bean;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"trimStrFields",
"(",
"T",
"bean",
",",
"String",
"...",
"ignoreFields",
")",
"{",
"if",
"(",
"bean",
"==",
"null",
")",
"{",
"return",
"bean",
";",
"}",
"final",
"Field",
"[",
"]",
"fields",
"=",
"ReflectUtil"... | 把Bean里面的String属性做trim操作。
通常bean直接用来绑定页面的input,用户的输入可能首尾存在空格,通常保存数据库前需要把首尾空格去掉
@param <T> Bean类型
@param bean Bean对象
@param ignoreFields 不需要trim的Field名称列表(不区分大小写) | [
"把Bean里面的String属性做trim操作。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L648-L673 | train | Trims all string fields from the bean and ignore fields. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
12241,
3367,
12881,
12891,
2015,
1006,
1056,
14068,
1010,
5164,
1012,
1012,
1012,
8568,
15155,
1007,
1063,
2065,
1006,
14068,
1027,
1027,
19701,
1007,
1063,
2709,
14068,
1025,
1065,
2345,
2492,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/overlays/AbstractContainerOverlay.java | AbstractContainerOverlay.addPathRecursively | protected void addPathRecursively(
final File sourcePath, final Path targetPath, final ContainerSpecification env) throws IOException {
final java.nio.file.Path sourceRoot = sourcePath.toPath().getParent();
Files.walkFileTree(sourcePath.toPath(), new SimpleFileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException {
java.nio.file.Path relativePath = sourceRoot.relativize(file);
ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder()
.setSource(new Path(file.toUri()))
.setDest(new Path(targetPath, relativePath.toString()))
.setExecutable(Files.isExecutable(file))
.setCachable(true)
.setExtract(false);
env.getArtifacts().add(artifact.build());
return super.visitFile(file, attrs);
}
});
} | java | protected void addPathRecursively(
final File sourcePath, final Path targetPath, final ContainerSpecification env) throws IOException {
final java.nio.file.Path sourceRoot = sourcePath.toPath().getParent();
Files.walkFileTree(sourcePath.toPath(), new SimpleFileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException {
java.nio.file.Path relativePath = sourceRoot.relativize(file);
ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder()
.setSource(new Path(file.toUri()))
.setDest(new Path(targetPath, relativePath.toString()))
.setExecutable(Files.isExecutable(file))
.setCachable(true)
.setExtract(false);
env.getArtifacts().add(artifact.build());
return super.visitFile(file, attrs);
}
});
} | [
"protected",
"void",
"addPathRecursively",
"(",
"final",
"File",
"sourcePath",
",",
"final",
"Path",
"targetPath",
",",
"final",
"ContainerSpecification",
"env",
")",
"throws",
"IOException",
"{",
"final",
"java",
".",
"nio",
".",
"file",
".",
"Path",
"sourceRoo... | Add a path recursively to the container specification.
If the path is a directory, the directory itself (not just its contents) is added to the target path.
The execute bit is preserved; permissions aren't.
@param sourcePath the path to add.
@param targetPath the target path.
@param env the specification to mutate.
@throws IOException | [
"Add",
"a",
"path",
"recursively",
"to",
"the",
"container",
"specification",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/overlays/AbstractContainerOverlay.java#L48-L71 | train | Add a path recursively to the container specification. | [
30522,
5123,
11675,
5587,
15069,
2890,
10841,
2869,
14547,
1006,
2345,
5371,
3120,
15069,
1010,
2345,
4130,
4539,
15069,
1010,
2345,
16143,
5051,
6895,
10803,
4372,
2615,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
9262,
1012,
9152,
2080,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.getRoot | public static String getRoot(String url) {
if (StringUtils.isBlank(url)) {
return null;
}
return RegExUtils.replacePattern(url, "(.*?://.*?)([/?#].*)", "$1");
} | java | public static String getRoot(String url) {
if (StringUtils.isBlank(url)) {
return null;
}
return RegExUtils.replacePattern(url, "(.*?://.*?)([/?#].*)", "$1");
} | [
"public",
"static",
"String",
"getRoot",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"RegExUtils",
".",
"replacePattern",
"(",
"url",
",",
"\"(.*?://.*?)([/?#].*... | <p>Gets the root of a URL. That is the left part of a URL up to and
including the host name. A <code>null</code> or empty string returns
a <code>null</code> document root.
This method is a short form of:<br>
<code>new HttpURL("http://example.com/path").getRoot();</code>
</p>
@param url a URL string
@return left part of a URL up to (and including the host name
@since 1.8.0 | [
"<p",
">",
"Gets",
"the",
"root",
"of",
"a",
"URL",
".",
"That",
"is",
"the",
"left",
"part",
"of",
"a",
"URL",
"up",
"to",
"and",
"including",
"the",
"host",
"name",
".",
"A",
"<code",
">",
"null<",
"/",
"code",
">",
"or",
"empty",
"string",
"re... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L348-L353 | train | Get the root of the URL. | [
30522,
2270,
10763,
5164,
2131,
3217,
4140,
1006,
5164,
24471,
2140,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
2003,
28522,
8950,
1006,
24471,
2140,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
19723,
10288,
21823,
4877,
1012,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-redis/src/main/java/io/netty/handler/codec/redis/RedisEncoder.java | RedisEncoder.writeArrayHeader | private void writeArrayHeader(ByteBufAllocator allocator, ArrayHeaderRedisMessage msg, List<Object> out) {
writeArrayHeader(allocator, msg.isNull(), msg.length(), out);
} | java | private void writeArrayHeader(ByteBufAllocator allocator, ArrayHeaderRedisMessage msg, List<Object> out) {
writeArrayHeader(allocator, msg.isNull(), msg.length(), out);
} | [
"private",
"void",
"writeArrayHeader",
"(",
"ByteBufAllocator",
"allocator",
",",
"ArrayHeaderRedisMessage",
"msg",
",",
"List",
"<",
"Object",
">",
"out",
")",
"{",
"writeArrayHeader",
"(",
"allocator",
",",
"msg",
".",
"isNull",
"(",
")",
",",
"msg",
".",
... | Write array header only without body. Use this if you want to write arrays as streaming. | [
"Write",
"array",
"header",
"only",
"without",
"body",
".",
"Use",
"this",
"if",
"you",
"want",
"to",
"write",
"arrays",
"as",
"streaming",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-redis/src/main/java/io/netty/handler/codec/redis/RedisEncoder.java#L167-L169 | train | Write array header. | [
30522,
2797,
11675,
4339,
2906,
9447,
4974,
2121,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
9140,
4974,
28849,
10521,
7834,
3736,
3351,
5796,
2290,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
1063,
4339,
2906,
9447,
4974... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/py/String2PinyinConverter.java | String2PinyinConverter.makeToneToTheSame | public static List<Pinyin> makeToneToTheSame(List<Pinyin> pinyinList)
{
ListIterator<Pinyin> listIterator = pinyinList.listIterator();
while (listIterator.hasNext())
{
listIterator.set(convert2Tone5(listIterator.next()));
}
return pinyinList;
} | java | public static List<Pinyin> makeToneToTheSame(List<Pinyin> pinyinList)
{
ListIterator<Pinyin> listIterator = pinyinList.listIterator();
while (listIterator.hasNext())
{
listIterator.set(convert2Tone5(listIterator.next()));
}
return pinyinList;
} | [
"public",
"static",
"List",
"<",
"Pinyin",
">",
"makeToneToTheSame",
"(",
"List",
"<",
"Pinyin",
">",
"pinyinList",
")",
"{",
"ListIterator",
"<",
"Pinyin",
">",
"listIterator",
"=",
"pinyinList",
".",
"listIterator",
"(",
")",
";",
"while",
"(",
"listIterat... | 将所有音调都转为1
@param pinyinList
@return | [
"将所有音调都转为1"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java#L177-L186 | train | Make the Tone to the same. | [
30522,
2270,
10763,
2862,
1026,
9973,
1028,
2191,
5524,
3406,
24138,
14074,
1006,
2862,
1026,
9973,
1028,
9973,
9863,
1007,
1063,
2862,
21646,
8844,
1026,
9973,
1028,
2862,
21646,
8844,
1027,
9973,
9863,
1012,
2862,
21646,
8844,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offsetDay | public static DateTime offsetDay(Date date, int offset) {
return offset(date, DateField.DAY_OF_YEAR, offset);
} | java | public static DateTime offsetDay(Date date, int offset) {
return offset(date, DateField.DAY_OF_YEAR, offset);
} | [
"public",
"static",
"DateTime",
"offsetDay",
"(",
"Date",
"date",
",",
"int",
"offset",
")",
"{",
"return",
"offset",
"(",
"date",
",",
"DateField",
".",
"DAY_OF_YEAR",
",",
"offset",
")",
";",
"}"
] | 偏移天
@param date 日期
@param offset 偏移天数,正数向未来偏移,负数向历史偏移
@return 偏移后的日期 | [
"偏移天"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1164-L1166 | train | Create an offset from a date. | [
30522,
2270,
10763,
3058,
7292,
16396,
10259,
1006,
3058,
3058,
1010,
20014,
16396,
1007,
1063,
2709,
16396,
1006,
3058,
1010,
3058,
3790,
1012,
2154,
1035,
1997,
1035,
2095,
1010,
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,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.load | public static <T> T load(File file, Charset charset, ReaderHandler<T> readerHandler) throws IORuntimeException {
return FileReader.create(file, charset).read(readerHandler);
} | java | public static <T> T load(File file, Charset charset, ReaderHandler<T> readerHandler) throws IORuntimeException {
return FileReader.create(file, charset).read(readerHandler);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"load",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"ReaderHandler",
"<",
"T",
">",
"readerHandler",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileReader",
".",
"create",
"(",
"file",
",",
"charse... | 按照给定的readerHandler读取文件中的数据
@param <T> 集合类型
@param readerHandler Reader处理类
@param file 文件
@param charset 字符集
@return 从文件中load出的数据
@throws IORuntimeException IO异常
@since 3.1.1 | [
"按照给定的readerHandler读取文件中的数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2545-L2547 | train | Load a file into an object. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
7170,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
8068,
11774,
3917,
1026,
1056,
1028,
8068,
11774,
3917,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
16416,
4063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.getBoolean | public static boolean getBoolean(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 1)) {
return segments[0].getBoolean(offset);
} else {
return getBooleanMultiSegments(segments, offset);
}
} | java | public static boolean getBoolean(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 1)) {
return segments[0].getBoolean(offset);
} else {
return getBooleanMultiSegments(segments, offset);
}
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"1",
")",
")",
"{",
"return",
"segments",
"[",
"0",
"]",
".",
"ge... | get boolean from segments.
@param segments target segments.
@param offset value offset. | [
"get",
"boolean",
"from",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L534-L540 | train | get boolean from segments. | [
30522,
2270,
10763,
22017,
20898,
2131,
5092,
9890,
2319,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
16396,
1007,
1063,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
9214,
1010,
16396,
1010,
1015,
1007,
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... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java | InboundHttp2ToHttpAdapter.removeMessage | protected final void removeMessage(Http2Stream stream, boolean release) {
FullHttpMessage msg = stream.removeProperty(messageKey);
if (release && msg != null) {
msg.release();
}
} | java | protected final void removeMessage(Http2Stream stream, boolean release) {
FullHttpMessage msg = stream.removeProperty(messageKey);
if (release && msg != null) {
msg.release();
}
} | [
"protected",
"final",
"void",
"removeMessage",
"(",
"Http2Stream",
"stream",
",",
"boolean",
"release",
")",
"{",
"FullHttpMessage",
"msg",
"=",
"stream",
".",
"removeProperty",
"(",
"messageKey",
")",
";",
"if",
"(",
"release",
"&&",
"msg",
"!=",
"null",
")... | The stream is out of scope for the HTTP message flow and will no longer be tracked
@param stream The stream to remove associated state with
@param release {@code true} to call release on the value if it is present. {@code false} to not call release. | [
"The",
"stream",
"is",
"out",
"of",
"scope",
"for",
"the",
"HTTP",
"message",
"flow",
"and",
"will",
"no",
"longer",
"be",
"tracked"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java#L93-L98 | train | Remove the message from the stream. | [
30522,
5123,
2345,
11675,
6366,
7834,
3736,
3351,
1006,
8299,
2475,
21422,
5460,
1010,
22017,
20898,
2713,
1007,
1063,
2440,
11039,
25856,
7834,
3736,
3351,
5796,
2290,
1027,
5460,
1012,
6366,
21572,
4842,
3723,
1006,
4471,
14839,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.fromAddress | public static BinaryString fromAddress(
MemorySegment[] segments, int offset, int numBytes) {
return new BinaryString(segments, offset, numBytes);
} | java | public static BinaryString fromAddress(
MemorySegment[] segments, int offset, int numBytes) {
return new BinaryString(segments, offset, numBytes);
} | [
"public",
"static",
"BinaryString",
"fromAddress",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"{",
"return",
"new",
"BinaryString",
"(",
"segments",
",",
"offset",
",",
"numBytes",
")",
";",
"}"
] | Creates an BinaryString from given address (base and offset) and length. | [
"Creates",
"an",
"BinaryString",
"from",
"given",
"address",
"(",
"base",
"and",
"offset",
")",
"and",
"length",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L69-L72 | train | Create a binary string from a set of segments. | [
30522,
2270,
10763,
12441,
3367,
4892,
2013,
4215,
16200,
4757,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2709,
2047,
12441,
3367,
4892,
1006,
9214,
1010,
16396,
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/img/ImgUtil.java | ImgUtil.pressText | public static void pressText(Image srcImage, OutputStream to, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException {
pressText(srcImage, getImageOutputStream(to), pressText, color, font, x, y, alpha);
} | java | public static void pressText(Image srcImage, OutputStream to, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException {
pressText(srcImage, getImageOutputStream(to), pressText, color, font, x, y, alpha);
} | [
"public",
"static",
"void",
"pressText",
"(",
"Image",
"srcImage",
",",
"OutputStream",
"to",
",",
"String",
"pressText",
",",
"Color",
"color",
",",
"Font",
"font",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"throws",
"IORuntimeExceptio... | 给图片添加文字水印<br>
此方法并不关闭流
@param srcImage 源图像
@param to 目标流
@param pressText 水印文字
@param color 水印的字体颜色
@param font {@link Font} 字体相关信息,如果默认则为{@code null}
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@throws IORuntimeException IO异常
@since 3.2.2 | [
"给图片添加文字水印<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L826-L828 | train | Press text from Image to OutputStream. | [
30522,
2270,
10763,
11675,
2811,
18209,
1006,
3746,
5034,
6895,
30524,
9581,
3351,
5833,
18780,
21422,
1006,
2000,
1007,
1010,
2811,
18209,
1010,
3609,
1010,
15489,
1010,
1060,
1010,
1061,
1010,
6541,
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/sort/SortUtil.java | SortUtil.putDoubleNormalizedKey | public static void putDoubleNormalizedKey(double value, MemorySegment target, int offset,
int numBytes) {
long lValue = Double.doubleToLongBits(value);
lValue ^= ((lValue >> (Long.SIZE - 1)) | Long.MIN_VALUE);
NormalizedKeyUtil.putUnsignedLongNormalizedKey(lValue, target, offset, numBytes);
} | java | public static void putDoubleNormalizedKey(double value, MemorySegment target, int offset,
int numBytes) {
long lValue = Double.doubleToLongBits(value);
lValue ^= ((lValue >> (Long.SIZE - 1)) | Long.MIN_VALUE);
NormalizedKeyUtil.putUnsignedLongNormalizedKey(lValue, target, offset, numBytes);
} | [
"public",
"static",
"void",
"putDoubleNormalizedKey",
"(",
"double",
"value",
",",
"MemorySegment",
"target",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"{",
"long",
"lValue",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
";",
"lValue",
... | See http://stereopsis.com/radix.html for more details. | [
"See",
"http",
":",
"//",
"stereopsis",
".",
"com",
"/",
"radix",
".",
"html",
"for",
"more",
"details",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SortUtil.java#L118-L123 | train | Put a double into the given MemorySegment. | [
30522,
2270,
10763,
11675,
2404,
26797,
3468,
12131,
9067,
3550,
14839,
1006,
3313,
3643,
1010,
3638,
3366,
21693,
4765,
4539,
1010,
20014,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2146,
1048,
10175,
5657,
1027,
3313,
1012,
3313,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java | SortOperationFactory.createLimitWithOffset | public TableOperation createLimitWithOffset(int offset, TableOperation child) {
SortTableOperation previousSort = validateAndGetChildSort(child);
if (offset < 0) {
throw new ValidationException("Offset should be greater or equal 0");
}
if (previousSort.getOffset() != -1) {
throw new ValidationException("OFFSET already defined");
}
return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, -1);
} | java | public TableOperation createLimitWithOffset(int offset, TableOperation child) {
SortTableOperation previousSort = validateAndGetChildSort(child);
if (offset < 0) {
throw new ValidationException("Offset should be greater or equal 0");
}
if (previousSort.getOffset() != -1) {
throw new ValidationException("OFFSET already defined");
}
return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, -1);
} | [
"public",
"TableOperation",
"createLimitWithOffset",
"(",
"int",
"offset",
",",
"TableOperation",
"child",
")",
"{",
"SortTableOperation",
"previousSort",
"=",
"validateAndGetChildSort",
"(",
"child",
")",
";",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"throw",
"... | Adds offset to the underlying {@link SortTableOperation} if it is a valid one.
@param offset offset to add
@param child should be {@link SortTableOperation}
@return valid sort operation with applied offset | [
"Adds",
"offset",
"to",
"the",
"underlying",
"{",
"@link",
"SortTableOperation",
"}",
"if",
"it",
"is",
"a",
"valid",
"one",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L73-L85 | train | Creates a new limit operation with the given offset and child table operation. | [
30522,
2270,
2795,
25918,
3370,
3443,
17960,
4183,
24415,
27475,
3388,
1006,
20014,
16396,
1010,
2795,
25918,
3370,
2775,
1007,
1063,
4066,
10880,
25918,
3370,
3025,
21748,
2102,
1027,
9398,
3686,
5685,
18150,
19339,
21748,
2102,
1006,
2775,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java | RemoteEnvironment.execute | @Override
public JobExecutionResult execute(String jobName) throws Exception {
PlanExecutor executor = getExecutor();
Plan p = createProgramPlan(jobName);
// Session management is disabled, revert this commit to enable
//p.setJobId(jobID);
//p.setSessionTimeout(sessionTimeout);
JobExecutionResult result = executor.executePlan(p);
this.lastJobExecutionResult = result;
return result;
} | java | @Override
public JobExecutionResult execute(String jobName) throws Exception {
PlanExecutor executor = getExecutor();
Plan p = createProgramPlan(jobName);
// Session management is disabled, revert this commit to enable
//p.setJobId(jobID);
//p.setSessionTimeout(sessionTimeout);
JobExecutionResult result = executor.executePlan(p);
this.lastJobExecutionResult = result;
return result;
} | [
"@",
"Override",
"public",
"JobExecutionResult",
"execute",
"(",
"String",
"jobName",
")",
"throws",
"Exception",
"{",
"PlanExecutor",
"executor",
"=",
"getExecutor",
"(",
")",
";",
"Plan",
"p",
"=",
"createProgramPlan",
"(",
"jobName",
")",
";",
"// Session man... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java#L163-L177 | train | Execute the job with the specified job ID. | [
30522,
1030,
2058,
15637,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
15389,
1006,
5164,
3105,
18442,
1007,
11618,
6453,
1063,
4946,
2595,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1027,
2131,
10288,
8586,
16161,
2099,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.firstNonNull | @SuppressWarnings("unchecked")
public static <T> T firstNonNull(T... array) {
if (isNotEmpty(array)) {
for (final T val : array) {
if (null != val) {
return val;
}
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <T> T firstNonNull(T... array) {
if (isNotEmpty(array)) {
for (final T val : array) {
if (null != val) {
return val;
}
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"firstNonNull",
"(",
"T",
"...",
"array",
")",
"{",
"if",
"(",
"isNotEmpty",
"(",
"array",
")",
")",
"{",
"for",
"(",
"final",
"T",
"val",
":",
"array",
")",
... | 返回数组中第一个非空元素
@param <T> 数组元素类型
@param array 数组
@return 非空元素,如果不存在非空元素或数组为空,返回{@code null}
@since 3.0.7 | [
"返回数组中第一个非空元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L273-L283 | train | Returns the first non - null element in the array or null if the array is empty. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
2034,
8540,
11231,
3363,
1006,
1056,
1012,
1012,
1012,
9140,
1007,
1063,
2065,
1006,
3475,
12184,
27718,
2100,
1006,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.isDelimiter | public static boolean isDelimiter(String str)
{
if (str != null && ("-".equals(str) || "-".equals(str)))
return true;
else
return false;
} | java | public static boolean isDelimiter(String str)
{
if (str != null && ("-".equals(str) || "-".equals(str)))
return true;
else
return false;
} | [
"public",
"static",
"boolean",
"isDelimiter",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"!=",
"null",
"&&",
"(",
"\"-\"",
".",
"equals",
"(",
"str",
")",
"||",
"\"-\".e",
"q",
"uals(s",
"t",
"r))",
")",
"",
"",
"return",
"true",
";",
"else"... | 判断是否是一个连字符(分隔符)
@param str
@return | [
"判断是否是一个连字符(分隔符)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L505-L511 | train | isDelimiter returns true if the string is a delimiter. | [
30522,
2270,
10763,
22017,
20898,
2003,
9247,
27605,
3334,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
2358,
2099,
999,
1027,
19701,
1004,
1004,
1006,
1000,
1011,
1000,
1012,
19635,
1006,
2358,
2099,
1007,
1064,
1064,
1000,
1990,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.update | public int update(Entity record, Entity where) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.update(conn, record, where);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public int update(Entity record, Entity where) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.update(conn, record, where);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"int",
"update",
"(",
"Entity",
"record",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"return",
"runner",
".",
"update... | 更新数据<br>
更新条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " > 1"),value也可以传Condition对象,key被忽略
@param record 记录
@param where 条件
@return 影响行数
@throws SQLException SQL执行异常 | [
"更新数据<br",
">",
"更新条件为多个key",
"value对表示,默认key",
"=",
"value,如果使用其它条件可以使用:where",
".",
"put",
"(",
"key",
">",
";",
"1",
")",
",value也可以传Condition对象,key被忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L380-L390 | train | Updates the specified entity in the database. | [
30522,
2270,
20014,
10651,
1006,
9178,
2501,
1010,
9178,
2073,
1007,
11618,
29296,
10288,
24422,
1063,
4434,
9530,
2078,
1027,
19701,
1025,
3046,
1063,
9530,
2078,
1027,
2023,
1012,
2131,
8663,
2638,
7542,
1006,
1007,
1025,
2709,
5479,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.getPrefix | public long getPrefix() {
// Since JVMs are either 4-byte aligned or 8-byte aligned, we check the size of the string.
// If size is 0, just return 0.
// If size is between 0 and 4 (inclusive), assume data is 4-byte aligned under the hood and
// use a getInt to fetch the prefix.
// If size is greater than 4, assume we have at least 8 bytes of data to fetch.
// After getting the data, we use a mask to mask out data that is not part of the string.
long p;
long mask = 0;
if (IS_LITTLE_ENDIAN) {
if (numBytes >= 8) {
p = Platform.getLong(base, offset);
} else if (numBytes > 4) {
p = Platform.getLong(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else if (numBytes > 0) {
p = (long) Platform.getInt(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else {
p = 0;
}
p = java.lang.Long.reverseBytes(p);
} else {
// byteOrder == ByteOrder.BIG_ENDIAN
if (numBytes >= 8) {
p = Platform.getLong(base, offset);
} else if (numBytes > 4) {
p = Platform.getLong(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else if (numBytes > 0) {
p = ((long) Platform.getInt(base, offset)) << 32;
mask = (1L << (8 - numBytes) * 8) - 1;
} else {
p = 0;
}
}
p &= ~mask;
return p;
} | java | public long getPrefix() {
// Since JVMs are either 4-byte aligned or 8-byte aligned, we check the size of the string.
// If size is 0, just return 0.
// If size is between 0 and 4 (inclusive), assume data is 4-byte aligned under the hood and
// use a getInt to fetch the prefix.
// If size is greater than 4, assume we have at least 8 bytes of data to fetch.
// After getting the data, we use a mask to mask out data that is not part of the string.
long p;
long mask = 0;
if (IS_LITTLE_ENDIAN) {
if (numBytes >= 8) {
p = Platform.getLong(base, offset);
} else if (numBytes > 4) {
p = Platform.getLong(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else if (numBytes > 0) {
p = (long) Platform.getInt(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else {
p = 0;
}
p = java.lang.Long.reverseBytes(p);
} else {
// byteOrder == ByteOrder.BIG_ENDIAN
if (numBytes >= 8) {
p = Platform.getLong(base, offset);
} else if (numBytes > 4) {
p = Platform.getLong(base, offset);
mask = (1L << (8 - numBytes) * 8) - 1;
} else if (numBytes > 0) {
p = ((long) Platform.getInt(base, offset)) << 32;
mask = (1L << (8 - numBytes) * 8) - 1;
} else {
p = 0;
}
}
p &= ~mask;
return p;
} | [
"public",
"long",
"getPrefix",
"(",
")",
"{",
"// Since JVMs are either 4-byte aligned or 8-byte aligned, we check the size of the string.",
"// If size is 0, just return 0.",
"// If size is between 0 and 4 (inclusive), assume data is 4-byte aligned under the hood and",
"// use a getInt to fetch t... | Returns a 64-bit integer that can be used as the prefix used in sorting. | [
"Returns",
"a",
"64",
"-",
"bit",
"integer",
"that",
"can",
"be",
"used",
"as",
"the",
"prefix",
"used",
"in",
"sorting",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L248-L286 | train | Gets the prefix of the string. | [
30522,
2270,
2146,
2131,
28139,
8873,
2595,
1006,
1007,
1063,
1013,
1013,
2144,
1046,
2615,
5244,
2024,
2593,
1018,
1011,
24880,
13115,
2030,
1022,
1011,
24880,
13115,
1010,
2057,
4638,
1996,
2946,
1997,
1996,
5164,
1012,
1013,
1013,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | security/src/main/java/com/networknt/security/JwtHelper.java | JwtHelper.readCertificate | static public X509Certificate readCertificate(String filename)
throws Exception {
InputStream inStream = null;
X509Certificate cert = null;
try {
inStream = Config.getInstance().getInputStreamFromFile(filename);
if (inStream != null) {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
cert = (X509Certificate) cf.generateCertificate(inStream);
} else {
logger.info("Certificate " + Encode.forJava(filename) + " not found.");
}
} catch (Exception e) {
logger.error("Exception: ", e);
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException ioe) {
logger.error("Exception: ", ioe);
}
}
}
return cert;
} | java | static public X509Certificate readCertificate(String filename)
throws Exception {
InputStream inStream = null;
X509Certificate cert = null;
try {
inStream = Config.getInstance().getInputStreamFromFile(filename);
if (inStream != null) {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
cert = (X509Certificate) cf.generateCertificate(inStream);
} else {
logger.info("Certificate " + Encode.forJava(filename) + " not found.");
}
} catch (Exception e) {
logger.error("Exception: ", e);
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException ioe) {
logger.error("Exception: ", ioe);
}
}
}
return cert;
} | [
"static",
"public",
"X509Certificate",
"readCertificate",
"(",
"String",
"filename",
")",
"throws",
"Exception",
"{",
"InputStream",
"inStream",
"=",
"null",
";",
"X509Certificate",
"cert",
"=",
"null",
";",
"try",
"{",
"inStream",
"=",
"Config",
".",
"getInstan... | Read certificate from a file and convert it into X509Certificate object
@param filename certificate file name
@return X509Certificate object
@throws Exception Exception while reading certificate | [
"Read",
"certificate",
"from",
"a",
"file",
"and",
"convert",
"it",
"into",
"X509Certificate",
"object"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/security/src/main/java/com/networknt/security/JwtHelper.java#L94-L118 | train | readCertificate Method. | [
30522,
10763,
2270,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
3191,
17119,
3775,
8873,
16280,
1006,
5164,
5371,
18442,
1007,
11618,
6453,
1063,
20407,
25379,
16021,
25379,
1027,
19701,
1025,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
829... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.addBroadcastConnection | public void addBroadcastConnection(String name, DagConnection broadcastConnection) {
this.broadcastConnectionNames.add(name);
this.broadcastConnections.add(broadcastConnection);
} | java | public void addBroadcastConnection(String name, DagConnection broadcastConnection) {
this.broadcastConnectionNames.add(name);
this.broadcastConnections.add(broadcastConnection);
} | [
"public",
"void",
"addBroadcastConnection",
"(",
"String",
"name",
",",
"DagConnection",
"broadcastConnection",
")",
"{",
"this",
".",
"broadcastConnectionNames",
".",
"add",
"(",
"name",
")",
";",
"this",
".",
"broadcastConnections",
".",
"add",
"(",
"broadcastCo... | Adds the broadcast connection identified by the given {@code name} to this node.
@param broadcastConnection The connection to add. | [
"Adds",
"the",
"broadcast",
"connection",
"identified",
"by",
"the",
"given",
"{",
"@code",
"name",
"}",
"to",
"this",
"node",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L318-L321 | train | Adds a broadcast connection to the DagConnectionCollection. | [
30522,
2270,
11675,
5587,
12618,
4215,
10526,
8663,
2638,
7542,
1006,
5164,
2171,
1010,
4830,
18195,
18256,
7542,
3743,
8663,
2638,
7542,
1007,
1063,
2023,
1012,
3743,
8663,
2638,
7542,
18442,
2015,
1012,
5587,
1006,
2171,
1007,
1025,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java | ClassScaner.addIfAccept | private void addIfAccept(Class<?> clazz) {
if (null != clazz) {
Filter<Class<?>> classFilter = this.classFilter;
if (classFilter == null || classFilter.accept(clazz)) {
this.classes.add(clazz);
}
}
} | java | private void addIfAccept(Class<?> clazz) {
if (null != clazz) {
Filter<Class<?>> classFilter = this.classFilter;
if (classFilter == null || classFilter.accept(clazz)) {
this.classes.add(clazz);
}
}
} | [
"private",
"void",
"addIfAccept",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"null",
"!=",
"clazz",
")",
"{",
"Filter",
"<",
"Class",
"<",
"?",
">",
">",
"classFilter",
"=",
"this",
".",
"classFilter",
";",
"if",
"(",
"classFilter",
... | 通过过滤器,是否满足接受此类的条件
@param clazz 类
@return 是否接受 | [
"通过过滤器,是否满足接受此类的条件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L309-L316 | train | Adds a class to the list of classes to be checked. | [
30522,
2797,
11675,
5587,
10128,
6305,
3401,
13876,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2065,
1006,
19701,
999,
1027,
18856,
10936,
2480,
1007,
1063,
11307,
1026,
2465,
1026,
1029,
1028,
1028,
2465,
8873,
21928,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SchedulerImpl.java | SchedulerImpl.allocateSharedSlot | private CompletableFuture<LogicalSlot> allocateSharedSlot(
SlotRequestId slotRequestId,
ScheduledUnit scheduledUnit,
SlotProfile slotProfile,
boolean allowQueuedScheduling,
Time allocationTimeout) {
// allocate slot with slot sharing
final SlotSharingManager multiTaskSlotManager = slotSharingManagers.computeIfAbsent(
scheduledUnit.getSlotSharingGroupId(),
id -> new SlotSharingManager(
id,
slotPool,
this));
final SlotSharingManager.MultiTaskSlotLocality multiTaskSlotLocality;
try {
if (scheduledUnit.getCoLocationConstraint() != null) {
multiTaskSlotLocality = allocateCoLocatedMultiTaskSlot(
scheduledUnit.getCoLocationConstraint(),
multiTaskSlotManager,
slotProfile,
allowQueuedScheduling,
allocationTimeout);
} else {
multiTaskSlotLocality = allocateMultiTaskSlot(
scheduledUnit.getJobVertexId(),
multiTaskSlotManager,
slotProfile,
allowQueuedScheduling,
allocationTimeout);
}
} catch (NoResourceAvailableException noResourceException) {
return FutureUtils.completedExceptionally(noResourceException);
}
// sanity check
Preconditions.checkState(!multiTaskSlotLocality.getMultiTaskSlot().contains(scheduledUnit.getJobVertexId()));
final SlotSharingManager.SingleTaskSlot leaf = multiTaskSlotLocality.getMultiTaskSlot().allocateSingleTaskSlot(
slotRequestId,
scheduledUnit.getJobVertexId(),
multiTaskSlotLocality.getLocality());
return leaf.getLogicalSlotFuture();
} | java | private CompletableFuture<LogicalSlot> allocateSharedSlot(
SlotRequestId slotRequestId,
ScheduledUnit scheduledUnit,
SlotProfile slotProfile,
boolean allowQueuedScheduling,
Time allocationTimeout) {
// allocate slot with slot sharing
final SlotSharingManager multiTaskSlotManager = slotSharingManagers.computeIfAbsent(
scheduledUnit.getSlotSharingGroupId(),
id -> new SlotSharingManager(
id,
slotPool,
this));
final SlotSharingManager.MultiTaskSlotLocality multiTaskSlotLocality;
try {
if (scheduledUnit.getCoLocationConstraint() != null) {
multiTaskSlotLocality = allocateCoLocatedMultiTaskSlot(
scheduledUnit.getCoLocationConstraint(),
multiTaskSlotManager,
slotProfile,
allowQueuedScheduling,
allocationTimeout);
} else {
multiTaskSlotLocality = allocateMultiTaskSlot(
scheduledUnit.getJobVertexId(),
multiTaskSlotManager,
slotProfile,
allowQueuedScheduling,
allocationTimeout);
}
} catch (NoResourceAvailableException noResourceException) {
return FutureUtils.completedExceptionally(noResourceException);
}
// sanity check
Preconditions.checkState(!multiTaskSlotLocality.getMultiTaskSlot().contains(scheduledUnit.getJobVertexId()));
final SlotSharingManager.SingleTaskSlot leaf = multiTaskSlotLocality.getMultiTaskSlot().allocateSingleTaskSlot(
slotRequestId,
scheduledUnit.getJobVertexId(),
multiTaskSlotLocality.getLocality());
return leaf.getLogicalSlotFuture();
} | [
"private",
"CompletableFuture",
"<",
"LogicalSlot",
">",
"allocateSharedSlot",
"(",
"SlotRequestId",
"slotRequestId",
",",
"ScheduledUnit",
"scheduledUnit",
",",
"SlotProfile",
"slotProfile",
",",
"boolean",
"allowQueuedScheduling",
",",
"Time",
"allocationTimeout",
")",
... | ------------------------------- slot sharing code | [
"-------------------------------",
"slot",
"sharing",
"code"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SchedulerImpl.java#L243-L286 | train | Allocate a shared slot. | [
30522,
2797,
4012,
10814,
10880,
11263,
11244,
1026,
11177,
14540,
4140,
1028,
2035,
24755,
4570,
8167,
2098,
14540,
4140,
1006,
10453,
2890,
15500,
3593,
10453,
2890,
15500,
3593,
1010,
5115,
19496,
2102,
5115,
19496,
2102,
1010,
10453,
2157... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.checkIdleSlot | private void checkIdleSlot() {
// The timestamp in SlotAndTimestamp is relative
final long currentRelativeTimeMillis = clock.relativeTimeMillis();
final List<AllocatedSlot> expiredSlots = new ArrayList<>(availableSlots.size());
for (SlotAndTimestamp slotAndTimestamp : availableSlots.availableSlots.values()) {
if (currentRelativeTimeMillis - slotAndTimestamp.timestamp > idleSlotTimeout.toMilliseconds()) {
expiredSlots.add(slotAndTimestamp.slot);
}
}
final FlinkException cause = new FlinkException("Releasing idle slot.");
for (AllocatedSlot expiredSlot : expiredSlots) {
final AllocationID allocationID = expiredSlot.getAllocationId();
if (availableSlots.tryRemove(allocationID) != null) {
log.info("Releasing idle slot [{}].", allocationID);
final CompletableFuture<Acknowledge> freeSlotFuture = expiredSlot.getTaskManagerGateway().freeSlot(
allocationID,
cause,
rpcTimeout);
FutureUtils.whenCompleteAsyncIfNotDone(
freeSlotFuture,
componentMainThreadExecutor,
(Acknowledge ignored, Throwable throwable) -> {
if (throwable != null) {
if (registeredTaskManagers.contains(expiredSlot.getTaskManagerId())) {
log.debug("Releasing slot [{}] of registered TaskExecutor {} failed. " +
"Trying to fulfill a different slot request.", allocationID, expiredSlot.getTaskManagerId(),
throwable);
tryFulfillSlotRequestOrMakeAvailable(expiredSlot);
} else {
log.debug("Releasing slot [{}] failed and owning TaskExecutor {} is no " +
"longer registered. Discarding slot.", allocationID, expiredSlot.getTaskManagerId());
}
}
});
}
}
scheduleRunAsync(this::checkIdleSlot, idleSlotTimeout);
} | java | private void checkIdleSlot() {
// The timestamp in SlotAndTimestamp is relative
final long currentRelativeTimeMillis = clock.relativeTimeMillis();
final List<AllocatedSlot> expiredSlots = new ArrayList<>(availableSlots.size());
for (SlotAndTimestamp slotAndTimestamp : availableSlots.availableSlots.values()) {
if (currentRelativeTimeMillis - slotAndTimestamp.timestamp > idleSlotTimeout.toMilliseconds()) {
expiredSlots.add(slotAndTimestamp.slot);
}
}
final FlinkException cause = new FlinkException("Releasing idle slot.");
for (AllocatedSlot expiredSlot : expiredSlots) {
final AllocationID allocationID = expiredSlot.getAllocationId();
if (availableSlots.tryRemove(allocationID) != null) {
log.info("Releasing idle slot [{}].", allocationID);
final CompletableFuture<Acknowledge> freeSlotFuture = expiredSlot.getTaskManagerGateway().freeSlot(
allocationID,
cause,
rpcTimeout);
FutureUtils.whenCompleteAsyncIfNotDone(
freeSlotFuture,
componentMainThreadExecutor,
(Acknowledge ignored, Throwable throwable) -> {
if (throwable != null) {
if (registeredTaskManagers.contains(expiredSlot.getTaskManagerId())) {
log.debug("Releasing slot [{}] of registered TaskExecutor {} failed. " +
"Trying to fulfill a different slot request.", allocationID, expiredSlot.getTaskManagerId(),
throwable);
tryFulfillSlotRequestOrMakeAvailable(expiredSlot);
} else {
log.debug("Releasing slot [{}] failed and owning TaskExecutor {} is no " +
"longer registered. Discarding slot.", allocationID, expiredSlot.getTaskManagerId());
}
}
});
}
}
scheduleRunAsync(this::checkIdleSlot, idleSlotTimeout);
} | [
"private",
"void",
"checkIdleSlot",
"(",
")",
"{",
"// The timestamp in SlotAndTimestamp is relative",
"final",
"long",
"currentRelativeTimeMillis",
"=",
"clock",
".",
"relativeTimeMillis",
"(",
")",
";",
"final",
"List",
"<",
"AllocatedSlot",
">",
"expiredSlots",
"=",
... | Check the available slots, release the slot that is idle for a long time. | [
"Check",
"the",
"available",
"slots",
"release",
"the",
"slot",
"that",
"is",
"idle",
"for",
"a",
"long",
"time",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L746-L791 | train | Check the idle slot. | [
30522,
2797,
11675,
4638,
3593,
4244,
10994,
1006,
1007,
1063,
1013,
1013,
1996,
2335,
15464,
2361,
1999,
10453,
5685,
7292,
9153,
8737,
2003,
5816,
2345,
2146,
2783,
16570,
8082,
7292,
19912,
2483,
1027,
5119,
1012,
5816,
7292,
19912,
2483... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java | CellUtil.getCellValue | public static Object getCellValue(Cell cell, CellType cellType, CellEditor cellEditor) {
if (null == cell) {
return null;
}
if (null == cellType) {
cellType = cell.getCellTypeEnum();
}
Object value;
switch (cellType) {
case NUMERIC:
value = getNumericValue(cell);
break;
case BOOLEAN:
value = cell.getBooleanCellValue();
break;
case FORMULA:
// 遇到公式时查找公式结果类型
value = getCellValue(cell, cell.getCachedFormulaResultTypeEnum(), cellEditor);
break;
case BLANK:
value = StrUtil.EMPTY;
break;
case ERROR:
final FormulaError error = FormulaError.forInt(cell.getErrorCellValue());
value = (null == error) ? StrUtil.EMPTY : error.getString();
break;
default:
value = cell.getStringCellValue();
}
return null == cellEditor ? value : cellEditor.edit(cell, value);
} | java | public static Object getCellValue(Cell cell, CellType cellType, CellEditor cellEditor) {
if (null == cell) {
return null;
}
if (null == cellType) {
cellType = cell.getCellTypeEnum();
}
Object value;
switch (cellType) {
case NUMERIC:
value = getNumericValue(cell);
break;
case BOOLEAN:
value = cell.getBooleanCellValue();
break;
case FORMULA:
// 遇到公式时查找公式结果类型
value = getCellValue(cell, cell.getCachedFormulaResultTypeEnum(), cellEditor);
break;
case BLANK:
value = StrUtil.EMPTY;
break;
case ERROR:
final FormulaError error = FormulaError.forInt(cell.getErrorCellValue());
value = (null == error) ? StrUtil.EMPTY : error.getString();
break;
default:
value = cell.getStringCellValue();
}
return null == cellEditor ? value : cellEditor.edit(cell, value);
} | [
"public",
"static",
"Object",
"getCellValue",
"(",
"Cell",
"cell",
",",
"CellType",
"cellType",
",",
"CellEditor",
"cellEditor",
")",
"{",
"if",
"(",
"null",
"==",
"cell",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"null",
"==",
"cellType",
")",
... | 获取单元格值<br>
如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型
@param cell {@link Cell}单元格
@param cellType 单元格值类型{@link CellType}枚举,如果为{@code null}默认使用cell的类型
@param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
@return 值,类型可能为:Date、Double、Boolean、String | [
"获取单元格值<br",
">",
"如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L78-L110 | train | Gets the value of the N1QL cell. | [
30522,
2270,
10763,
4874,
2131,
29109,
22144,
7630,
2063,
1006,
3526,
3526,
1010,
3526,
13874,
3526,
13874,
1010,
3526,
2098,
15660,
3526,
2098,
15660,
1007,
30524,
1027,
3526,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
19701,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readHex | public static String readHex(InputStream in, int length, boolean toLowerCase) throws IORuntimeException {
return HexUtil.encodeHexStr(readBytes(in, length), toLowerCase);
} | java | public static String readHex(InputStream in, int length, boolean toLowerCase) throws IORuntimeException {
return HexUtil.encodeHexStr(readBytes(in, length), toLowerCase);
} | [
"public",
"static",
"String",
"readHex",
"(",
"InputStream",
"in",
",",
"int",
"length",
",",
"boolean",
"toLowerCase",
")",
"throws",
"IORuntimeException",
"{",
"return",
"HexUtil",
".",
"encodeHexStr",
"(",
"readBytes",
"(",
"in",
",",
"length",
")",
",",
... | 读取16进制字符串
@param in {@link InputStream}
@param length 长度
@param toLowerCase true 传换成小写格式 , false 传换成大写格式
@return 16进制字符串
@throws IORuntimeException IO异常 | [
"读取16进制字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L569-L571 | train | Reads a sequence of bytes from the given input stream and returns a hex string. | [
30522,
2270,
10763,
5164,
3191,
5369,
2595,
1006,
20407,
25379,
1999,
1010,
20014,
3091,
1010,
22017,
20898,
2000,
27663,
18992,
3366,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
4372,
16044,
5369... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java | AbstractHealthAggregator.aggregateDetails | protected Map<String, Object> aggregateDetails(Map<String, Health> healths) {
return new LinkedHashMap<>(healths);
} | java | protected Map<String, Object> aggregateDetails(Map<String, Health> healths) {
return new LinkedHashMap<>(healths);
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"aggregateDetails",
"(",
"Map",
"<",
"String",
",",
"Health",
">",
"healths",
")",
"{",
"return",
"new",
"LinkedHashMap",
"<>",
"(",
"healths",
")",
";",
"}"
] | Return the map of 'aggregate' details that should be used from the specified
healths.
@param healths the health instances to aggregate
@return a map of details
@since 1.3.1 | [
"Return",
"the",
"map",
"of",
"aggregate",
"details",
"that",
"should",
"be",
"used",
"from",
"the",
"specified",
"healths",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java#L58-L60 | train | Aggregate the health details. | [
30522,
5123,
4949,
1026,
5164,
1010,
4874,
1028,
9572,
3207,
22081,
1006,
4949,
1026,
5164,
1010,
2740,
1028,
2740,
2015,
1007,
1063,
2709,
2047,
5799,
14949,
22444,
2361,
1026,
1028,
1006,
2740,
2015,
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-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsHistory.java | CheckpointStatsHistory.createSnapshot | CheckpointStatsHistory createSnapshot() {
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
List<AbstractCheckpointStats> checkpointsHistory;
Map<Long, AbstractCheckpointStats> checkpointsById;
checkpointsById = new HashMap<>(checkpointsArray.length);
if (maxSize == 0) {
checkpointsHistory = Collections.emptyList();
} else {
AbstractCheckpointStats[] newCheckpointsArray = new AbstractCheckpointStats[checkpointsArray.length];
System.arraycopy(checkpointsArray, nextPos, newCheckpointsArray, 0, checkpointsArray.length - nextPos);
System.arraycopy(checkpointsArray, 0, newCheckpointsArray, checkpointsArray.length - nextPos, nextPos);
checkpointsHistory = Arrays.asList(newCheckpointsArray);
// reverse the order such that we start with the youngest checkpoint
Collections.reverse(checkpointsHistory);
for (AbstractCheckpointStats checkpoint : checkpointsHistory) {
checkpointsById.put(checkpoint.getCheckpointId(), checkpoint);
}
}
if (latestCompletedCheckpoint != null) {
checkpointsById.put(latestCompletedCheckpoint.getCheckpointId(), latestCompletedCheckpoint);
}
if (latestFailedCheckpoint != null) {
checkpointsById.put(latestFailedCheckpoint.getCheckpointId(), latestFailedCheckpoint);
}
if (latestSavepoint != null) {
checkpointsById.put(latestSavepoint.getCheckpointId(), latestSavepoint);
}
return new CheckpointStatsHistory(
true,
maxSize,
null,
checkpointsHistory,
checkpointsById,
latestCompletedCheckpoint,
latestFailedCheckpoint,
latestSavepoint);
} | java | CheckpointStatsHistory createSnapshot() {
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
List<AbstractCheckpointStats> checkpointsHistory;
Map<Long, AbstractCheckpointStats> checkpointsById;
checkpointsById = new HashMap<>(checkpointsArray.length);
if (maxSize == 0) {
checkpointsHistory = Collections.emptyList();
} else {
AbstractCheckpointStats[] newCheckpointsArray = new AbstractCheckpointStats[checkpointsArray.length];
System.arraycopy(checkpointsArray, nextPos, newCheckpointsArray, 0, checkpointsArray.length - nextPos);
System.arraycopy(checkpointsArray, 0, newCheckpointsArray, checkpointsArray.length - nextPos, nextPos);
checkpointsHistory = Arrays.asList(newCheckpointsArray);
// reverse the order such that we start with the youngest checkpoint
Collections.reverse(checkpointsHistory);
for (AbstractCheckpointStats checkpoint : checkpointsHistory) {
checkpointsById.put(checkpoint.getCheckpointId(), checkpoint);
}
}
if (latestCompletedCheckpoint != null) {
checkpointsById.put(latestCompletedCheckpoint.getCheckpointId(), latestCompletedCheckpoint);
}
if (latestFailedCheckpoint != null) {
checkpointsById.put(latestFailedCheckpoint.getCheckpointId(), latestFailedCheckpoint);
}
if (latestSavepoint != null) {
checkpointsById.put(latestSavepoint.getCheckpointId(), latestSavepoint);
}
return new CheckpointStatsHistory(
true,
maxSize,
null,
checkpointsHistory,
checkpointsById,
latestCompletedCheckpoint,
latestFailedCheckpoint,
latestSavepoint);
} | [
"CheckpointStatsHistory",
"createSnapshot",
"(",
")",
"{",
"if",
"(",
"readOnly",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Can't create a snapshot of a read-only history.\"",
")",
";",
"}",
"List",
"<",
"AbstractCheckpointStats",
">",
"checkpoint... | Creates a snapshot of the current state.
@return Snapshot of the current state. | [
"Creates",
"a",
"snapshot",
"of",
"the",
"current",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsHistory.java#L162-L211 | train | Creates a snapshot of the checkpoint history. | [
30522,
26520,
9153,
3215,
24158,
7062,
9005,
2532,
4523,
12326,
1006,
1007,
1063,
2065,
1006,
3191,
2239,
2135,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
24422,
1006,
1000,
2064,
1005,
1056,
3443,
1037,
20057,
123... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/neo4j/Neo4jHealthIndicator.java | Neo4jHealthIndicator.extractResult | protected void extractResult(Session session, Health.Builder builder)
throws Exception {
Result result = session.query(CYPHER, Collections.emptyMap());
builder.up().withDetail("nodes",
result.queryResults().iterator().next().get("nodes"));
} | java | protected void extractResult(Session session, Health.Builder builder)
throws Exception {
Result result = session.query(CYPHER, Collections.emptyMap());
builder.up().withDetail("nodes",
result.queryResults().iterator().next().get("nodes"));
} | [
"protected",
"void",
"extractResult",
"(",
"Session",
"session",
",",
"Health",
".",
"Builder",
"builder",
")",
"throws",
"Exception",
"{",
"Result",
"result",
"=",
"session",
".",
"query",
"(",
"CYPHER",
",",
"Collections",
".",
"emptyMap",
"(",
")",
")",
... | Provide health details using the specified {@link Session} and {@link Builder
Builder}.
@param session the session to use to execute a cypher statement
@param builder the builder to add details to
@throws Exception if getting health details failed | [
"Provide",
"health",
"details",
"using",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicator.java#L70-L75 | train | Extract result from session. | [
30522,
5123,
11675,
14817,
6072,
11314,
1006,
5219,
5219,
1010,
2740,
1012,
12508,
12508,
1007,
11618,
6453,
1063,
2765,
2765,
1027,
5219,
1012,
23032,
1006,
22330,
27921,
1010,
6407,
1012,
4064,
2863,
2361,
1006,
1007,
1007,
1025,
12508,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.reduce | public ReduceOperator<T> reduce(ReduceFunction<T> reducer) {
if (reducer == null) {
throw new NullPointerException("Reduce function must not be null.");
}
return new ReduceOperator<>(this, clean(reducer), Utils.getCallLocationName());
} | java | public ReduceOperator<T> reduce(ReduceFunction<T> reducer) {
if (reducer == null) {
throw new NullPointerException("Reduce function must not be null.");
}
return new ReduceOperator<>(this, clean(reducer), Utils.getCallLocationName());
} | [
"public",
"ReduceOperator",
"<",
"T",
">",
"reduce",
"(",
"ReduceFunction",
"<",
"T",
">",
"reducer",
")",
"{",
"if",
"(",
"reducer",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Reduce function must not be null.\"",
")",
";",
"}",
... | Applies a Reduce transformation on a non-grouped {@link DataSet}.
<p>The transformation consecutively calls a {@link org.apache.flink.api.common.functions.RichReduceFunction}
until only a single element remains which is the result of the transformation.
A ReduceFunction combines two elements into one new element of the same type.
@param reducer The ReduceFunction that is applied on the DataSet.
@return A ReduceOperator that represents the reduced DataSet.
@see org.apache.flink.api.common.functions.RichReduceFunction
@see ReduceOperator
@see DataSet | [
"Applies",
"a",
"Reduce",
"transformation",
"on",
"a",
"non",
"-",
"grouped",
"{",
"@link",
"DataSet",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L443-L448 | train | Returns a new instance of this operator with the specified reducer applied to all operands of this operator. | [
30522,
2270,
5547,
25918,
8844,
1026,
1056,
1028,
5547,
1006,
5547,
11263,
27989,
1026,
1056,
1028,
5547,
2099,
1007,
1063,
2065,
1006,
5547,
2099,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
5547,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbSyncService.java | RdbSyncService.sync | public void sync(BatchExecutor batchExecutor, MappingConfig config, SingleDml dml) {
if (config != null) {
try {
String type = dml.getType();
if (type != null && type.equalsIgnoreCase("INSERT")) {
insert(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("UPDATE")) {
update(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("DELETE")) {
delete(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("TRUNCATE")) {
truncate(batchExecutor, config);
}
if (logger.isDebugEnabled()) {
logger.debug("DML: {}", JSON.toJSONString(dml, SerializerFeature.WriteMapNullValue));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
} | java | public void sync(BatchExecutor batchExecutor, MappingConfig config, SingleDml dml) {
if (config != null) {
try {
String type = dml.getType();
if (type != null && type.equalsIgnoreCase("INSERT")) {
insert(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("UPDATE")) {
update(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("DELETE")) {
delete(batchExecutor, config, dml);
} else if (type != null && type.equalsIgnoreCase("TRUNCATE")) {
truncate(batchExecutor, config);
}
if (logger.isDebugEnabled()) {
logger.debug("DML: {}", JSON.toJSONString(dml, SerializerFeature.WriteMapNullValue));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
} | [
"public",
"void",
"sync",
"(",
"BatchExecutor",
"batchExecutor",
",",
"MappingConfig",
"config",
",",
"SingleDml",
"dml",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"try",
"{",
"String",
"type",
"=",
"dml",
".",
"getType",
"(",
")",
";",
"i... | 单条 dml 同步
@param batchExecutor 批量事务执行器
@param config 对应配置对象
@param dml DML | [
"单条",
"dml",
"同步"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbSyncService.java#L202-L222 | train | Synchronize the DML with the database. | [
30522,
2270,
11675,
26351,
1006,
14108,
10288,
8586,
16161,
2099,
14108,
10288,
8586,
16161,
2099,
1010,
12375,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
25369,
19968,
1040,
19968,
1007,
1063,
2065,
1006,
9530,
8873,
2290,
999,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.quote | public static Writer quote(String str, Writer writer, boolean isWrap) throws IOException {
if (StrUtil.isEmpty(str)) {
if (isWrap) {
writer.write("\"\"");
}
return writer;
}
char b; // 前一个字符
char c = 0; // 当前字符
int len = str.length();
if (isWrap) {
writer.write('"');
}
for (int i = 0; i < len; i++) {
b = c;
c = str.charAt(i);
switch (c) {
case '\\':
case '"':
writer.write("\\");
writer.write(c);
break;
case '/':
if (b == '<') {
writer.write('\\');
}
writer.write(c);
break;
default:
writer.write(escape(c));
}
}
if (isWrap) {
writer.write('"');
}
return writer;
} | java | public static Writer quote(String str, Writer writer, boolean isWrap) throws IOException {
if (StrUtil.isEmpty(str)) {
if (isWrap) {
writer.write("\"\"");
}
return writer;
}
char b; // 前一个字符
char c = 0; // 当前字符
int len = str.length();
if (isWrap) {
writer.write('"');
}
for (int i = 0; i < len; i++) {
b = c;
c = str.charAt(i);
switch (c) {
case '\\':
case '"':
writer.write("\\");
writer.write(c);
break;
case '/':
if (b == '<') {
writer.write('\\');
}
writer.write(c);
break;
default:
writer.write(escape(c));
}
}
if (isWrap) {
writer.write('"');
}
return writer;
} | [
"public",
"static",
"Writer",
"quote",
"(",
"String",
"str",
",",
"Writer",
"writer",
",",
"boolean",
"isWrap",
")",
"throws",
"IOException",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"if",
"(",
"isWrap",
")",
"{",
"writer",... | 对所有双引号做转义处理(使用双反斜杠做转义)<br>
为了能在HTML中较好的显示,会将</转义为<\/<br>
JSON字符串中不能包含控制字符和未经转义的引号和反斜杠
@param str 字符串
@param writer Writer
@param isWrap 是否使用双引号包装字符串
@return Writer
@throws IOException IO异常
@since 3.3.1 | [
"对所有双引号做转义处理(使用双反斜杠做转义)<br",
">",
"为了能在HTML中较好的显示,会将<",
";",
"/",
"转义为<",
";",
"\\",
"/",
"<br",
">",
"JSON字符串中不能包含控制字符和未经转义的引号和反斜杠"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L498-L535 | train | Quote a string. | [
30522,
2270,
10763,
3213,
14686,
1006,
5164,
2358,
2099,
1010,
3213,
3213,
1010,
22017,
20898,
2003,
13088,
9331,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
2358,
2099,
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... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeInt16 | public final int getBeInt16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return (buf[position++] << 8) | (0xff & buf[position++]);
} | java | public final int getBeInt16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return (buf[position++] << 8) | (0xff & buf[position++]);
} | [
"public",
"final",
"int",
"getBeInt16",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"1",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"1",
")",
")",
";... | Return next 16-bit signed int from buffer. (big-endian)
@see mysql-5.1.60/include/my_global.h - mi_sint2korr | [
"Return",
"next",
"16",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L316-L322 | train | Gets a 16 - bit integer from the buffer. | [
30522,
2270,
2345,
20014,
2131,
19205,
3372,
16048,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1015,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileReader.java | FileReader.checkFile | private void checkFile() throws IORuntimeException {
if (false == file.exists()) {
throw new IORuntimeException("File not exist: " + file);
}
if (false == file.isFile()) {
throw new IORuntimeException("Not a file:" + file);
}
} | java | private void checkFile() throws IORuntimeException {
if (false == file.exists()) {
throw new IORuntimeException("File not exist: " + file);
}
if (false == file.isFile()) {
throw new IORuntimeException("Not a file:" + file);
}
} | [
"private",
"void",
"checkFile",
"(",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"\"File not exist: \"",
"+",
"file",
")",
";",
"}",
"if",
"(",
... | 检查文件
@throws IORuntimeException IO异常 | [
"检查文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileReader.java#L285-L292 | train | Checks if the file exists and is a file. | [
30522,
2797,
11675,
4638,
8873,
2571,
1006,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
5371,
1012,
6526,
1006,
1007,
1007,
1063,
5466,
2047,
22834,
15532,
7292,
10288,
24422,
1006,
1000,
5371,
2025,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.join | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, false);
} | java | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, false);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"join",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
")",
"{",
"return",
"join",
"(",
"map",
",",
"separator",
",",
"keyValueSeparator... | 将map转成字符串
@param <K> 键类型
@param <V> 值类型
@param map Map
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@return 连接字符串
@since 3.1.1 | [
"将map转成字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L427-L429 | train | Joins the given map with the given separator and key - value separator. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
5164,
3693,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
5164,
19802,
25879,
2953,
1010,
5164,
3145,
10175,
15808,
13699,
25879,
2953,
1007,
1063,
2709,
3693,
1006,
4949,
1010,
1980... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/HadoopConfigLoader.java | HadoopConfigLoader.getOrLoadHadoopConfig | public org.apache.hadoop.conf.Configuration getOrLoadHadoopConfig() {
org.apache.hadoop.conf.Configuration hadoopConfig = this.hadoopConfig;
if (hadoopConfig == null) {
if (flinkConfig != null) {
hadoopConfig = mirrorCertainHadoopConfig(loadHadoopConfigFromFlink());
}
else {
LOG.warn("Flink configuration is not set prior to loading this configuration."
+ " Cannot forward configuration keys from Flink configuration.");
hadoopConfig = new org.apache.hadoop.conf.Configuration();
}
}
this.hadoopConfig = hadoopConfig;
return hadoopConfig;
} | java | public org.apache.hadoop.conf.Configuration getOrLoadHadoopConfig() {
org.apache.hadoop.conf.Configuration hadoopConfig = this.hadoopConfig;
if (hadoopConfig == null) {
if (flinkConfig != null) {
hadoopConfig = mirrorCertainHadoopConfig(loadHadoopConfigFromFlink());
}
else {
LOG.warn("Flink configuration is not set prior to loading this configuration."
+ " Cannot forward configuration keys from Flink configuration.");
hadoopConfig = new org.apache.hadoop.conf.Configuration();
}
}
this.hadoopConfig = hadoopConfig;
return hadoopConfig;
} | [
"public",
"org",
".",
"apache",
".",
"hadoop",
".",
"conf",
".",
"Configuration",
"getOrLoadHadoopConfig",
"(",
")",
"{",
"org",
".",
"apache",
".",
"hadoop",
".",
"conf",
".",
"Configuration",
"hadoopConfig",
"=",
"this",
".",
"hadoopConfig",
";",
"if",
"... | get the loaded Hadoop config (or fall back to one loaded from the classpath). | [
"get",
"the",
"loaded",
"Hadoop",
"config",
"(",
"or",
"fall",
"back",
"to",
"one",
"loaded",
"from",
"the",
"classpath",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/HadoopConfigLoader.java#L78-L92 | train | Get the hadoop configuration or create one if it does not exist. | [
30522,
2270,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
9530,
2546,
1012,
9563,
2131,
2953,
11066,
16102,
18589,
8663,
8873,
2290,
1006,
1007,
1063,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
9530,
2546,
1012,
9563,
2018,
18589,
8663,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging/LoggingHandler.java | LoggingHandler.formatSimple | private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {
String chStr = ctx.channel().toString();
String msgStr = String.valueOf(msg);
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());
return buf.append(chStr).append(' ').append(eventName).append(": ").append(msgStr).toString();
} | java | private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {
String chStr = ctx.channel().toString();
String msgStr = String.valueOf(msg);
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());
return buf.append(chStr).append(' ').append(eventName).append(": ").append(msgStr).toString();
} | [
"private",
"static",
"String",
"formatSimple",
"(",
"ChannelHandlerContext",
"ctx",
",",
"String",
"eventName",
",",
"Object",
"msg",
")",
"{",
"String",
"chStr",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"msgStr",
"="... | Generates the default log message of the specified event whose argument is an arbitrary object. | [
"Generates",
"the",
"default",
"log",
"message",
"of",
"the",
"specified",
"event",
"whose",
"argument",
"is",
"an",
"arbitrary",
"object",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java#L369-L374 | train | Format a simple event. | [
30522,
2797,
10763,
5164,
11630,
5714,
10814,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
5164,
2724,
18442,
1010,
4874,
5796,
2290,
1007,
1063,
5164,
10381,
3367,
2099,
1027,
14931,
2595,
1012,
3149,
1006,
1007,
1012,
2000,
33... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SmUtil.java | SmUtil.changeC1C3C2ToC1C2C3 | public static byte[] changeC1C3C2ToC1C2C3(byte[] c1c3c2, ECDomainParameters ecDomainParameters) {
// sm2p256v1的这个固定65。可看GMNamedCurves、ECCurve代码。
final int c1Len = (ecDomainParameters.getCurve().getFieldSize() + 7) / 8 * 2 + 1;
final int c3Len = 32; // new SM3Digest().getDigestSize();
byte[] result = new byte[c1c3c2.length];
System.arraycopy(c1c3c2, 0, result, 0, c1Len); // c1: 0->65
System.arraycopy(c1c3c2, c1Len + c3Len, result, c1Len, c1c3c2.length - c1Len - c3Len); // c2
System.arraycopy(c1c3c2, c1Len, result, c1c3c2.length - c3Len, c3Len); // c3
return result;
} | java | public static byte[] changeC1C3C2ToC1C2C3(byte[] c1c3c2, ECDomainParameters ecDomainParameters) {
// sm2p256v1的这个固定65。可看GMNamedCurves、ECCurve代码。
final int c1Len = (ecDomainParameters.getCurve().getFieldSize() + 7) / 8 * 2 + 1;
final int c3Len = 32; // new SM3Digest().getDigestSize();
byte[] result = new byte[c1c3c2.length];
System.arraycopy(c1c3c2, 0, result, 0, c1Len); // c1: 0->65
System.arraycopy(c1c3c2, c1Len + c3Len, result, c1Len, c1c3c2.length - c1Len - c3Len); // c2
System.arraycopy(c1c3c2, c1Len, result, c1c3c2.length - c3Len, c3Len); // c3
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"changeC1C3C2ToC1C2C3",
"(",
"byte",
"[",
"]",
"c1c3c2",
",",
"ECDomainParameters",
"ecDomainParameters",
")",
"{",
"// sm2p256v1的这个固定65。可看GMNamedCurves、ECCurve代码。\r",
"final",
"int",
"c1Len",
"=",
"(",
"ecDomainParameters",
".",
... | bc加解密使用旧标c1||c3||c2,此方法在解密前调用,将密文转化为c1||c2||c3再去解密
@param c1c3c2 加密后的bytes,顺序为C1C3C2
@param ecDomainParameters {@link ECDomainParameters}
@return c1c2c3 加密后的bytes,顺序为C1C2C3 | [
"bc加解密使用旧标c1||c3||c2,此方法在解密前调用,将密文转化为c1||c2||c3再去解密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java#L169-L178 | train | Change the bytes of c1c3c2 to c1c2C3. | [
30522,
2270,
10763,
24880,
1031,
1033,
2689,
2278,
2487,
2278,
2509,
2278,
2475,
3406,
2278,
2487,
2278,
2475,
2278,
2509,
1006,
24880,
1031,
1033,
27723,
2278,
2509,
2278,
2475,
1010,
14925,
9527,
8113,
28689,
22828,
2015,
14925,
9527,
811... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | resource/src/main/java/com/networknt/resource/ResourceHelpers.java | ResourceHelpers.isResourcePath | public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) {
boolean isResourcePath = false;
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
if ((pathResourceProvider.isPrefixPath() && requestPath.startsWith(pathResourceProvider.getPath()))
|| (!pathResourceProvider.isPrefixPath() && requestPath.equals(pathResourceProvider.getPath()))) {
isResourcePath = true;
}
}
}
return isResourcePath;
} | java | public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) {
boolean isResourcePath = false;
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
if ((pathResourceProvider.isPrefixPath() && requestPath.startsWith(pathResourceProvider.getPath()))
|| (!pathResourceProvider.isPrefixPath() && requestPath.equals(pathResourceProvider.getPath()))) {
isResourcePath = true;
}
}
}
return isResourcePath;
} | [
"public",
"static",
"boolean",
"isResourcePath",
"(",
"String",
"requestPath",
",",
"PathResourceProvider",
"[",
"]",
"pathResourceProviders",
")",
"{",
"boolean",
"isResourcePath",
"=",
"false",
";",
"if",
"(",
"pathResourceProviders",
"!=",
"null",
"&&",
"pathReso... | Helper to check if a given requestPath could resolve to a PathResourceProvider.
@param requestPath The client request path.
@param pathResourceProviders The list of PathResourceProviders that could potentially resolve this path.
@return true if the path could resolve, false otherwise. | [
"Helper",
"to",
"check",
"if",
"a",
"given",
"requestPath",
"could",
"resolve",
"to",
"a",
"PathResourceProvider",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L72-L83 | train | Is the resource path | [
30522,
2270,
10763,
22017,
20898,
2003,
6072,
8162,
3401,
15069,
1006,
5164,
5227,
15069,
1010,
4130,
6072,
8162,
3401,
21572,
17258,
2121,
1031,
1033,
4130,
6072,
8162,
3401,
21572,
17258,
2545,
1007,
1063,
22017,
20898,
2003,
6072,
8162,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.header | public T header(Map<String, List<String>> headers, boolean isOverride) {
if(CollectionUtil.isEmpty(headers)) {
return (T)this;
}
String name;
for (Entry<String, List<String>> entry : headers.entrySet()) {
name = entry.getKey();
for (String value : entry.getValue()) {
this.header(name, StrUtil.nullToEmpty(value), isOverride);
}
}
return (T)this;
} | java | public T header(Map<String, List<String>> headers, boolean isOverride) {
if(CollectionUtil.isEmpty(headers)) {
return (T)this;
}
String name;
for (Entry<String, List<String>> entry : headers.entrySet()) {
name = entry.getKey();
for (String value : entry.getValue()) {
this.header(name, StrUtil.nullToEmpty(value), isOverride);
}
}
return (T)this;
} | [
"public",
"T",
"header",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
",",
"boolean",
"isOverride",
")",
"{",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"headers",
")",
")",
"{",
"return",
"(",
"T",
")",
"this",
... | 设置请求头<br>
不覆盖原有请求头
@param headers 请求头
@param isOverride 是否覆盖已有头信息
@return this
@since 4.0.8 | [
"设置请求头<br",
">",
"不覆盖原有请求头"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L157-L170 | train | Adds a header to the response. | [
30522,
2270,
1056,
20346,
1006,
4949,
1026,
5164,
1010,
2862,
1026,
5164,
1028,
1028,
20346,
2015,
1010,
22017,
20898,
11163,
6299,
15637,
1007,
1063,
2065,
1006,
3074,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
20346,
2015,
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 | client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java | ClientX509ExtendedTrustManager.doCustomServerIdentityCheck | private void doCustomServerIdentityCheck(X509Certificate cert) throws CertificateException{
if (EndpointIdentificationAlgorithm.APIS == identityAlg) {
APINameChecker.verifyAndThrow(trustedNameSet, cert);
}
} | java | private void doCustomServerIdentityCheck(X509Certificate cert) throws CertificateException{
if (EndpointIdentificationAlgorithm.APIS == identityAlg) {
APINameChecker.verifyAndThrow(trustedNameSet, cert);
}
} | [
"private",
"void",
"doCustomServerIdentityCheck",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"EndpointIdentificationAlgorithm",
".",
"APIS",
"==",
"identityAlg",
")",
"{",
"APINameChecker",
".",
"verifyAndThrow",
"(",
"trusted... | check server identify as per tls.trustedNames in client.yml.
Notes: this method should only be applied to verify server certificates on the client side.
@param cert
@throws CertificateException | [
"check",
"server",
"identify",
"as",
"per",
"tls",
".",
"trustedNames",
"in",
"client",
".",
"yml",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java#L144-L148 | train | Do the custom server identity check. | [
30522,
2797,
11675,
9986,
19966,
22225,
2121,
6299,
5178,
16778,
3723,
5403,
3600,
1006,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
8292,
5339,
1007,
11618,
8196,
10288,
24422,
1063,
2065,
1006,
2203,
8400,
5178,
16778,
10803,
2389,
20255,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static BufferedImage generate(String content, BarcodeFormat format, QrConfig config) {
final BitMatrix bitMatrix = encode(content, format, config);
final BufferedImage image = toImage(bitMatrix, config.foreColor, config.backColor);
final Image logoImg = config.img;
if (null != logoImg && BarcodeFormat.QR_CODE == format) {
// 只有二维码可以贴图
final int qrWidth = image.getWidth();
final int qrHeight = image.getHeight();
int width;
int height;
// 按照最短的边做比例缩放
if (qrWidth < qrHeight) {
width = qrWidth / config.ratio;
height = logoImg.getHeight(null) * width / logoImg.getWidth(null);
} else {
height = qrHeight / config.ratio;
width = logoImg.getWidth(null) * height / logoImg.getHeight(null);
}
Img.from(image).pressImage(//
Img.from(logoImg).round(0.3).getImg(), // 圆角
new Rectangle(width, height), //
1//
);
}
return image;
} | java | public static BufferedImage generate(String content, BarcodeFormat format, QrConfig config) {
final BitMatrix bitMatrix = encode(content, format, config);
final BufferedImage image = toImage(bitMatrix, config.foreColor, config.backColor);
final Image logoImg = config.img;
if (null != logoImg && BarcodeFormat.QR_CODE == format) {
// 只有二维码可以贴图
final int qrWidth = image.getWidth();
final int qrHeight = image.getHeight();
int width;
int height;
// 按照最短的边做比例缩放
if (qrWidth < qrHeight) {
width = qrWidth / config.ratio;
height = logoImg.getHeight(null) * width / logoImg.getWidth(null);
} else {
height = qrHeight / config.ratio;
width = logoImg.getWidth(null) * height / logoImg.getHeight(null);
}
Img.from(image).pressImage(//
Img.from(logoImg).round(0.3).getImg(), // 圆角
new Rectangle(width, height), //
1//
);
}
return image;
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"QrConfig",
"config",
")",
"{",
"final",
"BitMatrix",
"bitMatrix",
"=",
"encode",
"(",
"content",
",",
"format",
",",
"config",
")",
";",
"final",
... | 生成二维码或条形码图片<br>
只有二维码时QrConfig中的图片才有效
@param content 文本内容
@param format 格式,可选二维码、条形码等
@param config 二维码配置,包括长、宽、边距、颜色等
@return 二维码图片(黑白)
@since 4.1.14 | [
"生成二维码或条形码图片<br",
">",
"只有二维码时QrConfig中的图片才有效"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L172-L198 | train | Generates a BufferedImage from a String content and a QrConfig. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
9699,
1006,
5164,
4180,
1010,
3347,
16044,
14192,
4017,
4289,
1010,
1053,
29566,
2078,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2345,
2978,
18900,
17682,
2978,
18900,
17682,
1027,
4372,
16044,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.createFont | public static Font createFont(InputStream fontStream) {
try {
return Font.createFont(Font.TRUETYPE_FONT, fontStream);
} catch (FontFormatException e) {
// True Type字体无效时使用Type1字体
try {
return Font.createFont(Font.TYPE1_FONT, fontStream);
} catch (Exception e1) {
throw new UtilException(e1);
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static Font createFont(InputStream fontStream) {
try {
return Font.createFont(Font.TRUETYPE_FONT, fontStream);
} catch (FontFormatException e) {
// True Type字体无效时使用Type1字体
try {
return Font.createFont(Font.TYPE1_FONT, fontStream);
} catch (Exception e1) {
throw new UtilException(e1);
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"Font",
"createFont",
"(",
"InputStream",
"fontStream",
")",
"{",
"try",
"{",
"return",
"Font",
".",
"createFont",
"(",
"Font",
".",
"TRUETYPE_FONT",
",",
"fontStream",
")",
";",
"}",
"catch",
"(",
"FontFormatException",
"e",
")",
"{",
... | 根据文件创建字体<br>
首先尝试创建{@link Font#TRUETYPE_FONT}字体,此类字体无效则创建{@link Font#TYPE1_FONT}
@param fontStream 字体流
@return {@link Font}
@since 3.0.9 | [
"根据文件创建字体<br",
">",
"首先尝试创建",
"{",
"@link",
"Font#TRUETYPE_FONT",
"}",
"字体,此类字体无效则创建",
"{",
"@link",
"Font#TYPE1_FONT",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1319-L1332 | train | Creates a Font object from the specified input stream. | [
30522,
2270,
10763,
15489,
3443,
14876,
3372,
1006,
20407,
25379,
15489,
21422,
1007,
1063,
3046,
1063,
2709,
15489,
1012,
3443,
14876,
3372,
1006,
15489,
1012,
2995,
13874,
1035,
15489,
1010,
15489,
21422,
1007,
1025,
1065,
4608,
1006,
15489... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NetUtils.java | NetUtils.socketAddressToUrlString | public static String socketAddressToUrlString(InetSocketAddress address) {
if (address.isUnresolved()) {
throw new IllegalArgumentException("Address cannot be resolved: " + address.getHostString());
}
return ipAddressAndPortToUrlString(address.getAddress(), address.getPort());
} | java | public static String socketAddressToUrlString(InetSocketAddress address) {
if (address.isUnresolved()) {
throw new IllegalArgumentException("Address cannot be resolved: " + address.getHostString());
}
return ipAddressAndPortToUrlString(address.getAddress(), address.getPort());
} | [
"public",
"static",
"String",
"socketAddressToUrlString",
"(",
"InetSocketAddress",
"address",
")",
"{",
"if",
"(",
"address",
".",
"isUnresolved",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Address cannot be resolved: \"",
"+",
"address",... | Encodes an IP address and port to be included in URL. in particular, this method makes
sure that IPv6 addresses have the proper formatting to be included in URLs.
@param address The socket address with the IP address and port.
@return The proper URL string encoded IP address and port. | [
"Encodes",
"an",
"IP",
"address",
"and",
"port",
"to",
"be",
"included",
"in",
"URL",
".",
"in",
"particular",
"this",
"method",
"makes",
"sure",
"that",
"IPv6",
"addresses",
"have",
"the",
"proper",
"formatting",
"to",
"be",
"included",
"in",
"URLs",
"."
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L212-L217 | train | Converts a socket address to a URL string. | [
30522,
2270,
10763,
5164,
22278,
4215,
16200,
4757,
21163,
4877,
18886,
3070,
1006,
1999,
8454,
7432,
12928,
14141,
8303,
4769,
1007,
1063,
2065,
1006,
4769,
1012,
2003,
4609,
6072,
16116,
1006,
1007,
1007,
1063,
5466,
2047,
6206,
2906,
228... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getInt24 | public final int getInt24(final int pos) {
final int position = origin + pos;
if (pos + 2 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 2)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((buf[position + 2]) << 16);
} | java | public final int getInt24(final int pos) {
final int position = origin + pos;
if (pos + 2 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 2)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((buf[position + 2]) << 16);
} | [
"public",
"final",
"int",
"getInt24",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"2",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
... | Return 24-bit signed int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - sint3korr | [
"Return",
"24",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L357-L365 | train | Gets an int 24 - bit value from the buffer. | [
30522,
2270,
2345,
20014,
2131,
18447,
18827,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1016,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.secureScheme | public URLNormalizer secureScheme() {
Matcher m = PATTERN_SCHEMA.matcher(url);
if (m.find()) {
String schema = m.group(1);
if ("http".equalsIgnoreCase(schema)) {
url = m.replaceFirst(schema + "s$2");
}
}
return this;
} | java | public URLNormalizer secureScheme() {
Matcher m = PATTERN_SCHEMA.matcher(url);
if (m.find()) {
String schema = m.group(1);
if ("http".equalsIgnoreCase(schema)) {
url = m.replaceFirst(schema + "s$2");
}
}
return this;
} | [
"public",
"URLNormalizer",
"secureScheme",
"(",
")",
"{",
"Matcher",
"m",
"=",
"PATTERN_SCHEMA",
".",
"matcher",
"(",
"url",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"String",
"schema",
"=",
"m",
".",
"group",
"(",
"1",
")",
";",
... | <p>Converts <code>http</code> scheme to <code>https</code>.</p>
<code>http://www.example.com/ → https://www.example.com/</code>
@return this instance | [
"<p",
">",
"Converts",
"<code",
">",
"http<",
"/",
"code",
">",
"scheme",
"to",
"<code",
">",
"https<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">",
"<code",
">",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"&rarr",
";",
"https",
"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L604-L613 | train | Secure scheme. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
5851,
22842,
4168,
1006,
1007,
1063,
2674,
2121,
1049,
1027,
5418,
1035,
8040,
28433,
1012,
2674,
2121,
1006,
24471,
2140,
1007,
1025,
2065,
1006,
1049,
1012,
2424,
1006,
1007,
1007,
1063,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.contentEquals | public static boolean contentEquals(CharSequence a, CharSequence b) {
if (a == null || b == null) {
return a == b;
}
if (a.getClass() == AsciiString.class) {
return ((AsciiString) a).contentEquals(b);
}
if (b.getClass() == AsciiString.class) {
return ((AsciiString) b).contentEquals(a);
}
if (a.length() != b.length()) {
return false;
}
for (int i = 0; i < a.length(); ++i) {
if (a.charAt(i) != b.charAt(i)) {
return false;
}
}
return true;
} | java | public static boolean contentEquals(CharSequence a, CharSequence b) {
if (a == null || b == null) {
return a == b;
}
if (a.getClass() == AsciiString.class) {
return ((AsciiString) a).contentEquals(b);
}
if (b.getClass() == AsciiString.class) {
return ((AsciiString) b).contentEquals(a);
}
if (a.length() != b.length()) {
return false;
}
for (int i = 0; i < a.length(); ++i) {
if (a.charAt(i) != b.charAt(i)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"contentEquals",
"(",
"CharSequence",
"a",
",",
"CharSequence",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
")",
"{",
"return",
"a",
"==",
"b",
";",
"}",
"if",
"(",
"a",
".",
"getClass",
"(",... | Returns {@code true} if the content of both {@link CharSequence}'s are equals. This only supports 8-bit ASCII. | [
"Returns",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1502-L1524 | train | contentEquals Method. | [
30522,
2270,
10763,
22017,
20898,
4180,
2063,
26426,
2015,
1006,
25869,
3366,
4226,
5897,
1037,
1010,
25869,
3366,
4226,
5897,
1038,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
19701,
1064,
1064,
1038,
1027,
1027,
19701,
1007,
1063,
2709,
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/flink | flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java | ConfigurationUtils.parseLocalStateDirectories | @Nonnull
public static String[] parseLocalStateDirectories(Configuration configuration) {
String configValue = configuration.getString(CheckpointingOptions.LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS, "");
return splitPaths(configValue);
} | java | @Nonnull
public static String[] parseLocalStateDirectories(Configuration configuration) {
String configValue = configuration.getString(CheckpointingOptions.LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS, "");
return splitPaths(configValue);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"[",
"]",
"parseLocalStateDirectories",
"(",
"Configuration",
"configuration",
")",
"{",
"String",
"configValue",
"=",
"configuration",
".",
"getString",
"(",
"CheckpointingOptions",
".",
"LOCAL_RECOVERY_TASK_MANAGER_STATE_ROO... | Extracts the local state directories as defined by
{@link CheckpointingOptions#LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS}.
@param configuration configuration object
@return array of configured directories (in order) | [
"Extracts",
"the",
"local",
"state",
"directories",
"as",
"defined",
"by",
"{",
"@link",
"CheckpointingOptions#LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java#L110-L114 | train | Parses the configuration value of the CheckpointingOptions. LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS property. | [
30522,
1030,
2512,
11231,
3363,
2270,
10763,
5164,
1031,
1033,
11968,
11246,
24755,
4877,
16238,
7442,
16761,
3111,
1006,
9563,
9563,
1007,
1063,
5164,
9530,
8873,
2290,
10175,
5657,
1027,
9563,
1012,
4152,
18886,
3070,
1006,
26520,
2075,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/impl/ArrayConverter.java | ArrayConverter.convertArrayToArray | private Object convertArrayToArray(Object array) {
final Class<?> valueComponentType = ArrayUtil.getComponentType(array);
if (valueComponentType == targetComponentType) {
return array;
}
final int len = ArrayUtil.length(array);
final Object result = Array.newInstance(targetComponentType, len);
final ConverterRegistry converter = ConverterRegistry.getInstance();
for (int i = 0; i < len; i++) {
Array.set(result, i, converter.convert(targetComponentType, Array.get(array, i)));
}
return result;
} | java | private Object convertArrayToArray(Object array) {
final Class<?> valueComponentType = ArrayUtil.getComponentType(array);
if (valueComponentType == targetComponentType) {
return array;
}
final int len = ArrayUtil.length(array);
final Object result = Array.newInstance(targetComponentType, len);
final ConverterRegistry converter = ConverterRegistry.getInstance();
for (int i = 0; i < len; i++) {
Array.set(result, i, converter.convert(targetComponentType, Array.get(array, i)));
}
return result;
} | [
"private",
"Object",
"convertArrayToArray",
"(",
"Object",
"array",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"valueComponentType",
"=",
"ArrayUtil",
".",
"getComponentType",
"(",
"array",
")",
";",
"if",
"(",
"valueComponentType",
"==",
"targetComponentType",
... | 数组对数组转换
@param array 被转换的数组值
@return 转换后的数组 | [
"数组对数组转换"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/impl/ArrayConverter.java#L64-L79 | train | Convert array to array. | [
30522,
2797,
4874,
10463,
2906,
9447,
3406,
2906,
9447,
1006,
4874,
9140,
1007,
1063,
2345,
2465,
1026,
1029,
1028,
3643,
9006,
29513,
3372,
13874,
1027,
9140,
21823,
2140,
1012,
2131,
9006,
29513,
3372,
13874,
1006,
9140,
1007,
1025,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TTypeQualifiers.java | TTypeQualifiers.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case QUALIFIERS:
return isSetQualifiers();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case QUALIFIERS:
return isSetQualifiers();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"QUALIFIERS",
":",
"return",
"isSetQual... | 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/TTypeQualifiers.java#L214-L224 | train | Checks if the specified field is set to a value of a CRA S Grammar. | [
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,
1895... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java | SpdyCodecUtil.getSignedInt | static int getSignedInt(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0xFF) << 24 |
(buf.getByte(offset + 1) & 0xFF) << 16 |
(buf.getByte(offset + 2) & 0xFF) << 8 |
buf.getByte(offset + 3) & 0xFF;
} | java | static int getSignedInt(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0xFF) << 24 |
(buf.getByte(offset + 1) & 0xFF) << 16 |
(buf.getByte(offset + 2) & 0xFF) << 8 |
buf.getByte(offset + 3) & 0xFF;
} | [
"static",
"int",
"getSignedInt",
"(",
"ByteBuf",
"buf",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"buf",
".",
"getByte",
"(",
"offset",
")",
"&",
"0xFF",
")",
"<<",
"24",
"|",
"(",
"buf",
".",
"getByte",
"(",
"offset",
"+",
"1",
")",
"&",
"0... | Reads a big-endian signed integer from the buffer. | [
"Reads",
"a",
"big",
"-",
"endian",
"signed",
"integer",
"from",
"the",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java#L270-L275 | train | Get signed int from buffer. | [
30522,
10763,
20014,
4152,
23773,
2098,
18447,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
16396,
1007,
1063,
2709,
1006,
20934,
2546,
1012,
2131,
3762,
2618,
1006,
16396,
1007,
1004,
1014,
2595,
4246,
1007,
1026,
1026,
2484,
1064,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java | PerceptronLexicalAnalyzer.learn | public boolean learn(Sentence sentence)
{
CharTable.normalize(sentence);
if (!getPerceptronSegmenter().learn(sentence)) return false;
if (posTagger != null && !getPerceptronPOSTagger().learn(sentence)) return false;
if (neRecognizer != null && !getPerceptionNERecognizer().learn(sentence)) return false;
return true;
} | java | public boolean learn(Sentence sentence)
{
CharTable.normalize(sentence);
if (!getPerceptronSegmenter().learn(sentence)) return false;
if (posTagger != null && !getPerceptronPOSTagger().learn(sentence)) return false;
if (neRecognizer != null && !getPerceptionNERecognizer().learn(sentence)) return false;
return true;
} | [
"public",
"boolean",
"learn",
"(",
"Sentence",
"sentence",
")",
"{",
"CharTable",
".",
"normalize",
"(",
"sentence",
")",
";",
"if",
"(",
"!",
"getPerceptronSegmenter",
"(",
")",
".",
"learn",
"(",
"sentence",
")",
")",
"return",
"false",
";",
"if",
"(",... | 在线学习
@param sentence 已分词、标好词性和命名实体的人民日报2014格式的句子
@return 是否学习成果(失败的原因是句子格式不合法) | [
"在线学习"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java#L159-L166 | train | Learn a sentence using the CSP algorithm. | [
30522,
2270,
22017,
20898,
4553,
1006,
6251,
6251,
1007,
1063,
3673,
3085,
1012,
3671,
4697,
1006,
6251,
1007,
1025,
2065,
1006,
999,
2131,
4842,
3401,
13876,
28212,
13910,
3672,
2121,
1006,
1007,
1012,
4553,
1006,
6251,
1007,
1007,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java | KinesisDataFetcher.updateState | protected final void updateState(int shardStateIndex, SequenceNumber lastSequenceNumber) {
synchronized (checkpointLock) {
subscribedShardsState.get(shardStateIndex).setLastProcessedSequenceNum(lastSequenceNumber);
// if a shard's state is updated to be SENTINEL_SHARD_ENDING_SEQUENCE_NUM by its consumer thread,
// we've finished reading the shard and should determine it to be non-active
if (lastSequenceNumber.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
LOG.info("Subtask {} has reached the end of subscribed shard: {}",
indexOfThisConsumerSubtask, subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
// check if we need to mark the source as idle;
// note that on resharding, if registerNewSubscribedShardState was invoked for newly discovered shards
// AFTER the old shards had reached the end, the subtask's status will be automatically toggled back to
// be active immediately afterwards as soon as we collect records from the new shards
if (this.numberOfActiveShards.decrementAndGet() == 0) {
LOG.info("Subtask {} has reached the end of all currently subscribed shards; marking the subtask as temporarily idle ...",
indexOfThisConsumerSubtask);
sourceContext.markAsTemporarilyIdle();
}
}
}
} | java | protected final void updateState(int shardStateIndex, SequenceNumber lastSequenceNumber) {
synchronized (checkpointLock) {
subscribedShardsState.get(shardStateIndex).setLastProcessedSequenceNum(lastSequenceNumber);
// if a shard's state is updated to be SENTINEL_SHARD_ENDING_SEQUENCE_NUM by its consumer thread,
// we've finished reading the shard and should determine it to be non-active
if (lastSequenceNumber.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
LOG.info("Subtask {} has reached the end of subscribed shard: {}",
indexOfThisConsumerSubtask, subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
// check if we need to mark the source as idle;
// note that on resharding, if registerNewSubscribedShardState was invoked for newly discovered shards
// AFTER the old shards had reached the end, the subtask's status will be automatically toggled back to
// be active immediately afterwards as soon as we collect records from the new shards
if (this.numberOfActiveShards.decrementAndGet() == 0) {
LOG.info("Subtask {} has reached the end of all currently subscribed shards; marking the subtask as temporarily idle ...",
indexOfThisConsumerSubtask);
sourceContext.markAsTemporarilyIdle();
}
}
}
} | [
"protected",
"final",
"void",
"updateState",
"(",
"int",
"shardStateIndex",
",",
"SequenceNumber",
"lastSequenceNumber",
")",
"{",
"synchronized",
"(",
"checkpointLock",
")",
"{",
"subscribedShardsState",
".",
"get",
"(",
"shardStateIndex",
")",
".",
"setLastProcessed... | Update the shard to last processed sequence number state.
This method is called by {@link ShardConsumer}s.
@param shardStateIndex index of the shard to update in subscribedShardsState;
this index should be the returned value from
{@link KinesisDataFetcher#registerNewSubscribedShardState(KinesisStreamShardState)}, called
when the shard state was registered.
@param lastSequenceNumber the last sequence number value to update | [
"Update",
"the",
"shard",
"to",
"last",
"processed",
"sequence",
"number",
"state",
".",
"This",
"method",
"is",
"called",
"by",
"{",
"@link",
"ShardConsumer",
"}",
"s",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L641-L663 | train | Updates the state of the subscribed shards. | [
30522,
5123,
2345,
11675,
30524,
2063,
4226,
5897,
19172,
5677,
1007,
1063,
25549,
1006,
26520,
7878,
1007,
1063,
4942,
29234,
5104,
11783,
4757,
12259,
1012,
2131,
1006,
23327,
12259,
22254,
10288,
1007,
1012,
2275,
8523,
25856,
3217,
9623,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java | PojoSerializerSnapshot.buildNewFieldSerializersIndex | private static <T> Map<Field, TypeSerializer<?>> buildNewFieldSerializersIndex(PojoSerializer<T> newPojoSerializer) {
final Field[] newFields = newPojoSerializer.getFields();
final TypeSerializer<?>[] newFieldSerializers = newPojoSerializer.getFieldSerializers();
checkState(newFields.length == newFieldSerializers.length);
int numFields = newFields.length;
final Map<Field, TypeSerializer<?>> index = new HashMap<>(numFields);
for (int i = 0; i < numFields; i++) {
index.put(newFields[i], newFieldSerializers[i]);
}
return index;
} | java | private static <T> Map<Field, TypeSerializer<?>> buildNewFieldSerializersIndex(PojoSerializer<T> newPojoSerializer) {
final Field[] newFields = newPojoSerializer.getFields();
final TypeSerializer<?>[] newFieldSerializers = newPojoSerializer.getFieldSerializers();
checkState(newFields.length == newFieldSerializers.length);
int numFields = newFields.length;
final Map<Field, TypeSerializer<?>> index = new HashMap<>(numFields);
for (int i = 0; i < numFields; i++) {
index.put(newFields[i], newFieldSerializers[i]);
}
return index;
} | [
"private",
"static",
"<",
"T",
">",
"Map",
"<",
"Field",
",",
"TypeSerializer",
"<",
"?",
">",
">",
"buildNewFieldSerializersIndex",
"(",
"PojoSerializer",
"<",
"T",
">",
"newPojoSerializer",
")",
"{",
"final",
"Field",
"[",
"]",
"newFields",
"=",
"newPojoSe... | Builds an index of fields to their corresponding serializers for the
new {@link PojoSerializer} for faster field serializer lookups. | [
"Builds",
"an",
"index",
"of",
"fields",
"to",
"their",
"corresponding",
"serializers",
"for",
"the",
"new",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L298-L311 | train | Build a map of field serializers to index. | [
30522,
2797,
10763,
1026,
1056,
1028,
4949,
1026,
2492,
1010,
4127,
11610,
28863,
1026,
1029,
1028,
1028,
3857,
2638,
2860,
15155,
11610,
28863,
11493,
3207,
2595,
1006,
13433,
19929,
11610,
28863,
1026,
1056,
1028,
2047,
6873,
19929,
11610,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08Fetcher.java | Kafka08Fetcher.getTopics | private static List<String> getTopics(List<KafkaTopicPartitionState<TopicAndPartition>> partitions) {
HashSet<String> uniqueTopics = new HashSet<>();
for (KafkaTopicPartitionState<TopicAndPartition> fp: partitions) {
uniqueTopics.add(fp.getTopic());
}
return new ArrayList<>(uniqueTopics);
} | java | private static List<String> getTopics(List<KafkaTopicPartitionState<TopicAndPartition>> partitions) {
HashSet<String> uniqueTopics = new HashSet<>();
for (KafkaTopicPartitionState<TopicAndPartition> fp: partitions) {
uniqueTopics.add(fp.getTopic());
}
return new ArrayList<>(uniqueTopics);
} | [
"private",
"static",
"List",
"<",
"String",
">",
"getTopics",
"(",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"TopicAndPartition",
">",
">",
"partitions",
")",
"{",
"HashSet",
"<",
"String",
">",
"uniqueTopics",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",... | Returns a list of unique topics from for the given partitions.
@param partitions A the partitions
@return A list of unique topics | [
"Returns",
"a",
"list",
"of",
"unique",
"topics",
"from",
"for",
"the",
"given",
"partitions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08Fetcher.java#L413-L419 | train | Get the topics from a list of Kafka topics. | [
30522,
2797,
10763,
2862,
1026,
5164,
1028,
2131,
14399,
6558,
1006,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
8476,
5685,
19362,
3775,
3508,
1028,
1028,
13571,
2015,
1007,
1063,
23325,
13462,
1026,
5164,
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/util/EnumUtil.java | EnumUtil.getFieldNames | public static List<String> getFieldNames(Class<? extends Enum<?>> clazz) {
final List<String> names = new ArrayList<>();
final Field[] fields = ReflectUtil.getFields(clazz);
String name;
for (Field field : fields) {
name = field.getName();
if (field.getType().isEnum() || name.contains("$VALUES") || "ordinal".equals(name)) {
continue;
}
if(false == names.contains(name)) {
names.add(name);
}
}
return names;
} | java | public static List<String> getFieldNames(Class<? extends Enum<?>> clazz) {
final List<String> names = new ArrayList<>();
final Field[] fields = ReflectUtil.getFields(clazz);
String name;
for (Field field : fields) {
name = field.getName();
if (field.getType().isEnum() || name.contains("$VALUES") || "ordinal".equals(name)) {
continue;
}
if(false == names.contains(name)) {
names.add(name);
}
}
return names;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getFieldNames",
"(",
"Class",
"<",
"?",
"extends",
"Enum",
"<",
"?",
">",
">",
"clazz",
")",
"{",
"final",
"List",
"<",
"String",
">",
"names",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
... | 获得枚举类中所有的字段名<br>
除用户自定义的字段名,也包括“name”字段,例如:
<pre>
EnumUtil.getFieldNames(Color.class) == ["name", "index"]
</pre>
@param clazz 枚举类
@return 字段名列表
@since 4.1.20 | [
"获得枚举类中所有的字段名<br",
">",
"除用户自定义的字段名,也包括“name”字段,例如:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L146-L160 | train | Gets the field names of the given enum class. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
3790,
18442,
2015,
1006,
2465,
1026,
1029,
8908,
4372,
2819,
1026,
1029,
1028,
1028,
18856,
10936,
2480,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
3415,
1027,
2047,
9140,
9863,
1026,
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... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java | DnsNameResolver.query | public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
DnsQuestion question, Promise<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>> promise) {
return query(nextNameServerAddress(), question, Collections.<DnsRecord>emptyList(), promise);
} | java | public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
DnsQuestion question, Promise<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>> promise) {
return query(nextNameServerAddress(), question, Collections.<DnsRecord>emptyList(), promise);
} | [
"public",
"Future",
"<",
"AddressedEnvelope",
"<",
"DnsResponse",
",",
"InetSocketAddress",
">",
">",
"query",
"(",
"DnsQuestion",
"question",
",",
"Promise",
"<",
"AddressedEnvelope",
"<",
"?",
"extends",
"DnsResponse",
",",
"InetSocketAddress",
">",
">",
"promis... | Sends a DNS query with the specified question. | [
"Sends",
"a",
"DNS",
"query",
"with",
"the",
"specified",
"question",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L1058-L1061 | train | Query a single authority record. | [
30522,
2270,
2925,
1026,
8280,
2368,
15985,
17635,
1026,
1040,
3619,
6072,
26029,
3366,
1010,
1999,
8454,
7432,
12928,
14141,
8303,
1028,
1028,
23032,
1006,
1040,
3619,
15500,
3258,
3160,
1010,
4872,
1026,
8280,
2368,
15985,
17635,
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... |
netty/netty | codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java | HAProxyMessage.decodeHeader | static HAProxyMessage decodeHeader(ByteBuf header) {
if (header == null) {
throw new NullPointerException("header");
}
if (header.readableBytes() < 16) {
throw new HAProxyProtocolException(
"incomplete header: " + header.readableBytes() + " bytes (expected: 16+ bytes)");
}
// Per spec, the 13th byte is the protocol version and command byte
header.skipBytes(12);
final byte verCmdByte = header.readByte();
HAProxyProtocolVersion ver;
try {
ver = HAProxyProtocolVersion.valueOf(verCmdByte);
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (ver != HAProxyProtocolVersion.V2) {
throw new HAProxyProtocolException("version 1 unsupported: 0x" + Integer.toHexString(verCmdByte));
}
HAProxyCommand cmd;
try {
cmd = HAProxyCommand.valueOf(verCmdByte);
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (cmd == HAProxyCommand.LOCAL) {
return V2_LOCAL_MSG;
}
// Per spec, the 14th byte is the protocol and address family byte
HAProxyProxiedProtocol protAndFam;
try {
protAndFam = HAProxyProxiedProtocol.valueOf(header.readByte());
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (protAndFam == HAProxyProxiedProtocol.UNKNOWN) {
return V2_UNKNOWN_MSG;
}
int addressInfoLen = header.readUnsignedShort();
String srcAddress;
String dstAddress;
int addressLen;
int srcPort = 0;
int dstPort = 0;
AddressFamily addressFamily = protAndFam.addressFamily();
if (addressFamily == AddressFamily.AF_UNIX) {
// unix sockets require 216 bytes for address information
if (addressInfoLen < 216 || header.readableBytes() < 216) {
throw new HAProxyProtocolException(
"incomplete UNIX socket address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 216+ bytes)");
}
int startIdx = header.readerIndex();
int addressEnd = header.forEachByte(startIdx, 108, ByteProcessor.FIND_NUL);
if (addressEnd == -1) {
addressLen = 108;
} else {
addressLen = addressEnd - startIdx;
}
srcAddress = header.toString(startIdx, addressLen, CharsetUtil.US_ASCII);
startIdx += 108;
addressEnd = header.forEachByte(startIdx, 108, ByteProcessor.FIND_NUL);
if (addressEnd == -1) {
addressLen = 108;
} else {
addressLen = addressEnd - startIdx;
}
dstAddress = header.toString(startIdx, addressLen, CharsetUtil.US_ASCII);
// AF_UNIX defines that exactly 108 bytes are reserved for the address. The previous methods
// did not increase the reader index although we already consumed the information.
header.readerIndex(startIdx + 108);
} else {
if (addressFamily == AddressFamily.AF_IPv4) {
// IPv4 requires 12 bytes for address information
if (addressInfoLen < 12 || header.readableBytes() < 12) {
throw new HAProxyProtocolException(
"incomplete IPv4 address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 12+ bytes)");
}
addressLen = 4;
} else if (addressFamily == AddressFamily.AF_IPv6) {
// IPv6 requires 36 bytes for address information
if (addressInfoLen < 36 || header.readableBytes() < 36) {
throw new HAProxyProtocolException(
"incomplete IPv6 address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 36+ bytes)");
}
addressLen = 16;
} else {
throw new HAProxyProtocolException(
"unable to parse address information (unknown address family: " + addressFamily + ')');
}
// Per spec, the src address begins at the 17th byte
srcAddress = ipBytesToString(header, addressLen);
dstAddress = ipBytesToString(header, addressLen);
srcPort = header.readUnsignedShort();
dstPort = header.readUnsignedShort();
}
final List<HAProxyTLV> tlvs = readTlvs(header);
return new HAProxyMessage(ver, cmd, protAndFam, srcAddress, dstAddress, srcPort, dstPort, tlvs);
} | java | static HAProxyMessage decodeHeader(ByteBuf header) {
if (header == null) {
throw new NullPointerException("header");
}
if (header.readableBytes() < 16) {
throw new HAProxyProtocolException(
"incomplete header: " + header.readableBytes() + " bytes (expected: 16+ bytes)");
}
// Per spec, the 13th byte is the protocol version and command byte
header.skipBytes(12);
final byte verCmdByte = header.readByte();
HAProxyProtocolVersion ver;
try {
ver = HAProxyProtocolVersion.valueOf(verCmdByte);
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (ver != HAProxyProtocolVersion.V2) {
throw new HAProxyProtocolException("version 1 unsupported: 0x" + Integer.toHexString(verCmdByte));
}
HAProxyCommand cmd;
try {
cmd = HAProxyCommand.valueOf(verCmdByte);
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (cmd == HAProxyCommand.LOCAL) {
return V2_LOCAL_MSG;
}
// Per spec, the 14th byte is the protocol and address family byte
HAProxyProxiedProtocol protAndFam;
try {
protAndFam = HAProxyProxiedProtocol.valueOf(header.readByte());
} catch (IllegalArgumentException e) {
throw new HAProxyProtocolException(e);
}
if (protAndFam == HAProxyProxiedProtocol.UNKNOWN) {
return V2_UNKNOWN_MSG;
}
int addressInfoLen = header.readUnsignedShort();
String srcAddress;
String dstAddress;
int addressLen;
int srcPort = 0;
int dstPort = 0;
AddressFamily addressFamily = protAndFam.addressFamily();
if (addressFamily == AddressFamily.AF_UNIX) {
// unix sockets require 216 bytes for address information
if (addressInfoLen < 216 || header.readableBytes() < 216) {
throw new HAProxyProtocolException(
"incomplete UNIX socket address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 216+ bytes)");
}
int startIdx = header.readerIndex();
int addressEnd = header.forEachByte(startIdx, 108, ByteProcessor.FIND_NUL);
if (addressEnd == -1) {
addressLen = 108;
} else {
addressLen = addressEnd - startIdx;
}
srcAddress = header.toString(startIdx, addressLen, CharsetUtil.US_ASCII);
startIdx += 108;
addressEnd = header.forEachByte(startIdx, 108, ByteProcessor.FIND_NUL);
if (addressEnd == -1) {
addressLen = 108;
} else {
addressLen = addressEnd - startIdx;
}
dstAddress = header.toString(startIdx, addressLen, CharsetUtil.US_ASCII);
// AF_UNIX defines that exactly 108 bytes are reserved for the address. The previous methods
// did not increase the reader index although we already consumed the information.
header.readerIndex(startIdx + 108);
} else {
if (addressFamily == AddressFamily.AF_IPv4) {
// IPv4 requires 12 bytes for address information
if (addressInfoLen < 12 || header.readableBytes() < 12) {
throw new HAProxyProtocolException(
"incomplete IPv4 address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 12+ bytes)");
}
addressLen = 4;
} else if (addressFamily == AddressFamily.AF_IPv6) {
// IPv6 requires 36 bytes for address information
if (addressInfoLen < 36 || header.readableBytes() < 36) {
throw new HAProxyProtocolException(
"incomplete IPv6 address information: " +
Math.min(addressInfoLen, header.readableBytes()) + " bytes (expected: 36+ bytes)");
}
addressLen = 16;
} else {
throw new HAProxyProtocolException(
"unable to parse address information (unknown address family: " + addressFamily + ')');
}
// Per spec, the src address begins at the 17th byte
srcAddress = ipBytesToString(header, addressLen);
dstAddress = ipBytesToString(header, addressLen);
srcPort = header.readUnsignedShort();
dstPort = header.readUnsignedShort();
}
final List<HAProxyTLV> tlvs = readTlvs(header);
return new HAProxyMessage(ver, cmd, protAndFam, srcAddress, dstAddress, srcPort, dstPort, tlvs);
} | [
"static",
"HAProxyMessage",
"decodeHeader",
"(",
"ByteBuf",
"header",
")",
"{",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"header\"",
")",
";",
"}",
"if",
"(",
"header",
".",
"readableBytes",
"(",
")",
"<",... | Decodes a version 2, binary proxy protocol header.
@param header a version 2 proxy protocol header
@return {@link HAProxyMessage} instance
@throws HAProxyProtocolException if any portion of the header is invalid | [
"Decodes",
"a",
"version",
"2",
"binary",
"proxy",
"protocol",
"header",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java#L120-L238 | train | Decodes the header bytes. | [
30522,
10763,
5292,
21572,
18037,
7834,
3736,
3351,
21933,
25383,
13775,
2121,
1006,
24880,
8569,
2546,
20346,
1007,
1063,
2065,
1006,
20346,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
20346,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/MessageAggregator.java | MessageAggregator.handleOversizedMessage | protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception {
ctx.fireExceptionCaught(
new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes."));
} | java | protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception {
ctx.fireExceptionCaught(
new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes."));
} | [
"protected",
"void",
"handleOversizedMessage",
"(",
"ChannelHandlerContext",
"ctx",
",",
"S",
"oversized",
")",
"throws",
"Exception",
"{",
"ctx",
".",
"fireExceptionCaught",
"(",
"new",
"TooLongFrameException",
"(",
"\"content length exceeded \"",
"+",
"maxContentLength"... | Invoked when an incoming request exceeds the maximum content length. The default behvaior is to trigger an
{@code exceptionCaught()} event with a {@link TooLongFrameException}.
@param ctx the {@link ChannelHandlerContext}
@param oversized the accumulated message up to this point, whose type is {@code S} or {@code O} | [
"Invoked",
"when",
"an",
"incoming",
"request",
"exceeds",
"the",
"maximum",
"content",
"length",
".",
"The",
"default",
"behvaior",
"is",
"to",
"trigger",
"an",
"{",
"@code",
"exceptionCaught",
"()",
"}",
"event",
"with",
"a",
"{",
"@link",
"TooLongFrameExcep... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/MessageAggregator.java#L418-L421 | train | Handle an oversized message. | [
30522,
5123,
11675,
5047,
24302,
3550,
7834,
3736,
3351,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
1055,
21698,
1007,
11618,
6453,
1063,
14931,
2595,
1012,
2543,
10288,
24422,
3540,
18533,
1006,
2047,
6994,
5063,
15643,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.setDouble | @PublicEvolving
public void setDouble(ConfigOption<Double> key, double value) {
setValueInternal(key.key(), value);
} | java | @PublicEvolving
public void setDouble(ConfigOption<Double> key, double value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setDouble",
"(",
"ConfigOption",
"<",
"Double",
">",
"key",
",",
"double",
"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#L560-L563 | train | Sets the value associated with the given key. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
11675,
2275,
26797,
3468,
1006,
9530,
8873,
3995,
16790,
1026,
3313,
1028,
3145,
1010,
3313,
3643,
1007,
1063,
2275,
10175,
5657,
18447,
11795,
2389,
1006,
3145,
1012,
3145,
1006,
1007,
1010,
3643,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java | AkkaInvocationHandler.createRpcInvocationMessage | protected RpcInvocation createRpcInvocationMessage(
final String methodName,
final Class<?>[] parameterTypes,
final Object[] args) throws IOException {
final RpcInvocation rpcInvocation;
if (isLocal) {
rpcInvocation = new LocalRpcInvocation(
methodName,
parameterTypes,
args);
} else {
try {
RemoteRpcInvocation remoteRpcInvocation = new RemoteRpcInvocation(
methodName,
parameterTypes,
args);
if (remoteRpcInvocation.getSize() > maximumFramesize) {
throw new IOException("The rpc invocation size exceeds the maximum akka framesize.");
} else {
rpcInvocation = remoteRpcInvocation;
}
} catch (IOException e) {
LOG.warn("Could not create remote rpc invocation message. Failing rpc invocation because...", e);
throw e;
}
}
return rpcInvocation;
} | java | protected RpcInvocation createRpcInvocationMessage(
final String methodName,
final Class<?>[] parameterTypes,
final Object[] args) throws IOException {
final RpcInvocation rpcInvocation;
if (isLocal) {
rpcInvocation = new LocalRpcInvocation(
methodName,
parameterTypes,
args);
} else {
try {
RemoteRpcInvocation remoteRpcInvocation = new RemoteRpcInvocation(
methodName,
parameterTypes,
args);
if (remoteRpcInvocation.getSize() > maximumFramesize) {
throw new IOException("The rpc invocation size exceeds the maximum akka framesize.");
} else {
rpcInvocation = remoteRpcInvocation;
}
} catch (IOException e) {
LOG.warn("Could not create remote rpc invocation message. Failing rpc invocation because...", e);
throw e;
}
}
return rpcInvocation;
} | [
"protected",
"RpcInvocation",
"createRpcInvocationMessage",
"(",
"final",
"String",
"methodName",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"final",
"RpcInvocati... | Create the RpcInvocation message for the given RPC.
@param methodName of the RPC
@param parameterTypes of the RPC
@param args of the RPC
@return RpcInvocation message which encapsulates the RPC details
@throws IOException if we cannot serialize the RPC invocation parameters | [
"Create",
"the",
"RpcInvocation",
"message",
"for",
"the",
"given",
"RPC",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java#L251-L281 | train | Creates the rpc invocation message. | [
30522,
5123,
1054,
15042,
2378,
19152,
3443,
14536,
15459,
19152,
7834,
3736,
3351,
1006,
2345,
5164,
4118,
18442,
1010,
2345,
2465,
1026,
1029,
1028,
1031,
1033,
16381,
13874,
2015,
1010,
2345,
4874,
1031,
1033,
12098,
5620,
1007,
11618,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/ConfigOption.java | ConfigOption.fallbackKeys | public Iterable<FallbackKey> fallbackKeys() {
return (fallbackKeys == EMPTY) ? Collections.emptyList() : Arrays.asList(fallbackKeys);
} | java | public Iterable<FallbackKey> fallbackKeys() {
return (fallbackKeys == EMPTY) ? Collections.emptyList() : Arrays.asList(fallbackKeys);
} | [
"public",
"Iterable",
"<",
"FallbackKey",
">",
"fallbackKeys",
"(",
")",
"{",
"return",
"(",
"fallbackKeys",
"==",
"EMPTY",
")",
"?",
"Collections",
".",
"emptyList",
"(",
")",
":",
"Arrays",
".",
"asList",
"(",
"fallbackKeys",
")",
";",
"}"
] | Gets the fallback keys, in the order to be checked.
@return The option's fallback keys. | [
"Gets",
"the",
"fallback",
"keys",
"in",
"the",
"order",
"to",
"be",
"checked",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/ConfigOption.java#L210-L212 | train | Returns the fallback keys. | [
30522,
2270,
2009,
6906,
3468,
1026,
2991,
5963,
14839,
1028,
2991,
5963,
14839,
2015,
1006,
1007,
1063,
2709,
1006,
2991,
5963,
14839,
2015,
1027,
1027,
4064,
1007,
1029,
6407,
1012,
4064,
9863,
1006,
1007,
1024,
27448,
1012,
2004,
9863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.timeStringAs | public static long timeStringAs(String str, TimeUnit unit) {
String lower = str.toLowerCase(Locale.ROOT).trim();
try {
Matcher m = Pattern.compile("(-?[0-9]+)([a-z]+)?").matcher(lower);
if (!m.matches()) {
throw new NumberFormatException("Failed to parse time string: " + str);
}
long val = Long.parseLong(m.group(1));
String suffix = m.group(2);
// Check for invalid suffixes
if (suffix != null && !timeSuffixes.containsKey(suffix)) {
throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
}
// If suffix is valid use that, otherwise none was provided and use the default passed
return unit.convert(val, suffix != null ? timeSuffixes.get(suffix) : unit);
} catch (NumberFormatException e) {
String timeError = "Time must be specified as seconds (s), " +
"milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). " +
"E.g. 50s, 100ms, or 250us.";
throw new NumberFormatException(timeError + "\n" + e.getMessage());
}
} | java | public static long timeStringAs(String str, TimeUnit unit) {
String lower = str.toLowerCase(Locale.ROOT).trim();
try {
Matcher m = Pattern.compile("(-?[0-9]+)([a-z]+)?").matcher(lower);
if (!m.matches()) {
throw new NumberFormatException("Failed to parse time string: " + str);
}
long val = Long.parseLong(m.group(1));
String suffix = m.group(2);
// Check for invalid suffixes
if (suffix != null && !timeSuffixes.containsKey(suffix)) {
throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
}
// If suffix is valid use that, otherwise none was provided and use the default passed
return unit.convert(val, suffix != null ? timeSuffixes.get(suffix) : unit);
} catch (NumberFormatException e) {
String timeError = "Time must be specified as seconds (s), " +
"milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). " +
"E.g. 50s, 100ms, or 250us.";
throw new NumberFormatException(timeError + "\n" + e.getMessage());
}
} | [
"public",
"static",
"long",
"timeStringAs",
"(",
"String",
"str",
",",
"TimeUnit",
"unit",
")",
"{",
"String",
"lower",
"=",
"str",
".",
"toLowerCase",
"(",
"Locale",
".",
"ROOT",
")",
".",
"trim",
"(",
")",
";",
"try",
"{",
"Matcher",
"m",
"=",
"Pat... | Convert a passed time string (e.g. 50s, 100ms, or 250us) to a time count in the given unit.
The unit is also considered the default if the given string does not specify a unit. | [
"Convert",
"a",
"passed",
"time",
"string",
"(",
"e",
".",
"g",
".",
"50s",
"100ms",
"or",
"250us",
")",
"to",
"a",
"time",
"count",
"in",
"the",
"given",
"unit",
".",
"The",
"unit",
"is",
"also",
"considered",
"the",
"default",
"if",
"the",
"given",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L228-L254 | train | Convert a string of time units to a long value. | [
30522,
2270,
10763,
2146,
2335,
18886,
13807,
2015,
1006,
5164,
2358,
2099,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
5164,
2896,
1027,
2358,
2099,
1012,
2000,
27663,
18992,
3366,
1006,
2334,
2063,
1012,
7117,
1007,
1012,
12241,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.deflater | private static void deflater(InputStream in, OutputStream out, int level) {
final DeflaterOutputStream ios = (out instanceof DeflaterOutputStream) ? (DeflaterOutputStream) out : new DeflaterOutputStream(out, new Deflater(level, true));
IoUtil.copy(in, ios);
try {
ios.finish();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | private static void deflater(InputStream in, OutputStream out, int level) {
final DeflaterOutputStream ios = (out instanceof DeflaterOutputStream) ? (DeflaterOutputStream) out : new DeflaterOutputStream(out, new Deflater(level, true));
IoUtil.copy(in, ios);
try {
ios.finish();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"private",
"static",
"void",
"deflater",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"int",
"level",
")",
"{",
"final",
"DeflaterOutputStream",
"ios",
"=",
"(",
"out",
"instanceof",
"DeflaterOutputStream",
")",
"?",
"(",
"DeflaterOutputStream",
")... | 将普通数据流压缩成zlib到out中
@param in zlib数据流
@param out 输出
@param level 压缩级别,0~9 | [
"将普通数据流压缩成zlib到out中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L941-L949 | train | Write the contents of the input stream to the output stream using a compressed version of the output stream. | [
30522,
2797,
10763,
11675,
13366,
13806,
2099,
1006,
20407,
25379,
1999,
1010,
27852,
25379,
2041,
1010,
20014,
2504,
1007,
1063,
2345,
13366,
13806,
22494,
25856,
16446,
25379,
16380,
1027,
1006,
2041,
6013,
11253,
13366,
13806,
22494,
25856,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java | Catalogs.load | public static CatalogPlugin load(String name, SQLConf conf)
throws CatalogNotFoundException, SparkException {
String pluginClassName = conf.getConfString("spark.sql.catalog." + name, null);
if (pluginClassName == null) {
throw new CatalogNotFoundException(String.format(
"Catalog '%s' plugin class not found: spark.sql.catalog.%s is not defined", name, name));
}
ClassLoader loader = Utils.getContextOrSparkClassLoader();
try {
Class<?> pluginClass = loader.loadClass(pluginClassName);
if (!CatalogPlugin.class.isAssignableFrom(pluginClass)) {
throw new SparkException(String.format(
"Plugin class for catalog '%s' does not implement CatalogPlugin: %s",
name, pluginClassName));
}
CatalogPlugin plugin = CatalogPlugin.class.cast(pluginClass.newInstance());
plugin.initialize(name, catalogOptions(name, conf));
return plugin;
} catch (ClassNotFoundException e) {
throw new SparkException(String.format(
"Cannot find catalog plugin class for catalog '%s': %s", name, pluginClassName));
} catch (IllegalAccessException e) {
throw new SparkException(String.format(
"Failed to call public no-arg constructor for catalog '%s': %s", name, pluginClassName),
e);
} catch (InstantiationException e) {
throw new SparkException(String.format(
"Failed while instantiating plugin for catalog '%s': %s", name, pluginClassName),
e.getCause());
}
} | java | public static CatalogPlugin load(String name, SQLConf conf)
throws CatalogNotFoundException, SparkException {
String pluginClassName = conf.getConfString("spark.sql.catalog." + name, null);
if (pluginClassName == null) {
throw new CatalogNotFoundException(String.format(
"Catalog '%s' plugin class not found: spark.sql.catalog.%s is not defined", name, name));
}
ClassLoader loader = Utils.getContextOrSparkClassLoader();
try {
Class<?> pluginClass = loader.loadClass(pluginClassName);
if (!CatalogPlugin.class.isAssignableFrom(pluginClass)) {
throw new SparkException(String.format(
"Plugin class for catalog '%s' does not implement CatalogPlugin: %s",
name, pluginClassName));
}
CatalogPlugin plugin = CatalogPlugin.class.cast(pluginClass.newInstance());
plugin.initialize(name, catalogOptions(name, conf));
return plugin;
} catch (ClassNotFoundException e) {
throw new SparkException(String.format(
"Cannot find catalog plugin class for catalog '%s': %s", name, pluginClassName));
} catch (IllegalAccessException e) {
throw new SparkException(String.format(
"Failed to call public no-arg constructor for catalog '%s': %s", name, pluginClassName),
e);
} catch (InstantiationException e) {
throw new SparkException(String.format(
"Failed while instantiating plugin for catalog '%s': %s", name, pluginClassName),
e.getCause());
}
} | [
"public",
"static",
"CatalogPlugin",
"load",
"(",
"String",
"name",
",",
"SQLConf",
"conf",
")",
"throws",
"CatalogNotFoundException",
",",
"SparkException",
"{",
"String",
"pluginClassName",
"=",
"conf",
".",
"getConfString",
"(",
"\"spark.sql.catalog.\"",
"+",
"na... | Load and configure a catalog by name.
<p>
This loads, instantiates, and initializes the catalog plugin for each call; it does not cache
or reuse instances.
@param name a String catalog name
@param conf a SQLConf
@return an initialized CatalogPlugin
@throws CatalogNotFoundException if the plugin class cannot be found
@throws SparkException if the plugin class cannot be instantiated | [
"Load",
"and",
"configure",
"a",
"catalog",
"by",
"name",
".",
"<p",
">",
"This",
"loads",
"instantiates",
"and",
"initializes",
"the",
"catalog",
"plugin",
"for",
"each",
"call",
";",
"it",
"does",
"not",
"cache",
"or",
"reuse",
"instances",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java#L50-L89 | train | Load a catalog plugin. | [
30522,
2270,
10763,
12105,
24759,
15916,
2378,
7170,
1006,
5164,
2171,
1010,
29296,
8663,
2546,
9530,
2546,
1007,
11618,
12105,
17048,
14876,
8630,
10288,
24422,
1010,
12125,
10288,
24422,
1063,
5164,
13354,
2378,
26266,
18442,
1027,
9530,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getAllocationIdsPerJob | public Set<AllocationID> getAllocationIdsPerJob(JobID jobId) {
final Set<AllocationID> allocationIds = slotsPerJob.get(jobId);
if (allocationIds == null) {
return Collections.emptySet();
} else {
return Collections.unmodifiableSet(allocationIds);
}
} | java | public Set<AllocationID> getAllocationIdsPerJob(JobID jobId) {
final Set<AllocationID> allocationIds = slotsPerJob.get(jobId);
if (allocationIds == null) {
return Collections.emptySet();
} else {
return Collections.unmodifiableSet(allocationIds);
}
} | [
"public",
"Set",
"<",
"AllocationID",
">",
"getAllocationIdsPerJob",
"(",
"JobID",
"jobId",
")",
"{",
"final",
"Set",
"<",
"AllocationID",
">",
"allocationIds",
"=",
"slotsPerJob",
".",
"get",
"(",
"jobId",
")",
";",
"if",
"(",
"allocationIds",
"==",
"null",... | Returns the all {@link AllocationID} for the given job.
@param jobId for which to return the set of {@link AllocationID}.
@return Set of {@link AllocationID} for the given job | [
"Returns",
"the",
"all",
"{",
"@link",
"AllocationID",
"}",
"for",
"the",
"given",
"job",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L142-L150 | train | Returns the allocation ids for the given job. | [
30522,
2270,
2275,
1026,
16169,
3593,
1028,
2131,
8095,
23909,
9821,
4842,
5558,
2497,
1006,
3105,
3593,
3105,
3593,
1007,
1063,
2345,
2275,
1026,
16169,
3593,
1028,
16169,
9821,
1027,
19832,
4842,
5558,
2497,
1012,
2131,
1006,
3105,
3593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/Elasticsearch.java | Elasticsearch.host | public Elasticsearch host(String hostname, int port, String protocol) {
final Host host =
new Host(
Preconditions.checkNotNull(hostname),
port,
Preconditions.checkNotNull(protocol));
hosts.add(host);
return this;
} | java | public Elasticsearch host(String hostname, int port, String protocol) {
final Host host =
new Host(
Preconditions.checkNotNull(hostname),
port,
Preconditions.checkNotNull(protocol));
hosts.add(host);
return this;
} | [
"public",
"Elasticsearch",
"host",
"(",
"String",
"hostname",
",",
"int",
"port",
",",
"String",
"protocol",
")",
"{",
"final",
"Host",
"host",
"=",
"new",
"Host",
"(",
"Preconditions",
".",
"checkNotNull",
"(",
"hostname",
")",
",",
"port",
",",
"Precondi... | Adds an Elasticsearch host to connect to. Required.
<p>Multiple hosts can be declared by calling this method multiple times.
@param hostname connection hostname
@param port connection port
@param protocol connection protocol; e.g. "http" | [
"Adds",
"an",
"Elasticsearch",
"host",
"to",
"connect",
"to",
".",
"Required",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/Elasticsearch.java#L88-L96 | train | Add a host to the elasticsearch server. | [
30522,
2270,
21274,
17310,
11140,
3677,
1006,
5164,
3677,
18442,
1010,
20014,
3417,
1010,
5164,
8778,
1007,
1063,
2345,
3677,
3677,
1027,
2047,
3677,
1006,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3677,
18442,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java | AutoConfigurationImportSelector.getAttributes | protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) {
String name = getAnnotationClass().getName();
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(name, true));
Assert.notNull(attributes,
() -> "No auto-configuration attributes found. Is "
+ metadata.getClassName() + " annotated with "
+ ClassUtils.getShortName(name) + "?");
return attributes;
} | java | protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) {
String name = getAnnotationClass().getName();
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(name, true));
Assert.notNull(attributes,
() -> "No auto-configuration attributes found. Is "
+ metadata.getClassName() + " annotated with "
+ ClassUtils.getShortName(name) + "?");
return attributes;
} | [
"protected",
"AnnotationAttributes",
"getAttributes",
"(",
"AnnotationMetadata",
"metadata",
")",
"{",
"String",
"name",
"=",
"getAnnotationClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"AnnotationAttributes",
"attributes",
"=",
"AnnotationAttributes",
".",
"fromMa... | Return the appropriate {@link AnnotationAttributes} from the
{@link AnnotationMetadata}. By default this method will return attributes for
{@link #getAnnotationClass()}.
@param metadata the annotation metadata
@return annotation attributes | [
"Return",
"the",
"appropriate",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java#L151-L160 | train | Get the attribute map from the annotation metadata. | [
30522,
5123,
5754,
17287,
3508,
19321,
3089,
8569,
4570,
2131,
19321,
3089,
8569,
4570,
1006,
5754,
17287,
3508,
11368,
8447,
2696,
27425,
1007,
1063,
5164,
2171,
1027,
2131,
11639,
17287,
3508,
26266,
1006,
1007,
1012,
2131,
18442,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java | KafkaCanalConnector.connect | @Override
public void connect() {
if (connected) {
return;
}
connected = true;
if (kafkaConsumer == null && !flatMessage) {
kafkaConsumer = new KafkaConsumer<String, Message>(properties);
}
if (kafkaConsumer2 == null && flatMessage) {
kafkaConsumer2 = new KafkaConsumer<String, String>(properties);
}
} | java | @Override
public void connect() {
if (connected) {
return;
}
connected = true;
if (kafkaConsumer == null && !flatMessage) {
kafkaConsumer = new KafkaConsumer<String, Message>(properties);
}
if (kafkaConsumer2 == null && flatMessage) {
kafkaConsumer2 = new KafkaConsumer<String, String>(properties);
}
} | [
"@",
"Override",
"public",
"void",
"connect",
"(",
")",
"{",
"if",
"(",
"connected",
")",
"{",
"return",
";",
"}",
"connected",
"=",
"true",
";",
"if",
"(",
"kafkaConsumer",
"==",
"null",
"&&",
"!",
"flatMessage",
")",
"{",
"kafkaConsumer",
"=",
"new",... | 打开连接 | [
"打开连接"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java#L75-L89 | train | Connect to the Kafka application. | [
30522,
1030,
2058,
15637,
2270,
11675,
7532,
1006,
1007,
1063,
2065,
1006,
4198,
1007,
1063,
2709,
1025,
1065,
4198,
1027,
2995,
1025,
2065,
1006,
10556,
24316,
22684,
3619,
17897,
2099,
1027,
1027,
19701,
1004,
1004,
999,
4257,
7834,
3736,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getPublicMethods | public static List<Method> getPublicMethods(Class<?> clazz, Filter<Method> filter) {
return ReflectUtil.getPublicMethods(clazz, filter);
} | java | public static List<Method> getPublicMethods(Class<?> clazz, Filter<Method> filter) {
return ReflectUtil.getPublicMethods(clazz, filter);
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getPublicMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Filter",
"<",
"Method",
">",
"filter",
")",
"{",
"return",
"ReflectUtil",
".",
"getPublicMethods",
"(",
"clazz",
",",
"filter",
")",
";",
"}"
... | 获得指定类过滤后的Public方法列表
@param clazz 查找方法的类
@param filter 过滤器
@return 过滤后的方法列表 | [
"获得指定类过滤后的Public方法列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L259-L261 | train | Get a list of public methods of a class. | [
30522,
2270,
10763,
2862,
1026,
4118,
1028,
2131,
14289,
16558,
2594,
11368,
6806,
5104,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
11307,
1026,
4118,
1028,
11307,
1007,
1063,
2709,
8339,
21823,
2140,
1012,
2131,
14289,
16558,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionEnvironment.java | ExecutionEnvironment.fromCollection | public <X> DataSource<X> fromCollection(Collection<X> data, TypeInformation<X> type) {
return fromCollection(data, type, Utils.getCallLocationName());
} | java | public <X> DataSource<X> fromCollection(Collection<X> data, TypeInformation<X> type) {
return fromCollection(data, type, Utils.getCallLocationName());
} | [
"public",
"<",
"X",
">",
"DataSource",
"<",
"X",
">",
"fromCollection",
"(",
"Collection",
"<",
"X",
">",
"data",
",",
"TypeInformation",
"<",
"X",
">",
"type",
")",
"{",
"return",
"fromCollection",
"(",
"data",
",",
"type",
",",
"Utils",
".",
"getCall... | Creates a DataSet from the given non-empty collection. Note that this operation will result
in a non-parallel data source, i.e. a data source with a parallelism of one.
<p>The returned DataSet is typed to the given TypeInformation.
@param data The collection of elements to create the data set from.
@param type The TypeInformation for the produced data set.
@return A DataSet representing the given collection.
@see #fromCollection(Collection) | [
"Creates",
"a",
"DataSet",
"from",
"the",
"given",
"non",
"-",
"empty",
"collection",
".",
"Note",
"that",
"this",
"operation",
"will",
"result",
"in",
"a",
"non",
"-",
"parallel",
"data",
"source",
"i",
".",
"e",
".",
"a",
"data",
"source",
"with",
"a... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L629-L631 | train | Creates a data source from a collection of data. | [
30522,
2270,
1026,
1060,
1028,
2951,
6499,
3126,
3401,
1026,
1060,
1028,
2013,
26895,
18491,
1006,
3074,
1026,
1060,
1028,
2951,
1010,
2828,
2378,
14192,
3370,
1026,
1060,
1028,
2828,
1007,
1063,
2709,
2013,
26895,
18491,
1006,
2951,
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.within | public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime;
}
return this;
} | java | public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime;
}
return this;
} | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"within",
"(",
"Time",
"windowTime",
")",
"{",
"if",
"(",
"windowTime",
"!=",
"null",
")",
"{",
"this",
".",
"windowTime",
"=",
"windowTime",
";",
"}",
"return",
"this",
";",
"}"
] | Defines the maximum time interval in which a matching pattern has to be completed in
order to be considered valid. This interval corresponds to the maximum time gap between first
and the last event.
@param windowTime Time of the matching window
@return The same pattern operator with the new window length | [
"Defines",
"the",
"maximum",
"time",
"interval",
"in",
"which",
"a",
"matching",
"pattern",
"has",
"to",
"be",
"completed",
"in",
"order",
"to",
"be",
"considered",
"valid",
".",
"This",
"interval",
"corresponds",
"to",
"the",
"maximum",
"time",
"gap",
"betw... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L244-L250 | train | Sets the time interval that the pattern will be matched within the given time interval. | [
30522,
2270,
5418,
1026,
1056,
1010,
1042,
1028,
2306,
1006,
2051,
3332,
7292,
1007,
1063,
2065,
1006,
3332,
7292,
999,
1027,
19701,
1007,
1063,
2023,
1012,
3332,
7292,
1027,
3332,
7292,
1025,
1065,
2709,
2023,
1025,
1065,
102,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/MysqlGTIDSet.java | MysqlGTIDSet.parse | public static MysqlGTIDSet parse(String gtidData) {
Map<String, UUIDSet> m;
if (gtidData == null || gtidData.length() < 1) {
m = new HashMap<String, UUIDSet>();
} else {
// 存在多个GTID时会有回车符
String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
m = new HashMap<String, UUIDSet>(uuidStrs.length);
for (int i = 0; i < uuidStrs.length; i++) {
UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
m.put(uuidSet.SID.toString(), uuidSet);
}
}
MysqlGTIDSet gs = new MysqlGTIDSet();
gs.sets = m;
return gs;
} | java | public static MysqlGTIDSet parse(String gtidData) {
Map<String, UUIDSet> m;
if (gtidData == null || gtidData.length() < 1) {
m = new HashMap<String, UUIDSet>();
} else {
// 存在多个GTID时会有回车符
String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
m = new HashMap<String, UUIDSet>(uuidStrs.length);
for (int i = 0; i < uuidStrs.length; i++) {
UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
m.put(uuidSet.SID.toString(), uuidSet);
}
}
MysqlGTIDSet gs = new MysqlGTIDSet();
gs.sets = m;
return gs;
} | [
"public",
"static",
"MysqlGTIDSet",
"parse",
"(",
"String",
"gtidData",
")",
"{",
"Map",
"<",
"String",
",",
"UUIDSet",
">",
"m",
";",
"if",
"(",
"gtidData",
"==",
"null",
"||",
"gtidData",
".",
"length",
"(",
")",
"<",
"1",
")",
"{",
"m",
"=",
"ne... | 解析如下格式的字符串为MysqlGTIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 =>
MysqlGTIDSet{ sets: { 726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop: 10}] } } }
726757ad-4455-11e8-ae04-0242ac110002:1-3,726757
ad-4455-11e8-ae04-0242ac110003:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] },
726757ad-4455-11e8-ae04-0242ac110003: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:4, stop:5}] } }
}
@param gtidData
@return | [
"解析如下格式的字符串为MysqlGTIDSet",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"=",
">",
"MysqlGTIDSet",
"{",
"sets",
":",
"{",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"UUIDSet",
"{"... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/MysqlGTIDSet.java#L83-L102 | train | Parse GTID data into a MysqlGTIDSet object | [
30522,
2270,
10763,
2026,
2015,
4160,
2140,
13512,
9821,
3388,
11968,
3366,
1006,
5164,
14181,
3593,
2850,
2696,
1007,
1063,
4949,
1026,
5164,
1010,
1057,
21272,
13462,
1028,
1049,
1025,
2065,
1006,
14181,
3593,
2850,
2696,
1027,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java | PendingCheckpoint.addMasterState | public void addMasterState(MasterState state) {
checkNotNull(state);
synchronized (lock) {
if (!discarded) {
masterState.add(state);
}
}
} | java | public void addMasterState(MasterState state) {
checkNotNull(state);
synchronized (lock) {
if (!discarded) {
masterState.add(state);
}
}
} | [
"public",
"void",
"addMasterState",
"(",
"MasterState",
"state",
")",
"{",
"checkNotNull",
"(",
"state",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"discarded",
")",
"{",
"masterState",
".",
"add",
"(",
"state",
")",
";",
"}",
"}"... | Adds a master state (state generated on the checkpoint coordinator) to
the pending checkpoint.
@param state The state to add | [
"Adds",
"a",
"master",
"state",
"(",
"state",
"generated",
"on",
"the",
"checkpoint",
"coordinator",
")",
"to",
"the",
"pending",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java#L391-L399 | train | Add a master state to the cluster. | [
30522,
2270,
11675,
5587,
27751,
12259,
1006,
5972,
12259,
2110,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
2110,
1007,
1025,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
999,
15105,
1007,
1063,
5972,
12259,
1012,
5587,
1006,
2110,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http/upload/HttpUploadServerHandler.java | HttpUploadServerHandler.readHttpDataChunkByChunk | private void readHttpDataChunkByChunk() {
try {
while (decoder.hasNext()) {
InterfaceHttpData data = decoder.next();
if (data != null) {
// check if current HttpData is a FileUpload and previously set as partial
if (partialContent == data) {
logger.info(" 100% (FinalSize: " + partialContent.length() + ")");
partialContent = null;
}
// new value
writeHttpData(data);
}
}
// Check partial decoding for a FileUpload
InterfaceHttpData data = decoder.currentPartialHttpData();
if (data != null) {
StringBuilder builder = new StringBuilder();
if (partialContent == null) {
partialContent = (HttpData) data;
if (partialContent instanceof FileUpload) {
builder.append("Start FileUpload: ")
.append(((FileUpload) partialContent).getFilename()).append(" ");
} else {
builder.append("Start Attribute: ")
.append(partialContent.getName()).append(" ");
}
builder.append("(DefinedSize: ").append(partialContent.definedLength()).append(")");
}
if (partialContent.definedLength() > 0) {
builder.append(" ").append(partialContent.length() * 100 / partialContent.definedLength())
.append("% ");
logger.info(builder.toString());
} else {
builder.append(" ").append(partialContent.length()).append(" ");
logger.info(builder.toString());
}
}
} catch (EndOfDataDecoderException e1) {
// end
responseContent.append("\r\n\r\nEND OF CONTENT CHUNK BY CHUNK\r\n\r\n");
}
} | java | private void readHttpDataChunkByChunk() {
try {
while (decoder.hasNext()) {
InterfaceHttpData data = decoder.next();
if (data != null) {
// check if current HttpData is a FileUpload and previously set as partial
if (partialContent == data) {
logger.info(" 100% (FinalSize: " + partialContent.length() + ")");
partialContent = null;
}
// new value
writeHttpData(data);
}
}
// Check partial decoding for a FileUpload
InterfaceHttpData data = decoder.currentPartialHttpData();
if (data != null) {
StringBuilder builder = new StringBuilder();
if (partialContent == null) {
partialContent = (HttpData) data;
if (partialContent instanceof FileUpload) {
builder.append("Start FileUpload: ")
.append(((FileUpload) partialContent).getFilename()).append(" ");
} else {
builder.append("Start Attribute: ")
.append(partialContent.getName()).append(" ");
}
builder.append("(DefinedSize: ").append(partialContent.definedLength()).append(")");
}
if (partialContent.definedLength() > 0) {
builder.append(" ").append(partialContent.length() * 100 / partialContent.definedLength())
.append("% ");
logger.info(builder.toString());
} else {
builder.append(" ").append(partialContent.length()).append(" ");
logger.info(builder.toString());
}
}
} catch (EndOfDataDecoderException e1) {
// end
responseContent.append("\r\n\r\nEND OF CONTENT CHUNK BY CHUNK\r\n\r\n");
}
} | [
"private",
"void",
"readHttpDataChunkByChunk",
"(",
")",
"{",
"try",
"{",
"while",
"(",
"decoder",
".",
"hasNext",
"(",
")",
")",
"{",
"InterfaceHttpData",
"data",
"=",
"decoder",
".",
"next",
"(",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
... | Example of reading request by chunk and getting values from chunk to chunk | [
"Example",
"of",
"reading",
"request",
"by",
"chunk",
"and",
"getting",
"values",
"from",
"chunk",
"to",
"chunk"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/upload/HttpUploadServerHandler.java#L212-L254 | train | Read the HttpData chunk by chunk. | [
30522,
2797,
11675,
3191,
11039,
25856,
2850,
2696,
20760,
8950,
3762,
20760,
8950,
1006,
1007,
1063,
3046,
1063,
2096,
1006,
21933,
4063,
1012,
8440,
10288,
2102,
1006,
1007,
1007,
1063,
8278,
11039,
25856,
2850,
2696,
2951,
1027,
21933,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/StateMachineExample.java | StateMachineExample.main | public static void main(String[] args) throws Exception {
// ---- print some usage help ----
System.out.println("Usage with built-in data generator: StateMachineExample [--error-rate <probability-of-invalid-transition>] [--sleep <sleep-per-record-in-ms>]");
System.out.println("Usage with Kafka: StateMachineExample --kafka-topic <topic> [--brokers <brokers>]");
System.out.println("Options for both the above setups: ");
System.out.println("\t[--backend <file|rocks>]");
System.out.println("\t[--checkpoint-dir <filepath>]");
System.out.println("\t[--async-checkpoints <true|false>]");
System.out.println("\t[--incremental-checkpoints <true|false>]");
System.out.println("\t[--output <filepath> OR null for stdout]");
System.out.println();
// ---- determine whether to use the built-in source, or read from Kafka ----
final SourceFunction<Event> source;
final ParameterTool params = ParameterTool.fromArgs(args);
if (params.has("kafka-topic")) {
// set up the Kafka reader
String kafkaTopic = params.get("kafka-topic");
String brokers = params.get("brokers", "localhost:9092");
System.out.printf("Reading from kafka topic %s @ %s\n", kafkaTopic, brokers);
System.out.println();
Properties kafkaProps = new Properties();
kafkaProps.setProperty("bootstrap.servers", brokers);
FlinkKafkaConsumer010<Event> kafka = new FlinkKafkaConsumer010<>(kafkaTopic, new EventDeSerializer(), kafkaProps);
kafka.setStartFromLatest();
kafka.setCommitOffsetsOnCheckpoints(false);
source = kafka;
}
else {
double errorRate = params.getDouble("error-rate", 0.0);
int sleep = params.getInt("sleep", 1);
System.out.printf("Using standalone source with error rate %f and sleep delay %s millis\n", errorRate, sleep);
System.out.println();
source = new EventsGeneratorSource(errorRate, sleep);
}
// ---- main program ----
// create the environment to create streams and configure execution
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.enableCheckpointing(2000L);
final String stateBackend = params.get("backend", "memory");
if ("file".equals(stateBackend)) {
final String checkpointDir = params.get("checkpoint-dir");
boolean asyncCheckpoints = params.getBoolean("async-checkpoints", false);
env.setStateBackend(new FsStateBackend(checkpointDir, asyncCheckpoints));
} else if ("rocks".equals(stateBackend)) {
final String checkpointDir = params.get("checkpoint-dir");
boolean incrementalCheckpoints = params.getBoolean("incremental-checkpoints", false);
env.setStateBackend(new RocksDBStateBackend(checkpointDir, incrementalCheckpoints));
}
final String outputFile = params.get("output");
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
DataStream<Event> events = env.addSource(source);
DataStream<Alert> alerts = events
// partition on the address to make sure equal addresses
// end up in the same state machine flatMap function
.keyBy(Event::sourceAddress)
// the function that evaluates the state machine over the sequence of events
.flatMap(new StateMachineMapper());
// output the alerts to std-out
if (outputFile == null) {
alerts.print();
} else {
alerts
.writeAsText(outputFile, FileSystem.WriteMode.OVERWRITE)
.setParallelism(1);
}
// trigger program execution
env.execute("State machine job");
} | java | public static void main(String[] args) throws Exception {
// ---- print some usage help ----
System.out.println("Usage with built-in data generator: StateMachineExample [--error-rate <probability-of-invalid-transition>] [--sleep <sleep-per-record-in-ms>]");
System.out.println("Usage with Kafka: StateMachineExample --kafka-topic <topic> [--brokers <brokers>]");
System.out.println("Options for both the above setups: ");
System.out.println("\t[--backend <file|rocks>]");
System.out.println("\t[--checkpoint-dir <filepath>]");
System.out.println("\t[--async-checkpoints <true|false>]");
System.out.println("\t[--incremental-checkpoints <true|false>]");
System.out.println("\t[--output <filepath> OR null for stdout]");
System.out.println();
// ---- determine whether to use the built-in source, or read from Kafka ----
final SourceFunction<Event> source;
final ParameterTool params = ParameterTool.fromArgs(args);
if (params.has("kafka-topic")) {
// set up the Kafka reader
String kafkaTopic = params.get("kafka-topic");
String brokers = params.get("brokers", "localhost:9092");
System.out.printf("Reading from kafka topic %s @ %s\n", kafkaTopic, brokers);
System.out.println();
Properties kafkaProps = new Properties();
kafkaProps.setProperty("bootstrap.servers", brokers);
FlinkKafkaConsumer010<Event> kafka = new FlinkKafkaConsumer010<>(kafkaTopic, new EventDeSerializer(), kafkaProps);
kafka.setStartFromLatest();
kafka.setCommitOffsetsOnCheckpoints(false);
source = kafka;
}
else {
double errorRate = params.getDouble("error-rate", 0.0);
int sleep = params.getInt("sleep", 1);
System.out.printf("Using standalone source with error rate %f and sleep delay %s millis\n", errorRate, sleep);
System.out.println();
source = new EventsGeneratorSource(errorRate, sleep);
}
// ---- main program ----
// create the environment to create streams and configure execution
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.enableCheckpointing(2000L);
final String stateBackend = params.get("backend", "memory");
if ("file".equals(stateBackend)) {
final String checkpointDir = params.get("checkpoint-dir");
boolean asyncCheckpoints = params.getBoolean("async-checkpoints", false);
env.setStateBackend(new FsStateBackend(checkpointDir, asyncCheckpoints));
} else if ("rocks".equals(stateBackend)) {
final String checkpointDir = params.get("checkpoint-dir");
boolean incrementalCheckpoints = params.getBoolean("incremental-checkpoints", false);
env.setStateBackend(new RocksDBStateBackend(checkpointDir, incrementalCheckpoints));
}
final String outputFile = params.get("output");
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
DataStream<Event> events = env.addSource(source);
DataStream<Alert> alerts = events
// partition on the address to make sure equal addresses
// end up in the same state machine flatMap function
.keyBy(Event::sourceAddress)
// the function that evaluates the state machine over the sequence of events
.flatMap(new StateMachineMapper());
// output the alerts to std-out
if (outputFile == null) {
alerts.print();
} else {
alerts
.writeAsText(outputFile, FileSystem.WriteMode.OVERWRITE)
.setParallelism(1);
}
// trigger program execution
env.execute("State machine job");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// ---- print some usage help ----",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage with built-in data generator: StateMachineExample [--error-rate <probability-of-inva... | Main entry point for the program.
@param args The command line arguments. | [
"Main",
"entry",
"point",
"for",
"the",
"program",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/StateMachineExample.java#L55-L143 | train | Main method for the command - line tool. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
1011,
1011,
1011,
1011,
6140,
2070,
8192,
2393,
1011,
1011,
1011,
1011,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
1000,
8192,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/NioUtils.java | NioUtils.createZipFileSystem | private static FileSystem createZipFileSystem(String zipFilename, boolean create) throws IOException {
// convert the filename to a URI
final Path path = Paths.get(zipFilename);
if(Files.notExists(path.getParent())) {
Files.createDirectories(path.getParent());
}
final URI uri = URI.create("jar:file:" + path.toUri().getPath());
final Map<String, String> env = new HashMap<>();
if (create) {
env.put("create", "true");
}
return FileSystems.newFileSystem(uri, env);
} | java | private static FileSystem createZipFileSystem(String zipFilename, boolean create) throws IOException {
// convert the filename to a URI
final Path path = Paths.get(zipFilename);
if(Files.notExists(path.getParent())) {
Files.createDirectories(path.getParent());
}
final URI uri = URI.create("jar:file:" + path.toUri().getPath());
final Map<String, String> env = new HashMap<>();
if (create) {
env.put("create", "true");
}
return FileSystems.newFileSystem(uri, env);
} | [
"private",
"static",
"FileSystem",
"createZipFileSystem",
"(",
"String",
"zipFilename",
",",
"boolean",
"create",
")",
"throws",
"IOException",
"{",
"// convert the filename to a URI",
"final",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"zipFilename",
")",
";",
... | Returns a zip file system
@param zipFilename to construct the file system from
@param create true if the zip file should be created
@return a zip file system
@throws IOException | [
"Returns",
"a",
"zip",
"file",
"system"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L54-L68 | train | Create a zip file system. | [
30522,
2797,
10763,
6764,
27268,
6633,
3443,
5831,
14376,
9463,
6508,
13473,
2213,
1006,
5164,
14101,
8873,
20844,
4168,
1010,
22017,
20898,
3443,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
10463,
1996,
5371,
18442,
2000,
1037,
24471... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java | HttpUploadClient.formpostmultipart | private static void formpostmultipart(
Bootstrap bootstrap, String host, int port, URI uriFile, HttpDataFactory factory,
Iterable<Entry<String, String>> headers, List<InterfaceHttpData> bodylist) throws Exception {
// XXX /formpostmultipart
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(SocketUtils.socketAddress(host, port));
// Wait until the connection attempt succeeds or fails.
Channel channel = future.sync().channel();
// Prepare the HTTP request.
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriFile.toASCIIString());
// Use the PostBody encoder
HttpPostRequestEncoder bodyRequestEncoder =
new HttpPostRequestEncoder(factory, request, true); // true => multipart
// it is legal to add directly header or cookie into the request until finalize
for (Entry<String, String> entry : headers) {
request.headers().set(entry.getKey(), entry.getValue());
}
// add Form attribute from previous request in formpost()
bodyRequestEncoder.setBodyHttpDatas(bodylist);
// finalize request
bodyRequestEncoder.finalizeRequest();
// send request
channel.write(request);
// test if request was chunked and if so, finish the write
if (bodyRequestEncoder.isChunked()) {
channel.write(bodyRequestEncoder);
}
channel.flush();
// Now no more use of file representation (and list of HttpData)
bodyRequestEncoder.cleanFiles();
// Wait for the server to close the connection.
channel.closeFuture().sync();
} | java | private static void formpostmultipart(
Bootstrap bootstrap, String host, int port, URI uriFile, HttpDataFactory factory,
Iterable<Entry<String, String>> headers, List<InterfaceHttpData> bodylist) throws Exception {
// XXX /formpostmultipart
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(SocketUtils.socketAddress(host, port));
// Wait until the connection attempt succeeds or fails.
Channel channel = future.sync().channel();
// Prepare the HTTP request.
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriFile.toASCIIString());
// Use the PostBody encoder
HttpPostRequestEncoder bodyRequestEncoder =
new HttpPostRequestEncoder(factory, request, true); // true => multipart
// it is legal to add directly header or cookie into the request until finalize
for (Entry<String, String> entry : headers) {
request.headers().set(entry.getKey(), entry.getValue());
}
// add Form attribute from previous request in formpost()
bodyRequestEncoder.setBodyHttpDatas(bodylist);
// finalize request
bodyRequestEncoder.finalizeRequest();
// send request
channel.write(request);
// test if request was chunked and if so, finish the write
if (bodyRequestEncoder.isChunked()) {
channel.write(bodyRequestEncoder);
}
channel.flush();
// Now no more use of file representation (and list of HttpData)
bodyRequestEncoder.cleanFiles();
// Wait for the server to close the connection.
channel.closeFuture().sync();
} | [
"private",
"static",
"void",
"formpostmultipart",
"(",
"Bootstrap",
"bootstrap",
",",
"String",
"host",
",",
"int",
"port",
",",
"URI",
"uriFile",
",",
"HttpDataFactory",
"factory",
",",
"Iterable",
"<",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"head... | Multipart example | [
"Multipart",
"example"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java#L265-L306 | train | Form post multipart request. | [
30522,
2797,
10763,
11675,
2433,
19894,
12274,
7096,
11514,
8445,
1006,
6879,
6494,
2361,
6879,
6494,
2361,
1010,
5164,
3677,
1010,
20014,
3417,
1010,
24471,
2072,
24471,
10128,
9463,
1010,
8299,
2850,
2696,
21450,
4713,
1010,
2009,
6906,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java | IOManager.deleteChannel | public void deleteChannel(FileIOChannel.ID channel) throws IOException {
if (channel != null) {
if (channel.getPathFile().exists() && !channel.getPathFile().delete()) {
LOG.warn("IOManager failed to delete temporary file {}", channel.getPath());
}
}
} | java | public void deleteChannel(FileIOChannel.ID channel) throws IOException {
if (channel != null) {
if (channel.getPathFile().exists() && !channel.getPathFile().delete()) {
LOG.warn("IOManager failed to delete temporary file {}", channel.getPath());
}
}
} | [
"public",
"void",
"deleteChannel",
"(",
"FileIOChannel",
".",
"ID",
"channel",
")",
"throws",
"IOException",
"{",
"if",
"(",
"channel",
"!=",
"null",
")",
"{",
"if",
"(",
"channel",
".",
"getPathFile",
"(",
")",
".",
"exists",
"(",
")",
"&&",
"!",
"cha... | Deletes the file underlying the given channel. If the channel is still open, this
call may fail.
@param channel The channel to be deleted.
@throws IOException Thrown if the deletion fails. | [
"Deletes",
"the",
"file",
"underlying",
"the",
"given",
"channel",
".",
"If",
"the",
"channel",
"is",
"still",
"open",
"this",
"call",
"may",
"fail",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java#L150-L156 | train | Delete a temporary file from the given channel. | [
30522,
2270,
11675,
3972,
12870,
26058,
1006,
5371,
3695,
26058,
1012,
8909,
3149,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
3149,
999,
1027,
19701,
1007,
1063,
2065,
1006,
3149,
1012,
2131,
15069,
8873,
2571,
1006,
1007,
1012,
65... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getUsableLocalPorts | public static TreeSet<Integer> getUsableLocalPorts(int numRequested, int minPort, int maxPort) {
final TreeSet<Integer> availablePorts = new TreeSet<>();
int attemptCount = 0;
while ((++attemptCount <= numRequested + 100) && availablePorts.size() < numRequested) {
availablePorts.add(getUsableLocalPort(minPort, maxPort));
}
if (availablePorts.size() != numRequested) {
throw new UtilException("Could not find {} available ports in the range [{}, {}]", numRequested, minPort, maxPort);
}
return availablePorts;
} | java | public static TreeSet<Integer> getUsableLocalPorts(int numRequested, int minPort, int maxPort) {
final TreeSet<Integer> availablePorts = new TreeSet<>();
int attemptCount = 0;
while ((++attemptCount <= numRequested + 100) && availablePorts.size() < numRequested) {
availablePorts.add(getUsableLocalPort(minPort, maxPort));
}
if (availablePorts.size() != numRequested) {
throw new UtilException("Could not find {} available ports in the range [{}, {}]", numRequested, minPort, maxPort);
}
return availablePorts;
} | [
"public",
"static",
"TreeSet",
"<",
"Integer",
">",
"getUsableLocalPorts",
"(",
"int",
"numRequested",
",",
"int",
"minPort",
",",
"int",
"maxPort",
")",
"{",
"final",
"TreeSet",
"<",
"Integer",
">",
"availablePorts",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
... | 获取多个本地可用端口<br>
来自org.springframework.util.SocketUtils
@param minPort 端口最小值(包含)
@param maxPort 端口最大值(包含)
@return 可用的端口
@since 4.5.4 | [
"获取多个本地可用端口<br",
">",
"来自org",
".",
"springframework",
".",
"util",
".",
"SocketUtils"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L176-L188 | train | Returns a set of local ports that are available in the range [ minPort maxPort ). | [
30522,
2270,
10763,
3628,
3388,
1026,
16109,
1028,
2131,
10383,
3468,
4135,
9289,
25378,
1006,
20014,
16371,
2213,
2890,
15500,
2098,
1010,
20014,
8117,
6442,
1010,
20014,
4098,
6442,
1007,
1063,
2345,
3628,
3388,
1026,
16109,
1028,
2800,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CoreBiGramTableDictionary.java | CoreBiGramTableDictionary.getBiFrequency | public static int getBiFrequency(String a, String b)
{
int idA = CoreDictionary.trie.exactMatchSearch(a);
if (idA == -1)
{
return 0;
}
int idB = CoreDictionary.trie.exactMatchSearch(b);
if (idB == -1)
{
return 0;
}
int index = binarySearch(pair, start[idA], start[idA + 1] - start[idA], idB);
if (index < 0) return 0;
index <<= 1;
return pair[index + 1];
} | java | public static int getBiFrequency(String a, String b)
{
int idA = CoreDictionary.trie.exactMatchSearch(a);
if (idA == -1)
{
return 0;
}
int idB = CoreDictionary.trie.exactMatchSearch(b);
if (idB == -1)
{
return 0;
}
int index = binarySearch(pair, start[idA], start[idA + 1] - start[idA], idB);
if (index < 0) return 0;
index <<= 1;
return pair[index + 1];
} | [
"public",
"static",
"int",
"getBiFrequency",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"int",
"idA",
"=",
"CoreDictionary",
".",
"trie",
".",
"exactMatchSearch",
"(",
"a",
")",
";",
"if",
"(",
"idA",
"==",
"-",
"1",
")",
"{",
"return",
"0",
... | 获取共现频次
@param a 第一个词
@param b 第二个词
@return 第一个词@第二个词出现的频次 | [
"获取共现频次"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreBiGramTableDictionary.java#L245-L261 | train | Gets the biFrequency value of two strings. | [
30522,
2270,
10763,
20014,
2131,
5638,
19699,
2063,
4226,
9407,
1006,
5164,
1037,
1010,
5164,
1038,
1007,
1063,
20014,
16096,
1027,
4563,
29201,
3258,
5649,
1012,
13012,
2063,
1012,
6635,
18900,
18069,
14644,
2818,
1006,
1037,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcher.java | DirectLogFetcher.putInt16 | protected final void putInt16(int i16) {
ensureCapacity(position + 2);
byte[] buf = buffer;
buf[position++] = (byte) (i16 & 0xff);
buf[position++] = (byte) (i16 >>> 8);
} | java | protected final void putInt16(int i16) {
ensureCapacity(position + 2);
byte[] buf = buffer;
buf[position++] = (byte) (i16 & 0xff);
buf[position++] = (byte) (i16 >>> 8);
} | [
"protected",
"final",
"void",
"putInt16",
"(",
"int",
"i16",
")",
"{",
"ensureCapacity",
"(",
"position",
"+",
"2",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"buffer",
";",
"buf",
"[",
"position",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"i16",
"&",
... | Put 16-bit integer in the buffer.
@param i16 the integer to put in the buffer | [
"Put",
"16",
"-",
"bit",
"integer",
"in",
"the",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcher.java#L216-L222 | train | Puts the 16 - bit integer into the buffer. | [
30522,
5123,
2345,
11675,
22072,
2102,
16048,
1006,
20014,
1045,
16048,
1007,
1063,
5676,
17695,
6305,
3012,
1006,
2597,
1009,
1016,
30524,
1033,
1027,
1006,
24880,
1007,
1006,
1045,
16048,
1028,
1028,
1028,
1022,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.