repo
stringclasses
11 values
path
stringlengths
41
214
func_name
stringlengths
7
82
original_string
stringlengths
77
11.9k
language
stringclasses
1 value
code
stringlengths
77
11.9k
code_tokens
listlengths
22
1.57k
docstring
stringlengths
2
2.27k
docstring_tokens
listlengths
1
352
sha
stringclasses
11 values
url
stringlengths
129
319
partition
stringclasses
1 value
summary
stringlengths
7
191
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
apache/flink
flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java
FunctionUtils.uncheckedSupplier
public static <T> Supplier<T> uncheckedSupplier(SupplierWithException<T, ?> supplierWithException) { return () -> { T result = null; try { result = supplierWithException.get(); } catch (Throwable t) { ExceptionUtils.rethrow(t); } return result; }; }
java
public static <T> Supplier<T> uncheckedSupplier(SupplierWithException<T, ?> supplierWithException) { return () -> { T result = null; try { result = supplierWithException.get(); } catch (Throwable t) { ExceptionUtils.rethrow(t); } return result; }; }
[ "public", "static", "<", "T", ">", "Supplier", "<", "T", ">", "uncheckedSupplier", "(", "SupplierWithException", "<", "T", ",", "?", ">", "supplierWithException", ")", "{", "return", "(", ")", "->", "{", "T", "result", "=", "null", ";", "try", "{", "re...
Converts a {@link SupplierWithException} into a {@link Supplier} which throws all checked exceptions as unchecked. @param supplierWithException to convert into a {@link Supplier} @return {@link Supplier} which throws all checked exceptions as unchecked.
[ "Converts", "a", "{", "@link", "SupplierWithException", "}", "into", "a", "{", "@link", "Supplier", "}", "which", "throws", "all", "checked", "exceptions", "as", "unchecked", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java#L107-L117
train
Returns a supplier that throws an unchecked exception.
[ 30522, 2270, 10763, 1026, 1056, 1028, 17024, 1026, 1056, 1028, 4895, 5403, 18141, 6342, 9397, 14355, 1006, 17024, 24415, 10288, 24422, 1026, 1056, 1010, 1029, 1028, 17024, 24415, 10288, 24422, 1007, 1063, 2709, 1006, 1007, 1011, 1028, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHybridHashTable.java
LongHybridHashTable.putBuildRow
public void putBuildRow(BinaryRow row) throws IOException { long key = getBuildLongKey(row); final int hashCode = hashLong(key, 0); insertIntoTable(key, hashCode, row); }
java
public void putBuildRow(BinaryRow row) throws IOException { long key = getBuildLongKey(row); final int hashCode = hashLong(key, 0); insertIntoTable(key, hashCode, row); }
[ "public", "void", "putBuildRow", "(", "BinaryRow", "row", ")", "throws", "IOException", "{", "long", "key", "=", "getBuildLongKey", "(", "row", ")", ";", "final", "int", "hashCode", "=", "hashLong", "(", "key", ",", "0", ")", ";", "insertIntoTable", "(", ...
---------------------- interface to join operator ---------------------------------------
[ "----------------------", "interface", "to", "join", "operator", "---------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHybridHashTable.java#L89-L93
train
Put a build row into the build table.
[ 30522, 2270, 11675, 2404, 8569, 4014, 22196, 2860, 1006, 12441, 10524, 5216, 1007, 11618, 22834, 10288, 24422, 1063, 2146, 3145, 1027, 2131, 8569, 4014, 19422, 5063, 14839, 1006, 5216, 1007, 1025, 2345, 20014, 23325, 16044, 1027, 23325, 10052...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java
InboundHttp2ToHttpAdapter.processHeadersEnd
private void processHeadersEnd(ChannelHandlerContext ctx, Http2Stream stream, FullHttpMessage msg, boolean endOfStream) { if (endOfStream) { // Release if the msg from the map is different from the object being forwarded up the pipeline. fireChannelRead(ctx, msg, getMessage(stream) != msg, stream); } else { putMessage(stream, msg); } }
java
private void processHeadersEnd(ChannelHandlerContext ctx, Http2Stream stream, FullHttpMessage msg, boolean endOfStream) { if (endOfStream) { // Release if the msg from the map is different from the object being forwarded up the pipeline. fireChannelRead(ctx, msg, getMessage(stream) != msg, stream); } else { putMessage(stream, msg); } }
[ "private", "void", "processHeadersEnd", "(", "ChannelHandlerContext", "ctx", ",", "Http2Stream", "stream", ",", "FullHttpMessage", "msg", ",", "boolean", "endOfStream", ")", "{", "if", "(", "endOfStream", ")", "{", "// Release if the msg from the map is different from the...
After HTTP/2 headers have been processed by {@link #processHeadersBegin} this method either sends the result up the pipeline or retains the message for future processing. @param ctx The context for which this message has been received @param stream The stream the {@code objAccumulator} corresponds to @param msg The object which represents all headers/data for corresponding to {@code stream} @param endOfStream {@code true} if this is the last event for the stream
[ "After", "HTTP", "/", "2", "headers", "have", "been", "processed", "by", "{", "@link", "#processHeadersBegin", "}", "this", "method", "either", "sends", "the", "result", "up", "the", "pipeline", "or", "retains", "the", "message", "for", "future", "processing",...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java#L220-L228
train
Process the end of headers.
[ 30522, 2797, 11675, 2832, 4974, 2545, 10497, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 8299, 2475, 21422, 5460, 1010, 2440, 11039, 25856, 7834, 3736, 3351, 5796, 2290, 1010, 22017, 20898, 2203, 11253, 21422, 1007, 1063, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java
CLIService.getOperationStatus
@Override public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation(opHandle); /** * If this is a background operation run asynchronously, * we block for a configured duration, before we return * (duration: HIVE_SERVER2_LONG_POLLING_TIMEOUT). * However, if the background operation is complete, we return immediately. */ if (operation.shouldRunAsync()) { HiveConf conf = operation.getParentSession().getHiveConf(); long timeout = HiveConf.getTimeVar(conf, HiveConf.ConfVars.HIVE_SERVER2_LONG_POLLING_TIMEOUT, TimeUnit.MILLISECONDS); try { operation.getBackgroundHandle().get(timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { // No Op, return to the caller since long polling timeout has expired LOG.trace(opHandle + ": Long polling timed out"); } catch (CancellationException e) { // The background operation thread was cancelled LOG.trace(opHandle + ": The background operation was cancelled", e); } catch (ExecutionException e) { // The background operation thread was aborted LOG.warn(opHandle + ": The background operation was aborted", e); } catch (InterruptedException e) { // No op, this thread was interrupted // In this case, the call might return sooner than long polling timeout } } OperationStatus opStatus = operation.getStatus(); LOG.debug(opHandle + ": getOperationStatus()"); return opStatus; }
java
@Override public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation(opHandle); /** * If this is a background operation run asynchronously, * we block for a configured duration, before we return * (duration: HIVE_SERVER2_LONG_POLLING_TIMEOUT). * However, if the background operation is complete, we return immediately. */ if (operation.shouldRunAsync()) { HiveConf conf = operation.getParentSession().getHiveConf(); long timeout = HiveConf.getTimeVar(conf, HiveConf.ConfVars.HIVE_SERVER2_LONG_POLLING_TIMEOUT, TimeUnit.MILLISECONDS); try { operation.getBackgroundHandle().get(timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { // No Op, return to the caller since long polling timeout has expired LOG.trace(opHandle + ": Long polling timed out"); } catch (CancellationException e) { // The background operation thread was cancelled LOG.trace(opHandle + ": The background operation was cancelled", e); } catch (ExecutionException e) { // The background operation thread was aborted LOG.warn(opHandle + ": The background operation was aborted", e); } catch (InterruptedException e) { // No op, this thread was interrupted // In this case, the call might return sooner than long polling timeout } } OperationStatus opStatus = operation.getStatus(); LOG.debug(opHandle + ": getOperationStatus()"); return opStatus; }
[ "@", "Override", "public", "OperationStatus", "getOperationStatus", "(", "OperationHandle", "opHandle", ")", "throws", "HiveSQLException", "{", "Operation", "operation", "=", "sessionManager", ".", "getOperationManager", "(", ")", ".", "getOperation", "(", "opHandle", ...
/* (non-Javadoc) @see org.apache.hive.service.cli.ICLIService#getOperationStatus(org.apache.hive.service.cli.OperationHandle)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L372-L405
train
Get the OperationStatus for the given operation handle.
[ 30522, 1030, 2058, 15637, 2270, 3136, 29336, 2271, 2131, 25918, 10708, 29336, 2271, 1006, 3169, 11774, 2571, 6728, 11774, 2571, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1063, 3169, 3169, 1027, 5219, 24805, 4590, 1012, 2131, 25918, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.intersection
@SafeVarargs public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2, Collection<T>... otherColls) { Collection<T> intersection = intersection(coll1, coll2); if (isEmpty(intersection)) { return intersection; } for (Collection<T> coll : otherColls) { intersection = intersection(intersection, coll); if (isEmpty(intersection)) { return intersection; } } return intersection; }
java
@SafeVarargs public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2, Collection<T>... otherColls) { Collection<T> intersection = intersection(coll1, coll2); if (isEmpty(intersection)) { return intersection; } for (Collection<T> coll : otherColls) { intersection = intersection(intersection, coll); if (isEmpty(intersection)) { return intersection; } } return intersection; }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "intersection", "(", "Collection", "<", "T", ">", "coll1", ",", "Collection", "<", "T", ">", "coll2", ",", "Collection", "<", "T", ">", "...", "otherColls", ")", "{", ...
多个集合的交集<br> 针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最少的个数<br> 例如:集合1:[a, b, c, c, c],集合2:[a, b, c, c]<br> 结果:[a, b, c, c],此结果中只保留了两个c @param <T> 集合元素类型 @param coll1 集合1 @param coll2 集合2 @param otherColls 其它集合 @return 并集的集合,返回 {@link ArrayList}
[ "多个集合的交集<br", ">", "针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最少的个数<br", ">", "例如:集合1:", "[", "a", "b", "c", "c", "c", "]", ",集合2:", "[", "a", "b", "c", "c", "]", "<br", ">", "结果:", "[", "a", "b", "c", "c", "]", ",此结果中只保留了两个c" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L157-L170
train
Returns the intersection of the two collections.
[ 30522, 1030, 3647, 24516, 10623, 2015, 2270, 10763, 1026, 1056, 1028, 3074, 1026, 1056, 1028, 6840, 1006, 3074, 1026, 1056, 1028, 8902, 2140, 2487, 1010, 3074, 1026, 1056, 1028, 8902, 2140, 2475, 1010, 3074, 1026, 1056, 1028, 1012, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java
ClassLoaderFiles.getOrCreateSourceFolder
protected final SourceFolder getOrCreateSourceFolder(String name) { SourceFolder sourceFolder = this.sourceFolders.get(name); if (sourceFolder == null) { sourceFolder = new SourceFolder(name); this.sourceFolders.put(name, sourceFolder); } return sourceFolder; }
java
protected final SourceFolder getOrCreateSourceFolder(String name) { SourceFolder sourceFolder = this.sourceFolders.get(name); if (sourceFolder == null) { sourceFolder = new SourceFolder(name); this.sourceFolders.put(name, sourceFolder); } return sourceFolder; }
[ "protected", "final", "SourceFolder", "getOrCreateSourceFolder", "(", "String", "name", ")", "{", "SourceFolder", "sourceFolder", "=", "this", ".", "sourceFolders", ".", "get", "(", "name", ")", ";", "if", "(", "sourceFolder", "==", "null", ")", "{", "sourceFo...
Get or create a {@link SourceFolder} with the given name. @param name the name of the folder @return an existing or newly added {@link SourceFolder}
[ "Get", "or", "create", "a", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java#L110-L117
train
Gets or creates the SourceFolder with the given name.
[ 30522, 5123, 2345, 3120, 10371, 2121, 2131, 2953, 16748, 8520, 8162, 3401, 10371, 2121, 1006, 5164, 2171, 1007, 1063, 3120, 10371, 2121, 3120, 10371, 2121, 1027, 2023, 1012, 3120, 10371, 2545, 1012, 2131, 1006, 2171, 1007, 1025, 2065, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-system/src/main/java/cn/hutool/system/SystemUtil.java
SystemUtil.getTotalThreadCount
public static int getTotalThreadCount() { ThreadGroup parentThread = Thread.currentThread().getThreadGroup(); while(null != parentThread.getParent()) { parentThread = parentThread.getParent(); } return parentThread.activeCount(); }
java
public static int getTotalThreadCount() { ThreadGroup parentThread = Thread.currentThread().getThreadGroup(); while(null != parentThread.getParent()) { parentThread = parentThread.getParent(); } return parentThread.activeCount(); }
[ "public", "static", "int", "getTotalThreadCount", "(", ")", "{", "ThreadGroup", "parentThread", "=", "Thread", ".", "currentThread", "(", ")", ".", "getThreadGroup", "(", ")", ";", "while", "(", "null", "!=", "parentThread", ".", "getParent", "(", ")", ")", ...
获取总线程数 @return 总线程数
[ "获取总线程数" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L418-L424
train
Returns the total number of threads in the current thread group.
[ 30522, 2270, 10763, 20014, 2131, 3406, 9080, 2705, 16416, 16409, 21723, 1006, 1007, 1063, 11689, 17058, 6687, 2705, 16416, 2094, 1027, 11689, 1012, 2783, 2705, 16416, 2094, 1006, 1007, 1012, 2131, 2705, 16416, 2094, 17058, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/occurrence/PairFrequency.java
PairFrequency.create
public static PairFrequency create(String first, char delimiter ,String second) { PairFrequency pairFrequency = new PairFrequency(first + delimiter + second); pairFrequency.first = first; pairFrequency.delimiter = delimiter; pairFrequency.second = second; return pairFrequency; }
java
public static PairFrequency create(String first, char delimiter ,String second) { PairFrequency pairFrequency = new PairFrequency(first + delimiter + second); pairFrequency.first = first; pairFrequency.delimiter = delimiter; pairFrequency.second = second; return pairFrequency; }
[ "public", "static", "PairFrequency", "create", "(", "String", "first", ",", "char", "delimiter", ",", "String", "second", ")", "{", "PairFrequency", "pairFrequency", "=", "new", "PairFrequency", "(", "first", "+", "delimiter", "+", "second", ")", ";", "pairFre...
构造一个pf @param first @param delimiter @param second @return
[ "构造一个pf" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/occurrence/PairFrequency.java#L57-L64
train
Create PairFrequency object.
[ 30522, 2270, 10763, 3940, 19699, 2063, 4226, 9407, 3443, 1006, 5164, 2034, 1010, 25869, 3972, 27605, 3334, 1010, 5164, 2117, 1007, 1063, 3940, 19699, 2063, 4226, 9407, 3940, 19699, 2063, 4226, 9407, 1027, 2047, 3940, 19699, 2063, 4226, 9407...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java
ShardConsumer.adaptRecordsToRead
private int adaptRecordsToRead(long runLoopTimeNanos, int numRecords, long recordBatchSizeBytes, int maxNumberOfRecordsPerFetch) { if (useAdaptiveReads && numRecords != 0 && runLoopTimeNanos != 0) { long averageRecordSizeBytes = recordBatchSizeBytes / numRecords; // Adjust number of records to fetch from the shard depending on current average record size // to optimize 2 Mb / sec read limits double loopFrequencyHz = 1000000000.0d / runLoopTimeNanos; double bytesPerRead = KINESIS_SHARD_BYTES_PER_SECOND_LIMIT / loopFrequencyHz; maxNumberOfRecordsPerFetch = (int) (bytesPerRead / averageRecordSizeBytes); // Ensure the value is greater than 0 and not more than 10000L maxNumberOfRecordsPerFetch = Math.max(1, Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX)); // Set metrics shardMetricsReporter.setAverageRecordSizeBytes(averageRecordSizeBytes); shardMetricsReporter.setLoopFrequencyHz(loopFrequencyHz); shardMetricsReporter.setBytesPerRead(bytesPerRead); } return maxNumberOfRecordsPerFetch; }
java
private int adaptRecordsToRead(long runLoopTimeNanos, int numRecords, long recordBatchSizeBytes, int maxNumberOfRecordsPerFetch) { if (useAdaptiveReads && numRecords != 0 && runLoopTimeNanos != 0) { long averageRecordSizeBytes = recordBatchSizeBytes / numRecords; // Adjust number of records to fetch from the shard depending on current average record size // to optimize 2 Mb / sec read limits double loopFrequencyHz = 1000000000.0d / runLoopTimeNanos; double bytesPerRead = KINESIS_SHARD_BYTES_PER_SECOND_LIMIT / loopFrequencyHz; maxNumberOfRecordsPerFetch = (int) (bytesPerRead / averageRecordSizeBytes); // Ensure the value is greater than 0 and not more than 10000L maxNumberOfRecordsPerFetch = Math.max(1, Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX)); // Set metrics shardMetricsReporter.setAverageRecordSizeBytes(averageRecordSizeBytes); shardMetricsReporter.setLoopFrequencyHz(loopFrequencyHz); shardMetricsReporter.setBytesPerRead(bytesPerRead); } return maxNumberOfRecordsPerFetch; }
[ "private", "int", "adaptRecordsToRead", "(", "long", "runLoopTimeNanos", ",", "int", "numRecords", ",", "long", "recordBatchSizeBytes", ",", "int", "maxNumberOfRecordsPerFetch", ")", "{", "if", "(", "useAdaptiveReads", "&&", "numRecords", "!=", "0", "&&", "runLoopTi...
Calculates how many records to read each time through the loop based on a target throughput and the measured frequenecy of the loop. @param runLoopTimeNanos The total time of one pass through the loop @param numRecords The number of records of the last read operation @param recordBatchSizeBytes The total batch size of the last read operation @param maxNumberOfRecordsPerFetch The current maxNumberOfRecordsPerFetch
[ "Calculates", "how", "many", "records", "to", "read", "each", "time", "through", "the", "loop", "based", "on", "a", "target", "throughput", "and", "the", "measured", "frequenecy", "of", "the", "loop", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L308-L326
train
Adapt records read from the shard.
[ 30522, 2797, 20014, 15581, 2890, 27108, 5104, 19277, 4215, 1006, 2146, 2448, 4135, 7361, 7292, 7229, 2891, 1010, 20014, 16371, 2213, 2890, 27108, 5104, 1010, 2146, 2501, 14479, 18069, 4697, 3762, 4570, 1010, 20014, 4098, 19172, 5677, 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-core/src/main/java/org/apache/flink/configuration/MemorySize.java
MemorySize.parse
public static MemorySize parse(String text, MemoryUnit defaultUnit) throws IllegalArgumentException { if (!hasUnit(text)) { return parse(text + defaultUnit.getUnits()[0]); } return parse(text); }
java
public static MemorySize parse(String text, MemoryUnit defaultUnit) throws IllegalArgumentException { if (!hasUnit(text)) { return parse(text + defaultUnit.getUnits()[0]); } return parse(text); }
[ "public", "static", "MemorySize", "parse", "(", "String", "text", ",", "MemoryUnit", "defaultUnit", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "hasUnit", "(", "text", ")", ")", "{", "return", "parse", "(", "text", "+", "defaultUnit", "."...
Parses the given string with a default unit. @param text The string to parse. @param defaultUnit specify the default unit. @return The parsed MemorySize. @throws IllegalArgumentException Thrown, if the expression cannot be parsed.
[ "Parses", "the", "given", "string", "with", "a", "default", "unit", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/MemorySize.java#L143-L149
train
Parse a string of size.
[ 30522, 2270, 10763, 3638, 5332, 4371, 11968, 3366, 1006, 5164, 3793, 1010, 3638, 19496, 2102, 12398, 19496, 2102, 1007, 11618, 6206, 2906, 22850, 15781, 2595, 24422, 1063, 2065, 1006, 999, 2038, 19496, 2102, 1006, 3793, 1007, 1007, 1063, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
TaskExecutor.onStop
@Override public CompletableFuture<Void> onStop() { log.info("Stopping TaskExecutor {}.", getAddress()); Throwable throwable = null; if (resourceManagerConnection != null) { resourceManagerConnection.close(); } for (JobManagerConnection jobManagerConnection : jobManagerConnections.values()) { try { disassociateFromJobManager(jobManagerConnection, new FlinkException("The TaskExecutor is shutting down.")); } catch (Throwable t) { throwable = ExceptionUtils.firstOrSuppressed(t, throwable); } } jobManagerHeartbeatManager.stop(); resourceManagerHeartbeatManager.stop(); try { stopTaskExecutorServices(); } catch (Exception e) { throwable = ExceptionUtils.firstOrSuppressed(e, throwable); } if (throwable != null) { return FutureUtils.completedExceptionally(new FlinkException("Error while shutting the TaskExecutor down.", throwable)); } else { log.info("Stopped TaskExecutor {}.", getAddress()); return CompletableFuture.completedFuture(null); } }
java
@Override public CompletableFuture<Void> onStop() { log.info("Stopping TaskExecutor {}.", getAddress()); Throwable throwable = null; if (resourceManagerConnection != null) { resourceManagerConnection.close(); } for (JobManagerConnection jobManagerConnection : jobManagerConnections.values()) { try { disassociateFromJobManager(jobManagerConnection, new FlinkException("The TaskExecutor is shutting down.")); } catch (Throwable t) { throwable = ExceptionUtils.firstOrSuppressed(t, throwable); } } jobManagerHeartbeatManager.stop(); resourceManagerHeartbeatManager.stop(); try { stopTaskExecutorServices(); } catch (Exception e) { throwable = ExceptionUtils.firstOrSuppressed(e, throwable); } if (throwable != null) { return FutureUtils.completedExceptionally(new FlinkException("Error while shutting the TaskExecutor down.", throwable)); } else { log.info("Stopped TaskExecutor {}.", getAddress()); return CompletableFuture.completedFuture(null); } }
[ "@", "Override", "public", "CompletableFuture", "<", "Void", ">", "onStop", "(", ")", "{", "log", ".", "info", "(", "\"Stopping TaskExecutor {}.\"", ",", "getAddress", "(", ")", ")", ";", "Throwable", "throwable", "=", "null", ";", "if", "(", "resourceManage...
Called to shut down the TaskManager. The method closes all TaskManager services.
[ "Called", "to", "shut", "down", "the", "TaskManager", ".", "The", "method", "closes", "all", "TaskManager", "services", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java#L328-L362
train
Stop the TaskExecutor.
[ 30522, 1030, 2058, 15637, 2270, 4012, 10814, 10880, 11263, 11244, 1026, 11675, 1028, 2006, 16033, 2361, 1006, 1007, 1063, 8833, 1012, 18558, 1006, 1000, 7458, 4708, 10288, 8586, 16161, 2099, 1063, 1065, 1012, 1000, 1010, 2131, 4215, 16200, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/metrics/groups/AbstractMetricGroup.java
AbstractMetricGroup.addGroup
@Override public MetricGroup addGroup(int name) { return addGroup(String.valueOf(name), ChildType.GENERIC); }
java
@Override public MetricGroup addGroup(int name) { return addGroup(String.valueOf(name), ChildType.GENERIC); }
[ "@", "Override", "public", "MetricGroup", "addGroup", "(", "int", "name", ")", "{", "return", "addGroup", "(", "String", ".", "valueOf", "(", "name", ")", ",", "ChildType", ".", "GENERIC", ")", ";", "}" ]
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L415-L418
train
Add a metric group with the given name.
[ 30522, 1030, 2058, 15637, 2270, 12046, 17058, 5587, 17058, 1006, 20014, 2171, 1007, 1063, 2709, 5587, 17058, 1006, 5164, 1012, 3643, 11253, 1006, 2171, 1007, 1010, 2775, 13874, 1012, 12391, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.getURL
public static URL getURL(String path, Class<?> clazz) { return ResourceUtil.getResource(path, clazz); }
java
public static URL getURL(String path, Class<?> clazz) { return ResourceUtil.getResource(path, clazz); }
[ "public", "static", "URL", "getURL", "(", "String", "path", ",", "Class", "<", "?", ">", "clazz", ")", "{", "return", "ResourceUtil", ".", "getResource", "(", "path", ",", "clazz", ")", ";", "}" ]
获得URL @param path 相对给定 class所在的路径 @param clazz 指定class @return URL @see ResourceUtil#getResource(String, Class)
[ "获得URL" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L145-L147
train
Get URL for a resource
[ 30522, 2270, 10763, 24471, 2140, 2131, 3126, 2140, 1006, 5164, 4130, 1010, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1007, 1063, 2709, 7692, 21823, 2140, 1012, 2131, 6072, 8162, 3401, 1006, 4130, 1010, 18856, 10936, 2480, 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...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.length
public int length() { int length; if (head < tail) { length = hpackHeaderFields.length - tail + head; } else { length = head - tail; } return length; }
java
public int length() { int length; if (head < tail) { length = hpackHeaderFields.length - tail + head; } else { length = head - tail; } return length; }
[ "public", "int", "length", "(", ")", "{", "int", "length", ";", "if", "(", "head", "<", "tail", ")", "{", "length", "=", "hpackHeaderFields", ".", "length", "-", "tail", "+", "head", ";", "}", "else", "{", "length", "=", "head", "-", "tail", ";", ...
Return the number of header fields in the dynamic table.
[ "Return", "the", "number", "of", "header", "fields", "in", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L56-L64
train
Returns the length of the record.
[ 30522, 2270, 20014, 3091, 1006, 1007, 1063, 20014, 3091, 1025, 2065, 1006, 2132, 1026, 5725, 1007, 1063, 3091, 1027, 6522, 8684, 4974, 2121, 15155, 1012, 3091, 1011, 5725, 1009, 2132, 1025, 1065, 2842, 1063, 3091, 1027, 2132, 1011, 5725, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/StrSpliter.java
StrSpliter.splitToArray
public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty){ return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty)); }
java
public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty){ return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty)); }
[ "public", "static", "String", "[", "]", "splitToArray", "(", "String", "str", ",", "Pattern", "separatorPattern", ",", "int", "limit", ",", "boolean", "isTrim", ",", "boolean", "ignoreEmpty", ")", "{", "return", "toArray", "(", "split", "(", "str", ",", "s...
通过正则切分字符串为字符串数组 @param str 被切分的字符串 @param separatorPattern 分隔符正则{@link Pattern} @param limit 限制分片数 @param isTrim 是否去除切分字符串后每个元素两边的空格 @param ignoreEmpty 是否忽略空串 @return 切分后的集合 @since 3.0.8
[ "通过正则切分字符串为字符串数组" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L453-L455
train
Splits the given string into an array of strings using the given separator pattern.
[ 30522, 2270, 10763, 5164, 1031, 1033, 3975, 3406, 2906, 9447, 1006, 5164, 2358, 2099, 1010, 5418, 19802, 25879, 2953, 4502, 12079, 2078, 1010, 20014, 5787, 1010, 22017, 20898, 21541, 20026, 1010, 22017, 20898, 8568, 6633, 13876, 2100, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(ImageInputStream srcStream, ImageOutputStream destStream, float scale) { scale(read(srcStream), destStream, scale); }
java
public static void scale(ImageInputStream srcStream, ImageOutputStream destStream, float scale) { scale(read(srcStream), destStream, scale); }
[ "public", "static", "void", "scale", "(", "ImageInputStream", "srcStream", ",", "ImageOutputStream", "destStream", ",", "float", "scale", ")", "{", "scale", "(", "read", "(", "srcStream", ")", ",", "destStream", ",", "scale", ")", ";", "}" ]
缩放图像(按比例缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcStream 源图像来源流 @param destStream 缩放后的图像写出到的流 @param scale 缩放比例。比例大于1时为放大,小于1大于0为缩小 @since 3.1.0
[ "缩放图像(按比例缩放)<br", ">", "缩放后默认为jpeg格式,此方法并不关闭流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L101-L103
train
Scales the image from the source stream to the destination stream.
[ 30522, 2270, 10763, 11675, 4094, 1006, 3746, 2378, 18780, 21422, 5034, 6169, 25379, 1010, 3746, 5833, 18780, 21422, 4078, 3215, 25379, 1010, 14257, 4094, 1007, 1063, 4094, 1006, 3191, 1006, 5034, 6169, 25379, 1007, 1010, 4078, 3215, 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...
alibaba/canal
parse/src/main/java/com/alibaba/otter/canal/parse/inbound/EventTransactionBuffer.java
EventTransactionBuffer.checkFreeSlotAt
private boolean checkFreeSlotAt(final long sequence) { final long wrapPoint = sequence - bufferSize; if (wrapPoint > flushSequence.get()) { // 刚好追上一轮 return false; } else { return true; } }
java
private boolean checkFreeSlotAt(final long sequence) { final long wrapPoint = sequence - bufferSize; if (wrapPoint > flushSequence.get()) { // 刚好追上一轮 return false; } else { return true; } }
[ "private", "boolean", "checkFreeSlotAt", "(", "final", "long", "sequence", ")", "{", "final", "long", "wrapPoint", "=", "sequence", "-", "bufferSize", ";", "if", "(", "wrapPoint", ">", "flushSequence", ".", "get", "(", ")", ")", "{", "// 刚好追上一轮", "return", ...
查询是否有空位
[ "查询是否有空位" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/EventTransactionBuffer.java#L131-L138
train
Check if free slot at the given sequence is at the flush sequence.
[ 30522, 2797, 22017, 20898, 4638, 23301, 14540, 17287, 2102, 1006, 2345, 2146, 5537, 1007, 1063, 2345, 2146, 10236, 8400, 1027, 5537, 1011, 17698, 5332, 4371, 1025, 2065, 1006, 10236, 8400, 1028, 13862, 3366, 4226, 5897, 1012, 2131, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java
XmlUtil.readObjectFromXml
public static <T> T readObjectFromXml(String xmlStr) throws IOException { return readObjectFromXml(new InputSource(StrUtil.getReader(xmlStr))); }
java
public static <T> T readObjectFromXml(String xmlStr) throws IOException { return readObjectFromXml(new InputSource(StrUtil.getReader(xmlStr))); }
[ "public", "static", "<", "T", ">", "T", "readObjectFromXml", "(", "String", "xmlStr", ")", "throws", "IOException", "{", "return", "readObjectFromXml", "(", "new", "InputSource", "(", "StrUtil", ".", "getReader", "(", "xmlStr", ")", ")", ")", ";", "}" ]
从XML中读取对象 Reads serialized object from the XML file. @param <T> 对象类型 @param xmlStr XML内容 @return 对象 @throws IOException IO异常 @since 3.2.0
[ "从XML中读取对象", "Reads", "serialized", "object", "from", "the", "XML", "file", "." ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L186-L188
train
Reads an object from an XML string.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 3191, 16429, 20614, 19699, 5358, 2595, 19968, 1006, 5164, 20950, 3367, 2099, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 3191, 16429, 20614, 19699, 5358, 2595, 19968, 1006, 2047, 20407, 8162, 3401...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.insertRecord
public void insertRecord( Object recordBase, long recordOffset, int length, long prefix, boolean prefixIsNull) throws IOException { assert(inMemSorter != null); if (inMemSorter.numRecords() >= numElementsForSpillThreshold) { logger.info("Spilling data because number of spilledRecords crossed the threshold " + numElementsForSpillThreshold); spill(); } growPointerArrayIfNecessary(); int uaoSize = UnsafeAlignedOffset.getUaoSize(); // Need 4 or 8 bytes to store the record length. final int required = length + uaoSize; acquireNewPageIfNecessary(required); final Object base = currentPage.getBaseObject(); final long recordAddress = taskMemoryManager.encodePageNumberAndOffset(currentPage, pageCursor); UnsafeAlignedOffset.putSize(base, pageCursor, length); pageCursor += uaoSize; Platform.copyMemory(recordBase, recordOffset, base, pageCursor, length); pageCursor += length; inMemSorter.insertRecord(recordAddress, prefix, prefixIsNull); }
java
public void insertRecord( Object recordBase, long recordOffset, int length, long prefix, boolean prefixIsNull) throws IOException { assert(inMemSorter != null); if (inMemSorter.numRecords() >= numElementsForSpillThreshold) { logger.info("Spilling data because number of spilledRecords crossed the threshold " + numElementsForSpillThreshold); spill(); } growPointerArrayIfNecessary(); int uaoSize = UnsafeAlignedOffset.getUaoSize(); // Need 4 or 8 bytes to store the record length. final int required = length + uaoSize; acquireNewPageIfNecessary(required); final Object base = currentPage.getBaseObject(); final long recordAddress = taskMemoryManager.encodePageNumberAndOffset(currentPage, pageCursor); UnsafeAlignedOffset.putSize(base, pageCursor, length); pageCursor += uaoSize; Platform.copyMemory(recordBase, recordOffset, base, pageCursor, length); pageCursor += length; inMemSorter.insertRecord(recordAddress, prefix, prefixIsNull); }
[ "public", "void", "insertRecord", "(", "Object", "recordBase", ",", "long", "recordOffset", ",", "int", "length", ",", "long", "prefix", ",", "boolean", "prefixIsNull", ")", "throws", "IOException", "{", "assert", "(", "inMemSorter", "!=", "null", ")", ";", ...
Write a record to the sorter.
[ "Write", "a", "record", "to", "the", "sorter", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L390-L414
train
Insert a record into the record MemorySorter.
[ 30522, 2270, 11675, 19274, 2890, 27108, 2094, 1006, 4874, 2501, 15058, 1010, 2146, 2501, 27475, 3388, 1010, 20014, 3091, 1010, 2146, 17576, 1010, 22017, 20898, 17576, 2483, 11231, 3363, 1007, 11618, 22834, 10288, 24422, 1063, 20865, 1006, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.find
public static int find( MemorySegment[] segments1, int offset1, int numBytes1, MemorySegment[] segments2, int offset2, int numBytes2) { if (numBytes2 == 0) { // quick way 1. return offset1; } if (inFirstSegment(segments1, offset1, numBytes1) && inFirstSegment(segments2, offset2, numBytes2)) { byte first = segments2[0].get(offset2); int end = numBytes1 - numBytes2 + offset1; for (int i = offset1; i <= end; i++) { // quick way 2: equal first byte. if (segments1[0].get(i) == first && segments1[0].equalTo(segments2[0], i, offset2, numBytes2)) { return i; } } return -1; } else { return findInMultiSegments(segments1, offset1, numBytes1, segments2, offset2, numBytes2); } }
java
public static int find( MemorySegment[] segments1, int offset1, int numBytes1, MemorySegment[] segments2, int offset2, int numBytes2) { if (numBytes2 == 0) { // quick way 1. return offset1; } if (inFirstSegment(segments1, offset1, numBytes1) && inFirstSegment(segments2, offset2, numBytes2)) { byte first = segments2[0].get(offset2); int end = numBytes1 - numBytes2 + offset1; for (int i = offset1; i <= end; i++) { // quick way 2: equal first byte. if (segments1[0].get(i) == first && segments1[0].equalTo(segments2[0], i, offset2, numBytes2)) { return i; } } return -1; } else { return findInMultiSegments(segments1, offset1, numBytes1, segments2, offset2, numBytes2); } }
[ "public", "static", "int", "find", "(", "MemorySegment", "[", "]", "segments1", ",", "int", "offset1", ",", "int", "numBytes1", ",", "MemorySegment", "[", "]", "segments2", ",", "int", "offset2", ",", "int", "numBytes2", ")", "{", "if", "(", "numBytes2", ...
Find equal segments2 in segments1. @param segments1 segs to find. @param segments2 sub segs. @return Return the found offset, return -1 if not find.
[ "Find", "equal", "segments2", "in", "segments1", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L1040-L1061
train
Find the index of the first segment in segments1 that is equal to segments2.
[ 30522, 2270, 10763, 20014, 2424, 1006, 3638, 3366, 30524, 2475, 1007, 1063, 2065, 1006, 15903, 17250, 2015, 2475, 1027, 1027, 1014, 1007, 1063, 1013, 1013, 4248, 2126, 1015, 1012, 2709, 16396, 2487, 1025, 1065, 2065, 1006, 1999, 8873, 12096...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java
ExcelBase.getCell
public Cell getCell(int x, int y, boolean isCreateIfNotExist) { final Row row = isCreateIfNotExist ? RowUtil.getOrCreateRow(this.sheet, y) : this.sheet.getRow(y); if (null != row) { return isCreateIfNotExist ? CellUtil.getOrCreateCell(row, x) : row.getCell(x); } return null; }
java
public Cell getCell(int x, int y, boolean isCreateIfNotExist) { final Row row = isCreateIfNotExist ? RowUtil.getOrCreateRow(this.sheet, y) : this.sheet.getRow(y); if (null != row) { return isCreateIfNotExist ? CellUtil.getOrCreateCell(row, x) : row.getCell(x); } return null; }
[ "public", "Cell", "getCell", "(", "int", "x", ",", "int", "y", ",", "boolean", "isCreateIfNotExist", ")", "{", "final", "Row", "row", "=", "isCreateIfNotExist", "?", "RowUtil", ".", "getOrCreateRow", "(", "this", ".", "sheet", ",", "y", ")", ":", "this",...
获取指定坐标单元格,如果isCreateIfNotExist为false,则在单元格不存在时返回<code>null</code> @param x X坐标,从0计数,既列号 @param y Y坐标,从0计数,既行号 @param isCreateIfNotExist 单元格不存在时是否创建 @return {@link Cell} @since 4.0.6
[ "获取指定坐标单元格,如果isCreateIfNotExist为false,则在单元格不存在时返回<code", ">", "null<", "/", "code", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L172-L178
train
Gets the cell at the specified location.
[ 30522, 2270, 3526, 2131, 29109, 2140, 1006, 20014, 1060, 1010, 20014, 1061, 1010, 22017, 20898, 2003, 16748, 3686, 10128, 22074, 9048, 3367, 1007, 1063, 2345, 5216, 5216, 1027, 2003, 16748, 3686, 10128, 22074, 9048, 3367, 1029, 5216, 21823, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java
XmlUtil.readObjectFromXml
public static <T> T readObjectFromXml(File source) throws IOException { return readObjectFromXml(new InputSource(FileUtil.getInputStream(source))); }
java
public static <T> T readObjectFromXml(File source) throws IOException { return readObjectFromXml(new InputSource(FileUtil.getInputStream(source))); }
[ "public", "static", "<", "T", ">", "T", "readObjectFromXml", "(", "File", "source", ")", "throws", "IOException", "{", "return", "readObjectFromXml", "(", "new", "InputSource", "(", "FileUtil", ".", "getInputStream", "(", "source", ")", ")", ")", ";", "}" ]
从XML中读取对象 Reads serialized object from the XML file. @param <T> 对象类型 @param source XML文件 @return 对象 @throws IOException IO异常
[ "从XML中读取对象", "Reads", "serialized", "object", "from", "the", "XML", "file", "." ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L173-L175
train
Reads an object from an XML file.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 3191, 16429, 20614, 19699, 5358, 2595, 19968, 1006, 5371, 3120, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 3191, 16429, 20614, 19699, 5358, 2595, 19968, 1006, 2047, 20407, 8162, 3401, 1006, 5371,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/spargel/ScatterGatherConfiguration.java
ScatterGatherConfiguration.addBroadcastSetForScatterFunction
public void addBroadcastSetForScatterFunction(String name, DataSet<?> data) { this.bcVarsScatter.add(new Tuple2<>(name, data)); }
java
public void addBroadcastSetForScatterFunction(String name, DataSet<?> data) { this.bcVarsScatter.add(new Tuple2<>(name, data)); }
[ "public", "void", "addBroadcastSetForScatterFunction", "(", "String", "name", ",", "DataSet", "<", "?", ">", "data", ")", "{", "this", ".", "bcVarsScatter", ".", "add", "(", "new", "Tuple2", "<>", "(", "name", ",", "data", ")", ")", ";", "}" ]
Adds a data set as a broadcast set to the scatter function. @param name The name under which the broadcast data is available in the scatter function. @param data The data set to be broadcast.
[ "Adds", "a", "data", "set", "as", "a", "broadcast", "set", "to", "the", "scatter", "function", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherConfiguration.java#L61-L63
train
Adds a data set to the scatter function.
[ 30522, 2270, 11675, 5587, 12618, 4215, 10526, 13462, 29278, 15782, 12079, 11263, 27989, 1006, 5164, 2171, 1010, 2951, 13462, 1026, 1029, 1028, 2951, 1007, 1063, 2023, 1012, 4647, 10755, 4757, 11266, 3334, 1012, 5587, 1006, 2047, 10722, 10814,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java
Utils.registerLocalResource
private static LocalResource registerLocalResource( Path remoteRsrcPath, long resourceSize, long resourceModificationTime) { LocalResource localResource = Records.newRecord(LocalResource.class); localResource.setResource(ConverterUtils.getYarnUrlFromURI(remoteRsrcPath.toUri())); localResource.setSize(resourceSize); localResource.setTimestamp(resourceModificationTime); localResource.setType(LocalResourceType.FILE); localResource.setVisibility(LocalResourceVisibility.APPLICATION); return localResource; }
java
private static LocalResource registerLocalResource( Path remoteRsrcPath, long resourceSize, long resourceModificationTime) { LocalResource localResource = Records.newRecord(LocalResource.class); localResource.setResource(ConverterUtils.getYarnUrlFromURI(remoteRsrcPath.toUri())); localResource.setSize(resourceSize); localResource.setTimestamp(resourceModificationTime); localResource.setType(LocalResourceType.FILE); localResource.setVisibility(LocalResourceVisibility.APPLICATION); return localResource; }
[ "private", "static", "LocalResource", "registerLocalResource", "(", "Path", "remoteRsrcPath", ",", "long", "resourceSize", ",", "long", "resourceModificationTime", ")", "{", "LocalResource", "localResource", "=", "Records", ".", "newRecord", "(", "LocalResource", ".", ...
Creates a YARN resource for the remote object at the given location. @param remoteRsrcPath remote location of the resource @param resourceSize size of the resource @param resourceModificationTime last modification time of the resource @return YARN resource
[ "Creates", "a", "YARN", "resource", "for", "the", "remote", "object", "at", "the", "given", "location", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L208-L219
train
Register a local resource.
[ 30522, 2797, 10763, 2334, 6072, 8162, 3401, 4236, 4135, 9289, 6072, 8162, 3401, 1006, 4130, 6556, 2869, 11890, 15069, 1010, 2146, 4219, 4697, 1010, 2146, 7692, 5302, 4305, 10803, 7292, 1007, 1063, 2334, 6072, 8162, 3401, 2334, 6072, 8162, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java
TransitionSystem.transit
void transit(State source, Action act, State target) { int deprel = 0; int[] deprel_inference = new int[]{deprel}; if (ActionUtils.is_shift(act)) { target.shift(source); } else if (ActionUtils.is_left_arc(act, deprel_inference)) { deprel = deprel_inference[0]; target.left_arc(source, deprel); } else if (ActionUtils.is_right_arc(act, deprel_inference)) { deprel = deprel_inference[0]; target.right_arc(source, deprel); } else { System.err.printf("unknown transition in transit: %d-%d", act.name(), act.rel()); } }
java
void transit(State source, Action act, State target) { int deprel = 0; int[] deprel_inference = new int[]{deprel}; if (ActionUtils.is_shift(act)) { target.shift(source); } else if (ActionUtils.is_left_arc(act, deprel_inference)) { deprel = deprel_inference[0]; target.left_arc(source, deprel); } else if (ActionUtils.is_right_arc(act, deprel_inference)) { deprel = deprel_inference[0]; target.right_arc(source, deprel); } else { System.err.printf("unknown transition in transit: %d-%d", act.name(), act.rel()); } }
[ "void", "transit", "(", "State", "source", ",", "Action", "act", ",", "State", "target", ")", "{", "int", "deprel", "=", "0", ";", "int", "[", "]", "deprel_inference", "=", "new", "int", "[", "]", "{", "deprel", "}", ";", "if", "(", "ActionUtils", ...
转移状态 @param source 源状态 @param act 动作 @param target 目标状态
[ "转移状态" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java#L109-L131
train
Transit method.
[ 30522, 11675, 6671, 1006, 2110, 3120, 1010, 2895, 2552, 1010, 2110, 4539, 1007, 1063, 20014, 2139, 28139, 2140, 1027, 1014, 1025, 20014, 1031, 1033, 2139, 28139, 2140, 1035, 28937, 1027, 2047, 20014, 1031, 1033, 1063, 2139, 28139, 2140, 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-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java
Kafka.property
public Kafka property(String key, String value) { Preconditions.checkNotNull(key); Preconditions.checkNotNull(value); if (this.kafkaProperties == null) { this.kafkaProperties = new HashMap<>(); } kafkaProperties.put(key, value); return this; }
java
public Kafka property(String key, String value) { Preconditions.checkNotNull(key); Preconditions.checkNotNull(value); if (this.kafkaProperties == null) { this.kafkaProperties = new HashMap<>(); } kafkaProperties.put(key, value); return this; }
[ "public", "Kafka", "property", "(", "String", "key", ",", "String", "value", ")", "{", "Preconditions", ".", "checkNotNull", "(", "key", ")", ";", "Preconditions", ".", "checkNotNull", "(", "value", ")", ";", "if", "(", "this", ".", "kafkaProperties", "=="...
Adds a configuration properties for the Kafka consumer. @param key property key for the Kafka consumer @param value property value for the Kafka consumer
[ "Adds", "a", "configuration", "properties", "for", "the", "Kafka", "consumer", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java#L113-L121
train
Sets a Kafka property.
[ 30522, 2270, 10556, 24316, 2050, 3200, 1006, 5164, 3145, 1010, 5164, 3643, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 3145, 1007, 1025, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 30524, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.getStrings
private void getStrings(HashSet<String> strHashSet, SearchCondition searchCondition, String searchConditionString, String prefixString, SimpleMDAGNode node) { int transitionSetBegin = node.getTransitionSetBeginIndex(); int onePastTransitionSetEnd = transitionSetBegin + node.getOutgoingTransitionSetSize(); //Traverse all the valid _transition paths beginning from each _transition in transitionTreeMap, inserting the //corresponding Strings in to strHashSet that have the relationship with conditionString denoted by searchCondition for (int i = transitionSetBegin; i < onePastTransitionSetEnd; i++) { SimpleMDAGNode currentNode = mdagDataArray[i]; String newPrefixString = prefixString + currentNode.getLetter(); if (currentNode.isAcceptNode() && searchCondition.satisfiesCondition(newPrefixString, searchConditionString)) strHashSet.add(newPrefixString); //Recursively call this to traverse all the valid _transition paths from currentNode getStrings(strHashSet, searchCondition, searchConditionString, newPrefixString, currentNode); } ///// }
java
private void getStrings(HashSet<String> strHashSet, SearchCondition searchCondition, String searchConditionString, String prefixString, SimpleMDAGNode node) { int transitionSetBegin = node.getTransitionSetBeginIndex(); int onePastTransitionSetEnd = transitionSetBegin + node.getOutgoingTransitionSetSize(); //Traverse all the valid _transition paths beginning from each _transition in transitionTreeMap, inserting the //corresponding Strings in to strHashSet that have the relationship with conditionString denoted by searchCondition for (int i = transitionSetBegin; i < onePastTransitionSetEnd; i++) { SimpleMDAGNode currentNode = mdagDataArray[i]; String newPrefixString = prefixString + currentNode.getLetter(); if (currentNode.isAcceptNode() && searchCondition.satisfiesCondition(newPrefixString, searchConditionString)) strHashSet.add(newPrefixString); //Recursively call this to traverse all the valid _transition paths from currentNode getStrings(strHashSet, searchCondition, searchConditionString, newPrefixString, currentNode); } ///// }
[ "private", "void", "getStrings", "(", "HashSet", "<", "String", ">", "strHashSet", ",", "SearchCondition", "searchCondition", ",", "String", "searchConditionString", ",", "String", "prefixString", ",", "SimpleMDAGNode", "node", ")", "{", "int", "transitionSetBegin", ...
Retrieves Strings corresponding to all valid _transition paths from a given node that satisfy a given condition. @param strHashSet a HashSet of Strings to contain all those in the MDAG satisfying {@code searchCondition} with {@code conditionString} @param searchCondition the SearchCondition enum field describing the type of relationship that Strings contained in the MDAG must have with {@code conditionString} in order to be included in the result set @param searchConditionString the String that all Strings in the MDAG must be related with in the fashion denoted by {@code searchCondition} in order to be included in the result set @param prefixString the String corresponding to the currently traversed _transition path @param node an int denoting the starting index of a SimpleMDAGNode's _transition set in mdagDataArray
[ "Retrieves", "Strings", "corresponding", "to", "all", "valid", "_transition", "paths", "from", "a", "given", "node", "that", "satisfy", "a", "given", "condition", "." ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L892-L911
train
getStrings This method is called recursively to get all the strings from the SimpleMDAGNode that are valid _transition paths starting from the given node and adding them to the given HashSet.
[ 30522, 2797, 11675, 4152, 18886, 3070, 2015, 1006, 23325, 13462, 1026, 5164, 1028, 2358, 25032, 11823, 13462, 1010, 3945, 8663, 20562, 3945, 8663, 20562, 1010, 5164, 3945, 8663, 20562, 3367, 4892, 1010, 5164, 17576, 3367, 4892, 1010, 3722, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
MiniCluster.start
public void start() throws Exception { synchronized (lock) { checkState(!running, "MiniCluster is already running"); LOG.info("Starting Flink Mini Cluster"); LOG.debug("Using configuration {}", miniClusterConfiguration); final Configuration configuration = miniClusterConfiguration.getConfiguration(); final boolean useSingleRpcService = miniClusterConfiguration.getRpcServiceSharing() == RpcServiceSharing.SHARED; try { initializeIOFormatClasses(configuration); LOG.info("Starting Metrics Registry"); metricRegistry = createMetricRegistry(configuration); // bring up all the RPC services LOG.info("Starting RPC Service(s)"); AkkaRpcServiceConfiguration akkaRpcServiceConfig = AkkaRpcServiceConfiguration.fromConfiguration(configuration); final RpcServiceFactory dispatcherResourceManagreComponentRpcServiceFactory; if (useSingleRpcService) { // we always need the 'commonRpcService' for auxiliary calls commonRpcService = createRpcService(akkaRpcServiceConfig, false, null); final CommonRpcServiceFactory commonRpcServiceFactory = new CommonRpcServiceFactory(commonRpcService); taskManagerRpcServiceFactory = commonRpcServiceFactory; dispatcherResourceManagreComponentRpcServiceFactory = commonRpcServiceFactory; } else { // we always need the 'commonRpcService' for auxiliary calls commonRpcService = createRpcService(akkaRpcServiceConfig, true, null); // start a new service per component, possibly with custom bind addresses final String jobManagerBindAddress = miniClusterConfiguration.getJobManagerBindAddress(); final String taskManagerBindAddress = miniClusterConfiguration.getTaskManagerBindAddress(); dispatcherResourceManagreComponentRpcServiceFactory = new DedicatedRpcServiceFactory(akkaRpcServiceConfig, jobManagerBindAddress); taskManagerRpcServiceFactory = new DedicatedRpcServiceFactory(akkaRpcServiceConfig, taskManagerBindAddress); } RpcService metricQueryServiceRpcService = MetricUtils.startMetricsRpcService( configuration, commonRpcService.getAddress()); metricRegistry.startQueryService(metricQueryServiceRpcService, null); ioExecutor = Executors.newFixedThreadPool( Hardware.getNumberCPUCores(), new ExecutorThreadFactory("mini-cluster-io")); haServices = createHighAvailabilityServices(configuration, ioExecutor); blobServer = new BlobServer(configuration, haServices.createBlobStore()); blobServer.start(); heartbeatServices = HeartbeatServices.fromConfiguration(configuration); blobCacheService = new BlobCacheService( configuration, haServices.createBlobStore(), new InetSocketAddress(InetAddress.getLocalHost(), blobServer.getPort()) ); startTaskManagers(); MetricQueryServiceRetriever metricQueryServiceRetriever = new RpcMetricQueryServiceRetriever(metricRegistry.getMetricQueryServiceRpcService()); dispatcherResourceManagerComponents.addAll(createDispatcherResourceManagerComponents( configuration, dispatcherResourceManagreComponentRpcServiceFactory, haServices, blobServer, heartbeatServices, metricRegistry, metricQueryServiceRetriever, new ShutDownFatalErrorHandler() )); resourceManagerLeaderRetriever = haServices.getResourceManagerLeaderRetriever(); dispatcherLeaderRetriever = haServices.getDispatcherLeaderRetriever(); webMonitorLeaderRetrievalService = haServices.getWebMonitorLeaderRetriever(); dispatcherGatewayRetriever = new RpcGatewayRetriever<>( commonRpcService, DispatcherGateway.class, DispatcherId::fromUuid, 20, Time.milliseconds(20L)); resourceManagerGatewayRetriever = new RpcGatewayRetriever<>( commonRpcService, ResourceManagerGateway.class, ResourceManagerId::fromUuid, 20, Time.milliseconds(20L)); webMonitorLeaderRetriever = new LeaderRetriever(); resourceManagerLeaderRetriever.start(resourceManagerGatewayRetriever); dispatcherLeaderRetriever.start(dispatcherGatewayRetriever); webMonitorLeaderRetrievalService.start(webMonitorLeaderRetriever); } catch (Exception e) { // cleanup everything try { close(); } catch (Exception ee) { e.addSuppressed(ee); } throw e; } // create a new termination future terminationFuture = new CompletableFuture<>(); // now officially mark this as running running = true; LOG.info("Flink Mini Cluster started successfully"); } }
java
public void start() throws Exception { synchronized (lock) { checkState(!running, "MiniCluster is already running"); LOG.info("Starting Flink Mini Cluster"); LOG.debug("Using configuration {}", miniClusterConfiguration); final Configuration configuration = miniClusterConfiguration.getConfiguration(); final boolean useSingleRpcService = miniClusterConfiguration.getRpcServiceSharing() == RpcServiceSharing.SHARED; try { initializeIOFormatClasses(configuration); LOG.info("Starting Metrics Registry"); metricRegistry = createMetricRegistry(configuration); // bring up all the RPC services LOG.info("Starting RPC Service(s)"); AkkaRpcServiceConfiguration akkaRpcServiceConfig = AkkaRpcServiceConfiguration.fromConfiguration(configuration); final RpcServiceFactory dispatcherResourceManagreComponentRpcServiceFactory; if (useSingleRpcService) { // we always need the 'commonRpcService' for auxiliary calls commonRpcService = createRpcService(akkaRpcServiceConfig, false, null); final CommonRpcServiceFactory commonRpcServiceFactory = new CommonRpcServiceFactory(commonRpcService); taskManagerRpcServiceFactory = commonRpcServiceFactory; dispatcherResourceManagreComponentRpcServiceFactory = commonRpcServiceFactory; } else { // we always need the 'commonRpcService' for auxiliary calls commonRpcService = createRpcService(akkaRpcServiceConfig, true, null); // start a new service per component, possibly with custom bind addresses final String jobManagerBindAddress = miniClusterConfiguration.getJobManagerBindAddress(); final String taskManagerBindAddress = miniClusterConfiguration.getTaskManagerBindAddress(); dispatcherResourceManagreComponentRpcServiceFactory = new DedicatedRpcServiceFactory(akkaRpcServiceConfig, jobManagerBindAddress); taskManagerRpcServiceFactory = new DedicatedRpcServiceFactory(akkaRpcServiceConfig, taskManagerBindAddress); } RpcService metricQueryServiceRpcService = MetricUtils.startMetricsRpcService( configuration, commonRpcService.getAddress()); metricRegistry.startQueryService(metricQueryServiceRpcService, null); ioExecutor = Executors.newFixedThreadPool( Hardware.getNumberCPUCores(), new ExecutorThreadFactory("mini-cluster-io")); haServices = createHighAvailabilityServices(configuration, ioExecutor); blobServer = new BlobServer(configuration, haServices.createBlobStore()); blobServer.start(); heartbeatServices = HeartbeatServices.fromConfiguration(configuration); blobCacheService = new BlobCacheService( configuration, haServices.createBlobStore(), new InetSocketAddress(InetAddress.getLocalHost(), blobServer.getPort()) ); startTaskManagers(); MetricQueryServiceRetriever metricQueryServiceRetriever = new RpcMetricQueryServiceRetriever(metricRegistry.getMetricQueryServiceRpcService()); dispatcherResourceManagerComponents.addAll(createDispatcherResourceManagerComponents( configuration, dispatcherResourceManagreComponentRpcServiceFactory, haServices, blobServer, heartbeatServices, metricRegistry, metricQueryServiceRetriever, new ShutDownFatalErrorHandler() )); resourceManagerLeaderRetriever = haServices.getResourceManagerLeaderRetriever(); dispatcherLeaderRetriever = haServices.getDispatcherLeaderRetriever(); webMonitorLeaderRetrievalService = haServices.getWebMonitorLeaderRetriever(); dispatcherGatewayRetriever = new RpcGatewayRetriever<>( commonRpcService, DispatcherGateway.class, DispatcherId::fromUuid, 20, Time.milliseconds(20L)); resourceManagerGatewayRetriever = new RpcGatewayRetriever<>( commonRpcService, ResourceManagerGateway.class, ResourceManagerId::fromUuid, 20, Time.milliseconds(20L)); webMonitorLeaderRetriever = new LeaderRetriever(); resourceManagerLeaderRetriever.start(resourceManagerGatewayRetriever); dispatcherLeaderRetriever.start(dispatcherGatewayRetriever); webMonitorLeaderRetrievalService.start(webMonitorLeaderRetriever); } catch (Exception e) { // cleanup everything try { close(); } catch (Exception ee) { e.addSuppressed(ee); } throw e; } // create a new termination future terminationFuture = new CompletableFuture<>(); // now officially mark this as running running = true; LOG.info("Flink Mini Cluster started successfully"); } }
[ "public", "void", "start", "(", ")", "throws", "Exception", "{", "synchronized", "(", "lock", ")", "{", "checkState", "(", "!", "running", ",", "\"MiniCluster is already running\"", ")", ";", "LOG", ".", "info", "(", "\"Starting Flink Mini Cluster\"", ")", ";", ...
Starts the mini cluster, based on the configured properties. @throws Exception This method passes on any exception that occurs during the startup of the mini cluster.
[ "Starts", "the", "mini", "cluster", "based", "on", "the", "configured", "properties", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L250-L365
train
Start the Mini Cluster.
[ 30522, 2270, 11675, 2707, 1006, 1007, 11618, 6453, 1063, 25549, 1006, 5843, 1007, 1063, 14148, 12259, 1006, 999, 2770, 1010, 1000, 7163, 20464, 19966, 2121, 2003, 2525, 2770, 1000, 1007, 1025, 8833, 1012, 18558, 1006, 1000, 3225, 13109, 198...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/type/TypeConverters.java
TypeConverters.createInternalTypeInfoFromInternalType
public static TypeInformation createInternalTypeInfoFromInternalType(InternalType type) { TypeInformation typeInfo = INTERNAL_TYPE_TO_INTERNAL_TYPE_INFO.get(type); if (typeInfo != null) { return typeInfo; } if (type instanceof RowType) { RowType rowType = (RowType) type; return new BaseRowTypeInfo(rowType.getFieldTypes(), rowType.getFieldNames()); } else if (type instanceof ArrayType) { return new BinaryArrayTypeInfo(((ArrayType) type).getElementType()); } else if (type instanceof MapType) { MapType mapType = (MapType) type; return new BinaryMapTypeInfo(mapType.getKeyType(), mapType.getValueType()); } else if (type instanceof DecimalType) { DecimalType decimalType = (DecimalType) type; return new DecimalTypeInfo(decimalType.precision(), decimalType.scale()); } else if (type instanceof GenericType) { GenericType<?> genericType = (GenericType<?>) type; return new BinaryGenericTypeInfo<>(genericType); } else { throw new UnsupportedOperationException("Not support yet: " + type); } }
java
public static TypeInformation createInternalTypeInfoFromInternalType(InternalType type) { TypeInformation typeInfo = INTERNAL_TYPE_TO_INTERNAL_TYPE_INFO.get(type); if (typeInfo != null) { return typeInfo; } if (type instanceof RowType) { RowType rowType = (RowType) type; return new BaseRowTypeInfo(rowType.getFieldTypes(), rowType.getFieldNames()); } else if (type instanceof ArrayType) { return new BinaryArrayTypeInfo(((ArrayType) type).getElementType()); } else if (type instanceof MapType) { MapType mapType = (MapType) type; return new BinaryMapTypeInfo(mapType.getKeyType(), mapType.getValueType()); } else if (type instanceof DecimalType) { DecimalType decimalType = (DecimalType) type; return new DecimalTypeInfo(decimalType.precision(), decimalType.scale()); } else if (type instanceof GenericType) { GenericType<?> genericType = (GenericType<?>) type; return new BinaryGenericTypeInfo<>(genericType); } else { throw new UnsupportedOperationException("Not support yet: " + type); } }
[ "public", "static", "TypeInformation", "createInternalTypeInfoFromInternalType", "(", "InternalType", "type", ")", "{", "TypeInformation", "typeInfo", "=", "INTERNAL_TYPE_TO_INTERNAL_TYPE_INFO", ".", "get", "(", "type", ")", ";", "if", "(", "typeInfo", "!=", "null", "...
Create a internal {@link TypeInformation} from a {@link InternalType}. <p>eg: {@link InternalTypes#STRING} => {@link BinaryStringTypeInfo}. {@link RowType} => {@link BaseRowTypeInfo}.
[ "Create", "a", "internal", "{", "@link", "TypeInformation", "}", "from", "a", "{", "@link", "InternalType", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/type/TypeConverters.java#L194-L217
train
Creates a TypeInformation object from the given type.
[ 30522, 2270, 10763, 2828, 2378, 14192, 3370, 3443, 18447, 11795, 2389, 13874, 2378, 14876, 19699, 20936, 10111, 12789, 24228, 5051, 1006, 4722, 13874, 2828, 1007, 1063, 2828, 2378, 14192, 3370, 2828, 2378, 14876, 1027, 4722, 1035, 2828, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/ClientAuthenticationPacket.java
ClientAuthenticationPacket.toBytes
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 1. write client_flags ByteHelper.writeUnsignedIntLittleEndian(clientCapability, out); // remove // client_interactive // feature // 2. write max_packet_size ByteHelper.writeUnsignedIntLittleEndian(MSC.MAX_PACKET_LENGTH, out); // 3. write charset_number out.write(this.charsetNumber); // 4. write (filler) always 0x00... out.write(new byte[23]); // 5. write (Null-Terminated String) user ByteHelper.writeNullTerminatedString(getUsername(), out); // 6. write (Length Coded Binary) scramble_buff (1 + x bytes) if (StringUtils.isEmpty(getPassword())) { out.write(0x00); } else { try { byte[] encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), scrumbleBuff); ByteHelper.writeBinaryCodedLengthBytes(encryptedPassword, out); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e); } } // 7 . (Null-Terminated String) databasename (optional) if (getDatabaseName() != null) { ByteHelper.writeNullTerminatedString(getDatabaseName(), out); } // 8 . (Null-Terminated String) auth plugin name (optional) if (getAuthPluginName() != null) { ByteHelper.writeNullTerminated(getAuthPluginName(), out); } // end write return out.toByteArray(); }
java
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 1. write client_flags ByteHelper.writeUnsignedIntLittleEndian(clientCapability, out); // remove // client_interactive // feature // 2. write max_packet_size ByteHelper.writeUnsignedIntLittleEndian(MSC.MAX_PACKET_LENGTH, out); // 3. write charset_number out.write(this.charsetNumber); // 4. write (filler) always 0x00... out.write(new byte[23]); // 5. write (Null-Terminated String) user ByteHelper.writeNullTerminatedString(getUsername(), out); // 6. write (Length Coded Binary) scramble_buff (1 + x bytes) if (StringUtils.isEmpty(getPassword())) { out.write(0x00); } else { try { byte[] encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), scrumbleBuff); ByteHelper.writeBinaryCodedLengthBytes(encryptedPassword, out); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e); } } // 7 . (Null-Terminated String) databasename (optional) if (getDatabaseName() != null) { ByteHelper.writeNullTerminatedString(getDatabaseName(), out); } // 8 . (Null-Terminated String) auth plugin name (optional) if (getAuthPluginName() != null) { ByteHelper.writeNullTerminated(getAuthPluginName(), out); } // end write return out.toByteArray(); }
[ "public", "byte", "[", "]", "toBytes", "(", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "// 1. write client_flags", "ByteHelper", ".", "writeUnsignedIntLittleEndian", "(", "clientCapability", "...
<pre> VERSION 4.1 Bytes Name ----- ---- 4 client_flags 4 max_packet_size 1 charset_number 23 (filler) always 0x00... n (Null-Terminated String) user n (Length Coded Binary) scramble_buff (1 + x bytes) n (Null-Terminated String) databasename (optional) n (Null-Terminated String) auth plugin name (optional) </pre> @throws IOException
[ "<pre", ">", "VERSION", "4", ".", "1", "Bytes", "Name", "-----", "----", "4", "client_flags", "4", "max_packet_size", "1", "charset_number", "23", "(", "filler", ")", "always", "0x00", "...", "n", "(", "Null", "-", "Terminated", "String", ")", "user", "n...
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/ClientAuthenticationPacket.java#L50-L86
train
Serialize the entry to a byte array.
[ 30522, 2270, 24880, 1031, 1033, 11291, 4570, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 24880, 2906, 9447, 5833, 18780, 21422, 2041, 1027, 2047, 24880, 2906, 9447, 5833, 18780, 21422, 1006, 1007, 1025, 1013, 1013, 1015, 1012, 4339, 7396, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.fromCollection
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, Class<OUT> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
java
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, Class<OUT> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
[ "public", "<", "OUT", ">", "DataStreamSource", "<", "OUT", ">", "fromCollection", "(", "Iterator", "<", "OUT", ">", "data", ",", "Class", "<", "OUT", ">", "type", ")", "{", "return", "fromCollection", "(", "data", ",", "TypeExtractor", ".", "getForClass", ...
Creates a data stream from the given iterator. <p>Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type class (this is due to the fact that the Java compiler erases the generic type information). <p>Note that this operation will result in a non-parallel data stream source, i.e., a data stream source with a parallelism of one. @param data The iterator of elements to create the data stream from @param type The class of the data produced by the iterator. Must not be a generic class. @param <OUT> The type of the returned data stream @return The data stream representing the elements in the iterator @see #fromCollection(java.util.Iterator, org.apache.flink.api.common.typeinfo.TypeInformation)
[ "Creates", "a", "data", "stream", "from", "the", "given", "iterator", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L840-L842
train
Creates a DataStreamSource from an Iterator of data.
[ 30522, 2270, 1026, 2041, 1028, 2951, 21422, 6499, 3126, 3401, 1026, 2041, 1028, 2013, 26895, 18491, 1006, 2009, 6906, 4263, 1026, 2041, 1028, 30524, 1012, 2131, 29278, 26266, 1006, 2828, 1007, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/api/TableSchema.java
TableSchema.getFieldType
public Optional<TypeInformation<?>> getFieldType(String fieldName) { if (fieldNameToIndex.containsKey(fieldName)) { return Optional.of(fieldTypes[fieldNameToIndex.get(fieldName)]); } return Optional.empty(); }
java
public Optional<TypeInformation<?>> getFieldType(String fieldName) { if (fieldNameToIndex.containsKey(fieldName)) { return Optional.of(fieldTypes[fieldNameToIndex.get(fieldName)]); } return Optional.empty(); }
[ "public", "Optional", "<", "TypeInformation", "<", "?", ">", ">", "getFieldType", "(", "String", "fieldName", ")", "{", "if", "(", "fieldNameToIndex", ".", "containsKey", "(", "fieldName", ")", ")", "{", "return", "Optional", ".", "of", "(", "fieldTypes", ...
Returns the specified type information for the given field name. @param fieldName the name of the field
[ "Returns", "the", "specified", "type", "information", "for", "the", "given", "field", "name", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java#L121-L126
train
Gets the type information for the given field name.
[ 30522, 2270, 11887, 1026, 2828, 2378, 14192, 3370, 1026, 1029, 1028, 1028, 2131, 3790, 13874, 1006, 5164, 2492, 18442, 1007, 1063, 2065, 1006, 2492, 18442, 3406, 22254, 10288, 1012, 3397, 14839, 1006, 2492, 18442, 1007, 1007, 1063, 2709, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http2FrameCodecBuilder.java
Http2FrameCodecBuilder.build
@Override public Http2FrameCodec build() { Http2FrameWriter frameWriter = this.frameWriter; if (frameWriter != null) { // This is to support our tests and will never be executed by the user as frameWriter(...) // is package-private. DefaultHttp2Connection connection = new DefaultHttp2Connection(isServer(), maxReservedStreams()); Long maxHeaderListSize = initialSettings().maxHeaderListSize(); Http2FrameReader frameReader = new DefaultHttp2FrameReader(maxHeaderListSize == null ? new DefaultHttp2HeadersDecoder(true) : new DefaultHttp2HeadersDecoder(true, maxHeaderListSize)); if (frameLogger() != null) { frameWriter = new Http2OutboundFrameLogger(frameWriter, frameLogger()); frameReader = new Http2InboundFrameLogger(frameReader, frameLogger()); } Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(connection, frameWriter); if (encoderEnforceMaxConcurrentStreams()) { encoder = new StreamBufferingEncoder(encoder); } Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(connection, encoder, frameReader, promisedRequestVerifier(), isAutoAckSettingsFrame()); return build(decoder, encoder, initialSettings()); } return super.build(); }
java
@Override public Http2FrameCodec build() { Http2FrameWriter frameWriter = this.frameWriter; if (frameWriter != null) { // This is to support our tests and will never be executed by the user as frameWriter(...) // is package-private. DefaultHttp2Connection connection = new DefaultHttp2Connection(isServer(), maxReservedStreams()); Long maxHeaderListSize = initialSettings().maxHeaderListSize(); Http2FrameReader frameReader = new DefaultHttp2FrameReader(maxHeaderListSize == null ? new DefaultHttp2HeadersDecoder(true) : new DefaultHttp2HeadersDecoder(true, maxHeaderListSize)); if (frameLogger() != null) { frameWriter = new Http2OutboundFrameLogger(frameWriter, frameLogger()); frameReader = new Http2InboundFrameLogger(frameReader, frameLogger()); } Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(connection, frameWriter); if (encoderEnforceMaxConcurrentStreams()) { encoder = new StreamBufferingEncoder(encoder); } Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(connection, encoder, frameReader, promisedRequestVerifier(), isAutoAckSettingsFrame()); return build(decoder, encoder, initialSettings()); } return super.build(); }
[ "@", "Override", "public", "Http2FrameCodec", "build", "(", ")", "{", "Http2FrameWriter", "frameWriter", "=", "this", ".", "frameWriter", ";", "if", "(", "frameWriter", "!=", "null", ")", "{", "// This is to support our tests and will never be executed by the user as fram...
Build a {@link Http2FrameCodec} object.
[ "Build", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodecBuilder.java#L152-L178
train
Build the Http2FrameCodec.
[ 30522, 1030, 2058, 15637, 2270, 8299, 2475, 15643, 16044, 2278, 3857, 1006, 1007, 1063, 8299, 2475, 15643, 15994, 4853, 15994, 1027, 2023, 1012, 4853, 15994, 1025, 2065, 1006, 4853, 15994, 999, 1027, 19701, 1007, 1063, 1013, 1013, 2023, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.setProperty
public static void setProperty(Object bean, String expression, Object value) { BeanPath.create(expression).set(bean, value); }
java
public static void setProperty(Object bean, String expression, Object value) { BeanPath.create(expression).set(bean, value); }
[ "public", "static", "void", "setProperty", "(", "Object", "bean", ",", "String", "expression", ",", "Object", "value", ")", "{", "BeanPath", ".", "create", "(", "expression", ")", ".", "set", "(", "bean", ",", "value", ")", ";", "}" ]
解析Bean中的属性值 @param bean Bean对象,支持Map、List、Collection、Array @param expression 表达式,例如:person.friend[5].name @see BeanPath#get(Object) @since 4.0.6
[ "解析Bean中的属性值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L313-L315
train
Sets the property of the given bean to the given value.
[ 30522, 2270, 10763, 11675, 2275, 21572, 4842, 3723, 1006, 4874, 14068, 1010, 5164, 3670, 1010, 4874, 3643, 1007, 1063, 14068, 15069, 1012, 3443, 1006, 3670, 1007, 1012, 2275, 1006, 14068, 1010, 3643, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.generate
public static File generate(String content, QrConfig config, File targetFile) { final BufferedImage image = generate(content, config); ImgUtil.write(image, targetFile); return targetFile; }
java
public static File generate(String content, QrConfig config, File targetFile) { final BufferedImage image = generate(content, config); ImgUtil.write(image, targetFile); return targetFile; }
[ "public", "static", "File", "generate", "(", "String", "content", ",", "QrConfig", "config", ",", "File", "targetFile", ")", "{", "final", "BufferedImage", "image", "=", "generate", "(", "content", ",", "config", ")", ";", "ImgUtil", ".", "write", "(", "im...
生成二维码到文件,二维码图片格式取决于文件的扩展名 @param content 文本内容 @param config 二维码配置,包括长、宽、边距、颜色等 @param targetFile 目标文件,扩展名决定输出格式 @return 目标文件 @since 4.1.2
[ "生成二维码到文件,二维码图片格式取决于文件的扩展名" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L91-L95
train
Generates a image from the given content and writes it to the given file.
[ 30522, 2270, 10763, 5371, 9699, 1006, 5164, 4180, 1010, 1053, 29566, 2078, 8873, 2290, 9530, 8873, 2290, 1010, 5371, 4539, 8873, 2571, 1007, 1063, 2345, 17698, 2098, 9581, 3351, 3746, 1027, 9699, 1006, 4180, 1010, 9530, 8873, 2290, 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/spark
launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
LauncherServer.registerHandle
synchronized String registerHandle(AbstractAppHandle handle) { String secret = createSecret(); secretToPendingApps.put(secret, handle); return secret; }
java
synchronized String registerHandle(AbstractAppHandle handle) { String secret = createSecret(); secretToPendingApps.put(secret, handle); return secret; }
[ "synchronized", "String", "registerHandle", "(", "AbstractAppHandle", "handle", ")", "{", "String", "secret", "=", "createSecret", "(", ")", ";", "secretToPendingApps", ".", "put", "(", "secret", ",", "handle", ")", ";", "return", "secret", ";", "}" ]
Registers a handle with the server, and returns the secret the child app needs to connect back.
[ "Registers", "a", "handle", "with", "the", "server", "and", "returns", "the", "secret", "the", "child", "app", "needs", "to", "connect", "back", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java#L150-L154
train
Registers a new application handle.
[ 30522, 25549, 5164, 4236, 11774, 2571, 1006, 10061, 29098, 11774, 2571, 5047, 1007, 1063, 5164, 3595, 1027, 9005, 8586, 13465, 1006, 1007, 1025, 3595, 14399, 18537, 29098, 2015, 1012, 2404, 1006, 3595, 1010, 5047, 1007, 1025, 2709, 3595, 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-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.checkConstraint
private void checkConstraint( SqlValidatorTable validatorTable, SqlNode source, RelDataType targetRowType) { final ModifiableViewTable modifiableViewTable = validatorTable.unwrap(ModifiableViewTable.class); if (modifiableViewTable != null && source instanceof SqlCall) { final Table table = modifiableViewTable.unwrap(Table.class); final RelDataType tableRowType = table.getRowType(typeFactory); final List<RelDataTypeField> tableFields = tableRowType.getFieldList(); // Get the mapping from column indexes of the underlying table // to the target columns and view constraints. final Map<Integer, RelDataTypeField> tableIndexToTargetField = SqlValidatorUtil.getIndexToFieldMap(tableFields, targetRowType); final Map<Integer, RexNode> projectMap = RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType, typeFactory); // Determine columns (indexed to the underlying table) that need // to be validated against the view constraint. final ImmutableBitSet targetColumns = ImmutableBitSet.of(tableIndexToTargetField.keySet()); final ImmutableBitSet constrainedColumns = ImmutableBitSet.of(projectMap.keySet()); final ImmutableBitSet constrainedTargetColumns = targetColumns.intersect(constrainedColumns); // Validate insert values against the view constraint. final List<SqlNode> values = ((SqlCall) source).getOperandList(); for (final int colIndex : constrainedTargetColumns.asList()) { final String colName = tableFields.get(colIndex).getName(); final RelDataTypeField targetField = tableIndexToTargetField.get(colIndex); for (SqlNode row : values) { final SqlCall call = (SqlCall) row; final SqlNode sourceValue = call.operand(targetField.getIndex()); final ValidationError validationError = new ValidationError(sourceValue, RESOURCE.viewConstraintNotSatisfied(colName, Util.last(validatorTable.getQualifiedName()))); RelOptUtil.validateValueAgainstConstraint(sourceValue, projectMap.get(colIndex), validationError); } } } }
java
private void checkConstraint( SqlValidatorTable validatorTable, SqlNode source, RelDataType targetRowType) { final ModifiableViewTable modifiableViewTable = validatorTable.unwrap(ModifiableViewTable.class); if (modifiableViewTable != null && source instanceof SqlCall) { final Table table = modifiableViewTable.unwrap(Table.class); final RelDataType tableRowType = table.getRowType(typeFactory); final List<RelDataTypeField> tableFields = tableRowType.getFieldList(); // Get the mapping from column indexes of the underlying table // to the target columns and view constraints. final Map<Integer, RelDataTypeField> tableIndexToTargetField = SqlValidatorUtil.getIndexToFieldMap(tableFields, targetRowType); final Map<Integer, RexNode> projectMap = RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType, typeFactory); // Determine columns (indexed to the underlying table) that need // to be validated against the view constraint. final ImmutableBitSet targetColumns = ImmutableBitSet.of(tableIndexToTargetField.keySet()); final ImmutableBitSet constrainedColumns = ImmutableBitSet.of(projectMap.keySet()); final ImmutableBitSet constrainedTargetColumns = targetColumns.intersect(constrainedColumns); // Validate insert values against the view constraint. final List<SqlNode> values = ((SqlCall) source).getOperandList(); for (final int colIndex : constrainedTargetColumns.asList()) { final String colName = tableFields.get(colIndex).getName(); final RelDataTypeField targetField = tableIndexToTargetField.get(colIndex); for (SqlNode row : values) { final SqlCall call = (SqlCall) row; final SqlNode sourceValue = call.operand(targetField.getIndex()); final ValidationError validationError = new ValidationError(sourceValue, RESOURCE.viewConstraintNotSatisfied(colName, Util.last(validatorTable.getQualifiedName()))); RelOptUtil.validateValueAgainstConstraint(sourceValue, projectMap.get(colIndex), validationError); } } } }
[ "private", "void", "checkConstraint", "(", "SqlValidatorTable", "validatorTable", ",", "SqlNode", "source", ",", "RelDataType", "targetRowType", ")", "{", "final", "ModifiableViewTable", "modifiableViewTable", "=", "validatorTable", ".", "unwrap", "(", "ModifiableViewTabl...
Validates insert values against the constraint of a modifiable view. @param validatorTable Table that may wrap a ModifiableViewTable @param source The values being inserted @param targetRowType The target type for the view
[ "Validates", "insert", "values", "against", "the", "constraint", "of", "a", "modifiable", "view", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4269-L4313
train
Check the constraint.
[ 30522, 2797, 11675, 4638, 8663, 20528, 18447, 1006, 29296, 10175, 8524, 25485, 3085, 9398, 8844, 10880, 1010, 29296, 3630, 3207, 3120, 1010, 2128, 15150, 29336, 18863, 4539, 10524, 13874, 1007, 1063, 2345, 16913, 10128, 19210, 8584, 10880, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.contextClick
public Actions contextClick(WebElement target) { if (isBuildingActions()) { action.addAction(new ContextClickAction(jsonMouse, (Locatable) target)); } return moveInTicks(target, 0, 0).clickInTicks(RIGHT); }
java
public Actions contextClick(WebElement target) { if (isBuildingActions()) { action.addAction(new ContextClickAction(jsonMouse, (Locatable) target)); } return moveInTicks(target, 0, 0).clickInTicks(RIGHT); }
[ "public", "Actions", "contextClick", "(", "WebElement", "target", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "ContextClickAction", "(", "jsonMouse", ",", "(", "Locatable", ")", "target", ")", ")", ...
Performs a context-click at middle of the given element. First performs a mouseMove to the location of the element. @param target Element to move to. @return A self reference.
[ "Performs", "a", "context", "-", "click", "at", "middle", "of", "the", "given", "element", ".", "First", "performs", "a", "mouseMove", "to", "the", "location", "of", "the", "element", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L421-L426
train
Click on the element in the context of the element.
[ 30522, 2270, 4506, 6123, 20464, 6799, 1006, 4773, 12260, 3672, 4539, 1007, 1063, 2065, 1006, 2003, 25820, 18908, 8496, 1006, 1007, 1007, 1063, 2895, 1012, 5587, 18908, 3258, 1006, 2047, 6123, 20464, 6799, 18908, 3258, 1006, 1046, 3385, 2771...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.generateSignature
public static Signature generateSignature(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { try { return Signature.getInstance(generateAlgorithm(asymmetricAlgorithm, digestAlgorithm)); } catch (NoSuchAlgorithmException e) { throw new CryptoException(e); } }
java
public static Signature generateSignature(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { try { return Signature.getInstance(generateAlgorithm(asymmetricAlgorithm, digestAlgorithm)); } catch (NoSuchAlgorithmException e) { throw new CryptoException(e); } }
[ "public", "static", "Signature", "generateSignature", "(", "AsymmetricAlgorithm", "asymmetricAlgorithm", ",", "DigestAlgorithm", "digestAlgorithm", ")", "{", "try", "{", "return", "Signature", ".", "getInstance", "(", "generateAlgorithm", "(", "asymmetricAlgorithm", ",", ...
生成签名对象,仅用于非对称加密 @param asymmetricAlgorithm {@link AsymmetricAlgorithm} 非对称加密算法 @param digestAlgorithm {@link DigestAlgorithm} 摘要算法 @return {@link Signature}
[ "生成签名对象,仅用于非对称加密" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L289-L295
train
Generates a signature using the specified algorithm.
[ 30522, 2270, 10763, 8085, 19421, 23773, 4017, 5397, 1006, 2004, 24335, 12589, 2389, 20255, 8939, 2213, 2004, 24335, 12589, 2389, 20255, 8939, 2213, 1010, 17886, 2389, 20255, 8939, 2213, 17886, 2389, 20255, 8939, 2213, 1007, 1063, 3046, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copy
public static long copy(InputStream in, OutputStream out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { Assert.notNull(in, "InputStream is null !"); Assert.notNull(out, "OutputStream is null !"); if (bufferSize <= 0) { bufferSize = DEFAULT_BUFFER_SIZE; } byte[] buffer = new byte[bufferSize]; if (null != streamProgress) { streamProgress.start(); } long size = 0; try { for (int readSize = -1; (readSize = in.read(buffer)) != EOF;) { out.write(buffer, 0, readSize); size += readSize; out.flush(); if (null != streamProgress) { streamProgress.progress(size); } } } catch (IOException e) { throw new IORuntimeException(e); } if (null != streamProgress) { streamProgress.finish(); } return size; }
java
public static long copy(InputStream in, OutputStream out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { Assert.notNull(in, "InputStream is null !"); Assert.notNull(out, "OutputStream is null !"); if (bufferSize <= 0) { bufferSize = DEFAULT_BUFFER_SIZE; } byte[] buffer = new byte[bufferSize]; if (null != streamProgress) { streamProgress.start(); } long size = 0; try { for (int readSize = -1; (readSize = in.read(buffer)) != EOF;) { out.write(buffer, 0, readSize); size += readSize; out.flush(); if (null != streamProgress) { streamProgress.progress(size); } } } catch (IOException e) { throw new IORuntimeException(e); } if (null != streamProgress) { streamProgress.finish(); } return size; }
[ "public", "static", "long", "copy", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "int", "bufferSize", ",", "StreamProgress", "streamProgress", ")", "throws", "IORuntimeException", "{", "Assert", ".", "notNull", "(", "in", ",", "\"InputStream is null ...
拷贝流 @param in 输入流 @param out 输出流 @param bufferSize 缓存大小 @param streamProgress 进度条 @return 传输的byte数 @throws IORuntimeException IO异常
[ "拷贝流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L160-L188
train
Copies the contents of the specified input stream to the specified output stream using the specified buffer size and stream progress.
[ 30522, 2270, 10763, 2146, 6100, 1006, 20407, 25379, 1999, 1010, 27852, 25379, 2041, 1010, 20014, 17698, 5332, 4371, 1010, 5460, 21572, 17603, 4757, 5460, 21572, 17603, 4757, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 20865, 1012, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java
DualInputOperator.accept
@Override public void accept(Visitor<Operator<?>> visitor) { boolean descend = visitor.preVisit(this); if (descend) { this.input1.accept(visitor); this.input2.accept(visitor); for (Operator<?> c : this.broadcastInputs.values()) { c.accept(visitor); } visitor.postVisit(this); } }
java
@Override public void accept(Visitor<Operator<?>> visitor) { boolean descend = visitor.preVisit(this); if (descend) { this.input1.accept(visitor); this.input2.accept(visitor); for (Operator<?> c : this.broadcastInputs.values()) { c.accept(visitor); } visitor.postVisit(this); } }
[ "@", "Override", "public", "void", "accept", "(", "Visitor", "<", "Operator", "<", "?", ">", ">", "visitor", ")", "{", "boolean", "descend", "=", "visitor", ".", "preVisit", "(", "this", ")", ";", "if", "(", "descend", ")", "{", "this", ".", "input1"...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java#L277-L288
train
Visit this operator.
[ 30522, 1030, 2058, 15637, 2270, 11675, 5138, 1006, 10367, 1026, 6872, 1026, 1029, 1028, 1028, 10367, 1007, 1063, 22017, 20898, 18855, 1027, 10367, 1012, 3653, 11365, 4183, 1006, 2023, 1007, 1025, 2065, 1006, 18855, 1007, 1063, 2023, 1012, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java
Cluster.choose_smartly
void choose_smartly(int ndocs, List<Document> docs) { int siz = size(); double[] closest = new double[siz]; if (siz < ndocs) ndocs = siz; int index, count = 0; index = random.nextInt(siz); // initial center docs.add(documents_.get(index)); ++count; double potential = 0.0; for (int i = 0; i < documents_.size(); i++) { double dist = 1.0 - SparseVector.inner_product(documents_.get(i).feature(), documents_.get(index).feature()); potential += dist; closest[i] = dist; } // choose each center while (count < ndocs) { double randval = random.nextDouble() * potential; for (index = 0; index < documents_.size(); index++) { double dist = closest[index]; if (randval <= dist) break; randval -= dist; } if (index == documents_.size()) index--; docs.add(documents_.get(index)); ++count; double new_potential = 0.0; for (int i = 0; i < documents_.size(); i++) { double dist = 1.0 - SparseVector.inner_product(documents_.get(i).feature(), documents_.get(index).feature()); double min = closest[i]; if (dist < min) { closest[i] = dist; min = dist; } new_potential += min; } potential = new_potential; } }
java
void choose_smartly(int ndocs, List<Document> docs) { int siz = size(); double[] closest = new double[siz]; if (siz < ndocs) ndocs = siz; int index, count = 0; index = random.nextInt(siz); // initial center docs.add(documents_.get(index)); ++count; double potential = 0.0; for (int i = 0; i < documents_.size(); i++) { double dist = 1.0 - SparseVector.inner_product(documents_.get(i).feature(), documents_.get(index).feature()); potential += dist; closest[i] = dist; } // choose each center while (count < ndocs) { double randval = random.nextDouble() * potential; for (index = 0; index < documents_.size(); index++) { double dist = closest[index]; if (randval <= dist) break; randval -= dist; } if (index == documents_.size()) index--; docs.add(documents_.get(index)); ++count; double new_potential = 0.0; for (int i = 0; i < documents_.size(); i++) { double dist = 1.0 - SparseVector.inner_product(documents_.get(i).feature(), documents_.get(index).feature()); double min = closest[i]; if (dist < min) { closest[i] = dist; min = dist; } new_potential += min; } potential = new_potential; } }
[ "void", "choose_smartly", "(", "int", "ndocs", ",", "List", "<", "Document", ">", "docs", ")", "{", "int", "siz", "=", "size", "(", ")", ";", "double", "[", "]", "closest", "=", "new", "double", "[", "siz", "]", ";", "if", "(", "siz", "<", "ndocs...
选取初始质心 @param ndocs 质心数量 @param docs 输出到该列表中
[ "选取初始质心" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L232-L282
train
Choose a single language from the list of documents.
[ 30522, 11675, 5454, 1035, 6047, 2135, 1006, 20014, 1050, 3527, 6169, 1010, 2862, 1026, 6254, 1028, 9986, 2015, 1007, 1063, 20014, 9033, 2480, 1027, 2946, 1006, 1007, 1025, 3313, 1031, 1033, 7541, 1027, 2047, 3313, 1031, 9033, 2480, 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...
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java
AbstractFetcher.emitRecord
protected void emitRecord(T record, KafkaTopicPartitionState<KPH> partitionState, long offset) throws Exception { if (record != null) { if (timestampWatermarkMode == NO_TIMESTAMPS_WATERMARKS) { // fast path logic, in case there are no watermarks // emit the record, using the checkpoint lock to guarantee // atomicity of record emission and offset state update synchronized (checkpointLock) { sourceContext.collect(record); partitionState.setOffset(offset); } } else if (timestampWatermarkMode == PERIODIC_WATERMARKS) { emitRecordWithTimestampAndPeriodicWatermark(record, partitionState, offset, Long.MIN_VALUE); } else { emitRecordWithTimestampAndPunctuatedWatermark(record, partitionState, offset, Long.MIN_VALUE); } } else { // if the record is null, simply just update the offset state for partition synchronized (checkpointLock) { partitionState.setOffset(offset); } } }
java
protected void emitRecord(T record, KafkaTopicPartitionState<KPH> partitionState, long offset) throws Exception { if (record != null) { if (timestampWatermarkMode == NO_TIMESTAMPS_WATERMARKS) { // fast path logic, in case there are no watermarks // emit the record, using the checkpoint lock to guarantee // atomicity of record emission and offset state update synchronized (checkpointLock) { sourceContext.collect(record); partitionState.setOffset(offset); } } else if (timestampWatermarkMode == PERIODIC_WATERMARKS) { emitRecordWithTimestampAndPeriodicWatermark(record, partitionState, offset, Long.MIN_VALUE); } else { emitRecordWithTimestampAndPunctuatedWatermark(record, partitionState, offset, Long.MIN_VALUE); } } else { // if the record is null, simply just update the offset state for partition synchronized (checkpointLock) { partitionState.setOffset(offset); } } }
[ "protected", "void", "emitRecord", "(", "T", "record", ",", "KafkaTopicPartitionState", "<", "KPH", ">", "partitionState", ",", "long", "offset", ")", "throws", "Exception", "{", "if", "(", "record", "!=", "null", ")", "{", "if", "(", "timestampWatermarkMode",...
Emits a record without attaching an existing timestamp to it. <p>Implementation Note: This method is kept brief to be JIT inlining friendly. That makes the fast path efficient, the extended paths are called as separate methods. @param record The record to emit @param partitionState The state of the Kafka partition from which the record was fetched @param offset The offset of the record
[ "Emits", "a", "record", "without", "attaching", "an", "existing", "timestamp", "to", "it", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L353-L376
train
Emits a single record to the source context.
[ 30522, 5123, 11675, 12495, 7913, 27108, 2094, 1006, 1056, 2501, 1010, 10556, 24316, 10610, 24330, 19362, 3775, 9285, 12259, 1026, 1047, 8458, 1028, 13571, 9153, 2618, 1010, 2146, 16396, 1007, 11618, 6453, 1063, 2065, 1006, 2501, 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...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/Entity.java
Entity.parse
public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) { return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue); }
java
public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) { return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue); }
[ "public", "static", "<", "T", ">", "Entity", "parse", "(", "T", "bean", ",", "boolean", "isToUnderlineCase", ",", "boolean", "ignoreNullValue", ")", "{", "return", "create", "(", "null", ")", ".", "parseBean", "(", "bean", ",", "isToUnderlineCase", ",", "i...
将PO对象转为Entity @param <T> Bean对象类型 @param bean Bean对象 @param isToUnderlineCase 是否转换为下划线模式 @param ignoreNullValue 是否忽略值为空的字段 @return Entity
[ "将PO对象转为Entity" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L74-L76
train
Parse a bean into an Entity object.
[ 30522, 2270, 10763, 1026, 1056, 1028, 9178, 11968, 3366, 1006, 1056, 14068, 1010, 22017, 20898, 21541, 28819, 2121, 4179, 18382, 1010, 22017, 20898, 8568, 11231, 3363, 10175, 5657, 1007, 1063, 2709, 3443, 1006, 19701, 1007, 1012, 11968, 3366,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/PoolThreadCache.java
PoolThreadCache.allocateSmall
boolean allocateSmall(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) { return allocate(cacheForSmall(area, normCapacity), buf, reqCapacity); }
java
boolean allocateSmall(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) { return allocate(cacheForSmall(area, normCapacity), buf, reqCapacity); }
[ "boolean", "allocateSmall", "(", "PoolArena", "<", "?", ">", "area", ",", "PooledByteBuf", "<", "?", ">", "buf", ",", "int", "reqCapacity", ",", "int", "normCapacity", ")", "{", "return", "allocate", "(", "cacheForSmall", "(", "area", ",", "normCapacity", ...
Try to allocate a small buffer out of the cache. Returns {@code true} if successful {@code false} otherwise
[ "Try", "to", "allocate", "a", "small", "buffer", "out", "of", "the", "cache", ".", "Returns", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolThreadCache.java#L172-L174
train
Allocate a small block of data from the pool.
[ 30522, 22017, 20898, 2035, 24755, 4570, 9067, 2140, 1006, 4770, 12069, 2532, 1026, 1029, 1028, 2181, 1010, 19107, 18939, 17250, 8569, 2546, 1026, 1029, 1028, 20934, 2546, 1010, 20014, 2128, 4160, 17695, 6305, 3012, 1010, 20014, 13373, 17695, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
LogBuffer.consume
public final LogBuffer consume(final int len) { if (limit > len) { limit -= len; origin += len; position = origin; return this; } else if (limit == len) { limit = 0; origin = 0; position = 0; return this; } else { /* Should not happen. */ throw new IllegalArgumentException("limit excceed: " + len); } }
java
public final LogBuffer consume(final int len) { if (limit > len) { limit -= len; origin += len; position = origin; return this; } else if (limit == len) { limit = 0; origin = 0; position = 0; return this; } else { /* Should not happen. */ throw new IllegalArgumentException("limit excceed: " + len); } }
[ "public", "final", "LogBuffer", "consume", "(", "final", "int", "len", ")", "{", "if", "(", "limit", ">", "len", ")", "{", "limit", "-=", "len", ";", "origin", "+=", "len", ";", "position", "=", "origin", ";", "return", "this", ";", "}", "else", "i...
Consume this buffer, moving origin and position. @param len The consume distance @return This buffer
[ "Consume", "this", "buffer", "moving", "origin", "and", "position", "." ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L128-L143
train
Consume len bytes from this buffer.
[ 30522, 2270, 2345, 8833, 8569, 12494, 16678, 1006, 2345, 20014, 18798, 1007, 1063, 2065, 1006, 5787, 1028, 18798, 1007, 1063, 5787, 1011, 1027, 18798, 1025, 4761, 1009, 1027, 18798, 1025, 2597, 1027, 4761, 1025, 2709, 2023, 1025, 1065, 2842...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.copy
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
java
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
[ "private", "static", "void", "copy", "(", "ZipFile", "zipFile", ",", "ZipEntry", "zipEntry", ",", "File", "outItemFile", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=...
从Zip文件流中拷贝文件出来 @param zipFile Zip文件 @param zipEntry zip文件中的子文件 @param outItemFile 输出到的文件 @throws IOException IO异常
[ "从Zip文件流中拷贝文件出来" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L905-L916
train
Copy the contents of the specified zip entry to the specified output item file.
[ 30522, 2797, 10763, 11675, 6100, 1006, 14101, 8873, 2571, 14101, 8873, 2571, 1010, 14101, 4765, 2854, 14101, 4765, 2854, 1010, 5371, 2041, 4221, 2213, 8873, 2571, 1007, 11618, 22834, 10288, 24422, 1063, 20407, 25379, 1999, 1027, 19701, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java
FlinkZooKeeperQuorumPeer.runFlinkZkQuorumPeer
public static void runFlinkZkQuorumPeer(String zkConfigFile, int peerId) throws Exception { Properties zkProps = new Properties(); try (InputStream inStream = new FileInputStream(new File(zkConfigFile))) { zkProps.load(inStream); } LOG.info("Configuration: " + zkProps); // Set defaults for required properties setRequiredProperties(zkProps); // Write peer id to myid file writeMyIdToDataDir(zkProps, peerId); // The myid file needs to be written before creating the instance. Otherwise, this // will fail. QuorumPeerConfig conf = new QuorumPeerConfig(); conf.parseProperties(zkProps); if (conf.isDistributed()) { // Run quorum peer LOG.info("Running distributed ZooKeeper quorum peer (total peers: {}).", conf.getServers().size()); QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(conf); } else { // Run standalone LOG.info("Running standalone ZooKeeper quorum peer."); ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig sc = new ServerConfig(); sc.readFrom(conf); zk.runFromConfig(sc); } }
java
public static void runFlinkZkQuorumPeer(String zkConfigFile, int peerId) throws Exception { Properties zkProps = new Properties(); try (InputStream inStream = new FileInputStream(new File(zkConfigFile))) { zkProps.load(inStream); } LOG.info("Configuration: " + zkProps); // Set defaults for required properties setRequiredProperties(zkProps); // Write peer id to myid file writeMyIdToDataDir(zkProps, peerId); // The myid file needs to be written before creating the instance. Otherwise, this // will fail. QuorumPeerConfig conf = new QuorumPeerConfig(); conf.parseProperties(zkProps); if (conf.isDistributed()) { // Run quorum peer LOG.info("Running distributed ZooKeeper quorum peer (total peers: {}).", conf.getServers().size()); QuorumPeerMain qp = new QuorumPeerMain(); qp.runFromConfig(conf); } else { // Run standalone LOG.info("Running standalone ZooKeeper quorum peer."); ZooKeeperServerMain zk = new ZooKeeperServerMain(); ServerConfig sc = new ServerConfig(); sc.readFrom(conf); zk.runFromConfig(sc); } }
[ "public", "static", "void", "runFlinkZkQuorumPeer", "(", "String", "zkConfigFile", ",", "int", "peerId", ")", "throws", "Exception", "{", "Properties", "zkProps", "=", "new", "Properties", "(", ")", ";", "try", "(", "InputStream", "inStream", "=", "new", "File...
Runs a ZooKeeper {@link QuorumPeer} if further peers are configured or a single {@link ZooKeeperServer} if no further peers are configured. @param zkConfigFile ZooKeeper config file 'zoo.cfg' @param peerId ID for the 'myid' file
[ "Runs", "a", "ZooKeeper", "{", "@link", "QuorumPeer", "}", "if", "further", "peers", "are", "configured", "or", "a", "single", "{", "@link", "ZooKeeperServer", "}", "if", "no", "further", "peers", "are", "configured", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java#L96-L134
train
Run the Flink ZooKeeper quorum peer.
[ 30522, 2270, 10763, 11675, 2448, 10258, 19839, 2480, 2243, 28940, 20527, 28084, 2099, 1006, 5164, 1062, 2243, 8663, 8873, 25708, 9463, 1010, 20014, 8152, 3593, 1007, 11618, 6453, 1063, 5144, 1062, 2243, 21572, 4523, 1027, 2047, 5144, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java
AbstractServerBase.createQueryExecutor
private ExecutorService createQueryExecutor() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("Flink " + getServerName() + " Thread %d") .build(); return Executors.newFixedThreadPool(numQueryThreads, threadFactory); }
java
private ExecutorService createQueryExecutor() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("Flink " + getServerName() + " Thread %d") .build(); return Executors.newFixedThreadPool(numQueryThreads, threadFactory); }
[ "private", "ExecutorService", "createQueryExecutor", "(", ")", "{", "ThreadFactory", "threadFactory", "=", "new", "ThreadFactoryBuilder", "(", ")", ".", "setDaemon", "(", "true", ")", ".", "setNameFormat", "(", "\"Flink \"", "+", "getServerName", "(", ")", "+", ...
Creates a thread pool for the query execution. @return Thread pool for query execution
[ "Creates", "a", "thread", "pool", "for", "the", "query", "execution", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java#L143-L149
train
Create a query executor.
[ 30522, 2797, 4654, 8586, 16161, 22573, 2099, 7903, 2063, 3443, 4226, 2854, 10288, 8586, 16161, 2099, 1006, 1007, 1063, 11689, 21450, 11689, 21450, 1027, 2047, 11689, 21450, 8569, 23891, 2099, 1006, 1007, 1012, 2275, 6858, 8202, 1006, 2995, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TextSimilarity.java
TextSimilarity.similar
public static String similar(String strA, String strB, int scale) { return NumberUtil.formatPercent(similar(strA, strB), scale); }
java
public static String similar(String strA, String strB, int scale) { return NumberUtil.formatPercent(similar(strA, strB), scale); }
[ "public", "static", "String", "similar", "(", "String", "strA", ",", "String", "strB", ",", "int", "scale", ")", "{", "return", "NumberUtil", ".", "formatPercent", "(", "similar", "(", "strA", ",", "strB", ")", ",", "scale", ")", ";", "}" ]
计算相似度百分比 @param strA 字符串1 @param strB 字符串2 @param scale 保留小数 @return 百分比
[ "计算相似度百分比" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L45-L47
train
Returns the percent of similar strings.
[ 30522, 2270, 10763, 5164, 2714, 1006, 5164, 2358, 2527, 1010, 5164, 2358, 15185, 1010, 20014, 4094, 1007, 1063, 2709, 2193, 21823, 2140, 1012, 4289, 4842, 13013, 1006, 2714, 1006, 2358, 2527, 1010, 2358, 15185, 1007, 1010, 4094, 1007, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException { scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor); }
java
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException { scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor); }
[ "public", "static", "void", "scale", "(", "InputStream", "srcStream", ",", "OutputStream", "destStream", ",", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "throws", "IORuntimeException", "{", "scale", "(", "read", "(", "srcStream", ")...
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcStream 源图像流 @param destStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式,此方法并不关闭流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L199-L201
train
Scales the image from srcStream to destStream using the specified color.
[ 30522, 2270, 10763, 11675, 4094, 1006, 20407, 25379, 5034, 6169, 25379, 1010, 27852, 25379, 4078, 3215, 25379, 1010, 20014, 9381, 1010, 20014, 4578, 1010, 3609, 4964, 18717, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 4094, 1006, 319...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java
CharArrayBuffer.substring
public String substring(final int beginIndex, final int endIndex) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex); } if (endIndex > this.len) { throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len); } if (beginIndex > endIndex) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex); } return new String(this.array, beginIndex, endIndex - beginIndex); }
java
public String substring(final int beginIndex, final int endIndex) { if (beginIndex < 0) { throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex); } if (endIndex > this.len) { throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len); } if (beginIndex > endIndex) { throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex); } return new String(this.array, beginIndex, endIndex - beginIndex); }
[ "public", "String", "substring", "(", "final", "int", "beginIndex", ",", "final", "int", "endIndex", ")", "{", "if", "(", "beginIndex", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Negative beginIndex: \"", "+", "beginIndex", ")", "...
Returns a substring of this buffer. The substring begins at the specified {@code beginIndex} and extends to the character at index {@code endIndex - 1}. @param beginIndex the beginning index, inclusive. @param endIndex the ending index, exclusive. @return the specified substring. @throws StringIndexOutOfBoundsException if the {@code beginIndex} is negative, or {@code endIndex} is larger than the length of this buffer, or {@code beginIndex} is larger than {@code endIndex}.
[ "Returns", "a", "substring", "of", "this", "buffer", ".", "The", "substring", "begins", "at", "the", "specified", "{", "@code", "beginIndex", "}", "and", "extends", "to", "the", "character", "at", "index", "{", "@code", "endIndex", "-", "1", "}", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L419-L430
train
Gets a substring from this string.
[ 30522, 2270, 5164, 4942, 3367, 4892, 1006, 2345, 20014, 4088, 22254, 10288, 1010, 2345, 20014, 2203, 22254, 10288, 1007, 1063, 2065, 1006, 4088, 22254, 10288, 1026, 1014, 1007, 1063, 5466, 2047, 5950, 5833, 11253, 15494, 3366, 2595, 24422, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RedissonBoundedBlockingQueue.java
RedissonBoundedBlockingQueue.poll
@Override public V poll(long timeout, TimeUnit unit) throws InterruptedException { return get(pollAsync(timeout, unit)); }
java
@Override public V poll(long timeout, TimeUnit unit) throws InterruptedException { return get(pollAsync(timeout, unit)); }
[ "@", "Override", "public", "V", "poll", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "return", "get", "(", "pollAsync", "(", "timeout", ",", "unit", ")", ")", ";", "}" ]
/* (non-Javadoc) @see java.util.concurrent.BlockingQueue#poll(long, java.util.concurrent.TimeUnit)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
d3acc0249b2d5d658d36d99e2c808ce49332ea44
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java#L211-L214
train
Polls for a single element.
[ 30522, 1030, 2058, 15637, 2270, 1058, 8554, 1006, 2146, 2051, 5833, 1010, 2051, 19496, 2102, 3131, 1007, 11618, 7153, 10288, 24422, 1063, 2709, 2131, 1006, 8554, 3022, 6038, 2278, 1006, 2051, 5833, 1010, 3131, 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...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/operators/DataSource.java
DataSource.translateToDataFlow
protected GenericDataSourceBase<OUT, ?> translateToDataFlow() { String name = this.name != null ? this.name : "at " + dataSourceLocationName + " (" + inputFormat.getClass().getName() + ")"; if (name.length() > 150) { name = name.substring(0, 150); } @SuppressWarnings({"unchecked", "rawtypes"}) GenericDataSourceBase<OUT, ?> source = new GenericDataSourceBase(this.inputFormat, new OperatorInformation<OUT>(getType()), name); source.setParallelism(parallelism); if (this.parameters != null) { source.getParameters().addAll(this.parameters); } if (this.splitDataProperties != null) { source.setSplitDataProperties(this.splitDataProperties); } return source; }
java
protected GenericDataSourceBase<OUT, ?> translateToDataFlow() { String name = this.name != null ? this.name : "at " + dataSourceLocationName + " (" + inputFormat.getClass().getName() + ")"; if (name.length() > 150) { name = name.substring(0, 150); } @SuppressWarnings({"unchecked", "rawtypes"}) GenericDataSourceBase<OUT, ?> source = new GenericDataSourceBase(this.inputFormat, new OperatorInformation<OUT>(getType()), name); source.setParallelism(parallelism); if (this.parameters != null) { source.getParameters().addAll(this.parameters); } if (this.splitDataProperties != null) { source.setSplitDataProperties(this.splitDataProperties); } return source; }
[ "protected", "GenericDataSourceBase", "<", "OUT", ",", "?", ">", "translateToDataFlow", "(", ")", "{", "String", "name", "=", "this", ".", "name", "!=", "null", "?", "this", ".", "name", ":", "\"at \"", "+", "dataSourceLocationName", "+", "\" (\"", "+", "i...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSource.java#L126-L143
train
Translate this data source to a data flow.
[ 30522, 5123, 12391, 2850, 10230, 8162, 3401, 15058, 1026, 2041, 1010, 1029, 1028, 17637, 3406, 2850, 2696, 12314, 1006, 1007, 1063, 5164, 2171, 1027, 2023, 1012, 2171, 999, 1027, 19701, 1029, 2023, 1012, 2171, 1024, 1000, 2012, 1000, 1009, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.zlib
public static byte[] zlib(File file, int level) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(file); return zlib(in, level, (int)file.length()); } finally { IoUtil.close(in); } }
java
public static byte[] zlib(File file, int level) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(file); return zlib(in, level, (int)file.length()); } finally { IoUtil.close(in); } }
[ "public", "static", "byte", "[", "]", "zlib", "(", "File", "file", ",", "int", "level", ")", "{", "BufferedInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "FileUtil", ".", "getInputStream", "(", "file", ")", ";", "return", "zlib", "(", "...
Zlib压缩文件 @param file 被压缩的文件 @param level 压缩级别 @return 压缩后的字节流 @since 4.1.4
[ "Zlib压缩文件" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L641-L649
train
Returns a zlib - compressed byte array of the given file.
[ 30522, 2270, 10763, 24880, 1031, 1033, 1062, 29521, 1006, 5371, 5371, 1010, 20014, 2504, 1007, 1063, 17698, 2098, 2378, 18780, 21422, 1999, 1027, 19701, 1025, 3046, 1063, 1999, 1027, 5371, 21823, 2140, 1012, 2131, 2378, 18780, 21422, 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/dependency/nnparser/NeuralNetworkParser.java
NeuralNetworkParser.load
public boolean load(String path) { String binPath = path + Predefine.BIN_EXT; if (load(ByteArrayStream.createByteArrayStream(binPath))) return true; if (!loadTxt(path)) return false; try { logger.info("正在缓存" + binPath); DataOutputStream out = new DataOutputStream(IOUtil.newOutputStream(binPath)); save(out); out.close(); } catch (Exception e) { logger.warning("缓存" + binPath + "失败:\n" + TextUtility.exceptionToString(e)); } return true; }
java
public boolean load(String path) { String binPath = path + Predefine.BIN_EXT; if (load(ByteArrayStream.createByteArrayStream(binPath))) return true; if (!loadTxt(path)) return false; try { logger.info("正在缓存" + binPath); DataOutputStream out = new DataOutputStream(IOUtil.newOutputStream(binPath)); save(out); out.close(); } catch (Exception e) { logger.warning("缓存" + binPath + "失败:\n" + TextUtility.exceptionToString(e)); } return true; }
[ "public", "boolean", "load", "(", "String", "path", ")", "{", "String", "binPath", "=", "path", "+", "Predefine", ".", "BIN_EXT", ";", "if", "(", "load", "(", "ByteArrayStream", ".", "createByteArrayStream", "(", "binPath", ")", ")", ")", "return", "true",...
加载parser模型 @param path @return
[ "加载parser模型" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L129-L147
train
Load a single SECTYPE file.
[ 30522, 2270, 22017, 20898, 7170, 1006, 5164, 4130, 1007, 1063, 5164, 8026, 15069, 1027, 4130, 1009, 3653, 3207, 23460, 1012, 8026, 1035, 4654, 2102, 1025, 2065, 1006, 7170, 1006, 24880, 2906, 9447, 21422, 1012, 3443, 3762, 27058, 11335, 272...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java
RollingSink.shouldRoll
private boolean shouldRoll() throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!isWriterOpen) { shouldRoll = true; LOG.debug("RollingSink {} starting new initial bucket. ", subtaskIndex); } if (bucketer.shouldStartNewBucket(new Path(basePath), currentBucketDirectory)) { shouldRoll = true; LOG.debug("RollingSink {} starting new bucket because {} said we should. ", subtaskIndex, bucketer); // we will retrieve a new bucket base path in openNewPartFile so reset the part counter partCounter = 0; } if (isWriterOpen) { long writePosition = writer.getPos(); if (isWriterOpen && writePosition > batchSize) { shouldRoll = true; LOG.debug( "RollingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } } return shouldRoll; }
java
private boolean shouldRoll() throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!isWriterOpen) { shouldRoll = true; LOG.debug("RollingSink {} starting new initial bucket. ", subtaskIndex); } if (bucketer.shouldStartNewBucket(new Path(basePath), currentBucketDirectory)) { shouldRoll = true; LOG.debug("RollingSink {} starting new bucket because {} said we should. ", subtaskIndex, bucketer); // we will retrieve a new bucket base path in openNewPartFile so reset the part counter partCounter = 0; } if (isWriterOpen) { long writePosition = writer.getPos(); if (isWriterOpen && writePosition > batchSize) { shouldRoll = true; LOG.debug( "RollingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } } return shouldRoll; }
[ "private", "boolean", "shouldRoll", "(", ")", "throws", "IOException", "{", "boolean", "shouldRoll", "=", "false", ";", "int", "subtaskIndex", "=", "getRuntimeContext", "(", ")", ".", "getIndexOfThisSubtask", "(", ")", ";", "if", "(", "!", "isWriterOpen", ")",...
Determines whether we should change the bucket file we are writing to. <p>This will roll if no file was created yet, if the file size is larger than the specified size or if the {@code Bucketer} determines that we should roll.
[ "Determines", "whether", "we", "should", "change", "the", "bucket", "file", "we", "are", "writing", "to", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java#L413-L438
train
Checks if the current bucket should be rolled.
[ 30522, 2797, 22017, 20898, 2323, 28402, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 22017, 20898, 2323, 28402, 1027, 6270, 1025, 20014, 4942, 10230, 18824, 10288, 1027, 2131, 15532, 7292, 8663, 18209, 1006, 1007, 1012, 2131, 22254, 10288, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java
Router.decodePathTokens
private String[] decodePathTokens(String uri) { // Need to split the original URI (instead of QueryStringDecoder#path) then decode the tokens (components), // otherwise /test1/123%2F456 will not match /test1/:p1 int qPos = uri.indexOf("?"); String encodedPath = (qPos >= 0) ? uri.substring(0, qPos) : uri; String[] encodedTokens = PathPattern.removeSlashesAtBothEnds(encodedPath).split("/"); String[] decodedTokens = new String[encodedTokens.length]; for (int i = 0; i < encodedTokens.length; i++) { String encodedToken = encodedTokens[i]; decodedTokens[i] = QueryStringDecoder.decodeComponent(encodedToken); } return decodedTokens; }
java
private String[] decodePathTokens(String uri) { // Need to split the original URI (instead of QueryStringDecoder#path) then decode the tokens (components), // otherwise /test1/123%2F456 will not match /test1/:p1 int qPos = uri.indexOf("?"); String encodedPath = (qPos >= 0) ? uri.substring(0, qPos) : uri; String[] encodedTokens = PathPattern.removeSlashesAtBothEnds(encodedPath).split("/"); String[] decodedTokens = new String[encodedTokens.length]; for (int i = 0; i < encodedTokens.length; i++) { String encodedToken = encodedTokens[i]; decodedTokens[i] = QueryStringDecoder.decodeComponent(encodedToken); } return decodedTokens; }
[ "private", "String", "[", "]", "decodePathTokens", "(", "String", "uri", ")", "{", "// Need to split the original URI (instead of QueryStringDecoder#path) then decode the tokens (components),", "// otherwise /test1/123%2F456 will not match /test1/:p1", "int", "qPos", "=", "uri", ".",...
--------------------------------------------------------------------------
[ "--------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L251-L267
train
Decode path tokens from the given URI.
[ 30522, 2797, 5164, 1031, 1033, 21933, 3207, 15069, 18715, 6132, 1006, 5164, 24471, 2072, 1007, 1063, 1013, 1013, 2342, 2000, 3975, 1996, 2434, 24471, 2072, 1006, 2612, 1997, 23032, 3367, 4892, 3207, 16044, 2099, 1001, 4130, 1007, 2059, 2193...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java
SlotProfile.preferredLocality
public static SlotProfile preferredLocality(ResourceProfile resourceProfile, Collection<TaskManagerLocation> preferredLocations) { return new SlotProfile(resourceProfile, preferredLocations, Collections.emptyList()); }
java
public static SlotProfile preferredLocality(ResourceProfile resourceProfile, Collection<TaskManagerLocation> preferredLocations) { return new SlotProfile(resourceProfile, preferredLocations, Collections.emptyList()); }
[ "public", "static", "SlotProfile", "preferredLocality", "(", "ResourceProfile", "resourceProfile", ",", "Collection", "<", "TaskManagerLocation", ">", "preferredLocations", ")", "{", "return", "new", "SlotProfile", "(", "resourceProfile", ",", "preferredLocations", ",", ...
Returns a slot profile for the given resource profile and the preferred locations. @param resourceProfile specifying the slot requirements @param preferredLocations specifying the preferred locations @return Slot profile with the given resource profile and preferred locations
[ "Returns", "a", "slot", "profile", "for", "the", "given", "resource", "profile", "and", "the", "preferred", "locations", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java#L132-L134
train
Create a slot profile with preferred locality.
[ 30522, 2270, 10763, 10453, 21572, 8873, 2571, 6871, 4135, 9289, 3012, 1006, 7692, 21572, 8873, 2571, 7692, 21572, 8873, 2571, 1010, 3074, 1026, 4708, 24805, 4590, 4135, 10719, 1028, 6871, 4135, 10719, 2015, 1007, 1063, 2709, 2047, 10453, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.sliceByRowsAndCols
public static void sliceByRowsAndCols(Image srcImage, File destDir, int rows, int cols) { if (false == destDir.exists()) { FileUtil.mkdir(destDir); } else if (false == destDir.isDirectory()) { throw new IllegalArgumentException("Destination Dir must be a Directory !"); } try { if (rows <= 0 || rows > 20) { rows = 2; // 切片行数 } if (cols <= 0 || cols > 20) { cols = 2; // 切片列数 } // 读取源图像 final BufferedImage bi = toBufferedImage(srcImage); int srcWidth = bi.getWidth(); // 源图宽度 int srcHeight = bi.getHeight(); // 源图高度 int destWidth = NumberUtil.partValue(srcWidth, cols); // 每张切片的宽度 int destHeight = NumberUtil.partValue(srcHeight, rows); // 每张切片的高度 // 循环建立切片 BufferedImage tag; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { tag = cut(bi, new Rectangle(j * destWidth, i * destHeight, destWidth, destHeight)); // 输出为文件 ImageIO.write(tag, IMAGE_TYPE_JPEG, new File(destDir, "_r" + i + "_c" + j + ".jpg")); } } } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static void sliceByRowsAndCols(Image srcImage, File destDir, int rows, int cols) { if (false == destDir.exists()) { FileUtil.mkdir(destDir); } else if (false == destDir.isDirectory()) { throw new IllegalArgumentException("Destination Dir must be a Directory !"); } try { if (rows <= 0 || rows > 20) { rows = 2; // 切片行数 } if (cols <= 0 || cols > 20) { cols = 2; // 切片列数 } // 读取源图像 final BufferedImage bi = toBufferedImage(srcImage); int srcWidth = bi.getWidth(); // 源图宽度 int srcHeight = bi.getHeight(); // 源图高度 int destWidth = NumberUtil.partValue(srcWidth, cols); // 每张切片的宽度 int destHeight = NumberUtil.partValue(srcHeight, rows); // 每张切片的高度 // 循环建立切片 BufferedImage tag; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { tag = cut(bi, new Rectangle(j * destWidth, i * destHeight, destWidth, destHeight)); // 输出为文件 ImageIO.write(tag, IMAGE_TYPE_JPEG, new File(destDir, "_r" + i + "_c" + j + ".jpg")); } } } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "void", "sliceByRowsAndCols", "(", "Image", "srcImage", ",", "File", "destDir", ",", "int", "rows", ",", "int", "cols", ")", "{", "if", "(", "false", "==", "destDir", ".", "exists", "(", ")", ")", "{", "FileUtil", ".", "mkdir", "(",...
图像切割(指定切片的行数和列数) @param srcImage 源图像 @param destDir 切片目标文件夹 @param rows 目标切片行数。默认2,必须是范围 [1, 20] 之内 @param cols 目标切片列数。默认2,必须是范围 [1, 20] 之内
[ "图像切割(指定切片的行数和列数)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L448-L482
train
Slice the given image in the given destination directory by using the specified rows and cols.
[ 30522, 2270, 10763, 11675, 14704, 3762, 10524, 8791, 16409, 27896, 1006, 3746, 5034, 6895, 26860, 1010, 5371, 4078, 2102, 4305, 2099, 1010, 20014, 10281, 1010, 20014, 8902, 2015, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 4078, 2102, 4305, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java
WebServiceTemplateBuilder.setCheckConnectionForFault
public WebServiceTemplateBuilder setCheckConnectionForFault( boolean checkConnectionForFault) { return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, append(this.internalCustomizers, new CheckConnectionFaultCustomizer(checkConnectionForFault)), this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
java
public WebServiceTemplateBuilder setCheckConnectionForFault( boolean checkConnectionForFault) { return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, append(this.internalCustomizers, new CheckConnectionFaultCustomizer(checkConnectionForFault)), this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
[ "public", "WebServiceTemplateBuilder", "setCheckConnectionForFault", "(", "boolean", "checkConnectionForFault", ")", "{", "return", "new", "WebServiceTemplateBuilder", "(", "this", ".", "detectHttpMessageSender", ",", "this", ".", "interceptors", ",", "append", "(", "this...
Indicates whether the connection should be checked for fault indicators ({@code true}), or whether we should rely on the message only ({@code false}). @param checkConnectionForFault whether to check for fault indicators @return a new builder instance. @see WebServiceTemplate#setCheckConnectionForFault(boolean)
[ "Indicates", "whether", "the", "connection", "should", "be", "checked", "for", "fault", "indicators", "(", "{" ]
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#L332-L341
train
Sets whether the checkConnectionForFault parameter is true.
[ 30522, 2270, 4773, 8043, 7903, 12870, 8737, 13806, 8569, 23891, 2099, 2275, 5403, 3600, 8663, 2638, 7542, 29278, 7011, 11314, 1006, 22017, 20898, 4638, 8663, 2638, 7542, 29278, 7011, 11314, 1007, 1063, 2709, 2047, 4773, 8043, 7903, 12870, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
SingleThreadEventExecutor.runAllTasks
protected boolean runAllTasks(long timeoutNanos) { fetchFromScheduledTaskQueue(); Runnable task = pollTask(); if (task == null) { afterRunningAllTasks(); return false; } final long deadline = ScheduledFutureTask.nanoTime() + timeoutNanos; long runTasks = 0; long lastExecutionTime; for (;;) { safeExecute(task); runTasks ++; // Check timeout every 64 tasks because nanoTime() is relatively expensive. // XXX: Hard-coded value - will make it configurable if it is really a problem. if ((runTasks & 0x3F) == 0) { lastExecutionTime = ScheduledFutureTask.nanoTime(); if (lastExecutionTime >= deadline) { break; } } task = pollTask(); if (task == null) { lastExecutionTime = ScheduledFutureTask.nanoTime(); break; } } afterRunningAllTasks(); this.lastExecutionTime = lastExecutionTime; return true; }
java
protected boolean runAllTasks(long timeoutNanos) { fetchFromScheduledTaskQueue(); Runnable task = pollTask(); if (task == null) { afterRunningAllTasks(); return false; } final long deadline = ScheduledFutureTask.nanoTime() + timeoutNanos; long runTasks = 0; long lastExecutionTime; for (;;) { safeExecute(task); runTasks ++; // Check timeout every 64 tasks because nanoTime() is relatively expensive. // XXX: Hard-coded value - will make it configurable if it is really a problem. if ((runTasks & 0x3F) == 0) { lastExecutionTime = ScheduledFutureTask.nanoTime(); if (lastExecutionTime >= deadline) { break; } } task = pollTask(); if (task == null) { lastExecutionTime = ScheduledFutureTask.nanoTime(); break; } } afterRunningAllTasks(); this.lastExecutionTime = lastExecutionTime; return true; }
[ "protected", "boolean", "runAllTasks", "(", "long", "timeoutNanos", ")", "{", "fetchFromScheduledTaskQueue", "(", ")", ";", "Runnable", "task", "=", "pollTask", "(", ")", ";", "if", "(", "task", "==", "null", ")", "{", "afterRunningAllTasks", "(", ")", ";", ...
Poll all tasks from the task queue and run them via {@link Runnable#run()} method. This method stops running the tasks in the task queue and returns if it ran longer than {@code timeoutNanos}.
[ "Poll", "all", "tasks", "from", "the", "task", "queue", "and", "run", "them", "via", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L393-L428
train
Run all tasks in the scheduled task queue.
[ 30522, 5123, 22017, 20898, 2448, 8095, 10230, 5705, 1006, 2146, 2051, 5833, 7229, 2891, 1007, 1063, 18584, 19699, 22225, 7690, 18696, 10230, 2243, 4226, 5657, 1006, 1007, 1025, 2448, 22966, 4708, 1027, 8554, 10230, 2243, 1006, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.validate
void validate(ServerResponse serverResponse) throws GeneralSecurityException { byte[] response = validateChallenge(authNonce, serverResponse.response); byte[] expected = rawResponse(challenge); Preconditions.checkArgument(Arrays.equals(expected, response)); byte[] nonce = decrypt(serverResponse.nonce); byte[] inputIv = decrypt(serverResponse.inputIv); byte[] outputIv = decrypt(serverResponse.outputIv); SecretKeySpec sessionKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(), nonce, conf.encryptionKeyLength()); this.sessionCipher = new TransportCipher(cryptoConf, conf.cipherTransformation(), sessionKey, inputIv, outputIv); }
java
void validate(ServerResponse serverResponse) throws GeneralSecurityException { byte[] response = validateChallenge(authNonce, serverResponse.response); byte[] expected = rawResponse(challenge); Preconditions.checkArgument(Arrays.equals(expected, response)); byte[] nonce = decrypt(serverResponse.nonce); byte[] inputIv = decrypt(serverResponse.inputIv); byte[] outputIv = decrypt(serverResponse.outputIv); SecretKeySpec sessionKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(), nonce, conf.encryptionKeyLength()); this.sessionCipher = new TransportCipher(cryptoConf, conf.cipherTransformation(), sessionKey, inputIv, outputIv); }
[ "void", "validate", "(", "ServerResponse", "serverResponse", ")", "throws", "GeneralSecurityException", "{", "byte", "[", "]", "response", "=", "validateChallenge", "(", "authNonce", ",", "serverResponse", ".", "response", ")", ";", "byte", "[", "]", "expected", ...
Validates the server response and initializes the cipher to use for the session. @param serverResponse The response from the server.
[ "Validates", "the", "server", "response", "and", "initializes", "the", "cipher", "to", "use", "for", "the", "session", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L134-L148
train
Validate the serverResponse.
[ 30522, 11675, 9398, 3686, 1006, 8241, 6072, 26029, 3366, 8241, 6072, 26029, 3366, 1007, 11618, 11593, 8586, 25137, 10288, 24422, 1063, 24880, 1031, 1033, 3433, 30524, 6072, 26029, 3366, 1012, 3433, 1007, 1025, 24880, 1031, 1033, 3517, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java
StreamTransformation.setMaxParallelism
public void setMaxParallelism(int maxParallelism) { Preconditions.checkArgument(maxParallelism > 0 && maxParallelism <= StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM, "Maximum parallelism must be between 1 and " + StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM + ". Found: " + maxParallelism); this.maxParallelism = maxParallelism; }
java
public void setMaxParallelism(int maxParallelism) { Preconditions.checkArgument(maxParallelism > 0 && maxParallelism <= StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM, "Maximum parallelism must be between 1 and " + StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM + ". Found: " + maxParallelism); this.maxParallelism = maxParallelism; }
[ "public", "void", "setMaxParallelism", "(", "int", "maxParallelism", ")", "{", "Preconditions", ".", "checkArgument", "(", "maxParallelism", ">", "0", "&&", "maxParallelism", "<=", "StreamGraphGenerator", ".", "UPPER_BOUND_MAX_PARALLELISM", ",", "\"Maximum parallelism mus...
Sets the maximum parallelism for this stream transformation. @param maxParallelism Maximum parallelism for this stream transformation.
[ "Sets", "the", "maximum", "parallelism", "for", "this", "stream", "transformation", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java#L228-L234
train
Sets the maximum parallelism for this stream.
[ 30522, 2270, 11675, 2275, 17848, 28689, 6216, 28235, 1006, 20014, 4098, 28689, 6216, 28235, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 4098, 28689, 6216, 28235, 1028, 1014, 1004, 1004, 4098, 28689, 6216, 28235, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java
SslContextBuilder.keyManager
public SslContextBuilder keyManager(PrivateKey key, String keyPassword, X509Certificate... keyCertChain) { if (forServer) { checkNotNull(keyCertChain, "keyCertChain required for servers"); if (keyCertChain.length == 0) { throw new IllegalArgumentException("keyCertChain must be non-empty"); } checkNotNull(key, "key required for servers"); } if (keyCertChain == null || keyCertChain.length == 0) { this.keyCertChain = null; } else { for (X509Certificate cert: keyCertChain) { if (cert == null) { throw new IllegalArgumentException("keyCertChain contains null entry"); } } this.keyCertChain = keyCertChain.clone(); } this.key = key; this.keyPassword = keyPassword; keyManagerFactory = null; return this; }
java
public SslContextBuilder keyManager(PrivateKey key, String keyPassword, X509Certificate... keyCertChain) { if (forServer) { checkNotNull(keyCertChain, "keyCertChain required for servers"); if (keyCertChain.length == 0) { throw new IllegalArgumentException("keyCertChain must be non-empty"); } checkNotNull(key, "key required for servers"); } if (keyCertChain == null || keyCertChain.length == 0) { this.keyCertChain = null; } else { for (X509Certificate cert: keyCertChain) { if (cert == null) { throw new IllegalArgumentException("keyCertChain contains null entry"); } } this.keyCertChain = keyCertChain.clone(); } this.key = key; this.keyPassword = keyPassword; keyManagerFactory = null; return this; }
[ "public", "SslContextBuilder", "keyManager", "(", "PrivateKey", "key", ",", "String", "keyPassword", ",", "X509Certificate", "...", "keyCertChain", ")", "{", "if", "(", "forServer", ")", "{", "checkNotNull", "(", "keyCertChain", ",", "\"keyCertChain required for serve...
Identifying certificate for this host. {@code keyCertChain} and {@code key} may be {@code null} for client contexts, which disables mutual authentication. @param key a PKCS#8 private key file @param keyPassword the password of the {@code key}, or {@code null} if it's not password-protected @param keyCertChain an X.509 certificate chain
[ "Identifying", "certificate", "for", "this", "host", ".", "{", "@code", "keyCertChain", "}", "and", "{", "@code", "key", "}", "may", "be", "{", "@code", "null", "}", "for", "client", "contexts", "which", "disables", "mutual", "authentication", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L310-L332
train
Key manager for the SslContext.
[ 30522, 2270, 7020, 22499, 10111, 18413, 8569, 23891, 2099, 3145, 24805, 4590, 1006, 2797, 14839, 3145, 1010, 5164, 3145, 15194, 18351, 1010, 1060, 12376, 2683, 17119, 3775, 8873, 16280, 1012, 1012, 1012, 3145, 17119, 10649, 8113, 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...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java
FlinkZooKeeperQuorumPeer.main
public static void main(String[] args) { try { // startup checks and logging EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args); final ParameterTool params = ParameterTool.fromArgs(args); final String zkConfigFile = params.getRequired("zkConfigFile"); final int peerId = params.getInt("peerId"); // Run quorum peer runFlinkZkQuorumPeer(zkConfigFile, peerId); } catch (Throwable t) { LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t); System.exit(-1); } }
java
public static void main(String[] args) { try { // startup checks and logging EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args); final ParameterTool params = ParameterTool.fromArgs(args); final String zkConfigFile = params.getRequired("zkConfigFile"); final int peerId = params.getInt("peerId"); // Run quorum peer runFlinkZkQuorumPeer(zkConfigFile, peerId); } catch (Throwable t) { LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t); System.exit(-1); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "// startup checks and logging", "EnvironmentInformation", ".", "logEnvironmentInfo", "(", "LOG", ",", "\"ZooKeeper Quorum Peer\"", ",", "args", ")", ";", "final", "Paramete...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java#L69-L85
train
Main method to run the ZooKeeper quorum peer.
[ 30522, 2270, 10763, 11675, 2364, 1006, 5164, 1031, 1033, 30524, 1006, 8833, 1010, 1000, 9201, 13106, 22035, 6824, 8152, 1000, 1010, 12098, 5620, 1007, 1025, 2345, 16381, 3406, 4747, 11498, 5244, 1027, 16381, 3406, 4747, 1012, 2013, 2906, 56...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java
ResourceManager.onStart
@Override public void onStart() throws Exception { try { startResourceManagerServices(); } catch (Exception e) { final ResourceManagerException exception = new ResourceManagerException(String.format("Could not start the ResourceManager %s", getAddress()), e); onFatalError(exception); throw exception; } }
java
@Override public void onStart() throws Exception { try { startResourceManagerServices(); } catch (Exception e) { final ResourceManagerException exception = new ResourceManagerException(String.format("Could not start the ResourceManager %s", getAddress()), e); onFatalError(exception); throw exception; } }
[ "@", "Override", "public", "void", "onStart", "(", ")", "throws", "Exception", "{", "try", "{", "startResourceManagerServices", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "final", "ResourceManagerException", "exception", "=", "new", "Resourc...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L197-L206
train
Start the ResourceManager.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2006, 14117, 2102, 1006, 1007, 11618, 6453, 1063, 3046, 1063, 2707, 6072, 8162, 3401, 24805, 15776, 2121, 7903, 2229, 1006, 1007, 1025, 1065, 4608, 1006, 6453, 1041, 1007, 1063, 2345, 7692, 24805, 4590...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.alias
private static String alias(SqlNode item) { assert item instanceof SqlCall; assert item.getKind() == SqlKind.AS; final SqlIdentifier identifier = ((SqlCall) item).operand(1); return identifier.getSimple(); }
java
private static String alias(SqlNode item) { assert item instanceof SqlCall; assert item.getKind() == SqlKind.AS; final SqlIdentifier identifier = ((SqlCall) item).operand(1); return identifier.getSimple(); }
[ "private", "static", "String", "alias", "(", "SqlNode", "item", ")", "{", "assert", "item", "instanceof", "SqlCall", ";", "assert", "item", ".", "getKind", "(", ")", "==", "SqlKind", ".", "AS", ";", "final", "SqlIdentifier", "identifier", "=", "(", "(", ...
Returns the alias of a "expr AS alias" expression.
[ "Returns", "the", "alias", "of", "a", "expr", "AS", "alias", "expression", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L5142-L5147
train
Returns the alias of an AS item.
[ 30522, 2797, 10763, 5164, 14593, 1006, 29296, 3630, 3207, 8875, 1007, 1063, 20865, 8875, 6013, 11253, 29296, 9289, 2140, 1025, 20865, 8875, 1012, 2131, 18824, 1006, 1007, 1027, 1027, 29296, 18824, 1012, 2004, 1025, 2345, 29296, 5178, 16778, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java
FileOutputFormat.configure
@Override public void configure(Configuration parameters) { // get the output file path, if it was not yet set if (this.outputFilePath == null) { // get the file parameter String filePath = parameters.getString(FILE_PARAMETER_KEY, null); if (filePath == null) { throw new IllegalArgumentException("The output path has been specified neither via constructor/setters" + ", nor via the Configuration."); } try { this.outputFilePath = new Path(filePath); } catch (RuntimeException rex) { throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); } } // check if have not been set and use the defaults in that case if (this.writeMode == null) { this.writeMode = DEFAULT_WRITE_MODE; } if (this.outputDirectoryMode == null) { this.outputDirectoryMode = DEFAULT_OUTPUT_DIRECTORY_MODE; } }
java
@Override public void configure(Configuration parameters) { // get the output file path, if it was not yet set if (this.outputFilePath == null) { // get the file parameter String filePath = parameters.getString(FILE_PARAMETER_KEY, null); if (filePath == null) { throw new IllegalArgumentException("The output path has been specified neither via constructor/setters" + ", nor via the Configuration."); } try { this.outputFilePath = new Path(filePath); } catch (RuntimeException rex) { throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); } } // check if have not been set and use the defaults in that case if (this.writeMode == null) { this.writeMode = DEFAULT_WRITE_MODE; } if (this.outputDirectoryMode == null) { this.outputDirectoryMode = DEFAULT_OUTPUT_DIRECTORY_MODE; } }
[ "@", "Override", "public", "void", "configure", "(", "Configuration", "parameters", ")", "{", "// get the output file path, if it was not yet set", "if", "(", "this", ".", "outputFilePath", "==", "null", ")", "{", "// get the file parameter", "String", "filePath", "=", ...
----------------------------------------------------------------
[ "----------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java#L172-L199
train
Override this to configure the configuration.
[ 30522, 1030, 2058, 15637, 2270, 11675, 9530, 8873, 27390, 2063, 1006, 9563, 11709, 1007, 1063, 1013, 1013, 2131, 1996, 6434, 5371, 4130, 1010, 2065, 2009, 2001, 2025, 2664, 2275, 2065, 1006, 2023, 1012, 6434, 8873, 2571, 15069, 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/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
ConnectedStreams.keyBy
public <KEY> ConnectedStreams<IN1, IN2> keyBy( KeySelector<IN1, KEY> keySelector1, KeySelector<IN2, KEY> keySelector2, TypeInformation<KEY> keyType) { return new ConnectedStreams<>( environment, inputStream1.keyBy(keySelector1, keyType), inputStream2.keyBy(keySelector2, keyType)); }
java
public <KEY> ConnectedStreams<IN1, IN2> keyBy( KeySelector<IN1, KEY> keySelector1, KeySelector<IN2, KEY> keySelector2, TypeInformation<KEY> keyType) { return new ConnectedStreams<>( environment, inputStream1.keyBy(keySelector1, keyType), inputStream2.keyBy(keySelector2, keyType)); }
[ "public", "<", "KEY", ">", "ConnectedStreams", "<", "IN1", ",", "IN2", ">", "keyBy", "(", "KeySelector", "<", "IN1", ",", "KEY", ">", "keySelector1", ",", "KeySelector", "<", "IN2", ",", "KEY", ">", "keySelector2", ",", "TypeInformation", "<", "KEY", ">"...
KeyBy operation for connected data stream. Assigns keys to the elements of input1 and input2 using keySelector1 and keySelector2 with explicit type information for the common key type. @param keySelector1 The {@link KeySelector} used for grouping the first input @param keySelector2 The {@link KeySelector} used for grouping the second input @param keyType The type information of the common key type. @return The partitioned {@link ConnectedStreams}
[ "KeyBy", "operation", "for", "connected", "data", "stream", ".", "Assigns", "keys", "to", "the", "elements", "of", "input1", "and", "input2", "using", "keySelector1", "and", "keySelector2", "with", "explicit", "type", "information", "for", "the", "common", "key"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java#L206-L214
train
KeyBy operation for ConnectedStreams.
[ 30522, 2270, 1026, 3145, 1028, 4198, 21422, 2015, 1026, 1999, 2487, 1010, 1999, 2475, 1028, 3145, 3762, 1006, 6309, 12260, 16761, 1026, 1999, 2487, 1010, 3145, 1028, 6309, 12260, 16761, 2487, 1010, 6309, 12260, 16761, 1026, 1999, 2475, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
Types.EITHER
public static <L, R> TypeInformation<Either<L, R>> EITHER(TypeInformation<L> leftType, TypeInformation<R> rightType) { return new EitherTypeInfo<>(leftType, rightType); }
java
public static <L, R> TypeInformation<Either<L, R>> EITHER(TypeInformation<L> leftType, TypeInformation<R> rightType) { return new EitherTypeInfo<>(leftType, rightType); }
[ "public", "static", "<", "L", ",", "R", ">", "TypeInformation", "<", "Either", "<", "L", ",", "R", ">", ">", "EITHER", "(", "TypeInformation", "<", "L", ">", "leftType", ",", "TypeInformation", "<", "R", ">", "rightType", ")", "{", "return", "new", "...
Returns type information for Flink's {@link org.apache.flink.types.Either} type. Null values are not supported. <p>Either type can be used for a value of two possible types. <p>Example use: <code>Types.EITHER(Types.VOID, Types.INT)</code> @param leftType type information of left side / {@link org.apache.flink.types.Either.Left} @param rightType type information of right side / {@link org.apache.flink.types.Either.Right}
[ "Returns", "type", "information", "for", "Flink", "s", "{", "@link", "org", ".", "apache", ".", "flink", ".", "types", ".", "Either", "}", "type", ".", "Null", "values", "are", "not", "supported", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L455-L457
train
Returns the type information for the either operation.
[ 30522, 2270, 10763, 1026, 1048, 1010, 1054, 1028, 2828, 2378, 14192, 3370, 1026, 2593, 1026, 1048, 1010, 1054, 1028, 1028, 2593, 1006, 2828, 2378, 14192, 3370, 1026, 1048, 1028, 2187, 13874, 1010, 2828, 2378, 14192, 3370, 1026, 1054, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerUtil.java
CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult
public static <T> IntermediateCompatibilityResult<T> constructIntermediateCompatibilityResult( TypeSerializer<?>[] newNestedSerializers, TypeSerializerSnapshot<?>[] nestedSerializerSnapshots) { Preconditions.checkArgument(newNestedSerializers.length == nestedSerializerSnapshots.length, "Different number of new serializers and existing serializer snapshots."); TypeSerializer<?>[] nestedSerializers = new TypeSerializer[newNestedSerializers.length]; // check nested serializers for compatibility boolean nestedSerializerRequiresMigration = false; boolean hasReconfiguredNestedSerializers = false; for (int i = 0; i < nestedSerializerSnapshots.length; i++) { TypeSerializerSchemaCompatibility<?> compatibility = resolveCompatibility(newNestedSerializers[i], nestedSerializerSnapshots[i]); // if any one of the new nested serializers is incompatible, we can just short circuit the result if (compatibility.isIncompatible()) { return IntermediateCompatibilityResult.definedIncompatibleResult(); } if (compatibility.isCompatibleAfterMigration()) { nestedSerializerRequiresMigration = true; } else if (compatibility.isCompatibleWithReconfiguredSerializer()) { hasReconfiguredNestedSerializers = true; nestedSerializers[i] = compatibility.getReconfiguredSerializer(); } else if (compatibility.isCompatibleAsIs()) { nestedSerializers[i] = newNestedSerializers[i]; } else { throw new IllegalStateException("Undefined compatibility type."); } } if (nestedSerializerRequiresMigration) { return IntermediateCompatibilityResult.definedCompatibleAfterMigrationResult(); } if (hasReconfiguredNestedSerializers) { return IntermediateCompatibilityResult.undefinedReconfigureResult(nestedSerializers); } // ends up here if everything is compatible as is return IntermediateCompatibilityResult.definedCompatibleAsIsResult(nestedSerializers); }
java
public static <T> IntermediateCompatibilityResult<T> constructIntermediateCompatibilityResult( TypeSerializer<?>[] newNestedSerializers, TypeSerializerSnapshot<?>[] nestedSerializerSnapshots) { Preconditions.checkArgument(newNestedSerializers.length == nestedSerializerSnapshots.length, "Different number of new serializers and existing serializer snapshots."); TypeSerializer<?>[] nestedSerializers = new TypeSerializer[newNestedSerializers.length]; // check nested serializers for compatibility boolean nestedSerializerRequiresMigration = false; boolean hasReconfiguredNestedSerializers = false; for (int i = 0; i < nestedSerializerSnapshots.length; i++) { TypeSerializerSchemaCompatibility<?> compatibility = resolveCompatibility(newNestedSerializers[i], nestedSerializerSnapshots[i]); // if any one of the new nested serializers is incompatible, we can just short circuit the result if (compatibility.isIncompatible()) { return IntermediateCompatibilityResult.definedIncompatibleResult(); } if (compatibility.isCompatibleAfterMigration()) { nestedSerializerRequiresMigration = true; } else if (compatibility.isCompatibleWithReconfiguredSerializer()) { hasReconfiguredNestedSerializers = true; nestedSerializers[i] = compatibility.getReconfiguredSerializer(); } else if (compatibility.isCompatibleAsIs()) { nestedSerializers[i] = newNestedSerializers[i]; } else { throw new IllegalStateException("Undefined compatibility type."); } } if (nestedSerializerRequiresMigration) { return IntermediateCompatibilityResult.definedCompatibleAfterMigrationResult(); } if (hasReconfiguredNestedSerializers) { return IntermediateCompatibilityResult.undefinedReconfigureResult(nestedSerializers); } // ends up here if everything is compatible as is return IntermediateCompatibilityResult.definedCompatibleAsIsResult(nestedSerializers); }
[ "public", "static", "<", "T", ">", "IntermediateCompatibilityResult", "<", "T", ">", "constructIntermediateCompatibilityResult", "(", "TypeSerializer", "<", "?", ">", "[", "]", "newNestedSerializers", ",", "TypeSerializerSnapshot", "<", "?", ">", "[", "]", "nestedSe...
Constructs an {@link IntermediateCompatibilityResult} with the given array of nested serializers and their corresponding serializer snapshots. <p>This result is considered "intermediate", because the actual final result is not yet built if it isn't defined. This is the case if the final result is supposed to be {@link TypeSerializerSchemaCompatibility#compatibleWithReconfiguredSerializer(TypeSerializer)}, where construction of the reconfigured serializer instance should be done by the caller. <p>For other cases, i.e. {@link TypeSerializerSchemaCompatibility#compatibleAsIs()}, {@link TypeSerializerSchemaCompatibility#compatibleAfterMigration()}, and {@link TypeSerializerSchemaCompatibility#incompatible()}, these results are considered final. @param newNestedSerializers the new nested serializers to check for compatibility. @param nestedSerializerSnapshots the associated nested serializers' snapshots. @return the intermediate compatibility result of the new nested serializers.
[ "Constructs", "an", "{", "@link", "IntermediateCompatibilityResult", "}", "with", "the", "given", "array", "of", "nested", "serializers", "and", "their", "corresponding", "serializer", "snapshots", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerUtil.java#L87-L130
train
Construct an intermediate compatibility result.
[ 30522, 2270, 10763, 1026, 1056, 1028, 7783, 9006, 24952, 8553, 6072, 11314, 1026, 1056, 1028, 9570, 18447, 2121, 16969, 26557, 25377, 10450, 8553, 6072, 11314, 1006, 4127, 11610, 28863, 1026, 1029, 1028, 1031, 1033, 2047, 5267, 3064, 8043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java
ChannelOutboundBuffer.nioBuffers
public ByteBuffer[] nioBuffers(int maxCount, long maxBytes) { assert maxCount > 0; assert maxBytes > 0; long nioBufferSize = 0; int nioBufferCount = 0; final InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get(); ByteBuffer[] nioBuffers = NIO_BUFFERS.get(threadLocalMap); Entry entry = flushedEntry; while (isFlushedEntry(entry) && entry.msg instanceof ByteBuf) { if (!entry.cancelled) { ByteBuf buf = (ByteBuf) entry.msg; final int readerIndex = buf.readerIndex(); final int readableBytes = buf.writerIndex() - readerIndex; if (readableBytes > 0) { if (maxBytes - readableBytes < nioBufferSize && nioBufferCount != 0) { // If the nioBufferSize + readableBytes will overflow maxBytes, and there is at least one entry // we stop populate the ByteBuffer array. This is done for 2 reasons: // 1. bsd/osx don't allow to write more bytes then Integer.MAX_VALUE with one writev(...) call // and so will return 'EINVAL', which will raise an IOException. On Linux it may work depending // on the architecture and kernel but to be safe we also enforce the limit here. // 2. There is no sense in putting more data in the array than is likely to be accepted by the // OS. // // See also: // - https://www.freebsd.org/cgi/man.cgi?query=write&sektion=2 // - http://linux.die.net/man/2/writev break; } nioBufferSize += readableBytes; int count = entry.count; if (count == -1) { //noinspection ConstantValueVariableUse entry.count = count = buf.nioBufferCount(); } int neededSpace = min(maxCount, nioBufferCount + count); if (neededSpace > nioBuffers.length) { nioBuffers = expandNioBufferArray(nioBuffers, neededSpace, nioBufferCount); NIO_BUFFERS.set(threadLocalMap, nioBuffers); } if (count == 1) { ByteBuffer nioBuf = entry.buf; if (nioBuf == null) { // cache ByteBuffer as it may need to create a new ByteBuffer instance if its a // derived buffer entry.buf = nioBuf = buf.internalNioBuffer(readerIndex, readableBytes); } nioBuffers[nioBufferCount++] = nioBuf; } else { // The code exists in an extra method to ensure the method is not too big to inline as this // branch is not very likely to get hit very frequently. nioBufferCount = nioBuffers(entry, buf, nioBuffers, nioBufferCount, maxCount); } if (nioBufferCount == maxCount) { break; } } } entry = entry.next; } this.nioBufferCount = nioBufferCount; this.nioBufferSize = nioBufferSize; return nioBuffers; }
java
public ByteBuffer[] nioBuffers(int maxCount, long maxBytes) { assert maxCount > 0; assert maxBytes > 0; long nioBufferSize = 0; int nioBufferCount = 0; final InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get(); ByteBuffer[] nioBuffers = NIO_BUFFERS.get(threadLocalMap); Entry entry = flushedEntry; while (isFlushedEntry(entry) && entry.msg instanceof ByteBuf) { if (!entry.cancelled) { ByteBuf buf = (ByteBuf) entry.msg; final int readerIndex = buf.readerIndex(); final int readableBytes = buf.writerIndex() - readerIndex; if (readableBytes > 0) { if (maxBytes - readableBytes < nioBufferSize && nioBufferCount != 0) { // If the nioBufferSize + readableBytes will overflow maxBytes, and there is at least one entry // we stop populate the ByteBuffer array. This is done for 2 reasons: // 1. bsd/osx don't allow to write more bytes then Integer.MAX_VALUE with one writev(...) call // and so will return 'EINVAL', which will raise an IOException. On Linux it may work depending // on the architecture and kernel but to be safe we also enforce the limit here. // 2. There is no sense in putting more data in the array than is likely to be accepted by the // OS. // // See also: // - https://www.freebsd.org/cgi/man.cgi?query=write&sektion=2 // - http://linux.die.net/man/2/writev break; } nioBufferSize += readableBytes; int count = entry.count; if (count == -1) { //noinspection ConstantValueVariableUse entry.count = count = buf.nioBufferCount(); } int neededSpace = min(maxCount, nioBufferCount + count); if (neededSpace > nioBuffers.length) { nioBuffers = expandNioBufferArray(nioBuffers, neededSpace, nioBufferCount); NIO_BUFFERS.set(threadLocalMap, nioBuffers); } if (count == 1) { ByteBuffer nioBuf = entry.buf; if (nioBuf == null) { // cache ByteBuffer as it may need to create a new ByteBuffer instance if its a // derived buffer entry.buf = nioBuf = buf.internalNioBuffer(readerIndex, readableBytes); } nioBuffers[nioBufferCount++] = nioBuf; } else { // The code exists in an extra method to ensure the method is not too big to inline as this // branch is not very likely to get hit very frequently. nioBufferCount = nioBuffers(entry, buf, nioBuffers, nioBufferCount, maxCount); } if (nioBufferCount == maxCount) { break; } } } entry = entry.next; } this.nioBufferCount = nioBufferCount; this.nioBufferSize = nioBufferSize; return nioBuffers; }
[ "public", "ByteBuffer", "[", "]", "nioBuffers", "(", "int", "maxCount", ",", "long", "maxBytes", ")", "{", "assert", "maxCount", ">", "0", ";", "assert", "maxBytes", ">", "0", ";", "long", "nioBufferSize", "=", "0", ";", "int", "nioBufferCount", "=", "0"...
Returns an array of direct NIO buffers if the currently pending messages are made of {@link ByteBuf} only. {@link #nioBufferCount()} and {@link #nioBufferSize()} will return the number of NIO buffers in the returned array and the total number of readable bytes of the NIO buffers respectively. <p> Note that the returned array is reused and thus should not escape {@link AbstractChannel#doWrite(ChannelOutboundBuffer)}. Refer to {@link NioSocketChannel#doWrite(ChannelOutboundBuffer)} for an example. </p> @param maxCount The maximum amount of buffers that will be added to the return value. @param maxBytes A hint toward the maximum number of bytes to include as part of the return value. Note that this value maybe exceeded because we make a best effort to include at least 1 {@link ByteBuffer} in the return value to ensure write progress is made.
[ "Returns", "an", "array", "of", "direct", "NIO", "buffers", "if", "the", "currently", "pending", "messages", "are", "made", "of", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java#L400-L464
train
Returns an array of NIO buffers that can be used to write the data in the buffer.
[ 30522, 2270, 24880, 8569, 12494, 1031, 1033, 9152, 16429, 16093, 24396, 1006, 20014, 4098, 3597, 16671, 1010, 2146, 4098, 3762, 4570, 1007, 1063, 20865, 4098, 3597, 16671, 1028, 1014, 1025, 20865, 4098, 3762, 4570, 1028, 1014, 1025, 2146, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/store/ZooKeeperMesosWorkerStore.java
ZooKeeperMesosWorkerStore.newTaskID
@Override public Protos.TaskID newTaskID() throws Exception { synchronized (startStopLock) { verifyIsRunning(); int nextCount; boolean success; do { ZooKeeperVersionedValue<Integer> count = totalTaskCountInZooKeeper.getVersionedValue(); nextCount = count.getValue() + 1; success = totalTaskCountInZooKeeper.trySetCount(count, nextCount); } while (!success); Protos.TaskID taskID = Protos.TaskID.newBuilder().setValue(TASKID_FORMAT.format(nextCount)).build(); return taskID; } }
java
@Override public Protos.TaskID newTaskID() throws Exception { synchronized (startStopLock) { verifyIsRunning(); int nextCount; boolean success; do { ZooKeeperVersionedValue<Integer> count = totalTaskCountInZooKeeper.getVersionedValue(); nextCount = count.getValue() + 1; success = totalTaskCountInZooKeeper.trySetCount(count, nextCount); } while (!success); Protos.TaskID taskID = Protos.TaskID.newBuilder().setValue(TASKID_FORMAT.format(nextCount)).build(); return taskID; } }
[ "@", "Override", "public", "Protos", ".", "TaskID", "newTaskID", "(", ")", "throws", "Exception", "{", "synchronized", "(", "startStopLock", ")", "{", "verifyIsRunning", "(", ")", ";", "int", "nextCount", ";", "boolean", "success", ";", "do", "{", "ZooKeeper...
Generates a new task ID.
[ "Generates", "a", "new", "task", "ID", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/store/ZooKeeperMesosWorkerStore.java#L150-L167
train
Creates a new ID.
[ 30522, 1030, 2058, 15637, 2270, 15053, 2015, 1012, 4708, 3593, 25597, 19895, 3593, 1006, 1007, 11618, 6453, 1063, 25549, 1006, 4627, 14399, 7878, 1007, 1063, 20410, 2483, 15532, 5582, 1006, 1007, 1025, 20014, 2279, 3597, 16671, 1025, 22017, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java
DoubleArrayTrie.transition
protected int transition(char[] path) { int b = base[0]; int p; for (int i = 0; i < path.length; ++i) { p = b + (int) (path[i]) + 1; if (b == check[p]) b = base[p]; else return -1; } p = b; return p; }
java
protected int transition(char[] path) { int b = base[0]; int p; for (int i = 0; i < path.length; ++i) { p = b + (int) (path[i]) + 1; if (b == check[p]) b = base[p]; else return -1; } p = b; return p; }
[ "protected", "int", "transition", "(", "char", "[", "]", "path", ")", "{", "int", "b", "=", "base", "[", "0", "]", ";", "int", "p", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "path", ".", "length", ";", "++", "i", ")", "{", "p", ...
沿着节点转移状态 @param path @return
[ "沿着节点转移状态" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1044-L1060
train
transition to a base
[ 30522, 5123, 20014, 6653, 1006, 25869, 1031, 1033, 4130, 1007, 1063, 20014, 1038, 1027, 2918, 1031, 1014, 1033, 1025, 20014, 1052, 1025, 2005, 1006, 20014, 1045, 1027, 1014, 1025, 1045, 1026, 4130, 1012, 3091, 1025, 1009, 1009, 1045, 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...
netty/netty
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java
OpenSslSessionStats.acceptGood
public long acceptGood() { Lock readerLock = context.ctxLock.readLock(); readerLock.lock(); try { return SSLContext.sessionAcceptGood(context.ctx); } finally { readerLock.unlock(); } }
java
public long acceptGood() { Lock readerLock = context.ctxLock.readLock(); readerLock.lock(); try { return SSLContext.sessionAcceptGood(context.ctx); } finally { readerLock.unlock(); } }
[ "public", "long", "acceptGood", "(", ")", "{", "Lock", "readerLock", "=", "context", ".", "ctxLock", ".", "readLock", "(", ")", ";", "readerLock", ".", "lock", "(", ")", ";", "try", "{", "return", "SSLContext", ".", "sessionAcceptGood", "(", "context", "...
Returns the number of successfully established SSL/TLS sessions in server mode.
[ "Returns", "the", "number", "of", "successfully", "established", "SSL", "/", "TLS", "sessions", "in", "server", "mode", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L108-L116
train
Returns the number of good sessions.
[ 30522, 2270, 2146, 5138, 24146, 1006, 1007, 1063, 5843, 8068, 7878, 1027, 6123, 1012, 14931, 2595, 7878, 1012, 3191, 7878, 1006, 1007, 1025, 8068, 7878, 1012, 5843, 1006, 1007, 1025, 3046, 1063, 2709, 7020, 22499, 10111, 18413, 1012, 5219, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.touch
public static File touch(File file) throws IORuntimeException { if (null == file) { return null; } if (false == file.exists()) { mkParentDirs(file); try { file.createNewFile(); } catch (Exception e) { throw new IORuntimeException(e); } } return file; }
java
public static File touch(File file) throws IORuntimeException { if (null == file) { return null; } if (false == file.exists()) { mkParentDirs(file); try { file.createNewFile(); } catch (Exception e) { throw new IORuntimeException(e); } } return file; }
[ "public", "static", "File", "touch", "(", "File", "file", ")", "throws", "IORuntimeException", "{", "if", "(", "null", "==", "file", ")", "{", "return", "null", ";", "}", "if", "(", "false", "==", "file", ".", "exists", "(", ")", ")", "{", "mkParentD...
创建文件及其父目录,如果这个文件存在,直接返回这个文件<br> 此方法不对File对象类型做判断,如果File不存在,无法判断其类型 @param file 文件对象 @return 文件,若路径为null,返回null @throws IORuntimeException IO异常
[ "创建文件及其父目录,如果这个文件存在,直接返回这个文件<br", ">", "此方法不对File对象类型做判断,如果File不存在,无法判断其类型" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L610-L623
train
Creates and touchs the specified file.
[ 30522, 2270, 10763, 5371, 3543, 1006, 5371, 5371, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2065, 1006, 19701, 1027, 1027, 5371, 1007, 1063, 2709, 19701, 1025, 1065, 2065, 1006, 6270, 30524, 1065, 1065, 2709, 5371, 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...
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java
RuleDefinitionFileConstant.getSQLStatementRuleDefinitionFileName
public static String getSQLStatementRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) { return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), SQL_STATEMENT_RULE_DEFINITION_FILE_NAME); }
java
public static String getSQLStatementRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) { return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), SQL_STATEMENT_RULE_DEFINITION_FILE_NAME); }
[ "public", "static", "String", "getSQLStatementRuleDefinitionFileName", "(", "final", "String", "rootDir", ",", "final", "DatabaseType", "databaseType", ")", "{", "return", "Joiner", ".", "on", "(", "'", "'", ")", ".", "join", "(", "rootDir", ",", "databaseType",...
Get SQL statement rule definition file name. @param rootDir root dir @param databaseType database type @return SQL statement rule definition file name
[ "Get", "SQL", "statement", "rule", "definition", "file", "name", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java#L54-L56
train
Gets the SQL statement rule definition file name.
[ 30522, 2270, 10763, 5164, 4152, 4160, 4877, 12259, 3672, 6820, 3709, 12879, 5498, 3508, 8873, 20844, 4168, 1006, 2345, 5164, 7117, 4305, 2099, 1010, 2345, 7809, 13874, 7809, 13874, 1007, 1063, 2709, 3693, 2121, 1012, 2006, 1006, 1005, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParameters.java
MesosTaskManagerParameters.create
public static MesosTaskManagerParameters create(Configuration flinkConfig) { List<ConstraintEvaluator> constraints = parseConstraints(flinkConfig.getString(MESOS_CONSTRAINTS_HARD_HOSTATTR)); // parse the common parameters ContaineredTaskManagerParameters containeredParameters = ContaineredTaskManagerParameters.create( flinkConfig, flinkConfig.getInteger(MESOS_RM_TASKS_MEMORY_MB), flinkConfig.getInteger(MESOS_RM_TASKS_SLOTS)); double cpus = flinkConfig.getDouble(MESOS_RM_TASKS_CPUS); if (cpus <= 0.0) { cpus = Math.max(containeredParameters.numSlots(), 1.0); } int gpus = flinkConfig.getInteger(MESOS_RM_TASKS_GPUS); if (gpus < 0) { throw new IllegalConfigurationException(MESOS_RM_TASKS_GPUS.key() + " cannot be negative"); } int disk = flinkConfig.getInteger(MESOS_RM_TASKS_DISK_MB); // parse the containerization parameters String imageName = flinkConfig.getString(MESOS_RM_CONTAINER_IMAGE_NAME); ContainerType containerType; String containerTypeString = flinkConfig.getString(MESOS_RM_CONTAINER_TYPE); switch (containerTypeString) { case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_MESOS: containerType = ContainerType.MESOS; break; case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_DOCKER: containerType = ContainerType.DOCKER; if (imageName == null || imageName.length() == 0) { throw new IllegalConfigurationException(MESOS_RM_CONTAINER_IMAGE_NAME.key() + " must be specified for docker container type"); } break; default: throw new IllegalConfigurationException("invalid container type: " + containerTypeString); } Option<String> containerVolOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_VOLUMES)); Option<String> dockerParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_DOCKER_PARAMETERS)); Option<String> uriParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_TM_URIS)); boolean dockerForcePullImage = flinkConfig.getBoolean(MESOS_RM_CONTAINER_DOCKER_FORCE_PULL_IMAGE); List<Protos.Volume> containerVolumes = buildVolumes(containerVolOpt); List<Protos.Parameter> dockerParameters = buildDockerParameters(dockerParamsOpt); List<String> uris = buildUris(uriParamsOpt); //obtain Task Manager Host Name from the configuration Option<String> taskManagerHostname = Option.apply(flinkConfig.getString(MESOS_TM_HOSTNAME)); //obtain command-line from the configuration String tmCommand = flinkConfig.getString(MESOS_TM_CMD); Option<String> tmBootstrapCommand = Option.apply(flinkConfig.getString(MESOS_TM_BOOTSTRAP_CMD)); return new MesosTaskManagerParameters( cpus, gpus, disk, containerType, Option.apply(imageName), containeredParameters, containerVolumes, dockerParameters, dockerForcePullImage, constraints, tmCommand, tmBootstrapCommand, taskManagerHostname, uris); }
java
public static MesosTaskManagerParameters create(Configuration flinkConfig) { List<ConstraintEvaluator> constraints = parseConstraints(flinkConfig.getString(MESOS_CONSTRAINTS_HARD_HOSTATTR)); // parse the common parameters ContaineredTaskManagerParameters containeredParameters = ContaineredTaskManagerParameters.create( flinkConfig, flinkConfig.getInteger(MESOS_RM_TASKS_MEMORY_MB), flinkConfig.getInteger(MESOS_RM_TASKS_SLOTS)); double cpus = flinkConfig.getDouble(MESOS_RM_TASKS_CPUS); if (cpus <= 0.0) { cpus = Math.max(containeredParameters.numSlots(), 1.0); } int gpus = flinkConfig.getInteger(MESOS_RM_TASKS_GPUS); if (gpus < 0) { throw new IllegalConfigurationException(MESOS_RM_TASKS_GPUS.key() + " cannot be negative"); } int disk = flinkConfig.getInteger(MESOS_RM_TASKS_DISK_MB); // parse the containerization parameters String imageName = flinkConfig.getString(MESOS_RM_CONTAINER_IMAGE_NAME); ContainerType containerType; String containerTypeString = flinkConfig.getString(MESOS_RM_CONTAINER_TYPE); switch (containerTypeString) { case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_MESOS: containerType = ContainerType.MESOS; break; case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_DOCKER: containerType = ContainerType.DOCKER; if (imageName == null || imageName.length() == 0) { throw new IllegalConfigurationException(MESOS_RM_CONTAINER_IMAGE_NAME.key() + " must be specified for docker container type"); } break; default: throw new IllegalConfigurationException("invalid container type: " + containerTypeString); } Option<String> containerVolOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_VOLUMES)); Option<String> dockerParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_DOCKER_PARAMETERS)); Option<String> uriParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_TM_URIS)); boolean dockerForcePullImage = flinkConfig.getBoolean(MESOS_RM_CONTAINER_DOCKER_FORCE_PULL_IMAGE); List<Protos.Volume> containerVolumes = buildVolumes(containerVolOpt); List<Protos.Parameter> dockerParameters = buildDockerParameters(dockerParamsOpt); List<String> uris = buildUris(uriParamsOpt); //obtain Task Manager Host Name from the configuration Option<String> taskManagerHostname = Option.apply(flinkConfig.getString(MESOS_TM_HOSTNAME)); //obtain command-line from the configuration String tmCommand = flinkConfig.getString(MESOS_TM_CMD); Option<String> tmBootstrapCommand = Option.apply(flinkConfig.getString(MESOS_TM_BOOTSTRAP_CMD)); return new MesosTaskManagerParameters( cpus, gpus, disk, containerType, Option.apply(imageName), containeredParameters, containerVolumes, dockerParameters, dockerForcePullImage, constraints, tmCommand, tmBootstrapCommand, taskManagerHostname, uris); }
[ "public", "static", "MesosTaskManagerParameters", "create", "(", "Configuration", "flinkConfig", ")", "{", "List", "<", "ConstraintEvaluator", ">", "constraints", "=", "parseConstraints", "(", "flinkConfig", ".", "getString", "(", "MESOS_CONSTRAINTS_HARD_HOSTATTR", ")", ...
Create the Mesos TaskManager parameters. @param flinkConfig the TM configuration.
[ "Create", "the", "Mesos", "TaskManager", "parameters", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParameters.java#L333-L412
train
Create the MesosTaskManagerParameters object from the configuration.
[ 30522, 2270, 10763, 2033, 17063, 10230, 22287, 5162, 4590, 28689, 22828, 2015, 3443, 1006, 9563, 13109, 19839, 8663, 8873, 2290, 1007, 1063, 2862, 1026, 27142, 13331, 7630, 8844, 1028, 14679, 1027, 11968, 3366, 8663, 20528, 18447, 2015, 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...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
HttpCommandExecutor.defineCommand
protected void defineCommand(String commandName, CommandInfo info) { checkNotNull(commandName); checkNotNull(info); commandCodec.defineCommand(commandName, info.getMethod(), info.getUrl()); }
java
protected void defineCommand(String commandName, CommandInfo info) { checkNotNull(commandName); checkNotNull(info); commandCodec.defineCommand(commandName, info.getMethod(), info.getUrl()); }
[ "protected", "void", "defineCommand", "(", "String", "commandName", ",", "CommandInfo", "info", ")", "{", "checkNotNull", "(", "commandName", ")", ";", "checkNotNull", "(", "info", ")", ";", "commandCodec", ".", "defineCommand", "(", "commandName", ",", "info", ...
It may be useful to extend the commands understood by this {@code HttpCommandExecutor} at run time, and this can be achieved via this method. Note, this is protected, and expected usage is for subclasses only to call this. @param commandName The name of the command to use. @param info CommandInfo for the command name provided
[ "It", "may", "be", "useful", "to", "extend", "the", "commands", "understood", "by", "this", "{", "@code", "HttpCommandExecutor", "}", "at", "run", "time", "and", "this", "can", "be", "achieved", "via", "this", "method", ".", "Note", "this", "is", "protecte...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java#L101-L105
train
Defines a command.
[ 30522, 5123, 11675, 9375, 9006, 2386, 30524, 2278, 1012, 9375, 9006, 2386, 2094, 1006, 3094, 18442, 1010, 18558, 1012, 2131, 11368, 6806, 2094, 1006, 1007, 1010, 18558, 1012, 2131, 3126, 2140, 1006, 1007, 1007, 1025, 1065, 102, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java
NetUtil.isInnerIP
public static boolean isInnerIP(String ipAddress) { boolean isInnerIp = false; long ipNum = NetUtil.ipv4ToLong(ipAddress); long aBegin = NetUtil.ipv4ToLong("10.0.0.0"); long aEnd = NetUtil.ipv4ToLong("10.255.255.255"); long bBegin = NetUtil.ipv4ToLong("172.16.0.0"); long bEnd = NetUtil.ipv4ToLong("172.31.255.255"); long cBegin = NetUtil.ipv4ToLong("192.168.0.0"); long cEnd = NetUtil.ipv4ToLong("192.168.255.255"); isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals(LOCAL_IP); return isInnerIp; }
java
public static boolean isInnerIP(String ipAddress) { boolean isInnerIp = false; long ipNum = NetUtil.ipv4ToLong(ipAddress); long aBegin = NetUtil.ipv4ToLong("10.0.0.0"); long aEnd = NetUtil.ipv4ToLong("10.255.255.255"); long bBegin = NetUtil.ipv4ToLong("172.16.0.0"); long bEnd = NetUtil.ipv4ToLong("172.31.255.255"); long cBegin = NetUtil.ipv4ToLong("192.168.0.0"); long cEnd = NetUtil.ipv4ToLong("192.168.255.255"); isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals(LOCAL_IP); return isInnerIp; }
[ "public", "static", "boolean", "isInnerIP", "(", "String", "ipAddress", ")", "{", "boolean", "isInnerIp", "=", "false", ";", "long", "ipNum", "=", "NetUtil", ".", "ipv4ToLong", "(", "ipAddress", ")", ";", "long", "aBegin", "=", "NetUtil", ".", "ipv4ToLong", ...
判定是否为内网IP<br> 私有IP:A类 10.0.0.0-10.255.255.255 B类 172.16.0.0-172.31.255.255 C类 192.168.0.0-192.168.255.255 当然,还有127这个网段是环回地址 @param ipAddress IP地址 @return 是否为内网IP
[ "判定是否为内网IP<br", ">", "私有IP:A类", "10", ".", "0", ".", "0", ".", "0", "-", "10", ".", "255", ".", "255", ".", "255", "B类", "172", ".", "16", ".", "0", ".", "0", "-", "172", ".", "31", ".", "255", ".", "255", "C类", "192", ".", "168", ".", "0...
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L197-L212
train
Checks if the given IP address is an inner IP address.
[ 30522, 2270, 10763, 22017, 20898, 2003, 23111, 11124, 2361, 1006, 5164, 25249, 16200, 4757, 1007, 1063, 22017, 20898, 2003, 23111, 11124, 2361, 1027, 6270, 1025, 2146, 12997, 19172, 1027, 5658, 21823, 2140, 1012, 12997, 2615, 2549, 3406, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
DataSet.partitionByHash
public PartitionOperator<T> partitionByHash(int... fields) { return new PartitionOperator<>(this, PartitionMethod.HASH, new Keys.ExpressionKeys<>(fields, getType()), Utils.getCallLocationName()); }
java
public PartitionOperator<T> partitionByHash(int... fields) { return new PartitionOperator<>(this, PartitionMethod.HASH, new Keys.ExpressionKeys<>(fields, getType()), Utils.getCallLocationName()); }
[ "public", "PartitionOperator", "<", "T", ">", "partitionByHash", "(", "int", "...", "fields", ")", "{", "return", "new", "PartitionOperator", "<>", "(", "this", ",", "PartitionMethod", ".", "HASH", ",", "new", "Keys", ".", "ExpressionKeys", "<>", "(", "field...
Hash-partitions a DataSet on the specified key fields. <p><b>Important:</b>This operation shuffles the whole DataSet over the network and can take significant amount of time. @param fields The field indexes on which the DataSet is hash-partitioned. @return The partitioned DataSet.
[ "Hash", "-", "partitions", "a", "DataSet", "on", "the", "specified", "key", "fields", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1257-L1259
train
Partitions this DataSet by a hash function.
[ 30522, 2270, 13571, 25918, 8844, 1026, 1056, 1028, 13571, 3762, 14949, 2232, 1006, 20014, 1012, 1012, 1012, 4249, 1007, 1063, 2709, 2047, 13571, 25918, 8844, 1026, 1028, 1006, 2023, 1010, 13571, 11368, 6806, 2094, 1012, 23325, 1010, 2047, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartition.java
ResultPartition.notifyPipelinedConsumers
private void notifyPipelinedConsumers() { if (sendScheduleOrUpdateConsumersMessage && !hasNotifiedPipelinedConsumers && partitionType.isPipelined()) { partitionConsumableNotifier.notifyPartitionConsumable(jobId, partitionId, taskActions); hasNotifiedPipelinedConsumers = true; } }
java
private void notifyPipelinedConsumers() { if (sendScheduleOrUpdateConsumersMessage && !hasNotifiedPipelinedConsumers && partitionType.isPipelined()) { partitionConsumableNotifier.notifyPartitionConsumable(jobId, partitionId, taskActions); hasNotifiedPipelinedConsumers = true; } }
[ "private", "void", "notifyPipelinedConsumers", "(", ")", "{", "if", "(", "sendScheduleOrUpdateConsumersMessage", "&&", "!", "hasNotifiedPipelinedConsumers", "&&", "partitionType", ".", "isPipelined", "(", ")", ")", "{", "partitionConsumableNotifier", ".", "notifyPartition...
Notifies pipelined consumers of this result partition once.
[ "Notifies", "pipelined", "consumers", "of", "this", "result", "partition", "once", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartition.java#L462-L468
train
Notifies consumers of pipelined consumers
[ 30522, 2797, 11675, 2025, 8757, 24548, 18194, 8663, 23545, 2869, 1006, 1007, 1063, 2065, 1006, 10255, 7690, 9307, 2953, 6279, 13701, 8663, 23545, 2869, 7834, 3736, 3351, 1004, 1004, 999, 8440, 4140, 7810, 24548, 18194, 8663, 23545, 2869, 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.rename
public static File rename(File file, String newName, boolean isRetainExt, boolean isOverride) { if (isRetainExt) { newName = newName.concat(".").concat(FileUtil.extName(file)); } final Path path = file.toPath(); final CopyOption[] options = isOverride ? new CopyOption[] { StandardCopyOption.REPLACE_EXISTING } : new CopyOption[] {}; try { return Files.move(path, path.resolveSibling(newName), options).toFile(); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static File rename(File file, String newName, boolean isRetainExt, boolean isOverride) { if (isRetainExt) { newName = newName.concat(".").concat(FileUtil.extName(file)); } final Path path = file.toPath(); final CopyOption[] options = isOverride ? new CopyOption[] { StandardCopyOption.REPLACE_EXISTING } : new CopyOption[] {}; try { return Files.move(path, path.resolveSibling(newName), options).toFile(); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "File", "rename", "(", "File", "file", ",", "String", "newName", ",", "boolean", "isRetainExt", ",", "boolean", "isOverride", ")", "{", "if", "(", "isRetainExt", ")", "{", "newName", "=", "newName", ".", "concat", "(", "\".\"", ")", "...
修改文件或目录的文件名,不变更路径,只是简单修改文件名<br> 重命名有两种模式:<br> 1、isRetainExt为true时,保留原扩展名: <pre> FileUtil.rename(file, "aaa", true) xx/xx.png =》xx/aaa.png </pre> 2、isRetainExt为false时,不保留原扩展名,需要在newName中 <pre> FileUtil.rename(file, "aaa.jpg", false) xx/xx.png =》xx/aaa.jpg </pre> @param file 被修改的文件 @param newName 新的文件名,包括扩展名 @param isRetainExt 是否保留原文件的扩展名,如果保留,则newName不需要加扩展名 @param isOverride 是否覆盖目标文件 @return 目标文件 @since 3.0.9
[ "修改文件或目录的文件名,不变更路径,只是简单修改文件名<br", ">", "重命名有两种模式:<br", ">", "1、isRetainExt为true时,保留原扩展名:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1110-L1121
train
Rename a file.
[ 30522, 2270, 10763, 5371, 14916, 14074, 1006, 5371, 5371, 1010, 5164, 2047, 18442, 1010, 22017, 20898, 2003, 13465, 18175, 18413, 1010, 22017, 20898, 11163, 6299, 15637, 1007, 1063, 2065, 1006, 2003, 13465, 18175, 18413, 1007, 1063, 2047, 184...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.post
public static String post(String urlString, String body) { return post(urlString, body, HttpRequest.TIMEOUT_DEFAULT); }
java
public static String post(String urlString, String body) { return post(urlString, body, HttpRequest.TIMEOUT_DEFAULT); }
[ "public", "static", "String", "post", "(", "String", "urlString", ",", "String", "body", ")", "{", "return", "post", "(", "urlString", ",", "body", ",", "HttpRequest", ".", "TIMEOUT_DEFAULT", ")", ";", "}" ]
发送post请求<br> 请求体body参数支持两种类型: <pre> 1. 标准参数,例如 a=1&amp;b=2 这种格式 2. Rest模式,此时body需要传入一个JSON或者XML字符串,Hutool会自动绑定其对应的Content-Type </pre> @param urlString 网址 @param body post表单数据 @return 返回数据
[ "发送post请求<br", ">", "请求体body参数支持两种类型:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L183-L185
train
Perform a POST request with the given body.
[ 30522, 2270, 10763, 5164, 2695, 1006, 5164, 24471, 4877, 18886, 3070, 1010, 5164, 2303, 1007, 1063, 2709, 2695, 1006, 24471, 4877, 18886, 3070, 1010, 2303, 1010, 8299, 2890, 15500, 1012, 2051, 5833, 1035, 12398, 1007, 1025, 1065, 102, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/word2vec/DocVectorModel.java
DocVectorModel.similarity
public float similarity(String what, String with) { Vector A = query(what); if (A == null) return -1f; Vector B = query(with); if (B == null) return -1f; return A.cosineForUnitVector(B); }
java
public float similarity(String what, String with) { Vector A = query(what); if (A == null) return -1f; Vector B = query(with); if (B == null) return -1f; return A.cosineForUnitVector(B); }
[ "public", "float", "similarity", "(", "String", "what", ",", "String", "with", ")", "{", "Vector", "A", "=", "query", "(", "what", ")", ";", "if", "(", "A", "==", "null", ")", "return", "-", "1f", ";", "Vector", "B", "=", "query", "(", "with", ")...
文档相似度计算 @param what @param with @return
[ "文档相似度计算" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/DocVectorModel.java#L104-L111
train
Returns the similarity of two terms of the two terms.
[ 30522, 2270, 14257, 14402, 1006, 5164, 2054, 1010, 5164, 2007, 1007, 1063, 9207, 1037, 1027, 23032, 1006, 2054, 1007, 1025, 2065, 1006, 1037, 1027, 1027, 19701, 1007, 2709, 1011, 1015, 2546, 1025, 9207, 1038, 1027, 23032, 1006, 2007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/common/Vertex.java
Vertex.newAddressInstance
public static Vertex newAddressInstance(String realWord) { return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, 1000)); }
java
public static Vertex newAddressInstance(String realWord) { return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, 1000)); }
[ "public", "static", "Vertex", "newAddressInstance", "(", "String", "realWord", ")", "{", "return", "new", "Vertex", "(", "Predefine", ".", "TAG_PLACE", ",", "realWord", ",", "new", "CoreDictionary", ".", "Attribute", "(", "Nature", ".", "ns", ",", "1000", ")...
创建一个地名实例 @param realWord 数字对应的真实字串 @return 地名顶点
[ "创建一个地名实例" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L353-L356
train
Create a new address instance.
[ 30522, 2270, 10763, 19449, 2047, 4215, 16200, 18719, 23808, 6651, 1006, 5164, 2613, 18351, 1007, 1063, 2709, 2047, 19449, 1006, 3653, 3207, 23460, 1012, 6415, 1035, 2173, 1010, 2613, 18351, 1010, 2047, 4563, 29201, 3258, 5649, 1012, 17961, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java
MainClassFinder.findSingleMainClass
public static String findSingleMainClass(JarFile jarFile, String classesLocation) throws IOException { return findSingleMainClass(jarFile, classesLocation, null); }
java
public static String findSingleMainClass(JarFile jarFile, String classesLocation) throws IOException { return findSingleMainClass(jarFile, classesLocation, null); }
[ "public", "static", "String", "findSingleMainClass", "(", "JarFile", "jarFile", ",", "String", "classesLocation", ")", "throws", "IOException", "{", "return", "findSingleMainClass", "(", "jarFile", ",", "classesLocation", ",", "null", ")", ";", "}" ]
Find a single main class in a given jar file. @param jarFile the jar file to search @param classesLocation the location within the jar containing classes @return the main class or {@code null} @throws IOException if the jar file cannot be read
[ "Find", "a", "single", "main", "class", "in", "a", "given", "jar", "file", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L185-L188
train
Find the single main class in the given jar file.
[ 30522, 2270, 10763, 5164, 4858, 2075, 16930, 8113, 26266, 1006, 15723, 8873, 2571, 15723, 8873, 2571, 1010, 5164, 4280, 4135, 10719, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 4858, 2075, 16930, 8113, 26266, 1006, 15723, 8873, 2571, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readLines
public static <T extends Collection<String>> T readLines(Reader reader, final T collection) throws IORuntimeException { readLines(reader, new LineHandler() { @Override public void handle(String line) { collection.add(line); } }); return collection; }
java
public static <T extends Collection<String>> T readLines(Reader reader, final T collection) throws IORuntimeException { readLines(reader, new LineHandler() { @Override public void handle(String line) { collection.add(line); } }); return collection; }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readLines", "(", "Reader", "reader", ",", "final", "T", "collection", ")", "throws", "IORuntimeException", "{", "readLines", "(", "reader", ",", "new", "LineHandler", "(", ...
从Reader中读取内容 @param <T> 集合类型 @param reader {@link Reader} @param collection 返回集合 @return 内容 @throws IORuntimeException IO异常
[ "从Reader中读取内容" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L671-L679
train
Reads a collection of lines from the specified reader.
[ 30522, 2270, 10763, 1026, 1056, 8908, 3074, 1026, 5164, 1028, 1028, 1056, 3191, 12735, 1006, 8068, 8068, 1010, 2345, 1056, 3074, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 3191, 12735, 1006, 8068, 1010, 2047, 2240, 11774, 3917, 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/lang/Validator.java
Validator.validateUrl
public static <T extends CharSequence> T validateUrl(T value, String errorMsg) throws ValidateException { if (false == isUrl(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateUrl(T value, String errorMsg) throws ValidateException { if (false == isUrl(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateUrl", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isUrl", "(", "value", ")", ")", "{", "throw", "new", "Vali...
验证是否为URL @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为URL" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L922-L927
train
Validate a URL.
[ 30522, 2270, 10763, 1026, 1056, 8908, 25869, 3366, 4226, 5897, 1028, 1056, 9398, 3686, 3126, 2140, 1006, 1056, 3643, 1010, 5164, 7561, 5244, 2290, 1007, 11618, 9398, 3686, 10288, 24422, 1063, 2065, 1006, 6270, 1027, 1027, 2003, 3126, 2140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/stopword/CoreStopWordDictionary.java
CoreStopWordDictionary.load
public static void load(String coreStopWordDictionaryPath, boolean loadCacheIfPossible) { ByteArray byteArray = loadCacheIfPossible ? ByteArray.createByteArray(coreStopWordDictionaryPath + Predefine.BIN_EXT) : null; if (byteArray == null) { try { dictionary = new StopWordDictionary(HanLP.Config.CoreStopWordDictionaryPath); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(HanLP.Config.CoreStopWordDictionaryPath + Predefine.BIN_EXT))); dictionary.save(out); out.close(); } catch (Exception e) { logger.severe("载入停用词词典" + HanLP.Config.CoreStopWordDictionaryPath + "失败" + TextUtility.exceptionToString(e)); throw new RuntimeException("载入停用词词典" + HanLP.Config.CoreStopWordDictionaryPath + "失败"); } } else { dictionary = new StopWordDictionary(); dictionary.load(byteArray); } }
java
public static void load(String coreStopWordDictionaryPath, boolean loadCacheIfPossible) { ByteArray byteArray = loadCacheIfPossible ? ByteArray.createByteArray(coreStopWordDictionaryPath + Predefine.BIN_EXT) : null; if (byteArray == null) { try { dictionary = new StopWordDictionary(HanLP.Config.CoreStopWordDictionaryPath); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(HanLP.Config.CoreStopWordDictionaryPath + Predefine.BIN_EXT))); dictionary.save(out); out.close(); } catch (Exception e) { logger.severe("载入停用词词典" + HanLP.Config.CoreStopWordDictionaryPath + "失败" + TextUtility.exceptionToString(e)); throw new RuntimeException("载入停用词词典" + HanLP.Config.CoreStopWordDictionaryPath + "失败"); } } else { dictionary = new StopWordDictionary(); dictionary.load(byteArray); } }
[ "public", "static", "void", "load", "(", "String", "coreStopWordDictionaryPath", ",", "boolean", "loadCacheIfPossible", ")", "{", "ByteArray", "byteArray", "=", "loadCacheIfPossible", "?", "ByteArray", ".", "createByteArray", "(", "coreStopWordDictionaryPath", "+", "Pre...
加载另一部停用词词典 @param coreStopWordDictionaryPath 词典路径 @param loadCacheIfPossible 是否优先加载缓存(速度更快)
[ "加载另一部停用词词典" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/stopword/CoreStopWordDictionary.java#L53-L76
train
Load a stop word dictionary.
[ 30522, 2270, 10763, 11675, 7170, 1006, 5164, 25562, 14399, 18351, 29201, 3258, 5649, 15069, 1010, 22017, 20898, 7170, 3540, 5403, 10128, 6873, 18719, 3468, 1007, 1063, 24880, 2906, 9447, 24880, 2906, 9447, 1027, 7170, 3540, 5403, 10128, 6873,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.setBoolean
public static void setBoolean(MemorySegment[] segments, int offset, boolean value) { if (inFirstSegment(segments, offset, 1)) { segments[0].putBoolean(offset, value); } else { setBooleanMultiSegments(segments, offset, value); } }
java
public static void setBoolean(MemorySegment[] segments, int offset, boolean value) { if (inFirstSegment(segments, offset, 1)) { segments[0].putBoolean(offset, value); } else { setBooleanMultiSegments(segments, offset, value); } }
[ "public", "static", "void", "setBoolean", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "boolean", "value", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "1", ")", ")", "{", "segments", "[", "0", "...
set boolean from segments. @param segments target segments. @param offset value offset.
[ "set", "boolean", "from", "segments", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L555-L561
train
set boolean from segments.
[ 30522, 2270, 10763, 11675, 2275, 5092, 9890, 2319, 1006, 3638, 3366, 21693, 4765, 1031, 1033, 9214, 1010, 20014, 16396, 1010, 22017, 20898, 3643, 1007, 1063, 2065, 1006, 1999, 8873, 12096, 3366, 21693, 4765, 1006, 9214, 1010, 16396, 1010, 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-http/src/main/java/cn/hutool/http/HttpResponse.java
HttpResponse.writeBody
public long writeBody(OutputStream out, boolean isCloseOut, StreamProgress streamProgress) { if (null == out) { throw new NullPointerException("[out] is null!"); } try { return IoUtil.copyByNIO(bodyStream(), out, IoUtil.DEFAULT_BUFFER_SIZE, streamProgress); } finally { IoUtil.close(this); if (isCloseOut) { IoUtil.close(out); } } }
java
public long writeBody(OutputStream out, boolean isCloseOut, StreamProgress streamProgress) { if (null == out) { throw new NullPointerException("[out] is null!"); } try { return IoUtil.copyByNIO(bodyStream(), out, IoUtil.DEFAULT_BUFFER_SIZE, streamProgress); } finally { IoUtil.close(this); if (isCloseOut) { IoUtil.close(out); } } }
[ "public", "long", "writeBody", "(", "OutputStream", "out", ",", "boolean", "isCloseOut", ",", "StreamProgress", "streamProgress", ")", "{", "if", "(", "null", "==", "out", ")", "{", "throw", "new", "NullPointerException", "(", "\"[out] is null!\"", ")", ";", "...
将响应内容写出到{@link OutputStream}<br> 异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出<br> 写出后会关闭Http流(异步模式) @param out 写出的流 @param isCloseOut 是否关闭输出流 @param streamProgress 进度显示接口,通过实现此接口显示下载进度 @return 写出bytes数 @since 3.3.2
[ "将响应内容写出到", "{", "@link", "OutputStream", "}", "<br", ">", "异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出<br", ">", "写出后会关闭Http流(异步模式)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L235-L247
train
Writes the body of this message to the given output stream.
[ 30522, 2270, 2146, 4339, 23684, 1006, 27852, 25379, 2041, 1010, 22017, 20898, 2003, 20464, 9232, 5833, 1010, 5460, 21572, 17603, 4757, 5460, 21572, 17603, 4757, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 2041, 1007, 1063, 5466, 2047, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readUtf8Lines
public static List<String> readUtf8Lines(File file) throws IORuntimeException { return readLines(file, CharsetUtil.CHARSET_UTF_8); }
java
public static List<String> readUtf8Lines(File file) throws IORuntimeException { return readLines(file, CharsetUtil.CHARSET_UTF_8); }
[ "public", "static", "List", "<", "String", ">", "readUtf8Lines", "(", "File", "file", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "file", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ";", "}" ]
从文件中读取每一行数据 @param file 文件 @return 文件中的每行内容的集合List @throws IORuntimeException IO异常 @since 3.1.1
[ "从文件中读取每一行数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2368-L2370
train
Reads a file of UTF - 8 lines into a list of strings.
[ 30522, 2270, 10763, 2862, 1026, 5164, 1028, 3191, 4904, 2546, 2620, 12735, 1006, 5371, 5371, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2709, 3191, 12735, 1006, 5371, 1010, 25869, 13462, 21823, 2140, 1012, 25869, 13462, 1035, 21183,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java
MergingWindowSet.retireWindow
public void retireWindow(W window) { W removed = this.mapping.remove(window); if (removed == null) { throw new IllegalStateException("Window " + window + " is not in in-flight window set."); } }
java
public void retireWindow(W window) { W removed = this.mapping.remove(window); if (removed == null) { throw new IllegalStateException("Window " + window + " is not in in-flight window set."); } }
[ "public", "void", "retireWindow", "(", "W", "window", ")", "{", "W", "removed", "=", "this", ".", "mapping", ".", "remove", "(", "window", ")", ";", "if", "(", "removed", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Window \""...
Removes the given window from the set of in-flight windows. @param window The {@code Window} to remove.
[ "Removes", "the", "given", "window", "from", "the", "set", "of", "in", "-", "flight", "windows", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java#L128-L133
train
Retire a window from the in - flight window set.
[ 30522, 2270, 11675, 11036, 11101, 5004, 1006, 1059, 3332, 1007, 1063, 1059, 3718, 1027, 2023, 1012, 12375, 1012, 6366, 1006, 3332, 1007, 1025, 2065, 1006, 3718, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 9153, 17389, 2595, 24422, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/OneTimeLeaderListenerFuture.java
OneTimeLeaderListenerFuture.notifyLeaderAddress
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { future.complete(new LeaderAddressAndId(leaderAddress, leaderSessionID)); }
java
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { future.complete(new LeaderAddressAndId(leaderAddress, leaderSessionID)); }
[ "@", "Override", "public", "void", "notifyLeaderAddress", "(", "String", "leaderAddress", ",", "UUID", "leaderSessionID", ")", "{", "future", ".", "complete", "(", "new", "LeaderAddressAndId", "(", "leaderAddress", ",", "leaderSessionID", ")", ")", ";", "}" ]
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/OneTimeLeaderListenerFuture.java#L50-L53
train
Notifies the leader address.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2025, 8757, 19000, 4215, 16200, 4757, 1006, 5164, 3003, 4215, 16200, 4757, 1010, 1057, 21272, 4177, 7971, 3258, 3593, 1007, 1063, 2925, 1012, 3143, 1006, 2047, 3003, 4215, 16200, 11488, 16089, 2094, 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-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourcePropertyProviderLoader.java
DataSourcePropertyProviderLoader.getProvider
public static DataSourcePropertyProvider getProvider(final DataSource dataSource) { String dataSourceClassName = dataSource.getClass().getName(); return DATA_SOURCE_PROPERTY_PROVIDERS.containsKey(dataSourceClassName) ? DATA_SOURCE_PROPERTY_PROVIDERS.get(dataSourceClassName) : new DefaultDataSourcePropertyProvider(); }
java
public static DataSourcePropertyProvider getProvider(final DataSource dataSource) { String dataSourceClassName = dataSource.getClass().getName(); return DATA_SOURCE_PROPERTY_PROVIDERS.containsKey(dataSourceClassName) ? DATA_SOURCE_PROPERTY_PROVIDERS.get(dataSourceClassName) : new DefaultDataSourcePropertyProvider(); }
[ "public", "static", "DataSourcePropertyProvider", "getProvider", "(", "final", "DataSource", "dataSource", ")", "{", "String", "dataSourceClassName", "=", "dataSource", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "return", "DATA_SOURCE_PROPERTY_PROVIDERS...
Get data source property provider. @param dataSource data source @return data source property provider
[ "Get", "data", "source", "property", "provider", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourcePropertyProviderLoader.java#L48-L51
train
Gets the provider.
[ 30522, 2270, 10763, 2951, 6499, 3126, 3401, 21572, 4842, 3723, 21572, 17258, 2121, 2131, 21572, 17258, 2121, 1006, 2345, 2951, 6499, 3126, 3401, 2951, 6499, 3126, 3401, 1007, 1063, 5164, 2951, 6499, 3126, 3401, 26266, 18442, 1027, 2951, 649...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
LogBuffer.getBeUlong64
public final BigInteger getBeUlong64(final int pos) { final long long64 = getBeLong64(pos); return (long64 >= 0) ? BigInteger.valueOf(long64) : BIGINT_MAX_VALUE.add(BigInteger.valueOf(1 + long64)); }
java
public final BigInteger getBeUlong64(final int pos) { final long long64 = getBeLong64(pos); return (long64 >= 0) ? BigInteger.valueOf(long64) : BIGINT_MAX_VALUE.add(BigInteger.valueOf(1 + long64)); }
[ "public", "final", "BigInteger", "getBeUlong64", "(", "final", "int", "pos", ")", "{", "final", "long", "long64", "=", "getBeLong64", "(", "pos", ")", ";", "return", "(", "long64", ">=", "0", ")", "?", "BigInteger", ".", "valueOf", "(", "long64", ")", ...
Return 64-bit unsigned long from buffer. (big-endian) @see mysql-5.6.10/include/myisampack.h - mi_uint8korr
[ "Return", "64", "-", "bit", "unsigned", "long", "from", "buffer", ".", "(", "big", "-", "endian", ")" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L919-L923
train
Gets a big int from the record.
[ 30522, 2270, 2345, 2502, 18447, 26320, 2131, 4783, 18845, 3070, 21084, 1006, 2345, 20014, 13433, 2015, 1007, 1063, 2345, 2146, 2146, 21084, 1027, 2131, 8671, 5063, 21084, 1006, 13433, 2015, 1007, 1025, 2709, 1006, 2146, 21084, 1028, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/Signal.java
Signal.valueOf
public static Signal valueOf(Class<?> firstNameComponent, String secondNameComponent) { return pool.valueOf(firstNameComponent, secondNameComponent); }
java
public static Signal valueOf(Class<?> firstNameComponent, String secondNameComponent) { return pool.valueOf(firstNameComponent, secondNameComponent); }
[ "public", "static", "Signal", "valueOf", "(", "Class", "<", "?", ">", "firstNameComponent", ",", "String", "secondNameComponent", ")", "{", "return", "pool", ".", "valueOf", "(", "firstNameComponent", ",", "secondNameComponent", ")", ";", "}" ]
Shortcut of {@link #valueOf(String) valueOf(firstNameComponent.getName() + "#" + secondNameComponent)}.
[ "Shortcut", "of", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/Signal.java#L44-L46
train
Gets the Signal instance for the given component.
[ 30522, 2270, 10763, 4742, 3643, 11253, 1006, 2465, 1026, 1029, 1028, 2034, 18442, 9006, 29513, 3372, 1010, 5164, 2117, 18442, 9006, 29513, 3372, 1007, 1063, 2709, 4770, 1012, 3643, 11253, 1006, 2034, 18442, 9006, 29513, 3372, 1010, 2117, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.partValue
public static int partValue(int total, int partCount, boolean isPlusOneWhenHasRem) { int partValue = 0; if (total % partCount == 0) { partValue = total / partCount; } else { partValue = (int) Math.floor(total / partCount); if (isPlusOneWhenHasRem) { partValue += 1; } } return partValue; }
java
public static int partValue(int total, int partCount, boolean isPlusOneWhenHasRem) { int partValue = 0; if (total % partCount == 0) { partValue = total / partCount; } else { partValue = (int) Math.floor(total / partCount); if (isPlusOneWhenHasRem) { partValue += 1; } } return partValue; }
[ "public", "static", "int", "partValue", "(", "int", "total", ",", "int", "partCount", ",", "boolean", "isPlusOneWhenHasRem", ")", "{", "int", "partValue", "=", "0", ";", "if", "(", "total", "%", "partCount", "==", "0", ")", "{", "partValue", "=", "total"...
把给定的总数平均分成N份,返回每份的个数<br> 如果isPlusOneWhenHasRem为true,则当除以分数有余数时每份+1,否则丢弃余数部分 @param total 总数 @param partCount 份数 @param isPlusOneWhenHasRem 在有余数时是否每份+1 @return 每份的个数 @since 4.0.7
[ "把给定的总数平均分成N份,返回每份的个数<br", ">", "如果isPlusOneWhenHasRem为true,则当除以分数有余数时每份", "+", "1,否则丢弃余数部分" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2072-L2083
train
Returns the value of the last part of the total number.
[ 30522, 2270, 10763, 20014, 2112, 10175, 5657, 1006, 20014, 2561, 1010, 20014, 2112, 3597, 16671, 1010, 22017, 20898, 2003, 24759, 26658, 2638, 2860, 10222, 14949, 28578, 1007, 1063, 20014, 2112, 10175, 5657, 1027, 1014, 1025, 2065, 1006, 2561...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...