repo
stringclasses
11 values
path
stringlengths
41
234
func_name
stringlengths
5
78
original_string
stringlengths
71
14.1k
language
stringclasses
1 value
code
stringlengths
71
14.1k
code_tokens
listlengths
22
2.65k
docstring
stringlengths
2
5.35k
docstring_tokens
listlengths
1
369
sha
stringclasses
11 values
url
stringlengths
129
339
partition
stringclasses
1 value
summary
stringlengths
7
175
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
alibaba/canal
client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java
DbRemoteConfigLoader.loadRemoteConfig
@Override public void loadRemoteConfig() { try { // 加载远程adapter配置 ConfigItem configItem = getRemoteAdapterConfig(); if (configItem != null) { if (configItem.getModifiedTime() != currentConfigTimestamp) { currentConfigTimestamp = configItem.getModifiedTime(); overrideLocalCanalConfig(configItem.getContent()); logger.info("## Loaded remote adapter config: application.yml"); } } } catch (Exception e) { logger.error(e.getMessage(), e); } }
java
@Override public void loadRemoteConfig() { try { // 加载远程adapter配置 ConfigItem configItem = getRemoteAdapterConfig(); if (configItem != null) { if (configItem.getModifiedTime() != currentConfigTimestamp) { currentConfigTimestamp = configItem.getModifiedTime(); overrideLocalCanalConfig(configItem.getContent()); logger.info("## Loaded remote adapter config: application.yml"); } } } catch (Exception e) { logger.error(e.getMessage(), e); } }
[ "@", "Override", "public", "void", "loadRemoteConfig", "(", ")", "{", "try", "{", "// 加载远程adapter配置\r", "ConfigItem", "configItem", "=", "getRemoteAdapterConfig", "(", ")", ";", "if", "(", "configItem", "!=", "null", ")", "{", "if", "(", "configItem", ".", "...
加载远程application.yml配置
[ "加载远程application", ".", "yml配置" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java#L73-L88
train
Load the remote adapter config.
[ 30522, 1030, 2058, 15637, 2270, 11675, 7170, 28578, 12184, 8663, 8873, 2290, 1006, 1007, 1063, 3046, 1063, 1013, 1013, 1779, 100, 100, 100, 15581, 2121, 100, 100, 9530, 8873, 23806, 6633, 9530, 8873, 23806, 6633, 1027, 2131, 28578, 12184, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/heartbeat/HeartbeatServices.java
HeartbeatServices.createHeartbeatManagerSender
public <I, O> HeartbeatManager<I, O> createHeartbeatManagerSender( ResourceID resourceId, HeartbeatListener<I, O> heartbeatListener, ScheduledExecutor scheduledExecutor, Logger log) { return new HeartbeatManagerSenderImpl<>( heartbeatInterval, heartbeatTimeout, resourceId, heartbeatListener, scheduledExecutor, scheduledExecutor, log); }
java
public <I, O> HeartbeatManager<I, O> createHeartbeatManagerSender( ResourceID resourceId, HeartbeatListener<I, O> heartbeatListener, ScheduledExecutor scheduledExecutor, Logger log) { return new HeartbeatManagerSenderImpl<>( heartbeatInterval, heartbeatTimeout, resourceId, heartbeatListener, scheduledExecutor, scheduledExecutor, log); }
[ "public", "<", "I", ",", "O", ">", "HeartbeatManager", "<", "I", ",", "O", ">", "createHeartbeatManagerSender", "(", "ResourceID", "resourceId", ",", "HeartbeatListener", "<", "I", ",", "O", ">", "heartbeatListener", ",", "ScheduledExecutor", "scheduledExecutor", ...
Creates a heartbeat manager which actively sends heartbeats to monitoring targets. @param resourceId Resource Id which identifies the owner of the heartbeat manager @param heartbeatListener Listener which will be notified upon heartbeat timeouts for registered targets @param scheduledExecutor Scheduled executor to be used for scheduling heartbeat timeouts @param log Logger to be used for the logging @param <I> Type of the incoming payload @param <O> Type of the outgoing payload @return A new HeartbeatManager instance which actively sends heartbeats
[ "Creates", "a", "heartbeat", "manager", "which", "actively", "sends", "heartbeats", "to", "monitoring", "targets", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatServices.java#L88-L102
train
Creates a heartbeat manager sender.
[ 30522, 2270, 1026, 1045, 1010, 1051, 1028, 12251, 24805, 4590, 1026, 1045, 1010, 1051, 1028, 3443, 22375, 19442, 24805, 15776, 10497, 2121, 1006, 7692, 3593, 7692, 3593, 1010, 12251, 9863, 24454, 1026, 1045, 1010, 1051, 1028, 12251, 9863, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
EmbeddedLeaderService.confirmLeader
private void confirmLeader(final EmbeddedLeaderElectionService service, final UUID leaderSessionId) { synchronized (lock) { // if the service was shut down in the meantime, ignore this confirmation if (!service.running || shutdown) { return; } try { // check if the confirmation is for the same grant, or whether it is a stale grant if (service == currentLeaderProposed && currentLeaderSessionId.equals(leaderSessionId)) { final String address = service.contender.getAddress(); LOG.info("Received confirmation of leadership for leader {} , session={}", address, leaderSessionId); // mark leadership currentLeaderConfirmed = service; currentLeaderAddress = address; currentLeaderProposed = null; // notify all listeners notifyAllListeners(address, leaderSessionId); } else { LOG.debug("Received confirmation of leadership for a stale leadership grant. Ignoring."); } } catch (Throwable t) { fatalError(t); } } }
java
private void confirmLeader(final EmbeddedLeaderElectionService service, final UUID leaderSessionId) { synchronized (lock) { // if the service was shut down in the meantime, ignore this confirmation if (!service.running || shutdown) { return; } try { // check if the confirmation is for the same grant, or whether it is a stale grant if (service == currentLeaderProposed && currentLeaderSessionId.equals(leaderSessionId)) { final String address = service.contender.getAddress(); LOG.info("Received confirmation of leadership for leader {} , session={}", address, leaderSessionId); // mark leadership currentLeaderConfirmed = service; currentLeaderAddress = address; currentLeaderProposed = null; // notify all listeners notifyAllListeners(address, leaderSessionId); } else { LOG.debug("Received confirmation of leadership for a stale leadership grant. Ignoring."); } } catch (Throwable t) { fatalError(t); } } }
[ "private", "void", "confirmLeader", "(", "final", "EmbeddedLeaderElectionService", "service", ",", "final", "UUID", "leaderSessionId", ")", "{", "synchronized", "(", "lock", ")", "{", "// if the service was shut down in the meantime, ignore this confirmation", "if", "(", "!...
Callback from leader contenders when they confirm a leader grant.
[ "Callback", "from", "leader", "contenders", "when", "they", "confirm", "a", "leader", "grant", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java#L239-L268
train
Confirm the leader.
[ 30522, 2797, 11675, 12210, 19000, 1006, 2345, 11157, 19000, 12260, 22014, 2121, 7903, 2063, 2326, 1010, 2345, 1057, 21272, 4177, 7971, 3258, 3593, 1007, 1063, 25549, 1006, 5843, 1007, 1063, 1013, 1013, 2065, 1996, 2326, 2001, 3844, 2091, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CustomDictionary.java
CustomDictionary.add
public static boolean add(String word) { if (HanLP.Config.Normalization) word = CharTable.convert(word); if (contains(word)) return false; return insert(word, null); }
java
public static boolean add(String word) { if (HanLP.Config.Normalization) word = CharTable.convert(word); if (contains(word)) return false; return insert(word, null); }
[ "public", "static", "boolean", "add", "(", "String", "word", ")", "{", "if", "(", "HanLP", ".", "Config", ".", "Normalization", ")", "word", "=", "CharTable", ".", "convert", "(", "word", ")", ";", "if", "(", "contains", "(", "word", ")", ")", "retur...
往自定义词典中插入一个新词(非覆盖模式)<br> 动态增删不会持久化到词典文件 @param word 新词 如“裸婚” @return 是否插入成功(失败的原因可能是不覆盖等,可以通过调试模式了解原因)
[ "往自定义词典中插入一个新词(非覆盖模式)<br", ">", "动态增删不会持久化到词典文件" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L278-L283
train
Add a new CID word.
[ 30522, 2270, 10763, 22017, 20898, 5587, 1006, 5164, 2773, 1007, 1063, 2065, 1006, 7658, 14277, 1012, 9530, 8873, 2290, 1012, 3671, 3989, 1007, 2773, 1027, 3673, 3085, 1012, 10463, 1006, 2773, 1007, 1025, 2065, 1006, 3397, 1006, 2773, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/operators/base/CrossOperatorBase.java
CrossOperatorBase.executeOnCollections
@Override protected List<OUT> executeOnCollections(List<IN1> inputData1, List<IN2> inputData2, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception { CrossFunction<IN1, IN2, OUT> function = this.userFunction.getUserCodeObject(); FunctionUtils.setFunctionRuntimeContext(function, ctx); FunctionUtils.openFunction(function, this.parameters); ArrayList<OUT> result = new ArrayList<OUT>(inputData1.size() * inputData2.size()); TypeSerializer<IN1> inSerializer1 = getOperatorInfo().getFirstInputType().createSerializer(executionConfig); TypeSerializer<IN2> inSerializer2 = getOperatorInfo().getSecondInputType().createSerializer(executionConfig); TypeSerializer<OUT> outSerializer = getOperatorInfo().getOutputType().createSerializer(executionConfig); for (IN1 element1 : inputData1) { for (IN2 element2 : inputData2) { IN1 copy1 = inSerializer1.copy(element1); IN2 copy2 = inSerializer2.copy(element2); OUT o = function.cross(copy1, copy2); result.add(outSerializer.copy(o)); } } FunctionUtils.closeFunction(function); return result; }
java
@Override protected List<OUT> executeOnCollections(List<IN1> inputData1, List<IN2> inputData2, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception { CrossFunction<IN1, IN2, OUT> function = this.userFunction.getUserCodeObject(); FunctionUtils.setFunctionRuntimeContext(function, ctx); FunctionUtils.openFunction(function, this.parameters); ArrayList<OUT> result = new ArrayList<OUT>(inputData1.size() * inputData2.size()); TypeSerializer<IN1> inSerializer1 = getOperatorInfo().getFirstInputType().createSerializer(executionConfig); TypeSerializer<IN2> inSerializer2 = getOperatorInfo().getSecondInputType().createSerializer(executionConfig); TypeSerializer<OUT> outSerializer = getOperatorInfo().getOutputType().createSerializer(executionConfig); for (IN1 element1 : inputData1) { for (IN2 element2 : inputData2) { IN1 copy1 = inSerializer1.copy(element1); IN2 copy2 = inSerializer2.copy(element2); OUT o = function.cross(copy1, copy2); result.add(outSerializer.copy(o)); } } FunctionUtils.closeFunction(function); return result; }
[ "@", "Override", "protected", "List", "<", "OUT", ">", "executeOnCollections", "(", "List", "<", "IN1", ">", "inputData1", ",", "List", "<", "IN2", ">", "inputData2", ",", "RuntimeContext", "ctx", ",", "ExecutionConfig", "executionConfig", ")", "throws", "Exce...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/base/CrossOperatorBase.java#L91-L115
train
Execute on collections.
[ 30522, 1030, 2058, 15637, 5123, 2862, 1026, 2041, 1028, 15389, 2239, 26895, 18491, 2015, 1006, 2862, 1026, 1999, 2487, 1028, 7953, 2850, 2696, 2487, 1010, 2862, 1026, 1999, 2475, 1028, 7953, 2850, 2696, 2475, 1010, 2448, 7292, 8663, 18209, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
EnvironmentInformation.getJvmStartupOptions
public static String getJvmStartupOptions() { try { final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); final StringBuilder bld = new StringBuilder(); for (String s : bean.getInputArguments()) { bld.append(s).append(' '); } return bld.toString(); } catch (Throwable t) { return UNKNOWN; } }
java
public static String getJvmStartupOptions() { try { final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); final StringBuilder bld = new StringBuilder(); for (String s : bean.getInputArguments()) { bld.append(s).append(' '); } return bld.toString(); } catch (Throwable t) { return UNKNOWN; } }
[ "public", "static", "String", "getJvmStartupOptions", "(", ")", "{", "try", "{", "final", "RuntimeMXBean", "bean", "=", "ManagementFactory", ".", "getRuntimeMXBean", "(", ")", ";", "final", "StringBuilder", "bld", "=", "new", "StringBuilder", "(", ")", ";", "f...
Gets the system parameters and environment parameters that were passed to the JVM on startup. @return The options passed to the JVM on startup.
[ "Gets", "the", "system", "parameters", "and", "environment", "parameters", "that", "were", "passed", "to", "the", "JVM", "on", "startup", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L189-L203
train
Get the JVM startup options.
[ 30522, 2270, 10763, 5164, 2131, 3501, 2615, 5244, 7559, 8525, 16340, 9285, 1006, 1007, 1063, 3046, 1063, 2345, 2448, 7292, 22984, 4783, 2319, 14068, 1027, 2968, 21450, 1012, 2131, 15532, 7292, 22984, 4783, 2319, 1006, 1007, 1025, 2345, 5164...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/FileUtils.java
FileUtils.deleteDirectory
public static void deleteDirectory(File directory) throws IOException { checkNotNull(directory, "directory"); guardIfWindows(FileUtils::deleteDirectoryInternal, directory); }
java
public static void deleteDirectory(File directory) throws IOException { checkNotNull(directory, "directory"); guardIfWindows(FileUtils::deleteDirectoryInternal, directory); }
[ "public", "static", "void", "deleteDirectory", "(", "File", "directory", ")", "throws", "IOException", "{", "checkNotNull", "(", "directory", ",", "\"directory\"", ")", ";", "guardIfWindows", "(", "FileUtils", "::", "deleteDirectoryInternal", ",", "directory", ")", ...
Deletes the given directory recursively. <p>If the directory does not exist, this does not throw an exception, but simply does nothing. It considers the fact that a directory-to-be-deleted is not present a success. <p>This method is safe against other concurrent deletion attempts. @param directory The directory to be deleted. @throws IOException Thrown if the given file is not a directory, or if the directory could not be deleted for some reason, for example due to missing access/write permissions.
[ "Deletes", "the", "given", "directory", "recursively", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L241-L245
train
Deletes the given directory.
[ 30522, 2270, 10763, 11675, 17159, 7442, 16761, 2100, 1006, 5371, 14176, 1007, 11618, 22834, 10288, 24422, 1063, 4638, 17048, 11231, 3363, 1006, 14176, 1010, 1000, 14176, 1000, 1007, 1025, 3457, 10128, 11101, 15568, 1006, 5371, 21823, 4877, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.createServer
public TransportServer createServer(int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, null, port, rpcHandler, bootstraps); }
java
public TransportServer createServer(int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, null, port, rpcHandler, bootstraps); }
[ "public", "TransportServer", "createServer", "(", "int", "port", ",", "List", "<", "TransportServerBootstrap", ">", "bootstraps", ")", "{", "return", "new", "TransportServer", "(", "this", ",", "null", ",", "port", ",", "rpcHandler", ",", "bootstraps", ")", ";...
Create a server which will attempt to bind to a specific port.
[ "Create", "a", "server", "which", "will", "attempt", "to", "bind", "to", "a", "specific", "port", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L150-L152
train
Create a new server with the specified port and bootstraps.
[ 30522, 2270, 19003, 2121, 6299, 9005, 2121, 6299, 1006, 20014, 3417, 1010, 2862, 1026, 19003, 2121, 6299, 27927, 20528, 2361, 1028, 6879, 6494, 4523, 1007, 1063, 2709, 2047, 19003, 2121, 6299, 1006, 2023, 1010, 19701, 1010, 3417, 1010, 1054...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HanLP.java
HanLP.convertToPinyinFirstCharString
public static String convertToPinyinFirstCharString(String text, String separator, boolean remainNone) { List<Pinyin> pinyinList = PinyinDictionary.convertToPinyin(text, remainNone); int length = pinyinList.size(); StringBuilder sb = new StringBuilder(length * (1 + separator.length())); int i = 1; for (Pinyin pinyin : pinyinList) { sb.append(pinyin.getFirstChar()); if (i < length) { sb.append(separator); } ++i; } return sb.toString(); }
java
public static String convertToPinyinFirstCharString(String text, String separator, boolean remainNone) { List<Pinyin> pinyinList = PinyinDictionary.convertToPinyin(text, remainNone); int length = pinyinList.size(); StringBuilder sb = new StringBuilder(length * (1 + separator.length())); int i = 1; for (Pinyin pinyin : pinyinList) { sb.append(pinyin.getFirstChar()); if (i < length) { sb.append(separator); } ++i; } return sb.toString(); }
[ "public", "static", "String", "convertToPinyinFirstCharString", "(", "String", "text", ",", "String", "separator", ",", "boolean", "remainNone", ")", "{", "List", "<", "Pinyin", ">", "pinyinList", "=", "PinyinDictionary", ".", "convertToPinyin", "(", "text", ",", ...
转化为拼音(首字母) @param text 文本 @param separator 分隔符 @param remainNone 有些字没有拼音(如标点),是否保留它们(用none表示) @return 一个字符串,由[首字母][分隔符][首字母]构成
[ "转化为拼音(首字母)" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L608-L624
train
Convert a string of Pinyin first char to a String of UTF - 8 characters.
[ 30522, 2270, 10763, 5164, 10463, 14399, 24300, 2378, 8873, 12096, 7507, 12096, 4892, 1006, 5164, 3793, 1010, 5164, 19802, 25879, 2953, 1010, 22017, 20898, 3961, 8540, 2063, 1007, 1063, 2862, 1026, 9973, 1028, 9973, 9863, 1027, 9973, 29201, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java
SqlFunctionUtils.hash
public static String hash(String algorithm, String str, String charsetName) { try { byte[] digest = MessageDigest .getInstance(algorithm) .digest(strToBytesWithCharset(str, charsetName)); return EncodingUtils.hex(digest); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Unsupported algorithm: " + algorithm, e); } }
java
public static String hash(String algorithm, String str, String charsetName) { try { byte[] digest = MessageDigest .getInstance(algorithm) .digest(strToBytesWithCharset(str, charsetName)); return EncodingUtils.hex(digest); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Unsupported algorithm: " + algorithm, e); } }
[ "public", "static", "String", "hash", "(", "String", "algorithm", ",", "String", "str", ",", "String", "charsetName", ")", "{", "try", "{", "byte", "[", "]", "digest", "=", "MessageDigest", ".", "getInstance", "(", "algorithm", ")", ".", "digest", "(", "...
Calculate the hash value of a given string. @param algorithm message digest algorithm. @param str string to hash. @param charsetName charset of string. @return hash value of string.
[ "Calculate", "the", "hash", "value", "of", "a", "given", "string", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L473-L482
train
Returns the hex encoded hash of the given string.
[ 30522, 2270, 10763, 5164, 23325, 1006, 5164, 9896, 1010, 5164, 2358, 2099, 1010, 5164, 25869, 13462, 18442, 1007, 1063, 3046, 1063, 24880, 1031, 1033, 17886, 1027, 4471, 4305, 8449, 2102, 1012, 2131, 7076, 26897, 1006, 9896, 1007, 1012, 178...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ReferenceCountUtil.java
ReferenceCountUtil.release
public static boolean release(Object msg, int decrement) { if (msg instanceof ReferenceCounted) { return ((ReferenceCounted) msg).release(decrement); } return false; }
java
public static boolean release(Object msg, int decrement) { if (msg instanceof ReferenceCounted) { return ((ReferenceCounted) msg).release(decrement); } return false; }
[ "public", "static", "boolean", "release", "(", "Object", "msg", ",", "int", "decrement", ")", "{", "if", "(", "msg", "instanceof", "ReferenceCounted", ")", "{", "return", "(", "(", "ReferenceCounted", ")", "msg", ")", ".", "release", "(", "decrement", ")",...
Try to call {@link ReferenceCounted#release(int)} if the specified message implements {@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.
[ "Try", "to", "call", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ReferenceCountUtil.java#L97-L102
train
Release a reference count.
[ 30522, 2270, 10763, 22017, 20898, 2713, 1006, 4874, 5796, 2290, 1010, 20014, 11703, 28578, 4765, 1007, 1063, 2065, 1006, 5796, 2290, 6013, 11253, 4431, 3597, 16671, 2098, 1007, 1063, 2709, 1006, 1006, 4431, 3597, 16671, 2098, 1007, 5796, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java
StrSpliter.addToList
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty){ if(isTrim){ part = StrUtil.trim(part); } if(false == ignoreEmpty || false == part.isEmpty()){ list.add(part); } return list; }
java
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty){ if(isTrim){ part = StrUtil.trim(part); } if(false == ignoreEmpty || false == part.isEmpty()){ list.add(part); } return list; }
[ "private", "static", "List", "<", "String", ">", "addToList", "(", "List", "<", "String", ">", "list", ",", "String", "part", ",", "boolean", "isTrim", ",", "boolean", "ignoreEmpty", ")", "{", "if", "(", "isTrim", ")", "{", "part", "=", "StrUtil", ".",...
将字符串加入List中 @param list 列表 @param part 被加入的部分 @param isTrim 是否去除两端空白符 @param ignoreEmpty 是否略过空字符串(空字符串不做为一个元素) @return 列表
[ "将字符串加入List中" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L494-L502
train
Adds a string to a list of strings.
[ 30522, 2797, 10763, 2862, 1026, 5164, 1028, 5587, 3406, 9863, 1006, 2862, 1026, 5164, 1028, 2862, 1010, 5164, 2112, 1010, 22017, 20898, 21541, 20026, 1010, 22017, 20898, 8568, 6633, 13876, 2100, 1007, 1063, 2065, 1006, 21541, 20026, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.toChar
public static Character toChar(Object value, Character defaultValue) { return convert(Character.class, value, defaultValue); }
java
public static Character toChar(Object value, Character defaultValue) { return convert(Character.class, value, defaultValue); }
[ "public", "static", "Character", "toChar", "(", "Object", "value", ",", "Character", "defaultValue", ")", "{", "return", "convert", "(", "Character", ".", "class", ",", "value", ",", "defaultValue", ")", ";", "}" ]
转换为字符<br> 如果给定的值为null,或者转换失败,返回默认值<br> 转换失败不会报错 @param value 被转换的值 @param defaultValue 转换错误时的默认值 @return 结果
[ "转换为字符<br", ">", "如果给定的值为null,或者转换失败,返回默认值<br", ">", "转换失败不会报错" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L77-L79
train
Converts value of type IDENTITY to Character.
[ 30522, 2270, 10763, 2839, 2000, 7507, 2099, 1006, 4874, 3643, 1010, 2839, 12398, 10175, 5657, 1007, 1063, 2709, 10463, 1006, 2839, 1012, 2465, 1010, 3643, 1010, 12398, 10175, 5657, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/YamlProcessor.java
YamlProcessor.process
protected void process(MatchCallback callback) { Yaml yaml = createYaml(); for (Resource resource : this.resources) { boolean found = process(callback, yaml, resource); if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND && found) { return; } } }
java
protected void process(MatchCallback callback) { Yaml yaml = createYaml(); for (Resource resource : this.resources) { boolean found = process(callback, yaml, resource); if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND && found) { return; } } }
[ "protected", "void", "process", "(", "MatchCallback", "callback", ")", "{", "Yaml", "yaml", "=", "createYaml", "(", ")", ";", "for", "(", "Resource", "resource", ":", "this", ".", "resources", ")", "{", "boolean", "found", "=", "process", "(", "callback", ...
Provide an opportunity for subclasses to process the Yaml parsed from the supplied resources. Each resource is parsed in turn and the documents inside checked against the {@link #setDocumentMatchers(DocumentMatcher...) matchers}. If a document matches it is passed into the callback, along with its representation as Properties. Depending on the {@link #setResolutionMethod(ResolutionMethod)} not all of the documents will be parsed. @param callback a callback to delegate to once matching documents are found @see #createYaml()
[ "Provide", "an", "opportunity", "for", "subclasses", "to", "process", "the", "Yaml", "parsed", "from", "the", "supplied", "resources", ".", "Each", "resource", "is", "parsed", "in", "turn", "and", "the", "documents", "inside", "checked", "against", "the", "{",...
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/YamlProcessor.java#L110-L118
train
Process the resource list.
[ 30522, 5123, 11675, 2832, 1006, 2674, 9289, 20850, 8684, 30524, 1012, 4219, 1007, 1063, 22017, 20898, 2179, 1027, 2832, 1006, 2655, 5963, 1010, 8038, 19968, 1010, 7692, 1007, 1025, 2065, 1006, 2023, 1012, 5813, 11368, 6806, 2094, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/utility/TextUtility.java
TextUtility.isAllIndex
public static boolean isAllIndex(byte[] sString) { int nLen = sString.length; int i = 0; while (i < nLen - 1 && getUnsigned(sString[i]) == 162) { i += 2; } if (i >= nLen) return true; while (i < nLen && (sString[i] > 'A' - 1 && sString[i] < 'Z' + 1) || (sString[i] > 'a' - 1 && sString[i] < 'z' + 1)) {// single // byte // number // char i += 1; } if (i < nLen) return false; return true; }
java
public static boolean isAllIndex(byte[] sString) { int nLen = sString.length; int i = 0; while (i < nLen - 1 && getUnsigned(sString[i]) == 162) { i += 2; } if (i >= nLen) return true; while (i < nLen && (sString[i] > 'A' - 1 && sString[i] < 'Z' + 1) || (sString[i] > 'a' - 1 && sString[i] < 'z' + 1)) {// single // byte // number // char i += 1; } if (i < nLen) return false; return true; }
[ "public", "static", "boolean", "isAllIndex", "(", "byte", "[", "]", "sString", ")", "{", "int", "nLen", "=", "sString", ".", "length", ";", "int", "i", "=", "0", ";", "while", "(", "i", "<", "nLen", "-", "1", "&&", "getUnsigned", "(", "sString", "[...
是否全是序号 @param sString @return
[ "是否全是序号" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L210-L234
train
is all index of a string in a CIS file
[ 30522, 2270, 10763, 22017, 20898, 18061, 21202, 3207, 2595, 1006, 24880, 1031, 1033, 7020, 18886, 3070, 1007, 1063, 20014, 17953, 2368, 1027, 7020, 18886, 3070, 1012, 3091, 1025, 20014, 1045, 1027, 1014, 1025, 2096, 1006, 1045, 1026, 17953, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Assert.java
Assert.checkBetween
public static Number checkBetween(Number value, Number min, Number max) { notNull(value); notNull(min); notNull(max); double valueDouble = value.doubleValue(); double minDouble = min.doubleValue(); double maxDouble = max.doubleValue(); if (valueDouble < minDouble || valueDouble > maxDouble) { throw new IllegalArgumentException(StrUtil.format("Length must be between {} and {}.", min, max)); } return value; }
java
public static Number checkBetween(Number value, Number min, Number max) { notNull(value); notNull(min); notNull(max); double valueDouble = value.doubleValue(); double minDouble = min.doubleValue(); double maxDouble = max.doubleValue(); if (valueDouble < minDouble || valueDouble > maxDouble) { throw new IllegalArgumentException(StrUtil.format("Length must be between {} and {}.", min, max)); } return value; }
[ "public", "static", "Number", "checkBetween", "(", "Number", "value", ",", "Number", "min", ",", "Number", "max", ")", "{", "notNull", "(", "value", ")", ";", "notNull", "(", "min", ")", ";", "notNull", "(", "max", ")", ";", "double", "valueDouble", "=...
检查值是否在指定范围内 @param value 值 @param min 最小值(包含) @param max 最大值(包含) @return 检查后的长度值 @since 4.1.10
[ "检查值是否在指定范围内" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L622-L633
train
Checks if the given value is between the given values.
[ 30522, 2270, 10763, 2193, 4638, 20915, 28394, 2078, 1006, 2193, 3643, 1010, 2193, 8117, 1010, 2193, 4098, 1007, 1063, 2025, 11231, 3363, 1006, 3643, 1007, 1025, 2025, 11231, 3363, 1006, 8117, 1007, 1025, 2025, 11231, 3363, 1006, 4098, 30524...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.readLines
public static <T extends Collection<String>> T readLines(URL url, String charsetName, T collection) throws IORuntimeException { return readLines(url, CharsetUtil.charset(charsetName), collection); }
java
public static <T extends Collection<String>> T readLines(URL url, String charsetName, T collection) throws IORuntimeException { return readLines(url, CharsetUtil.charset(charsetName), collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readLines", "(", "URL", "url", ",", "String", "charsetName", ",", "T", "collection", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "url", ",", "Ch...
从文件中读取每一行数据 @param <T> 集合类型 @param url 文件的URL @param charsetName 字符集 @param collection 集合 @return 文件中的每行内容的集合 @throws IORuntimeException IO异常
[ "从文件中读取每一行数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2261-L2263
train
Reads the contents of the URL into the given collection.
[ 30522, 2270, 10763, 1026, 1056, 8908, 3074, 1026, 5164, 1028, 1028, 1056, 3191, 12735, 1006, 24471, 2140, 24471, 2140, 1010, 5164, 25869, 13462, 18442, 1010, 1056, 3074, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2709, 3191, 12735, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HttpRequest.java
HttpRequest.method
public HttpRequest method(Method method) { if (Method.PATCH == method) { this.method = Method.POST; this.header("X-HTTP-Method-Override", "PATCH"); } else { this.method = method; } return this; }
java
public HttpRequest method(Method method) { if (Method.PATCH == method) { this.method = Method.POST; this.header("X-HTTP-Method-Override", "PATCH"); } else { this.method = method; } return this; }
[ "public", "HttpRequest", "method", "(", "Method", "method", ")", "{", "if", "(", "Method", ".", "PATCH", "==", "method", ")", "{", "this", ".", "method", "=", "Method", ".", "POST", ";", "this", ".", "header", "(", "\"X-HTTP-Method-Override\"", ",", "\"P...
设置请求方法 @param method HTTP方法 @return HttpRequest
[ "设置请求方法" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L295-L303
train
Sets the HTTP method to use.
[ 30522, 2270, 8299, 2890, 15500, 4118, 1006, 4118, 4118, 1007, 1063, 2065, 1006, 4118, 1012, 8983, 1027, 1027, 4118, 1007, 1063, 2023, 1012, 4118, 1027, 4118, 1012, 2695, 1025, 2023, 1012, 20346, 1006, 1000, 1060, 1011, 8299, 1011, 4118, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java
CombinationAnnotationElement.parseDeclared
private void parseDeclared(Annotation[] annotations) { Class<? extends Annotation> annotationType; // 直接注解 for (Annotation annotation : annotations) { annotationType = annotation.annotationType(); if (false == META_ANNOTATIONS.contains(annotationType)) { declaredAnnotationMap.put(annotationType, annotation); parseDeclared(annotationType.getDeclaredAnnotations()); } } }
java
private void parseDeclared(Annotation[] annotations) { Class<? extends Annotation> annotationType; // 直接注解 for (Annotation annotation : annotations) { annotationType = annotation.annotationType(); if (false == META_ANNOTATIONS.contains(annotationType)) { declaredAnnotationMap.put(annotationType, annotation); parseDeclared(annotationType.getDeclaredAnnotations()); } } }
[ "private", "void", "parseDeclared", "(", "Annotation", "[", "]", "annotations", ")", "{", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ";", "// 直接注解\r", "for", "(", "Annotation", "annotation", ":", "annotations", ")", "{", "annotationType",...
进行递归解析注解,直到全部都是元注解为止 @param annotations Class, Method, Field等
[ "进行递归解析注解,直到全部都是元注解为止" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java#L98-L108
train
Parse declared annotations.
[ 30522, 2797, 11675, 11968, 6924, 8586, 8017, 2098, 1006, 5754, 17287, 3508, 1031, 1033, 5754, 17287, 9285, 1007, 1063, 2465, 1026, 1029, 8908, 5754, 17287, 3508, 1028, 5754, 17287, 3508, 13874, 30524, 5754, 17287, 3508, 1024, 5754, 17287, 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-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
CompactingHashTable.resizeHashTable
private boolean resizeHashTable() throws IOException { final int newNumBuckets = 2*this.numBuckets; final int bucketsPerSegment = this.bucketsPerSegmentMask + 1; final int newNumSegments = (newNumBuckets + (bucketsPerSegment-1)) / bucketsPerSegment; final int additionalSegments = newNumSegments-this.buckets.length; final int numPartitions = this.partitions.size(); if (this.availableMemory.size() < additionalSegments) { for (int i = 0; i < numPartitions; i++) { compactPartition(i); if(this.availableMemory.size() >= additionalSegments) { break; } } } if (this.availableMemory.size() < additionalSegments || this.closed) { return false; } else { this.isResizing = true; // allocate new buckets final int startOffset = (this.numBuckets * HASH_BUCKET_SIZE) % this.segmentSize; final int oldNumBuckets = this.numBuckets; final int oldNumSegments = this.buckets.length; MemorySegment[] mergedBuckets = new MemorySegment[newNumSegments]; System.arraycopy(this.buckets, 0, mergedBuckets, 0, this.buckets.length); this.buckets = mergedBuckets; this.numBuckets = newNumBuckets; // initialize all new buckets boolean oldSegment = (startOffset != 0); final int startSegment = oldSegment ? (oldNumSegments-1) : oldNumSegments; for (int i = startSegment, bucket = oldNumBuckets; i < newNumSegments && bucket < this.numBuckets; i++) { MemorySegment seg; int bucketOffset; if(oldSegment) { // the first couple of new buckets may be located on an old segment seg = this.buckets[i]; for (int k = (oldNumBuckets % bucketsPerSegment) ; k < bucketsPerSegment && bucket < this.numBuckets; k++, bucket++) { bucketOffset = k * HASH_BUCKET_SIZE; // initialize the header fields seg.put(bucketOffset + HEADER_PARTITION_OFFSET, assignPartition(bucket, (byte)numPartitions)); seg.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); seg.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); } } else { seg = getNextBuffer(); // go over all buckets in the segment for (int k = 0; k < bucketsPerSegment && bucket < this.numBuckets; k++, bucket++) { bucketOffset = k * HASH_BUCKET_SIZE; // initialize the header fields seg.put(bucketOffset + HEADER_PARTITION_OFFSET, assignPartition(bucket, (byte)numPartitions)); seg.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); seg.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); } } this.buckets[i] = seg; oldSegment = false; // we write on at most one old segment } int hashOffset; int hash; int pointerOffset; long pointer; IntArrayList hashList = new IntArrayList(NUM_ENTRIES_PER_BUCKET); LongArrayList pointerList = new LongArrayList(NUM_ENTRIES_PER_BUCKET); IntArrayList overflowHashes = new IntArrayList(64); LongArrayList overflowPointers = new LongArrayList(64); // go over all buckets and split them between old and new buckets for (int i = 0; i < numPartitions; i++) { InMemoryPartition<T> partition = this.partitions.get(i); final MemorySegment[] overflowSegments = partition.overflowSegments; int posHashCode; for (int j = 0, bucket = i; j < this.buckets.length && bucket < oldNumBuckets; j++) { MemorySegment segment = this.buckets[j]; // go over all buckets in the segment belonging to the partition for (int k = bucket % bucketsPerSegment; k < bucketsPerSegment && bucket < oldNumBuckets; k += numPartitions, bucket += numPartitions) { int bucketOffset = k * HASH_BUCKET_SIZE; if((int)segment.get(bucketOffset + HEADER_PARTITION_OFFSET) != i) { throw new IOException("Accessed wrong bucket! wanted: " + i + " got: " + segment.get(bucketOffset + HEADER_PARTITION_OFFSET)); } // loop over all segments that are involved in the bucket (original bucket plus overflow buckets) int countInSegment = segment.getInt(bucketOffset + HEADER_COUNT_OFFSET); int numInSegment = 0; pointerOffset = bucketOffset + BUCKET_POINTER_START_OFFSET; hashOffset = bucketOffset + BUCKET_HEADER_LENGTH; while (true) { while (numInSegment < countInSegment) { hash = segment.getInt(hashOffset); if((hash % this.numBuckets) != bucket && (hash % this.numBuckets) != (bucket+oldNumBuckets)) { throw new IOException("wanted: " + bucket + " or " + (bucket + oldNumBuckets) + " got: " + hash%this.numBuckets); } pointer = segment.getLong(pointerOffset); hashList.add(hash); pointerList.add(pointer); pointerOffset += POINTER_LEN; hashOffset += HASH_CODE_LEN; numInSegment++; } // this segment is done. check if there is another chained bucket final long forwardPointer = segment.getLong(bucketOffset + HEADER_FORWARD_OFFSET); if (forwardPointer == BUCKET_FORWARD_POINTER_NOT_SET) { break; } final int overflowSegNum = (int) (forwardPointer >>> 32); segment = overflowSegments[overflowSegNum]; bucketOffset = (int) forwardPointer; countInSegment = segment.getInt(bucketOffset + HEADER_COUNT_OFFSET); pointerOffset = bucketOffset + BUCKET_POINTER_START_OFFSET; hashOffset = bucketOffset + BUCKET_HEADER_LENGTH; numInSegment = 0; } segment = this.buckets[j]; bucketOffset = k * HASH_BUCKET_SIZE; // reset bucket for re-insertion segment.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); segment.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); // refill table if(hashList.size() != pointerList.size()) { throw new IOException("Pointer and hash counts do not match. hashes: " + hashList.size() + " pointer: " + pointerList.size()); } int newSegmentIndex = (bucket + oldNumBuckets) / bucketsPerSegment; MemorySegment newSegment = this.buckets[newSegmentIndex]; // we need to avoid overflows in the first run int oldBucketCount = 0; int newBucketCount = 0; while (!hashList.isEmpty()) { hash = hashList.removeLast(); pointer = pointerList.removeLong(pointerList.size()-1); posHashCode = hash % this.numBuckets; if (posHashCode == bucket && oldBucketCount < NUM_ENTRIES_PER_BUCKET) { bucketOffset = (bucket % bucketsPerSegment) * HASH_BUCKET_SIZE; insertBucketEntryFromStart(segment, bucketOffset, hash, pointer, partition.getPartitionNumber()); oldBucketCount++; } else if (posHashCode == (bucket + oldNumBuckets) && newBucketCount < NUM_ENTRIES_PER_BUCKET) { bucketOffset = ((bucket + oldNumBuckets) % bucketsPerSegment) * HASH_BUCKET_SIZE; insertBucketEntryFromStart(newSegment, bucketOffset, hash, pointer, partition.getPartitionNumber()); newBucketCount++; } else if (posHashCode == (bucket + oldNumBuckets) || posHashCode == bucket) { overflowHashes.add(hash); overflowPointers.add(pointer); } else { throw new IOException("Accessed wrong bucket. Target: " + bucket + " or " + (bucket + oldNumBuckets) + " Hit: " + posHashCode); } } hashList.clear(); pointerList.clear(); } } // reset partition's overflow buckets and reclaim their memory this.availableMemory.addAll(partition.resetOverflowBuckets()); // clear overflow lists int bucketArrayPos; int bucketInSegmentPos; MemorySegment bucket; while(!overflowHashes.isEmpty()) { hash = overflowHashes.removeLast(); pointer = overflowPointers.removeLong(overflowPointers.size()-1); posHashCode = hash % this.numBuckets; bucketArrayPos = posHashCode >>> this.bucketsPerSegmentBits; bucketInSegmentPos = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; bucket = this.buckets[bucketArrayPos]; insertBucketEntryFromStart(bucket, bucketInSegmentPos, hash, pointer, partition.getPartitionNumber()); } overflowHashes.clear(); overflowPointers.clear(); } this.isResizing = false; return true; } }
java
private boolean resizeHashTable() throws IOException { final int newNumBuckets = 2*this.numBuckets; final int bucketsPerSegment = this.bucketsPerSegmentMask + 1; final int newNumSegments = (newNumBuckets + (bucketsPerSegment-1)) / bucketsPerSegment; final int additionalSegments = newNumSegments-this.buckets.length; final int numPartitions = this.partitions.size(); if (this.availableMemory.size() < additionalSegments) { for (int i = 0; i < numPartitions; i++) { compactPartition(i); if(this.availableMemory.size() >= additionalSegments) { break; } } } if (this.availableMemory.size() < additionalSegments || this.closed) { return false; } else { this.isResizing = true; // allocate new buckets final int startOffset = (this.numBuckets * HASH_BUCKET_SIZE) % this.segmentSize; final int oldNumBuckets = this.numBuckets; final int oldNumSegments = this.buckets.length; MemorySegment[] mergedBuckets = new MemorySegment[newNumSegments]; System.arraycopy(this.buckets, 0, mergedBuckets, 0, this.buckets.length); this.buckets = mergedBuckets; this.numBuckets = newNumBuckets; // initialize all new buckets boolean oldSegment = (startOffset != 0); final int startSegment = oldSegment ? (oldNumSegments-1) : oldNumSegments; for (int i = startSegment, bucket = oldNumBuckets; i < newNumSegments && bucket < this.numBuckets; i++) { MemorySegment seg; int bucketOffset; if(oldSegment) { // the first couple of new buckets may be located on an old segment seg = this.buckets[i]; for (int k = (oldNumBuckets % bucketsPerSegment) ; k < bucketsPerSegment && bucket < this.numBuckets; k++, bucket++) { bucketOffset = k * HASH_BUCKET_SIZE; // initialize the header fields seg.put(bucketOffset + HEADER_PARTITION_OFFSET, assignPartition(bucket, (byte)numPartitions)); seg.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); seg.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); } } else { seg = getNextBuffer(); // go over all buckets in the segment for (int k = 0; k < bucketsPerSegment && bucket < this.numBuckets; k++, bucket++) { bucketOffset = k * HASH_BUCKET_SIZE; // initialize the header fields seg.put(bucketOffset + HEADER_PARTITION_OFFSET, assignPartition(bucket, (byte)numPartitions)); seg.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); seg.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); } } this.buckets[i] = seg; oldSegment = false; // we write on at most one old segment } int hashOffset; int hash; int pointerOffset; long pointer; IntArrayList hashList = new IntArrayList(NUM_ENTRIES_PER_BUCKET); LongArrayList pointerList = new LongArrayList(NUM_ENTRIES_PER_BUCKET); IntArrayList overflowHashes = new IntArrayList(64); LongArrayList overflowPointers = new LongArrayList(64); // go over all buckets and split them between old and new buckets for (int i = 0; i < numPartitions; i++) { InMemoryPartition<T> partition = this.partitions.get(i); final MemorySegment[] overflowSegments = partition.overflowSegments; int posHashCode; for (int j = 0, bucket = i; j < this.buckets.length && bucket < oldNumBuckets; j++) { MemorySegment segment = this.buckets[j]; // go over all buckets in the segment belonging to the partition for (int k = bucket % bucketsPerSegment; k < bucketsPerSegment && bucket < oldNumBuckets; k += numPartitions, bucket += numPartitions) { int bucketOffset = k * HASH_BUCKET_SIZE; if((int)segment.get(bucketOffset + HEADER_PARTITION_OFFSET) != i) { throw new IOException("Accessed wrong bucket! wanted: " + i + " got: " + segment.get(bucketOffset + HEADER_PARTITION_OFFSET)); } // loop over all segments that are involved in the bucket (original bucket plus overflow buckets) int countInSegment = segment.getInt(bucketOffset + HEADER_COUNT_OFFSET); int numInSegment = 0; pointerOffset = bucketOffset + BUCKET_POINTER_START_OFFSET; hashOffset = bucketOffset + BUCKET_HEADER_LENGTH; while (true) { while (numInSegment < countInSegment) { hash = segment.getInt(hashOffset); if((hash % this.numBuckets) != bucket && (hash % this.numBuckets) != (bucket+oldNumBuckets)) { throw new IOException("wanted: " + bucket + " or " + (bucket + oldNumBuckets) + " got: " + hash%this.numBuckets); } pointer = segment.getLong(pointerOffset); hashList.add(hash); pointerList.add(pointer); pointerOffset += POINTER_LEN; hashOffset += HASH_CODE_LEN; numInSegment++; } // this segment is done. check if there is another chained bucket final long forwardPointer = segment.getLong(bucketOffset + HEADER_FORWARD_OFFSET); if (forwardPointer == BUCKET_FORWARD_POINTER_NOT_SET) { break; } final int overflowSegNum = (int) (forwardPointer >>> 32); segment = overflowSegments[overflowSegNum]; bucketOffset = (int) forwardPointer; countInSegment = segment.getInt(bucketOffset + HEADER_COUNT_OFFSET); pointerOffset = bucketOffset + BUCKET_POINTER_START_OFFSET; hashOffset = bucketOffset + BUCKET_HEADER_LENGTH; numInSegment = 0; } segment = this.buckets[j]; bucketOffset = k * HASH_BUCKET_SIZE; // reset bucket for re-insertion segment.putInt(bucketOffset + HEADER_COUNT_OFFSET, 0); segment.putLong(bucketOffset + HEADER_FORWARD_OFFSET, BUCKET_FORWARD_POINTER_NOT_SET); // refill table if(hashList.size() != pointerList.size()) { throw new IOException("Pointer and hash counts do not match. hashes: " + hashList.size() + " pointer: " + pointerList.size()); } int newSegmentIndex = (bucket + oldNumBuckets) / bucketsPerSegment; MemorySegment newSegment = this.buckets[newSegmentIndex]; // we need to avoid overflows in the first run int oldBucketCount = 0; int newBucketCount = 0; while (!hashList.isEmpty()) { hash = hashList.removeLast(); pointer = pointerList.removeLong(pointerList.size()-1); posHashCode = hash % this.numBuckets; if (posHashCode == bucket && oldBucketCount < NUM_ENTRIES_PER_BUCKET) { bucketOffset = (bucket % bucketsPerSegment) * HASH_BUCKET_SIZE; insertBucketEntryFromStart(segment, bucketOffset, hash, pointer, partition.getPartitionNumber()); oldBucketCount++; } else if (posHashCode == (bucket + oldNumBuckets) && newBucketCount < NUM_ENTRIES_PER_BUCKET) { bucketOffset = ((bucket + oldNumBuckets) % bucketsPerSegment) * HASH_BUCKET_SIZE; insertBucketEntryFromStart(newSegment, bucketOffset, hash, pointer, partition.getPartitionNumber()); newBucketCount++; } else if (posHashCode == (bucket + oldNumBuckets) || posHashCode == bucket) { overflowHashes.add(hash); overflowPointers.add(pointer); } else { throw new IOException("Accessed wrong bucket. Target: " + bucket + " or " + (bucket + oldNumBuckets) + " Hit: " + posHashCode); } } hashList.clear(); pointerList.clear(); } } // reset partition's overflow buckets and reclaim their memory this.availableMemory.addAll(partition.resetOverflowBuckets()); // clear overflow lists int bucketArrayPos; int bucketInSegmentPos; MemorySegment bucket; while(!overflowHashes.isEmpty()) { hash = overflowHashes.removeLast(); pointer = overflowPointers.removeLong(overflowPointers.size()-1); posHashCode = hash % this.numBuckets; bucketArrayPos = posHashCode >>> this.bucketsPerSegmentBits; bucketInSegmentPos = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; bucket = this.buckets[bucketArrayPos]; insertBucketEntryFromStart(bucket, bucketInSegmentPos, hash, pointer, partition.getPartitionNumber()); } overflowHashes.clear(); overflowPointers.clear(); } this.isResizing = false; return true; } }
[ "private", "boolean", "resizeHashTable", "(", ")", "throws", "IOException", "{", "final", "int", "newNumBuckets", "=", "2", "*", "this", ".", "numBuckets", ";", "final", "int", "bucketsPerSegment", "=", "this", ".", "bucketsPerSegmentMask", "+", "1", ";", "fin...
Attempts to double the number of buckets @return true on success @throws IOException
[ "Attempts", "to", "double", "the", "number", "of", "buckets" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java#L874-L1048
train
Resizes the hash table.
[ 30522, 2797, 22017, 20898, 24501, 4697, 14949, 22893, 3468, 1006, 1007, 30524, 1027, 2023, 1012, 13610, 17668, 3366, 21693, 4765, 9335, 2243, 1009, 1015, 1025, 2345, 20014, 2047, 19172, 3366, 21693, 11187, 1027, 1006, 2047, 19172, 24204, 8454...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.spill
@Override public long spill(long size, MemoryConsumer trigger) throws IOException { if (trigger != this) { if (readingIterator != null) { return readingIterator.spill(); } return 0L; // this should throw exception } if (inMemSorter == null || inMemSorter.numRecords() <= 0) { return 0L; } logger.info("Thread {} spilling sort data of {} to disk ({} {} so far)", Thread.currentThread().getId(), Utils.bytesToString(getMemoryUsage()), spillWriters.size(), spillWriters.size() > 1 ? " times" : " time"); ShuffleWriteMetrics writeMetrics = new ShuffleWriteMetrics(); final UnsafeSorterSpillWriter spillWriter = new UnsafeSorterSpillWriter(blockManager, fileBufferSizeBytes, writeMetrics, inMemSorter.numRecords()); spillWriters.add(spillWriter); spillIterator(inMemSorter.getSortedIterator(), spillWriter); final long spillSize = freeMemory(); // Note that this is more-or-less going to be a multiple of the page size, so wasted space in // pages will currently be counted as memory spilled even though that space isn't actually // written to disk. This also counts the space needed to store the sorter's pointer array. inMemSorter.reset(); // Reset the in-memory sorter's pointer array only after freeing up the memory pages holding the // records. Otherwise, if the task is over allocated memory, then without freeing the memory // pages, we might not be able to get memory for the pointer array. taskContext.taskMetrics().incMemoryBytesSpilled(spillSize); taskContext.taskMetrics().incDiskBytesSpilled(writeMetrics.bytesWritten()); totalSpillBytes += spillSize; return spillSize; }
java
@Override public long spill(long size, MemoryConsumer trigger) throws IOException { if (trigger != this) { if (readingIterator != null) { return readingIterator.spill(); } return 0L; // this should throw exception } if (inMemSorter == null || inMemSorter.numRecords() <= 0) { return 0L; } logger.info("Thread {} spilling sort data of {} to disk ({} {} so far)", Thread.currentThread().getId(), Utils.bytesToString(getMemoryUsage()), spillWriters.size(), spillWriters.size() > 1 ? " times" : " time"); ShuffleWriteMetrics writeMetrics = new ShuffleWriteMetrics(); final UnsafeSorterSpillWriter spillWriter = new UnsafeSorterSpillWriter(blockManager, fileBufferSizeBytes, writeMetrics, inMemSorter.numRecords()); spillWriters.add(spillWriter); spillIterator(inMemSorter.getSortedIterator(), spillWriter); final long spillSize = freeMemory(); // Note that this is more-or-less going to be a multiple of the page size, so wasted space in // pages will currently be counted as memory spilled even though that space isn't actually // written to disk. This also counts the space needed to store the sorter's pointer array. inMemSorter.reset(); // Reset the in-memory sorter's pointer array only after freeing up the memory pages holding the // records. Otherwise, if the task is over allocated memory, then without freeing the memory // pages, we might not be able to get memory for the pointer array. taskContext.taskMetrics().incMemoryBytesSpilled(spillSize); taskContext.taskMetrics().incDiskBytesSpilled(writeMetrics.bytesWritten()); totalSpillBytes += spillSize; return spillSize; }
[ "@", "Override", "public", "long", "spill", "(", "long", "size", ",", "MemoryConsumer", "trigger", ")", "throws", "IOException", "{", "if", "(", "trigger", "!=", "this", ")", "{", "if", "(", "readingIterator", "!=", "null", ")", "{", "return", "readingIter...
Sort and spill the current records in response to memory pressure.
[ "Sort", "and", "spill", "the", "current", "records", "in", "response", "to", "memory", "pressure", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L196-L236
train
Spill the data from the in - memory sorter to disk.
[ 30522, 1030, 2058, 15637, 2270, 2146, 14437, 1006, 2146, 2946, 1010, 3638, 8663, 23545, 2099, 9495, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 9495, 999, 1027, 2023, 1007, 1063, 2065, 1006, 3752, 21646, 8844, 999, 1027, 19701, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStore.java
ZooKeeperCompletedCheckpointStore.pathToCheckpointId
public static long pathToCheckpointId(String path) { try { String numberString; // check if we have a leading slash if ('/' == path.charAt(0)) { numberString = path.substring(1); } else { numberString = path; } return Long.parseLong(numberString); } catch (NumberFormatException e) { LOG.warn("Could not parse checkpoint id from {}. This indicates that the " + "checkpoint id to path conversion has changed.", path); return -1L; } }
java
public static long pathToCheckpointId(String path) { try { String numberString; // check if we have a leading slash if ('/' == path.charAt(0)) { numberString = path.substring(1); } else { numberString = path; } return Long.parseLong(numberString); } catch (NumberFormatException e) { LOG.warn("Could not parse checkpoint id from {}. This indicates that the " + "checkpoint id to path conversion has changed.", path); return -1L; } }
[ "public", "static", "long", "pathToCheckpointId", "(", "String", "path", ")", "{", "try", "{", "String", "numberString", ";", "// check if we have a leading slash", "if", "(", "'", "'", "==", "path", ".", "charAt", "(", "0", ")", ")", "{", "numberString", "=...
Converts a path to the checkpoint id. @param path in ZooKeeper @return Checkpoint id parsed from the path
[ "Converts", "a", "path", "to", "the", "checkpoint", "id", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStore.java#L324-L341
train
Converts a path to a checkpoint id.
[ 30522, 2270, 10763, 2146, 4130, 3406, 5403, 3600, 8400, 3593, 1006, 5164, 4130, 1007, 1063, 3046, 1063, 5164, 3616, 18886, 3070, 1025, 1013, 1013, 4638, 2065, 2057, 2031, 1037, 2877, 18296, 2065, 1006, 1005, 1013, 1005, 1027, 1027, 4130, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java
HashUtil.pjwHash
public static int pjwHash(String str) { int bitsInUnsignedInt = 32; int threeQuarters = (bitsInUnsignedInt * 3) / 4; int oneEighth = bitsInUnsignedInt / 8; int highBits = 0xFFFFFFFF << (bitsInUnsignedInt - oneEighth); int hash = 0; int test = 0; for (int i = 0; i < str.length(); i++) { hash = (hash << oneEighth) + str.charAt(i); if ((test = hash & highBits) != 0) { hash = ((hash ^ (test >> threeQuarters)) & (~highBits)); } } return hash & 0x7FFFFFFF; }
java
public static int pjwHash(String str) { int bitsInUnsignedInt = 32; int threeQuarters = (bitsInUnsignedInt * 3) / 4; int oneEighth = bitsInUnsignedInt / 8; int highBits = 0xFFFFFFFF << (bitsInUnsignedInt - oneEighth); int hash = 0; int test = 0; for (int i = 0; i < str.length(); i++) { hash = (hash << oneEighth) + str.charAt(i); if ((test = hash & highBits) != 0) { hash = ((hash ^ (test >> threeQuarters)) & (~highBits)); } } return hash & 0x7FFFFFFF; }
[ "public", "static", "int", "pjwHash", "(", "String", "str", ")", "{", "int", "bitsInUnsignedInt", "=", "32", ";", "int", "threeQuarters", "=", "(", "bitsInUnsignedInt", "*", "3", ")", "/", "4", ";", "int", "oneEighth", "=", "bitsInUnsignedInt", "/", "8", ...
PJW算法 @param str 字符串 @return hash值
[ "PJW算法" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L235-L252
train
Returns the hash value of the given string.
[ 30522, 2270, 10763, 20014, 1052, 3501, 2860, 14949, 2232, 1006, 5164, 2358, 2099, 1007, 1063, 20014, 9017, 2378, 4609, 5332, 19225, 18447, 1027, 3590, 1025, 20014, 2093, 16211, 19418, 2015, 1027, 1006, 9017, 2378, 4609, 5332, 19225, 18447, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/utils/ParameterTool.java
ParameterTool.getBoolean
public boolean getBoolean(String key) { addToDefaults(key, null); String value = getRequired(key); return Boolean.valueOf(value); }
java
public boolean getBoolean(String key) { addToDefaults(key, null); String value = getRequired(key); return Boolean.valueOf(value); }
[ "public", "boolean", "getBoolean", "(", "String", "key", ")", "{", "addToDefaults", "(", "key", ",", "null", ")", ";", "String", "value", "=", "getRequired", "(", "key", ")", ";", "return", "Boolean", ".", "valueOf", "(", "value", ")", ";", "}" ]
Returns the Boolean value for the given key. The method fails if the key does not exist.
[ "Returns", "the", "Boolean", "value", "for", "the", "given", "key", ".", "The", "method", "fails", "if", "the", "key", "does", "not", "exist", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L387-L391
train
Gets a boolean value.
[ 30522, 2270, 22017, 20898, 2131, 5092, 9890, 2319, 1006, 5164, 3145, 1007, 1063, 5587, 3406, 3207, 7011, 11314, 2015, 1006, 3145, 1010, 19701, 1007, 1025, 5164, 3643, 1027, 2131, 2890, 15549, 5596, 1006, 3145, 1007, 1025, 2709, 22017, 20898...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/builder/HashCodeBuilder.java
HashCodeBuilder.append
public HashCodeBuilder append(final byte[] array) { if (array == null) { iTotal = iTotal * iConstant; } else { for (final byte element : array) { append(element); } } return this; }
java
public HashCodeBuilder append(final byte[] array) { if (array == null) { iTotal = iTotal * iConstant; } else { for (final byte element : array) { append(element); } } return this; }
[ "public", "HashCodeBuilder", "append", "(", "final", "byte", "[", "]", "array", ")", "{", "if", "(", "array", "==", "null", ")", "{", "iTotal", "=", "iTotal", "*", "iConstant", ";", "}", "else", "{", "for", "(", "final", "byte", "element", ":", "arra...
<p> Append a <code>hashCode</code> for a <code>byte</code> array. </p> @param array the array to add to the <code>hashCode</code> @return this
[ "<p", ">", "Append", "a", "<code", ">", "hashCode<", "/", "code", ">", "for", "a", "<code", ">", "byte<", "/", "code", ">", "array", ".", "<", "/", "p", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L622-L631
train
Appends the array of bytes to the hash code.
[ 30522, 2270, 23325, 16044, 8569, 23891, 2099, 10439, 10497, 1006, 2345, 24880, 1031, 1033, 9140, 1007, 1063, 2065, 1006, 9140, 1027, 1027, 19701, 1007, 1063, 23333, 9080, 1027, 23333, 9080, 1008, 18407, 5794, 2102, 1025, 1065, 2842, 1063, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport/src/main/java/io/netty/channel/ChannelHandlerMask.java
ChannelHandlerMask.mask
static int mask(Class<? extends ChannelHandler> clazz) { // Try to obtain the mask from the cache first. If this fails calculate it and put it in the cache for fast // lookup in the future. Map<Class<? extends ChannelHandler>, Integer> cache = MASKS.get(); Integer mask = cache.get(clazz); if (mask == null) { mask = mask0(clazz); cache.put(clazz, mask); } return mask; }
java
static int mask(Class<? extends ChannelHandler> clazz) { // Try to obtain the mask from the cache first. If this fails calculate it and put it in the cache for fast // lookup in the future. Map<Class<? extends ChannelHandler>, Integer> cache = MASKS.get(); Integer mask = cache.get(clazz); if (mask == null) { mask = mask0(clazz); cache.put(clazz, mask); } return mask; }
[ "static", "int", "mask", "(", "Class", "<", "?", "extends", "ChannelHandler", ">", "clazz", ")", "{", "// Try to obtain the mask from the cache first. If this fails calculate it and put it in the cache for fast", "// lookup in the future.", "Map", "<", "Class", "<", "?", "ext...
Return the {@code executionMask}.
[ "Return", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java#L70-L80
train
Get the mask for a channel handler.
[ 30522, 10763, 20014, 7308, 1006, 2465, 1026, 1029, 8908, 3149, 11774, 3917, 1028, 18856, 10936, 2480, 1007, 1063, 1013, 1013, 3046, 2000, 6855, 1996, 7308, 2013, 1996, 17053, 2034, 1012, 2065, 2023, 11896, 18422, 2009, 1998, 2404, 2009, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java
InitializrService.generate
public ProjectGenerationResponse generate(ProjectGenerationRequest request) throws IOException { Log.info("Using service at " + request.getServiceUrl()); InitializrServiceMetadata metadata = loadMetadata(request.getServiceUrl()); URI url = request.generateUrl(metadata); CloseableHttpResponse httpResponse = executeProjectGenerationRequest(url); HttpEntity httpEntity = httpResponse.getEntity(); validateResponse(httpResponse, request.getServiceUrl()); return createResponse(httpResponse, httpEntity); }
java
public ProjectGenerationResponse generate(ProjectGenerationRequest request) throws IOException { Log.info("Using service at " + request.getServiceUrl()); InitializrServiceMetadata metadata = loadMetadata(request.getServiceUrl()); URI url = request.generateUrl(metadata); CloseableHttpResponse httpResponse = executeProjectGenerationRequest(url); HttpEntity httpEntity = httpResponse.getEntity(); validateResponse(httpResponse, request.getServiceUrl()); return createResponse(httpResponse, httpEntity); }
[ "public", "ProjectGenerationResponse", "generate", "(", "ProjectGenerationRequest", "request", ")", "throws", "IOException", "{", "Log", ".", "info", "(", "\"Using service at \"", "+", "request", ".", "getServiceUrl", "(", ")", ")", ";", "InitializrServiceMetadata", "...
Generate a project based on the specified {@link ProjectGenerationRequest}. @param request the generation request @return an entity defining the project @throws IOException if generation fails
[ "Generate", "a", "project", "based", "on", "the", "specified", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java#L89-L98
train
Generate a project from the specified request.
[ 30522, 2270, 2622, 6914, 16754, 6072, 26029, 3366, 9699, 1006, 2622, 6914, 16754, 2890, 15500, 5227, 1007, 11618, 22834, 10288, 24422, 1063, 8833, 1012, 18558, 1006, 1000, 2478, 2326, 2012, 1000, 1009, 5227, 1012, 4152, 2121, 7903, 11236, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java
HandleHelper.getColumnValue
private static <T> Object getColumnValue(ResultSet rs, String label, int type, Type targetColumnType) throws SQLException { Object rawValue; switch (type) { case Types.TIMESTAMP: rawValue = rs.getTimestamp(label); break; case Types.TIME: rawValue = rs.getTime(label); break; default: rawValue = rs.getObject(label); } if (null == targetColumnType || Object.class == targetColumnType) { // 无需转换 return rawValue; } else { // 按照返回值要求转换 return Convert.convert(targetColumnType, rawValue); } }
java
private static <T> Object getColumnValue(ResultSet rs, String label, int type, Type targetColumnType) throws SQLException { Object rawValue; switch (type) { case Types.TIMESTAMP: rawValue = rs.getTimestamp(label); break; case Types.TIME: rawValue = rs.getTime(label); break; default: rawValue = rs.getObject(label); } if (null == targetColumnType || Object.class == targetColumnType) { // 无需转换 return rawValue; } else { // 按照返回值要求转换 return Convert.convert(targetColumnType, rawValue); } }
[ "private", "static", "<", "T", ">", "Object", "getColumnValue", "(", "ResultSet", "rs", ",", "String", "label", ",", "int", "type", ",", "Type", "targetColumnType", ")", "throws", "SQLException", "{", "Object", "rawValue", ";", "switch", "(", "type", ")", ...
获取字段值<br> 针对日期时间等做单独处理判断 @param <T> 返回类型 @param rs {@link ResultSet} @param label 字段标签或者字段名 @param type 字段类型,默认Object @param targetColumnType 结果要求的类型,需进行二次转换(null或者Object不转换) @return 字段值 @throws SQLException SQL异常
[ "获取字段值<br", ">", "针对日期时间等做单独处理判断" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java#L212-L231
train
Gets the value of a column from a ResultSet.
[ 30522, 2797, 10763, 1026, 1056, 1028, 4874, 2131, 25778, 2819, 2078, 10175, 5657, 1006, 3463, 3388, 12667, 1010, 5164, 3830, 1010, 20014, 2828, 1010, 2828, 4539, 25778, 2819, 29405, 5051, 1007, 11618, 29296, 10288, 24422, 1063, 4874, 6315, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HttpRequest.java
HttpRequest.urlWithParamIfGet
private void urlWithParamIfGet() { if (Method.GET.equals(method) && false == this.isRest) { // 优先使用body形式的参数,不存在使用form if (ArrayUtil.isNotEmpty(this.bodyBytes)) { this.url = HttpUtil.urlWithForm(this.url, StrUtil.str(this.bodyBytes, this.charset), this.charset, false); } else { this.url = HttpUtil.urlWithForm(this.url, this.form, this.charset, false); } } }
java
private void urlWithParamIfGet() { if (Method.GET.equals(method) && false == this.isRest) { // 优先使用body形式的参数,不存在使用form if (ArrayUtil.isNotEmpty(this.bodyBytes)) { this.url = HttpUtil.urlWithForm(this.url, StrUtil.str(this.bodyBytes, this.charset), this.charset, false); } else { this.url = HttpUtil.urlWithForm(this.url, this.form, this.charset, false); } } }
[ "private", "void", "urlWithParamIfGet", "(", ")", "{", "if", "(", "Method", ".", "GET", ".", "equals", "(", "method", ")", "&&", "false", "==", "this", ".", "isRest", ")", "{", "// 优先使用body形式的参数,不存在使用form\r", "if", "(", "ArrayUtil", ".", "isNotEmpty", "(",...
对于GET请求将参数加到URL中<br> 此处不对URL中的特殊字符做单独编码
[ "对于GET请求将参数加到URL中<br", ">", "此处不对URL中的特殊字符做单独编码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L930-L939
train
URL with param if get.
[ 30522, 2797, 11675, 24471, 2140, 24415, 28689, 4328, 2546, 18150, 1006, 1007, 1063, 2065, 1006, 4118, 1012, 2131, 1012, 19635, 1006, 4118, 1007, 1004, 1004, 6270, 1027, 1027, 2023, 1012, 2003, 28533, 1007, 1063, 1013, 1013, 100, 100, 100, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java
NetworkEnvironmentConfiguration.checkNewNetworkConfig
private static void checkNewNetworkConfig( final int pageSize, final float networkBufFraction, final long networkBufMin, final long networkBufMax) throws IllegalConfigurationException { ConfigurationParserUtils.checkConfigParameter(networkBufFraction > 0.0f && networkBufFraction < 1.0f, networkBufFraction, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION.key(), "Network buffer memory fraction of the free memory must be between 0.0 and 1.0"); ConfigurationParserUtils.checkConfigParameter(networkBufMin >= pageSize, networkBufMin, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.key(), "Minimum memory for network buffers must allow at least one network " + "buffer with respect to the memory segment size"); ConfigurationParserUtils.checkConfigParameter(networkBufMax >= pageSize, networkBufMax, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key(), "Maximum memory for network buffers must allow at least one network " + "buffer with respect to the memory segment size"); ConfigurationParserUtils.checkConfigParameter(networkBufMax >= networkBufMin, networkBufMax, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key(), "Maximum memory for network buffers must not be smaller than minimum memory (" + TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key() + ": " + networkBufMin + ")"); }
java
private static void checkNewNetworkConfig( final int pageSize, final float networkBufFraction, final long networkBufMin, final long networkBufMax) throws IllegalConfigurationException { ConfigurationParserUtils.checkConfigParameter(networkBufFraction > 0.0f && networkBufFraction < 1.0f, networkBufFraction, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION.key(), "Network buffer memory fraction of the free memory must be between 0.0 and 1.0"); ConfigurationParserUtils.checkConfigParameter(networkBufMin >= pageSize, networkBufMin, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.key(), "Minimum memory for network buffers must allow at least one network " + "buffer with respect to the memory segment size"); ConfigurationParserUtils.checkConfigParameter(networkBufMax >= pageSize, networkBufMax, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key(), "Maximum memory for network buffers must allow at least one network " + "buffer with respect to the memory segment size"); ConfigurationParserUtils.checkConfigParameter(networkBufMax >= networkBufMin, networkBufMax, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key(), "Maximum memory for network buffers must not be smaller than minimum memory (" + TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key() + ": " + networkBufMin + ")"); }
[ "private", "static", "void", "checkNewNetworkConfig", "(", "final", "int", "pageSize", ",", "final", "float", "networkBufFraction", ",", "final", "long", "networkBufMin", ",", "final", "long", "networkBufMax", ")", "throws", "IllegalConfigurationException", "{", "Conf...
Validates the (new) network buffer configuration. @param pageSize size of memory buffers @param networkBufFraction fraction of JVM memory to use for network buffers @param networkBufMin minimum memory size for network buffers (in bytes) @param networkBufMax maximum memory size for network buffers (in bytes) @throws IllegalConfigurationException if the condition does not hold
[ "Validates", "the", "(", "new", ")", "network", "buffer", "configuration", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L324-L348
train
Check the configuration for a new network.
[ 30522, 2797, 10763, 11675, 4638, 2638, 7962, 3388, 6198, 8663, 8873, 2290, 1006, 2345, 20014, 5530, 4697, 1010, 2345, 14257, 2897, 8569, 4246, 25533, 1010, 2345, 2146, 2897, 8569, 16715, 2378, 1010, 2345, 2146, 2897, 8569, 16715, 8528, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.convertCharset
public static File convertCharset(File file, Charset srcCharset, Charset destCharset) { return CharsetUtil.convert(file, srcCharset, destCharset); }
java
public static File convertCharset(File file, Charset srcCharset, Charset destCharset) { return CharsetUtil.convert(file, srcCharset, destCharset); }
[ "public", "static", "File", "convertCharset", "(", "File", "file", ",", "Charset", "srcCharset", ",", "Charset", "destCharset", ")", "{", "return", "CharsetUtil", ".", "convert", "(", "file", ",", "srcCharset", ",", "destCharset", ")", ";", "}" ]
转换文件编码<br> 此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码 @param file 文件 @param srcCharset 原文件的编码,必须与文件内容的编码保持一致 @param destCharset 转码后的编码 @return 被转换编码的文件 @see CharsetUtil#convert(File, Charset, Charset) @since 3.1.0
[ "转换文件编码<br", ">", "此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3229-L3231
train
Convert the given file to the given charset.
[ 30522, 2270, 10763, 5371, 10463, 7507, 22573, 2102, 1006, 5371, 30524, 2709, 25869, 13462, 21823, 2140, 1012, 10463, 1006, 5371, 1010, 5034, 9468, 8167, 13462, 1010, 4078, 10649, 11650, 3388, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/AllGroupCombineDriver.java
AllGroupCombineDriver.setup
@Override public void setup(TaskContext<GroupCombineFunction<IN, OUT>, OUT> context) { this.taskContext = context; }
java
@Override public void setup(TaskContext<GroupCombineFunction<IN, OUT>, OUT> context) { this.taskContext = context; }
[ "@", "Override", "public", "void", "setup", "(", "TaskContext", "<", "GroupCombineFunction", "<", "IN", ",", "OUT", ">", ",", "OUT", ">", "context", ")", "{", "this", ".", "taskContext", "=", "context", ";", "}" ]
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/AllGroupCombineDriver.java#L53-L56
train
Set up the task context.
[ 30522, 1030, 2058, 15637, 2270, 11675, 16437, 1006, 4708, 8663, 18209, 1026, 2177, 18274, 3170, 11263, 27989, 1026, 1999, 1010, 2041, 1028, 1010, 2041, 1028, 6123, 1007, 1063, 2023, 1012, 4708, 8663, 18209, 1027, 6123, 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...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
WindowedStream.trigger
@PublicEvolving public WindowedStream<T, K, W> trigger(Trigger<? super T, ? super W> trigger) { if (windowAssigner instanceof MergingWindowAssigner && !trigger.canMerge()) { throw new UnsupportedOperationException("A merging window assigner cannot be used with a trigger that does not support merging."); } if (windowAssigner instanceof BaseAlignedWindowAssigner) { throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with a custom trigger."); } this.trigger = trigger; return this; }
java
@PublicEvolving public WindowedStream<T, K, W> trigger(Trigger<? super T, ? super W> trigger) { if (windowAssigner instanceof MergingWindowAssigner && !trigger.canMerge()) { throw new UnsupportedOperationException("A merging window assigner cannot be used with a trigger that does not support merging."); } if (windowAssigner instanceof BaseAlignedWindowAssigner) { throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with a custom trigger."); } this.trigger = trigger; return this; }
[ "@", "PublicEvolving", "public", "WindowedStream", "<", "T", ",", "K", ",", "W", ">", "trigger", "(", "Trigger", "<", "?", "super", "T", ",", "?", "super", "W", ">", "trigger", ")", "{", "if", "(", "windowAssigner", "instanceof", "MergingWindowAssigner", ...
Sets the {@code Trigger} that should be used to trigger window emission.
[ "Sets", "the", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L136-L148
train
Sets the trigger for this stream.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 3332, 2098, 21422, 1026, 1056, 1010, 1047, 1010, 1059, 1028, 9495, 1006, 9495, 1026, 1029, 3565, 1056, 1010, 1029, 3565, 1059, 1028, 9495, 1007, 1063, 2065, 1006, 3332, 12054, 23773, 2121, 6013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/operators/DeltaIteration.java
DeltaIteration.registerAggregator
@PublicEvolving public DeltaIteration<ST, WT> registerAggregator(String name, Aggregator<?> aggregator) { this.aggregators.registerAggregator(name, aggregator); return this; }
java
@PublicEvolving public DeltaIteration<ST, WT> registerAggregator(String name, Aggregator<?> aggregator) { this.aggregators.registerAggregator(name, aggregator); return this; }
[ "@", "PublicEvolving", "public", "DeltaIteration", "<", "ST", ",", "WT", ">", "registerAggregator", "(", "String", "name", ",", "Aggregator", "<", "?", ">", "aggregator", ")", "{", "this", ".", "aggregators", ".", "registerAggregator", "(", "name", ",", "agg...
Registers an {@link Aggregator} for the iteration. Aggregators can be used to maintain simple statistics during the iteration, such as number of elements processed. The aggregators compute global aggregates: After each iteration step, the values are globally aggregated to produce one aggregate that represents statistics across all parallel instances. The value of an aggregator can be accessed in the next iteration. <p>Aggregators can be accessed inside a function via the {@link org.apache.flink.api.common.functions.AbstractRichFunction#getIterationRuntimeContext()} method. @param name The name under which the aggregator is registered. @param aggregator The aggregator class. @return The DeltaIteration itself, to allow chaining function calls.
[ "Registers", "an", "{", "@link", "Aggregator", "}", "for", "the", "iteration", ".", "Aggregators", "can", "be", "used", "to", "maintain", "simple", "statistics", "during", "the", "iteration", "such", "as", "number", "of", "elements", "processed", ".", "The", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DeltaIteration.java#L278-L282
train
Registers an aggregator for the delta iteration.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 7160, 21646, 3370, 1026, 2358, 1010, 1059, 2102, 1028, 4236, 8490, 17603, 20697, 2953, 1006, 5164, 2171, 1010, 24089, 1026, 1029, 1028, 24089, 1007, 1063, 2023, 1012, 24089, 2015, 1012, 4236, 8490,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java
KryoUtils.copy
public static <T> T copy(T from, Kryo kryo, TypeSerializer<T> serializer) { try { return kryo.copy(from); } catch (KryoException ke) { // Kryo could not copy the object --> try to serialize/deserialize the object try { byte[] byteArray = InstantiationUtil.serializeToByteArray(serializer, from); return InstantiationUtil.deserializeFromByteArray(serializer, byteArray); } catch (IOException ioe) { throw new RuntimeException("Could not copy object by serializing/deserializing" + " it.", ioe); } } }
java
public static <T> T copy(T from, Kryo kryo, TypeSerializer<T> serializer) { try { return kryo.copy(from); } catch (KryoException ke) { // Kryo could not copy the object --> try to serialize/deserialize the object try { byte[] byteArray = InstantiationUtil.serializeToByteArray(serializer, from); return InstantiationUtil.deserializeFromByteArray(serializer, byteArray); } catch (IOException ioe) { throw new RuntimeException("Could not copy object by serializing/deserializing" + " it.", ioe); } } }
[ "public", "static", "<", "T", ">", "T", "copy", "(", "T", "from", ",", "Kryo", "kryo", ",", "TypeSerializer", "<", "T", ">", "serializer", ")", "{", "try", "{", "return", "kryo", ".", "copy", "(", "from", ")", ";", "}", "catch", "(", "KryoException...
Tries to copy the given record from using the provided Kryo instance. If this fails, then the record from is copied by serializing it into a byte buffer and deserializing it from there. @param from Element to copy @param kryo Kryo instance to use @param serializer TypeSerializer which is used in case of a Kryo failure @param <T> Type of the element to be copied @return Copied element
[ "Tries", "to", "copy", "the", "given", "record", "from", "using", "the", "provided", "Kryo", "instance", ".", "If", "this", "fails", "then", "the", "record", "from", "is", "copied", "by", "serializing", "it", "into", "a", "byte", "buffer", "and", "deserial...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java#L48-L62
train
Copy the object using the given Kryo and TypeSerializer.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 6100, 1006, 1056, 2013, 1010, 1047, 2854, 2080, 1047, 2854, 2080, 1010, 4127, 11610, 28863, 1026, 1056, 1028, 7642, 17629, 1007, 1063, 3046, 1063, 2709, 1047, 2854, 2080, 1012, 6100, 1006, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SimpleCache.java
SimpleCache.remove
public V remove(K key) { writeLock.lock(); try { return cache.remove(key); } finally { writeLock.unlock(); } }
java
public V remove(K key) { writeLock.lock(); try { return cache.remove(key); } finally { writeLock.unlock(); } }
[ "public", "V", "remove", "(", "K", "key", ")", "{", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "return", "cache", ".", "remove", "(", "key", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
移除缓存 @param key 键 @return 移除的值
[ "移除缓存" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/SimpleCache.java#L64-L71
train
Removes the object from the cache.
[ 30522, 2270, 1058, 6366, 1006, 1047, 3145, 1007, 1063, 4339, 7878, 1012, 5843, 1006, 1007, 1025, 3046, 1063, 2709, 17053, 1012, 6366, 1006, 3145, 1007, 1025, 1065, 2633, 1063, 4339, 7878, 1012, 19829, 1006, 1007, 1025, 1065, 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...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java
DataSetUtils.sampleWithSize
public static <T> DataSet<T> sampleWithSize( DataSet <T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
java
public static <T> DataSet<T> sampleWithSize( DataSet <T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
[ "public", "static", "<", "T", ">", "DataSet", "<", "T", ">", "sampleWithSize", "(", "DataSet", "<", "T", ">", "input", ",", "final", "boolean", "withReplacement", ",", "final", "int", "numSamples", ")", "{", "return", "sampleWithSize", "(", "input", ",", ...
Generate a sample of DataSet which contains fixed size elements. <p><strong>NOTE:</strong> Sample with fixed size is not as efficient as sample with fraction, use sample with fraction unless you need exact precision. @param withReplacement Whether element can be selected more than once. @param numSamples The expected sample size. @return The sampled DataSet
[ "Generate", "a", "sample", "of", "DataSet", "which", "contains", "fixed", "size", "elements", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L232-L238
train
Samples a DataSet of type N with a fixed size.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2951, 13462, 1026, 1056, 1028, 7099, 24415, 5332, 4371, 1006, 2951, 13462, 1026, 1056, 1028, 7953, 1010, 2345, 22017, 20898, 2007, 2890, 24759, 10732, 3672, 1010, 2345, 20014, 16371, 5244, 16613, 4244, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.downloadFile
public static long downloadFile(String url, String dest) { return downloadFile(url, FileUtil.file(dest)); }
java
public static long downloadFile(String url, String dest) { return downloadFile(url, FileUtil.file(dest)); }
[ "public", "static", "long", "downloadFile", "(", "String", "url", ",", "String", "dest", ")", "{", "return", "downloadFile", "(", "url", ",", "FileUtil", ".", "file", "(", "dest", ")", ")", ";", "}" ]
下载远程文件 @param url 请求的url @param dest 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名 @return 文件大小
[ "下载远程文件" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L254-L256
train
Download file from url to dest
[ 30522, 2270, 10763, 2146, 8816, 8873, 2571, 1006, 5164, 24471, 2140, 1010, 5164, 4078, 2102, 1007, 1063, 2709, 8816, 8873, 2571, 1006, 24471, 2140, 1010, 5371, 21823, 2140, 1012, 5371, 1006, 4078, 2102, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/proxy/KinesisProxy.java
KinesisProxy.isRecoverableException
protected static boolean isRecoverableException(AmazonServiceException ex) { if (ex.getErrorType() == null) { return false; } switch (ex.getErrorType()) { case Client: return ex instanceof ProvisionedThroughputExceededException; case Service: case Unknown: return true; default: return false; } }
java
protected static boolean isRecoverableException(AmazonServiceException ex) { if (ex.getErrorType() == null) { return false; } switch (ex.getErrorType()) { case Client: return ex instanceof ProvisionedThroughputExceededException; case Service: case Unknown: return true; default: return false; } }
[ "protected", "static", "boolean", "isRecoverableException", "(", "AmazonServiceException", "ex", ")", "{", "if", "(", "ex", ".", "getErrorType", "(", ")", "==", "null", ")", "{", "return", "false", ";", "}", "switch", "(", "ex", ".", "getErrorType", "(", "...
Determines whether the exception is recoverable using exponential-backoff. @param ex Exception to inspect @return <code>true</code> if the exception can be recovered from, else <code>false</code>
[ "Determines", "whether", "the", "exception", "is", "recoverable", "using", "exponential", "-", "backoff", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java#L368-L382
train
Returns true if the exception is recoverable.
[ 30522, 5123, 10763, 22017, 20898, 2003, 2890, 3597, 26061, 3468, 10288, 24422, 1006, 9733, 8043, 7903, 4402, 2595, 24422, 4654, 1007, 1063, 2065, 1006, 4654, 1012, 2131, 2121, 29165, 13874, 1006, 1007, 1027, 1027, 19701, 1007, 1063, 2709, 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/consumer/RemoteInputChannel.java
RemoteInputChannel.requestSubpartition
@VisibleForTesting @Override public void requestSubpartition(int subpartitionIndex) throws IOException, InterruptedException { if (partitionRequestClient == null) { // Create a client and request the partition partitionRequestClient = connectionManager .createPartitionRequestClient(connectionId); partitionRequestClient.requestSubpartition(partitionId, subpartitionIndex, this, 0); } }
java
@VisibleForTesting @Override public void requestSubpartition(int subpartitionIndex) throws IOException, InterruptedException { if (partitionRequestClient == null) { // Create a client and request the partition partitionRequestClient = connectionManager .createPartitionRequestClient(connectionId); partitionRequestClient.requestSubpartition(partitionId, subpartitionIndex, this, 0); } }
[ "@", "VisibleForTesting", "@", "Override", "public", "void", "requestSubpartition", "(", "int", "subpartitionIndex", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "partitionRequestClient", "==", "null", ")", "{", "// Create a client and requ...
Requests a remote subpartition.
[ "Requests", "a", "remote", "subpartition", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java#L159-L169
train
Request a subpartition.
[ 30522, 1030, 5710, 13028, 4355, 2075, 1030, 2058, 15637, 2270, 11675, 11186, 12083, 19362, 3775, 3508, 1006, 20014, 4942, 19362, 3775, 3508, 22254, 10288, 1007, 11618, 22834, 10288, 24422, 1010, 7153, 10288, 24422, 1063, 2065, 1006, 13571, 28...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.cleanMixedAttributes
private void cleanMixedAttributes() { currentFieldAttributes.remove(HttpHeaderValues.CHARSET); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_LENGTH); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TRANSFER_ENCODING); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TYPE); currentFieldAttributes.remove(HttpHeaderValues.FILENAME); }
java
private void cleanMixedAttributes() { currentFieldAttributes.remove(HttpHeaderValues.CHARSET); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_LENGTH); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TRANSFER_ENCODING); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TYPE); currentFieldAttributes.remove(HttpHeaderValues.FILENAME); }
[ "private", "void", "cleanMixedAttributes", "(", ")", "{", "currentFieldAttributes", ".", "remove", "(", "HttpHeaderValues", ".", "CHARSET", ")", ";", "currentFieldAttributes", ".", "remove", "(", "HttpHeaderNames", ".", "CONTENT_LENGTH", ")", ";", "currentFieldAttribu...
Remove all Attributes that should be cleaned between two FileUpload in Mixed mode
[ "Remove", "all", "Attributes", "that", "should", "be", "cleaned", "between", "two", "FileUpload", "in", "Mixed", "mode" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L975-L981
train
Remove mixed attributes.
[ 30522, 2797, 11675, 4550, 4328, 19068, 19321, 3089, 8569, 4570, 1006, 1007, 1063, 2783, 3790, 19321, 3089, 8569, 4570, 1012, 6366, 1006, 8299, 4974, 2121, 10175, 15808, 1012, 25869, 13462, 1007, 1025, 2783, 3790, 19321, 3089, 8569, 4570, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/perceptron/structures/CompactArray.java
CompactArray.set
public void set(int index, float value) { if (index < offset + array.length && index >= offset) { array[index - offset] += value; } else if (index < offset) { //expand from left int gap = offset - index; int newSize = gap + array.length; float[] newArray = new float[newSize]; newArray[0] = value; for (int i = 0; i < array.length; i++) { newArray[gap + i] = array[i]; } this.offset = index; this.array = newArray; } else { int gap = index - (array.length + offset - 1); int newSize = array.length + gap; float[] newArray = new float[newSize]; newArray[newSize - 1] = value; for (int i = 0; i < array.length; i++) { newArray[i] = array[i]; } this.array = newArray; } }
java
public void set(int index, float value) { if (index < offset + array.length && index >= offset) { array[index - offset] += value; } else if (index < offset) { //expand from left int gap = offset - index; int newSize = gap + array.length; float[] newArray = new float[newSize]; newArray[0] = value; for (int i = 0; i < array.length; i++) { newArray[gap + i] = array[i]; } this.offset = index; this.array = newArray; } else { int gap = index - (array.length + offset - 1); int newSize = array.length + gap; float[] newArray = new float[newSize]; newArray[newSize - 1] = value; for (int i = 0; i < array.length; i++) { newArray[i] = array[i]; } this.array = newArray; } }
[ "public", "void", "set", "(", "int", "index", ",", "float", "value", ")", "{", "if", "(", "index", "<", "offset", "+", "array", ".", "length", "&&", "index", ">=", "offset", ")", "{", "array", "[", "index", "-", "offset", "]", "+=", "value", ";", ...
将index处的元素设置为value @param index @param value
[ "将index处的元素设置为value" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/structures/CompactArray.java#L33-L64
train
Sets the value of a single element in the array at the specified index.
[ 30522, 2270, 11675, 2275, 1006, 20014, 5950, 1010, 14257, 3643, 1007, 1063, 2065, 1006, 5950, 1026, 16396, 1009, 9140, 1012, 3091, 1004, 1004, 5950, 1028, 1027, 30524, 2187, 20014, 6578, 1027, 16396, 1011, 5950, 1025, 20014, 2739, 4697, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.toDecimal
public Decimal toDecimal(int precision, int scale) { ensureMaterialized(); if (precision > Decimal.MAX_LONG_DIGITS || this.sizeInBytes > Decimal.MAX_LONG_DIGITS) { return toDecimalSlow(precision, scale); } // Data in Decimal is stored by one long value if `precision` <= Decimal.MAX_LONG_DIGITS. // In this case we can directly extract the value from memory segment. int size = getSegments()[0].size(); SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size); int totalOffset = 0; // Remove white spaces at the beginning byte b = 0; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); if (b != ' ' && b != '\n' && b != '\t') { break; } totalOffset++; segmentAndOffset.nextByte(size); } if (totalOffset == this.sizeInBytes) { // all whitespaces return null; } // ======= Significand part begin ======= final boolean negative = b == '-'; if (negative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (totalOffset == this.sizeInBytes) { // only contains prefix plus/minus return null; } } long significand = 0; int exp = 0; int significandLen = 0, pointPos = -1; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b >= '0' && b <= '9') { // No need to worry about overflow, because this.sizeInBytes <= Decimal.MAX_LONG_DIGITS significand = significand * 10 + (b - '0'); significandLen++; } else if (b == '.') { if (pointPos >= 0) { // More than one decimal point return null; } pointPos = significandLen; } else { break; } } if (pointPos < 0) { pointPos = significandLen; } if (negative) { significand = -significand; } // ======= Significand part end ======= // ======= Exponential part begin ======= if ((b == 'e' || b == 'E') && totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); final boolean expNegative = b == '-'; if (expNegative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (totalOffset == this.sizeInBytes) { return null; } } int expDigits = 0; // As `precision` <= 18, value absolute range is limited to 10^-18 ~ 10^18. // The worst case is <18-digits>E-36 final int expStopValue = 40; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b >= '0' && b <= '9') { // No need to worry about larger exponents, // because they will produce overflow or underflow if (expDigits < expStopValue) { expDigits = expDigits * 10 + (b - '0'); } } else { break; } } if (expNegative) { expDigits = -expDigits; } exp += expDigits; } exp -= significandLen - pointPos; // ======= Exponential part end ======= // Check for invalid character at the end while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); // White spaces are allowed at the end if (b != ' ' && b != '\n' && b != '\t') { return null; } } // Round exp to scale int change = exp + scale; if (significandLen + change > precision) { // Overflow return null; } if (change >= 0) { significand *= Decimal.POW10[change]; } else { int k = negative ? -5 : 5; significand = (significand + k * Decimal.POW10[-change - 1]) / Decimal.POW10[-change]; } return Decimal.fromLong(significand, precision, scale); }
java
public Decimal toDecimal(int precision, int scale) { ensureMaterialized(); if (precision > Decimal.MAX_LONG_DIGITS || this.sizeInBytes > Decimal.MAX_LONG_DIGITS) { return toDecimalSlow(precision, scale); } // Data in Decimal is stored by one long value if `precision` <= Decimal.MAX_LONG_DIGITS. // In this case we can directly extract the value from memory segment. int size = getSegments()[0].size(); SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size); int totalOffset = 0; // Remove white spaces at the beginning byte b = 0; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); if (b != ' ' && b != '\n' && b != '\t') { break; } totalOffset++; segmentAndOffset.nextByte(size); } if (totalOffset == this.sizeInBytes) { // all whitespaces return null; } // ======= Significand part begin ======= final boolean negative = b == '-'; if (negative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (totalOffset == this.sizeInBytes) { // only contains prefix plus/minus return null; } } long significand = 0; int exp = 0; int significandLen = 0, pointPos = -1; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b >= '0' && b <= '9') { // No need to worry about overflow, because this.sizeInBytes <= Decimal.MAX_LONG_DIGITS significand = significand * 10 + (b - '0'); significandLen++; } else if (b == '.') { if (pointPos >= 0) { // More than one decimal point return null; } pointPos = significandLen; } else { break; } } if (pointPos < 0) { pointPos = significandLen; } if (negative) { significand = -significand; } // ======= Significand part end ======= // ======= Exponential part begin ======= if ((b == 'e' || b == 'E') && totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); final boolean expNegative = b == '-'; if (expNegative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (totalOffset == this.sizeInBytes) { return null; } } int expDigits = 0; // As `precision` <= 18, value absolute range is limited to 10^-18 ~ 10^18. // The worst case is <18-digits>E-36 final int expStopValue = 40; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b >= '0' && b <= '9') { // No need to worry about larger exponents, // because they will produce overflow or underflow if (expDigits < expStopValue) { expDigits = expDigits * 10 + (b - '0'); } } else { break; } } if (expNegative) { expDigits = -expDigits; } exp += expDigits; } exp -= significandLen - pointPos; // ======= Exponential part end ======= // Check for invalid character at the end while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); // White spaces are allowed at the end if (b != ' ' && b != '\n' && b != '\t') { return null; } } // Round exp to scale int change = exp + scale; if (significandLen + change > precision) { // Overflow return null; } if (change >= 0) { significand *= Decimal.POW10[change]; } else { int k = negative ? -5 : 5; significand = (significand + k * Decimal.POW10[-change - 1]) / Decimal.POW10[-change]; } return Decimal.fromLong(significand, precision, scale); }
[ "public", "Decimal", "toDecimal", "(", "int", "precision", ",", "int", "scale", ")", "{", "ensureMaterialized", "(", ")", ";", "if", "(", "precision", ">", "Decimal", ".", "MAX_LONG_DIGITS", "||", "this", ".", "sizeInBytes", ">", "Decimal", ".", "MAX_LONG_DI...
Parses this BinaryString to Decimal. @return Decimal value if the parsing was successful, or null if overflow @throws NumberFormatException if the parsing failed.
[ "Parses", "this", "BinaryString", "to", "Decimal", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L1477-L1612
train
Returns the decimal value of this object.
[ 30522, 2270, 26066, 28681, 8586, 9581, 2140, 1006, 20014, 11718, 1010, 20014, 4094, 1007, 1063, 5676, 8585, 14482, 3550, 1006, 1007, 1025, 2065, 1006, 11718, 1028, 26066, 1012, 4098, 1035, 2146, 1035, 16648, 1064, 1064, 2023, 1012, 2946, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
CompressorHttp2ConnectionEncoder.cleanup
void cleanup(Http2Stream stream, EmbeddedChannel compressor) { if (compressor.finish()) { for (;;) { final ByteBuf buf = compressor.readOutbound(); if (buf == null) { break; } buf.release(); } } stream.removeProperty(propertyKey); }
java
void cleanup(Http2Stream stream, EmbeddedChannel compressor) { if (compressor.finish()) { for (;;) { final ByteBuf buf = compressor.readOutbound(); if (buf == null) { break; } buf.release(); } } stream.removeProperty(propertyKey); }
[ "void", "cleanup", "(", "Http2Stream", "stream", ",", "EmbeddedChannel", "compressor", ")", "{", "if", "(", "compressor", ".", "finish", "(", ")", ")", "{", "for", "(", ";", ";", ")", "{", "final", "ByteBuf", "buf", "=", "compressor", ".", "readOutbound"...
Release remaining content from {@link EmbeddedChannel} and remove the compressor from the {@link Http2Stream}. @param stream The stream for which {@code compressor} is the compressor for @param compressor The compressor for {@code stream}
[ "Release", "remaining", "content", "from", "{", "@link", "EmbeddedChannel", "}", "and", "remove", "the", "compressor", "from", "the", "{", "@link", "Http2Stream", "}", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L286-L298
train
Cleanup the stream.
[ 30522, 11675, 27686, 1006, 8299, 2475, 21422, 5460, 1010, 11157, 26058, 29329, 1007, 1063, 2065, 1006, 29329, 1012, 3926, 1006, 1007, 1007, 1063, 2005, 1006, 1025, 1025, 1007, 1063, 2345, 24880, 8569, 2546, 20934, 2546, 1027, 29329, 1012, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java
Bzip2HuffmanStageEncoder.generateHuffmanCodeLengths
private static void generateHuffmanCodeLengths(final int alphabetSize, final int[] symbolFrequencies, final int[] codeLengths) { final int[] mergedFrequenciesAndIndices = new int[alphabetSize]; final int[] sortedFrequencies = new int[alphabetSize]; // The Huffman allocator needs its input symbol frequencies to be sorted, but we need to // return code lengths in the same order as the corresponding frequencies are passed in. // The symbol frequency and index are merged into a single array of // integers - frequency in the high 23 bits, index in the low 9 bits. // 2^23 = 8,388,608 which is higher than the maximum possible frequency for one symbol in a block // 2^9 = 512 which is higher than the maximum possible alphabet size (== 258) // Sorting this array simultaneously sorts the frequencies and // leaves a lookup that can be used to cheaply invert the sort. for (int i = 0; i < alphabetSize; i++) { mergedFrequenciesAndIndices[i] = (symbolFrequencies[i] << 9) | i; } Arrays.sort(mergedFrequenciesAndIndices); for (int i = 0; i < alphabetSize; i++) { sortedFrequencies[i] = mergedFrequenciesAndIndices[i] >>> 9; } // Allocate code lengths - the allocation is in place, // so the code lengths will be in the sortedFrequencies array afterwards Bzip2HuffmanAllocator.allocateHuffmanCodeLengths(sortedFrequencies, HUFFMAN_ENCODE_MAX_CODE_LENGTH); // Reverse the sort to place the code lengths in the same order as the symbols whose frequencies were passed in for (int i = 0; i < alphabetSize; i++) { codeLengths[mergedFrequenciesAndIndices[i] & 0x1ff] = sortedFrequencies[i]; } }
java
private static void generateHuffmanCodeLengths(final int alphabetSize, final int[] symbolFrequencies, final int[] codeLengths) { final int[] mergedFrequenciesAndIndices = new int[alphabetSize]; final int[] sortedFrequencies = new int[alphabetSize]; // The Huffman allocator needs its input symbol frequencies to be sorted, but we need to // return code lengths in the same order as the corresponding frequencies are passed in. // The symbol frequency and index are merged into a single array of // integers - frequency in the high 23 bits, index in the low 9 bits. // 2^23 = 8,388,608 which is higher than the maximum possible frequency for one symbol in a block // 2^9 = 512 which is higher than the maximum possible alphabet size (== 258) // Sorting this array simultaneously sorts the frequencies and // leaves a lookup that can be used to cheaply invert the sort. for (int i = 0; i < alphabetSize; i++) { mergedFrequenciesAndIndices[i] = (symbolFrequencies[i] << 9) | i; } Arrays.sort(mergedFrequenciesAndIndices); for (int i = 0; i < alphabetSize; i++) { sortedFrequencies[i] = mergedFrequenciesAndIndices[i] >>> 9; } // Allocate code lengths - the allocation is in place, // so the code lengths will be in the sortedFrequencies array afterwards Bzip2HuffmanAllocator.allocateHuffmanCodeLengths(sortedFrequencies, HUFFMAN_ENCODE_MAX_CODE_LENGTH); // Reverse the sort to place the code lengths in the same order as the symbols whose frequencies were passed in for (int i = 0; i < alphabetSize; i++) { codeLengths[mergedFrequenciesAndIndices[i] & 0x1ff] = sortedFrequencies[i]; } }
[ "private", "static", "void", "generateHuffmanCodeLengths", "(", "final", "int", "alphabetSize", ",", "final", "int", "[", "]", "symbolFrequencies", ",", "final", "int", "[", "]", "codeLengths", ")", "{", "final", "int", "[", "]", "mergedFrequenciesAndIndices", "...
Generate a Huffman code length table for a given list of symbol frequencies. @param alphabetSize The total number of symbols @param symbolFrequencies The frequencies of the symbols @param codeLengths The array to which the generated code lengths should be written
[ "Generate", "a", "Huffman", "code", "length", "table", "for", "a", "given", "list", "of", "symbol", "frequencies", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java#L122-L153
train
Generate the Huffman code lengths array.
[ 30522, 2797, 10763, 11675, 9699, 6979, 4246, 2386, 16044, 7770, 13512, 7898, 1006, 2345, 20014, 12440, 5332, 4371, 1010, 2345, 20014, 1031, 1033, 6454, 19699, 2063, 4226, 14767, 1010, 2345, 20014, 1031, 1033, 3642, 7770, 13512, 7898, 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
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.checkSubArray
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
java
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
[ "private", "void", "checkSubArray", "(", "byte", "[", "]", "test", ",", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Preconditions", ".", "checkArgument", "(", "data", ".", "length", ">=", "test", ".", "length", "+", "offset", ")", ";", ...
Checks that the "test" array is in the data array starting at the given offset.
[ "Checks", "that", "the", "test", "array", "is", "in", "the", "data", "array", "starting", "at", "the", "given", "offset", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L308-L313
train
Check sub array.
[ 30522, 2797, 11675, 14148, 19761, 11335, 2100, 1006, 24880, 1031, 1033, 3231, 1010, 24880, 1031, 1033, 2951, 1010, 20014, 16396, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 2951, 1012, 3091, 1028, 1027, 3231, 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-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java
DayOfMonthValueMatcher.match
public boolean match(int value, int month, boolean isLeapYear) { return (super.match(value) // 在约定日范围内的某一天 //匹配器中用户定义了最后一天(32表示最后一天) || (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear))); }
java
public boolean match(int value, int month, boolean isLeapYear) { return (super.match(value) // 在约定日范围内的某一天 //匹配器中用户定义了最后一天(32表示最后一天) || (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear))); }
[ "public", "boolean", "match", "(", "int", "value", ",", "int", "month", ",", "boolean", "isLeapYear", ")", "{", "return", "(", "super", ".", "match", "(", "value", ")", "// 在约定日范围内的某一天\r", "//匹配器中用户定义了最后一天(32表示最后一天)\r", "||", "(", "value", ">", "27", "&&", ...
给定的日期是否匹配当前匹配器 @param value 被检查的值,此处为日 @param month 实际的月份 @param isLeapYear 是否闰年 @return 是否匹配
[ "给定的日期是否匹配当前匹配器" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java#L33-L37
train
Match a date in a month.
[ 30522, 2270, 22017, 20898, 2674, 1006, 20014, 3643, 1010, 20014, 3204, 1010, 22017, 20898, 8842, 9331, 29100, 1007, 1063, 2709, 1006, 3565, 1012, 2674, 1006, 3643, 1007, 1013, 1013, 100, 100, 1822, 1864, 100, 100, 1773, 1916, 100, 1740, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.getByteBuffer
@Nonnull public ByteBuffer getByteBuffer() { if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) { final byte[] bytes = (byte[]) base; // the offset includes an object header... this is only needed for unsafe copies final long arrayOffset = offset - BYTE_ARRAY_OFFSET; // verify that the offset and length points somewhere inside the byte array // and that the offset can safely be truncated to a 32-bit integer if ((long) bytes.length < arrayOffset + numBytes) { throw new ArrayIndexOutOfBoundsException(); } return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes); } else { return ByteBuffer.wrap(getBytes()); } }
java
@Nonnull public ByteBuffer getByteBuffer() { if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) { final byte[] bytes = (byte[]) base; // the offset includes an object header... this is only needed for unsafe copies final long arrayOffset = offset - BYTE_ARRAY_OFFSET; // verify that the offset and length points somewhere inside the byte array // and that the offset can safely be truncated to a 32-bit integer if ((long) bytes.length < arrayOffset + numBytes) { throw new ArrayIndexOutOfBoundsException(); } return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes); } else { return ByteBuffer.wrap(getBytes()); } }
[ "@", "Nonnull", "public", "ByteBuffer", "getByteBuffer", "(", ")", "{", "if", "(", "base", "instanceof", "byte", "[", "]", "&&", "offset", ">=", "BYTE_ARRAY_OFFSET", ")", "{", "final", "byte", "[", "]", "bytes", "=", "(", "byte", "[", "]", ")", "base",...
Returns a {@link ByteBuffer} wrapping the base object if it is a byte array or a copy of the data if the base object is not a byte array. Unlike getBytes this will not create a copy the array if this is a slice.
[ "Returns", "a", "{", "@link", "ByteBuffer", "}", "wrapping", "the", "base", "object", "if", "it", "is", "a", "byte", "array", "or", "a", "copy", "of", "the", "data", "if", "the", "base", "object", "is", "not", "a", "byte", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L189-L207
train
Get the ByteBuffer of the object.
[ 30522, 1030, 2512, 11231, 3363, 2270, 24880, 8569, 12494, 2131, 3762, 2618, 8569, 12494, 1006, 1007, 1063, 2065, 1006, 2918, 6013, 11253, 24880, 1031, 1033, 1004, 1004, 16396, 1028, 1027, 24880, 1035, 9140, 1035, 16396, 1007, 1063, 2345, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copyByNIO
public static long copyByNIO(InputStream in, OutputStream out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { return copy(Channels.newChannel(in), Channels.newChannel(out), bufferSize, streamProgress); }
java
public static long copyByNIO(InputStream in, OutputStream out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { return copy(Channels.newChannel(in), Channels.newChannel(out), bufferSize, streamProgress); }
[ "public", "static", "long", "copyByNIO", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "int", "bufferSize", ",", "StreamProgress", "streamProgress", ")", "throws", "IORuntimeException", "{", "return", "copy", "(", "Channels", ".", "newChannel", "(", ...
拷贝流 thanks to: https://github.com/venusdrogon/feilong-io/blob/master/src/main/java/com/feilong/io/IOWriteUtil.java<br> 本方法不会关闭流 @param in 输入流 @param out 输出流 @param bufferSize 缓存大小 @param streamProgress 进度条 @return 传输的byte数 @throws IORuntimeException IO异常
[ "拷贝流", "thanks", "to", ":", "https", ":", "//", "github", ".", "com", "/", "venusdrogon", "/", "feilong", "-", "io", "/", "blob", "/", "master", "/", "src", "/", "main", "/", "java", "/", "com", "/", "feilong", "/", "io", "/", "IOWriteUtil", ".", ...
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L201-L203
train
Copies the contents of the input stream to the output stream using NIO.
[ 30522, 2270, 10763, 2146, 6100, 3762, 27678, 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, 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/spark
common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java
SparkSaslClient.response
public synchronized byte[] response(byte[] token) { try { return saslClient != null ? saslClient.evaluateChallenge(token) : new byte[0]; } catch (SaslException e) { throw Throwables.propagate(e); } }
java
public synchronized byte[] response(byte[] token) { try { return saslClient != null ? saslClient.evaluateChallenge(token) : new byte[0]; } catch (SaslException e) { throw Throwables.propagate(e); } }
[ "public", "synchronized", "byte", "[", "]", "response", "(", "byte", "[", "]", "token", ")", "{", "try", "{", "return", "saslClient", "!=", "null", "?", "saslClient", ".", "evaluateChallenge", "(", "token", ")", ":", "new", "byte", "[", "0", "]", ";", ...
Respond to server's SASL token. @param token contains server's SASL token @return client's response SASL token
[ "Respond", "to", "server", "s", "SASL", "token", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java#L96-L102
train
Evaluate the SASL challenge.
[ 30522, 2270, 25549, 24880, 1031, 1033, 3433, 1006, 24880, 1031, 1033, 19204, 1007, 1063, 3046, 1063, 2709, 21871, 15472, 8751, 3372, 999, 1027, 19701, 1029, 21871, 15472, 8751, 3372, 1012, 16157, 18598, 7770, 3351, 1006, 19204, 1007, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java
MurmurHashUtil.hashUnsafeBytesByWords
public static int hashUnsafeBytesByWords(Object base, long offset, int lengthInBytes) { return hashUnsafeBytesByWords(base, offset, lengthInBytes, DEFAULT_SEED); }
java
public static int hashUnsafeBytesByWords(Object base, long offset, int lengthInBytes) { return hashUnsafeBytesByWords(base, offset, lengthInBytes, DEFAULT_SEED); }
[ "public", "static", "int", "hashUnsafeBytesByWords", "(", "Object", "base", ",", "long", "offset", ",", "int", "lengthInBytes", ")", "{", "return", "hashUnsafeBytesByWords", "(", "base", ",", "offset", ",", "lengthInBytes", ",", "DEFAULT_SEED", ")", ";", "}" ]
Hash unsafe bytes, length must be aligned to 4 bytes. @param base base unsafe object @param offset offset for unsafe object @param lengthInBytes length in bytes @return hash code
[ "Hash", "unsafe", "bytes", "length", "must", "be", "aligned", "to", "4", "bytes", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L40-L42
train
Hash unsafe bytes by words.
[ 30522, 2270, 10763, 20014, 23325, 4609, 3736, 7959, 3762, 4570, 3762, 22104, 1006, 4874, 2918, 1010, 2146, 16396, 1010, 20014, 3091, 2378, 3762, 4570, 1007, 1063, 2709, 23325, 4609, 3736, 7959, 3762, 4570, 3762, 22104, 1006, 2918, 1010, 163...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/LocalStreamEnvironment.java
LocalStreamEnvironment.execute
@Override public JobExecutionResult execute(String jobName) throws Exception { // transform the streaming program into a JobGraph StreamGraph streamGraph = getStreamGraph(); streamGraph.setJobName(jobName); JobGraph jobGraph = streamGraph.getJobGraph(); jobGraph.setAllowQueuedScheduling(true); Configuration configuration = new Configuration(); configuration.addAll(jobGraph.getJobConfiguration()); configuration.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "0"); // add (and override) the settings with what the user defined configuration.addAll(this.configuration); if (!configuration.contains(RestOptions.BIND_PORT)) { configuration.setString(RestOptions.BIND_PORT, "0"); } int numSlotsPerTaskManager = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, jobGraph.getMaximumParallelism()); MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder() .setConfiguration(configuration) .setNumSlotsPerTaskManager(numSlotsPerTaskManager) .build(); if (LOG.isInfoEnabled()) { LOG.info("Running job on local embedded Flink mini cluster"); } MiniCluster miniCluster = new MiniCluster(cfg); try { miniCluster.start(); configuration.setInteger(RestOptions.PORT, miniCluster.getRestAddress().get().getPort()); return miniCluster.executeJobBlocking(jobGraph); } finally { transformations.clear(); miniCluster.close(); } }
java
@Override public JobExecutionResult execute(String jobName) throws Exception { // transform the streaming program into a JobGraph StreamGraph streamGraph = getStreamGraph(); streamGraph.setJobName(jobName); JobGraph jobGraph = streamGraph.getJobGraph(); jobGraph.setAllowQueuedScheduling(true); Configuration configuration = new Configuration(); configuration.addAll(jobGraph.getJobConfiguration()); configuration.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "0"); // add (and override) the settings with what the user defined configuration.addAll(this.configuration); if (!configuration.contains(RestOptions.BIND_PORT)) { configuration.setString(RestOptions.BIND_PORT, "0"); } int numSlotsPerTaskManager = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, jobGraph.getMaximumParallelism()); MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder() .setConfiguration(configuration) .setNumSlotsPerTaskManager(numSlotsPerTaskManager) .build(); if (LOG.isInfoEnabled()) { LOG.info("Running job on local embedded Flink mini cluster"); } MiniCluster miniCluster = new MiniCluster(cfg); try { miniCluster.start(); configuration.setInteger(RestOptions.PORT, miniCluster.getRestAddress().get().getPort()); return miniCluster.executeJobBlocking(jobGraph); } finally { transformations.clear(); miniCluster.close(); } }
[ "@", "Override", "public", "JobExecutionResult", "execute", "(", "String", "jobName", ")", "throws", "Exception", "{", "// transform the streaming program into a JobGraph", "StreamGraph", "streamGraph", "=", "getStreamGraph", "(", ")", ";", "streamGraph", ".", "setJobName...
Executes the JobGraph of the on a mini cluster of CLusterUtil with a user specified name. @param jobName name of the job @return The result of the job execution, containing elapsed time and accumulators.
[ "Executes", "the", "JobGraph", "of", "the", "on", "a", "mini", "cluster", "of", "CLusterUtil", "with", "a", "user", "specified", "name", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java#L86-L129
train
Execute the job on the local embedded Flink mini cluster.
[ 30522, 1030, 2058, 15637, 2270, 3105, 10288, 8586, 13700, 6072, 11314, 15389, 1006, 5164, 3105, 18442, 1007, 11618, 6453, 1063, 1013, 1013, 10938, 1996, 11058, 2565, 2046, 1037, 3105, 14413, 5460, 14413, 5460, 14413, 1027, 4152, 25379, 14413,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.createTempFile
public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException { int exceptionsCount = 0; while (true) { try { File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile(); if (isReCreat) { file.delete(); file.createNewFile(); } return file; } catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied if (++exceptionsCount >= 50) { throw new IORuntimeException(ioex); } } } }
java
public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException { int exceptionsCount = 0; while (true) { try { File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile(); if (isReCreat) { file.delete(); file.createNewFile(); } return file; } catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied if (++exceptionsCount >= 50) { throw new IORuntimeException(ioex); } } } }
[ "public", "static", "File", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ",", "File", "dir", ",", "boolean", "isReCreat", ")", "throws", "IORuntimeException", "{", "int", "exceptionsCount", "=", "0", ";", "while", "(", "true", ")", "{"...
创建临时文件<br> 创建后的文件名为 prefix[Randon].suffix From com.jodd.io.FileUtil @param prefix 前缀,至少3个字符 @param suffix 后缀,如果null则使用默认.tmp @param dir 临时文件创建的所在目录 @param isReCreat 是否重新创建文件(删掉原来的,创建新的) @return 临时文件 @throws IORuntimeException IO异常
[ "创建临时文件<br", ">", "创建后的文件名为", "prefix", "[", "Randon", "]", ".", "suffix", "From", "com", ".", "jodd", ".", "io", ".", "FileUtil" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L897-L913
train
Creates a temporary file with the specified prefix and suffix and directory.
[ 30522, 2270, 10763, 5371, 3443, 18532, 14376, 9463, 1006, 5164, 17576, 1010, 5164, 16809, 1010, 5371, 16101, 1010, 22017, 20898, 2003, 2890, 16748, 4017, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 20014, 11790, 3597, 16671, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java
AbstractTrafficShapingHandler.checkWriteSuspend
void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) { if (queueSize > maxWriteSize || delay > maxWriteDelay) { setUserDefinedWritability(ctx, false); } }
java
void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) { if (queueSize > maxWriteSize || delay > maxWriteDelay) { setUserDefinedWritability(ctx, false); } }
[ "void", "checkWriteSuspend", "(", "ChannelHandlerContext", "ctx", ",", "long", "delay", ",", "long", "queueSize", ")", "{", "if", "(", "queueSize", ">", "maxWriteSize", "||", "delay", ">", "maxWriteDelay", ")", "{", "setUserDefinedWritability", "(", "ctx", ",", ...
Check the writability according to delay and size for the channel. Set if necessary setUserDefinedWritability status. @param delay the computed delay @param queueSize the current queueSize
[ "Check", "the", "writability", "according", "to", "delay", "and", "size", "for", "the", "channel", ".", "Set", "if", "necessary", "setUserDefinedWritability", "status", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L597-L601
train
Check if write suspend is allowed.
[ 30522, 11675, 4638, 26373, 13203, 11837, 2094, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 2146, 8536, 1010, 2146, 24240, 5332, 4371, 1007, 1063, 2065, 1006, 24240, 5332, 4371, 1028, 4098, 26373, 5332, 4371, 1064, 1064, 8536, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java
ClientX509ExtendedTrustManager.decorate
public static TrustManager[] decorate(TrustManager[] trustManagers, TLSConfig tlsConfig) { if (null!=trustManagers && trustManagers.length>0) { TrustManager[] decoratedTrustManagers = new TrustManager[trustManagers.length]; for (int i=0; i<trustManagers.length; ++i) { TrustManager trustManager = trustManagers[i]; if (trustManager instanceof X509TrustManager){ decoratedTrustManagers[i] = new ClientX509ExtendedTrustManager((X509TrustManager)trustManager, tlsConfig); }else { decoratedTrustManagers[i] = trustManager; } } return decoratedTrustManagers; } return trustManagers; }
java
public static TrustManager[] decorate(TrustManager[] trustManagers, TLSConfig tlsConfig) { if (null!=trustManagers && trustManagers.length>0) { TrustManager[] decoratedTrustManagers = new TrustManager[trustManagers.length]; for (int i=0; i<trustManagers.length; ++i) { TrustManager trustManager = trustManagers[i]; if (trustManager instanceof X509TrustManager){ decoratedTrustManagers[i] = new ClientX509ExtendedTrustManager((X509TrustManager)trustManager, tlsConfig); }else { decoratedTrustManagers[i] = trustManager; } } return decoratedTrustManagers; } return trustManagers; }
[ "public", "static", "TrustManager", "[", "]", "decorate", "(", "TrustManager", "[", "]", "trustManagers", ",", "TLSConfig", "tlsConfig", ")", "{", "if", "(", "null", "!=", "trustManagers", "&&", "trustManagers", ".", "length", ">", "0", ")", "{", "TrustManag...
This method converts existing X509TrustManagers to ClientX509ExtendedTrustManagers. @param trustManagers @param tlsConfig @return
[ "This", "method", "converts", "existing", "X509TrustManagers", "to", "ClientX509ExtendedTrustManagers", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java#L193-L211
train
Decorate the given trust managers with ClientX509ExtendedTrustManagers
[ 30522, 2270, 10763, 3404, 24805, 4590, 1031, 1033, 29460, 1006, 3404, 24805, 4590, 1031, 1033, 3404, 24805, 15776, 1010, 1056, 4877, 8663, 8873, 2290, 1056, 4877, 8663, 8873, 2290, 1007, 1063, 2065, 1006, 19701, 999, 1027, 3404, 24805, 1577...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
Http2ConnectionHandler.resetUnknownStream
private ChannelFuture resetUnknownStream(final ChannelHandlerContext ctx, int streamId, long errorCode, ChannelPromise promise) { ChannelFuture future = frameWriter().writeRstStream(ctx, streamId, errorCode, promise); if (future.isDone()) { closeConnectionOnError(ctx, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { closeConnectionOnError(ctx, future); } }); } return future; }
java
private ChannelFuture resetUnknownStream(final ChannelHandlerContext ctx, int streamId, long errorCode, ChannelPromise promise) { ChannelFuture future = frameWriter().writeRstStream(ctx, streamId, errorCode, promise); if (future.isDone()) { closeConnectionOnError(ctx, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { closeConnectionOnError(ctx, future); } }); } return future; }
[ "private", "ChannelFuture", "resetUnknownStream", "(", "final", "ChannelHandlerContext", "ctx", ",", "int", "streamId", ",", "long", "errorCode", ",", "ChannelPromise", "promise", ")", "{", "ChannelFuture", "future", "=", "frameWriter", "(", ")", ".", "writeRstStrea...
Sends a {@code RST_STREAM} frame even if we don't know about the stream. This error condition is most likely triggered by the first frame of a stream being invalid. That is, there was an error reading the frame before we could create a new stream.
[ "Sends", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L745-L759
train
Reset unknown stream.
[ 30522, 2797, 3149, 11263, 11244, 25141, 16814, 19779, 23808, 16416, 2213, 1006, 2345, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 20014, 5460, 3593, 1010, 2146, 7561, 16044, 1010, 3149, 21572, 28732, 4872, 1007, 1063, 3149, 11263, 1124...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.delegateCompatibilityCheckToNewSnapshot
public static <T> TypeSerializerSchemaCompatibility<T> delegateCompatibilityCheckToNewSnapshot( TypeSerializer<T> newSerializer, CompositeTypeSerializerSnapshot<T, ? extends TypeSerializer> newCompositeSnapshot, TypeSerializerSnapshot<?>... legacyNestedSnapshots) { checkArgument(legacyNestedSnapshots.length > 0); return newCompositeSnapshot.internalResolveSchemaCompatibility(newSerializer, legacyNestedSnapshots); }
java
public static <T> TypeSerializerSchemaCompatibility<T> delegateCompatibilityCheckToNewSnapshot( TypeSerializer<T> newSerializer, CompositeTypeSerializerSnapshot<T, ? extends TypeSerializer> newCompositeSnapshot, TypeSerializerSnapshot<?>... legacyNestedSnapshots) { checkArgument(legacyNestedSnapshots.length > 0); return newCompositeSnapshot.internalResolveSchemaCompatibility(newSerializer, legacyNestedSnapshots); }
[ "public", "static", "<", "T", ">", "TypeSerializerSchemaCompatibility", "<", "T", ">", "delegateCompatibilityCheckToNewSnapshot", "(", "TypeSerializer", "<", "T", ">", "newSerializer", ",", "CompositeTypeSerializerSnapshot", "<", "T", ",", "?", "extends", "TypeSerialize...
Delegates compatibility checks to a {@link CompositeTypeSerializerSnapshot} instance. This can be used by legacy snapshot classes, which have a newer implementation implemented as a {@link CompositeTypeSerializerSnapshot}. @param newSerializer the new serializer to check for compatibility. @param newCompositeSnapshot an instance of the new snapshot class to delegate compatibility checks to. This instance should already contain the outer snapshot information. @param legacyNestedSnapshots the nested serializer snapshots of the legacy composite snapshot. @return the result compatibility.
[ "Delegates", "compatibility", "checks", "to", "a", "{", "@link", "CompositeTypeSerializerSnapshot", "}", "instance", ".", "This", "can", "be", "used", "by", "legacy", "snapshot", "classes", "which", "have", "a", "newer", "implementation", "implemented", "as", "a",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerUtil.java#L46-L53
train
Delegate compatibility check to a new composite snapshot.
[ 30522, 2270, 10763, 1026, 1056, 1028, 4127, 11610, 28863, 22842, 22911, 25377, 10450, 8553, 1026, 1056, 1028, 11849, 9006, 24952, 8553, 5403, 3600, 5524, 9333, 2532, 4523, 12326, 1006, 4127, 11610, 28863, 1026, 1056, 1028, 2739, 11610, 28863,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonDictionaryMaker.java
CommonDictionaryMaker.learn
public void learn(List<Sentence> sentenceList) { List<List<IWord>> s = new ArrayList<List<IWord>>(sentenceList.size()); for (Sentence sentence : sentenceList) { s.add(sentence.wordList); } compute(s); }
java
public void learn(List<Sentence> sentenceList) { List<List<IWord>> s = new ArrayList<List<IWord>>(sentenceList.size()); for (Sentence sentence : sentenceList) { s.add(sentence.wordList); } compute(s); }
[ "public", "void", "learn", "(", "List", "<", "Sentence", ">", "sentenceList", ")", "{", "List", "<", "List", "<", "IWord", ">>", "s", "=", "new", "ArrayList", "<", "List", "<", "IWord", ">", ">", "(", "sentenceList", ".", "size", "(", ")", ")", ";"...
同compute @param sentenceList
[ "同compute" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonDictionaryMaker.java#L77-L85
train
This method is called to learn a list of words.
[ 30522, 2270, 11675, 4553, 1006, 2862, 1026, 6251, 1028, 6251, 9863, 1007, 1063, 2862, 1026, 2862, 1026, 1045, 18351, 1028, 1028, 1055, 1027, 2047, 9140, 9863, 1026, 2862, 1026, 1045, 18351, 1028, 1028, 1006, 6251, 9863, 1012, 2946, 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-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java
BucketingSink.shouldRoll
private boolean shouldRoll(BucketState<T> bucketState, long currentProcessingTime) throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!bucketState.isWriterOpen) { shouldRoll = true; LOG.debug("BucketingSink {} starting new bucket.", subtaskIndex); } else { long writePosition = bucketState.writer.getPos(); if (writePosition > batchSize) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } else { if (currentProcessingTime - bucketState.creationTime > batchRolloverInterval) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file is older than roll over interval {}.", subtaskIndex, batchRolloverInterval); } } } return shouldRoll; }
java
private boolean shouldRoll(BucketState<T> bucketState, long currentProcessingTime) throws IOException { boolean shouldRoll = false; int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (!bucketState.isWriterOpen) { shouldRoll = true; LOG.debug("BucketingSink {} starting new bucket.", subtaskIndex); } else { long writePosition = bucketState.writer.getPos(); if (writePosition > batchSize) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file position {} is above batch size {}.", subtaskIndex, writePosition, batchSize); } else { if (currentProcessingTime - bucketState.creationTime > batchRolloverInterval) { shouldRoll = true; LOG.debug( "BucketingSink {} starting new bucket because file is older than roll over interval {}.", subtaskIndex, batchRolloverInterval); } } } return shouldRoll; }
[ "private", "boolean", "shouldRoll", "(", "BucketState", "<", "T", ">", "bucketState", ",", "long", "currentProcessingTime", ")", "throws", "IOException", "{", "boolean", "shouldRoll", "=", "false", ";", "int", "subtaskIndex", "=", "getRuntimeContext", "(", ")", ...
Returns {@code true} if the current {@code part-file} should be closed and a new should be created. This happens if: <ol> <li>no file is created yet for the task to write to, or</li> <li>the current file has reached the maximum bucket size.</li> <li>the current file is older than roll over interval</li> </ol>
[ "Returns", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java#L474-L500
train
Checks if the bucket should be rolled.
[ 30522, 2797, 22017, 20898, 2323, 28402, 1006, 13610, 9153, 2618, 1026, 1056, 1028, 13610, 9153, 2618, 1010, 2146, 2783, 21572, 9623, 7741, 7292, 1007, 11618, 22834, 10288, 24422, 1063, 22017, 20898, 2323, 28402, 1027, 6270, 1025, 20014, 4942,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/LocalInputChannel.java
LocalInputChannel.sendTaskEvent
@Override void sendTaskEvent(TaskEvent event) throws IOException { checkError(); checkState(subpartitionView != null, "Tried to send task event to producer before requesting the subpartition."); if (!taskEventPublisher.publish(partitionId, event)) { throw new IOException("Error while publishing event " + event + " to producer. The producer could not be found."); } }
java
@Override void sendTaskEvent(TaskEvent event) throws IOException { checkError(); checkState(subpartitionView != null, "Tried to send task event to producer before requesting the subpartition."); if (!taskEventPublisher.publish(partitionId, event)) { throw new IOException("Error while publishing event " + event + " to producer. The producer could not be found."); } }
[ "@", "Override", "void", "sendTaskEvent", "(", "TaskEvent", "event", ")", "throws", "IOException", "{", "checkError", "(", ")", ";", "checkState", "(", "subpartitionView", "!=", "null", ",", "\"Tried to send task event to producer before requesting the subpartition.\"", "...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/LocalInputChannel.java#L220-L228
train
Sends a task event to the producer.
[ 30522, 1030, 2058, 15637, 11675, 4604, 10230, 3489, 15338, 1006, 4708, 18697, 3372, 2724, 1007, 11618, 22834, 10288, 24422, 1063, 4638, 2121, 29165, 1006, 1007, 1025, 14148, 12259, 1006, 4942, 19362, 3775, 3508, 8584, 999, 1027, 19701, 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/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java
BatchPreparedStatementExecutor.getStatements
@Override public List<Statement> getStatements() { List<Statement> result = new LinkedList<>(); for (ShardingExecuteGroup<StatementExecuteUnit> each : getExecuteGroups()) { result.addAll(Lists.transform(each.getInputs(), new Function<StatementExecuteUnit, Statement>() { @Override public Statement apply(final StatementExecuteUnit input) { return input.getStatement(); } })); } return result; }
java
@Override public List<Statement> getStatements() { List<Statement> result = new LinkedList<>(); for (ShardingExecuteGroup<StatementExecuteUnit> each : getExecuteGroups()) { result.addAll(Lists.transform(each.getInputs(), new Function<StatementExecuteUnit, Statement>() { @Override public Statement apply(final StatementExecuteUnit input) { return input.getStatement(); } })); } return result; }
[ "@", "Override", "public", "List", "<", "Statement", ">", "getStatements", "(", ")", "{", "List", "<", "Statement", ">", "result", "=", "new", "LinkedList", "<>", "(", ")", ";", "for", "(", "ShardingExecuteGroup", "<", "StatementExecuteUnit", ">", "each", ...
Get statements. @return statements
[ "Get", "statements", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java#L206-L219
train
Gets the statements.
[ 30522, 1030, 2058, 15637, 2270, 2862, 1026, 4861, 1028, 4152, 12259, 8163, 1006, 1007, 1063, 2862, 1026, 4861, 1028, 2765, 1027, 2047, 5799, 9863, 1026, 1028, 1006, 1007, 1025, 2005, 1006, 21146, 17080, 15465, 2595, 8586, 10421, 17058, 1026...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.digitToChinese
public static String digitToChinese(Number n) { if(null == n) { return "零"; } return NumberChineseFormater.format(n.doubleValue(), true, true); }
java
public static String digitToChinese(Number n) { if(null == n) { return "零"; } return NumberChineseFormater.format(n.doubleValue(), true, true); }
[ "public", "static", "String", "digitToChinese", "(", "Number", "n", ")", "{", "if", "(", "null", "==", "n", ")", "{", "return", "\"零\";\r", "", "}", "return", "NumberChineseFormater", ".", "format", "(", "n", ".", "doubleValue", "(", ")", ",", "true", ...
金额转为中文形式 @param n 数字 @return 中文大写数字 @since 3.2.3
[ "金额转为中文形式" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L858-L863
train
Converts a digit number to Chinese.
[ 30522, 2270, 10763, 5164, 15340, 3406, 17231, 6810, 1006, 2193, 1050, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1050, 1007, 1063, 2709, 1000, 100, 1000, 1025, 1065, 2709, 2193, 17231, 6810, 14192, 24932, 1012, 4289, 1006, 1050, 1012, 3313,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport/src/main/java/io/netty/channel/ChannelDuplexHandler.java
ChannelDuplexHandler.bind
@Skip @Override public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception { ctx.bind(localAddress, promise); }
java
@Skip @Override public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception { ctx.bind(localAddress, promise); }
[ "@", "Skip", "@", "Override", "public", "void", "bind", "(", "ChannelHandlerContext", "ctx", ",", "SocketAddress", "localAddress", ",", "ChannelPromise", "promise", ")", "throws", "Exception", "{", "ctx", ".", "bind", "(", "localAddress", ",", "promise", ")", ...
Calls {@link ChannelHandlerContext#bind(SocketAddress, ChannelPromise)} to forward to the next {@link ChannelOutboundHandler} in the {@link ChannelPipeline}. Sub-classes may override this method to change behavior.
[ "Calls", "{", "@link", "ChannelHandlerContext#bind", "(", "SocketAddress", "ChannelPromise", ")", "}", "to", "forward", "to", "the", "next", "{", "@link", "ChannelOutboundHandler", "}", "in", "the", "{", "@link", "ChannelPipeline", "}", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelDuplexHandler.java#L37-L42
train
Override this method to bind to a local address.
[ 30522, 1030, 13558, 1030, 2058, 15637, 2270, 11675, 14187, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 22278, 4215, 16200, 4757, 2334, 4215, 16200, 4757, 1010, 3149, 21572, 28732, 4872, 1007, 11618, 6453, 1063, 14931, 2595, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
WindowedStream.apply
public <R> SingleOutputStreamOperator<R> apply(WindowFunction<T, R, K, W> function, TypeInformation<R> resultType) { function = input.getExecutionEnvironment().clean(function); return apply(new InternalIterableWindowFunction<>(function), resultType, function); }
java
public <R> SingleOutputStreamOperator<R> apply(WindowFunction<T, R, K, W> function, TypeInformation<R> resultType) { function = input.getExecutionEnvironment().clean(function); return apply(new InternalIterableWindowFunction<>(function), resultType, function); }
[ "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "apply", "(", "WindowFunction", "<", "T", ",", "R", ",", "K", ",", "W", ">", "function", ",", "TypeInformation", "<", "R", ">", "resultType", ")", "{", "function", "=", "input", ".",...
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream. <p>Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation. @param function The window function. @param resultType Type information for the result type of the window function @return The data stream that is the result of applying the window function to the window.
[ "Applies", "the", "given", "window", "function", "to", "each", "window", ".", "The", "window", "function", "is", "called", "for", "each", "evaluation", "of", "the", "window", "for", "each", "key", "individually", ".", "The", "output", "of", "the", "window", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L1036-L1039
train
Applies a window function to the stream.
[ 30522, 2270, 1026, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 6611, 1006, 3332, 11263, 27989, 1026, 1056, 1010, 1054, 1010, 1047, 1010, 1059, 1028, 3853, 1010, 2828, 2378, 14192, 3370, 1026, 1054, 1028, 2765, 13874...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-json/src/main/java/cn/hutool/json/XMLTokener.java
XMLTokener.nextToken
public Object nextToken() throws JSONException { char c; char q; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); switch (c) { case 0: throw syntaxError("Misshaped element"); case '<': throw syntaxError("Misplaced '<'"); case '>': return XML.GT; case '/': return XML.SLASH; case '=': return XML.EQ; case '!': return XML.BANG; case '?': return XML.QUEST; // Quoted string case '"': case '\'': q = c; sb = new StringBuilder(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unterminated string"); } if (c == q) { return sb.toString(); } if (c == '&') { sb.append(nextEntity(c)); } else { sb.append(c); } } default: // Name sb = new StringBuilder(); for (;;) { sb.append(c); c = next(); if (Character.isWhitespace(c)) { return sb.toString(); } switch (c) { case 0: return sb.toString(); case '>': case '/': case '=': case '!': case '?': case '[': case ']': back(); return sb.toString(); case '<': case '"': case '\'': throw syntaxError("Bad character in a name"); } } } }
java
public Object nextToken() throws JSONException { char c; char q; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); switch (c) { case 0: throw syntaxError("Misshaped element"); case '<': throw syntaxError("Misplaced '<'"); case '>': return XML.GT; case '/': return XML.SLASH; case '=': return XML.EQ; case '!': return XML.BANG; case '?': return XML.QUEST; // Quoted string case '"': case '\'': q = c; sb = new StringBuilder(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unterminated string"); } if (c == q) { return sb.toString(); } if (c == '&') { sb.append(nextEntity(c)); } else { sb.append(c); } } default: // Name sb = new StringBuilder(); for (;;) { sb.append(c); c = next(); if (Character.isWhitespace(c)) { return sb.toString(); } switch (c) { case 0: return sb.toString(); case '>': case '/': case '=': case '!': case '?': case '[': case ']': back(); return sb.toString(); case '<': case '"': case '\'': throw syntaxError("Bad character in a name"); } } } }
[ "public", "Object", "nextToken", "(", ")", "throws", "JSONException", "{", "char", "c", ";", "char", "q", ";", "StringBuilder", "sb", ";", "do", "{", "c", "=", "next", "(", ")", ";", "}", "while", "(", "Character", ".", "isWhitespace", "(", "c", ")",...
Get the next XML Token. These tokens are found inside of angle brackets. It may be one of these characters: <code>/ &gt; = ! ?</code> or it may be a string wrapped in single quotes or double quotes, or it may be a name. @return a String or a Character. @throws JSONException If the XML is not well formed.
[ "Get", "the", "next", "XML", "Token", ".", "These", "tokens", "are", "found", "inside", "of", "angle", "brackets", ".", "It", "may", "be", "one", "of", "these", "characters", ":", "<code", ">", "/", "&gt", ";", "=", "!", "?<", "/", "code", ">", "or...
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java#L184-L257
train
Returns the next token.
[ 30522, 2270, 4874, 2279, 18715, 2368, 1006, 1007, 11618, 1046, 3385, 10288, 24422, 1063, 25869, 1039, 1025, 25869, 1053, 1025, 5164, 8569, 23891, 2099, 24829, 1025, 2079, 1063, 1039, 1027, 2279, 1006, 1007, 1025, 1065, 2096, 1006, 2839, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
JSONArray.put
public JSONArray put(int index, Object value) throws JSONException { if (value instanceof Number) { // deviate from the original by checking all Numbers, not just floats & // doubles JSON.checkDouble(((Number) value).doubleValue()); } while (this.values.size() <= index) { this.values.add(null); } this.values.set(index, value); return this; }
java
public JSONArray put(int index, Object value) throws JSONException { if (value instanceof Number) { // deviate from the original by checking all Numbers, not just floats & // doubles JSON.checkDouble(((Number) value).doubleValue()); } while (this.values.size() <= index) { this.values.add(null); } this.values.set(index, value); return this; }
[ "public", "JSONArray", "put", "(", "int", "index", ",", "Object", "value", ")", "throws", "JSONException", "{", "if", "(", "value", "instanceof", "Number", ")", "{", "// deviate from the original by checking all Numbers, not just floats &", "// doubles", "JSON", ".", ...
Sets the value at {@code index} to {@code value}, null padding this array to the required length if necessary. If a value already exists at {@code index}, it will be replaced. @param index the index to set the value to @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this array. @throws JSONException if processing of json failed
[ "Sets", "the", "value", "at", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L250-L261
train
Add a value to this JSONArray at the specified index.
[ 30522, 2270, 1046, 3385, 2906, 9447, 2404, 1006, 20014, 5950, 1010, 4874, 3643, 1007, 11618, 1046, 30524, 2193, 1007, 1063, 1013, 1013, 14386, 3686, 2013, 1996, 2434, 2011, 9361, 2035, 3616, 1010, 2025, 2074, 24885, 1004, 1013, 1013, 7695, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/NShort/Path/AtomNode.java
AtomNode.getNature
public Nature getNature() { Nature nature = Nature.nz; switch (nPOS) { case CharType.CT_CHINESE: break; case CharType.CT_NUM: case CharType.CT_INDEX: case CharType.CT_CNUM: nature = Nature.m; sWord = Predefine.TAG_NUMBER; break; case CharType.CT_DELIMITER: nature = Nature.w; break; case CharType.CT_LETTER: nature = Nature.nx; sWord = Predefine.TAG_CLUSTER; break; case CharType.CT_SINGLE://12021-2129-3121 if (Predefine.PATTERN_FLOAT_NUMBER.matcher(sWord).matches())//匹配浮点数 { nature = Nature.m; sWord = Predefine.TAG_NUMBER; } else { nature = Nature.nx; sWord = Predefine.TAG_CLUSTER; } break; default: break; } return nature; }
java
public Nature getNature() { Nature nature = Nature.nz; switch (nPOS) { case CharType.CT_CHINESE: break; case CharType.CT_NUM: case CharType.CT_INDEX: case CharType.CT_CNUM: nature = Nature.m; sWord = Predefine.TAG_NUMBER; break; case CharType.CT_DELIMITER: nature = Nature.w; break; case CharType.CT_LETTER: nature = Nature.nx; sWord = Predefine.TAG_CLUSTER; break; case CharType.CT_SINGLE://12021-2129-3121 if (Predefine.PATTERN_FLOAT_NUMBER.matcher(sWord).matches())//匹配浮点数 { nature = Nature.m; sWord = Predefine.TAG_NUMBER; } else { nature = Nature.nx; sWord = Predefine.TAG_CLUSTER; } break; default: break; } return nature; }
[ "public", "Nature", "getNature", "(", ")", "{", "Nature", "nature", "=", "Nature", ".", "nz", ";", "switch", "(", "nPOS", ")", "{", "case", "CharType", ".", "CT_CHINESE", ":", "break", ";", "case", "CharType", ".", "CT_NUM", ":", "case", "CharType", "....
原子的词性 @return
[ "原子的词性" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/AtomNode.java#L45-L80
train
Get the Nature of the class.
[ 30522, 2270, 3267, 2131, 19833, 5397, 1006, 1007, 1063, 3267, 3267, 1027, 3267, 1012, 20008, 1025, 6942, 1006, 27937, 2891, 1007, 1063, 2553, 3673, 18863, 1012, 14931, 1035, 2822, 1024, 3338, 1025, 2553, 3673, 18863, 1012, 14931, 1035, 1637...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/crf/Table.java
Table.get
public String get(int x, int y) { if (x < 0) return HEAD + x; if (x >= v.length) return HEAD + "+" + (x - v.length + 1); return v[x][y]; }
java
public String get(int x, int y) { if (x < 0) return HEAD + x; if (x >= v.length) return HEAD + "+" + (x - v.length + 1); return v[x][y]; }
[ "public", "String", "get", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "<", "0", ")", "return", "HEAD", "+", "x", ";", "if", "(", "x", ">=", "v", ".", "length", ")", "return", "HEAD", "+", "\"+\"", "+", "(", "x", "-", "v", ...
获取表中某一个元素 @param x @param y @return
[ "获取表中某一个元素" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/Table.java#L48-L54
train
Gets the value of the specified key.
[ 30522, 2270, 5164, 2131, 1006, 20014, 1060, 1010, 20014, 1061, 1007, 1063, 2065, 1006, 1060, 1026, 1014, 1007, 2709, 2132, 1009, 1060, 1025, 2065, 1006, 1060, 1028, 1027, 1058, 1012, 3091, 1007, 2709, 2132, 1009, 1000, 1009, 1000, 1009, 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-db/src/main/java/cn/hutool/db/Entity.java
Entity.set
@Override public Entity set(String field, Object value) { return (Entity) super.set(field, value); }
java
@Override public Entity set(String field, Object value) { return (Entity) super.set(field, value); }
[ "@", "Override", "public", "Entity", "set", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "(", "Entity", ")", "super", ".", "set", "(", "field", ",", "value", ")", ";", "}" ]
-------------------------------------------------------------------- Put and Set start
[ "--------------------------------------------------------------------", "Put", "and", "Set", "start" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L240-L243
train
Override set to set a field in the entity.
[ 30522, 1030, 2058, 15637, 2270, 9178, 2275, 1006, 5164, 2492, 1010, 4874, 3643, 1007, 1063, 2709, 1006, 9178, 1007, 3565, 1012, 2275, 1006, 2492, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/schema/OrchestrationShardingSchemaGroup.java
OrchestrationShardingSchemaGroup.put
public void put(final String shardingSchemaName, final Collection<String> dataSourceNames) { schemaGroup.put(shardingSchemaName, dataSourceNames); }
java
public void put(final String shardingSchemaName, final Collection<String> dataSourceNames) { schemaGroup.put(shardingSchemaName, dataSourceNames); }
[ "public", "void", "put", "(", "final", "String", "shardingSchemaName", ",", "final", "Collection", "<", "String", ">", "dataSourceNames", ")", "{", "schemaGroup", ".", "put", "(", "shardingSchemaName", ",", "dataSourceNames", ")", ";", "}" ]
Put orchestration sharding schema. @param shardingSchemaName sharding schema name @param dataSourceNames data source names
[ "Put", "orchestration", "sharding", "schema", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/schema/OrchestrationShardingSchemaGroup.java#L54-L56
train
Put sharding schema name and data source names into the schema group.
[ 30522, 2270, 11675, 2404, 1006, 2345, 5164, 21146, 17080, 3070, 22842, 24805, 4168, 1010, 2345, 3074, 1026, 5164, 1028, 2951, 6499, 3126, 27524, 14074, 2015, 1007, 1063, 8040, 28433, 17058, 1012, 2404, 1006, 21146, 17080, 3070, 22842, 24805, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.generateRandomAlphanumericString
public static String generateRandomAlphanumericString(Random rnd, int length) { checkNotNull(rnd); checkArgument(length >= 0); StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(nextAlphanumericChar(rnd)); } return buffer.toString(); }
java
public static String generateRandomAlphanumericString(Random rnd, int length) { checkNotNull(rnd); checkArgument(length >= 0); StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(nextAlphanumericChar(rnd)); } return buffer.toString(); }
[ "public", "static", "String", "generateRandomAlphanumericString", "(", "Random", "rnd", ",", "int", "length", ")", "{", "checkNotNull", "(", "rnd", ")", ";", "checkArgument", "(", "length", ">=", "0", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBui...
Creates a random alphanumeric string of given length. @param rnd The random number generator to use. @param length The number of alphanumeric characters to append.
[ "Creates", "a", "random", "alphanumeric", "string", "of", "given", "length", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L258-L267
train
Generates a random alphanumeric string of the specified length.
[ 30522, 2270, 10763, 5164, 9699, 13033, 9626, 14277, 4819, 17897, 7277, 3367, 4892, 1006, 6721, 29300, 2094, 1010, 20014, 3091, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 29300, 2094, 1007, 1025, 4638, 2906, 22850, 4765, 1006, 3091, 1028, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/BetweenFormater.java
BetweenFormater.format
public String format(){ final StringBuilder sb = new StringBuilder(); if(betweenMs > 0){ long day = betweenMs / DateUnit.DAY.getMillis(); long hour = betweenMs / DateUnit.HOUR.getMillis() - day * 24; long minute = betweenMs / DateUnit.MINUTE.getMillis() - day * 24 * 60 - hour * 60; long second = betweenMs / DateUnit.SECOND.getMillis() - ((day * 24 + hour) * 60 + minute) * 60; long millisecond = betweenMs - (((day * 24 + hour) * 60 + minute) * 60 + second) * 1000; final int level = this.level.ordinal(); int levelCount = 0; if(isLevelCountValid(levelCount) && 0 != day && level >= Level.DAY.ordinal()){ sb.append(day).append(Level.DAY.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != hour && level >= Level.HOUR.ordinal()){ sb.append(hour).append(Level.HOUR.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != minute && level >= Level.MINUTE.ordinal()){ sb.append(minute).append(Level.MINUTE.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != second && level >= Level.SECOND.ordinal()){ sb.append(second).append(Level.SECOND.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != millisecond && level >= Level.MILLSECOND.ordinal()){ sb.append(millisecond).append(Level.MILLSECOND.name); levelCount++; } } if(StrUtil.isEmpty(sb)) { sb.append(0).append(this.level.name); } return sb.toString(); }
java
public String format(){ final StringBuilder sb = new StringBuilder(); if(betweenMs > 0){ long day = betweenMs / DateUnit.DAY.getMillis(); long hour = betweenMs / DateUnit.HOUR.getMillis() - day * 24; long minute = betweenMs / DateUnit.MINUTE.getMillis() - day * 24 * 60 - hour * 60; long second = betweenMs / DateUnit.SECOND.getMillis() - ((day * 24 + hour) * 60 + minute) * 60; long millisecond = betweenMs - (((day * 24 + hour) * 60 + minute) * 60 + second) * 1000; final int level = this.level.ordinal(); int levelCount = 0; if(isLevelCountValid(levelCount) && 0 != day && level >= Level.DAY.ordinal()){ sb.append(day).append(Level.DAY.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != hour && level >= Level.HOUR.ordinal()){ sb.append(hour).append(Level.HOUR.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != minute && level >= Level.MINUTE.ordinal()){ sb.append(minute).append(Level.MINUTE.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != second && level >= Level.SECOND.ordinal()){ sb.append(second).append(Level.SECOND.name); levelCount++; } if(isLevelCountValid(levelCount) && 0 != millisecond && level >= Level.MILLSECOND.ordinal()){ sb.append(millisecond).append(Level.MILLSECOND.name); levelCount++; } } if(StrUtil.isEmpty(sb)) { sb.append(0).append(this.level.name); } return sb.toString(); }
[ "public", "String", "format", "(", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "betweenMs", ">", "0", ")", "{", "long", "day", "=", "betweenMs", "/", "DateUnit", ".", "DAY", ".", "getMillis", "(", ...
格式化日期间隔输出<br> @return 格式化后的字符串
[ "格式化日期间隔输出<br", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/BetweenFormater.java#L45-L84
train
Returns a string representation of the device s data.
[ 30522, 2270, 5164, 4289, 1006, 1007, 1063, 2345, 5164, 8569, 23891, 2099, 24829, 1027, 2047, 5164, 8569, 23891, 2099, 1006, 1007, 1025, 2065, 1006, 2090, 5244, 1028, 1014, 1007, 1063, 2146, 2154, 1027, 2090, 5244, 1013, 3058, 19496, 2102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java
ProxyUtil.newProxyInstance
public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) { return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces); }
java
public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) { return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces); }
[ "public", "static", "<", "T", ">", "T", "newProxyInstance", "(", "InvocationHandler", "invocationHandler", ",", "Class", "<", "?", ">", "...", "interfaces", ")", "{", "return", "newProxyInstance", "(", "ClassUtil", ".", "getClassLoader", "(", ")", ",", "invoca...
创建动态代理对象 @param <T> 被代理对象类型 @param invocationHandler {@link InvocationHandler} ,被代理类通过实现此接口提供动态代理功能 @param interfaces 代理类中需要实现的被代理类的接口方法 @return 代理类
[ "创建动态代理对象" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java#L70-L72
train
Creates a new proxy instance with the given invocation handler and interfaces.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 2047, 21572, 18037, 7076, 26897, 1006, 1999, 19152, 11774, 3917, 1999, 19152, 11774, 3917, 1010, 2465, 1026, 1029, 1028, 1012, 1012, 1012, 19706, 1007, 1063, 2709, 2047, 21572, 18037, 7076, 26897, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateBetween.java
DateBetween.betweenYear
public long betweenYear(boolean isReset) { final Calendar beginCal = DateUtil.calendar(begin); final Calendar endCal = DateUtil.calendar(end); int result = endCal.get(Calendar.YEAR) - beginCal.get(Calendar.YEAR); if (false == isReset) { endCal.set(Calendar.YEAR, beginCal.get(Calendar.YEAR)); long between = endCal.getTimeInMillis() - beginCal.getTimeInMillis(); if (between < 0) { return result - 1; } } return result; }
java
public long betweenYear(boolean isReset) { final Calendar beginCal = DateUtil.calendar(begin); final Calendar endCal = DateUtil.calendar(end); int result = endCal.get(Calendar.YEAR) - beginCal.get(Calendar.YEAR); if (false == isReset) { endCal.set(Calendar.YEAR, beginCal.get(Calendar.YEAR)); long between = endCal.getTimeInMillis() - beginCal.getTimeInMillis(); if (between < 0) { return result - 1; } } return result; }
[ "public", "long", "betweenYear", "(", "boolean", "isReset", ")", "{", "final", "Calendar", "beginCal", "=", "DateUtil", ".", "calendar", "(", "begin", ")", ";", "final", "Calendar", "endCal", "=", "DateUtil", ".", "calendar", "(", "end", ")", ";", "int", ...
计算两个日期相差年数<br> 在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年) @param isReset 是否重置时间为起始时间(重置月天时分秒) @return 相差年数 @since 3.0.8
[ "计算两个日期相差年数<br", ">", "在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateBetween.java#L129-L142
train
Gets the number of days between the two calendar years.
[ 30522, 2270, 2146, 2090, 29100, 1006, 22017, 20898, 2003, 6072, 3388, 1007, 1063, 2345, 8094, 4088, 9289, 1027, 3058, 21823, 2140, 1012, 8094, 1006, 4088, 1007, 1025, 2345, 8094, 2203, 9289, 1027, 3058, 21823, 2140, 1012, 8094, 1006, 2203, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.getRandomString
public static String getRandomString(Random rnd, int minLength, int maxLength, char minValue, char maxValue) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; int diff = maxValue - minValue + 1; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(diff) + minValue); } return new String(data); }
java
public static String getRandomString(Random rnd, int minLength, int maxLength, char minValue, char maxValue) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; int diff = maxValue - minValue + 1; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(diff) + minValue); } return new String(data); }
[ "public", "static", "String", "getRandomString", "(", "Random", "rnd", ",", "int", "minLength", ",", "int", "maxLength", ",", "char", "minValue", ",", "char", "maxValue", ")", "{", "int", "len", "=", "rnd", ".", "nextInt", "(", "maxLength", "-", "minLength...
Creates a random string with a length within the given interval. The string contains only characters that can be represented as a single code point. @param rnd The random used to create the strings. @param minLength The minimum string length. @param maxLength The maximum string length (inclusive). @param minValue The minimum character value to occur. @param maxValue The maximum character value to occur. @return A random String.
[ "Creates", "a", "random", "string", "with", "a", "length", "within", "the", "given", "interval", ".", "The", "string", "contains", "only", "characters", "that", "can", "be", "represented", "as", "a", "single", "code", "point", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L240-L250
train
Get a random string.
[ 30522, 2270, 10763, 5164, 2131, 13033, 22225, 18886, 3070, 1006, 6721, 29300, 2094, 1010, 20014, 8117, 7770, 13512, 2232, 1010, 20014, 4098, 7770, 13512, 2232, 1010, 25869, 8117, 10175, 5657, 1010, 25869, 4098, 10175, 5657, 1007, 1063, 20014,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
client/src/main/java/com/networknt/client/Http2Client.java
Http2Client.propagateHeaders
public Result propagateHeaders(ClientRequest request, final HttpServerExchange exchange) { String tid = exchange.getRequestHeaders().getFirst(HttpStringConstants.TRACEABILITY_ID); String token = exchange.getRequestHeaders().getFirst(Headers.AUTHORIZATION); String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID); return populateHeader(request, token, cid, tid); }
java
public Result propagateHeaders(ClientRequest request, final HttpServerExchange exchange) { String tid = exchange.getRequestHeaders().getFirst(HttpStringConstants.TRACEABILITY_ID); String token = exchange.getRequestHeaders().getFirst(Headers.AUTHORIZATION); String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID); return populateHeader(request, token, cid, tid); }
[ "public", "Result", "propagateHeaders", "(", "ClientRequest", "request", ",", "final", "HttpServerExchange", "exchange", ")", "{", "String", "tid", "=", "exchange", ".", "getRequestHeaders", "(", ")", ".", "getFirst", "(", "HttpStringConstants", ".", "TRACEABILITY_I...
Support API to API calls with scope token. The token is the original token from consumer and the client credentials token of caller API is added from cache. This method is used in API to API call @param request the http request @param exchange the http server exchange
[ "Support", "API", "to", "API", "calls", "with", "scope", "token", ".", "The", "token", "is", "the", "original", "token", "from", "consumer", "and", "the", "client", "credentials", "token", "of", "caller", "API", "is", "added", "from", "cache", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L350-L355
train
Propagate headers to the client.
[ 30522, 2270, 2765, 17678, 16098, 2618, 4974, 2545, 1006, 7396, 2890, 15500, 5227, 1010, 2345, 16770, 2121, 28943, 2595, 22305, 2063, 3863, 1007, 1063, 5164, 14841, 2094, 1027, 3863, 1012, 2131, 2890, 15500, 4974, 2545, 1006, 1007, 1012, 213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/dictionary/SimpleDictionary.java
SimpleDictionary.combine
public void combine(SimpleDictionary<V> other) { if (other.trie == null) { logger.warning("有个词典还没加载"); return; } for (Map.Entry<String, V> entry : other.trie.entrySet()) { if (trie.containsKey(entry.getKey())) continue; trie.put(entry.getKey(), entry.getValue()); } }
java
public void combine(SimpleDictionary<V> other) { if (other.trie == null) { logger.warning("有个词典还没加载"); return; } for (Map.Entry<String, V> entry : other.trie.entrySet()) { if (trie.containsKey(entry.getKey())) continue; trie.put(entry.getKey(), entry.getValue()); } }
[ "public", "void", "combine", "(", "SimpleDictionary", "<", "V", ">", "other", ")", "{", "if", "(", "other", ".", "trie", "==", "null", ")", "{", "logger", ".", "warning", "(", "\"有个词典还没加载\");", "", "", "return", ";", "}", "for", "(", "Map", ".", "E...
以我为主词典,合并一个副词典,我有的词条不会被副词典覆盖 @param other 副词典
[ "以我为主词典,合并一个副词典,我有的词条不会被副词典覆盖" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/SimpleDictionary.java#L80-L92
train
Combine two simple dictionaries into this one.
[ 30522, 2270, 11675, 11506, 1006, 3722, 29201, 3258, 5649, 1026, 1058, 1028, 2060, 1007, 1063, 2065, 1006, 2060, 1012, 13012, 2063, 1027, 1027, 19701, 1007, 1063, 8833, 4590, 1012, 5432, 1006, 1000, 1873, 100, 100, 100, 100, 100, 1779, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java
DeweyNumber.isCompatibleWith
public boolean isCompatibleWith(DeweyNumber other) { if (length() > other.length()) { // prefix case for (int i = 0; i < other.length(); i++) { if (other.deweyNumber[i] != deweyNumber[i]) { return false; } } return true; } else if (length() == other.length()) { // check init digits for equality int lastIndex = length() - 1; for (int i = 0; i < lastIndex; i++) { if (other.deweyNumber[i] != deweyNumber[i]) { return false; } } // check that the last digit is greater or equal return deweyNumber[lastIndex] >= other.deweyNumber[lastIndex]; } else { return false; } }
java
public boolean isCompatibleWith(DeweyNumber other) { if (length() > other.length()) { // prefix case for (int i = 0; i < other.length(); i++) { if (other.deweyNumber[i] != deweyNumber[i]) { return false; } } return true; } else if (length() == other.length()) { // check init digits for equality int lastIndex = length() - 1; for (int i = 0; i < lastIndex; i++) { if (other.deweyNumber[i] != deweyNumber[i]) { return false; } } // check that the last digit is greater or equal return deweyNumber[lastIndex] >= other.deweyNumber[lastIndex]; } else { return false; } }
[ "public", "boolean", "isCompatibleWith", "(", "DeweyNumber", "other", ")", "{", "if", "(", "length", "(", ")", ">", "other", ".", "length", "(", ")", ")", "{", "// prefix case", "for", "(", "int", "i", "=", "0", ";", "i", "<", "other", ".", "length",...
Checks whether this dewey number is compatible to the other dewey number. <p>True iff this contains other as a prefix or iff they differ only in the last digit whereas the last digit of this is greater than the last digit of other. @param other The other dewey number to check compatibility against @return Whether this dewey number is compatible to the other dewey number
[ "Checks", "whether", "this", "dewey", "number", "is", "compatible", "to", "the", "other", "dewey", "number", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java#L68-L92
train
Checks if this dewey number is compatible with another dewey number.
[ 30522, 2270, 22017, 20898, 2003, 9006, 24952, 3468, 24415, 1006, 20309, 19172, 5677, 2060, 1007, 1063, 2065, 1006, 3091, 1006, 1007, 1028, 2060, 1012, 3091, 1006, 1007, 1007, 1063, 1013, 1013, 17576, 2553, 2005, 1006, 20014, 1045, 1027, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.formatBetween
public static String formatBetween(long betweenMs, BetweenFormater.Level level) { return new BetweenFormater(betweenMs, level).format(); }
java
public static String formatBetween(long betweenMs, BetweenFormater.Level level) { return new BetweenFormater(betweenMs, level).format(); }
[ "public", "static", "String", "formatBetween", "(", "long", "betweenMs", ",", "BetweenFormater", ".", "Level", "level", ")", "{", "return", "new", "BetweenFormater", "(", "betweenMs", ",", "level", ")", ".", "format", "(", ")", ";", "}" ]
格式化日期间隔输出 @param betweenMs 日期间隔 @param level 级别,按照天、小时、分、秒、毫秒分为5个等级 @return XX天XX小时XX分XX秒XX毫秒
[ "格式化日期间隔输出" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1341-L1343
train
Format between milliseconds.
[ 30522, 2270, 10763, 5164, 4289, 20915, 28394, 2078, 1006, 2146, 2090, 5244, 1010, 2090, 14192, 24932, 1012, 2504, 2504, 1007, 1063, 2709, 2047, 2090, 14192, 24932, 1006, 2090, 5244, 1010, 2504, 1007, 1012, 4289, 1006, 1007, 1025, 1065, 102,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/LongValueArray.java
LongValueArray.compareTo
@Override public int compareTo(ValueArray<LongValue> o) { LongValueArray other = (LongValueArray) o; int min = Math.min(position, other.position); for (int i = 0; i < min; i++) { int cmp = Long.compare(data[i], other.data[i]); if (cmp != 0) { return cmp; } } return Integer.compare(position, other.position); }
java
@Override public int compareTo(ValueArray<LongValue> o) { LongValueArray other = (LongValueArray) o; int min = Math.min(position, other.position); for (int i = 0; i < min; i++) { int cmp = Long.compare(data[i], other.data[i]); if (cmp != 0) { return cmp; } } return Integer.compare(position, other.position); }
[ "@", "Override", "public", "int", "compareTo", "(", "ValueArray", "<", "LongValue", ">", "o", ")", "{", "LongValueArray", "other", "=", "(", "LongValueArray", ")", "o", ";", "int", "min", "=", "Math", ".", "min", "(", "position", ",", "other", ".", "po...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/LongValueArray.java#L225-L239
train
Compares two LongValueArrays.
[ 30522, 1030, 2058, 15637, 2270, 20014, 12826, 3406, 1006, 3643, 2906, 9447, 1026, 2146, 10175, 5657, 1028, 1051, 1007, 1063, 2146, 10175, 5657, 2906, 9447, 2060, 1027, 1006, 2146, 10175, 5657, 2906, 9447, 1007, 1051, 1025, 20014, 8117, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.replaceOrRegister
private void replaceOrRegister(MDAGNode originNode, String str) { char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
java
private void replaceOrRegister(MDAGNode originNode, String str) { char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
[ "private", "void", "replaceOrRegister", "(", "MDAGNode", "originNode", ",", "String", "str", ")", "{", "char", "transitionLabelChar", "=", "str", ".", "charAt", "(", "0", ")", ";", "MDAGNode", "relevantTargetNode", "=", "originNode", ".", "transition", "(", "t...
在从给定节点开始的一段路径上执行最小化<br> Performs minimization processing on a _transition path starting from a given node. <p/> This entails either replacing a node in the path with one that has an equivalent right language/equivalence class (defined as set of _transition paths that can be traversed and nodes able to be reached from it), or making it a representative of a right language/equivalence class if a such a node does not already exist. @param originNode the MDAGNode that the _transition path corresponding to str starts from @param str a String related to a _transition path
[ "在从给定节点开始的一段路径上执行最小化<br", ">", "Performs", "minimization", "processing", "on", "a", "_transition", "path", "starting", "from", "a", "given", "node", ".", "<p", "/", ">", "This", "entails", "either", "replacing", "a", "node", "in", "the", "path", "with", "one",...
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L539-L564
train
This method replaces the _transition path of the specified string with the corresponding _transition path of the specified originNode.
[ 30522, 2797, 11675, 5672, 2953, 2890, 24063, 2121, 1006, 9108, 8490, 3630, 3207, 4761, 3630, 3207, 1010, 5164, 2358, 2099, 1007, 1063, 25869, 6653, 20470, 2884, 7507, 2099, 1027, 2358, 2099, 1012, 25869, 4017, 1006, 1014, 1007, 1025, 9108, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java
ClassScaner.scanJavaClassPaths
private void scanJavaClassPaths() { final String[] javaClassPaths = ClassUtil.getJavaClassPaths(); for (String classPath : javaClassPaths) { // bug修复,由于路径中空格和中文导致的Jar找不到 classPath = URLUtil.decode(classPath, CharsetUtil.systemCharsetName()); scanFile(new File(classPath), null); } }
java
private void scanJavaClassPaths() { final String[] javaClassPaths = ClassUtil.getJavaClassPaths(); for (String classPath : javaClassPaths) { // bug修复,由于路径中空格和中文导致的Jar找不到 classPath = URLUtil.decode(classPath, CharsetUtil.systemCharsetName()); scanFile(new File(classPath), null); } }
[ "private", "void", "scanJavaClassPaths", "(", ")", "{", "final", "String", "[", "]", "javaClassPaths", "=", "ClassUtil", ".", "getJavaClassPaths", "(", ")", ";", "for", "(", "String", "classPath", ":", "javaClassPaths", ")", "{", "// bug修复,由于路径中空格和中文导致的Jar找不到\r", ...
扫描Java指定的ClassPath路径 @return 扫描到的类
[ "扫描Java指定的ClassPath路径" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L197-L205
train
Scan the Java class paths.
[ 30522, 2797, 11675, 13594, 3900, 24887, 27102, 15069, 2015, 1006, 1007, 1063, 2345, 5164, 1031, 1033, 9262, 26266, 15069, 2015, 1027, 2465, 21823, 2140, 1012, 2131, 3900, 24887, 27102, 15069, 2015, 1006, 1007, 1025, 2005, 1006, 5164, 2465, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java
PropertiesMigrationReport.getErrorReport
public String getErrorReport() { Map<String, List<PropertyMigration>> content = getContent( LegacyProperties::getUnsupported); if (content.isEmpty()) { return null; } StringBuilder report = new StringBuilder(); report.append(String.format("%nThe use of configuration keys that are no longer " + "supported was found in the environment:%n%n")); append(report, content); report.append(String.format("%n")); report.append("Please refer to the migration guide or reference guide for " + "potential alternatives."); report.append(String.format("%n")); return report.toString(); }
java
public String getErrorReport() { Map<String, List<PropertyMigration>> content = getContent( LegacyProperties::getUnsupported); if (content.isEmpty()) { return null; } StringBuilder report = new StringBuilder(); report.append(String.format("%nThe use of configuration keys that are no longer " + "supported was found in the environment:%n%n")); append(report, content); report.append(String.format("%n")); report.append("Please refer to the migration guide or reference guide for " + "potential alternatives."); report.append(String.format("%n")); return report.toString(); }
[ "public", "String", "getErrorReport", "(", ")", "{", "Map", "<", "String", ",", "List", "<", "PropertyMigration", ">", ">", "content", "=", "getContent", "(", "LegacyProperties", "::", "getUnsupported", ")", ";", "if", "(", "content", ".", "isEmpty", "(", ...
Return a report for all the properties that are no longer supported. If no such properties were found, return {@code null}. @return a report with the configurations keys that are no longer supported
[ "Return", "a", "report", "for", "all", "the", "properties", "that", "are", "no", "longer", "supported", ".", "If", "no", "such", "properties", "were", "found", "return", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java#L65-L80
train
Returns a string with the error report for the configuration keys that are no longer supported in the environment.
[ 30522, 2270, 5164, 2131, 2121, 29165, 2890, 6442, 1006, 1007, 1063, 4949, 1026, 5164, 1010, 2862, 1026, 3200, 4328, 29397, 1028, 1028, 4180, 1027, 2131, 8663, 6528, 2102, 1006, 8027, 21572, 4842, 7368, 1024, 1024, 2131, 4609, 6342, 9397, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/messages/MessageSerializer.java
MessageSerializer.writeHeader
private static void writeHeader(final ByteBuf buf, final MessageType messageType) { buf.writeInt(VERSION); buf.writeInt(messageType.ordinal()); }
java
private static void writeHeader(final ByteBuf buf, final MessageType messageType) { buf.writeInt(VERSION); buf.writeInt(messageType.ordinal()); }
[ "private", "static", "void", "writeHeader", "(", "final", "ByteBuf", "buf", ",", "final", "MessageType", "messageType", ")", "{", "buf", ".", "writeInt", "(", "VERSION", ")", ";", "buf", ".", "writeInt", "(", "messageType", ".", "ordinal", "(", ")", ")", ...
Helper for serializing the header. @param buf The {@link ByteBuf} to serialize the header into. @param messageType The {@link MessageType} of the message this header refers to.
[ "Helper", "for", "serializing", "the", "header", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L185-L188
train
Write header.
[ 30522, 2797, 10763, 11675, 4339, 4974, 2121, 1006, 2345, 24880, 8569, 2546, 20934, 2546, 1010, 2345, 4471, 13874, 4471, 13874, 1007, 1063, 20934, 2546, 1012, 4339, 18447, 1006, 2544, 1007, 1025, 20934, 2546, 1012, 4339, 18447, 1006, 4471, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java
DeltaEvictor.of
public static <T, W extends Window> DeltaEvictor<T, W> of(double threshold, DeltaFunction<T> deltaFunction) { return new DeltaEvictor<>(threshold, deltaFunction); }
java
public static <T, W extends Window> DeltaEvictor<T, W> of(double threshold, DeltaFunction<T> deltaFunction) { return new DeltaEvictor<>(threshold, deltaFunction); }
[ "public", "static", "<", "T", ",", "W", "extends", "Window", ">", "DeltaEvictor", "<", "T", ",", "W", ">", "of", "(", "double", "threshold", ",", "DeltaFunction", "<", "T", ">", "deltaFunction", ")", "{", "return", "new", "DeltaEvictor", "<>", "(", "th...
Creates a {@code DeltaEvictor} from the given threshold and {@code DeltaFunction}. Eviction is done before the window function. @param threshold The threshold @param deltaFunction The {@code DeltaFunction}
[ "Creates", "a", "{", "@code", "DeltaEvictor", "}", "from", "the", "given", "threshold", "and", "{", "@code", "DeltaFunction", "}", ".", "Eviction", "is", "done", "before", "the", "window", "function", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java#L94-L96
train
Create a new delta evictor.
[ 30522, 2270, 10763, 1026, 1056, 1010, 1059, 8908, 3332, 1028, 7160, 17726, 4263, 1026, 1056, 1010, 1059, 1028, 1997, 1006, 3313, 11207, 1010, 7160, 11263, 27989, 1026, 1056, 1028, 7160, 11263, 27989, 1007, 1063, 2709, 2047, 7160, 17726, 426...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.wrap
public static Object[] wrap(Object obj) { if (null == obj) { return null; } if (isArray(obj)) { try { return (Object[]) obj; } catch (Exception e) { final String className = obj.getClass().getComponentType().getName(); switch (className) { case "long": return wrap((long[]) obj); case "int": return wrap((int[]) obj); case "short": return wrap((short[]) obj); case "char": return wrap((char[]) obj); case "byte": return wrap((byte[]) obj); case "boolean": return wrap((boolean[]) obj); case "float": return wrap((float[]) obj); case "double": return wrap((double[]) obj); default: throw new UtilException(e); } } } throw new UtilException(StrUtil.format("[{}] is not Array!", obj.getClass())); }
java
public static Object[] wrap(Object obj) { if (null == obj) { return null; } if (isArray(obj)) { try { return (Object[]) obj; } catch (Exception e) { final String className = obj.getClass().getComponentType().getName(); switch (className) { case "long": return wrap((long[]) obj); case "int": return wrap((int[]) obj); case "short": return wrap((short[]) obj); case "char": return wrap((char[]) obj); case "byte": return wrap((byte[]) obj); case "boolean": return wrap((boolean[]) obj); case "float": return wrap((float[]) obj); case "double": return wrap((double[]) obj); default: throw new UtilException(e); } } } throw new UtilException(StrUtil.format("[{}] is not Array!", obj.getClass())); }
[ "public", "static", "Object", "[", "]", "wrap", "(", "Object", "obj", ")", "{", "if", "(", "null", "==", "obj", ")", "{", "return", "null", ";", "}", "if", "(", "isArray", "(", "obj", ")", ")", "{", "try", "{", "return", "(", "Object", "[", "]"...
包装数组对象 @param obj 对象,可以是对象数组或者基本类型数组 @return 包装类型数组或对象数组 @throws UtilException 对象为非数组
[ "包装数组对象" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1752-L1784
train
Creates an array of objects that is not null and wraps it.
[ 30522, 2270, 10763, 4874, 1031, 1033, 10236, 1006, 4874, 27885, 3501, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 27885, 3501, 1007, 1063, 2709, 19701, 1025, 1065, 2065, 1006, 18061, 11335, 2100, 1006, 27885, 3501, 1007, 1007, 1063, 3046, 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/ArrayUtil.java
ArrayUtil.removeEle
public static <T> T[] removeEle(T[] array, T element) throws IllegalArgumentException { return remove(array, indexOf(array, element)); }
java
public static <T> T[] removeEle(T[] array, T element) throws IllegalArgumentException { return remove(array, indexOf(array, element)); }
[ "public", "static", "<", "T", ">", "T", "[", "]", "removeEle", "(", "T", "[", "]", "array", ",", "T", "element", ")", "throws", "IllegalArgumentException", "{", "return", "remove", "(", "array", ",", "indexOf", "(", "array", ",", "element", ")", ")", ...
移除数组中指定的元素<br> 只会移除匹配到的第一个元素 copy from commons-lang @param <T> 数组元素类型 @param array 数组对象,可以是对象数组,也可以原始类型数组 @param element 要移除的元素 @return 去掉指定元素后的新数组或原数组 @throws IllegalArgumentException 参数对象不为数组对象 @since 3.0.8
[ "移除数组中指定的元素<br", ">", "只会移除匹配到的第一个元素", "copy", "from", "commons", "-", "lang" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2805-L2807
train
Removes the element from the array.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 1031, 1033, 6366, 12260, 1006, 1056, 1031, 1033, 9140, 1010, 1056, 5783, 1007, 11618, 6206, 2906, 22850, 15781, 2595, 24422, 1063, 2709, 6366, 1006, 9140, 1010, 5950, 11253, 1006, 9140, 1010, 5783...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
metrics/src/main/java/io/dropwizard/metrics/UniformSnapshot.java
UniformSnapshot.getValue
@Override public double getValue(double quantile) { if (quantile < 0.0 || quantile > 1.0 || Double.isNaN( quantile )) { throw new IllegalArgumentException(quantile + " is not in [0..1]"); } if (values.length == 0) { return 0.0; } final double pos = quantile * (values.length + 1); final int index = (int) pos; if (index < 1) { return values[0]; } if (index >= values.length) { return values[values.length - 1]; } final double lower = values[index - 1]; final double upper = values[index]; return lower + (pos - floor(pos)) * (upper - lower); }
java
@Override public double getValue(double quantile) { if (quantile < 0.0 || quantile > 1.0 || Double.isNaN( quantile )) { throw new IllegalArgumentException(quantile + " is not in [0..1]"); } if (values.length == 0) { return 0.0; } final double pos = quantile * (values.length + 1); final int index = (int) pos; if (index < 1) { return values[0]; } if (index >= values.length) { return values[values.length - 1]; } final double lower = values[index - 1]; final double upper = values[index]; return lower + (pos - floor(pos)) * (upper - lower); }
[ "@", "Override", "public", "double", "getValue", "(", "double", "quantile", ")", "{", "if", "(", "quantile", "<", "0.0", "||", "quantile", ">", "1.0", "||", "Double", ".", "isNaN", "(", "quantile", ")", ")", "{", "throw", "new", "IllegalArgumentException",...
Returns the value at the given quantile. @param quantile a given quantile, in {@code [0..1]} @return the value in the distribution at {@code quantile}
[ "Returns", "the", "value", "at", "the", "given", "quantile", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/UniformSnapshot.java#L81-L105
train
Gets the value of a single attribute.
[ 30522, 1030, 2058, 15637, 2270, 3313, 2131, 10175, 5657, 1006, 3313, 24110, 15286, 1007, 1063, 2065, 1006, 24110, 15286, 1026, 1014, 1012, 1014, 1064, 1064, 24110, 15286, 1028, 1015, 1012, 1014, 1064, 1064, 3313, 1012, 3475, 2319, 1006, 241...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.addVertex
public Graph<K, VV, EV> addVertex(final Vertex<K, VV> vertex) { List<Vertex<K, VV>> newVertex = new ArrayList<>(); newVertex.add(vertex); return addVertices(newVertex); }
java
public Graph<K, VV, EV> addVertex(final Vertex<K, VV> vertex) { List<Vertex<K, VV>> newVertex = new ArrayList<>(); newVertex.add(vertex); return addVertices(newVertex); }
[ "public", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "addVertex", "(", "final", "Vertex", "<", "K", ",", "VV", ">", "vertex", ")", "{", "List", "<", "Vertex", "<", "K", ",", "VV", ">", ">", "newVertex", "=", "new", "ArrayList", "<>", "(", ")...
Adds the input vertex to the graph. If the vertex already exists in the graph, it will not be added again. @param vertex the vertex to be added @return the new graph containing the existing vertices as well as the one just added
[ "Adds", "the", "input", "vertex", "to", "the", "graph", ".", "If", "the", "vertex", "already", "exists", "in", "the", "graph", "it", "will", "not", "be", "added", "again", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1365-L1370
train
Add a vertex to the graph.
[ 30522, 2270, 10629, 1026, 1047, 1010, 1058, 2615, 1010, 23408, 1028, 5587, 16874, 10288, 1006, 2345, 19449, 1026, 1047, 1010, 30524, 1007, 1025, 2709, 5587, 16874, 23522, 1006, 2047, 16874, 10288, 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/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
ThriftCLIService.getSessionHandle
SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res) throws HiveSQLException, LoginException, IOException { String userName = getUserName(req); String ipAddress = getIpAddress(); TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION, req.getClient_protocol()); SessionHandle sessionHandle; if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) && (userName != null)) { String delegationTokenStr = getDelegationToken(userName); sessionHandle = cliService.openSessionWithImpersonation(protocol, userName, req.getPassword(), ipAddress, req.getConfiguration(), delegationTokenStr); } else { sessionHandle = cliService.openSession(protocol, userName, req.getPassword(), ipAddress, req.getConfiguration()); } res.setServerProtocolVersion(protocol); return sessionHandle; }
java
SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res) throws HiveSQLException, LoginException, IOException { String userName = getUserName(req); String ipAddress = getIpAddress(); TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION, req.getClient_protocol()); SessionHandle sessionHandle; if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) && (userName != null)) { String delegationTokenStr = getDelegationToken(userName); sessionHandle = cliService.openSessionWithImpersonation(protocol, userName, req.getPassword(), ipAddress, req.getConfiguration(), delegationTokenStr); } else { sessionHandle = cliService.openSession(protocol, userName, req.getPassword(), ipAddress, req.getConfiguration()); } res.setServerProtocolVersion(protocol); return sessionHandle; }
[ "SessionHandle", "getSessionHandle", "(", "TOpenSessionReq", "req", ",", "TOpenSessionResp", "res", ")", "throws", "HiveSQLException", ",", "LoginException", ",", "IOException", "{", "String", "userName", "=", "getUserName", "(", "req", ")", ";", "String", "ipAddres...
Create a session handle @param req @param res @return @throws HiveSQLException @throws LoginException @throws IOException
[ "Create", "a", "session", "handle" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L341-L359
train
Get a session handle from the input.
[ 30522, 5219, 11774, 2571, 4152, 7971, 3258, 11774, 2571, 1006, 2327, 16700, 28231, 2890, 4160, 2128, 4160, 1010, 2327, 16700, 28231, 6072, 2361, 24501, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1010, 8833, 3170, 2595, 24422, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java
CassandraSink.uid
@PublicEvolving public CassandraSink<IN> uid(String uid) { if (useDataStreamSink) { getSinkTransformation().setUid(uid); } else { getStreamTransformation().setUid(uid); } return this; }
java
@PublicEvolving public CassandraSink<IN> uid(String uid) { if (useDataStreamSink) { getSinkTransformation().setUid(uid); } else { getStreamTransformation().setUid(uid); } return this; }
[ "@", "PublicEvolving", "public", "CassandraSink", "<", "IN", ">", "uid", "(", "String", "uid", ")", "{", "if", "(", "useDataStreamSink", ")", "{", "getSinkTransformation", "(", ")", ".", "setUid", "(", "uid", ")", ";", "}", "else", "{", "getStreamTransform...
Sets an ID for this operator. <p>The specified ID is used to assign the same operator ID across job submissions (for example when starting a job from a savepoint). <p><strong>Important</strong>: this ID needs to be unique per transformation and job. Otherwise, job submission will fail. @param uid The unique user-specified ID of this transformation. @return The operator with the specified ID.
[ "Sets", "an", "ID", "for", "this", "operator", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java#L99-L107
train
Sets the UID of the sink.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 15609, 11493, 2243, 1026, 1999, 1028, 21318, 2094, 1006, 5164, 21318, 2094, 1007, 1063, 2065, 1006, 2109, 6790, 21422, 11493, 2243, 1007, 1063, 4152, 19839, 6494, 3619, 14192, 3370, 1006, 1007, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.getPropertyDescriptor
public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName) throws BeanException { return getPropertyDescriptor(clazz, fieldName, false); }
java
public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName) throws BeanException { return getPropertyDescriptor(clazz, fieldName, false); }
[ "public", "static", "PropertyDescriptor", "getPropertyDescriptor", "(", "Class", "<", "?", ">", "clazz", ",", "final", "String", "fieldName", ")", "throws", "BeanException", "{", "return", "getPropertyDescriptor", "(", "clazz", ",", "fieldName", ",", "false", ")",...
获得Bean类属性描述,大小写敏感 @param clazz Bean类 @param fieldName 字段名 @return PropertyDescriptor @throws BeanException 获取属性异常
[ "获得Bean类属性描述,大小写敏感" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L228-L230
train
Returns the PropertyDescriptor for the given field.
[ 30522, 2270, 10763, 3200, 6155, 23235, 2953, 2131, 21572, 4842, 3723, 6155, 23235, 2953, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 2345, 5164, 2492, 18442, 1007, 11618, 14068, 10288, 24422, 1063, 2709, 2131, 21572, 4842, 3723, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Range.java
Range.reset
public Range<T> reset() { lock.lock(); try { this.current = this.start; this.index = 0; } finally { lock.unlock(); } return this; }
java
public Range<T> reset() { lock.lock(); try { this.current = this.start; this.index = 0; } finally { lock.unlock(); } return this; }
[ "public", "Range", "<", "T", ">", "reset", "(", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "this", ".", "current", "=", "this", ".", "start", ";", "this", ".", "index", "=", "0", ";", "}", "finally", "{", "lock", ".", "unlock", ...
重置{@link Range} @return this
[ "重置", "{", "@link", "Range", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Range.java#L172-L181
train
Resets the range to the beginning of this range.
[ 30522, 2270, 2846, 1026, 1056, 1028, 25141, 1006, 1007, 1063, 5843, 1012, 5843, 1006, 1007, 1025, 3046, 1063, 2023, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/crf/crfpp/EncoderFeatureIndex.java
EncoderFeatureIndex.openTemplate
private boolean openTemplate(String filename) { InputStreamReader isr = null; try { isr = new InputStreamReader(IOUtil.newInputStream(filename), "UTF-8"); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { if (line.length() == 0 || line.charAt(0) == ' ' || line.charAt(0) == '#') { continue; } else if (line.charAt(0) == 'U') { unigramTempls_.add(line.trim()); } else if (line.charAt(0) == 'B') { bigramTempls_.add(line.trim()); } else { System.err.println("unknown type: " + line); } } br.close(); templs_ = makeTempls(unigramTempls_, bigramTempls_); } catch (Exception e) { if (isr != null) { try { isr.close(); } catch (Exception e2) { } } e.printStackTrace(); System.err.println("Error reading " + filename); return false; } return true; }
java
private boolean openTemplate(String filename) { InputStreamReader isr = null; try { isr = new InputStreamReader(IOUtil.newInputStream(filename), "UTF-8"); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { if (line.length() == 0 || line.charAt(0) == ' ' || line.charAt(0) == '#') { continue; } else if (line.charAt(0) == 'U') { unigramTempls_.add(line.trim()); } else if (line.charAt(0) == 'B') { bigramTempls_.add(line.trim()); } else { System.err.println("unknown type: " + line); } } br.close(); templs_ = makeTempls(unigramTempls_, bigramTempls_); } catch (Exception e) { if (isr != null) { try { isr.close(); } catch (Exception e2) { } } e.printStackTrace(); System.err.println("Error reading " + filename); return false; } return true; }
[ "private", "boolean", "openTemplate", "(", "String", "filename", ")", "{", "InputStreamReader", "isr", "=", "null", ";", "try", "{", "isr", "=", "new", "InputStreamReader", "(", "IOUtil", ".", "newInputStream", "(", "filename", ")", ",", "\"UTF-8\"", ")", ";...
读取特征模板文件 @param filename @return
[ "读取特征模板文件" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/EncoderFeatureIndex.java#L74-L121
train
Open a template file.
[ 30522, 2797, 22017, 20898, 2330, 18532, 15725, 1006, 5164, 5371, 18442, 1007, 1063, 20407, 25379, 16416, 4063, 2003, 2099, 1027, 19701, 1025, 3046, 1063, 2003, 2099, 1027, 2047, 20407, 25379, 16416, 4063, 1006, 22834, 21823, 2140, 1012, 2047,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/AhoCorasick/State.java
State.setFailure
public void setFailure(State failState, int fail[]) { this.failure = failState; fail[index] = failState.index; }
java
public void setFailure(State failState, int fail[]) { this.failure = failState; fail[index] = failState.index; }
[ "public", "void", "setFailure", "(", "State", "failState", ",", "int", "fail", "[", "]", ")", "{", "this", ".", "failure", "=", "failState", ";", "fail", "[", "index", "]", "=", "failState", ".", "index", ";", "}" ]
设置failure状态 @param failState
[ "设置failure状态" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/State.java#L142-L146
train
Sets the failure of the exception.
[ 30522, 2270, 11675, 2275, 7011, 4014, 5397, 1006, 2110, 11896, 12259, 30524, 1025, 8246, 1031, 5950, 1033, 1027, 11896, 12259, 1012, 5950, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/RelaxedNames.java
RelaxedNames.forCamelCase
public static RelaxedNames forCamelCase(String name) { StringBuilder result = new StringBuilder(); for (char c : name.toCharArray()) { result.append(Character.isUpperCase(c) && result.length() > 0 && result.charAt(result.length() - 1) != '-' ? "-" + Character.toLowerCase(c) : c); } return new RelaxedNames(result.toString()); }
java
public static RelaxedNames forCamelCase(String name) { StringBuilder result = new StringBuilder(); for (char c : name.toCharArray()) { result.append(Character.isUpperCase(c) && result.length() > 0 && result.charAt(result.length() - 1) != '-' ? "-" + Character.toLowerCase(c) : c); } return new RelaxedNames(result.toString()); }
[ "public", "static", "RelaxedNames", "forCamelCase", "(", "String", "name", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "char", "c", ":", "name", ".", "toCharArray", "(", ")", ")", "{", "result", ".", "appe...
Return a {@link RelaxedNames} for the given source camelCase source name. @param name the source name in camelCase @return the relaxed names
[ "Return", "a", "{", "@link", "RelaxedNames", "}", "for", "the", "given", "source", "camelCase", "source", "name", "." ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/RelaxedNames.java#L232-L239
train
Returns a RelaxedNames for a CamelCase name.
[ 30522, 2270, 10763, 8363, 18442, 2015, 2005, 28727, 2884, 18382, 1006, 5164, 2171, 1007, 1063, 5164, 8569, 23891, 2099, 2765, 1027, 2047, 5164, 8569, 23891, 2099, 1006, 1007, 1025, 2005, 1006, 25869, 1039, 30524, 2003, 29547, 18992, 3366, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.hexToColor
public static Color hexToColor(String hex) { return getColor(Integer.parseInt(StrUtil.removePrefix("#", hex), 16)); }
java
public static Color hexToColor(String hex) { return getColor(Integer.parseInt(StrUtil.removePrefix("#", hex), 16)); }
[ "public", "static", "Color", "hexToColor", "(", "String", "hex", ")", "{", "return", "getColor", "(", "Integer", ".", "parseInt", "(", "StrUtil", ".", "removePrefix", "(", "\"#\"", ",", "hex", ")", ",", "16", ")", ")", ";", "}" ]
16进制的颜色值转换为Color对象,例如#fcf6d6 @param hex 16进制的颜色值,例如#fcf6d6 @return {@link Color} @since 4.1.14
[ "16进制的颜色值转换为Color对象,例如#fcf6d6" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1708-L1710
train
Converts a hex string to a color.
[ 30522, 2270, 10763, 3609, 2002, 18413, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java
HttpConversionUtil.toHttpResponse
public static HttpResponse toHttpResponse(final int streamId, final Http2Headers http2Headers, final boolean validateHttpHeaders) throws Http2Exception { final HttpResponseStatus status = parseStatus(http2Headers.status()); // HTTP/2 does not define a way to carry the version or reason phrase that is included in an // HTTP/1.1 status line. final HttpResponse msg = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status, validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true); } catch (final Http2Exception e) { throw e; } catch (final Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
java
public static HttpResponse toHttpResponse(final int streamId, final Http2Headers http2Headers, final boolean validateHttpHeaders) throws Http2Exception { final HttpResponseStatus status = parseStatus(http2Headers.status()); // HTTP/2 does not define a way to carry the version or reason phrase that is included in an // HTTP/1.1 status line. final HttpResponse msg = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status, validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true); } catch (final Http2Exception e) { throw e; } catch (final Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
[ "public", "static", "HttpResponse", "toHttpResponse", "(", "final", "int", "streamId", ",", "final", "Http2Headers", "http2Headers", ",", "final", "boolean", "validateHttpHeaders", ")", "throws", "Http2Exception", "{", "final", "HttpResponseStatus", "status", "=", "pa...
Create a new object to contain the response data. @param streamId The stream associated with the response @param http2Headers The initial set of HTTP/2 headers to create the response with @param validateHttpHeaders <ul> <li>{@code true} to validate HTTP headers in the http-codec</li> <li>{@code false} not to validate HTTP headers in the http-codec</li> </ul> @return A new response object which represents headers for a chunked response @throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, HttpHeaders, HttpVersion, boolean, boolean)}
[ "Create", "a", "new", "object", "to", "contain", "the", "response", "data", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L312-L327
train
Converts a Http2 headers object to a HTTP response object.
[ 30522, 2270, 10763, 8299, 6072, 26029, 3366, 2000, 11039, 25856, 6072, 26029, 3366, 1006, 2345, 20014, 5460, 3593, 1010, 2345, 8299, 2475, 4974, 2545, 8299, 2475, 4974, 2545, 1010, 2345, 22017, 20898, 9398, 3686, 11039, 25856, 4974, 2545, 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/concurrent/FutureUtils.java
FutureUtils.runAfterwards
public static CompletableFuture<Void> runAfterwards(CompletableFuture<?> future, RunnableWithException runnable) { return runAfterwardsAsync(future, runnable, Executors.directExecutor()); }
java
public static CompletableFuture<Void> runAfterwards(CompletableFuture<?> future, RunnableWithException runnable) { return runAfterwardsAsync(future, runnable, Executors.directExecutor()); }
[ "public", "static", "CompletableFuture", "<", "Void", ">", "runAfterwards", "(", "CompletableFuture", "<", "?", ">", "future", ",", "RunnableWithException", "runnable", ")", "{", "return", "runAfterwardsAsync", "(", "future", ",", "runnable", ",", "Executors", "."...
Run the given action after the completion of the given future. The given future can be completed normally or exceptionally. In case of an exceptional completion the, the action's exception will be added to the initial exception. @param future to wait for its completion @param runnable action which is triggered after the future's completion @return Future which is completed after the action has completed. This future can contain an exception, if an error occurred in the given future or action.
[ "Run", "the", "given", "action", "after", "the", "completion", "of", "the", "given", "future", ".", "The", "given", "future", "can", "be", "completed", "normally", "or", "exceptionally", ".", "In", "case", "of", "an", "exceptional", "completion", "the", "the...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L407-L409
train
Run afterwards CompletableFuture.
[ 30522, 2270, 10763, 4012, 10814, 10880, 11263, 11244, 1026, 11675, 1028, 2448, 10354, 3334, 7652, 2015, 1006, 4012, 10814, 10880, 11263, 11244, 1026, 1029, 1028, 2925, 1010, 2448, 22966, 24415, 10288, 24422, 2448, 22966, 1007, 1063, 2709, 244...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
DataSet.reduce
public ReduceOperator<T> reduce(ReduceFunction<T> reducer) { if (reducer == null) { throw new NullPointerException("Reduce function must not be null."); } return new ReduceOperator<>(this, clean(reducer), Utils.getCallLocationName()); }
java
public ReduceOperator<T> reduce(ReduceFunction<T> reducer) { if (reducer == null) { throw new NullPointerException("Reduce function must not be null."); } return new ReduceOperator<>(this, clean(reducer), Utils.getCallLocationName()); }
[ "public", "ReduceOperator", "<", "T", ">", "reduce", "(", "ReduceFunction", "<", "T", ">", "reducer", ")", "{", "if", "(", "reducer", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Reduce function must not be null.\"", ")", ";", "}", ...
Applies a Reduce transformation on a non-grouped {@link DataSet}. <p>The transformation consecutively calls a {@link org.apache.flink.api.common.functions.RichReduceFunction} until only a single element remains which is the result of the transformation. A ReduceFunction combines two elements into one new element of the same type. @param reducer The ReduceFunction that is applied on the DataSet. @return A ReduceOperator that represents the reduced DataSet. @see org.apache.flink.api.common.functions.RichReduceFunction @see ReduceOperator @see DataSet
[ "Applies", "a", "Reduce", "transformation", "on", "a", "non", "-", "grouped", "{", "@link", "DataSet", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L443-L448
train
Returns a new instance of this operator with the specified reducer applied to all operands of this operator.
[ 30522, 2270, 5547, 25918, 8844, 1026, 1056, 1028, 5547, 1006, 5547, 11263, 27989, 1026, 1056, 1028, 5547, 2099, 1007, 1063, 2065, 1006, 5547, 2099, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 19701, 8400, 7869, 2595, 24422, 1006, 1000, 5547,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...