repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
podio/podio-java | src/main/java/com/podio/item/ItemAPI.java | ItemAPI.updateItem | public void updateItem(int itemId, ItemUpdate update, boolean silent, boolean hook) {
getResourceFactory().getApiResource("/item/" + itemId)
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateItem(int itemId, ItemUpdate update, boolean silent, boolean hook) {
getResourceFactory().getApiResource("/item/" + itemId)
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateItem",
"(",
"int",
"itemId",
",",
"ItemUpdate",
"update",
",",
"boolean",
"silent",
",",
"boolean",
"hook",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/item/\"",
"+",
"itemId",
")",
".",
"queryParam",
"(... | Updates the entire item. Only fields which have values specified will be
updated. To delete the contents of a field, pass an empty array for the
value.
@param itemId
The id of the item to update
@param update
The data for the update
@param silent
True if the update should be silent, false otherwise
@param hook
True if hooks should be executed for the change, false otherwise | [
"Updates",
"the",
"entire",
"item",
".",
"Only",
"fields",
"which",
"have",
"values",
"specified",
"will",
"be",
"updated",
".",
"To",
"delete",
"the",
"contents",
"of",
"a",
"field",
"pass",
"an",
"empty",
"array",
"for",
"the",
"value",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/item/ItemAPI.java#L78-L83 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.createFileListIterator | public FileListIterator createFileListIterator(String bucket, String prefix, int limit, String delimiter) {
return new FileListIterator(bucket, prefix, limit, delimiter);
} | java | public FileListIterator createFileListIterator(String bucket, String prefix, int limit, String delimiter) {
return new FileListIterator(bucket, prefix, limit, delimiter);
} | [
"public",
"FileListIterator",
"createFileListIterator",
"(",
"String",
"bucket",
",",
"String",
"prefix",
",",
"int",
"limit",
",",
"String",
"delimiter",
")",
"{",
"return",
"new",
"FileListIterator",
"(",
"bucket",
",",
"prefix",
",",
"limit",
",",
"delimiter"... | 根据前缀获取文件列表的迭代器
@param bucket 空间名
@param prefix 文件名前缀
@param limit 每次迭代的长度限制,最大1000,推荐值 100
@param delimiter 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串
@return FileInfo迭代器 | [
"根据前缀获取文件列表的迭代器"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L149-L151 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java | RepositoryReaderImpl.getLogListForServerInstance | public ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after, final LogRecordHeaderFilter filter) {
if (after instanceof RepositoryPointerImpl) {
ServerInstanceByPointer instance = new ServerInstanceByPointer((RepositoryPointerImpl) after);
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST;
}
if (instance.record != null) {
return new ServerInstanceLogRecordListHeaderPointerImpl(instance.logs, instance.traces, instance.switched, (RepositoryPointerImpl) after, instance.record, filter, -1);
}
// Neither trace nor log contain the location which means that file containing
// it was purged already and that we can just return all the records we can find.
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, instance.switched) {
@Override
public OnePidRecordListImpl queryResult(
LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
};
} else if (after != null) {
throw new IllegalArgumentException("This method accept only RepositoryPointer instances retrieved from previously read records");
}
return getLogListForServerInstance((Date) null, filter);
} | java | public ServerInstanceLogRecordList getLogListForServerInstance(RepositoryPointer after, final LogRecordHeaderFilter filter) {
if (after instanceof RepositoryPointerImpl) {
ServerInstanceByPointer instance = new ServerInstanceByPointer((RepositoryPointerImpl) after);
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST;
}
if (instance.record != null) {
return new ServerInstanceLogRecordListHeaderPointerImpl(instance.logs, instance.traces, instance.switched, (RepositoryPointerImpl) after, instance.record, filter, -1);
}
// Neither trace nor log contain the location which means that file containing
// it was purged already and that we can just return all the records we can find.
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, instance.switched) {
@Override
public OnePidRecordListImpl queryResult(
LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
};
} else if (after != null) {
throw new IllegalArgumentException("This method accept only RepositoryPointer instances retrieved from previously read records");
}
return getLogListForServerInstance((Date) null, filter);
} | [
"public",
"ServerInstanceLogRecordList",
"getLogListForServerInstance",
"(",
"RepositoryPointer",
"after",
",",
"final",
"LogRecordHeaderFilter",
"filter",
")",
"{",
"if",
"(",
"after",
"instanceof",
"RepositoryPointerImpl",
")",
"{",
"ServerInstanceByPointer",
"instance",
... | returns log records from the binary repository that are beyond a given repository location and satisfies the filter criteria as specified
by the parameters. Callers would have to invoke {@link RepositoryLogRecord#getRepositoryPointer()} to obtain the RepositoryPointer
of the last record read. The returned logs will be from the same server instance.
@param after RepositoryPointer of the last read log record.
@param filter an instance implementing {@link LogRecordHeaderFilter} interface to verify one record at a time.
@return the iterable list of log records | [
"returns",
"log",
"records",
"from",
"the",
"binary",
"repository",
"that",
"are",
"beyond",
"a",
"given",
"repository",
"location",
"and",
"satisfies",
"the",
"filter",
"criteria",
"as",
"specified",
"by",
"the",
"parameters",
".",
"Callers",
"would",
"have",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java#L846-L872 |
GoogleCloudPlatform/google-cloud-datastore | java/datastore/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java | DatastoreHelper.getServiceAccountCredential | public static Credential getServiceAccountCredential(String serviceAccountId,
String privateKeyFile, Collection<String> serviceAccountScopes)
throws GeneralSecurityException, IOException {
return getCredentialBuilderWithoutPrivateKey(serviceAccountId, serviceAccountScopes)
.setServiceAccountPrivateKeyFromP12File(new File(privateKeyFile))
.build();
} | java | public static Credential getServiceAccountCredential(String serviceAccountId,
String privateKeyFile, Collection<String> serviceAccountScopes)
throws GeneralSecurityException, IOException {
return getCredentialBuilderWithoutPrivateKey(serviceAccountId, serviceAccountScopes)
.setServiceAccountPrivateKeyFromP12File(new File(privateKeyFile))
.build();
} | [
"public",
"static",
"Credential",
"getServiceAccountCredential",
"(",
"String",
"serviceAccountId",
",",
"String",
"privateKeyFile",
",",
"Collection",
"<",
"String",
">",
"serviceAccountScopes",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"return"... | Constructs credentials for the given account and key file.
@param serviceAccountId service account ID (typically an e-mail address).
@param privateKeyFile the file name from which to get the private key.
@param serviceAccountScopes Collection of OAuth scopes to use with the the service
account flow or {@code null} if not.
@return valid credentials or {@code null} | [
"Constructs",
"credentials",
"for",
"the",
"given",
"account",
"and",
"key",
"file",
"."
] | train | https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/java/datastore/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java#L177-L183 |
apache/incubator-shardingsphere | sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/SQLLogger.java | SQLLogger.logSQL | public static void logSQL(final String logicSQL, final boolean showSimple, final SQLStatement sqlStatement, final Collection<RouteUnit> routeUnits) {
log("Rule Type: sharding");
log("Logic SQL: {}", logicSQL);
log("SQLStatement: {}", sqlStatement);
if (showSimple) {
logSimpleMode(routeUnits);
} else {
logNormalMode(routeUnits);
}
} | java | public static void logSQL(final String logicSQL, final boolean showSimple, final SQLStatement sqlStatement, final Collection<RouteUnit> routeUnits) {
log("Rule Type: sharding");
log("Logic SQL: {}", logicSQL);
log("SQLStatement: {}", sqlStatement);
if (showSimple) {
logSimpleMode(routeUnits);
} else {
logNormalMode(routeUnits);
}
} | [
"public",
"static",
"void",
"logSQL",
"(",
"final",
"String",
"logicSQL",
",",
"final",
"boolean",
"showSimple",
",",
"final",
"SQLStatement",
"sqlStatement",
",",
"final",
"Collection",
"<",
"RouteUnit",
">",
"routeUnits",
")",
"{",
"log",
"(",
"\"Rule Type: sh... | Print SQL log for sharding rule.
@param logicSQL logic SQL
@param showSimple whether show SQL in simple style
@param sqlStatement SQL statement
@param routeUnits route units | [
"Print",
"SQL",
"log",
"for",
"sharding",
"rule",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/SQLLogger.java#L59-L68 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rel/PartialDruidQuery.java | PartialDruidQuery.leafRel | public RelNode leafRel()
{
final Stage currentStage = stage();
switch (currentStage) {
case SORT_PROJECT:
return sortProject;
case SORT:
return sort;
case AGGREGATE_PROJECT:
return aggregateProject;
case HAVING_FILTER:
return havingFilter;
case AGGREGATE:
return aggregate;
case SELECT_SORT:
return selectSort;
case SELECT_PROJECT:
return selectProject;
case WHERE_FILTER:
return whereFilter;
case SCAN:
return scan;
default:
throw new ISE("WTF?! Unknown stage: %s", currentStage);
}
} | java | public RelNode leafRel()
{
final Stage currentStage = stage();
switch (currentStage) {
case SORT_PROJECT:
return sortProject;
case SORT:
return sort;
case AGGREGATE_PROJECT:
return aggregateProject;
case HAVING_FILTER:
return havingFilter;
case AGGREGATE:
return aggregate;
case SELECT_SORT:
return selectSort;
case SELECT_PROJECT:
return selectProject;
case WHERE_FILTER:
return whereFilter;
case SCAN:
return scan;
default:
throw new ISE("WTF?! Unknown stage: %s", currentStage);
}
} | [
"public",
"RelNode",
"leafRel",
"(",
")",
"{",
"final",
"Stage",
"currentStage",
"=",
"stage",
"(",
")",
";",
"switch",
"(",
"currentStage",
")",
"{",
"case",
"SORT_PROJECT",
":",
"return",
"sortProject",
";",
"case",
"SORT",
":",
"return",
"sort",
";",
... | Returns the rel at the end of the query. It will match the stage returned from {@link #stage()}.
@return leaf rel | [
"Returns",
"the",
"rel",
"at",
"the",
"end",
"of",
"the",
"query",
".",
"It",
"will",
"match",
"the",
"stage",
"returned",
"from",
"{",
"@link",
"#stage",
"()",
"}",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rel/PartialDruidQuery.java#L397-L423 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/DbxUploader.java | DbxUploader.uploadAndFinish | public R uploadAndFinish(InputStream in, IOUtil.ProgressListener progressListener) throws X, DbxException, IOException {
try {
try {
httpUploader.setProgressListener(progressListener);
httpUploader.upload(in);
} catch (IOUtil.ReadException ex) {
throw ex.getCause();
} catch (IOException ex) {
// write exceptions and everything else is a Network I/O problem
throw new NetworkIOException(ex);
}
return finish();
} finally {
close();
}
} | java | public R uploadAndFinish(InputStream in, IOUtil.ProgressListener progressListener) throws X, DbxException, IOException {
try {
try {
httpUploader.setProgressListener(progressListener);
httpUploader.upload(in);
} catch (IOUtil.ReadException ex) {
throw ex.getCause();
} catch (IOException ex) {
// write exceptions and everything else is a Network I/O problem
throw new NetworkIOException(ex);
}
return finish();
} finally {
close();
}
} | [
"public",
"R",
"uploadAndFinish",
"(",
"InputStream",
"in",
",",
"IOUtil",
".",
"ProgressListener",
"progressListener",
")",
"throws",
"X",
",",
"DbxException",
",",
"IOException",
"{",
"try",
"{",
"try",
"{",
"httpUploader",
".",
"setProgressListener",
"(",
"pr... | This method is the same as {@link #uploadAndFinish(InputStream, long)} except for it allow
tracking the upload progress.
@param in {@code InputStream} containing data to upload
@param progressListener {@code OUtil.ProgressListener} to track the upload progress.
Only support OKHttpRequester and StandardHttpRequester.
@return Response from server
@throws X if the server sent an error response for the request
@throws DbxException if an error occurs uploading the data or reading the response
@throws IOException if an error occurs reading the input stream.
@throws IllegalStateException if this uploader has already been closed (see {@link #close}) or finished (see {@link #finish}) | [
"This",
"method",
"is",
"the",
"same",
"as",
"{",
"@link",
"#uploadAndFinish",
"(",
"InputStream",
"long",
")",
"}",
"except",
"for",
"it",
"allow",
"tracking",
"the",
"upload",
"progress",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/DbxUploader.java#L114-L130 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java | AvailabilitySetsInner.createOrUpdate | public AvailabilitySetInner createOrUpdate(String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, availabilitySetName, parameters).toBlocking().single().body();
} | java | public AvailabilitySetInner createOrUpdate(String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, availabilitySetName, parameters).toBlocking().single().body();
} | [
"public",
"AvailabilitySetInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"availabilitySetName",
",",
"AvailabilitySetInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"availabilitySet... | Create or update an availability set.
@param resourceGroupName The name of the resource group.
@param availabilitySetName The name of the availability set.
@param parameters Parameters supplied to the Create Availability Set operation.
@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
@return the AvailabilitySetInner object if successful. | [
"Create",
"or",
"update",
"an",
"availability",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java#L96-L98 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java | UiPlugin.contains | public static boolean contains(Element parent, Element descendant) {
return parent != descendant && parent.isOrHasChild(descendant);
} | java | public static boolean contains(Element parent, Element descendant) {
return parent != descendant && parent.isOrHasChild(descendant);
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Element",
"parent",
",",
"Element",
"descendant",
")",
"{",
"return",
"parent",
"!=",
"descendant",
"&&",
"parent",
".",
"isOrHasChild",
"(",
"descendant",
")",
";",
"}"
] | Return true if the <code>descendant</code> is a child of the parent. Return false elsewhere. | [
"Return",
"true",
"if",
"the",
"<code",
">",
"descendant<",
"/",
"code",
">",
"is",
"a",
"child",
"of",
"the",
"parent",
".",
"Return",
"false",
"elsewhere",
"."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java#L139-L141 |
jenkinsci/jenkins | core/src/main/java/jenkins/util/AntClassLoader.java | AntClassLoader.findClassInComponents | private Class findClassInComponents(String name)
throws ClassNotFoundException {
// we need to search the components of the path to see if
// we can find the class we want.
String classFilename = getClassFilename(name);
Enumeration e = pathComponents.elements();
while (e.hasMoreElements()) {
File pathComponent = (File) e.nextElement();
try (final InputStream stream = getResourceStream(pathComponent, classFilename)) {
if (stream != null) {
log("Loaded from " + pathComponent + " "
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
} catch (SecurityException se) {
throw se;
} catch (IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
}
}
throw new ClassNotFoundException(name);
} | java | private Class findClassInComponents(String name)
throws ClassNotFoundException {
// we need to search the components of the path to see if
// we can find the class we want.
String classFilename = getClassFilename(name);
Enumeration e = pathComponents.elements();
while (e.hasMoreElements()) {
File pathComponent = (File) e.nextElement();
try (final InputStream stream = getResourceStream(pathComponent, classFilename)) {
if (stream != null) {
log("Loaded from " + pathComponent + " "
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
} catch (SecurityException se) {
throw se;
} catch (IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
}
}
throw new ClassNotFoundException(name);
} | [
"private",
"Class",
"findClassInComponents",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"// we need to search the components of the path to see if",
"// we can find the class we want.",
"String",
"classFilename",
"=",
"getClassFilename",
"(",
"name",
")"... | Finds a class on the given classpath.
@param name The name of the class to be loaded. Must not be
<code>null</code>.
@return the required Class object
@exception ClassNotFoundException if the requested class does not exist
on this loader's classpath. | [
"Finds",
"a",
"class",
"on",
"the",
"given",
"classpath",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/AntClassLoader.java#L1351-L1374 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java | BackupEnginesInner.getWithServiceResponseAsync | public Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>> getWithServiceResponseAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) {
return getSinglePageAsync(vaultName, resourceGroupName, filter, skipToken)
.concatMap(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>> getWithServiceResponseAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) {
return getSinglePageAsync(vaultName, resourceGroupName, filter, skipToken)
.concatMap(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<BackupEngineBaseResourceInner>>> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"BackupEngineBaseResourceInner",
">",
">",
">",
"getWithServiceResponseAsync",
"(",
"final",
"String",
"vaultName",
",",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"filter",
",",
... | The backup management servers registered to a Recovery Services vault. This returns a pageable list of servers.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param filter Use this filter to choose the specific backup management server. backupManagementType { AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql }.
@param skipToken The Skip Token filter.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BackupEngineBaseResourceInner> object | [
"The",
"backup",
"management",
"servers",
"registered",
"to",
"a",
"Recovery",
"Services",
"vault",
".",
"This",
"returns",
"a",
"pageable",
"list",
"of",
"servers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java#L262-L274 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/RetireJsAnalyzer.java | RetireJsAnalyzer.prepareFileTypeAnalyzer | @Override
protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException {
File repoFile = null;
try {
repoFile = new File(getSettings().getDataDirectory(), "jsrepository.json");
} catch (FileNotFoundException ex) {
this.setEnabled(false);
throw new InitializationException(String.format("RetireJS repo does not exist locally (%s)", repoFile), ex);
} catch (IOException ex) {
this.setEnabled(false);
throw new InitializationException("Failed to initialize the RetireJS repo - data directory could not be created", ex);
}
try (FileInputStream in = new FileInputStream(repoFile)) {
this.jsRepository = new VulnerabilitiesRepositoryLoader().loadFromInputStream(in);
} catch (IOException ex) {
this.setEnabled(false);
throw new InitializationException("Failed to initialize the RetireJS repo", ex);
}
} | java | @Override
protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException {
File repoFile = null;
try {
repoFile = new File(getSettings().getDataDirectory(), "jsrepository.json");
} catch (FileNotFoundException ex) {
this.setEnabled(false);
throw new InitializationException(String.format("RetireJS repo does not exist locally (%s)", repoFile), ex);
} catch (IOException ex) {
this.setEnabled(false);
throw new InitializationException("Failed to initialize the RetireJS repo - data directory could not be created", ex);
}
try (FileInputStream in = new FileInputStream(repoFile)) {
this.jsRepository = new VulnerabilitiesRepositoryLoader().loadFromInputStream(in);
} catch (IOException ex) {
this.setEnabled(false);
throw new InitializationException("Failed to initialize the RetireJS repo", ex);
}
} | [
"@",
"Override",
"protected",
"void",
"prepareFileTypeAnalyzer",
"(",
"Engine",
"engine",
")",
"throws",
"InitializationException",
"{",
"File",
"repoFile",
"=",
"null",
";",
"try",
"{",
"repoFile",
"=",
"new",
"File",
"(",
"getSettings",
"(",
")",
".",
"getDa... | {@inheritDoc}
@param engine a reference to the dependency-check engine
@throws InitializationException thrown if there is an exception during
initialization | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RetireJsAnalyzer.java#L166-L185 |
hdinsight/storm-eventhubs | src/main/java/org/apache/storm/eventhubs/spout/EventHubSpout.java | EventHubSpout.preparePartitions | public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
this.collector = collector;
if(stateStore == null) {
String zkEndpointAddress = eventHubConfig.getZkConnectionString();
if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
//use storm's zookeeper servers if not specified.
@SuppressWarnings("unchecked")
List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
StringBuilder sb = new StringBuilder();
for (String zk : zkServers) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(zk+":"+zkPort);
}
zkEndpointAddress = sb.toString();
}
stateStore = new ZookeeperStateStore(zkEndpointAddress,
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
}
stateStore.open();
partitionCoordinator = new StaticPartitionCoordinator(
eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);
for (IPartitionManager partitionManager :
partitionCoordinator.getMyPartitionManagers()) {
partitionManager.open();
}
} | java | public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
this.collector = collector;
if(stateStore == null) {
String zkEndpointAddress = eventHubConfig.getZkConnectionString();
if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
//use storm's zookeeper servers if not specified.
@SuppressWarnings("unchecked")
List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
StringBuilder sb = new StringBuilder();
for (String zk : zkServers) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(zk+":"+zkPort);
}
zkEndpointAddress = sb.toString();
}
stateStore = new ZookeeperStateStore(zkEndpointAddress,
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
}
stateStore.open();
partitionCoordinator = new StaticPartitionCoordinator(
eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);
for (IPartitionManager partitionManager :
partitionCoordinator.getMyPartitionManagers()) {
partitionManager.open();
}
} | [
"public",
"void",
"preparePartitions",
"(",
"Map",
"config",
",",
"int",
"totalTasks",
",",
"int",
"taskIndex",
",",
"SpoutOutputCollector",
"collector",
")",
"throws",
"Exception",
"{",
"this",
".",
"collector",
"=",
"collector",
";",
"if",
"(",
"stateStore",
... | This is a extracted method that is easy to test
@param config
@param totalTasks
@param taskIndex
@param collector
@throws Exception | [
"This",
"is",
"a",
"extracted",
"method",
"that",
"is",
"easy",
"to",
"test"
] | train | https://github.com/hdinsight/storm-eventhubs/blob/86c99201e6df5e1caee3f664de8843bd656c0f1c/src/main/java/org/apache/storm/eventhubs/spout/EventHubSpout.java#L105-L136 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java | DistanceCorrelationDependenceMeasure.computeDCovar | protected double computeDCovar(double[] dVarMatrixA, double[] dVarMatrixB, int n) {
double result = 0.;
for(int i = 0, c = 0; i < n; i++) {
for(int j = 0; j < i; j++) {
result += 2. * dVarMatrixA[c] * dVarMatrixB[c];
c++;
}
// Diagonal entry.
result += dVarMatrixA[c] * dVarMatrixB[c];
c++;
}
return result / (n * n);
} | java | protected double computeDCovar(double[] dVarMatrixA, double[] dVarMatrixB, int n) {
double result = 0.;
for(int i = 0, c = 0; i < n; i++) {
for(int j = 0; j < i; j++) {
result += 2. * dVarMatrixA[c] * dVarMatrixB[c];
c++;
}
// Diagonal entry.
result += dVarMatrixA[c] * dVarMatrixB[c];
c++;
}
return result / (n * n);
} | [
"protected",
"double",
"computeDCovar",
"(",
"double",
"[",
"]",
"dVarMatrixA",
",",
"double",
"[",
"]",
"dVarMatrixB",
",",
"int",
"n",
")",
"{",
"double",
"result",
"=",
"0.",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"c",
"=",
"0",
";",
"i",
... | Computes the distance covariance for two axis. Can also be used to compute
the distance variance of one axis (dVarMatrixA = dVarMatrixB).
@param dVarMatrixA distance variance matrix of the first axis
@param dVarMatrixB distance variance matrix of the second axis
@param n number of points
@return distance covariance | [
"Computes",
"the",
"distance",
"covariance",
"for",
"two",
"axis",
".",
"Can",
"also",
"be",
"used",
"to",
"compute",
"the",
"distance",
"variance",
"of",
"one",
"axis",
"(",
"dVarMatrixA",
"=",
"dVarMatrixB",
")",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java#L178-L190 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ConsumerService.java | ConsumerService.dispatchMessages | protected void dispatchMessages(String channel, Message message, Set<IMessageCallback> callbacks) {
for (IMessageCallback callback : callbacks) {
try {
callback.onMessage(channel, message);
} catch (Exception e) {
}
}
} | java | protected void dispatchMessages(String channel, Message message, Set<IMessageCallback> callbacks) {
for (IMessageCallback callback : callbacks) {
try {
callback.onMessage(channel, message);
} catch (Exception e) {
}
}
} | [
"protected",
"void",
"dispatchMessages",
"(",
"String",
"channel",
",",
"Message",
"message",
",",
"Set",
"<",
"IMessageCallback",
">",
"callbacks",
")",
"{",
"for",
"(",
"IMessageCallback",
"callback",
":",
"callbacks",
")",
"{",
"try",
"{",
"callback",
".",
... | Dispatch message to callback. Override to address special threading considerations.
@param channel The channel that delivered the message.
@param message The message to dispatch.
@param callbacks The callbacks to receive the message. | [
"Dispatch",
"message",
"to",
"callback",
".",
"Override",
"to",
"address",
"special",
"threading",
"considerations",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ConsumerService.java#L186-L194 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdateWorkerPool | public WorkerPoolResourceInner createOrUpdateWorkerPool(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
return createOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).toBlocking().last().body();
} | java | public WorkerPoolResourceInner createOrUpdateWorkerPool(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
return createOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).toBlocking().last().body();
} | [
"public",
"WorkerPoolResourceInner",
"createOrUpdateWorkerPool",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerPoolName",
",",
"WorkerPoolResourceInner",
"workerPoolEnvelope",
")",
"{",
"return",
"createOrUpdateWorkerPoolWithServiceResponseAsync... | Create or update a worker pool.
Create or update a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param workerPoolEnvelope Properties of the worker pool.
@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
@return the WorkerPoolResourceInner object if successful. | [
"Create",
"or",
"update",
"a",
"worker",
"pool",
".",
"Create",
"or",
"update",
"a",
"worker",
"pool",
"."
] | 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/AppServiceEnvironmentsInner.java#L5190-L5192 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.removeKeys | public static <E> void removeKeys(Counter<E> counter, Collection<E> removeKeysCollection) {
for (E key : removeKeysCollection)
counter.remove(key);
} | java | public static <E> void removeKeys(Counter<E> counter, Collection<E> removeKeysCollection) {
for (E key : removeKeysCollection)
counter.remove(key);
} | [
"public",
"static",
"<",
"E",
">",
"void",
"removeKeys",
"(",
"Counter",
"<",
"E",
">",
"counter",
",",
"Collection",
"<",
"E",
">",
"removeKeysCollection",
")",
"{",
"for",
"(",
"E",
"key",
":",
"removeKeysCollection",
")",
"counter",
".",
"remove",
"("... | Removes all entries with keys in the given collection
@param <E>
@param counter
@param removeKeysCollection | [
"Removes",
"all",
"entries",
"with",
"keys",
"in",
"the",
"given",
"collection"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L680-L684 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.decryptOpenPgpElement | public OpenPgpMessage decryptOpenPgpElement(OpenPgpElement element, OpenPgpContact sender)
throws SmackException.NotLoggedInException, IOException, PGPException {
return provider.decryptAndOrVerify(element, getOpenPgpSelf(), sender);
} | java | public OpenPgpMessage decryptOpenPgpElement(OpenPgpElement element, OpenPgpContact sender)
throws SmackException.NotLoggedInException, IOException, PGPException {
return provider.decryptAndOrVerify(element, getOpenPgpSelf(), sender);
} | [
"public",
"OpenPgpMessage",
"decryptOpenPgpElement",
"(",
"OpenPgpElement",
"element",
",",
"OpenPgpContact",
"sender",
")",
"throws",
"SmackException",
".",
"NotLoggedInException",
",",
"IOException",
",",
"PGPException",
"{",
"return",
"provider",
".",
"decryptAndOrVeri... | Decrypt and or verify an {@link OpenPgpElement} and return the decrypted {@link OpenPgpMessage}.
@param element {@link OpenPgpElement} containing the message.
@param sender {@link OpenPgpContact} who sent the message.
@return decrypted and/or verified message
@throws SmackException.NotLoggedInException in case we aren't logged in (we need to know our jid)
@throws IOException IO error (reading keys, streams etc)
@throws PGPException in case of an PGP error | [
"Decrypt",
"and",
"or",
"verify",
"an",
"{",
"@link",
"OpenPgpElement",
"}",
"and",
"return",
"the",
"decrypted",
"{",
"@link",
"OpenPgpMessage",
"}",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L545-L548 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.programWithSketch | public void programWithSketch(SketchHex hex, Callback<UploadProgress> onProgress, Runnable onComplete) {
// Resetting client state means we have a clean state to start. Variables are cleared and
// the state timeout timer will not fire during firmware uploads.
resetSketchUploadState();
// Set onProgress and onComplete handlers
this.onSketchUploadProgress = onProgress;
this.onSketchUploadComplete = onComplete;
// Prepare the sketch blocks to be sent
sketchBlocksToSend = Chunk.chunksFrom(hex, MAX_BLOCK_SIZE_BYTES);
// Construct and send the START payload with sketch metadata
SketchMetadata metadata = SketchMetadata.create(hex, new Date());
Buffer payload = metadata.toPayload();
// If there's no data in the hex sketch, send the empty metadata to clear the Bean's sketch
// and don't worry about sending sketch blocks
if (hex.bytes().length > 0) {
sketchUploadState = SketchUploadState.SENDING_START_COMMAND;
resetSketchStateTimeout();
}
sendMessage(BeanMessageID.BL_CMD_START, payload);
} | java | public void programWithSketch(SketchHex hex, Callback<UploadProgress> onProgress, Runnable onComplete) {
// Resetting client state means we have a clean state to start. Variables are cleared and
// the state timeout timer will not fire during firmware uploads.
resetSketchUploadState();
// Set onProgress and onComplete handlers
this.onSketchUploadProgress = onProgress;
this.onSketchUploadComplete = onComplete;
// Prepare the sketch blocks to be sent
sketchBlocksToSend = Chunk.chunksFrom(hex, MAX_BLOCK_SIZE_BYTES);
// Construct and send the START payload with sketch metadata
SketchMetadata metadata = SketchMetadata.create(hex, new Date());
Buffer payload = metadata.toPayload();
// If there's no data in the hex sketch, send the empty metadata to clear the Bean's sketch
// and don't worry about sending sketch blocks
if (hex.bytes().length > 0) {
sketchUploadState = SketchUploadState.SENDING_START_COMMAND;
resetSketchStateTimeout();
}
sendMessage(BeanMessageID.BL_CMD_START, payload);
} | [
"public",
"void",
"programWithSketch",
"(",
"SketchHex",
"hex",
",",
"Callback",
"<",
"UploadProgress",
">",
"onProgress",
",",
"Runnable",
"onComplete",
")",
"{",
"// Resetting client state means we have a clean state to start. Variables are cleared and",
"// the state timeout t... | Programs the Bean with an Arduino sketch in hex form. The Bean's sketch name and
programmed-at timestamp will be set from the
{@link com.punchthrough.bean.sdk.upload.SketchHex} object.
@param hex The sketch to be sent to the Bean
@param onProgress Called with progress while the sketch upload is occurring
@param onComplete Called when the sketch upload is complete | [
"Programs",
"the",
"Bean",
"with",
"an",
"Arduino",
"sketch",
"in",
"hex",
"form",
".",
"The",
"Bean",
"s",
"sketch",
"name",
"and",
"programmed",
"-",
"at",
"timestamp",
"will",
"be",
"set",
"from",
"the",
"{",
"@link",
"com",
".",
"punchthrough",
".",
... | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L1107-L1133 |
Impetus/Kundera | src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java | OracleNoSQLClient.findByRelation | @Override
public List<Object> findByRelation(String colName, Object colValue, Class entityClazz)
{
// find by relational value !
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);
MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
entityMetadata.getPersistenceUnit());
EntityType entityType = metamodel.entity(entityMetadata.getEntityClazz());
Table schemaTable = tableAPI.getTable(entityMetadata.getTableName());
Iterator<Row> rowsIter = null;
if (schemaTable.getPrimaryKey().contains(colName))
{
PrimaryKey rowKey = schemaTable.createPrimaryKey();
NoSqlDBUtils.add(schemaTable.getField(colName), rowKey, colValue, colName);
rowsIter = tableAPI.tableIterator(rowKey, null, null);
}
else
{
Index index = schemaTable.getIndex(colName);
IndexKey indexKey = index.createIndexKey();
NoSqlDBUtils.add(schemaTable.getField(colName), indexKey, colValue, colName);
rowsIter = tableAPI.tableIterator(indexKey, null, null);
}
try
{
Map<String, Object> relationMap = initialize(entityMetadata);
return scrollAndPopulate(null, entityMetadata, metamodel, schemaTable, rowsIter, relationMap, null);
}
catch (Exception e)
{
log.error("Error while finding data for Key " + colName + ", Caused By :" + e + ".");
throw new PersistenceException(e);
}
} | java | @Override
public List<Object> findByRelation(String colName, Object colValue, Class entityClazz)
{
// find by relational value !
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);
MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
entityMetadata.getPersistenceUnit());
EntityType entityType = metamodel.entity(entityMetadata.getEntityClazz());
Table schemaTable = tableAPI.getTable(entityMetadata.getTableName());
Iterator<Row> rowsIter = null;
if (schemaTable.getPrimaryKey().contains(colName))
{
PrimaryKey rowKey = schemaTable.createPrimaryKey();
NoSqlDBUtils.add(schemaTable.getField(colName), rowKey, colValue, colName);
rowsIter = tableAPI.tableIterator(rowKey, null, null);
}
else
{
Index index = schemaTable.getIndex(colName);
IndexKey indexKey = index.createIndexKey();
NoSqlDBUtils.add(schemaTable.getField(colName), indexKey, colValue, colName);
rowsIter = tableAPI.tableIterator(indexKey, null, null);
}
try
{
Map<String, Object> relationMap = initialize(entityMetadata);
return scrollAndPopulate(null, entityMetadata, metamodel, schemaTable, rowsIter, relationMap, null);
}
catch (Exception e)
{
log.error("Error while finding data for Key " + colName + ", Caused By :" + e + ".");
throw new PersistenceException(e);
}
} | [
"@",
"Override",
"public",
"List",
"<",
"Object",
">",
"findByRelation",
"(",
"String",
"colName",
",",
"Object",
"colValue",
",",
"Class",
"entityClazz",
")",
"{",
"// find by relational value !",
"EntityMetadata",
"entityMetadata",
"=",
"KunderaMetadataManager",
"."... | Find by relational column name and value.
@param colName
the col name
@param colValue
the col value
@param entityClazz
the entity clazz
@return the list | [
"Find",
"by",
"relational",
"column",
"name",
"and",
"value",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L715-L755 |
aws/aws-sdk-java | aws-java-sdk-cloudwatch/src/main/java/com/amazonaws/services/cloudwatch/model/Datapoint.java | Datapoint.withExtendedStatistics | public Datapoint withExtendedStatistics(java.util.Map<String, Double> extendedStatistics) {
setExtendedStatistics(extendedStatistics);
return this;
} | java | public Datapoint withExtendedStatistics(java.util.Map<String, Double> extendedStatistics) {
setExtendedStatistics(extendedStatistics);
return this;
} | [
"public",
"Datapoint",
"withExtendedStatistics",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Double",
">",
"extendedStatistics",
")",
"{",
"setExtendedStatistics",
"(",
"extendedStatistics",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The percentile statistic for the data point.
</p>
@param extendedStatistics
The percentile statistic for the data point.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"percentile",
"statistic",
"for",
"the",
"data",
"point",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudwatch/src/main/java/com/amazonaws/services/cloudwatch/model/Datapoint.java#L426-L429 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java | ExceptionSoftening.updateEndPCsOnCatchRegScope | private void updateEndPCsOnCatchRegScope(List<CatchInfo> infos, int pc, int seen) {
if (lvt != null) {
for (CatchInfo ci : infos) {
if ((ci.getStart() == pc) && OpcodeUtils.isAStore(seen)) {
int exReg = RegisterUtils.getAStoreReg(this, seen);
LocalVariable lv = lvt.getLocalVariable(exReg, pc + 1);
if (lv != null) {
ci.setFinish(lv.getStartPC() + lv.getLength());
}
break;
}
}
}
} | java | private void updateEndPCsOnCatchRegScope(List<CatchInfo> infos, int pc, int seen) {
if (lvt != null) {
for (CatchInfo ci : infos) {
if ((ci.getStart() == pc) && OpcodeUtils.isAStore(seen)) {
int exReg = RegisterUtils.getAStoreReg(this, seen);
LocalVariable lv = lvt.getLocalVariable(exReg, pc + 1);
if (lv != null) {
ci.setFinish(lv.getStartPC() + lv.getLength());
}
break;
}
}
}
} | [
"private",
"void",
"updateEndPCsOnCatchRegScope",
"(",
"List",
"<",
"CatchInfo",
">",
"infos",
",",
"int",
"pc",
",",
"int",
"seen",
")",
"{",
"if",
"(",
"lvt",
"!=",
"null",
")",
"{",
"for",
"(",
"CatchInfo",
"ci",
":",
"infos",
")",
"{",
"if",
"(",... | reduces the end pc based on the optional LocalVariableTable's exception
register scope
@param infos the list of active catch blocks
@param pc the current pc
@param seen the currently parsed opcode | [
"reduces",
"the",
"end",
"pc",
"based",
"on",
"the",
"optional",
"LocalVariableTable",
"s",
"exception",
"register",
"scope"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L332-L345 |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/base/AnnotationUtilImpl.java | AnnotationUtilImpl.getInterfacesAnnotation | private <A extends Annotation> A getInterfacesAnnotation(Class<?> annotatedType, Class<A> annotation) {
Class<?>[] interfaces = annotatedType.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
A result = interfaces[i].getAnnotation(annotation);
if (result != null) {
return result;
}
}
for (int i = 0; i < interfaces.length; i++) {
A result = getInterfacesAnnotation(interfaces[i], annotation);
if (result != null) {
return result;
}
}
return null;
} | java | private <A extends Annotation> A getInterfacesAnnotation(Class<?> annotatedType, Class<A> annotation) {
Class<?>[] interfaces = annotatedType.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
A result = interfaces[i].getAnnotation(annotation);
if (result != null) {
return result;
}
}
for (int i = 0; i < interfaces.length; i++) {
A result = getInterfacesAnnotation(interfaces[i], annotation);
if (result != null) {
return result;
}
}
return null;
} | [
"private",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getInterfacesAnnotation",
"(",
"Class",
"<",
"?",
">",
"annotatedType",
",",
"Class",
"<",
"A",
">",
"annotation",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"annotatedType",
".... | This method gets the first {@link Class#getAnnotation(Class) annotation} of the type given by {@code annotation} in
the {@link Class#getInterfaces() hierarchy} of the given {@code annotatedInterface} . <br>
This method is only useful if the given {@code annotation} is a {@link #isRuntimeAnnotation(Class) runtime
annotation} that is {@link #isAnnotationForType(Class, ElementType) applicable} for {@link ElementType#TYPE
classes}.
@param <A> is the type of the requested annotation.
@param annotatedType is the type potentially implementing an interface annotated with the given {@code annotation}.
This should NOT be an {@link Class#isPrimitive() primitive}, {@link Class#isArray() array},
{@link Class#isEnum() enum}, or {@link Class#isAnnotation() annotation}.
@param annotation is the type of the requested annotation.
@return the requested annotation or {@code null} if neither the {@code annotatedInterface} nor one of its
{@link Class#getInterfaces() super-interfaces} are {@link Class#getAnnotation(Class) annotated} with the
given {@code annotation}. | [
"This",
"method",
"gets",
"the",
"first",
"{",
"@link",
"Class#getAnnotation",
"(",
"Class",
")",
"annotation",
"}",
"of",
"the",
"type",
"given",
"by",
"{",
"@code",
"annotation",
"}",
"in",
"the",
"{",
"@link",
"Class#getInterfaces",
"()",
"hierarchy",
"}"... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/AnnotationUtilImpl.java#L156-L172 |
google/closure-compiler | src/com/google/javascript/jscomp/TypedCodeGenerator.java | TypedCodeGenerator.appendClassAnnotations | private void appendClassAnnotations(StringBuilder sb, FunctionType funType) {
FunctionType superConstructor = funType.getInstanceType().getSuperClassConstructor();
if (superConstructor != null) {
ObjectType superInstance = superConstructor.getInstanceType();
if (!superInstance.toString().equals("Object")) {
sb.append(" * ");
appendAnnotation(sb, "extends", superInstance.toAnnotationString(Nullability.IMPLICIT));
sb.append("\n");
}
}
// Avoid duplicates, add implemented type to a set first
Set<String> interfaces = new TreeSet<>();
for (ObjectType interfaze : funType.getAncestorInterfaces()) {
interfaces.add(interfaze.toAnnotationString(Nullability.IMPLICIT));
}
for (String interfaze : interfaces) {
sb.append(" * ");
appendAnnotation(sb, "implements", interfaze);
sb.append("\n");
}
} | java | private void appendClassAnnotations(StringBuilder sb, FunctionType funType) {
FunctionType superConstructor = funType.getInstanceType().getSuperClassConstructor();
if (superConstructor != null) {
ObjectType superInstance = superConstructor.getInstanceType();
if (!superInstance.toString().equals("Object")) {
sb.append(" * ");
appendAnnotation(sb, "extends", superInstance.toAnnotationString(Nullability.IMPLICIT));
sb.append("\n");
}
}
// Avoid duplicates, add implemented type to a set first
Set<String> interfaces = new TreeSet<>();
for (ObjectType interfaze : funType.getAncestorInterfaces()) {
interfaces.add(interfaze.toAnnotationString(Nullability.IMPLICIT));
}
for (String interfaze : interfaces) {
sb.append(" * ");
appendAnnotation(sb, "implements", interfaze);
sb.append("\n");
}
} | [
"private",
"void",
"appendClassAnnotations",
"(",
"StringBuilder",
"sb",
",",
"FunctionType",
"funType",
")",
"{",
"FunctionType",
"superConstructor",
"=",
"funType",
".",
"getInstanceType",
"(",
")",
".",
"getSuperClassConstructor",
"(",
")",
";",
"if",
"(",
"sup... | we should print it first, like users write it. Same for @interface and @record. | [
"we",
"should",
"print",
"it",
"first",
"like",
"users",
"write",
"it",
".",
"Same",
"for"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedCodeGenerator.java#L342-L362 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateFormat | public static String dateFormat(String dateStr, String fromFormat, String toFormat, TimeZone tz) {
SimpleDateFormat fromFormatter = FORMATTER_CACHE.get(fromFormat);
fromFormatter.setTimeZone(tz);
SimpleDateFormat toFormatter = FORMATTER_CACHE.get(toFormat);
toFormatter.setTimeZone(tz);
try {
return toFormatter.format(fromFormatter.parse(dateStr));
} catch (ParseException e) {
LOG.error("Exception when formatting: '" + dateStr +
"' from: '" + fromFormat + "' to: '" + toFormat + "'", e);
return null;
}
} | java | public static String dateFormat(String dateStr, String fromFormat, String toFormat, TimeZone tz) {
SimpleDateFormat fromFormatter = FORMATTER_CACHE.get(fromFormat);
fromFormatter.setTimeZone(tz);
SimpleDateFormat toFormatter = FORMATTER_CACHE.get(toFormat);
toFormatter.setTimeZone(tz);
try {
return toFormatter.format(fromFormatter.parse(dateStr));
} catch (ParseException e) {
LOG.error("Exception when formatting: '" + dateStr +
"' from: '" + fromFormat + "' to: '" + toFormat + "'", e);
return null;
}
} | [
"public",
"static",
"String",
"dateFormat",
"(",
"String",
"dateStr",
",",
"String",
"fromFormat",
",",
"String",
"toFormat",
",",
"TimeZone",
"tz",
")",
"{",
"SimpleDateFormat",
"fromFormatter",
"=",
"FORMATTER_CACHE",
".",
"get",
"(",
"fromFormat",
")",
";",
... | Format a string datetime as specific.
@param dateStr the string datetime.
@param fromFormat the original date format.
@param toFormat the target date format.
@param tz the time zone. | [
"Format",
"a",
"string",
"datetime",
"as",
"specific",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L340-L352 |
census-instrumentation/opencensus-java | contrib/dropwizard/src/main/java/io/opencensus/contrib/dropwizard/DropWizardMetrics.java | DropWizardMetrics.collectTimer | private Metric collectTimer(String dropwizardName, Timer timer) {
String metricName = DropWizardUtils.generateFullMetricName(dropwizardName, "timer");
String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardName, timer);
return collectSnapshotAndCount(
metricName, metricDescription, NS_UNIT, timer.getSnapshot(), timer.getCount());
} | java | private Metric collectTimer(String dropwizardName, Timer timer) {
String metricName = DropWizardUtils.generateFullMetricName(dropwizardName, "timer");
String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardName, timer);
return collectSnapshotAndCount(
metricName, metricDescription, NS_UNIT, timer.getSnapshot(), timer.getCount());
} | [
"private",
"Metric",
"collectTimer",
"(",
"String",
"dropwizardName",
",",
"Timer",
"timer",
")",
"{",
"String",
"metricName",
"=",
"DropWizardUtils",
".",
"generateFullMetricName",
"(",
"dropwizardName",
",",
"\"timer\"",
")",
";",
"String",
"metricDescription",
"=... | Returns a {@code Metric} collected from {@link Timer}.
@param dropwizardName the metric name.
@param timer the timer object to collect
@return a {@code Metric}. | [
"Returns",
"a",
"{",
"@code",
"Metric",
"}",
"collected",
"from",
"{",
"@link",
"Timer",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/dropwizard/src/main/java/io/opencensus/contrib/dropwizard/DropWizardMetrics.java#L210-L215 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_ownLogs_id_userLogs_login_PUT | public void serviceName_ownLogs_id_userLogs_login_PUT(String serviceName, Long id, String login, OvhUserLogs body) throws IOException {
String qPath = "/hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}";
StringBuilder sb = path(qPath, serviceName, id, login);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_ownLogs_id_userLogs_login_PUT(String serviceName, Long id, String login, OvhUserLogs body) throws IOException {
String qPath = "/hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}";
StringBuilder sb = path(qPath, serviceName, id, login);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_ownLogs_id_userLogs_login_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"id",
",",
"String",
"login",
",",
"OvhUserLogs",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/ownLogs/{id}/userLo... | Alter this object properties
REST: PUT /hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}
@param body [required] New object properties
@param serviceName [required] The internal name of your hosting
@param id [required] Id of the object
@param login [required] The userLogs login used to connect to logs.ovh.net | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1020-L1024 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java | OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLFunctionalObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLFunctionalObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLFunctionalObjectPropertyAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}... | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java#L75-L78 |
Ellzord/JALSE | src/main/java/jalse/entities/Entities.java | Entities.withinSameTree | public static boolean withinSameTree(final EntityContainer one, final EntityContainer two) {
return Objects.equals(getRootContainer(one), getRootContainer(two));
} | java | public static boolean withinSameTree(final EntityContainer one, final EntityContainer two) {
return Objects.equals(getRootContainer(one), getRootContainer(two));
} | [
"public",
"static",
"boolean",
"withinSameTree",
"(",
"final",
"EntityContainer",
"one",
",",
"final",
"EntityContainer",
"two",
")",
"{",
"return",
"Objects",
".",
"equals",
"(",
"getRootContainer",
"(",
"one",
")",
",",
"getRootContainer",
"(",
"two",
")",
"... | Checks to see if an container is in the same tree as the other container (checking highest
parent container).
@param one
Container to check.
@param two
Container to check.
@return Whether the container is within the same tree as the other container.
@see #getRootContainer(EntityContainer) | [
"Checks",
"to",
"see",
"if",
"an",
"container",
"is",
"in",
"the",
"same",
"tree",
"as",
"the",
"other",
"container",
"(",
"checking",
"highest",
"parent",
"container",
")",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L539-L541 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java | NumberFunctions.atan | public static Expression atan(Expression expression1, Expression expression2) {
return x("ATAN(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression atan(Expression expression1, Expression expression2) {
return x("ATAN(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"atan",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"ATAN(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
"(",
"... | Returned expression results in the arctangent of expression2/expression1. | [
"Returned",
"expression",
"results",
"in",
"the",
"arctangent",
"of",
"expression2",
"/",
"expression1",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java#L97-L99 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java | AbstractFallbackRequestAndResponseControlDirContextProcessor.createRequestControl | public Control createRequestControl(Class<?>[] paramTypes, Object[] params) {
Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(requestControlClass, paramTypes);
if (constructor == null) {
throw new IllegalArgumentException("Failed to find an appropriate RequestControl constructor");
}
Control result = null;
try {
result = (Control) constructor.newInstance(params);
}
catch (Exception e) {
ReflectionUtils.handleReflectionException(e);
}
return result;
} | java | public Control createRequestControl(Class<?>[] paramTypes, Object[] params) {
Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(requestControlClass, paramTypes);
if (constructor == null) {
throw new IllegalArgumentException("Failed to find an appropriate RequestControl constructor");
}
Control result = null;
try {
result = (Control) constructor.newInstance(params);
}
catch (Exception e) {
ReflectionUtils.handleReflectionException(e);
}
return result;
} | [
"public",
"Control",
"createRequestControl",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"Constructor",
"<",
"?",
">",
"constructor",
"=",
"ClassUtils",
".",
"getConstructorIfAvailable",
"(",
"requestContro... | Creates a request control using the constructor parameters given in
<code>params</code>.
@param paramTypes Types of the constructor parameters
@param params Actual constructor parameters
@return Control to be used by the DirContextProcessor | [
"Creates",
"a",
"request",
"control",
"using",
"the",
"constructor",
"parameters",
"given",
"in",
"<code",
">",
"params<",
"/",
"code",
">",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java#L159-L174 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java | MmffAromaticTypeMapping.normaliseCycle | static boolean normaliseCycle(int[] cycle, int[] contribution) {
int offset = indexOfHetro(cycle, contribution);
if (offset < 0) return false;
if (offset == 0) return true;
int[] cpy = Arrays.copyOf(cycle, cycle.length);
int len = cycle.length - 1;
for (int j = 0; j < len; j++) {
cycle[j] = cpy[(offset + j) % len];
}
cycle[len] = cycle[0]; // make closed walk
return true;
} | java | static boolean normaliseCycle(int[] cycle, int[] contribution) {
int offset = indexOfHetro(cycle, contribution);
if (offset < 0) return false;
if (offset == 0) return true;
int[] cpy = Arrays.copyOf(cycle, cycle.length);
int len = cycle.length - 1;
for (int j = 0; j < len; j++) {
cycle[j] = cpy[(offset + j) % len];
}
cycle[len] = cycle[0]; // make closed walk
return true;
} | [
"static",
"boolean",
"normaliseCycle",
"(",
"int",
"[",
"]",
"cycle",
",",
"int",
"[",
"]",
"contribution",
")",
"{",
"int",
"offset",
"=",
"indexOfHetro",
"(",
"cycle",
",",
"contribution",
")",
";",
"if",
"(",
"offset",
"<",
"0",
")",
"return",
"fals... | Normalises a 5-member 'cycle' such that the hetroatom contributing the lone-pair is in
position 1 (index 0). The alpha atoms are then in index 1 and 4 whilst the beta atoms are in
index 2 and 3. If the ring contains more than one hetroatom the cycle is not normalised
(return=false).
@param cycle aromatic cycle to normalise, |C| = 5
@param contribution vector of p electron contributions from each vertex (size |V|)
@return whether the cycle was normalised | [
"Normalises",
"a",
"5",
"-",
"member",
"cycle",
"such",
"that",
"the",
"hetroatom",
"contributing",
"the",
"lone",
"-",
"pair",
"is",
"in",
"position",
"1",
"(",
"index",
"0",
")",
".",
"The",
"alpha",
"atoms",
"are",
"then",
"in",
"index",
"1",
"and",... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L341-L352 |
JOML-CI/JOML | src/org/joml/Vector3f.java | Vector3f.fma | public Vector3f fma(Vector3fc a, Vector3fc b) {
return fma(a, b, thisOrNew());
} | java | public Vector3f fma(Vector3fc a, Vector3fc b) {
return fma(a, b, thisOrNew());
} | [
"public",
"Vector3f",
"fma",
"(",
"Vector3fc",
"a",
",",
"Vector3fc",
"b",
")",
"{",
"return",
"fma",
"(",
"a",
",",
"b",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Add the component-wise multiplication of <code>a * b</code> to this vector.
@param a
the first multiplicand
@param b
the second multiplicand
@return a vector holding the result | [
"Add",
"the",
"component",
"-",
"wise",
"multiplication",
"of",
"<code",
">",
"a",
"*",
"b<",
"/",
"code",
">",
"to",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L590-L592 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java | KnowledgeExchangeHandler.getLong | protected Long getLong(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Long) {
return (Long)value;
} else if (value instanceof Number) {
return Long.valueOf(((Number)value).longValue());
} else if (value instanceof String) {
return Long.valueOf(((String)value).trim());
}
return null;
} | java | protected Long getLong(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Long) {
return (Long)value;
} else if (value instanceof Number) {
return Long.valueOf(((Number)value).longValue());
} else if (value instanceof String) {
return Long.valueOf(((String)value).trim());
}
return null;
} | [
"protected",
"Long",
"getLong",
"(",
"Exchange",
"exchange",
",",
"Message",
"message",
",",
"String",
"name",
")",
"{",
"Object",
"value",
"=",
"getObject",
"(",
"exchange",
",",
"message",
",",
"name",
")",
";",
"if",
"(",
"value",
"instanceof",
"Long",
... | Gets a Long context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property | [
"Gets",
"a",
"Long",
"context",
"property",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L220-L230 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.handleNodeAttributes | protected void handleNodeAttributes(Object node, Map attributes) {
// first, short circuit
if (node == null) {
return;
}
for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) {
FactoryBuilderSupport builder = this;
if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getOwner();
} else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getDelegate();
}
attrDelegate.call(builder, node, attributes);
}
if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) {
getProxyBuilder().setNodeAttributes(node, attributes);
}
} | java | protected void handleNodeAttributes(Object node, Map attributes) {
// first, short circuit
if (node == null) {
return;
}
for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) {
FactoryBuilderSupport builder = this;
if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getOwner();
} else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getDelegate();
}
attrDelegate.call(builder, node, attributes);
}
if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) {
getProxyBuilder().setNodeAttributes(node, attributes);
}
} | [
"protected",
"void",
"handleNodeAttributes",
"(",
"Object",
"node",
",",
"Map",
"attributes",
")",
"{",
"// first, short circuit",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Closure",
"attrDelegate",
":",
"getProxyBuilder",
"("... | Assigns any existing properties to the node.<br>
It will call attributeDelegates before passing control to the factory
that built the node.
@param node the object returned by tne node factory
@param attributes the attributes for the node | [
"Assigns",
"any",
"existing",
"properties",
"to",
"the",
"node",
".",
"<br",
">",
"It",
"will",
"call",
"attributeDelegates",
"before",
"passing",
"control",
"to",
"the",
"factory",
"that",
"built",
"the",
"node",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L968-L988 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java | HpelFormatter.formatRecord | public String formatRecord(RepositoryLogRecord record) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
return formatRecord(record, (Locale) null);
} | java | public String formatRecord(RepositoryLogRecord record) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
return formatRecord(record, (Locale) null);
} | [
"public",
"String",
"formatRecord",
"(",
"RepositoryLogRecord",
"record",
")",
"{",
"if",
"(",
"null",
"==",
"record",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Record cannot be null\"",
")",
";",
"}",
"return",
"formatRecord",
"(",
"record",
... | Formats a RepositoryLogRecord using the formatter's locale
@param record log record to be formatted
@return the resulting formatted string output. | [
"Formats",
"a",
"RepositoryLogRecord",
"using",
"the",
"formatter",
"s",
"locale"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java#L498-L503 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.appendHexString | static public void appendHexString(StringBuilder buffer, int value) {
assertNotNull(buffer);
int nibble = (value & 0xF0000000) >>> 28;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F000000) >>> 24;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F00000) >>> 20;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F0000) >>> 16;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0000F000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00000F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000000F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0000000F);
buffer.append(HEX_TABLE[nibble]);
} | java | static public void appendHexString(StringBuilder buffer, int value) {
assertNotNull(buffer);
int nibble = (value & 0xF0000000) >>> 28;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F000000) >>> 24;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F00000) >>> 20;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F0000) >>> 16;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0000F000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00000F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000000F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0000000F);
buffer.append(HEX_TABLE[nibble]);
} | [
"static",
"public",
"void",
"appendHexString",
"(",
"StringBuilder",
"buffer",
",",
"int",
"value",
")",
"{",
"assertNotNull",
"(",
"buffer",
")",
";",
"int",
"nibble",
"=",
"(",
"value",
"&",
"0xF0000000",
")",
">>>",
"28",
";",
"buffer",
".",
"append",
... | Appends 8 characters to a StringBuilder with the int in a "Big Endian"
hexidecimal format. For example, a int 0xFFAA1234 will be appended as a
String in format "FFAA1234". A int of value 0 will be appended as "00000000".
@param buffer The StringBuilder the int value in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param value The int value that will be converted to a hexidecimal String. | [
"Appends",
"8",
"characters",
"to",
"a",
"StringBuilder",
"with",
"the",
"int",
"in",
"a",
"Big",
"Endian",
"hexidecimal",
"format",
".",
"For",
"example",
"a",
"int",
"0xFFAA1234",
"will",
"be",
"appended",
"as",
"a",
"String",
"in",
"format",
"FFAA1234",
... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L206-L224 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/filtered/TreeModelFilters.java | TreeModelFilters.containsLeafContainingStringIgnoreCase | public static TreeModelFilter containsLeafContainingStringIgnoreCase(
final String string)
{
return new TreeModelFilter()
{
@Override
public boolean acceptNode(TreeModel treeModel, TreeNode node)
{
if (node.isLeaf())
{
if (String.valueOf(node).toLowerCase().contains(
string.toLowerCase()))
{
return true;
}
}
for (int i=0; i<node.getChildCount(); i++)
{
if (acceptNode(treeModel, node.getChildAt(i)))
{
return true;
}
}
return false;
}
@Override
public String toString()
{
return "TreeModelFilter[" +
"containsLeafContainingStringIgnoreCase("+string+")]";
}
};
} | java | public static TreeModelFilter containsLeafContainingStringIgnoreCase(
final String string)
{
return new TreeModelFilter()
{
@Override
public boolean acceptNode(TreeModel treeModel, TreeNode node)
{
if (node.isLeaf())
{
if (String.valueOf(node).toLowerCase().contains(
string.toLowerCase()))
{
return true;
}
}
for (int i=0; i<node.getChildCount(); i++)
{
if (acceptNode(treeModel, node.getChildAt(i)))
{
return true;
}
}
return false;
}
@Override
public String toString()
{
return "TreeModelFilter[" +
"containsLeafContainingStringIgnoreCase("+string+")]";
}
};
} | [
"public",
"static",
"TreeModelFilter",
"containsLeafContainingStringIgnoreCase",
"(",
"final",
"String",
"string",
")",
"{",
"return",
"new",
"TreeModelFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"acceptNode",
"(",
"TreeModel",
"treeModel",
",",
"T... | Returns a {@link TreeModelFilter} that is accepting all leaf nodes
whose string representation contains the given string (ignoring
upper/lower case), and all ancestors of these nodes
@param string The string that must be contained in the node string
@return The new {@link TreeModelFilter} | [
"Returns",
"a",
"{",
"@link",
"TreeModelFilter",
"}",
"that",
"is",
"accepting",
"all",
"leaf",
"nodes",
"whose",
"string",
"representation",
"contains",
"the",
"given",
"string",
"(",
"ignoring",
"upper",
"/",
"lower",
"case",
")",
"and",
"all",
"ancestors",
... | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/filtered/TreeModelFilters.java#L70-L103 |
javagl/Common | src/main/java/de/javagl/common/beans/XmlBeanUtil.java | XmlBeanUtil.createFullBeanXmlString | public static String createFullBeanXmlString(Object object)
{
ByteArrayOutputStream stream = null;
try
{
stream = new ByteArrayOutputStream();
writeFullBeanXml(object, stream);
return stream.toString();
}
finally
{
if (stream != null)
{
try
{
stream.close();
}
catch (IOException e)
{
throw new XmlException("Could not close the stream", e);
}
}
}
} | java | public static String createFullBeanXmlString(Object object)
{
ByteArrayOutputStream stream = null;
try
{
stream = new ByteArrayOutputStream();
writeFullBeanXml(object, stream);
return stream.toString();
}
finally
{
if (stream != null)
{
try
{
stream.close();
}
catch (IOException e)
{
throw new XmlException("Could not close the stream", e);
}
}
}
} | [
"public",
"static",
"String",
"createFullBeanXmlString",
"(",
"Object",
"object",
")",
"{",
"ByteArrayOutputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"writeFullBeanXml",
"(",
"object",
",",
"st... | Create the XML string describing the given bean, as created by
an <code>XMLEncoder</code>, but including all properties, even
if they still have their default values.
@param object The bean object
@return The string
@throws XmlException If there is an error while encoding the object | [
"Create",
"the",
"XML",
"string",
"describing",
"the",
"given",
"bean",
"as",
"created",
"by",
"an",
"<code",
">",
"XMLEncoder<",
"/",
"code",
">",
"but",
"including",
"all",
"properties",
"even",
"if",
"they",
"still",
"have",
"their",
"default",
"values",
... | train | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/XmlBeanUtil.java#L78-L101 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-api/src/main/java/org/xwiki/diff/internal/DefaultDiffManager.java | DefaultDiffManager.isFullyModified | private <E> boolean isFullyModified(List commonAncestor, Patch<E> patchCurrent) {
return patchCurrent.size() == 1 && commonAncestor.size() == patchCurrent.get(0).getPrevious().size();
} | java | private <E> boolean isFullyModified(List commonAncestor, Patch<E> patchCurrent) {
return patchCurrent.size() == 1 && commonAncestor.size() == patchCurrent.get(0).getPrevious().size();
} | [
"private",
"<",
"E",
">",
"boolean",
"isFullyModified",
"(",
"List",
"commonAncestor",
",",
"Patch",
"<",
"E",
">",
"patchCurrent",
")",
"{",
"return",
"patchCurrent",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"commonAncestor",
".",
"size",
"(",
")",
"==",... | Check if the content is completely different between the ancestor and the current version
@param <E> the type of compared elements
@param commonAncestor previous version
@param patchCurrent patch to the current version
@return either or not the user has changed everything | [
"Check",
"if",
"the",
"content",
"is",
"completely",
"different",
"between",
"the",
"ancestor",
"and",
"the",
"current",
"version"
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-api/src/main/java/org/xwiki/diff/internal/DefaultDiffManager.java#L399-L401 |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java | HalResource.addEmbedded | public HalResource addEmbedded(String relation, HalResource... resources) {
return addResources(HalResourceType.EMBEDDED, relation, true, resources);
} | java | public HalResource addEmbedded(String relation, HalResource... resources) {
return addResources(HalResourceType.EMBEDDED, relation, true, resources);
} | [
"public",
"HalResource",
"addEmbedded",
"(",
"String",
"relation",
",",
"HalResource",
"...",
"resources",
")",
"{",
"return",
"addResources",
"(",
"HalResourceType",
".",
"EMBEDDED",
",",
"relation",
",",
"true",
",",
"resources",
")",
";",
"}"
] | Embed resources for the given relation
@param relation Embedded resource relation
@param resources Resources to embed
@return HAL resource | [
"Embed",
"resources",
"for",
"the",
"given",
"relation"
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L352-L354 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/commands/CommandReader.java | CommandReader.setBreakpoint | private void setBreakpoint(String name, String condition) throws Exception
{
LexTokenReader ltr = new LexTokenReader(name, Dialect.VDM_SL);
LexToken token = ltr.nextToken();
ltr.close();
Value v = null;
if (token.is(VDMToken.IDENTIFIER))
{
LexIdentifierToken id = (LexIdentifierToken) token;
LexNameToken lnt = new LexNameToken(interpreter.getDefaultName(), id);
v = interpreter.findGlobal(lnt);
} else if (token.is(VDMToken.NAME))
{
v = interpreter.findGlobal((LexNameToken) token);
}
if (v instanceof FunctionValue)
{
FunctionValue fv = (FunctionValue) v;
PExp exp = fv.body;
interpreter.clearBreakpoint(BreakpointManager.getBreakpoint(exp).number);
Breakpoint bp = interpreter.setBreakpoint(exp, condition);
println("Created " + bp);
println(interpreter.getSourceLine(bp.location));
} else if (v instanceof OperationValue)
{
OperationValue ov = (OperationValue) v;
PStm stmt = ov.body;
interpreter.clearBreakpoint(BreakpointManager.getBreakpoint(stmt).number);
Breakpoint bp = interpreter.setBreakpoint(stmt, condition);
println("Created " + bp);
println(interpreter.getSourceLine(bp.location));
} else if (v == null)
{
println(name + " is not visible or not found");
} else
{
println(name + " is not a function or operation");
}
} | java | private void setBreakpoint(String name, String condition) throws Exception
{
LexTokenReader ltr = new LexTokenReader(name, Dialect.VDM_SL);
LexToken token = ltr.nextToken();
ltr.close();
Value v = null;
if (token.is(VDMToken.IDENTIFIER))
{
LexIdentifierToken id = (LexIdentifierToken) token;
LexNameToken lnt = new LexNameToken(interpreter.getDefaultName(), id);
v = interpreter.findGlobal(lnt);
} else if (token.is(VDMToken.NAME))
{
v = interpreter.findGlobal((LexNameToken) token);
}
if (v instanceof FunctionValue)
{
FunctionValue fv = (FunctionValue) v;
PExp exp = fv.body;
interpreter.clearBreakpoint(BreakpointManager.getBreakpoint(exp).number);
Breakpoint bp = interpreter.setBreakpoint(exp, condition);
println("Created " + bp);
println(interpreter.getSourceLine(bp.location));
} else if (v instanceof OperationValue)
{
OperationValue ov = (OperationValue) v;
PStm stmt = ov.body;
interpreter.clearBreakpoint(BreakpointManager.getBreakpoint(stmt).number);
Breakpoint bp = interpreter.setBreakpoint(stmt, condition);
println("Created " + bp);
println(interpreter.getSourceLine(bp.location));
} else if (v == null)
{
println(name + " is not visible or not found");
} else
{
println(name + " is not a function or operation");
}
} | [
"private",
"void",
"setBreakpoint",
"(",
"String",
"name",
",",
"String",
"condition",
")",
"throws",
"Exception",
"{",
"LexTokenReader",
"ltr",
"=",
"new",
"LexTokenReader",
"(",
"name",
",",
"Dialect",
".",
"VDM_SL",
")",
";",
"LexToken",
"token",
"=",
"lt... | Set a breakpoint at the given function or operation name with a condition.
@param name
The function or operation name.
@param condition
Any condition for the breakpoint, or null.
@throws Exception
Problems parsing condition. | [
"Set",
"a",
"breakpoint",
"at",
"the",
"given",
"function",
"or",
"operation",
"name",
"with",
"a",
"condition",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/commands/CommandReader.java#L1366-L1407 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/StringUtils.java | StringUtils.columnStringToObject | public static <T> T columnStringToObject(Class<?> objClass, String str, Pattern delimiterPattern, String[] fieldNames)
throws InstantiationException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException
{
String[] fields = delimiterPattern.split(str);
T item = ErasureUtils.<T>uncheckedCast(objClass.newInstance());
for (int i = 0; i < fields.length; i++) {
try {
Field field = objClass.getDeclaredField(fieldNames[i]);
field.set(item, fields[i]);
} catch (IllegalAccessException ex) {
Method method = objClass.getDeclaredMethod("set" + StringUtils.capitalize(fieldNames[i]), String.class);
method.invoke(item, fields[i]);
}
}
return item;
} | java | public static <T> T columnStringToObject(Class<?> objClass, String str, Pattern delimiterPattern, String[] fieldNames)
throws InstantiationException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException
{
String[] fields = delimiterPattern.split(str);
T item = ErasureUtils.<T>uncheckedCast(objClass.newInstance());
for (int i = 0; i < fields.length; i++) {
try {
Field field = objClass.getDeclaredField(fieldNames[i]);
field.set(item, fields[i]);
} catch (IllegalAccessException ex) {
Method method = objClass.getDeclaredMethod("set" + StringUtils.capitalize(fieldNames[i]), String.class);
method.invoke(item, fields[i]);
}
}
return item;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"columnStringToObject",
"(",
"Class",
"<",
"?",
">",
"objClass",
",",
"String",
"str",
",",
"Pattern",
"delimiterPattern",
",",
"String",
"[",
"]",
"fieldNames",
")",
"throws",
"InstantiationException",
",",
"IllegalAcce... | Converts a tab delimited string into an object with given fields
Requires the object has public access for the specified fields
@param objClass Class of object to be created
@param str string to convert
@param delimiterPattern delimiter
@param fieldNames fieldnames
@param <T> type to return
@return Object created from string | [
"Converts",
"a",
"tab",
"delimited",
"string",
"into",
"an",
"object",
"with",
"given",
"fields",
"Requires",
"the",
"object",
"has",
"public",
"access",
"for",
"the",
"specified",
"fields"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L1363-L1378 |
code4everything/util | src/main/java/com/zhazhapan/util/encryption/SimpleEncrypt.java | SimpleEncrypt.xor | public static String xor(String string, String key) {
return xor(string, CryptUtils.stringToKey(string));
} | java | public static String xor(String string, String key) {
return xor(string, CryptUtils.stringToKey(string));
} | [
"public",
"static",
"String",
"xor",
"(",
"String",
"string",
",",
"String",
"key",
")",
"{",
"return",
"xor",
"(",
"string",
",",
"CryptUtils",
".",
"stringToKey",
"(",
"string",
")",
")",
";",
"}"
] | 异或加密
@param string {@link String}
@param key {@link String}
@return {@link String} | [
"异或加密"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/encryption/SimpleEncrypt.java#L48-L50 |
alkacon/opencms-core | src/org/opencms/ui/error/CmsErrorUI.java | CmsErrorUI.getBootstrapPage | public static String getBootstrapPage(CmsObject cms, Throwable throwable, HttpServletRequest request) {
try {
setErrorAttributes(cms, throwable, request);
byte[] pageBytes = CmsFileUtil.readFully(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
"org/opencms/ui/error/error-page.html"));
String page = new String(pageBytes, "UTF-8");
CmsMacroResolver resolver = new CmsMacroResolver();
String context = OpenCms.getSystemInfo().getContextPath();
String vaadinDir = CmsStringUtil.joinPaths(context, "VAADIN/");
String vaadinVersion = Version.getFullVersion();
String vaadinServlet = CmsStringUtil.joinPaths(context, "workplace/", ERROR_PAGE_PATH_FRAQUMENT);
String vaadinBootstrap = CmsStringUtil.joinPaths(context, "VAADIN/vaadinBootstrap.js");
resolver.addMacro("loadingHtml", CmsVaadinConstants.LOADING_INDICATOR_HTML);
resolver.addMacro("vaadinDir", vaadinDir);
resolver.addMacro("vaadinVersion", vaadinVersion);
resolver.addMacro("vaadinServlet", vaadinServlet);
resolver.addMacro("vaadinBootstrap", vaadinBootstrap);
resolver.addMacro("title", "Error page");
page = resolver.resolveMacros(page);
return page;
} catch (Exception e) {
LOG.error("Failed to display error page.", e);
return "<!--Error-->";
}
} | java | public static String getBootstrapPage(CmsObject cms, Throwable throwable, HttpServletRequest request) {
try {
setErrorAttributes(cms, throwable, request);
byte[] pageBytes = CmsFileUtil.readFully(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
"org/opencms/ui/error/error-page.html"));
String page = new String(pageBytes, "UTF-8");
CmsMacroResolver resolver = new CmsMacroResolver();
String context = OpenCms.getSystemInfo().getContextPath();
String vaadinDir = CmsStringUtil.joinPaths(context, "VAADIN/");
String vaadinVersion = Version.getFullVersion();
String vaadinServlet = CmsStringUtil.joinPaths(context, "workplace/", ERROR_PAGE_PATH_FRAQUMENT);
String vaadinBootstrap = CmsStringUtil.joinPaths(context, "VAADIN/vaadinBootstrap.js");
resolver.addMacro("loadingHtml", CmsVaadinConstants.LOADING_INDICATOR_HTML);
resolver.addMacro("vaadinDir", vaadinDir);
resolver.addMacro("vaadinVersion", vaadinVersion);
resolver.addMacro("vaadinServlet", vaadinServlet);
resolver.addMacro("vaadinBootstrap", vaadinBootstrap);
resolver.addMacro("title", "Error page");
page = resolver.resolveMacros(page);
return page;
} catch (Exception e) {
LOG.error("Failed to display error page.", e);
return "<!--Error-->";
}
} | [
"public",
"static",
"String",
"getBootstrapPage",
"(",
"CmsObject",
"cms",
",",
"Throwable",
"throwable",
",",
"HttpServletRequest",
"request",
")",
"{",
"try",
"{",
"setErrorAttributes",
"(",
"cms",
",",
"throwable",
",",
"request",
")",
";",
"byte",
"[",
"]"... | Returns the error bootstrap page HTML.<p>
@param cms the cms context
@param throwable the throwable
@param request the current request
@return the error bootstrap page HTML | [
"Returns",
"the",
"error",
"bootstrap",
"page",
"HTML",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/error/CmsErrorUI.java#L93-L122 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.unbindRawFile | @ObjectiveCName("unbindRawFileWithFileId:autoCancel:withCallback:")
public void unbindRawFile(long fileId, boolean isAutoCancel, FileCallback callback) {
modules.getFilesModule().unbindFile(fileId, callback, isAutoCancel);
} | java | @ObjectiveCName("unbindRawFileWithFileId:autoCancel:withCallback:")
public void unbindRawFile(long fileId, boolean isAutoCancel, FileCallback callback) {
modules.getFilesModule().unbindFile(fileId, callback, isAutoCancel);
} | [
"@",
"ObjectiveCName",
"(",
"\"unbindRawFileWithFileId:autoCancel:withCallback:\"",
")",
"public",
"void",
"unbindRawFile",
"(",
"long",
"fileId",
",",
"boolean",
"isAutoCancel",
",",
"FileCallback",
"callback",
")",
"{",
"modules",
".",
"getFilesModule",
"(",
")",
".... | Unbind Raw File
@param fileId file id
@param isAutoCancel automatically cancel download
@param callback file state callback | [
"Unbind",
"Raw",
"File"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1942-L1945 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java | BooleanIndexing.replaceWhere | public static void replaceWhere(@NonNull INDArray to, @NonNull INDArray from, @NonNull Condition condition) {
if (!(condition instanceof BaseCondition))
throw new UnsupportedOperationException("Only static Conditions are supported");
if (to.length() != from.length())
throw new IllegalStateException("Mis matched length for to and from");
Nd4j.getExecutioner().exec(new CompareAndReplace(to, from, condition));
} | java | public static void replaceWhere(@NonNull INDArray to, @NonNull INDArray from, @NonNull Condition condition) {
if (!(condition instanceof BaseCondition))
throw new UnsupportedOperationException("Only static Conditions are supported");
if (to.length() != from.length())
throw new IllegalStateException("Mis matched length for to and from");
Nd4j.getExecutioner().exec(new CompareAndReplace(to, from, condition));
} | [
"public",
"static",
"void",
"replaceWhere",
"(",
"@",
"NonNull",
"INDArray",
"to",
",",
"@",
"NonNull",
"INDArray",
"from",
",",
"@",
"NonNull",
"Condition",
"condition",
")",
"{",
"if",
"(",
"!",
"(",
"condition",
"instanceof",
"BaseCondition",
")",
")",
... | This method does element-wise comparison for 2 equal-sized matrices, for each element that matches Condition
@param to
@param from
@param condition | [
"This",
"method",
"does",
"element",
"-",
"wise",
"comparison",
"for",
"2",
"equal",
"-",
"sized",
"matrices",
"for",
"each",
"element",
"that",
"matches",
"Condition"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java#L174-L182 |
Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/jdbc/RDBMServices.java | RDBMServices.setAutoCommit | public static final void setAutoCommit(final Connection connection, boolean autocommit) {
try {
connection.setAutoCommit(autocommit);
} catch (Exception e) {
if (LOG.isWarnEnabled())
LOG.warn("Error committing Connection: " + connection + " to: " + autocommit, e);
}
} | java | public static final void setAutoCommit(final Connection connection, boolean autocommit) {
try {
connection.setAutoCommit(autocommit);
} catch (Exception e) {
if (LOG.isWarnEnabled())
LOG.warn("Error committing Connection: " + connection + " to: " + autocommit, e);
}
} | [
"public",
"static",
"final",
"void",
"setAutoCommit",
"(",
"final",
"Connection",
"connection",
",",
"boolean",
"autocommit",
")",
"{",
"try",
"{",
"connection",
".",
"setAutoCommit",
"(",
"autocommit",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{"... | Set auto commit state for the connection. Unlike the underlying connection.setAutoCommit(),
this method does not throw SQLException or any other Exception. It fails silently from the
perspective of calling code, logging any errors encountered using Commons Logging.
@param connection
@param autocommit | [
"Set",
"auto",
"commit",
"state",
"for",
"the",
"connection",
".",
"Unlike",
"the",
"underlying",
"connection",
".",
"setAutoCommit",
"()",
"this",
"method",
"does",
"not",
"throw",
"SQLException",
"or",
"any",
"other",
"Exception",
".",
"It",
"fails",
"silent... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/jdbc/RDBMServices.java#L270-L277 |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java | Utils.setupLocalResource | static Tuple2<Path, LocalResource> setupLocalResource(
FileSystem fs,
String appId,
Path localSrcPath,
Path homedir,
String relativeTargetPath) throws IOException {
File localFile = new File(localSrcPath.toUri().getPath());
if (localFile.isDirectory()) {
throw new IllegalArgumentException("File to copy must not be a directory: " +
localSrcPath);
}
// copy resource to HDFS
String suffix =
".flink/"
+ appId
+ (relativeTargetPath.isEmpty() ? "" : "/" + relativeTargetPath)
+ "/" + localSrcPath.getName();
Path dst = new Path(homedir, suffix);
LOG.debug("Copying from {} to {}", localSrcPath, dst);
fs.copyFromLocalFile(false, true, localSrcPath, dst);
// Note: If we used registerLocalResource(FileSystem, Path) here, we would access the remote
// file once again which has problems with eventually consistent read-after-write file
// systems. Instead, we decide to preserve the modification time at the remote
// location because this and the size of the resource will be checked by YARN based on
// the values we provide to #registerLocalResource() below.
fs.setTimes(dst, localFile.lastModified(), -1);
// now create the resource instance
LocalResource resource = registerLocalResource(dst, localFile.length(), localFile.lastModified());
return Tuple2.of(dst, resource);
} | java | static Tuple2<Path, LocalResource> setupLocalResource(
FileSystem fs,
String appId,
Path localSrcPath,
Path homedir,
String relativeTargetPath) throws IOException {
File localFile = new File(localSrcPath.toUri().getPath());
if (localFile.isDirectory()) {
throw new IllegalArgumentException("File to copy must not be a directory: " +
localSrcPath);
}
// copy resource to HDFS
String suffix =
".flink/"
+ appId
+ (relativeTargetPath.isEmpty() ? "" : "/" + relativeTargetPath)
+ "/" + localSrcPath.getName();
Path dst = new Path(homedir, suffix);
LOG.debug("Copying from {} to {}", localSrcPath, dst);
fs.copyFromLocalFile(false, true, localSrcPath, dst);
// Note: If we used registerLocalResource(FileSystem, Path) here, we would access the remote
// file once again which has problems with eventually consistent read-after-write file
// systems. Instead, we decide to preserve the modification time at the remote
// location because this and the size of the resource will be checked by YARN based on
// the values we provide to #registerLocalResource() below.
fs.setTimes(dst, localFile.lastModified(), -1);
// now create the resource instance
LocalResource resource = registerLocalResource(dst, localFile.length(), localFile.lastModified());
return Tuple2.of(dst, resource);
} | [
"static",
"Tuple2",
"<",
"Path",
",",
"LocalResource",
">",
"setupLocalResource",
"(",
"FileSystem",
"fs",
",",
"String",
"appId",
",",
"Path",
"localSrcPath",
",",
"Path",
"homedir",
",",
"String",
"relativeTargetPath",
")",
"throws",
"IOException",
"{",
"File"... | Copy a local file to a remote file system.
@param fs
remote filesystem
@param appId
application ID
@param localSrcPath
path to the local file
@param homedir
remote home directory base (will be extended)
@param relativeTargetPath
relative target path of the file (will be prefixed be the full home directory we set up)
@return Path to remote file (usually hdfs) | [
"Copy",
"a",
"local",
"file",
"to",
"a",
"remote",
"file",
"system",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L138-L174 |
infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/table/PerCacheTxTable.java | PerCacheTxTable.createLocalTx | public void createLocalTx(Xid xid, EmbeddedTransaction tx) {
localTxTable.put(xid, tx);
if (trace) {
log.tracef("[%s] New tx=%s", xid, tx);
}
} | java | public void createLocalTx(Xid xid, EmbeddedTransaction tx) {
localTxTable.put(xid, tx);
if (trace) {
log.tracef("[%s] New tx=%s", xid, tx);
}
} | [
"public",
"void",
"createLocalTx",
"(",
"Xid",
"xid",
",",
"EmbeddedTransaction",
"tx",
")",
"{",
"localTxTable",
".",
"put",
"(",
"xid",
",",
"tx",
")",
";",
"if",
"(",
"trace",
")",
"{",
"log",
".",
"tracef",
"(",
"\"[%s] New tx=%s\"",
",",
"xid",
",... | Adds the {@link EmbeddedTransaction} in the local transaction table. | [
"Adds",
"the",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/table/PerCacheTxTable.java#L60-L65 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationSuggestOracle.java | CmsLocationSuggestOracle.addSuggestion | private static void addSuggestion(List<LocationSuggestion> suggestions, String address) {
suggestions.add(new LocationSuggestion(address));
} | java | private static void addSuggestion(List<LocationSuggestion> suggestions, String address) {
suggestions.add(new LocationSuggestion(address));
} | [
"private",
"static",
"void",
"addSuggestion",
"(",
"List",
"<",
"LocationSuggestion",
">",
"suggestions",
",",
"String",
"address",
")",
"{",
"suggestions",
".",
"add",
"(",
"new",
"LocationSuggestion",
"(",
"address",
")",
")",
";",
"}"
] | Adds a location suggestion to the list.<p>
@param suggestions the suggestions list
@param address the address | [
"Adds",
"a",
"location",
"suggestion",
"to",
"the",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationSuggestOracle.java#L99-L102 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_POST | public OvhOvhPabxDialplan billingAccount_ovhPabx_serviceName_dialplan_POST(String billingAccount, String serviceName, Boolean anonymousRejection, String name, OvhOvhPabxDialplanNumberPresentationEnum showCallerNumber, Long transferTimeout) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "anonymousRejection", anonymousRejection);
addBody(o, "name", name);
addBody(o, "showCallerNumber", showCallerNumber);
addBody(o, "transferTimeout", transferTimeout);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxDialplan.class);
} | java | public OvhOvhPabxDialplan billingAccount_ovhPabx_serviceName_dialplan_POST(String billingAccount, String serviceName, Boolean anonymousRejection, String name, OvhOvhPabxDialplanNumberPresentationEnum showCallerNumber, Long transferTimeout) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "anonymousRejection", anonymousRejection);
addBody(o, "name", name);
addBody(o, "showCallerNumber", showCallerNumber);
addBody(o, "transferTimeout", transferTimeout);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxDialplan.class);
} | [
"public",
"OvhOvhPabxDialplan",
"billingAccount_ovhPabx_serviceName_dialplan_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Boolean",
"anonymousRejection",
",",
"String",
"name",
",",
"OvhOvhPabxDialplanNumberPresentationEnum",
"showCallerNumber",
","... | Create a new dialplan
REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan
@param transferTimeout [required] The timeout (in seconds) when bridging calls
@param anonymousRejection [required] Reject (hangup) anonymous calls
@param name [required] The dialplan name
@param showCallerNumber [required] The presented number when bridging calls
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"new",
"dialplan"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7432-L7442 |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java | FromCobolVisitor.isCustomVariable | public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
if (type.isCustomVariable()) {
return true;
}
if (customVariables != null && customVariables.contains(name)) {
return true;
}
if (customChoiceStrategy != null
&& customChoiceStrategy.getVariableNames() != null
&& customChoiceStrategy.getVariableNames().contains(name)) {
return true;
}
return false;
} | java | public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
if (type.isCustomVariable()) {
return true;
}
if (customVariables != null && customVariables.contains(name)) {
return true;
}
if (customChoiceStrategy != null
&& customChoiceStrategy.getVariableNames() != null
&& customChoiceStrategy.getVariableNames().contains(name)) {
return true;
}
return false;
} | [
"public",
"boolean",
"isCustomVariable",
"(",
"CobolPrimitiveType",
"<",
"?",
">",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"type",
".",
"isCustomVariable",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"customVariables",
"!=",
"n... | A primitive type is a custom variable if it has been marked as so via one
of the available mechanisms or is needed to make choice decisions.
@param type the primitive type
@param name the variable name
@return true if this is a custom variable | [
"A",
"primitive",
"type",
"is",
"a",
"custom",
"variable",
"if",
"it",
"has",
"been",
"marked",
"as",
"so",
"via",
"one",
"of",
"the",
"available",
"mechanisms",
"or",
"is",
"needed",
"to",
"make",
"choice",
"decisions",
"."
] | train | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java#L588-L601 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java | SharedValue.trySetValue | public boolean trySetValue(VersionedValue<byte[]> previous, byte[] newValue) throws Exception
{
Preconditions.checkState(state.get() == State.STARTED, "not started");
VersionedValue<byte[]> current = currentValue.get();
if ( previous.getVersion() != current.getVersion() || !Arrays.equals(previous.getValue(), current.getValue()) )
{
return false;
}
try
{
Stat result = client.setData().withVersion(previous.getVersion()).forPath(path, newValue);
updateValue(result.getVersion(), Arrays.copyOf(newValue, newValue.length));
return true;
}
catch ( KeeperException.BadVersionException ignore )
{
// ignore
}
readValue();
return false;
} | java | public boolean trySetValue(VersionedValue<byte[]> previous, byte[] newValue) throws Exception
{
Preconditions.checkState(state.get() == State.STARTED, "not started");
VersionedValue<byte[]> current = currentValue.get();
if ( previous.getVersion() != current.getVersion() || !Arrays.equals(previous.getValue(), current.getValue()) )
{
return false;
}
try
{
Stat result = client.setData().withVersion(previous.getVersion()).forPath(path, newValue);
updateValue(result.getVersion(), Arrays.copyOf(newValue, newValue.length));
return true;
}
catch ( KeeperException.BadVersionException ignore )
{
// ignore
}
readValue();
return false;
} | [
"public",
"boolean",
"trySetValue",
"(",
"VersionedValue",
"<",
"byte",
"[",
"]",
">",
"previous",
",",
"byte",
"[",
"]",
"newValue",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"state",
".",
"get",
"(",
")",
"==",
"State",
... | Changes the shared value only if its value has not changed since the version specified by
newValue. If the value has changed, the value is not set and this client's view of the
value is updated. i.e. if the value is not successful you can get the updated value
by calling {@link #getValue()}.
@param newValue the new value to attempt
@return true if the change attempt was successful, false if not. If the change
was not successful, {@link #getValue()} will return the updated value
@throws Exception ZK errors, interruptions, etc. | [
"Changes",
"the",
"shared",
"value",
"only",
"if",
"its",
"value",
"has",
"not",
"changed",
"since",
"the",
"version",
"specified",
"by",
"newValue",
".",
"If",
"the",
"value",
"has",
"changed",
"the",
"value",
"is",
"not",
"set",
"and",
"this",
"client",
... | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L162-L185 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java | FindBugs.configureBaselineFilter | public static BugReporter configureBaselineFilter(BugReporter bugReporter, String baselineFileName) throws IOException,
DocumentException {
return new ExcludingHashesBugReporter(bugReporter, baselineFileName);
} | java | public static BugReporter configureBaselineFilter(BugReporter bugReporter, String baselineFileName) throws IOException,
DocumentException {
return new ExcludingHashesBugReporter(bugReporter, baselineFileName);
} | [
"public",
"static",
"BugReporter",
"configureBaselineFilter",
"(",
"BugReporter",
"bugReporter",
",",
"String",
"baselineFileName",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"return",
"new",
"ExcludingHashesBugReporter",
"(",
"bugReporter",
",",
"baseli... | Configure a baseline bug instance filter.
@param bugReporter
a DelegatingBugReporter
@param baselineFileName
filename of baseline Filter
@throws java.io.IOException
@throws org.dom4j.DocumentException | [
"Configure",
"a",
"baseline",
"bug",
"instance",
"filter",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L500-L503 |
alkacon/opencms-core | src/org/opencms/search/fields/CmsLuceneFieldConfiguration.java | CmsLuceneFieldConfiguration.getAnalyzer | public Analyzer getAnalyzer(Analyzer analyzer) {
// parent folder and last modified lookup fields must use whitespace analyzer
WhitespaceAnalyzer ws = new WhitespaceAnalyzer();
Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>();
// first make map the default hard coded fields
analyzers.put(CmsSearchField.FIELD_PARENT_FOLDERS, ws);
analyzers.put(CmsSearchField.FIELD_CATEGORY, ws);
analyzers.put(CmsSearchField.FIELD_DATE_LASTMODIFIED_LOOKUP, ws);
analyzers.put(CmsSearchField.FIELD_DATE_CREATED_LOOKUP, ws);
for (CmsLuceneField field : getLuceneFields()) {
Analyzer fieldAnalyzer = field.getAnalyzer();
if (fieldAnalyzer != null) {
// this field has an individual analyzer configured
analyzers.put(field.getName(), fieldAnalyzer);
}
}
// return the individual field configured analyzer
return new PerFieldAnalyzerWrapper(analyzer, analyzers);
} | java | public Analyzer getAnalyzer(Analyzer analyzer) {
// parent folder and last modified lookup fields must use whitespace analyzer
WhitespaceAnalyzer ws = new WhitespaceAnalyzer();
Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>();
// first make map the default hard coded fields
analyzers.put(CmsSearchField.FIELD_PARENT_FOLDERS, ws);
analyzers.put(CmsSearchField.FIELD_CATEGORY, ws);
analyzers.put(CmsSearchField.FIELD_DATE_LASTMODIFIED_LOOKUP, ws);
analyzers.put(CmsSearchField.FIELD_DATE_CREATED_LOOKUP, ws);
for (CmsLuceneField field : getLuceneFields()) {
Analyzer fieldAnalyzer = field.getAnalyzer();
if (fieldAnalyzer != null) {
// this field has an individual analyzer configured
analyzers.put(field.getName(), fieldAnalyzer);
}
}
// return the individual field configured analyzer
return new PerFieldAnalyzerWrapper(analyzer, analyzers);
} | [
"public",
"Analyzer",
"getAnalyzer",
"(",
"Analyzer",
"analyzer",
")",
"{",
"// parent folder and last modified lookup fields must use whitespace analyzer",
"WhitespaceAnalyzer",
"ws",
"=",
"new",
"WhitespaceAnalyzer",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Analyzer",
... | Returns an analyzer that wraps the given base analyzer with the analyzers of this individual field configuration.<p>
@param analyzer the base analyzer to wrap
@return an analyzer that wraps the given base analyzer with the analyzers of this individual field configuration | [
"Returns",
"an",
"analyzer",
"that",
"wraps",
"the",
"given",
"base",
"analyzer",
"with",
"the",
"analyzers",
"of",
"this",
"individual",
"field",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/fields/CmsLuceneFieldConfiguration.java#L190-L210 |
alkacon/opencms-core | src/org/opencms/util/CmsFileUtil.java | CmsFileUtil.getRepositoryName | public static String getRepositoryName(String repository, String vfspath, boolean online) {
StringBuffer result = new StringBuffer(64);
result.append(repository);
result.append(online ? CmsFlexCache.REPOSITORY_ONLINE : CmsFlexCache.REPOSITORY_OFFLINE);
result.append(vfspath);
return result.toString();
} | java | public static String getRepositoryName(String repository, String vfspath, boolean online) {
StringBuffer result = new StringBuffer(64);
result.append(repository);
result.append(online ? CmsFlexCache.REPOSITORY_ONLINE : CmsFlexCache.REPOSITORY_OFFLINE);
result.append(vfspath);
return result.toString();
} | [
"public",
"static",
"String",
"getRepositoryName",
"(",
"String",
"repository",
",",
"String",
"vfspath",
",",
"boolean",
"online",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"64",
")",
";",
"result",
".",
"append",
"(",
"repository",... | Returns the file name for a given VFS name that has to be written to a repository in the "real" file system,
by appending the VFS root path to the given base repository path, also adding an
folder for the "online" or "offline" project.<p>
@param repository the base repository path
@param vfspath the VFS root path to write to use
@param online flag indicates if the result should be used for the online project (<code>true</code>) or not
@return The full uri to the JSP | [
"Returns",
"the",
"file",
"name",
"for",
"a",
"given",
"VFS",
"name",
"that",
"has",
"to",
"be",
"written",
"to",
"a",
"repository",
"in",
"the",
"real",
"file",
"system",
"by",
"appending",
"the",
"VFS",
"root",
"path",
"to",
"the",
"given",
"base",
"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L419-L426 |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/classloader/ClassLoaderUtils.java | ClassLoaderUtils.getResourceAsStream | @FFDCIgnore({IOException.class})
public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
URL url = getResource(resourceName, callingClass);
try {
return (url != null) ? url.openStream() : null;
} catch (IOException e) {
return null;
}
} | java | @FFDCIgnore({IOException.class})
public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
URL url = getResource(resourceName, callingClass);
try {
return (url != null) ? url.openStream() : null;
} catch (IOException e) {
return null;
}
} | [
"@",
"FFDCIgnore",
"(",
"{",
"IOException",
".",
"class",
"}",
")",
"public",
"static",
"InputStream",
"getResourceAsStream",
"(",
"String",
"resourceName",
",",
"Class",
"<",
"?",
">",
"callingClass",
")",
"{",
"URL",
"url",
"=",
"getResource",
"(",
"resour... | This is a convenience method to load a resource as a stream. <p/> The
algorithm used to find the resource is given in getResource()
@param resourceName The name of the resource to load
@param callingClass The Class object of the calling object | [
"This",
"is",
"a",
"convenience",
"method",
"to",
"load",
"a",
"resource",
"as",
"a",
"stream",
".",
"<p",
"/",
">",
"The",
"algorithm",
"used",
"to",
"find",
"the",
"resource",
"is",
"given",
"in",
"getResource",
"()"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/common/classloader/ClassLoaderUtils.java#L246-L255 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/ConstructorScopes.java | ConstructorScopes.createConstructorScope | public IScope createConstructorScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
if (!(context instanceof XConstructorCall)) {
return IScope.NULLSCOPE;
}
/*
* We use a type scope here in order to provide better feedback for users,
* e.g. if the constructor call refers to an interface or a primitive.
*/
final IScope delegateScope = typeScopes.createTypeScope(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, session, resolvedTypes);
IScope result = new ConstructorTypeScopeWrapper(context, session, delegateScope);
return result;
} | java | public IScope createConstructorScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
if (!(context instanceof XConstructorCall)) {
return IScope.NULLSCOPE;
}
/*
* We use a type scope here in order to provide better feedback for users,
* e.g. if the constructor call refers to an interface or a primitive.
*/
final IScope delegateScope = typeScopes.createTypeScope(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, session, resolvedTypes);
IScope result = new ConstructorTypeScopeWrapper(context, session, delegateScope);
return result;
} | [
"public",
"IScope",
"createConstructorScope",
"(",
"EObject",
"context",
",",
"EReference",
"reference",
",",
"IFeatureScopeSession",
"session",
",",
"IResolvedTypes",
"resolvedTypes",
")",
"{",
"if",
"(",
"!",
"(",
"context",
"instanceof",
"XConstructorCall",
")",
... | Creates the constructor scope for {@link XConstructorCall}.
The scope will likely contain descriptions for {@link JvmConstructor constructors}.
If there is not constructor declared, it may contain {@link JvmType types}.
@param session the currently available visibilityHelper data
@param reference the reference that will hold the resolved constructor
@param resolvedTypes the currently known resolved types | [
"Creates",
"the",
"constructor",
"scope",
"for",
"{",
"@link",
"XConstructorCall",
"}",
".",
"The",
"scope",
"will",
"likely",
"contain",
"descriptions",
"for",
"{",
"@link",
"JvmConstructor",
"constructors",
"}",
".",
"If",
"there",
"is",
"not",
"constructor",
... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/ConstructorScopes.java#L59-L70 |
uber/NullAway | nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java | AccessPathNullnessPropagation.setNonnullIfAnalyzeable | private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL);
}
} | java | private void setNonnullIfAnalyzeable(Updates updates, Node node) {
AccessPath ap = AccessPath.getAccessPathForNodeWithMapGet(node, types);
if (ap != null) {
updates.set(ap, NONNULL);
}
} | [
"private",
"void",
"setNonnullIfAnalyzeable",
"(",
"Updates",
"updates",
",",
"Node",
"node",
")",
"{",
"AccessPath",
"ap",
"=",
"AccessPath",
".",
"getAccessPathForNodeWithMapGet",
"(",
"node",
",",
"types",
")",
";",
"if",
"(",
"ap",
"!=",
"null",
")",
"{"... | If node represents a local, field access, or method call we can track, set it to be non-null in
the updates | [
"If",
"node",
"represents",
"a",
"local",
"field",
"access",
"or",
"method",
"call",
"we",
"can",
"track",
"set",
"it",
"to",
"be",
"non",
"-",
"null",
"in",
"the",
"updates"
] | train | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java#L635-L640 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java | RoutesInner.listAsync | public Observable<Page<RouteInner>> listAsync(final String resourceGroupName, final String routeTableName) {
return listWithServiceResponseAsync(resourceGroupName, routeTableName)
.map(new Func1<ServiceResponse<Page<RouteInner>>, Page<RouteInner>>() {
@Override
public Page<RouteInner> call(ServiceResponse<Page<RouteInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RouteInner>> listAsync(final String resourceGroupName, final String routeTableName) {
return listWithServiceResponseAsync(resourceGroupName, routeTableName)
.map(new Func1<ServiceResponse<Page<RouteInner>>, Page<RouteInner>>() {
@Override
public Page<RouteInner> call(ServiceResponse<Page<RouteInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RouteInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"routeTableName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
... | Gets all routes in a route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RouteInner> object | [
"Gets",
"all",
"routes",
"in",
"a",
"route",
"table",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java#L581-L589 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java | SuperPositionQCP.calcRmsd | private void calcRmsd(Point3d[] x, Point3d[] y) {
if (centered) {
innerProduct(y, x);
} else {
// translate to origin
xref = CalcPoint.clonePoint3dArray(x);
xtrans = CalcPoint.centroid(xref);
logger.debug("x centroid: " + xtrans);
xtrans.negate();
CalcPoint.translate(new Vector3d(xtrans), xref);
yref = CalcPoint.clonePoint3dArray(y);
ytrans = CalcPoint.centroid(yref);
logger.debug("y centroid: " + ytrans);
ytrans.negate();
CalcPoint.translate(new Vector3d(ytrans), yref);
innerProduct(yref, xref);
}
calcRmsd(wsum);
} | java | private void calcRmsd(Point3d[] x, Point3d[] y) {
if (centered) {
innerProduct(y, x);
} else {
// translate to origin
xref = CalcPoint.clonePoint3dArray(x);
xtrans = CalcPoint.centroid(xref);
logger.debug("x centroid: " + xtrans);
xtrans.negate();
CalcPoint.translate(new Vector3d(xtrans), xref);
yref = CalcPoint.clonePoint3dArray(y);
ytrans = CalcPoint.centroid(yref);
logger.debug("y centroid: " + ytrans);
ytrans.negate();
CalcPoint.translate(new Vector3d(ytrans), yref);
innerProduct(yref, xref);
}
calcRmsd(wsum);
} | [
"private",
"void",
"calcRmsd",
"(",
"Point3d",
"[",
"]",
"x",
",",
"Point3d",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"centered",
")",
"{",
"innerProduct",
"(",
"y",
",",
"x",
")",
";",
"}",
"else",
"{",
"// translate to origin",
"xref",
"=",
"CalcPoint"... | Calculates the RMSD value for superposition of y onto x. This requires
the coordinates to be precentered.
@param x
3d points of reference coordinate set
@param y
3d points of coordinate set for superposition | [
"Calculates",
"the",
"RMSD",
"value",
"for",
"superposition",
"of",
"y",
"onto",
"x",
".",
"This",
"requires",
"the",
"coordinates",
"to",
"be",
"precentered",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java#L257-L276 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java | GVRRigidBody.setGravity | public void setGravity(float x, float y, float z) {
Native3DRigidBody.setGravity(getNative(), x, y, z);
} | java | public void setGravity(float x, float y, float z) {
Native3DRigidBody.setGravity(getNative(), x, y, z);
} | [
"public",
"void",
"setGravity",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"Native3DRigidBody",
".",
"setGravity",
"(",
"getNative",
"(",
")",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] | Sets a particular acceleration vector [X, Y, Z] on this {@linkplain GVRRigidBody rigid body}
@param x factor on the 'X' axis.
@param y factor on the 'Y' axis.
@param z factor on the 'Z' axis. | [
"Sets",
"a",
"particular",
"acceleration",
"vector",
"[",
"X",
"Y",
"Z",
"]",
"on",
"this",
"{",
"@linkplain",
"GVRRigidBody",
"rigid",
"body",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L287-L289 |
wildfly/wildfly-core | request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java | ControlPoint.queueTask | public void queueTask(Runnable task, Executor taskExecutor, long timeout, Runnable timeoutTask, boolean rejectOnSuspend) {
controller.queueTask(this, task, taskExecutor, timeout, timeoutTask, rejectOnSuspend, false);
} | java | public void queueTask(Runnable task, Executor taskExecutor, long timeout, Runnable timeoutTask, boolean rejectOnSuspend) {
controller.queueTask(this, task, taskExecutor, timeout, timeoutTask, rejectOnSuspend, false);
} | [
"public",
"void",
"queueTask",
"(",
"Runnable",
"task",
",",
"Executor",
"taskExecutor",
",",
"long",
"timeout",
",",
"Runnable",
"timeoutTask",
",",
"boolean",
"rejectOnSuspend",
")",
"{",
"controller",
".",
"queueTask",
"(",
"this",
",",
"task",
",",
"taskEx... | Queues a task to run when the request controller allows it. There are two use cases for this:
<ol>
<li>This allows for requests to be queued instead of dropped when the request limit has been hit</li>
<li>Timed jobs that are supposed to execute while the container is suspended can be queued to execute
when it resumes</li>
</ol>
<p>
Note that the task will be run within the context of a {@link #beginRequest()} call, if the task
is executed there is no need to invoke on the control point again.
</p>
@param task The task to run
@param timeout The timeout in milliseconds, if this is larger than zero the task will be timed out after
this much time has elapsed
@param timeoutTask The task that is run on timeout
@param rejectOnSuspend If the task should be rejected if the container is suspended, if this happens the timeout task is invoked immediately | [
"Queues",
"a",
"task",
"to",
"run",
"when",
"the",
"request",
"controller",
"allows",
"it",
".",
"There",
"are",
"two",
"use",
"cases",
"for",
"this",
":",
"<ol",
">",
"<li",
">",
"This",
"allows",
"for",
"requests",
"to",
"be",
"queued",
"instead",
"o... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L211-L213 |
zamrokk/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Member.java | Member.getNextTCert | public TCert getNextTCert(List<String> attrs) {
if (!isEnrolled()) {
throw new RuntimeException(String.format("user '%s' is not enrolled", this.getName()));
}
String key = getAttrsKey(attrs);
logger.debug(String.format("Member.getNextTCert: key=%s", key));
TCertGetter tcertGetter = this.tcertGetterMap.get(key);
if (tcertGetter == null) {
logger.debug(String.format("Member.getNextTCert: key=%s, creating new getter", key));
tcertGetter = new TCertGetter(this, attrs, key);
this.tcertGetterMap.put(key, tcertGetter);
}
return tcertGetter.getNextTCert();
} | java | public TCert getNextTCert(List<String> attrs) {
if (!isEnrolled()) {
throw new RuntimeException(String.format("user '%s' is not enrolled", this.getName()));
}
String key = getAttrsKey(attrs);
logger.debug(String.format("Member.getNextTCert: key=%s", key));
TCertGetter tcertGetter = this.tcertGetterMap.get(key);
if (tcertGetter == null) {
logger.debug(String.format("Member.getNextTCert: key=%s, creating new getter", key));
tcertGetter = new TCertGetter(this, attrs, key);
this.tcertGetterMap.put(key, tcertGetter);
}
return tcertGetter.getNextTCert();
} | [
"public",
"TCert",
"getNextTCert",
"(",
"List",
"<",
"String",
">",
"attrs",
")",
"{",
"if",
"(",
"!",
"isEnrolled",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"user '%s' is not enrolled\"",
",",
"this",
".... | Get the next available transaction certificate with the appropriate attributes. | [
"Get",
"the",
"next",
"available",
"transaction",
"certificate",
"with",
"the",
"appropriate",
"attributes",
"."
] | train | https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Member.java#L308-L322 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.findFirst | public static <T extends AnnotationDesc> T findFirst(T[] original, Predicate<T> filter) {
for (final T element : original) {
if (filter.test(element)) {
return element;
}
}
return null;
} | java | public static <T extends AnnotationDesc> T findFirst(T[] original, Predicate<T> filter) {
for (final T element : original) {
if (filter.test(element)) {
return element;
}
}
return null;
} | [
"public",
"static",
"<",
"T",
"extends",
"AnnotationDesc",
">",
"T",
"findFirst",
"(",
"T",
"[",
"]",
"original",
",",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{",
"for",
"(",
"final",
"T",
"element",
":",
"original",
")",
"{",
"if",
"(",
"filter"... | Find the first element into the given array.
@param <T> the type of the elements to filter.
@param original the original array.
@param filter the filtering action.
@return the first element. | [
"Find",
"the",
"first",
"element",
"into",
"the",
"given",
"array",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L188-L195 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildMethodSubHeader | public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
} | java | public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
} | [
"public",
"void",
"buildMethodSubHeader",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"{",
"methodWriter",
".",
"addMemberHeader",
"(",
"(",
"ExecutableElement",
")",
"currentMember",
",",
"methodsContentTree",
")",
";",
"}"
] | Build the method sub header.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added | [
"Build",
"the",
"method",
"sub",
"header",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L322-L324 |
mikepenz/Crossfader | library/src/main/java/com/mikepenz/crossfader/view/CrossFadeSlidingPaneLayout.java | CrossFadeSlidingPaneLayout.enableDisableView | private void enableDisableView(View view, boolean enabled) {
view.setEnabled(enabled);
view.setFocusable(enabled);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int idx = 0; idx < group.getChildCount(); idx++) {
enableDisableView(group.getChildAt(idx), enabled);
}
}
} | java | private void enableDisableView(View view, boolean enabled) {
view.setEnabled(enabled);
view.setFocusable(enabled);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int idx = 0; idx < group.getChildCount(); idx++) {
enableDisableView(group.getChildAt(idx), enabled);
}
}
} | [
"private",
"void",
"enableDisableView",
"(",
"View",
"view",
",",
"boolean",
"enabled",
")",
"{",
"view",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"view",
".",
"setFocusable",
"(",
"enabled",
")",
";",
"if",
"(",
"view",
"instanceof",
"ViewGroup",
")",... | helper method to disable a view and all its subviews
@param view
@param enabled | [
"helper",
"method",
"to",
"disable",
"a",
"view",
"and",
"all",
"its",
"subviews"
] | train | https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/view/CrossFadeSlidingPaneLayout.java#L152-L162 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_disclaimer_PUT | public void organizationName_service_exchangeService_domain_domainName_disclaimer_PUT(String organizationName, String exchangeService, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_domain_domainName_disclaimer_PUT(String organizationName, String exchangeService, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_domain_domainName_disclaimer_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"domainName",
",",
"OvhDisclaimer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",... | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L545-L549 |
Tristan971/EasyFXML | easyfxml/src/main/java/moe/tristan/easyfxml/util/Clipping.java | Clipping.getCircleClip | private static Circle getCircleClip(final double radius, final double centerX, final double centerY) {
final Circle clip = new Circle(radius);
clip.setCenterX(centerX);
clip.setCenterY(centerY);
return clip;
} | java | private static Circle getCircleClip(final double radius, final double centerX, final double centerY) {
final Circle clip = new Circle(radius);
clip.setCenterX(centerX);
clip.setCenterY(centerY);
return clip;
} | [
"private",
"static",
"Circle",
"getCircleClip",
"(",
"final",
"double",
"radius",
",",
"final",
"double",
"centerX",
",",
"final",
"double",
"centerY",
")",
"{",
"final",
"Circle",
"clip",
"=",
"new",
"Circle",
"(",
"radius",
")",
";",
"clip",
".",
"setCen... | Builds a clip-ready {@link Circle} with a specific radius and specific center position.
@param radius The radius of this circle.
@param centerX The horizontal position for this circle's center
@param centerY The vertical position for this circle's center
@return A circle with the given radius and center position | [
"Builds",
"a",
"clip",
"-",
"ready",
"{",
"@link",
"Circle",
"}",
"with",
"a",
"specific",
"radius",
"and",
"specific",
"center",
"position",
"."
] | train | https://github.com/Tristan971/EasyFXML/blob/f82cad1d54e62903ca5e4a250279ad315b028aef/easyfxml/src/main/java/moe/tristan/easyfxml/util/Clipping.java#L58-L63 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/InternalEventBusSkill.java | InternalEventBusSkill.runInitializationStage | private void runInitializationStage(Event event) {
// Immediate synchronous dispatching of Initialize event
try {
setOwnerState(OwnerState.INITIALIZING);
try {
this.eventDispatcher.immediateDispatch(event);
} finally {
setOwnerState(OwnerState.ALIVE);
}
this.agentAsEventListener.fireEnqueuedEvents(this);
if (this.agentAsEventListener.isKilled.get()) {
this.agentAsEventListener.killOwner(InternalEventBusSkill.this);
}
} catch (Exception e) {
// Log the exception
final Logging loggingCapacity = getLoggingSkill();
if (loggingCapacity != null) {
loggingCapacity.error(Messages.InternalEventBusSkill_3, e);
} else {
final LogRecord record = new LogRecord(Level.SEVERE, Messages.InternalEventBusSkill_3);
this.logger.getKernelLogger().log(
this.logger.prepareLogRecord(record, this.logger.getKernelLogger().getName(),
Throwables.getRootCause(e)));
}
// If we have an exception within the agent's initialization, we kill the agent.
setOwnerState(OwnerState.ALIVE);
// Asynchronous kill of the event.
this.agentAsEventListener.killOrMarkAsKilled();
}
} | java | private void runInitializationStage(Event event) {
// Immediate synchronous dispatching of Initialize event
try {
setOwnerState(OwnerState.INITIALIZING);
try {
this.eventDispatcher.immediateDispatch(event);
} finally {
setOwnerState(OwnerState.ALIVE);
}
this.agentAsEventListener.fireEnqueuedEvents(this);
if (this.agentAsEventListener.isKilled.get()) {
this.agentAsEventListener.killOwner(InternalEventBusSkill.this);
}
} catch (Exception e) {
// Log the exception
final Logging loggingCapacity = getLoggingSkill();
if (loggingCapacity != null) {
loggingCapacity.error(Messages.InternalEventBusSkill_3, e);
} else {
final LogRecord record = new LogRecord(Level.SEVERE, Messages.InternalEventBusSkill_3);
this.logger.getKernelLogger().log(
this.logger.prepareLogRecord(record, this.logger.getKernelLogger().getName(),
Throwables.getRootCause(e)));
}
// If we have an exception within the agent's initialization, we kill the agent.
setOwnerState(OwnerState.ALIVE);
// Asynchronous kill of the event.
this.agentAsEventListener.killOrMarkAsKilled();
}
} | [
"private",
"void",
"runInitializationStage",
"(",
"Event",
"event",
")",
"{",
"// Immediate synchronous dispatching of Initialize event",
"try",
"{",
"setOwnerState",
"(",
"OwnerState",
".",
"INITIALIZING",
")",
";",
"try",
"{",
"this",
".",
"eventDispatcher",
".",
"i... | This function runs the initialization of the agent.
@param event the {@link Initialize} occurrence. | [
"This",
"function",
"runs",
"the",
"initialization",
"of",
"the",
"agent",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/InternalEventBusSkill.java#L237-L266 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.getDouble | public static Double getDouble(Map<?, ?> map, Object key) {
return get(map, key, Double.class);
} | java | public static Double getDouble(Map<?, ?> map, Object key) {
return get(map, key, Double.class);
} | [
"public",
"static",
"Double",
"getDouble",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Object",
"key",
")",
"{",
"return",
"get",
"(",
"map",
",",
"key",
",",
"Double",
".",
"class",
")",
";",
"}"
] | 获取Map指定key的值,并转换为Double
@param map Map
@param key 键
@return 值
@since 4.0.6 | [
"获取Map指定key的值,并转换为Double"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L780-L782 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.replaceFirst | public static String replaceFirst(final String text, final Pattern regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text;
}
return regex.matcher(text).replaceFirst(replacement);
} | java | public static String replaceFirst(final String text, final Pattern regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text;
}
return regex.matcher(text).replaceFirst(replacement);
} | [
"public",
"static",
"String",
"replaceFirst",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"regex",
"==",
"null",
"||",
"replacement",
"==",
"null"... | <p>Replaces the first substring of the text string that matches the given regular expression pattern
with the given replacement.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceFirst(replacement)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.replaceFirst(null, *, *) = null
StringUtils.replaceFirst("any", (Pattern) null, *) = "any"
StringUtils.replaceFirst("any", *, null) = "any"
StringUtils.replaceFirst("", Pattern.compile(""), "zzz") = "zzz"
StringUtils.replaceFirst("", Pattern.compile(".*"), "zzz") = "zzz"
StringUtils.replaceFirst("", Pattern.compile(".+"), "zzz") = ""
StringUtils.replaceFirst("abc", Pattern.compile(""), "ZZ") = "ZZabc"
StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\n<__>"
StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
StringUtils.replaceFirst("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC_bc123"
StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123abc"
StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123abc"
StringUtils.replaceFirst("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum dolor sit"
</pre>
@param text text to search and replace in, may be null
@param regex the regular expression pattern to which this string is to be matched
@param replacement the string to be substituted for the first match
@return the text with the first replacement processed,
{@code null} if null String input
@see java.util.regex.Matcher#replaceFirst(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Replaces",
"the",
"first",
"substring",
"of",
"the",
"text",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"pattern",
"with",
"the",
"given",
"replacement",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L355-L360 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2018_03_31_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_03_31_preview/implementation/TasksInner.java | TasksInner.updateAsync | public Observable<ProjectTaskInner> updateAsync(String groupName, String serviceName, String projectName, String taskName, ProjectTaskInner parameters) {
return updateWithServiceResponseAsync(groupName, serviceName, projectName, taskName, parameters).map(new Func1<ServiceResponse<ProjectTaskInner>, ProjectTaskInner>() {
@Override
public ProjectTaskInner call(ServiceResponse<ProjectTaskInner> response) {
return response.body();
}
});
} | java | public Observable<ProjectTaskInner> updateAsync(String groupName, String serviceName, String projectName, String taskName, ProjectTaskInner parameters) {
return updateWithServiceResponseAsync(groupName, serviceName, projectName, taskName, parameters).map(new Func1<ServiceResponse<ProjectTaskInner>, ProjectTaskInner>() {
@Override
public ProjectTaskInner call(ServiceResponse<ProjectTaskInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ProjectTaskInner",
">",
"updateAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"String",
"projectName",
",",
"String",
"taskName",
",",
"ProjectTaskInner",
"parameters",
")",
"{",
"return",
"updateWithServiceRespons... | Create or update task.
The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so.
@param groupName Name of the resource group
@param serviceName Name of the service
@param projectName Name of the project
@param taskName Name of the Task
@param parameters Information about the task
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ProjectTaskInner object | [
"Create",
"or",
"update",
"task",
".",
"The",
"tasks",
"resource",
"is",
"a",
"nested",
"proxy",
"-",
"only",
"resource",
"representing",
"work",
"performed",
"by",
"a",
"DMS",
"instance",
".",
"The",
"PATCH",
"method",
"updates",
"an",
"existing",
"task",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_03_31_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_03_31_preview/implementation/TasksInner.java#L938-L945 |
alkacon/opencms-core | src/org/opencms/gwt/CmsVfsService.java | CmsVfsService.getPageInfo | private CmsListInfoBean getPageInfo(CmsResource res) throws CmsException, CmsLoaderException {
CmsObject cms = getCmsObject();
return getPageInfo(cms, res);
} | java | private CmsListInfoBean getPageInfo(CmsResource res) throws CmsException, CmsLoaderException {
CmsObject cms = getCmsObject();
return getPageInfo(cms, res);
} | [
"private",
"CmsListInfoBean",
"getPageInfo",
"(",
"CmsResource",
"res",
")",
"throws",
"CmsException",
",",
"CmsLoaderException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"return",
"getPageInfo",
"(",
"cms",
",",
"res",
")",
";",
"}"
] | Returns a bean to display the {@link org.opencms.gwt.client.ui.CmsListItemWidget}.<p>
@param res the resource to get the page info for
@return a bean to display the {@link org.opencms.gwt.client.ui.CmsListItemWidget}.<p>
@throws CmsLoaderException if the resource type could not be found
@throws CmsException if something else goes wrong | [
"Returns",
"a",
"bean",
"to",
"display",
"the",
"{",
"@link",
"org",
".",
"opencms",
".",
"gwt",
".",
"client",
".",
"ui",
".",
"CmsListItemWidget",
"}",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L1592-L1596 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ExternalContextUtils.java | ExternalContextUtils.getSessionId | public static String getSessionId(ExternalContext ec, boolean create)
{
Object session = ec.getSession(create);
return (null != session) ? (String) _runMethod(session, "getId") : null;
} | java | public static String getSessionId(ExternalContext ec, boolean create)
{
Object session = ec.getSession(create);
return (null != session) ? (String) _runMethod(session, "getId") : null;
} | [
"public",
"static",
"String",
"getSessionId",
"(",
"ExternalContext",
"ec",
",",
"boolean",
"create",
")",
"{",
"Object",
"session",
"=",
"ec",
".",
"getSession",
"(",
"create",
")",
";",
"return",
"(",
"null",
"!=",
"session",
")",
"?",
"(",
"String",
"... | Returns the current active session id or <code>null</code> if there is
none.
@param ec the current external context
@param create create a new session if one is not created
@return a string containing the requestedSessionId | [
"Returns",
"the",
"current",
"active",
"session",
"id",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"there",
"is",
"none",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ExternalContextUtils.java#L235-L239 |
census-instrumentation/opencensus-java | contrib/http_util/src/main/java/io/opencensus/contrib/http/AbstractHttpHandler.java | AbstractHttpHandler.handleMessageSent | public final void handleMessageSent(HttpRequestContext context, long bytes) {
checkNotNull(context, "context");
context.sentMessageSize.addAndGet(bytes);
if (context.span.getOptions().contains(Options.RECORD_EVENTS)) {
// record compressed size
recordMessageEvent(context.span, context.sentSeqId.addAndGet(1L), Type.SENT, bytes, 0L);
}
} | java | public final void handleMessageSent(HttpRequestContext context, long bytes) {
checkNotNull(context, "context");
context.sentMessageSize.addAndGet(bytes);
if (context.span.getOptions().contains(Options.RECORD_EVENTS)) {
// record compressed size
recordMessageEvent(context.span, context.sentSeqId.addAndGet(1L), Type.SENT, bytes, 0L);
}
} | [
"public",
"final",
"void",
"handleMessageSent",
"(",
"HttpRequestContext",
"context",
",",
"long",
"bytes",
")",
"{",
"checkNotNull",
"(",
"context",
",",
"\"context\"",
")",
";",
"context",
".",
"sentMessageSize",
".",
"addAndGet",
"(",
"bytes",
")",
";",
"if... | Instrument an HTTP span after a message is sent. Typically called for every chunk of request or
response is sent.
@param context request specific {@link HttpRequestContext}
@param bytes bytes sent.
@since 0.19 | [
"Instrument",
"an",
"HTTP",
"span",
"after",
"a",
"message",
"is",
"sent",
".",
"Typically",
"called",
"for",
"every",
"chunk",
"of",
"request",
"or",
"response",
"is",
"sent",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/http_util/src/main/java/io/opencensus/contrib/http/AbstractHttpHandler.java#L77-L84 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java | SchemaHelper.getNodeValue | static public String getNodeValue(List<Element> elements, String nodeName, String defaultValue)
{
if (elements != null)
{
for (Element el : elements)
{
if (el.getNodeName().equals(nodeName))
{
if (el.getFirstChild() != null)
{
return el.getFirstChild().getTextContent();
}
}
}
}
return defaultValue;
} | java | static public String getNodeValue(List<Element> elements, String nodeName, String defaultValue)
{
if (elements != null)
{
for (Element el : elements)
{
if (el.getNodeName().equals(nodeName))
{
if (el.getFirstChild() != null)
{
return el.getFirstChild().getTextContent();
}
}
}
}
return defaultValue;
} | [
"static",
"public",
"String",
"getNodeValue",
"(",
"List",
"<",
"Element",
">",
"elements",
",",
"String",
"nodeName",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"elements",
"!=",
"null",
")",
"{",
"for",
"(",
"Element",
"el",
":",
"elements",
"... | Return the text value of the first child of the named node, or the specified default if the node can't be found.<br>
For example, calling getNodeValue(el, "Mode", "whatever") on a list of elements which contains the following XML:
<Mode>survival</Mode>
should return "survival".
@param elements the list of XML elements to search
@param nodeName the name of the parent node to extract the text value from
@param defaultValue the default to return if the node is empty / doesn't exist
@return the text content of the desired element | [
"Return",
"the",
"text",
"value",
"of",
"the",
"first",
"child",
"of",
"the",
"named",
"node",
"or",
"the",
"specified",
"default",
"if",
"the",
"node",
"can",
"t",
"be",
"found",
".",
"<br",
">",
"For",
"example",
"calling",
"getNodeValue",
"(",
"el",
... | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java#L223-L239 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/AlpnSupportUtils.java | AlpnSupportUtils.getAlpnResult | protected static void getAlpnResult(SSLEngine engine, SSLConnectionLink link) {
alpnNegotiator.tryToRemoveAlpnNegotiator(link.getAlpnNegotiator(), engine, link);
} | java | protected static void getAlpnResult(SSLEngine engine, SSLConnectionLink link) {
alpnNegotiator.tryToRemoveAlpnNegotiator(link.getAlpnNegotiator(), engine, link);
} | [
"protected",
"static",
"void",
"getAlpnResult",
"(",
"SSLEngine",
"engine",
",",
"SSLConnectionLink",
"link",
")",
"{",
"alpnNegotiator",
".",
"tryToRemoveAlpnNegotiator",
"(",
"link",
".",
"getAlpnNegotiator",
"(",
")",
",",
"engine",
",",
"link",
")",
";",
"}"... | This must be called after the SSL handshake has completed. If an ALPN protocol was selected by the available provider,
that protocol will be set on the SSLConnectionLink. Also, additional cleanup will be done for some ALPN providers.
@param SSLEngine
@param SSLConnectionLink | [
"This",
"must",
"be",
"called",
"after",
"the",
"SSL",
"handshake",
"has",
"completed",
".",
"If",
"an",
"ALPN",
"protocol",
"was",
"selected",
"by",
"the",
"available",
"provider",
"that",
"protocol",
"will",
"be",
"set",
"on",
"the",
"SSLConnectionLink",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/AlpnSupportUtils.java#L58-L60 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.setMetaClass | public static void setMetaClass(Class self, MetaClass metaClass) {
final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
if (metaClass == null)
metaClassRegistry.removeMetaClass(self);
else {
if (metaClass instanceof HandleMetaClass) {
metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
} else {
metaClassRegistry.setMetaClass(self, metaClass);
}
if (self==NullObject.class) {
NullObject.getNullObject().setMetaClass(metaClass);
}
}
} | java | public static void setMetaClass(Class self, MetaClass metaClass) {
final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
if (metaClass == null)
metaClassRegistry.removeMetaClass(self);
else {
if (metaClass instanceof HandleMetaClass) {
metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
} else {
metaClassRegistry.setMetaClass(self, metaClass);
}
if (self==NullObject.class) {
NullObject.getNullObject().setMetaClass(metaClass);
}
}
} | [
"public",
"static",
"void",
"setMetaClass",
"(",
"Class",
"self",
",",
"MetaClass",
"metaClass",
")",
"{",
"final",
"MetaClassRegistry",
"metaClassRegistry",
"=",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
";",
"if",
"(",
"metaClass",
"==",
"null",
"... | Sets the metaclass for a given class.
@param self the class whose metaclass we wish to set
@param metaClass the new MetaClass
@since 1.6.0 | [
"Sets",
"the",
"metaclass",
"for",
"a",
"given",
"class",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17270-L17284 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/WordUtils.java | WordUtils.containsAllWords | public static boolean containsAllWords(final CharSequence word, final CharSequence... words) {
if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) {
return false;
}
for (final CharSequence w : words) {
if (StringUtils.isBlank(w)) {
return false;
}
final RegExp p = RegExp.compile(".*\\b" + w + "\\b.*");
MatchResult m = p.exec(word.toString());
if (m == null || m.getGroupCount() == 0) {
return false;
}
}
return true;
} | java | public static boolean containsAllWords(final CharSequence word, final CharSequence... words) {
if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) {
return false;
}
for (final CharSequence w : words) {
if (StringUtils.isBlank(w)) {
return false;
}
final RegExp p = RegExp.compile(".*\\b" + w + "\\b.*");
MatchResult m = p.exec(word.toString());
if (m == null || m.getGroupCount() == 0) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"containsAllWords",
"(",
"final",
"CharSequence",
"word",
",",
"final",
"CharSequence",
"...",
"words",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"word",
")",
"||",
"ArrayUtils",
".",
"isEmpty",
"(",
"words",
")"... | <p>Checks if the String contains all words in the given array.</p>
<p>
A {@code null} String will return {@code false}. A {@code null}, zero
length search array or if one element of array is null will return {@code false}.
</p>
<pre>
WordUtils.containsAllWords(null, *) = false
WordUtils.containsAllWords("", *) = false
WordUtils.containsAllWords(*, null) = false
WordUtils.containsAllWords(*, []) = false
WordUtils.containsAllWords("abcd", "ab", "cd") = false
WordUtils.containsAllWords("abc def", "def", "abc") = true
</pre>
@param word The CharSequence to check, may be null
@param words The array of String words to search for, may be null
@return {@code true} if all search words are found, {@code false} otherwise
@since 3.5 | [
"<p",
">",
"Checks",
"if",
"the",
"String",
"contains",
"all",
"words",
"in",
"the",
"given",
"array",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/WordUtils.java#L718-L733 |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/util/MethodsBag.java | MethodsBag.itosReverse | public final static int itosReverse(int i, int index, char[] buf) {
assert (i >= 0);
int q, r;
int posChar = index;
// Generate two digits per iteration
while (i >= 65536) {
q = i / 100;
// really: r = i - (q * 100);
r = i - ((q << 6) + (q << 5) + (q << 2));
i = q;
buf[posChar++] = DigitOnes[r];
buf[posChar++] = DigitTens[r];
}
// Fall thru to fast mode for smaller numbers
// assert(i <= 65536, i);
for (;;) {
q = (i * 52429) >>> (16 + 3);
r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ...
buf[posChar++] = digits[r];
i = q;
if (i == 0)
break;
}
return (posChar - index); // number of written chars
} | java | public final static int itosReverse(int i, int index, char[] buf) {
assert (i >= 0);
int q, r;
int posChar = index;
// Generate two digits per iteration
while (i >= 65536) {
q = i / 100;
// really: r = i - (q * 100);
r = i - ((q << 6) + (q << 5) + (q << 2));
i = q;
buf[posChar++] = DigitOnes[r];
buf[posChar++] = DigitTens[r];
}
// Fall thru to fast mode for smaller numbers
// assert(i <= 65536, i);
for (;;) {
q = (i * 52429) >>> (16 + 3);
r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ...
buf[posChar++] = digits[r];
i = q;
if (i == 0)
break;
}
return (posChar - index); // number of written chars
} | [
"public",
"final",
"static",
"int",
"itosReverse",
"(",
"int",
"i",
",",
"int",
"index",
",",
"char",
"[",
"]",
"buf",
")",
"{",
"assert",
"(",
"i",
">=",
"0",
")",
";",
"int",
"q",
",",
"r",
";",
"int",
"posChar",
"=",
"index",
";",
"// Generate... | Places characters representing the integer i into the character array buf
in reverse order.
Will fail if i < 0 (zero)
@param i
integer
@param index
index
@param buf
character buffer
@return number of written chars | [
"Places",
"characters",
"representing",
"the",
"integer",
"i",
"into",
"the",
"character",
"array",
"buf",
"in",
"reverse",
"order",
"."
] | train | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/MethodsBag.java#L454-L481 |
docker-java/docker-java | src/main/java/com/github/dockerjava/core/command/WaitContainerResultCallback.java | WaitContainerResultCallback.awaitStatusCode | public Integer awaitStatusCode(long timeout, TimeUnit timeUnit) {
try {
if (!awaitCompletion(timeout, timeUnit)) {
throw new DockerClientException("Awaiting status code timeout.");
}
} catch (InterruptedException e) {
throw new DockerClientException("Awaiting status code interrupted: ", e);
}
return getStatusCode();
} | java | public Integer awaitStatusCode(long timeout, TimeUnit timeUnit) {
try {
if (!awaitCompletion(timeout, timeUnit)) {
throw new DockerClientException("Awaiting status code timeout.");
}
} catch (InterruptedException e) {
throw new DockerClientException("Awaiting status code interrupted: ", e);
}
return getStatusCode();
} | [
"public",
"Integer",
"awaitStatusCode",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"awaitCompletion",
"(",
"timeout",
",",
"timeUnit",
")",
")",
"{",
"throw",
"new",
"DockerClientException",
"(",
"\"Awaiting stat... | Awaits the status code from the container.
@throws DockerClientException
if the wait operation fails. | [
"Awaits",
"the",
"status",
"code",
"from",
"the",
"container",
"."
] | train | https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/command/WaitContainerResultCallback.java#L57-L67 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ImplementationImpl.java | ImplementationImpl.newTransaction | public Transaction newTransaction()
{
if ((getCurrentDatabase() == null))
{
throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction");
}
TransactionImpl tx = new TransactionImpl(this);
try
{
getConfigurator().configure(tx);
}
catch (ConfigurationException e)
{
throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage());
}
return tx;
} | java | public Transaction newTransaction()
{
if ((getCurrentDatabase() == null))
{
throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction");
}
TransactionImpl tx = new TransactionImpl(this);
try
{
getConfigurator().configure(tx);
}
catch (ConfigurationException e)
{
throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage());
}
return tx;
} | [
"public",
"Transaction",
"newTransaction",
"(",
")",
"{",
"if",
"(",
"(",
"getCurrentDatabase",
"(",
")",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"DatabaseClosedException",
"(",
"\"Database is NULL, must have a DB in order to create a transaction\"",
")",
";",
"}... | Create a <code>Transaction</code> object and associate it with the current thread.
@return The newly created <code>Transaction</code> instance.
@see Transaction | [
"Create",
"a",
"<code",
">",
"Transaction<",
"/",
"code",
">",
"object",
"and",
"associate",
"it",
"with",
"the",
"current",
"thread",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationImpl.java#L144-L160 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/TypeReference.java | TypeReference.putTarget | static void putTarget(final int targetTypeAndInfo, final ByteVector output) {
switch (targetTypeAndInfo >>> 24) {
case CLASS_TYPE_PARAMETER:
case METHOD_TYPE_PARAMETER:
case METHOD_FORMAL_PARAMETER:
output.putShort(targetTypeAndInfo >>> 16);
break;
case FIELD:
case METHOD_RETURN:
case METHOD_RECEIVER:
output.putByte(targetTypeAndInfo >>> 24);
break;
case CAST:
case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
case METHOD_INVOCATION_TYPE_ARGUMENT:
case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
case METHOD_REFERENCE_TYPE_ARGUMENT:
output.putInt(targetTypeAndInfo);
break;
case CLASS_EXTENDS:
case CLASS_TYPE_PARAMETER_BOUND:
case METHOD_TYPE_PARAMETER_BOUND:
case THROWS:
case EXCEPTION_PARAMETER:
case INSTANCEOF:
case NEW:
case CONSTRUCTOR_REFERENCE:
case METHOD_REFERENCE:
output.put12(targetTypeAndInfo >>> 24, (targetTypeAndInfo & 0xFFFF00) >> 8);
break;
default:
throw new IllegalArgumentException();
}
} | java | static void putTarget(final int targetTypeAndInfo, final ByteVector output) {
switch (targetTypeAndInfo >>> 24) {
case CLASS_TYPE_PARAMETER:
case METHOD_TYPE_PARAMETER:
case METHOD_FORMAL_PARAMETER:
output.putShort(targetTypeAndInfo >>> 16);
break;
case FIELD:
case METHOD_RETURN:
case METHOD_RECEIVER:
output.putByte(targetTypeAndInfo >>> 24);
break;
case CAST:
case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
case METHOD_INVOCATION_TYPE_ARGUMENT:
case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
case METHOD_REFERENCE_TYPE_ARGUMENT:
output.putInt(targetTypeAndInfo);
break;
case CLASS_EXTENDS:
case CLASS_TYPE_PARAMETER_BOUND:
case METHOD_TYPE_PARAMETER_BOUND:
case THROWS:
case EXCEPTION_PARAMETER:
case INSTANCEOF:
case NEW:
case CONSTRUCTOR_REFERENCE:
case METHOD_REFERENCE:
output.put12(targetTypeAndInfo >>> 24, (targetTypeAndInfo & 0xFFFF00) >> 8);
break;
default:
throw new IllegalArgumentException();
}
} | [
"static",
"void",
"putTarget",
"(",
"final",
"int",
"targetTypeAndInfo",
",",
"final",
"ByteVector",
"output",
")",
"{",
"switch",
"(",
"targetTypeAndInfo",
">>>",
"24",
")",
"{",
"case",
"CLASS_TYPE_PARAMETER",
":",
"case",
"METHOD_TYPE_PARAMETER",
":",
"case",
... | Puts the given target_type and target_info JVMS structures into the given ByteVector.
@param targetTypeAndInfo a target_type and a target_info structures encoded as in {@link
#targetTypeAndInfo}. LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported.
@param output where the type reference must be put. | [
"Puts",
"the",
"given",
"target_type",
"and",
"target_info",
"JVMS",
"structures",
"into",
"the",
"given",
"ByteVector",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/TypeReference.java#L402-L435 |
wildfly-extras/wildfly-camel | config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java | IllegalArgumentAssertion.assertFalse | public static Boolean assertFalse(Boolean value, String message) {
if (Boolean.valueOf(value))
throw new IllegalArgumentException(message);
return value;
} | java | public static Boolean assertFalse(Boolean value, String message) {
if (Boolean.valueOf(value))
throw new IllegalArgumentException(message);
return value;
} | [
"public",
"static",
"Boolean",
"assertFalse",
"(",
"Boolean",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"return",
"value",
... | Throws an IllegalArgumentException when the given value is not false.
@param value the value to assert if false
@param message the message to display if the value is false
@return the value | [
"Throws",
"an",
"IllegalArgumentException",
"when",
"the",
"given",
"value",
"is",
"not",
"false",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L66-L70 |
mediathekview/MServer | src/main/java/mServer/crawler/sender/arte/ArteVideoDetailsDeserializer.java | ArteVideoDetailsDeserializer.getBroadcastDateIgnoringCatchupRights | private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) {
String broadcastDate = "";
for(int i = 0; i < broadcastArray.size(); i++) {
JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject();
if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) &&
broadcastObject.has(JSON_ELEMENT_BROADCAST)) {
String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString();
if(type.equals(broadcastType)) {
if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) {
broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString());
}
}
}
}
return broadcastDate;
} | java | private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) {
String broadcastDate = "";
for(int i = 0; i < broadcastArray.size(); i++) {
JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject();
if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) &&
broadcastObject.has(JSON_ELEMENT_BROADCAST)) {
String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString();
if(type.equals(broadcastType)) {
if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) {
broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString());
}
}
}
}
return broadcastDate;
} | [
"private",
"static",
"String",
"getBroadcastDateIgnoringCatchupRights",
"(",
"JsonArray",
"broadcastArray",
",",
"String",
"broadcastType",
")",
"{",
"String",
"broadcastDate",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"broadcastArray",
... | *
liefert die erste Ausstrahlung des Typs ohne Berücksichtigung der CatchupRights | [
"*",
"liefert",
"die",
"erste",
"Ausstrahlung",
"des",
"Typs",
"ohne",
"Berücksichtigung",
"der",
"CatchupRights"
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/arte/ArteVideoDetailsDeserializer.java#L285-L304 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java | JdbcCpoXaAdapter.deleteObject | @Override
public <T> long deleteObject(String name, T obj) throws CpoException {
return getCurrentResource().deleteObject( name, obj);
} | java | @Override
public <T> long deleteObject(String name, T obj) throws CpoException {
return getCurrentResource().deleteObject( name, obj);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"deleteObject",
"(",
"String",
"name",
",",
"T",
"obj",
")",
"throws",
"CpoException",
"{",
"return",
"getCurrentResource",
"(",
")",
".",
"deleteObject",
"(",
"name",
",",
"obj",
")",
";",
"}"
] | Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method
stores the object in the datasource
<p>
<pre>Example:
<code>
<p>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p>
try {
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
cpo.deleteObject("DeleteById",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the DELETE Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
@return The number of objects deleted from the datasource
@throws CpoException Thrown if there are errors accessing the datasource | [
"Removes",
"the",
"Object",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"object",
"exists",
"in",
"the",
"datasource",
".",
"This",
"method",
"stores",
"the",
"object",
"in",
"the",
"datasource",
"<p",
">",
"<pre",
">",
"Exa... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L484-L487 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.deleteImageTagsAsync | public Observable<Void> deleteImageTagsAsync(UUID projectId, List<String> imageIds, List<String> tagIds) {
return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteImageTagsAsync(UUID projectId, List<String> imageIds, List<String> tagIds) {
return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteImageTagsAsync",
"(",
"UUID",
"projectId",
",",
"List",
"<",
"String",
">",
"imageIds",
",",
"List",
"<",
"String",
">",
"tagIds",
")",
"{",
"return",
"deleteImageTagsWithServiceResponseAsync",
"(",
"projectId",
"... | Remove a set of tags from a set of images.
@param projectId The project id
@param imageIds Image ids. Limited to 64 images
@param tagIds Tags to be deleted from the specified images. Limted to 20 tags
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Remove",
"a",
"set",
"of",
"tags",
"from",
"a",
"set",
"of",
"images",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3532-L3539 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeCharacterObjDesc | public static Character decodeCharacterObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int b = src[srcOffset];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
return decodeCharDesc(src, srcOffset + 1);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static Character decodeCharacterObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int b = src[srcOffset];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
return decodeCharDesc(src, srcOffset + 1);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"Character",
"decodeCharacterObjDesc",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"int",
"b",
"=",
"src",
"[",
"srcOffset",
"]",
";",
"if",
"(",
"b",
"==",
"NULL_BY... | Decodes a Character object from exactly 1 or 3 bytes, as encoded for
descending order. If null is returned, then 1 byte was read.
@param src source of encoded bytes
@param srcOffset offset into source array
@return Character object or null | [
"Decodes",
"a",
"Character",
"object",
"from",
"exactly",
"1",
"or",
"3",
"bytes",
"as",
"encoded",
"for",
"descending",
"order",
".",
"If",
"null",
"is",
"returned",
"then",
"1",
"byte",
"was",
"read",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L213-L225 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/CounterAspect.java | CounterAspect.countMethod | @Around(value = "execution(* *(..)) && (@annotation(annotation))")
public Object countMethod(ProceedingJoinPoint pjp, Count annotation) throws Throwable {
return count(pjp, annotation.producerId(), annotation.subsystem(), annotation.category());
} | java | @Around(value = "execution(* *(..)) && (@annotation(annotation))")
public Object countMethod(ProceedingJoinPoint pjp, Count annotation) throws Throwable {
return count(pjp, annotation.producerId(), annotation.subsystem(), annotation.category());
} | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *(..)) && (@annotation(annotation))\"",
")",
"public",
"Object",
"countMethod",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"Count",
"annotation",
")",
"throws",
"Throwable",
"{",
"return",
"count",
"(",
"pjp",
",",
"anno... | Pointcut definition for @Count annotation at method level.
@param pjp ProceedingJoinPoint.
@param annotation @Count annotation.
@return
@throws Throwable | [
"Pointcut",
"definition",
"for"
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/CounterAspect.java#L31-L34 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java | UsersInner.createOrUpdateAsync | public Observable<UserInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) {
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | java | public Observable<UserInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) {
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UserInner",
">",
"createOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"UserInner",
"user",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
","... | Creates a new user or updates an existing user's information on a data box edge/gateway device.
@param deviceName The device name.
@param name The user name.
@param resourceGroupName The resource group name.
@param user The user details.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"new",
"user",
"or",
"updates",
"an",
"existing",
"user",
"s",
"information",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L351-L358 |
rometools/rome | rome-certiorem/src/main/java/com/rometools/certiorem/pub/Publisher.java | Publisher.sendUpdateNotificationAsyncronously | public void sendUpdateNotificationAsyncronously(final String hub, final String topic, final AsyncNotificationCallback callback) {
final Runnable r = new Runnable() {
@Override
public void run() {
try {
sendUpdateNotification(hub, topic);
callback.onSuccess();
} catch (final Throwable t) {
callback.onFailure(t);
}
}
};
if (executor != null) {
executor.execute(r);
} else {
new Thread(r).start();
}
} | java | public void sendUpdateNotificationAsyncronously(final String hub, final String topic, final AsyncNotificationCallback callback) {
final Runnable r = new Runnable() {
@Override
public void run() {
try {
sendUpdateNotification(hub, topic);
callback.onSuccess();
} catch (final Throwable t) {
callback.onFailure(t);
}
}
};
if (executor != null) {
executor.execute(r);
} else {
new Thread(r).start();
}
} | [
"public",
"void",
"sendUpdateNotificationAsyncronously",
"(",
"final",
"String",
"hub",
",",
"final",
"String",
"topic",
",",
"final",
"AsyncNotificationCallback",
"callback",
")",
"{",
"final",
"Runnable",
"r",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Overr... | Sends the HUB url a notification of a change in topic asynchronously
@param hub URL of the hub to notify.
@param topic The Topic that has changed
@param callback A callback invoked when the notification completes.
@throws NotificationException Any failure | [
"Sends",
"the",
"HUB",
"url",
"a",
"notification",
"of",
"a",
"change",
"in",
"topic",
"asynchronously"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-certiorem/src/main/java/com/rometools/certiorem/pub/Publisher.java#L160-L178 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java | MessageRetriever.getText | public String getText(String key, Object... args) throws MissingResourceException {
ResourceBundle bundle = initRB();
String message = bundle.getString(key);
return MessageFormat.format(message, args);
} | java | public String getText(String key, Object... args) throws MissingResourceException {
ResourceBundle bundle = initRB();
String message = bundle.getString(key);
return MessageFormat.format(message, args);
} | [
"public",
"String",
"getText",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"throws",
"MissingResourceException",
"{",
"ResourceBundle",
"bundle",
"=",
"initRB",
"(",
")",
";",
"String",
"message",
"=",
"bundle",
".",
"getString",
"(",
"key",
")"... | Get and format message string from resource
@param key selects message from resource
@param args arguments to be replaced in the message.
@throws MissingResourceException when the key does not
exist in the properties file. | [
"Get",
"and",
"format",
"message",
"string",
"from",
"resource"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java#L123-L127 |
apache/incubator-atlas | webapp/src/main/java/org/apache/atlas/web/service/AtlasZookeeperSecurityProperties.java | AtlasZookeeperSecurityProperties.parseAuth | public static AuthInfo parseAuth(String authString) {
String[] authComponents = getComponents(authString, "authString", "scheme:authString");
return new AuthInfo(authComponents[0], authComponents[1].getBytes(Charsets.UTF_8));
} | java | public static AuthInfo parseAuth(String authString) {
String[] authComponents = getComponents(authString, "authString", "scheme:authString");
return new AuthInfo(authComponents[0], authComponents[1].getBytes(Charsets.UTF_8));
} | [
"public",
"static",
"AuthInfo",
"parseAuth",
"(",
"String",
"authString",
")",
"{",
"String",
"[",
"]",
"authComponents",
"=",
"getComponents",
"(",
"authString",
",",
"\"authString\"",
",",
"\"scheme:authString\"",
")",
";",
"return",
"new",
"AuthInfo",
"(",
"a... | Get an {@link AuthInfo} by parsing input string.
@param authString A string of the form scheme:authString
@return {@link AuthInfo} with the scheme and auth taken from configuration values. | [
"Get",
"an",
"{"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/service/AtlasZookeeperSecurityProperties.java#L70-L73 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/db/SQLUtils.java | SQLUtils.wrapQuery | public static ResultSetResult wrapQuery(Connection connection, String sql,
String[] selectionArgs) {
return new ResultSetResult(query(connection, sql, selectionArgs));
} | java | public static ResultSetResult wrapQuery(Connection connection, String sql,
String[] selectionArgs) {
return new ResultSetResult(query(connection, sql, selectionArgs));
} | [
"public",
"static",
"ResultSetResult",
"wrapQuery",
"(",
"Connection",
"connection",
",",
"String",
"sql",
",",
"String",
"[",
"]",
"selectionArgs",
")",
"{",
"return",
"new",
"ResultSetResult",
"(",
"query",
"(",
"connection",
",",
"sql",
",",
"selectionArgs",
... | Perform the query and wrap as a result
@param connection
connection
@param sql
sql statement
@param selectionArgs
selection arguments
@return result
@since 3.1.0 | [
"Perform",
"the",
"query",
"and",
"wrap",
"as",
"a",
"result"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/db/SQLUtils.java#L596-L599 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsDocumentTypeAddList.java | CmsDocumentTypeAddList.fillDetailMimetypes | private void fillDetailMimetypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of mime types
Iterator<String> itMimetypes = docType.getMimeTypes().iterator();
html.append("<ul>\n");
while (itMimetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itMimetypes.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} | java | private void fillDetailMimetypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of mime types
Iterator<String> itMimetypes = docType.getMimeTypes().iterator();
html.append("<ul>\n");
while (itMimetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itMimetypes.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} | [
"private",
"void",
"fillDetailMimetypes",
"(",
"CmsListItem",
"item",
",",
"String",
"detailId",
")",
"{",
"CmsSearchManager",
"searchManager",
"=",
"OpenCms",
".",
"getSearchManager",
"(",
")",
";",
"StringBuffer",
"html",
"=",
"new",
"StringBuffer",
"(",
")",
... | Fills details about configured mime types of the document type into the given item. <p>
@param item the list item to fill
@param detailId the id for the detail to fill | [
"Fills",
"details",
"about",
"configured",
"mime",
"types",
"of",
"the",
"document",
"type",
"into",
"the",
"given",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsDocumentTypeAddList.java#L492-L510 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/internal/MessageProcessor.java | MessageProcessor.createTempMessage | public ChatMessage createTempMessage() {
return ChatMessage.builder()
.setMessageId(tempId)
.setSentEventId(-1L) // temporary value, will be replaced by persistence controller
.setConversationId(conversationId)
.setSentBy(sender)
.setFromWhom(new Sender(sender, sender))
.setSentOn(System.currentTimeMillis())
.setParts(getAllParts())
.setMetadata(originalMessage.getMetadata())
.build();
} | java | public ChatMessage createTempMessage() {
return ChatMessage.builder()
.setMessageId(tempId)
.setSentEventId(-1L) // temporary value, will be replaced by persistence controller
.setConversationId(conversationId)
.setSentBy(sender)
.setFromWhom(new Sender(sender, sender))
.setSentOn(System.currentTimeMillis())
.setParts(getAllParts())
.setMetadata(originalMessage.getMetadata())
.build();
} | [
"public",
"ChatMessage",
"createTempMessage",
"(",
")",
"{",
"return",
"ChatMessage",
".",
"builder",
"(",
")",
".",
"setMessageId",
"(",
"tempId",
")",
".",
"setSentEventId",
"(",
"-",
"1L",
")",
"// temporary value, will be replaced by persistence controller",
".",
... | Create a temporary message to be displayed while the message is being send. to be replaced later on with a final message constructed with MessageProcessor#createFinalMessage(MessageSentResponse).
@return Temporary message to be saved in persistance store. | [
"Create",
"a",
"temporary",
"message",
"to",
"be",
"displayed",
"while",
"the",
"message",
"is",
"being",
"send",
".",
"to",
"be",
"replaced",
"later",
"on",
"with",
"a",
"final",
"message",
"constructed",
"with",
"MessageProcessor#createFinalMessage",
"(",
"Mes... | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/internal/MessageProcessor.java#L231-L242 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuTexRefGetAddressMode | public static int cuTexRefGetAddressMode(int pam[], CUtexref hTexRef, int dim)
{
return checkResult(cuTexRefGetAddressModeNative(pam, hTexRef, dim));
} | java | public static int cuTexRefGetAddressMode(int pam[], CUtexref hTexRef, int dim)
{
return checkResult(cuTexRefGetAddressModeNative(pam, hTexRef, dim));
} | [
"public",
"static",
"int",
"cuTexRefGetAddressMode",
"(",
"int",
"pam",
"[",
"]",
",",
"CUtexref",
"hTexRef",
",",
"int",
"dim",
")",
"{",
"return",
"checkResult",
"(",
"cuTexRefGetAddressModeNative",
"(",
"pam",
",",
"hTexRef",
",",
"dim",
")",
")",
";",
... | Gets the addressing mode used by a texture reference.
<pre>
CUresult cuTexRefGetAddressMode (
CUaddress_mode* pam,
CUtexref hTexRef,
int dim )
</pre>
<div>
<p>Gets the addressing mode used by a
texture reference. Returns in <tt>*pam</tt> the addressing mode
corresponding to the dimension <tt>dim</tt> of the texture reference
<tt>hTexRef</tt>. Currently, the only valid value for <tt>dim</tt>
are 0 and 1.
</p>
</div>
@param pam Returned addressing mode
@param hTexRef Texture reference
@param dim Dimension
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuTexRefSetAddress
@see JCudaDriver#cuTexRefSetAddress2D
@see JCudaDriver#cuTexRefSetAddressMode
@see JCudaDriver#cuTexRefSetArray
@see JCudaDriver#cuTexRefSetFilterMode
@see JCudaDriver#cuTexRefSetFlags
@see JCudaDriver#cuTexRefSetFormat
@see JCudaDriver#cuTexRefGetAddress
@see JCudaDriver#cuTexRefGetArray
@see JCudaDriver#cuTexRefGetFilterMode
@see JCudaDriver#cuTexRefGetFlags
@see JCudaDriver#cuTexRefGetFormat | [
"Gets",
"the",
"addressing",
"mode",
"used",
"by",
"a",
"texture",
"reference",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L10519-L10522 |
protostuff/protostuff | protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java | MsgpackIOUtil.parseListFrom | public static <T> List<T> parseListFrom(MessageBufferInput in, Schema<T> schema, boolean numeric) throws IOException
{
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(in);
try
{
return parseListFrom(unpacker, schema, numeric);
}
finally
{
unpacker.close();
}
} | java | public static <T> List<T> parseListFrom(MessageBufferInput in, Schema<T> schema, boolean numeric) throws IOException
{
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(in);
try
{
return parseListFrom(unpacker, schema, numeric);
}
finally
{
unpacker.close();
}
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"parseListFrom",
"(",
"MessageBufferInput",
"in",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"throws",
"IOException",
"{",
"MessageUnpacker",
"unpacker",
"=",
"MessagePack... | Parses the {@code messages} from the stream using the given {@code schema}. | [
"Parses",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L310-L323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.