repo
stringclasses
11 values
path
stringlengths
41
214
func_name
stringlengths
7
82
original_string
stringlengths
77
11.9k
language
stringclasses
1 value
code
stringlengths
77
11.9k
code_tokens
listlengths
22
1.57k
docstring
stringlengths
2
2.27k
docstring_tokens
listlengths
1
352
sha
stringclasses
11 values
url
stringlengths
129
319
partition
stringclasses
1 value
summary
stringlengths
7
191
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
BootstrapTools.getTaskManagerShellCommand
public static String getTaskManagerShellCommand( Configuration flinkConfig, ContaineredTaskManagerParameters tmParams, String configDirectory, String logDirectory, boolean hasLogback, boolean hasLog4j, boolean hasKrb5, Class<?> mainClass) { final Map<String, String> startCommandValues = new HashMap<>(); startCommandValues.put("java", "$JAVA_HOME/bin/java"); ArrayList<String> params = new ArrayList<>(); params.add(String.format("-Xms%dm", tmParams.taskManagerHeapSizeMB())); params.add(String.format("-Xmx%dm", tmParams.taskManagerHeapSizeMB())); if (tmParams.taskManagerDirectMemoryLimitMB() >= 0) { params.add(String.format("-XX:MaxDirectMemorySize=%dm", tmParams.taskManagerDirectMemoryLimitMB())); } startCommandValues.put("jvmmem", StringUtils.join(params, ' ')); String javaOpts = flinkConfig.getString(CoreOptions.FLINK_JVM_OPTIONS); if (flinkConfig.getString(CoreOptions.FLINK_TM_JVM_OPTIONS).length() > 0) { javaOpts += " " + flinkConfig.getString(CoreOptions.FLINK_TM_JVM_OPTIONS); } //applicable only for YarnMiniCluster secure test run //krb5.conf file will be available as local resource in JM/TM container if (hasKrb5) { javaOpts += " -Djava.security.krb5.conf=krb5.conf"; } startCommandValues.put("jvmopts", javaOpts); String logging = ""; if (hasLogback || hasLog4j) { logging = "-Dlog.file=" + logDirectory + "/taskmanager.log"; if (hasLogback) { logging += " -Dlogback.configurationFile=file:" + configDirectory + "/logback.xml"; } if (hasLog4j) { logging += " -Dlog4j.configuration=file:" + configDirectory + "/log4j.properties"; } } startCommandValues.put("logging", logging); startCommandValues.put("class", mainClass.getName()); startCommandValues.put("redirects", "1> " + logDirectory + "/taskmanager.out " + "2> " + logDirectory + "/taskmanager.err"); startCommandValues.put("args", "--configDir " + configDirectory); final String commandTemplate = flinkConfig .getString(ConfigConstants.YARN_CONTAINER_START_COMMAND_TEMPLATE, ConfigConstants.DEFAULT_YARN_CONTAINER_START_COMMAND_TEMPLATE); String startCommand = getStartCommand(commandTemplate, startCommandValues); LOG.debug("TaskManager start command: " + startCommand); return startCommand; }
java
public static String getTaskManagerShellCommand( Configuration flinkConfig, ContaineredTaskManagerParameters tmParams, String configDirectory, String logDirectory, boolean hasLogback, boolean hasLog4j, boolean hasKrb5, Class<?> mainClass) { final Map<String, String> startCommandValues = new HashMap<>(); startCommandValues.put("java", "$JAVA_HOME/bin/java"); ArrayList<String> params = new ArrayList<>(); params.add(String.format("-Xms%dm", tmParams.taskManagerHeapSizeMB())); params.add(String.format("-Xmx%dm", tmParams.taskManagerHeapSizeMB())); if (tmParams.taskManagerDirectMemoryLimitMB() >= 0) { params.add(String.format("-XX:MaxDirectMemorySize=%dm", tmParams.taskManagerDirectMemoryLimitMB())); } startCommandValues.put("jvmmem", StringUtils.join(params, ' ')); String javaOpts = flinkConfig.getString(CoreOptions.FLINK_JVM_OPTIONS); if (flinkConfig.getString(CoreOptions.FLINK_TM_JVM_OPTIONS).length() > 0) { javaOpts += " " + flinkConfig.getString(CoreOptions.FLINK_TM_JVM_OPTIONS); } //applicable only for YarnMiniCluster secure test run //krb5.conf file will be available as local resource in JM/TM container if (hasKrb5) { javaOpts += " -Djava.security.krb5.conf=krb5.conf"; } startCommandValues.put("jvmopts", javaOpts); String logging = ""; if (hasLogback || hasLog4j) { logging = "-Dlog.file=" + logDirectory + "/taskmanager.log"; if (hasLogback) { logging += " -Dlogback.configurationFile=file:" + configDirectory + "/logback.xml"; } if (hasLog4j) { logging += " -Dlog4j.configuration=file:" + configDirectory + "/log4j.properties"; } } startCommandValues.put("logging", logging); startCommandValues.put("class", mainClass.getName()); startCommandValues.put("redirects", "1> " + logDirectory + "/taskmanager.out " + "2> " + logDirectory + "/taskmanager.err"); startCommandValues.put("args", "--configDir " + configDirectory); final String commandTemplate = flinkConfig .getString(ConfigConstants.YARN_CONTAINER_START_COMMAND_TEMPLATE, ConfigConstants.DEFAULT_YARN_CONTAINER_START_COMMAND_TEMPLATE); String startCommand = getStartCommand(commandTemplate, startCommandValues); LOG.debug("TaskManager start command: " + startCommand); return startCommand; }
[ "public", "static", "String", "getTaskManagerShellCommand", "(", "Configuration", "flinkConfig", ",", "ContaineredTaskManagerParameters", "tmParams", ",", "String", "configDirectory", ",", "String", "logDirectory", ",", "boolean", "hasLogback", ",", "boolean", "hasLog4j", ...
Generates the shell command to start a task manager. @param flinkConfig The Flink configuration. @param tmParams Parameters for the task manager. @param configDirectory The configuration directory for the flink-conf.yaml @param logDirectory The log directory. @param hasLogback Uses logback? @param hasLog4j Uses log4j? @param mainClass The main class to start with. @return A String containing the task manager startup command.
[ "Generates", "the", "shell", "command", "to", "start", "a", "task", "manager", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java#L413-L476
train
Returns the shell command to run the task manager.
[ 30522, 2270, 10763, 5164, 2131, 10230, 22287, 5162, 15776, 18223, 9006, 2386, 2094, 1006, 9563, 13109, 19839, 8663, 8873, 2290, 1010, 11661, 2098, 10230, 22287, 5162, 4590, 30524, 5963, 1010, 22017, 20898, 2038, 21197, 2549, 3501, 1010, 22017...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraCommitter.java
CassandraCommitter.createResource
@Override public void createResource() throws Exception { cluster = builder.getCluster(); session = cluster.connect(); session.execute(String.format("CREATE KEYSPACE IF NOT EXISTS %s with replication={'class':'SimpleStrategy', 'replication_factor':1};", keySpace)); session.execute(String.format("CREATE TABLE IF NOT EXISTS %s.%s (sink_id text, sub_id int, checkpoint_id bigint, PRIMARY KEY (sink_id, sub_id));", keySpace, table)); try { session.close(); } catch (Exception e) { LOG.error("Error while closing session.", e); } try { cluster.close(); } catch (Exception e) { LOG.error("Error while closing cluster.", e); } }
java
@Override public void createResource() throws Exception { cluster = builder.getCluster(); session = cluster.connect(); session.execute(String.format("CREATE KEYSPACE IF NOT EXISTS %s with replication={'class':'SimpleStrategy', 'replication_factor':1};", keySpace)); session.execute(String.format("CREATE TABLE IF NOT EXISTS %s.%s (sink_id text, sub_id int, checkpoint_id bigint, PRIMARY KEY (sink_id, sub_id));", keySpace, table)); try { session.close(); } catch (Exception e) { LOG.error("Error while closing session.", e); } try { cluster.close(); } catch (Exception e) { LOG.error("Error while closing cluster.", e); } }
[ "@", "Override", "public", "void", "createResource", "(", ")", "throws", "Exception", "{", "cluster", "=", "builder", ".", "getCluster", "(", ")", ";", "session", "=", "cluster", ".", "connect", "(", ")", ";", "session", ".", "execute", "(", "String", "....
Generates the necessary tables to store information. @throws Exception
[ "Generates", "the", "necessary", "tables", "to", "store", "information", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraCommitter.java#L78-L96
train
Create the resource.
[ 30522, 1030, 2058, 15637, 2270, 11675, 3443, 6072, 8162, 3401, 1006, 1007, 11618, 6453, 1063, 9324, 1027, 12508, 1012, 2131, 20464, 19966, 2121, 1006, 1007, 1025, 5219, 1027, 9324, 1012, 7532, 1006, 1007, 1025, 5219, 1012, 15389, 1006, 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...
networknt/light-4j
metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java
InstrumentedExecutors.newScheduledThreadPool
public static InstrumentedScheduledExecutorService newScheduledThreadPool( int corePoolSize, ThreadFactory threadFactory, MetricRegistry registry, String name) { return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(corePoolSize, threadFactory), registry, name); }
java
public static InstrumentedScheduledExecutorService newScheduledThreadPool( int corePoolSize, ThreadFactory threadFactory, MetricRegistry registry, String name) { return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(corePoolSize, threadFactory), registry, name); }
[ "public", "static", "InstrumentedScheduledExecutorService", "newScheduledThreadPool", "(", "int", "corePoolSize", ",", "ThreadFactory", "threadFactory", ",", "MetricRegistry", "registry", ",", "String", "name", ")", "{", "return", "new", "InstrumentedScheduledExecutorService"...
Creates an instrumented thread pool that can schedule commands to run after a given delay, or to execute periodically. @param corePoolSize the number of threads to keep in the pool, even if they are idle @param threadFactory the factory to use when the executor creates a new thread @param registry the {@link MetricRegistry} that will contain the metrics. @param name the (metrics) name for this executor service, see {@link MetricRegistry#name(String, String...)}. @return a newly created scheduled thread pool @throws IllegalArgumentException if {@code corePoolSize < 0} @throws NullPointerException if threadFactory is null @see Executors#newScheduledThreadPool(int, ThreadFactory)
[ "Creates", "an", "instrumented", "thread", "pool", "that", "can", "schedule", "commands", "to", "run", "after", "a", "given", "delay", "or", "to", "execute", "periodically", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L439-L443
train
Create a new scheduled thread pool InstrumentedScheduledExecutorService.
[ 30522, 2270, 10763, 6602, 2098, 22842, 8566, 3709, 10288, 8586, 16161, 22573, 2099, 7903, 2063, 2739, 7690, 18696, 2705, 16416, 18927, 13669, 1006, 20014, 4563, 16869, 5332, 4371, 1010, 11689, 21450, 11689, 21450, 1010, 12046, 2890, 24063, 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...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java
AvroUtils.getAvroUtils
public static AvroUtils getAvroUtils() { // try and load the special AvroUtils from the flink-avro package try { Class<?> clazz = Class.forName(AVRO_KRYO_UTILS, false, Thread.currentThread().getContextClassLoader()); return clazz.asSubclass(AvroUtils.class).getConstructor().newInstance(); } catch (ClassNotFoundException e) { // cannot find the utils, return the default implementation return new DefaultAvroUtils(); } catch (Exception e) { throw new RuntimeException("Could not instantiate " + AVRO_KRYO_UTILS + ".", e); } }
java
public static AvroUtils getAvroUtils() { // try and load the special AvroUtils from the flink-avro package try { Class<?> clazz = Class.forName(AVRO_KRYO_UTILS, false, Thread.currentThread().getContextClassLoader()); return clazz.asSubclass(AvroUtils.class).getConstructor().newInstance(); } catch (ClassNotFoundException e) { // cannot find the utils, return the default implementation return new DefaultAvroUtils(); } catch (Exception e) { throw new RuntimeException("Could not instantiate " + AVRO_KRYO_UTILS + ".", e); } }
[ "public", "static", "AvroUtils", "getAvroUtils", "(", ")", "{", "// try and load the special AvroUtils from the flink-avro package", "try", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "AVRO_KRYO_UTILS", ",", "false", ",", "Thread", ".", ...
Returns either the default {@link AvroUtils} which throw an exception in cases where Avro would be needed or loads the specific utils for Avro from flink-avro.
[ "Returns", "either", "the", "default", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java#L44-L55
train
Get the AvroUtils instance.
[ 30522, 2270, 10763, 20704, 22494, 3775, 4877, 2131, 11431, 22494, 3775, 4877, 1006, 1007, 1063, 1013, 1013, 3046, 1998, 7170, 1996, 2569, 20704, 22494, 3775, 4877, 2013, 1996, 13109, 19839, 1011, 20704, 3217, 7427, 3046, 1063, 2465, 1026, 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/util/ConfigurationParserUtils.java
ConfigurationParserUtils.checkConfigParameter
public static void checkConfigParameter(boolean condition, Object parameter, String name, String errorMessage) throws IllegalConfigurationException { if (!condition) { throw new IllegalConfigurationException("Invalid configuration value for " + name + " : " + parameter + " - " + errorMessage); } }
java
public static void checkConfigParameter(boolean condition, Object parameter, String name, String errorMessage) throws IllegalConfigurationException { if (!condition) { throw new IllegalConfigurationException("Invalid configuration value for " + name + " : " + parameter + " - " + errorMessage); } }
[ "public", "static", "void", "checkConfigParameter", "(", "boolean", "condition", ",", "Object", "parameter", ",", "String", "name", ",", "String", "errorMessage", ")", "throws", "IllegalConfigurationException", "{", "if", "(", "!", "condition", ")", "{", "throw", ...
Validates a condition for a config parameter and displays a standard exception, if the the condition does not hold. @param condition The condition that must hold. If the condition is false, an exception is thrown. @param parameter The parameter value. Will be shown in the exception message. @param name The name of the config parameter. Will be shown in the exception message. @param errorMessage The optional custom error message to append to the exception message. @throws IllegalConfigurationException if the condition does not hold
[ "Validates", "a", "condition", "for", "a", "config", "parameter", "and", "displays", "a", "standard", "exception", "if", "the", "the", "condition", "does", "not", "hold", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ConfigurationParserUtils.java#L127-L133
train
Check configuration parameter.
[ 30522, 2270, 10763, 11675, 4638, 8663, 8873, 21600, 5400, 22828, 1006, 22017, 20898, 4650, 1010, 4874, 16381, 1010, 5164, 2171, 1010, 5164, 7561, 7834, 3736, 3351, 1007, 11618, 6206, 8663, 8873, 27390, 3370, 10288, 24422, 1063, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java
MapBuilder.put
public MapBuilder<K, V> put(K k, V v) { map.put(k, v); return this; }
java
public MapBuilder<K, V> put(K k, V v) { map.put(k, v); return this; }
[ "public", "MapBuilder", "<", "K", ",", "V", ">", "put", "(", "K", "k", ",", "V", "v", ")", "{", "map", ".", "put", "(", "k", ",", "v", ")", ";", "return", "this", ";", "}" ]
链式Map创建 @param k Key类型 @param v Value类型 @return 当前类
[ "链式Map创建" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java#L44-L47
train
Adds a mapping between the specified key and value to the map.
[ 30522, 2270, 4949, 8569, 23891, 2099, 1026, 1047, 1010, 1058, 1028, 2404, 1006, 1047, 1047, 1010, 1058, 1058, 1007, 1063, 4949, 1012, 2404, 1006, 1047, 1010, 1058, 1007, 1025, 2709, 2023, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RuntimeUtil.java
RuntimeUtil.exec
public static Process exec(String[] envp, File dir, String... cmds) { if (ArrayUtil.isEmpty(cmds)) { throw new NullPointerException("Command is empty !"); } // 单条命令的情况 if (1 == cmds.length) { final String cmd = cmds[0]; if (StrUtil.isBlank(cmd)) { throw new NullPointerException("Command is empty !"); } cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE); } try { return Runtime.getRuntime().exec(cmds, envp, dir); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static Process exec(String[] envp, File dir, String... cmds) { if (ArrayUtil.isEmpty(cmds)) { throw new NullPointerException("Command is empty !"); } // 单条命令的情况 if (1 == cmds.length) { final String cmd = cmds[0]; if (StrUtil.isBlank(cmd)) { throw new NullPointerException("Command is empty !"); } cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE); } try { return Runtime.getRuntime().exec(cmds, envp, dir); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "Process", "exec", "(", "String", "[", "]", "envp", ",", "File", "dir", ",", "String", "...", "cmds", ")", "{", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "cmds", ")", ")", "{", "throw", "new", "NullPointerException", "(", "\"Comm...
执行命令<br> 命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入 @param envp 环境变量参数,传入形式为key=value,null表示继承系统环境变量 @param dir 执行命令所在目录(用于相对路径命令执行),null表示使用当前进程执行的目录 @param cmds 命令 @return {@link Process} @since 4.1.6
[ "执行命令<br", ">", "命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L122-L140
train
Executes a command on the specified directory.
[ 30522, 2270, 10763, 2832, 4654, 8586, 1006, 5164, 1031, 1033, 4372, 2615, 2361, 1010, 5371, 16101, 1010, 5164, 1012, 1012, 1012, 4642, 5104, 1007, 1063, 2065, 1006, 9140, 21823, 2140, 1012, 2003, 6633, 13876, 2100, 1006, 4642, 5104, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java
SqlClient.main
public static void main(String[] args) { if (args.length < 1) { CliOptionsParser.printHelpClient(); return; } switch (args[0]) { case MODE_EMBEDDED: // remove mode final String[] modeArgs = Arrays.copyOfRange(args, 1, args.length); final CliOptions options = CliOptionsParser.parseEmbeddedModeClient(modeArgs); if (options.isPrintHelp()) { CliOptionsParser.printHelpEmbeddedModeClient(); } else { try { final SqlClient client = new SqlClient(true, options); client.start(); } catch (SqlClientException e) { // make space in terminal System.out.println(); System.out.println(); LOG.error("SQL Client must stop.", e); throw e; } catch (Throwable t) { // make space in terminal System.out.println(); System.out.println(); LOG.error("SQL Client must stop. Unexpected exception. This is a bug. Please consider filing an issue.", t); throw new SqlClientException("Unexpected exception. This is a bug. Please consider filing an issue.", t); } } break; case MODE_GATEWAY: throw new SqlClientException("Gateway mode is not supported yet."); default: CliOptionsParser.printHelpClient(); } }
java
public static void main(String[] args) { if (args.length < 1) { CliOptionsParser.printHelpClient(); return; } switch (args[0]) { case MODE_EMBEDDED: // remove mode final String[] modeArgs = Arrays.copyOfRange(args, 1, args.length); final CliOptions options = CliOptionsParser.parseEmbeddedModeClient(modeArgs); if (options.isPrintHelp()) { CliOptionsParser.printHelpEmbeddedModeClient(); } else { try { final SqlClient client = new SqlClient(true, options); client.start(); } catch (SqlClientException e) { // make space in terminal System.out.println(); System.out.println(); LOG.error("SQL Client must stop.", e); throw e; } catch (Throwable t) { // make space in terminal System.out.println(); System.out.println(); LOG.error("SQL Client must stop. Unexpected exception. This is a bug. Please consider filing an issue.", t); throw new SqlClientException("Unexpected exception. This is a bug. Please consider filing an issue.", t); } } break; case MODE_GATEWAY: throw new SqlClientException("Gateway mode is not supported yet."); default: CliOptionsParser.printHelpClient(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "<", "1", ")", "{", "CliOptionsParser", ".", "printHelpClient", "(", ")", ";", "return", ";", "}", "switch", "(", "args", "[", "0", "]"...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java#L177-L217
train
Main method for the command line tool.
[ 30522, 2270, 10763, 11675, 2364, 1006, 5164, 1031, 1033, 12098, 5620, 1007, 1063, 2065, 1006, 12098, 5620, 1012, 3091, 1026, 1015, 1007, 1063, 18856, 3695, 16790, 27694, 8043, 1012, 6140, 16001, 15042, 8751, 3372, 1006, 1007, 1025, 2709, 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-http/src/main/java/cn/hutool/http/webservice/SoapClient.java
SoapClient.send
public String send(boolean pretty) { final String body = sendForResponse().body(); return pretty ? XmlUtil.format(body) : body; }
java
public String send(boolean pretty) { final String body = sendForResponse().body(); return pretty ? XmlUtil.format(body) : body; }
[ "public", "String", "send", "(", "boolean", "pretty", ")", "{", "final", "String", "body", "=", "sendForResponse", "(", ")", ".", "body", "(", ")", ";", "return", "pretty", "?", "XmlUtil", ".", "format", "(", "body", ")", ":", "body", ";", "}" ]
执行Webservice请求,既发送SOAP内容 @param pretty 是否格式化 @return 返回结果
[ "执行Webservice请求,既发送SOAP内容" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L427-L430
train
Send the request and return the response body as a string.
[ 30522, 2270, 5164, 4604, 1006, 22017, 20898, 3492, 1007, 1063, 2345, 5164, 2303, 1027, 4604, 29278, 6072, 26029, 3366, 1006, 1007, 1012, 2303, 1006, 1007, 1025, 2709, 3492, 1029, 20950, 21823, 2140, 1012, 4289, 1006, 2303, 1007, 1024, 2303,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.handleRow
public static <T extends Entity> T handleRow(T row, int columnCount, ResultSetMetaData meta, ResultSet rs, boolean withMetaInfo) throws SQLException { String columnLabel; int type; for (int i = 1; i <= columnCount; i++) { columnLabel = meta.getColumnLabel(i); type = meta.getColumnType(i); row.put(columnLabel, getColumnValue(rs, columnLabel, type, null)); } if (withMetaInfo) { row.setTableName(meta.getTableName(1)); row.setFieldNames(row.keySet()); } return row; }
java
public static <T extends Entity> T handleRow(T row, int columnCount, ResultSetMetaData meta, ResultSet rs, boolean withMetaInfo) throws SQLException { String columnLabel; int type; for (int i = 1; i <= columnCount; i++) { columnLabel = meta.getColumnLabel(i); type = meta.getColumnType(i); row.put(columnLabel, getColumnValue(rs, columnLabel, type, null)); } if (withMetaInfo) { row.setTableName(meta.getTableName(1)); row.setFieldNames(row.keySet()); } return row; }
[ "public", "static", "<", "T", "extends", "Entity", ">", "T", "handleRow", "(", "T", "row", ",", "int", "columnCount", ",", "ResultSetMetaData", "meta", ",", "ResultSet", "rs", ",", "boolean", "withMetaInfo", ")", "throws", "SQLException", "{", "String", "col...
处理单条数据 @param <T> Entity及其子对象 @param row Entity对象 @param columnCount 列数 @param meta ResultSetMetaData @param rs 数据集 @param withMetaInfo 是否包含表名、字段名等元信息 @return 每一行的Entity @throws SQLException SQL执行异常 @since 3.3.1
[ "处理单条数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/handler/HandleHelper.java#L128-L141
train
Handles a single row of a table from a ResultSet.
[ 30522, 2270, 10763, 1026, 1056, 8908, 9178, 1028, 1056, 28213, 5004, 1006, 1056, 5216, 1010, 20014, 5930, 3597, 16671, 1010, 3463, 3388, 11368, 8447, 2696, 18804, 1010, 3463, 3388, 12667, 1010, 22017, 20898, 2007, 11368, 8113, 14876, 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-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
CliFrontend.executeProgram
protected void executeProgram(PackagedProgram program, ClusterClient<?> client, int parallelism) throws ProgramMissingJobException, ProgramInvocationException { logAndSysout("Starting execution of program"); final JobSubmissionResult result = client.run(program, parallelism); if (null == result) { throw new ProgramMissingJobException("No JobSubmissionResult returned, please make sure you called " + "ExecutionEnvironment.execute()"); } if (result.isJobExecutionResult()) { logAndSysout("Program execution finished"); JobExecutionResult execResult = result.getJobExecutionResult(); System.out.println("Job with JobID " + execResult.getJobID() + " has finished."); System.out.println("Job Runtime: " + execResult.getNetRuntime() + " ms"); Map<String, Object> accumulatorsResult = execResult.getAllAccumulatorResults(); if (accumulatorsResult.size() > 0) { System.out.println("Accumulator Results: "); System.out.println(AccumulatorHelper.getResultsFormatted(accumulatorsResult)); } } else { logAndSysout("Job has been submitted with JobID " + result.getJobID()); } }
java
protected void executeProgram(PackagedProgram program, ClusterClient<?> client, int parallelism) throws ProgramMissingJobException, ProgramInvocationException { logAndSysout("Starting execution of program"); final JobSubmissionResult result = client.run(program, parallelism); if (null == result) { throw new ProgramMissingJobException("No JobSubmissionResult returned, please make sure you called " + "ExecutionEnvironment.execute()"); } if (result.isJobExecutionResult()) { logAndSysout("Program execution finished"); JobExecutionResult execResult = result.getJobExecutionResult(); System.out.println("Job with JobID " + execResult.getJobID() + " has finished."); System.out.println("Job Runtime: " + execResult.getNetRuntime() + " ms"); Map<String, Object> accumulatorsResult = execResult.getAllAccumulatorResults(); if (accumulatorsResult.size() > 0) { System.out.println("Accumulator Results: "); System.out.println(AccumulatorHelper.getResultsFormatted(accumulatorsResult)); } } else { logAndSysout("Job has been submitted with JobID " + result.getJobID()); } }
[ "protected", "void", "executeProgram", "(", "PackagedProgram", "program", ",", "ClusterClient", "<", "?", ">", "client", ",", "int", "parallelism", ")", "throws", "ProgramMissingJobException", ",", "ProgramInvocationException", "{", "logAndSysout", "(", "\"Starting exec...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L739-L762
train
Execute a packaged program.
[ 30522, 5123, 11675, 15389, 21572, 13113, 1006, 21972, 21572, 13113, 2565, 1010, 9324, 20464, 11638, 1026, 1029, 1028, 7396, 1010, 20014, 5903, 2964, 1007, 11618, 2565, 15630, 7741, 5558, 4783, 2595, 24422, 1010, 2565, 2378, 19152, 10288, 2442...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java
IOManagerAsync.createBlockChannelReader
@Override public BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue); }
java
@Override public BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue); }
[ "@", "Override", "public", "BlockChannelReader", "<", "MemorySegment", ">", "createBlockChannelReader", "(", "FileIOChannel", ".", "ID", "channelID", ",", "LinkedBlockingQueue", "<", "MemorySegment", ">", "returnQueue", ")", "throws", "IOException", "{", "checkState", ...
Creates a block channel reader that reads blocks from the given channel. The reader reads asynchronously, such that a read request is accepted, carried out at some (close) point in time, and the full segment is pushed to the given queue. @param channelID The descriptor for the channel to write to. @param returnQueue The queue to put the full buffers into. @return A block channel reader that reads from the given channel. @throws IOException Thrown, if the channel for the reader could not be opened.
[ "Creates", "a", "block", "channel", "reader", "that", "reads", "blocks", "from", "the", "given", "channel", ".", "The", "reader", "reads", "asynchronously", "such", "that", "a", "read", "request", "is", "accepted", "carried", "out", "at", "some", "(", "close...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L220-L226
train
Create a block channel reader.
[ 30522, 1030, 2058, 15637, 2270, 3796, 26058, 16416, 4063, 1026, 3638, 3366, 21693, 4765, 1028, 3443, 23467, 26058, 16416, 4063, 1006, 5371, 3695, 26058, 1012, 8909, 3149, 3593, 1010, 5799, 23467, 2075, 4226, 5657, 1026, 3638, 3366, 21693, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
ExecutionVertex.getPreferredLocationsBasedOnState
public Collection<CompletableFuture<TaskManagerLocation>> getPreferredLocationsBasedOnState() { TaskManagerLocation priorLocation; if (currentExecution.getTaskRestore() != null && (priorLocation = getLatestPriorLocation()) != null) { return Collections.singleton(CompletableFuture.completedFuture(priorLocation)); } else { return null; } }
java
public Collection<CompletableFuture<TaskManagerLocation>> getPreferredLocationsBasedOnState() { TaskManagerLocation priorLocation; if (currentExecution.getTaskRestore() != null && (priorLocation = getLatestPriorLocation()) != null) { return Collections.singleton(CompletableFuture.completedFuture(priorLocation)); } else { return null; } }
[ "public", "Collection", "<", "CompletableFuture", "<", "TaskManagerLocation", ">", ">", "getPreferredLocationsBasedOnState", "(", ")", "{", "TaskManagerLocation", "priorLocation", ";", "if", "(", "currentExecution", ".", "getTaskRestore", "(", ")", "!=", "null", "&&",...
Gets the preferred location to execute the current task execution attempt, based on the state that the execution attempt will resume. @return A size-one collection with the location preference, or null, if there is no location preference based on the state.
[ "Gets", "the", "preferred", "location", "to", "execute", "the", "current", "task", "execution", "attempt", "based", "on", "the", "state", "that", "the", "execution", "attempt", "will", "resume", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java#L504-L512
train
Returns the list of preferred locations based on the current state of the task manager.
[ 30522, 2270, 3074, 1026, 4012, 10814, 10880, 11263, 11244, 1026, 4708, 24805, 4590, 4135, 10719, 1028, 1028, 2131, 28139, 7512, 5596, 4135, 10719, 19022, 11022, 5280, 9153, 2618, 1006, 1007, 1063, 4708, 24805, 4590, 4135, 10719, 3188, 4135, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java
ExecutionGraph.attachJobGraph
public void attachJobGraph(List<JobVertex> topologiallySorted) throws JobException { assertRunningInJobMasterMainThread(); LOG.debug("Attaching {} topologically sorted vertices to existing job graph with {} " + "vertices and {} intermediate results.", topologiallySorted.size(), tasks.size(), intermediateResults.size()); final ArrayList<ExecutionJobVertex> newExecJobVertices = new ArrayList<>(topologiallySorted.size()); final long createTimestamp = System.currentTimeMillis(); for (JobVertex jobVertex : topologiallySorted) { if (jobVertex.isInputVertex() && !jobVertex.isStoppable()) { this.isStoppable = false; } // create the execution job vertex and attach it to the graph ExecutionJobVertex ejv = new ExecutionJobVertex( this, jobVertex, 1, rpcTimeout, globalModVersion, createTimestamp); ejv.connectToPredecessors(this.intermediateResults); ExecutionJobVertex previousTask = this.tasks.putIfAbsent(jobVertex.getID(), ejv); if (previousTask != null) { throw new JobException(String.format("Encountered two job vertices with ID %s : previous=[%s] / new=[%s]", jobVertex.getID(), ejv, previousTask)); } for (IntermediateResult res : ejv.getProducedDataSets()) { IntermediateResult previousDataSet = this.intermediateResults.putIfAbsent(res.getId(), res); if (previousDataSet != null) { throw new JobException(String.format("Encountered two intermediate data set with ID %s : previous=[%s] / new=[%s]", res.getId(), res, previousDataSet)); } } this.verticesInCreationOrder.add(ejv); this.numVerticesTotal += ejv.getParallelism(); newExecJobVertices.add(ejv); } terminationFuture = new CompletableFuture<>(); failoverStrategy.notifyNewVertices(newExecJobVertices); }
java
public void attachJobGraph(List<JobVertex> topologiallySorted) throws JobException { assertRunningInJobMasterMainThread(); LOG.debug("Attaching {} topologically sorted vertices to existing job graph with {} " + "vertices and {} intermediate results.", topologiallySorted.size(), tasks.size(), intermediateResults.size()); final ArrayList<ExecutionJobVertex> newExecJobVertices = new ArrayList<>(topologiallySorted.size()); final long createTimestamp = System.currentTimeMillis(); for (JobVertex jobVertex : topologiallySorted) { if (jobVertex.isInputVertex() && !jobVertex.isStoppable()) { this.isStoppable = false; } // create the execution job vertex and attach it to the graph ExecutionJobVertex ejv = new ExecutionJobVertex( this, jobVertex, 1, rpcTimeout, globalModVersion, createTimestamp); ejv.connectToPredecessors(this.intermediateResults); ExecutionJobVertex previousTask = this.tasks.putIfAbsent(jobVertex.getID(), ejv); if (previousTask != null) { throw new JobException(String.format("Encountered two job vertices with ID %s : previous=[%s] / new=[%s]", jobVertex.getID(), ejv, previousTask)); } for (IntermediateResult res : ejv.getProducedDataSets()) { IntermediateResult previousDataSet = this.intermediateResults.putIfAbsent(res.getId(), res); if (previousDataSet != null) { throw new JobException(String.format("Encountered two intermediate data set with ID %s : previous=[%s] / new=[%s]", res.getId(), res, previousDataSet)); } } this.verticesInCreationOrder.add(ejv); this.numVerticesTotal += ejv.getParallelism(); newExecJobVertices.add(ejv); } terminationFuture = new CompletableFuture<>(); failoverStrategy.notifyNewVertices(newExecJobVertices); }
[ "public", "void", "attachJobGraph", "(", "List", "<", "JobVertex", ">", "topologiallySorted", ")", "throws", "JobException", "{", "assertRunningInJobMasterMainThread", "(", ")", ";", "LOG", ".", "debug", "(", "\"Attaching {} topologically sorted vertices to existing job gra...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L807-L858
train
Attaches a list of job vertices to the existing job graph.
[ 30522, 2270, 11675, 22476, 5558, 2497, 14413, 1006, 2862, 1026, 3105, 16874, 10288, 1028, 2327, 12898, 10440, 9215, 21748, 3064, 1007, 11618, 3105, 10288, 24422, 1063, 20865, 15532, 5582, 2378, 5558, 25526, 24268, 24238, 2705, 16416, 2094, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BaseHybridHashTable.java
BaseHybridHashTable.freeCurrent
public void freeCurrent() { int beforeReleaseNum = availableMemory.size(); memManager.release(availableMemory); allocatedFloatingNum -= (beforeReleaseNum - availableMemory.size()); }
java
public void freeCurrent() { int beforeReleaseNum = availableMemory.size(); memManager.release(availableMemory); allocatedFloatingNum -= (beforeReleaseNum - availableMemory.size()); }
[ "public", "void", "freeCurrent", "(", ")", "{", "int", "beforeReleaseNum", "=", "availableMemory", ".", "size", "(", ")", ";", "memManager", ".", "release", "(", "availableMemory", ")", ";", "allocatedFloatingNum", "-=", "(", "beforeReleaseNum", "-", "availableM...
Free the memory not used.
[ "Free", "the", "memory", "not", "used", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BaseHybridHashTable.java#L484-L488
train
Free the current memory.
[ 30522, 2270, 11675, 2489, 10841, 14343, 3372, 1006, 1007, 1063, 20014, 2077, 16570, 19500, 19172, 1027, 2800, 4168, 5302, 2854, 1012, 2946, 1006, 1007, 1025, 2033, 14760, 27031, 2099, 1012, 2713, 1006, 2800, 4168, 5302, 2854, 1007, 1025, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.div
public static BigDecimal div(Number v1, Number v2) { return div(v1, v2, DEFAUT_DIV_SCALE); }
java
public static BigDecimal div(Number v1, Number v2) { return div(v1, v2, DEFAUT_DIV_SCALE); }
[ "public", "static", "BigDecimal", "div", "(", "Number", "v1", ",", "Number", "v2", ")", "{", "return", "div", "(", "v1", ",", "v2", ",", "DEFAUT_DIV_SCALE", ")", ";", "}" ]
提供(相对)精确的除法运算,当发生除不尽的情况的时候,精确到小数点后10位,后面的四舍五入 @param v1 被除数 @param v2 除数 @return 两个参数的商 @since 3.1.0
[ "提供", "(", "相对", ")", "精确的除法运算", "当发生除不尽的情况的时候", "精确到小数点后10位", "后面的四舍五入" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L539-L541
train
Divide two numbers.
[ 30522, 2270, 10763, 2502, 3207, 6895, 9067, 4487, 2615, 1006, 2193, 1058, 2487, 1010, 2193, 1058, 2475, 1007, 1063, 2709, 4487, 2615, 1006, 1058, 2487, 1010, 1058, 2475, 1010, 13366, 4887, 2102, 1035, 4487, 2615, 1035, 4094, 1007, 1025, 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/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/InsertDuplicateKeyUpdateClauseParser.java
InsertDuplicateKeyUpdateClauseParser.parse
public void parse(final InsertStatement insertStatement) { if (!lexerEngine.skipIfEqual(getCustomizedInsertKeywords())) { return; } lexerEngine.accept(DefaultKeyword.DUPLICATE); lexerEngine.accept(DefaultKeyword.KEY); lexerEngine.accept(DefaultKeyword.UPDATE); do { Column column = new Column(SQLUtil.getExactlyValue(lexerEngine.getCurrentToken().getLiterals()), insertStatement.getTables().getSingleTableName()); if (shardingRule.isShardingColumn(column.getName(), column.getTableName())) { throw new SQLParsingException("INSERT INTO .... ON DUPLICATE KEY UPDATE can not support on sharding column, token is '%s', literals is '%s'.", lexerEngine.getCurrentToken().getType(), lexerEngine.getCurrentToken().getLiterals()); } basicExpressionParser.parse(insertStatement); lexerEngine.accept(Symbol.EQ); if (lexerEngine.skipIfEqual(DefaultKeyword.VALUES)) { lexerEngine.accept(Symbol.LEFT_PAREN); basicExpressionParser.parse(insertStatement); lexerEngine.accept(Symbol.RIGHT_PAREN); } else { lexerEngine.nextToken(); } } while (lexerEngine.skipIfEqual(Symbol.COMMA)); }
java
public void parse(final InsertStatement insertStatement) { if (!lexerEngine.skipIfEqual(getCustomizedInsertKeywords())) { return; } lexerEngine.accept(DefaultKeyword.DUPLICATE); lexerEngine.accept(DefaultKeyword.KEY); lexerEngine.accept(DefaultKeyword.UPDATE); do { Column column = new Column(SQLUtil.getExactlyValue(lexerEngine.getCurrentToken().getLiterals()), insertStatement.getTables().getSingleTableName()); if (shardingRule.isShardingColumn(column.getName(), column.getTableName())) { throw new SQLParsingException("INSERT INTO .... ON DUPLICATE KEY UPDATE can not support on sharding column, token is '%s', literals is '%s'.", lexerEngine.getCurrentToken().getType(), lexerEngine.getCurrentToken().getLiterals()); } basicExpressionParser.parse(insertStatement); lexerEngine.accept(Symbol.EQ); if (lexerEngine.skipIfEqual(DefaultKeyword.VALUES)) { lexerEngine.accept(Symbol.LEFT_PAREN); basicExpressionParser.parse(insertStatement); lexerEngine.accept(Symbol.RIGHT_PAREN); } else { lexerEngine.nextToken(); } } while (lexerEngine.skipIfEqual(Symbol.COMMA)); }
[ "public", "void", "parse", "(", "final", "InsertStatement", "insertStatement", ")", "{", "if", "(", "!", "lexerEngine", ".", "skipIfEqual", "(", "getCustomizedInsertKeywords", "(", ")", ")", ")", "{", "return", ";", "}", "lexerEngine", ".", "accept", "(", "D...
Parse insert duplicate key update. @param insertStatement insert statement
[ "Parse", "insert", "duplicate", "key", "update", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/InsertDuplicateKeyUpdateClauseParser.java#L56-L79
train
Parse INSERT INTO... ON DUPLICATE KEY UPDATE...
[ 30522, 2270, 11675, 11968, 3366, 1006, 2345, 19274, 9153, 18532, 4765, 19274, 9153, 18532, 4765, 1007, 1063, 2065, 1006, 999, 17244, 7869, 3070, 3170, 1012, 13558, 29323, 26426, 1006, 2131, 7874, 20389, 3550, 7076, 8743, 14839, 22104, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/Broker.java
Broker.retrieveSharedQueue
private BlockingQueue<V> retrieveSharedQueue(String key) { BlockingQueue<V> queue = mediations.get(key); if (queue == null) { queue = new ArrayBlockingQueue<V>(1); BlockingQueue<V> commonQueue = mediations.putIfAbsent(key, queue); return commonQueue != null ? commonQueue : queue; } else { return queue; } }
java
private BlockingQueue<V> retrieveSharedQueue(String key) { BlockingQueue<V> queue = mediations.get(key); if (queue == null) { queue = new ArrayBlockingQueue<V>(1); BlockingQueue<V> commonQueue = mediations.putIfAbsent(key, queue); return commonQueue != null ? commonQueue : queue; } else { return queue; } }
[ "private", "BlockingQueue", "<", "V", ">", "retrieveSharedQueue", "(", "String", "key", ")", "{", "BlockingQueue", "<", "V", ">", "queue", "=", "mediations", ".", "get", "(", "key", ")", ";", "if", "(", "queue", "==", "null", ")", "{", "queue", "=", ...
Thread-safe call to get a shared {@link BlockingQueue}.
[ "Thread", "-", "safe", "call", "to", "get", "a", "shared", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/Broker.java#L75-L84
train
Retrieve a shared queue.
[ 30522, 2797, 10851, 4226, 5657, 1026, 1058, 1028, 12850, 7377, 5596, 4226, 5657, 1006, 5164, 3145, 1007, 1063, 10851, 4226, 5657, 1026, 1058, 1028, 24240, 1027, 26435, 2015, 1012, 2131, 1006, 3145, 1007, 1025, 2065, 1006, 24240, 1027, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/TriangleListing.java
TriangleListing.runInternal
@Override public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input) throws Exception { // u, v, bitmask where u < v DataSet<Tuple3<K, K, ByteValue>> filteredByID = input .getEdges() .map(new OrderByID<>()) .setParallelism(parallelism) .name("Order by ID") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by ID"); // u, v, (deg(u), deg(v)) DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> pairDegrees = input .run(new EdgeDegreesPair<K, VV, EV>() .setParallelism(parallelism)); // u, v, bitmask where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, K, ByteValue>> filteredByDegree = pairDegrees .map(new OrderByDegree<>()) .setParallelism(parallelism) .name("Order by degree") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by degree"); // u, v, w, bitmask where (u, v) and (u, w) are edges in graph DataSet<Tuple4<K, K, K, ByteValue>> triplets = filteredByDegree .groupBy(0) .sortGroup(1, Order.ASCENDING) .reduceGroup(new GenerateTriplets<>()) .name("Generate triplets"); // u, v, w, bitmask where (u, v), (u, w), and (v, w) are edges in graph DataSet<Result<K>> triangles = triplets .join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND) .where(1, 2) .equalTo(0, 1) .with(new ProjectTriangles<>()) .name("Triangle listing"); if (permuteResults) { triangles = triangles .flatMap(new PermuteResult<>()) .name("Permute triangle vertices"); } else if (sortTriangleVertices.get()) { triangles = triangles .map(new SortTriangleVertices<>()) .name("Sort triangle vertices"); } return triangles; }
java
@Override public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input) throws Exception { // u, v, bitmask where u < v DataSet<Tuple3<K, K, ByteValue>> filteredByID = input .getEdges() .map(new OrderByID<>()) .setParallelism(parallelism) .name("Order by ID") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by ID"); // u, v, (deg(u), deg(v)) DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> pairDegrees = input .run(new EdgeDegreesPair<K, VV, EV>() .setParallelism(parallelism)); // u, v, bitmask where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, K, ByteValue>> filteredByDegree = pairDegrees .map(new OrderByDegree<>()) .setParallelism(parallelism) .name("Order by degree") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by degree"); // u, v, w, bitmask where (u, v) and (u, w) are edges in graph DataSet<Tuple4<K, K, K, ByteValue>> triplets = filteredByDegree .groupBy(0) .sortGroup(1, Order.ASCENDING) .reduceGroup(new GenerateTriplets<>()) .name("Generate triplets"); // u, v, w, bitmask where (u, v), (u, w), and (v, w) are edges in graph DataSet<Result<K>> triangles = triplets .join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND) .where(1, 2) .equalTo(0, 1) .with(new ProjectTriangles<>()) .name("Triangle listing"); if (permuteResults) { triangles = triangles .flatMap(new PermuteResult<>()) .name("Permute triangle vertices"); } else if (sortTriangleVertices.get()) { triangles = triangles .map(new SortTriangleVertices<>()) .name("Sort triangle vertices"); } return triangles; }
[ "@", "Override", "public", "DataSet", "<", "Result", "<", "K", ">", ">", "runInternal", "(", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "input", ")", "throws", "Exception", "{", "// u, v, bitmask where u < v", "DataSet", "<", "Tuple3", "<", "K", ",", ...
/* Implementation notes: The requirement that "K extends CopyableValue<K>" can be removed when Flink has a self-join and GenerateTriplets is implemented as such. ProjectTriangles should eventually be replaced by ".projectFirst("*")" when projections use code generation.
[ "/", "*", "Implementation", "notes", ":" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/TriangleListing.java#L81-L136
train
This method is used to run the H2O algorithm on the input Graph.
[ 30522, 1030, 2058, 15637, 2270, 2951, 13462, 1026, 2765, 1026, 1047, 1028, 1028, 2448, 18447, 11795, 2389, 1006, 10629, 1026, 1047, 1010, 1058, 2615, 1010, 23408, 1028, 7953, 1007, 11618, 6453, 1063, 1013, 1013, 1057, 1010, 1058, 1010, 2978...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.setValidatedNodeType
@SuppressWarnings("deprecation") public final void setValidatedNodeType(SqlNode node, RelDataType type) { Objects.requireNonNull(type); Objects.requireNonNull(node); if (type.equals(unknownType)) { // don't set anything until we know what it is, and don't overwrite // a known type with the unknown type return; } nodeToTypeMap.put(node, type); }
java
@SuppressWarnings("deprecation") public final void setValidatedNodeType(SqlNode node, RelDataType type) { Objects.requireNonNull(type); Objects.requireNonNull(node); if (type.equals(unknownType)) { // don't set anything until we know what it is, and don't overwrite // a known type with the unknown type return; } nodeToTypeMap.put(node, type); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "final", "void", "setValidatedNodeType", "(", "SqlNode", "node", ",", "RelDataType", "type", ")", "{", "Objects", ".", "requireNonNull", "(", "type", ")", ";", "Objects", ".", "requireNonNull", "(",...
Saves the type of a {@link SqlNode}, now that it has been validated. <p>Unlike the base class method, this method is not deprecated. It is available from within Calcite, but is not part of the public API. @param node A SQL parse tree node, never null @param type Its type; must not be null
[ "Saves", "the", "type", "of", "a", "{", "@link", "SqlNode", "}", "now", "that", "it", "has", "been", "validated", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1598-L1608
train
Sets the validated type for the given node.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 2139, 28139, 10719, 1000, 1007, 2270, 2345, 11675, 2275, 10175, 8524, 3064, 3630, 3207, 13874, 1006, 29296, 3630, 3207, 13045, 1010, 2128, 15150, 29336, 18863, 2828, 1007, 1063, 5200, 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-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java
CsvReader.types
public <T0, T1> DataSource<Tuple2<T0, T1>> types(Class<T0> type0, Class<T1> type1) { TupleTypeInfo<Tuple2<T0, T1>> types = TupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(type0, type1); CsvInputFormat<Tuple2<T0, T1>> inputFormat = new TupleCsvInputFormat<Tuple2<T0, T1>>(path, types, this.includedMask); configureInputFormat(inputFormat); return new DataSource<Tuple2<T0, T1>>(executionContext, inputFormat, types, Utils.getCallLocationName()); }
java
public <T0, T1> DataSource<Tuple2<T0, T1>> types(Class<T0> type0, Class<T1> type1) { TupleTypeInfo<Tuple2<T0, T1>> types = TupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(type0, type1); CsvInputFormat<Tuple2<T0, T1>> inputFormat = new TupleCsvInputFormat<Tuple2<T0, T1>>(path, types, this.includedMask); configureInputFormat(inputFormat); return new DataSource<Tuple2<T0, T1>>(executionContext, inputFormat, types, Utils.getCallLocationName()); }
[ "public", "<", "T0", ",", "T1", ">", "DataSource", "<", "Tuple2", "<", "T0", ",", "T1", ">", ">", "types", "(", "Class", "<", "T0", ">", "type0", ",", "Class", "<", "T1", ">", "type1", ")", "{", "TupleTypeInfo", "<", "Tuple2", "<", "T0", ",", "...
Specifies the types for the CSV fields. This method parses the CSV data to a 2-tuple which has fields of the specified types. This method is overloaded for each possible length of the tuples to support type safe creation of data sets through CSV parsing. @param type0 The type of CSV field 0 and the type of field 0 in the returned tuple type. @param type1 The type of CSV field 1 and the type of field 1 in the returned tuple type. @return The {@link org.apache.flink.api.java.DataSet} representing the parsed CSV data.
[ "Specifies", "the", "types", "for", "the", "CSV", "fields", ".", "This", "method", "parses", "the", "CSV", "data", "to", "a", "2", "-", "tuple", "which", "has", "fields", "of", "the", "specified", "types", ".", "This", "method", "is", "overloaded", "for"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L409-L414
train
Creates a DataSource that contains tuples of the given type.
[ 30522, 2270, 1026, 1056, 2692, 1010, 1056, 2487, 1028, 2951, 6499, 3126, 3401, 1026, 10722, 10814, 2475, 1026, 1056, 2692, 1010, 1056, 2487, 1028, 1028, 4127, 1006, 2465, 1026, 1056, 2692, 1028, 2828, 2692, 1010, 2465, 1026, 1056, 2487, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java
Restarter.relaunch
protected Throwable relaunch(ClassLoader classLoader) throws Exception { RestartLauncher launcher = new RestartLauncher(classLoader, this.mainClassName, this.args, this.exceptionHandler); launcher.start(); launcher.join(); return launcher.getError(); }
java
protected Throwable relaunch(ClassLoader classLoader) throws Exception { RestartLauncher launcher = new RestartLauncher(classLoader, this.mainClassName, this.args, this.exceptionHandler); launcher.start(); launcher.join(); return launcher.getError(); }
[ "protected", "Throwable", "relaunch", "(", "ClassLoader", "classLoader", ")", "throws", "Exception", "{", "RestartLauncher", "launcher", "=", "new", "RestartLauncher", "(", "classLoader", ",", "this", ".", "mainClassName", ",", "this", ".", "args", ",", "this", ...
Relaunch the application using the specified classloader. @param classLoader the classloader to use @return any exception that caused the launch to fail or {@code null} @throws Exception in case of errors
[ "Relaunch", "the", "application", "using", "the", "specified", "classloader", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java#L295-L301
train
Relaunch the application.
[ 30522, 5123, 5466, 3085, 2128, 17298, 12680, 1006, 2465, 11066, 2121, 2465, 11066, 2121, 1007, 11618, 6453, 1063, 23818, 17298, 26091, 2099, 22742, 1027, 2047, 23818, 17298, 26091, 2099, 1006, 2465, 11066, 2121, 1010, 2023, 1012, 2364, 26266,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/JSONTokener.java
JSONTokener.nextString
public String nextString(char quote) throws JSONException { char c; StringBuilder sb = new StringBuilder(); for (;;) { c = this.next(); switch (c) { case 0: case '\n': case '\r': throw this.syntaxError("Unterminated string"); case '\\':// 转义符 c = this.next(); switch (c) { case 'b': sb.append('\b'); break; case 't': sb.append('\t'); break; case 'n': sb.append('\n'); break; case 'f': sb.append('\f'); break; case 'r': sb.append('\r'); break; case 'u':// Unicode符 sb.append((char) Integer.parseInt(this.next(4), 16)); break; case '"': case '\'': case '\\': case '/': sb.append(c); break; default: throw this.syntaxError("Illegal escape."); } break; default: if (c == quote) { return sb.toString(); } sb.append(c); } } }
java
public String nextString(char quote) throws JSONException { char c; StringBuilder sb = new StringBuilder(); for (;;) { c = this.next(); switch (c) { case 0: case '\n': case '\r': throw this.syntaxError("Unterminated string"); case '\\':// 转义符 c = this.next(); switch (c) { case 'b': sb.append('\b'); break; case 't': sb.append('\t'); break; case 'n': sb.append('\n'); break; case 'f': sb.append('\f'); break; case 'r': sb.append('\r'); break; case 'u':// Unicode符 sb.append((char) Integer.parseInt(this.next(4), 16)); break; case '"': case '\'': case '\\': case '/': sb.append(c); break; default: throw this.syntaxError("Illegal escape."); } break; default: if (c == quote) { return sb.toString(); } sb.append(c); } } }
[ "public", "String", "nextString", "(", "char", "quote", ")", "throws", "JSONException", "{", "char", "c", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", ";", ";", ")", "{", "c", "=", "this", ".", "next", "(", ")",...
返回当前位置到指定引号前的所有字符,反斜杠的转义符也会被处理。<br> 标准的JSON是不允许使用单引号包含字符串的,但是此实现允许。 @param quote 字符引号, 包括 <code>"</code>(双引号) 或 <code>'</code>(单引号)。 @return 截止到引号前的字符串 @throws JSONException 出现无结束的字符串时抛出此异常
[ "返回当前位置到指定引号前的所有字符,反斜杠的转义符也会被处理。<br", ">", "标准的JSON是不允许使用单引号包含字符串的,但是此实现允许。" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONTokener.java#L200-L248
train
Returns the next string in the JSON stream.
[ 30522, 2270, 5164, 2279, 3367, 4892, 1006, 25869, 14686, 1007, 11618, 1046, 3385, 10288, 24422, 1063, 30524, 1005, 1024, 5466, 2023, 1012, 20231, 2121, 29165, 1006, 1000, 4895, 3334, 26972, 5164, 1000, 1007, 1025, 2553, 1005, 1032, 1032, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterSource.java
TwitterSource.setCustomEndpointInitializer
public void setCustomEndpointInitializer(EndpointInitializer initializer) { Objects.requireNonNull(initializer, "Initializer has to be set"); ClosureCleaner.ensureSerializable(initializer); this.initializer = initializer; }
java
public void setCustomEndpointInitializer(EndpointInitializer initializer) { Objects.requireNonNull(initializer, "Initializer has to be set"); ClosureCleaner.ensureSerializable(initializer); this.initializer = initializer; }
[ "public", "void", "setCustomEndpointInitializer", "(", "EndpointInitializer", "initializer", ")", "{", "Objects", ".", "requireNonNull", "(", "initializer", ",", "\"Initializer has to be set\"", ")", ";", "ClosureCleaner", ".", "ensureSerializable", "(", "initializer", ")...
Set a custom endpoint initializer.
[ "Set", "a", "custom", "endpoint", "initializer", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterSource.java#L106-L110
train
Sets the custom endpoint initializer.
[ 30522, 2270, 11675, 2275, 7874, 20389, 10497, 8400, 5498, 20925, 17629, 1006, 2203, 8400, 5498, 20925, 17629, 3988, 17629, 1007, 1063, 5200, 1012, 5478, 8540, 11231, 3363, 1006, 3988, 17629, 1010, 1000, 3988, 17629, 2038, 2000, 2022, 2275, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/Segment.java
Segment.convert
protected static List<Term> convert(List<Vertex> vertexList, boolean offsetEnabled) { assert vertexList != null; assert vertexList.size() >= 2 : "这条路径不应当短于2" + vertexList.toString(); int length = vertexList.size() - 2; List<Term> resultList = new ArrayList<Term>(length); Iterator<Vertex> iterator = vertexList.iterator(); iterator.next(); if (offsetEnabled) { int offset = 0; for (int i = 0; i < length; ++i) { Vertex vertex = iterator.next(); Term term = convert(vertex); term.offset = offset; offset += term.length(); resultList.add(term); } } else { for (int i = 0; i < length; ++i) { Vertex vertex = iterator.next(); Term term = convert(vertex); resultList.add(term); } } return resultList; }
java
protected static List<Term> convert(List<Vertex> vertexList, boolean offsetEnabled) { assert vertexList != null; assert vertexList.size() >= 2 : "这条路径不应当短于2" + vertexList.toString(); int length = vertexList.size() - 2; List<Term> resultList = new ArrayList<Term>(length); Iterator<Vertex> iterator = vertexList.iterator(); iterator.next(); if (offsetEnabled) { int offset = 0; for (int i = 0; i < length; ++i) { Vertex vertex = iterator.next(); Term term = convert(vertex); term.offset = offset; offset += term.length(); resultList.add(term); } } else { for (int i = 0; i < length; ++i) { Vertex vertex = iterator.next(); Term term = convert(vertex); resultList.add(term); } } return resultList; }
[ "protected", "static", "List", "<", "Term", ">", "convert", "(", "List", "<", "Vertex", ">", "vertexList", ",", "boolean", "offsetEnabled", ")", "{", "assert", "vertexList", "!=", "null", ";", "assert", "vertexList", ".", "size", "(", ")", ">=", "2", ":"...
将一条路径转为最终结果 @param vertexList @param offsetEnabled 是否计算offset @return
[ "将一条路径转为最终结果" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L358-L388
train
Convert a list of Vertex objects to a list of Term objects.
[ 30522, 5123, 10763, 2862, 1026, 2744, 1028, 10463, 1006, 2862, 1026, 19449, 1028, 19449, 9863, 1010, 22017, 20898, 16396, 8189, 23242, 1007, 1063, 20865, 19449, 9863, 999, 1027, 19701, 1025, 20865, 19449, 9863, 1012, 2946, 1006, 1007, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getFieldValue
public static Object getFieldValue(Object obj, Field field) throws UtilException { if (null == obj || null == field) { return null; } field.setAccessible(true); Object result = null; try { result = field.get(obj); } catch (IllegalAccessException e) { throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName()); } return result; }
java
public static Object getFieldValue(Object obj, Field field) throws UtilException { if (null == obj || null == field) { return null; } field.setAccessible(true); Object result = null; try { result = field.get(obj); } catch (IllegalAccessException e) { throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName()); } return result; }
[ "public", "static", "Object", "getFieldValue", "(", "Object", "obj", ",", "Field", "field", ")", "throws", "UtilException", "{", "if", "(", "null", "==", "obj", "||", "null", "==", "field", ")", "{", "return", "null", ";", "}", "field", ".", "setAccessib...
获取字段值 @param obj 对象 @param field 字段 @return 字段值 @throws UtilException 包装IllegalAccessException异常
[ "获取字段值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L194-L206
train
Gets the value of a field from an object.
[ 30522, 2270, 10763, 4874, 2131, 3790, 10175, 5657, 1006, 4874, 27885, 3501, 1010, 2492, 2492, 1007, 11618, 21183, 9463, 2595, 24422, 1063, 2065, 1006, 19701, 1027, 1027, 27885, 3501, 1064, 1064, 19701, 1027, 1027, 2492, 1007, 1063, 2709, 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...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.readDelimiterStandard
private static String readDelimiterStandard(ByteBuf undecodedChunk, String delimiter) { int readerIndex = undecodedChunk.readerIndex(); try { StringBuilder sb = new StringBuilder(64); int delimiterPos = 0; int len = delimiter.length(); while (undecodedChunk.isReadable() && delimiterPos < len) { byte nextByte = undecodedChunk.readByte(); if (nextByte == delimiter.charAt(delimiterPos)) { delimiterPos++; sb.append((char) nextByte); } else { // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } // Now check if either opening delimiter or closing delimiter if (undecodedChunk.isReadable()) { byte nextByte = undecodedChunk.readByte(); // first check for opening delimiter if (nextByte == HttpConstants.CR) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // error since CR must be followed by LF // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } else if (nextByte == HttpConstants.LF) { return sb.toString(); } else if (nextByte == '-') { sb.append('-'); // second check for closing delimiter nextByte = undecodedChunk.readByte(); if (nextByte == '-') { sb.append('-'); // now try to find if CRLF or LF there if (undecodedChunk.isReadable()) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // error CR without LF // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } else if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // No CRLF but ok however (Adobe Flash uploader) // minus 1 since we read one char ahead but // should not undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); return sb.toString(); } } // FIXME what do we do here? // either considering it is fine, either waiting for // more data to come? // lets try considering it is fine... return sb.toString(); } // only one '-' => not enough // whatever now => error since incomplete } } } catch (IndexOutOfBoundsException e) { undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(e); } undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); }
java
private static String readDelimiterStandard(ByteBuf undecodedChunk, String delimiter) { int readerIndex = undecodedChunk.readerIndex(); try { StringBuilder sb = new StringBuilder(64); int delimiterPos = 0; int len = delimiter.length(); while (undecodedChunk.isReadable() && delimiterPos < len) { byte nextByte = undecodedChunk.readByte(); if (nextByte == delimiter.charAt(delimiterPos)) { delimiterPos++; sb.append((char) nextByte); } else { // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } // Now check if either opening delimiter or closing delimiter if (undecodedChunk.isReadable()) { byte nextByte = undecodedChunk.readByte(); // first check for opening delimiter if (nextByte == HttpConstants.CR) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // error since CR must be followed by LF // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } else if (nextByte == HttpConstants.LF) { return sb.toString(); } else if (nextByte == '-') { sb.append('-'); // second check for closing delimiter nextByte = undecodedChunk.readByte(); if (nextByte == '-') { sb.append('-'); // now try to find if CRLF or LF there if (undecodedChunk.isReadable()) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // error CR without LF // delimiter not found so break here ! undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); } } else if (nextByte == HttpConstants.LF) { return sb.toString(); } else { // No CRLF but ok however (Adobe Flash uploader) // minus 1 since we read one char ahead but // should not undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); return sb.toString(); } } // FIXME what do we do here? // either considering it is fine, either waiting for // more data to come? // lets try considering it is fine... return sb.toString(); } // only one '-' => not enough // whatever now => error since incomplete } } } catch (IndexOutOfBoundsException e) { undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(e); } undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); }
[ "private", "static", "String", "readDelimiterStandard", "(", "ByteBuf", "undecodedChunk", ",", "String", "delimiter", ")", "{", "int", "readerIndex", "=", "undecodedChunk", ".", "readerIndex", "(", ")", ";", "try", "{", "StringBuilder", "sb", "=", "new", "String...
Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF Read one line up to --delimiter or --delimiter-- and if existing the CRLF or LF. Note that CRLF or LF are mandatory for opening delimiter (--delimiter) but not for closing delimiter (--delimiter--) since some clients does not include CRLF in this case. @param delimiter of the form --string, such that '--' is already included @return the String from one line as the delimiter searched (opening or closing) @throws NotEnoughDataDecoderException Need more chunks and reset the {@code readerIndex} to the previous value
[ "Read", "one", "line", "up", "to", "--", "delimiter", "or", "--", "delimiter", "--", "and", "if", "existing", "the", "CRLF", "or", "LF", "Read", "one", "line", "up", "to", "--", "delimiter", "or", "--", "delimiter", "--", "and", "if", "existing", "the"...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1086-L1164
train
Reads the standard delimiter from the given byte buffer.
[ 30522, 2797, 10763, 5164, 3191, 9247, 27605, 7747, 5794, 7662, 2094, 1006, 24880, 8569, 2546, 6151, 8586, 10244, 16409, 17157, 2243, 1010, 5164, 3972, 27605, 3334, 1007, 1063, 20014, 8068, 22254, 10288, 1027, 6151, 8586, 10244, 16409, 17157, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java
SqlBuilder.join
public SqlBuilder join(String tableName, Join join) { if (StrUtil.isBlank(tableName)) { throw new DbRuntimeException("Table name is blank !"); } if (null != join) { sql.append(StrUtil.SPACE).append(join).append(" JOIN "); if (null != wrapper) { // 包装表名 tableName = wrapper.wrap(tableName); } sql.append(tableName); } return this; }
java
public SqlBuilder join(String tableName, Join join) { if (StrUtil.isBlank(tableName)) { throw new DbRuntimeException("Table name is blank !"); } if (null != join) { sql.append(StrUtil.SPACE).append(join).append(" JOIN "); if (null != wrapper) { // 包装表名 tableName = wrapper.wrap(tableName); } sql.append(tableName); } return this; }
[ "public", "SqlBuilder", "join", "(", "String", "tableName", ",", "Join", "join", ")", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "tableName", ")", ")", "{", "throw", "new", "DbRuntimeException", "(", "\"Table name is blank !\"", ")", ";", "}", "if", "...
多表关联 @param tableName 被关联的表名 @param join 内联方式 @return 自己
[ "多表关联" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L439-L453
train
Appends a JOIN clause to the SQL statement.
[ 30522, 2270, 29296, 8569, 23891, 2099, 3693, 1006, 5164, 2795, 18442, 1010, 3693, 3693, 1007, 1063, 2065, 1006, 2358, 22134, 4014, 1012, 2003, 28522, 8950, 1006, 2795, 18442, 1007, 1007, 1063, 5466, 2047, 16962, 15532, 7292, 10288, 24422, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
AllWindowedStream.reduce
@PublicEvolving public <R> SingleOutputStreamOperator<R> reduce( ReduceFunction<T> reduceFunction, AllWindowFunction<T, R, W> function) { TypeInformation<T> inType = input.getType(); TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, inType); return reduce(reduceFunction, function, resultType); }
java
@PublicEvolving public <R> SingleOutputStreamOperator<R> reduce( ReduceFunction<T> reduceFunction, AllWindowFunction<T, R, W> function) { TypeInformation<T> inType = input.getType(); TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, inType); return reduce(reduceFunction, function, resultType); }
[ "@", "PublicEvolving", "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "reduce", "(", "ReduceFunction", "<", "T", ">", "reduceFunction", ",", "AllWindowFunction", "<", "T", ",", "R", ",", "W", ">", "function", ")", "{", "TypeInformation...
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>Arriving data is incrementally aggregated using the given reducer. @param reduceFunction The reduce function that is used for incremental aggregation. @param function 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/AllWindowedStream.java#L232-L241
train
Returns a new stream that combines the results of applying the given reduce function and all window functions.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 1026, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 5547, 1006, 5547, 11263, 27989, 1026, 1056, 1028, 5547, 11263, 27989, 1010, 2035, 11101, 5004, 11263, 27989, 1026, 1056, 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/collection/CollUtil.java
CollUtil.toMapList
public static <K, V> List<Map<K, V>> toMapList(Map<K, ? extends Iterable<V>> listMap) { return MapUtil.toMapList(listMap); }
java
public static <K, V> List<Map<K, V>> toMapList(Map<K, ? extends Iterable<V>> listMap) { return MapUtil.toMapList(listMap); }
[ "public", "static", "<", "K", ",", "V", ">", "List", "<", "Map", "<", "K", ",", "V", ">", ">", "toMapList", "(", "Map", "<", "K", ",", "?", "extends", "Iterable", "<", "V", ">", ">", "listMap", ")", "{", "return", "MapUtil", ".", "toMapList", "...
列转行。将Map中值列表分别按照其位置与key组成新的map。<br> 是{@link #toListMap(Iterable)}的逆方法<br> 比如传入数据: <pre> { a: [1,2,3,4] b: [1,2,3,] c: [1] } </pre> 结果是: <pre> [ {a: 1, b: 1, c: 1} {a: 2, b: 2} {a: 3, b: 3} {a: 4} ] </pre> @param <K> 键类型 @param <V> 值类型 @param listMap 列表Map @return Map列表 @see MapUtil#toMapList(Map)
[ "列转行。将Map中值列表分别按照其位置与key组成新的map。<br", ">", "是", "{", "@link", "#toListMap", "(", "Iterable", ")", "}", "的逆方法<br", ">", "比如传入数据:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1677-L1679
train
Converts a Map to a List of Maps.
[ 30522, 2270, 10763, 1026, 1047, 1010, 1058, 1028, 2862, 1026, 4949, 1026, 1047, 1010, 1058, 1028, 1028, 3419, 9331, 9863, 1006, 4949, 1026, 1047, 1010, 1029, 8908, 2009, 6906, 3468, 1026, 1058, 1028, 1028, 2862, 2863, 2361, 1007, 1063, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java
ServletListenerRegistrationBean.isSupportedType
public static boolean isSupportedType(EventListener listener) { for (Class<?> type : SUPPORTED_TYPES) { if (ClassUtils.isAssignableValue(type, listener)) { return true; } } return false; }
java
public static boolean isSupportedType(EventListener listener) { for (Class<?> type : SUPPORTED_TYPES) { if (ClassUtils.isAssignableValue(type, listener)) { return true; } } return false; }
[ "public", "static", "boolean", "isSupportedType", "(", "EventListener", "listener", ")", "{", "for", "(", "Class", "<", "?", ">", "type", ":", "SUPPORTED_TYPES", ")", "{", "if", "(", "ClassUtils", ".", "isAssignableValue", "(", "type", ",", "listener", ")", ...
Returns {@code true} if the specified listener is one of the supported types. @param listener the listener to test @return if the listener is of a supported type
[ "Returns", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java#L131-L138
train
Checks if the given listener is an instance of a supported type.
[ 30522, 2270, 10763, 22017, 20898, 26354, 6279, 6442, 2098, 13874, 1006, 2724, 9863, 24454, 19373, 1007, 1063, 2005, 1006, 2465, 1026, 1029, 1028, 2828, 1024, 3569, 1035, 4127, 1007, 1063, 2065, 1006, 2465, 21823, 4877, 1012, 18061, 18719, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonSuffixExtractor.java
CommonSuffixExtractor.extractSuffix
public List<String> extractSuffix(int length, int size, boolean extend) { TFDictionary suffixTreeSet = new TFDictionary(); for (String key : tfDictionary.keySet()) { if (key.length() > length) { suffixTreeSet.add(key.substring(key.length() - length, key.length())); if (extend) { for (int l = 1; l < length; ++l) { suffixTreeSet.add(key.substring(key.length() - l, key.length())); } } } } if (extend) { size *= length; } return extract(suffixTreeSet, size); }
java
public List<String> extractSuffix(int length, int size, boolean extend) { TFDictionary suffixTreeSet = new TFDictionary(); for (String key : tfDictionary.keySet()) { if (key.length() > length) { suffixTreeSet.add(key.substring(key.length() - length, key.length())); if (extend) { for (int l = 1; l < length; ++l) { suffixTreeSet.add(key.substring(key.length() - l, key.length())); } } } } if (extend) { size *= length; } return extract(suffixTreeSet, size); }
[ "public", "List", "<", "String", ">", "extractSuffix", "(", "int", "length", ",", "int", "size", ",", "boolean", "extend", ")", "{", "TFDictionary", "suffixTreeSet", "=", "new", "TFDictionary", "(", ")", ";", "for", "(", "String", "key", ":", "tfDictionary...
提取公共后缀 @param length 公共后缀长度 @param size 频率最高的前多少个公共后缀 @param extend 长度是否拓展为从1到length为止的后缀 @return 公共后缀列表
[ "提取公共后缀" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonSuffixExtractor.java#L54-L78
train
Extract suffix from the TFDictionary.
[ 30522, 2270, 2862, 1026, 5164, 1028, 27059, 16093, 8873, 2595, 1006, 20014, 3091, 1010, 20014, 2946, 1010, 22017, 20898, 7949, 1007, 1063, 1056, 2546, 29201, 3258, 5649, 16809, 13334, 13462, 1027, 2047, 1056, 2546, 29201, 3258, 5649, 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...
redisson/redisson
redisson/src/main/java/org/redisson/api/CronSchedule.java
CronSchedule.weeklyOnDayAndHourAndMinute
public static CronSchedule weeklyOnDayAndHourAndMinute(int hour, int minute, Integer... daysOfWeek) { if (daysOfWeek == null || daysOfWeek.length == 0) { throw new IllegalArgumentException("You must specify at least one day of week."); } String expression = String.format("0 %d %d ? * %d", minute, hour, daysOfWeek[0]); for (int i = 1; i < daysOfWeek.length; i++) { expression = expression + "," + daysOfWeek[i]; } return of(expression); }
java
public static CronSchedule weeklyOnDayAndHourAndMinute(int hour, int minute, Integer... daysOfWeek) { if (daysOfWeek == null || daysOfWeek.length == 0) { throw new IllegalArgumentException("You must specify at least one day of week."); } String expression = String.format("0 %d %d ? * %d", minute, hour, daysOfWeek[0]); for (int i = 1; i < daysOfWeek.length; i++) { expression = expression + "," + daysOfWeek[i]; } return of(expression); }
[ "public", "static", "CronSchedule", "weeklyOnDayAndHourAndMinute", "(", "int", "hour", ",", "int", "minute", ",", "Integer", "...", "daysOfWeek", ")", "{", "if", "(", "daysOfWeek", "==", "null", "||", "daysOfWeek", ".", "length", "==", "0", ")", "{", "throw"...
Creates cron expression which schedule task execution every given days of the week at the given time. Use Calendar object constants to define day. @param hour of schedule @param minute of schedule @param daysOfWeek - Calendar object constants @return object
[ "Creates", "cron", "expression", "which", "schedule", "task", "execution", "every", "given", "days", "of", "the", "week", "at", "the", "given", "time", ".", "Use", "Calendar", "object", "constants", "to", "define", "day", "." ]
d3acc0249b2d5d658d36d99e2c808ce49332ea44
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/CronSchedule.java#L75-L86
train
Create a CronSchedule that schedules a single instance of a CronSchedule for a single hour and minute on a given number of days of the week.
[ 30522, 2270, 10763, 13675, 5644, 7690, 9307, 4882, 29067, 7054, 16425, 8162, 5685, 10020, 10421, 1006, 20014, 3178, 1010, 20014, 3371, 1010, 16109, 1012, 1012, 1012, 2420, 11253, 28075, 1007, 1063, 2065, 1006, 2420, 11253, 28075, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java
UnorderedStreamElementQueue.onCompleteHandler
public void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException { lock.lockInterruptibly(); try { if (firstSet.remove(streamElementQueueEntry)) { completedQueue.offer(streamElementQueueEntry); while (firstSet.isEmpty() && firstSet != lastSet) { firstSet = uncompletedQueue.poll(); Iterator<StreamElementQueueEntry<?>> it = firstSet.iterator(); while (it.hasNext()) { StreamElementQueueEntry<?> bufferEntry = it.next(); if (bufferEntry.isDone()) { completedQueue.offer(bufferEntry); it.remove(); } } } LOG.debug("Signal unordered stream element queue has completed entries."); hasCompletedEntries.signalAll(); } } finally { lock.unlock(); } }
java
public void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException { lock.lockInterruptibly(); try { if (firstSet.remove(streamElementQueueEntry)) { completedQueue.offer(streamElementQueueEntry); while (firstSet.isEmpty() && firstSet != lastSet) { firstSet = uncompletedQueue.poll(); Iterator<StreamElementQueueEntry<?>> it = firstSet.iterator(); while (it.hasNext()) { StreamElementQueueEntry<?> bufferEntry = it.next(); if (bufferEntry.isDone()) { completedQueue.offer(bufferEntry); it.remove(); } } } LOG.debug("Signal unordered stream element queue has completed entries."); hasCompletedEntries.signalAll(); } } finally { lock.unlock(); } }
[ "public", "void", "onCompleteHandler", "(", "StreamElementQueueEntry", "<", "?", ">", "streamElementQueueEntry", ")", "throws", "InterruptedException", "{", "lock", ".", "lockInterruptibly", "(", ")", ";", "try", "{", "if", "(", "firstSet", ".", "remove", "(", "...
Callback for onComplete events for the given stream element queue entry. Whenever a queue entry is completed, it is checked whether this entry belongs to the first set. If this is the case, then the element is added to the completed entries queue from where it can be consumed. If the first set becomes empty, then the next set is polled from the uncompleted entries queue. Completed entries from this new set are then added to the completed entries queue. @param streamElementQueueEntry which has been completed @throws InterruptedException if the current thread has been interrupted while performing the on complete callback.
[ "Callback", "for", "onComplete", "events", "for", "the", "given", "stream", "element", "queue", "entry", ".", "Whenever", "a", "queue", "entry", "is", "completed", "it", "is", "checked", "whether", "this", "entry", "belongs", "to", "the", "first", "set", "."...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java#L231-L259
train
Called when the stream element queue is complete.
[ 30522, 2270, 11675, 2006, 9006, 10814, 2618, 11774, 3917, 1006, 5460, 12260, 3672, 4226, 5657, 4765, 2854, 1026, 1029, 1028, 5460, 12260, 3672, 4226, 5657, 4765, 2854, 1007, 11618, 7153, 10288, 24422, 1063, 5843, 1012, 5843, 18447, 2121, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java
AWSUtil.createKinesisClient
public static AmazonKinesis createKinesisClient(Properties configProps, ClientConfiguration awsClientConfig) { // set a Flink-specific user agent awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT, EnvironmentInformation.getVersion(), EnvironmentInformation.getRevisionInformation().commitId)); // utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard() .withCredentials(AWSUtil.getCredentialsProvider(configProps)) .withClientConfiguration(awsClientConfig); if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) { // Set signingRegion as null, to facilitate mocking Kinesis for local tests builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration( configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT), null)); } else { builder.withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION))); } return builder.build(); }
java
public static AmazonKinesis createKinesisClient(Properties configProps, ClientConfiguration awsClientConfig) { // set a Flink-specific user agent awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT, EnvironmentInformation.getVersion(), EnvironmentInformation.getRevisionInformation().commitId)); // utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard() .withCredentials(AWSUtil.getCredentialsProvider(configProps)) .withClientConfiguration(awsClientConfig); if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) { // Set signingRegion as null, to facilitate mocking Kinesis for local tests builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration( configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT), null)); } else { builder.withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION))); } return builder.build(); }
[ "public", "static", "AmazonKinesis", "createKinesisClient", "(", "Properties", "configProps", ",", "ClientConfiguration", "awsClientConfig", ")", "{", "// set a Flink-specific user agent", "awsClientConfig", ".", "setUserAgentPrefix", "(", "String", ".", "format", "(", "USE...
Creates an Amazon Kinesis Client. @param configProps configuration properties containing the access key, secret key, and region @param awsClientConfig preconfigured AWS SDK client configuration @return a new Amazon Kinesis Client
[ "Creates", "an", "Amazon", "Kinesis", "Client", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java#L76-L96
train
Creates a Kinesis client using the specified properties.
[ 30522, 2270, 10763, 9733, 4939, 19009, 3443, 4939, 19009, 20464, 11638, 1006, 5144, 9530, 8873, 21600, 18981, 2015, 1010, 7396, 8663, 8873, 27390, 3370, 22091, 11020, 8751, 3372, 8663, 8873, 2290, 1007, 1063, 1013, 1013, 2275, 1037, 13109, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.insertBucketEntryFromStart
private void insertBucketEntryFromStart(MemorySegment bucket, int bucketInSegmentPos, int hashCode, long pointer, int partitionNumber) throws IOException { boolean checkForResize = false; // find the position to put the hash code and pointer final int count = bucket.getInt(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count < NUM_ENTRIES_PER_BUCKET) { // we are good in our current bucket, put the values bucket.putInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + (count * HASH_CODE_LEN), hashCode); // hash code bucket.putLong(bucketInSegmentPos + BUCKET_POINTER_START_OFFSET + (count * POINTER_LEN), pointer); // pointer bucket.putInt(bucketInSegmentPos + HEADER_COUNT_OFFSET, count + 1); // update count } else { // we need to go to the overflow buckets final InMemoryPartition<T> p = this.partitions.get(partitionNumber); final long originalForwardPointer = bucket.getLong(bucketInSegmentPos + HEADER_FORWARD_OFFSET); final long forwardForNewBucket; if (originalForwardPointer != BUCKET_FORWARD_POINTER_NOT_SET) { // forward pointer set final int overflowSegNum = (int) (originalForwardPointer >>> 32); final int segOffset = (int) originalForwardPointer; final MemorySegment seg = p.overflowSegments[overflowSegNum]; final int obCount = seg.getInt(segOffset + HEADER_COUNT_OFFSET); // check if there is space in this overflow bucket if (obCount < NUM_ENTRIES_PER_BUCKET) { // space in this bucket and we are done seg.putInt(segOffset + BUCKET_HEADER_LENGTH + (obCount * HASH_CODE_LEN), hashCode); // hash code seg.putLong(segOffset + BUCKET_POINTER_START_OFFSET + (obCount * POINTER_LEN), pointer); // pointer seg.putInt(segOffset + HEADER_COUNT_OFFSET, obCount + 1); // update count return; } else { // no space here, we need a new bucket. this current overflow bucket will be the // target of the new overflow bucket forwardForNewBucket = originalForwardPointer; } } else { // no overflow bucket yet, so we need a first one forwardForNewBucket = BUCKET_FORWARD_POINTER_NOT_SET; } // we need a new overflow bucket MemorySegment overflowSeg; final int overflowBucketNum; final int overflowBucketOffset; // first, see if there is space for an overflow bucket remaining in the last overflow segment if (p.nextOverflowBucket == 0) { // no space left in last bucket, or no bucket yet, so create an overflow segment overflowSeg = getNextBuffer(); overflowBucketOffset = 0; overflowBucketNum = p.numOverflowSegments; // add the new overflow segment if (p.overflowSegments.length <= p.numOverflowSegments) { MemorySegment[] newSegsArray = new MemorySegment[p.overflowSegments.length * 2]; System.arraycopy(p.overflowSegments, 0, newSegsArray, 0, p.overflowSegments.length); p.overflowSegments = newSegsArray; } p.overflowSegments[p.numOverflowSegments] = overflowSeg; p.numOverflowSegments++; checkForResize = true; } else { // there is space in the last overflow bucket overflowBucketNum = p.numOverflowSegments - 1; overflowSeg = p.overflowSegments[overflowBucketNum]; overflowBucketOffset = p.nextOverflowBucket << NUM_INTRA_BUCKET_BITS; } // next overflow bucket is one ahead. if the segment is full, the next will be at the beginning // of a new segment p.nextOverflowBucket = (p.nextOverflowBucket == this.bucketsPerSegmentMask ? 0 : p.nextOverflowBucket + 1); // insert the new overflow bucket in the chain of buckets // 1) set the old forward pointer // 2) let the bucket in the main table point to this one overflowSeg.putLong(overflowBucketOffset + HEADER_FORWARD_OFFSET, forwardForNewBucket); final long pointerToNewBucket = (((long) overflowBucketNum) << 32) | ((long) overflowBucketOffset); bucket.putLong(bucketInSegmentPos + HEADER_FORWARD_OFFSET, pointerToNewBucket); // finally, insert the values into the overflow buckets overflowSeg.putInt(overflowBucketOffset + BUCKET_HEADER_LENGTH, hashCode); // hash code overflowSeg.putLong(overflowBucketOffset + BUCKET_POINTER_START_OFFSET, pointer); // pointer // set the count to one overflowSeg.putInt(overflowBucketOffset + HEADER_COUNT_OFFSET, 1); if (checkForResize && !this.isResizing) { // check if we should resize buckets if (this.buckets.length <= getOverflowSegmentCount()) { resizeHashTable(); } } } }
java
private void insertBucketEntryFromStart(MemorySegment bucket, int bucketInSegmentPos, int hashCode, long pointer, int partitionNumber) throws IOException { boolean checkForResize = false; // find the position to put the hash code and pointer final int count = bucket.getInt(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count < NUM_ENTRIES_PER_BUCKET) { // we are good in our current bucket, put the values bucket.putInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + (count * HASH_CODE_LEN), hashCode); // hash code bucket.putLong(bucketInSegmentPos + BUCKET_POINTER_START_OFFSET + (count * POINTER_LEN), pointer); // pointer bucket.putInt(bucketInSegmentPos + HEADER_COUNT_OFFSET, count + 1); // update count } else { // we need to go to the overflow buckets final InMemoryPartition<T> p = this.partitions.get(partitionNumber); final long originalForwardPointer = bucket.getLong(bucketInSegmentPos + HEADER_FORWARD_OFFSET); final long forwardForNewBucket; if (originalForwardPointer != BUCKET_FORWARD_POINTER_NOT_SET) { // forward pointer set final int overflowSegNum = (int) (originalForwardPointer >>> 32); final int segOffset = (int) originalForwardPointer; final MemorySegment seg = p.overflowSegments[overflowSegNum]; final int obCount = seg.getInt(segOffset + HEADER_COUNT_OFFSET); // check if there is space in this overflow bucket if (obCount < NUM_ENTRIES_PER_BUCKET) { // space in this bucket and we are done seg.putInt(segOffset + BUCKET_HEADER_LENGTH + (obCount * HASH_CODE_LEN), hashCode); // hash code seg.putLong(segOffset + BUCKET_POINTER_START_OFFSET + (obCount * POINTER_LEN), pointer); // pointer seg.putInt(segOffset + HEADER_COUNT_OFFSET, obCount + 1); // update count return; } else { // no space here, we need a new bucket. this current overflow bucket will be the // target of the new overflow bucket forwardForNewBucket = originalForwardPointer; } } else { // no overflow bucket yet, so we need a first one forwardForNewBucket = BUCKET_FORWARD_POINTER_NOT_SET; } // we need a new overflow bucket MemorySegment overflowSeg; final int overflowBucketNum; final int overflowBucketOffset; // first, see if there is space for an overflow bucket remaining in the last overflow segment if (p.nextOverflowBucket == 0) { // no space left in last bucket, or no bucket yet, so create an overflow segment overflowSeg = getNextBuffer(); overflowBucketOffset = 0; overflowBucketNum = p.numOverflowSegments; // add the new overflow segment if (p.overflowSegments.length <= p.numOverflowSegments) { MemorySegment[] newSegsArray = new MemorySegment[p.overflowSegments.length * 2]; System.arraycopy(p.overflowSegments, 0, newSegsArray, 0, p.overflowSegments.length); p.overflowSegments = newSegsArray; } p.overflowSegments[p.numOverflowSegments] = overflowSeg; p.numOverflowSegments++; checkForResize = true; } else { // there is space in the last overflow bucket overflowBucketNum = p.numOverflowSegments - 1; overflowSeg = p.overflowSegments[overflowBucketNum]; overflowBucketOffset = p.nextOverflowBucket << NUM_INTRA_BUCKET_BITS; } // next overflow bucket is one ahead. if the segment is full, the next will be at the beginning // of a new segment p.nextOverflowBucket = (p.nextOverflowBucket == this.bucketsPerSegmentMask ? 0 : p.nextOverflowBucket + 1); // insert the new overflow bucket in the chain of buckets // 1) set the old forward pointer // 2) let the bucket in the main table point to this one overflowSeg.putLong(overflowBucketOffset + HEADER_FORWARD_OFFSET, forwardForNewBucket); final long pointerToNewBucket = (((long) overflowBucketNum) << 32) | ((long) overflowBucketOffset); bucket.putLong(bucketInSegmentPos + HEADER_FORWARD_OFFSET, pointerToNewBucket); // finally, insert the values into the overflow buckets overflowSeg.putInt(overflowBucketOffset + BUCKET_HEADER_LENGTH, hashCode); // hash code overflowSeg.putLong(overflowBucketOffset + BUCKET_POINTER_START_OFFSET, pointer); // pointer // set the count to one overflowSeg.putInt(overflowBucketOffset + HEADER_COUNT_OFFSET, 1); if (checkForResize && !this.isResizing) { // check if we should resize buckets if (this.buckets.length <= getOverflowSegmentCount()) { resizeHashTable(); } } } }
[ "private", "void", "insertBucketEntryFromStart", "(", "MemorySegment", "bucket", ",", "int", "bucketInSegmentPos", ",", "int", "hashCode", ",", "long", "pointer", ",", "int", "partitionNumber", ")", "throws", "IOException", "{", "boolean", "checkForResize", "=", "fa...
IMPORTANT!!! We pass only the partition number, because we must make sure we get a fresh partition reference. The partition reference used during search for the key may have become invalid during the compaction.
[ "IMPORTANT!!!", "We", "pass", "only", "the", "partition", "number", "because", "we", "must", "make", "sure", "we", "get", "a", "fresh", "partition", "reference", ".", "The", "partition", "reference", "used", "during", "search", "for", "the", "key", "may", "h...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java#L479-L578
train
Insert the bucket entry from the start of the given bucket.
[ 30522, 2797, 11675, 19274, 24204, 12870, 3372, 2854, 19699, 22225, 7559, 2102, 1006, 3638, 3366, 21693, 4765, 13610, 1010, 20014, 13610, 7076, 13910, 3672, 6873, 2015, 1010, 20014, 23325, 16044, 1010, 2146, 20884, 1010, 20014, 13571, 19172, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
redisson/redisson
redisson/src/main/java/org/redisson/api/BatchResult.java
BatchResult.addAll
@Deprecated public boolean addAll(int index, Collection<? extends E> c) { return responses.addAll(index, c); }
java
@Deprecated public boolean addAll(int index, Collection<? extends E> c) { return responses.addAll(index, c); }
[ "@", "Deprecated", "public", "boolean", "addAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "E", ">", "c", ")", "{", "return", "responses", ".", "addAll", "(", "index", ",", "c", ")", ";", "}" ]
Use {@link #getResponses()}
[ "Use", "{" ]
d3acc0249b2d5d658d36d99e2c808ce49332ea44
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/BatchResult.java#L140-L143
train
Add all the elements in the Collection to the list.
[ 30522, 1030, 2139, 28139, 12921, 2270, 22017, 20898, 5587, 8095, 1006, 20014, 5950, 1010, 3074, 1026, 1029, 8908, 1041, 1028, 1039, 1007, 1063, 2709, 10960, 1012, 5587, 8095, 1006, 5950, 1010, 1039, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseEncoder.java
DatagramDnsResponseEncoder.allocateBuffer
protected ByteBuf allocateBuffer( ChannelHandlerContext ctx, @SuppressWarnings("unused") AddressedEnvelope<DnsResponse, InetSocketAddress> msg) throws Exception { return ctx.alloc().ioBuffer(1024); }
java
protected ByteBuf allocateBuffer( ChannelHandlerContext ctx, @SuppressWarnings("unused") AddressedEnvelope<DnsResponse, InetSocketAddress> msg) throws Exception { return ctx.alloc().ioBuffer(1024); }
[ "protected", "ByteBuf", "allocateBuffer", "(", "ChannelHandlerContext", "ctx", ",", "@", "SuppressWarnings", "(", "\"unused\"", ")", "AddressedEnvelope", "<", "DnsResponse", ",", "InetSocketAddress", ">", "msg", ")", "throws", "Exception", "{", "return", "ctx", ".",...
Allocate a {@link ByteBuf} which will be used for constructing a datagram packet. Sub-classes may override this method to return a {@link ByteBuf} with a perfect matching initial capacity.
[ "Allocate", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseEncoder.java#L85-L89
train
Allocate a buffer for a single record.
[ 30522, 5123, 24880, 8569, 2546, 2035, 24755, 2618, 8569, 12494, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 15171, 1000, 1007, 8280, 2368, 15985, 17635, 1026, 1040, 3619, 6072, 26029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/SimpleSlot.java
SimpleSlot.tryAssignPayload
@Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
java
@Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
[ "@", "Override", "public", "boolean", "tryAssignPayload", "(", "Payload", "payload", ")", "{", "Preconditions", ".", "checkNotNull", "(", "payload", ")", ";", "// check that we can actually run in this slot", "if", "(", "isCanceled", "(", ")", ")", "{", "return", ...
Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. @param payload The vertex to assign to this slot. @return True, if the vertex was assigned, false, otherwise.
[ "Atomically", "sets", "the", "executed", "vertex", "if", "no", "vertex", "has", "been", "assigned", "to", "this", "slot", "so", "far", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SimpleSlot.java#L171-L192
train
Try to assign a payload to this vertex.
[ 30522, 1030, 2058, 15637, 2270, 22017, 20898, 3046, 12054, 23773, 4502, 8516, 10441, 2094, 1006, 18093, 18093, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 18093, 1007, 1025, 1013, 1013, 4638, 2008, 2057, 2064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ThriftHttpServlet.java
ThriftHttpServlet.getClientNameFromCookie
private String getClientNameFromCookie(Cookie[] cookies) { // Current Cookie Name, Current Cookie Value String currName, currValue; // Following is the main loop which iterates through all the cookies send by the client. // The HS2 generated cookies are of the format hive.server2.auth=<value> // A cookie which is identified as a hiveserver2 generated cookie is validated // by calling signer.verifyAndExtract(). If the validation passes, send the // username for which the cookie is validated to the caller. If no client side // cookie passes the validation, return null to the caller. for (Cookie currCookie : cookies) { // Get the cookie name currName = currCookie.getName(); if (!currName.equals(AUTH_COOKIE)) { // Not a HS2 generated cookie, continue. continue; } // If we reached here, we have match for HS2 generated cookie currValue = currCookie.getValue(); // Validate the value. currValue = signer.verifyAndExtract(currValue); // Retrieve the user name, do the final validation step. if (currValue != null) { String userName = HttpAuthUtils.getUserNameFromCookieToken(currValue); if (userName == null) { LOG.warn("Invalid cookie token " + currValue); continue; } //We have found a valid cookie in the client request. if (LOG.isDebugEnabled()) { LOG.debug("Validated the cookie for user " + userName); } return userName; } } // No valid HS2 generated cookies found, return null return null; }
java
private String getClientNameFromCookie(Cookie[] cookies) { // Current Cookie Name, Current Cookie Value String currName, currValue; // Following is the main loop which iterates through all the cookies send by the client. // The HS2 generated cookies are of the format hive.server2.auth=<value> // A cookie which is identified as a hiveserver2 generated cookie is validated // by calling signer.verifyAndExtract(). If the validation passes, send the // username for which the cookie is validated to the caller. If no client side // cookie passes the validation, return null to the caller. for (Cookie currCookie : cookies) { // Get the cookie name currName = currCookie.getName(); if (!currName.equals(AUTH_COOKIE)) { // Not a HS2 generated cookie, continue. continue; } // If we reached here, we have match for HS2 generated cookie currValue = currCookie.getValue(); // Validate the value. currValue = signer.verifyAndExtract(currValue); // Retrieve the user name, do the final validation step. if (currValue != null) { String userName = HttpAuthUtils.getUserNameFromCookieToken(currValue); if (userName == null) { LOG.warn("Invalid cookie token " + currValue); continue; } //We have found a valid cookie in the client request. if (LOG.isDebugEnabled()) { LOG.debug("Validated the cookie for user " + userName); } return userName; } } // No valid HS2 generated cookies found, return null return null; }
[ "private", "String", "getClientNameFromCookie", "(", "Cookie", "[", "]", "cookies", ")", "{", "// Current Cookie Name, Current Cookie Value", "String", "currName", ",", "currValue", ";", "// Following is the main loop which iterates through all the cookies send by the client.", "//...
Retrieves the client name from cookieString. If the cookie does not correspond to a valid client, the function returns null. @param cookies HTTP Request cookies. @return Client Username if cookieString has a HS2 Generated cookie that is currently valid. Else, returns null.
[ "Retrieves", "the", "client", "name", "from", "cookieString", ".", "If", "the", "cookie", "does", "not", "correspond", "to", "a", "valid", "client", "the", "function", "returns", "null", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L196-L234
train
Gets the client name from the cookies.
[ 30522, 2797, 5164, 2131, 20464, 11638, 18442, 19699, 5358, 3597, 23212, 2063, 1006, 17387, 1031, 1033, 16324, 1007, 1063, 1013, 1013, 2783, 17387, 2171, 1010, 2783, 17387, 3643, 5164, 12731, 12171, 18442, 1010, 12731, 12171, 10175, 5657, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/AsciiString.java
AsciiString.trim
public static CharSequence trim(CharSequence c) { if (c.getClass() == AsciiString.class) { return ((AsciiString) c).trim(); } if (c instanceof String) { return ((String) c).trim(); } int start = 0, last = c.length() - 1; int end = last; while (start <= end && c.charAt(start) <= ' ') { start++; } while (end >= start && c.charAt(end) <= ' ') { end--; } if (start == 0 && end == last) { return c; } return c.subSequence(start, end); }
java
public static CharSequence trim(CharSequence c) { if (c.getClass() == AsciiString.class) { return ((AsciiString) c).trim(); } if (c instanceof String) { return ((String) c).trim(); } int start = 0, last = c.length() - 1; int end = last; while (start <= end && c.charAt(start) <= ' ') { start++; } while (end >= start && c.charAt(end) <= ' ') { end--; } if (start == 0 && end == last) { return c; } return c.subSequence(start, end); }
[ "public", "static", "CharSequence", "trim", "(", "CharSequence", "c", ")", "{", "if", "(", "c", ".", "getClass", "(", ")", "==", "AsciiString", ".", "class", ")", "{", "return", "(", "(", "AsciiString", ")", "c", ")", ".", "trim", "(", ")", ";", "}...
Copies this string removing white space characters from the beginning and end of the string, and tries not to copy if possible. @param c The {@link CharSequence} to trim. @return a new string with characters {@code <= \\u0020} removed from the beginning and the end.
[ "Copies", "this", "string", "removing", "white", "space", "characters", "from", "the", "beginning", "and", "end", "of", "the", "string", "and", "tries", "not", "to", "copy", "if", "possible", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L990-L1009
train
Trims a CharSequence.
[ 30522, 2270, 10763, 25869, 3366, 4226, 5897, 12241, 1006, 25869, 3366, 4226, 5897, 1039, 1007, 1063, 2065, 1006, 1039, 1012, 2131, 26266, 1006, 1007, 1027, 1027, 2004, 6895, 2923, 4892, 1012, 2465, 1007, 1063, 2709, 1006, 1006, 2004, 6895, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.addAll
public static <T> Collection<T> addAll(Collection<T> collection, Object value) { return addAll(collection, value, TypeUtil.getTypeArgument(collection.getClass())); }
java
public static <T> Collection<T> addAll(Collection<T> collection, Object value) { return addAll(collection, value, TypeUtil.getTypeArgument(collection.getClass())); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "addAll", "(", "Collection", "<", "T", ">", "collection", ",", "Object", "value", ")", "{", "return", "addAll", "(", "collection", ",", "value", ",", "TypeUtil", ".", "getTypeArgument", "(",...
将指定对象全部加入到集合中<br> 提供的对象如果为集合类型,会自动转换为目标元素类型<br> @param <T> 元素类型 @param collection 被加入的集合 @param value 对象,可能为Iterator、Iterable、Enumeration、Array @return 被加入集合
[ "将指定对象全部加入到集合中<br", ">", "提供的对象如果为集合类型,会自动转换为目标元素类型<br", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1690-L1692
train
Add all elements of the given collection to the given value.
[ 30522, 2270, 10763, 1026, 1056, 1028, 3074, 1026, 1056, 1028, 5587, 8095, 1006, 3074, 1026, 1056, 1028, 3074, 1010, 4874, 3643, 1007, 1063, 2709, 5587, 8095, 1006, 3074, 1010, 3643, 1010, 2828, 21823, 2140, 1012, 2131, 13874, 2906, 22850, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLBuilder.java
SQLBuilder.toSQL
public String toSQL(final MasterSlaveRule masterSlaveRule, final ShardingDataSourceMetaData shardingDataSourceMetaData) { StringBuilder result = new StringBuilder(); for (Object each : segments) { if (each instanceof SchemaPlaceholder) { result.append(shardingDataSourceMetaData.getActualDataSourceMetaData(masterSlaveRule.getMasterDataSourceName()).getSchemaName()); } else { result.append(each); } } return result.toString(); }
java
public String toSQL(final MasterSlaveRule masterSlaveRule, final ShardingDataSourceMetaData shardingDataSourceMetaData) { StringBuilder result = new StringBuilder(); for (Object each : segments) { if (each instanceof SchemaPlaceholder) { result.append(shardingDataSourceMetaData.getActualDataSourceMetaData(masterSlaveRule.getMasterDataSourceName()).getSchemaName()); } else { result.append(each); } } return result.toString(); }
[ "public", "String", "toSQL", "(", "final", "MasterSlaveRule", "masterSlaveRule", ",", "final", "ShardingDataSourceMetaData", "shardingDataSourceMetaData", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "each", ...
Convert to SQL unit. @param masterSlaveRule master slave rule @param shardingDataSourceMetaData sharding data source meta data @return SQL
[ "Convert", "to", "SQL", "unit", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLBuilder.java#L131-L141
train
To SQL.
[ 30522, 2270, 5164, 2000, 2015, 4160, 2140, 1006, 2345, 5972, 14973, 2121, 9307, 5972, 14973, 2121, 9307, 1010, 2345, 21146, 17080, 3070, 2850, 10230, 8162, 3401, 11368, 8447, 2696, 21146, 17080, 3070, 2850, 10230, 8162, 3401, 11368, 8447, 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-log/src/main/java/cn/hutool/log/StaticLog.java
StaticLog.error
public static void error(Log log, Throwable e, String format, Object... arguments) { if (false == log(log, Level.ERROR, e, format, arguments)) { log.error(e, format, arguments); } }
java
public static void error(Log log, Throwable e, String format, Object... arguments) { if (false == log(log, Level.ERROR, e, format, arguments)) { log.error(e, format, arguments); } }
[ "public", "static", "void", "error", "(", "Log", "log", ",", "Throwable", "e", ",", "String", "format", ",", "Object", "...", "arguments", ")", "{", "if", "(", "false", "==", "log", "(", "log", ",", "Level", ".", "ERROR", ",", "e", ",", "format", "...
Error等级日志<br> @param log 日志对象 @param e 需在日志中堆栈打印的异常 @param format 格式文本,{} 代表变量 @param arguments 变量对应的参数
[ "Error等级日志<br", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/StaticLog.java#L207-L211
train
Logs an error with a throwable.
[ 30522, 2270, 10763, 11675, 7561, 1006, 8833, 8833, 1010, 5466, 3085, 1041, 1010, 5164, 4289, 1010, 4874, 1012, 1012, 1012, 9918, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 8833, 1006, 8833, 1010, 2504, 1012, 7561, 1010, 1041, 1010, 4289, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java
Bindable.setOf
public static <E> Bindable<Set<E>> setOf(Class<E> elementType) { return of(ResolvableType.forClassWithGenerics(Set.class, elementType)); }
java
public static <E> Bindable<Set<E>> setOf(Class<E> elementType) { return of(ResolvableType.forClassWithGenerics(Set.class, elementType)); }
[ "public", "static", "<", "E", ">", "Bindable", "<", "Set", "<", "E", ">", ">", "setOf", "(", "Class", "<", "E", ">", "elementType", ")", "{", "return", "of", "(", "ResolvableType", ".", "forClassWithGenerics", "(", "Set", ".", "class", ",", "elementTyp...
Create a new {@link Bindable} {@link Set} of the specified element type. @param <E> the element type @param elementType the set element type @return a {@link Bindable} instance
[ "Create", "a", "new", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L223-L225
train
Create a set type binding for the given element type.
[ 30522, 2270, 10763, 1026, 1041, 1028, 14187, 3085, 1026, 2275, 1026, 1041, 1028, 1028, 2275, 11253, 1006, 2465, 1026, 1041, 1028, 5783, 13874, 1007, 1063, 2709, 1997, 1006, 24501, 4747, 12423, 13874, 1012, 2005, 26266, 24415, 6914, 22420, 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/SqlConnRunner.java
SqlConnRunner.find
public <T> T find(Connection conn, Collection<String> fields, Entity where, RsHandler<T> rsh) throws SQLException { final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); query.setFields(fields); return find(conn, query, rsh); }
java
public <T> T find(Connection conn, Collection<String> fields, Entity where, RsHandler<T> rsh) throws SQLException { final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); query.setFields(fields); return find(conn, query, rsh); }
[ "public", "<", "T", ">", "T", "find", "(", "Connection", "conn", ",", "Collection", "<", "String", ">", "fields", ",", "Entity", "where", ",", "RsHandler", "<", "T", ">", "rsh", ")", "throws", "SQLException", "{", "final", "Query", "query", "=", "new",...
查询<br> 此方法不会关闭Connection @param <T> 结果对象类型 @param conn 数据库连接对象 @param fields 返回的字段列表,null则返回所有字段 @param where 条件实体类(包含表名) @param rsh 结果集处理对象 @return 结果对象 @throws SQLException SQL执行异常
[ "查询<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L330-L334
train
Find records in the database.
[ 30522, 2270, 1026, 1056, 1028, 1056, 2424, 1006, 4434, 9530, 2078, 1010, 3074, 1026, 5164, 1028, 4249, 1010, 9178, 2073, 1010, 12667, 11774, 3917, 1026, 1056, 1028, 12667, 2232, 1007, 11618, 29296, 10288, 24422, 1063, 2345, 23032, 23032, 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
common/src/main/java/io/netty/util/internal/MacAddressUtil.java
MacAddressUtil.bestAvailableMac
public static byte[] bestAvailableMac() { // Find the best MAC address available. byte[] bestMacAddr = EMPTY_BYTES; InetAddress bestInetAddr = NetUtil.LOCALHOST4; // Retrieve the list of available network interfaces. Map<NetworkInterface, InetAddress> ifaces = new LinkedHashMap<NetworkInterface, InetAddress>(); try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); if (interfaces != null) { while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); // Use the interface with proper INET addresses only. Enumeration<InetAddress> addrs = SocketUtils.addressesFromNetworkInterface(iface); if (addrs.hasMoreElements()) { InetAddress a = addrs.nextElement(); if (!a.isLoopbackAddress()) { ifaces.put(iface, a); } } } } } catch (SocketException e) { logger.warn("Failed to retrieve the list of available network interfaces", e); } for (Entry<NetworkInterface, InetAddress> entry: ifaces.entrySet()) { NetworkInterface iface = entry.getKey(); InetAddress inetAddr = entry.getValue(); if (iface.isVirtual()) { continue; } byte[] macAddr; try { macAddr = SocketUtils.hardwareAddressFromNetworkInterface(iface); } catch (SocketException e) { logger.debug("Failed to get the hardware address of a network interface: {}", iface, e); continue; } boolean replace = false; int res = compareAddresses(bestMacAddr, macAddr); if (res < 0) { // Found a better MAC address. replace = true; } else if (res == 0) { // Two MAC addresses are of pretty much same quality. res = compareAddresses(bestInetAddr, inetAddr); if (res < 0) { // Found a MAC address with better INET address. replace = true; } else if (res == 0) { // Cannot tell the difference. Choose the longer one. if (bestMacAddr.length < macAddr.length) { replace = true; } } } if (replace) { bestMacAddr = macAddr; bestInetAddr = inetAddr; } } if (bestMacAddr == EMPTY_BYTES) { return null; } switch (bestMacAddr.length) { case EUI48_MAC_ADDRESS_LENGTH: // EUI-48 - convert to EUI-64 byte[] newAddr = new byte[EUI64_MAC_ADDRESS_LENGTH]; System.arraycopy(bestMacAddr, 0, newAddr, 0, 3); newAddr[3] = (byte) 0xFF; newAddr[4] = (byte) 0xFE; System.arraycopy(bestMacAddr, 3, newAddr, 5, 3); bestMacAddr = newAddr; break; default: // Unknown bestMacAddr = Arrays.copyOf(bestMacAddr, EUI64_MAC_ADDRESS_LENGTH); } return bestMacAddr; }
java
public static byte[] bestAvailableMac() { // Find the best MAC address available. byte[] bestMacAddr = EMPTY_BYTES; InetAddress bestInetAddr = NetUtil.LOCALHOST4; // Retrieve the list of available network interfaces. Map<NetworkInterface, InetAddress> ifaces = new LinkedHashMap<NetworkInterface, InetAddress>(); try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); if (interfaces != null) { while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); // Use the interface with proper INET addresses only. Enumeration<InetAddress> addrs = SocketUtils.addressesFromNetworkInterface(iface); if (addrs.hasMoreElements()) { InetAddress a = addrs.nextElement(); if (!a.isLoopbackAddress()) { ifaces.put(iface, a); } } } } } catch (SocketException e) { logger.warn("Failed to retrieve the list of available network interfaces", e); } for (Entry<NetworkInterface, InetAddress> entry: ifaces.entrySet()) { NetworkInterface iface = entry.getKey(); InetAddress inetAddr = entry.getValue(); if (iface.isVirtual()) { continue; } byte[] macAddr; try { macAddr = SocketUtils.hardwareAddressFromNetworkInterface(iface); } catch (SocketException e) { logger.debug("Failed to get the hardware address of a network interface: {}", iface, e); continue; } boolean replace = false; int res = compareAddresses(bestMacAddr, macAddr); if (res < 0) { // Found a better MAC address. replace = true; } else if (res == 0) { // Two MAC addresses are of pretty much same quality. res = compareAddresses(bestInetAddr, inetAddr); if (res < 0) { // Found a MAC address with better INET address. replace = true; } else if (res == 0) { // Cannot tell the difference. Choose the longer one. if (bestMacAddr.length < macAddr.length) { replace = true; } } } if (replace) { bestMacAddr = macAddr; bestInetAddr = inetAddr; } } if (bestMacAddr == EMPTY_BYTES) { return null; } switch (bestMacAddr.length) { case EUI48_MAC_ADDRESS_LENGTH: // EUI-48 - convert to EUI-64 byte[] newAddr = new byte[EUI64_MAC_ADDRESS_LENGTH]; System.arraycopy(bestMacAddr, 0, newAddr, 0, 3); newAddr[3] = (byte) 0xFF; newAddr[4] = (byte) 0xFE; System.arraycopy(bestMacAddr, 3, newAddr, 5, 3); bestMacAddr = newAddr; break; default: // Unknown bestMacAddr = Arrays.copyOf(bestMacAddr, EUI64_MAC_ADDRESS_LENGTH); } return bestMacAddr; }
[ "public", "static", "byte", "[", "]", "bestAvailableMac", "(", ")", "{", "// Find the best MAC address available.", "byte", "[", "]", "bestMacAddr", "=", "EMPTY_BYTES", ";", "InetAddress", "bestInetAddr", "=", "NetUtil", ".", "LOCALHOST4", ";", "// Retrieve the list o...
Obtains the best MAC address found on local network interfaces. Generally speaking, an active network interface used on public networks is better than a local network interface. @return byte array containing a MAC. null if no MAC can be found.
[ "Obtains", "the", "best", "MAC", "address", "found", "on", "local", "network", "interfaces", ".", "Generally", "speaking", "an", "active", "network", "interface", "used", "on", "public", "networks", "is", "better", "than", "a", "local", "network", "interface", ...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/MacAddressUtil.java#L47-L131
train
Returns the best MAC address available in the system.
[ 30522, 2270, 10763, 24880, 1031, 1033, 2190, 12462, 11733, 3468, 22911, 1006, 1007, 1063, 1013, 1013, 2424, 1996, 2190, 6097, 4769, 2800, 1012, 24880, 1031, 1033, 2190, 22911, 4215, 13626, 1027, 4064, 1035, 27507, 1025, 1999, 12928, 14141, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Operator.java
Operator.createUnionCascade
public static <T> Operator<T> createUnionCascade(Operator<T>... operators) { return createUnionCascade(null, operators); }
java
public static <T> Operator<T> createUnionCascade(Operator<T>... operators) { return createUnionCascade(null, operators); }
[ "public", "static", "<", "T", ">", "Operator", "<", "T", ">", "createUnionCascade", "(", "Operator", "<", "T", ">", "...", "operators", ")", "{", "return", "createUnionCascade", "(", "null", ",", "operators", ")", ";", "}" ]
Takes a list of operators and creates a cascade of unions of this inputs, if needed. If not needed (there was only one operator in the list), then that operator is returned. @param operators The operators. @return The single operator or a cascade of unions of the operators.
[ "Takes", "a", "list", "of", "operators", "and", "creates", "a", "cascade", "of", "unions", "of", "this", "inputs", "if", "needed", ".", "If", "not", "needed", "(", "there", "was", "only", "one", "operator", "in", "the", "list", ")", "then", "that", "op...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java#L259-L261
train
Create an Union cascading operator from the given operators.
[ 30522, 2270, 10763, 1026, 1056, 1028, 6872, 1026, 1056, 1028, 3443, 19496, 2239, 15671, 21869, 1006, 6872, 1026, 1056, 1028, 1012, 1012, 1012, 9224, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/PartialOrderPriorityQueue.java
PartialOrderPriorityQueue.poll
public final T poll() { if (size > 0) { T result = heap[1]; // save first value heap[1] = heap[size]; // move last to first heap[size] = null; // permit GC of objects size--; downHeap(); // adjust heap return result; } else { return null; } }
java
public final T poll() { if (size > 0) { T result = heap[1]; // save first value heap[1] = heap[size]; // move last to first heap[size] = null; // permit GC of objects size--; downHeap(); // adjust heap return result; } else { return null; } }
[ "public", "final", "T", "poll", "(", ")", "{", "if", "(", "size", ">", "0", ")", "{", "T", "result", "=", "heap", "[", "1", "]", ";", "// save first value", "heap", "[", "1", "]", "=", "heap", "[", "size", "]", ";", "// move last to first", "heap",...
Removes and returns the least element of the PriorityQueue in log(size) time. @return The least element.
[ "Removes", "and", "returns", "the", "least", "element", "of", "the", "PriorityQueue", "in", "log", "(", "size", ")", "time", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/PartialOrderPriorityQueue.java#L143-L154
train
Poll the object from the queue.
[ 30522, 2270, 2345, 1056, 8554, 1006, 1007, 1063, 2065, 1006, 2946, 1028, 1014, 1007, 1063, 1056, 2765, 1027, 16721, 1031, 30524, 2278, 1997, 5200, 2946, 1011, 1011, 1025, 2091, 20192, 2361, 1006, 1007, 1025, 1013, 1013, 14171, 16721, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
handler/src/main/java/com/networknt/handler/Handler.java
Handler.getNext
public static HttpHandler getNext(HttpServerExchange httpServerExchange) { String chainId = httpServerExchange.getAttachment(CHAIN_ID); List<HttpHandler> handlersForId = handlerListById.get(chainId); Integer nextIndex = httpServerExchange.getAttachment(CHAIN_SEQ); // Check if we've reached the end of the chain. if (nextIndex < handlersForId.size()) { httpServerExchange.putAttachment(CHAIN_SEQ, nextIndex + 1); return handlersForId.get(nextIndex); } return null; }
java
public static HttpHandler getNext(HttpServerExchange httpServerExchange) { String chainId = httpServerExchange.getAttachment(CHAIN_ID); List<HttpHandler> handlersForId = handlerListById.get(chainId); Integer nextIndex = httpServerExchange.getAttachment(CHAIN_SEQ); // Check if we've reached the end of the chain. if (nextIndex < handlersForId.size()) { httpServerExchange.putAttachment(CHAIN_SEQ, nextIndex + 1); return handlersForId.get(nextIndex); } return null; }
[ "public", "static", "HttpHandler", "getNext", "(", "HttpServerExchange", "httpServerExchange", ")", "{", "String", "chainId", "=", "httpServerExchange", ".", "getAttachment", "(", "CHAIN_ID", ")", ";", "List", "<", "HttpHandler", ">", "handlersForId", "=", "handlerL...
Returns the instance of the next handler, rather then calling handleRequest on it. @param httpServerExchange The current requests server exchange. @return The HttpHandler that should be executed next.
[ "Returns", "the", "instance", "of", "the", "next", "handler", "rather", "then", "calling", "handleRequest", "on", "it", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L272-L282
train
Get the next handler in the chain.
[ 30522, 2270, 10763, 8299, 11774, 3917, 2131, 2638, 18413, 1006, 16770, 2121, 28943, 2595, 22305, 2063, 16770, 2121, 28943, 2595, 22305, 2063, 1007, 1063, 5164, 4677, 3593, 1027, 16770, 2121, 28943, 2595, 22305, 2063, 1012, 2131, 19321, 6776, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.createKinesisClient
protected AmazonKinesis createKinesisClient(Properties configProps) { ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig(); AWSUtil.setAwsClientConfigProperties(awsClientConfig, configProps); return AWSUtil.createKinesisClient(configProps, awsClientConfig); }
java
protected AmazonKinesis createKinesisClient(Properties configProps) { ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig(); AWSUtil.setAwsClientConfigProperties(awsClientConfig, configProps); return AWSUtil.createKinesisClient(configProps, awsClientConfig); }
[ "protected", "AmazonKinesis", "createKinesisClient", "(", "Properties", "configProps", ")", "{", "ClientConfiguration", "awsClientConfig", "=", "new", "ClientConfigurationFactory", "(", ")", ".", "getConfig", "(", ")", ";", "AWSUtil", ".", "setAwsClientConfigProperties", ...
Create the Kinesis client, using the provided configuration properties and default {@link ClientConfiguration}. Derived classes can override this method to customize the client configuration. @param configProps @return
[ "Create", "the", "Kinesis", "client", "using", "the", "provided", "configuration", "properties", "and", "default", "{" ]
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#L219-L224
train
Creates a Kinesis client with the specified properties.
[ 30522, 5123, 9733, 4939, 19009, 3443, 4939, 19009, 20464, 11638, 1006, 5144, 9530, 8873, 21600, 18981, 2015, 1007, 1063, 7396, 8663, 8873, 27390, 3370, 22091, 11020, 8751, 3372, 8663, 8873, 2290, 1027, 2047, 7396, 8663, 8873, 27390, 3370, 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-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/LeadLagAggFunction.java
LeadLagAggFunction.retractExpressions
@Override public Expression[] retractExpressions() { return new Expression[] {existDefaultValue ? cast(operand(2), typeLiteral(getResultType())) : literal(null, getResultType())}; }
java
@Override public Expression[] retractExpressions() { return new Expression[] {existDefaultValue ? cast(operand(2), typeLiteral(getResultType())) : literal(null, getResultType())}; }
[ "@", "Override", "public", "Expression", "[", "]", "retractExpressions", "(", ")", "{", "return", "new", "Expression", "[", "]", "{", "existDefaultValue", "?", "cast", "(", "operand", "(", "2", ")", ",", "typeLiteral", "(", "getResultType", "(", ")", ")", ...
TODO hack, use the current input reset the buffer value.
[ "TODO", "hack", "use", "the", "current", "input", "reset", "the", "buffer", "value", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/LeadLagAggFunction.java#L94-L98
train
Returns an array of expressions that can be used to create a null value.
[ 30522, 1030, 2058, 15637, 2270, 3670, 1031, 1033, 2128, 6494, 6593, 10288, 20110, 8496, 1006, 1007, 1063, 2709, 2047, 3670, 1031, 1033, 1063, 4839, 3207, 7011, 11314, 10175, 5657, 1029, 3459, 1006, 3850, 4859, 1006, 1016, 1007, 1010, 2828, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java
Layouts.forFile
public static Layout forFile(File file) { if (file == null) { throw new IllegalArgumentException("File must not be null"); } String lowerCaseFileName = file.getName().toLowerCase(Locale.ENGLISH); if (lowerCaseFileName.endsWith(".jar")) { return new Jar(); } if (lowerCaseFileName.endsWith(".war")) { return new War(); } if (file.isDirectory() || lowerCaseFileName.endsWith(".zip")) { return new Expanded(); } throw new IllegalStateException("Unable to deduce layout for '" + file + "'"); }
java
public static Layout forFile(File file) { if (file == null) { throw new IllegalArgumentException("File must not be null"); } String lowerCaseFileName = file.getName().toLowerCase(Locale.ENGLISH); if (lowerCaseFileName.endsWith(".jar")) { return new Jar(); } if (lowerCaseFileName.endsWith(".war")) { return new War(); } if (file.isDirectory() || lowerCaseFileName.endsWith(".zip")) { return new Expanded(); } throw new IllegalStateException("Unable to deduce layout for '" + file + "'"); }
[ "public", "static", "Layout", "forFile", "(", "File", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"File must not be null\"", ")", ";", "}", "String", "lowerCaseFileName", "=", "file", ".", "...
Return a layout for the given source file. @param file the source file @return a {@link Layout}
[ "Return", "a", "layout", "for", "the", "given", "source", "file", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java#L42-L57
train
Returns a layout for the given file.
[ 30522, 2270, 10763, 9621, 2005, 8873, 2571, 1006, 5371, 5371, 1007, 1063, 2065, 1006, 5371, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 5371, 2442, 2025, 2022, 19701, 1000, 1007, 1025, 1065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java
SharedBuffer.isEmpty
public boolean isEmpty() throws Exception { return Iterables.isEmpty(eventsBufferCache.keySet()) && Iterables.isEmpty(eventsBuffer.keys()); }
java
public boolean isEmpty() throws Exception { return Iterables.isEmpty(eventsBufferCache.keySet()) && Iterables.isEmpty(eventsBuffer.keys()); }
[ "public", "boolean", "isEmpty", "(", ")", "throws", "Exception", "{", "return", "Iterables", ".", "isEmpty", "(", "eventsBufferCache", ".", "keySet", "(", ")", ")", "&&", "Iterables", ".", "isEmpty", "(", "eventsBuffer", ".", "keys", "(", ")", ")", ";", ...
Checks if there is no elements in the buffer. @return true if there is no elements in the buffer @throws Exception Thrown if the system cannot access the state.
[ "Checks", "if", "there", "is", "no", "elements", "in", "the", "buffer", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L152-L154
train
Returns true if the cache and buffer are empty.
[ 30522, 2270, 22017, 20898, 2003, 6633, 13876, 2100, 1006, 1007, 11618, 6453, 1063, 2709, 2009, 6906, 13510, 1012, 2003, 6633, 13876, 2100, 1006, 2824, 8569, 12494, 3540, 5403, 1012, 6309, 3388, 1006, 1007, 1007, 1004, 1004, 2009, 6906, 1351...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.encode
public static BitMatrix encode(String content, int width, int height) { return encode(content, BarcodeFormat.QR_CODE, width, height); }
java
public static BitMatrix encode(String content, int width, int height) { return encode(content, BarcodeFormat.QR_CODE, width, height); }
[ "public", "static", "BitMatrix", "encode", "(", "String", "content", ",", "int", "width", ",", "int", "height", ")", "{", "return", "encode", "(", "content", ",", "BarcodeFormat", ".", "QR_CODE", ",", "width", ",", "height", ")", ";", "}" ]
将文本内容编码为二维码 @param content 文本内容 @param width 宽度 @param height 高度 @return {@link BitMatrix}
[ "将文本内容编码为二维码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L209-L211
train
Encodes a String into a BitMatrix.
[ 30522, 2270, 10763, 2978, 18900, 17682, 4372, 16044, 1006, 5164, 4180, 1010, 20014, 9381, 1010, 20014, 4578, 1007, 1063, 2709, 4372, 16044, 1006, 4180, 1010, 3347, 16044, 14192, 4017, 1012, 1053, 2099, 1035, 3642, 1010, 9381, 1010, 4578, 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-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.callQuery
public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException { CallableStatement proc = null; try { proc = StatementUtil.prepareCall(conn, sql, params); return proc.executeQuery(); } finally { DbUtil.close(proc); } }
java
public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException { CallableStatement proc = null; try { proc = StatementUtil.prepareCall(conn, sql, params); return proc.executeQuery(); } finally { DbUtil.close(proc); } }
[ "public", "static", "ResultSet", "callQuery", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "CallableStatement", "proc", "=", "null", ";", "try", "{", "proc", "=", "StatementUtil", ".", "...
执行调用存储过程<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sql SQL @param params 参数 @return ResultSet @throws SQLException SQL执行异常 @since 4.1.4
[ "执行调用存储过程<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L94-L102
train
Call a query on a database connection.
[ 30522, 2270, 10763, 3463, 3388, 2655, 4226, 2854, 1006, 4434, 9530, 2078, 1010, 5164, 29296, 1010, 4874, 1012, 1012, 1012, 11498, 5244, 1007, 11618, 29296, 10288, 24422, 1063, 2655, 3085, 9153, 18532, 4765, 4013, 2278, 1027, 19701, 1025, 30...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DelegatingDecompressorFrameListener.java
DelegatingDecompressorFrameListener.nextReadableBuf
private static ByteBuf nextReadableBuf(EmbeddedChannel decompressor) { for (;;) { final ByteBuf buf = decompressor.readInbound(); if (buf == null) { return null; } if (!buf.isReadable()) { buf.release(); continue; } return buf; } }
java
private static ByteBuf nextReadableBuf(EmbeddedChannel decompressor) { for (;;) { final ByteBuf buf = decompressor.readInbound(); if (buf == null) { return null; } if (!buf.isReadable()) { buf.release(); continue; } return buf; } }
[ "private", "static", "ByteBuf", "nextReadableBuf", "(", "EmbeddedChannel", "decompressor", ")", "{", "for", "(", ";", ";", ")", "{", "final", "ByteBuf", "buf", "=", "decompressor", ".", "readInbound", "(", ")", ";", "if", "(", "buf", "==", "null", ")", "...
Read the next decompressed {@link ByteBuf} from the {@link EmbeddedChannel} or {@code null} if one does not exist. @param decompressor The channel to read from @return The next decoded {@link ByteBuf} from the {@link EmbeddedChannel} or {@code null} if one does not exist
[ "Read", "the", "next", "decompressed", "{", "@link", "ByteBuf", "}", "from", "the", "{", "@link", "EmbeddedChannel", "}", "or", "{", "@code", "null", "}", "if", "one", "does", "not", "exist", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java#L269-L281
train
Read the next readable ByteBuf from the decompressor.
[ 30522, 2797, 10763, 24880, 8569, 2546, 2279, 16416, 20782, 8569, 2546, 1006, 11157, 26058, 21933, 8737, 8303, 2953, 1007, 1063, 2005, 1006, 1025, 1025, 1007, 1063, 2345, 24880, 8569, 2546, 20934, 2546, 1027, 21933, 8737, 8303, 2953, 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...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.setInt
public static void setInt(MemorySegment[] segments, int offset, int value) { if (inFirstSegment(segments, offset, 4)) { segments[0].putInt(offset, value); } else { setIntMultiSegments(segments, offset, value); } }
java
public static void setInt(MemorySegment[] segments, int offset, int value) { if (inFirstSegment(segments, offset, 4)) { segments[0].putInt(offset, value); } else { setIntMultiSegments(segments, offset, value); } }
[ "public", "static", "void", "setInt", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "int", "value", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "4", ")", ")", "{", "segments", "[", "0", "]", "....
set int from segments. @param segments target segments. @param offset value offset.
[ "set", "int", "from", "segments", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L664-L670
train
set int from segments.
[ 30522, 2270, 10763, 11675, 2275, 18447, 1006, 3638, 3366, 21693, 4765, 1031, 1033, 9214, 1010, 20014, 16396, 1010, 20014, 3643, 1007, 1063, 2065, 1006, 1999, 8873, 12096, 3366, 21693, 4765, 1006, 9214, 1010, 16396, 1010, 1018, 1007, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGNode.java
MDAGNode.haveSameTransitions
public static boolean haveSameTransitions(MDAGNode node1, MDAGNode node2) { TreeMap<Character, MDAGNode> outgoingTransitionTreeMap1 = node1.outgoingTransitionTreeMap; TreeMap<Character, MDAGNode> outgoingTransitionTreeMap2 = node2.outgoingTransitionTreeMap; if(outgoingTransitionTreeMap1.size() == outgoingTransitionTreeMap2.size()) { //For each _transition in outgoingTransitionTreeMap1, get the identically lableed _transition //in outgoingTransitionTreeMap2 (if present), and test the equality of the transitions' target nodes for(Entry<Character, MDAGNode> transitionKeyValuePair : outgoingTransitionTreeMap1.entrySet()) { Character currentCharKey = transitionKeyValuePair.getKey(); MDAGNode currentTargetNode = transitionKeyValuePair.getValue(); if(!outgoingTransitionTreeMap2.containsKey(currentCharKey) || !outgoingTransitionTreeMap2.get(currentCharKey).equals(currentTargetNode)) return false; } ///// } else return false; return true; }
java
public static boolean haveSameTransitions(MDAGNode node1, MDAGNode node2) { TreeMap<Character, MDAGNode> outgoingTransitionTreeMap1 = node1.outgoingTransitionTreeMap; TreeMap<Character, MDAGNode> outgoingTransitionTreeMap2 = node2.outgoingTransitionTreeMap; if(outgoingTransitionTreeMap1.size() == outgoingTransitionTreeMap2.size()) { //For each _transition in outgoingTransitionTreeMap1, get the identically lableed _transition //in outgoingTransitionTreeMap2 (if present), and test the equality of the transitions' target nodes for(Entry<Character, MDAGNode> transitionKeyValuePair : outgoingTransitionTreeMap1.entrySet()) { Character currentCharKey = transitionKeyValuePair.getKey(); MDAGNode currentTargetNode = transitionKeyValuePair.getValue(); if(!outgoingTransitionTreeMap2.containsKey(currentCharKey) || !outgoingTransitionTreeMap2.get(currentCharKey).equals(currentTargetNode)) return false; } ///// } else return false; return true; }
[ "public", "static", "boolean", "haveSameTransitions", "(", "MDAGNode", "node1", ",", "MDAGNode", "node2", ")", "{", "TreeMap", "<", "Character", ",", "MDAGNode", ">", "outgoingTransitionTreeMap1", "=", "node1", ".", "outgoingTransitionTreeMap", ";", "TreeMap", "<", ...
是否含有相同的转移函数 @param node1 @param node2 @return
[ "是否含有相同的转移函数" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGNode.java#L451-L474
train
Checks if two nodes have the same outgoing transitions.
[ 30522, 2270, 10763, 22017, 20898, 2031, 21559, 3388, 5521, 28032, 8496, 1006, 9108, 8490, 3630, 3207, 13045, 2487, 1010, 9108, 8490, 3630, 3207, 13045, 2475, 1007, 1063, 3392, 2863, 2361, 1026, 2839, 1010, 9108, 8490, 3630, 3207, 1028, 2201...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java
MqttDecoder.decodeVariableHeader
private static Result<?> decodeVariableHeader(ByteBuf buffer, MqttFixedHeader mqttFixedHeader) { switch (mqttFixedHeader.messageType()) { case CONNECT: return decodeConnectionVariableHeader(buffer); case CONNACK: return decodeConnAckVariableHeader(buffer); case SUBSCRIBE: case UNSUBSCRIBE: case SUBACK: case UNSUBACK: case PUBACK: case PUBREC: case PUBCOMP: case PUBREL: return decodeMessageIdVariableHeader(buffer); case PUBLISH: return decodePublishVariableHeader(buffer, mqttFixedHeader); case PINGREQ: case PINGRESP: case DISCONNECT: // Empty variable header return new Result<Object>(null, 0); } return new Result<Object>(null, 0); //should never reach here }
java
private static Result<?> decodeVariableHeader(ByteBuf buffer, MqttFixedHeader mqttFixedHeader) { switch (mqttFixedHeader.messageType()) { case CONNECT: return decodeConnectionVariableHeader(buffer); case CONNACK: return decodeConnAckVariableHeader(buffer); case SUBSCRIBE: case UNSUBSCRIBE: case SUBACK: case UNSUBACK: case PUBACK: case PUBREC: case PUBCOMP: case PUBREL: return decodeMessageIdVariableHeader(buffer); case PUBLISH: return decodePublishVariableHeader(buffer, mqttFixedHeader); case PINGREQ: case PINGRESP: case DISCONNECT: // Empty variable header return new Result<Object>(null, 0); } return new Result<Object>(null, 0); //should never reach here }
[ "private", "static", "Result", "<", "?", ">", "decodeVariableHeader", "(", "ByteBuf", "buffer", ",", "MqttFixedHeader", "mqttFixedHeader", ")", "{", "switch", "(", "mqttFixedHeader", ".", "messageType", "(", ")", ")", "{", "case", "CONNECT", ":", "return", "de...
Decodes the variable header (if any) @param buffer the buffer to decode from @param mqttFixedHeader MqttFixedHeader of the same message @return the variable header
[ "Decodes", "the", "variable", "header", "(", "if", "any", ")" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L179-L207
train
Decode the variable header.
[ 30522, 2797, 10763, 2765, 1026, 1029, 30524, 2546, 17698, 1010, 1049, 4160, 4779, 23901, 4974, 2121, 1049, 4160, 4779, 23901, 4974, 2121, 1007, 1063, 6942, 1006, 1049, 4160, 4779, 23901, 4974, 2121, 1012, 4471, 13874, 1006, 1007, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java
MutableHashTable.buildBloomFilterForBucket
final void buildBloomFilterForBucket(int bucketInSegmentPos, MemorySegment bucket, HashPartition<BT, PT> p) { final int count = bucket.getShort(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count <= 0) { return; } int[] hashCodes = new int[count]; // As the hashcode and bloom filter occupy same bytes, so we read all hashcode out at first and then write back to bloom filter. for (int i = 0; i < count; i++) { hashCodes[i] = bucket.getInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + i * HASH_CODE_LEN); } this.bloomFilter.setBitsLocation(bucket, bucketInSegmentPos + BUCKET_HEADER_LENGTH); for (int hashCode : hashCodes) { this.bloomFilter.addHash(hashCode); } buildBloomFilterForExtraOverflowSegments(bucketInSegmentPos, bucket, p); }
java
final void buildBloomFilterForBucket(int bucketInSegmentPos, MemorySegment bucket, HashPartition<BT, PT> p) { final int count = bucket.getShort(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count <= 0) { return; } int[] hashCodes = new int[count]; // As the hashcode and bloom filter occupy same bytes, so we read all hashcode out at first and then write back to bloom filter. for (int i = 0; i < count; i++) { hashCodes[i] = bucket.getInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + i * HASH_CODE_LEN); } this.bloomFilter.setBitsLocation(bucket, bucketInSegmentPos + BUCKET_HEADER_LENGTH); for (int hashCode : hashCodes) { this.bloomFilter.addHash(hashCode); } buildBloomFilterForExtraOverflowSegments(bucketInSegmentPos, bucket, p); }
[ "final", "void", "buildBloomFilterForBucket", "(", "int", "bucketInSegmentPos", ",", "MemorySegment", "bucket", ",", "HashPartition", "<", "BT", ",", "PT", ">", "p", ")", "{", "final", "int", "count", "=", "bucket", ".", "getShort", "(", "bucketInSegmentPos", ...
Set all the bucket memory except bucket header as the bit set of bloom filter, and use hash code of build records to build bloom filter.
[ "Set", "all", "the", "bucket", "memory", "except", "bucket", "header", "as", "the", "bit", "set", "of", "bloom", "filter", "and", "use", "hash", "code", "of", "build", "records", "to", "build", "bloom", "filter", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java#L1269-L1285
train
Builds the bloom filter for the given bucket.
[ 30522, 2345, 11675, 3857, 16558, 17650, 8873, 21928, 29278, 24204, 3388, 1006, 20014, 13610, 7076, 13910, 3672, 6873, 2015, 1010, 3638, 3366, 21693, 4765, 13610, 1010, 23325, 19362, 3775, 3508, 1026, 18411, 1010, 13866, 1028, 1052, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java
AbstractErrorWebExceptionHandler.isTraceEnabled
protected boolean isTraceEnabled(ServerRequest request) { String parameter = request.queryParam("trace").orElse("false"); return !"false".equalsIgnoreCase(parameter); }
java
protected boolean isTraceEnabled(ServerRequest request) { String parameter = request.queryParam("trace").orElse("false"); return !"false".equalsIgnoreCase(parameter); }
[ "protected", "boolean", "isTraceEnabled", "(", "ServerRequest", "request", ")", "{", "String", "parameter", "=", "request", ".", "queryParam", "(", "\"trace\"", ")", ".", "orElse", "(", "\"false\"", ")", ";", "return", "!", "\"false\"", ".", "equalsIgnoreCase", ...
Check whether the trace attribute has been set on the given request. @param request the source request @return {@code true} if the error trace has been requested, {@code false} otherwise
[ "Check", "whether", "the", "trace", "attribute", "has", "been", "set", "on", "the", "given", "request", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java#L157-L160
train
Returns true if the request is trace - able.
[ 30522, 5123, 22017, 20898, 21541, 22903, 8189, 23242, 1006, 8241, 2890, 15500, 5227, 1007, 1063, 5164, 16381, 1027, 5227, 1012, 23032, 28689, 2213, 1006, 1000, 7637, 1000, 1007, 1012, 10848, 4877, 2063, 1006, 1000, 6270, 1000, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java
ConditionEvaluationReport.recordExclusions
public void recordExclusions(Collection<String> exclusions) { Assert.notNull(exclusions, "exclusions must not be null"); this.exclusions.addAll(exclusions); }
java
public void recordExclusions(Collection<String> exclusions) { Assert.notNull(exclusions, "exclusions must not be null"); this.exclusions.addAll(exclusions); }
[ "public", "void", "recordExclusions", "(", "Collection", "<", "String", ">", "exclusions", ")", "{", "Assert", ".", "notNull", "(", "exclusions", ",", "\"exclusions must not be null\"", ")", ";", "this", ".", "exclusions", ".", "addAll", "(", "exclusions", ")", ...
Records the names of the classes that have been excluded from condition evaluation. @param exclusions the names of the excluded classes
[ "Records", "the", "names", "of", "the", "classes", "that", "have", "been", "excluded", "from", "condition", "evaluation", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java#L95-L98
train
Records the exclusions of the current resource.
[ 30522, 2270, 11675, 2501, 10288, 20464, 22016, 1006, 3074, 1026, 5164, 1028, 15945, 2015, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 15945, 2015, 1010, 1000, 15945, 2015, 2442, 2025, 2022, 19701, 1000, 1007, 1025, 2023, 1012, 15945, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.newInstance
public static <T> T newInstance(Class<T> clazz, Object... params) throws UtilException { if (ArrayUtil.isEmpty(params)) { final Constructor<T> constructor = getConstructor(clazz); try { return constructor.newInstance(); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } } final Class<?>[] paramTypes = ClassUtil.getClasses(params); final Constructor<T> constructor = getConstructor(clazz, paramTypes); if (null == constructor) { throw new UtilException("No Constructor matched for parameter types: [{}]", new Object[] { paramTypes }); } try { return constructor.newInstance(params); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } }
java
public static <T> T newInstance(Class<T> clazz, Object... params) throws UtilException { if (ArrayUtil.isEmpty(params)) { final Constructor<T> constructor = getConstructor(clazz); try { return constructor.newInstance(); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } } final Class<?>[] paramTypes = ClassUtil.getClasses(params); final Constructor<T> constructor = getConstructor(clazz, paramTypes); if (null == constructor) { throw new UtilException("No Constructor matched for parameter types: [{}]", new Object[] { paramTypes }); } try { return constructor.newInstance(params); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "params", ")", "throws", "UtilException", "{", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "params", ")", ")", "{", "final", "Constructo...
实例化对象 @param <T> 对象类型 @param clazz 类 @param params 构造函数参数 @return 对象 @throws UtilException 包装各类异常
[ "实例化对象" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L669-L689
train
Creates an instance of the specified class using the specified parameters.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 2047, 7076, 26897, 1006, 2465, 1026, 1056, 1028, 18856, 10936, 2480, 1010, 4874, 1012, 1012, 1012, 11498, 5244, 1007, 11618, 21183, 9463, 2595, 24422, 1063, 2065, 1006, 9140, 21823, 2140, 1012, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java
Http2StreamChannelBootstrap.option
@SuppressWarnings("unchecked") public <T> Http2StreamChannelBootstrap option(ChannelOption<T> option, T value) { if (option == null) { throw new NullPointerException("option"); } if (value == null) { synchronized (options) { options.remove(option); } } else { synchronized (options) { options.put(option, value); } } return this; }
java
@SuppressWarnings("unchecked") public <T> Http2StreamChannelBootstrap option(ChannelOption<T> option, T value) { if (option == null) { throw new NullPointerException("option"); } if (value == null) { synchronized (options) { options.remove(option); } } else { synchronized (options) { options.put(option, value); } } return this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Http2StreamChannelBootstrap", "option", "(", "ChannelOption", "<", "T", ">", "option", ",", "T", "value", ")", "{", "if", "(", "option", "==", "null", ")", "{", "throw", "new", ...
Allow to specify a {@link ChannelOption} which is used for the {@link Http2StreamChannel} instances once they got created. Use a value of {@code null} to remove a previous set {@link ChannelOption}.
[ "Allow", "to", "specify", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java#L56-L71
train
Sets the specified option to the specified value.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 1026, 1056, 1028, 8299, 2475, 21422, 26058, 27927, 20528, 2361, 5724, 1006, 3149, 7361, 3508, 1026, 1056, 1028, 5724, 1010, 1056, 3643, 1007, 1063, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getPropertySources
@InterfaceStability.Unstable public synchronized String[] getPropertySources(String name) { if (properties == null) { // If properties is null, it means a resource was newly added // but the props were cleared so as to load it upon future // requests. So lets force a load by asking a properties list. getProps(); } // Return a null right away if our properties still // haven't loaded or the resource mapping isn't defined if (properties == null || updatingResource == null) { return null; } else { String[] source = updatingResource.get(name); if(source == null) { return null; } else { return Arrays.copyOf(source, source.length); } } }
java
@InterfaceStability.Unstable public synchronized String[] getPropertySources(String name) { if (properties == null) { // If properties is null, it means a resource was newly added // but the props were cleared so as to load it upon future // requests. So lets force a load by asking a properties list. getProps(); } // Return a null right away if our properties still // haven't loaded or the resource mapping isn't defined if (properties == null || updatingResource == null) { return null; } else { String[] source = updatingResource.get(name); if(source == null) { return null; } else { return Arrays.copyOf(source, source.length); } } }
[ "@", "InterfaceStability", ".", "Unstable", "public", "synchronized", "String", "[", "]", "getPropertySources", "(", "String", "name", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "// If properties is null, it means a resource was newly added", "// but the...
Gets information about why a property was set. Typically this is the path to the resource objects (file, URL, etc.) the property came from, but it can also indicate that it was set programmatically, or because of the command line. @param name - The property name to get the source of. @return null - If the property or its source wasn't found. Otherwise, returns a list of the sources of the resource. The older sources are the first ones in the list. So for example if a configuration is set from the command line, and then written out to a file that is read back in the first entry would indicate that it was set from the command line, while the second one would indicate the file that the new configuration was read in from.
[ "Gets", "information", "about", "why", "a", "property", "was", "set", ".", "Typically", "this", "is", "the", "path", "to", "the", "resource", "objects", "(", "file", "URL", "etc", ".", ")", "the", "property", "came", "from", "but", "it", "can", "also", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1846-L1866
train
Returns the property sources for the specified property name.
[ 30522, 1030, 19706, 2696, 8553, 1012, 14480, 2270, 25549, 5164, 1031, 1033, 2131, 21572, 4842, 3723, 6499, 3126, 9623, 1006, 5164, 2171, 1007, 1063, 2065, 1006, 5144, 1027, 1027, 19701, 1007, 1063, 1013, 1013, 2065, 5144, 2003, 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...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.internalGetPropertyDescriptorMap
private static Map<String, PropertyDescriptor> internalGetPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase) throws BeanException { final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); final Map<String, PropertyDescriptor> map = ignoreCase ? new CaseInsensitiveMap<String, PropertyDescriptor>(propertyDescriptors.length, 1) : new HashMap<String, PropertyDescriptor>((int) (propertyDescriptors.length), 1); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { map.put(propertyDescriptor.getName(), propertyDescriptor); } return map; }
java
private static Map<String, PropertyDescriptor> internalGetPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase) throws BeanException { final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); final Map<String, PropertyDescriptor> map = ignoreCase ? new CaseInsensitiveMap<String, PropertyDescriptor>(propertyDescriptors.length, 1) : new HashMap<String, PropertyDescriptor>((int) (propertyDescriptors.length), 1); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { map.put(propertyDescriptor.getName(), propertyDescriptor); } return map; }
[ "private", "static", "Map", "<", "String", ",", "PropertyDescriptor", ">", "internalGetPropertyDescriptorMap", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "ignoreCase", ")", "throws", "BeanException", "{", "final", "PropertyDescriptor", "[", "]", "proper...
获得字段名和字段描述Map。内部使用,直接获取Bean类的PropertyDescriptor @param clazz Bean类 @param ignoreCase 是否忽略大小写 @return 字段名和字段描述Map @throws BeanException 获取属性异常
[ "获得字段名和字段描述Map。内部使用,直接获取Bean类的PropertyDescriptor" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L209-L218
train
Returns a map of property names to PropertyDescriptor objects.
[ 30522, 2797, 10763, 4949, 1026, 5164, 1010, 3200, 6155, 23235, 2953, 1028, 4722, 18150, 21572, 4842, 3723, 6155, 23235, 2953, 2863, 2361, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 22017, 20898, 8568, 18382, 1007, 11618, 14068, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java
CommonRest.count
@GetMapping("/count/{type}/{key}/{task}") public Map<String, Object> count(@PathVariable String type, @PathVariable String key, @PathVariable String task) { OuterAdapter adapter = loader.getExtension(type, key); return adapter.count(task); }
java
@GetMapping("/count/{type}/{key}/{task}") public Map<String, Object> count(@PathVariable String type, @PathVariable String key, @PathVariable String task) { OuterAdapter adapter = loader.getExtension(type, key); return adapter.count(task); }
[ "@", "GetMapping", "(", "\"/count/{type}/{key}/{task}\"", ")", "public", "Map", "<", "String", ",", "Object", ">", "count", "(", "@", "PathVariable", "String", "type", ",", "@", "PathVariable", "String", "key", ",", "@", "PathVariable", "String", "task", ")", ...
统计总数 curl http://127.0.0.1:8081/count/rdb/oracle1/mytest_user.yml @param type 类型 hbase, es @param key adapter key @param task 任务名对应配置文件名 mytest_person2.yml @return
[ "统计总数", "curl", "http", ":", "//", "127", ".", "0", ".", "0", ".", "1", ":", "8081", "/", "count", "/", "rdb", "/", "oracle1", "/", "mytest_user", ".", "yml" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java#L134-L138
train
Count the number of items in a single resource.
[ 30522, 1030, 2131, 2863, 14853, 1006, 1000, 1013, 4175, 1013, 1063, 2828, 1065, 1013, 1063, 3145, 1065, 1013, 1063, 4708, 1065, 1000, 1007, 2270, 4949, 1026, 5164, 1010, 4874, 1028, 4175, 1006, 1030, 4130, 10755, 19210, 5164, 2828, 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-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java
MetricRegistryImpl.register
@Override public void register(Metric metric, String metricName, AbstractMetricGroup group) { synchronized (lock) { if (isShutdown()) { LOG.warn("Cannot register metric, because the MetricRegistry has already been shut down."); } else { if (reporters != null) { for (int i = 0; i < reporters.size(); i++) { MetricReporter reporter = reporters.get(i); try { if (reporter != null) { FrontMetricGroup front = new FrontMetricGroup<AbstractMetricGroup<?>>(i, group); reporter.notifyOfAddedMetric(metric, metricName, front); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } } } try { if (queryService != null) { queryService.addMetric(metricName, metric, group); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } try { if (metric instanceof View) { if (viewUpdater == null) { viewUpdater = new ViewUpdater(executor); } viewUpdater.notifyOfAddedView((View) metric); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } } } }
java
@Override public void register(Metric metric, String metricName, AbstractMetricGroup group) { synchronized (lock) { if (isShutdown()) { LOG.warn("Cannot register metric, because the MetricRegistry has already been shut down."); } else { if (reporters != null) { for (int i = 0; i < reporters.size(); i++) { MetricReporter reporter = reporters.get(i); try { if (reporter != null) { FrontMetricGroup front = new FrontMetricGroup<AbstractMetricGroup<?>>(i, group); reporter.notifyOfAddedMetric(metric, metricName, front); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } } } try { if (queryService != null) { queryService.addMetric(metricName, metric, group); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } try { if (metric instanceof View) { if (viewUpdater == null) { viewUpdater = new ViewUpdater(executor); } viewUpdater.notifyOfAddedView((View) metric); } } catch (Exception e) { LOG.warn("Error while registering metric.", e); } } } }
[ "@", "Override", "public", "void", "register", "(", "Metric", "metric", ",", "String", "metricName", ",", "AbstractMetricGroup", "group", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "isShutdown", "(", ")", ")", "{", "LOG", ".", "warn", "(...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java#L326-L364
train
Register a metric with the MetricRegistry.
[ 30522, 1030, 2058, 15637, 2270, 11675, 4236, 1006, 12046, 12046, 1010, 5164, 12046, 18442, 1010, 10061, 12589, 17058, 2177, 1007, 1063, 25549, 1006, 5843, 1007, 1063, 2065, 1006, 26354, 6979, 2102, 7698, 1006, 1007, 1007, 1063, 8833, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/Proxy.java
Proxy.setHttpProxy
public Proxy setHttpProxy(String httpProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.httpProxy = httpProxy; return this; }
java
public Proxy setHttpProxy(String httpProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.httpProxy = httpProxy; return this; }
[ "public", "Proxy", "setHttpProxy", "(", "String", "httpProxy", ")", "{", "verifyProxyTypeCompatibility", "(", "ProxyType", ".", "MANUAL", ")", ";", "this", ".", "proxyType", "=", "ProxyType", ".", "MANUAL", ";", "this", ".", "httpProxy", "=", "httpProxy", ";",...
Specify which proxy to use for HTTP connections. @param httpProxy the proxy host, expected format is <code>hostname:1234</code> @return reference to self
[ "Specify", "which", "proxy", "to", "use", "for", "HTTP", "connections", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L239-L244
train
Sets the http proxy.
[ 30522, 2270, 24540, 6662, 4779, 9397, 3217, 18037, 1006, 5164, 8299, 21572, 18037, 1007, 1063, 20410, 21572, 18037, 13874, 9006, 24952, 8553, 1006, 24540, 13874, 1012, 6410, 1007, 1025, 2023, 1012, 24540, 13874, 1027, 24540, 13874, 1012, 6410...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/concurrent/PromiseCombiner.java
PromiseCombiner.add
@SuppressWarnings({ "unchecked", "rawtypes" }) public void add(Future future) { checkAddAllowed(); checkInEventLoop(); ++expectedCount; future.addListener(listener); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public void add(Future future) { checkAddAllowed(); checkInEventLoop(); ++expectedCount; future.addListener(listener); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "add", "(", "Future", "future", ")", "{", "checkAddAllowed", "(", ")", ";", "checkInEventLoop", "(", ")", ";", "++", "expectedCount", ";", "future", ".", "...
Adds a new future to be combined. New futures may be added until an aggregate promise is added via the {@link PromiseCombiner#finish(Promise)} method. @param future the future to add to this promise combiner
[ "Adds", "a", "new", "future", "to", "be", "combined", ".", "New", "futures", "may", "be", "added", "until", "an", "aggregate", "promise", "is", "added", "via", "the", "{", "@link", "PromiseCombiner#finish", "(", "Promise", ")", "}", "method", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/PromiseCombiner.java#L106-L112
train
Add a new resource to the resource.
[ 30522, 1030, 16081, 9028, 5582, 2015, 30524, 1063, 4638, 4215, 9305, 27663, 2094, 1006, 1007, 1025, 4638, 3170, 15338, 4135, 7361, 1006, 1007, 1025, 1009, 1009, 3517, 3597, 16671, 1025, 2925, 1012, 5587, 9863, 24454, 1006, 19373, 1007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/watchers/DelayWatcher.java
DelayWatcher.onModify
@Override public void onModify(WatchEvent<?> event, Path currentPath) { if(this.delay < 1) { this.watcher.onModify(event, currentPath); }else { onDelayModify(event, currentPath); } }
java
@Override public void onModify(WatchEvent<?> event, Path currentPath) { if(this.delay < 1) { this.watcher.onModify(event, currentPath); }else { onDelayModify(event, currentPath); } }
[ "@", "Override", "public", "void", "onModify", "(", "WatchEvent", "<", "?", ">", "event", ",", "Path", "currentPath", ")", "{", "if", "(", "this", ".", "delay", "<", "1", ")", "{", "this", ".", "watcher", ".", "onModify", "(", "event", ",", "currentP...
---------------------------------------------------------------------------------------------------------- Constructor end
[ "----------------------------------------------------------------------------------------------------------", "Constructor", "end" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/watchers/DelayWatcher.java#L49-L56
train
Override this method to handle modify events.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2006, 5302, 4305, 12031, 1006, 3422, 18697, 3372, 1026, 1029, 1028, 2724, 1010, 4130, 2783, 15069, 1007, 1063, 2065, 1006, 2023, 1012, 8536, 1026, 1015, 1007, 1063, 2023, 1012, 3422, 2121, 1012, 2006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getRequired
public String getRequired(String key) { addToDefaults(key, null); String value = get(key); if (value == null) { throw new RuntimeException("No data for required key '" + key + "'"); } return value; }
java
public String getRequired(String key) { addToDefaults(key, null); String value = get(key); if (value == null) { throw new RuntimeException("No data for required key '" + key + "'"); } return value; }
[ "public", "String", "getRequired", "(", "String", "key", ")", "{", "addToDefaults", "(", "key", ",", "null", ")", ";", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "RuntimeException", ...
Returns the String value for the given key. If the key does not exist it will throw a {@link RuntimeException}.
[ "Returns", "the", "String", "value", "for", "the", "given", "key", ".", "If", "the", "key", "does", "not", "exist", "it", "will", "throw", "a", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L247-L254
train
Returns the value for the given key.
[ 30522, 2270, 5164, 2131, 2890, 15549, 5596, 1006, 5164, 3145, 1007, 1063, 5587, 3406, 3207, 7011, 11314, 2015, 1006, 3145, 1010, 19701, 1007, 1025, 5164, 3643, 1027, 2131, 1006, 3145, 1007, 1025, 2065, 1006, 3643, 1027, 1027, 19701, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java
TypeExtractor.getAllDeclaredFields
@PublicEvolving public static List<Field> getAllDeclaredFields(Class<?> clazz, boolean ignoreDuplicates) { List<Field> result = new ArrayList<Field>(); while (clazz != null) { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { if(Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) { continue; // we have no use for transient or static fields } if(hasFieldWithSameName(field.getName(), result)) { if (ignoreDuplicates) { continue; } else { throw new InvalidTypesException("The field "+field+" is already contained in the hierarchy of the "+clazz+"." + "Please use unique field names through your classes hierarchy"); } } result.add(field); } clazz = clazz.getSuperclass(); } return result; }
java
@PublicEvolving public static List<Field> getAllDeclaredFields(Class<?> clazz, boolean ignoreDuplicates) { List<Field> result = new ArrayList<Field>(); while (clazz != null) { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { if(Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) { continue; // we have no use for transient or static fields } if(hasFieldWithSameName(field.getName(), result)) { if (ignoreDuplicates) { continue; } else { throw new InvalidTypesException("The field "+field+" is already contained in the hierarchy of the "+clazz+"." + "Please use unique field names through your classes hierarchy"); } } result.add(field); } clazz = clazz.getSuperclass(); } return result; }
[ "@", "PublicEvolving", "public", "static", "List", "<", "Field", ">", "getAllDeclaredFields", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "ignoreDuplicates", ")", "{", "List", "<", "Field", ">", "result", "=", "new", "ArrayList", "<", "Field", ">...
Recursively determine all declared fields This is required because class.getFields() is not returning fields defined in parent classes. @param clazz class to be analyzed @param ignoreDuplicates if true, in case of duplicate field names only the lowest one in a hierarchy will be returned; throws an exception otherwise @return list of fields
[ "Recursively", "determine", "all", "declared", "fields", "This", "is", "required", "because", "class", ".", "getFields", "()", "is", "not", "returning", "fields", "defined", "in", "parent", "classes", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1929-L1951
train
Returns a list of all declared fields of the given class.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 10763, 2862, 1026, 2492, 1028, 2131, 8095, 3207, 20464, 12069, 20952, 12891, 2015, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 22017, 20898, 6439, 6279, 19341, 4570, 1007, 1063, 2862, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
resolver/src/main/java/io/netty/resolver/HostsFileParser.java
HostsFileParser.parseSilently
public static HostsFileEntries parseSilently(Charset... charsets) { File hostsFile = locateHostsFile(); try { return parse(hostsFile, charsets); } catch (IOException e) { if (logger.isWarnEnabled()) { logger.warn("Failed to load and parse hosts file at " + hostsFile.getPath(), e); } return HostsFileEntries.EMPTY; } }
java
public static HostsFileEntries parseSilently(Charset... charsets) { File hostsFile = locateHostsFile(); try { return parse(hostsFile, charsets); } catch (IOException e) { if (logger.isWarnEnabled()) { logger.warn("Failed to load and parse hosts file at " + hostsFile.getPath(), e); } return HostsFileEntries.EMPTY; } }
[ "public", "static", "HostsFileEntries", "parseSilently", "(", "Charset", "...", "charsets", ")", "{", "File", "hostsFile", "=", "locateHostsFile", "(", ")", ";", "try", "{", "return", "parse", "(", "hostsFile", ",", "charsets", ")", ";", "}", "catch", "(", ...
Parse hosts file at standard OS location using the given {@link Charset}s one after each other until we were able to parse something or none is left. @param charsets the {@link Charset}s to try as file encodings when parsing. @return a {@link HostsFileEntries}
[ "Parse", "hosts", "file", "at", "standard", "OS", "location", "using", "the", "given", "{", "@link", "Charset", "}", "s", "one", "after", "each", "other", "until", "we", "were", "able", "to", "parse", "something", "or", "none", "is", "left", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/HostsFileParser.java#L86-L96
train
Parses the hosts file with the specified charset ignoring any exceptions.
[ 30522, 2270, 10763, 6184, 8873, 24129, 21011, 11968, 8583, 9463, 20630, 1006, 25869, 13462, 1012, 1012, 1012, 25869, 13462, 2015, 1007, 1063, 5371, 6184, 8873, 2571, 1027, 12453, 15006, 3215, 8873, 2571, 1006, 1007, 1025, 3046, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java
CharArrayBuffer.append
public void append(final byte[] b, final int off, final int len) { if (b == null) { return; } if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) < 0) || ((off + len) > b.length)) { throw new IndexOutOfBoundsException("off: "+off+" len: "+len+" b.length: "+b.length); } if (len == 0) { return; } final int oldlen = this.len; final int newlen = oldlen + len; if (newlen > this.array.length) { expand(newlen); } for (int i1 = off, i2 = oldlen; i2 < newlen; i1++, i2++) { this.array[i2] = (char) (b[i1] & 0xff); } this.len = newlen; }
java
public void append(final byte[] b, final int off, final int len) { if (b == null) { return; } if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) < 0) || ((off + len) > b.length)) { throw new IndexOutOfBoundsException("off: "+off+" len: "+len+" b.length: "+b.length); } if (len == 0) { return; } final int oldlen = this.len; final int newlen = oldlen + len; if (newlen > this.array.length) { expand(newlen); } for (int i1 = off, i2 = oldlen; i2 < newlen; i1++, i2++) { this.array[i2] = (char) (b[i1] & 0xff); } this.len = newlen; }
[ "public", "void", "append", "(", "final", "byte", "[", "]", "b", ",", "final", "int", "off", ",", "final", "int", "len", ")", "{", "if", "(", "b", "==", "null", ")", "{", "return", ";", "}", "if", "(", "(", "off", "<", "0", ")", "||", "(", ...
Appends {@code len} bytes to this buffer from the given source array starting at index {@code off}. The capacity of the buffer is increased, if necessary, to accommodate all {@code len} bytes. <p> The bytes are converted to chars using simple cast. @param b the bytes to be appended. @param off the index of the first byte to append. @param len the number of bytes to append. @throws IndexOutOfBoundsException if {@code off} is out of range, {@code len} is negative, or {@code off} + {@code len} is out of range.
[ "Appends", "{", "@code", "len", "}", "bytes", "to", "this", "buffer", "from", "the", "given", "source", "array", "starting", "at", "index", "{", "@code", "off", "}", ".", "The", "capacity", "of", "the", "buffer", "is", "increased", "if", "necessary", "to...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L176-L196
train
Append a byte array to this array.
[ 30522, 2270, 11675, 10439, 10497, 1006, 2345, 24880, 1031, 1033, 1038, 1010, 2345, 20014, 2125, 1010, 2345, 20014, 18798, 1007, 1063, 2065, 1006, 1038, 1027, 1027, 19701, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 1006, 2125, 1026, 1014, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readObj
public static <T> T readObj(InputStream in) throws IORuntimeException, UtilException { if (in == null) { throw new IllegalArgumentException("The InputStream must not be null"); } ObjectInputStream ois = null; try { ois = new ObjectInputStream(in); @SuppressWarnings("unchecked") // may fail with CCE if serialised form is incorrect final T obj = (T) ois.readObject(); return obj; } catch (IOException e) { throw new IORuntimeException(e); } catch (ClassNotFoundException e) { throw new UtilException(e); } }
java
public static <T> T readObj(InputStream in) throws IORuntimeException, UtilException { if (in == null) { throw new IllegalArgumentException("The InputStream must not be null"); } ObjectInputStream ois = null; try { ois = new ObjectInputStream(in); @SuppressWarnings("unchecked") // may fail with CCE if serialised form is incorrect final T obj = (T) ois.readObject(); return obj; } catch (IOException e) { throw new IORuntimeException(e); } catch (ClassNotFoundException e) { throw new UtilException(e); } }
[ "public", "static", "<", "T", ">", "T", "readObj", "(", "InputStream", "in", ")", "throws", "IORuntimeException", ",", "UtilException", "{", "if", "(", "in", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The InputStream must not be ...
从流中读取内容,读到输出流中 @param <T> 读取对象的类型 @param in 输入流 @return 输出流 @throws IORuntimeException IO异常 @throws UtilException ClassNotFoundException包装
[ "从流中读取内容,读到输出流中" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L604-L619
train
Reads a single object from an input stream.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 3191, 16429, 3501, 1006, 20407, 25379, 1999, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1010, 21183, 9463, 2595, 24422, 1063, 2065, 1006, 1999, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.writePayload
private static ByteBuf writePayload( final ByteBufAllocator alloc, final long requestId, final MessageType messageType, final byte[] payload) { final int frameLength = HEADER_LENGTH + REQUEST_ID_SIZE + payload.length; final ByteBuf buf = alloc.ioBuffer(frameLength + Integer.BYTES); buf.writeInt(frameLength); writeHeader(buf, messageType); buf.writeLong(requestId); buf.writeBytes(payload); return buf; }
java
private static ByteBuf writePayload( final ByteBufAllocator alloc, final long requestId, final MessageType messageType, final byte[] payload) { final int frameLength = HEADER_LENGTH + REQUEST_ID_SIZE + payload.length; final ByteBuf buf = alloc.ioBuffer(frameLength + Integer.BYTES); buf.writeInt(frameLength); writeHeader(buf, messageType); buf.writeLong(requestId); buf.writeBytes(payload); return buf; }
[ "private", "static", "ByteBuf", "writePayload", "(", "final", "ByteBufAllocator", "alloc", ",", "final", "long", "requestId", ",", "final", "MessageType", "messageType", ",", "final", "byte", "[", "]", "payload", ")", "{", "final", "int", "frameLength", "=", "...
Helper for serializing the messages. @param alloc The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into. @param requestId The id of the request to which the message refers to. @param messageType The {@link MessageType type of the message}. @param payload The serialized version of the message. @return A {@link ByteBuf} containing the serialized message.
[ "Helper", "for", "serializing", "the", "messages", "." ]
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#L199-L213
train
Write the payload.
[ 30522, 2797, 10763, 24880, 8569, 2546, 4339, 4502, 8516, 10441, 2094, 1006, 2345, 24880, 8569, 13976, 24755, 4263, 2035, 10085, 1010, 2345, 2146, 5227, 3593, 1010, 2345, 4471, 13874, 4471, 13874, 1010, 2345, 24880, 1031, 1033, 18093, 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-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.toImage
public static BufferedImage toImage(BitMatrix matrix, int foreColor, int backColor) { final int width = matrix.getWidth(); final int height = matrix.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { image.setRGB(x, y, matrix.get(x, y) ? foreColor : backColor); } } return image; }
java
public static BufferedImage toImage(BitMatrix matrix, int foreColor, int backColor) { final int width = matrix.getWidth(); final int height = matrix.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { image.setRGB(x, y, matrix.get(x, y) ? foreColor : backColor); } } return image; }
[ "public", "static", "BufferedImage", "toImage", "(", "BitMatrix", "matrix", ",", "int", "foreColor", ",", "int", "backColor", ")", "{", "final", "int", "width", "=", "matrix", ".", "getWidth", "(", ")", ";", "final", "int", "height", "=", "matrix", ".", ...
BitMatrix转BufferedImage @param matrix BitMatrix @param foreColor 前景色 @param backColor 背景色 @return BufferedImage @since 4.1.2
[ "BitMatrix转BufferedImage" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L341-L351
train
Converts a BitMatrix to a BufferedImage.
[ 30522, 2270, 10763, 17698, 2098, 9581, 3351, 2000, 9581, 3351, 1006, 2978, 18900, 17682, 8185, 1010, 20014, 18921, 18717, 1010, 20014, 2067, 18717, 1007, 1063, 2345, 20014, 9381, 1027, 8185, 1012, 2131, 9148, 11927, 2232, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/operators/util/FieldList.java
FieldList.addField
@Override public FieldList addField(Integer fieldID) { if (fieldID == null) { throw new IllegalArgumentException("Field ID must not be null."); } if (size() == 0) { return new FieldList(fieldID); } else { ArrayList<Integer> list = new ArrayList<Integer>(size() + 1); list.addAll(this.collection); list.add(fieldID); return new FieldList(Collections.unmodifiableList(list)); } }
java
@Override public FieldList addField(Integer fieldID) { if (fieldID == null) { throw new IllegalArgumentException("Field ID must not be null."); } if (size() == 0) { return new FieldList(fieldID); } else { ArrayList<Integer> list = new ArrayList<Integer>(size() + 1); list.addAll(this.collection); list.add(fieldID); return new FieldList(Collections.unmodifiableList(list)); } }
[ "@", "Override", "public", "FieldList", "addField", "(", "Integer", "fieldID", ")", "{", "if", "(", "fieldID", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field ID must not be null.\"", ")", ";", "}", "if", "(", "size", "(", "...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/util/FieldList.java#L60-L74
train
Add a field to the list.
[ 30522, 1030, 2058, 15637, 2270, 2492, 9863, 5587, 3790, 1006, 16109, 2492, 3593, 1007, 1063, 2065, 1006, 2492, 3593, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 2492, 8909, 2442, 2025, 2022,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
TaskMemoryManager.encodePageNumberAndOffset
public long encodePageNumberAndOffset(MemoryBlock page, long offsetInPage) { if (tungstenMemoryMode == MemoryMode.OFF_HEAP) { // In off-heap mode, an offset is an absolute address that may require a full 64 bits to // encode. Due to our page size limitation, though, we can convert this into an offset that's // relative to the page's base offset; this relative offset will fit in 51 bits. offsetInPage -= page.getBaseOffset(); } return encodePageNumberAndOffset(page.pageNumber, offsetInPage); }
java
public long encodePageNumberAndOffset(MemoryBlock page, long offsetInPage) { if (tungstenMemoryMode == MemoryMode.OFF_HEAP) { // In off-heap mode, an offset is an absolute address that may require a full 64 bits to // encode. Due to our page size limitation, though, we can convert this into an offset that's // relative to the page's base offset; this relative offset will fit in 51 bits. offsetInPage -= page.getBaseOffset(); } return encodePageNumberAndOffset(page.pageNumber, offsetInPage); }
[ "public", "long", "encodePageNumberAndOffset", "(", "MemoryBlock", "page", ",", "long", "offsetInPage", ")", "{", "if", "(", "tungstenMemoryMode", "==", "MemoryMode", ".", "OFF_HEAP", ")", "{", "// In off-heap mode, an offset is an absolute address that may require a full 64 ...
Given a memory page and offset within that page, encode this address into a 64-bit long. This address will remain valid as long as the corresponding page has not been freed. @param page a data page allocated by {@link TaskMemoryManager#allocatePage}/ @param offsetInPage an offset in this page which incorporates the base offset. In other words, this should be the value that you would pass as the base offset into an UNSAFE call (e.g. page.baseOffset() + something). @return an encoded page address.
[ "Given", "a", "memory", "page", "and", "offset", "within", "that", "page", "encode", "this", "address", "into", "a", "64", "-", "bit", "long", ".", "This", "address", "will", "remain", "valid", "as", "long", "as", "the", "corresponding", "page", "has", "...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L363-L371
train
Encode a page number and offset in the given memory block.
[ 30522, 2270, 2146, 4372, 16044, 13704, 19172, 5677, 28574, 21807, 3388, 1006, 3638, 23467, 3931, 1010, 2146, 16396, 2378, 13704, 1007, 1063, 2065, 1006, 27079, 16173, 4168, 5302, 2854, 5302, 3207, 1027, 1027, 3638, 5302, 3207, 1012, 2125, 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...
SeleniumHQ/selenium
java/server/src/org/openqa/grid/web/servlet/console/ConsoleServlet.java
ConsoleServlet.getVerboseConfig
private String getVerboseConfig() { StringBuilder builder = new StringBuilder(); GridHubConfiguration config = getRegistry().getHub().getConfiguration(); builder.append("<div id='verbose-config-container'>"); builder.append("<a id='verbose-config-view-toggle' href='#'>View Verbose</a>"); builder.append("<div id='verbose-config-content'>"); GridHubConfiguration tmp = new GridHubConfiguration(); builder.append("<br/><b>The final configuration comes from:</b><br/>"); builder.append("<b>the default :</b><br/>"); builder.append(prettyHtmlPrint(tmp)); if (config.getRawArgs() != null) { builder.append("<b>updated with command line options:</b><br/>"); builder.append(String.join(" ", config.getRawArgs())); if (config.getConfigFile() != null) { builder.append("<br/><b>and configuration loaded from ").append(config.getConfigFile()).append(":</b><br/>"); try { builder.append(String.join("<br/>", Files.readAllLines(new File(config.getConfigFile()).toPath()))); } catch (IOException e) { builder.append("<b>").append(e.getMessage()).append("</b>"); } } } builder.append("</div>"); // End of Verbose Content builder.append("</div>"); // End of Verbose Container return builder.toString(); }
java
private String getVerboseConfig() { StringBuilder builder = new StringBuilder(); GridHubConfiguration config = getRegistry().getHub().getConfiguration(); builder.append("<div id='verbose-config-container'>"); builder.append("<a id='verbose-config-view-toggle' href='#'>View Verbose</a>"); builder.append("<div id='verbose-config-content'>"); GridHubConfiguration tmp = new GridHubConfiguration(); builder.append("<br/><b>The final configuration comes from:</b><br/>"); builder.append("<b>the default :</b><br/>"); builder.append(prettyHtmlPrint(tmp)); if (config.getRawArgs() != null) { builder.append("<b>updated with command line options:</b><br/>"); builder.append(String.join(" ", config.getRawArgs())); if (config.getConfigFile() != null) { builder.append("<br/><b>and configuration loaded from ").append(config.getConfigFile()).append(":</b><br/>"); try { builder.append(String.join("<br/>", Files.readAllLines(new File(config.getConfigFile()).toPath()))); } catch (IOException e) { builder.append("<b>").append(e.getMessage()).append("</b>"); } } } builder.append("</div>"); // End of Verbose Content builder.append("</div>"); // End of Verbose Container return builder.toString(); }
[ "private", "String", "getVerboseConfig", "(", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "GridHubConfiguration", "config", "=", "getRegistry", "(", ")", ".", "getHub", "(", ")", ".", "getConfiguration", "(", ")", ";", "...
Displays more detailed configuration @return html representation of the verbose hub config
[ "Displays", "more", "detailed", "configuration" ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/ConsoleServlet.java#L225-L255
train
Get the verbose configuration
[ 30522, 2797, 5164, 2131, 6299, 15853, 8586, 2239, 8873, 2290, 1006, 1007, 1063, 5164, 8569, 23891, 2099, 12508, 1027, 2047, 5164, 8569, 23891, 2099, 1006, 1007, 1025, 8370, 6979, 9818, 2239, 8873, 27390, 3370, 9530, 8873, 2290, 1027, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java
WordBasedSegment.checkDateElements
private static void checkDateElements(List<Vertex> linkedArray) { if (linkedArray.size() < 2) return; ListIterator<Vertex> listIterator = linkedArray.listIterator(); Vertex next = listIterator.next(); Vertex current = next; while (listIterator.hasNext()) { next = listIterator.next(); if (TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord)) { //===== 1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并且当前词词性是时间 String nextWord = next.realWord; if ((nextWord.length() == 1 && "月日时分秒".contains(nextWord)) || (nextWord.length() == 2 && nextWord.equals("月份"))) { mergeDate(listIterator, next, current); } //===== 2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。 else if (nextWord.equals("年")) { if (TextUtility.isYearTime(current.realWord)) { mergeDate(listIterator, next, current); } //===== 否则当前词就是数字了 ===== else { current.confirmNature(Nature.m); } } else { //===== 3、如果最后一个汉字是"点" ,则认为当前数字是时间 if (current.realWord.endsWith("点")) { current.confirmNature(Nature.t, true); } else { char[] tmpCharArray = current.realWord.toCharArray(); String lastChar = String.valueOf(tmpCharArray[tmpCharArray.length - 1]); //===== 4、如果当前串最后一个汉字不是"∶·./"和半角的'.''/',那么是数 if (!"∶·././".contains(lastChar)) { current.confirmNature(Nature.m, true); } //===== 5、当前串最后一个汉字是"∶·./"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如"1." else if (current.realWord.length() > 1) { char last = current.realWord.charAt(current.realWord.length() - 1); current = Vertex.newNumberInstance(current.realWord.substring(0, current.realWord.length() - 1)); listIterator.previous(); listIterator.previous(); listIterator.set(current); listIterator.next(); listIterator.add(Vertex.newPunctuationInstance(String.valueOf(last))); } } } } current = next; } // logger.trace("日期识别后:" + Graph.parseResult(linkedArray)); }
java
private static void checkDateElements(List<Vertex> linkedArray) { if (linkedArray.size() < 2) return; ListIterator<Vertex> listIterator = linkedArray.listIterator(); Vertex next = listIterator.next(); Vertex current = next; while (listIterator.hasNext()) { next = listIterator.next(); if (TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord)) { //===== 1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并且当前词词性是时间 String nextWord = next.realWord; if ((nextWord.length() == 1 && "月日时分秒".contains(nextWord)) || (nextWord.length() == 2 && nextWord.equals("月份"))) { mergeDate(listIterator, next, current); } //===== 2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。 else if (nextWord.equals("年")) { if (TextUtility.isYearTime(current.realWord)) { mergeDate(listIterator, next, current); } //===== 否则当前词就是数字了 ===== else { current.confirmNature(Nature.m); } } else { //===== 3、如果最后一个汉字是"点" ,则认为当前数字是时间 if (current.realWord.endsWith("点")) { current.confirmNature(Nature.t, true); } else { char[] tmpCharArray = current.realWord.toCharArray(); String lastChar = String.valueOf(tmpCharArray[tmpCharArray.length - 1]); //===== 4、如果当前串最后一个汉字不是"∶·./"和半角的'.''/',那么是数 if (!"∶·././".contains(lastChar)) { current.confirmNature(Nature.m, true); } //===== 5、当前串最后一个汉字是"∶·./"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如"1." else if (current.realWord.length() > 1) { char last = current.realWord.charAt(current.realWord.length() - 1); current = Vertex.newNumberInstance(current.realWord.substring(0, current.realWord.length() - 1)); listIterator.previous(); listIterator.previous(); listIterator.set(current); listIterator.next(); listIterator.add(Vertex.newPunctuationInstance(String.valueOf(last))); } } } } current = next; } // logger.trace("日期识别后:" + Graph.parseResult(linkedArray)); }
[ "private", "static", "void", "checkDateElements", "(", "List", "<", "Vertex", ">", "linkedArray", ")", "{", "if", "(", "linkedArray", ".", "size", "(", ")", "<", "2", ")", "return", ";", "ListIterator", "<", "Vertex", ">", "listIterator", "=", "linkedArray...
====================================================================
[ "====================================================================" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L149-L213
train
checkDateElements This method checks if the list of vertices contains a date element.
[ 30522, 2797, 10763, 11675, 4638, 13701, 12260, 8163, 1006, 2862, 1026, 19449, 1028, 5799, 2906, 9447, 1007, 1063, 2065, 1006, 5799, 2906, 9447, 1012, 2946, 1006, 1007, 1026, 1016, 1007, 2709, 1025, 2862, 21646, 8844, 1026, 19449, 1028, 2862...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.populateHeader
public Result populateHeader(ClientRequest request, String authToken, String correlationId, String traceabilityId) { if(traceabilityId != null) { addAuthTokenTrace(request, authToken, traceabilityId); } else { addAuthToken(request, authToken); } Result<Jwt> result = tokenManager.getJwt(request); if(result.isFailure()) { return Failure.of(result.getError()); } request.getRequestHeaders().put(HttpStringConstants.CORRELATION_ID, correlationId); request.getRequestHeaders().put(HttpStringConstants.SCOPE_TOKEN, "Bearer " + result.getResult().getJwt()); return result; }
java
public Result populateHeader(ClientRequest request, String authToken, String correlationId, String traceabilityId) { if(traceabilityId != null) { addAuthTokenTrace(request, authToken, traceabilityId); } else { addAuthToken(request, authToken); } Result<Jwt> result = tokenManager.getJwt(request); if(result.isFailure()) { return Failure.of(result.getError()); } request.getRequestHeaders().put(HttpStringConstants.CORRELATION_ID, correlationId); request.getRequestHeaders().put(HttpStringConstants.SCOPE_TOKEN, "Bearer " + result.getResult().getJwt()); return result; }
[ "public", "Result", "populateHeader", "(", "ClientRequest", "request", ",", "String", "authToken", ",", "String", "correlationId", ",", "String", "traceabilityId", ")", "{", "if", "(", "traceabilityId", "!=", "null", ")", "{", "addAuthTokenTrace", "(", "request", ...
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. authToken, correlationId and traceabilityId are passed in as strings. This method is used in API to API call @param request the http request @param authToken the authorization token @param correlationId the correlation id @param traceabilityId the traceability id @return Result when fail to get jwt, it will return a Status.
[ "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", ".", "authTo...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L370-L381
train
Populate the request header with the token.
[ 30522, 2270, 2765, 3769, 9869, 4974, 2121, 1006, 7396, 2890, 15500, 5227, 1010, 5164, 8740, 2705, 18715, 2368, 1010, 5164, 16902, 3593, 1010, 5164, 7637, 8010, 3593, 1007, 1063, 2065, 1006, 7637, 8010, 3593, 999, 1027, 19701, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
buffer/src/main/java/io/netty/buffer/PoolChunkList.java
PoolChunkList.move0
private boolean move0(PoolChunk<T> chunk) { if (prevList == null) { // There is no previous PoolChunkList so return false which result in having the PoolChunk destroyed and // all memory associated with the PoolChunk will be released. assert chunk.usage() == 0; return false; } return prevList.move(chunk); }
java
private boolean move0(PoolChunk<T> chunk) { if (prevList == null) { // There is no previous PoolChunkList so return false which result in having the PoolChunk destroyed and // all memory associated with the PoolChunk will be released. assert chunk.usage() == 0; return false; } return prevList.move(chunk); }
[ "private", "boolean", "move0", "(", "PoolChunk", "<", "T", ">", "chunk", ")", "{", "if", "(", "prevList", "==", "null", ")", "{", "// There is no previous PoolChunkList so return false which result in having the PoolChunk destroyed and", "// all memory associated with the PoolC...
Moves the {@link PoolChunk} down the {@link PoolChunkList} linked-list so it will end up in the right {@link PoolChunkList} that has the correct minUsage / maxUsage in respect to {@link PoolChunk#usage()}.
[ "Moves", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolChunkList.java#L125-L133
train
Move the PoolChunk to the beginning of the list.
[ 30522, 2797, 22017, 20898, 2693, 2692, 1006, 4770, 20760, 8950, 1026, 1056, 1028, 20000, 1007, 1063, 2065, 1006, 3653, 2615, 9863, 1027, 1027, 19701, 1007, 1063, 1013, 1013, 2045, 2003, 2053, 3025, 4770, 20760, 8950, 9863, 2061, 2709, 6270,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
RestTemplateBuilder.interceptors
public RestTemplateBuilder interceptors( ClientHttpRequestInterceptor... interceptors) { Assert.notNull(interceptors, "interceptors must not be null"); return interceptors(Arrays.asList(interceptors)); }
java
public RestTemplateBuilder interceptors( ClientHttpRequestInterceptor... interceptors) { Assert.notNull(interceptors, "interceptors must not be null"); return interceptors(Arrays.asList(interceptors)); }
[ "public", "RestTemplateBuilder", "interceptors", "(", "ClientHttpRequestInterceptor", "...", "interceptors", ")", "{", "Assert", ".", "notNull", "(", "interceptors", ",", "\"interceptors must not be null\"", ")", ";", "return", "interceptors", "(", "Arrays", ".", "asLis...
Set the {@link ClientHttpRequestInterceptor ClientHttpRequestInterceptors} that should be used with the {@link RestTemplate}. Setting this value will replace any previously defined interceptors. @param interceptors the interceptors to set @return a new builder instance @since 1.4.1 @see #additionalInterceptors(ClientHttpRequestInterceptor...)
[ "Set", "the", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L246-L250
train
Add interceptors to the response.
[ 30522, 2270, 2717, 18532, 15725, 8569, 23891, 2099, 24727, 2015, 1006, 7396, 11039, 25856, 2890, 15500, 18447, 2121, 3401, 13876, 2953, 1012, 1012, 1012, 24727, 2015, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 24727, 2015, 1010, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java
HttpStaticFileServerHandler.sendAndCleanupConnection
private void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response) { final FullHttpRequest request = this.request; final boolean keepAlive = HttpUtil.isKeepAlive(request); HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { // We're going to close the connection as soon as the response is sent, // so we should also make it clear for the client. response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } else if (request.protocolVersion().equals(HTTP_1_0)) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); } ChannelFuture flushPromise = ctx.writeAndFlush(response); if (!keepAlive) { // Close the connection as soon as the response is sent. flushPromise.addListener(ChannelFutureListener.CLOSE); } }
java
private void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response) { final FullHttpRequest request = this.request; final boolean keepAlive = HttpUtil.isKeepAlive(request); HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { // We're going to close the connection as soon as the response is sent, // so we should also make it clear for the client. response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } else if (request.protocolVersion().equals(HTTP_1_0)) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); } ChannelFuture flushPromise = ctx.writeAndFlush(response); if (!keepAlive) { // Close the connection as soon as the response is sent. flushPromise.addListener(ChannelFutureListener.CLOSE); } }
[ "private", "void", "sendAndCleanupConnection", "(", "ChannelHandlerContext", "ctx", ",", "FullHttpResponse", "response", ")", "{", "final", "FullHttpRequest", "request", "=", "this", ".", "request", ";", "final", "boolean", "keepAlive", "=", "HttpUtil", ".", "isKeep...
If Keep-Alive is disabled, attaches "Connection: close" header to the response and closes the connection after the response being sent.
[ "If", "Keep", "-", "Alive", "is", "disabled", "attaches", "Connection", ":", "close", "header", "to", "the", "response", "and", "closes", "the", "connection", "after", "the", "response", "being", "sent", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java#L349-L367
train
Send and cleanup connection.
[ 30522, 2797, 11675, 4604, 5685, 14321, 24076, 15042, 18256, 7542, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 2440, 11039, 25856, 6072, 26029, 3366, 3433, 1007, 1063, 2345, 2440, 11039, 25856, 2890, 15500, 5227, 1027, 2023, 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...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionStatus.java
SpdySessionStatus.valueOf
public static SpdySessionStatus valueOf(int code) { switch (code) { case 0: return OK; case 1: return PROTOCOL_ERROR; case 2: return INTERNAL_ERROR; } return new SpdySessionStatus(code, "UNKNOWN (" + code + ')'); }
java
public static SpdySessionStatus valueOf(int code) { switch (code) { case 0: return OK; case 1: return PROTOCOL_ERROR; case 2: return INTERNAL_ERROR; } return new SpdySessionStatus(code, "UNKNOWN (" + code + ')'); }
[ "public", "static", "SpdySessionStatus", "valueOf", "(", "int", "code", ")", "{", "switch", "(", "code", ")", "{", "case", "0", ":", "return", "OK", ";", "case", "1", ":", "return", "PROTOCOL_ERROR", ";", "case", "2", ":", "return", "INTERNAL_ERROR", ";"...
Returns the {@link SpdySessionStatus} represented by the specified code. If the specified code is a defined SPDY status code, a cached instance will be returned. Otherwise, a new instance will be returned.
[ "Returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionStatus.java#L46-L57
train
Gets the status object for a specific session code.
[ 30522, 2270, 10763, 23772, 23274, 28231, 9153, 5809, 3643, 11253, 1006, 20014, 3642, 1007, 1063, 6942, 1006, 3642, 1007, 1063, 2553, 1014, 1024, 2709, 7929, 1025, 2553, 1015, 1024, 2709, 8778, 1035, 7561, 1025, 2553, 1016, 1024, 2709, 4722,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.escapeCsv
public static CharSequence escapeCsv(CharSequence value, boolean trimWhiteSpace) { int length = checkNotNull(value, "value").length(); int start; int last; if (trimWhiteSpace) { start = indexOfFirstNonOwsChar(value, length); last = indexOfLastNonOwsChar(value, start, length); } else { start = 0; last = length - 1; } if (start > last) { return EMPTY_STRING; } int firstUnescapedSpecial = -1; boolean quoted = false; if (isDoubleQuote(value.charAt(start))) { quoted = isDoubleQuote(value.charAt(last)) && last > start; if (quoted) { start++; last--; } else { firstUnescapedSpecial = start; } } if (firstUnescapedSpecial < 0) { if (quoted) { for (int i = start; i <= last; i++) { if (isDoubleQuote(value.charAt(i))) { if (i == last || !isDoubleQuote(value.charAt(i + 1))) { firstUnescapedSpecial = i; break; } i++; } } } else { for (int i = start; i <= last; i++) { char c = value.charAt(i); if (c == LINE_FEED || c == CARRIAGE_RETURN || c == COMMA) { firstUnescapedSpecial = i; break; } if (isDoubleQuote(c)) { if (i == last || !isDoubleQuote(value.charAt(i + 1))) { firstUnescapedSpecial = i; break; } i++; } } } if (firstUnescapedSpecial < 0) { // Special characters is not found or all of them already escaped. // In the most cases returns a same string. New string will be instantiated (via StringBuilder) // only if it really needed. It's important to prevent GC extra load. return quoted? value.subSequence(start - 1, last + 2) : value.subSequence(start, last + 1); } } StringBuilder result = new StringBuilder(last - start + 1 + CSV_NUMBER_ESCAPE_CHARACTERS); result.append(DOUBLE_QUOTE).append(value, start, firstUnescapedSpecial); for (int i = firstUnescapedSpecial; i <= last; i++) { char c = value.charAt(i); if (isDoubleQuote(c)) { result.append(DOUBLE_QUOTE); if (i < last && isDoubleQuote(value.charAt(i + 1))) { i++; } } result.append(c); } return result.append(DOUBLE_QUOTE); }
java
public static CharSequence escapeCsv(CharSequence value, boolean trimWhiteSpace) { int length = checkNotNull(value, "value").length(); int start; int last; if (trimWhiteSpace) { start = indexOfFirstNonOwsChar(value, length); last = indexOfLastNonOwsChar(value, start, length); } else { start = 0; last = length - 1; } if (start > last) { return EMPTY_STRING; } int firstUnescapedSpecial = -1; boolean quoted = false; if (isDoubleQuote(value.charAt(start))) { quoted = isDoubleQuote(value.charAt(last)) && last > start; if (quoted) { start++; last--; } else { firstUnescapedSpecial = start; } } if (firstUnescapedSpecial < 0) { if (quoted) { for (int i = start; i <= last; i++) { if (isDoubleQuote(value.charAt(i))) { if (i == last || !isDoubleQuote(value.charAt(i + 1))) { firstUnescapedSpecial = i; break; } i++; } } } else { for (int i = start; i <= last; i++) { char c = value.charAt(i); if (c == LINE_FEED || c == CARRIAGE_RETURN || c == COMMA) { firstUnescapedSpecial = i; break; } if (isDoubleQuote(c)) { if (i == last || !isDoubleQuote(value.charAt(i + 1))) { firstUnescapedSpecial = i; break; } i++; } } } if (firstUnescapedSpecial < 0) { // Special characters is not found or all of them already escaped. // In the most cases returns a same string. New string will be instantiated (via StringBuilder) // only if it really needed. It's important to prevent GC extra load. return quoted? value.subSequence(start - 1, last + 2) : value.subSequence(start, last + 1); } } StringBuilder result = new StringBuilder(last - start + 1 + CSV_NUMBER_ESCAPE_CHARACTERS); result.append(DOUBLE_QUOTE).append(value, start, firstUnescapedSpecial); for (int i = firstUnescapedSpecial; i <= last; i++) { char c = value.charAt(i); if (isDoubleQuote(c)) { result.append(DOUBLE_QUOTE); if (i < last && isDoubleQuote(value.charAt(i + 1))) { i++; } } result.append(c); } return result.append(DOUBLE_QUOTE); }
[ "public", "static", "CharSequence", "escapeCsv", "(", "CharSequence", "value", ",", "boolean", "trimWhiteSpace", ")", "{", "int", "length", "=", "checkNotNull", "(", "value", ",", "\"value\"", ")", ".", "length", "(", ")", ";", "int", "start", ";", "int", ...
Escapes the specified value, if necessary according to <a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>. @param value The value which will be escaped according to <a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a> @param trimWhiteSpace The value will first be trimmed of its optional white-space characters, according to <a href="https://tools.ietf.org/html/rfc7230#section-7">RFC-7230</a> @return {@link CharSequence} the escaped value if necessary, or the value unchanged
[ "Escapes", "the", "specified", "value", "if", "necessary", "according", "to", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc4180#section", "-", "2", ">", "RFC", "-", "4180<", "/", "a", ">", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L314-L390
train
Escape CSV characters.
[ 30522, 2270, 10763, 25869, 3366, 4226, 5897, 4019, 6169, 2615, 1006, 25869, 3366, 4226, 5897, 3643, 1010, 22017, 20898, 12241, 2860, 16584, 2229, 15327, 1007, 1063, 20014, 3091, 1027, 4638, 17048, 11231, 3363, 1006, 3643, 1010, 1000, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
http-url/src/main/java/com/networknt/url/URLNormalizer.java
URLNormalizer.removeDefaultPort
public URLNormalizer removeDefaultPort() { URL u = toURL(); if ("http".equalsIgnoreCase(u.getProtocol()) && u.getPort() == HttpURL.DEFAULT_HTTP_PORT) { url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTP_PORT, ""); } else if ("https".equalsIgnoreCase(u.getProtocol()) && u.getPort() == HttpURL.DEFAULT_HTTPS_PORT) { url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTPS_PORT, ""); } return this; }
java
public URLNormalizer removeDefaultPort() { URL u = toURL(); if ("http".equalsIgnoreCase(u.getProtocol()) && u.getPort() == HttpURL.DEFAULT_HTTP_PORT) { url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTP_PORT, ""); } else if ("https".equalsIgnoreCase(u.getProtocol()) && u.getPort() == HttpURL.DEFAULT_HTTPS_PORT) { url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTPS_PORT, ""); } return this; }
[ "public", "URLNormalizer", "removeDefaultPort", "(", ")", "{", "URL", "u", "=", "toURL", "(", ")", ";", "if", "(", "\"http\"", ".", "equalsIgnoreCase", "(", "u", ".", "getProtocol", "(", ")", ")", "&&", "u", ".", "getPort", "(", ")", "==", "HttpURL", ...
Removes the default port (80 for http, and 443 for https).<p> <code>http://www.example.com:80/bar.html &rarr; http://www.example.com/bar.html</code> @return this instance
[ "Removes", "the", "default", "port", "(", "80", "for", "http", "and", "443", "for", "https", ")", ".", "<p", ">", "<code", ">", "http", ":", "//", "www", ".", "example", ".", "com", ":", "80", "/", "bar", ".", "html", "&rarr", ";", "http", ":", ...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L295-L305
train
Remove the default port from the URL.
[ 30522, 2270, 24471, 19666, 2953, 9067, 17629, 3718, 12879, 23505, 6442, 1006, 1007, 1063, 24471, 2140, 1057, 1027, 2778, 2140, 1006, 1007, 1025, 2065, 1006, 1000, 8299, 1000, 1012, 19635, 23773, 5686, 18382, 1006, 1057, 1012, 2131, 21572, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
BeanDefinitionLoader.setResourceLoader
public void setResourceLoader(ResourceLoader resourceLoader) { this.resourceLoader = resourceLoader; this.xmlReader.setResourceLoader(resourceLoader); this.scanner.setResourceLoader(resourceLoader); }
java
public void setResourceLoader(ResourceLoader resourceLoader) { this.resourceLoader = resourceLoader; this.xmlReader.setResourceLoader(resourceLoader); this.scanner.setResourceLoader(resourceLoader); }
[ "public", "void", "setResourceLoader", "(", "ResourceLoader", "resourceLoader", ")", "{", "this", ".", "resourceLoader", "=", "resourceLoader", ";", "this", ".", "xmlReader", ".", "setResourceLoader", "(", "resourceLoader", ")", ";", "this", ".", "scanner", ".", ...
Set the resource loader to be used by the underlying readers and scanner. @param resourceLoader the resource loader
[ "Set", "the", "resource", "loader", "to", "be", "used", "by", "the", "underlying", "readers", "and", "scanner", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java#L105-L109
train
Sets the resource loader.
[ 30522, 30524, 2023, 1012, 20950, 16416, 4063, 1012, 2275, 6072, 8162, 29109, 10441, 4063, 1006, 7692, 11066, 2121, 1007, 1025, 2023, 1012, 26221, 1012, 2275, 6072, 8162, 29109, 10441, 4063, 1006, 7692, 11066, 2121, 1007, 1025, 1065, 102, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
TypeExtractionUtils.extractTypeFromLambda
public static Type extractTypeFromLambda( Class<?> baseClass, LambdaExecutable exec, int[] lambdaTypeArgumentIndices, int paramLen, int baseParametersLen) { Type output = exec.getParameterTypes()[paramLen - baseParametersLen + lambdaTypeArgumentIndices[0]]; for (int i = 1; i < lambdaTypeArgumentIndices.length; i++) { validateLambdaType(baseClass, output); output = extractTypeArgument(output, lambdaTypeArgumentIndices[i]); } validateLambdaType(baseClass, output); return output; }
java
public static Type extractTypeFromLambda( Class<?> baseClass, LambdaExecutable exec, int[] lambdaTypeArgumentIndices, int paramLen, int baseParametersLen) { Type output = exec.getParameterTypes()[paramLen - baseParametersLen + lambdaTypeArgumentIndices[0]]; for (int i = 1; i < lambdaTypeArgumentIndices.length; i++) { validateLambdaType(baseClass, output); output = extractTypeArgument(output, lambdaTypeArgumentIndices[i]); } validateLambdaType(baseClass, output); return output; }
[ "public", "static", "Type", "extractTypeFromLambda", "(", "Class", "<", "?", ">", "baseClass", ",", "LambdaExecutable", "exec", ",", "int", "[", "]", "lambdaTypeArgumentIndices", ",", "int", "paramLen", ",", "int", "baseParametersLen", ")", "{", "Type", "output"...
Extracts type from given index from lambda. It supports nested types. @param baseClass SAM function that the lambda implements @param exec lambda function to extract the type from @param lambdaTypeArgumentIndices position of type to extract in type hierarchy @param paramLen count of total parameters of the lambda (including closure parameters) @param baseParametersLen count of lambda interface parameters (without closure parameters) @return extracted type
[ "Extracts", "type", "from", "given", "index", "from", "lambda", ".", "It", "supports", "nested", "types", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L168-L181
train
Extract type from lambda.
[ 30522, 2270, 10763, 2828, 14817, 13874, 19699, 5358, 10278, 2497, 2850, 1006, 2465, 1026, 1029, 1028, 2918, 26266, 1010, 23375, 10288, 8586, 23056, 4654, 8586, 1010, 20014, 1031, 1033, 23375, 13874, 2906, 22850, 4765, 22254, 23522, 1010, 2001...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonEnvironmentFactory.java
PythonEnvironmentFactory.create_local_execution_environment
public PythonStreamExecutionEnvironment create_local_execution_environment(int parallelism, Configuration config) { return new PythonStreamExecutionEnvironment( StreamExecutionEnvironment.createLocalEnvironment(parallelism, config), new Path(localTmpPath), scriptName); }
java
public PythonStreamExecutionEnvironment create_local_execution_environment(int parallelism, Configuration config) { return new PythonStreamExecutionEnvironment( StreamExecutionEnvironment.createLocalEnvironment(parallelism, config), new Path(localTmpPath), scriptName); }
[ "public", "PythonStreamExecutionEnvironment", "create_local_execution_environment", "(", "int", "parallelism", ",", "Configuration", "config", ")", "{", "return", "new", "PythonStreamExecutionEnvironment", "(", "StreamExecutionEnvironment", ".", "createLocalEnvironment", "(", "...
A thin wrapper layer over {@link StreamExecutionEnvironment#createLocalEnvironment(int, Configuration)}. @param parallelism The parallelism for the local environment. @param config Pass a custom configuration into the cluster @return A local python execution environment with the specified parallelism.
[ "A", "thin", "wrapper", "layer", "over", "{", "@link", "StreamExecutionEnvironment#createLocalEnvironment", "(", "int", "Configuration", ")", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonEnvironmentFactory.java#L74-L77
train
Create a local Python stream execution environment.
[ 30522, 2270, 18750, 30524, 1012, 3443, 4135, 9289, 2368, 21663, 2239, 3672, 1006, 5903, 2964, 1010, 9530, 8873, 2290, 1007, 1010, 2047, 4130, 1006, 2334, 21246, 13944, 2705, 1007, 1010, 5896, 18442, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java
WatchUtil.createModify
public static WatchMonitor createModify(Path path, int maxDepth, Watcher watcher) { final WatchMonitor watchMonitor = create(path, maxDepth, WatchMonitor.ENTRY_MODIFY); watchMonitor.setWatcher(watcher); return watchMonitor; }
java
public static WatchMonitor createModify(Path path, int maxDepth, Watcher watcher) { final WatchMonitor watchMonitor = create(path, maxDepth, WatchMonitor.ENTRY_MODIFY); watchMonitor.setWatcher(watcher); return watchMonitor; }
[ "public", "static", "WatchMonitor", "createModify", "(", "Path", "path", ",", "int", "maxDepth", ",", "Watcher", "watcher", ")", "{", "final", "WatchMonitor", "watchMonitor", "=", "create", "(", "path", ",", "maxDepth", ",", "WatchMonitor", ".", "ENTRY_MODIFY", ...
创建并初始化监听,监听修改事件 @param path 路径 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @param watcher {@link Watcher} @return {@link WatchMonitor} @since 4.5.2
[ "创建并初始化监听,监听修改事件" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L375-L379
train
Creates a new watch monitor that changes the state of the file system.
[ 30522, 2270, 10763, 3422, 8202, 15660, 3443, 5302, 4305, 12031, 1006, 4130, 4130, 1010, 20014, 4098, 3207, 13876, 2232, 1010, 3422, 2121, 3422, 2121, 1007, 1063, 2345, 3422, 8202, 15660, 3422, 8202, 15660, 1027, 3443, 1006, 4130, 1010, 4098...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/AsciiString.java
AsciiString.copy
public void copy(int srcIdx, char[] dst, int dstIdx, int length) { if (dst == null) { throw new NullPointerException("dst"); } if (isOutOfBounds(srcIdx, length, length())) { throw new IndexOutOfBoundsException("expected: " + "0 <= srcIdx(" + srcIdx + ") <= srcIdx + length(" + length + ") <= srcLen(" + length() + ')'); } final int dstEnd = dstIdx + length; for (int i = dstIdx, j = srcIdx + arrayOffset(); i < dstEnd; i++, j++) { dst[i] = b2c(value[j]); } }
java
public void copy(int srcIdx, char[] dst, int dstIdx, int length) { if (dst == null) { throw new NullPointerException("dst"); } if (isOutOfBounds(srcIdx, length, length())) { throw new IndexOutOfBoundsException("expected: " + "0 <= srcIdx(" + srcIdx + ") <= srcIdx + length(" + length + ") <= srcLen(" + length() + ')'); } final int dstEnd = dstIdx + length; for (int i = dstIdx, j = srcIdx + arrayOffset(); i < dstEnd; i++, j++) { dst[i] = b2c(value[j]); } }
[ "public", "void", "copy", "(", "int", "srcIdx", ",", "char", "[", "]", "dst", ",", "int", "dstIdx", ",", "int", "length", ")", "{", "if", "(", "dst", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"dst\"", ")", ";", "}", "if...
Copied the content of this string to a character array. @param srcIdx the starting offset of characters to copy. @param dst the destination character array. @param dstIdx the starting offset in the destination byte array. @param length the number of characters to copy.
[ "Copied", "the", "content", "of", "this", "string", "to", "a", "character", "array", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L587-L601
train
Copy the contents of this instance to the specified destination array.
[ 30522, 2270, 11675, 6100, 1006, 20014, 5034, 6895, 2094, 2595, 1010, 25869, 1031, 1033, 16233, 2102, 1010, 20014, 16233, 3775, 2094, 2595, 1010, 20014, 3091, 1007, 1063, 2065, 1006, 16233, 2102, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 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/seg/common/WordNet.java
WordNet.insert
public void insert(int line, Vertex vertex, WordNet wordNetAll) { for (Vertex oldVertex : vertexes[line]) { // 保证唯一性 if (oldVertex.realWord.length() == vertex.realWord.length()) return; } vertexes[line].add(vertex); ++size; // 保证这个词语前面直连 final int start = Math.max(0, line - 5); // 效率起见,只扫描前4行 for (int l = line - 1; l > start; --l) { LinkedList<Vertex> all = wordNetAll.get(l); if (all.size() <= vertexes[l].size()) continue; for (Vertex pre : all) { if (pre.length() + l == line) { vertexes[l].add(pre); ++size; } } } // 保证这个词语后面直连 int l = line + vertex.realWord.length(); LinkedList<Vertex> targetLine = wordNetAll.get(l); if (vertexes[l].size() == 0 && targetLine.size() != 0) // 有时候vertexes里面的词语已经经过用户词典合并,造成数量更少 { size += targetLine.size(); vertexes[l] = targetLine; } }
java
public void insert(int line, Vertex vertex, WordNet wordNetAll) { for (Vertex oldVertex : vertexes[line]) { // 保证唯一性 if (oldVertex.realWord.length() == vertex.realWord.length()) return; } vertexes[line].add(vertex); ++size; // 保证这个词语前面直连 final int start = Math.max(0, line - 5); // 效率起见,只扫描前4行 for (int l = line - 1; l > start; --l) { LinkedList<Vertex> all = wordNetAll.get(l); if (all.size() <= vertexes[l].size()) continue; for (Vertex pre : all) { if (pre.length() + l == line) { vertexes[l].add(pre); ++size; } } } // 保证这个词语后面直连 int l = line + vertex.realWord.length(); LinkedList<Vertex> targetLine = wordNetAll.get(l); if (vertexes[l].size() == 0 && targetLine.size() != 0) // 有时候vertexes里面的词语已经经过用户词典合并,造成数量更少 { size += targetLine.size(); vertexes[l] = targetLine; } }
[ "public", "void", "insert", "(", "int", "line", ",", "Vertex", "vertex", ",", "WordNet", "wordNetAll", ")", "{", "for", "(", "Vertex", "oldVertex", ":", "vertexes", "[", "line", "]", ")", "{", "// 保证唯一性", "if", "(", "oldVertex", ".", "realWord", ".", "...
添加顶点,同时检查此顶点是否悬孤,如果悬孤则自动补全 @param line @param vertex @param wordNetAll 这是一个完全的词图
[ "添加顶点,同时检查此顶点是否悬孤,如果悬孤则自动补全" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/WordNet.java#L141-L174
train
Insert a single entry into the list.
[ 30522, 2270, 11675, 19274, 1006, 20014, 2240, 1010, 19449, 19449, 1010, 2773, 7159, 2773, 7159, 8095, 1007, 1063, 2005, 1006, 19449, 2214, 16874, 10288, 1024, 19449, 2229, 1031, 2240, 1033, 1007, 1063, 1013, 1013, 1766, 100, 100, 1740, 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-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java
AbstractFetcher.createPartitionStateHolders
private List<KafkaTopicPartitionState<KPH>> createPartitionStateHolders( List<KafkaTopicPartition> partitions, long initialOffset, int timestampWatermarkMode, SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic, SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated, ClassLoader userCodeClassLoader) throws IOException, ClassNotFoundException { Map<KafkaTopicPartition, Long> partitionsToInitialOffset = new HashMap<>(partitions.size()); for (KafkaTopicPartition partition : partitions) { partitionsToInitialOffset.put(partition, initialOffset); } return createPartitionStateHolders( partitionsToInitialOffset, timestampWatermarkMode, watermarksPeriodic, watermarksPunctuated, userCodeClassLoader); }
java
private List<KafkaTopicPartitionState<KPH>> createPartitionStateHolders( List<KafkaTopicPartition> partitions, long initialOffset, int timestampWatermarkMode, SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic, SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated, ClassLoader userCodeClassLoader) throws IOException, ClassNotFoundException { Map<KafkaTopicPartition, Long> partitionsToInitialOffset = new HashMap<>(partitions.size()); for (KafkaTopicPartition partition : partitions) { partitionsToInitialOffset.put(partition, initialOffset); } return createPartitionStateHolders( partitionsToInitialOffset, timestampWatermarkMode, watermarksPeriodic, watermarksPunctuated, userCodeClassLoader); }
[ "private", "List", "<", "KafkaTopicPartitionState", "<", "KPH", ">", ">", "createPartitionStateHolders", "(", "List", "<", "KafkaTopicPartition", ">", "partitions", ",", "long", "initialOffset", ",", "int", "timestampWatermarkMode", ",", "SerializedValue", "<", "Assig...
Shortcut variant of {@link #createPartitionStateHolders(Map, int, SerializedValue, SerializedValue, ClassLoader)} that uses the same offset for all partitions when creating their state holders.
[ "Shortcut", "variant", "of", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L583-L602
train
Creates the partition state holders for the given partitions.
[ 30522, 2797, 2862, 1026, 10556, 24316, 10610, 24330, 19362, 3775, 9285, 12259, 1026, 1047, 8458, 1028, 1028, 3443, 19362, 3775, 9285, 12259, 17794, 1006, 2862, 1026, 10556, 24316, 10610, 24330, 19362, 3775, 3508, 1028, 13571, 2015, 1010, 2146...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/nodes/exec/NodeResourceConfig.java
NodeResourceConfig.calOperatorParallelism
public static int calOperatorParallelism(double rowCount, Configuration tableConf) { int maxParallelism = getOperatorMaxParallelism(tableConf); int minParallelism = getOperatorMinParallelism(tableConf); int resultParallelism = (int) (rowCount / getRowCountPerPartition(tableConf)); return Math.max(Math.min(resultParallelism, maxParallelism), minParallelism); }
java
public static int calOperatorParallelism(double rowCount, Configuration tableConf) { int maxParallelism = getOperatorMaxParallelism(tableConf); int minParallelism = getOperatorMinParallelism(tableConf); int resultParallelism = (int) (rowCount / getRowCountPerPartition(tableConf)); return Math.max(Math.min(resultParallelism, maxParallelism), minParallelism); }
[ "public", "static", "int", "calOperatorParallelism", "(", "double", "rowCount", ",", "Configuration", "tableConf", ")", "{", "int", "maxParallelism", "=", "getOperatorMaxParallelism", "(", "tableConf", ")", ";", "int", "minParallelism", "=", "getOperatorMinParallelism",...
Calculates operator parallelism based on rowcount of the operator. @param rowCount rowCount of the operator @param tableConf Configuration. @return the result of operator parallelism.
[ "Calculates", "operator", "parallelism", "based", "on", "rowcount", "of", "the", "operator", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/nodes/exec/NodeResourceConfig.java#L74-L79
train
Cal operator parallelism.
[ 30522, 2270, 10763, 20014, 10250, 25918, 8844, 28689, 6216, 28235, 1006, 3313, 5216, 3597, 16671, 1010, 9563, 2795, 8663, 2546, 1007, 1063, 20014, 4098, 28689, 6216, 30524, 28689, 6216, 28235, 1006, 2795, 8663, 2546, 1007, 1025, 20014, 2765, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONUtil.java
JSONUtil.readJSONObject
public static JSONObject readJSONObject(File file, Charset charset) throws IORuntimeException { return parseObj(FileReader.create(file, charset).readString()); }
java
public static JSONObject readJSONObject(File file, Charset charset) throws IORuntimeException { return parseObj(FileReader.create(file, charset).readString()); }
[ "public", "static", "JSONObject", "readJSONObject", "(", "File", "file", ",", "Charset", "charset", ")", "throws", "IORuntimeException", "{", "return", "parseObj", "(", "FileReader", ".", "create", "(", "file", ",", "charset", ")", ".", "readString", "(", ")",...
读取JSONObject @param file JSON文件 @param charset 编码 @return JSONObject @throws IORuntimeException IO异常
[ "读取JSONObject" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L224-L226
train
Read a JSON object from a file.
[ 30522, 2270, 10763, 1046, 3385, 16429, 20614, 3191, 22578, 17175, 2497, 20614, 1006, 5371, 5371, 1010, 25869, 13462, 25869, 13462, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2709, 11968, 3366, 16429, 3501, 1006, 5371, 16416, 4063, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java
SslContextBuilder.trustManager
public SslContextBuilder trustManager(X509Certificate... trustCertCollection) { this.trustCertCollection = trustCertCollection != null ? trustCertCollection.clone() : null; trustManagerFactory = null; return this; }
java
public SslContextBuilder trustManager(X509Certificate... trustCertCollection) { this.trustCertCollection = trustCertCollection != null ? trustCertCollection.clone() : null; trustManagerFactory = null; return this; }
[ "public", "SslContextBuilder", "trustManager", "(", "X509Certificate", "...", "trustCertCollection", ")", "{", "this", ".", "trustCertCollection", "=", "trustCertCollection", "!=", "null", "?", "trustCertCollection", ".", "clone", "(", ")", ":", "null", ";", "trustM...
Trusted certificates for verifying the remote endpoint's certificate, {@code null} uses the system default.
[ "Trusted", "certificates", "for", "verifying", "the", "remote", "endpoint", "s", "certificate", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L202-L206
train
Set the trust manager certificate collection.
[ 30522, 2270, 7020, 22499, 10111, 18413, 8569, 23891, 2099, 3404, 24805, 4590, 1006, 1060, 12376, 2683, 17119, 3775, 8873, 16280, 1012, 1012, 1012, 3404, 17119, 13535, 14511, 18491, 1007, 1063, 2023, 1012, 3404, 17119, 13535, 14511, 18491, 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...