repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notEmpty | public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (CollectionUtil.isEmpty(collection)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return collection;
} | java | public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (CollectionUtil.isEmpty(collection)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return collection;
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"notEmpty",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"Collect... | 断言给定集合非空
<pre class="code">
Assert.notEmpty(collection, "Collection must have elements");
</pre>
@param <T> 集合元素类型
@param collection 被检查的集合
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 非空集合
@throws IllegalArgumentException if the collection is {@code null} or has no elements | [
"断言给定集合非空"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L351-L356 | train | Returns a new collection with all elements in the given collection that are not empty. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
3602,
27718,
2100,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
30524,
24422,
1006,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/pool/SimpleChannelPool.java | SimpleChannelPool.acquireHealthyFromPoolOrNew | private Future<Channel> acquireHealthyFromPoolOrNew(final Promise<Channel> promise) {
try {
final Channel ch = pollChannel();
if (ch == null) {
// No Channel left in the pool bootstrap a new Channel
Bootstrap bs = bootstrap.clone();
bs.attr(POOL_KEY, this);
ChannelFuture f = connectChannel(bs);
if (f.isDone()) {
notifyConnect(f, promise);
} else {
f.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
notifyConnect(future, promise);
}
});
}
return promise;
}
EventLoop loop = ch.eventLoop();
if (loop.inEventLoop()) {
doHealthCheck(ch, promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
doHealthCheck(ch, promise);
}
});
}
} catch (Throwable cause) {
promise.tryFailure(cause);
}
return promise;
} | java | private Future<Channel> acquireHealthyFromPoolOrNew(final Promise<Channel> promise) {
try {
final Channel ch = pollChannel();
if (ch == null) {
// No Channel left in the pool bootstrap a new Channel
Bootstrap bs = bootstrap.clone();
bs.attr(POOL_KEY, this);
ChannelFuture f = connectChannel(bs);
if (f.isDone()) {
notifyConnect(f, promise);
} else {
f.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
notifyConnect(future, promise);
}
});
}
return promise;
}
EventLoop loop = ch.eventLoop();
if (loop.inEventLoop()) {
doHealthCheck(ch, promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
doHealthCheck(ch, promise);
}
});
}
} catch (Throwable cause) {
promise.tryFailure(cause);
}
return promise;
} | [
"private",
"Future",
"<",
"Channel",
">",
"acquireHealthyFromPoolOrNew",
"(",
"final",
"Promise",
"<",
"Channel",
">",
"promise",
")",
"{",
"try",
"{",
"final",
"Channel",
"ch",
"=",
"pollChannel",
"(",
")",
";",
"if",
"(",
"ch",
"==",
"null",
")",
"{",
... | Tries to retrieve healthy channel from the pool if any or creates a new channel otherwise.
@param promise the promise to provide acquire result.
@return future for acquiring a channel. | [
"Tries",
"to",
"retrieve",
"healthy",
"channel",
"from",
"the",
"pool",
"if",
"any",
"or",
"creates",
"a",
"new",
"channel",
"otherwise",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/pool/SimpleChannelPool.java#L172-L207 | train | Acquires a healthy channel from the pool or creates a new one. | [
30522,
2797,
2925,
1026,
3149,
1028,
9878,
20192,
24658,
2100,
19699,
25377,
13669,
23846,
2860,
1006,
2345,
4872,
1026,
3149,
1028,
4872,
1007,
1063,
3046,
1063,
2345,
3149,
10381,
1027,
8554,
26058,
1006,
1007,
1025,
2065,
1006,
10381,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java | WebServiceTemplateBuilder.setDefaultUri | public WebServiceTemplateBuilder setDefaultUri(String defaultUri) {
Assert.hasText(defaultUri, "DefaultUri must not be empty");
return setDestinationProvider(() -> URI.create(defaultUri));
} | java | public WebServiceTemplateBuilder setDefaultUri(String defaultUri) {
Assert.hasText(defaultUri, "DefaultUri must not be empty");
return setDestinationProvider(() -> URI.create(defaultUri));
} | [
"public",
"WebServiceTemplateBuilder",
"setDefaultUri",
"(",
"String",
"defaultUri",
")",
"{",
"Assert",
".",
"hasText",
"(",
"defaultUri",
",",
"\"DefaultUri must not be empty\"",
")",
";",
"return",
"setDestinationProvider",
"(",
"(",
")",
"->",
"URI",
".",
"creat... | Set the default URI to be used on operations that do not have a URI parameter.
Typically, either this property is set, or
{@link #setDestinationProvider(DestinationProvider)}, but not both.
@param defaultUri the destination provider URI to be used on operations that do not
have a URI parameter.
@return a new builder instance.
@see #setDestinationProvider(DestinationProvider) | [
"Set",
"the",
"default",
"URI",
"to",
"be",
"used",
"on",
"operations",
"that",
"do",
"not",
"have",
"a",
"URI",
"parameter",
".",
"Typically",
"either",
"this",
"property",
"is",
"set",
"or",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java#L444-L447 | train | Sets the default URI to use. | [
30522,
2270,
4773,
8043,
7903,
12870,
8737,
13806,
8569,
23891,
2099,
2275,
3207,
7011,
11314,
9496,
1006,
5164,
12398,
9496,
1007,
1063,
20865,
1012,
24748,
18413,
1006,
12398,
9496,
1010,
1000,
12398,
9496,
2442,
2025,
2022,
4064,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java | PoolingConnectionFactoryBean.setConnectionFactory | public void setConnectionFactory(XAConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
setClassName(DirectXAConnectionFactory.class.getName());
setDriverProperties(new Properties());
} | java | public void setConnectionFactory(XAConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
setClassName(DirectXAConnectionFactory.class.getName());
setDriverProperties(new Properties());
} | [
"public",
"void",
"setConnectionFactory",
"(",
"XAConnectionFactory",
"connectionFactory",
")",
"{",
"this",
".",
"connectionFactory",
"=",
"connectionFactory",
";",
"setClassName",
"(",
"DirectXAConnectionFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
... | Set the {@link XAConnectionFactory} directly, instead of calling
{@link #setClassName(String)}.
@param connectionFactory the connection factory to use | [
"Set",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java#L97-L101 | train | Sets the XA connection factory. | [
30522,
2270,
11675,
2275,
8663,
2638,
7542,
21450,
1006,
1060,
22684,
10087,
7542,
21450,
4434,
21450,
1007,
1063,
2023,
1012,
4434,
21450,
1027,
4434,
21450,
1025,
2275,
26266,
18442,
1006,
3622,
18684,
8663,
2638,
7542,
21450,
1012,
2465,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java | LaunchedURLClassLoader.clearCache | public void clearCache() {
for (URL url : getURLs()) {
try {
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
clearCache(connection);
}
}
catch (IOException ex) {
// Ignore
}
}
} | java | public void clearCache() {
for (URL url : getURLs()) {
try {
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
clearCache(connection);
}
}
catch (IOException ex) {
// Ignore
}
}
} | [
"public",
"void",
"clearCache",
"(",
")",
"{",
"for",
"(",
"URL",
"url",
":",
"getURLs",
"(",
")",
")",
"{",
"try",
"{",
"URLConnection",
"connection",
"=",
"url",
".",
"openConnection",
"(",
")",
";",
"if",
"(",
"connection",
"instanceof",
"JarURLConnec... | Clear URL caches. | [
"Clear",
"URL",
"caches",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java#L163-L176 | train | Clear the cache of all the URLs. | [
30522,
2270,
11675,
3154,
3540,
5403,
1006,
1007,
1063,
2005,
1006,
24471,
30524,
22499,
10087,
7542,
1007,
1063,
3154,
3540,
5403,
1006,
4434,
1007,
1025,
1065,
1065,
4608,
1006,
22834,
10288,
24422,
4654,
1007,
1063,
1013,
1013,
8568,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/NetUtils.java | NetUtils.createSocketFromPorts | public static ServerSocket createSocketFromPorts(Iterator<Integer> portsIterator, SocketFactory factory) {
while (portsIterator.hasNext()) {
int port = portsIterator.next();
LOG.debug("Trying to open socket on port {}", port);
try {
return factory.createSocket(port);
} catch (IOException | IllegalArgumentException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to allocate socket on port", e);
} else {
LOG.info("Unable to allocate on port {}, due to error: {}", port, e.getMessage());
}
}
}
return null;
} | java | public static ServerSocket createSocketFromPorts(Iterator<Integer> portsIterator, SocketFactory factory) {
while (portsIterator.hasNext()) {
int port = portsIterator.next();
LOG.debug("Trying to open socket on port {}", port);
try {
return factory.createSocket(port);
} catch (IOException | IllegalArgumentException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to allocate socket on port", e);
} else {
LOG.info("Unable to allocate on port {}, due to error: {}", port, e.getMessage());
}
}
}
return null;
} | [
"public",
"static",
"ServerSocket",
"createSocketFromPorts",
"(",
"Iterator",
"<",
"Integer",
">",
"portsIterator",
",",
"SocketFactory",
"factory",
")",
"{",
"while",
"(",
"portsIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"int",
"port",
"=",
"portsIterator",... | Tries to allocate a socket from the given sets of ports.
@param portsIterator A set of ports to choose from.
@param factory A factory for creating the SocketServer
@return null if no port was available or an allocated socket. | [
"Tries",
"to",
"allocate",
"a",
"socket",
"from",
"the",
"given",
"sets",
"of",
"ports",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L374-L389 | train | Creates a server socket from the given ports iterator. | [
30522,
2270,
10763,
14903,
7432,
3388,
9005,
7432,
3388,
19699,
25377,
11589,
2015,
1006,
2009,
6906,
4263,
1026,
16109,
1028,
8831,
21646,
8844,
1010,
22278,
21450,
4713,
1007,
1063,
2096,
1006,
8831,
21646,
8844,
1012,
8440,
10288,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.getSharedPooledByteBufAllocator | public static synchronized PooledByteBufAllocator getSharedPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache) {
final int index = allowCache ? 0 : 1;
if (_sharedPooledByteBufAllocator[index] == null) {
_sharedPooledByteBufAllocator[index] =
createPooledByteBufAllocator(
allowDirectBufs,
allowCache,
defaultNumThreads(0));
}
return _sharedPooledByteBufAllocator[index];
} | java | public static synchronized PooledByteBufAllocator getSharedPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache) {
final int index = allowCache ? 0 : 1;
if (_sharedPooledByteBufAllocator[index] == null) {
_sharedPooledByteBufAllocator[index] =
createPooledByteBufAllocator(
allowDirectBufs,
allowCache,
defaultNumThreads(0));
}
return _sharedPooledByteBufAllocator[index];
} | [
"public",
"static",
"synchronized",
"PooledByteBufAllocator",
"getSharedPooledByteBufAllocator",
"(",
"boolean",
"allowDirectBufs",
",",
"boolean",
"allowCache",
")",
"{",
"final",
"int",
"index",
"=",
"allowCache",
"?",
"0",
":",
"1",
";",
"if",
"(",
"_sharedPooled... | Returns the lazily created shared pooled ByteBuf allocator for the specified allowCache
parameter value. | [
"Returns",
"the",
"lazily",
"created",
"shared",
"pooled",
"ByteBuf",
"allocator",
"for",
"the",
"specified",
"allowCache",
"parameter",
"value",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L132-L144 | train | Get the shared pooled ByteBuf allocator. | [
30522,
2270,
10763,
25549,
19107,
18939,
17250,
8569,
13976,
24755,
4263,
4152,
8167,
2098,
16869,
2098,
3762,
2618,
8569,
13976,
24755,
4263,
1006,
22017,
20898,
3499,
4305,
2890,
6593,
8569,
10343,
1010,
22017,
20898,
3499,
3540,
5403,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.containsIgnoreCase | public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return false;
}
final int len = searchStr.length();
final int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (CharSequenceUtils.regionMatches(str, true, i, searchStr, 0, len)) {
return true;
}
}
return false;
} | java | public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return false;
}
final int len = searchStr.length();
final int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (CharSequenceUtils.regionMatches(str, true, i, searchStr, 0, len)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"searchStr",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"final",
... | <p>Checks if CharSequence contains a search CharSequence irrespective of case,
handling {@code null}. Case-insensitivity is defined as by
{@link String#equalsIgnoreCase(String)}.
<p>A {@code null} CharSequence will return {@code false}.</p>
<pre>
StringUtils.containsIgnoreCase(null, *) = false
StringUtils.containsIgnoreCase(*, null) = false
StringUtils.containsIgnoreCase("", "") = true
StringUtils.containsIgnoreCase("abc", "") = true
StringUtils.containsIgnoreCase("abc", "a") = true
StringUtils.containsIgnoreCase("abc", "z") = false
StringUtils.containsIgnoreCase("abc", "A") = true
StringUtils.containsIgnoreCase("abc", "Z") = false
</pre>
@param str the CharSequence to check, may be null
@param searchStr the CharSequence to find, may be null
@return true if the CharSequence contains the search CharSequence irrespective of
case or false if not or {@code null} string input
@since 3.0 Changed signature from containsIgnoreCase(String, String) to containsIgnoreCase(CharSequence, CharSequence) | [
"<p",
">",
"Checks",
"if",
"CharSequence",
"contains",
"a",
"search",
"CharSequence",
"irrespective",
"of",
"case",
"handling",
"{",
"@code",
"null",
"}",
".",
"Case",
"-",
"insensitivity",
"is",
"defined",
"as",
"by",
"{",
"@link",
"String#equalsIgnoreCase",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L860-L872 | train | Check if the CharSequence contains the search string ignoring case. | [
30522,
2270,
10763,
22017,
20898,
3397,
23773,
5686,
18382,
1006,
2345,
25869,
3366,
4226,
5897,
2358,
2099,
1010,
2345,
25869,
3366,
4226,
5897,
3945,
3367,
2099,
1007,
1063,
2065,
1006,
2358,
2099,
1027,
1027,
19701,
1064,
1064,
3945,
336... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.hasNull | @SuppressWarnings("unchecked")
public static <T> boolean hasNull(T... array) {
if (isNotEmpty(array)) {
for (T element : array) {
if (null == element) {
return true;
}
}
}
return false;
} | java | @SuppressWarnings("unchecked")
public static <T> boolean hasNull(T... array) {
if (isNotEmpty(array)) {
for (T element : array) {
if (null == element) {
return true;
}
}
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"boolean",
"hasNull",
"(",
"T",
"...",
"array",
")",
"{",
"if",
"(",
"isNotEmpty",
"(",
"array",
")",
")",
"{",
"for",
"(",
"T",
"element",
":",
"array",
")",
"{",... | 是否包含{@code null}元素
@param <T> 数组元素类型
@param array 被检查的数组
@return 是否包含{@code null}元素
@since 3.0.7 | [
"是否包含",
"{",
"@code",
"null",
"}",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L253-L263 | train | Returns true if the array contains at least one element that is not null. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
22017,
20898,
8440,
18083,
1006,
1056,
1012,
1012,
1012,
9140,
1007,
1063,
2065,
1006,
3475,
12184,
27718,
2100,
1006,
9140,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Record.java | Record.setNull | public void setNull(long[] mask) {
for (int maskPos = 0, i = 0; i < this.numFields;) {
long currMask = mask[maskPos];
for (int k = 64; i < this.numFields && k > 0; --k, i++, currMask >>>= 1) {
if ((currMask & 0x1) != 0) {
internallySetField(i, null);
}
}
}
} | java | public void setNull(long[] mask) {
for (int maskPos = 0, i = 0; i < this.numFields;) {
long currMask = mask[maskPos];
for (int k = 64; i < this.numFields && k > 0; --k, i++, currMask >>>= 1) {
if ((currMask & 0x1) != 0) {
internallySetField(i, null);
}
}
}
} | [
"public",
"void",
"setNull",
"(",
"long",
"[",
"]",
"mask",
")",
"{",
"for",
"(",
"int",
"maskPos",
"=",
"0",
",",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"numFields",
";",
")",
"{",
"long",
"currMask",
"=",
"mask",
"[",
"maskPos",
"]",
";",... | Sets the fields to <code>null</code> using the given bit mask.
The bits correspond to the individual columns: <code>(1 == nullify, 0 == keep)</code>.
@param mask Bit mask, where the i-th least significant bit in the n-th bit mask represents the
<code>(n*64) + i</code>-th field in the record. | [
"Sets",
"the",
"fields",
"to",
"<code",
">",
"null<",
"/",
"code",
">",
"using",
"the",
"given",
"bit",
"mask",
".",
"The",
"bits",
"correspond",
"to",
"the",
"individual",
"columns",
":",
"<code",
">",
"(",
"1",
"==",
"nullify",
"0",
"==",
"keep",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L523-L532 | train | Sets the null value in the given mask. | [
30522,
2270,
11675,
2275,
11231,
3363,
1006,
2146,
1031,
1033,
7308,
1007,
1063,
2005,
1006,
20014,
7308,
6873,
2015,
1027,
1014,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
16371,
2213,
15155,
1025,
1007,
1063,
2146,
12731,
12171... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/config/Config.java | Config.fromYAML | public static Config fromYAML(String content) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromYAML(content, Config.class);
} | java | public static Config fromYAML(String content) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromYAML(content, Config.class);
} | [
"public",
"static",
"Config",
"fromYAML",
"(",
"String",
"content",
")",
"throws",
"IOException",
"{",
"ConfigSupport",
"support",
"=",
"new",
"ConfigSupport",
"(",
")",
";",
"return",
"support",
".",
"fromYAML",
"(",
"content",
",",
"Config",
".",
"class",
... | Read config object stored in YAML format from <code>String</code>
@param content of config
@return config
@throws IOException error | [
"Read",
"config",
"object",
"stored",
"in",
"YAML",
"format",
"from",
"<code",
">",
"String<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/Config.java#L639-L642 | train | Creates a Config object from a YAML string. | [
30522,
2270,
10763,
9530,
8873,
2290,
2013,
14852,
2140,
1006,
5164,
4180,
1007,
11618,
22834,
10288,
24422,
1063,
9530,
8873,
5620,
6279,
6442,
2490,
1027,
2047,
9530,
8873,
5620,
6279,
6442,
1006,
1007,
1025,
2709,
2490,
1012,
2013,
14852... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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, int width, int height) {
return generate(content, new QrConfig(width, height));
} | java | public static BufferedImage generate(String content, int width, int height) {
return generate(content, new QrConfig(width, height));
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"generate",
"(",
"content",
",",
"new",
"QrConfig",
"(",
"width",
",",
"height",
")",
")",
";",
"}"
] | 生成二维码图片
@param content 文本内容
@param width 宽度
@param height 高度
@return 二维码图片(黑白) | [
"生成二维码图片"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L133-L135 | train | Generates a image of the specified size with the specified content. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
9699,
1006,
5164,
4180,
1010,
20014,
9381,
1010,
20014,
4578,
1007,
1063,
2709,
9699,
1006,
4180,
1010,
2047,
1053,
29566,
2078,
8873,
2290,
1006,
9381,
1010,
4578,
1007,
1007,
1025,
1065,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.set | public Setting set(String group, String key, String value) {
this.put(group, key, value);
return this;
} | java | public Setting set(String group, String key, String value) {
this.put(group, key, value);
return this;
} | [
"public",
"Setting",
"set",
"(",
"String",
"group",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"put",
"(",
"group",
",",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | 将键值对加入到对应分组中
@param group 分组
@param key 键
@param value 值
@return 此key之前存在的值,如果没有返回null | [
"将键值对加入到对应分组中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L510-L513 | train | Sets a value for a group. | [
30522,
2270,
4292,
2275,
1006,
5164,
2177,
1010,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
2023,
1012,
2404,
1006,
2177,
1010,
3145,
1010,
3643,
1007,
1025,
2709,
2023,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.bind | public ChannelFuture bind(SocketAddress localAddress) {
validate();
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
return doBind(localAddress);
} | java | public ChannelFuture bind(SocketAddress localAddress) {
validate();
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
return doBind(localAddress);
} | [
"public",
"ChannelFuture",
"bind",
"(",
"SocketAddress",
"localAddress",
")",
"{",
"validate",
"(",
")",
";",
"if",
"(",
"localAddress",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"localAddress\"",
")",
";",
"}",
"return",
"doBind",... | Create a new {@link Channel} and bind it. | [
"Create",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L273-L279 | train | Bind to the specified local address. | [
30522,
2270,
3149,
11263,
11244,
14187,
1006,
22278,
4215,
16200,
4757,
2334,
4215,
16200,
4757,
1007,
1063,
9398,
3686,
1006,
1007,
1025,
2065,
1006,
2334,
4215,
16200,
4757,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
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... |
networknt/light-4j | email-sender/src/main/java/com/networknt/email/EmailSender.java | EmailSender.sendMailWithAttachment | public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port", emailConfg.getPort());
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.debug", emailConfg.getDebug());
props.put("mail.smtp.auth", emailConfg.getAuth());
props.put("mail.smtp.ssl.trust", emailConfg.host);
SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD));
Session session = Session.getInstance(props, auth);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(emailConfg.getUser()));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Now set the actual message
messageBodyPart.setText(content);
// Create a multipar message
Multipart multipart = new MimeMultipart();
// Set text message part
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
// Send the complete message parts
message.setContent(multipart);
// Send message
Transport.send(message);
if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject);
} | java | public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port", emailConfg.getPort());
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.debug", emailConfg.getDebug());
props.put("mail.smtp.auth", emailConfg.getAuth());
props.put("mail.smtp.ssl.trust", emailConfg.host);
SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD));
Session session = Session.getInstance(props, auth);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(emailConfg.getUser()));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Now set the actual message
messageBodyPart.setText(content);
// Create a multipar message
Multipart multipart = new MimeMultipart();
// Set text message part
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
// Send the complete message parts
message.setContent(multipart);
// Send message
Transport.send(message);
if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject);
} | [
"public",
"void",
"sendMailWithAttachment",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"content",
",",
"String",
"filename",
")",
"throws",
"MessagingException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
"... | Send email with a string content and attachment
@param to destination eamil address
@param subject email subject
@param content email content
@param filename attachment filename
@throws MessagingException messaging exception | [
"Send",
"email",
"with",
"a",
"string",
"content",
"and",
"attachment"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/email-sender/src/main/java/com/networknt/email/EmailSender.java#L97-L141 | train | Send an email with an attachment | [
30522,
2270,
11675,
4604,
21397,
24415,
19321,
6776,
3672,
1006,
5164,
2000,
1010,
5164,
3395,
1010,
5164,
4180,
1010,
5164,
5371,
18442,
1007,
11618,
24732,
10288,
24422,
1063,
5144,
24387,
1027,
2047,
5144,
1006,
1007,
1025,
24387,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.releaseSlot | @Override
public void releaseSlot(@Nonnull SlotRequestId slotRequestId, @Nullable Throwable cause) {
componentMainThreadExecutor.assertRunningInMainThread();
log.debug("Releasing slot [{}] because: {}", slotRequestId, cause != null ? cause.getMessage() : "null");
releaseSingleSlot(slotRequestId, cause);
} | java | @Override
public void releaseSlot(@Nonnull SlotRequestId slotRequestId, @Nullable Throwable cause) {
componentMainThreadExecutor.assertRunningInMainThread();
log.debug("Releasing slot [{}] because: {}", slotRequestId, cause != null ? cause.getMessage() : "null");
releaseSingleSlot(slotRequestId, cause);
} | [
"@",
"Override",
"public",
"void",
"releaseSlot",
"(",
"@",
"Nonnull",
"SlotRequestId",
"slotRequestId",
",",
"@",
"Nullable",
"Throwable",
"cause",
")",
"{",
"componentMainThreadExecutor",
".",
"assertRunningInMainThread",
"(",
")",
";",
"log",
".",
"debug",
"(",... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L369-L376 | train | Releases a slot. | [
30522,
1030,
2058,
15637,
2270,
11675,
7085,
10994,
1006,
1030,
2512,
11231,
3363,
10453,
2890,
15500,
3593,
10453,
2890,
15500,
3593,
1010,
1030,
19701,
3085,
5466,
3085,
3426,
1007,
1063,
6922,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dataproperties/RequestedLocalProperties.java | RequestedLocalProperties.isMetBy | public boolean isMetBy(LocalProperties other) {
if (this.ordering != null) {
// we demand an ordering
return other.getOrdering() != null && this.ordering.isMetBy(other.getOrdering());
} else if (this.groupedFields != null) {
// check if the other fields are unique
if (other.getGroupedFields() != null && other.getGroupedFields().isValidUnorderedPrefix(this.groupedFields)) {
return true;
} else {
return other.areFieldsUnique(this.groupedFields);
}
} else {
return true;
}
} | java | public boolean isMetBy(LocalProperties other) {
if (this.ordering != null) {
// we demand an ordering
return other.getOrdering() != null && this.ordering.isMetBy(other.getOrdering());
} else if (this.groupedFields != null) {
// check if the other fields are unique
if (other.getGroupedFields() != null && other.getGroupedFields().isValidUnorderedPrefix(this.groupedFields)) {
return true;
} else {
return other.areFieldsUnique(this.groupedFields);
}
} else {
return true;
}
} | [
"public",
"boolean",
"isMetBy",
"(",
"LocalProperties",
"other",
")",
"{",
"if",
"(",
"this",
".",
"ordering",
"!=",
"null",
")",
"{",
"// we demand an ordering",
"return",
"other",
".",
"getOrdering",
"(",
")",
"!=",
"null",
"&&",
"this",
".",
"ordering",
... | Checks, if this set of properties, as interesting properties, is met by the given
properties.
@param other
The properties for which to check whether they meet these properties.
@return True, if the properties are met, false otherwise. | [
"Checks",
"if",
"this",
"set",
"of",
"properties",
"as",
"interesting",
"properties",
"is",
"met",
"by",
"the",
"given",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/RequestedLocalProperties.java#L193-L207 | train | Checks if this properties is met by another properties. | [
30522,
2270,
22017,
20898,
2003,
11368,
3762,
1006,
2334,
21572,
4842,
7368,
2060,
1007,
1063,
2065,
1006,
2023,
1012,
13063,
999,
1027,
19701,
1007,
1063,
1013,
1013,
2057,
5157,
2019,
13063,
2709,
2060,
1012,
2131,
8551,
7999,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.removeFirst | public static String removeFirst(final String text, final Pattern regex) {
return replaceFirst(text, regex, StringUtils.EMPTY);
} | java | public static String removeFirst(final String text, final Pattern regex) {
return replaceFirst(text, regex, StringUtils.EMPTY);
} | [
"public",
"static",
"String",
"removeFirst",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
")",
"{",
"return",
"replaceFirst",
"(",
"text",
",",
"regex",
",",
"StringUtils",
".",
"EMPTY",
")",
";",
"}"
] | <p>Removes the first 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).replaceFirst(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.removeFirst(null, *) = null
StringUtils.removeFirst("any", (Pattern) null) = "any"
StringUtils.removeFirst("any", Pattern.compile("")) = "any"
StringUtils.removeFirst("any", Pattern.compile(".*")) = ""
StringUtils.removeFirst("any", Pattern.compile(".+")) = ""
StringUtils.removeFirst("abc", Pattern.compile(".?")) = "bc"
StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\n<__>B"
StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
StringUtils.removeFirst("ABCabc123", Pattern.compile("[a-z]")) = "ABCbc123"
StringUtils.removeFirst("ABCabc123abc", Pattern.compile("[a-z]+")) = "ABC123abc"
</pre>
@param text text to remove from, may be null
@param regex the regular expression pattern to which this string is to be matched
@return the text with the first replacement processed,
{@code null} if null String input
@see #replaceFirst(String, Pattern, String)
@see java.util.regex.Matcher#replaceFirst(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Removes",
"the",
"first",
"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#L142-L144 | train | Remove first. | [
30522,
2270,
10763,
5164,
6366,
8873,
12096,
1006,
2345,
5164,
3793,
1010,
2345,
5418,
19723,
10288,
1007,
1063,
2709,
5672,
8873,
12096,
1006,
3793,
1010,
19723,
10288,
1010,
5164,
21823,
4877,
1012,
4064,
1007,
1025,
1065,
102,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java | ApplicationConversionService.addApplicationConverters | public static void addApplicationConverters(ConverterRegistry registry) {
addDelimitedStringConverters(registry);
registry.addConverter(new StringToDurationConverter());
registry.addConverter(new DurationToStringConverter());
registry.addConverter(new NumberToDurationConverter());
registry.addConverter(new DurationToNumberConverter());
registry.addConverter(new StringToDataSizeConverter());
registry.addConverter(new NumberToDataSizeConverter());
registry.addConverterFactory(new StringToEnumIgnoringCaseConverterFactory());
} | java | public static void addApplicationConverters(ConverterRegistry registry) {
addDelimitedStringConverters(registry);
registry.addConverter(new StringToDurationConverter());
registry.addConverter(new DurationToStringConverter());
registry.addConverter(new NumberToDurationConverter());
registry.addConverter(new DurationToNumberConverter());
registry.addConverter(new StringToDataSizeConverter());
registry.addConverter(new NumberToDataSizeConverter());
registry.addConverterFactory(new StringToEnumIgnoringCaseConverterFactory());
} | [
"public",
"static",
"void",
"addApplicationConverters",
"(",
"ConverterRegistry",
"registry",
")",
"{",
"addDelimitedStringConverters",
"(",
"registry",
")",
";",
"registry",
".",
"addConverter",
"(",
"new",
"StringToDurationConverter",
"(",
")",
")",
";",
"registry",... | Add converters useful for most Spring Boot applications.
@param registry the registry of converters to add to (must also be castable to
ConversionService, e.g. being a {@link ConfigurableConversionService})
@throws ClassCastException if the given ConverterRegistry could not be cast to a
ConversionService | [
"Add",
"converters",
"useful",
"for",
"most",
"Spring",
"Boot",
"applications",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java#L101-L110 | train | Add all application converters to the given converter registry. | [
30522,
2270,
10763,
11675,
5587,
29098,
19341,
3508,
8663,
16874,
2545,
30524,
1025,
15584,
1012,
5587,
8663,
16874,
2121,
1006,
2047,
9367,
13122,
18886,
3070,
8663,
16874,
2121,
1006,
1007,
1007,
1025,
15584,
1012,
5587,
8663,
16874,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/CharValueArray.java | CharValueArray.compareTo | @Override
public int compareTo(ValueArray<CharValue> o) {
CharValueArray other = (CharValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Character.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | java | @Override
public int compareTo(ValueArray<CharValue> o) {
CharValueArray other = (CharValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Character.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"CharValue",
">",
"o",
")",
"{",
"CharValueArray",
"other",
"=",
"(",
"CharValueArray",
")",
"o",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"position",
",",
"other",
".",
"po... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/CharValueArray.java#L226-L240 | train | Compare two CharValueArrays. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
25869,
10175,
5657,
1028,
1051,
1007,
1063,
25869,
10175,
5657,
2906,
9447,
2060,
1027,
1006,
25869,
10175,
5657,
2906,
9447,
1007,
1051,
1025,
20014,
8117,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.numberToString | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Number must be non-null");
}
double doubleValue = number.doubleValue();
JSON.checkDouble(doubleValue);
// the original returns "-0" instead of "-0.0" for negative zero
if (number.equals(NEGATIVE_ZERO)) {
return "-0";
}
long longValue = number.longValue();
if (doubleValue == longValue) {
return Long.toString(longValue);
}
return number.toString();
} | java | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Number must be non-null");
}
double doubleValue = number.doubleValue();
JSON.checkDouble(doubleValue);
// the original returns "-0" instead of "-0.0" for negative zero
if (number.equals(NEGATIVE_ZERO)) {
return "-0";
}
long longValue = number.longValue();
if (doubleValue == longValue) {
return Long.toString(longValue);
}
return number.toString();
} | [
"public",
"static",
"String",
"numberToString",
"(",
"Number",
"number",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Number must be non-null\"",
")",
";",
"}",
"double",
"doubleValue"... | Encodes the number as a JSON string.
@param number a finite value. May not be {@link Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}.
@return the encoded value
@throws JSONException if an error occurs | [
"Encodes",
"the",
"number",
"as",
"a",
"JSON",
"string",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L748-L767 | train | Convert a number to a string. | [
30522,
2270,
10763,
5164,
2193,
13122,
18886,
3070,
1006,
2193,
2193,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
2193,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
1046,
3385,
10288,
24422,
1006,
1000,
2193,
2442,
2022,
2512,
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/corpus/dependency/CoNll/CoNLLSentence.java | CoNLLSentence.findChildren | public List<CoNLLWord> findChildren(CoNLLWord word, String relation)
{
List<CoNLLWord> result = new LinkedList<CoNLLWord>();
for (CoNLLWord other : this)
{
if (other.HEAD == word && other.DEPREL.equals(relation))
result.add(other);
}
return result;
} | java | public List<CoNLLWord> findChildren(CoNLLWord word, String relation)
{
List<CoNLLWord> result = new LinkedList<CoNLLWord>();
for (CoNLLWord other : this)
{
if (other.HEAD == word && other.DEPREL.equals(relation))
result.add(other);
}
return result;
} | [
"public",
"List",
"<",
"CoNLLWord",
">",
"findChildren",
"(",
"CoNLLWord",
"word",
",",
"String",
"relation",
")",
"{",
"List",
"<",
"CoNLLWord",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"CoNLLWord",
">",
"(",
")",
";",
"for",
"(",
"CoNLLWord",
"oth... | 找出特定依存关系的子节点
@param word
@param relation
@return | [
"找出特定依存关系的子节点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java#L154-L163 | train | Find children. | [
30522,
2270,
2862,
1026,
9530,
3363,
18351,
1028,
2424,
19339,
7389,
1006,
9530,
3363,
18351,
2773,
1010,
5164,
7189,
1007,
1063,
2862,
1026,
9530,
3363,
18351,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
9530,
3363,
18351,
1028,
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/io/watch/WatchMonitor.java | WatchMonitor.createAll | public static WatchMonitor createAll(String path, Watcher watcher){
return createAll(Paths.get(path), watcher);
} | java | public static WatchMonitor createAll(String path, Watcher watcher){
return createAll(Paths.get(path), watcher);
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"String",
"path",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createAll",
"(",
"Paths",
".",
"get",
"(",
"path",
")",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听所有事件
@param path 路径
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L228-L230 | train | Creates a WatchMonitor for all the files in the given path. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
8095,
1006,
5164,
4130,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
2709,
3443,
8095,
1006,
10425,
1012,
2131,
1006,
4130,
1007,
1010,
3422,
2121,
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... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.replaceAll | public static String replaceAll(final String text, final Pattern regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
return text;
}
return regex.matcher(text).replaceAll(replacement);
} | java | public static String replaceAll(final String text, final Pattern regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
return text;
}
return regex.matcher(text).replaceAll(replacement);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"regex",
"==",
"null",
"||",
"replacement",
"==",
"null",
... | <p>Replaces each substring of the text String that matches the given regular expression pattern with the given replacement.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceAll(replacement)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.replaceAll(null, *, *) = null
StringUtils.replaceAll("any", (Pattern) null, *) = "any"
StringUtils.replaceAll("any", *, null) = "any"
StringUtils.replaceAll("", Pattern.compile(""), "zzz") = "zzz"
StringUtils.replaceAll("", Pattern.compile(".*"), "zzz") = "zzz"
StringUtils.replaceAll("", Pattern.compile(".+"), "zzz") = ""
StringUtils.replaceAll("abc", Pattern.compile(""), "ZZ") = "ZZaZZbZZcZZ"
StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\nz"
StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>", Pattern.DOTALL), "z") = "z"
StringUtils.replaceAll("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
StringUtils.replaceAll("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC___123"
StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123"
StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123"
StringUtils.replaceAll("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum_dolor_sit"
</pre>
@param text text to search and replace in, may be null
@param regex the regular expression pattern to which this string is to be matched
@param replacement the string to be substituted for each match
@return the text with any replacements processed,
{@code null} if null String input
@see java.util.regex.Matcher#replaceAll(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Replaces",
"each",
"substring",
"of",
"the",
"text",
"String",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"pattern",
"with",
"the",
"given",
"replacement",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L258-L263 | train | Replaces all occurrences of the given regular expression with the given replacement. | [
30522,
2270,
10763,
5164,
5672,
8095,
1006,
2345,
5164,
3793,
1010,
2345,
5418,
19723,
10288,
1010,
2345,
5164,
6110,
1007,
1063,
2065,
1006,
3793,
1027,
1027,
19701,
1064,
1064,
19723,
10288,
1027,
1027,
19701,
1064,
1064,
6110,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java | YarnShuffleService.serviceStop | @Override
protected void serviceStop() {
try {
if (shuffleServer != null) {
shuffleServer.close();
}
if (transportContext != null) {
transportContext.close();
}
if (blockHandler != null) {
blockHandler.close();
}
if (db != null) {
db.close();
}
} catch (Exception e) {
logger.error("Exception when stopping service", e);
}
} | java | @Override
protected void serviceStop() {
try {
if (shuffleServer != null) {
shuffleServer.close();
}
if (transportContext != null) {
transportContext.close();
}
if (blockHandler != null) {
blockHandler.close();
}
if (db != null) {
db.close();
}
} catch (Exception e) {
logger.error("Exception when stopping service", e);
}
} | [
"@",
"Override",
"protected",
"void",
"serviceStop",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"shuffleServer",
"!=",
"null",
")",
"{",
"shuffleServer",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"transportContext",
"!=",
"null",
")",
"{",
"transportContex... | Close the shuffle server to clean up any associated state. | [
"Close",
"the",
"shuffle",
"server",
"to",
"clean",
"up",
"any",
"associated",
"state",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L317-L335 | train | Stop the service. | [
30522,
1030,
2058,
15637,
5123,
11675,
2578,
14399,
1006,
1007,
1063,
3046,
1063,
2065,
1006,
23046,
8043,
6299,
999,
1027,
19701,
1007,
1063,
23046,
8043,
6299,
1012,
2485,
1006,
1007,
1025,
1065,
2065,
1006,
3665,
8663,
18209,
999,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(ByteBuffer... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return copiedBuffer(buffers[0]);
}
// Merge the specified buffers into one buffer.
ByteOrder order = null;
int length = 0;
for (ByteBuffer b: buffers) {
int bLen = b.remaining();
if (bLen <= 0) {
continue;
}
if (Integer.MAX_VALUE - length < bLen) {
throw new IllegalArgumentException(
"The total length of the specified buffers is too big.");
}
length += bLen;
if (order != null) {
if (!order.equals(b.order())) {
throw new IllegalArgumentException("inconsistent byte order");
}
} else {
order = b.order();
}
}
if (length == 0) {
return EMPTY_BUFFER;
}
byte[] mergedArray = PlatformDependent.allocateUninitializedArray(length);
for (int i = 0, j = 0; i < buffers.length; i ++) {
// Duplicate the buffer so we not adjust the position during our get operation.
// See https://github.com/netty/netty/issues/3896
ByteBuffer b = buffers[i].duplicate();
int bLen = b.remaining();
b.get(mergedArray, j, bLen);
j += bLen;
}
return wrappedBuffer(mergedArray).order(order);
} | java | public static ByteBuf copiedBuffer(ByteBuffer... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return copiedBuffer(buffers[0]);
}
// Merge the specified buffers into one buffer.
ByteOrder order = null;
int length = 0;
for (ByteBuffer b: buffers) {
int bLen = b.remaining();
if (bLen <= 0) {
continue;
}
if (Integer.MAX_VALUE - length < bLen) {
throw new IllegalArgumentException(
"The total length of the specified buffers is too big.");
}
length += bLen;
if (order != null) {
if (!order.equals(b.order())) {
throw new IllegalArgumentException("inconsistent byte order");
}
} else {
order = b.order();
}
}
if (length == 0) {
return EMPTY_BUFFER;
}
byte[] mergedArray = PlatformDependent.allocateUninitializedArray(length);
for (int i = 0, j = 0; i < buffers.length; i ++) {
// Duplicate the buffer so we not adjust the position during our get operation.
// See https://github.com/netty/netty/issues/3896
ByteBuffer b = buffers[i].duplicate();
int bLen = b.remaining();
b.get(mergedArray, j, bLen);
j += bLen;
}
return wrappedBuffer(mergedArray).order(order);
} | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"ByteBuffer",
"...",
"buffers",
")",
"{",
"switch",
"(",
"buffers",
".",
"length",
")",
"{",
"case",
"0",
":",
"return",
"EMPTY_BUFFER",
";",
"case",
"1",
":",
"return",
"copiedBuffer",
"(",
"buffers",
"[... | Creates a new buffer whose content is a merged copy of the specified
{@code buffers}' slices. The new buffer's {@code readerIndex} and
{@code writerIndex} are {@code 0} and the sum of all buffers'
{@code remaining} respectively.
@throws IllegalArgumentException
if the specified buffers' endianness are different from each
other | [
"Creates",
"a",
"new",
"buffer",
"whose",
"content",
"is",
"a",
"merged",
"copy",
"of",
"the",
"specified",
"{",
"@code",
"buffers",
"}",
"slices",
".",
"The",
"new",
"buffer",
"s",
"{",
"@code",
"readerIndex",
"}",
"and",
"{",
"@code",
"writerIndex",
"}... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L524-L569 | train | Returns a new byte buffer that contains all of the specified buffers. | [
30522,
2270,
10763,
24880,
8569,
2546,
15826,
8569,
12494,
1006,
24880,
8569,
12494,
1012,
1012,
1012,
17698,
2015,
1007,
1063,
6942,
1006,
17698,
2015,
1012,
3091,
1007,
1063,
2553,
1014,
1024,
2709,
4064,
1035,
17698,
1025,
2553,
1015,
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/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java | ShardingEncryptorEngine.getAssistedQueryColumn | public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) {
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
Optional<String> result = each.getAssistedQueryColumn(logicTableName, columnName);
if (result.isPresent()) {
return result;
}
}
return Optional.absent();
} | java | public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) {
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
Optional<String> result = each.getAssistedQueryColumn(logicTableName, columnName);
if (result.isPresent()) {
return result;
}
}
return Optional.absent();
} | [
"public",
"Optional",
"<",
"String",
">",
"getAssistedQueryColumn",
"(",
"final",
"String",
"logicTableName",
",",
"final",
"String",
"columnName",
")",
"{",
"for",
"(",
"ShardingEncryptorStrategy",
"each",
":",
"shardingEncryptorStrategies",
".",
"values",
"(",
")"... | Get assisted query column.
@param logicTableName logic table name
@param columnName column name
@return assisted query column | [
"Get",
"assisted",
"query",
"column",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java#L88-L96 | train | Get assisted query column. | [
30522,
2270,
11887,
1026,
5164,
1028,
2131,
12054,
27870,
2094,
4226,
2854,
25778,
2819,
2078,
1006,
2345,
5164,
7961,
10880,
18442,
1010,
2345,
5164,
5930,
18442,
1007,
1063,
2005,
1006,
21146,
17080,
25997,
26775,
22571,
6591,
6494,
2618,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java | ServerBootstrap.childAttr | public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value) {
if (childKey == null) {
throw new NullPointerException("childKey");
}
if (value == null) {
childAttrs.remove(childKey);
} else {
childAttrs.put(childKey, value);
}
return this;
} | java | public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value) {
if (childKey == null) {
throw new NullPointerException("childKey");
}
if (value == null) {
childAttrs.remove(childKey);
} else {
childAttrs.put(childKey, value);
}
return this;
} | [
"public",
"<",
"T",
">",
"ServerBootstrap",
"childAttr",
"(",
"AttributeKey",
"<",
"T",
">",
"childKey",
",",
"T",
"value",
")",
"{",
"if",
"(",
"childKey",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"childKey\"",
")",
";",
"}... | Set the specific {@link AttributeKey} with the given value on every child {@link Channel}. If the value is
{@code null} the {@link AttributeKey} is removed | [
"Set",
"the",
"specific",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java#L117-L127 | train | Add a child attribute. | [
30522,
2270,
1026,
1056,
1028,
8241,
27927,
20528,
2361,
2775,
19321,
2099,
1006,
17961,
14839,
1026,
1056,
1028,
2775,
14839,
1010,
1056,
3643,
1007,
1063,
2065,
1006,
2775,
14839,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
78... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java | PackagedProgram.createPlanFromProgram | private static Plan createPlanFromProgram(Program program, String[] options) throws ProgramInvocationException {
try {
return program.getPlan(options);
} catch (Throwable t) {
throw new ProgramInvocationException("Error while calling the program: " + t.getMessage(), t);
}
} | java | private static Plan createPlanFromProgram(Program program, String[] options) throws ProgramInvocationException {
try {
return program.getPlan(options);
} catch (Throwable t) {
throw new ProgramInvocationException("Error while calling the program: " + t.getMessage(), t);
}
} | [
"private",
"static",
"Plan",
"createPlanFromProgram",
"(",
"Program",
"program",
",",
"String",
"[",
"]",
"options",
")",
"throws",
"ProgramInvocationException",
"{",
"try",
"{",
"return",
"program",
".",
"getPlan",
"(",
"options",
")",
";",
"}",
"catch",
"(",... | Takes the jar described by the given file and invokes its pact assembler class to
assemble a plan. The assembler class name is either passed through a parameter,
or it is read from the manifest of the jar. The assembler is handed the given options
for its assembly.
@param program The program to create the plan for.
@param options
The options for the assembler.
@return The plan created by the program.
@throws ProgramInvocationException
Thrown, if an error occurred in the user-provided pact assembler. | [
"Takes",
"the",
"jar",
"described",
"by",
"the",
"given",
"file",
"and",
"invokes",
"its",
"pact",
"assembler",
"class",
"to",
"assemble",
"a",
"plan",
".",
"The",
"assembler",
"class",
"name",
"is",
"either",
"passed",
"through",
"a",
"parameter",
"or",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L651-L657 | train | Create a plan from a program. | [
30522,
2797,
10763,
2933,
3443,
24759,
2319,
19699,
25377,
3217,
13113,
1006,
2565,
2565,
1010,
5164,
1031,
1033,
7047,
1007,
11618,
2565,
2378,
19152,
10288,
24422,
1063,
3046,
1063,
2709,
2565,
1012,
2131,
24759,
2319,
1006,
7047,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java | ExecutionEnvironment.readTextFile | public DataSource<String> readTextFile(String filePath) {
Preconditions.checkNotNull(filePath, "The file path may not be null.");
return new DataSource<>(this, new TextInputFormat(new Path(filePath)), BasicTypeInfo.STRING_TYPE_INFO, Utils.getCallLocationName());
} | java | public DataSource<String> readTextFile(String filePath) {
Preconditions.checkNotNull(filePath, "The file path may not be null.");
return new DataSource<>(this, new TextInputFormat(new Path(filePath)), BasicTypeInfo.STRING_TYPE_INFO, Utils.getCallLocationName());
} | [
"public",
"DataSource",
"<",
"String",
">",
"readTextFile",
"(",
"String",
"filePath",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"filePath",
",",
"\"The file path may not be null.\"",
")",
";",
"return",
"new",
"DataSource",
"<>",
"(",
"this",
",",
"n... | Creates a {@link DataSet} that represents the Strings produced by reading the given file line wise.
The file will be read with the UTF-8 character set.
@param filePath The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path").
@return A {@link DataSet} that represents the data read from the given file as text lines. | [
"Creates",
"a",
"{",
"@link",
"DataSet",
"}",
"that",
"represents",
"the",
"Strings",
"produced",
"by",
"reading",
"the",
"given",
"file",
"line",
"wise",
".",
"The",
"file",
"will",
"be",
"read",
"with",
"the",
"UTF",
"-",
"8",
"character",
"set",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L393-L397 | train | Reads a text file from the specified path. | [
30522,
2270,
2951,
6499,
3126,
3401,
1026,
5164,
1028,
3191,
18209,
8873,
2571,
1006,
5164,
5371,
15069,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
5371,
15069,
1010,
1000,
1996,
5371,
4130,
2089,
2025,
2022,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | store/src/main/java/com/alibaba/otter/canal/store/AbstractCanalStoreScavenge.java | AbstractCanalStoreScavenge.min | private LogPosition min(LogPosition position1, LogPosition position2) {
if (position1.getIdentity().equals(position2.getIdentity())) {
// 首先根据文件进行比较
if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) < 0) {
return position2;
} else if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) > 0) {
return position1;
} else {
// 根据offest进行比较
if (position1.getPostion().getPosition() < position2.getPostion().getPosition()) {
return position2;
} else {
return position1;
}
}
} else {
// 不同的主备库,根据时间进行比较
if (position1.getPostion().getTimestamp() < position2.getPostion().getTimestamp()) {
return position2;
} else {
return position1;
}
}
} | java | private LogPosition min(LogPosition position1, LogPosition position2) {
if (position1.getIdentity().equals(position2.getIdentity())) {
// 首先根据文件进行比较
if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) < 0) {
return position2;
} else if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) > 0) {
return position1;
} else {
// 根据offest进行比较
if (position1.getPostion().getPosition() < position2.getPostion().getPosition()) {
return position2;
} else {
return position1;
}
}
} else {
// 不同的主备库,根据时间进行比较
if (position1.getPostion().getTimestamp() < position2.getPostion().getTimestamp()) {
return position2;
} else {
return position1;
}
}
} | [
"private",
"LogPosition",
"min",
"(",
"LogPosition",
"position1",
",",
"LogPosition",
"position2",
")",
"{",
"if",
"(",
"position1",
".",
"getIdentity",
"(",
")",
".",
"equals",
"(",
"position2",
".",
"getIdentity",
"(",
")",
")",
")",
"{",
"// 首先根据文件进行比较",
... | 找出一个最小的position位置 | [
"找出一个最小的position位置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/store/src/main/java/com/alibaba/otter/canal/store/AbstractCanalStoreScavenge.java#L63-L86 | train | Returns the min of two log positions. | [
30522,
2797,
8833,
26994,
8117,
1006,
8833,
26994,
2597,
2487,
1010,
8833,
26994,
2597,
2475,
1007,
1063,
2065,
1006,
2597,
2487,
1012,
2131,
5178,
16778,
3723,
1006,
1007,
1012,
19635,
1006,
2597,
2475,
1012,
2131,
5178,
16778,
3723,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.isAllChineseNum | public static boolean isAllChineseNum(String word)
{// 百分之五点六的人早上八点十八分起床
String chineseNum = "零○一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟∶·./点";//
String prefix = "几数上第";
String surfix = "几多余来成倍";
boolean round = false;
if (word == null)
return false;
char[] temp = word.toCharArray();
for (int i = 0; i < temp.length; i++)
{
if (word.startsWith("分之", i))// 百分之五
{
i += 1;
continue;
}
char tchar = temp[i];
if (i == 0 && prefix.indexOf(tchar) != -1)
{
round = true;
}
else if (i == temp.length-1 && !round && surfix.indexOf(tchar) != -1)
{
round = true;
}
else if (chineseNum.indexOf(tchar) == -1)
return false;
}
return true;
} | java | public static boolean isAllChineseNum(String word)
{// 百分之五点六的人早上八点十八分起床
String chineseNum = "零○一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟∶·./点";//
String prefix = "几数上第";
String surfix = "几多余来成倍";
boolean round = false;
if (word == null)
return false;
char[] temp = word.toCharArray();
for (int i = 0; i < temp.length; i++)
{
if (word.startsWith("分之", i))// 百分之五
{
i += 1;
continue;
}
char tchar = temp[i];
if (i == 0 && prefix.indexOf(tchar) != -1)
{
round = true;
}
else if (i == temp.length-1 && !round && surfix.indexOf(tchar) != -1)
{
round = true;
}
else if (chineseNum.indexOf(tchar) == -1)
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isAllChineseNum",
"(",
"String",
"word",
")",
"{",
"// 百分之五点六的人早上八点十八分起床",
"String",
"chineseNum",
"=",
"\"零○一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟∶·./点\";//",
"",
"",
"String",
"prefix",
"=",
"\"几数上第\";",
"",
"String",
"surfix",
"=",
"\"几多余来成倍\"... | 是否全是中国数字
@param word
@return | [
"是否全是中国数字"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L300-L332 | train | isAllChineseNum returns true if the word is all chinese numbers | [
30522,
2270,
10763,
22017,
20898,
18061,
3363,
17231,
6810,
19172,
1006,
5164,
2773,
1007,
1063,
1013,
1013,
100,
1775,
1749,
1753,
100,
100,
1916,
1756,
100,
1742,
1771,
100,
1783,
1771,
1775,
100,
100,
5164,
2822,
19172,
1027,
1000,
305... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.toMapList | public static <K, V> List<Map<K, V>> toMapList(Map<K, ? extends Iterable<V>> listMap) {
final List<Map<K, V>> resultList = new ArrayList<>();
if (isEmpty(listMap)) {
return resultList;
}
boolean isEnd = true;// 是否结束。标准是元素列表已耗尽
int index = 0;// 值索引
Map<K, V> map;
do {
isEnd = true;
map = new HashMap<>();
List<V> vList;
int vListSize;
for (Entry<K, ? extends Iterable<V>> entry : listMap.entrySet()) {
vList = CollectionUtil.newArrayList(entry.getValue());
vListSize = vList.size();
if (index < vListSize) {
map.put(entry.getKey(), vList.get(index));
if (index != vListSize - 1) {
// 当值列表中还有更多值(非最后一个),继续循环
isEnd = false;
}
}
}
if (false == map.isEmpty()) {
resultList.add(map);
}
index++;
} while (false == isEnd);
return resultList;
} | java | public static <K, V> List<Map<K, V>> toMapList(Map<K, ? extends Iterable<V>> listMap) {
final List<Map<K, V>> resultList = new ArrayList<>();
if (isEmpty(listMap)) {
return resultList;
}
boolean isEnd = true;// 是否结束。标准是元素列表已耗尽
int index = 0;// 值索引
Map<K, V> map;
do {
isEnd = true;
map = new HashMap<>();
List<V> vList;
int vListSize;
for (Entry<K, ? extends Iterable<V>> entry : listMap.entrySet()) {
vList = CollectionUtil.newArrayList(entry.getValue());
vListSize = vList.size();
if (index < vListSize) {
map.put(entry.getKey(), vList.get(index));
if (index != vListSize - 1) {
// 当值列表中还有更多值(非最后一个),继续循环
isEnd = false;
}
}
}
if (false == map.isEmpty()) {
resultList.add(map);
}
index++;
} while (false == isEnd);
return resultList;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"List",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"toMapList",
"(",
"Map",
"<",
"K",
",",
"?",
"extends",
"Iterable",
"<",
"V",
">",
">",
"listMap",
")",
"{",
"final",
"List",
"<",
"Map",
"<",
"K",... | 列转行。将Map中值列表分别按照其位置与key组成新的map。<br>
是{@link #toListMap(Iterable)}的逆方法<br>
比如传入数据:
<pre>
{
a: [1,2,3,4]
b: [1,2,3,]
c: [1]
}
</pre>
结果是:
<pre>
[
{a: 1, b: 1, c: 1}
{a: 2, b: 2}
{a: 3, b: 3}
{a: 4}
]
</pre>
@param <K> 键类型
@param <V> 值类型
@param listMap 列表Map
@return Map列表 | [
"列转行。将Map中值列表分别按照其位置与key组成新的map。<br",
">",
"是",
"{",
"@link",
"#toListMap",
"(",
"Iterable",
")",
"}",
"的逆方法<br",
">",
"比如传入数据:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L345-L377 | train | Creates a list of Maps from the given map. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2862,
1026,
4949,
1026,
1047,
1010,
1058,
1028,
1028,
3419,
9331,
9863,
1006,
4949,
1026,
1047,
1010,
1029,
8908,
2009,
6906,
3468,
1026,
1058,
1028,
1028,
2862,
2863,
2361,
1007,
1063,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.createProgramPlan | @Internal
public Plan createProgramPlan(String jobName, boolean clearSinks) {
if (this.sinks.isEmpty()) {
if (wasExecuted) {
throw new RuntimeException("No new data sinks have been defined since the " +
"last execution. The last execution refers to the latest call to " +
"'execute()', 'count()', 'collect()', or 'print()'.");
} else {
throw new RuntimeException("No data sinks have been created yet. " +
"A program needs at least one sink that consumes data. " +
"Examples are writing the data set or printing it.");
}
}
if (jobName == null) {
jobName = getDefaultName();
}
OperatorTranslation translator = new OperatorTranslation();
Plan plan = translator.translateToPlan(this.sinks, jobName);
if (getParallelism() > 0) {
plan.setDefaultParallelism(getParallelism());
}
plan.setExecutionConfig(getConfig());
// Check plan for GenericTypeInfo's and register the types at the serializers.
if (!config.isAutoTypeRegistrationDisabled()) {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
private final Set<Class<?>> registeredTypes = new HashSet<>();
private final Set<org.apache.flink.api.common.operators.Operator<?>> visitedOperators = new HashSet<>();
@Override
public boolean preVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {
if (!visitedOperators.add(visitable)) {
return false;
}
OperatorInformation<?> opInfo = visitable.getOperatorInfo();
Serializers.recursivelyRegisterType(opInfo.getOutputType(), config, registeredTypes);
return true;
}
@Override
public void postVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {}
});
}
try {
registerCachedFilesWithPlan(plan);
} catch (Exception e) {
throw new RuntimeException("Error while registering cached files: " + e.getMessage(), e);
}
// clear all the sinks such that the next execution does not redo everything
if (clearSinks) {
this.sinks.clear();
wasExecuted = true;
}
// All types are registered now. Print information.
int registeredTypes = config.getRegisteredKryoTypes().size() +
config.getRegisteredPojoTypes().size() +
config.getRegisteredTypesWithKryoSerializerClasses().size() +
config.getRegisteredTypesWithKryoSerializers().size();
int defaultKryoSerializers = config.getDefaultKryoSerializers().size() +
config.getDefaultKryoSerializerClasses().size();
LOG.info("The job has {} registered types and {} default Kryo serializers", registeredTypes, defaultKryoSerializers);
if (config.isForceKryoEnabled() && config.isForceAvroEnabled()) {
LOG.warn("In the ExecutionConfig, both Avro and Kryo are enforced. Using Kryo serializer");
}
if (config.isForceKryoEnabled()) {
LOG.info("Using KryoSerializer for serializing POJOs");
}
if (config.isForceAvroEnabled()) {
LOG.info("Using AvroSerializer for serializing POJOs");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Registered Kryo types: {}", config.getRegisteredKryoTypes().toString());
LOG.debug("Registered Kryo with Serializers types: {}", config.getRegisteredTypesWithKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo with Serializer Classes types: {}", config.getRegisteredTypesWithKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered Kryo default Serializers: {}", config.getDefaultKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo default Serializers Classes {}", config.getDefaultKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered POJO types: {}", config.getRegisteredPojoTypes().toString());
// print information about static code analysis
LOG.debug("Static code analysis mode: {}", config.getCodeAnalysisMode());
}
return plan;
} | java | @Internal
public Plan createProgramPlan(String jobName, boolean clearSinks) {
if (this.sinks.isEmpty()) {
if (wasExecuted) {
throw new RuntimeException("No new data sinks have been defined since the " +
"last execution. The last execution refers to the latest call to " +
"'execute()', 'count()', 'collect()', or 'print()'.");
} else {
throw new RuntimeException("No data sinks have been created yet. " +
"A program needs at least one sink that consumes data. " +
"Examples are writing the data set or printing it.");
}
}
if (jobName == null) {
jobName = getDefaultName();
}
OperatorTranslation translator = new OperatorTranslation();
Plan plan = translator.translateToPlan(this.sinks, jobName);
if (getParallelism() > 0) {
plan.setDefaultParallelism(getParallelism());
}
plan.setExecutionConfig(getConfig());
// Check plan for GenericTypeInfo's and register the types at the serializers.
if (!config.isAutoTypeRegistrationDisabled()) {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
private final Set<Class<?>> registeredTypes = new HashSet<>();
private final Set<org.apache.flink.api.common.operators.Operator<?>> visitedOperators = new HashSet<>();
@Override
public boolean preVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {
if (!visitedOperators.add(visitable)) {
return false;
}
OperatorInformation<?> opInfo = visitable.getOperatorInfo();
Serializers.recursivelyRegisterType(opInfo.getOutputType(), config, registeredTypes);
return true;
}
@Override
public void postVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {}
});
}
try {
registerCachedFilesWithPlan(plan);
} catch (Exception e) {
throw new RuntimeException("Error while registering cached files: " + e.getMessage(), e);
}
// clear all the sinks such that the next execution does not redo everything
if (clearSinks) {
this.sinks.clear();
wasExecuted = true;
}
// All types are registered now. Print information.
int registeredTypes = config.getRegisteredKryoTypes().size() +
config.getRegisteredPojoTypes().size() +
config.getRegisteredTypesWithKryoSerializerClasses().size() +
config.getRegisteredTypesWithKryoSerializers().size();
int defaultKryoSerializers = config.getDefaultKryoSerializers().size() +
config.getDefaultKryoSerializerClasses().size();
LOG.info("The job has {} registered types and {} default Kryo serializers", registeredTypes, defaultKryoSerializers);
if (config.isForceKryoEnabled() && config.isForceAvroEnabled()) {
LOG.warn("In the ExecutionConfig, both Avro and Kryo are enforced. Using Kryo serializer");
}
if (config.isForceKryoEnabled()) {
LOG.info("Using KryoSerializer for serializing POJOs");
}
if (config.isForceAvroEnabled()) {
LOG.info("Using AvroSerializer for serializing POJOs");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Registered Kryo types: {}", config.getRegisteredKryoTypes().toString());
LOG.debug("Registered Kryo with Serializers types: {}", config.getRegisteredTypesWithKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo with Serializer Classes types: {}", config.getRegisteredTypesWithKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered Kryo default Serializers: {}", config.getDefaultKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo default Serializers Classes {}", config.getDefaultKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered POJO types: {}", config.getRegisteredPojoTypes().toString());
// print information about static code analysis
LOG.debug("Static code analysis mode: {}", config.getCodeAnalysisMode());
}
return plan;
} | [
"@",
"Internal",
"public",
"Plan",
"createProgramPlan",
"(",
"String",
"jobName",
",",
"boolean",
"clearSinks",
")",
"{",
"if",
"(",
"this",
".",
"sinks",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"wasExecuted",
")",
"{",
"throw",
"new",
"RuntimeExc... | Creates the program's {@link Plan}. The plan is a description of all data sources, data sinks,
and operations and how they interact, as an isolated unit that can be executed with a
{@link org.apache.flink.api.common.PlanExecutor}. Obtaining a plan and starting it with an
executor is an alternative way to run a program and is only possible if the program consists
only of distributed operations.
@param jobName The name attached to the plan (displayed in logs and monitoring).
@param clearSinks Whether or not to start a new stage of execution.
@return The program's plan. | [
"Creates",
"the",
"program",
"s",
"{",
"@link",
"Plan",
"}",
".",
"The",
"plan",
"is",
"a",
"description",
"of",
"all",
"data",
"sources",
"data",
"sinks",
"and",
"operations",
"and",
"how",
"they",
"interact",
"as",
"an",
"isolated",
"unit",
"that",
"ca... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L937-L1029 | train | Creates a program plan. | [
30522,
1030,
4722,
2270,
2933,
3443,
21572,
13113,
24759,
2319,
1006,
5164,
3105,
18442,
1010,
22017,
20898,
28837,
19839,
2015,
1007,
1063,
2065,
1006,
2023,
1012,
23462,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2065,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java | TypeExtractionUtils.typeToClass | public static Class<?> typeToClass(Type t) {
if (t instanceof Class) {
return (Class<?>)t;
}
else if (t instanceof ParameterizedType) {
return ((Class<?>) ((ParameterizedType) t).getRawType());
}
throw new IllegalArgumentException("Cannot convert type to class");
} | java | public static Class<?> typeToClass(Type t) {
if (t instanceof Class) {
return (Class<?>)t;
}
else if (t instanceof ParameterizedType) {
return ((Class<?>) ((ParameterizedType) t).getRawType());
}
throw new IllegalArgumentException("Cannot convert type to class");
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"typeToClass",
"(",
"Type",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"Class",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"t",
";",
"}",
"else",
"if",
"(",
"t",
"instanceof",
"ParameterizedT... | Convert ParameterizedType or Class to a Class. | [
"Convert",
"ParameterizedType",
"or",
"Class",
"to",
"a",
"Class",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L260-L268 | train | Convert a type to a class. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
2828,
3406,
26266,
1006,
2828,
1056,
1007,
1063,
2065,
1006,
1056,
6013,
11253,
2465,
1007,
1063,
2709,
1006,
2465,
1026,
1029,
1028,
1007,
1056,
1025,
1065,
2842,
2065,
1006,
1056,
6013,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java | StreamGraphGenerator.generateInternal | private StreamGraph generateInternal(List<StreamTransformation<?>> transformations) {
for (StreamTransformation<?> transformation: transformations) {
transform(transformation);
}
return streamGraph;
} | java | private StreamGraph generateInternal(List<StreamTransformation<?>> transformations) {
for (StreamTransformation<?> transformation: transformations) {
transform(transformation);
}
return streamGraph;
} | [
"private",
"StreamGraph",
"generateInternal",
"(",
"List",
"<",
"StreamTransformation",
"<",
"?",
">",
">",
"transformations",
")",
"{",
"for",
"(",
"StreamTransformation",
"<",
"?",
">",
"transformation",
":",
"transformations",
")",
"{",
"transform",
"(",
"tra... | This starts the actual transformation, beginning from the sinks. | [
"This",
"starts",
"the",
"actual",
"transformation",
"beginning",
"from",
"the",
"sinks",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L130-L135 | train | Generate internal stream graph. | [
30522,
2797,
5460,
14413,
9699,
18447,
11795,
2389,
1006,
2862,
1026,
5460,
6494,
3619,
14192,
3370,
1026,
1029,
1028,
1028,
21865,
1007,
1063,
2005,
1006,
5460,
6494,
3619,
14192,
3370,
1026,
1029,
1028,
8651,
1024,
21865,
1007,
1063,
1093... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PendingCheckpointStats.java | PendingCheckpointStats.reportSubtaskStats | boolean reportSubtaskStats(JobVertexID jobVertexId, SubtaskStateStats subtask) {
TaskStateStats taskStateStats = taskStats.get(jobVertexId);
if (taskStateStats != null && taskStateStats.reportSubtaskStats(subtask)) {
currentNumAcknowledgedSubtasks++;
latestAcknowledgedSubtask = subtask;
currentStateSize += subtask.getStateSize();
long alignmentBuffered = subtask.getAlignmentBuffered();
if (alignmentBuffered > 0) {
currentAlignmentBuffered += alignmentBuffered;
}
return true;
} else {
return false;
}
} | java | boolean reportSubtaskStats(JobVertexID jobVertexId, SubtaskStateStats subtask) {
TaskStateStats taskStateStats = taskStats.get(jobVertexId);
if (taskStateStats != null && taskStateStats.reportSubtaskStats(subtask)) {
currentNumAcknowledgedSubtasks++;
latestAcknowledgedSubtask = subtask;
currentStateSize += subtask.getStateSize();
long alignmentBuffered = subtask.getAlignmentBuffered();
if (alignmentBuffered > 0) {
currentAlignmentBuffered += alignmentBuffered;
}
return true;
} else {
return false;
}
} | [
"boolean",
"reportSubtaskStats",
"(",
"JobVertexID",
"jobVertexId",
",",
"SubtaskStateStats",
"subtask",
")",
"{",
"TaskStateStats",
"taskStateStats",
"=",
"taskStats",
".",
"get",
"(",
"jobVertexId",
")",
";",
"if",
"(",
"taskStateStats",
"!=",
"null",
"&&",
"tas... | Reports statistics for a single subtask.
@param jobVertexId ID of the task/operator the subtask belongs to.
@param subtask The statistics for the subtask.
@return <code>true</code> if successfully reported or <code>false</code> otherwise. | [
"Reports",
"statistics",
"for",
"a",
"single",
"subtask",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java#L120-L138 | train | Report the subtask stats for a given job vertex. | [
30522,
22017,
20898,
4311,
12083,
10230,
5705,
29336,
2015,
1006,
3105,
16874,
10288,
3593,
3105,
16874,
10288,
3593,
1010,
4942,
10230,
5705,
12259,
9153,
3215,
4942,
10230,
2243,
1007,
1063,
8518,
30524,
9153,
3215,
1027,
8518,
29336,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.removeFromWordNet | private static void removeFromWordNet(Vertex cur, WordNet wordNetAll, int line, int length)
{
LinkedList<Vertex>[] vertexes = wordNetAll.getVertexes();
// 将其从wordNet中删除
for (Vertex vertex : vertexes[line + length])
{
if (vertex.from == cur)
vertex.from = null;
}
ListIterator<Vertex> iterator = vertexes[line + length - cur.realWord.length()].listIterator();
while (iterator.hasNext())
{
Vertex vertex = iterator.next();
if (vertex == cur) iterator.remove();
}
} | java | private static void removeFromWordNet(Vertex cur, WordNet wordNetAll, int line, int length)
{
LinkedList<Vertex>[] vertexes = wordNetAll.getVertexes();
// 将其从wordNet中删除
for (Vertex vertex : vertexes[line + length])
{
if (vertex.from == cur)
vertex.from = null;
}
ListIterator<Vertex> iterator = vertexes[line + length - cur.realWord.length()].listIterator();
while (iterator.hasNext())
{
Vertex vertex = iterator.next();
if (vertex == cur) iterator.remove();
}
} | [
"private",
"static",
"void",
"removeFromWordNet",
"(",
"Vertex",
"cur",
",",
"WordNet",
"wordNetAll",
",",
"int",
"line",
",",
"int",
"length",
")",
"{",
"LinkedList",
"<",
"Vertex",
">",
"[",
"]",
"vertexes",
"=",
"wordNetAll",
".",
"getVertexes",
"(",
")... | 将一个词语从词网中彻底抹除
@param cur 词语
@param wordNetAll 词网
@param line 当前扫描的行数
@param length 当前缓冲区的长度 | [
"将一个词语从词网中彻底抹除"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L468-L483 | train | Remove from wordNet. | [
30522,
2797,
10763,
11675,
6366,
19699,
5358,
18351,
7159,
1006,
19449,
12731,
2099,
1010,
2773,
7159,
2773,
7159,
8095,
1010,
20014,
2240,
1010,
20014,
3091,
1007,
1063,
5799,
9863,
1026,
19449,
1028,
1031,
1033,
19449,
2229,
1027,
2773,
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... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.wrappedBuffer | public static ByteBuf wrappedBuffer(ByteBuf buffer) {
if (buffer.isReadable()) {
return buffer.slice();
} else {
buffer.release();
return EMPTY_BUFFER;
}
} | java | public static ByteBuf wrappedBuffer(ByteBuf buffer) {
if (buffer.isReadable()) {
return buffer.slice();
} else {
buffer.release();
return EMPTY_BUFFER;
}
} | [
"public",
"static",
"ByteBuf",
"wrappedBuffer",
"(",
"ByteBuf",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"isReadable",
"(",
")",
")",
"{",
"return",
"buffer",
".",
"slice",
"(",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"release",
"(",
")",
";"... | Creates a new buffer which wraps the specified buffer's readable bytes.
A modification on the specified buffer's content will be visible to the
returned buffer.
@param buffer The buffer to wrap. Reference count ownership of this variable is transferred to this method.
@return The readable portion of the {@code buffer}, or an empty buffer if there is no readable portion.
The caller is responsible for releasing this buffer. | [
"Creates",
"a",
"new",
"buffer",
"which",
"wraps",
"the",
"specified",
"buffer",
"s",
"readable",
"bytes",
".",
"A",
"modification",
"on",
"the",
"specified",
"buffer",
"s",
"content",
"will",
"be",
"visible",
"to",
"the",
"returned",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L226-L233 | train | Returns a buffer that wraps the contents of the specified byte buffer. | [
30522,
2270,
10763,
24880,
8569,
2546,
5058,
8569,
12494,
1006,
24880,
8569,
2546,
17698,
1007,
1063,
2065,
1006,
17698,
1012,
2003,
16416,
20782,
1006,
1007,
1007,
1063,
2709,
17698,
1012,
14704,
1006,
1007,
1025,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.writeBits | void writeBits(ByteBuf out, final int count, final long value) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32)");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer | value << 64 - count >>> bitCount;
bitCount += count;
if (bitCount >= 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer <<= 32;
bitCount -= 32;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | java | void writeBits(ByteBuf out, final int count, final long value) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32)");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer | value << 64 - count >>> bitCount;
bitCount += count;
if (bitCount >= 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer <<= 32;
bitCount -= 32;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | [
"void",
"writeBits",
"(",
"ByteBuf",
"out",
",",
"final",
"int",
"count",
",",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"count",
"<",
"0",
"||",
"count",
">",
"32",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count: \"",
"+",
"c... | Writes up to 32 bits to the output {@link ByteBuf}.
@param count The number of bits to write (maximum {@code 32} as a size of {@code int})
@param value The bits to write | [
"Writes",
"up",
"to",
"32",
"bits",
"to",
"the",
"output",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L41-L56 | train | Write bits. | [
30522,
11675,
4339,
16313,
2015,
1006,
24880,
8569,
2546,
2041,
1010,
2345,
20014,
4175,
1010,
2345,
2146,
3643,
1007,
1063,
2065,
1006,
4175,
1026,
1014,
1064,
1064,
4175,
1028,
3590,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tokenizer/TraditionalChineseTokenizer.java | TraditionalChineseTokenizer.seg2sentence | public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> resultList = new LinkedList<List<Term>>();
{
for (String sentence : SentencesUtil.toSentenceList(text))
{
resultList.add(segment(sentence));
}
}
return resultList;
} | java | public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> resultList = new LinkedList<List<Term>>();
{
for (String sentence : SentencesUtil.toSentenceList(text))
{
resultList.add(segment(sentence));
}
}
return resultList;
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Term",
">",
">",
"seg2sentence",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"List",
"<",
"Term",
">>",
"resultList",
"=",
"new",
"LinkedList",
"<",
"List",
"<",
"Term",
">",
">",
"(",
")",
";",
"{",... | 切分为句子形式
@param text 文本
@return 句子列表 | [
"切分为句子形式"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/TraditionalChineseTokenizer.java#L79-L90 | train | seg2sentence - returns a list of lists of lists of terms. | [
30522,
2270,
10763,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
5164,
3793,
1007,
1063,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
2765,
9863,
1027,
2047,
5799,
9863,
1026,
2862,
1026,
2744,
1028,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java | HpackEncoder.add | private void add(CharSequence name, CharSequence value, long headerSize) {
// Clear the table if the header field size is larger than the maxHeaderTableSize.
if (headerSize > maxHeaderTableSize) {
clear();
return;
}
// Evict oldest entries until we have enough maxHeaderTableSize.
while (maxHeaderTableSize - size < headerSize) {
remove();
}
int h = AsciiString.hashCode(name);
int i = index(h);
HeaderEntry old = headerFields[i];
HeaderEntry e = new HeaderEntry(h, name, value, head.before.index - 1, old);
headerFields[i] = e;
e.addBefore(head);
size += headerSize;
} | java | private void add(CharSequence name, CharSequence value, long headerSize) {
// Clear the table if the header field size is larger than the maxHeaderTableSize.
if (headerSize > maxHeaderTableSize) {
clear();
return;
}
// Evict oldest entries until we have enough maxHeaderTableSize.
while (maxHeaderTableSize - size < headerSize) {
remove();
}
int h = AsciiString.hashCode(name);
int i = index(h);
HeaderEntry old = headerFields[i];
HeaderEntry e = new HeaderEntry(h, name, value, head.before.index - 1, old);
headerFields[i] = e;
e.addBefore(head);
size += headerSize;
} | [
"private",
"void",
"add",
"(",
"CharSequence",
"name",
",",
"CharSequence",
"value",
",",
"long",
"headerSize",
")",
"{",
"// Clear the table if the header field size is larger than the maxHeaderTableSize.",
"if",
"(",
"headerSize",
">",
"maxHeaderTableSize",
")",
"{",
"c... | Add the header field to the dynamic table. Entries are evicted from the dynamic table until
the size of the table and the new header field is less than the table's maxHeaderTableSize. If the size
of the new entry is larger than the table's maxHeaderTableSize, the dynamic table will be cleared. | [
"Add",
"the",
"header",
"field",
"to",
"the",
"dynamic",
"table",
".",
"Entries",
"are",
"evicted",
"from",
"the",
"dynamic",
"table",
"until",
"the",
"size",
"of",
"the",
"table",
"and",
"the",
"new",
"header",
"field",
"is",
"less",
"than",
"the",
"tab... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L395-L414 | train | Add a new entry to the header table. | [
30522,
2797,
11675,
5587,
1006,
25869,
3366,
4226,
5897,
2171,
1010,
25869,
3366,
4226,
5897,
3643,
1010,
2146,
20346,
5332,
4371,
1007,
1063,
1013,
1013,
3154,
1996,
2795,
2065,
1996,
20346,
2492,
2946,
2003,
3469,
2084,
1996,
4098,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/KinesisConfigUtil.java | KinesisConfigUtil.replaceDeprecatedProducerKeys | public static Properties replaceDeprecatedProducerKeys(Properties configProps) {
// Replace deprecated key
if (configProps.containsKey(ProducerConfigConstants.COLLECTION_MAX_COUNT)) {
configProps.setProperty(COLLECTION_MAX_COUNT,
configProps.getProperty(ProducerConfigConstants.COLLECTION_MAX_COUNT));
configProps.remove(ProducerConfigConstants.COLLECTION_MAX_COUNT);
}
// Replace deprecated key
if (configProps.containsKey(ProducerConfigConstants.AGGREGATION_MAX_COUNT)) {
configProps.setProperty(AGGREGATION_MAX_COUNT,
configProps.getProperty(ProducerConfigConstants.AGGREGATION_MAX_COUNT));
configProps.remove(ProducerConfigConstants.AGGREGATION_MAX_COUNT);
}
return configProps;
} | java | public static Properties replaceDeprecatedProducerKeys(Properties configProps) {
// Replace deprecated key
if (configProps.containsKey(ProducerConfigConstants.COLLECTION_MAX_COUNT)) {
configProps.setProperty(COLLECTION_MAX_COUNT,
configProps.getProperty(ProducerConfigConstants.COLLECTION_MAX_COUNT));
configProps.remove(ProducerConfigConstants.COLLECTION_MAX_COUNT);
}
// Replace deprecated key
if (configProps.containsKey(ProducerConfigConstants.AGGREGATION_MAX_COUNT)) {
configProps.setProperty(AGGREGATION_MAX_COUNT,
configProps.getProperty(ProducerConfigConstants.AGGREGATION_MAX_COUNT));
configProps.remove(ProducerConfigConstants.AGGREGATION_MAX_COUNT);
}
return configProps;
} | [
"public",
"static",
"Properties",
"replaceDeprecatedProducerKeys",
"(",
"Properties",
"configProps",
")",
"{",
"// Replace deprecated key",
"if",
"(",
"configProps",
".",
"containsKey",
"(",
"ProducerConfigConstants",
".",
"COLLECTION_MAX_COUNT",
")",
")",
"{",
"configPro... | Replace deprecated configuration properties for {@link FlinkKinesisProducer}.
This should be remove along with deprecated keys | [
"Replace",
"deprecated",
"configuration",
"properties",
"for",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/KinesisConfigUtil.java#L180-L194 | train | Replace deprecated producer keys in configuration properties. | [
30522,
2270,
10763,
5144,
2999,
13699,
2890,
12921,
21572,
8566,
17119,
14839,
2015,
1006,
5144,
9530,
8873,
21600,
18981,
2015,
1007,
1063,
1013,
1013,
5672,
2139,
28139,
12921,
3145,
2065,
1006,
9530,
8873,
21600,
18981,
2015,
1012,
3397,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/kafka/KafkaStandaloneGenerator.java | KafkaStandaloneGenerator.main | public static void main(String[] args) throws Exception {
final KafkaCollector[] collectors = new KafkaCollector[NUM_PARTITIONS];
// create the generator threads
for (int i = 0; i < collectors.length; i++) {
collectors[i] = new KafkaCollector(BROKER_ADDRESS, TOPIC, i);
}
StandaloneThreadedGenerator.runGenerator(collectors);
} | java | public static void main(String[] args) throws Exception {
final KafkaCollector[] collectors = new KafkaCollector[NUM_PARTITIONS];
// create the generator threads
for (int i = 0; i < collectors.length; i++) {
collectors[i] = new KafkaCollector(BROKER_ADDRESS, TOPIC, i);
}
StandaloneThreadedGenerator.runGenerator(collectors);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"KafkaCollector",
"[",
"]",
"collectors",
"=",
"new",
"KafkaCollector",
"[",
"NUM_PARTITIONS",
"]",
";",
"// create the generator threads",
"for",
"(",... | Entry point to the kafka data producer. | [
"Entry",
"point",
"to",
"the",
"kafka",
"data",
"producer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/kafka/KafkaStandaloneGenerator.java#L48-L58 | train | Main method for the generator. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
10556,
24316,
22684,
6216,
16761,
1031,
1033,
14256,
1027,
2047,
10556,
24316,
22684,
6216,
16761,
1031,
16371,
2213,
1035,
13571,
2015,
1033... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java | SystemPropertyUtil.getInt | public static int getInt(String key, int def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Integer.parseInt(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | java | public static int getInt(String key, int def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Integer.parseInt(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | [
"public",
"static",
"int",
"getInt",
"(",
"String",
"key",
",",
"int",
"def",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"value",
"=",
"value",
".",
"trim"... | Returns the value of the Java system property with the specified
{@code key}, while falling back to the specified default value if
the property access fails.
@return the property value.
{@code def} if there's no such property or if an access to the
specified property is not allowed. | [
"Returns",
"the",
"value",
"of",
"the",
"Java",
"system",
"property",
"with",
"the",
"specified",
"{",
"@code",
"key",
"}",
"while",
"falling",
"back",
"to",
"the",
"specified",
"default",
"value",
"if",
"the",
"property",
"access",
"fails",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L134-L153 | train | Get the integer system property value. | [
30522,
2270,
10763,
20014,
2131,
18447,
1006,
5164,
3145,
1010,
20014,
13366,
1007,
1063,
5164,
3643,
1027,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
2709,
13366,
1025,
1065,
3643,
1027,
3643,
1012,
1224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/web/servlet/error/BasicErrorController.java | BasicErrorController.isIncludeStackTrace | protected boolean isIncludeStackTrace(HttpServletRequest request,
MediaType produces) {
IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
if (include == IncludeStacktrace.ALWAYS) {
return true;
}
if (include == IncludeStacktrace.ON_TRACE_PARAM) {
return getTraceParameter(request);
}
return false;
} | java | protected boolean isIncludeStackTrace(HttpServletRequest request,
MediaType produces) {
IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
if (include == IncludeStacktrace.ALWAYS) {
return true;
}
if (include == IncludeStacktrace.ON_TRACE_PARAM) {
return getTraceParameter(request);
}
return false;
} | [
"protected",
"boolean",
"isIncludeStackTrace",
"(",
"HttpServletRequest",
"request",
",",
"MediaType",
"produces",
")",
"{",
"IncludeStacktrace",
"include",
"=",
"getErrorProperties",
"(",
")",
".",
"getIncludeStacktrace",
"(",
")",
";",
"if",
"(",
"include",
"==",
... | Determine if the stacktrace attribute should be included.
@param request the source request
@param produces the media type produced (or {@code MediaType.ALL})
@return if the stacktrace attribute should be included | [
"Determine",
"if",
"the",
"stacktrace",
"attribute",
"should",
"be",
"included",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java#L110-L120 | train | Returns true if the stacktrace should be included in the error message. | [
30522,
5123,
22017,
20898,
2003,
2378,
20464,
22087,
2696,
3600,
6494,
3401,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1010,
2865,
13874,
7137,
1007,
1063,
2950,
2696,
3600,
6494,
3401,
2421,
1027,
2131,
2121,
29165,
21572,
4842,
73... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HashUtil.java | HashUtil.bernstein | public static int bernstein(String key) {
int hash = 0;
int i;
for (i = 0; i < key.length(); ++i) {
hash = 33 * hash + key.charAt(i);
}
return hash;
} | java | public static int bernstein(String key) {
int hash = 0;
int i;
for (i = 0; i < key.length(); ++i) {
hash = 33 * hash + key.charAt(i);
}
return hash;
} | [
"public",
"static",
"int",
"bernstein",
"(",
"String",
"key",
")",
"{",
"int",
"hash",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"hash",
"=",
"33",
"*... | Bernstein's hash
@param key 输入字节数组
@return 结果hash | [
"Bernstein",
"s",
"hash"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L73-L80 | train | Returns the hash code of the given string. | [
30522,
2270,
10763,
20014,
18862,
1006,
5164,
3145,
1007,
1063,
20014,
23325,
1027,
1014,
1025,
20014,
1045,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
3145,
1012,
3091,
1006,
1007,
1025,
1009,
1009,
1045,
1007,
1063,
23325,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-redis/src/main/java/io/netty/handler/codec/redis/RedisEncoder.java | RedisEncoder.writeArrayMessage | private void writeArrayMessage(ByteBufAllocator allocator, ArrayRedisMessage msg, List<Object> out) {
if (msg.isNull()) {
writeArrayHeader(allocator, msg.isNull(), RedisConstants.NULL_VALUE, out);
} else {
writeArrayHeader(allocator, msg.isNull(), msg.children().size(), out);
for (RedisMessage child : msg.children()) {
writeRedisMessage(allocator, child, out);
}
}
} | java | private void writeArrayMessage(ByteBufAllocator allocator, ArrayRedisMessage msg, List<Object> out) {
if (msg.isNull()) {
writeArrayHeader(allocator, msg.isNull(), RedisConstants.NULL_VALUE, out);
} else {
writeArrayHeader(allocator, msg.isNull(), msg.children().size(), out);
for (RedisMessage child : msg.children()) {
writeRedisMessage(allocator, child, out);
}
}
} | [
"private",
"void",
"writeArrayMessage",
"(",
"ByteBufAllocator",
"allocator",
",",
"ArrayRedisMessage",
"msg",
",",
"List",
"<",
"Object",
">",
"out",
")",
"{",
"if",
"(",
"msg",
".",
"isNull",
"(",
")",
")",
"{",
"writeArrayHeader",
"(",
"allocator",
",",
... | Write full constructed array message. | [
"Write",
"full",
"constructed",
"array",
"message",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-redis/src/main/java/io/netty/handler/codec/redis/RedisEncoder.java#L174-L183 | train | Write array message. | [
30522,
2797,
11675,
4339,
2906,
9447,
7834,
3736,
3351,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
9140,
5596,
2964,
7971,
4270,
5796,
2290,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
1063,
2065,
1006,
5796,
2290,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.and | public static ExpectedCondition<Boolean> and(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
for (ExpectedCondition<?> condition : conditions) {
Object result = condition.apply(driver);
if (result instanceof Boolean) {
if (Boolean.FALSE.equals(result)) {
return false;
}
}
if (result == null) {
return false;
}
}
return true;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("all conditions to be valid: ");
Joiner.on(" && ").appendTo(message, conditions);
return message.toString();
}
};
} | java | public static ExpectedCondition<Boolean> and(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
for (ExpectedCondition<?> condition : conditions) {
Object result = condition.apply(driver);
if (result instanceof Boolean) {
if (Boolean.FALSE.equals(result)) {
return false;
}
}
if (result == null) {
return false;
}
}
return true;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("all conditions to be valid: ");
Joiner.on(" && ").appendTo(message, conditions);
return message.toString();
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"and",
"(",
"final",
"ExpectedCondition",
"<",
"?",
">",
"...",
"conditions",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolea... | An expectation with the logical and condition of the given list of conditions.
Each condition is checked until all of them return true or not null
@param conditions ExpectedCondition is a list of alternative conditions
@return true once all conditions are satisfied | [
"An",
"expectation",
"with",
"the",
"logical",
"and",
"condition",
"of",
"the",
"given",
"list",
"of",
"conditions",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1408-L1435 | train | An expectation for checking that all the given conditions are true or false. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1998,
1006,
2345,
3517,
8663,
20562,
1026,
1029,
1028,
1012,
1012,
1012,
3785,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
1030,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.addWords | public void addWords(String... words){
HashSet<String> wordsSet = CollectionUtil.newHashSet(words);
for (String word : wordsSet) {
addWord(word);
}
} | java | public void addWords(String... words){
HashSet<String> wordsSet = CollectionUtil.newHashSet(words);
for (String word : wordsSet) {
addWord(word);
}
} | [
"public",
"void",
"addWords",
"(",
"String",
"...",
"words",
")",
"{",
"HashSet",
"<",
"String",
">",
"wordsSet",
"=",
"CollectionUtil",
".",
"newHashSet",
"(",
"words",
")",
";",
"for",
"(",
"String",
"word",
":",
"wordsSet",
")",
"{",
"addWord",
"(",
... | 增加一组单词
@param words 单词数组 | [
"增加一组单词"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L62-L67 | train | Add words to the list of words. | [
30522,
2270,
11675,
5587,
22104,
1006,
5164,
1012,
1012,
1012,
2616,
1007,
1063,
23325,
13462,
1026,
5164,
1028,
2616,
13462,
1027,
3074,
21823,
2140,
1012,
2047,
14949,
7898,
3388,
1006,
2616,
1007,
1025,
2005,
1006,
5164,
2773,
1024,
2616... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetTimestampUtils.java | ParquetTimestampUtils.getTimestampMillis | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != 12) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - need to invert byte order
long timeOfDayNanos = ByteBuffer.wrap(new byte[] {bytes[7], bytes[6], bytes[5], bytes[4],
bytes[3], bytes[2], bytes[1], bytes[0]}).getLong();
int julianDay = ByteBuffer.wrap(new byte[] {bytes[11], bytes[10], bytes[9], bytes[8]}).getInt();
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | java | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != 12) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - need to invert byte order
long timeOfDayNanos = ByteBuffer.wrap(new byte[] {bytes[7], bytes[6], bytes[5], bytes[4],
bytes[3], bytes[2], bytes[1], bytes[0]}).getLong();
int julianDay = ByteBuffer.wrap(new byte[] {bytes[11], bytes[10], bytes[9], bytes[8]}).getInt();
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | [
"public",
"static",
"long",
"getTimestampMillis",
"(",
"Binary",
"timestampBinary",
")",
"{",
"if",
"(",
"timestampBinary",
".",
"length",
"(",
")",
"!=",
"12",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parquet timestamp must be 12 bytes, actual \"... | Returns GMT timestamp from binary encoded parquet timestamp (12 bytes - julian date + time of day nanos).
@param timestampBinary INT96 parquet timestamp
@return timestamp in millis, GMT timezone | [
"Returns",
"GMT",
"timestamp",
"from",
"binary",
"encoded",
"parquet",
"timestamp",
"(",
"12",
"bytes",
"-",
"julian",
"date",
"+",
"time",
"of",
"day",
"nanos",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetTimestampUtils.java#L44-L56 | train | Gets the timestamp from the binary representation of the parquet timestamp. | [
30522,
2270,
10763,
2146,
2131,
7292,
9153,
8737,
19912,
2483,
1006,
12441,
2335,
15464,
2361,
21114,
2854,
1007,
1063,
2065,
1006,
2335,
15464,
2361,
21114,
2854,
1012,
3091,
1006,
1007,
999,
1027,
2260,
1007,
1063,
5466,
2047,
6206,
2906,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/summary/TextRankSentence.java | TextRankSentence.getTopSentenceList | public static List<String> getTopSentenceList(String document, int size, String sentence_separator)
{
List<String> sentenceList = splitSentence(document, sentence_separator);
List<List<String>> docs = convertSentenceListToDocument(sentenceList);
TextRankSentence textRank = new TextRankSentence(docs);
int[] topSentence = textRank.getTopSentence(size);
List<String> resultList = new LinkedList<String>();
for (int i : topSentence)
{
resultList.add(sentenceList.get(i));
}
return resultList;
} | java | public static List<String> getTopSentenceList(String document, int size, String sentence_separator)
{
List<String> sentenceList = splitSentence(document, sentence_separator);
List<List<String>> docs = convertSentenceListToDocument(sentenceList);
TextRankSentence textRank = new TextRankSentence(docs);
int[] topSentence = textRank.getTopSentence(size);
List<String> resultList = new LinkedList<String>();
for (int i : topSentence)
{
resultList.add(sentenceList.get(i));
}
return resultList;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getTopSentenceList",
"(",
"String",
"document",
",",
"int",
"size",
",",
"String",
"sentence_separator",
")",
"{",
"List",
"<",
"String",
">",
"sentenceList",
"=",
"splitSentence",
"(",
"document",
",",
"sentenc... | 一句话调用接口
@param document 目标文档
@param size 需要的关键句的个数
@param sentence_separator 句子分隔符,正则格式, 如:[。??!!;;]
@return 关键句列表 | [
"一句话调用接口"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java#L240-L252 | train | Get the top sentence list. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
25181,
15781,
5897,
9863,
1006,
5164,
6254,
1010,
20014,
2946,
1010,
5164,
6251,
1035,
19802,
25879,
2953,
1007,
1063,
2862,
1026,
5164,
1028,
6251,
9863,
1027,
19584,
15781,
5897,
1006,
625... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpUtil.java | HttpUtil.isOriginForm | public static boolean isOriginForm(URI uri) {
return uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null;
} | java | public static boolean isOriginForm(URI uri) {
return uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null;
} | [
"public",
"static",
"boolean",
"isOriginForm",
"(",
"URI",
"uri",
")",
"{",
"return",
"uri",
".",
"getScheme",
"(",
")",
"==",
"null",
"&&",
"uri",
".",
"getSchemeSpecificPart",
"(",
")",
"==",
"null",
"&&",
"uri",
".",
"getHost",
"(",
")",
"==",
"null... | Determine if a uri is in origin-form according to
<a href="https://tools.ietf.org/html/rfc7230#section-5.3">rfc7230, 5.3</a>. | [
"Determine",
"if",
"a",
"uri",
"is",
"in",
"origin",
"-",
"form",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7230#section",
"-",
"5",
".",
"3",
">",
"rfc7230",
"5",
".",
"3<",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L44-L47 | train | Is the URI an origin form of a URI. | [
30522,
2270,
10763,
22017,
20898,
11163,
3089,
11528,
14192,
30524,
2072,
1012,
4152,
5403,
4168,
1006,
1007,
1027,
1027,
19701,
1004,
1004,
24471,
2072,
1012,
4152,
5403,
7834,
5051,
6895,
8873,
21906,
8445,
1006,
1007,
1027,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/deployment/InputChannelDeploymentDescriptor.java | InputChannelDeploymentDescriptor.fromEdges | public static List<InputChannelDeploymentDescriptor> fromEdges(
List<ExecutionEdge> edges,
boolean allowLazyDeployment) {
return edges.stream().map(edge -> fromEdgeAndValidate(allowLazyDeployment, edge)).collect(Collectors.toList());
} | java | public static List<InputChannelDeploymentDescriptor> fromEdges(
List<ExecutionEdge> edges,
boolean allowLazyDeployment) {
return edges.stream().map(edge -> fromEdgeAndValidate(allowLazyDeployment, edge)).collect(Collectors.toList());
} | [
"public",
"static",
"List",
"<",
"InputChannelDeploymentDescriptor",
">",
"fromEdges",
"(",
"List",
"<",
"ExecutionEdge",
">",
"edges",
",",
"boolean",
"allowLazyDeployment",
")",
"{",
"return",
"edges",
".",
"stream",
"(",
")",
".",
"map",
"(",
"edge",
"->",
... | Creates an input channel deployment descriptor for each partition. | [
"Creates",
"an",
"input",
"channel",
"deployment",
"descriptor",
"for",
"each",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/deployment/InputChannelDeploymentDescriptor.java#L89-L93 | train | Creates a list of input channel deployment descriptors from a list of execution edges. | [
30522,
2270,
10763,
2862,
1026,
7953,
26058,
3207,
24759,
6977,
3672,
6155,
23235,
2953,
1028,
2013,
24225,
2015,
1006,
2862,
1026,
7781,
24225,
1028,
7926,
1010,
22017,
20898,
3499,
2721,
9096,
3207,
24759,
6977,
3672,
1007,
1063,
2709,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/experimental/CollectSink.java | CollectSink.open | @Override
public void open(Configuration parameters) throws Exception {
try {
client = new Socket(hostIp, port);
outputStream = client.getOutputStream();
streamWriter = new DataOutputViewStreamWrapper(outputStream);
}
catch (IOException e) {
throw new IOException("Cannot connect to the client to send back the stream", e);
}
} | java | @Override
public void open(Configuration parameters) throws Exception {
try {
client = new Socket(hostIp, port);
outputStream = client.getOutputStream();
streamWriter = new DataOutputViewStreamWrapper(outputStream);
}
catch (IOException e) {
throw new IOException("Cannot connect to the client to send back the stream", e);
}
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
"Configuration",
"parameters",
")",
"throws",
"Exception",
"{",
"try",
"{",
"client",
"=",
"new",
"Socket",
"(",
"hostIp",
",",
"port",
")",
";",
"outputStream",
"=",
"client",
".",
"getOutputStream",
"(",
")... | Initialize the connection with the Socket in the server.
@param parameters Configuration. | [
"Initialize",
"the",
"connection",
"with",
"the",
"Socket",
"in",
"the",
"server",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/experimental/CollectSink.java#L77-L87 | train | Open the connection to the server. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
9563,
11709,
1007,
11618,
6453,
1063,
3046,
1063,
7396,
1027,
2047,
22278,
1006,
3677,
11514,
1010,
3417,
1007,
1025,
27852,
25379,
1027,
7396,
1012,
2131,
5833,
18780,
21422,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.join | public <T2> JoinedStreams<T, T2> join(DataStream<T2> otherStream) {
return new JoinedStreams<>(this, otherStream);
} | java | public <T2> JoinedStreams<T, T2> join(DataStream<T2> otherStream) {
return new JoinedStreams<>(this, otherStream);
} | [
"public",
"<",
"T2",
">",
"JoinedStreams",
"<",
"T",
",",
"T2",
">",
"join",
"(",
"DataStream",
"<",
"T2",
">",
"otherStream",
")",
"{",
"return",
"new",
"JoinedStreams",
"<>",
"(",
"this",
",",
"otherStream",
")",
";",
"}"
] | Creates a join operation. See {@link JoinedStreams} for an example of how the keys
and window can be specified. | [
"Creates",
"a",
"join",
"operation",
".",
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L725-L727 | train | Join the two data streams. | [
30522,
2270,
1026,
1056,
2475,
1028,
2587,
21422,
2015,
1026,
1056,
1010,
1056,
2475,
1028,
3693,
1006,
2951,
21422,
1026,
1056,
2475,
1028,
2500,
25379,
1007,
1063,
2709,
2047,
2587,
21422,
2015,
1026,
1028,
1006,
2023,
1010,
2500,
25379,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.div | public static double div(float v1, float v2, int scale, RoundingMode roundingMode) {
return div(Float.toString(v1), Float.toString(v2), scale, roundingMode).doubleValue();
} | java | public static double div(float v1, float v2, int scale, RoundingMode roundingMode) {
return div(Float.toString(v1), Float.toString(v2), scale, roundingMode).doubleValue();
} | [
"public",
"static",
"double",
"div",
"(",
"float",
"v1",
",",
"float",
"v2",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"div",
"(",
"Float",
".",
"toString",
"(",
"v1",
")",
",",
"Float",
".",
"toString",
"(",
"v2",
... | 提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度
@param v1 被除数
@param v2 除数
@param scale 精确度,如果为负值,取绝对值
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 两个参数的商 | [
"提供",
"(",
"相对",
")",
"精确的除法运算",
"当发生除不尽的情况时",
"由scale指定精确度"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L648-L650 | train | Divide two floats. | [
30522,
2270,
10763,
3313,
4487,
2615,
1006,
14257,
1058,
2487,
30524,
14257,
1012,
2000,
3367,
4892,
1006,
1058,
2475,
1007,
1010,
4094,
1010,
26939,
5302,
3207,
1007,
1012,
3313,
10175,
5657,
1006,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.columnMinValue | public Statistics columnMinValue(String columnName, Number min) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(MIN_VALUE, String.valueOf(min));
return this;
} | java | public Statistics columnMinValue(String columnName, Number min) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(MIN_VALUE, String.valueOf(min));
return this;
} | [
"public",
"Statistics",
"columnMinValue",
"(",
"String",
"columnName",
",",
"Number",
"min",
")",
"{",
"this",
".",
"columnStats",
".",
"computeIfAbsent",
"(",
"columnName",
",",
"column",
"->",
"new",
"HashMap",
"<>",
"(",
")",
")",
".",
"put",
"(",
"MIN_... | Sets the minimum value statistic for the given column. | [
"Sets",
"the",
"minimum",
"value",
"statistic",
"for",
"the",
"given",
"column",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L141-L146 | train | Sets the minimum value of the specified column. | [
30522,
2270,
6747,
5930,
10020,
10175,
5657,
1006,
5164,
5930,
18442,
1010,
2193,
8117,
1007,
1063,
2023,
1012,
7753,
29336,
2015,
1012,
24134,
10128,
7875,
5054,
2102,
1006,
5930,
18442,
1010,
5930,
1011,
1028,
2047,
23325,
2863,
2361,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/HashedWheelTimer.java | HashedWheelTimer.start | public void start() {
switch (WORKER_STATE_UPDATER.get(this)) {
case WORKER_STATE_INIT:
if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) {
workerThread.start();
}
break;
case WORKER_STATE_STARTED:
break;
case WORKER_STATE_SHUTDOWN:
throw new IllegalStateException("cannot be started once stopped");
default:
throw new Error("Invalid WorkerState");
}
// Wait until the startTime is initialized by the worker.
while (startTime == 0) {
try {
startTimeInitialized.await();
} catch (InterruptedException ignore) {
// Ignore - it will be ready very soon.
}
}
} | java | public void start() {
switch (WORKER_STATE_UPDATER.get(this)) {
case WORKER_STATE_INIT:
if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) {
workerThread.start();
}
break;
case WORKER_STATE_STARTED:
break;
case WORKER_STATE_SHUTDOWN:
throw new IllegalStateException("cannot be started once stopped");
default:
throw new Error("Invalid WorkerState");
}
// Wait until the startTime is initialized by the worker.
while (startTime == 0) {
try {
startTimeInitialized.await();
} catch (InterruptedException ignore) {
// Ignore - it will be ready very soon.
}
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"switch",
"(",
"WORKER_STATE_UPDATER",
".",
"get",
"(",
"this",
")",
")",
"{",
"case",
"WORKER_STATE_INIT",
":",
"if",
"(",
"WORKER_STATE_UPDATER",
".",
"compareAndSet",
"(",
"this",
",",
"WORKER_STATE_INIT",
",",
"W... | Starts the background thread explicitly. The background thread will
start automatically on demand even if you did not call this method.
@throws IllegalStateException if this timer has been
{@linkplain #stop() stopped} already | [
"Starts",
"the",
"background",
"thread",
"explicitly",
".",
"The",
"background",
"thread",
"will",
"start",
"automatically",
"on",
"demand",
"even",
"if",
"you",
"did",
"not",
"call",
"this",
"method",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/HashedWheelTimer.java#L340-L363 | train | Start the worker thread. | [
30522,
2270,
11675,
2707,
1006,
1007,
1063,
6942,
1006,
7309,
1035,
2110,
1035,
10651,
2099,
1012,
2131,
1006,
2023,
1007,
1007,
1063,
2553,
7309,
1035,
2110,
1035,
1999,
4183,
1024,
2065,
1006,
7309,
1035,
2110,
1035,
10651,
2099,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java | ConverterRegistry.convert | @SuppressWarnings("unchecked")
public <T> T convert(Type type, Object value, T defaultValue, boolean isCustomFirst) throws ConvertException {
if (TypeUtil.isUnknow(type) && null == defaultValue) {
// 对于用户不指定目标类型的情况,返回原值
return (T) value;
}
if (ObjectUtil.isNull(value)) {
return defaultValue;
}
if (TypeUtil.isUnknow(type)) {
type = defaultValue.getClass();
}
// 标准转换器
final Converter<T> converter = getConverter(type, isCustomFirst);
if (null != converter) {
return converter.convert(value, defaultValue);
}
Class<T> rowType = (Class<T>) TypeUtil.getClass(type);
if (null == rowType) {
if (null != defaultValue) {
rowType = (Class<T>) defaultValue.getClass();
} else {
// 无法识别的泛型类型,按照Object处理
return (T) value;
}
}
// 特殊类型转换,包括Collection、Map、强转、Array等
final T result = convertSpecial(type, rowType, value, defaultValue);
if (null != result) {
return result;
}
// 尝试转Bean
if (BeanUtil.isBean(rowType)) {
return new BeanConverter<T>(type).convert(value, defaultValue);
}
// 无法转换
throw new ConvertException("No Converter for type [{}]", rowType.getName());
} | java | @SuppressWarnings("unchecked")
public <T> T convert(Type type, Object value, T defaultValue, boolean isCustomFirst) throws ConvertException {
if (TypeUtil.isUnknow(type) && null == defaultValue) {
// 对于用户不指定目标类型的情况,返回原值
return (T) value;
}
if (ObjectUtil.isNull(value)) {
return defaultValue;
}
if (TypeUtil.isUnknow(type)) {
type = defaultValue.getClass();
}
// 标准转换器
final Converter<T> converter = getConverter(type, isCustomFirst);
if (null != converter) {
return converter.convert(value, defaultValue);
}
Class<T> rowType = (Class<T>) TypeUtil.getClass(type);
if (null == rowType) {
if (null != defaultValue) {
rowType = (Class<T>) defaultValue.getClass();
} else {
// 无法识别的泛型类型,按照Object处理
return (T) value;
}
}
// 特殊类型转换,包括Collection、Map、强转、Array等
final T result = convertSpecial(type, rowType, value, defaultValue);
if (null != result) {
return result;
}
// 尝试转Bean
if (BeanUtil.isBean(rowType)) {
return new BeanConverter<T>(type).convert(value, defaultValue);
}
// 无法转换
throw new ConvertException("No Converter for type [{}]", rowType.getName());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"convert",
"(",
"Type",
"type",
",",
"Object",
"value",
",",
"T",
"defaultValue",
",",
"boolean",
"isCustomFirst",
")",
"throws",
"ConvertException",
"{",
"if",
"(",
"TypeUtil"... | 转换值为指定类型
@param <T> 转换的目标类型(转换器转换到的类型)
@param type 类型目标
@param value 被转换值
@param defaultValue 默认值
@param isCustomFirst 是否自定义转换器优先
@return 转换后的值
@throws ConvertException 转换器不存在 | [
"转换值为指定类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L187-L229 | train | Converts the given value to the given type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
1028,
1056,
10463,
1006,
2828,
2828,
1010,
4874,
3643,
1010,
1056,
12398,
10175,
5657,
1010,
22017,
20898,
2003,
7874,
20389,
8873,
12096,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java | StreamGraphGenerator.transformCoFeedback | private <F> Collection<Integer> transformCoFeedback(CoFeedbackTransformation<F> coIterate) {
// For Co-Iteration we don't need to transform the input and wire the input to the
// head operator by returning the input IDs, the input is directly wired to the left
// input of the co-operation. This transform only needs to return the ids of the feedback
// edges, since they need to be wired to the second input of the co-operation.
// create the fake iteration source/sink pair
Tuple2<StreamNode, StreamNode> itSourceAndSink = streamGraph.createIterationSourceAndSink(
coIterate.getId(),
getNewIterationNodeId(),
getNewIterationNodeId(),
coIterate.getWaitTime(),
coIterate.getParallelism(),
coIterate.getMaxParallelism(),
coIterate.getMinResources(),
coIterate.getPreferredResources());
StreamNode itSource = itSourceAndSink.f0;
StreamNode itSink = itSourceAndSink.f1;
// We set the proper serializers for the sink/source
streamGraph.setSerializers(itSource.getId(), null, null, coIterate.getOutputType().createSerializer(env.getConfig()));
streamGraph.setSerializers(itSink.getId(), coIterate.getOutputType().createSerializer(env.getConfig()), null, null);
Collection<Integer> resultIds = Collections.singleton(itSource.getId());
// at the iterate to the already-seen-set with the result IDs, so that we can transform
// the feedback edges and let them stop when encountering the iterate node
alreadyTransformed.put(coIterate, resultIds);
// so that we can determine the slot sharing group from all feedback edges
List<Integer> allFeedbackIds = new ArrayList<>();
for (StreamTransformation<F> feedbackEdge : coIterate.getFeedbackEdges()) {
Collection<Integer> feedbackIds = transform(feedbackEdge);
allFeedbackIds.addAll(feedbackIds);
for (Integer feedbackId: feedbackIds) {
streamGraph.addEdge(feedbackId,
itSink.getId(),
0
);
}
}
String slotSharingGroup = determineSlotSharingGroup(null, allFeedbackIds);
itSink.setSlotSharingGroup(slotSharingGroup);
itSource.setSlotSharingGroup(slotSharingGroup);
return Collections.singleton(itSource.getId());
} | java | private <F> Collection<Integer> transformCoFeedback(CoFeedbackTransformation<F> coIterate) {
// For Co-Iteration we don't need to transform the input and wire the input to the
// head operator by returning the input IDs, the input is directly wired to the left
// input of the co-operation. This transform only needs to return the ids of the feedback
// edges, since they need to be wired to the second input of the co-operation.
// create the fake iteration source/sink pair
Tuple2<StreamNode, StreamNode> itSourceAndSink = streamGraph.createIterationSourceAndSink(
coIterate.getId(),
getNewIterationNodeId(),
getNewIterationNodeId(),
coIterate.getWaitTime(),
coIterate.getParallelism(),
coIterate.getMaxParallelism(),
coIterate.getMinResources(),
coIterate.getPreferredResources());
StreamNode itSource = itSourceAndSink.f0;
StreamNode itSink = itSourceAndSink.f1;
// We set the proper serializers for the sink/source
streamGraph.setSerializers(itSource.getId(), null, null, coIterate.getOutputType().createSerializer(env.getConfig()));
streamGraph.setSerializers(itSink.getId(), coIterate.getOutputType().createSerializer(env.getConfig()), null, null);
Collection<Integer> resultIds = Collections.singleton(itSource.getId());
// at the iterate to the already-seen-set with the result IDs, so that we can transform
// the feedback edges and let them stop when encountering the iterate node
alreadyTransformed.put(coIterate, resultIds);
// so that we can determine the slot sharing group from all feedback edges
List<Integer> allFeedbackIds = new ArrayList<>();
for (StreamTransformation<F> feedbackEdge : coIterate.getFeedbackEdges()) {
Collection<Integer> feedbackIds = transform(feedbackEdge);
allFeedbackIds.addAll(feedbackIds);
for (Integer feedbackId: feedbackIds) {
streamGraph.addEdge(feedbackId,
itSink.getId(),
0
);
}
}
String slotSharingGroup = determineSlotSharingGroup(null, allFeedbackIds);
itSink.setSlotSharingGroup(slotSharingGroup);
itSource.setSlotSharingGroup(slotSharingGroup);
return Collections.singleton(itSource.getId());
} | [
"private",
"<",
"F",
">",
"Collection",
"<",
"Integer",
">",
"transformCoFeedback",
"(",
"CoFeedbackTransformation",
"<",
"F",
">",
"coIterate",
")",
"{",
"// For Co-Iteration we don't need to transform the input and wire the input to the",
"// head operator by returning the inpu... | Transforms a {@code CoFeedbackTransformation}.
<p>This will only transform feedback edges, the result of this transform will be wired
to the second input of a Co-Transform. The original input is wired directly to the first
input of the downstream Co-Transform.
<p>This is responsible for creating the IterationSource and IterationSink which
are used to feed back the elements. | [
"Transforms",
"a",
"{",
"@code",
"CoFeedbackTransformation",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L421-L472 | train | Transform the co - feedback edges of the given Co - Iteration. | [
30522,
2797,
1026,
1042,
1028,
3074,
1026,
16109,
1028,
10938,
3597,
7959,
2098,
5963,
1006,
2522,
7959,
2098,
5963,
6494,
3619,
14192,
3370,
1026,
1042,
1028,
2522,
21646,
3686,
1007,
1063,
1013,
1013,
2005,
2522,
1011,
27758,
2057,
2123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getTimeDuration | public long getTimeDuration(String name, long defaultValue, TimeUnit unit) {
String vStr = get(name);
if (null == vStr) {
return defaultValue;
} else {
return getTimeDurationHelper(name, vStr, unit);
}
} | java | public long getTimeDuration(String name, long defaultValue, TimeUnit unit) {
String vStr = get(name);
if (null == vStr) {
return defaultValue;
} else {
return getTimeDurationHelper(name, vStr, unit);
}
} | [
"public",
"long",
"getTimeDuration",
"(",
"String",
"name",
",",
"long",
"defaultValue",
",",
"TimeUnit",
"unit",
")",
"{",
"String",
"vStr",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"vStr",
")",
"{",
"return",
"defaultValue",
";",
"... | Return time duration in the given time unit. Valid units are encoded in
properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
(ms), seconds (s), minutes (m), hours (h), and days (d).
@param name Property name
@param defaultValue Value returned if no mapping exists.
@param unit Unit to convert the stored property, if it exists.
@throws NumberFormatException If the property stripped of its unit is not
a number | [
"Return",
"time",
"duration",
"in",
"the",
"given",
"time",
"unit",
".",
"Valid",
"units",
"are",
"encoded",
"in",
"properties",
"as",
"suffixes",
":",
"nanoseconds",
"(",
"ns",
")",
"microseconds",
"(",
"us",
")",
"milliseconds",
"(",
"ms",
")",
"seconds"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1662-L1669 | train | Returns the value of the specified property as a long. | [
30522,
2270,
2146,
2131,
7292,
24979,
3370,
1006,
5164,
2171,
1010,
2146,
12398,
10175,
5657,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
5164,
5443,
16344,
1027,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
5443,
16344,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RoundRobinOperatorStateRepartitioner.java | RoundRobinOperatorStateRepartitioner.repartitionUnionState | private void repartitionUnionState(
Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> unionState,
List<Map<StreamStateHandle, OperatorStateHandle>> mergeMapList) {
for (Map<StreamStateHandle, OperatorStateHandle> mergeMap : mergeMapList) {
for (Map.Entry<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> e :
unionState.entrySet()) {
for (Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> handleWithMetaInfo : e.getValue()) {
OperatorStateHandle operatorStateHandle = mergeMap.get(handleWithMetaInfo.f0);
if (operatorStateHandle == null) {
operatorStateHandle = new OperatorStreamStateHandle(
new HashMap<>(unionState.size()),
handleWithMetaInfo.f0);
mergeMap.put(handleWithMetaInfo.f0, operatorStateHandle);
}
operatorStateHandle.getStateNameToPartitionOffsets().put(e.getKey(), handleWithMetaInfo.f1);
}
}
}
} | java | private void repartitionUnionState(
Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> unionState,
List<Map<StreamStateHandle, OperatorStateHandle>> mergeMapList) {
for (Map<StreamStateHandle, OperatorStateHandle> mergeMap : mergeMapList) {
for (Map.Entry<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> e :
unionState.entrySet()) {
for (Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> handleWithMetaInfo : e.getValue()) {
OperatorStateHandle operatorStateHandle = mergeMap.get(handleWithMetaInfo.f0);
if (operatorStateHandle == null) {
operatorStateHandle = new OperatorStreamStateHandle(
new HashMap<>(unionState.size()),
handleWithMetaInfo.f0);
mergeMap.put(handleWithMetaInfo.f0, operatorStateHandle);
}
operatorStateHandle.getStateNameToPartitionOffsets().put(e.getKey(), handleWithMetaInfo.f1);
}
}
}
} | [
"private",
"void",
"repartitionUnionState",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"Tuple2",
"<",
"StreamStateHandle",
",",
"OperatorStateHandle",
".",
"StateMetaInfo",
">",
">",
">",
"unionState",
",",
"List",
"<",
"Map",
"<",
"StreamStateHandle",
",",
... | Repartition UNION state. | [
"Repartition",
"UNION",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RoundRobinOperatorStateRepartitioner.java#L323-L343 | train | Repartition the union state. | [
30522,
2797,
11675,
16360,
8445,
22753,
19496,
5644,
12259,
1006,
4949,
1026,
5164,
1010,
2862,
1026,
10722,
10814,
2475,
1026,
9199,
12259,
11774,
2571,
1010,
9224,
12259,
11774,
2571,
1012,
2110,
11368,
8113,
14876,
1028,
1028,
1028,
9209,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/typeutils/SortedMapTypeInfo.java | SortedMapTypeInfo.getTypeClass | @SuppressWarnings("unchecked")
@Override
public Class<SortedMap<K, V>> getTypeClass() {
return (Class<SortedMap<K, V>>) (Class<?>) SortedMap.class;
} | java | @SuppressWarnings("unchecked")
@Override
public Class<SortedMap<K, V>> getTypeClass() {
return (Class<SortedMap<K, V>>) (Class<?>) SortedMap.class;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"Class",
"<",
"SortedMap",
"<",
"K",
",",
"V",
">",
">",
"getTypeClass",
"(",
")",
"{",
"return",
"(",
"Class",
"<",
"SortedMap",
"<",
"K",
",",
"V",
">",
">",
")",
"(",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/SortedMapTypeInfo.java#L75-L79 | train | Get the type class. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2058,
15637,
2270,
2465,
1026,
19616,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
1028,
2131,
13874,
26266,
1006,
1007,
1063,
2709,
1006,
2465,
1026,
19616... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java | ClosableBlockingQueue.addIfOpen | public boolean addIfOpen(E element) {
requireNonNull(element);
lock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
nonEmpty.signalAll();
}
}
return open;
} finally {
lock.unlock();
}
} | java | public boolean addIfOpen(E element) {
requireNonNull(element);
lock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
nonEmpty.signalAll();
}
}
return open;
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"addIfOpen",
"(",
"E",
"element",
")",
"{",
"requireNonNull",
"(",
"element",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"open",
")",
"{",
"elements",
".",
"addLast",
"(",
"element",
")",
";",
"if",
"(... | Tries to add an element to the queue, if the queue is still open. Checking whether the queue
is open and adding the element is one atomic operation.
<p>Unlike the {@link #add(Object)} method, this method never throws an exception,
but only indicates via the return code if the element was added or the
queue was closed.
@param element The element to add.
@return True, if the element was added, false if the queue was closes. | [
"Tries",
"to",
"add",
"an",
"element",
"to",
"the",
"queue",
"if",
"the",
"queue",
"is",
"still",
"open",
".",
"Checking",
"whether",
"the",
"queue",
"is",
"open",
"and",
"adding",
"the",
"element",
"is",
"one",
"atomic",
"operation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java#L176-L191 | train | Adds the specified element to the end of the list if it is open. | [
30522,
2270,
22017,
20898,
5587,
10128,
26915,
1006,
1041,
5783,
1007,
1063,
5478,
8540,
11231,
3363,
1006,
5783,
1007,
1025,
5843,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2065,
1006,
2330,
1007,
1063,
3787,
1012,
5587,
8523,
2102,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.convert | public static <T> T convert(TypeReference<T> reference, Object value) throws ConvertException{
return convert(reference.getType(), value, null);
} | java | public static <T> T convert(TypeReference<T> reference, Object value) throws ConvertException{
return convert(reference.getType(), value, null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"convert",
"(",
"TypeReference",
"<",
"T",
">",
"reference",
",",
"Object",
"value",
")",
"throws",
"ConvertException",
"{",
"return",
"convert",
"(",
"reference",
".",
"getType",
"(",
")",
",",
"value",
",",
"null... | 转换值为指定类型
@param <T> 目标类型
@param reference 类型参考,用于持有转换后的泛型类型
@param value 值
@return 转换后的值
@throws ConvertException 转换器不存在 | [
"转换值为指定类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L567-L569 | train | Convert a value to a type reference. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
10463,
1006,
2828,
2890,
25523,
1026,
1056,
1028,
4431,
1010,
4874,
3643,
1007,
11618,
10463,
10288,
24422,
1063,
2709,
10463,
1006,
4431,
1012,
2131,
13874,
1006,
1007,
1010,
3643,
1010,
19701,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cookie/ClientCookieEncoder.java | ClientCookieEncoder.encode | public String encode(Cookie... cookies) {
if (checkNotNull(cookies, "cookies").length == 0) {
return null;
}
StringBuilder buf = stringBuilder();
if (strict) {
if (cookies.length == 1) {
encode(buf, cookies[0]);
} else {
Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length);
Arrays.sort(cookiesSorted, COOKIE_COMPARATOR);
for (Cookie c : cookiesSorted) {
encode(buf, c);
}
}
} else {
for (Cookie c : cookies) {
encode(buf, c);
}
}
return stripTrailingSeparatorOrNull(buf);
} | java | public String encode(Cookie... cookies) {
if (checkNotNull(cookies, "cookies").length == 0) {
return null;
}
StringBuilder buf = stringBuilder();
if (strict) {
if (cookies.length == 1) {
encode(buf, cookies[0]);
} else {
Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length);
Arrays.sort(cookiesSorted, COOKIE_COMPARATOR);
for (Cookie c : cookiesSorted) {
encode(buf, c);
}
}
} else {
for (Cookie c : cookies) {
encode(buf, c);
}
}
return stripTrailingSeparatorOrNull(buf);
} | [
"public",
"String",
"encode",
"(",
"Cookie",
"...",
"cookies",
")",
"{",
"if",
"(",
"checkNotNull",
"(",
"cookies",
",",
"\"cookies\"",
")",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"buf",
"=",
"stringBuilder",
"("... | Encodes the specified cookies into a single Cookie header value.
@param cookies
some cookies
@return a Rfc6265 style Cookie header value, null if no cookies are passed. | [
"Encodes",
"the",
"specified",
"cookies",
"into",
"a",
"single",
"Cookie",
"header",
"value",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ClientCookieEncoder.java#L123-L145 | train | Encode a set of cookies. | [
30522,
2270,
5164,
4372,
16044,
1006,
17387,
1012,
1012,
1012,
16324,
1007,
1063,
2065,
1006,
4638,
17048,
11231,
3363,
1006,
16324,
1010,
1000,
16324,
1000,
1007,
1012,
3091,
1027,
1027,
1014,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
856... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getUnsignedMedium | static int getUnsignedMedium(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0xFF) << 16 |
(buf.getByte(offset + 1) & 0xFF) << 8 |
buf.getByte(offset + 2) & 0xFF;
} | java | static int getUnsignedMedium(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0xFF) << 16 |
(buf.getByte(offset + 1) & 0xFF) << 8 |
buf.getByte(offset + 2) & 0xFF;
} | [
"static",
"int",
"getUnsignedMedium",
"(",
"ByteBuf",
"buf",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"buf",
".",
"getByte",
"(",
"offset",
")",
"&",
"0xFF",
")",
"<<",
"16",
"|",
"(",
"buf",
".",
"getByte",
"(",
"offset",
"+",
"1",
")",
"&",... | Reads a big-endian unsigned medium integer from the buffer. | [
"Reads",
"a",
"big",
"-",
"endian",
"unsigned",
"medium",
"integer",
"from",
"the",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java#L251-L255 | train | Get the unsigned medium from the buffer. | [
30522,
10763,
20014,
2131,
4609,
5332,
19225,
7583,
5007,
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,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/web/reactive/error/DefaultErrorWebExceptionHandler.java | DefaultErrorWebExceptionHandler.renderErrorView | protected Mono<ServerResponse> renderErrorView(ServerRequest request) {
boolean includeStackTrace = isIncludeStackTrace(request, MediaType.TEXT_HTML);
Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
HttpStatus errorStatus = getHttpStatus(error);
ServerResponse.BodyBuilder responseBody = ServerResponse.status(errorStatus)
.contentType(MediaType.TEXT_HTML);
return Flux
.just("error/" + errorStatus.value(),
"error/" + SERIES_VIEWS.get(errorStatus.series()), "error/error")
.flatMap((viewName) -> renderErrorView(viewName, responseBody, error))
.switchIfEmpty(this.errorProperties.getWhitelabel().isEnabled()
? renderDefaultErrorView(responseBody, error)
: Mono.error(getError(request)))
.next();
} | java | protected Mono<ServerResponse> renderErrorView(ServerRequest request) {
boolean includeStackTrace = isIncludeStackTrace(request, MediaType.TEXT_HTML);
Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
HttpStatus errorStatus = getHttpStatus(error);
ServerResponse.BodyBuilder responseBody = ServerResponse.status(errorStatus)
.contentType(MediaType.TEXT_HTML);
return Flux
.just("error/" + errorStatus.value(),
"error/" + SERIES_VIEWS.get(errorStatus.series()), "error/error")
.flatMap((viewName) -> renderErrorView(viewName, responseBody, error))
.switchIfEmpty(this.errorProperties.getWhitelabel().isEnabled()
? renderDefaultErrorView(responseBody, error)
: Mono.error(getError(request)))
.next();
} | [
"protected",
"Mono",
"<",
"ServerResponse",
">",
"renderErrorView",
"(",
"ServerRequest",
"request",
")",
"{",
"boolean",
"includeStackTrace",
"=",
"isIncludeStackTrace",
"(",
"request",
",",
"MediaType",
".",
"TEXT_HTML",
")",
";",
"Map",
"<",
"String",
",",
"O... | Render the error information as an HTML view.
@param request the current request
@return a {@code Publisher} of the HTTP response | [
"Render",
"the",
"error",
"information",
"as",
"an",
"HTML",
"view",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java#L113-L127 | train | Render error view. | [
30522,
5123,
18847,
1026,
8241,
6072,
26029,
3366,
1028,
17552,
2121,
29165,
8584,
1006,
8241,
2890,
15500,
5227,
1007,
1063,
22017,
20898,
2950,
2696,
3600,
6494,
3401,
1027,
2003,
2378,
20464,
22087,
2696,
3600,
6494,
3401,
1006,
5227,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java | DefaultConfigurableOptionsFactory.getInternal | private String getInternal(String key) {
Preconditions.checkArgument(configuredOptions.containsKey(key),
"The configuration " + key + " has not been configured.");
return configuredOptions.get(key);
} | java | private String getInternal(String key) {
Preconditions.checkArgument(configuredOptions.containsKey(key),
"The configuration " + key + " has not been configured.");
return configuredOptions.get(key);
} | [
"private",
"String",
"getInternal",
"(",
"String",
"key",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"configuredOptions",
".",
"containsKey",
"(",
"key",
")",
",",
"\"The configuration \"",
"+",
"key",
"+",
"\" has not been configured.\"",
")",
";",
"re... | Returns the value in string format with the given key.
@param key The configuration-key to query in string format. | [
"Returns",
"the",
"value",
"in",
"string",
"format",
"with",
"the",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java#L419-L424 | train | Gets the value of the configuration option with the given key. | [
30522,
2797,
5164,
2131,
18447,
11795,
2389,
1006,
5164,
3145,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
26928,
7361,
9285,
1012,
3397,
14839,
1006,
3145,
1007,
1010,
1000,
1996,
9563,
1000,
1009,
3145,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java | ExecutionEnvironment.createRemoteEnvironment | public static ExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfiguration, String... jarFiles) {
return new RemoteEnvironment(host, port, clientConfiguration, jarFiles, null);
} | java | public static ExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfiguration, String... jarFiles) {
return new RemoteEnvironment(host, port, clientConfiguration, jarFiles, null);
} | [
"public",
"static",
"ExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"Configuration",
"clientConfiguration",
",",
"String",
"...",
"jarFiles",
")",
"{",
"return",
"new",
"RemoteEnvironment",
"(",
"host",
",",
"port",... | Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program
to a cluster for execution. Note that all file paths used in the program must be accessible from the
cluster. The custom configuration file is used to configure Akka specific configuration parameters
for the Client only; Program parallelism can be set via {@link ExecutionEnvironment#setParallelism(int)}.
<p>Cluster configuration has to be done in the remotely running Flink instance.
@param host The host name or address of the master (JobManager), where the program should be executed.
@param port The port of the master (JobManager), where the program should be executed.
@param clientConfiguration Configuration used by the client that connects to the cluster.
@param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses
user-defined functions, user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1192-L1195 | train | Create a remote environment. | [
30522,
2270,
10763,
7781,
2368,
21663,
2239,
3672,
3443,
28578,
12184,
2368,
21663,
2239,
3672,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
9563,
7396,
8663,
8873,
27390,
3370,
1010,
5164,
1012,
1012,
1012,
15723,
8873,
4244,
1007,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.removeSessionIds | public URLNormalizer removeSessionIds() {
if (StringUtils.containsIgnoreCase(url, ";jsessionid=")) {
url = url.replaceFirst(
"(;jsessionid=([A-F0-9]+)((\\.\\w+)*))", "");
} else {
String u = StringUtils.substringBefore(url, "?");
String q = StringUtils.substringAfter(url, "?");
if (StringUtils.containsIgnoreCase(url, "PHPSESSID=")) {
q = q.replaceFirst("(&|^)(PHPSESSID=[0-9a-zA-Z]*)", "");
} else if (StringUtils.containsIgnoreCase(url, "ASPSESSIONID")) {
q = q.replaceFirst(
"(&|^)(ASPSESSIONID[a-zA-Z]{8}=[a-zA-Z]*)", "");
}
if (!StringUtils.isBlank(q)) {
u += "?" + StringUtils.removeStart(q, "&");
}
url = u;
}
return this;
} | java | public URLNormalizer removeSessionIds() {
if (StringUtils.containsIgnoreCase(url, ";jsessionid=")) {
url = url.replaceFirst(
"(;jsessionid=([A-F0-9]+)((\\.\\w+)*))", "");
} else {
String u = StringUtils.substringBefore(url, "?");
String q = StringUtils.substringAfter(url, "?");
if (StringUtils.containsIgnoreCase(url, "PHPSESSID=")) {
q = q.replaceFirst("(&|^)(PHPSESSID=[0-9a-zA-Z]*)", "");
} else if (StringUtils.containsIgnoreCase(url, "ASPSESSIONID")) {
q = q.replaceFirst(
"(&|^)(ASPSESSIONID[a-zA-Z]{8}=[a-zA-Z]*)", "");
}
if (!StringUtils.isBlank(q)) {
u += "?" + StringUtils.removeStart(q, "&");
}
url = u;
}
return this;
} | [
"public",
"URLNormalizer",
"removeSessionIds",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"containsIgnoreCase",
"(",
"url",
",",
"\";jsessionid=\"",
")",
")",
"{",
"url",
"=",
"url",
".",
"replaceFirst",
"(",
"\"(;jsessionid=([A-F0-9]+)((\\\\.\\\\w+)*))\"",
",",
... | <p>Removes a URL-based session id. It removes PHP (PHPSESSID),
ASP (ASPSESSIONID), and Java EE (jsessionid) session ids.</p>
<code>http://www.example.com/servlet;jsessionid=1E6FEC0D14D044541DD84D2D013D29ED?a=b
→ http://www.example.com/servlet?a=b</code>
<p><b>Please Note:</b> Removing session IDs from URLs is often
a good way to have the URL return an error once invoked.</p>
@return this instance | [
"<p",
">",
"Removes",
"a",
"URL",
"-",
"based",
"session",
"id",
".",
"It",
"removes",
"PHP",
"(",
"PHPSESSID",
")",
"ASP",
"(",
"ASPSESSIONID",
")",
"and",
"Java",
"EE",
"(",
"jsessionid",
")",
"session",
"ids",
".",
"<",
"/",
"p",
">",
"<code",
"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L742-L761 | train | Removes session ids from the URL. | [
30522,
2270,
24471,
19666,
2953,
9067,
30524,
1000,
1006,
1025,
1046,
8583,
10992,
3593,
1027,
1006,
1031,
1037,
1011,
1042,
2692,
1011,
1023,
1033,
1009,
1007,
1006,
1006,
1032,
1032,
1012,
1032,
1032,
1059,
1009,
1007,
1008,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.appendDisplayNames | private static Map<String, Integer> appendDisplayNames(final Calendar cal, final Locale locale, final int field, final StringBuilder regex) {
final Map<String, Integer> values = new HashMap<>();
final Map<String, Integer> displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale);
final TreeSet<String> sorted = new TreeSet<>(LONGER_FIRST_LOWERCASE);
for (final Map.Entry<String, Integer> displayName : displayNames.entrySet()) {
final String key = displayName.getKey().toLowerCase(locale);
if (sorted.add(key)) {
values.put(key, displayName.getValue());
}
}
for (final String symbol : sorted) {
simpleQuote(regex, symbol).append('|');
}
return values;
} | java | private static Map<String, Integer> appendDisplayNames(final Calendar cal, final Locale locale, final int field, final StringBuilder regex) {
final Map<String, Integer> values = new HashMap<>();
final Map<String, Integer> displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale);
final TreeSet<String> sorted = new TreeSet<>(LONGER_FIRST_LOWERCASE);
for (final Map.Entry<String, Integer> displayName : displayNames.entrySet()) {
final String key = displayName.getKey().toLowerCase(locale);
if (sorted.add(key)) {
values.put(key, displayName.getValue());
}
}
for (final String symbol : sorted) {
simpleQuote(regex, symbol).append('|');
}
return values;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"appendDisplayNames",
"(",
"final",
"Calendar",
"cal",
",",
"final",
"Locale",
"locale",
",",
"final",
"int",
"field",
",",
"final",
"StringBuilder",
"regex",
")",
"{",
"final",
"Map",
"<",
"S... | Get the short and long values displayed for a field
@param cal The calendar to obtain the short and long values
@param locale The locale of display names
@param field The field of interest
@param regex The regular expression to build
@return The map of string display names to field values | [
"Get",
"the",
"short",
"and",
"long",
"values",
"displayed",
"for",
"a",
"field"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L305-L320 | train | Append display names. | [
30522,
2797,
10763,
4949,
1026,
5164,
1010,
16109,
1028,
10439,
10497,
10521,
13068,
18442,
2015,
1006,
2345,
8094,
10250,
1010,
2345,
2334,
2063,
2334,
2063,
1010,
2345,
20014,
2492,
1010,
2345,
5164,
8569,
23891,
2099,
19723,
10288,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.writeUtf8 | public static void writeUtf8(OutputStream out, boolean isCloseOut, Object... contents) throws IORuntimeException {
write(out, CharsetUtil.CHARSET_UTF_8, isCloseOut, contents);
} | java | public static void writeUtf8(OutputStream out, boolean isCloseOut, Object... contents) throws IORuntimeException {
write(out, CharsetUtil.CHARSET_UTF_8, isCloseOut, contents);
} | [
"public",
"static",
"void",
"writeUtf8",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
",",
"Object",
"...",
"contents",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"out",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
",",
"isCloseOut",
",",
... | 将多部分内容写到流中,自动转换为UTF-8字符串
@param out 输出流
@param isCloseOut 写入完毕是否关闭输出流
@param contents 写入的内容,调用toString()方法,不包括不会自动换行
@throws IORuntimeException IO异常
@since 3.1.1 | [
"将多部分内容写到流中,自动转换为UTF",
"-",
"8字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L878-L880 | train | Write the contents of the object array to the output stream using UTF - 8 encoding. | [
30522,
2270,
10763,
11675,
4339,
4904,
2546,
2620,
1006,
27852,
25379,
2041,
1010,
22017,
20898,
2003,
20464,
9232,
5833,
1010,
4874,
1012,
1012,
1012,
8417,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
1006,
2041,
1010,
25869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFileHeader.java | UploadFileHeader.processHeaderString | private void processHeaderString(String dataHeader) {
isFile = dataHeader.indexOf("filename") > 0;
formFieldName = getDataFieldValue(dataHeader, "name");
if (isFile) {
formFileName = getDataFieldValue(dataHeader, "filename");
if (formFileName == null) {
return;
}
if (formFileName.length() == 0) {
path = StrUtil.EMPTY;
fileName = StrUtil.EMPTY;
}
int ls = FileUtil.lastIndexOfSeparator(formFileName);
if (ls == -1) {
path = StrUtil.EMPTY;
fileName = formFileName;
} else {
path = formFileName.substring(0, ls);
fileName = formFileName.substring(ls);
}
if (fileName.length() > 0) {
this.contentType = getContentType(dataHeader);
mimeType = getMimeType(contentType);
mimeSubtype = getMimeSubtype(contentType);
contentDisposition = getContentDisposition(dataHeader);
}
}
} | java | private void processHeaderString(String dataHeader) {
isFile = dataHeader.indexOf("filename") > 0;
formFieldName = getDataFieldValue(dataHeader, "name");
if (isFile) {
formFileName = getDataFieldValue(dataHeader, "filename");
if (formFileName == null) {
return;
}
if (formFileName.length() == 0) {
path = StrUtil.EMPTY;
fileName = StrUtil.EMPTY;
}
int ls = FileUtil.lastIndexOfSeparator(formFileName);
if (ls == -1) {
path = StrUtil.EMPTY;
fileName = formFileName;
} else {
path = formFileName.substring(0, ls);
fileName = formFileName.substring(ls);
}
if (fileName.length() > 0) {
this.contentType = getContentType(dataHeader);
mimeType = getMimeType(contentType);
mimeSubtype = getMimeSubtype(contentType);
contentDisposition = getContentDisposition(dataHeader);
}
}
} | [
"private",
"void",
"processHeaderString",
"(",
"String",
"dataHeader",
")",
"{",
"isFile",
"=",
"dataHeader",
".",
"indexOf",
"(",
"\"filename\"",
")",
">",
"0",
";",
"formFieldName",
"=",
"getDataFieldValue",
"(",
"dataHeader",
",",
"\"name\"",
")",
";",
"if"... | 处理头字符串,使之转化为字段
@param dataHeader | [
"处理头字符串,使之转化为字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFileHeader.java#L159-L186 | train | Process the header string. | [
30522,
2797,
11675,
2832,
4974,
2545,
18886,
3070,
1006,
5164,
2951,
4974,
2121,
1007,
1063,
2003,
8873,
2571,
1027,
2951,
4974,
2121,
1012,
5950,
11253,
1006,
1000,
5371,
18442,
1000,
1007,
1028,
1014,
1025,
2433,
3790,
18442,
1027,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java | Instance.returnLogicalSlot | @Override
public void returnLogicalSlot(LogicalSlot logicalSlot) {
checkNotNull(logicalSlot);
checkArgument(logicalSlot instanceof Slot);
final Slot slot = ((Slot) logicalSlot);
checkArgument(!slot.isAlive(), "slot is still alive");
checkArgument(slot.getOwner() == this, "slot belongs to the wrong TaskManager.");
if (slot.markReleased()) {
LOG.debug("Return allocated slot {}.", slot);
synchronized (instanceLock) {
if (isDead) {
return;
}
if (this.allocatedSlots.remove(slot)) {
this.availableSlots.add(slot.getSlotNumber());
if (this.slotAvailabilityListener != null) {
this.slotAvailabilityListener.newSlotAvailable(this);
}
}
else {
throw new IllegalArgumentException("Slot was not allocated from this TaskManager.");
}
}
}
} | java | @Override
public void returnLogicalSlot(LogicalSlot logicalSlot) {
checkNotNull(logicalSlot);
checkArgument(logicalSlot instanceof Slot);
final Slot slot = ((Slot) logicalSlot);
checkArgument(!slot.isAlive(), "slot is still alive");
checkArgument(slot.getOwner() == this, "slot belongs to the wrong TaskManager.");
if (slot.markReleased()) {
LOG.debug("Return allocated slot {}.", slot);
synchronized (instanceLock) {
if (isDead) {
return;
}
if (this.allocatedSlots.remove(slot)) {
this.availableSlots.add(slot.getSlotNumber());
if (this.slotAvailabilityListener != null) {
this.slotAvailabilityListener.newSlotAvailable(this);
}
}
else {
throw new IllegalArgumentException("Slot was not allocated from this TaskManager.");
}
}
}
} | [
"@",
"Override",
"public",
"void",
"returnLogicalSlot",
"(",
"LogicalSlot",
"logicalSlot",
")",
"{",
"checkNotNull",
"(",
"logicalSlot",
")",
";",
"checkArgument",
"(",
"logicalSlot",
"instanceof",
"Slot",
")",
";",
"final",
"Slot",
"slot",
"=",
"(",
"(",
"Slo... | Returns a slot that has been allocated from this instance. The slot needs have been canceled
prior to calling this method.
<p>The method will transition the slot to the "released" state. If the slot is already in state
"released", this method will do nothing.</p>
@param logicalSlot The slot to return.
@return Future which is completed with true, if the slot was returned, false if not. | [
"Returns",
"a",
"slot",
"that",
"has",
"been",
"allocated",
"from",
"this",
"instance",
".",
"The",
"slot",
"needs",
"have",
"been",
"canceled",
"prior",
"to",
"calling",
"this",
"method",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java#L284-L313 | train | Return a slot from this TaskManager. | [
30522,
1030,
2058,
15637,
2270,
11675,
2709,
9966,
14540,
4140,
1006,
11177,
14540,
4140,
11177,
14540,
4140,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
11177,
14540,
4140,
1007,
1025,
4638,
2906,
22850,
4765,
1006,
11177,
14540,
4140,
6013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.scanPackageByAnnotation | public static Set<Class<?>> scanPackageByAnnotation(String packageName, final Class<? extends Annotation> annotationClass) {
return ClassScaner.scanPackageByAnnotation(packageName, annotationClass);
} | java | public static Set<Class<?>> scanPackageByAnnotation(String packageName, final Class<? extends Annotation> annotationClass) {
return ClassScaner.scanPackageByAnnotation(packageName, annotationClass);
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scanPackageByAnnotation",
"(",
"String",
"packageName",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"return",
"ClassScaner",
".",
"scanPackageByAnnotati... | 扫描指定包路径下所有包含指定注解的类
@param packageName 包路径
@param annotationClass 注解类
@return 类集合
@see ClassScaner#scanPackageByAnnotation(String, Class) | [
"扫描指定包路径下所有包含指定注解的类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L180-L182 | train | Scan a package for classes that have an annotation of the given type. | [
30522,
2270,
10763,
2275,
1026,
2465,
1026,
1029,
1028,
1028,
13594,
23947,
4270,
3762,
11639,
17287,
3508,
1006,
5164,
7427,
18442,
1010,
2345,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
5754,
17287,
3508,
26266,
1007,
1063,
2709,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getIntHeader | @Deprecated
public static int getIntHeader(HttpMessage message, CharSequence name) {
String value = message.headers().get(name);
if (value == null) {
throw new NumberFormatException("header not found: " + name);
}
return Integer.parseInt(value);
} | java | @Deprecated
public static int getIntHeader(HttpMessage message, CharSequence name) {
String value = message.headers().get(name);
if (value == null) {
throw new NumberFormatException("header not found: " + name);
}
return Integer.parseInt(value);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getIntHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
")",
"{",
"String",
"value",
"=",
"message",
".",
"headers",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"==",
... | @deprecated Use {@link #getInt(CharSequence)} instead.
Returns the integer header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.
@return the header value
@throws NumberFormatException
if there is no such header or the header value is not a number | [
"@deprecated",
"Use",
"{",
"@link",
"#getInt",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L725-L732 | train | Gets the value of the specified HTTP header as an int. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
20014,
2131,
18447,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1007,
1063,
5164,
3643,
1027,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2131,
1006,
2171... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.readFileOfPrimitives | public <X> DataSource<X> readFileOfPrimitives(String filePath, Class<X> typeClass) {
Preconditions.checkNotNull(filePath, "The file path may not be null.");
return new DataSource<>(this, new PrimitiveInputFormat<>(new Path(filePath), typeClass), TypeExtractor.getForClass(typeClass), Utils.getCallLocationName());
} | java | public <X> DataSource<X> readFileOfPrimitives(String filePath, Class<X> typeClass) {
Preconditions.checkNotNull(filePath, "The file path may not be null.");
return new DataSource<>(this, new PrimitiveInputFormat<>(new Path(filePath), typeClass), TypeExtractor.getForClass(typeClass), Utils.getCallLocationName());
} | [
"public",
"<",
"X",
">",
"DataSource",
"<",
"X",
">",
"readFileOfPrimitives",
"(",
"String",
"filePath",
",",
"Class",
"<",
"X",
">",
"typeClass",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"filePath",
",",
"\"The file path may not be null.\"",
")",
... | Creates a {@link DataSet} that represents the primitive type produced by reading the given file line wise.
This method is similar to {@link #readCsvFile(String)} with single field, but it produces a DataSet not through
{@link org.apache.flink.api.java.tuple.Tuple1}.
@param filePath The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path").
@param typeClass The primitive type class to be read.
@return A {@link DataSet} that represents the data read from the given file as primitive type. | [
"Creates",
"a",
"{",
"@link",
"DataSet",
"}",
"that",
"represents",
"the",
"primitive",
"type",
"produced",
"by",
"reading",
"the",
"given",
"file",
"line",
"wise",
".",
"This",
"method",
"is",
"similar",
"to",
"{",
"@link",
"#readCsvFile",
"(",
"String",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L468-L472 | train | Reads a file of primitives from the given file path. | [
30522,
2270,
1026,
1060,
1028,
2951,
6499,
3126,
3401,
1026,
1060,
1028,
3191,
8873,
2571,
11253,
18098,
27605,
6024,
2015,
1006,
5164,
5371,
15069,
1010,
2465,
1026,
1060,
1028,
2828,
26266,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | AbstractFilterRegistrationBean.addServletNames | public void addServletNames(String... servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames.addAll(Arrays.asList(servletNames));
} | java | public void addServletNames(String... servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames.addAll(Arrays.asList(servletNames));
} | [
"public",
"void",
"addServletNames",
"(",
"String",
"...",
"servletNames",
")",
"{",
"Assert",
".",
"notNull",
"(",
"servletNames",
",",
"\"ServletNames must not be null\"",
")",
";",
"this",
".",
"servletNames",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",... | Add servlet names for the filter.
@param servletNames the servlet names to add | [
"Add",
"servlet",
"names",
"for",
"the",
"filter",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java#L130-L133 | train | Add servlet names to the list of servlet names. | [
30522,
2270,
11675,
9909,
2121,
2615,
7485,
18442,
2015,
1006,
5164,
1012,
1012,
1012,
14262,
2615,
7485,
18442,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
14262,
2615,
7485,
18442,
2015,
1010,
1000,
14262,
2615,
7485,
18442,
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-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetInputFormat.java | ParquetInputFormat.getReadSchema | private MessageType getReadSchema(MessageType fileSchema, Path filePath) {
RowTypeInfo fileTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(fileSchema);
List<Type> types = new ArrayList<>();
for (int i = 0; i < fieldNames.length; ++i) {
String readFieldName = fieldNames[i];
TypeInformation<?> readFieldType = fieldTypes[i];
if (fileTypeInfo.getFieldIndex(readFieldName) < 0) {
if (!skipWrongSchemaFileSplit) {
throw new IllegalArgumentException("Field " + readFieldName + " cannot be found in schema of "
+ " Parquet file: " + filePath + ".");
} else {
this.skipThisSplit = true;
return fileSchema;
}
}
if (!readFieldType.equals(fileTypeInfo.getTypeAt(readFieldName))) {
if (!skipWrongSchemaFileSplit) {
throw new IllegalArgumentException("Expecting type " + readFieldType + " for field " + readFieldName
+ " but found type " + fileTypeInfo.getTypeAt(readFieldName) + " in Parquet file: "
+ filePath + ".");
} else {
this.skipThisSplit = true;
return fileSchema;
}
}
types.add(fileSchema.getType(readFieldName));
}
return new MessageType(fileSchema.getName(), types);
} | java | private MessageType getReadSchema(MessageType fileSchema, Path filePath) {
RowTypeInfo fileTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(fileSchema);
List<Type> types = new ArrayList<>();
for (int i = 0; i < fieldNames.length; ++i) {
String readFieldName = fieldNames[i];
TypeInformation<?> readFieldType = fieldTypes[i];
if (fileTypeInfo.getFieldIndex(readFieldName) < 0) {
if (!skipWrongSchemaFileSplit) {
throw new IllegalArgumentException("Field " + readFieldName + " cannot be found in schema of "
+ " Parquet file: " + filePath + ".");
} else {
this.skipThisSplit = true;
return fileSchema;
}
}
if (!readFieldType.equals(fileTypeInfo.getTypeAt(readFieldName))) {
if (!skipWrongSchemaFileSplit) {
throw new IllegalArgumentException("Expecting type " + readFieldType + " for field " + readFieldName
+ " but found type " + fileTypeInfo.getTypeAt(readFieldName) + " in Parquet file: "
+ filePath + ".");
} else {
this.skipThisSplit = true;
return fileSchema;
}
}
types.add(fileSchema.getType(readFieldName));
}
return new MessageType(fileSchema.getName(), types);
} | [
"private",
"MessageType",
"getReadSchema",
"(",
"MessageType",
"fileSchema",
",",
"Path",
"filePath",
")",
"{",
"RowTypeInfo",
"fileTypeInfo",
"=",
"(",
"RowTypeInfo",
")",
"ParquetSchemaConverter",
".",
"fromParquetType",
"(",
"fileSchema",
")",
";",
"List",
"<",
... | Generates and returns the read schema based on the projected fields for a given file.
@param fileSchema The schema of the given file.
@param filePath The path of the given file.
@return The read schema based on the given file's schema and the projected fields. | [
"Generates",
"and",
"returns",
"the",
"read",
"schema",
"based",
"on",
"the",
"projected",
"fields",
"for",
"a",
"given",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetInputFormat.java#L248-L278 | train | Get read schema. | [
30522,
2797,
4471,
13874,
2131,
16416,
5104,
5403,
2863,
1006,
4471,
13874,
6764,
5403,
2863,
1010,
4130,
5371,
15069,
1007,
1063,
5216,
13874,
2378,
14876,
5371,
13874,
2378,
14876,
1027,
1006,
5216,
13874,
2378,
14876,
1007,
11968,
12647,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.channel | public B channel(Class<? extends C> channelClass) {
if (channelClass == null) {
throw new NullPointerException("channelClass");
}
return channelFactory(new ReflectiveChannelFactory<C>(channelClass));
} | java | public B channel(Class<? extends C> channelClass) {
if (channelClass == null) {
throw new NullPointerException("channelClass");
}
return channelFactory(new ReflectiveChannelFactory<C>(channelClass));
} | [
"public",
"B",
"channel",
"(",
"Class",
"<",
"?",
"extends",
"C",
">",
"channelClass",
")",
"{",
"if",
"(",
"channelClass",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"channelClass\"",
")",
";",
"}",
"return",
"channelFactory",
... | The {@link Class} which is used to create {@link Channel} instances from.
You either use this or {@link #channelFactory(io.netty.channel.ChannelFactory)} if your
{@link Channel} implementation has no no-args constructor. | [
"The",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L102-L107 | train | Creates a new instance of the specified channel class using the default channel factory. | [
30522,
2270,
1038,
3149,
1006,
2465,
1026,
1029,
8908,
1039,
1028,
3149,
26266,
1007,
1063,
2065,
1006,
3149,
26266,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
3149,
26266,
1000,
1007,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerUtils.java | TypeSerializerUtils.snapshotBackwardsCompatible | public static TypeSerializerSnapshot<?>[] snapshotBackwardsCompatible(
TypeSerializer<?>... originatingSerializers) {
return Arrays.stream(originatingSerializers)
.map(TypeSerializerUtils::snapshotBackwardsCompatible)
.toArray(TypeSerializerSnapshot[]::new);
} | java | public static TypeSerializerSnapshot<?>[] snapshotBackwardsCompatible(
TypeSerializer<?>... originatingSerializers) {
return Arrays.stream(originatingSerializers)
.map(TypeSerializerUtils::snapshotBackwardsCompatible)
.toArray(TypeSerializerSnapshot[]::new);
} | [
"public",
"static",
"TypeSerializerSnapshot",
"<",
"?",
">",
"[",
"]",
"snapshotBackwardsCompatible",
"(",
"TypeSerializer",
"<",
"?",
">",
"...",
"originatingSerializers",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"originatingSerializers",
")",
".",
"map"... | Takes snapshots of the given serializers. In case where the snapshots
are still extending the old {@code TypeSerializerConfigSnapshot} class, the snapshots
are set up properly (with their originating serializer) such that the backwards
compatible code paths work. | [
"Takes",
"snapshots",
"of",
"the",
"given",
"serializers",
".",
"In",
"case",
"where",
"the",
"snapshots",
"are",
"still",
"extending",
"the",
"old",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerUtils.java#L34-L40 | train | Creates a snapshot of the given serializers in backwards compatible order. | [
30522,
2270,
10763,
4127,
11610,
28863,
2015,
30524,
1006,
14802,
8043,
4818,
17629,
2015,
1007,
1012,
4949,
1006,
4127,
11610,
28863,
21823,
4877,
1024,
1024,
20057,
12326,
5963,
7652,
9363,
8737,
10450,
3468,
1007,
1012,
2000,
2906,
9447,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/Simhash.java | Simhash.splitSimhash | private List<String> splitSimhash(Long simhash) {
final int bitNum = this.bitNum;
final int fracBitNum = this.fracBitNum;
final List<String> ls = new ArrayList<String>();
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < bitNum; i++) {
sb.append(simhash >> i & 1);
if ((i + 1) % fracBitNum == 0) {
ls.add(sb.toString());
sb.setLength(0);
}
}
return ls;
} | java | private List<String> splitSimhash(Long simhash) {
final int bitNum = this.bitNum;
final int fracBitNum = this.fracBitNum;
final List<String> ls = new ArrayList<String>();
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < bitNum; i++) {
sb.append(simhash >> i & 1);
if ((i + 1) % fracBitNum == 0) {
ls.add(sb.toString());
sb.setLength(0);
}
}
return ls;
} | [
"private",
"List",
"<",
"String",
">",
"splitSimhash",
"(",
"Long",
"simhash",
")",
"{",
"final",
"int",
"bitNum",
"=",
"this",
".",
"bitNum",
";",
"final",
"int",
"fracBitNum",
"=",
"this",
".",
"fracBitNum",
";",
"final",
"List",
"<",
"String",
">",
... | 将simhash分成n段
@param simhash Simhash值
@return N段Simhash | [
"将simhash分成n段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/Simhash.java#L183-L197 | train | Split the given simhash into two lists of strings. | [
30522,
2797,
2862,
1026,
5164,
1028,
19584,
5714,
14949,
2232,
1006,
2146,
21934,
14949,
2232,
1007,
1063,
2345,
20014,
2978,
19172,
1027,
2023,
1012,
2978,
19172,
1025,
2345,
20014,
25312,
27421,
4183,
19172,
1027,
2023,
1012,
25312,
27421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java | ExecutionConfig.registerTypeWithKryoSerializer | @SuppressWarnings("rawtypes")
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends Serializer> serializerClass) {
if (type == null || serializerClass == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
@SuppressWarnings("unchecked")
Class<? extends Serializer<?>> castedSerializerClass = (Class<? extends Serializer<?>>) serializerClass;
registeredTypesWithKryoSerializerClasses.put(type, castedSerializerClass);
} | java | @SuppressWarnings("rawtypes")
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends Serializer> serializerClass) {
if (type == null || serializerClass == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
@SuppressWarnings("unchecked")
Class<? extends Serializer<?>> castedSerializerClass = (Class<? extends Serializer<?>>) serializerClass;
registeredTypesWithKryoSerializerClasses.put(type, castedSerializerClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"registerTypeWithKryoSerializer",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
"extends",
"Serializer",
">",
"serializerClass",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"|... | Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer
@param type The class of the types serialized with the given serializer.
@param serializerClass The class of the serializer to use. | [
"Registers",
"the",
"given",
"Serializer",
"via",
"its",
"class",
"as",
"a",
"serializer",
"for",
"the",
"given",
"type",
"at",
"the",
"KryoSerializer"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java#L812-L821 | train | Registers a type with a serializer class. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
6315,
13874,
2015,
1000,
1007,
2270,
11675,
4236,
13874,
24415,
21638,
7677,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
2465,
1026,
1029,
8908,
7642,
17629,
1028,
7642,
176... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EscapeUtil.java | EscapeUtil.escape | public static String escape(String content) {
if (StrUtil.isBlank(content)) {
return content;
}
int i;
char j;
StringBuilder tmp = new StringBuilder();
tmp.ensureCapacity(content.length() * 6);
for (i = 0; i < content.length(); i++) {
j = content.charAt(i);
if (Character.isDigit(j) || Character.isLowerCase(j) || Character.isUpperCase(j)) {
tmp.append(j);
} else if (j < 256) {
tmp.append("%");
if (j < 16) {
tmp.append("0");
}
tmp.append(Integer.toString(j, 16));
} else {
tmp.append("%u");
tmp.append(Integer.toString(j, 16));
}
}
return tmp.toString();
} | java | public static String escape(String content) {
if (StrUtil.isBlank(content)) {
return content;
}
int i;
char j;
StringBuilder tmp = new StringBuilder();
tmp.ensureCapacity(content.length() * 6);
for (i = 0; i < content.length(); i++) {
j = content.charAt(i);
if (Character.isDigit(j) || Character.isLowerCase(j) || Character.isUpperCase(j)) {
tmp.append(j);
} else if (j < 256) {
tmp.append("%");
if (j < 16) {
tmp.append("0");
}
tmp.append(Integer.toString(j, 16));
} else {
tmp.append("%u");
tmp.append(Integer.toString(j, 16));
}
}
return tmp.toString();
} | [
"public",
"static",
"String",
"escape",
"(",
"String",
"content",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"content",
")",
")",
"{",
"return",
"content",
";",
"}",
"int",
"i",
";",
"char",
"j",
";",
"StringBuilder",
"tmp",
"=",
"new",
"St... | Escape编码(Unicode)<br>
该方法不会对 ASCII 字母和数字进行编码,也不会对下面这些 ASCII 标点符号进行编码: * @ - _ + . / 。其他所有的字符都会被转义序列替换。
@param content 被转义的内容
@return 编码后的字符串 | [
"Escape编码(Unicode)<br",
">",
"该方法不会对",
"ASCII",
"字母和数字进行编码,也不会对下面这些",
"ASCII",
"标点符号进行编码:",
"*",
"@",
"-",
"_",
"+",
".",
"/",
"。其他所有的字符都会被转义序列替换。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EscapeUtil.java#L46-L74 | train | Escape the content of a UTF - 8 string. | [
30522,
2270,
10763,
5164,
4019,
1006,
5164,
4180,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
4180,
1007,
1007,
1063,
2709,
4180,
1025,
1065,
20014,
1045,
1025,
25869,
1046,
1025,
5164,
8569,
23891,
2099,
1056,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/net/PortProber.java | PortProber.createAcceptablePort | private static int createAcceptablePort() {
synchronized (random) {
final int FIRST_PORT;
final int LAST_PORT;
int freeAbove = HIGHEST_PORT - ephemeralRangeDetector.getHighestEphemeralPort();
int freeBelow = max(0, ephemeralRangeDetector.getLowestEphemeralPort() - START_OF_USER_PORTS);
if (freeAbove > freeBelow) {
FIRST_PORT = ephemeralRangeDetector.getHighestEphemeralPort();
LAST_PORT = 65535;
} else {
FIRST_PORT = 1024;
LAST_PORT = ephemeralRangeDetector.getLowestEphemeralPort();
}
if (FIRST_PORT == LAST_PORT) {
return FIRST_PORT;
}
if (FIRST_PORT > LAST_PORT) {
throw new UnsupportedOperationException("Could not find ephemeral port to use");
}
final int randomInt = random.nextInt();
final int portWithoutOffset = Math.abs(randomInt % (LAST_PORT - FIRST_PORT + 1));
return portWithoutOffset + FIRST_PORT;
}
} | java | private static int createAcceptablePort() {
synchronized (random) {
final int FIRST_PORT;
final int LAST_PORT;
int freeAbove = HIGHEST_PORT - ephemeralRangeDetector.getHighestEphemeralPort();
int freeBelow = max(0, ephemeralRangeDetector.getLowestEphemeralPort() - START_OF_USER_PORTS);
if (freeAbove > freeBelow) {
FIRST_PORT = ephemeralRangeDetector.getHighestEphemeralPort();
LAST_PORT = 65535;
} else {
FIRST_PORT = 1024;
LAST_PORT = ephemeralRangeDetector.getLowestEphemeralPort();
}
if (FIRST_PORT == LAST_PORT) {
return FIRST_PORT;
}
if (FIRST_PORT > LAST_PORT) {
throw new UnsupportedOperationException("Could not find ephemeral port to use");
}
final int randomInt = random.nextInt();
final int portWithoutOffset = Math.abs(randomInt % (LAST_PORT - FIRST_PORT + 1));
return portWithoutOffset + FIRST_PORT;
}
} | [
"private",
"static",
"int",
"createAcceptablePort",
"(",
")",
"{",
"synchronized",
"(",
"random",
")",
"{",
"final",
"int",
"FIRST_PORT",
";",
"final",
"int",
"LAST_PORT",
";",
"int",
"freeAbove",
"=",
"HIGHEST_PORT",
"-",
"ephemeralRangeDetector",
".",
"getHigh... | Returns a port that is within a probable free range. <p/> Based on the ports in
http://en.wikipedia.org/wiki/Ephemeral_ports, this method stays away from all well-known
ephemeral port ranges, since they can arbitrarily race with the operating system in
allocations. Due to the port-greedy nature of selenium this happens fairly frequently.
Staying within the known safe range increases the probability tests will run green quite
significantly.
@return a random port number | [
"Returns",
"a",
"port",
"that",
"is",
"within",
"a",
"probable",
"free",
"range",
".",
"<p",
"/",
">",
"Based",
"on",
"the",
"ports",
"in",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Ephemeral_ports",
"this",
"method",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/net/PortProber.java#L79-L105 | train | Create an acceptable port number. | [
30522,
2797,
10763,
20014,
3443,
6305,
3401,
22799,
3468,
6442,
1006,
1007,
1063,
25549,
1006,
6721,
1007,
1063,
2345,
20014,
2034,
1035,
3417,
1025,
2345,
20014,
2197,
1035,
3417,
1025,
20014,
2489,
7875,
21818,
1027,
3284,
1035,
3417,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.indexOf | public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value) {
if (fromIndex <= toIndex) {
return firstIndexOf(buffer, fromIndex, toIndex, value);
} else {
return lastIndexOf(buffer, fromIndex, toIndex, value);
}
} | java | public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value) {
if (fromIndex <= toIndex) {
return firstIndexOf(buffer, fromIndex, toIndex, value);
} else {
return lastIndexOf(buffer, fromIndex, toIndex, value);
}
} | [
"public",
"static",
"int",
"indexOf",
"(",
"ByteBuf",
"buffer",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
",",
"byte",
"value",
")",
"{",
"if",
"(",
"fromIndex",
"<=",
"toIndex",
")",
"{",
"return",
"firstIndexOf",
"(",
"buffer",
",",
"fromIndex",
... | The default implementation of {@link ByteBuf#indexOf(int, int, byte)}.
This method is useful when implementing a new buffer type. | [
"The",
"default",
"implementation",
"of",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L375-L381 | train | Gets the index of the specified value in the specified buffer starting from the specified index. | [
30522,
2270,
10763,
20014,
5950,
11253,
1006,
24880,
8569,
2546,
17698,
1010,
20014,
2013,
22254,
10288,
1010,
20014,
2000,
22254,
10288,
1010,
24880,
3643,
1007,
1063,
2065,
1006,
2013,
22254,
10288,
1026,
1027,
2000,
22254,
10288,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.resize | public static <T> T[] resize(T[] buffer, int newSize) {
return resize(buffer, newSize, buffer.getClass().getComponentType());
} | java | public static <T> T[] resize(T[] buffer, int newSize) {
return resize(buffer, newSize, buffer.getClass().getComponentType());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"resize",
"(",
"T",
"[",
"]",
"buffer",
",",
"int",
"newSize",
")",
"{",
"return",
"resize",
"(",
"buffer",
",",
"newSize",
",",
"buffer",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")... | 生成一个新的重新设置大小的数组<br>
新数组的类型为原数组的类型,调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断
@param <T> 数组元素类型
@param buffer 原数组
@param newSize 新的数组大小
@return 调整后的新数组 | [
"生成一个新的重新设置大小的数组<br",
">",
"新数组的类型为原数组的类型,调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L523-L525 | train | Resize the given array to the given size. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
24501,
4697,
1006,
1056,
1031,
1033,
17698,
1010,
20014,
2739,
4697,
1007,
1063,
2709,
24501,
4697,
1006,
17698,
1010,
2739,
4697,
1010,
17698,
1012,
2131,
26266,
1006,
1007,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.newSingleThreadScheduledExecutor | public static InstrumentedScheduledExecutorService newSingleThreadScheduledExecutor(
ThreadFactory threadFactory, MetricRegistry registry) {
return new InstrumentedScheduledExecutorService(
Executors.newSingleThreadScheduledExecutor(threadFactory), registry);
} | java | public static InstrumentedScheduledExecutorService newSingleThreadScheduledExecutor(
ThreadFactory threadFactory, MetricRegistry registry) {
return new InstrumentedScheduledExecutorService(
Executors.newSingleThreadScheduledExecutor(threadFactory), registry);
} | [
"public",
"static",
"InstrumentedScheduledExecutorService",
"newSingleThreadScheduledExecutor",
"(",
"ThreadFactory",
"threadFactory",
",",
"MetricRegistry",
"registry",
")",
"{",
"return",
"new",
"InstrumentedScheduledExecutorService",
"(",
"Executors",
".",
"newSingleThreadSche... | Creates a single-threaded instrumented executor that can schedule commands
to run after a given delay, or to execute periodically. (Note
however that if this single thread terminates due to a failure
during execution prior to shutdown, a new one will take its
place if needed to execute subsequent tasks.) Tasks are
guaranteed to execute sequentially, and no more than one task
will be active at any given time. Unlike the otherwise
equivalent {@code newScheduledThreadPool(1, threadFactory)}
the returned executor is guaranteed not to be reconfigurable to
use additional threads.
@param threadFactory the factory to use when creating new threads
@param registry the {@link MetricRegistry} that will contain the metrics.
@return a newly created scheduled executor
@throws NullPointerException if threadFactory is null
@see Executors#newSingleThreadExecutor(ThreadFactory) | [
"Creates",
"a",
"single",
"-",
"threaded",
"instrumented",
"executor",
"that",
"can",
"schedule",
"commands",
"to",
"run",
"after",
"a",
"given",
"delay",
"or",
"to",
"execute",
"periodically",
".",
"(",
"Note",
"however",
"that",
"if",
"this",
"single",
"th... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L383-L387 | train | Create a new InstrumentedScheduledExecutorService with the given ThreadFactory and MetricRegistry. | [
30522,
2270,
10763,
6602,
2098,
22842,
8566,
3709,
10288,
8586,
16161,
22573,
2099,
7903,
2063,
2739,
2075,
7485,
28362,
19303,
7690,
18696,
10288,
8586,
16161,
2099,
1006,
11689,
21450,
11689,
21450,
1010,
12046,
2890,
24063,
2854,
15584,
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/mining/cluster/Cluster.java | Cluster.set_composite_vector | void set_composite_vector()
{
composite_.clear();
for (Document<K> document : documents_)
{
composite_.add_vector(document.feature());
}
} | java | void set_composite_vector()
{
composite_.clear();
for (Document<K> document : documents_)
{
composite_.add_vector(document.feature());
}
} | [
"void",
"set_composite_vector",
"(",
")",
"{",
"composite_",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Document",
"<",
"K",
">",
"document",
":",
"documents_",
")",
"{",
"composite_",
".",
"add_vector",
"(",
"document",
".",
"feature",
"(",
")",
")",
"... | Add the vectors of all documents to a composite vector. | [
"Add",
"the",
"vectors",
"of",
"all",
"documents",
"to",
"a",
"composite",
"vector",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L42-L49 | train | Sets the composite vector. | [
30522,
11675,
2275,
1035,
12490,
1035,
9207,
1006,
1007,
1063,
12490,
1035,
1012,
3154,
1006,
1007,
1025,
2005,
1006,
6254,
1026,
1047,
1028,
6254,
1024,
5491,
1035,
1007,
1063,
12490,
1035,
1012,
5587,
1035,
9207,
1006,
6254,
1012,
3444,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.add | public static BigDecimal add(Number v1, Number v2) {
return add(new Number[] { v1, v2 });
} | java | public static BigDecimal add(Number v1, Number v2) {
return add(new Number[] { v1, v2 });
} | [
"public",
"static",
"BigDecimal",
"add",
"(",
"Number",
"v1",
",",
"Number",
"v2",
")",
"{",
"return",
"add",
"(",
"new",
"Number",
"[",
"]",
"{",
"v1",
",",
"v2",
"}",
")",
";",
"}"
] | 提供精确的加法运算<br>
如果传入多个值为null或者空,则返回0
@param v1 被加数
@param v2 加数
@return 和 | [
"提供精确的加法运算<br",
">",
"如果传入多个值为null或者空,则返回0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L109-L111 | train | Add two numbers. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
5587,
1006,
2193,
1058,
2487,
1010,
2193,
1058,
2475,
1007,
1063,
2709,
5587,
1006,
2047,
2193,
1031,
1033,
1063,
1058,
2487,
1010,
1058,
2475,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.decodeHexDump | public static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length) {
return StringUtil.decodeHexDump(hexDump, fromIndex, length);
} | java | public static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length) {
return StringUtil.decodeHexDump(hexDump, fromIndex, length);
} | [
"public",
"static",
"byte",
"[",
"]",
"decodeHexDump",
"(",
"CharSequence",
"hexDump",
",",
"int",
"fromIndex",
",",
"int",
"length",
")",
"{",
"return",
"StringUtil",
".",
"decodeHexDump",
"(",
"hexDump",
",",
"fromIndex",
",",
"length",
")",
";",
"}"
] | Decodes part of a string generated by {@link #hexDump(byte[])} | [
"Decodes",
"part",
"of",
"a",
"string",
"generated",
"by",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L158-L160 | train | Decode a hex dump of a sequence of bytes. | [
30522,
2270,
10763,
24880,
1031,
1033,
21933,
25383,
10288,
8566,
8737,
1006,
25869,
3366,
4226,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/resettable/BlockResettableMutableObjectIterator.java | BlockResettableMutableObjectIterator.next | @Override
public T next(T target) throws IOException {
// check for the left over element
if (this.readPhase) {
return getNextRecord(target);
} else {
// writing phase. check for leftover first
if (this.leftOverReturned) {
// get next record
if ((target = this.input.next(target)) != null) {
if (writeNextRecord(target)) {
return target;
} else {
// did not fit into memory, keep as leftover
this.leftOverRecord = this.serializer.copy(target, this.leftOverRecord);
this.leftOverReturned = false;
this.fullWriteBuffer = true;
return null;
}
} else {
this.noMoreBlocks = true;
return null;
}
} else if (this.fullWriteBuffer) {
return null;
} else {
this.leftOverReturned = true;
target = this.serializer.copy(this.leftOverRecord, target);
return target;
}
}
} | java | @Override
public T next(T target) throws IOException {
// check for the left over element
if (this.readPhase) {
return getNextRecord(target);
} else {
// writing phase. check for leftover first
if (this.leftOverReturned) {
// get next record
if ((target = this.input.next(target)) != null) {
if (writeNextRecord(target)) {
return target;
} else {
// did not fit into memory, keep as leftover
this.leftOverRecord = this.serializer.copy(target, this.leftOverRecord);
this.leftOverReturned = false;
this.fullWriteBuffer = true;
return null;
}
} else {
this.noMoreBlocks = true;
return null;
}
} else if (this.fullWriteBuffer) {
return null;
} else {
this.leftOverReturned = true;
target = this.serializer.copy(this.leftOverRecord, target);
return target;
}
}
} | [
"@",
"Override",
"public",
"T",
"next",
"(",
"T",
"target",
")",
"throws",
"IOException",
"{",
"// check for the left over element",
"if",
"(",
"this",
".",
"readPhase",
")",
"{",
"return",
"getNextRecord",
"(",
"target",
")",
";",
"}",
"else",
"{",
"// writ... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/resettable/BlockResettableMutableObjectIterator.java#L74-L105 | train | This method is called to read the next record from the input stream. | [
30522,
1030,
2058,
15637,
2270,
1056,
2279,
1006,
1056,
4539,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
2005,
1996,
2187,
2058,
5783,
2065,
1006,
2023,
1012,
3191,
21890,
3366,
1007,
1063,
30524,
2023,
1012,
7953,
1012,
2279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/functions/SemanticPropUtil.java | SemanticPropUtil.areFieldsCompatible | private static boolean areFieldsCompatible(String sourceField, TypeInformation<?> inType, String targetField,
TypeInformation<?> outType, boolean throwException) {
try {
// get source type information
TypeInformation<?> sourceType = getExpressionTypeInformation(sourceField, inType);
// get target type information
TypeInformation<?> targetType = getExpressionTypeInformation(targetField, outType);
return sourceType.equals(targetType);
} catch (InvalidFieldReferenceException e) {
if (throwException) {
throw e;
} else {
return false;
}
}
} | java | private static boolean areFieldsCompatible(String sourceField, TypeInformation<?> inType, String targetField,
TypeInformation<?> outType, boolean throwException) {
try {
// get source type information
TypeInformation<?> sourceType = getExpressionTypeInformation(sourceField, inType);
// get target type information
TypeInformation<?> targetType = getExpressionTypeInformation(targetField, outType);
return sourceType.equals(targetType);
} catch (InvalidFieldReferenceException e) {
if (throwException) {
throw e;
} else {
return false;
}
}
} | [
"private",
"static",
"boolean",
"areFieldsCompatible",
"(",
"String",
"sourceField",
",",
"TypeInformation",
"<",
"?",
">",
"inType",
",",
"String",
"targetField",
",",
"TypeInformation",
"<",
"?",
">",
"outType",
",",
"boolean",
"throwException",
")",
"{",
"try... | //////////////////// UTIL METHODS /////////////////////////////// | [
"////////////////////",
"UTIL",
"METHODS",
"///////////////////////////////"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/functions/SemanticPropUtil.java#L648-L664 | train | Checks if two fields are compatible. | [
30522,
2797,
10763,
22017,
20898,
2024,
15155,
9006,
24952,
3468,
1006,
5164,
3120,
3790,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
20014,
18863,
1010,
5164,
4539,
3790,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
2041,
13874,
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.flip | public static void flip(File imageFile, File outFile) throws IORuntimeException {
flip(read(imageFile), outFile);
} | java | public static void flip(File imageFile, File outFile) throws IORuntimeException {
flip(read(imageFile), outFile);
} | [
"public",
"static",
"void",
"flip",
"(",
"File",
"imageFile",
",",
"File",
"outFile",
")",
"throws",
"IORuntimeException",
"{",
"flip",
"(",
"read",
"(",
"imageFile",
")",
",",
"outFile",
")",
";",
"}"
] | 水平翻转图像
@param imageFile 图像文件
@param outFile 输出文件
@throws IORuntimeException IO异常
@since 3.2.2 | [
"水平翻转图像"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1070-L1072 | train | Flips the contents of the image file to the destination file. | [
30522,
2270,
10763,
11675,
11238,
1006,
5371,
3746,
8873,
2571,
1010,
5371,
2041,
8873,
2571,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
11238,
1006,
3191,
1006,
3746,
8873,
2571,
1007,
1010,
2041,
8873,
2571,
1007,
1025,
1065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.size | public static long size(File file) {
Assert.notNull(file, "file argument is null !");
if (false == file.exists()) {
throw new IllegalArgumentException(StrUtil.format("File [{}] not exist !", file.getAbsolutePath()));
}
if (file.isDirectory()) {
long size = 0L;
File[] subFiles = file.listFiles();
if (ArrayUtil.isEmpty(subFiles)) {
return 0L;// empty directory
}
for (int i = 0; i < subFiles.length; i++) {
size += size(subFiles[i]);
}
return size;
} else {
return file.length();
}
} | java | public static long size(File file) {
Assert.notNull(file, "file argument is null !");
if (false == file.exists()) {
throw new IllegalArgumentException(StrUtil.format("File [{}] not exist !", file.getAbsolutePath()));
}
if (file.isDirectory()) {
long size = 0L;
File[] subFiles = file.listFiles();
if (ArrayUtil.isEmpty(subFiles)) {
return 0L;// empty directory
}
for (int i = 0; i < subFiles.length; i++) {
size += size(subFiles[i]);
}
return size;
} else {
return file.length();
}
} | [
"public",
"static",
"long",
"size",
"(",
"File",
"file",
")",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"file argument is null !\"",
")",
";",
"if",
"(",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentE... | 计算目录或文件的总大小<br>
当给定对象为文件时,直接调用 {@link File#length()}<br>
当给定对象为目录时,遍历目录下的所有文件和目录,递归计算其大小,求和返回
@param file 目录或文件
@return 总大小,bytes长度 | [
"计算目录或文件的总大小<br",
">",
"当给定对象为文件时,直接调用",
"{",
"@link",
"File#length",
"()",
"}",
"<br",
">",
"当给定对象为目录时,遍历目录下的所有文件和目录,递归计算其大小,求和返回"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L538-L557 | train | Returns the size of the file in bytes. | [
30522,
2270,
10763,
2146,
2946,
1006,
5371,
5371,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
6685,
2003,
19701,
999,
1000,
1007,
1025,
2065,
1006,
6270,
1027,
1027,
5371,
1012,
6526,
1006,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.read | @SuppressWarnings("unchecked")
public <T> List<T> read(int headerRowIndex, int startRowIndex, int endRowIndex, Class<T> beanType) {
checkNotClosed();
final List<Map<String, Object>> mapList = read(headerRowIndex, startRowIndex, endRowIndex);
if (Map.class.isAssignableFrom(beanType)) {
return (List<T>) mapList;
}
final List<T> beanList = new ArrayList<>(mapList.size());
for (Map<String, Object> map : mapList) {
beanList.add(BeanUtil.mapToBean(map, beanType, false));
}
return beanList;
} | java | @SuppressWarnings("unchecked")
public <T> List<T> read(int headerRowIndex, int startRowIndex, int endRowIndex, Class<T> beanType) {
checkNotClosed();
final List<Map<String, Object>> mapList = read(headerRowIndex, startRowIndex, endRowIndex);
if (Map.class.isAssignableFrom(beanType)) {
return (List<T>) mapList;
}
final List<T> beanList = new ArrayList<>(mapList.size());
for (Map<String, Object> map : mapList) {
beanList.add(BeanUtil.mapToBean(map, beanType, false));
}
return beanList;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"read",
"(",
"int",
"headerRowIndex",
",",
"int",
"startRowIndex",
",",
"int",
"endRowIndex",
",",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"checkNot... | 读取Excel为Bean的列表
@param <T> Bean类型
@param headerRowIndex 标题所在行,如果标题行在读取的内容行中间,这行做为数据将忽略,,从0开始计数
@param startRowIndex 起始行(包含,从0开始计数)
@param endRowIndex 读取结束行(包含,从0开始计数)
@param beanType 每行对应Bean的类型
@return Map的列表 | [
"读取Excel为Bean的列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L348-L361 | train | Reads a list of data from the table. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
3191,
1006,
20014,
20346,
10524,
22254,
10288,
1010,
20014,
2707,
10524,
22254,
10288,
1010,
20014,
2203,
10524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/memory/MemoryManager.java | MemoryManager.allocatePages | public void allocatePages(Object owner, List<MemorySegment> target, int numPages)
throws MemoryAllocationException {
// sanity check
if (owner == null) {
throw new IllegalArgumentException("The memory owner must not be null.");
}
// reserve array space, if applicable
if (target instanceof ArrayList) {
((ArrayList<MemorySegment>) target).ensureCapacity(numPages);
}
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// in the case of pre-allocated memory, the 'numNonAllocatedPages' is zero, in the
// lazy case, the 'freeSegments.size()' is zero.
if (numPages > (memoryPool.getNumberOfAvailableMemorySegments() + numNonAllocatedPages)) {
throw new MemoryAllocationException("Could not allocate " + numPages + " pages. Only " +
(memoryPool.getNumberOfAvailableMemorySegments() + numNonAllocatedPages)
+ " pages are remaining.");
}
Set<MemorySegment> segmentsForOwner = allocatedSegments.get(owner);
if (segmentsForOwner == null) {
segmentsForOwner = new HashSet<MemorySegment>(numPages);
allocatedSegments.put(owner, segmentsForOwner);
}
if (isPreAllocated) {
for (int i = numPages; i > 0; i--) {
MemorySegment segment = memoryPool.requestSegmentFromPool(owner);
target.add(segment);
segmentsForOwner.add(segment);
}
}
else {
for (int i = numPages; i > 0; i--) {
MemorySegment segment = memoryPool.allocateNewSegment(owner);
target.add(segment);
segmentsForOwner.add(segment);
}
numNonAllocatedPages -= numPages;
}
}
// -------------------- END CRITICAL SECTION -------------------
} | java | public void allocatePages(Object owner, List<MemorySegment> target, int numPages)
throws MemoryAllocationException {
// sanity check
if (owner == null) {
throw new IllegalArgumentException("The memory owner must not be null.");
}
// reserve array space, if applicable
if (target instanceof ArrayList) {
((ArrayList<MemorySegment>) target).ensureCapacity(numPages);
}
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// in the case of pre-allocated memory, the 'numNonAllocatedPages' is zero, in the
// lazy case, the 'freeSegments.size()' is zero.
if (numPages > (memoryPool.getNumberOfAvailableMemorySegments() + numNonAllocatedPages)) {
throw new MemoryAllocationException("Could not allocate " + numPages + " pages. Only " +
(memoryPool.getNumberOfAvailableMemorySegments() + numNonAllocatedPages)
+ " pages are remaining.");
}
Set<MemorySegment> segmentsForOwner = allocatedSegments.get(owner);
if (segmentsForOwner == null) {
segmentsForOwner = new HashSet<MemorySegment>(numPages);
allocatedSegments.put(owner, segmentsForOwner);
}
if (isPreAllocated) {
for (int i = numPages; i > 0; i--) {
MemorySegment segment = memoryPool.requestSegmentFromPool(owner);
target.add(segment);
segmentsForOwner.add(segment);
}
}
else {
for (int i = numPages; i > 0; i--) {
MemorySegment segment = memoryPool.allocateNewSegment(owner);
target.add(segment);
segmentsForOwner.add(segment);
}
numNonAllocatedPages -= numPages;
}
}
// -------------------- END CRITICAL SECTION -------------------
} | [
"public",
"void",
"allocatePages",
"(",
"Object",
"owner",
",",
"List",
"<",
"MemorySegment",
">",
"target",
",",
"int",
"numPages",
")",
"throws",
"MemoryAllocationException",
"{",
"// sanity check",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"throw",
"new",... | Allocates a set of memory segments from this memory manager. If the memory manager pre-allocated the
segments, they will be taken from the pool of memory segments. Otherwise, they will be allocated
as part of this call.
@param owner The owner to associate with the memory segment, for the fallback release.
@param target The list into which to put the allocated memory pages.
@param numPages The number of pages to allocate.
@throws MemoryAllocationException Thrown, if this memory manager does not have the requested amount
of memory pages any more. | [
"Allocates",
"a",
"set",
"of",
"memory",
"segments",
"from",
"this",
"memory",
"manager",
".",
"If",
"the",
"memory",
"manager",
"pre",
"-",
"allocated",
"the",
"segments",
"they",
"will",
"be",
"taken",
"from",
"the",
"pool",
"of",
"memory",
"segments",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java#L276-L325 | train | Allocate pages from the given owner. | [
30522,
2270,
11675,
2035,
24755,
2618,
13704,
2015,
1006,
4874,
3954,
1010,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
4539,
1010,
20014,
16371,
8737,
13923,
1007,
11618,
3638,
8095,
23909,
10288,
24422,
1063,
1013,
1013,
20039,
4638,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.