repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.getQuotaMetricsAsync
public Observable<Page<IotHubQuotaMetricInfoInner>> getQuotaMetricsAsync(final String resourceGroupName, final String resourceName) { return getQuotaMetricsWithServiceResponseAsync(resourceGroupName, resourceName) .map(new Func1<ServiceResponse<Page<IotHubQuotaMetricInfoInner>>, Page<IotHubQuotaMetricInfoInner>>() { @Override public Page<IotHubQuotaMetricInfoInner> call(ServiceResponse<Page<IotHubQuotaMetricInfoInner>> response) { return response.body(); } }); }
java
public Observable<Page<IotHubQuotaMetricInfoInner>> getQuotaMetricsAsync(final String resourceGroupName, final String resourceName) { return getQuotaMetricsWithServiceResponseAsync(resourceGroupName, resourceName) .map(new Func1<ServiceResponse<Page<IotHubQuotaMetricInfoInner>>, Page<IotHubQuotaMetricInfoInner>>() { @Override public Page<IotHubQuotaMetricInfoInner> call(ServiceResponse<Page<IotHubQuotaMetricInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "IotHubQuotaMetricInfoInner", ">", ">", "getQuotaMetricsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "resourceName", ")", "{", "return", "getQuotaMetricsWithServiceResponseAsync", "(", "resourceGrou...
Get the quota metrics for an IoT hub. Get the quota metrics for an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IotHubQuotaMetricInfoInner&gt; object
[ "Get", "the", "quota", "metrics", "for", "an", "IoT", "hub", ".", "Get", "the", "quota", "metrics", "for", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2345-L2353
dihedron/dihedron-commons
src/main/java/org/dihedron/core/zip/ZipArchive.java
ZipArchive.addFile
public void addFile(String zipEntry, InputStream input) throws IOException { if(input != null) { stream.putNextEntry(new ZipEntry(zipEntry)); Streams.copy(input, stream); } }
java
public void addFile(String zipEntry, InputStream input) throws IOException { if(input != null) { stream.putNextEntry(new ZipEntry(zipEntry)); Streams.copy(input, stream); } }
[ "public", "void", "addFile", "(", "String", "zipEntry", ",", "InputStream", "input", ")", "throws", "IOException", "{", "if", "(", "input", "!=", "null", ")", "{", "stream", ".", "putNextEntry", "(", "new", "ZipEntry", "(", "zipEntry", ")", ")", ";", "St...
Adds a file to the ZIP archive, given its content as an input stream. @param zipEntry name of the entry in the archive. @param input the stream from which data will be read to be added to the ZIP archive; the stream must be open and will not be closed once the operation is complete, so it is up to the caller to release it.
[ "Adds", "a", "file", "to", "the", "ZIP", "archive", "given", "its", "content", "as", "an", "input", "stream", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/zip/ZipArchive.java#L104-L109
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java
CompoundTag.setValue
public void setValue(Map<String, Tag> value) { this.value = new LinkedHashMap<String, Tag>(value); }
java
public void setValue(Map<String, Tag> value) { this.value = new LinkedHashMap<String, Tag>(value); }
[ "public", "void", "setValue", "(", "Map", "<", "String", ",", "Tag", ">", "value", ")", "{", "this", ".", "value", "=", "new", "LinkedHashMap", "<", "String", ",", "Tag", ">", "(", "value", ")", ";", "}" ]
Sets the value of this tag. @param value New value of this tag.
[ "Sets", "the", "value", "of", "this", "tag", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java#L54-L56
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.getAsync
public CompletableFuture<Object> getAsync(@DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> get(closure), getExecutor()); }
java
public CompletableFuture<Object> getAsync(@DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> get(closure), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "getAsync", "(", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "get", "(", "closur...
Executes an asynchronous GET request on the configured URI (asynchronous alias to the `get(Closure)` method), with additional configuration provided by the configuration closure. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletableFuture future = http.getAsync(){ request.uri.path = '/something' } def result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the resulting content
[ "Executes", "an", "asynchronous", "GET", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "get", "(", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure"...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L414-L416
alibaba/jstorm
jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/registry/YarnRegistryViewForProviders.java
YarnRegistryViewForProviders.putService
public String putService( String serviceClass, String serviceName, ServiceRecord record, boolean deleteTreeFirst) throws IOException { return putService(user, serviceClass, serviceName, record, deleteTreeFirst); }
java
public String putService( String serviceClass, String serviceName, ServiceRecord record, boolean deleteTreeFirst) throws IOException { return putService(user, serviceClass, serviceName, record, deleteTreeFirst); }
[ "public", "String", "putService", "(", "String", "serviceClass", ",", "String", "serviceName", ",", "ServiceRecord", "record", ",", "boolean", "deleteTreeFirst", ")", "throws", "IOException", "{", "return", "putService", "(", "user", ",", "serviceClass", ",", "ser...
Add a service under a path for the current user @param serviceClass service class to use under ~user @param serviceName name of the service @param record service record @param deleteTreeFirst perform recursive delete of the path first @return the path the service was created at @throws IOException
[ "Add", "a", "service", "under", "a", "path", "for", "the", "current", "user" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/registry/YarnRegistryViewForProviders.java#L201-L207
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_tcp_route_routeId_PUT
public void serviceName_tcp_route_routeId_PUT(String serviceName, Long routeId, OvhRouteTcp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}"; StringBuilder sb = path(qPath, serviceName, routeId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_tcp_route_routeId_PUT(String serviceName, Long routeId, OvhRouteTcp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}"; StringBuilder sb = path(qPath, serviceName, routeId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_tcp_route_routeId_PUT", "(", "String", "serviceName", ",", "Long", "routeId", ",", "OvhRouteTcp", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/tcp/route/{routeId}\"", ";", "StringBuilder"...
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/tcp/route/{routeId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param routeId [required] Id of your route
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1321-L1325
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java
KeyValueSources.fromZip
@Nonnull public static ImmutableKeyValueSource<Symbol, ByteSource> fromZip(final ZipFile zipFile, final Function<String, Symbol> idExtractor) { final ImmutableMap.Builder<Symbol, String> ret = ImmutableMap.builder(); // Build a map of the key for each file to the filename final Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { final ZipEntry entry = entries.nextElement(); final String name = entry.getName(); // Skip directories if (entry.isDirectory()) { continue; } final Symbol id = checkNotNull(idExtractor.apply(name)); ret.put(id, name); } return new ZipKeyValueSource(zipFile, ret.build()); }
java
@Nonnull public static ImmutableKeyValueSource<Symbol, ByteSource> fromZip(final ZipFile zipFile, final Function<String, Symbol> idExtractor) { final ImmutableMap.Builder<Symbol, String> ret = ImmutableMap.builder(); // Build a map of the key for each file to the filename final Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { final ZipEntry entry = entries.nextElement(); final String name = entry.getName(); // Skip directories if (entry.isDirectory()) { continue; } final Symbol id = checkNotNull(idExtractor.apply(name)); ret.put(id, name); } return new ZipKeyValueSource(zipFile, ret.build()); }
[ "@", "Nonnull", "public", "static", "ImmutableKeyValueSource", "<", "Symbol", ",", "ByteSource", ">", "fromZip", "(", "final", "ZipFile", "zipFile", ",", "final", "Function", "<", "String", ",", "Symbol", ">", "idExtractor", ")", "{", "final", "ImmutableMap", ...
Creates a new source using a zip file and a function that maps each entry in the zip file to a unique key. The caller must ensure that the zip file is not closed or modified, otherwise all behavior is undefined. All files in the zip file will be used; there is currently no way to exclude specific files. Use a default identity-like function that defines the mapping between keys and the entry used for their values, see {@link #fromZip(ZipFile)}. @param zipFile the zip file to use as a source @param idExtractor a function that returns a unique id for every file contained in the zip @return a new key-value source backed by the specified zip file @see #fromZip(ZipFile)
[ "Creates", "a", "new", "source", "using", "a", "zip", "file", "and", "a", "function", "that", "maps", "each", "entry", "in", "the", "zip", "file", "to", "a", "unique", "key", ".", "The", "caller", "must", "ensure", "that", "the", "zip", "file", "is", ...
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java#L82-L99
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ImplementationJTAImpl.java
ImplementationJTAImpl.newInternTransaction
private J2EETransactionImpl newInternTransaction() { if (log.isDebugEnabled()) log.debug("obtain new intern odmg-transaction"); J2EETransactionImpl tx = new J2EETransactionImpl(this); try { getConfigurator().configure(tx); } catch (ConfigurationException e) { throw new OJBRuntimeException("Cannot create new intern odmg transaction", e); } return tx; }
java
private J2EETransactionImpl newInternTransaction() { if (log.isDebugEnabled()) log.debug("obtain new intern odmg-transaction"); J2EETransactionImpl tx = new J2EETransactionImpl(this); try { getConfigurator().configure(tx); } catch (ConfigurationException e) { throw new OJBRuntimeException("Cannot create new intern odmg transaction", e); } return tx; }
[ "private", "J2EETransactionImpl", "newInternTransaction", "(", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"obtain new intern odmg-transaction\"", ")", ";", "J2EETransactionImpl", "tx", "=", "new", "J2EETransactionIm...
Returns a new intern odmg-transaction for the current database.
[ "Returns", "a", "new", "intern", "odmg", "-", "transaction", "for", "the", "current", "database", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationJTAImpl.java#L121-L134
bwkimmel/java-util
src/main/java/ca/eandb/util/ClassUtil.java
ClassUtil.writeClassToStream
public static void writeClassToStream(Class<?> cl, OutputStream out) throws IOException { InputStream in = getClassAsStream(cl); StreamUtil.writeStream(in, out); out.flush(); }
java
public static void writeClassToStream(Class<?> cl, OutputStream out) throws IOException { InputStream in = getClassAsStream(cl); StreamUtil.writeStream(in, out); out.flush(); }
[ "public", "static", "void", "writeClassToStream", "(", "Class", "<", "?", ">", "cl", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "InputStream", "in", "=", "getClassAsStream", "(", "cl", ")", ";", "StreamUtil", ".", "writeStream", "(", "in"...
Writes a class' bytecode to an <code>OutputStream</code>. @param cl The <code>Class</code> to write. @param out The <code>OutputStream</code> to write to. @throws IOException If unable to write to <code>out</code>.
[ "Writes", "a", "class", "bytecode", "to", "an", "<code", ">", "OutputStream<", "/", "code", ">", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/ClassUtil.java#L89-L93
G2G3Digital/substeps-framework
core/src/main/java/com/technophobia/substeps/runner/TagManager.java
TagManager.acceptTaggedScenario
public boolean acceptTaggedScenario(final Set<String> tags) { if (acceptAll || (acceptedTags.isEmpty() && excludedTags.isEmpty())) { return true; } else if (acceptedTags.size() > 0 && (tags == null || tags.isEmpty())) { return false; } else if (containsAny(tags, excludedTags)) { return false; } else { return tags == null || tags.containsAll(acceptedTags); } }
java
public boolean acceptTaggedScenario(final Set<String> tags) { if (acceptAll || (acceptedTags.isEmpty() && excludedTags.isEmpty())) { return true; } else if (acceptedTags.size() > 0 && (tags == null || tags.isEmpty())) { return false; } else if (containsAny(tags, excludedTags)) { return false; } else { return tags == null || tags.containsAll(acceptedTags); } }
[ "public", "boolean", "acceptTaggedScenario", "(", "final", "Set", "<", "String", ">", "tags", ")", "{", "if", "(", "acceptAll", "||", "(", "acceptedTags", ".", "isEmpty", "(", ")", "&&", "excludedTags", ".", "isEmpty", "(", ")", ")", ")", "{", "return", ...
passed a set of tags, works out if we should run this feature or not
[ "passed", "a", "set", "of", "tags", "works", "out", "if", "we", "should", "run", "this", "feature", "or", "not" ]
train
https://github.com/G2G3Digital/substeps-framework/blob/c1ec6487e1673a7dae54b5e7b62a96f602cd280a/core/src/main/java/com/technophobia/substeps/runner/TagManager.java#L134-L145
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java
Debugger.printFatal
public static void printFatal(Object caller, Object message) { StringBuilder text = new StringBuilder(); Class<?> c = callerBuilder(caller, text); if(message instanceof Throwable) getLog(c).fatal(text.append(stackTrace((Throwable)message))); else getLog(c).fatal(text.append(message)); }
java
public static void printFatal(Object caller, Object message) { StringBuilder text = new StringBuilder(); Class<?> c = callerBuilder(caller, text); if(message instanceof Throwable) getLog(c).fatal(text.append(stackTrace((Throwable)message))); else getLog(c).fatal(text.append(message)); }
[ "public", "static", "void", "printFatal", "(", "Object", "caller", ",", "Object", "message", ")", "{", "StringBuilder", "text", "=", "new", "StringBuilder", "(", ")", ";", "Class", "<", "?", ">", "c", "=", "callerBuilder", "(", "caller", ",", "text", ")"...
Print a fatal message. The stack trace will be printed if the given message is an exception. @param caller the calling object @param message the fatal message
[ "Print", "a", "fatal", "message", ".", "The", "stack", "trace", "will", "be", "printed", "if", "the", "given", "message", "is", "an", "exception", "." ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L474-L486
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/serialization/ScrollReader.java
ScrollReader.readListItem
protected Object readListItem(String fieldName, Token t, String fieldMapping, Parser parser) { if (t == Token.START_ARRAY) { return list(fieldName, fieldMapping, parser); } // handle nested nodes first else if (t == Token.START_OBJECT) { // Don't need special handling for nested fields since this field is already in an array. return map(fieldMapping, parser); } FieldType esType = mapping(fieldMapping, parser); if (t.isValue()) { String rawValue = parser.text(); try { return parseValue(parser, esType); } catch (Exception ex) { throw new EsHadoopParsingException(String.format(Locale.ROOT, "Cannot parse value [%s] for field [%s]", rawValue, fieldName), ex); } } return null; }
java
protected Object readListItem(String fieldName, Token t, String fieldMapping, Parser parser) { if (t == Token.START_ARRAY) { return list(fieldName, fieldMapping, parser); } // handle nested nodes first else if (t == Token.START_OBJECT) { // Don't need special handling for nested fields since this field is already in an array. return map(fieldMapping, parser); } FieldType esType = mapping(fieldMapping, parser); if (t.isValue()) { String rawValue = parser.text(); try { return parseValue(parser, esType); } catch (Exception ex) { throw new EsHadoopParsingException(String.format(Locale.ROOT, "Cannot parse value [%s] for field [%s]", rawValue, fieldName), ex); } } return null; }
[ "protected", "Object", "readListItem", "(", "String", "fieldName", ",", "Token", "t", ",", "String", "fieldMapping", ",", "Parser", "parser", ")", "{", "if", "(", "t", "==", "Token", ".", "START_ARRAY", ")", "{", "return", "list", "(", "fieldName", ",", ...
Same as read(String, Token, String) above, but does not include checking the current field name to see if it's an array.
[ "Same", "as", "read", "(", "String", "Token", "String", ")", "above", "but", "does", "not", "include", "checking", "the", "current", "field", "name", "to", "see", "if", "it", "s", "an", "array", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/serialization/ScrollReader.java#L910-L931
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java
DerValue.getInteger
public int getInteger() throws IOException { if (tag != tag_Integer) { throw new IOException("DerValue.getInteger, not an int " + tag); } return buffer.getInteger(data.available()); }
java
public int getInteger() throws IOException { if (tag != tag_Integer) { throw new IOException("DerValue.getInteger, not an int " + tag); } return buffer.getInteger(data.available()); }
[ "public", "int", "getInteger", "(", ")", "throws", "IOException", "{", "if", "(", "tag", "!=", "tag_Integer", ")", "{", "throw", "new", "IOException", "(", "\"DerValue.getInteger, not an int \"", "+", "tag", ")", ";", "}", "return", "buffer", ".", "getInteger"...
Returns an ASN.1 INTEGER value as an integer. @return the integer held in this DER value.
[ "Returns", "an", "ASN", ".", "1", "INTEGER", "value", "as", "an", "integer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L510-L515
nmdp-bioinformatics/genotype-list
gl-config/src/main/java/org/nmdp/gl/config/ConfigurationModule.java
ConfigurationModule.bindPropertiesWithOverrides
protected final void bindPropertiesWithOverrides(final String propertyFile) { checkNotNull(propertyFile, "classpath resource property file must not be null"); Properties properties = new Properties(); // load classpath resource properties InputStream inputStream = getClass().getResourceAsStream(propertyFile); if (inputStream != null) { try { properties.load(inputStream); } catch (IOException e) { // ignore } } // override with system properties properties.putAll(System.getProperties()); // override with environment variables for (Map.Entry<String, String> entry : System.getenv().entrySet()) { String reformattedKey = entry.getKey().replace('_', '.'); // only replace existing keys if (properties.containsKey(reformattedKey)) { properties.put(reformattedKey, entry.getValue()); } } // bind merged properties bindProperties(properties); }
java
protected final void bindPropertiesWithOverrides(final String propertyFile) { checkNotNull(propertyFile, "classpath resource property file must not be null"); Properties properties = new Properties(); // load classpath resource properties InputStream inputStream = getClass().getResourceAsStream(propertyFile); if (inputStream != null) { try { properties.load(inputStream); } catch (IOException e) { // ignore } } // override with system properties properties.putAll(System.getProperties()); // override with environment variables for (Map.Entry<String, String> entry : System.getenv().entrySet()) { String reformattedKey = entry.getKey().replace('_', '.'); // only replace existing keys if (properties.containsKey(reformattedKey)) { properties.put(reformattedKey, entry.getValue()); } } // bind merged properties bindProperties(properties); }
[ "protected", "final", "void", "bindPropertiesWithOverrides", "(", "final", "String", "propertyFile", ")", "{", "checkNotNull", "(", "propertyFile", ",", "\"classpath resource property file must not be null\"", ")", ";", "Properties", "properties", "=", "new", "Properties", ...
Bind properties from the specified classpath resource property file, overriding those values with system properties and with environment variables after replacing key underscores '_' by dots '.'. @param propertyFile classpath resource property file, must not be null
[ "Bind", "properties", "from", "the", "specified", "classpath", "resource", "property", "file", "overriding", "those", "values", "with", "system", "properties", "and", "with", "environment", "variables", "after", "replacing", "key", "underscores", "_", "by", "dots", ...
train
https://github.com/nmdp-bioinformatics/genotype-list/blob/03b2579552cb9f680a62ffaaecdca9c2a5d12ee4/gl-config/src/main/java/org/nmdp/gl/config/ConfigurationModule.java#L54-L85
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/bolt/AmBaseBolt.java
AmBaseBolt.emitWithNoAnchorKeyAndGrouping
protected void emitWithNoAnchorKeyAndGrouping(StreamMessage message, String groupingKey) { getCollector().emit(new Values(groupingKey, message)); }
java
protected void emitWithNoAnchorKeyAndGrouping(StreamMessage message, String groupingKey) { getCollector().emit(new Values(groupingKey, message)); }
[ "protected", "void", "emitWithNoAnchorKeyAndGrouping", "(", "StreamMessage", "message", ",", "String", "groupingKey", ")", "{", "getCollector", "(", ")", ".", "emit", "(", "new", "Values", "(", "groupingKey", ",", "message", ")", ")", ";", "}" ]
Not use this class's key history function, and not use anchor function(child message failed. notify fail to parent message.).<br> Send message to downstream component with grouping key.<br> Use following situation. <ol> <li>Not use this class's key history function.</li> <li>Not use storm's fault detect function.</li> </ol> @param message sending message @param groupingKey grouping key
[ "Not", "use", "this", "class", "s", "key", "history", "function", "and", "not", "use", "anchor", "function", "(", "child", "message", "failed", ".", "notify", "fail", "to", "parent", "message", ".", ")", ".", "<br", ">", "Send", "message", "to", "downstr...
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L496-L499
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java
IOUtils.copyStream
public static void copyStream(InputStream from, OutputStream to) throws IOException { byte buffer[] = new byte[2048]; int bytesRead; while ((bytesRead = from.read(buffer)) != -1) { to.write(buffer, 0, bytesRead); } from.close(); }
java
public static void copyStream(InputStream from, OutputStream to) throws IOException { byte buffer[] = new byte[2048]; int bytesRead; while ((bytesRead = from.read(buffer)) != -1) { to.write(buffer, 0, bytesRead); } from.close(); }
[ "public", "static", "void", "copyStream", "(", "InputStream", "from", ",", "OutputStream", "to", ")", "throws", "IOException", "{", "byte", "buffer", "[", "]", "=", "new", "byte", "[", "2048", "]", ";", "int", "bytesRead", ";", "while", "(", "(", "bytesR...
Copy the given InputStream to the given OutputStream. Note: the InputStream is closed when the copy is complete. The OutputStream is left open.
[ "Copy", "the", "given", "InputStream", "to", "the", "given", "OutputStream", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java#L27-L34
nohana/Amalgam
amalgam/src/main/java/com/amalgam/content/pm/SignatureUtils.java
SignatureUtils.ensureSameSignature
public static boolean ensureSameSignature(Context context, String targetPackageName) { return ensureSameSignature(context, targetPackageName, getSignatureHexCode(context)); }
java
public static boolean ensureSameSignature(Context context, String targetPackageName) { return ensureSameSignature(context, targetPackageName, getSignatureHexCode(context)); }
[ "public", "static", "boolean", "ensureSameSignature", "(", "Context", "context", ",", "String", "targetPackageName", ")", "{", "return", "ensureSameSignature", "(", "context", ",", "targetPackageName", ",", "getSignatureHexCode", "(", "context", ")", ")", ";", "}" ]
Ensure the running application and the target package has the same signature. @param context the running application context. @param targetPackageName the target package name. @return true if the same signature.
[ "Ensure", "the", "running", "application", "and", "the", "target", "package", "has", "the", "same", "signature", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/SignatureUtils.java#L45-L47
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
AtomContainerManipulator.setAtomProperties
public static void setAtomProperties(IAtomContainer container, Object propKey, Object propVal) { if (container != null) { for (IAtom atom : container.atoms()) { atom.setProperty(propKey, propVal); } } }
java
public static void setAtomProperties(IAtomContainer container, Object propKey, Object propVal) { if (container != null) { for (IAtom atom : container.atoms()) { atom.setProperty(propKey, propVal); } } }
[ "public", "static", "void", "setAtomProperties", "(", "IAtomContainer", "container", ",", "Object", "propKey", ",", "Object", "propVal", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "for", "(", "IAtom", "atom", ":", "container", ".", "atoms", ...
Sets a property on all <code>Atom</code>s in the given container.
[ "Sets", "a", "property", "on", "all", "<code", ">", "Atom<", "/", "code", ">", "s", "in", "the", "given", "container", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L1361-L1367
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.lookForMissingEvents
private Observable<ConversationComparison> lookForMissingEvents(final RxComapiClient client, ConversationComparison conversationComparison) { if (!conversationComparison.isSuccessful || conversationComparison.conversationsToUpdate.isEmpty()) { return Observable.fromCallable(() -> conversationComparison); } return synchroniseEvents(client, conversationComparison.conversationsToUpdate, new ArrayList<>()) .map(result -> { if (conversationComparison.isSuccessful && !result) { conversationComparison.addSuccess(false); } return conversationComparison; }); }
java
private Observable<ConversationComparison> lookForMissingEvents(final RxComapiClient client, ConversationComparison conversationComparison) { if (!conversationComparison.isSuccessful || conversationComparison.conversationsToUpdate.isEmpty()) { return Observable.fromCallable(() -> conversationComparison); } return synchroniseEvents(client, conversationComparison.conversationsToUpdate, new ArrayList<>()) .map(result -> { if (conversationComparison.isSuccessful && !result) { conversationComparison.addSuccess(false); } return conversationComparison; }); }
[ "private", "Observable", "<", "ConversationComparison", ">", "lookForMissingEvents", "(", "final", "RxComapiClient", "client", ",", "ConversationComparison", "conversationComparison", ")", "{", "if", "(", "!", "conversationComparison", ".", "isSuccessful", "||", "conversa...
Checks services for missing events in stored conversations. @param client Foundation client. @param conversationComparison Describes differences in local and remote conversation list. @return Observable returning unchanged argument to further processing.
[ "Checks", "services", "for", "missing", "events", "in", "stored", "conversations", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L527-L540
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteNote
public void deleteNote(GitlabMergeRequest mergeRequest, GitlabNote noteToDelete) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabNote.URL + "/" + noteToDelete.getId(); retrieve().method(DELETE).to(tailUrl, GitlabNote.class); }
java
public void deleteNote(GitlabMergeRequest mergeRequest, GitlabNote noteToDelete) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabNote.URL + "/" + noteToDelete.getId(); retrieve().method(DELETE).to(tailUrl, GitlabNote.class); }
[ "public", "void", "deleteNote", "(", "GitlabMergeRequest", "mergeRequest", ",", "GitlabNote", "noteToDelete", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "mergeRequest", ".", "getProjectId", "(", ")"...
Delete a Merge Request Note @param mergeRequest The merge request @param noteToDelete The note to delete @throws IOException on gitlab api call error
[ "Delete", "a", "Merge", "Request", "Note" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2291-L2295
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.min
public static double min(double a, double b) { if (a != a) return a; // a is NaN if ((a == 0.0d) && (b == 0.0d) && (Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) { // Raw conversion ok since NaN can't map to -0.0. return b; } return (a <= b) ? a : b; }
java
public static double min(double a, double b) { if (a != a) return a; // a is NaN if ((a == 0.0d) && (b == 0.0d) && (Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) { // Raw conversion ok since NaN can't map to -0.0. return b; } return (a <= b) ? a : b; }
[ "public", "static", "double", "min", "(", "double", "a", ",", "double", "b", ")", "{", "if", "(", "a", "!=", "a", ")", "return", "a", ";", "// a is NaN", "if", "(", "(", "a", "==", "0.0d", ")", "&&", "(", "b", "==", "0.0d", ")", "&&", "(", "D...
Returns the smaller of two {@code double} values. That is, the result is the value closer to negative infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero, the result is negative zero. @param a an argument. @param b another argument. @return the smaller of {@code a} and {@code b}.
[ "Returns", "the", "smaller", "of", "two", "{", "@code", "double", "}", "values", ".", "That", "is", "the", "result", "is", "the", "value", "closer", "to", "negative", "infinity", ".", "If", "the", "arguments", "have", "the", "same", "value", "the", "resu...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1404-L1414
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.addPreDestroy
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final AbstractBeanDefinition addPreDestroy(Class declaringType, String method, Argument[] arguments, AnnotationMetadata annotationMetadata, boolean requiresReflection) { return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.preDestroyMethods); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final AbstractBeanDefinition addPreDestroy(Class declaringType, String method, Argument[] arguments, AnnotationMetadata annotationMetadata, boolean requiresReflection) { return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.preDestroyMethods); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "AbstractBeanDefinition", "addPreDestroy", "(", "Class", "declaringType", ",", "String", "method", ",", "Argument", "[", "]", "arguments", ",", "Annot...
Adds a pre destroy method definition. @param declaringType The declaring type @param method The method @param arguments The arguments @param annotationMetadata The annotation metadata @param requiresReflection Whether the method requires reflection @return This bean definition
[ "Adds", "a", "pre", "destroy", "method", "definition", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L563-L572
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/resolver/multipart/MultipartLocationResolver.java
MultipartLocationResolver.resolveLocation
public ResolvedLocation resolveLocation(final String loc, final boolean fuzzy) throws ClavinException { return resolveLocation(fuzzy, loc.split(",")); }
java
public ResolvedLocation resolveLocation(final String loc, final boolean fuzzy) throws ClavinException { return resolveLocation(fuzzy, loc.split(",")); }
[ "public", "ResolvedLocation", "resolveLocation", "(", "final", "String", "loc", ",", "final", "boolean", "fuzzy", ")", "throws", "ClavinException", "{", "return", "resolveLocation", "(", "fuzzy", ",", "loc", ".", "split", "(", "\",\"", ")", ")", ";", "}" ]
Attempts to resolve a location provided as a comma-separated string of political divisions from narrowest to broadest. The gazetteer current supports ancestry from the country level through four administrative divisions so any more-specific divisions will be ignored once a city (lowest available level of resolution) is found. Results will only be returned if all unignored location components are matched. @param loc the comma-separated location name (e.g. "City, County, State, Country") @param fuzzy <code>true</code> to use fuzzy matching if an exact match for any location could not be found @return the resolved location @throws ClavinException if an error occurs while searching
[ "Attempts", "to", "resolve", "a", "location", "provided", "as", "a", "comma", "-", "separated", "string", "of", "political", "divisions", "from", "narrowest", "to", "broadest", ".", "The", "gazetteer", "current", "supports", "ancestry", "from", "the", "country",...
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/resolver/multipart/MultipartLocationResolver.java#L217-L219
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.clearModifiedList
public void clearModifiedList() { CmsSitemapClipboardData clipboardData = getData().getClipboardData().copy(); clipboardData.getModifications().clear(); CmsSitemapChange change = new CmsSitemapChange(null, null, ChangeType.clipboardOnly); change.setClipBoardData(clipboardData); commitChange(change, null); }
java
public void clearModifiedList() { CmsSitemapClipboardData clipboardData = getData().getClipboardData().copy(); clipboardData.getModifications().clear(); CmsSitemapChange change = new CmsSitemapChange(null, null, ChangeType.clipboardOnly); change.setClipBoardData(clipboardData); commitChange(change, null); }
[ "public", "void", "clearModifiedList", "(", ")", "{", "CmsSitemapClipboardData", "clipboardData", "=", "getData", "(", ")", ".", "getClipboardData", "(", ")", ".", "copy", "(", ")", ";", "clipboardData", ".", "getModifications", "(", ")", ".", "clear", "(", ...
Clears the modified clip-board list and commits the change.<p>
[ "Clears", "the", "modified", "clip", "-", "board", "list", "and", "commits", "the", "change", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L414-L421
codelibs/jcifs
src/main/java/jcifs/smb1/util/Hexdump.java
Hexdump.toHexString
public static String toHexString( int val, int size ) { char[] c = new char[size]; toHexChars( val, c, 0, size ); return new String( c ); }
java
public static String toHexString( int val, int size ) { char[] c = new char[size]; toHexChars( val, c, 0, size ); return new String( c ); }
[ "public", "static", "String", "toHexString", "(", "int", "val", ",", "int", "size", ")", "{", "char", "[", "]", "c", "=", "new", "char", "[", "size", "]", ";", "toHexChars", "(", "val", ",", "c", ",", "0", ",", "size", ")", ";", "return", "new", ...
This is an alternative to the <code>java.lang.Integer.toHexString</cod> method. It is an efficient relative that also will pad the left side so that the result is <code>size</code> digits.
[ "This", "is", "an", "alternative", "to", "the", "<code", ">", "java", ".", "lang", ".", "Integer", ".", "toHexString<", "/", "cod", ">", "method", ".", "It", "is", "an", "efficient", "relative", "that", "also", "will", "pad", "the", "left", "side", "so...
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/util/Hexdump.java#L110-L114
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/random/RandomDouble.java
RandomDouble.updateDouble
public static double updateDouble(double value, double range) { range = range == 0 ? 0.1 * value : range; double min = value - range; double max = value + range; return nextDouble(min, max); }
java
public static double updateDouble(double value, double range) { range = range == 0 ? 0.1 * value : range; double min = value - range; double max = value + range; return nextDouble(min, max); }
[ "public", "static", "double", "updateDouble", "(", "double", "value", ",", "double", "range", ")", "{", "range", "=", "range", "==", "0", "?", "0.1", "*", "value", ":", "range", ";", "double", "min", "=", "value", "-", "range", ";", "double", "max", ...
Updates (drifts) a double value within specified range defined @param value a double value to drift. @param range (optional) a range. Default: 10% of the value @return updated random double value.
[ "Updates", "(", "drifts", ")", "a", "double", "value", "within", "specified", "range", "defined" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomDouble.java#L56-L61
line/centraldogma
common/src/main/java/com/linecorp/centraldogma/internal/jsonpatch/JsonPatch.java
JsonPatch.fromJson
public static JsonPatch fromJson(final JsonNode node) throws IOException { requireNonNull(node, "node"); try { return Jackson.treeToValue(node, JsonPatch.class); } catch (JsonMappingException e) { throw new JsonPatchException("invalid JSON patch", e); } }
java
public static JsonPatch fromJson(final JsonNode node) throws IOException { requireNonNull(node, "node"); try { return Jackson.treeToValue(node, JsonPatch.class); } catch (JsonMappingException e) { throw new JsonPatchException("invalid JSON patch", e); } }
[ "public", "static", "JsonPatch", "fromJson", "(", "final", "JsonNode", "node", ")", "throws", "IOException", "{", "requireNonNull", "(", "node", ",", "\"node\"", ")", ";", "try", "{", "return", "Jackson", ".", "treeToValue", "(", "node", ",", "JsonPatch", "....
Static factory method to build a JSON Patch out of a JSON representation. @param node the JSON representation of the generated JSON Patch @return a JSON Patch @throws IOException input is not a valid JSON patch @throws NullPointerException input is null
[ "Static", "factory", "method", "to", "build", "a", "JSON", "Patch", "out", "of", "a", "JSON", "representation", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/common/src/main/java/com/linecorp/centraldogma/internal/jsonpatch/JsonPatch.java#L137-L144
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_GET
public OvhSharedAccount organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_GET(String organizationName, String exchangeService, String sharedEmailAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, sharedEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSharedAccount.class); }
java
public OvhSharedAccount organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_GET(String organizationName, String exchangeService, String sharedEmailAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, sharedEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSharedAccount.class); }
[ "public", "OvhSharedAccount", "organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "sharedEmailAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param sharedEmailAddress [required] Default email for this shared mailbox
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L867-L872
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java
ClassReflectionIndexUtil.findMethod
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) { Assert.checkNotNullParam("method", method); MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method); return findMethod(deploymentReflectionIndex, clazz, methodIdentifier); }
java
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) { Assert.checkNotNullParam("method", method); MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method); return findMethod(deploymentReflectionIndex, clazz, methodIdentifier); }
[ "public", "static", "Method", "findMethod", "(", "final", "DeploymentReflectionIndex", "deploymentReflectionIndex", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "Method", "method", ")", "{", "Assert", ".", "checkNotNullParam", "(", "\"method\"", ",...
Finds and returns a method corresponding to the passed <code>method</code>, which may be declared in the super class of the passed <code>classReflectionIndex</code>. <p/> <p/> @param deploymentReflectionIndex The deployment reflection index @param clazz The class @param method The method being searched for @return
[ "Finds", "and", "returns", "a", "method", "corresponding", "to", "the", "passed", "<code", ">", "method<", "/", "code", ">", "which", "may", "be", "declared", "in", "the", "super", "class", "of", "the", "passed", "<code", ">", "classReflectionIndex<", "/", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L136-L140
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/PropertiesHelper.java
PropertiesHelper.parsePropertiesString
public Properties parsePropertiesString(String propertiesAsString) { final Properties p = new Properties(); try (StringReader reader = new StringReader(propertiesAsString)) { p.load(reader); } catch (IOException e) { throw new IllegalArgumentException("Unable to parse .properties: " + propertiesAsString, e); } return p; }
java
public Properties parsePropertiesString(String propertiesAsString) { final Properties p = new Properties(); try (StringReader reader = new StringReader(propertiesAsString)) { p.load(reader); } catch (IOException e) { throw new IllegalArgumentException("Unable to parse .properties: " + propertiesAsString, e); } return p; }
[ "public", "Properties", "parsePropertiesString", "(", "String", "propertiesAsString", ")", "{", "final", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "try", "(", "StringReader", "reader", "=", "new", "StringReader", "(", "propertiesAsString", ")", ...
Converts String to Properties. @param propertiesAsString contents of .properties file. @return Properties as parsed.
[ "Converts", "String", "to", "Properties", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/PropertiesHelper.java#L20-L28
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMaxCardinalityImpl_CustomFieldSerializer.java
OWLObjectMaxCardinalityImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectMaxCardinalityImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectMaxCardinalityImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectMaxCardinalityImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMaxCardinalityImpl_CustomFieldSerializer.java#L73-L76
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectOne
public Object collectOne(String json, JsonPath... paths) { return collectOne(json, Object.class, paths); }
java
public Object collectOne(String json, JsonPath... paths) { return collectOne(json, Object.class, paths); }
[ "public", "Object", "collectOne", "(", "String", "json", ",", "JsonPath", "...", "paths", ")", "{", "return", "collectOne", "(", "json", ",", "Object", ".", "class", ",", "paths", ")", ";", "}" ]
Collect the first matched value and stop parsing immediately @param json json @param paths JsonPath @return value
[ "Collect", "the", "first", "matched", "value", "and", "stop", "parsing", "immediately" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L399-L401
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseFloatObj
@Nullable public static Float parseFloatObj (@Nullable final String sStr, @Nullable final Float aDefault) { final float fValue = parseFloat (sStr, Float.NaN); return Float.isNaN (fValue) ? aDefault : Float.valueOf (fValue); }
java
@Nullable public static Float parseFloatObj (@Nullable final String sStr, @Nullable final Float aDefault) { final float fValue = parseFloat (sStr, Float.NaN); return Float.isNaN (fValue) ? aDefault : Float.valueOf (fValue); }
[ "@", "Nullable", "public", "static", "Float", "parseFloatObj", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "Float", "aDefault", ")", "{", "final", "float", "fValue", "=", "parseFloat", "(", "sStr", ",", "Float", ".", "Na...
Parse the given {@link String} as {@link Float}. Note: both the locale independent form of a double can be parsed here (e.g. 4.523) as well as a localized form using the comma as the decimal separator (e.g. the German 4,523). @param sStr The string to parse. May be <code>null</code>. @param aDefault The default value to be returned if the parsed string cannot be converted to a float. May be <code>null</code>. @return <code>aDefault</code> if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "Float", "}", ".", "Note", ":", "both", "the", "locale", "independent", "form", "of", "a", "double", "can", "be", "parsed", "here", "(", "e", ".", "g", ".", "4", ".", "523", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L690-L695
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/ElytronUtil.java
ElytronUtil.getServerfactory
private static ModelNode getServerfactory(CommandContext ctx, String point, String name) throws OperationFormatException, IOException { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(); builder.setOperationName(Util.READ_RESOURCE); for (String p : point.split("/")) { if (p.isEmpty()) { continue; } String[] ps = p.split("="); if (ps[1].equals("*")) { ps[1] = name; } builder.addNode(ps[0], ps[1]); } builder.getModelNode().get(Util.INCLUDE_RUNTIME).set(true); ModelNode response = ctx.getModelControllerClient().execute(builder.buildRequest()); if (Util.isSuccess(response)) { return response.get(Util.RESULT); } return null; }
java
private static ModelNode getServerfactory(CommandContext ctx, String point, String name) throws OperationFormatException, IOException { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(); builder.setOperationName(Util.READ_RESOURCE); for (String p : point.split("/")) { if (p.isEmpty()) { continue; } String[] ps = p.split("="); if (ps[1].equals("*")) { ps[1] = name; } builder.addNode(ps[0], ps[1]); } builder.getModelNode().get(Util.INCLUDE_RUNTIME).set(true); ModelNode response = ctx.getModelControllerClient().execute(builder.buildRequest()); if (Util.isSuccess(response)) { return response.get(Util.RESULT); } return null; }
[ "private", "static", "ModelNode", "getServerfactory", "(", "CommandContext", "ctx", ",", "String", "point", ",", "String", "name", ")", "throws", "OperationFormatException", ",", "IOException", "{", "DefaultOperationRequestBuilder", "builder", "=", "new", "DefaultOperat...
Simplistic for now, the format is something like: /subsystem=elytron/aggregate-sasl-server-factory=*
[ "Simplistic", "for", "now", "the", "format", "is", "something", "like", ":", "/", "subsystem", "=", "elytron", "/", "aggregate", "-", "sasl", "-", "server", "-", "factory", "=", "*" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/ElytronUtil.java#L1103-L1122
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java
JobGraphMouseListener.onTableRightClicked
public void onTableRightClicked(final Table table, final MouseEvent me) { final JPopupMenu popup = new JPopupMenu(); popup.add(createLinkMenuItem(table)); final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(table); final Datastore datastore = analysisJobBuilder.getDatastore(); final List<MetaModelInputColumn> inputColumns = analysisJobBuilder.getSourceColumnsOfTable(table); previewMenuItem.addActionListener(new PreviewSourceDataActionListener(_windowContext, datastore, inputColumns)); popup.add(previewMenuItem); popup.addSeparator(); popup.add(new RemoveSourceTableMenuItem(analysisJobBuilder, table)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
java
public void onTableRightClicked(final Table table, final MouseEvent me) { final JPopupMenu popup = new JPopupMenu(); popup.add(createLinkMenuItem(table)); final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(table); final Datastore datastore = analysisJobBuilder.getDatastore(); final List<MetaModelInputColumn> inputColumns = analysisJobBuilder.getSourceColumnsOfTable(table); previewMenuItem.addActionListener(new PreviewSourceDataActionListener(_windowContext, datastore, inputColumns)); popup.add(previewMenuItem); popup.addSeparator(); popup.add(new RemoveSourceTableMenuItem(analysisJobBuilder, table)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
[ "public", "void", "onTableRightClicked", "(", "final", "Table", "table", ",", "final", "MouseEvent", "me", ")", "{", "final", "JPopupMenu", "popup", "=", "new", "JPopupMenu", "(", ")", ";", "popup", ".", "add", "(", "createLinkMenuItem", "(", "table", ")", ...
Invoked when a {@link Table} is right-clicked @param table @param me
[ "Invoked", "when", "a", "{", "@link", "Table", "}", "is", "right", "-", "clicked" ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java#L121-L136
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java
PermissionAwareCrudService.findAllUserPermissionsOfUser
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) { return dao.findAllUserPermissionsOfUser(user); }
java
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) { return dao.findAllUserPermissionsOfUser(user); }
[ "@", "PreAuthorize", "(", "\"hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')\"", ")", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "Map", "<", "PersistentObject", ",", "PermissionCollection", ">", "findAllUserPermissionsOfUse...
This method returns a {@link Map} that maps {@link PersistentObject}s to PermissionCollections for the passed {@link User}. I.e. the keySet of the map is the collection of all {@link PersistentObject}s where the user has at least one permission and the corresponding value contains the {@link PermissionCollection} for the passed user on the entity. @param user @return
[ "This", "method", "returns", "a", "{", "@link", "Map", "}", "that", "maps", "{", "@link", "PersistentObject", "}", "s", "to", "PermissionCollections", "for", "the", "passed", "{", "@link", "User", "}", ".", "I", ".", "e", ".", "the", "keySet", "of", "t...
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java#L345-L349
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
java
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
[ "public", "OvhOvhPabxDialplanExtensionConditionTime", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",",...
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param conditionId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7121-L7126
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10AttributeMinimal
public static void escapeXml10AttributeMinimal(final Reader reader, final Writer writer) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeXml10AttributeMinimal(final Reader reader, final Writer writer) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeXml10AttributeMinimal", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeXml", "(", "reader", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML10_ATTRIBUTE_SYMBOLS", ",",...
<p> Perform an XML 1.0 level 1 (only markup-significant chars) <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters which are <em>predefined</em> as Character Entity References in XML: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "an", "XML", "1", ".", "0", "level", "1", "(", "only", "markup", "-", "significant", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "meant", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1312-L1317
joniles/mpxj
src/main/java/net/sf/mpxj/merlin/MerlinReader.java
MerlinReader.assignmentDuration
private Duration assignmentDuration(Task task, Duration work) { Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); } } } return result; }
java
private Duration assignmentDuration(Task task, Duration work) { Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); } } } return result; }
[ "private", "Duration", "assignmentDuration", "(", "Task", "task", ",", "Duration", "work", ")", "{", "Duration", "result", "=", "work", ";", "if", "(", "result", "!=", "null", ")", "{", "if", "(", "result", ".", "getUnits", "(", ")", "==", "TimeUnit", ...
Extract a duration amount from the assignment, converting a percentage into an actual duration. @param task parent task @param work duration from assignment @return Duration instance
[ "Extract", "a", "duration", "amount", "from", "the", "assignment", "converting", "a", "percentage", "into", "an", "actual", "duration", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L576-L592
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getString
public static final String getString(InputStream is) throws IOException { int type = is.read(); if (type != 1) { throw new IllegalArgumentException("Unexpected string format"); } Charset charset = CharsetHelper.UTF8; int length = is.read(); if (length == 0xFF) { length = getShort(is); if (length == 0xFFFE) { charset = CharsetHelper.UTF16LE; length = (is.read() * 2); } } String result; if (length == 0) { result = null; } else { byte[] stringData = new byte[length]; is.read(stringData); result = new String(stringData, charset); } return result; }
java
public static final String getString(InputStream is) throws IOException { int type = is.read(); if (type != 1) { throw new IllegalArgumentException("Unexpected string format"); } Charset charset = CharsetHelper.UTF8; int length = is.read(); if (length == 0xFF) { length = getShort(is); if (length == 0xFFFE) { charset = CharsetHelper.UTF16LE; length = (is.read() * 2); } } String result; if (length == 0) { result = null; } else { byte[] stringData = new byte[length]; is.read(stringData); result = new String(stringData, charset); } return result; }
[ "public", "static", "final", "String", "getString", "(", "InputStream", "is", ")", "throws", "IOException", "{", "int", "type", "=", "is", ".", "read", "(", ")", ";", "if", "(", "type", "!=", "1", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Read a Synchro string from an input stream. @param is input stream @return String instance
[ "Read", "a", "Synchro", "string", "from", "an", "input", "stream", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L182-L215
jimmoores/quandl4j
core/src/main/java/com/jimmoores/quandl/MetaDataResult.java
MetaDataResult.getLocalDate
public LocalDate getLocalDate(final String fieldName) { try { if (_jsonObject.isNull(fieldName)) { return null; } else { return LocalDate.parse(_jsonObject.getString(fieldName), DATE_FORMATTER); } } catch (JSONException ex) { throw new QuandlRuntimeException("Cannot find field", ex); } }
java
public LocalDate getLocalDate(final String fieldName) { try { if (_jsonObject.isNull(fieldName)) { return null; } else { return LocalDate.parse(_jsonObject.getString(fieldName), DATE_FORMATTER); } } catch (JSONException ex) { throw new QuandlRuntimeException("Cannot find field", ex); } }
[ "public", "LocalDate", "getLocalDate", "(", "final", "String", "fieldName", ")", "{", "try", "{", "if", "(", "_jsonObject", ".", "isNull", "(", "fieldName", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "LocalDate", ".", "parse", "(",...
Get a LocalDate field (converted from a String internally). Throws a QuandlRuntimeException if it cannot find the field @param fieldName the name of the field @return the field value, or null if the field is null
[ "Get", "a", "LocalDate", "field", "(", "converted", "from", "a", "String", "internally", ")", ".", "Throws", "a", "QuandlRuntimeException", "if", "it", "cannot", "find", "the", "field" ]
train
https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/MetaDataResult.java#L103-L113
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.getBlockIndex
int getBlockIndex(INodeFile inode, Block blk, String file) throws IOException { if (inode == null) { throw new IOException("inode for file " + file + " is null"); } readLock(); try { return inode.getBlockIndex(blk, file); } finally { readUnlock(); } }
java
int getBlockIndex(INodeFile inode, Block blk, String file) throws IOException { if (inode == null) { throw new IOException("inode for file " + file + " is null"); } readLock(); try { return inode.getBlockIndex(blk, file); } finally { readUnlock(); } }
[ "int", "getBlockIndex", "(", "INodeFile", "inode", ",", "Block", "blk", ",", "String", "file", ")", "throws", "IOException", "{", "if", "(", "inode", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"inode for file \"", "+", "file", "+", "\" i...
/* Search the given block from the file and return the block index
[ "/", "*", "Search", "the", "given", "block", "from", "the", "file", "and", "return", "the", "block", "index" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L1927-L1937
jbehave/jbehave-core
jbehave-guice/src/main/java/org/jbehave/core/steps/guice/GuiceStepsFactory.java
GuiceStepsFactory.addTypes
private void addTypes(Injector injector, List<Class<?>> types) { for (Binding<?> binding : injector.getBindings().values()) { Key<?> key = binding.getKey(); Type type = key.getTypeLiteral().getType(); if (hasAnnotatedMethods(type)) { types.add(((Class<?>)type)); } } if (injector.getParent() != null) { addTypes(injector.getParent(), types); } }
java
private void addTypes(Injector injector, List<Class<?>> types) { for (Binding<?> binding : injector.getBindings().values()) { Key<?> key = binding.getKey(); Type type = key.getTypeLiteral().getType(); if (hasAnnotatedMethods(type)) { types.add(((Class<?>)type)); } } if (injector.getParent() != null) { addTypes(injector.getParent(), types); } }
[ "private", "void", "addTypes", "(", "Injector", "injector", ",", "List", "<", "Class", "<", "?", ">", ">", "types", ")", "{", "for", "(", "Binding", "<", "?", ">", "binding", ":", "injector", ".", "getBindings", "(", ")", ".", "values", "(", ")", "...
Adds steps types from given injector and recursively its parent @param injector the current Inject @param types the List of steps types
[ "Adds", "steps", "types", "from", "given", "injector", "and", "recursively", "its", "parent" ]
train
https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-guice/src/main/java/org/jbehave/core/steps/guice/GuiceStepsFactory.java#L46-L57
line/armeria
core/src/main/java/com/linecorp/armeria/server/cors/CorsConfig.java
CorsConfig.getPolicy
@Nullable public CorsPolicy getPolicy(String origin, PathMappingContext pathMappingContext) { requireNonNull(origin, "origin"); if (isAnyOriginSupported()) { return Iterables.getFirst(policies, null); } final String lowerCaseOrigin = Ascii.toLowerCase(origin); final boolean isNullOrigin = CorsService.NULL_ORIGIN.equals(lowerCaseOrigin); for (final CorsPolicy policy : policies) { if (isNullOrigin && policy.isNullOriginAllowed() && isPathMatched(policy, pathMappingContext)) { return policy; } else if (!isNullOrigin && policy.origins().contains(lowerCaseOrigin) && isPathMatched(policy, pathMappingContext)) { return policy; } } return null; }
java
@Nullable public CorsPolicy getPolicy(String origin, PathMappingContext pathMappingContext) { requireNonNull(origin, "origin"); if (isAnyOriginSupported()) { return Iterables.getFirst(policies, null); } final String lowerCaseOrigin = Ascii.toLowerCase(origin); final boolean isNullOrigin = CorsService.NULL_ORIGIN.equals(lowerCaseOrigin); for (final CorsPolicy policy : policies) { if (isNullOrigin && policy.isNullOriginAllowed() && isPathMatched(policy, pathMappingContext)) { return policy; } else if (!isNullOrigin && policy.origins().contains(lowerCaseOrigin) && isPathMatched(policy, pathMappingContext)) { return policy; } } return null; }
[ "@", "Nullable", "public", "CorsPolicy", "getPolicy", "(", "String", "origin", ",", "PathMappingContext", "pathMappingContext", ")", "{", "requireNonNull", "(", "origin", ",", "\"origin\"", ")", ";", "if", "(", "isAnyOriginSupported", "(", ")", ")", "{", "return...
Returns the policy for the specified {@code origin}. @return {@link CorsPolicy} which allows the {@code origin}, {@code null} if the {@code origin} is not allowed in any policy.
[ "Returns", "the", "policy", "for", "the", "specified", "{", "@code", "origin", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/CorsConfig.java#L123-L141
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.purgeDeletedCertificate
public void purgeDeletedCertificate(String vaultBaseUrl, String certificateName) { purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body(); }
java
public void purgeDeletedCertificate(String vaultBaseUrl, String certificateName) { purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body(); }
[ "public", "void", "purgeDeletedCertificate", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ")", "{", "purgeDeletedCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ...
Permanently deletes the specified deleted certificate. The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Permanently", "deletes", "the", "specified", "deleted", "certificate", ".", "The", "PurgeDeletedCertificate", "operation", "performs", "an", "irreversible", "deletion", "of", "the", "specified", "certificate", "without", "possibility", "for", "recovery", ".", "The", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8621-L8623
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.evaluateMDS
public <T extends Evaluation> T evaluateMDS(JavaRDD<MultiDataSet> data, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.Evaluation())[0]; }
java
public <T extends Evaluation> T evaluateMDS(JavaRDD<MultiDataSet> data, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.Evaluation())[0]; }
[ "public", "<", "T", "extends", "Evaluation", ">", "T", "evaluateMDS", "(", "JavaRDD", "<", "MultiDataSet", ">", "data", ",", "int", "minibatchSize", ")", "{", "return", "(", "T", ")", "doEvaluationMDS", "(", "data", ",", "minibatchSize", ",", "new", "org",...
Evaluate the network (classification performance) in a distributed manner on the provided data
[ "Evaluate", "the", "network", "(", "classification", "performance", ")", "in", "a", "distributed", "manner", "on", "the", "provided", "data" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L733-L735
lucee/Lucee
core/src/main/java/lucee/commons/io/SystemUtil.java
SystemUtil.arePathsSame
public static boolean arePathsSame(String path1, String path2) { if (StringUtil.isEmpty(path1, true) || StringUtil.isEmpty(path2, true)) return false; String p1 = path1.replace('\\', '/'); String p2 = path2.replace('\\', '/'); if (p1.endsWith("/") && !p2.endsWith("/")) p2 = p2 + "/"; else if (p2.endsWith("/") && !p1.endsWith("/")) p1 = p1 + "/"; return p1.equalsIgnoreCase(p2); }
java
public static boolean arePathsSame(String path1, String path2) { if (StringUtil.isEmpty(path1, true) || StringUtil.isEmpty(path2, true)) return false; String p1 = path1.replace('\\', '/'); String p2 = path2.replace('\\', '/'); if (p1.endsWith("/") && !p2.endsWith("/")) p2 = p2 + "/"; else if (p2.endsWith("/") && !p1.endsWith("/")) p1 = p1 + "/"; return p1.equalsIgnoreCase(p2); }
[ "public", "static", "boolean", "arePathsSame", "(", "String", "path1", ",", "String", "path2", ")", "{", "if", "(", "StringUtil", ".", "isEmpty", "(", "path1", ",", "true", ")", "||", "StringUtil", ".", "isEmpty", "(", "path2", ",", "true", ")", ")", "...
checks if both paths are the same ignoring CaSe, file separator type, and whether one path ends with a separator while the other does not. if either path is empty then false is returned. @param path1 @param path2 @return true if neither path is empty and the paths are the same ignoring case, separator, and whether either path ends with a separator.
[ "checks", "if", "both", "paths", "are", "the", "same", "ignoring", "CaSe", "file", "separator", "type", "and", "whether", "one", "path", "ends", "with", "a", "separator", "while", "the", "other", "does", "not", ".", "if", "either", "path", "is", "empty", ...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L1441-L1452
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/QuantityClientParam.java
QuantityClientParam.withPrefix
public IMatches<IAndUnits> withPrefix(final ParamPrefixEnum thePrefix) { return new NumberClientParam.IMatches<IAndUnits>() { @Override public IAndUnits number(long theNumber) { return new AndUnits(thePrefix, Long.toString(theNumber)); } @Override public IAndUnits number(String theNumber) { return new AndUnits(thePrefix, theNumber); } }; }
java
public IMatches<IAndUnits> withPrefix(final ParamPrefixEnum thePrefix) { return new NumberClientParam.IMatches<IAndUnits>() { @Override public IAndUnits number(long theNumber) { return new AndUnits(thePrefix, Long.toString(theNumber)); } @Override public IAndUnits number(String theNumber) { return new AndUnits(thePrefix, theNumber); } }; }
[ "public", "IMatches", "<", "IAndUnits", ">", "withPrefix", "(", "final", "ParamPrefixEnum", "thePrefix", ")", "{", "return", "new", "NumberClientParam", ".", "IMatches", "<", "IAndUnits", ">", "(", ")", "{", "@", "Override", "public", "IAndUnits", "number", "(...
Use the given quantity prefix @param thePrefix The prefix, or <code>null</code> for no prefix
[ "Use", "the", "given", "quantity", "prefix" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/QuantityClientParam.java#L133-L145
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java
XNodeSet.lessThan
public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LT); }
java
public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LT); }
[ "public", "boolean", "lessThan", "(", "XObject", "obj2", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "compare", "(", "obj2", ",", "S_LT", ")", ";", "}" ]
Tell if one object is less than the other. @param obj2 object to compare this nodeset to @return see this.compare(...) @throws javax.xml.transform.TransformerException
[ "Tell", "if", "one", "object", "is", "less", "than", "the", "other", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L644-L647
osglworks/java-tool
src/main/java/org/osgl/util/FastStr.java
FastStr.unsafeOf
public static FastStr unsafeOf(char[] buf, int start, int end) { E.NPE(buf); E.illegalArgumentIf(start < 0 || end > buf.length); if (end < start) return EMPTY_STR; return new FastStr(buf, start, end); }
java
public static FastStr unsafeOf(char[] buf, int start, int end) { E.NPE(buf); E.illegalArgumentIf(start < 0 || end > buf.length); if (end < start) return EMPTY_STR; return new FastStr(buf, start, end); }
[ "public", "static", "FastStr", "unsafeOf", "(", "char", "[", "]", "buf", ",", "int", "start", ",", "int", "end", ")", "{", "E", ".", "NPE", "(", "buf", ")", ";", "E", ".", "illegalArgumentIf", "(", "start", "<", "0", "||", "end", ">", "buf", ".",...
Construct a FastStr instance from char array, from the start position, finished at end position without copying the array. This method might use the array directly instead of copying elements from the array. Thus it is extremely important that the array buf passed in will NOT be updated outside the FastStr instance. @param buf the char array @param start the start position (inclusive) @param end the end position (exclusive) @return a FastStr instance that consist of chars specified
[ "Construct", "a", "FastStr", "instance", "from", "char", "array", "from", "the", "start", "position", "finished", "at", "end", "position", "without", "copying", "the", "array", ".", "This", "method", "might", "use", "the", "array", "directly", "instead", "of",...
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/FastStr.java#L1690-L1695
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.selectRangeWithoutCopy
private static Iterator<RoaringBitmap> selectRangeWithoutCopy(final Iterator<? extends RoaringBitmap> bitmaps, final long rangeStart, final long rangeEnd) { Iterator<RoaringBitmap> bitmapsIterator; bitmapsIterator = new Iterator<RoaringBitmap>() { @Override public boolean hasNext() { return bitmaps.hasNext(); } @Override public RoaringBitmap next() { RoaringBitmap next = bitmaps.next(); return selectRangeWithoutCopy(next, rangeStart, rangeEnd); } @Override public void remove() { throw new UnsupportedOperationException("Remove not supported"); } }; return bitmapsIterator; }
java
private static Iterator<RoaringBitmap> selectRangeWithoutCopy(final Iterator<? extends RoaringBitmap> bitmaps, final long rangeStart, final long rangeEnd) { Iterator<RoaringBitmap> bitmapsIterator; bitmapsIterator = new Iterator<RoaringBitmap>() { @Override public boolean hasNext() { return bitmaps.hasNext(); } @Override public RoaringBitmap next() { RoaringBitmap next = bitmaps.next(); return selectRangeWithoutCopy(next, rangeStart, rangeEnd); } @Override public void remove() { throw new UnsupportedOperationException("Remove not supported"); } }; return bitmapsIterator; }
[ "private", "static", "Iterator", "<", "RoaringBitmap", ">", "selectRangeWithoutCopy", "(", "final", "Iterator", "<", "?", "extends", "RoaringBitmap", ">", "bitmaps", ",", "final", "long", "rangeStart", ",", "final", "long", "rangeEnd", ")", "{", "Iterator", "<",...
Return new iterator with only values from rangeStart (inclusive) to rangeEnd (exclusive) @param bitmaps bitmaps iterator @param rangeStart inclusive @param rangeEnd exclusive @return new iterator of bitmaps
[ "Return", "new", "iterator", "with", "only", "values", "from", "rangeStart", "(", "inclusive", ")", "to", "rangeEnd", "(", "exclusive", ")" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L2565-L2587
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelConcat
@SafeVarargs public static <T> Stream<T> parallelConcat(final Iterator<? extends T>... a) { return parallelConcat(a, DEFAULT_READING_THREAD_NUM, calculateQueueSize(a.length)); }
java
@SafeVarargs public static <T> Stream<T> parallelConcat(final Iterator<? extends T>... a) { return parallelConcat(a, DEFAULT_READING_THREAD_NUM, calculateQueueSize(a.length)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "parallelConcat", "(", "final", "Iterator", "<", "?", "extends", "T", ">", "...", "a", ")", "{", "return", "parallelConcat", "(", "a", ",", "DEFAULT_READING_THREAD_NUM", ",", ...
Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param a @return
[ "Put", "the", "stream", "in", "try", "-", "catch", "to", "stop", "the", "back", "-", "end", "reading", "thread", "if", "error", "happens", "<br", "/", ">", "<code", ">", "try", "(", "Stream<Integer", ">", "stream", "=", "Stream", ".", "parallelConcat", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L4156-L4159
milaboratory/milib
src/main/java/com/milaboratory/core/io/util/FileIndexBuilder.java
FileIndexBuilder.putMetadata
public FileIndexBuilder putMetadata(String key, String value) { checkIfDestroyed(); metadata.put(key, value); return this; }
java
public FileIndexBuilder putMetadata(String key, String value) { checkIfDestroyed(); metadata.put(key, value); return this; }
[ "public", "FileIndexBuilder", "putMetadata", "(", "String", "key", ",", "String", "value", ")", "{", "checkIfDestroyed", "(", ")", ";", "metadata", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Puts metadata. @param key metadata key @param value metadata value @return this
[ "Puts", "metadata", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/FileIndexBuilder.java#L109-L113
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java
CudaZeroHandler.memcpySpecial
@Override public void memcpySpecial(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset) { CudaContext context = getCudaContext(); AllocationPoint point = ((BaseCudaDataBuffer) dstBuffer).getAllocationPoint(); Pointer dP = new CudaPointer((point.getPointers().getHostPointer().address()) + dstOffset); val profH = PerformanceTracker.getInstance().helperStartTransaction(); if (nativeOps.memcpyAsync(dP, srcPointer, length, CudaConstants.cudaMemcpyHostToHost, context.getOldStream()) == 0) throw new ND4JIllegalStateException("memcpyAsync failed"); PerformanceTracker.getInstance().helperRegisterTransaction(point.getDeviceId(), profH, point.getNumberOfBytes(),MemcpyDirection.HOST_TO_HOST); if (point.getAllocationStatus() == AllocationStatus.DEVICE) { Pointer rDP = new CudaPointer(point.getPointers().getDevicePointer().address() + dstOffset); val profD = PerformanceTracker.getInstance().helperStartTransaction(); if (nativeOps.memcpyAsync(rDP, dP, length, CudaConstants.cudaMemcpyHostToDevice, context.getOldStream()) == 0) throw new ND4JIllegalStateException("memcpyAsync failed"); context.syncOldStream(); PerformanceTracker.getInstance().helperRegisterTransaction(point.getDeviceId(), profD, point.getNumberOfBytes(),MemcpyDirection.HOST_TO_DEVICE); } context.syncOldStream(); point.tickDeviceWrite(); }
java
@Override public void memcpySpecial(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset) { CudaContext context = getCudaContext(); AllocationPoint point = ((BaseCudaDataBuffer) dstBuffer).getAllocationPoint(); Pointer dP = new CudaPointer((point.getPointers().getHostPointer().address()) + dstOffset); val profH = PerformanceTracker.getInstance().helperStartTransaction(); if (nativeOps.memcpyAsync(dP, srcPointer, length, CudaConstants.cudaMemcpyHostToHost, context.getOldStream()) == 0) throw new ND4JIllegalStateException("memcpyAsync failed"); PerformanceTracker.getInstance().helperRegisterTransaction(point.getDeviceId(), profH, point.getNumberOfBytes(),MemcpyDirection.HOST_TO_HOST); if (point.getAllocationStatus() == AllocationStatus.DEVICE) { Pointer rDP = new CudaPointer(point.getPointers().getDevicePointer().address() + dstOffset); val profD = PerformanceTracker.getInstance().helperStartTransaction(); if (nativeOps.memcpyAsync(rDP, dP, length, CudaConstants.cudaMemcpyHostToDevice, context.getOldStream()) == 0) throw new ND4JIllegalStateException("memcpyAsync failed"); context.syncOldStream(); PerformanceTracker.getInstance().helperRegisterTransaction(point.getDeviceId(), profD, point.getNumberOfBytes(),MemcpyDirection.HOST_TO_DEVICE); } context.syncOldStream(); point.tickDeviceWrite(); }
[ "@", "Override", "public", "void", "memcpySpecial", "(", "DataBuffer", "dstBuffer", ",", "Pointer", "srcPointer", ",", "long", "length", ",", "long", "dstOffset", ")", "{", "CudaContext", "context", "=", "getCudaContext", "(", ")", ";", "AllocationPoint", "point...
Special memcpy version, addressing shapeInfoDataBuffer copies PLEASE NOTE: Blocking H->H, Async H->D @param dstBuffer @param srcPointer @param length @param dstOffset
[ "Special", "memcpy", "version", "addressing", "shapeInfoDataBuffer", "copies" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L652-L683
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.eachKeyMappedToAnArrayLike
public LambdaDslObject eachKeyMappedToAnArrayLike(String exampleKey, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody objectLike = object.eachKeyMappedToAnArrayLike(exampleKey); final LambdaDslObject dslObject = new LambdaDslObject(objectLike); nestedObject.accept(dslObject); objectLike.closeObject().closeArray(); return this; }
java
public LambdaDslObject eachKeyMappedToAnArrayLike(String exampleKey, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody objectLike = object.eachKeyMappedToAnArrayLike(exampleKey); final LambdaDslObject dslObject = new LambdaDslObject(objectLike); nestedObject.accept(dslObject); objectLike.closeObject().closeArray(); return this; }
[ "public", "LambdaDslObject", "eachKeyMappedToAnArrayLike", "(", "String", "exampleKey", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "objectLike", "=", "object", ".", "eachKeyMappedToAnArrayLike", "(", "exampleKey", ...
Accepts any key, and each key is mapped to a list of items that must match the following object definition. Note: this needs the Java system property "pact.matching.wildcard" set to value "true" when the pact file is verified. @param exampleKey Example key to use for generating bodies
[ "Accepts", "any", "key", "and", "each", "key", "is", "mapped", "to", "a", "list", "of", "items", "that", "must", "match", "the", "following", "object", "definition", ".", "Note", ":", "this", "needs", "the", "Java", "system", "property", "pact", ".", "ma...
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L651-L657
hudson3-plugins/warnings-plugin
src/main/java/hudson/plugins/warnings/parser/RegexpParser.java
RegexpParser.findAnnotations
protected void findAnnotations(final String content, final List<FileAnnotation> warnings) throws ParsingCanceledException { Matcher matcher = pattern.matcher(content); while (matcher.find()) { Warning warning = createWarning(matcher); if (warning != FALSE_POSITIVE) { // NOPMD detectPackageName(warning); warnings.add(warning); } if (Thread.interrupted()) { throw new ParsingCanceledException(); } } }
java
protected void findAnnotations(final String content, final List<FileAnnotation> warnings) throws ParsingCanceledException { Matcher matcher = pattern.matcher(content); while (matcher.find()) { Warning warning = createWarning(matcher); if (warning != FALSE_POSITIVE) { // NOPMD detectPackageName(warning); warnings.add(warning); } if (Thread.interrupted()) { throw new ParsingCanceledException(); } } }
[ "protected", "void", "findAnnotations", "(", "final", "String", "content", ",", "final", "List", "<", "FileAnnotation", ">", "warnings", ")", "throws", "ParsingCanceledException", "{", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "content", ")", ";...
Parses the specified string content and creates annotations for each found warning. @param content the content to scan @param warnings the found annotations @throws ParsingCanceledException indicates that the user canceled the operation
[ "Parses", "the", "specified", "string", "content", "and", "creates", "annotations", "for", "each", "found", "warning", "." ]
train
https://github.com/hudson3-plugins/warnings-plugin/blob/462c9f3dffede9120173935567392b22520b0966/src/main/java/hudson/plugins/warnings/parser/RegexpParser.java#L83-L96
susom/database
src/main/java/com/github/susom/database/DatabaseProvider.java
DatabaseProvider.fromProperties
public static Builder fromProperties(Properties properties, String propertyPrefix) { return fromProperties(properties, propertyPrefix, false); }
java
public static Builder fromProperties(Properties properties, String propertyPrefix) { return fromProperties(properties, propertyPrefix, false); }
[ "public", "static", "Builder", "fromProperties", "(", "Properties", "properties", ",", "String", "propertyPrefix", ")", "{", "return", "fromProperties", "(", "properties", ",", "propertyPrefix", ",", "false", ")", ";", "}" ]
Configure the database from up to five properties read from the provided properties: <br/> <pre> database.url=... Database connect string (required) database.user=... Authenticate as this user (optional if provided in url) database.password=... User password (optional if user and password provided in url; prompted on standard input if user is provided and password is not) database.flavor=... What kind of database it is (optional, will guess based on the url if this is not provided) database.driver=... The Java class of the JDBC driver to load (optional, will guess based on the flavor if this is not provided) </pre> @param properties properties will be read from here @param propertyPrefix if this is null or empty the properties above will be read; if a value is provided it will be prefixed to each property (exactly, so if you want to use "my.database.url" you must pass "my." as the prefix) @throws DatabaseException if the property file could not be read for any reason
[ "Configure", "the", "database", "from", "up", "to", "five", "properties", "read", "from", "the", "provided", "properties", ":", "<br", "/", ">", "<pre", ">", "database", ".", "url", "=", "...", "Database", "connect", "string", "(", "required", ")", "databa...
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProvider.java#L394-L396
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/Bundle.java
Bundle.getString
public static String getString(String aKey) { try { return getBundle().getString(aKey); } catch(Exception e) { return getString("System_StringNotFound",new Object[]{aKey}); } }
java
public static String getString(String aKey) { try { return getBundle().getString(aKey); } catch(Exception e) { return getString("System_StringNotFound",new Object[]{aKey}); } }
[ "public", "static", "String", "getString", "(", "String", "aKey", ")", "{", "try", "{", "return", "getBundle", "(", ")", ".", "getString", "(", "aKey", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "getString", "(", "\"System_StringN...
Returns the string specified by aKey from the errors.properties bundle.
[ "Returns", "the", "string", "specified", "by", "aKey", "from", "the", "errors", ".", "properties", "bundle", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/Bundle.java#L48-L58
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/Messages.java
Messages.loadResourceBundle
private ListResourceBundle loadResourceBundle(String resourceBundle) throws MissingResourceException { m_resourceBundleName = resourceBundle; Locale locale = getLocale(); ListResourceBundle lrb; try { ResourceBundle rb = ResourceBundle.getBundle(m_resourceBundleName, locale); lrb = (ListResourceBundle) rb; } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. lrb = (ListResourceBundle) ResourceBundle.getBundle( m_resourceBundleName, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles." + m_resourceBundleName, m_resourceBundleName, ""); } } m_resourceBundle = lrb; return lrb; }
java
private ListResourceBundle loadResourceBundle(String resourceBundle) throws MissingResourceException { m_resourceBundleName = resourceBundle; Locale locale = getLocale(); ListResourceBundle lrb; try { ResourceBundle rb = ResourceBundle.getBundle(m_resourceBundleName, locale); lrb = (ListResourceBundle) rb; } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. lrb = (ListResourceBundle) ResourceBundle.getBundle( m_resourceBundleName, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles." + m_resourceBundleName, m_resourceBundleName, ""); } } m_resourceBundle = lrb; return lrb; }
[ "private", "ListResourceBundle", "loadResourceBundle", "(", "String", "resourceBundle", ")", "throws", "MissingResourceException", "{", "m_resourceBundleName", "=", "resourceBundle", ";", "Locale", "locale", "=", "getLocale", "(", ")", ";", "ListResourceBundle", "lrb", ...
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle(). @param className the name of the class that implements ListResourceBundle, without language suffix. @return the ResourceBundle @throws MissingResourceException @xsl.usage internal
[ "Return", "a", "named", "ResourceBundle", "for", "a", "particular", "locale", ".", "This", "method", "mimics", "the", "behavior", "of", "ResourceBundle", ".", "getBundle", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/Messages.java#L304-L344
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java
ParserUtil.parseOperationRequest
public static String parseOperationRequest(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { SubstitutedLine sl = parseOperationRequestLine(commandLine, handler, null); return sl == null ? null : sl.getSubstitued(); }
java
public static String parseOperationRequest(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { SubstitutedLine sl = parseOperationRequestLine(commandLine, handler, null); return sl == null ? null : sl.getSubstitued(); }
[ "public", "static", "String", "parseOperationRequest", "(", "String", "commandLine", ",", "final", "CommandLineParser", ".", "CallbackHandler", "handler", ")", "throws", "CommandFormatException", "{", "SubstitutedLine", "sl", "=", "parseOperationRequestLine", "(", "comman...
Returns the string which was actually parsed with all the substitutions performed
[ "Returns", "the", "string", "which", "was", "actually", "parsed", "with", "all", "the", "substitutions", "performed" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java#L99-L102
lucee/Lucee
loader/src/main/java/lucee/cli/CLI.java
CLI.main
public static void main(final String[] args) throws ServletException, IOException, JspException { final Map<String, String> config = toMap(args); System.setProperty("lucee.cli.call", "true"); final boolean useRMI = "true".equalsIgnoreCase(config.get("rmi")); File root; final String param = config.get("webroot"); if (Util.isEmpty(param, true)) { root = new File("."); // working directory that the java command was called from config.put("webroot", root.getAbsolutePath()); } else { root = new File(param); root.mkdirs(); } // System.out.println("set webroot to: " + root.getAbsolutePath()); String servletName = config.get("servlet-name"); if (Util.isEmpty(servletName, true)) servletName = "CFMLServlet"; if (useRMI) { final CLIFactory factory = new CLIFactory(root, servletName, config); factory.setDaemon(false); factory.start(); } else { final CLIInvokerImpl invoker = new CLIInvokerImpl(root, servletName); invoker.invoke(config); } }
java
public static void main(final String[] args) throws ServletException, IOException, JspException { final Map<String, String> config = toMap(args); System.setProperty("lucee.cli.call", "true"); final boolean useRMI = "true".equalsIgnoreCase(config.get("rmi")); File root; final String param = config.get("webroot"); if (Util.isEmpty(param, true)) { root = new File("."); // working directory that the java command was called from config.put("webroot", root.getAbsolutePath()); } else { root = new File(param); root.mkdirs(); } // System.out.println("set webroot to: " + root.getAbsolutePath()); String servletName = config.get("servlet-name"); if (Util.isEmpty(servletName, true)) servletName = "CFMLServlet"; if (useRMI) { final CLIFactory factory = new CLIFactory(root, servletName, config); factory.setDaemon(false); factory.start(); } else { final CLIInvokerImpl invoker = new CLIInvokerImpl(root, servletName); invoker.invoke(config); } }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "throws", "ServletException", ",", "IOException", ",", "JspException", "{", "final", "Map", "<", "String", ",", "String", ">", "config", "=", "toMap", "(", "args", ")", ";...
/* Config webroot - webroot directory servlet-name - name of the servlet (default:CFMLServlet) server-name - server name (default:localhost) uri - host/scriptname/query cookie - cookies (same pattern as query string) form - form (same pattern as query string)
[ "/", "*", "Config" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/cli/CLI.java#L41-L79
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/utils/DispatchingEStage.java
DispatchingEStage.onNext
@SuppressWarnings("unchecked") public <T, U extends T> void onNext(final Class<T> type, final U message) { if (this.isClosed()) { LOG.log(Level.WARNING, "Dispatcher {0} already closed: ignoring message {1}: {2}", new Object[] {this.stage, type.getCanonicalName(), message}); } else { final EventHandler<T> handler = (EventHandler<T>) this.handlers.get(type); this.stage.onNext(new DelayedOnNext(handler, message)); } }
java
@SuppressWarnings("unchecked") public <T, U extends T> void onNext(final Class<T> type, final U message) { if (this.isClosed()) { LOG.log(Level.WARNING, "Dispatcher {0} already closed: ignoring message {1}: {2}", new Object[] {this.stage, type.getCanonicalName(), message}); } else { final EventHandler<T> handler = (EventHandler<T>) this.handlers.get(type); this.stage.onNext(new DelayedOnNext(handler, message)); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ",", "U", "extends", "T", ">", "void", "onNext", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "U", "message", ")", "{", "if", "(", "this", ".", "isClosed", "(", ...
Dispatch a new message by type. If the stage is already closed, log a warning and ignore the message. @param type Type of event handler - must match the register() call. @param message A message to process. Must be a subclass of T. @param <T> Message type that event handler supports. @param <U> input message type. Must be a subclass of T.
[ "Dispatch", "a", "new", "message", "by", "type", ".", "If", "the", "stage", "is", "already", "closed", "log", "a", "warning", "and", "ignore", "the", "message", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/utils/DispatchingEStage.java#L111-L120
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java
StatementCache.calculateCacheKey
public String calculateCacheKey(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability){ StringBuilder tmp = calculateCacheKeyInternal(sql, resultSetType, resultSetConcurrency); tmp.append(", H:"); tmp.append(resultSetHoldability); return tmp.toString(); }
java
public String calculateCacheKey(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability){ StringBuilder tmp = calculateCacheKeyInternal(sql, resultSetType, resultSetConcurrency); tmp.append(", H:"); tmp.append(resultSetHoldability); return tmp.toString(); }
[ "public", "String", "calculateCacheKey", "(", "String", "sql", ",", "int", "resultSetType", ",", "int", "resultSetConcurrency", ",", "int", "resultSetHoldability", ")", "{", "StringBuilder", "tmp", "=", "calculateCacheKeyInternal", "(", "sql", ",", "resultSetType", ...
Simply appends the given parameters and returns it to obtain a cache key @param sql @param resultSetConcurrency @param resultSetHoldability @param resultSetType @return cache key to use
[ "Simply", "appends", "the", "given", "parameters", "and", "returns", "it", "to", "obtain", "a", "cache", "key" ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java#L68-L76
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/io/FileStorage.java
FileStorage.onInput
@Handler public void onInput(Input<ByteBuffer> event, Channel channel) { Writer writer = inputWriters.get(channel); if (writer != null) { writer.write(event.buffer()); } }
java
@Handler public void onInput(Input<ByteBuffer> event, Channel channel) { Writer writer = inputWriters.get(channel); if (writer != null) { writer.write(event.buffer()); } }
[ "@", "Handler", "public", "void", "onInput", "(", "Input", "<", "ByteBuffer", ">", "event", ",", "Channel", "channel", ")", "{", "Writer", "writer", "=", "inputWriters", ".", "get", "(", "channel", ")", ";", "if", "(", "writer", "!=", "null", ")", "{",...
Handle input by writing it to the file, if a channel exists. @param event the event @param channel the channel
[ "Handle", "input", "by", "writing", "it", "to", "the", "file", "if", "a", "channel", "exists", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/FileStorage.java#L327-L333
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteUser
public void deleteUser(CmsRequestContext context, CmsUUID userId, CmsUUID replacementId) throws CmsException { CmsUser user = readUser(context, userId); CmsUser replacementUser = null; if ((replacementId != null) && !replacementId.isNullUUID()) { replacementUser = readUser(context, replacementId); } deleteUser(context, user, replacementUser); }
java
public void deleteUser(CmsRequestContext context, CmsUUID userId, CmsUUID replacementId) throws CmsException { CmsUser user = readUser(context, userId); CmsUser replacementUser = null; if ((replacementId != null) && !replacementId.isNullUUID()) { replacementUser = readUser(context, replacementId); } deleteUser(context, user, replacementUser); }
[ "public", "void", "deleteUser", "(", "CmsRequestContext", "context", ",", "CmsUUID", "userId", ",", "CmsUUID", "replacementId", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "readUser", "(", "context", ",", "userId", ")", ";", "CmsUser", "replaceme...
Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user.<p> @param context the current request context @param userId the id of the user to be deleted @param replacementId the id of the user to be transfered @throws CmsException if operation was not successful
[ "Deletes", "a", "user", "where", "all", "permissions", "and", "resources", "attributes", "of", "the", "user", "were", "transfered", "to", "a", "replacement", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1679-L1687
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/CompactionJobConfigurator.java
CompactionJobConfigurator.concatPaths
private Path concatPaths(String... names) { if (names == null || names.length == 0) { return null; } Path cur = new Path(names[0]); for (int i = 1; i < names.length; ++i) { cur = new Path(cur, new Path(names[i])); } return cur; }
java
private Path concatPaths(String... names) { if (names == null || names.length == 0) { return null; } Path cur = new Path(names[0]); for (int i = 1; i < names.length; ++i) { cur = new Path(cur, new Path(names[i])); } return cur; }
[ "private", "Path", "concatPaths", "(", "String", "...", "names", ")", "{", "if", "(", "names", "==", "null", "||", "names", ".", "length", "==", "0", ")", "{", "return", "null", ";", "}", "Path", "cur", "=", "new", "Path", "(", "names", "[", "0", ...
Concatenate multiple directory or file names into one path @return Concatenated path or null if the parameter is empty
[ "Concatenate", "multiple", "directory", "or", "file", "names", "into", "one", "path" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/CompactionJobConfigurator.java#L263-L272
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRMapHandler.java
CDKRMapHandler.calculateOverlapsAndReduce
public void calculateOverlapsAndReduce(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds) throws CDKException { setSource(molecule1); setTarget(molecule2); setMappings(new ArrayList<Map<Integer, Integer>>()); if ((getSource().getAtomCount() == 1) || (getTarget().getAtomCount() == 1)) { List<CDKRMap> overlaps = CDKMCS.checkSingleAtomCases(getSource(), getTarget()); int nAtomsMatched = overlaps.size(); nAtomsMatched = (nAtomsMatched > 0) ? 1 : 0; if (nAtomsMatched > 0) { /* UnComment this to get one Unique Mapping */ //List reducedList = removeRedundantMappingsForSingleAtomCase(overlaps); //int counter = 0; identifySingleAtomsMatchedParts(overlaps, getSource(), getTarget()); } } else { List<List<CDKRMap>> overlaps = CDKMCS.search(getSource(), getTarget(), new BitSet(), new BitSet(), true, true, shouldMatchBonds); List<List<CDKRMap>> reducedList = removeSubGraph(overlaps); Stack<List<CDKRMap>> allMaxOverlaps = getAllMaximum(reducedList); while (!allMaxOverlaps.empty()) { // System.out.println("source: " + source.getAtomCount() + ", target: " + target.getAtomCount() + ", overl: " + allMaxOverlaps.peek().size()); List<List<CDKRMap>> maxOverlapsAtoms = makeAtomsMapOfBondsMap(allMaxOverlaps.peek(), getSource(), getTarget()); // System.out.println("size of maxOverlaps: " + maxOverlapsAtoms.size()); identifyMatchedParts(maxOverlapsAtoms, getSource(), getTarget()); // identifyMatchedParts(allMaxOverlaps.peek(), source, target); allMaxOverlaps.pop(); } } FinalMappings.getInstance().set(getMappings()); }
java
public void calculateOverlapsAndReduce(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds) throws CDKException { setSource(molecule1); setTarget(molecule2); setMappings(new ArrayList<Map<Integer, Integer>>()); if ((getSource().getAtomCount() == 1) || (getTarget().getAtomCount() == 1)) { List<CDKRMap> overlaps = CDKMCS.checkSingleAtomCases(getSource(), getTarget()); int nAtomsMatched = overlaps.size(); nAtomsMatched = (nAtomsMatched > 0) ? 1 : 0; if (nAtomsMatched > 0) { /* UnComment this to get one Unique Mapping */ //List reducedList = removeRedundantMappingsForSingleAtomCase(overlaps); //int counter = 0; identifySingleAtomsMatchedParts(overlaps, getSource(), getTarget()); } } else { List<List<CDKRMap>> overlaps = CDKMCS.search(getSource(), getTarget(), new BitSet(), new BitSet(), true, true, shouldMatchBonds); List<List<CDKRMap>> reducedList = removeSubGraph(overlaps); Stack<List<CDKRMap>> allMaxOverlaps = getAllMaximum(reducedList); while (!allMaxOverlaps.empty()) { // System.out.println("source: " + source.getAtomCount() + ", target: " + target.getAtomCount() + ", overl: " + allMaxOverlaps.peek().size()); List<List<CDKRMap>> maxOverlapsAtoms = makeAtomsMapOfBondsMap(allMaxOverlaps.peek(), getSource(), getTarget()); // System.out.println("size of maxOverlaps: " + maxOverlapsAtoms.size()); identifyMatchedParts(maxOverlapsAtoms, getSource(), getTarget()); // identifyMatchedParts(allMaxOverlaps.peek(), source, target); allMaxOverlaps.pop(); } } FinalMappings.getInstance().set(getMappings()); }
[ "public", "void", "calculateOverlapsAndReduce", "(", "IAtomContainer", "molecule1", ",", "IAtomContainer", "molecule2", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "setSource", "(", "molecule1", ")", ";", "setTarget", "(", "molecule2", ")",...
This function calculates all the possible combinations of MCS @param molecule1 @param molecule2 @param shouldMatchBonds @throws CDKException
[ "This", "function", "calculates", "all", "the", "possible", "combinations", "of", "MCS" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRMapHandler.java#L105-L144
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java
ShutdownHook.writeUnixCleanup
private void writeUnixCleanup(File file, BufferedWriter bw) throws IOException { bw.write("echo begin delete" + "\n"); bw.write("n=0" + "\n"); bw.write("while [ $n -ne 1 ]; do" + "\n"); bw.write(" sleep 3" + "\n"); bw.write(" if [ -e " + dir.replace('\\', '/') + " ]; then" + "\n"); bw.write(" rm -rf " + dir.replace('\\', '/') + "\n"); bw.write(" else" + "\n"); bw.write(" echo file not found - n=$n" + "\n"); bw.write(" n=1" + "\n"); bw.write(" fi" + "\n"); bw.write("done" + "\n"); bw.write("echo end delete" + "\n"); bw.write("rm " + file.getAbsolutePath().replace('\\', '/') + "\n"); }
java
private void writeUnixCleanup(File file, BufferedWriter bw) throws IOException { bw.write("echo begin delete" + "\n"); bw.write("n=0" + "\n"); bw.write("while [ $n -ne 1 ]; do" + "\n"); bw.write(" sleep 3" + "\n"); bw.write(" if [ -e " + dir.replace('\\', '/') + " ]; then" + "\n"); bw.write(" rm -rf " + dir.replace('\\', '/') + "\n"); bw.write(" else" + "\n"); bw.write(" echo file not found - n=$n" + "\n"); bw.write(" n=1" + "\n"); bw.write(" fi" + "\n"); bw.write("done" + "\n"); bw.write("echo end delete" + "\n"); bw.write("rm " + file.getAbsolutePath().replace('\\', '/') + "\n"); }
[ "private", "void", "writeUnixCleanup", "(", "File", "file", ",", "BufferedWriter", "bw", ")", "throws", "IOException", "{", "bw", ".", "write", "(", "\"echo begin delete\"", "+", "\"\\n\"", ")", ";", "bw", ".", "write", "(", "\"n=0\"", "+", "\"\\n\"", ")", ...
Write logic for Unix cleanup script @param file - script File object @param bw - bufferedWriter to write into script file @throws IOException
[ "Write", "logic", "for", "Unix", "cleanup", "script" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L175-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java
DefaultSources.getPropertiesFileConfigSources
public static List<ConfigSource> getPropertiesFileConfigSources(ClassLoader classloader) { ArrayList<ConfigSource> sources = new ArrayList<>(); try { Enumeration<URL> propsResources = classloader.getResources(ConfigConstants.CONFIG_PROPERTIES); if (propsResources != null) { while (propsResources.hasMoreElements()) { URL prop = propsResources.nextElement(); ConfigSource source = new PropertiesConfigSource(prop); sources.add(source); } } } catch (IOException e) { //TODO maybe we should just output a warning and continue?? //TODO NLS throw new ConfigException("Could not load " + ConfigConstants.CONFIG_PROPERTIES, e); } return sources; }
java
public static List<ConfigSource> getPropertiesFileConfigSources(ClassLoader classloader) { ArrayList<ConfigSource> sources = new ArrayList<>(); try { Enumeration<URL> propsResources = classloader.getResources(ConfigConstants.CONFIG_PROPERTIES); if (propsResources != null) { while (propsResources.hasMoreElements()) { URL prop = propsResources.nextElement(); ConfigSource source = new PropertiesConfigSource(prop); sources.add(source); } } } catch (IOException e) { //TODO maybe we should just output a warning and continue?? //TODO NLS throw new ConfigException("Could not load " + ConfigConstants.CONFIG_PROPERTIES, e); } return sources; }
[ "public", "static", "List", "<", "ConfigSource", ">", "getPropertiesFileConfigSources", "(", "ClassLoader", "classloader", ")", "{", "ArrayList", "<", "ConfigSource", ">", "sources", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "Enumeration", "<", ...
Add resources of name {#link ConfigConstants.CONFIG_PROPERTIES} to a List of sources using the classloader's loadResources method to locate resources. @param classloader @param sources
[ "Add", "resources", "of", "name", "{", "#link", "ConfigConstants", ".", "CONFIG_PROPERTIES", "}", "to", "a", "List", "of", "sources", "using", "the", "classloader", "s", "loadResources", "method", "to", "locate", "resources", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java#L59-L76
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java
JsonLdUtils.compareValues
static boolean compareValues(Object v1, Object v2) { if (v1.equals(v2)) { return true; } if (isValue(v1) && isValue(v2) && Obj.equals(((Map<String, Object>) v1).get("@value"), ((Map<String, Object>) v2).get("@value")) && Obj.equals(((Map<String, Object>) v1).get("@type"), ((Map<String, Object>) v2).get("@type")) && Obj.equals(((Map<String, Object>) v1).get("@language"), ((Map<String, Object>) v2).get("@language")) && Obj.equals(((Map<String, Object>) v1).get("@index"), ((Map<String, Object>) v2).get("@index"))) { return true; } if ((v1 instanceof Map && ((Map<String, Object>) v1).containsKey("@id")) && (v2 instanceof Map && ((Map<String, Object>) v2).containsKey("@id")) && ((Map<String, Object>) v1).get("@id") .equals(((Map<String, Object>) v2).get("@id"))) { return true; } return false; }
java
static boolean compareValues(Object v1, Object v2) { if (v1.equals(v2)) { return true; } if (isValue(v1) && isValue(v2) && Obj.equals(((Map<String, Object>) v1).get("@value"), ((Map<String, Object>) v2).get("@value")) && Obj.equals(((Map<String, Object>) v1).get("@type"), ((Map<String, Object>) v2).get("@type")) && Obj.equals(((Map<String, Object>) v1).get("@language"), ((Map<String, Object>) v2).get("@language")) && Obj.equals(((Map<String, Object>) v1).get("@index"), ((Map<String, Object>) v2).get("@index"))) { return true; } if ((v1 instanceof Map && ((Map<String, Object>) v1).containsKey("@id")) && (v2 instanceof Map && ((Map<String, Object>) v2).containsKey("@id")) && ((Map<String, Object>) v1).get("@id") .equals(((Map<String, Object>) v2).get("@id"))) { return true; } return false; }
[ "static", "boolean", "compareValues", "(", "Object", "v1", ",", "Object", "v2", ")", "{", "if", "(", "v1", ".", "equals", "(", "v2", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isValue", "(", "v1", ")", "&&", "isValue", "(", "v2", ")",...
Compares two JSON-LD values for equality. Two JSON-LD values will be considered equal if: 1. They are both primitives of the same type and value. 2. They are both @values with the same @value, @type, and @language, OR 3. They both have @ids they are the same. @param v1 the first value. @param v2 the second value. @return true if v1 and v2 are considered equal, false if not.
[ "Compares", "two", "JSON", "-", "LD", "values", "for", "equality", ".", "Two", "JSON", "-", "LD", "values", "will", "be", "considered", "equal", "if", ":" ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdUtils.java#L358-L383
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java
Shell.addMainHandler
public void addMainHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
java
public void addMainHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
[ "public", "void", "addMainHandler", "(", "Object", "handler", ",", "String", "prefix", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "allHandlers", ".", "add", "(", "handler", ")", ";"...
Method for registering command hanlers (or providers?) You call it, and from then the Shell has all commands declare in the handler object. This method recognizes if it is passed ShellDependent or ShellManageable and calls corresponding methods, as described in those interfaces. @see org.gearvrf.debug.cli.ShellDependent @see org.gearvrf.debug.cli.ShellManageable @param handler Object which should be registered as handler. @param prefix Prefix that should be prepended to all handler's command names.
[ "Method", "for", "registering", "command", "hanlers", "(", "or", "providers?", ")", "You", "call", "it", "and", "from", "then", "the", "Shell", "has", "all", "commands", "declare", "in", "the", "handler", "object", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java#L140-L153
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/system/IntegerRange.java
IntegerRange.createArray
public static ValueArray createArray(int begin, int end, int step) { if (end < begin) { throw new IllegalArgumentException("End must be greater or equal to begin"); } int nbClasses = (int) ((end - begin) / step); ValueInt[] getArray = new ValueInt[nbClasses]; for (int i = 0; i < nbClasses; i++) { getArray[i] = ValueInt.get(i * step + begin); } return ValueArray.get(getArray); }
java
public static ValueArray createArray(int begin, int end, int step) { if (end < begin) { throw new IllegalArgumentException("End must be greater or equal to begin"); } int nbClasses = (int) ((end - begin) / step); ValueInt[] getArray = new ValueInt[nbClasses]; for (int i = 0; i < nbClasses; i++) { getArray[i] = ValueInt.get(i * step + begin); } return ValueArray.get(getArray); }
[ "public", "static", "ValueArray", "createArray", "(", "int", "begin", ",", "int", "end", ",", "int", "step", ")", "{", "if", "(", "end", "<", "begin", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"End must be greater or equal to begin\"", ")", ...
Return an array of integers @param begin from start @param end to end @param step increment @return
[ "Return", "an", "array", "of", "integers" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/system/IntegerRange.java#L62-L73
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/DoubleDynamicHistogram.java
DoubleDynamicHistogram.increment
@Override public void increment(double coord, double value) { // Store in cache if (cachefill >= 0) { if (cachefill < cachec.length) { cachec[cachefill] = coord; cachev[cachefill] = value; cachefill ++; return; } else { materialize(); // But continue below! } } // Check if we need to resample to accomodate this bin. testResample(coord); // super class will handle histogram resizing / shifting super.increment(coord, value); }
java
@Override public void increment(double coord, double value) { // Store in cache if (cachefill >= 0) { if (cachefill < cachec.length) { cachec[cachefill] = coord; cachev[cachefill] = value; cachefill ++; return; } else { materialize(); // But continue below! } } // Check if we need to resample to accomodate this bin. testResample(coord); // super class will handle histogram resizing / shifting super.increment(coord, value); }
[ "@", "Override", "public", "void", "increment", "(", "double", "coord", ",", "double", "value", ")", "{", "// Store in cache", "if", "(", "cachefill", ">=", "0", ")", "{", "if", "(", "cachefill", "<", "cachec", ".", "length", ")", "{", "cachec", "[", "...
Put fresh data into the histogram (or into the cache) @param coord Coordinate @param value Value
[ "Put", "fresh", "data", "into", "the", "histogram", "(", "or", "into", "the", "cache", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/DoubleDynamicHistogram.java#L117-L135
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getCreateRequest
public BoxRequestsBookmark.CreateBookmark getCreateRequest(String parentId, String url) { BoxRequestsBookmark.CreateBookmark request = new BoxRequestsBookmark.CreateBookmark(parentId, url, getBookmarksUrl(), mSession); return request; }
java
public BoxRequestsBookmark.CreateBookmark getCreateRequest(String parentId, String url) { BoxRequestsBookmark.CreateBookmark request = new BoxRequestsBookmark.CreateBookmark(parentId, url, getBookmarksUrl(), mSession); return request; }
[ "public", "BoxRequestsBookmark", ".", "CreateBookmark", "getCreateRequest", "(", "String", "parentId", ",", "String", "url", ")", "{", "BoxRequestsBookmark", ".", "CreateBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "CreateBookmark", "(", "parentId", "...
Gets a request that creates a bookmark in a parent bookmark @param parentId id of the parent bookmark to create the bookmark in @param url URL of the new bookmark @return request to create a bookmark
[ "Gets", "a", "request", "that", "creates", "a", "bookmark", "in", "a", "parent", "bookmark" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L85-L88
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/Loading.java
Loading.setLoadingDrawable
protected void setLoadingDrawable(LoadingDrawable drawable) { if (drawable == null) { throw new NullPointerException("LoadingDrawable is null, You can only set the STYLE_CIRCLE and STYLE_LINE parameters."); } else { drawable.setCallback(this); mLoadingDrawable = drawable; invalidate(); requestLayout(); } }
java
protected void setLoadingDrawable(LoadingDrawable drawable) { if (drawable == null) { throw new NullPointerException("LoadingDrawable is null, You can only set the STYLE_CIRCLE and STYLE_LINE parameters."); } else { drawable.setCallback(this); mLoadingDrawable = drawable; invalidate(); requestLayout(); } }
[ "protected", "void", "setLoadingDrawable", "(", "LoadingDrawable", "drawable", ")", "{", "if", "(", "drawable", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"LoadingDrawable is null, You can only set the STYLE_CIRCLE and STYLE_LINE parameters.\"", ")...
In this we set LoadingDrawable really @param drawable {@link LoadingDrawable}
[ "In", "this", "we", "set", "LoadingDrawable", "really" ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/Loading.java#L361-L371
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java
JsonHelper.jsonStringToMap
public Map<String, Object> jsonStringToMap(String jsonString) { if (StringUtils.isEmpty(jsonString)) { return null; } JSONObject jsonObject; try { jsonObject = new JSONObject(jsonString); return jsonObjectToMap(jsonObject); } catch (JSONException e) { throw new RuntimeException("Unable to convert string to map: " + jsonString, e); } }
java
public Map<String, Object> jsonStringToMap(String jsonString) { if (StringUtils.isEmpty(jsonString)) { return null; } JSONObject jsonObject; try { jsonObject = new JSONObject(jsonString); return jsonObjectToMap(jsonObject); } catch (JSONException e) { throw new RuntimeException("Unable to convert string to map: " + jsonString, e); } }
[ "public", "Map", "<", "String", ",", "Object", ">", "jsonStringToMap", "(", "String", "jsonString", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "jsonString", ")", ")", "{", "return", "null", ";", "}", "JSONObject", "jsonObject", ";", "try", ...
Interprets supplied String as Json and converts it into a Map. @param jsonString string to interpret as Json object. @return property -> value.
[ "Interprets", "supplied", "String", "as", "Json", "and", "converts", "it", "into", "a", "Map", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java#L44-L55
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isPositive
public static void isPositive( long argument, String name ) { if (argument <= 0) { throw new IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument)); } }
java
public static void isPositive( long argument, String name ) { if (argument <= 0) { throw new IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument)); } }
[ "public", "static", "void", "isPositive", "(", "long", "argument", ",", "String", "name", ")", "{", "if", "(", "argument", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", "argumentMustBePositive", ".", "text", "(", "n...
Check that the argument is positive (>0). @param argument The argument @param name The name of the argument @throws IllegalArgumentException If argument is non-positive (<=0)
[ "Check", "that", "the", "argument", "is", "positive", "(", ">", "0", ")", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L268-L273
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java
InMemoryTopology.getOwnImports
@Override public List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey) { return getOwnImports(configKey, Optional.<Config>absent()); }
java
@Override public List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey) { return getOwnImports(configKey, Optional.<Config>absent()); }
[ "@", "Override", "public", "List", "<", "ConfigKeyPath", ">", "getOwnImports", "(", "ConfigKeyPath", "configKey", ")", "{", "return", "getOwnImports", "(", "configKey", ",", "Optional", ".", "<", "Config", ">", "absent", "(", ")", ")", ";", "}" ]
{@inheritDoc}. <p> If the result is already in cache, return the result. Otherwise, delegate the functionality to the fallback object </p>
[ "{", "@inheritDoc", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java#L124-L127
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java
SparkExport.exportCSVLocal
public static void exportCSVLocal(File outputFile, String delimiter, JavaRDD<List<Writable>> data, int rngSeed) throws Exception { exportCSVLocal(outputFile, delimiter, null, data, rngSeed); }
java
public static void exportCSVLocal(File outputFile, String delimiter, JavaRDD<List<Writable>> data, int rngSeed) throws Exception { exportCSVLocal(outputFile, delimiter, null, data, rngSeed); }
[ "public", "static", "void", "exportCSVLocal", "(", "File", "outputFile", ",", "String", "delimiter", ",", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "data", ",", "int", "rngSeed", ")", "throws", "Exception", "{", "exportCSVLocal", "(", "outputFile", ...
Another quick and dirty CSV export (local). Dumps all values into a single file
[ "Another", "quick", "and", "dirty", "CSV", "export", "(", "local", ")", ".", "Dumps", "all", "values", "into", "a", "single", "file" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java#L55-L58
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java
JawrRequestHandler.doGet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String requestedPath = "".equals(jawrConfig.getServletMapping()) ? request.getServletPath() : request.getPathInfo(); processRequest(requestedPath, request, response); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("ServletException : ", e); } throw new ServletException(e); } }
java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String requestedPath = "".equals(jawrConfig.getServletMapping()) ? request.getServletPath() : request.getPathInfo(); processRequest(requestedPath, request, response); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("ServletException : ", e); } throw new ServletException(e); } }
[ "public", "void", "doGet", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "try", "{", "String", "requestedPath", "=", "\"\"", ".", "equals", "(", "jawrConfig", ".", "getServ...
Handles a resource request by getting the requested path from the request object and invoking processRequest. @param request the request @param response the response @throws ServletException if a servlet exception occurs @throws IOException if an IO exception occurs.
[ "Handles", "a", "resource", "request", "by", "getting", "the", "requested", "path", "from", "the", "request", "object", "and", "invoking", "processRequest", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java#L647-L663
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.executeLargeBatch
@Override public long[] executeLargeBatch() throws SQLException { checkClose(); int size; if (batchQueries == null || (size = batchQueries.size()) == 0) { return new long[0]; } lock.lock(); try { internalBatchExecution(size); return results.getCmdInformation().getLargeUpdateCounts(); } catch (SQLException initialSqlEx) { throw executeBatchExceptionEpilogue(initialSqlEx, size); } finally { executeBatchEpilogue(); lock.unlock(); } }
java
@Override public long[] executeLargeBatch() throws SQLException { checkClose(); int size; if (batchQueries == null || (size = batchQueries.size()) == 0) { return new long[0]; } lock.lock(); try { internalBatchExecution(size); return results.getCmdInformation().getLargeUpdateCounts(); } catch (SQLException initialSqlEx) { throw executeBatchExceptionEpilogue(initialSqlEx, size); } finally { executeBatchEpilogue(); lock.unlock(); } }
[ "@", "Override", "public", "long", "[", "]", "executeLargeBatch", "(", ")", "throws", "SQLException", "{", "checkClose", "(", ")", ";", "int", "size", ";", "if", "(", "batchQueries", "==", "null", "||", "(", "size", "=", "batchQueries", ".", "size", "(",...
Execute batch, like executeBatch(), with returning results with long[]. For when row count may exceed Integer.MAX_VALUE. @return an array of update counts (one element for each command in the batch) @throws SQLException if a database error occur.
[ "Execute", "batch", "like", "executeBatch", "()", "with", "returning", "results", "with", "long", "[]", ".", "For", "when", "row", "count", "may", "exceed", "Integer", ".", "MAX_VALUE", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L1310-L1329
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/resources/demo/demo-soapclient/DemoSOAPClient.java
DemoSOAPClient.pipeStream
public static void pipeStream(InputStream in, OutputStream out, int bufSize) throws IOException { try { byte[] buf = new byte[bufSize]; int len; while ( ( len = in.read( buf ) ) > 0 ) { out.write( buf, 0, len ); } } finally { try { in.close(); out.close(); } catch (IOException e) { System.err.println("WARNING: Could not close stream."); } } }
java
public static void pipeStream(InputStream in, OutputStream out, int bufSize) throws IOException { try { byte[] buf = new byte[bufSize]; int len; while ( ( len = in.read( buf ) ) > 0 ) { out.write( buf, 0, len ); } } finally { try { in.close(); out.close(); } catch (IOException e) { System.err.println("WARNING: Could not close stream."); } } }
[ "public", "static", "void", "pipeStream", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "int", "bufSize", ")", "throws", "IOException", "{", "try", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "bufSize", "]", ";", "int", "len", "...
Copies the contents of an InputStream to an OutputStream, then closes both. @param in The source stream. @param out The target stram. @param bufSize Number of bytes to attempt to copy at a time. @throws IOException If any sort of read/write error occurs on either stream.
[ "Copies", "the", "contents", "of", "an", "InputStream", "to", "an", "OutputStream", "then", "closes", "both", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/resources/demo/demo-soapclient/DemoSOAPClient.java#L218-L234
jblas-project/jblas
src/main/java/org/jblas/Solve.java
Solve.pinv
public static DoubleMatrix pinv(DoubleMatrix A) { return solveLeastSquares(A, DoubleMatrix.eye(A.rows)); }
java
public static DoubleMatrix pinv(DoubleMatrix A) { return solveLeastSquares(A, DoubleMatrix.eye(A.rows)); }
[ "public", "static", "DoubleMatrix", "pinv", "(", "DoubleMatrix", "A", ")", "{", "return", "solveLeastSquares", "(", "A", ",", "DoubleMatrix", ".", "eye", "(", "A", ".", "rows", ")", ")", ";", "}" ]
Computes the pseudo-inverse. Note, this function uses the solveLeastSquares and might produce different numerical solutions for the underdetermined case than matlab. @param A rectangular matrix @return matrix P such that A*P*A = A and P*A*P = P.
[ "Computes", "the", "pseudo", "-", "inverse", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Solve.java#L104-L106
aws/aws-sdk-java
aws-java-sdk-iotanalytics/src/main/java/com/amazonaws/services/iotanalytics/model/AddAttributesActivity.java
AddAttributesActivity.withAttributes
public AddAttributesActivity withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public AddAttributesActivity withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "AddAttributesActivity", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> A list of 1-50 "AttributeNameMapping" objects that map an existing attribute to a new attribute. </p> <note> <p> The existing attributes remain in the message, so if you want to remove the originals, use "RemoveAttributeActivity". </p> </note> @param attributes A list of 1-50 "AttributeNameMapping" objects that map an existing attribute to a new attribute.</p> <note> <p> The existing attributes remain in the message, so if you want to remove the originals, use "RemoveAttributeActivity". </p> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "1", "-", "50", "AttributeNameMapping", "objects", "that", "map", "an", "existing", "attribute", "to", "a", "new", "attribute", ".", "<", "/", "p", ">", "<note", ">", "<p", ">", "The", "existing", "attributes", "remain", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iotanalytics/src/main/java/com/amazonaws/services/iotanalytics/model/AddAttributesActivity.java#L164-L167
jklingsporn/vertx-jooq
vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java
VertxGenerator.generateFetchMethods
protected void generateFetchMethods(TableDefinition table, JavaWriter out){ VertxJavaWriter vOut = (VertxJavaWriter) out; String pType = vOut.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO)); UniqueKeyDefinition primaryKey = table.getPrimaryKey(); ColumnDefinition firstPrimaryKeyColumn = primaryKey.getKeyColumns().get(0); for (ColumnDefinition column : table.getColumns()) { final String colName = column.getOutputName(); final String colClass = getStrategy().getJavaClassName(column); final String colType = vOut.ref(getJavaType(column.getType())); final String colIdentifier = vOut.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column)); //fetchById is already defined in VertxDAO if(!firstPrimaryKeyColumn.equals(column)){ // fetchBy[Column]([T]...) // ----------------------- generateFindManyByMethods(out, pType, colName, colClass, colType, colIdentifier); } ukLoop: for (UniqueKeyDefinition uk : column.getUniqueKeys()) { // If column is part of a single-column unique key... if (uk.getKeyColumns().size() == 1 && uk.getKeyColumns().get(0).equals(column) && !uk.isPrimaryKey()) { // fetchOneBy[Column]([T]) // ----------------------- generateFindOneByMethods(out, pType, colName, colClass, colType, colIdentifier); break ukLoop; } } } }
java
protected void generateFetchMethods(TableDefinition table, JavaWriter out){ VertxJavaWriter vOut = (VertxJavaWriter) out; String pType = vOut.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO)); UniqueKeyDefinition primaryKey = table.getPrimaryKey(); ColumnDefinition firstPrimaryKeyColumn = primaryKey.getKeyColumns().get(0); for (ColumnDefinition column : table.getColumns()) { final String colName = column.getOutputName(); final String colClass = getStrategy().getJavaClassName(column); final String colType = vOut.ref(getJavaType(column.getType())); final String colIdentifier = vOut.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column)); //fetchById is already defined in VertxDAO if(!firstPrimaryKeyColumn.equals(column)){ // fetchBy[Column]([T]...) // ----------------------- generateFindManyByMethods(out, pType, colName, colClass, colType, colIdentifier); } ukLoop: for (UniqueKeyDefinition uk : column.getUniqueKeys()) { // If column is part of a single-column unique key... if (uk.getKeyColumns().size() == 1 && uk.getKeyColumns().get(0).equals(column) && !uk.isPrimaryKey()) { // fetchOneBy[Column]([T]) // ----------------------- generateFindOneByMethods(out, pType, colName, colClass, colType, colIdentifier); break ukLoop; } } } }
[ "protected", "void", "generateFetchMethods", "(", "TableDefinition", "table", ",", "JavaWriter", "out", ")", "{", "VertxJavaWriter", "vOut", "=", "(", "VertxJavaWriter", ")", "out", ";", "String", "pType", "=", "vOut", ".", "ref", "(", "getStrategy", "(", ")",...
Copied (more ore less) from JavaGenerator. Generates fetchByCYZ- and fetchOneByCYZ-methods @param table @param out
[ "Copied", "(", "more", "ore", "less", ")", "from", "JavaGenerator", ".", "Generates", "fetchByCYZ", "-", "and", "fetchOneByCYZ", "-", "methods" ]
train
https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java#L390-L425
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java
PersistenceController.upsertMessageStatus
public Observable<Boolean> upsertMessageStatus(ChatMessageStatus status) { return asObservable(new Executor<Boolean>() { @Override void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccessful = store.update(status) && doUpdateConversationFromEvent(store, status.getConversationId(), status.getConversationEventId(), status.getUpdatedOn()); store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
java
public Observable<Boolean> upsertMessageStatus(ChatMessageStatus status) { return asObservable(new Executor<Boolean>() { @Override void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccessful = store.update(status) && doUpdateConversationFromEvent(store, status.getConversationId(), status.getConversationEventId(), status.getUpdatedOn()); store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "upsertMessageStatus", "(", "ChatMessageStatus", "status", ")", "{", "return", "asObservable", "(", "new", "Executor", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "void", "execute", "(", "ChatStore", "store...
Insert new message status. @param status New message status. @return Observable emitting result.
[ "Insert", "new", "message", "status", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L362-L377
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java
ImageVectorizer.shutDown
public void shutDown() { vectorizationExecutor.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) { vectorizationExecutor.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) System.err.println("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted vectorizationExecutor.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
java
public void shutDown() { vectorizationExecutor.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) { vectorizationExecutor.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) System.err.println("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted vectorizationExecutor.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
[ "public", "void", "shutDown", "(", ")", "{", "vectorizationExecutor", ".", "shutdown", "(", ")", ";", "// Disable new tasks from being submitted\r", "try", "{", "// Wait a while for existing tasks to terminate\r", "if", "(", "!", "vectorizationExecutor", ".", "awaitTerminat...
Shuts the vectorization executor down, waiting for up to 10 seconds for the remaining tasks to complete. See http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html
[ "Shuts", "the", "vectorization", "executor", "down", "waiting", "for", "up", "to", "10", "seconds", "for", "the", "remaining", "tasks", "to", "complete", ".", "See", "http", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "d...
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java#L222-L238
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java
AvroFlattener.flattenUnion
private Schema flattenUnion(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.UNION.equals(schema.getType())); Schema flattenedSchema; List<Schema> flattenedUnionMembers = new ArrayList<>(); if (null != schema.getTypes() && schema.getTypes().size() > 0) { for (Schema oldUnionMember : schema.getTypes()) { if (flattenComplexTypes) { // It's member might still recursively contain records flattenedUnionMembers.add(flatten(oldUnionMember, shouldPopulateLineage, flattenComplexTypes)); } else { flattenedUnionMembers.add(oldUnionMember); } } } flattenedSchema = Schema.createUnion(flattenedUnionMembers); return flattenedSchema; }
java
private Schema flattenUnion(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.UNION.equals(schema.getType())); Schema flattenedSchema; List<Schema> flattenedUnionMembers = new ArrayList<>(); if (null != schema.getTypes() && schema.getTypes().size() > 0) { for (Schema oldUnionMember : schema.getTypes()) { if (flattenComplexTypes) { // It's member might still recursively contain records flattenedUnionMembers.add(flatten(oldUnionMember, shouldPopulateLineage, flattenComplexTypes)); } else { flattenedUnionMembers.add(oldUnionMember); } } } flattenedSchema = Schema.createUnion(flattenedUnionMembers); return flattenedSchema; }
[ "private", "Schema", "flattenUnion", "(", "Schema", "schema", ",", "boolean", "shouldPopulateLineage", ",", "boolean", "flattenComplexTypes", ")", "{", "Preconditions", ".", "checkNotNull", "(", "schema", ")", ";", "Preconditions", ".", "checkArgument", "(", "Schema...
* Flatten Union Schema @param schema Union Schema to flatten @param shouldPopulateLineage If lineage information should be tagged in the field, this is true when we are un-nesting fields @param flattenComplexTypes Flatten complex types recursively other than Record and Option @return Flattened Union Schema
[ "*", "Flatten", "Union", "Schema" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java#L271-L291
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.element
public JSONObject element( String key, long value ) { verifyIsNull(); return element( key, new Long( value ) ); }
java
public JSONObject element( String key, long value ) { verifyIsNull(); return element( key, new Long( value ) ); }
[ "public", "JSONObject", "element", "(", "String", "key", ",", "long", "value", ")", "{", "verifyIsNull", "(", ")", ";", "return", "element", "(", "key", ",", "new", "Long", "(", "value", ")", ")", ";", "}" ]
Put a key/long pair in the JSONObject. @param key A key string. @param value A long which is the value. @return this. @throws JSONException If the key is null.
[ "Put", "a", "key", "/", "long", "pair", "in", "the", "JSONObject", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1640-L1643
KyoriPowered/text
api/src/main/java/net/kyori/text/KeybindComponent.java
KeybindComponent.of
public static KeybindComponent of(final @NonNull String keybind, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { return builder(keybind).color(color).decorations(decorations, true).build(); }
java
public static KeybindComponent of(final @NonNull String keybind, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { return builder(keybind).color(color).decorations(decorations, true).build(); }
[ "public", "static", "KeybindComponent", "of", "(", "final", "@", "NonNull", "String", "keybind", ",", "final", "@", "Nullable", "TextColor", "color", ",", "final", "@", "NonNull", "Set", "<", "TextDecoration", ">", "decorations", ")", "{", "return", "builder",...
Creates a keybind component with content, and optional color and decorations. @param keybind the keybind @param color the color @param decorations the decorations @return the keybind component
[ "Creates", "a", "keybind", "component", "with", "content", "and", "optional", "color", "and", "decorations", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/KeybindComponent.java#L97-L99
alkacon/opencms-core
src-setup/org/opencms/setup/updater/dialogs/A_CmsUpdateDialog.java
A_CmsUpdateDialog.readSnippet
public String readSnippet(String name) { String path = CmsStringUtil.joinPaths( m_ui.getUpdateBean().getWebAppRfsPath(), CmsUpdateBean.FOLDER_UPDATE, "html", name); try (InputStream stream = new FileInputStream(path)) { byte[] data = CmsFileUtil.readFully(stream, false); String result = new String(data, "UTF-8"); return result; } catch (Exception e) { throw new RuntimeException(e); } }
java
public String readSnippet(String name) { String path = CmsStringUtil.joinPaths( m_ui.getUpdateBean().getWebAppRfsPath(), CmsUpdateBean.FOLDER_UPDATE, "html", name); try (InputStream stream = new FileInputStream(path)) { byte[] data = CmsFileUtil.readFully(stream, false); String result = new String(data, "UTF-8"); return result; } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "String", "readSnippet", "(", "String", "name", ")", "{", "String", "path", "=", "CmsStringUtil", ".", "joinPaths", "(", "m_ui", ".", "getUpdateBean", "(", ")", ".", "getWebAppRfsPath", "(", ")", ",", "CmsUpdateBean", ".", "FOLDER_UPDATE", ",", "\"...
Reads an HTML snipped with the given name. @param name name of file @return the HTML data
[ "Reads", "an", "HTML", "snipped", "with", "the", "given", "name", ".", "@param", "name", "name", "of", "file" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/updater/dialogs/A_CmsUpdateDialog.java#L156-L170
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.setWordAndCandidate
void setWordAndCandidate(final String word, final String candidate) { wordProcessed = word.toCharArray(); wordLen = wordProcessed.length; this.candidate = candidate.toCharArray(); candLen = this.candidate.length; effectEditDistance = wordLen <= editDistance ? wordLen - 1 : editDistance; }
java
void setWordAndCandidate(final String word, final String candidate) { wordProcessed = word.toCharArray(); wordLen = wordProcessed.length; this.candidate = candidate.toCharArray(); candLen = this.candidate.length; effectEditDistance = wordLen <= editDistance ? wordLen - 1 : editDistance; }
[ "void", "setWordAndCandidate", "(", "final", "String", "word", ",", "final", "String", "candidate", ")", "{", "wordProcessed", "=", "word", ".", "toCharArray", "(", ")", ";", "wordLen", "=", "wordProcessed", ".", "length", ";", "this", ".", "candidate", "=",...
Sets up the word and candidate. Used only to test the edit distance in JUnit tests. @param word the first word @param candidate the second word used for edit distance calculation
[ "Sets", "up", "the", "word", "and", "candidate", ".", "Used", "only", "to", "test", "the", "edit", "distance", "in", "JUnit", "tests", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L871-L877
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java
JavaAnnotationMetadataBuilder.hasAnnotation
@Override public boolean hasAnnotation(Element element, Class<? extends Annotation> ann) { List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) { return true; } } return false; }
java
@Override public boolean hasAnnotation(Element element, Class<? extends Annotation> ann) { List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "hasAnnotation", "(", "Element", "element", ",", "Class", "<", "?", "extends", "Annotation", ">", "ann", ")", "{", "List", "<", "?", "extends", "AnnotationMirror", ">", "annotationMirrors", "=", "element", ".", "getAnnotat...
Checks if a method has an annotation. @param element The method @param ann The annotation to look for @return Whether if the method has the annotation
[ "Checks", "if", "a", "method", "has", "an", "annotation", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java#L404-L413
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/units/DaoUnit.java
DaoUnit.logSql
public static void logSql(Class daoUnitClass, Map<String, Object> map) { XianConnection connection = PoolFactory.getPool().getMasterDatasource().getConnection().blockingGet(); DaoUnit daoUnit; try { daoUnit = (DaoUnit) daoUnitClass.newInstance(); for (SqlAction action : daoUnit.getActions()) { ((AbstractSqlAction) action).setConnection(connection); ((AbstractSqlAction) action).setMap(map); action.logSql(map); } } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } PoolFactory.getPool().destroyPoolIfNot(); }
java
public static void logSql(Class daoUnitClass, Map<String, Object> map) { XianConnection connection = PoolFactory.getPool().getMasterDatasource().getConnection().blockingGet(); DaoUnit daoUnit; try { daoUnit = (DaoUnit) daoUnitClass.newInstance(); for (SqlAction action : daoUnit.getActions()) { ((AbstractSqlAction) action).setConnection(connection); ((AbstractSqlAction) action).setMap(map); action.logSql(map); } } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } PoolFactory.getPool().destroyPoolIfNot(); }
[ "public", "static", "void", "logSql", "(", "Class", "daoUnitClass", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "XianConnection", "connection", "=", "PoolFactory", ".", "getPool", "(", ")", ".", "getMasterDatasource", "(", ")", ".", "ge...
打印sql语句,它不会将sql执行,只是打印sql语句。 仅供内部测试使用 @param daoUnitClass unit class @param map parameter map
[ "打印sql语句,它不会将sql执行,只是打印sql语句。", "仅供内部测试使用" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/units/DaoUnit.java#L164-L178
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java
InstanceImpl.addSparseValues
@Override public void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes) { this.instanceData = new SparseInstanceData(attributeValues, indexValues, numberAttributes); //??? }
java
@Override public void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes) { this.instanceData = new SparseInstanceData(attributeValues, indexValues, numberAttributes); //??? }
[ "@", "Override", "public", "void", "addSparseValues", "(", "int", "[", "]", "indexValues", ",", "double", "[", "]", "attributeValues", ",", "int", "numberAttributes", ")", "{", "this", ".", "instanceData", "=", "new", "SparseInstanceData", "(", "attributeValues"...
Adds the sparse values. @param indexValues the index values @param attributeValues the attribute values @param numberAttributes the number attributes
[ "Adds", "the", "sparse", "values", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java#L381-L384
netty/netty
handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java
OpenSslX509KeyManagerFactory.newEngineBased
public static OpenSslX509KeyManagerFactory newEngineBased(X509Certificate[] certificateChain, String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { KeyStore store = new OpenSslKeyStore(certificateChain.clone(), false); store.load(null, null); OpenSslX509KeyManagerFactory factory = new OpenSslX509KeyManagerFactory(); factory.init(store, password == null ? null : password.toCharArray()); return factory; }
java
public static OpenSslX509KeyManagerFactory newEngineBased(X509Certificate[] certificateChain, String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { KeyStore store = new OpenSslKeyStore(certificateChain.clone(), false); store.load(null, null); OpenSslX509KeyManagerFactory factory = new OpenSslX509KeyManagerFactory(); factory.init(store, password == null ? null : password.toCharArray()); return factory; }
[ "public", "static", "OpenSslX509KeyManagerFactory", "newEngineBased", "(", "X509Certificate", "[", "]", "certificateChain", ",", "String", "password", ")", "throws", "CertificateException", ",", "IOException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", ",", ...
Create a new initialized {@link OpenSslX509KeyManagerFactory} which loads its {@link PrivateKey} directly from an {@code OpenSSL engine} via the <a href="https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_load_private_key.html">ENGINE_load_private_key</a> function.
[ "Create", "a", "new", "initialized", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L252-L260
alkacon/opencms-core
src/org/opencms/search/CmsSearchIndex.java
CmsSearchIndex.createDateRangeFilter
protected Query createDateRangeFilter(String fieldName, long startTime, long endTime) { Query filter = null; if ((startTime != Long.MIN_VALUE) || (endTime != Long.MAX_VALUE)) { // a date range has been set for this document search if (startTime == Long.MIN_VALUE) { // default start will always be "yyyy1231" in order to reduce term size Calendar cal = Calendar.getInstance(OpenCms.getLocaleManager().getTimeZone()); cal.setTimeInMillis(endTime); cal.set(cal.get(Calendar.YEAR) - MAX_YEAR_RANGE, 11, 31, 0, 0, 0); startTime = cal.getTimeInMillis(); } else if (endTime == Long.MAX_VALUE) { // default end will always be "yyyy0101" in order to reduce term size Calendar cal = Calendar.getInstance(OpenCms.getLocaleManager().getTimeZone()); cal.setTimeInMillis(startTime); cal.set(cal.get(Calendar.YEAR) + MAX_YEAR_RANGE, 0, 1, 0, 0, 0); endTime = cal.getTimeInMillis(); } // get the list of all possible date range options List<String> dateRange = getDateRangeSpan(startTime, endTime); List<Term> terms = new ArrayList<Term>(); for (String range : dateRange) { terms.add(new Term(fieldName, range)); } // create the filter for the date BooleanQuery.Builder build = new BooleanQuery.Builder(); terms.forEach(term -> build.add(new TermQuery(term), Occur.SHOULD)); filter = build.build(); } return filter; }
java
protected Query createDateRangeFilter(String fieldName, long startTime, long endTime) { Query filter = null; if ((startTime != Long.MIN_VALUE) || (endTime != Long.MAX_VALUE)) { // a date range has been set for this document search if (startTime == Long.MIN_VALUE) { // default start will always be "yyyy1231" in order to reduce term size Calendar cal = Calendar.getInstance(OpenCms.getLocaleManager().getTimeZone()); cal.setTimeInMillis(endTime); cal.set(cal.get(Calendar.YEAR) - MAX_YEAR_RANGE, 11, 31, 0, 0, 0); startTime = cal.getTimeInMillis(); } else if (endTime == Long.MAX_VALUE) { // default end will always be "yyyy0101" in order to reduce term size Calendar cal = Calendar.getInstance(OpenCms.getLocaleManager().getTimeZone()); cal.setTimeInMillis(startTime); cal.set(cal.get(Calendar.YEAR) + MAX_YEAR_RANGE, 0, 1, 0, 0, 0); endTime = cal.getTimeInMillis(); } // get the list of all possible date range options List<String> dateRange = getDateRangeSpan(startTime, endTime); List<Term> terms = new ArrayList<Term>(); for (String range : dateRange) { terms.add(new Term(fieldName, range)); } // create the filter for the date BooleanQuery.Builder build = new BooleanQuery.Builder(); terms.forEach(term -> build.add(new TermQuery(term), Occur.SHOULD)); filter = build.build(); } return filter; }
[ "protected", "Query", "createDateRangeFilter", "(", "String", "fieldName", ",", "long", "startTime", ",", "long", "endTime", ")", "{", "Query", "filter", "=", "null", ";", "if", "(", "(", "startTime", "!=", "Long", ".", "MIN_VALUE", ")", "||", "(", "endTim...
Creates an optimized date range filter for the date of last modification or creation.<p> If the start date is equal to {@link Long#MIN_VALUE} and the end date is equal to {@link Long#MAX_VALUE} than <code>null</code> is returned.<p> @param fieldName the name of the field to search @param startTime start time of the range to search in @param endTime end time of the range to search in @return an optimized date range filter for the date of last modification or creation
[ "Creates", "an", "optimized", "date", "range", "filter", "for", "the", "date", "of", "last", "modification", "or", "creation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1432-L1463
Waikato/moa
moa/src/main/java/moa/classifiers/meta/ADACC.java
ADACC.computeKappa
private double computeKappa(int[] y1,int[] y2){ int m=y1.length; double theta1=0; double counts[][]=new double[2][this.modelContext.numClasses()]; for (int i=0;i<m;i++){ if (y1[i]==y2[i]) theta1=theta1+1; counts[0][y1[i]]=counts[0][y1[i]]+1; counts[1][y2[i]]=counts[1][y2[i]]+1; } theta1=theta1/m; double theta2=0; for(int i=0;i<this.modelContext.numClasses();i++) theta2+=counts[0][i]/m*counts[1][i]/m; if (theta1==theta2 && theta2==1) return 1; return (theta1-theta2)/(1-theta2); }
java
private double computeKappa(int[] y1,int[] y2){ int m=y1.length; double theta1=0; double counts[][]=new double[2][this.modelContext.numClasses()]; for (int i=0;i<m;i++){ if (y1[i]==y2[i]) theta1=theta1+1; counts[0][y1[i]]=counts[0][y1[i]]+1; counts[1][y2[i]]=counts[1][y2[i]]+1; } theta1=theta1/m; double theta2=0; for(int i=0;i<this.modelContext.numClasses();i++) theta2+=counts[0][i]/m*counts[1][i]/m; if (theta1==theta2 && theta2==1) return 1; return (theta1-theta2)/(1-theta2); }
[ "private", "double", "computeKappa", "(", "int", "[", "]", "y1", ",", "int", "[", "]", "y2", ")", "{", "int", "m", "=", "y1", ".", "length", ";", "double", "theta1", "=", "0", ";", "double", "counts", "[", "]", "[", "]", "=", "new", "double", "...
Returns the kappa statistics, a statistical measure of agreement in the predictions of 2 classifiers. Used as a measure of diversity of predictive models: the higher the kappa value, the smaller the diversity @param y1 the predictions of classifier A @param y2 the predictions of classifier B @return the kappa measure
[ "Returns", "the", "kappa", "statistics", "a", "statistical", "measure", "of", "agreement", "in", "the", "predictions", "of", "2", "classifiers", ".", "Used", "as", "a", "measure", "of", "diversity", "of", "predictive", "models", ":", "the", "higher", "the", ...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/ADACC.java#L179-L207
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
ConstructorBuilder.buildConstructorComments
public void buildConstructorComments(XMLNode node, Content constructorDocTree) { if (!configuration.nocomment) { writer.addComments(currentConstructor, constructorDocTree); } }
java
public void buildConstructorComments(XMLNode node, Content constructorDocTree) { if (!configuration.nocomment) { writer.addComments(currentConstructor, constructorDocTree); } }
[ "public", "void", "buildConstructorComments", "(", "XMLNode", "node", ",", "Content", "constructorDocTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "writer", ".", "addComments", "(", "currentConstructor", ",", "constructorDocTree", "...
Build the comments for the constructor. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param constructorDocTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "constructor", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java#L200-L204
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSUtils.java
COSUtils.ensureOutputParameterInRange
public static int ensureOutputParameterInRange(String name, long size) { if (size > Integer.MAX_VALUE) { LOG.warn("cos: {} capped to ~2.14GB" + " (maximum allowed size with current output mechanism)", name); return Integer.MAX_VALUE; } else { return (int) size; } }
java
public static int ensureOutputParameterInRange(String name, long size) { if (size > Integer.MAX_VALUE) { LOG.warn("cos: {} capped to ~2.14GB" + " (maximum allowed size with current output mechanism)", name); return Integer.MAX_VALUE; } else { return (int) size; } }
[ "public", "static", "int", "ensureOutputParameterInRange", "(", "String", "name", ",", "long", "size", ")", "{", "if", "(", "size", ">", "Integer", ".", "MAX_VALUE", ")", "{", "LOG", ".", "warn", "(", "\"cos: {} capped to ~2.14GB\"", "+", "\" (maximum allowed si...
Ensure that the long value is in the range of an integer. @param name property name for error messages @param size original size @return the size, guaranteed to be less than or equal to the max value of an integer
[ "Ensure", "that", "the", "long", "value", "is", "in", "the", "range", "of", "an", "integer", "." ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSUtils.java#L224-L232