repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformTimestampToCalendar.java
TransformTimestampToCalendar.transformOut
@Override public Timestamp transformOut(JdbcCallableStatementFactory jcsf, Calendar cal) throws CpoException { Timestamp ts = null; if (cal != null) { ts = new Timestamp(cal.getTimeInMillis()); } return ts; }
java
@Override public Timestamp transformOut(JdbcCallableStatementFactory jcsf, Calendar cal) throws CpoException { Timestamp ts = null; if (cal != null) { ts = new Timestamp(cal.getTimeInMillis()); } return ts; }
[ "@", "Override", "public", "Timestamp", "transformOut", "(", "JdbcCallableStatementFactory", "jcsf", ",", "Calendar", "cal", ")", "throws", "CpoException", "{", "Timestamp", "ts", "=", "null", ";", "if", "(", "cal", "!=", "null", ")", "{", "ts", "=", "new", ...
Transforms a <code>java.util.Calendar</code> from the CPO Bean into a <code>java.sql.Timestamp</code> to be stored by JDBC @param jcsf a reference to the JdbcCallableStatementFactory. This is necessary as some DBMSs (ORACLE !#$%^&!) that require access to the connection to deal with certain datatypes. @param A Calendar instance @return A Timestamp object to be stored in the database. @throws CpoException
[ "Transforms", "a", "<code", ">", "java", ".", "util", ".", "Calendar<", "/", "code", ">", "from", "the", "CPO", "Bean", "into", "a", "<code", ">", "java", ".", "sql", ".", "Timestamp<", "/", "code", ">", "to", "be", "stored", "by", "JDBC" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformTimestampToCalendar.java#L70-L77
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.loadConfig
public static Config loadConfig(ConfigParseOptions parseOptions, ConfigResolveOptions resolveOptions, String configFile) { return loadConfig(parseOptions, resolveOptions, new File(configFile)); }
java
public static Config loadConfig(ConfigParseOptions parseOptions, ConfigResolveOptions resolveOptions, String configFile) { return loadConfig(parseOptions, resolveOptions, new File(configFile)); }
[ "public", "static", "Config", "loadConfig", "(", "ConfigParseOptions", "parseOptions", ",", "ConfigResolveOptions", "resolveOptions", ",", "String", "configFile", ")", "{", "return", "loadConfig", "(", "parseOptions", ",", "resolveOptions", ",", "new", "File", "(", ...
Load, Parse & Resolve configurations from a file, specifying parse & resolve options. @param parseOptions @param resolveOptions @param configFile @return
[ "Load", "Parse", "&", "Resolve", "configurations", "from", "a", "file", "specifying", "parse", "&", "resolve", "options", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L117-L120
facebookarchive/hadoop-20
src/contrib/index/src/java/org/apache/hadoop/contrib/index/mapred/DocumentAndOp.java
DocumentAndOp.setUpdate
public void setUpdate(Document doc, Term term) { this.op = Op.UPDATE; this.doc = doc; this.term = term; }
java
public void setUpdate(Document doc, Term term) { this.op = Op.UPDATE; this.doc = doc; this.term = term; }
[ "public", "void", "setUpdate", "(", "Document", "doc", ",", "Term", "term", ")", "{", "this", ".", "op", "=", "Op", ".", "UPDATE", ";", "this", ".", "doc", "=", "doc", ";", "this", ".", "term", "=", "term", ";", "}" ]
Set the instance to be an update operation. @param doc @param term
[ "Set", "the", "instance", "to", "be", "an", "update", "operation", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/index/src/java/org/apache/hadoop/contrib/index/mapred/DocumentAndOp.java#L139-L143
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java
WebSiteManagementClientImpl.listGeoRegionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<GeoRegionInner>>> listGeoRegionsWithServiceResponseAsync(final SkuName sku, final Boolean linuxWorkersEnabled) { return listGeoRegionsSinglePageAsync(sku, linuxWorkersEnabled) .concatMap(new Func1<ServiceResponse<Page<GeoRegionInner>>, Observable<ServiceResponse<Page<GeoRegionInner>>>>() { @Override public Observable<ServiceResponse<Page<GeoRegionInner>>> call(ServiceResponse<Page<GeoRegionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listGeoRegionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<GeoRegionInner>>> listGeoRegionsWithServiceResponseAsync(final SkuName sku, final Boolean linuxWorkersEnabled) { return listGeoRegionsSinglePageAsync(sku, linuxWorkersEnabled) .concatMap(new Func1<ServiceResponse<Page<GeoRegionInner>>, Observable<ServiceResponse<Page<GeoRegionInner>>>>() { @Override public Observable<ServiceResponse<Page<GeoRegionInner>>> call(ServiceResponse<Page<GeoRegionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listGeoRegionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "GeoRegionInner", ">", ">", ">", "listGeoRegionsWithServiceResponseAsync", "(", "final", "SkuName", "sku", ",", "final", "Boolean", "linuxWorkersEnabled", ")", "{", "return", "listGeoRegionsSinglePageAsyn...
Get a list of available geographical regions. Get a list of available geographical regions. @param sku Name of SKU used to filter the regions. Possible values include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'Dynamic', 'Isolated', 'PremiumV2' @param linuxWorkersEnabled Specify &lt;code&gt;true&lt;/code&gt; if you want to filter to only regions that support Linux workers. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;GeoRegionInner&gt; object
[ "Get", "a", "list", "of", "available", "geographical", "regions", ".", "Get", "a", "list", "of", "available", "geographical", "regions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L1589-L1601
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.notNull
@Throws(IllegalNullArgumentException.class) public static <T> void notNull(final boolean condition, @Nonnull final T reference) { if (condition) { Check.notNull(reference); } }
java
@Throws(IllegalNullArgumentException.class) public static <T> void notNull(final boolean condition, @Nonnull final T reference) { if (condition) { Check.notNull(reference); } }
[ "@", "Throws", "(", "IllegalNullArgumentException", ".", "class", ")", "public", "static", "<", "T", ">", "void", "notNull", "(", "final", "boolean", "condition", ",", "@", "Nonnull", "final", "T", "reference", ")", "{", "if", "(", "condition", ")", "{", ...
Ensures that an object reference passed as a parameter to the calling method is not {@code null}. <p> We recommend to use the overloaded method {@link Check#notNull(Object, String)} and pass as second argument the name of the parameter to enhance the exception message. @param condition condition must be {@code true}^ so that the check will be performed @param reference an object reference @throws IllegalNullArgumentException if the given argument {@code reference} is {@code null}
[ "Ensures", "that", "an", "object", "reference", "passed", "as", "a", "parameter", "to", "the", "calling", "method", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L2001-L2006
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.updateVnetGatewayAsync
public Observable<VnetGatewayInner> updateVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).map(new Func1<ServiceResponse<VnetGatewayInner>, VnetGatewayInner>() { @Override public VnetGatewayInner call(ServiceResponse<VnetGatewayInner> response) { return response.body(); } }); }
java
public Observable<VnetGatewayInner> updateVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).map(new Func1<ServiceResponse<VnetGatewayInner>, VnetGatewayInner>() { @Override public VnetGatewayInner call(ServiceResponse<VnetGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VnetGatewayInner", ">", "updateVnetGatewayAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "gatewayName", ",", "VnetGatewayInner", "connectionEnvelope", ")", "{", "return", "upda...
Update a Virtual Network gateway. Update a Virtual Network gateway. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. @param connectionEnvelope Definition of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VnetGatewayInner object
[ "Update", "a", "Virtual", "Network", "gateway", ".", "Update", "a", "Virtual", "Network", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3312-L3319
fcrepo4/fcrepo4
fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java
ContentExposingResource.getContent
protected Response getContent(final String rangeValue, final int limit, final RdfStream rdfStream, final FedoraResource resource) throws IOException { final RdfNamespacedStream outputStream; if (resource instanceof FedoraBinary) { return getBinaryContent(rangeValue, resource); } else { outputStream = new RdfNamespacedStream( new DefaultRdfStream(rdfStream.topic(), concat(rdfStream, getResourceTriples(limit, resource))), namespaceRegistry.getNamespaces()); } setVaryAndPreferenceAppliedHeaders(servletResponse, prefer, resource); return ok(outputStream).build(); }
java
protected Response getContent(final String rangeValue, final int limit, final RdfStream rdfStream, final FedoraResource resource) throws IOException { final RdfNamespacedStream outputStream; if (resource instanceof FedoraBinary) { return getBinaryContent(rangeValue, resource); } else { outputStream = new RdfNamespacedStream( new DefaultRdfStream(rdfStream.topic(), concat(rdfStream, getResourceTriples(limit, resource))), namespaceRegistry.getNamespaces()); } setVaryAndPreferenceAppliedHeaders(servletResponse, prefer, resource); return ok(outputStream).build(); }
[ "protected", "Response", "getContent", "(", "final", "String", "rangeValue", ",", "final", "int", "limit", ",", "final", "RdfStream", "rdfStream", ",", "final", "FedoraResource", "resource", ")", "throws", "IOException", "{", "final", "RdfNamespacedStream", "outputS...
This method returns an HTTP response with content body appropriate to the following arguments. @param rangeValue starting and ending byte offsets, see {@link Range} @param limit is the number of child resources returned in the response, -1 for all @param rdfStream to which response RDF will be concatenated @param resource the fedora resource @return HTTP response @throws IOException in case of error extracting content
[ "This", "method", "returns", "an", "HTTP", "response", "with", "content", "body", "appropriate", "to", "the", "following", "arguments", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L263-L280
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java
AsyncMutateInBuilder.arrayAppend
@Deprecated public <T> AsyncMutateInBuilder arrayAppend(String path, T value, boolean createPath) { return arrayAppend(path, value, new SubdocOptionsBuilder().createPath(createPath)); }
java
@Deprecated public <T> AsyncMutateInBuilder arrayAppend(String path, T value, boolean createPath) { return arrayAppend(path, value, new SubdocOptionsBuilder().createPath(createPath)); }
[ "@", "Deprecated", "public", "<", "T", ">", "AsyncMutateInBuilder", "arrayAppend", "(", "String", "path", ",", "T", "value", ",", "boolean", "createPath", ")", "{", "return", "arrayAppend", "(", "path", ",", "value", ",", "new", "SubdocOptionsBuilder", "(", ...
Append to an existing array, pushing the value to the back/last position in the array. @param path the path of the array. @param value the value to insert at the back of the array. @param createPath true to create missing intermediary nodes. @deprecated Use {@link #arrayAppend(String, Object, SubdocOptionsBuilder)} instead.
[ "Append", "to", "an", "existing", "array", "pushing", "the", "value", "to", "the", "back", "/", "last", "position", "in", "the", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L972-L975
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java
MappeableRunContainer.copyToOffset
private void copyToOffset(int offset) { final int minCapacity = 2 * (offset + nbrruns); if (valueslength.capacity() < minCapacity) { // expensive case where we need to reallocate int newCapacity = valueslength.capacity(); while (newCapacity < minCapacity) { newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE : newCapacity < 64 ? newCapacity * 2 : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4; } ShortBuffer newvalueslength = ShortBuffer.allocate(newCapacity); copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns); this.valueslength = newvalueslength; } else { // efficient case where we just copy copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns); } }
java
private void copyToOffset(int offset) { final int minCapacity = 2 * (offset + nbrruns); if (valueslength.capacity() < minCapacity) { // expensive case where we need to reallocate int newCapacity = valueslength.capacity(); while (newCapacity < minCapacity) { newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE : newCapacity < 64 ? newCapacity * 2 : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4; } ShortBuffer newvalueslength = ShortBuffer.allocate(newCapacity); copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns); this.valueslength = newvalueslength; } else { // efficient case where we just copy copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns); } }
[ "private", "void", "copyToOffset", "(", "int", "offset", ")", "{", "final", "int", "minCapacity", "=", "2", "*", "(", "offset", "+", "nbrruns", ")", ";", "if", "(", "valueslength", ".", "capacity", "(", ")", "<", "minCapacity", ")", "{", "// expensive ca...
Push all values length to the end of the array (resize array if needed)
[ "Push", "all", "values", "length", "to", "the", "end", "of", "the", "array", "(", "resize", "array", "if", "needed", ")" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java#L770-L787
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/SubReportBuilder.java
SubReportBuilder.setDataSource
public SubReportBuilder setDataSource(int origin, String expression) { return setDataSource(origin, DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE, expression); }
java
public SubReportBuilder setDataSource(int origin, String expression) { return setDataSource(origin, DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE, expression); }
[ "public", "SubReportBuilder", "setDataSource", "(", "int", "origin", ",", "String", "expression", ")", "{", "return", "setDataSource", "(", "origin", ",", "DJConstants", ".", "DATA_SOURCE_TYPE_JRDATASOURCE", ",", "expression", ")", ";", "}" ]
like addDataSource(int origin, int type, String expression) but the type will be of the {@link JRDataSource} @param origin @param expression @return
[ "like", "addDataSource", "(", "int", "origin", "int", "type", "String", "expression", ")", "but", "the", "type", "will", "be", "of", "the", "{" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/SubReportBuilder.java#L120-L122
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
EscapedFunctions2.sqlcurtime
public static void sqlcurtime(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { zeroArgumentFunctionCall(buf, "current_time", "curtime", parsedArgs); }
java
public static void sqlcurtime(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { zeroArgumentFunctionCall(buf, "current_time", "curtime", parsedArgs); }
[ "public", "static", "void", "sqlcurtime", "(", "StringBuilder", "buf", ",", "List", "<", "?", "extends", "CharSequence", ">", "parsedArgs", ")", "throws", "SQLException", "{", "zeroArgumentFunctionCall", "(", "buf", ",", "\"current_time\"", ",", "\"curtime\"", ","...
curtime to current_time translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens
[ "curtime", "to", "current_time", "translation" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L342-L344
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/BaseUpdateableClassifier.java
BaseUpdateableClassifier.trainEpochs
public static void trainEpochs(ClassificationDataSet dataSet, UpdateableClassifier toTrain, int epochs) { if(epochs < 1) throw new IllegalArgumentException("epochs must be positive"); toTrain.setUp(dataSet.getCategories(), dataSet.getNumNumericalVars(), dataSet.getPredicting()); IntList randomOrder = new IntList(dataSet.size()); ListUtils.addRange(randomOrder, 0, dataSet.size(), 1); for (int epoch = 0; epoch < epochs; epoch++) { Collections.shuffle(randomOrder); for (int i : randomOrder) toTrain.update(dataSet.getDataPoint(i), dataSet.getWeight(i), dataSet.getDataPointCategory(i)); } }
java
public static void trainEpochs(ClassificationDataSet dataSet, UpdateableClassifier toTrain, int epochs) { if(epochs < 1) throw new IllegalArgumentException("epochs must be positive"); toTrain.setUp(dataSet.getCategories(), dataSet.getNumNumericalVars(), dataSet.getPredicting()); IntList randomOrder = new IntList(dataSet.size()); ListUtils.addRange(randomOrder, 0, dataSet.size(), 1); for (int epoch = 0; epoch < epochs; epoch++) { Collections.shuffle(randomOrder); for (int i : randomOrder) toTrain.update(dataSet.getDataPoint(i), dataSet.getWeight(i), dataSet.getDataPointCategory(i)); } }
[ "public", "static", "void", "trainEpochs", "(", "ClassificationDataSet", "dataSet", ",", "UpdateableClassifier", "toTrain", ",", "int", "epochs", ")", "{", "if", "(", "epochs", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"epochs must be positiv...
Performs training on an updateable classifier by going over the whole data set in random order one observation at a time, multiple times. @param dataSet the data set to train from @param toTrain the classifier to train @param epochs the number of passes through the data set
[ "Performs", "training", "on", "an", "updateable", "classifier", "by", "going", "over", "the", "whole", "data", "set", "in", "random", "order", "one", "observation", "at", "a", "time", "multiple", "times", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/BaseUpdateableClassifier.java#L82-L96
craftercms/commons
utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java
HttpUtils.addValues
public static void addValues(String key, Collection<String> values, MultiValueMap<String, String> params) { if (values != null) { for (String value : values) { params.add(key, value); } } }
java
public static void addValues(String key, Collection<String> values, MultiValueMap<String, String> params) { if (values != null) { for (String value : values) { params.add(key, value); } } }
[ "public", "static", "void", "addValues", "(", "String", "key", ",", "Collection", "<", "String", ">", "values", ",", "MultiValueMap", "<", "String", ",", "String", ">", "params", ")", "{", "if", "(", "values", "!=", "null", ")", "{", "for", "(", "Strin...
Adds a collection of param values to a params map. If the collection is null, nothing is done. @param key the param key @param values the collection of param values @param params the params map
[ "Adds", "a", "collection", "of", "param", "values", "to", "a", "params", "map", ".", "If", "the", "collection", "is", "null", "nothing", "is", "done", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java#L198-L204
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java
LibraryLoader.findLibraryURL
@Pure public static URL findLibraryURL(String libName) { return findLibraryURL(null, libName, null, null); }
java
@Pure public static URL findLibraryURL(String libName) { return findLibraryURL(null, libName, null, null); }
[ "@", "Pure", "public", "static", "URL", "findLibraryURL", "(", "String", "libName", ")", "{", "return", "findLibraryURL", "(", "null", ",", "libName", ",", "null", ",", "null", ")", ";", "}" ]
Replies the URL for the specified library. @param libName is the name of the library @return the URL where the specified library was located.
[ "Replies", "the", "URL", "for", "the", "specified", "library", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java#L233-L236
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getQualifiedClassLink
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, Element element) { LinkInfoImpl linkInfoImpl = new LinkInfoImpl(configuration, context, (TypeElement)element); return getLink(linkInfoImpl.label(utils.getFullyQualifiedName(element))); }
java
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, Element element) { LinkInfoImpl linkInfoImpl = new LinkInfoImpl(configuration, context, (TypeElement)element); return getLink(linkInfoImpl.label(utils.getFullyQualifiedName(element))); }
[ "public", "Content", "getQualifiedClassLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "Element", "element", ")", "{", "LinkInfoImpl", "linkInfoImpl", "=", "new", "LinkInfoImpl", "(", "configuration", ",", "context", ",", "(", "TypeElement", ")", "element...
Get the class link. @param context the id of the context where the link will be added @param element to link to @return a content tree for the link
[ "Get", "the", "class", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1271-L1274
auth0/auth0-spring-security-api
lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java
JwtWebSecurityConfigurer.forRS256
@SuppressWarnings({"WeakerAccess", "SameParameterValue"}) public static JwtWebSecurityConfigurer forRS256(String audience, String issuer) { final JwkProvider jwkProvider = new JwkProviderBuilder(issuer).build(); return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(jwkProvider, issuer, audience)); }
java
@SuppressWarnings({"WeakerAccess", "SameParameterValue"}) public static JwtWebSecurityConfigurer forRS256(String audience, String issuer) { final JwkProvider jwkProvider = new JwkProviderBuilder(issuer).build(); return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(jwkProvider, issuer, audience)); }
[ "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"SameParameterValue\"", "}", ")", "public", "static", "JwtWebSecurityConfigurer", "forRS256", "(", "String", "audience", ",", "String", "issuer", ")", "{", "final", "JwkProvider", "jwkProvider", "=", "new...
Configures application authorization for JWT signed with RS256. Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value of {@code kid} of the JWT header @param audience identifier of the API and must match the {@code aud} value in the token @param issuer of the token for this API and must match the {@code iss} value in the token @return JwtWebSecurityConfigurer for further configuration
[ "Configures", "application", "authorization", "for", "JWT", "signed", "with", "RS256", ".", "Will", "try", "to", "validate", "the", "token", "using", "the", "public", "key", "downloaded", "from", "$issuer", "/", ".", "well", "-", "known", "/", "jwks", ".", ...
train
https://github.com/auth0/auth0-spring-security-api/blob/cebd4daa0125efd4da9e651cf29aa5ebdb147e2b/lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java#L33-L37
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.fireDefaultSREChanged
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) { for (final Object listener : SRE_LISTENERS.getListeners()) { ((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current); } }
java
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) { for (final Object listener : SRE_LISTENERS.getListeners()) { ((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current); } }
[ "private", "static", "void", "fireDefaultSREChanged", "(", "ISREInstall", "previous", ",", "ISREInstall", "current", ")", "{", "for", "(", "final", "Object", "listener", ":", "SRE_LISTENERS", ".", "getListeners", "(", ")", ")", "{", "(", "(", "ISREInstallChanged...
Notifies registered listeners that the default SRE has changed. @param previous the previous SRE @param current the new current default SRE
[ "Notifies", "registered", "listeners", "that", "the", "default", "SRE", "has", "changed", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L391-L395
xbib/marc
src/main/java/org/xbib/marc/xml/MarcContentHandler.java
MarcContentHandler.setMarcListener
public MarcContentHandler setMarcListener(String type, MarcListener listener) { this.listeners.put(type, listener); return this; }
java
public MarcContentHandler setMarcListener(String type, MarcListener listener) { this.listeners.put(type, listener); return this; }
[ "public", "MarcContentHandler", "setMarcListener", "(", "String", "type", ",", "MarcListener", "listener", ")", "{", "this", ".", "listeners", ".", "put", "(", "type", ",", "listener", ")", ";", "return", "this", ";", "}" ]
Set MARC listener for a specific record type. @param type the record type @param listener the MARC listener @return this handler
[ "Set", "MARC", "listener", "for", "a", "specific", "record", "type", "." ]
train
https://github.com/xbib/marc/blob/d8426fcfc686507cab59b3d8181b08f83718418c/src/main/java/org/xbib/marc/xml/MarcContentHandler.java#L101-L104
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java
MyfacesLogger.entering
public void entering(String sourceClass, String sourceMethod, Object param1) { _log.entering(sourceClass, sourceMethod, param1); }
java
public void entering(String sourceClass, String sourceMethod, Object param1) { _log.entering(sourceClass, sourceMethod, param1); }
[ "public", "void", "entering", "(", "String", "sourceClass", ",", "String", "sourceMethod", ",", "Object", "param1", ")", "{", "_log", ".", "entering", "(", "sourceClass", ",", "sourceMethod", ",", "param1", ")", ";", "}" ]
Log a method entry, with one parameter. <p> This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY {0}", log level FINER, and the given sourceMethod, sourceClass, and parameter is logged. <p> @param sourceClass name of class that issued the logging request @param sourceMethod name of method that is being entered @param param1 parameter to the method being entered
[ "Log", "a", "method", "entry", "with", "one", "parameter", ".", "<p", ">", "This", "is", "a", "convenience", "method", "that", "can", "be", "used", "to", "log", "entry", "to", "a", "method", ".", "A", "LogRecord", "with", "message", "ENTRY", "{", "0", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java#L723-L726
authlete/authlete-java-common
src/main/java/com/authlete/common/dto/AuthorizationRequest.java
AuthorizationRequest.setParameters
public AuthorizationRequest setParameters(Map<String, String[]> parameters) { return setParameters(URLCoder.formUrlEncode(parameters)); }
java
public AuthorizationRequest setParameters(Map<String, String[]> parameters) { return setParameters(URLCoder.formUrlEncode(parameters)); }
[ "public", "AuthorizationRequest", "setParameters", "(", "Map", "<", "String", ",", "String", "[", "]", ">", "parameters", ")", "{", "return", "setParameters", "(", "URLCoder", ".", "formUrlEncode", "(", "parameters", ")", ")", ";", "}" ]
Set the value of {@code parameters} which are the request parameters that the OAuth 2.0 authorization endpoint of the service implementation received from the client application. <p> This method converts the given map into a string in {@code x-www-form-urlencoded} format and passes it to {@link #setParameters(String)} method. </p> @param parameters Request parameters. @return {@code this} object. @since 1.24
[ "Set", "the", "value", "of", "{", "@code", "parameters", "}", "which", "are", "the", "request", "parameters", "that", "the", "OAuth", "2", ".", "0", "authorization", "endpoint", "of", "the", "service", "implementation", "received", "from", "the", "client", "...
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/AuthorizationRequest.java#L116-L119
opencypher/openCypher
tools/grammar/src/main/java/org/opencypher/tools/TypedArgument.java
TypedArgument.typed
public static TypedArgument typed( Class<?> type, Object value ) { type = Objects.requireNonNull( type, "type" ); if ( value != null && !type.isInstance( value ) ) { throw new IllegalArgumentException( value + " (a " + value.getClass().getName() + ") is not an instance of " + type.getName() ); } return new TypedArgument( type, value ); }
java
public static TypedArgument typed( Class<?> type, Object value ) { type = Objects.requireNonNull( type, "type" ); if ( value != null && !type.isInstance( value ) ) { throw new IllegalArgumentException( value + " (a " + value.getClass().getName() + ") is not an instance of " + type.getName() ); } return new TypedArgument( type, value ); }
[ "public", "static", "TypedArgument", "typed", "(", "Class", "<", "?", ">", "type", ",", "Object", "value", ")", "{", "type", "=", "Objects", ".", "requireNonNull", "(", "type", ",", "\"type\"", ")", ";", "if", "(", "value", "!=", "null", "&&", "!", "...
Factory method. @param type the type of the parameter. @param value the value of the argument. @return a new instance.
[ "Factory", "method", "." ]
train
https://github.com/opencypher/openCypher/blob/eb780caea625900ddbedd28a1eac9a5dbe09c5f0/tools/grammar/src/main/java/org/opencypher/tools/TypedArgument.java#L46-L55
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADECache.java
CmsADECache.setCacheGroupContainer
public void setCacheGroupContainer(String key, CmsXmlGroupContainer groupContainer, boolean online) { try { m_lock.writeLock().lock(); if (online) { m_groupContainersOnline.put(key, groupContainer); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_ONLINE_2, new Object[] {key, groupContainer})); } } else { m_groupContainersOffline.put(key, groupContainer); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_OFFLINE_2, new Object[] {key, groupContainer})); } } } finally { m_lock.writeLock().unlock(); } }
java
public void setCacheGroupContainer(String key, CmsXmlGroupContainer groupContainer, boolean online) { try { m_lock.writeLock().lock(); if (online) { m_groupContainersOnline.put(key, groupContainer); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_ONLINE_2, new Object[] {key, groupContainer})); } } else { m_groupContainersOffline.put(key, groupContainer); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_OFFLINE_2, new Object[] {key, groupContainer})); } } } finally { m_lock.writeLock().unlock(); } }
[ "public", "void", "setCacheGroupContainer", "(", "String", "key", ",", "CmsXmlGroupContainer", "groupContainer", ",", "boolean", "online", ")", "{", "try", "{", "m_lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "if", "(", "online", ")", "{"...
Caches the given group container under the given key and for the given project.<p> @param key the cache key @param groupContainer the object to cache @param online if to cache in online or offline project
[ "Caches", "the", "given", "group", "container", "under", "the", "given", "key", "and", "for", "the", "given", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L284-L308
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newPostOpenGraphObjectRequest
public static Request newPostOpenGraphObjectRequest(Session session, String type, String title, String imageUrl, String url, String description, GraphObject objectProperties, Callback callback) { OpenGraphObject openGraphObject = OpenGraphObject.Factory.createForPost(OpenGraphObject.class, type, title, imageUrl, url, description); if (objectProperties != null) { openGraphObject.setData(objectProperties); } return newPostOpenGraphObjectRequest(session, openGraphObject, callback); }
java
public static Request newPostOpenGraphObjectRequest(Session session, String type, String title, String imageUrl, String url, String description, GraphObject objectProperties, Callback callback) { OpenGraphObject openGraphObject = OpenGraphObject.Factory.createForPost(OpenGraphObject.class, type, title, imageUrl, url, description); if (objectProperties != null) { openGraphObject.setData(objectProperties); } return newPostOpenGraphObjectRequest(session, openGraphObject, callback); }
[ "public", "static", "Request", "newPostOpenGraphObjectRequest", "(", "Session", "session", ",", "String", "type", ",", "String", "title", ",", "String", "imageUrl", ",", "String", "url", ",", "String", "description", ",", "GraphObject", "objectProperties", ",", "C...
Creates a new Request configured to create a user owned Open Graph object. @param session the Session to use, or null; if non-null, the session must be in an opened state @param type the fully-specified Open Graph object type (e.g., my_app_namespace:my_object_name); must not be null @param title the title of the Open Graph object; must not be null @param imageUrl the link to an image to be associated with the Open Graph object; may be null @param url the url to be associated with the Open Graph object; may be null @param description the description to be associated with the object; may be null @param objectProperties any additional type-specific properties for the Open Graph object; may be null @param callback a callback that will be called when the request is completed to handle success or error conditions; may be null @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "create", "a", "user", "owned", "Open", "Graph", "object", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L720-L729
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java
WorkbookUtil.createBook
public static Workbook createBook(File excelFile, String password) { try { return WorkbookFactory.create(excelFile, password); } catch (Exception e) { throw new POIException(e); } }
java
public static Workbook createBook(File excelFile, String password) { try { return WorkbookFactory.create(excelFile, password); } catch (Exception e) { throw new POIException(e); } }
[ "public", "static", "Workbook", "createBook", "(", "File", "excelFile", ",", "String", "password", ")", "{", "try", "{", "return", "WorkbookFactory", ".", "create", "(", "excelFile", ",", "password", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{",...
创建或加载工作簿,只读模式 @param excelFile Excel文件 @param password Excel工作簿密码,如果无密码传{@code null} @return {@link Workbook}
[ "创建或加载工作簿,只读模式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L58-L64
zaproxy/zaproxy
src/org/zaproxy/zap/view/DeselectableButtonGroup.java
DeselectableButtonGroup.setSelected
@Override public void setSelected(ButtonModel m, boolean selected) { if (!selected && m == getSelection()) { clearSelection(); } else { super.setSelected(m, selected); } }
java
@Override public void setSelected(ButtonModel m, boolean selected) { if (!selected && m == getSelection()) { clearSelection(); } else { super.setSelected(m, selected); } }
[ "@", "Override", "public", "void", "setSelected", "(", "ButtonModel", "m", ",", "boolean", "selected", ")", "{", "if", "(", "!", "selected", "&&", "m", "==", "getSelection", "(", ")", ")", "{", "clearSelection", "(", ")", ";", "}", "else", "{", "super"...
{@inheritDoc} <p> Overridden to deselect the button when {@code selected} is {@code false}. </p>
[ "{" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/DeselectableButtonGroup.java#L40-L47
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/Launcher.java
Launcher.addEnvironmentVariable
public Launcher addEnvironmentVariable(final String key, final String value) { env.put(key, value); return this; }
java
public Launcher addEnvironmentVariable(final String key, final String value) { env.put(key, value); return this; }
[ "public", "Launcher", "addEnvironmentVariable", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "env", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds an environment variable to the process being created. @param key they key for the variable @param value the value for the variable @return the launcher
[ "Adds", "an", "environment", "variable", "to", "the", "process", "being", "created", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Launcher.java#L218-L221
realexpayments/rxp-hpp-java
src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java
JsonUtils.fromJsonHppResponse
public static HppResponse fromJsonHppResponse(String json) { try { return hppResponseReader.readValue(json); } catch (Exception ex) { LOGGER.error("Error creating HppResponse from JSON.", ex); throw new RealexException("Error creating HppResponse from JSON.", ex); } }
java
public static HppResponse fromJsonHppResponse(String json) { try { return hppResponseReader.readValue(json); } catch (Exception ex) { LOGGER.error("Error creating HppResponse from JSON.", ex); throw new RealexException("Error creating HppResponse from JSON.", ex); } }
[ "public", "static", "HppResponse", "fromJsonHppResponse", "(", "String", "json", ")", "{", "try", "{", "return", "hppResponseReader", ".", "readValue", "(", "json", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOGGER", ".", "error", "(", "\"E...
Method deserialises JSON to <code>HppResponse</code>. @param json @return HppResponse
[ "Method", "deserialises", "JSON", "to", "<code", ">", "HppResponse<", "/", "code", ">", "." ]
train
https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/utils/JsonUtils.java#L108-L115
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java
ElementPlugin.registerId
public void registerId(String id, BaseComponent component) { if (!StringUtils.isEmpty(id) && !container.hasAttribute(id)) { container.setAttribute(id, component); } }
java
public void registerId(String id, BaseComponent component) { if (!StringUtils.isEmpty(id) && !container.hasAttribute(id)) { container.setAttribute(id, component); } }
[ "public", "void", "registerId", "(", "String", "id", ",", "BaseComponent", "component", ")", "{", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "id", ")", "&&", "!", "container", ".", "hasAttribute", "(", "id", ")", ")", "{", "container", ".", "s...
Allows auto-wire to work even if component is not a child of the container. @param id BaseComponent id. @param component BaseComponent to be registered.
[ "Allows", "auto", "-", "wire", "to", "work", "even", "if", "component", "is", "not", "a", "child", "of", "the", "container", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L635-L639
Harium/keel
src/main/java/com/harium/keel/catalano/core/DoublePoint.java
DoublePoint.Multiply
public DoublePoint Multiply(DoublePoint point1, DoublePoint point2) { DoublePoint result = new DoublePoint(point1); result.Multiply(point2); return result; }
java
public DoublePoint Multiply(DoublePoint point1, DoublePoint point2) { DoublePoint result = new DoublePoint(point1); result.Multiply(point2); return result; }
[ "public", "DoublePoint", "Multiply", "(", "DoublePoint", "point1", ",", "DoublePoint", "point2", ")", "{", "DoublePoint", "result", "=", "new", "DoublePoint", "(", "point1", ")", ";", "result", ".", "Multiply", "(", "point2", ")", ";", "return", "result", ";...
Multiply values of two points. @param point1 DoublePoint. @param point2 DoublePoint. @return A new DoublePoint with the multiplication operation.
[ "Multiply", "values", "of", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/DoublePoint.java#L205-L209
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Point.java
Point.getAttributeAsInt
public int getAttributeAsInt(int semantics, int ordinate) { if (isEmptyImpl()) throw new GeometryException( "This operation was performed on an Empty Geometry."); int ncomps = VertexDescription.getComponentCount(semantics); if (ordinate >= ncomps) throw new IndexOutOfBoundsException(); int attributeIndex = m_description.getAttributeIndex(semantics); if (attributeIndex >= 0) return (int) m_attributes[m_description ._getPointAttributeOffset(attributeIndex) + ordinate]; else return (int) VertexDescription.getDefaultValue(semantics); }
java
public int getAttributeAsInt(int semantics, int ordinate) { if (isEmptyImpl()) throw new GeometryException( "This operation was performed on an Empty Geometry."); int ncomps = VertexDescription.getComponentCount(semantics); if (ordinate >= ncomps) throw new IndexOutOfBoundsException(); int attributeIndex = m_description.getAttributeIndex(semantics); if (attributeIndex >= 0) return (int) m_attributes[m_description ._getPointAttributeOffset(attributeIndex) + ordinate]; else return (int) VertexDescription.getDefaultValue(semantics); }
[ "public", "int", "getAttributeAsInt", "(", "int", "semantics", ",", "int", "ordinate", ")", "{", "if", "(", "isEmptyImpl", "(", ")", ")", "throw", "new", "GeometryException", "(", "\"This operation was performed on an Empty Geometry.\"", ")", ";", "int", "ncomps", ...
Returns value of the given vertex attribute's ordinate. The ordinate is always 0 because integer attributes always have one component. @param semantics The attribute semantics. @param ordinate The attribute's ordinate. For example, the y coordinate of the NORMAL has ordinate of 1. @return The ordinate value truncated to a 32 bit integer value.
[ "Returns", "value", "of", "the", "given", "vertex", "attribute", "s", "ordinate", ".", "The", "ordinate", "is", "always", "0", "because", "integer", "attributes", "always", "have", "one", "component", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Point.java#L312-L327
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java
GroupHandlerImpl.readGroup
private Group readGroup(Node groupNode) throws Exception { String groupName = groupNode.getName(); String desc = utils.readString(groupNode, GroupProperties.JOS_DESCRIPTION); String label = utils.readString(groupNode, GroupProperties.JOS_LABEL); String parentId = utils.getGroupIds(groupNode).parentId; GroupImpl group = new GroupImpl(groupName, parentId); group.setInternalId(groupNode.getUUID()); group.setDescription(desc); group.setLabel(label); return group; }
java
private Group readGroup(Node groupNode) throws Exception { String groupName = groupNode.getName(); String desc = utils.readString(groupNode, GroupProperties.JOS_DESCRIPTION); String label = utils.readString(groupNode, GroupProperties.JOS_LABEL); String parentId = utils.getGroupIds(groupNode).parentId; GroupImpl group = new GroupImpl(groupName, parentId); group.setInternalId(groupNode.getUUID()); group.setDescription(desc); group.setLabel(label); return group; }
[ "private", "Group", "readGroup", "(", "Node", "groupNode", ")", "throws", "Exception", "{", "String", "groupName", "=", "groupNode", ".", "getName", "(", ")", ";", "String", "desc", "=", "utils", ".", "readString", "(", "groupNode", ",", "GroupProperties", "...
Read group properties from node. @param groupNode the node where group properties are stored @return {@link Group} @throws OrganizationServiceException if unexpected exception is occurred during reading
[ "Read", "group", "properties", "from", "node", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L473-L486
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java
CursorManager.assignDeviceToCursor
int assignDeviceToCursor(final Cursor cursor) { int currentPriority = cursor.getCurrentDevicePriority(); IoDevice savedDevice = cursor.getSavedIoDevice(); /* * Give preference to the saved device for this cursor */ if ((savedDevice != null) && (currentPriority < 0)) { int priority = cursor.getDevicePriority(savedDevice); cursor.clearSavedIoDevice(); return attachCursorToDevice(cursor, savedDevice, 1, priority); } List<IoDevice> availableDevices = getAvailableIoDevices(); for (IoDevice d : availableDevices) { IoDevice availableIoDevice = d; int priority = cursor.getDevicePriority(availableIoDevice); Log.d(TAG, "Trying to attach available ioDevice:" + IoDeviceFactory.getXmlString(availableIoDevice) + " to cursor:" + cursor.getId()); /* * If the unused device is compatible with this cursor and * has a higher priority than the current device associated * with the cursor, use it instead of the current device. * If there is no device for this cursor, use the first available. */ if (priority > 0) { if (currentPriority < 0) { return attachCursorToDevice(cursor, availableIoDevice, 1, priority); } else if (priority < currentPriority) { return attachCursorToDevice(cursor, availableIoDevice, 0, priority); } } } return -1; }
java
int assignDeviceToCursor(final Cursor cursor) { int currentPriority = cursor.getCurrentDevicePriority(); IoDevice savedDevice = cursor.getSavedIoDevice(); /* * Give preference to the saved device for this cursor */ if ((savedDevice != null) && (currentPriority < 0)) { int priority = cursor.getDevicePriority(savedDevice); cursor.clearSavedIoDevice(); return attachCursorToDevice(cursor, savedDevice, 1, priority); } List<IoDevice> availableDevices = getAvailableIoDevices(); for (IoDevice d : availableDevices) { IoDevice availableIoDevice = d; int priority = cursor.getDevicePriority(availableIoDevice); Log.d(TAG, "Trying to attach available ioDevice:" + IoDeviceFactory.getXmlString(availableIoDevice) + " to cursor:" + cursor.getId()); /* * If the unused device is compatible with this cursor and * has a higher priority than the current device associated * with the cursor, use it instead of the current device. * If there is no device for this cursor, use the first available. */ if (priority > 0) { if (currentPriority < 0) { return attachCursorToDevice(cursor, availableIoDevice, 1, priority); } else if (priority < currentPriority) { return attachCursorToDevice(cursor, availableIoDevice, 0, priority); } } } return -1; }
[ "int", "assignDeviceToCursor", "(", "final", "Cursor", "cursor", ")", "{", "int", "currentPriority", "=", "cursor", ".", "getCurrentDevicePriority", "(", ")", ";", "IoDevice", "savedDevice", "=", "cursor", ".", "getSavedIoDevice", "(", ")", ";", "/*\n * Gi...
Assign an {@link IoDevice} to the given {@link Cursor}. If the cursor is not already attached to an IO device, the highest priority device that is compatible with the cursor is selected. Otherwise a new device will be assigned only if its priority is greater than the one already attached. @param cursor @return 1 = cursor attached to device and added to scene, 0 = device replaced on cursor, -1 = nothing was done
[ "Assign", "an", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java#L813-L853
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java
Printer.visitSymbols
public String visitSymbols(List<Symbol> ts, Locale locale) { ListBuffer<String> sbuf = new ListBuffer<>(); for (Symbol t : ts) { sbuf.append(visit(t, locale)); } return sbuf.toList().toString(); }
java
public String visitSymbols(List<Symbol> ts, Locale locale) { ListBuffer<String> sbuf = new ListBuffer<>(); for (Symbol t : ts) { sbuf.append(visit(t, locale)); } return sbuf.toList().toString(); }
[ "public", "String", "visitSymbols", "(", "List", "<", "Symbol", ">", "ts", ",", "Locale", "locale", ")", "{", "ListBuffer", "<", "String", ">", "sbuf", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Symbol", "t", ":", "ts", ")", "{", "...
* Get a localized string representation for all the symbols in the input list. @param ts symbols to be displayed @param locale the locale in which the string is to be rendered @return localized string representation
[ "*", "Get", "a", "localized", "string", "representation", "for", "all", "the", "symbols", "in", "the", "input", "list", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java#L120-L126
alibaba/canal
parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/request/AbstractRequest.java
AbstractRequest.HmacSHA1Encrypt
private byte[] HmacSHA1Encrypt(String encryptText, String encryptKey) throws Exception { byte[] data = encryptKey.getBytes(ENCODING); // 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称 SecretKey secretKey = new SecretKeySpec(data, MAC_NAME); // 生成一个指定 Mac 算法 的 Mac 对象 Mac mac = Mac.getInstance(MAC_NAME); // 用给定密钥初始化 Mac 对象 mac.init(secretKey); byte[] text = encryptText.getBytes(ENCODING); // 完成 Mac 操作 return mac.doFinal(text); }
java
private byte[] HmacSHA1Encrypt(String encryptText, String encryptKey) throws Exception { byte[] data = encryptKey.getBytes(ENCODING); // 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称 SecretKey secretKey = new SecretKeySpec(data, MAC_NAME); // 生成一个指定 Mac 算法 的 Mac 对象 Mac mac = Mac.getInstance(MAC_NAME); // 用给定密钥初始化 Mac 对象 mac.init(secretKey); byte[] text = encryptText.getBytes(ENCODING); // 完成 Mac 操作 return mac.doFinal(text); }
[ "private", "byte", "[", "]", "HmacSHA1Encrypt", "(", "String", "encryptText", ",", "String", "encryptKey", ")", "throws", "Exception", "{", "byte", "[", "]", "data", "=", "encryptKey", ".", "getBytes", "(", "ENCODING", ")", ";", "// 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的...
使用 HMAC-SHA1 签名方法对对encryptText进行签名 @param encryptText 被签名的字符串 @param encryptKey 密钥 @return @throws Exception
[ "使用", "HMAC", "-", "SHA1", "签名方法对对encryptText进行签名" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/request/AbstractRequest.java#L108-L120
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java
ArgumentWithValue.getResolvedValue
public String getResolvedValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException { final String value = getOriginalValue(parsedLine, required); return resolveValue(value, initialState); }
java
public String getResolvedValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException { final String value = getOriginalValue(parsedLine, required); return resolveValue(value, initialState); }
[ "public", "String", "getResolvedValue", "(", "ParsedCommandLine", "parsedLine", ",", "boolean", "required", ")", "throws", "CommandFormatException", "{", "final", "String", "value", "=", "getOriginalValue", "(", "parsedLine", ",", "required", ")", ";", "return", "re...
Calls getOriginalValue(ParsedCommandLine parsedLine, boolean required) and correctly handles escape sequences and resolves system properties. @param parsedLine parsed command line @param required whether the argument is required @return resolved argument value @throws CommandFormatException in case the required argument is missing
[ "Calls", "getOriginalValue", "(", "ParsedCommandLine", "parsedLine", "boolean", "required", ")", "and", "correctly", "handles", "escape", "sequences", "and", "resolves", "system", "properties", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java#L117-L120
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1Instance.java
V1Instance.clearCache
void clearCache(Entity entity, String name) { final Asset asset = getAsset(entity); IAttributeDefinition def = null; if (name != null) { def = asset.getAssetType().getAttributeDefinition(name); } asset.clearAttributeCache(def); }
java
void clearCache(Entity entity, String name) { final Asset asset = getAsset(entity); IAttributeDefinition def = null; if (name != null) { def = asset.getAssetType().getAttributeDefinition(name); } asset.clearAttributeCache(def); }
[ "void", "clearCache", "(", "Entity", "entity", ",", "String", "name", ")", "{", "final", "Asset", "asset", "=", "getAsset", "(", "entity", ")", ";", "IAttributeDefinition", "def", "=", "null", ";", "if", "(", "name", "!=", "null", ")", "{", "def", "=",...
Clear an attribute from cache of specified Entity. @param entity to clear attribute of. @param name of the attribute to clear; if null, all attributes will be cleared from cache.
[ "Clear", "an", "attribute", "from", "cache", "of", "specified", "Entity", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1Instance.java#L670-L677
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/hmap/HMap.java
HMap.singletonHMap
public static <V> HMap singletonHMap(TypeSafeKey<?, V> key, V value) { return emptyHMap().put(key, value); }
java
public static <V> HMap singletonHMap(TypeSafeKey<?, V> key, V value) { return emptyHMap().put(key, value); }
[ "public", "static", "<", "V", ">", "HMap", "singletonHMap", "(", "TypeSafeKey", "<", "?", ",", "V", ">", "key", ",", "V", "value", ")", "{", "return", "emptyHMap", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Static factory method for creating a singleton HMap. @param key the only mapped key @param value the only mapped value @param <V> the only mapped value type @return a singleton HMap
[ "Static", "factory", "method", "for", "creating", "a", "singleton", "HMap", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/hmap/HMap.java#L197-L199
facebook/SoLoader
java/com/facebook/soloader/ApplicationSoSource.java
ApplicationSoSource.checkAndMaybeUpdate
public boolean checkAndMaybeUpdate() throws IOException { try { File nativeLibDir = soSource.soDirectory; Context updatedContext = applicationContext.createPackageContext(applicationContext.getPackageName(), 0); File updatedNativeLibDir = new File(updatedContext.getApplicationInfo().nativeLibraryDir); if (!nativeLibDir.equals(updatedNativeLibDir)) { Log.d( SoLoader.TAG, "Native library directory updated from " + nativeLibDir + " to " + updatedNativeLibDir); // update flags to resolve dependencies since the system does not properly resolve // dependencies when the location has moved flags |= DirectorySoSource.RESOLVE_DEPENDENCIES; soSource = new DirectorySoSource(updatedNativeLibDir, flags); soSource.prepare(flags); applicationContext = updatedContext; return true; } return false; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } }
java
public boolean checkAndMaybeUpdate() throws IOException { try { File nativeLibDir = soSource.soDirectory; Context updatedContext = applicationContext.createPackageContext(applicationContext.getPackageName(), 0); File updatedNativeLibDir = new File(updatedContext.getApplicationInfo().nativeLibraryDir); if (!nativeLibDir.equals(updatedNativeLibDir)) { Log.d( SoLoader.TAG, "Native library directory updated from " + nativeLibDir + " to " + updatedNativeLibDir); // update flags to resolve dependencies since the system does not properly resolve // dependencies when the location has moved flags |= DirectorySoSource.RESOLVE_DEPENDENCIES; soSource = new DirectorySoSource(updatedNativeLibDir, flags); soSource.prepare(flags); applicationContext = updatedContext; return true; } return false; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } }
[ "public", "boolean", "checkAndMaybeUpdate", "(", ")", "throws", "IOException", "{", "try", "{", "File", "nativeLibDir", "=", "soSource", ".", "soDirectory", ";", "Context", "updatedContext", "=", "applicationContext", ".", "createPackageContext", "(", "applicationCont...
check to make sure there haven't been any changes to the nativeLibraryDir since the last check, if there have been changes, update the context and soSource @return true if the nativeLibraryDir was updated
[ "check", "to", "make", "sure", "there", "haven", "t", "been", "any", "changes", "to", "the", "nativeLibraryDir", "since", "the", "last", "check", "if", "there", "have", "been", "changes", "update", "the", "context", "and", "soSource" ]
train
https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/ApplicationSoSource.java#L54-L76
operasoftware/operaprestodriver
src/com/opera/core/systems/runner/launcher/OperaLauncherRunner.java
OperaLauncherRunner.captureScreen
public ScreenCaptureReply captureScreen(long timeout, List<String> knownMD5s) throws OperaRunnerException { assertLauncherAlive(); String resultMd5; byte[] resultBytes; boolean blank = false; try { LauncherScreenshotRequest.Builder request = LauncherScreenshotRequest.newBuilder(); request.addAllKnownMD5S(knownMD5s); request.setKnownMD5STimeoutMs((int) timeout); ResponseEncapsulation res = protocol.sendRequest( MessageType.MSG_SCREENSHOT, request.build().toByteArray()); LauncherScreenshotResponse response = (LauncherScreenshotResponse) res.getResponse(); resultMd5 = response.getMd5(); resultBytes = response.getImagedata().toByteArray(); if (response.hasBlank()) { blank = response.getBlank(); } } catch (SocketTimeoutException e) { throw new OperaRunnerException("Could not get screenshot from launcher", e); } catch (IOException e) { throw new OperaRunnerException("Could not get screenshot from launcher", e); } ScreenCaptureReply.Builder builder = ScreenCaptureReply.builder(); builder.setMD5(resultMd5); builder.setPNG(resultBytes); builder.setBlank(blank); builder.setCrashed(this.hasOperaCrashed()); return builder.build(); }
java
public ScreenCaptureReply captureScreen(long timeout, List<String> knownMD5s) throws OperaRunnerException { assertLauncherAlive(); String resultMd5; byte[] resultBytes; boolean blank = false; try { LauncherScreenshotRequest.Builder request = LauncherScreenshotRequest.newBuilder(); request.addAllKnownMD5S(knownMD5s); request.setKnownMD5STimeoutMs((int) timeout); ResponseEncapsulation res = protocol.sendRequest( MessageType.MSG_SCREENSHOT, request.build().toByteArray()); LauncherScreenshotResponse response = (LauncherScreenshotResponse) res.getResponse(); resultMd5 = response.getMd5(); resultBytes = response.getImagedata().toByteArray(); if (response.hasBlank()) { blank = response.getBlank(); } } catch (SocketTimeoutException e) { throw new OperaRunnerException("Could not get screenshot from launcher", e); } catch (IOException e) { throw new OperaRunnerException("Could not get screenshot from launcher", e); } ScreenCaptureReply.Builder builder = ScreenCaptureReply.builder(); builder.setMD5(resultMd5); builder.setPNG(resultBytes); builder.setBlank(blank); builder.setCrashed(this.hasOperaCrashed()); return builder.build(); }
[ "public", "ScreenCaptureReply", "captureScreen", "(", "long", "timeout", ",", "List", "<", "String", ">", "knownMD5s", ")", "throws", "OperaRunnerException", "{", "assertLauncherAlive", "(", ")", ";", "String", "resultMd5", ";", "byte", "[", "]", "resultBytes", ...
Take screenshot using external program. Will not trigger a screen repaint. @throws OperaRunnerException if runner is shutdown or not running @inheritDoc
[ "Take", "screenshot", "using", "external", "program", ".", "Will", "not", "trigger", "a", "screen", "repaint", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/runner/launcher/OperaLauncherRunner.java#L354-L389
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetListBoxWidget.java
FacetListBoxWidget.ifEmptyUseDefault
private String ifEmptyUseDefault(String firstValue, String defaultValue) { return StringUtils.ifEmpty(firstValue, defaultValue); }
java
private String ifEmptyUseDefault(String firstValue, String defaultValue) { return StringUtils.ifEmpty(firstValue, defaultValue); }
[ "private", "String", "ifEmptyUseDefault", "(", "String", "firstValue", ",", "String", "defaultValue", ")", "{", "return", "StringUtils", ".", "ifEmpty", "(", "firstValue", ",", "defaultValue", ")", ";", "}" ]
/*public FacetListBoxWidget(String facetField, String facetTitle, String facetLabel, int visibleIntColumn) { this(facetField,facetTitle,facetLabel); this.listBox.setVisibleItemCount(visibleIntColumn); }
[ "/", "*", "public", "FacetListBoxWidget", "(", "String", "facetField", "String", "facetTitle", "String", "facetLabel", "int", "visibleIntColumn", ")", "{", "this", "(", "facetField", "facetTitle", "facetLabel", ")", ";", "this", ".", "listBox", ".", "setVisibleIte...
train
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetListBoxWidget.java#L112-L114
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.read
public FileStorageInfoInner read(String groupName, String serviceName, String projectName, String fileName) { return readWithServiceResponseAsync(groupName, serviceName, projectName, fileName).toBlocking().single().body(); }
java
public FileStorageInfoInner read(String groupName, String serviceName, String projectName, String fileName) { return readWithServiceResponseAsync(groupName, serviceName, projectName, fileName).toBlocking().single().body(); }
[ "public", "FileStorageInfoInner", "read", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ")", "{", "return", "readWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ",", "projectName", ...
Request storage information for downloading the file content. This method is used for requesting storage information using which contents of the file can be downloaded. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the FileStorageInfoInner object if successful.
[ "Request", "storage", "information", "for", "downloading", "the", "file", "content", ".", "This", "method", "is", "used", "for", "requesting", "storage", "information", "using", "which", "contents", "of", "the", "file", "can", "be", "downloaded", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L682-L684
Azure/azure-sdk-for-java
applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java
EventsImpl.getByTypeAsync
public Observable<EventsResults> getByTypeAsync(String appId, EventType eventType, String timespan, String filter, String search, String orderby, String select, Integer skip, Integer top, String format, Boolean count, String apply) { return getByTypeWithServiceResponseAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() { @Override public EventsResults call(ServiceResponse<EventsResults> response) { return response.body(); } }); }
java
public Observable<EventsResults> getByTypeAsync(String appId, EventType eventType, String timespan, String filter, String search, String orderby, String select, Integer skip, Integer top, String format, Boolean count, String apply) { return getByTypeWithServiceResponseAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() { @Override public EventsResults call(ServiceResponse<EventsResults> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventsResults", ">", "getByTypeAsync", "(", "String", "appId", ",", "EventType", "eventType", ",", "String", "timespan", ",", "String", "filter", ",", "String", "search", ",", "String", "orderby", ",", "String", "select", ",", "In...
Execute OData query. Executes an OData query for events. @param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal. @param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics' @param timespan Optional. The timespan over which to retrieve events. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the Odata expression. @param filter An expression used to filter the returned events @param search A free-text search expression to match for whether a particular event should be returned @param orderby A comma-separated list of properties with \"asc\" (the default) or \"desc\" to control the order of returned events @param select Limits the properties to just those requested on each returned event @param skip The number of items to skip over before returning events @param top The number of events to return @param format Format for the returned events @param count Request a count of matching items included with the returned events @param apply An expression used for aggregation over returned events @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventsResults object
[ "Execute", "OData", "query", ".", "Executes", "an", "OData", "query", "for", "events", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java#L222-L229
spring-projects/spring-flex
spring-flex-core/src/main/java/org/springframework/flex/core/io/SpringPropertyProxy.java
SpringPropertyProxy.setValue
@Override public void setValue(Object instance, String propertyName, Object value) { if (!isWriteIgnored(instance, propertyName)) { PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance).setPropertyValue(propertyName, value); } }
java
@Override public void setValue(Object instance, String propertyName, Object value) { if (!isWriteIgnored(instance, propertyName)) { PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance).setPropertyValue(propertyName, value); } }
[ "@", "Override", "public", "void", "setValue", "(", "Object", "instance", ",", "String", "propertyName", ",", "Object", "value", ")", "{", "if", "(", "!", "isWriteIgnored", "(", "instance", ",", "propertyName", ")", ")", "{", "PropertyProxyUtils", ".", "getP...
{@inheritDoc} Delegates to the configured {@link ConversionService} to potentially convert the value to the actual type of the property.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/spring-projects/spring-flex/blob/85f2bff300d74e2d77d565f97a09d12d18e19adc/spring-flex-core/src/main/java/org/springframework/flex/core/io/SpringPropertyProxy.java#L180-L185
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.zip
public static Map zip(Iterator keys, Iterator values, boolean includeNull) { HashMap hm = new HashMap(); while (keys.hasNext() && values.hasNext()) { Object o = keys.next(); Object p = values.next(); if (includeNull || o != null && p != null) { hm.put(o, p); } } return hm; }
java
public static Map zip(Iterator keys, Iterator values, boolean includeNull) { HashMap hm = new HashMap(); while (keys.hasNext() && values.hasNext()) { Object o = keys.next(); Object p = values.next(); if (includeNull || o != null && p != null) { hm.put(o, p); } } return hm; }
[ "public", "static", "Map", "zip", "(", "Iterator", "keys", ",", "Iterator", "values", ",", "boolean", "includeNull", ")", "{", "HashMap", "hm", "=", "new", "HashMap", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", "&&", "values", ".", ...
Creates a map where the object at index N from the first Iterator is the key for the object at index N of the second Iterator. If either Iterator is shorter than the other, the resulting Map will have only as many keys as are in the smallest of the two Iterator. <br> If includeNull is true, both keys and values of null are allowed. Note that if more than one key is null, previous entries will be overwritten. @param keys Iterator of keys @param values Iterator of values @param includeNull allow null values and keys @return map
[ "Creates", "a", "map", "where", "the", "object", "at", "index", "N", "from", "the", "first", "Iterator", "is", "the", "key", "for", "the", "object", "at", "index", "N", "of", "the", "second", "Iterator", ".", "If", "either", "Iterator", "is", "shorter", ...
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L246-L256
tobykurien/Xtendroid
Xtendroid/src/asia/sonix/android/orm/AbatisService.java
AbatisService.executeForMap
public Map<String, Object> executeForMap(int sqlId, Map<String, ? extends Object> bindParams) { String sql = context.getResources().getString(sqlId); return executeForMap(sql, bindParams); }
java
public Map<String, Object> executeForMap(int sqlId, Map<String, ? extends Object> bindParams) { String sql = context.getResources().getString(sqlId); return executeForMap(sql, bindParams); }
[ "public", "Map", "<", "String", ",", "Object", ">", "executeForMap", "(", "int", "sqlId", ",", "Map", "<", "String", ",", "?", "extends", "Object", ">", "bindParams", ")", "{", "String", "sql", "=", "context", ".", "getResources", "(", ")", ".", "getSt...
指定したSQLIDにparameterをmappingして、クエリする。結果mapを返却。 <p> mappingの時、parameterが足りない場合はnullを返す。 また、結果がない場合nullを返す。 </p> @param sqlId SQLID @param bindParams sql parameter @return Map<String, Object> result
[ "指定したSQLIDにparameterをmappingして、クエリする。結果mapを返却。" ]
train
https://github.com/tobykurien/Xtendroid/blob/758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4/Xtendroid/src/asia/sonix/android/orm/AbatisService.java#L194-L197
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forMethodParameter
public static ResolvableType forMethodParameter(Method method, int parameterIndex) { LettuceAssert.notNull(method, "Method must not be null"); return forMethodParameter(new MethodParameter(method, parameterIndex)); }
java
public static ResolvableType forMethodParameter(Method method, int parameterIndex) { LettuceAssert.notNull(method, "Method must not be null"); return forMethodParameter(new MethodParameter(method, parameterIndex)); }
[ "public", "static", "ResolvableType", "forMethodParameter", "(", "Method", "method", ",", "int", "parameterIndex", ")", "{", "LettuceAssert", ".", "notNull", "(", "method", ",", "\"Method must not be null\"", ")", ";", "return", "forMethodParameter", "(", "new", "Me...
Return a {@link ResolvableType} for the specified {@link Method} parameter. @param method the source method (must not be {@code null}) @param parameterIndex the parameter index @return a {@link ResolvableType} for the specified method parameter @see #forMethodParameter(Method, int, Class) @see #forMethodParameter(MethodParameter)
[ "Return", "a", "{", "@link", "ResolvableType", "}", "for", "the", "specified", "{", "@link", "Method", "}", "parameter", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L949-L952
awltech/org.parallelj
parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launcher.java
Launcher.newLaunch
public synchronized Launch newLaunch(final Class<?> jobClass, ExecutorService executorService) throws LaunchException { return new Launch(jobClass, executorService); }
java
public synchronized Launch newLaunch(final Class<?> jobClass, ExecutorService executorService) throws LaunchException { return new Launch(jobClass, executorService); }
[ "public", "synchronized", "Launch", "newLaunch", "(", "final", "Class", "<", "?", ">", "jobClass", ",", "ExecutorService", "executorService", ")", "throws", "LaunchException", "{", "return", "new", "Launch", "(", "jobClass", ",", "executorService", ")", ";", "}"...
Create a new instance of Launch. @param jobClass The Program Adapter class. @param executorService The ExecutorService instance to use. @return An instance of Launch. @throws LaunchException
[ "Create", "a", "new", "instance", "of", "Launch", "." ]
train
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launcher.java#L82-L84
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario2DPortrayal.java
Scenario2DPortrayal.situateDevice
public void situateDevice(Device d, double x, double y) { devices.setObjectLocation(d, new Double2D(x, y)); }
java
public void situateDevice(Device d, double x, double y) { devices.setObjectLocation(d, new Double2D(x, y)); }
[ "public", "void", "situateDevice", "(", "Device", "d", ",", "double", "x", ",", "double", "y", ")", "{", "devices", ".", "setObjectLocation", "(", "d", ",", "new", "Double2D", "(", "x", ",", "y", ")", ")", ";", "}" ]
To place a device in the simulation @param d @param x @param y
[ "To", "place", "a", "device", "in", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario2DPortrayal.java#L181-L183
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/resources/uac/RoleResource1.java
RoleResource1.updateRole
@PUT @Path("{group}/{id}") @Consumes(MediaType.APPLICATION_JSON) public SuccessResponse updateRole(@PathParam("group") String group, @PathParam("id") String id, EmoRole role, final @Authenticated Subject subject) { checkArgument(role.getId().equals(new EmoRoleKey(group, id)), "Body contains conflicting role identifier"); return updateRoleFromUpdateRequest(group, id, new UpdateEmoRoleRequest() .setName(role.getName()) .setDescription(role.getDescription()) .setGrantedPermissions(role.getPermissions()) .setRevokeOtherPermissions(true), subject); }
java
@PUT @Path("{group}/{id}") @Consumes(MediaType.APPLICATION_JSON) public SuccessResponse updateRole(@PathParam("group") String group, @PathParam("id") String id, EmoRole role, final @Authenticated Subject subject) { checkArgument(role.getId().equals(new EmoRoleKey(group, id)), "Body contains conflicting role identifier"); return updateRoleFromUpdateRequest(group, id, new UpdateEmoRoleRequest() .setName(role.getName()) .setDescription(role.getDescription()) .setGrantedPermissions(role.getPermissions()) .setRevokeOtherPermissions(true), subject); }
[ "@", "PUT", "@", "Path", "(", "\"{group}/{id}\"", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "SuccessResponse", "updateRole", "(", "@", "PathParam", "(", "\"group\"", ")", "String", "group", ",", "@", "PathParam", "(", "\...
RESTful endpoint for updating a role. Note that all attributes of the role will be updated to match the provided object.
[ "RESTful", "endpoint", "for", "updating", "a", "role", ".", "Note", "that", "all", "attributes", "of", "the", "role", "will", "be", "updated", "to", "match", "the", "provided", "object", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/resources/uac/RoleResource1.java#L116-L131
treelogic-swe/aws-mock
example/java/full/client-usage/DescribeImagesExample.java
DescribeImagesExample.describeAllImages
public static List<Image> describeAllImages() { // pass any credentials as aws-mock does not authenticate them at all AWSCredentials credentials = new BasicAWSCredentials("foo", "bar"); AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials); // the mock endpoint for ec2 which runs on your computer String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/"; amazonEC2Client.setEndpoint(ec2Endpoint); // describe all AMIs in aws-mock. DescribeImagesResult result = amazonEC2Client.describeImages(); return result.getImages(); }
java
public static List<Image> describeAllImages() { // pass any credentials as aws-mock does not authenticate them at all AWSCredentials credentials = new BasicAWSCredentials("foo", "bar"); AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials); // the mock endpoint for ec2 which runs on your computer String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/"; amazonEC2Client.setEndpoint(ec2Endpoint); // describe all AMIs in aws-mock. DescribeImagesResult result = amazonEC2Client.describeImages(); return result.getImages(); }
[ "public", "static", "List", "<", "Image", ">", "describeAllImages", "(", ")", "{", "// pass any credentials as aws-mock does not authenticate them at all", "AWSCredentials", "credentials", "=", "new", "BasicAWSCredentials", "(", "\"foo\"", ",", "\"bar\"", ")", ";", "Amazo...
Describe all available AMIs within aws-mock. @return a list of AMIs
[ "Describe", "all", "available", "AMIs", "within", "aws", "-", "mock", "." ]
train
https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/example/java/full/client-usage/DescribeImagesExample.java#L30-L43
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/zip/ZipExtensions.java
ZipExtensions.extractZipEntry
public static void extractZipEntry(final ZipFile zipFile, final ZipEntry target, final File toDirectory) throws IOException { final File fileToExtract = new File(toDirectory, target.getName()); new File(fileToExtract.getParent()).mkdirs(); try (InputStream is = zipFile.getInputStream(target); BufferedInputStream bis = new BufferedInputStream(is); FileOutputStream fos = new FileOutputStream(fileToExtract); BufferedOutputStream bos = new BufferedOutputStream(fos)) { for (int c; (c = bis.read()) != -1;) { bos.write((byte)c); } bos.flush(); } catch (final IOException e) { throw e; } }
java
public static void extractZipEntry(final ZipFile zipFile, final ZipEntry target, final File toDirectory) throws IOException { final File fileToExtract = new File(toDirectory, target.getName()); new File(fileToExtract.getParent()).mkdirs(); try (InputStream is = zipFile.getInputStream(target); BufferedInputStream bis = new BufferedInputStream(is); FileOutputStream fos = new FileOutputStream(fileToExtract); BufferedOutputStream bos = new BufferedOutputStream(fos)) { for (int c; (c = bis.read()) != -1;) { bos.write((byte)c); } bos.flush(); } catch (final IOException e) { throw e; } }
[ "public", "static", "void", "extractZipEntry", "(", "final", "ZipFile", "zipFile", ",", "final", "ZipEntry", "target", ",", "final", "File", "toDirectory", ")", "throws", "IOException", "{", "final", "File", "fileToExtract", "=", "new", "File", "(", "toDirectory...
Extract zip entry. @param zipFile the zip file @param target the target @param toDirectory the to directory @throws IOException Signals that an I/O exception has occurred.
[ "Extract", "zip", "entry", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/ZipExtensions.java#L94-L115
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.dropWhile
@NotNull public LongStream dropWhile(@NotNull final LongPredicate predicate) { return new LongStream(params, new LongDropWhile(iterator, predicate)); }
java
@NotNull public LongStream dropWhile(@NotNull final LongPredicate predicate) { return new LongStream(params, new LongDropWhile(iterator, predicate)); }
[ "@", "NotNull", "public", "LongStream", "dropWhile", "(", "@", "NotNull", "final", "LongPredicate", "predicate", ")", "{", "return", "new", "LongStream", "(", "params", ",", "new", "LongDropWhile", "(", "iterator", ",", "predicate", ")", ")", ";", "}" ]
Drops elements while the predicate is true and returns the rest. <p>This is an intermediate operation. <p>Example: <pre> predicate: (a) -&gt; a &lt; 3 stream: [1, 2, 3, 4, 1, 2, 3, 4] result: [3, 4, 1, 2, 3, 4] </pre> @param predicate the predicate used to drop elements @return the new {@code LongStream}
[ "Drops", "elements", "while", "the", "predicate", "is", "true", "and", "returns", "the", "rest", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L775-L778
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/stats/ErrorStatsManager.java
ErrorStatsManager.putStats
public void putStats(String route, String cause) { if (route == null) route = "UNKNOWN_ROUTE"; route = route.replace("/", "_"); ConcurrentHashMap<String, ErrorStatsData> statsMap = routeMap.get(route); if (statsMap == null) { statsMap = new ConcurrentHashMap<String, ErrorStatsData>(); routeMap.putIfAbsent(route, statsMap); } ErrorStatsData sd = statsMap.get(cause); if (sd == null) { sd = new ErrorStatsData(route, cause); ErrorStatsData sd1 = statsMap.putIfAbsent(cause, sd); if (sd1 != null) { sd = sd1; } else { MonitorRegistry.getInstance().registerObject(sd); } } sd.update(); }
java
public void putStats(String route, String cause) { if (route == null) route = "UNKNOWN_ROUTE"; route = route.replace("/", "_"); ConcurrentHashMap<String, ErrorStatsData> statsMap = routeMap.get(route); if (statsMap == null) { statsMap = new ConcurrentHashMap<String, ErrorStatsData>(); routeMap.putIfAbsent(route, statsMap); } ErrorStatsData sd = statsMap.get(cause); if (sd == null) { sd = new ErrorStatsData(route, cause); ErrorStatsData sd1 = statsMap.putIfAbsent(cause, sd); if (sd1 != null) { sd = sd1; } else { MonitorRegistry.getInstance().registerObject(sd); } } sd.update(); }
[ "public", "void", "putStats", "(", "String", "route", ",", "String", "cause", ")", "{", "if", "(", "route", "==", "null", ")", "route", "=", "\"UNKNOWN_ROUTE\"", ";", "route", "=", "route", ".", "replace", "(", "\"/\"", ",", "\"_\"", ")", ";", "Concurr...
updates count for the given route and error cause @param route @param cause
[ "updates", "count", "for", "the", "given", "route", "and", "error", "cause" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/stats/ErrorStatsManager.java#L65-L84
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.loadVar
public static InsnList loadVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ALOAD, variable.getIndex())); // If required, do it outside this method // ret.add(new TypeInsnNode(Opcodes.CHECKCAST, variable.getType().getInternalName())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
java
public static InsnList loadVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ALOAD, variable.getIndex())); // If required, do it outside this method // ret.add(new TypeInsnNode(Opcodes.CHECKCAST, variable.getType().getInternalName())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
[ "public", "static", "InsnList", "loadVar", "(", "Variable", "variable", ")", "{", "Validate", ".", "notNull", "(", "variable", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "switch", "(", "variable", ".", "getType", "(", ")", ".", ...
Copies a local variable on to the stack. @param variable variable within the local variable table to load from @return instructions to load a local variable on to the stack @throws NullPointerException if any argument is {@code null} @throws IllegalArgumentException if {@code variable} has been released
[ "Copies", "a", "local", "variable", "on", "to", "the", "stack", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L388-L421
google/closure-templates
java/src/com/google/template/soy/jbcsrc/internal/ClassData.java
ClassData.checkClass
public void checkClass() { ClassNode cv = new ClassNode(); new ClassReader(data).accept(new CheckClassAdapter(cv, true /* check data flow */), 0); // double check our fields while we are here. checkState(type.internalName().equals(cv.name)); checkState(numberOfFields == cv.fields.size()); }
java
public void checkClass() { ClassNode cv = new ClassNode(); new ClassReader(data).accept(new CheckClassAdapter(cv, true /* check data flow */), 0); // double check our fields while we are here. checkState(type.internalName().equals(cv.name)); checkState(numberOfFields == cv.fields.size()); }
[ "public", "void", "checkClass", "(", ")", "{", "ClassNode", "cv", "=", "new", "ClassNode", "(", ")", ";", "new", "ClassReader", "(", "data", ")", ".", "accept", "(", "new", "CheckClassAdapter", "(", "cv", ",", "true", "/* check data flow */", ")", ",", "...
Runs the {@link CheckClassAdapter} on this class in basic analysis mode. <p>Basic anaylsis mode can flag verification errors that don't depend on knowing complete type information for the classes and methods being called. This is useful for flagging simple generation mistakes (e.g. stack underflows, method return type mismatches, accessing invalid locals). Additionally, the error messages are more useful than what the java verifier normally presents.
[ "Runs", "the", "{", "@link", "CheckClassAdapter", "}", "on", "this", "class", "in", "basic", "analysis", "mode", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/ClassData.java#L87-L93
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java
DiscordApiImpl.removeObjectListeners
public void removeObjectListeners(Class<?> objectClass, long objectId) { if (objectClass == null) { return; } synchronized (objectListeners) { Map<Long, Map<Class<? extends ObjectAttachableListener>, Map<ObjectAttachableListener, ListenerManagerImpl<? extends ObjectAttachableListener>>>> objects = objectListeners.get(objectClass); if (objects == null) { return; } // Remove all listeners objects.computeIfPresent(objectId, (id, listeners) -> { listeners.values().stream() .flatMap(map -> map.values().stream()) .forEach(ListenerManagerImpl::removed); listeners.clear(); return null; }); // Cleanup if (objects.isEmpty()) { objectListeners.remove(objectClass); } } }
java
public void removeObjectListeners(Class<?> objectClass, long objectId) { if (objectClass == null) { return; } synchronized (objectListeners) { Map<Long, Map<Class<? extends ObjectAttachableListener>, Map<ObjectAttachableListener, ListenerManagerImpl<? extends ObjectAttachableListener>>>> objects = objectListeners.get(objectClass); if (objects == null) { return; } // Remove all listeners objects.computeIfPresent(objectId, (id, listeners) -> { listeners.values().stream() .flatMap(map -> map.values().stream()) .forEach(ListenerManagerImpl::removed); listeners.clear(); return null; }); // Cleanup if (objects.isEmpty()) { objectListeners.remove(objectClass); } } }
[ "public", "void", "removeObjectListeners", "(", "Class", "<", "?", ">", "objectClass", ",", "long", "objectId", ")", "{", "if", "(", "objectClass", "==", "null", ")", "{", "return", ";", "}", "synchronized", "(", "objectListeners", ")", "{", "Map", "<", ...
Remove all listeners attached to an object. @param objectClass The class of the object. @param objectId The id of the object.
[ "Remove", "all", "listeners", "attached", "to", "an", "object", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L975-L999
aws/aws-sdk-java
aws-java-sdk-guardduty/src/main/java/com/amazonaws/services/guardduty/model/FindingCriteria.java
FindingCriteria.withCriterion
public FindingCriteria withCriterion(java.util.Map<String, Condition> criterion) { setCriterion(criterion); return this; }
java
public FindingCriteria withCriterion(java.util.Map<String, Condition> criterion) { setCriterion(criterion); return this; }
[ "public", "FindingCriteria", "withCriterion", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Condition", ">", "criterion", ")", "{", "setCriterion", "(", "criterion", ")", ";", "return", "this", ";", "}" ]
Represents a map of finding properties that match specified conditions and values when querying findings. @param criterion Represents a map of finding properties that match specified conditions and values when querying findings. @return Returns a reference to this object so that method calls can be chained together.
[ "Represents", "a", "map", "of", "finding", "properties", "that", "match", "specified", "conditions", "and", "values", "when", "querying", "findings", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-guardduty/src/main/java/com/amazonaws/services/guardduty/model/FindingCriteria.java#L61-L64
mockito/mockito
src/main/java/org/mockito/internal/util/reflection/GenericTypeExtractor.java
GenericTypeExtractor.findGenericInterface
private static Type findGenericInterface(Class<?> sourceClass, Class<?> targetBaseInterface) { for (int i = 0; i < sourceClass.getInterfaces().length; i++) { Class<?> inter = sourceClass.getInterfaces()[i]; if (inter == targetBaseInterface) { return sourceClass.getGenericInterfaces()[0]; } else { Type deeper = findGenericInterface(inter, targetBaseInterface); if (deeper != null) { return deeper; } } } return null; }
java
private static Type findGenericInterface(Class<?> sourceClass, Class<?> targetBaseInterface) { for (int i = 0; i < sourceClass.getInterfaces().length; i++) { Class<?> inter = sourceClass.getInterfaces()[i]; if (inter == targetBaseInterface) { return sourceClass.getGenericInterfaces()[0]; } else { Type deeper = findGenericInterface(inter, targetBaseInterface); if (deeper != null) { return deeper; } } } return null; }
[ "private", "static", "Type", "findGenericInterface", "(", "Class", "<", "?", ">", "sourceClass", ",", "Class", "<", "?", ">", "targetBaseInterface", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sourceClass", ".", "getInterfaces", "(", ")",...
Finds generic interface implementation based on the source class and the target interface. Returns null if not found. Recurses the interface hierarchy.
[ "Finds", "generic", "interface", "implementation", "based", "on", "the", "source", "class", "and", "the", "target", "interface", ".", "Returns", "null", "if", "not", "found", ".", "Recurses", "the", "interface", "hierarchy", "." ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/util/reflection/GenericTypeExtractor.java#L60-L73
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java
OrientationHistogramSift.computeWeight
double computeWeight( double deltaX , double deltaY , double sigma ) { // the exact equation // return Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma))); // approximation below. when validating this approach it produced results that were within // floating point tolerance of the exact solution, but much faster double d = ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma))/approximateStep; if( approximateGauss.interpolate(d) ) { return approximateGauss.value; } else return 0; }
java
double computeWeight( double deltaX , double deltaY , double sigma ) { // the exact equation // return Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma))); // approximation below. when validating this approach it produced results that were within // floating point tolerance of the exact solution, but much faster double d = ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma))/approximateStep; if( approximateGauss.interpolate(d) ) { return approximateGauss.value; } else return 0; }
[ "double", "computeWeight", "(", "double", "deltaX", ",", "double", "deltaY", ",", "double", "sigma", ")", "{", "// the exact equation", "//\t\treturn Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma)));", "// approximation below. when validating this approach it p...
Computes the weight based on a centered Gaussian shaped function. Interpolation is used to speed up the process
[ "Computes", "the", "weight", "based", "on", "a", "centered", "Gaussian", "shaped", "function", ".", "Interpolation", "is", "used", "to", "speed", "up", "the", "process" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L298-L309
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/MBlockPos.java
MBlockPos.getAllInBox
public static Iterable<MBlockPos> getAllInBox(MBlockPos from, MBlockPos to) { return new BlockIterator(from, to).asIterable(); }
java
public static Iterable<MBlockPos> getAllInBox(MBlockPos from, MBlockPos to) { return new BlockIterator(from, to).asIterable(); }
[ "public", "static", "Iterable", "<", "MBlockPos", ">", "getAllInBox", "(", "MBlockPos", "from", ",", "MBlockPos", "to", ")", "{", "return", "new", "BlockIterator", "(", "from", ",", "to", ")", ".", "asIterable", "(", ")", ";", "}" ]
Create an {@link Iterable} that returns all positions in the box specified by the given corners. @param from the first corner @param to the second corner @return the iterable
[ "Create", "an", "{", "@link", "Iterable", "}", "that", "returns", "all", "positions", "in", "the", "box", "specified", "by", "the", "given", "corners", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/MBlockPos.java#L334-L337
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.del
public static boolean del(Path path) throws IORuntimeException { if (Files.notExists(path)) { return true; } try { if (Files.isDirectory(path)) { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { Files.delete(dir); return FileVisitResult.CONTINUE; } else { throw e; } } }); } else { Files.delete(path); } } catch (IOException e) { throw new IORuntimeException(e); } return true; }
java
public static boolean del(Path path) throws IORuntimeException { if (Files.notExists(path)) { return true; } try { if (Files.isDirectory(path)) { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { Files.delete(dir); return FileVisitResult.CONTINUE; } else { throw e; } } }); } else { Files.delete(path); } } catch (IOException e) { throw new IORuntimeException(e); } return true; }
[ "public", "static", "boolean", "del", "(", "Path", "path", ")", "throws", "IORuntimeException", "{", "if", "(", "Files", ".", "notExists", "(", "path", ")", ")", "{", "return", "true", ";", "}", "try", "{", "if", "(", "Files", ".", "isDirectory", "(", ...
删除文件或者文件夹<br> 注意:删除文件夹时不会判断文件夹是否为空,如果不空则递归删除子文件或文件夹<br> 某个文件删除失败会终止删除操作 @param path 文件对象 @return 成功与否 @throws IORuntimeException IO异常 @since 4.4.2
[ "删除文件或者文件夹<br", ">", "注意:删除文件夹时不会判断文件夹是否为空,如果不空则递归删除子文件或文件夹<br", ">", "某个文件删除失败会终止删除操作" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L728-L760
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java
Trash.purgeTrashSnapshots
public void purgeTrashSnapshots() throws IOException { List<FileStatus> snapshotsInTrash = Arrays.asList(this.fs.listStatus(this.trashLocation, TRASH_SNAPSHOT_PATH_FILTER)); Collections.sort(snapshotsInTrash, new Comparator<FileStatus>() { @Override public int compare(FileStatus o1, FileStatus o2) { return TRASH_SNAPSHOT_NAME_FORMATTER.parseDateTime(o1.getPath().getName()) .compareTo(TRASH_SNAPSHOT_NAME_FORMATTER.parseDateTime(o2.getPath().getName())); } }); int totalSnapshots = snapshotsInTrash.size(); int snapshotsDeleted = 0; for (FileStatus snapshot : snapshotsInTrash) { if (this.snapshotCleanupPolicy.shouldDeleteSnapshot(snapshot, this)) { try { boolean successfullyDeleted = this.fs.delete(snapshot.getPath(), true); if (successfullyDeleted) { snapshotsDeleted++; } else { LOG.error("Failed to delete snapshot " + snapshot.getPath()); } } catch (IOException exception) { LOG.error("Failed to delete snapshot " + snapshot.getPath(), exception); } } } LOG.info(String.format("Deleted %d out of %d existing snapshots.", snapshotsDeleted, totalSnapshots)); }
java
public void purgeTrashSnapshots() throws IOException { List<FileStatus> snapshotsInTrash = Arrays.asList(this.fs.listStatus(this.trashLocation, TRASH_SNAPSHOT_PATH_FILTER)); Collections.sort(snapshotsInTrash, new Comparator<FileStatus>() { @Override public int compare(FileStatus o1, FileStatus o2) { return TRASH_SNAPSHOT_NAME_FORMATTER.parseDateTime(o1.getPath().getName()) .compareTo(TRASH_SNAPSHOT_NAME_FORMATTER.parseDateTime(o2.getPath().getName())); } }); int totalSnapshots = snapshotsInTrash.size(); int snapshotsDeleted = 0; for (FileStatus snapshot : snapshotsInTrash) { if (this.snapshotCleanupPolicy.shouldDeleteSnapshot(snapshot, this)) { try { boolean successfullyDeleted = this.fs.delete(snapshot.getPath(), true); if (successfullyDeleted) { snapshotsDeleted++; } else { LOG.error("Failed to delete snapshot " + snapshot.getPath()); } } catch (IOException exception) { LOG.error("Failed to delete snapshot " + snapshot.getPath(), exception); } } } LOG.info(String.format("Deleted %d out of %d existing snapshots.", snapshotsDeleted, totalSnapshots)); }
[ "public", "void", "purgeTrashSnapshots", "(", ")", "throws", "IOException", "{", "List", "<", "FileStatus", ">", "snapshotsInTrash", "=", "Arrays", ".", "asList", "(", "this", ".", "fs", ".", "listStatus", "(", "this", ".", "trashLocation", ",", "TRASH_SNAPSHO...
For each existing trash snapshot, uses a {@link org.apache.gobblin.data.management.trash.SnapshotCleanupPolicy} to determine whether the snapshot should be deleted. If so, delete it permanently. <p> Each existing snapshot will be passed to {@link org.apache.gobblin.data.management.trash.SnapshotCleanupPolicy#shouldDeleteSnapshot} from oldest to newest, and will be deleted if the method returns true. </p> @throws IOException
[ "For", "each", "existing", "trash", "snapshot", "uses", "a", "{", "@link", "org", ".", "apache", ".", "gobblin", ".", "data", ".", "management", ".", "trash", ".", "SnapshotCleanupPolicy", "}", "to", "determine", "whether", "the", "snapshot", "should", "be",...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java#L250-L281
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertPackage
public void convertPackage(PackageElement pkg, DocPath outputdir) throws DocFileIOException, SimpleDocletException { if (pkg == null) { return; } for (Element te : utils.getAllClasses(pkg)) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && utils.isDeprecated(te))) convertClass((TypeElement)te, outputdir); } }
java
public void convertPackage(PackageElement pkg, DocPath outputdir) throws DocFileIOException, SimpleDocletException { if (pkg == null) { return; } for (Element te : utils.getAllClasses(pkg)) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && utils.isDeprecated(te))) convertClass((TypeElement)te, outputdir); } }
[ "public", "void", "convertPackage", "(", "PackageElement", "pkg", ",", "DocPath", "outputdir", ")", "throws", "DocFileIOException", ",", "SimpleDocletException", "{", "if", "(", "pkg", "==", "null", ")", "{", "return", ";", "}", "for", "(", "Element", "te", ...
Convert the Classes in the given Package to an HTML file. @param pkg the Package to convert. @param outputdir the name of the directory to output to. @throws DocFileIOException if there is a problem generating an output file @throws SimpleDocletException if there is a problem reading a source file
[ "Convert", "the", "Classes", "in", "the", "given", "Package", "to", "an", "HTML", "file", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L142-L155
sdl/odata
odata_processor/src/main/java/com/sdl/odata/processor/write/util/WriteMethodUtil.java
WriteMethodUtil.validateKeys
public static void validateKeys(Object entity, EntityType type, ODataUri oDataUri, EntityDataModel entityDataModel) throws ODataClientException, ODataProcessorException { final Map<String, Object> oDataUriKeyValues = asJavaMap(getEntityKeyMap(oDataUri, entityDataModel)); final Map<String, Object> keyValues = getKeyValues(entity, type); if (oDataUriKeyValues.size() != keyValues.size()) { throw new ODataClientException(PROCESSOR_ERROR, "Number of keys don't match"); } for (Map.Entry<String, Object> oDataUriEntry : oDataUriKeyValues.entrySet()) { String oDataUriKey = oDataUriEntry.getKey(); Object value = keyValues.get(oDataUriKey); if (value == null || !normalize(value).equals(normalize(oDataUriEntry.getValue()))) { throw new ODataClientException(PROCESSOR_ERROR, "Key/Values in OData URI and the entity don't match"); } } }
java
public static void validateKeys(Object entity, EntityType type, ODataUri oDataUri, EntityDataModel entityDataModel) throws ODataClientException, ODataProcessorException { final Map<String, Object> oDataUriKeyValues = asJavaMap(getEntityKeyMap(oDataUri, entityDataModel)); final Map<String, Object> keyValues = getKeyValues(entity, type); if (oDataUriKeyValues.size() != keyValues.size()) { throw new ODataClientException(PROCESSOR_ERROR, "Number of keys don't match"); } for (Map.Entry<String, Object> oDataUriEntry : oDataUriKeyValues.entrySet()) { String oDataUriKey = oDataUriEntry.getKey(); Object value = keyValues.get(oDataUriKey); if (value == null || !normalize(value).equals(normalize(oDataUriEntry.getValue()))) { throw new ODataClientException(PROCESSOR_ERROR, "Key/Values in OData URI and the entity don't match"); } } }
[ "public", "static", "void", "validateKeys", "(", "Object", "entity", ",", "EntityType", "type", ",", "ODataUri", "oDataUri", ",", "EntityDataModel", "entityDataModel", ")", "throws", "ODataClientException", ",", "ODataProcessorException", "{", "final", "Map", "<", "...
Performs the validation of keys. The key(s) in the 'OData URI' should match the existing key(s) in the passed entity. @param entity The passed entity. @param type The entity type of the passed entity. @throws com.sdl.odata.api.ODataClientException @throws com.sdl.odata.api.processor.ODataProcessorException
[ "Performs", "the", "validation", "of", "keys", ".", "The", "key", "(", "s", ")", "in", "the", "OData", "URI", "should", "match", "the", "existing", "key", "(", "s", ")", "in", "the", "passed", "entity", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_processor/src/main/java/com/sdl/odata/processor/write/util/WriteMethodUtil.java#L117-L134
finmath/finmath-lib
src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java
DiscountCurveInterpolation.createDiscountCurveFromZeroRates
public static DiscountCurveInterpolation createDiscountCurveFromZeroRates(String name, double[] times, RandomVariable[] givenZeroRates) { RandomVariable[] givenDiscountFactors = new RandomVariable[givenZeroRates.length]; for(int timeIndex=0; timeIndex<times.length;timeIndex++) { givenDiscountFactors[timeIndex] = givenZeroRates[timeIndex].mult(-times[timeIndex]).exp(); } return createDiscountCurveFromDiscountFactors(name, times, givenDiscountFactors); }
java
public static DiscountCurveInterpolation createDiscountCurveFromZeroRates(String name, double[] times, RandomVariable[] givenZeroRates) { RandomVariable[] givenDiscountFactors = new RandomVariable[givenZeroRates.length]; for(int timeIndex=0; timeIndex<times.length;timeIndex++) { givenDiscountFactors[timeIndex] = givenZeroRates[timeIndex].mult(-times[timeIndex]).exp(); } return createDiscountCurveFromDiscountFactors(name, times, givenDiscountFactors); }
[ "public", "static", "DiscountCurveInterpolation", "createDiscountCurveFromZeroRates", "(", "String", "name", ",", "double", "[", "]", "times", ",", "RandomVariable", "[", "]", "givenZeroRates", ")", "{", "RandomVariable", "[", "]", "givenDiscountFactors", "=", "new", ...
Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods. The discount factor is determined by <code> givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]); </code> @param name The name of this discount curve. @param times Array of times as doubles. @param givenZeroRates Array of corresponding zero rates. @return A new discount factor object.
[ "Create", "a", "discount", "curve", "from", "given", "times", "and", "given", "zero", "rates", "using", "default", "interpolation", "and", "extrapolation", "methods", ".", "The", "discount", "factor", "is", "determined", "by", "<code", ">", "givenDiscountFactors",...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java#L298-L306
voldemort/voldemort
src/java/voldemort/store/stats/ClientSocketStats.java
ClientSocketStats.recordResourceRequestTimeUs
public void recordResourceRequestTimeUs(SocketDestination dest, long resourceRequestTimeUs) { if(dest != null) { getOrCreateNodeStats(dest).recordResourceRequestTimeUs(null, resourceRequestTimeUs); recordResourceRequestTimeUs(null, resourceRequestTimeUs); } else { this.resourceRequestTimeRequestCounter.addRequest(resourceRequestTimeUs * Time.NS_PER_US); } }
java
public void recordResourceRequestTimeUs(SocketDestination dest, long resourceRequestTimeUs) { if(dest != null) { getOrCreateNodeStats(dest).recordResourceRequestTimeUs(null, resourceRequestTimeUs); recordResourceRequestTimeUs(null, resourceRequestTimeUs); } else { this.resourceRequestTimeRequestCounter.addRequest(resourceRequestTimeUs * Time.NS_PER_US); } }
[ "public", "void", "recordResourceRequestTimeUs", "(", "SocketDestination", "dest", ",", "long", "resourceRequestTimeUs", ")", "{", "if", "(", "dest", "!=", "null", ")", "{", "getOrCreateNodeStats", "(", "dest", ")", ".", "recordResourceRequestTimeUs", "(", "null", ...
Record the resource request wait time in us @param dest Destination of the socket for which the resource was requested. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param resourceRequestTimeUs The number of us to wait before getting a socket
[ "Record", "the", "resource", "request", "wait", "time", "in", "us" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L302-L310
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/walk/TypesWalker.java
TypesWalker.isCompatibleClasses
private static boolean isCompatibleClasses(final Class<?> one, final Class<?> two) { return one.isAssignableFrom(two) || two.isAssignableFrom(one); }
java
private static boolean isCompatibleClasses(final Class<?> one, final Class<?> two) { return one.isAssignableFrom(two) || two.isAssignableFrom(one); }
[ "private", "static", "boolean", "isCompatibleClasses", "(", "final", "Class", "<", "?", ">", "one", ",", "final", "Class", "<", "?", ">", "two", ")", "{", "return", "one", ".", "isAssignableFrom", "(", "two", ")", "||", "two", ".", "isAssignableFrom", "(...
Classes are compatible if one can be casted to another (or they are equal). @param one first class @param two second class @return true is classes are compatible, false otherwise
[ "Classes", "are", "compatible", "if", "one", "can", "be", "casted", "to", "another", "(", "or", "they", "are", "equal", ")", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/walk/TypesWalker.java#L206-L208
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java
ColumnBuilder.addFieldProperty
public ColumnBuilder addFieldProperty(String propertyName, String value) { fieldProperties.put(propertyName, value); return this; }
java
public ColumnBuilder addFieldProperty(String propertyName, String value) { fieldProperties.put(propertyName, value); return this; }
[ "public", "ColumnBuilder", "addFieldProperty", "(", "String", "propertyName", ",", "String", "value", ")", "{", "fieldProperties", ".", "put", "(", "propertyName", ",", "value", ")", ";", "return", "this", ";", "}" ]
When the JRField needs properties, use this method. @param propertyName @param value @return
[ "When", "the", "JRField", "needs", "properties", "use", "this", "method", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/ColumnBuilder.java#L342-L345
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.asyncAction
public static FuncN<Observable<Void>> asyncAction(final ActionN action, final Scheduler scheduler) { return toAsync(action, scheduler); }
java
public static FuncN<Observable<Void>> asyncAction(final ActionN action, final Scheduler scheduler) { return toAsync(action, scheduler); }
[ "public", "static", "FuncN", "<", "Observable", "<", "Void", ">", ">", "asyncAction", "(", "final", "ActionN", "action", ",", "final", "Scheduler", "scheduler", ")", "{", "return", "toAsync", "(", "action", ",", "scheduler", ")", ";", "}" ]
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/asyncAction.ns.png" alt=""> <p> Alias for toAsync(ActionN, Scheduler) intended for dynamic languages. @param action the action to convert @param scheduler the Scheduler used to execute the {@code action} @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: asyncAction()</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1715-L1717
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java
WNExtendedSemanticGlossComparison.getRelationFromRels
private char getRelationFromRels(char builtForRel, char glossRel) { if (builtForRel == IMappingElement.EQUIVALENCE) { return glossRel; } if (builtForRel == IMappingElement.LESS_GENERAL) { if ((glossRel == IMappingElement.LESS_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) { return IMappingElement.LESS_GENERAL; } } if (builtForRel == IMappingElement.MORE_GENERAL) { if ((glossRel == IMappingElement.MORE_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) { return IMappingElement.MORE_GENERAL; } } return IMappingElement.IDK; }
java
private char getRelationFromRels(char builtForRel, char glossRel) { if (builtForRel == IMappingElement.EQUIVALENCE) { return glossRel; } if (builtForRel == IMappingElement.LESS_GENERAL) { if ((glossRel == IMappingElement.LESS_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) { return IMappingElement.LESS_GENERAL; } } if (builtForRel == IMappingElement.MORE_GENERAL) { if ((glossRel == IMappingElement.MORE_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) { return IMappingElement.MORE_GENERAL; } } return IMappingElement.IDK; }
[ "private", "char", "getRelationFromRels", "(", "char", "builtForRel", ",", "char", "glossRel", ")", "{", "if", "(", "builtForRel", "==", "IMappingElement", ".", "EQUIVALENCE", ")", "{", "return", "glossRel", ";", "}", "if", "(", "builtForRel", "==", "IMappingE...
Decides which relation to return as a function of relation for which extended gloss was built. @param builtForRel relation for which the gloss was built @param glossRel relation @return less general, more general or IDK relation
[ "Decides", "which", "relation", "to", "return", "as", "a", "function", "of", "relation", "for", "which", "extended", "gloss", "was", "built", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L153-L168
phax/ph-web
ph-web/src/main/java/com/helger/web/fileupload/parse/ParameterParser.java
ParameterParser._parseToken
@Nullable private String _parseToken (final char cTerminator1, final char cTerminator2) { char ch; m_nIndex1 = m_nPos; m_nIndex2 = m_nPos; while (_hasChar ()) { ch = m_aChars[m_nPos]; if (ch == cTerminator1 || ch == cTerminator2) break; m_nIndex2++; m_nPos++; } return _getToken (false); }
java
@Nullable private String _parseToken (final char cTerminator1, final char cTerminator2) { char ch; m_nIndex1 = m_nPos; m_nIndex2 = m_nPos; while (_hasChar ()) { ch = m_aChars[m_nPos]; if (ch == cTerminator1 || ch == cTerminator2) break; m_nIndex2++; m_nPos++; } return _getToken (false); }
[ "@", "Nullable", "private", "String", "_parseToken", "(", "final", "char", "cTerminator1", ",", "final", "char", "cTerminator2", ")", "{", "char", "ch", ";", "m_nIndex1", "=", "m_nPos", ";", "m_nIndex2", "=", "m_nPos", ";", "while", "(", "_hasChar", "(", "...
Parses out a token until any of the given terminators is encountered. @param cTerminator1 the first terminating character. Any when encountered signify the end of the token @param cTerminator2 the second terminating character. Any when encountered signify the end of the token @return the token
[ "Parses", "out", "a", "token", "until", "any", "of", "the", "given", "terminators", "is", "encountered", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/ParameterParser.java#L143-L158
dhanji/sitebricks
sitebricks/src/main/java/com/google/sitebricks/routing/WidgetRoutingDispatcher.java
WidgetRoutingDispatcher.fireEvent
@SuppressWarnings("unchecked") private Object fireEvent(Request request, PageBook.Page page, Object instance) throws IOException { final String method = request.method(); final String pathInfo = request.path(); return page.doMethod(method.toLowerCase(), instance, pathInfo, request); }
java
@SuppressWarnings("unchecked") private Object fireEvent(Request request, PageBook.Page page, Object instance) throws IOException { final String method = request.method(); final String pathInfo = request.path(); return page.doMethod(method.toLowerCase(), instance, pathInfo, request); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Object", "fireEvent", "(", "Request", "request", ",", "PageBook", ".", "Page", "page", ",", "Object", "instance", ")", "throws", "IOException", "{", "final", "String", "method", "=", "request", "....
We're sure the request parameter map is a Map<String, String[]>
[ "We", "re", "sure", "the", "request", "parameter", "map", "is", "a", "Map<String", "String", "[]", ">" ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/routing/WidgetRoutingDispatcher.java#L165-L172
termsuite/termsuite-core
src/main/java/fr/univnantes/termsuite/utils/TermOccurrenceUtils.java
TermOccurrenceUtils.areOffsetsOverlapping
public static boolean areOffsetsOverlapping(TermOccurrence a, TermOccurrence b) { if(a.getBegin() <= b.getBegin()) return !(a.getBegin() <= b.getEnd() && a.getEnd() <= b.getBegin()); else return !(b.getBegin() <= a.getEnd() && b.getEnd() <= a.getBegin()); }
java
public static boolean areOffsetsOverlapping(TermOccurrence a, TermOccurrence b) { if(a.getBegin() <= b.getBegin()) return !(a.getBegin() <= b.getEnd() && a.getEnd() <= b.getBegin()); else return !(b.getBegin() <= a.getEnd() && b.getEnd() <= a.getBegin()); }
[ "public", "static", "boolean", "areOffsetsOverlapping", "(", "TermOccurrence", "a", ",", "TermOccurrence", "b", ")", "{", "if", "(", "a", ".", "getBegin", "(", ")", "<=", "b", ".", "getBegin", "(", ")", ")", "return", "!", "(", "a", ".", "getBegin", "(...
True if two {@link TermOccurrence} offsets overlap strictly. Sharing exactly one offset (e.g. <code>a.end == b.begin</code>) is not considered as overlap. @param a @param b @return
[ "True", "if", "two", "{", "@link", "TermOccurrence", "}", "offsets", "overlap", "strictly", ".", "Sharing", "exactly", "one", "offset", "(", "e", ".", "g", ".", "<code", ">", "a", ".", "end", "==", "b", ".", "begin<", "/", "code", ">", ")", "is", "...
train
https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/utils/TermOccurrenceUtils.java#L150-L156
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java
AnnotationValue.getRequiredValue
public @Nonnull final <T> T getRequiredValue(Class<T> type) { return getRequiredValue(AnnotationMetadata.VALUE_MEMBER, type); }
java
public @Nonnull final <T> T getRequiredValue(Class<T> type) { return getRequiredValue(AnnotationMetadata.VALUE_MEMBER, type); }
[ "public", "@", "Nonnull", "final", "<", "T", ">", "T", "getRequiredValue", "(", "Class", "<", "T", ">", "type", ")", "{", "return", "getRequiredValue", "(", "AnnotationMetadata", ".", "VALUE_MEMBER", ",", "type", ")", ";", "}" ]
Get the value of the {@code value} member of the annotation. @param type The type @param <T> The type @throws IllegalStateException If no member is available that conforms to the given type @return The result
[ "Get", "the", "value", "of", "the", "{", "@code", "value", "}", "member", "of", "the", "annotation", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java#L210-L212
igniterealtime/Smack
smack-tcp/src/main/java/org/jivesoftware/smack/sm/SMUtils.java
SMUtils.calculateDelta
public static long calculateDelta(long reportedHandledCount, long lastKnownHandledCount) { if (lastKnownHandledCount > reportedHandledCount) { throw new IllegalStateException("Illegal Stream Management State: Last known handled count (" + lastKnownHandledCount + ") is greater than reported handled count (" + reportedHandledCount + ')'); } return (reportedHandledCount - lastKnownHandledCount) & MASK_32_BIT; }
java
public static long calculateDelta(long reportedHandledCount, long lastKnownHandledCount) { if (lastKnownHandledCount > reportedHandledCount) { throw new IllegalStateException("Illegal Stream Management State: Last known handled count (" + lastKnownHandledCount + ") is greater than reported handled count (" + reportedHandledCount + ')'); } return (reportedHandledCount - lastKnownHandledCount) & MASK_32_BIT; }
[ "public", "static", "long", "calculateDelta", "(", "long", "reportedHandledCount", ",", "long", "lastKnownHandledCount", ")", "{", "if", "(", "lastKnownHandledCount", ">", "reportedHandledCount", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Illegal Stream ...
Calculates the delta of the last known stanza handled count and the new reported stanza handled count while considering that the new value may be wrapped after 2^32-1. @param reportedHandledCount @param lastKnownHandledCount @return the delta
[ "Calculates", "the", "delta", "of", "the", "last", "known", "stanza", "handled", "count", "and", "the", "new", "reported", "stanza", "handled", "count", "while", "considering", "that", "the", "new", "value", "may", "be", "wrapped", "after", "2^32", "-", "1",...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-tcp/src/main/java/org/jivesoftware/smack/sm/SMUtils.java#L49-L54
kirgor/enklib
sql/src/main/java/com/kirgor/enklib/sql/proxy/StoredProcedureProxyFactory.java
StoredProcedureProxyFactory.getProxy
public <T> T getProxy(Class<T> interfaceClass, Session session) throws Exception { Class proxyClass = proxyClassesByInterface.get(interfaceClass); if (proxyClass == null) { proxyClass = StoredProcedureProxy.createProxyClass(interfaceClass, dialect); proxyClassesByInterface.put(interfaceClass, proxyClass); } StoredProcedureProxy result = (StoredProcedureProxy) proxyClass.newInstance(); result.setSession(session); return (T) result; }
java
public <T> T getProxy(Class<T> interfaceClass, Session session) throws Exception { Class proxyClass = proxyClassesByInterface.get(interfaceClass); if (proxyClass == null) { proxyClass = StoredProcedureProxy.createProxyClass(interfaceClass, dialect); proxyClassesByInterface.put(interfaceClass, proxyClass); } StoredProcedureProxy result = (StoredProcedureProxy) proxyClass.newInstance(); result.setSession(session); return (T) result; }
[ "public", "<", "T", ">", "T", "getProxy", "(", "Class", "<", "T", ">", "interfaceClass", ",", "Session", "session", ")", "throws", "Exception", "{", "Class", "proxyClass", "=", "proxyClassesByInterface", ".", "get", "(", "interfaceClass", ")", ";", "if", "...
Creates ready-to-use proxy instance for specified interface and {@link Session}. Please, use Sessions with {@link Dialect} compatible to {@link Dialect} used in factory. @param interfaceClass Interface class, which contains proxy declaration. @param session {@link Session}, which generated proxy will wrap. @param <T> Type of interface class, which contains proxy declaration. @throws Exception
[ "Creates", "ready", "-", "to", "-", "use", "proxy", "instance", "for", "specified", "interface", "and", "{", "@link", "Session", "}", ".", "Please", "use", "Sessions", "with", "{", "@link", "Dialect", "}", "compatible", "to", "{", "@link", "Dialect", "}", ...
train
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/sql/src/main/java/com/kirgor/enklib/sql/proxy/StoredProcedureProxyFactory.java#L35-L45
grails/grails-core
grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java
GroovyPagesUriSupport.getViewURI
public String getViewURI(GroovyObject controller, String viewName) { return getViewURI(getLogicalControllerName(controller), viewName); }
java
public String getViewURI(GroovyObject controller, String viewName) { return getViewURI(getLogicalControllerName(controller), viewName); }
[ "public", "String", "getViewURI", "(", "GroovyObject", "controller", ",", "String", "viewName", ")", "{", "return", "getViewURI", "(", "getLogicalControllerName", "(", "controller", ")", ",", "viewName", ")", ";", "}" ]
Obtains a view URI of the given controller and view name @param controller The name of the controller @param viewName The name of the view @return The view URI
[ "Obtains", "a", "view", "URI", "of", "the", "given", "controller", "and", "view", "name" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L69-L71
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/CopyOnWriteMap.java
CopyOnWriteMap.putAll
public void putAll(Map<? extends K, ? extends V> newData) { synchronized (this) { Map<K, V> newMap = new HashMap<>(internalMap); newMap.putAll(newData); internalMap = newMap; } }
java
public void putAll(Map<? extends K, ? extends V> newData) { synchronized (this) { Map<K, V> newMap = new HashMap<>(internalMap); newMap.putAll(newData); internalMap = newMap; } }
[ "public", "void", "putAll", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "newData", ")", "{", "synchronized", "(", "this", ")", "{", "Map", "<", "K", ",", "V", ">", "newMap", "=", "new", "HashMap", "<>", "(", "internalMap", ...
Inserts all the keys and values contained in the provided map to this map. @see java.util.Map#putAll(java.util.Map)
[ "Inserts", "all", "the", "keys", "and", "values", "contained", "in", "the", "provided", "map", "to", "this", "map", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/CopyOnWriteMap.java#L103-L109
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/AbstractPrintQuery.java
AbstractPrintQuery.addMsgPhrase
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr, final UUID... _msgPhrase) throws EFapsException { final List<MsgPhrase> msgphrases = new ArrayList<>(); for (final UUID phraseUUID : _msgPhrase) { msgphrases.add(MsgPhrase.get(phraseUUID)); } return addMsgPhrase(_selectBldr, msgphrases.toArray(new MsgPhrase[msgphrases.size()])); }
java
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr, final UUID... _msgPhrase) throws EFapsException { final List<MsgPhrase> msgphrases = new ArrayList<>(); for (final UUID phraseUUID : _msgPhrase) { msgphrases.add(MsgPhrase.get(phraseUUID)); } return addMsgPhrase(_selectBldr, msgphrases.toArray(new MsgPhrase[msgphrases.size()])); }
[ "public", "AbstractPrintQuery", "addMsgPhrase", "(", "final", "SelectBuilder", "_selectBldr", ",", "final", "UUID", "...", "_msgPhrase", ")", "throws", "EFapsException", "{", "final", "List", "<", "MsgPhrase", ">", "msgphrases", "=", "new", "ArrayList", "<>", "(",...
Adds the msg phrase. @param _selectBldr the select bldr @param _msgPhrase the msg phrase @return the abstract print query @throws EFapsException on error
[ "Adds", "the", "msg", "phrase", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L546-L555
operasoftware/operaprestodriver
src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java
OperaLauncherProtocol.recvMessage
private ResponseEncapsulation recvMessage() throws IOException { GeneratedMessage msg = null; byte[] headers = new byte[8]; recv(headers, headers.length); if (headers[0] != 'L' || headers[1] != '1') { throw new IOException("Wrong launcher protocol header"); } ByteBuffer buf = ByteBuffer.allocate(4); buf.order(ByteOrder.BIG_ENDIAN); buf.put(headers, 4, 4); buf.flip(); int size = buf.getInt(); logger.finest("RECV: type=" + ((int) headers[3]) + ", command=" + ((int) headers[2]) + ", size=" + size); byte[] data = new byte[size]; recv(data, size); boolean success = (headers[3] == (byte) 1); MessageType type = MessageType.get(headers[2]); if (type == null) { throw new IOException("Unable to determine message type"); } if ((headers[3] != (byte) 1) && (headers[3] != (byte) 2)) { throw new IOException("Unable to determine success or error"); } switch (type) { case MSG_HELLO: { LauncherHandshakeResponse.Builder response = LauncherHandshakeResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } case MSG_START: case MSG_STATUS: case MSG_STOP: { LauncherStatusResponse.Builder response = LauncherStatusResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } case MSG_SCREENSHOT: { LauncherScreenshotResponse.Builder response = LauncherScreenshotResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } } return new ResponseEncapsulation(success, msg); }
java
private ResponseEncapsulation recvMessage() throws IOException { GeneratedMessage msg = null; byte[] headers = new byte[8]; recv(headers, headers.length); if (headers[0] != 'L' || headers[1] != '1') { throw new IOException("Wrong launcher protocol header"); } ByteBuffer buf = ByteBuffer.allocate(4); buf.order(ByteOrder.BIG_ENDIAN); buf.put(headers, 4, 4); buf.flip(); int size = buf.getInt(); logger.finest("RECV: type=" + ((int) headers[3]) + ", command=" + ((int) headers[2]) + ", size=" + size); byte[] data = new byte[size]; recv(data, size); boolean success = (headers[3] == (byte) 1); MessageType type = MessageType.get(headers[2]); if (type == null) { throw new IOException("Unable to determine message type"); } if ((headers[3] != (byte) 1) && (headers[3] != (byte) 2)) { throw new IOException("Unable to determine success or error"); } switch (type) { case MSG_HELLO: { LauncherHandshakeResponse.Builder response = LauncherHandshakeResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } case MSG_START: case MSG_STATUS: case MSG_STOP: { LauncherStatusResponse.Builder response = LauncherStatusResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } case MSG_SCREENSHOT: { LauncherScreenshotResponse.Builder response = LauncherScreenshotResponse.newBuilder(); buildMessage(response, data); msg = response.build(); break; } } return new ResponseEncapsulation(success, msg); }
[ "private", "ResponseEncapsulation", "recvMessage", "(", ")", "throws", "IOException", "{", "GeneratedMessage", "msg", "=", "null", ";", "byte", "[", "]", "headers", "=", "new", "byte", "[", "8", "]", ";", "recv", "(", "headers", ",", "headers", ".", "lengt...
Receive a message response. @return Response body and request status code @throws IOException if socket read error or protocol parse error
[ "Receive", "a", "message", "response", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java#L196-L256
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.getOrCreateRegularFile
public RegularFile getOrCreateRegularFile( JimfsPath path, Set<OpenOption> options, FileAttribute<?>... attrs) throws IOException { checkNotNull(path); if (!options.contains(CREATE_NEW)) { // assume file exists unless we're explicitly trying to create a new file RegularFile file = lookUpRegularFile(path, options); if (file != null) { return file; } } if (options.contains(CREATE) || options.contains(CREATE_NEW)) { return getOrCreateRegularFileWithWriteLock(path, options, attrs); } else { throw new NoSuchFileException(path.toString()); } }
java
public RegularFile getOrCreateRegularFile( JimfsPath path, Set<OpenOption> options, FileAttribute<?>... attrs) throws IOException { checkNotNull(path); if (!options.contains(CREATE_NEW)) { // assume file exists unless we're explicitly trying to create a new file RegularFile file = lookUpRegularFile(path, options); if (file != null) { return file; } } if (options.contains(CREATE) || options.contains(CREATE_NEW)) { return getOrCreateRegularFileWithWriteLock(path, options, attrs); } else { throw new NoSuchFileException(path.toString()); } }
[ "public", "RegularFile", "getOrCreateRegularFile", "(", "JimfsPath", "path", ",", "Set", "<", "OpenOption", ">", "options", ",", "FileAttribute", "<", "?", ">", "...", "attrs", ")", "throws", "IOException", "{", "checkNotNull", "(", "path", ")", ";", "if", "...
Gets the regular file at the given path, creating it if it doesn't exist and the given options specify that it should be created.
[ "Gets", "the", "regular", "file", "at", "the", "given", "path", "creating", "it", "if", "it", "doesn", "t", "exist", "and", "the", "given", "options", "specify", "that", "it", "should", "be", "created", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L285-L302
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java
UnsynchronizedRateLimiter.reserveNextTicket
private long reserveNextTicket(double requiredPermits, long nowMicros) { resync(nowMicros); long microsToNextFreeTicket = Math.max(0, nextFreeTicketMicros - nowMicros); double storedPermitsToSpend = Math.min(requiredPermits, this.storedPermits); double freshPermits = requiredPermits - storedPermitsToSpend; long waitMicros = storedPermitsToWaitTime(this.storedPermits, storedPermitsToSpend) + (long) (freshPermits * stableIntervalMicros); this.nextFreeTicketMicros = nextFreeTicketMicros + waitMicros; this.storedPermits -= storedPermitsToSpend; return microsToNextFreeTicket; }
java
private long reserveNextTicket(double requiredPermits, long nowMicros) { resync(nowMicros); long microsToNextFreeTicket = Math.max(0, nextFreeTicketMicros - nowMicros); double storedPermitsToSpend = Math.min(requiredPermits, this.storedPermits); double freshPermits = requiredPermits - storedPermitsToSpend; long waitMicros = storedPermitsToWaitTime(this.storedPermits, storedPermitsToSpend) + (long) (freshPermits * stableIntervalMicros); this.nextFreeTicketMicros = nextFreeTicketMicros + waitMicros; this.storedPermits -= storedPermitsToSpend; return microsToNextFreeTicket; }
[ "private", "long", "reserveNextTicket", "(", "double", "requiredPermits", ",", "long", "nowMicros", ")", "{", "resync", "(", "nowMicros", ")", ";", "long", "microsToNextFreeTicket", "=", "Math", ".", "max", "(", "0", ",", "nextFreeTicketMicros", "-", "nowMicros"...
Reserves next ticket and returns the wait time that the caller must wait for. <p>The return value is guaranteed to be non-negative.
[ "Reserves", "next", "ticket", "and", "returns", "the", "wait", "time", "that", "the", "caller", "must", "wait", "for", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java#L502-L514
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.pages_getInfo
public T pages_getInfo(Integer userId, EnumSet<PageProfileField> fields) throws FacebookException, IOException { if (fields == null || fields.isEmpty()) { throw new IllegalArgumentException("fields cannot be empty or null"); } if (userId == null) { userId = this._userId; } return this.callMethod(FacebookMethod.PAGES_GET_INFO, new Pair<String, CharSequence>("uid", userId.toString()), new Pair<String, CharSequence>("fields", delimit(fields))); }
java
public T pages_getInfo(Integer userId, EnumSet<PageProfileField> fields) throws FacebookException, IOException { if (fields == null || fields.isEmpty()) { throw new IllegalArgumentException("fields cannot be empty or null"); } if (userId == null) { userId = this._userId; } return this.callMethod(FacebookMethod.PAGES_GET_INFO, new Pair<String, CharSequence>("uid", userId.toString()), new Pair<String, CharSequence>("fields", delimit(fields))); }
[ "public", "T", "pages_getInfo", "(", "Integer", "userId", ",", "EnumSet", "<", "PageProfileField", ">", "fields", ")", "throws", "FacebookException", ",", "IOException", "{", "if", "(", "fields", "==", "null", "||", "fields", ".", "isEmpty", "(", ")", ")", ...
Retrieves the requested profile fields for the Facebook Pages of the user with the given <code>userId</code>. @param userId the ID of a user about whose pages to fetch info (defaulted to the logged-in user) @param fields a set of PageProfileFields @return a T consisting of a list of pages, with each page element containing the requested fields. @see <a href="http://wiki.developers.facebook.com/index.php/Pages.getInfo"> Developers Wiki: Pages.getInfo</a>
[ "Retrieves", "the", "requested", "profile", "fields", "for", "the", "Facebook", "Pages", "of", "the", "user", "with", "the", "given", "<code", ">", "userId<", "/", "code", ">", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2129-L2140
javagl/ND
nd-arrays/src/main/java/de/javagl/nd/arrays/Utils.java
Utils.countDifferences
public static int countDifferences(IntTuple t0, IntTuple t1) { if (t0.getSize() != t1.getSize()) { throw new IllegalArgumentException( "Sizes do not match: "+t0.getSize()+ " and "+t1.getSize()); } int n = t0.getSize(); int differences = 0; for (int i=0; i<n; i++) { if (t0.get(i) != t1.get(i)) { differences++; } } return differences; }
java
public static int countDifferences(IntTuple t0, IntTuple t1) { if (t0.getSize() != t1.getSize()) { throw new IllegalArgumentException( "Sizes do not match: "+t0.getSize()+ " and "+t1.getSize()); } int n = t0.getSize(); int differences = 0; for (int i=0; i<n; i++) { if (t0.get(i) != t1.get(i)) { differences++; } } return differences; }
[ "public", "static", "int", "countDifferences", "(", "IntTuple", "t0", ",", "IntTuple", "t1", ")", "{", "if", "(", "t0", ".", "getSize", "(", ")", "!=", "t1", ".", "getSize", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sizes do...
Returns the number of entries of the given tuples that are different @param t0 The first tuple @param t1 The second tuple @return The number of differences @throws NullPointerException If any of the arguments is <code>null</code> @throws IllegalArgumentException If the given tuples do not have the same {@link IntTuple#getSize() size}
[ "Returns", "the", "number", "of", "entries", "of", "the", "given", "tuples", "that", "are", "different" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/Utils.java#L160-L178
Whiley/WhileyCompiler
src/main/java/wyil/io/WyilFilePrinter.java
WyilFilePrinter.visitBracketedExpression
public void visitBracketedExpression(Expr expr, Integer indent) { boolean needsBrackets = needsBrackets(expr); if (needsBrackets) { out.print("("); } visitExpression(expr, indent); if (needsBrackets) { out.print(")"); } }
java
public void visitBracketedExpression(Expr expr, Integer indent) { boolean needsBrackets = needsBrackets(expr); if (needsBrackets) { out.print("("); } visitExpression(expr, indent); if (needsBrackets) { out.print(")"); } }
[ "public", "void", "visitBracketedExpression", "(", "Expr", "expr", ",", "Integer", "indent", ")", "{", "boolean", "needsBrackets", "=", "needsBrackets", "(", "expr", ")", ";", "if", "(", "needsBrackets", ")", "{", "out", ".", "print", "(", "\"(\"", ")", ";...
Write a bracketed operand if necessary. Any operand whose human-readable representation can contain whitespace must have brackets around it. @param operand @param enclosing @param out
[ "Write", "a", "bracketed", "operand", "if", "necessary", ".", "Any", "operand", "whose", "human", "-", "readable", "representation", "can", "contain", "whitespace", "must", "have", "brackets", "around", "it", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/io/WyilFilePrinter.java#L397-L406
apereo/cas
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/UrlResourceMetadataResolver.java
UrlResourceMetadataResolver.fetchMetadata
protected HttpResponse fetchMetadata(final String metadataLocation, final CriteriaSet criteriaSet) { LOGGER.debug("Fetching metadata from [{}]", metadataLocation); return HttpUtils.executeGet(metadataLocation, new LinkedHashMap<>()); }
java
protected HttpResponse fetchMetadata(final String metadataLocation, final CriteriaSet criteriaSet) { LOGGER.debug("Fetching metadata from [{}]", metadataLocation); return HttpUtils.executeGet(metadataLocation, new LinkedHashMap<>()); }
[ "protected", "HttpResponse", "fetchMetadata", "(", "final", "String", "metadataLocation", ",", "final", "CriteriaSet", "criteriaSet", ")", "{", "LOGGER", ".", "debug", "(", "\"Fetching metadata from [{}]\"", ",", "metadataLocation", ")", ";", "return", "HttpUtils", "....
Fetch metadata http response. @param metadataLocation the metadata location @param criteriaSet the criteria set @return the http response
[ "Fetch", "metadata", "http", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/UrlResourceMetadataResolver.java#L146-L149
liyiorg/weixin-popular
src/main/java/weixin/popular/api/BizwifiAPI.java
BizwifiAPI.openpluginToken
public static OpenPluginTokenResult openpluginToken(String accessToken, OpenPluginToken openPluginToken) { return openpluginToken(accessToken, JsonUtil.toJSONString(openPluginToken)); }
java
public static OpenPluginTokenResult openpluginToken(String accessToken, OpenPluginToken openPluginToken) { return openpluginToken(accessToken, JsonUtil.toJSONString(openPluginToken)); }
[ "public", "static", "OpenPluginTokenResult", "openpluginToken", "(", "String", "accessToken", ",", "OpenPluginToken", "openPluginToken", ")", "{", "return", "openpluginToken", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "openPluginToken", ")", ")", ...
第三方平台获取插件wifi_token @param accessToken accessToken @param openPluginToken openpluginToken @return OpenpluginTokenResult
[ "第三方平台获取插件wifi_token" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L50-L52
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java
LinkUtil.getUnmappedUrl
public static String getUnmappedUrl(SlingHttpServletRequest request, String url) { return getUrl(request, url, null, null, LinkMapper.CONTEXT); }
java
public static String getUnmappedUrl(SlingHttpServletRequest request, String url) { return getUrl(request, url, null, null, LinkMapper.CONTEXT); }
[ "public", "static", "String", "getUnmappedUrl", "(", "SlingHttpServletRequest", "request", ",", "String", "url", ")", "{", "return", "getUrl", "(", "request", ",", "url", ",", "null", ",", "null", ",", "LinkMapper", ".", "CONTEXT", ")", ";", "}" ]
Builds a unmapped link to a path (resource path) without selectors and a determined extension. @param request the request context for path mapping (the result is always mapped) @param url the URL to use (complete) or the path to an addressed resource (without any extension) @return the unmapped url for the referenced resource
[ "Builds", "a", "unmapped", "link", "to", "a", "path", "(", "resource", "path", ")", "without", "selectors", "and", "a", "determined", "extension", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java#L76-L78
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.getBrandResourcesByContentType
public void getBrandResourcesByContentType(String accountId, String brandId, String resourceContentType, AccountsApi.GetBrandResourcesByContentTypeOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getBrandResourcesByContentType"); } // verify the required parameter 'brandId' is set if (brandId == null) { throw new ApiException(400, "Missing the required parameter 'brandId' when calling getBrandResourcesByContentType"); } // verify the required parameter 'resourceContentType' is set if (resourceContentType == null) { throw new ApiException(400, "Missing the required parameter 'resourceContentType' when calling getBrandResourcesByContentType"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/brands/{brandId}/resources/{resourceContentType}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "brandId" + "\\}", apiClient.escapeString(brandId.toString())) .replaceAll("\\{" + "resourceContentType" + "\\}", apiClient.escapeString(resourceContentType.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "langcode", options.langcode)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "return_master", options.returnMaster)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); }
java
public void getBrandResourcesByContentType(String accountId, String brandId, String resourceContentType, AccountsApi.GetBrandResourcesByContentTypeOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getBrandResourcesByContentType"); } // verify the required parameter 'brandId' is set if (brandId == null) { throw new ApiException(400, "Missing the required parameter 'brandId' when calling getBrandResourcesByContentType"); } // verify the required parameter 'resourceContentType' is set if (resourceContentType == null) { throw new ApiException(400, "Missing the required parameter 'resourceContentType' when calling getBrandResourcesByContentType"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/brands/{brandId}/resources/{resourceContentType}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "brandId" + "\\}", apiClient.escapeString(brandId.toString())) .replaceAll("\\{" + "resourceContentType" + "\\}", apiClient.escapeString(resourceContentType.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "langcode", options.langcode)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "return_master", options.returnMaster)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); }
[ "public", "void", "getBrandResourcesByContentType", "(", "String", "accountId", ",", "String", "brandId", ",", "String", "resourceContentType", ",", "AccountsApi", ".", "GetBrandResourcesByContentTypeOptions", "options", ")", "throws", "ApiException", "{", "Object", "loca...
Returns the specified branding resource file. @param accountId The external account number (int) or account ID Guid. (required) @param brandId The unique identifier of a brand. (required) @param resourceContentType (required) @param options for modifying the method behavior. @throws ApiException if fails to make API call
[ "Returns", "the", "specified", "branding", "resource", "file", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1311-L1360
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/BasePrepareStatement.java
BasePrepareStatement.setURL
@Override public void setURL(final int parameterIndex, final URL url) throws SQLException { if (url == null) { setNull(parameterIndex, ColumnType.STRING); return; } setParameter(parameterIndex, new StringParameter(url.toString(), noBackslashEscapes)); }
java
@Override public void setURL(final int parameterIndex, final URL url) throws SQLException { if (url == null) { setNull(parameterIndex, ColumnType.STRING); return; } setParameter(parameterIndex, new StringParameter(url.toString(), noBackslashEscapes)); }
[ "@", "Override", "public", "void", "setURL", "(", "final", "int", "parameterIndex", ",", "final", "URL", "url", ")", "throws", "SQLException", "{", "if", "(", "url", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "ColumnType", ".", "STRING"...
Sets the designated parameter to the given <code>java.net.URL</code> value. The driver converts this to an SQL <code>DATALINK</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param url the <code>java.net.URL</code> object to be set @throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "net", ".", "URL<", "/", "code", ">", "value", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "DATALINK<", "/", "code", ">", "value",...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L703-L710
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/DynamicLoader.java
DynamicLoader.createMethod
public Method createMethod(C object, String methodName, Class[] parameterTypes) throws NoSuchMethodException { Class clazz = object.getClass(); try { @SuppressWarnings("unchecked") Method method = clazz.getMethod(methodName, parameterTypes); return method; } catch (NoSuchMethodException nsme) { String info = "The specified class " + clazz.getName(); info += " does not have a method \"" + methodName + "\" as expected: "; info += nsme.getMessage(); throw new NoSuchMethodException(info); } }
java
public Method createMethod(C object, String methodName, Class[] parameterTypes) throws NoSuchMethodException { Class clazz = object.getClass(); try { @SuppressWarnings("unchecked") Method method = clazz.getMethod(methodName, parameterTypes); return method; } catch (NoSuchMethodException nsme) { String info = "The specified class " + clazz.getName(); info += " does not have a method \"" + methodName + "\" as expected: "; info += nsme.getMessage(); throw new NoSuchMethodException(info); } }
[ "public", "Method", "createMethod", "(", "C", "object", ",", "String", "methodName", ",", "Class", "[", "]", "parameterTypes", ")", "throws", "NoSuchMethodException", "{", "Class", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "try", "{", "@", "S...
Creates a method for a class. @param object the object to which the method belongs. @param methodName name of method. @param parameterTypes an array of parameter types for the method. @throws NoSuchMethodException if method is not found on object.
[ "Creates", "a", "method", "for", "a", "class", "." ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/DynamicLoader.java#L340-L354
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/FrameworkBeanFactory.java
FrameworkBeanFactory.getAttribute
private String getAttribute(BeanDefinition beanDefinition, String attributeName) { String value = null; while (beanDefinition != null) { value = (String) beanDefinition.getAttribute(attributeName); if (value != null) { break; } beanDefinition = beanDefinition.getOriginatingBeanDefinition(); } return value; }
java
private String getAttribute(BeanDefinition beanDefinition, String attributeName) { String value = null; while (beanDefinition != null) { value = (String) beanDefinition.getAttribute(attributeName); if (value != null) { break; } beanDefinition = beanDefinition.getOriginatingBeanDefinition(); } return value; }
[ "private", "String", "getAttribute", "(", "BeanDefinition", "beanDefinition", ",", "String", "attributeName", ")", "{", "String", "value", "=", "null", ";", "while", "(", "beanDefinition", "!=", "null", ")", "{", "value", "=", "(", "String", ")", "beanDefiniti...
Searches this bean definition and all originating bean definitions until it finds the requested attribute. @param beanDefinition Bean definition. @param attributeName Attribute to locate. @return The value of the attribute, or null if not found.
[ "Searches", "this", "bean", "definition", "and", "all", "originating", "bean", "definitions", "until", "it", "finds", "the", "requested", "attribute", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/FrameworkBeanFactory.java#L184-L198
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XElement.java
XElement.parseXML
public static XElement parseXML(ResultSet rs, String column) throws SQLException, IOException, XMLStreamException { try (InputStream is = rs.getBinaryStream(column)) { if (is != null) { return parseXML(is); } return null; } }
java
public static XElement parseXML(ResultSet rs, String column) throws SQLException, IOException, XMLStreamException { try (InputStream is = rs.getBinaryStream(column)) { if (is != null) { return parseXML(is); } return null; } }
[ "public", "static", "XElement", "parseXML", "(", "ResultSet", "rs", ",", "String", "column", ")", "throws", "SQLException", ",", "IOException", ",", "XMLStreamException", "{", "try", "(", "InputStream", "is", "=", "rs", ".", "getBinaryStream", "(", "column", "...
Reads the contents of a named column as an XML. @param rs the result set to read from @param column the column name @return the parsed XNElement or null if the column contained null @throws SQLException on SQL error @throws IOException on IO error @throws XMLStreamException on parsing error
[ "Reads", "the", "contents", "of", "a", "named", "column", "as", "an", "XML", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XElement.java#L101-L109
skjolber/3d-bin-container-packing
src/main/java/com/github/skjolberg/packing/Packager.java
Packager.packList
public List<Container> packList(List<BoxItem> boxes, int limit, long deadline) { return packList(boxes, limit, deadLinePredicate(deadline)); }
java
public List<Container> packList(List<BoxItem> boxes, int limit, long deadline) { return packList(boxes, limit, deadLinePredicate(deadline)); }
[ "public", "List", "<", "Container", ">", "packList", "(", "List", "<", "BoxItem", ">", "boxes", ",", "int", "limit", ",", "long", "deadline", ")", "{", "return", "packList", "(", "boxes", ",", "limit", ",", "deadLinePredicate", "(", "deadline", ")", ")",...
Return a list of containers which holds all the boxes in the argument @param boxes list of boxes to fit in a container @param limit maximum number of containers @param deadline the system time in milliseconds at which the search should be aborted @return index of container if match, -1 if not
[ "Return", "a", "list", "of", "containers", "which", "holds", "all", "the", "boxes", "in", "the", "argument" ]
train
https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Packager.java#L228-L230
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentDefinition.java
CmsXmlContentDefinition.addDefaultXml
public Element addDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) { Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator(); int currentPos = 0; List<Element> allElements = CmsXmlGenericWrapper.elements(root); while (i.hasNext()) { I_CmsXmlSchemaType type = i.next(); // check how many elements of this type already exist in the XML String elementName = type.getName(); List<Element> elements = CmsXmlGenericWrapper.elements(root, elementName); currentPos += elements.size(); for (int j = elements.size(); j < type.getMinOccurs(); j++) { // append the missing elements Element typeElement = type.generateXml(cms, document, root, locale); // need to check for default value again because the of appinfo "mappings" node I_CmsXmlContentValue value = type.createValue(document, typeElement, locale); String defaultValue = document.getHandler().getDefault(cms, value, locale); if (defaultValue != null) { // only if there is a default value available use it to overwrite the initial default value.setStringValue(cms, defaultValue); } // re-sort elements as they have been appended to the end of the XML root, not at the correct position typeElement.detach(); allElements.add(currentPos, typeElement); currentPos++; } } return root; }
java
public Element addDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) { Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator(); int currentPos = 0; List<Element> allElements = CmsXmlGenericWrapper.elements(root); while (i.hasNext()) { I_CmsXmlSchemaType type = i.next(); // check how many elements of this type already exist in the XML String elementName = type.getName(); List<Element> elements = CmsXmlGenericWrapper.elements(root, elementName); currentPos += elements.size(); for (int j = elements.size(); j < type.getMinOccurs(); j++) { // append the missing elements Element typeElement = type.generateXml(cms, document, root, locale); // need to check for default value again because the of appinfo "mappings" node I_CmsXmlContentValue value = type.createValue(document, typeElement, locale); String defaultValue = document.getHandler().getDefault(cms, value, locale); if (defaultValue != null) { // only if there is a default value available use it to overwrite the initial default value.setStringValue(cms, defaultValue); } // re-sort elements as they have been appended to the end of the XML root, not at the correct position typeElement.detach(); allElements.add(currentPos, typeElement); currentPos++; } } return root; }
[ "public", "Element", "addDefaultXml", "(", "CmsObject", "cms", ",", "I_CmsXmlDocument", "document", ",", "Element", "root", ",", "Locale", "locale", ")", "{", "Iterator", "<", "I_CmsXmlSchemaType", ">", "i", "=", "m_typeSequence", ".", "iterator", "(", ")", ";...
Adds the missing default XML according to this content definition to the given document element.<p> In case the root element already contains sub nodes, only missing sub nodes are added.<p> @param cms the current users OpenCms context @param document the document where the XML is added in (required for default XML generation) @param root the root node to add the missing XML for @param locale the locale to add the XML for @return the given root element with the missing content added
[ "Adds", "the", "missing", "default", "XML", "according", "to", "this", "content", "definition", "to", "the", "given", "document", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1082-L1115
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.seleniumBrowse
@Given("^I( securely)? browse to '(.+?)'$") public void seleniumBrowse(String isSecured, String path) throws Exception { assertThat(path).isNotEmpty(); if (commonspec.getWebHost() == null) { throw new Exception("Web host has not been set"); } if (commonspec.getWebPort() == null) { throw new Exception("Web port has not been set"); } String protocol = "http://"; if (isSecured != null) { protocol = "https://"; } String webURL = protocol + commonspec.getWebHost() + commonspec.getWebPort(); commonspec.getDriver().get(webURL + path); commonspec.setParentWindow(commonspec.getDriver().getWindowHandle()); }
java
@Given("^I( securely)? browse to '(.+?)'$") public void seleniumBrowse(String isSecured, String path) throws Exception { assertThat(path).isNotEmpty(); if (commonspec.getWebHost() == null) { throw new Exception("Web host has not been set"); } if (commonspec.getWebPort() == null) { throw new Exception("Web port has not been set"); } String protocol = "http://"; if (isSecured != null) { protocol = "https://"; } String webURL = protocol + commonspec.getWebHost() + commonspec.getWebPort(); commonspec.getDriver().get(webURL + path); commonspec.setParentWindow(commonspec.getDriver().getWindowHandle()); }
[ "@", "Given", "(", "\"^I( securely)? browse to '(.+?)'$\"", ")", "public", "void", "seleniumBrowse", "(", "String", "isSecured", ",", "String", "path", ")", "throws", "Exception", "{", "assertThat", "(", "path", ")", ".", "isNotEmpty", "(", ")", ";", "if", "("...
Browse to {@code url} using the current browser. @param path path of running app @throws Exception exception
[ "Browse", "to", "{", "@code", "url", "}", "using", "the", "current", "browser", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L61-L81
apache/incubator-druid
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildBufferAggregator.java
HllSketchBuildBufferAggregator.relocate
@Override public void relocate(final int oldPosition, final int newPosition, final ByteBuffer oldBuf, final ByteBuffer newBuf) { HllSketch sketch = sketchCache.get(oldBuf).get(oldPosition); final WritableMemory oldMem = getMemory(oldBuf).writableRegion(oldPosition, size); if (sketch.isSameResource(oldMem)) { // sketch has not moved final WritableMemory newMem = getMemory(newBuf).writableRegion(newPosition, size); sketch = HllSketch.writableWrap(newMem); } putSketchIntoCache(newBuf, newPosition, sketch); }
java
@Override public void relocate(final int oldPosition, final int newPosition, final ByteBuffer oldBuf, final ByteBuffer newBuf) { HllSketch sketch = sketchCache.get(oldBuf).get(oldPosition); final WritableMemory oldMem = getMemory(oldBuf).writableRegion(oldPosition, size); if (sketch.isSameResource(oldMem)) { // sketch has not moved final WritableMemory newMem = getMemory(newBuf).writableRegion(newPosition, size); sketch = HllSketch.writableWrap(newMem); } putSketchIntoCache(newBuf, newPosition, sketch); }
[ "@", "Override", "public", "void", "relocate", "(", "final", "int", "oldPosition", ",", "final", "int", "newPosition", ",", "final", "ByteBuffer", "oldBuf", ",", "final", "ByteBuffer", "newBuf", ")", "{", "HllSketch", "sketch", "=", "sketchCache", ".", "get", ...
In very rare cases sketches can exceed given memory, request on-heap memory and move there. We need to identify such sketches and reuse the same objects as opposed to wrapping new memory regions.
[ "In", "very", "rare", "cases", "sketches", "can", "exceed", "given", "memory", "request", "on", "-", "heap", "memory", "and", "move", "there", ".", "We", "need", "to", "identify", "such", "sketches", "and", "reuse", "the", "same", "objects", "as", "opposed...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildBufferAggregator.java#L146-L156
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java
BinaryInMemorySortBuffer.getIterator
public final MutableObjectIterator<BinaryRow> getIterator() { return new MutableObjectIterator<BinaryRow>() { private final int size = size(); private int current = 0; private int currentSegment = 0; private int currentOffset = 0; private MemorySegment currentIndexSegment = sortIndex.get(0); @Override public BinaryRow next(BinaryRow target) { if (this.current < this.size) { this.current++; if (this.currentOffset > lastIndexEntryOffset) { this.currentOffset = 0; this.currentIndexSegment = sortIndex.get(++this.currentSegment); } long pointer = this.currentIndexSegment.getLong(this.currentOffset); this.currentOffset += indexEntrySize; try { return getRecordFromBuffer(target, pointer); } catch (IOException ioe) { throw new RuntimeException(ioe); } } else { return null; } } @Override public BinaryRow next() { throw new RuntimeException("Not support!"); } }; }
java
public final MutableObjectIterator<BinaryRow> getIterator() { return new MutableObjectIterator<BinaryRow>() { private final int size = size(); private int current = 0; private int currentSegment = 0; private int currentOffset = 0; private MemorySegment currentIndexSegment = sortIndex.get(0); @Override public BinaryRow next(BinaryRow target) { if (this.current < this.size) { this.current++; if (this.currentOffset > lastIndexEntryOffset) { this.currentOffset = 0; this.currentIndexSegment = sortIndex.get(++this.currentSegment); } long pointer = this.currentIndexSegment.getLong(this.currentOffset); this.currentOffset += indexEntrySize; try { return getRecordFromBuffer(target, pointer); } catch (IOException ioe) { throw new RuntimeException(ioe); } } else { return null; } } @Override public BinaryRow next() { throw new RuntimeException("Not support!"); } }; }
[ "public", "final", "MutableObjectIterator", "<", "BinaryRow", ">", "getIterator", "(", ")", "{", "return", "new", "MutableObjectIterator", "<", "BinaryRow", ">", "(", ")", "{", "private", "final", "int", "size", "=", "size", "(", ")", ";", "private", "int", ...
Gets an iterator over all records in this buffer in their logical order. @return An iterator returning the records in their logical order.
[ "Gets", "an", "iterator", "over", "all", "records", "in", "this", "buffer", "in", "their", "logical", "order", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java#L186-L223
Azure/azure-sdk-for-java
policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java
PolicyDefinitionsInner.deleteAtManagementGroup
public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); }
java
public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); }
[ "public", "void", "deleteAtManagementGroup", "(", "String", "policyDefinitionName", ",", "String", "managementGroupId", ")", "{", "deleteAtManagementGroupWithServiceResponseAsync", "(", "policyDefinitionName", ",", "managementGroupId", ")", ".", "toBlocking", "(", ")", ".",...
Deletes a policy definition at management group level. @param policyDefinitionName The name of the policy definition to delete. @param managementGroupId The ID of the management group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "policy", "definition", "at", "management", "group", "level", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java#L539-L541
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-maven/src/main/java/org/xwiki/extension/maven/internal/MavenUtils.java
MavenUtils.toExtensionId
public static String toExtensionId(String groupId, String artifactId, String classifier) { StringBuilder builder = new StringBuilder(); builder.append(groupId); builder.append(':'); builder.append(artifactId); if (StringUtils.isNotEmpty(classifier)) { builder.append(':'); builder.append(classifier); } return builder.toString(); }
java
public static String toExtensionId(String groupId, String artifactId, String classifier) { StringBuilder builder = new StringBuilder(); builder.append(groupId); builder.append(':'); builder.append(artifactId); if (StringUtils.isNotEmpty(classifier)) { builder.append(':'); builder.append(classifier); } return builder.toString(); }
[ "public", "static", "String", "toExtensionId", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "classifier", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "groupId", ")", ...
Create a extension identifier from Maven artifact identifier elements. @param groupId the group id @param artifactId the artifact id @param classifier the classifier @return the extension identifier
[ "Create", "a", "extension", "identifier", "from", "Maven", "artifact", "identifier", "elements", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-maven/src/main/java/org/xwiki/extension/maven/internal/MavenUtils.java#L96-L109