repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTree.java | MkCoPTree.adjustApproximatedKNNDistances | private void adjustApproximatedKNNDistances(MkCoPEntry entry, Map<DBID, KNNList> knnLists) {
MkCoPTreeNode<O> node = getNode(entry);
if(node.isLeaf()) {
for(int i = 0; i < node.getNumEntries(); i++) {
MkCoPLeafEntry leafEntry = (MkCoPLeafEntry) node.getEntry(i);
approximateKnnDistances(leafEntry, knnLists.get(leafEntry.getRoutingObjectID()));
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
MkCoPEntry dirEntry = node.getEntry(i);
adjustApproximatedKNNDistances(dirEntry, knnLists);
}
}
ApproximationLine approx = node.conservativeKnnDistanceApproximation(settings.kmax);
entry.setConservativeKnnDistanceApproximation(approx);
} | java | private void adjustApproximatedKNNDistances(MkCoPEntry entry, Map<DBID, KNNList> knnLists) {
MkCoPTreeNode<O> node = getNode(entry);
if(node.isLeaf()) {
for(int i = 0; i < node.getNumEntries(); i++) {
MkCoPLeafEntry leafEntry = (MkCoPLeafEntry) node.getEntry(i);
approximateKnnDistances(leafEntry, knnLists.get(leafEntry.getRoutingObjectID()));
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
MkCoPEntry dirEntry = node.getEntry(i);
adjustApproximatedKNNDistances(dirEntry, knnLists);
}
}
ApproximationLine approx = node.conservativeKnnDistanceApproximation(settings.kmax);
entry.setConservativeKnnDistanceApproximation(approx);
} | [
"private",
"void",
"adjustApproximatedKNNDistances",
"(",
"MkCoPEntry",
"entry",
",",
"Map",
"<",
"DBID",
",",
"KNNList",
">",
"knnLists",
")",
"{",
"MkCoPTreeNode",
"<",
"O",
">",
"node",
"=",
"getNode",
"(",
"entry",
")",
";",
"if",
"(",
"node",
".",
"... | Adjusts the knn distance in the subtree of the specified root entry.
@param entry the root entry of the current subtree
@param knnLists a map of knn lists for each leaf entry | [
"Adjusts",
"the",
"knn",
"distance",
"in",
"the",
"subtree",
"of",
"the",
"specified",
"root",
"entry",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTree.java#L300-L318 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | ProcessDefinitionManager.deleteProcessDefinition | public void deleteProcessDefinition(ProcessDefinition processDefinition, String processDefinitionId, boolean cascadeToHistory, boolean cascadeToInstances, boolean skipCustomListeners, boolean skipIoMappings) {
if (cascadeToHistory) {
cascadeDeleteHistoryForProcessDefinition(processDefinitionId);
if (cascadeToInstances) {
cascadeDeleteProcessInstancesForProcessDefinition(processDefinitionId, skipCustomListeners, skipIoMappings);
}
} else {
ProcessInstanceQueryImpl procInstQuery = new ProcessInstanceQueryImpl().processDefinitionId(processDefinitionId);
long processInstanceCount = getProcessInstanceManager().findProcessInstanceCountByQueryCriteria(procInstQuery);
if (processInstanceCount != 0) {
throw LOG.deleteProcessDefinitionWithProcessInstancesException(processDefinitionId, processInstanceCount);
}
}
// remove related authorization parameters in IdentityLink table
getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId);
// remove timer start events:
deleteTimerStartEventsForProcessDefinition(processDefinition);
//delete process definition from database
getDbEntityManager().delete(ProcessDefinitionEntity.class, "deleteProcessDefinitionsById", processDefinitionId);
// remove process definition from cache:
Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.removeProcessDefinition(processDefinitionId);
deleteSubscriptionsForProcessDefinition(processDefinitionId);
// delete job definitions
getJobDefinitionManager().deleteJobDefinitionsByProcessDefinitionId(processDefinition.getId());
} | java | public void deleteProcessDefinition(ProcessDefinition processDefinition, String processDefinitionId, boolean cascadeToHistory, boolean cascadeToInstances, boolean skipCustomListeners, boolean skipIoMappings) {
if (cascadeToHistory) {
cascadeDeleteHistoryForProcessDefinition(processDefinitionId);
if (cascadeToInstances) {
cascadeDeleteProcessInstancesForProcessDefinition(processDefinitionId, skipCustomListeners, skipIoMappings);
}
} else {
ProcessInstanceQueryImpl procInstQuery = new ProcessInstanceQueryImpl().processDefinitionId(processDefinitionId);
long processInstanceCount = getProcessInstanceManager().findProcessInstanceCountByQueryCriteria(procInstQuery);
if (processInstanceCount != 0) {
throw LOG.deleteProcessDefinitionWithProcessInstancesException(processDefinitionId, processInstanceCount);
}
}
// remove related authorization parameters in IdentityLink table
getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId);
// remove timer start events:
deleteTimerStartEventsForProcessDefinition(processDefinition);
//delete process definition from database
getDbEntityManager().delete(ProcessDefinitionEntity.class, "deleteProcessDefinitionsById", processDefinitionId);
// remove process definition from cache:
Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.removeProcessDefinition(processDefinitionId);
deleteSubscriptionsForProcessDefinition(processDefinitionId);
// delete job definitions
getJobDefinitionManager().deleteJobDefinitionsByProcessDefinitionId(processDefinition.getId());
} | [
"public",
"void",
"deleteProcessDefinition",
"(",
"ProcessDefinition",
"processDefinition",
",",
"String",
"processDefinitionId",
",",
"boolean",
"cascadeToHistory",
",",
"boolean",
"cascadeToInstances",
",",
"boolean",
"skipCustomListeners",
",",
"boolean",
"skipIoMappings",... | Deletes the given process definition from the database and cache.
If cascadeToHistory and cascadeToInstances is set to true it deletes
the history and the process instances.
*Note*: If more than one process definition, from one deployment, is deleted in
a single transaction and the cascadeToHistory and cascadeToInstances flag was set to true it
can cause a dirty deployment cache. The process instances of ALL process definitions must be deleted,
before every process definition can be deleted! In such cases the cascadeToInstances flag
have to set to false!
On deletion of all process instances, the task listeners will be deleted as well.
Deletion of tasks and listeners needs the redeployment of deployments.
It can cause to problems if is done sequential with the deletion of process definition
in a single transaction.
*For example*:
Deployment contains two process definition. First process definition
and instances will be removed, also cleared from the cache.
Second process definition will be removed and his instances.
Deletion of instances will cause redeployment this deploys again
first into the cache. Only the second will be removed from cache and
first remains in the cache after the deletion process.
@param processDefinition the process definition which should be deleted
@param processDefinitionId the id of the process definition
@param cascadeToHistory if true the history will deleted as well
@param cascadeToInstances if true the process instances are deleted as well
@param skipCustomListeners if true skips the custom listeners on deletion of instances
@param skipIoMappings specifies whether input/output mappings for tasks should be invoked | [
"Deletes",
"the",
"given",
"process",
"definition",
"from",
"the",
"database",
"and",
"cache",
".",
"If",
"cascadeToHistory",
"and",
"cascadeToInstances",
"is",
"set",
"to",
"true",
"it",
"deletes",
"the",
"history",
"and",
"the",
"process",
"instances",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L335-L370 |
js-lib-com/commons | src/main/java/js/util/FilteredStrings.java | FilteredStrings.addAll | public void addAll(String prefix, String[] strings) {
if (strings == null) {
return;
}
for (String string : strings) {
if (filter.accept(string)) {
list.add(prefix + string);
}
}
} | java | public void addAll(String prefix, String[] strings) {
if (strings == null) {
return;
}
for (String string : strings) {
if (filter.accept(string)) {
list.add(prefix + string);
}
}
} | [
"public",
"void",
"addAll",
"(",
"String",
"prefix",
",",
"String",
"[",
"]",
"strings",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"String",
"string",
":",
"strings",
")",
"{",
"if",
"(",
"filter",
".",... | Add strings accepted by this filter pattern but prefixed with given string. Strings argument can come from
{@link File#list()} and can be null in which case this method does nothing. This method accept a prefix argument; it is
inserted at every string start before actually adding to strings list.
<pre>
File directory = new File(".");
FilteredStrings files = new FilteredStrings("index.*");
files.addAll("/var/www/", directory.list());
</pre>
If <code>directory</code> contains files like <em>index.htm</em>, <em>index.css</em>, etc. will be added to
<code>files</code> but prefixed like <em>/var/www/index.htm</em>, respective <em>/var/www/index.css</em>.
@param prefix prefix to insert on every string,
@param strings strings to scan for pattern, possible null. | [
"Add",
"strings",
"accepted",
"by",
"this",
"filter",
"pattern",
"but",
"prefixed",
"with",
"given",
"string",
".",
"Strings",
"argument",
"can",
"come",
"from",
"{",
"@link",
"File#list",
"()",
"}",
"and",
"can",
"be",
"null",
"in",
"which",
"case",
"this... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/FilteredStrings.java#L79-L88 |
petergeneric/stdlib | service-manager/host-agent/src/main/java/com/peterphi/servicemanager/hostagent/webapp/service/NginxService.java | NginxService.reconfigure | public void reconfigure(final String config)
{
try
{
final File tempFile = File.createTempFile("nginx", ".conf");
try
{
FileHelper.write(tempFile, config);
final Execed process = Exec.rootUtility(new File(binPath, "nginx-reconfigure").getAbsolutePath(),
tempFile.getAbsolutePath());
process.waitForExit(new Timeout(30, TimeUnit.SECONDS).start(), 0);
}
finally
{
FileUtils.deleteQuietly(tempFile);
}
}
catch (IOException e)
{
throw new RuntimeException("Error executing nginx-reload command", e);
}
reload();
} | java | public void reconfigure(final String config)
{
try
{
final File tempFile = File.createTempFile("nginx", ".conf");
try
{
FileHelper.write(tempFile, config);
final Execed process = Exec.rootUtility(new File(binPath, "nginx-reconfigure").getAbsolutePath(),
tempFile.getAbsolutePath());
process.waitForExit(new Timeout(30, TimeUnit.SECONDS).start(), 0);
}
finally
{
FileUtils.deleteQuietly(tempFile);
}
}
catch (IOException e)
{
throw new RuntimeException("Error executing nginx-reload command", e);
}
reload();
} | [
"public",
"void",
"reconfigure",
"(",
"final",
"String",
"config",
")",
"{",
"try",
"{",
"final",
"File",
"tempFile",
"=",
"File",
".",
"createTempFile",
"(",
"\"nginx\"",
",",
"\".conf\"",
")",
";",
"try",
"{",
"FileHelper",
".",
"write",
"(",
"tempFile",... | Rewrite the nginx site configuration and reload
@param config
the nginx site configuration | [
"Rewrite",
"the",
"nginx",
"site",
"configuration",
"and",
"reload"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/service-manager/host-agent/src/main/java/com/peterphi/servicemanager/hostagent/webapp/service/NginxService.java#L45-L70 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexController.java | CmsFlexController.push | public void push(CmsFlexRequest req, CmsFlexResponse res) {
m_flexRequestList.add(req);
m_flexResponseList.add(res);
m_flexContextInfoList.add(new CmsFlexRequestContextInfo());
updateRequestContextInfo();
} | java | public void push(CmsFlexRequest req, CmsFlexResponse res) {
m_flexRequestList.add(req);
m_flexResponseList.add(res);
m_flexContextInfoList.add(new CmsFlexRequestContextInfo());
updateRequestContextInfo();
} | [
"public",
"void",
"push",
"(",
"CmsFlexRequest",
"req",
",",
"CmsFlexResponse",
"res",
")",
"{",
"m_flexRequestList",
".",
"add",
"(",
"req",
")",
";",
"m_flexResponseList",
".",
"add",
"(",
"res",
")",
";",
"m_flexContextInfoList",
".",
"add",
"(",
"new",
... | Adds another flex request/response pair to the stack.<p>
@param req the request to add
@param res the response to add | [
"Adds",
"another",
"flex",
"request",
"/",
"response",
"pair",
"to",
"the",
"stack",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L617-L623 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.applyInstallExtension | private void applyInstallExtension(DefaultInstalledExtension installedExtension, String namespace,
boolean dependency, Map<String, Object> properties, Map<String, ExtensionDependency> managedDependencies)
throws InstallException
{
// INSTALLED
installedExtension.setInstalled(true, namespace);
installedExtension.setInstallDate(new Date(), namespace);
// DEPENDENCY
installedExtension.setDependency(dependency, namespace);
// Add custom install properties for the specified namespace. The map holding the namespace properties should
// not be null because it is initialized by the InstalledExtension#setInstalled(true, namespace) call above.
installedExtension.getNamespaceProperties(namespace).putAll(properties);
// Save properties
try {
this.localRepository.setProperties(installedExtension.getLocalExtension(),
installedExtension.getProperties());
} catch (Exception e) {
throw new InstallException("Failed to modify extension descriptor", e);
}
// VALID
installedExtension.setValid(namespace, isValid(installedExtension, namespace, managedDependencies));
// Update caches
addInstalledExtension(installedExtension, namespace);
} | java | private void applyInstallExtension(DefaultInstalledExtension installedExtension, String namespace,
boolean dependency, Map<String, Object> properties, Map<String, ExtensionDependency> managedDependencies)
throws InstallException
{
// INSTALLED
installedExtension.setInstalled(true, namespace);
installedExtension.setInstallDate(new Date(), namespace);
// DEPENDENCY
installedExtension.setDependency(dependency, namespace);
// Add custom install properties for the specified namespace. The map holding the namespace properties should
// not be null because it is initialized by the InstalledExtension#setInstalled(true, namespace) call above.
installedExtension.getNamespaceProperties(namespace).putAll(properties);
// Save properties
try {
this.localRepository.setProperties(installedExtension.getLocalExtension(),
installedExtension.getProperties());
} catch (Exception e) {
throw new InstallException("Failed to modify extension descriptor", e);
}
// VALID
installedExtension.setValid(namespace, isValid(installedExtension, namespace, managedDependencies));
// Update caches
addInstalledExtension(installedExtension, namespace);
} | [
"private",
"void",
"applyInstallExtension",
"(",
"DefaultInstalledExtension",
"installedExtension",
",",
"String",
"namespace",
",",
"boolean",
"dependency",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"ExtensionDepen... | Install provided extension.
@param localExtension the extension to install
@param namespace the namespace
@param dependency indicate if the extension is stored as a dependency of another one
@param properties the custom properties to set on the installed extension for the specified namespace
@param managedDependencies the managed dependencies
@throws InstallException error when trying to uninstall extension
@see #installExtension(LocalExtension, String) | [
"Install",
"provided",
"extension",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L476-L505 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/TenantServiceClient.java | TenantServiceClient.createTenant | public final Tenant createTenant(ProjectName parent, Tenant tenant) {
CreateTenantRequest request =
CreateTenantRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setTenant(tenant)
.build();
return createTenant(request);
} | java | public final Tenant createTenant(ProjectName parent, Tenant tenant) {
CreateTenantRequest request =
CreateTenantRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setTenant(tenant)
.build();
return createTenant(request);
} | [
"public",
"final",
"Tenant",
"createTenant",
"(",
"ProjectName",
"parent",
",",
"Tenant",
"tenant",
")",
"{",
"CreateTenantRequest",
"request",
"=",
"CreateTenantRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"null",
... | Creates a new tenant entity.
<p>Sample code:
<pre><code>
try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Tenant tenant = Tenant.newBuilder().build();
Tenant response = tenantServiceClient.createTenant(parent, tenant);
}
</code></pre>
@param parent Required.
<p>Resource name of the project under which the tenant is created.
<p>The format is "projects/{project_id}", for example, "projects/api-test-project".
@param tenant Required.
<p>The tenant to be created.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"new",
"tenant",
"entity",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/TenantServiceClient.java#L179-L187 |
google/truth | core/src/main/java/com/google/common/truth/Platform.java | Platform.containsMatch | static boolean containsMatch(String actual, String regex) {
return Pattern.compile(regex).matcher(actual).find();
} | java | static boolean containsMatch(String actual, String regex) {
return Pattern.compile(regex).matcher(actual).find();
} | [
"static",
"boolean",
"containsMatch",
"(",
"String",
"actual",
",",
"String",
"regex",
")",
"{",
"return",
"Pattern",
".",
"compile",
"(",
"regex",
")",
".",
"matcher",
"(",
"actual",
")",
".",
"find",
"(",
")",
";",
"}"
] | Determines if the given subject contains a match for the given regex. | [
"Determines",
"if",
"the",
"given",
"subject",
"contains",
"a",
"match",
"for",
"the",
"given",
"regex",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Platform.java#L50-L52 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.mergeCertificate | public CertificateBundle mergeCertificate(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, tags).toBlocking().single().body();
} | java | public CertificateBundle mergeCertificate(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, tags).toBlocking().single().body();
} | [
"public",
"CertificateBundle",
"mergeCertificate",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"List",
"<",
"byte",
"[",
"]",
">",
"x509Certificates",
",",
"CertificateAttributes",
"certificateAttributes",
",",
"Map",
"<",
"String",
",",
"S... | Merges a certificate or a certificate chain with a key pair existing on the server.
The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param x509Certificates The certificate or the certificate chain to merge.
@param certificateAttributes The attributes of the certificate (optional).
@param tags Application specific metadata in the form of key-value pairs.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateBundle object if successful. | [
"Merges",
"a",
"certificate",
"or",
"a",
"certificate",
"chain",
"with",
"a",
"key",
"pair",
"existing",
"on",
"the",
"server",
".",
"The",
"MergeCertificate",
"operation",
"performs",
"the",
"merging",
"of",
"a",
"certificate",
"or",
"certificate",
"chain",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8008-L8010 |
litsec/swedish-eid-shibboleth-base | shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/ProxyIdpAuthnContextServiceImpl.java | ProxyIdpAuthnContextServiceImpl.isSupported | protected boolean isSupported(ProfileRequestContext<?, ?> context, String uri, List<String> assuranceURIs) {
return assuranceURIs.contains(uri);
} | java | protected boolean isSupported(ProfileRequestContext<?, ?> context, String uri, List<String> assuranceURIs) {
return assuranceURIs.contains(uri);
} | [
"protected",
"boolean",
"isSupported",
"(",
"ProfileRequestContext",
"<",
"?",
",",
"?",
">",
"context",
",",
"String",
"uri",
",",
"List",
"<",
"String",
">",
"assuranceURIs",
")",
"{",
"return",
"assuranceURIs",
".",
"contains",
"(",
"uri",
")",
";",
"}"... | A Proxy-IdP may communicate with an IdP that uses different URI declarations for the same type of authentication
methods, e.g., the Swedish eID framework and eIDAS has different URI:s for the same type of authentication. This
method will enable tranformation of URI:s and provide the possibility to match URI:s from different schemes.
<p>
The default implementation just checks if the supplied {@code uri} is part of the {@code assuranceURIs} list. To
implement different behaviour override this method.
</p>
@param context
the request context
@param uri
the URI to test
@param assuranceURIs
IdP assurance certification URI:s
@return {@code true} if there is a match, and {@code false} otherwise | [
"A",
"Proxy",
"-",
"IdP",
"may",
"communicate",
"with",
"an",
"IdP",
"that",
"uses",
"different",
"URI",
"declarations",
"for",
"the",
"same",
"type",
"of",
"authentication",
"methods",
"e",
".",
"g",
".",
"the",
"Swedish",
"eID",
"framework",
"and",
"eIDA... | train | https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/ProxyIdpAuthnContextServiceImpl.java#L130-L132 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.listAsync | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | java | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName"... | Gets a list of API keys of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ApplicationInsightsComponentAPIKeyInner> object | [
"Gets",
"a",
"list",
"of",
"API",
"keys",
"of",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L113-L120 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.connectWithRegEx | public RouteMatcher connectWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, connectBindings);
return this;
} | java | public RouteMatcher connectWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, connectBindings);
return this;
} | [
"public",
"RouteMatcher",
"connectWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"connectBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP CONNECT
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"CONNECT"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L279-L282 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.listAsync | public Observable<ListContainerItemsInner> listAsync(String resourceGroupName, String accountName) {
return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<ListContainerItemsInner>, ListContainerItemsInner>() {
@Override
public ListContainerItemsInner call(ServiceResponse<ListContainerItemsInner> response) {
return response.body();
}
});
} | java | public Observable<ListContainerItemsInner> listAsync(String resourceGroupName, String accountName) {
return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<ListContainerItemsInner>, ListContainerItemsInner>() {
@Override
public ListContainerItemsInner call(ServiceResponse<ListContainerItemsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListContainerItemsInner",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"map",
"(",
"new",
... | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListContainerItemsInner object | [
"Lists",
"all",
"containers",
"and",
"does",
"not",
"support",
"a",
"prefix",
"like",
"data",
"plane",
".",
"Also",
"SRP",
"today",
"does",
"not",
"return",
"continuation",
"token",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L154-L161 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnots | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types, offset, knotTypes, 0, numKnots);
sortKnots();
rebuildGradient();
} | java | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types, offset, knotTypes, 0, numKnots);
sortKnots();
rebuildGradient();
} | [
"public",
"void",
"setKnots",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"byte",
"[",
"]",
"types",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"numKnots",
"=",
"count",
";",
"xKnots",
"=",
"new",
"int",
"[",
"numKnots",
... | Set the values of a set of knots.
@param x the knot positions
@param y the knot colors
@param types the knot types
@param offset the first knot to set
@param count the number of knots | [
"Set",
"the",
"values",
"of",
"a",
"set",
"of",
"knots",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L316-L326 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.modulesIn | public static Set<ModuleElement>
modulesIn(Set<? extends Element> elements) {
return setFilter(elements, MODULE_KIND, ModuleElement.class);
} | java | public static Set<ModuleElement>
modulesIn(Set<? extends Element> elements) {
return setFilter(elements, MODULE_KIND, ModuleElement.class);
} | [
"public",
"static",
"Set",
"<",
"ModuleElement",
">",
"modulesIn",
"(",
"Set",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"setFilter",
"(",
"elements",
",",
"MODULE_KIND",
",",
"ModuleElement",
".",
"class",
")",
";",
"}"
] | Returns a set of modules in {@code elements}.
@return a set of modules in {@code elements}
@param elements the elements to filter
@since 9
@spec JPMS | [
"Returns",
"a",
"set",
"of",
"modules",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L206-L209 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/authorization/authorizationpolicylabel_stats.java | authorizationpolicylabel_stats.get | public static authorizationpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats();
obj.set_labelname(labelname);
authorizationpolicylabel_stats response = (authorizationpolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static authorizationpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats();
obj.set_labelname(labelname);
authorizationpolicylabel_stats response = (authorizationpolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"authorizationpolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"authorizationpolicylabel_stats",
"obj",
"=",
"new",
"authorizationpolicylabel_stats",
"(",
")",
";",
"obj",
".",
... | Use this API to fetch statistics of authorizationpolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"authorizationpolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/authorization/authorizationpolicylabel_stats.java#L149-L154 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java | JobsInner.stopAsync | public Observable<Void> stopAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
return stopWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> stopAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
return stopWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"stopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"jobId",
")",
"{",
"return",
"stopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"j... | Stop the job identified by jobId.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stop",
"the",
"job",
"identified",
"by",
"jobId",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L417-L424 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.getLayoutDimension | private int getLayoutDimension(final int dimension, final int margin, final int total) {
if (dimension == Dialog.MATCH_PARENT) {
return RelativeLayout.LayoutParams.MATCH_PARENT;
} else if (dimension == Dialog.WRAP_CONTENT) {
return RelativeLayout.LayoutParams.WRAP_CONTENT;
} else {
return Math.min(dimension, total - margin);
}
} | java | private int getLayoutDimension(final int dimension, final int margin, final int total) {
if (dimension == Dialog.MATCH_PARENT) {
return RelativeLayout.LayoutParams.MATCH_PARENT;
} else if (dimension == Dialog.WRAP_CONTENT) {
return RelativeLayout.LayoutParams.WRAP_CONTENT;
} else {
return Math.min(dimension, total - margin);
}
} | [
"private",
"int",
"getLayoutDimension",
"(",
"final",
"int",
"dimension",
",",
"final",
"int",
"margin",
",",
"final",
"int",
"total",
")",
"{",
"if",
"(",
"dimension",
"==",
"Dialog",
".",
"MATCH_PARENT",
")",
"{",
"return",
"RelativeLayout",
".",
"LayoutPa... | Returns a dimension (width or height) of the dialog, depending of the margin of the
corresponding orientation and the display space, which is available in total.
@param dimension
The dimension, which should be used, in pixels as an {@link Integer value}
@param margin
The margin in pixels as an {@link Integer} value
@param total
The display space, which is available in total, in pixels as an {@link Integer}
value
@return The dimension of the dialog as an {@link Integer} value | [
"Returns",
"a",
"dimension",
"(",
"width",
"or",
"height",
")",
"of",
"the",
"dialog",
"depending",
"of",
"the",
"margin",
"of",
"the",
"corresponding",
"orientation",
"and",
"the",
"display",
"space",
"which",
"is",
"available",
"in",
"total",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L653-L661 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java | SynchronizationGenerators.enterMonitorAndStore | public static InsnList enterMonitorAndStore(MarkerType markerType, LockVariables lockVars) {
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Validate.isTrue(lockStateVar != null);
Type clsType = Type.getType(LOCKSTATE_ENTER_METHOD.getDeclaringClass());
Type methodType = Type.getType(LOCKSTATE_ENTER_METHOD);
String clsInternalName = clsType.getInternalName();
String methodDesc = methodType.getDescriptor();
String methodName = LOCKSTATE_ENTER_METHOD.getName();
// NOTE: This adds to the lock state AFTER locking.
return merge(
debugMarker(markerType, "Entering monitor and storing"),
// [obj]
new InsnNode(Opcodes.DUP), // [obj, obj]
new InsnNode(Opcodes.MONITORENTER), // [obj]
new VarInsnNode(Opcodes.ALOAD, lockStateVar.getIndex()), // [obj, lockState]
new InsnNode(Opcodes.SWAP), // [lockState, obj]
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, // []
clsInternalName,
methodName,
methodDesc,
false)
);
} | java | public static InsnList enterMonitorAndStore(MarkerType markerType, LockVariables lockVars) {
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Validate.isTrue(lockStateVar != null);
Type clsType = Type.getType(LOCKSTATE_ENTER_METHOD.getDeclaringClass());
Type methodType = Type.getType(LOCKSTATE_ENTER_METHOD);
String clsInternalName = clsType.getInternalName();
String methodDesc = methodType.getDescriptor();
String methodName = LOCKSTATE_ENTER_METHOD.getName();
// NOTE: This adds to the lock state AFTER locking.
return merge(
debugMarker(markerType, "Entering monitor and storing"),
// [obj]
new InsnNode(Opcodes.DUP), // [obj, obj]
new InsnNode(Opcodes.MONITORENTER), // [obj]
new VarInsnNode(Opcodes.ALOAD, lockStateVar.getIndex()), // [obj, lockState]
new InsnNode(Opcodes.SWAP), // [lockState, obj]
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, // []
clsInternalName,
methodName,
methodDesc,
false)
);
} | [
"public",
"static",
"InsnList",
"enterMonitorAndStore",
"(",
"MarkerType",
"markerType",
",",
"LockVariables",
"lockVars",
")",
"{",
"Validate",
".",
"notNull",
"(",
"markerType",
")",
";",
"Validate",
".",
"notNull",
"(",
"lockVars",
")",
";",
"Variable",
"lock... | Generates instruction to enter a monitor (top item on the stack) and store it in the {@link LockState} object sitting in the
lockstate variable.
@param markerType debug marker type
@param lockVars variables for lock/synchpoint functionality
@return instructions to enter a monitor and store it in the {@link LockState} object
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions) | [
"Generates",
"instruction",
"to",
"enter",
"a",
"monitor",
"(",
"top",
"item",
"on",
"the",
"stack",
")",
"and",
"store",
"it",
"in",
"the",
"{"
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java#L149-L176 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELManager.java | ELManager.defineBean | public Object defineBean(String name, Object bean) {
Object ret = getELContext().getBeans().get(name);
getELContext().getBeans().put(name, bean);
return ret;
} | java | public Object defineBean(String name, Object bean) {
Object ret = getELContext().getBeans().get(name);
getELContext().getBeans().put(name, bean);
return ret;
} | [
"public",
"Object",
"defineBean",
"(",
"String",
"name",
",",
"Object",
"bean",
")",
"{",
"Object",
"ret",
"=",
"getELContext",
"(",
")",
".",
"getBeans",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"getELContext",
"(",
")",
".",
"getBeans",
"(",
")... | Define a bean in the local bean repository
@param name The name of the bean
@param bean The bean instance to be defined. If null, the definition
of the bean is removed. | [
"Define",
"a",
"bean",
"in",
"the",
"local",
"bean",
"repository"
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELManager.java#L177-L181 |
gallandarakhneorg/afc | advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java | XMLRoadUtil.writeRoadPolyline | public static Element writeRoadPolyline(RoadPolyline primitive, XMLBuilder builder,
XMLResources resources) throws IOException {
return writeMapElement(primitive, NODE_ROAD, builder, resources);
} | java | public static Element writeRoadPolyline(RoadPolyline primitive, XMLBuilder builder,
XMLResources resources) throws IOException {
return writeMapElement(primitive, NODE_ROAD, builder, resources);
} | [
"public",
"static",
"Element",
"writeRoadPolyline",
"(",
"RoadPolyline",
"primitive",
",",
"XMLBuilder",
"builder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"return",
"writeMapElement",
"(",
"primitive",
",",
"NODE_ROAD",
",",
"builder",
... | Write the XML description for the given road.
@param primitive is the road to output.
@param builder is the tool to create XML nodes.
@param resources is the tool that permits to gather the resources.
@return the XML node of the map element.
@throws IOException in case of error. | [
"Write",
"the",
"XML",
"description",
"for",
"the",
"given",
"road",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L87-L90 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addCompositeEntity | public UUID addCompositeEntity(UUID appId, String versionId, CompositeEntityModel compositeModelCreateObject) {
return addCompositeEntityWithServiceResponseAsync(appId, versionId, compositeModelCreateObject).toBlocking().single().body();
} | java | public UUID addCompositeEntity(UUID appId, String versionId, CompositeEntityModel compositeModelCreateObject) {
return addCompositeEntityWithServiceResponseAsync(appId, versionId, compositeModelCreateObject).toBlocking().single().body();
} | [
"public",
"UUID",
"addCompositeEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"CompositeEntityModel",
"compositeModelCreateObject",
")",
"{",
"return",
"addCompositeEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"compositeModelCreateO... | Adds a composite entity extractor to the application.
@param appId The application ID.
@param versionId The version ID.
@param compositeModelCreateObject A model containing the name and children of the new entity extractor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Adds",
"a",
"composite",
"entity",
"extractor",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1550-L1552 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.getItem | public GetItemResult getItem(GetItemRequest getItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(getItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<GetItemRequest> request = marshall(getItemRequest,
new GetItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<GetItemResult, JsonUnmarshallerContext> unmarshaller = new GetItemResultJsonUnmarshaller();
JsonResponseHandler<GetItemResult> responseHandler = new JsonResponseHandler<GetItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public GetItemResult getItem(GetItemRequest getItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(getItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<GetItemRequest> request = marshall(getItemRequest,
new GetItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<GetItemResult, JsonUnmarshallerContext> unmarshaller = new GetItemResultJsonUnmarshaller();
JsonResponseHandler<GetItemResult> responseHandler = new JsonResponseHandler<GetItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"GetItemResult",
"getItem",
"(",
"GetItemRequest",
"getItemRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"getItemRequest",
")",
";",
"AWSRequestMetric... | <p>
Retrieves a set of Attributes for an item that matches the primary
key.
</p>
<p>
The <code>GetItem</code> operation provides an eventually-consistent
read by default. If eventually-consistent reads are not acceptable for
your application, use <code>ConsistentRead</code> . Although this
operation might take longer than a standard read, it always returns
the last updated value.
</p>
@param getItemRequest Container for the necessary parameters to
execute the GetItem service method on AmazonDynamoDB.
@return The response from the GetItem service method, as returned by
AmazonDynamoDB.
@throws ProvisionedThroughputExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Retrieves",
"a",
"set",
"of",
"Attributes",
"for",
"an",
"item",
"that",
"matches",
"the",
"primary",
"key",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"<code",
">",
"GetItem<",
"/",
"code",
">",
"operation",
"provides",
"an",
"eventually",... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L854-L866 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toBool | public static Boolean toBool(Object value, Boolean defaultValue) {
return convert(Boolean.class, value, defaultValue);
} | java | public static Boolean toBool(Object value, Boolean defaultValue) {
return convert(Boolean.class, value, defaultValue);
} | [
"public",
"static",
"Boolean",
"toBool",
"(",
"Object",
"value",
",",
"Boolean",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"Boolean",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为boolean<br>
String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为boolean<br",
">",
"String支持的值为:true、false、yes、ok、no,1",
"0",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L361-L363 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/HibernateMappingContextConfiguration.java | HibernateMappingContextConfiguration.setDataSourceConnectionSource | public void setDataSourceConnectionSource(ConnectionSource<DataSource, DataSourceSettings> connectionSource) {
this.dataSourceName = connectionSource.getName();
DataSource source = connectionSource.getSource();
getProperties().put(Environment.DATASOURCE, source);
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, GrailsSessionContext.class.getName());
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null && contextClassLoader.getClass().getSimpleName().equalsIgnoreCase("RestartClassLoader")) {
getProperties().put(AvailableSettings.CLASSLOADERS, contextClassLoader);
} else {
getProperties().put(AvailableSettings.CLASSLOADERS, connectionSource.getClass().getClassLoader());
}
} | java | public void setDataSourceConnectionSource(ConnectionSource<DataSource, DataSourceSettings> connectionSource) {
this.dataSourceName = connectionSource.getName();
DataSource source = connectionSource.getSource();
getProperties().put(Environment.DATASOURCE, source);
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, GrailsSessionContext.class.getName());
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null && contextClassLoader.getClass().getSimpleName().equalsIgnoreCase("RestartClassLoader")) {
getProperties().put(AvailableSettings.CLASSLOADERS, contextClassLoader);
} else {
getProperties().put(AvailableSettings.CLASSLOADERS, connectionSource.getClass().getClassLoader());
}
} | [
"public",
"void",
"setDataSourceConnectionSource",
"(",
"ConnectionSource",
"<",
"DataSource",
",",
"DataSourceSettings",
">",
"connectionSource",
")",
"{",
"this",
".",
"dataSourceName",
"=",
"connectionSource",
".",
"getName",
"(",
")",
";",
"DataSource",
"source",
... | Set the target SQL {@link DataSource}
@param connectionSource The data source to use | [
"Set",
"the",
"target",
"SQL",
"{",
"@link",
"DataSource",
"}"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/HibernateMappingContextConfiguration.java#L103-L114 |
GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/IndirectBigQueryOutputCommitter.java | IndirectBigQueryOutputCommitter.commitJob | @Override
public void commitJob(JobContext context) throws IOException {
super.commitJob(context);
// Get the destination configuration information.
Configuration conf = context.getConfiguration();
TableReference destTable = BigQueryOutputConfiguration.getTableReference(conf);
String destProjectId = BigQueryOutputConfiguration.getProjectId(conf);
String writeDisposition = BigQueryOutputConfiguration.getWriteDisposition(conf);
Optional<BigQueryTableSchema> destSchema = BigQueryOutputConfiguration.getTableSchema(conf);
String kmsKeyName = BigQueryOutputConfiguration.getKmsKeyName(conf);
BigQueryFileFormat outputFileFormat = BigQueryOutputConfiguration.getFileFormat(conf);
List<String> sourceUris = getOutputFileURIs();
try {
getBigQueryHelper()
.importFromGcs(
destProjectId,
destTable,
destSchema.isPresent() ? destSchema.get().get() : null,
kmsKeyName,
outputFileFormat,
writeDisposition,
sourceUris,
true);
} catch (InterruptedException e) {
throw new IOException("Failed to import GCS into BigQuery", e);
}
cleanup(context);
} | java | @Override
public void commitJob(JobContext context) throws IOException {
super.commitJob(context);
// Get the destination configuration information.
Configuration conf = context.getConfiguration();
TableReference destTable = BigQueryOutputConfiguration.getTableReference(conf);
String destProjectId = BigQueryOutputConfiguration.getProjectId(conf);
String writeDisposition = BigQueryOutputConfiguration.getWriteDisposition(conf);
Optional<BigQueryTableSchema> destSchema = BigQueryOutputConfiguration.getTableSchema(conf);
String kmsKeyName = BigQueryOutputConfiguration.getKmsKeyName(conf);
BigQueryFileFormat outputFileFormat = BigQueryOutputConfiguration.getFileFormat(conf);
List<String> sourceUris = getOutputFileURIs();
try {
getBigQueryHelper()
.importFromGcs(
destProjectId,
destTable,
destSchema.isPresent() ? destSchema.get().get() : null,
kmsKeyName,
outputFileFormat,
writeDisposition,
sourceUris,
true);
} catch (InterruptedException e) {
throw new IOException("Failed to import GCS into BigQuery", e);
}
cleanup(context);
} | [
"@",
"Override",
"public",
"void",
"commitJob",
"(",
"JobContext",
"context",
")",
"throws",
"IOException",
"{",
"super",
".",
"commitJob",
"(",
"context",
")",
";",
"// Get the destination configuration information.",
"Configuration",
"conf",
"=",
"context",
".",
"... | Runs an import job on BigQuery for the data in the output path in addition to calling the
delegate's commitJob. | [
"Runs",
"an",
"import",
"job",
"on",
"BigQuery",
"for",
"the",
"data",
"in",
"the",
"output",
"path",
"in",
"addition",
"to",
"calling",
"the",
"delegate",
"s",
"commitJob",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/IndirectBigQueryOutputCommitter.java#L55-L85 |
bwkimmel/java-util | src/main/java/ca/eandb/util/ByteArray.java | ByteArray.setAll | public void setAll(int index, byte[] items) {
rangeCheck(index, index + items.length);
for (int i = index, j = 0; j < items.length; i++, j++) {
elements[i] = items[j];
}
} | java | public void setAll(int index, byte[] items) {
rangeCheck(index, index + items.length);
for (int i = index, j = 0; j < items.length; i++, j++) {
elements[i] = items[j];
}
} | [
"public",
"void",
"setAll",
"(",
"int",
"index",
",",
"byte",
"[",
"]",
"items",
")",
"{",
"rangeCheck",
"(",
"index",
",",
"index",
"+",
"items",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"index",
",",
"j",
"=",
"0",
";",
"j",
"<",... | Sets a range of elements of this array.
@param index
The index of the first element to set.
@param items
The values to set.
@throws IndexOutOfBoundsException
if
<code>index < 0 || index + items.length > size()</code>. | [
"Sets",
"a",
"range",
"of",
"elements",
"of",
"this",
"array",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/ByteArray.java#L255-L260 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java | ConcurrentCountingMap.addTo | public int addTo(final byte[] array, final int offset, final int length, final int delta) {
final long hash = MurmurHash3.hash(array, offset, length);
final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock();
try {
writeLock.lock();
return stripe[(int)(hash >>> shift)].addTo(array, offset, length, hash, delta);
}
finally {
writeLock.unlock();
}
} | java | public int addTo(final byte[] array, final int offset, final int length, final int delta) {
final long hash = MurmurHash3.hash(array, offset, length);
final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock();
try {
writeLock.lock();
return stripe[(int)(hash >>> shift)].addTo(array, offset, length, hash, delta);
}
finally {
writeLock.unlock();
}
} | [
"public",
"int",
"addTo",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
",",
"final",
"int",
"delta",
")",
"{",
"final",
"long",
"hash",
"=",
"MurmurHash3",
".",
"hash",
"(",
"array",
",",
"off... | Adds a value to the counter associated with a given key.
@param array a byte array.
@param offset the first valid byte in {@code array}.
@param length the number of valid elements in {@code array}.
@param delta a value to be added to the counter associated with the specified key.
@return the previous value of the counter associated with the specified key. | [
"Adds",
"a",
"value",
"to",
"the",
"counter",
"associated",
"with",
"a",
"given",
"key",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java#L115-L125 |
code-disaster/steamworks4j | java-wrapper/src/main/java/com/codedisaster/steamworks/SteamNetworking.java | SteamNetworking.readP2PPacket | public int readP2PPacket(SteamID steamIDRemote, ByteBuffer dest, int channel) throws SteamException {
if (!dest.isDirect()) {
throw new SteamException("Direct buffer required!");
}
if (readP2PPacket(pointer, dest, dest.position(), dest.remaining(), tmpIntResult, tmpLongResult, channel)) {
steamIDRemote.handle = tmpLongResult[0];
return tmpIntResult[0];
}
return 0;
} | java | public int readP2PPacket(SteamID steamIDRemote, ByteBuffer dest, int channel) throws SteamException {
if (!dest.isDirect()) {
throw new SteamException("Direct buffer required!");
}
if (readP2PPacket(pointer, dest, dest.position(), dest.remaining(), tmpIntResult, tmpLongResult, channel)) {
steamIDRemote.handle = tmpLongResult[0];
return tmpIntResult[0];
}
return 0;
} | [
"public",
"int",
"readP2PPacket",
"(",
"SteamID",
"steamIDRemote",
",",
"ByteBuffer",
"dest",
",",
"int",
"channel",
")",
"throws",
"SteamException",
"{",
"if",
"(",
"!",
"dest",
".",
"isDirect",
"(",
")",
")",
"{",
"throw",
"new",
"SteamException",
"(",
"... | Read incoming packet data into a direct {@link ByteBuffer}.
On success, returns the number of bytes received, and the <code>steamIDRemote</code> parameter contains the
sender's ID. | [
"Read",
"incoming",
"packet",
"data",
"into",
"a",
"direct",
"{",
"@link",
"ByteBuffer",
"}",
"."
] | train | https://github.com/code-disaster/steamworks4j/blob/8813f680dfacd510fe8af35ce6c73be9b7d1cecb/java-wrapper/src/main/java/com/codedisaster/steamworks/SteamNetworking.java#L107-L119 |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.getChild | public static Element getChild( Element root, String name )
{
if( null == root )
{
return null;
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
if( n < 1 )
{
return null;
}
return (Element) list.item( 0 );
} | java | public static Element getChild( Element root, String name )
{
if( null == root )
{
return null;
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
if( n < 1 )
{
return null;
}
return (Element) list.item( 0 );
} | [
"public",
"static",
"Element",
"getChild",
"(",
"Element",
"root",
",",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"return",
"null",
";",
"}",
"NodeList",
"list",
"=",
"root",
".",
"getElementsByTagName",
"(",
"name",
")",
"... | Return a named child relative to a supplied element.
@param root the parent DOM element
@param name the name of a child element
@return the child element of null if the child does not exist | [
"Return",
"a",
"named",
"child",
"relative",
"to",
"a",
"supplied",
"element",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L115-L128 |
NessComputing/components-ness-jdbi | src/main/java/com/nesscomputing/jdbi/JdbiMappers.java | JdbiMappers.getDateTime | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | java | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | [
"public",
"static",
"DateTime",
"getDateTime",
"(",
"final",
"ResultSet",
"rs",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"final",
"Timestamp",
"ts",
"=",
"rs",
".",
"getTimestamp",
"(",
"columnName",
")",
";",
"return",
"(",
... | Returns a DateTime object representing the date or null if the input is null. | [
"Returns",
"a",
"DateTime",
"object",
"representing",
"the",
"date",
"or",
"null",
"if",
"the",
"input",
"is",
"null",
"."
] | train | https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L73-L78 |
perwendel/spark | src/main/java/spark/http/matching/Halt.java | Halt.modify | public static void modify(HttpServletResponse httpResponse, Body body, HaltException halt) {
httpResponse.setStatus(halt.statusCode());
if (halt.body() != null) {
body.set(halt.body());
} else {
body.set("");
}
} | java | public static void modify(HttpServletResponse httpResponse, Body body, HaltException halt) {
httpResponse.setStatus(halt.statusCode());
if (halt.body() != null) {
body.set(halt.body());
} else {
body.set("");
}
} | [
"public",
"static",
"void",
"modify",
"(",
"HttpServletResponse",
"httpResponse",
",",
"Body",
"body",
",",
"HaltException",
"halt",
")",
"{",
"httpResponse",
".",
"setStatus",
"(",
"halt",
".",
"statusCode",
"(",
")",
")",
";",
"if",
"(",
"halt",
".",
"bo... | Modifies the HTTP response and body based on the provided HaltException.
@param httpResponse The HTTP servlet response
@param body The body content
@param halt The halt exception object | [
"Modifies",
"the",
"HTTP",
"response",
"and",
"body",
"based",
"on",
"the",
"provided",
"HaltException",
"."
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/http/matching/Halt.java#L35-L44 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java | JUnitReporter.createReportFile | private void createReportFile(String reportFileName, String content, File targetDirectory) {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | java | private void createReportFile(String reportFileName, String content, File targetDirectory) {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | [
"private",
"void",
"createReportFile",
"(",
"String",
"reportFileName",
",",
"String",
"content",
",",
"File",
"targetDirectory",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"mkdirs"... | Creates the JUnit report file
@param reportFileName The report file to write
@param content The String content of the report file | [
"Creates",
"the",
"JUnit",
"report",
"file"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java#L156-L169 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.findWith | public static void findWith(final ModelListener listener, String query, Object ... params) {
ModelDelegate.findWith(modelClass(), listener, query, params);
} | java | public static void findWith(final ModelListener listener, String query, Object ... params) {
ModelDelegate.findWith(modelClass(), listener, query, params);
} | [
"public",
"static",
"void",
"findWith",
"(",
"final",
"ModelListener",
"listener",
",",
"String",
"query",
",",
"Object",
"...",
"params",
")",
"{",
"ModelDelegate",
".",
"findWith",
"(",
"modelClass",
"(",
")",
",",
"listener",
",",
"query",
",",
"params",
... | This method is for processing really large result sets. Results found by this method are never cached.
@param listener this is a call back implementation which will receive instances of models found.
@param query sub-query (content after "WHERE" clause)
@param params optional parameters for a query. | [
"This",
"method",
"is",
"for",
"processing",
"really",
"large",
"result",
"sets",
".",
"Results",
"found",
"by",
"this",
"method",
"are",
"never",
"cached",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2513-L2515 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.contourWidthDp | @NonNull
public IconicsDrawable contourWidthDp(@Dimension(unit = DP) int sizeDp) {
return contourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable contourWidthDp(@Dimension(unit = DP) int sizeDp) {
return contourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"contourWidthDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"contourWidthPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";",
"}"... | Set contour width from dp for the icon
@return The current IconicsDrawable for chaining. | [
"Set",
"contour",
"width",
"from",
"dp",
"for",
"the",
"icon"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L1011-L1014 |
Azure/azure-sdk-for-java | policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java | PolicyAssignmentsInner.getAsync | public Observable<PolicyAssignmentInner> getAsync(String scope, String policyAssignmentName) {
return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() {
@Override
public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyAssignmentInner> getAsync(String scope, String policyAssignmentName) {
return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() {
@Override
public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyAssignmentInner",
">",
"getAsync",
"(",
"String",
"scope",
",",
"String",
"policyAssignmentName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"scope",
",",
"policyAssignmentName",
")",
".",
"map",
"(",
"new",
"Func1",
... | Gets a policy assignment.
@param scope The scope of the policy assignment.
@param policyAssignmentName The name of the policy assignment to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyAssignmentInner object | [
"Gets",
"a",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java#L330-L337 |
wouterd/docker-maven-plugin | src/main/java/net/wouterdanes/docker/remoteapi/MiscService.java | MiscService.buildImage | public String buildImage(byte[] tarArchive, Optional<String> name, Optional<String> buildArguments) {
Response response = getServiceEndPoint()
.path("/build")
.queryParam("q", true)
.queryParam("t", name.orElse(null))
.queryParam("buildargs", UriComponent.encode(buildArguments.orElse(null), UriComponent.Type.QUERY_PARAM_SPACE_ENCODED))
.queryParam("forcerm")
.request(MediaType.APPLICATION_JSON_TYPE)
.header(REGISTRY_AUTH_HEADER, getRegistryAuthHeaderValue())
.post(Entity.entity(tarArchive, "application/tar"));
InputStream inputStream = (InputStream) response.getEntity();
String imageId = parseSteamForImageId(inputStream);
if (imageId == null) {
throw new DockerException("Can't obtain ID from build output stream.");
}
return imageId;
} | java | public String buildImage(byte[] tarArchive, Optional<String> name, Optional<String> buildArguments) {
Response response = getServiceEndPoint()
.path("/build")
.queryParam("q", true)
.queryParam("t", name.orElse(null))
.queryParam("buildargs", UriComponent.encode(buildArguments.orElse(null), UriComponent.Type.QUERY_PARAM_SPACE_ENCODED))
.queryParam("forcerm")
.request(MediaType.APPLICATION_JSON_TYPE)
.header(REGISTRY_AUTH_HEADER, getRegistryAuthHeaderValue())
.post(Entity.entity(tarArchive, "application/tar"));
InputStream inputStream = (InputStream) response.getEntity();
String imageId = parseSteamForImageId(inputStream);
if (imageId == null) {
throw new DockerException("Can't obtain ID from build output stream.");
}
return imageId;
} | [
"public",
"String",
"buildImage",
"(",
"byte",
"[",
"]",
"tarArchive",
",",
"Optional",
"<",
"String",
">",
"name",
",",
"Optional",
"<",
"String",
">",
"buildArguments",
")",
"{",
"Response",
"response",
"=",
"getServiceEndPoint",
"(",
")",
".",
"path",
"... | Builds an image based on the passed tar archive. Optionally names & tags the image
@param tarArchive the tar archive to use as a source for the image
@param name the name and optional tag of the image.
@param buildArguments a list of optional build arguments made available to the Dockerfile.
@return the ID of the created image | [
"Builds",
"an",
"image",
"based",
"on",
"the",
"passed",
"tar",
"archive",
".",
"Optionally",
"names",
"&",
";",
"tags",
"the",
"image"
] | train | https://github.com/wouterd/docker-maven-plugin/blob/ea15f9e6c273989bb91f4228fb52cb73d00e07b3/src/main/java/net/wouterdanes/docker/remoteapi/MiscService.java#L121-L141 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java | PcsUtils.buildCStorageException | public static CStorageException buildCStorageException( CResponse response, String message, CPath path )
{
switch ( response.getStatus() ) {
case 401:
return new CAuthenticationException( message, response );
case 404:
message = "No file found at URL " + shortenUrl( response.getUri() ) + " (" + message + ")";
return new CFileNotFoundException( message, path );
default:
return new CHttpException( message, response );
}
} | java | public static CStorageException buildCStorageException( CResponse response, String message, CPath path )
{
switch ( response.getStatus() ) {
case 401:
return new CAuthenticationException( message, response );
case 404:
message = "No file found at URL " + shortenUrl( response.getUri() ) + " (" + message + ")";
return new CFileNotFoundException( message, path );
default:
return new CHttpException( message, response );
}
} | [
"public",
"static",
"CStorageException",
"buildCStorageException",
"(",
"CResponse",
"response",
",",
"String",
"message",
",",
"CPath",
"path",
")",
"{",
"switch",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"case",
"401",
":",
"return",
"new",
"... | Some common code between providers. Handles the different status codes, and generates a nice exception
@param response The wrapped HTTP response
@param message The error message (provided by the server or by the application)
@param path The file requested (which failed)
@return The exception | [
"Some",
"common",
"code",
"between",
"providers",
".",
"Handles",
"the",
"different",
"status",
"codes",
"and",
"generates",
"a",
"nice",
"exception"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java#L117-L130 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/ExtensionUtils.java | ExtensionUtils.listToolExtensionDirectories | static private List<File> listToolExtensionDirectories(String extension) {
List<File> dirs = new ArrayList<File>();
dirs.add(new File(Utils.getInstallDir(), EXTENSION_DIR + extension)); // wlp/bin/tools/extensions
dirs.add(new File(Utils.getInstallDir(), USER_EXTENSION_DIR + extension)); // wlp/usr/extension/bin/tools/extensions
List<File> extDirs = listProductExtensionDirectories();
// add extension directory path and extension name.
for (File extDir : extDirs) {
dirs.add(new File(extDir, EXTENSION_DIR + extension));
}
return dirs;
} | java | static private List<File> listToolExtensionDirectories(String extension) {
List<File> dirs = new ArrayList<File>();
dirs.add(new File(Utils.getInstallDir(), EXTENSION_DIR + extension)); // wlp/bin/tools/extensions
dirs.add(new File(Utils.getInstallDir(), USER_EXTENSION_DIR + extension)); // wlp/usr/extension/bin/tools/extensions
List<File> extDirs = listProductExtensionDirectories();
// add extension directory path and extension name.
for (File extDir : extDirs) {
dirs.add(new File(extDir, EXTENSION_DIR + extension));
}
return dirs;
} | [
"static",
"private",
"List",
"<",
"File",
">",
"listToolExtensionDirectories",
"(",
"String",
"extension",
")",
"{",
"List",
"<",
"File",
">",
"dirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"dirs",
".",
"add",
"(",
"new",
"File",
"("... | Compose a list which contains all of directories which need to look into.
The directory may or may not exist.
the list of directories which this method returns is:
1, wlp/bin/tools/extensions,
2. wlp/usr/extension/bin/tools/extensions,
3. all locations returned from ProductExtension.getProductExtensions() with /bin/tools/extensions | [
"Compose",
"a",
"list",
"which",
"contains",
"all",
"of",
"directories",
"which",
"need",
"to",
"look",
"into",
".",
"The",
"directory",
"may",
"or",
"may",
"not",
"exist",
".",
"the",
"list",
"of",
"directories",
"which",
"this",
"method",
"returns",
"is"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/ExtensionUtils.java#L55-L65 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigCacheState.java | CmsADEConfigCacheState.createUpdatedCopy | public CmsADEConfigCacheState createUpdatedCopy(
Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates,
List<CmsADEConfigDataInternal> moduleUpdates,
Map<CmsUUID, CmsElementView> elementViewUpdates) {
Map<CmsUUID, CmsADEConfigDataInternal> newSitemapConfigs = Maps.newHashMap(m_siteConfigurations);
if (sitemapUpdates != null) {
for (Map.Entry<CmsUUID, CmsADEConfigDataInternal> entry : sitemapUpdates.entrySet()) {
CmsUUID key = entry.getKey();
CmsADEConfigDataInternal value = entry.getValue();
if (value != null) {
newSitemapConfigs.put(key, value);
} else {
newSitemapConfigs.remove(key);
}
}
}
List<CmsADEConfigDataInternal> newModuleConfigs = m_moduleConfigurations;
if (moduleUpdates != null) {
newModuleConfigs = moduleUpdates;
}
Map<CmsUUID, CmsElementView> newElementViews = m_elementViews;
if (elementViewUpdates != null) {
newElementViews = elementViewUpdates;
}
return new CmsADEConfigCacheState(m_cms, newSitemapConfigs, newModuleConfigs, newElementViews);
} | java | public CmsADEConfigCacheState createUpdatedCopy(
Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates,
List<CmsADEConfigDataInternal> moduleUpdates,
Map<CmsUUID, CmsElementView> elementViewUpdates) {
Map<CmsUUID, CmsADEConfigDataInternal> newSitemapConfigs = Maps.newHashMap(m_siteConfigurations);
if (sitemapUpdates != null) {
for (Map.Entry<CmsUUID, CmsADEConfigDataInternal> entry : sitemapUpdates.entrySet()) {
CmsUUID key = entry.getKey();
CmsADEConfigDataInternal value = entry.getValue();
if (value != null) {
newSitemapConfigs.put(key, value);
} else {
newSitemapConfigs.remove(key);
}
}
}
List<CmsADEConfigDataInternal> newModuleConfigs = m_moduleConfigurations;
if (moduleUpdates != null) {
newModuleConfigs = moduleUpdates;
}
Map<CmsUUID, CmsElementView> newElementViews = m_elementViews;
if (elementViewUpdates != null) {
newElementViews = elementViewUpdates;
}
return new CmsADEConfigCacheState(m_cms, newSitemapConfigs, newModuleConfigs, newElementViews);
} | [
"public",
"CmsADEConfigCacheState",
"createUpdatedCopy",
"(",
"Map",
"<",
"CmsUUID",
",",
"CmsADEConfigDataInternal",
">",
"sitemapUpdates",
",",
"List",
"<",
"CmsADEConfigDataInternal",
">",
"moduleUpdates",
",",
"Map",
"<",
"CmsUUID",
",",
"CmsElementView",
">",
"el... | Creates a new object which represents the changed configuration state given some updates, without
changing the current configuration state (this object instance).
@param sitemapUpdates a map containing changed sitemap configurations indexed by structure id (the map values are null if the corresponding sitemap configuration is not valid or could not be found)
@param moduleUpdates the list of *all* module configurations, or null if no module configuration update is needed
@param elementViewUpdates the updated element views, or null if no update needed
@return the new configuration state | [
"Creates",
"a",
"new",
"object",
"which",
"represents",
"the",
"changed",
"configuration",
"state",
"given",
"some",
"updates",
"without",
"changing",
"the",
"current",
"configuration",
"state",
"(",
"this",
"object",
"instance",
")",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigCacheState.java#L169-L196 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java | JobsInner.listByExperimentAsync | public Observable<Page<JobInner>> listByExperimentAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final JobsListByExperimentOptions jobsListByExperimentOptions) {
return listByExperimentWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobsListByExperimentOptions)
.map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() {
@Override
public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<JobInner>> listByExperimentAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final JobsListByExperimentOptions jobsListByExperimentOptions) {
return listByExperimentWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobsListByExperimentOptions)
.map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() {
@Override
public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"JobInner",
">",
">",
"listByExperimentAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"workspaceName",
",",
"final",
"String",
"experimentName",
",",
"final",
"JobsListByExperimentOptions",
"jobsL... | Gets a list of Jobs within the specified Experiment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param jobsListByExperimentOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobInner> object | [
"Gets",
"a",
"list",
"of",
"Jobs",
"within",
"the",
"specified",
"Experiment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L303-L311 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.exportObjects2Excel | public void exportObjects2Excel(String templatePath, List<?> data, Class clazz, String targetPath)
throws Excel4JException {
exportObjects2Excel(templatePath, 0, data, null, clazz, true, targetPath);
} | java | public void exportObjects2Excel(String templatePath, List<?> data, Class clazz, String targetPath)
throws Excel4JException {
exportObjects2Excel(templatePath, 0, data, null, clazz, true, targetPath);
} | [
"public",
"void",
"exportObjects2Excel",
"(",
"String",
"templatePath",
",",
"List",
"<",
"?",
">",
"data",
",",
"Class",
"clazz",
",",
"String",
"targetPath",
")",
"throws",
"Excel4JException",
"{",
"exportObjects2Excel",
"(",
"templatePath",
",",
"0",
",",
"... | 基于Excel模板与注解{@link com.github.crab2died.annotation.ExcelField}导出Excel
@param templatePath Excel模板路径
@param data 待导出数据的集合
@param clazz 映射对象Class
@param targetPath 生成的Excel输出全路径
@throws Excel4JException 异常
@author Crab2Died | [
"基于Excel模板与注解",
"{",
"@link",
"com",
".",
"github",
".",
"crab2died",
".",
"annotation",
".",
"ExcelField",
"}",
"导出Excel"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L590-L594 |
riversun/bigdoc | src/main/java/org/riversun/bigdoc/bin/BigFileSearcher.java | BigFileSearcher.searchBigFile | public List<Long> searchBigFile(File f, byte[] searchBytes) {
return searchBigFile(f, searchBytes, null);
} | java | public List<Long> searchBigFile(File f, byte[] searchBytes) {
return searchBigFile(f, searchBytes, null);
} | [
"public",
"List",
"<",
"Long",
">",
"searchBigFile",
"(",
"File",
"f",
",",
"byte",
"[",
"]",
"searchBytes",
")",
"{",
"return",
"searchBigFile",
"(",
"f",
",",
"searchBytes",
",",
"null",
")",
";",
"}"
] | Search bytes from big file faster in a concurrent processing with
progress callback
@param f
target file
@param searchBytes
sequence of bytes you want to search
@return | [
"Search",
"bytes",
"from",
"big",
"file",
"faster",
"in",
"a",
"concurrent",
"processing",
"with",
"progress",
"callback"
] | train | https://github.com/riversun/bigdoc/blob/46bd7c9a8667be23acdb1ad8286027e4b08cff3a/src/main/java/org/riversun/bigdoc/bin/BigFileSearcher.java#L271-L273 |
rundeck/rundeck | rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/LockingTree.java | LockingTree.synchStream | protected HasInputStream synchStream(final Path path, final HasInputStream stream) {
return new HasInputStream() {
@Override
public InputStream getInputStream() throws IOException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
writeContent(bytes);
return new ByteArrayInputStream(bytes.toByteArray());
}
@Override
public long writeContent(OutputStream outputStream) throws IOException {
synchronized (pathSynch(path)) {
return stream.writeContent(outputStream);
}
}
};
} | java | protected HasInputStream synchStream(final Path path, final HasInputStream stream) {
return new HasInputStream() {
@Override
public InputStream getInputStream() throws IOException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
writeContent(bytes);
return new ByteArrayInputStream(bytes.toByteArray());
}
@Override
public long writeContent(OutputStream outputStream) throws IOException {
synchronized (pathSynch(path)) {
return stream.writeContent(outputStream);
}
}
};
} | [
"protected",
"HasInputStream",
"synchStream",
"(",
"final",
"Path",
"path",
",",
"final",
"HasInputStream",
"stream",
")",
"{",
"return",
"new",
"HasInputStream",
"(",
")",
"{",
"@",
"Override",
"public",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOE... | Return a {@link HasInputStream} where all read access to the underlying data is synchronized around the path
@param path path
@param stream stream
@return synchronized stream access | [
"Return",
"a",
"{",
"@link",
"HasInputStream",
"}",
"where",
"all",
"read",
"access",
"to",
"the",
"underlying",
"data",
"is",
"synchronized",
"around",
"the",
"path"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/LockingTree.java#L61-L78 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java | AuditEvent.isAuditRequired | public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException {
AuditService auditService = SecurityUtils.getAuditService();
if (auditService != null) {
return auditService.isAuditRequired(eventType, outcome);
} else {
throw new AuditServiceUnavailableException();
}
} | java | public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException {
AuditService auditService = SecurityUtils.getAuditService();
if (auditService != null) {
return auditService.isAuditRequired(eventType, outcome);
} else {
throw new AuditServiceUnavailableException();
}
} | [
"public",
"static",
"boolean",
"isAuditRequired",
"(",
"String",
"eventType",
",",
"String",
"outcome",
")",
"throws",
"AuditServiceUnavailableException",
"{",
"AuditService",
"auditService",
"=",
"SecurityUtils",
".",
"getAuditService",
"(",
")",
";",
"if",
"(",
"a... | Check to see if auditing is required for an event type and outcome.
@param eventType SECURITY_AUTHN, SECURITY_AUTHZ, etc
@param outcome OUTCOME_SUCCESS, OUTCOME_DENIED, etc.
@return true - events with the type/outcome should be audited
false - events with the type/outcome should not be audited
@throws AuditServiceUnavailableException | [
"Check",
"to",
"see",
"if",
"auditing",
"is",
"required",
"for",
"an",
"event",
"type",
"and",
"outcome",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L595-L602 |
btaz/data-util | src/main/java/com/btaz/util/xml/diff/DefaultReport.java | DefaultReport.trimNonXmlElements | @SuppressWarnings("RedundantStringConstructorCall") // avoid String substring memory leak in JDK 1.6
private String trimNonXmlElements(String path) {
if(path != null && path.length() > 0) {
int pos = path.lastIndexOf(">");
if(pos > -1) {
path = new String(path.substring(0, pos+1));
}
}
return path;
} | java | @SuppressWarnings("RedundantStringConstructorCall") // avoid String substring memory leak in JDK 1.6
private String trimNonXmlElements(String path) {
if(path != null && path.length() > 0) {
int pos = path.lastIndexOf(">");
if(pos > -1) {
path = new String(path.substring(0, pos+1));
}
}
return path;
} | [
"@",
"SuppressWarnings",
"(",
"\"RedundantStringConstructorCall\"",
")",
"// avoid String substring memory leak in JDK 1.6",
"private",
"String",
"trimNonXmlElements",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
"&&",
"path",
".",
"length",
"(",
... | /*
This method trims non XML element data from the end of a path
e.g. <float name="score">12.34567 would become <float name="score">, 12.34567 would be stripped out | [
"/",
"*",
"This",
"method",
"trims",
"non",
"XML",
"element",
"data",
"from",
"the",
"end",
"of",
"a",
"path",
"e",
".",
"g",
".",
"<float",
"name",
"=",
"score",
">",
"12",
".",
"34567",
"would",
"become",
"<float",
"name",
"=",
"score",
">",
"12"... | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/diff/DefaultReport.java#L71-L80 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/style/MasterPageStyle.java | MasterPageStyle.appendXMLToMasterStyle | public void appendXMLToMasterStyle(final XMLUtil util, final Appendable appendable)
throws IOException {
appendable.append("<style:master-page");
util.appendEAttribute(appendable, "style:name", this.name);
util.appendEAttribute(appendable, "style:page-layout-name", this.layoutName);
appendable.append("><style:header>");
this.header.appendXMLToMasterStyle(util, appendable);
appendable.append("</style:header>");
appendable.append("<style:header-left");
util.appendAttribute(appendable, "style:display", false);
appendable.append("/>");
appendable.append("<style:footer>");
this.footer.appendXMLToMasterStyle(util, appendable);
appendable.append("</style:footer>");
appendable.append("<style:footer-left");
util.appendAttribute(appendable, "style:display", false);
appendable.append("/>");
appendable.append("</style:master-page>");
} | java | public void appendXMLToMasterStyle(final XMLUtil util, final Appendable appendable)
throws IOException {
appendable.append("<style:master-page");
util.appendEAttribute(appendable, "style:name", this.name);
util.appendEAttribute(appendable, "style:page-layout-name", this.layoutName);
appendable.append("><style:header>");
this.header.appendXMLToMasterStyle(util, appendable);
appendable.append("</style:header>");
appendable.append("<style:header-left");
util.appendAttribute(appendable, "style:display", false);
appendable.append("/>");
appendable.append("<style:footer>");
this.footer.appendXMLToMasterStyle(util, appendable);
appendable.append("</style:footer>");
appendable.append("<style:footer-left");
util.appendAttribute(appendable, "style:display", false);
appendable.append("/>");
appendable.append("</style:master-page>");
} | [
"public",
"void",
"appendXMLToMasterStyle",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"appendable",
".",
"append",
"(",
"\"<style:master-page\"",
")",
";",
"util",
".",
"appendEAttribute",
"(",
"a... | Return the master-style informations for this PageStyle.
@param util a util for XML writing
@param appendable where to write
@throws IOException If an I/O error occurs | [
"Return",
"the",
"master",
"-",
"style",
"informations",
"for",
"this",
"PageStyle",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/style/MasterPageStyle.java#L88-L106 |
icode/ameba-utils | src/main/java/ameba/util/IOUtils.java | IOUtils.getJarManifestValue | public static String getJarManifestValue(Class clazz, String attrName) {
URL url = getResource("/" + clazz.getName().replace('.', '/')
+ ".class");
if (url != null)
try {
URLConnection uc = url.openConnection();
if (uc instanceof java.net.JarURLConnection) {
JarURLConnection juc = (JarURLConnection) uc;
Manifest m = juc.getManifest();
return m.getMainAttributes().getValue(attrName);
}
} catch (IOException e) {
return null;
}
return null;
} | java | public static String getJarManifestValue(Class clazz, String attrName) {
URL url = getResource("/" + clazz.getName().replace('.', '/')
+ ".class");
if (url != null)
try {
URLConnection uc = url.openConnection();
if (uc instanceof java.net.JarURLConnection) {
JarURLConnection juc = (JarURLConnection) uc;
Manifest m = juc.getManifest();
return m.getMainAttributes().getValue(attrName);
}
} catch (IOException e) {
return null;
}
return null;
} | [
"public",
"static",
"String",
"getJarManifestValue",
"(",
"Class",
"clazz",
",",
"String",
"attrName",
")",
"{",
"URL",
"url",
"=",
"getResource",
"(",
"\"/\"",
"+",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
... | <p>getJarManifestValue.</p>
@param clazz a {@link java.lang.Class} object.
@param attrName a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"getJarManifestValue",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/IOUtils.java#L325-L340 |
hexagonframework/spring-data-ebean | src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java | StringQuery.getBindingFor | public ParameterBinding getBindingFor(int position) {
for (ParameterBinding binding : bindings) {
if (binding.hasPosition(position)) {
return binding;
}
}
throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position));
} | java | public ParameterBinding getBindingFor(int position) {
for (ParameterBinding binding : bindings) {
if (binding.hasPosition(position)) {
return binding;
}
}
throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position));
} | [
"public",
"ParameterBinding",
"getBindingFor",
"(",
"int",
"position",
")",
"{",
"for",
"(",
"ParameterBinding",
"binding",
":",
"bindings",
")",
"{",
"if",
"(",
"binding",
".",
"hasPosition",
"(",
"position",
")",
")",
"{",
"return",
"binding",
";",
"}",
... | Returns the {@link ParameterBinding} for the given position.
@param position
@return | [
"Returns",
"the",
"{",
"@link",
"ParameterBinding",
"}",
"for",
"the",
"given",
"position",
"."
] | train | https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java#L114-L123 |
lawloretienne/ImageGallery | library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java | TouchImageView.setZoom | public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
//
// setZoom can be called before the image is on the screen, but at this point,
// image and view sizes have not yet been calculated in onMeasure. Thus, we should
// delay calling setZoom until the view has been measured.
//
if (!onDrawReady) {
delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType);
return;
}
if (scaleType != mScaleType) {
setScaleType(scaleType);
}
resetZoom();
scaleImage(scale, viewWidth / 2, viewHeight / 2, true);
matrix.getValues(m);
m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f));
m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f));
matrix.setValues(m);
fixTrans();
setImageMatrix(matrix);
} | java | public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
//
// setZoom can be called before the image is on the screen, but at this point,
// image and view sizes have not yet been calculated in onMeasure. Thus, we should
// delay calling setZoom until the view has been measured.
//
if (!onDrawReady) {
delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType);
return;
}
if (scaleType != mScaleType) {
setScaleType(scaleType);
}
resetZoom();
scaleImage(scale, viewWidth / 2, viewHeight / 2, true);
matrix.getValues(m);
m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f));
m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f));
matrix.setValues(m);
fixTrans();
setImageMatrix(matrix);
} | [
"public",
"void",
"setZoom",
"(",
"float",
"scale",
",",
"float",
"focusX",
",",
"float",
"focusY",
",",
"ScaleType",
"scaleType",
")",
"{",
"//",
"// setZoom can be called before the image is on the screen, but at this point,",
"// image and view sizes have not yet been calcul... | Set zoom to the specified scale. Image will be centered around the point
(focusX, focusY). These floats range from 0 to 1 and denote the focus point
as a fraction from the left and top of the view. For example, the top left
corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
@param scale
@param focusX
@param focusY
@param scaleType | [
"Set",
"zoom",
"to",
"the",
"specified",
"scale",
".",
"Image",
"will",
"be",
"centered",
"around",
"the",
"point",
"(",
"focusX",
"focusY",
")",
".",
"These",
"floats",
"range",
"from",
"0",
"to",
"1",
"and",
"denote",
"the",
"focus",
"point",
"as",
"... | train | https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L389-L411 |
geomajas/geomajas-project-server | plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java | HibernateLayerUtil.setSessionFactory | public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException {
try {
this.sessionFactory = sessionFactory;
if (null != layerInfo) {
entityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName());
}
} catch (Exception e) { // NOSONAR
throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_NO_SESSION_FACTORY);
}
} | java | public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException {
try {
this.sessionFactory = sessionFactory;
if (null != layerInfo) {
entityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName());
}
} catch (Exception e) { // NOSONAR
throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_NO_SESSION_FACTORY);
}
} | [
"public",
"void",
"setSessionFactory",
"(",
"SessionFactory",
"sessionFactory",
")",
"throws",
"HibernateLayerException",
"{",
"try",
"{",
"this",
".",
"sessionFactory",
"=",
"sessionFactory",
";",
"if",
"(",
"null",
"!=",
"layerInfo",
")",
"{",
"entityMetadata",
... | Set session factory.
@param sessionFactory session factory
@throws HibernateLayerException could not get class metadata for data source | [
"Set",
"session",
"factory",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java#L145-L154 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listStorageAccountsWithServiceResponseAsync | public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listStorageAccountsSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listStorageAccountsSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"StorageAccountInfoInner",
">",
">",
">",
"listStorageAccountsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listStorag... | Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account for which to list Azure Storage accounts.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountInfoInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Azure",
"Storage",
"accounts",
"if",
"any",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1288-L1300 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java | DeprecatedAPIListBuilder.composeDeprecatedList | private void composeDeprecatedList(SortedSet<Element> rset, SortedSet<Element> sset, List<? extends Element> members) {
for (Element member : members) {
if (utils.isDeprecatedForRemoval(member)) {
rset.add(member);
}
if (utils.isDeprecated(member)) {
sset.add(member);
}
}
} | java | private void composeDeprecatedList(SortedSet<Element> rset, SortedSet<Element> sset, List<? extends Element> members) {
for (Element member : members) {
if (utils.isDeprecatedForRemoval(member)) {
rset.add(member);
}
if (utils.isDeprecated(member)) {
sset.add(member);
}
}
} | [
"private",
"void",
"composeDeprecatedList",
"(",
"SortedSet",
"<",
"Element",
">",
"rset",
",",
"SortedSet",
"<",
"Element",
">",
"sset",
",",
"List",
"<",
"?",
"extends",
"Element",
">",
"members",
")",
"{",
"for",
"(",
"Element",
"member",
":",
"members"... | Add the members into a single list of deprecated members.
@param rset set of elements deprecated for removal.
@param sset set of deprecated elements.
@param list List of all the particular deprecated members, e.g. methods.
@param members members to be added in the list. | [
"Add",
"the",
"members",
"into",
"a",
"single",
"list",
"of",
"deprecated",
"members",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java#L173-L182 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_login_login_PUT | public void zone_zoneName_dynHost_login_login_PUT(String zoneName, String login, OvhDynHostLogin body) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}";
StringBuilder sb = path(qPath, zoneName, login);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void zone_zoneName_dynHost_login_login_PUT(String zoneName, String login, OvhDynHostLogin body) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}";
StringBuilder sb = path(qPath, zoneName, login);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"zone_zoneName_dynHost_login_login_PUT",
"(",
"String",
"zoneName",
",",
"String",
"login",
",",
"OvhDynHostLogin",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/login/{login}\"",
";",
"StringBuilder"... | Alter this object properties
REST: PUT /domain/zone/{zoneName}/dynHost/login/{login}
@param body [required] New object properties
@param zoneName [required] The internal name of your zone
@param login [required] Login | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L453-L457 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addIdNotInCollectionCondition | protected void addIdNotInCollectionCondition(final String propertyName, final Collection<Integer> values) {
if (values != null && !values.isEmpty()) {
fieldConditions.add(getCriteriaBuilder().not(getRootPath().get(propertyName).in(values)));
}
} | java | protected void addIdNotInCollectionCondition(final String propertyName, final Collection<Integer> values) {
if (values != null && !values.isEmpty()) {
fieldConditions.add(getCriteriaBuilder().not(getRootPath().get(propertyName).in(values)));
}
} | [
"protected",
"void",
"addIdNotInCollectionCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Collection",
"<",
"Integer",
">",
"values",
")",
"{",
"if",
"(",
"values",
"!=",
"null",
"&&",
"!",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"... | Add a Field Search Condition that will check if the id field does not exist in an array of values. eg.
{@code field NOT IN (values)}
@param propertyName The name of the field id as defined in the Entity mapping class.
@param values The List of Ids to be compared to. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"id",
"field",
"does",
"not",
"exist",
"in",
"an",
"array",
"of",
"values",
".",
"eg",
".",
"{",
"@code",
"field",
"NOT",
"IN",
"(",
"values",
")",
"}"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L370-L374 |
structr/structr | structr-core/src/main/java/org/structr/core/auth/HashHelper.java | HashHelper.getHash | public static String getHash(final String password, final String salt) {
if (StringUtils.isEmpty(salt)) {
return getSimpleHash(password);
}
return DigestUtils.sha512Hex(DigestUtils.sha512Hex(password).concat(salt));
} | java | public static String getHash(final String password, final String salt) {
if (StringUtils.isEmpty(salt)) {
return getSimpleHash(password);
}
return DigestUtils.sha512Hex(DigestUtils.sha512Hex(password).concat(salt));
} | [
"public",
"static",
"String",
"getHash",
"(",
"final",
"String",
"password",
",",
"final",
"String",
"salt",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"salt",
")",
")",
"{",
"return",
"getSimpleHash",
"(",
"password",
")",
";",
"}",
"retur... | Calculate a SHA-512 hash of the given password string.
If salt is given, use salt.
@param password
@param salt
@return hash | [
"Calculate",
"a",
"SHA",
"-",
"512",
"hash",
"of",
"the",
"given",
"password",
"string",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/auth/HashHelper.java#L38-L48 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsProjectDriver.java | CmsProjectDriver.internalReadLogEntry | protected CmsLogEntry internalReadLogEntry(ResultSet res) throws SQLException {
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_USER_ID")));
long date = res.getLong(m_sqlManager.readQuery("C_LOG_DATE"));
CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_STRUCTURE_ID")));
CmsLogEntryType type = CmsLogEntryType.valueOf(res.getInt(m_sqlManager.readQuery("C_LOG_TYPE")));
String[] data = CmsStringUtil.splitAsArray(res.getString(m_sqlManager.readQuery("C_LOG_DATA")), '|');
return new CmsLogEntry(userId, date, structureId, type, data);
} | java | protected CmsLogEntry internalReadLogEntry(ResultSet res) throws SQLException {
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_USER_ID")));
long date = res.getLong(m_sqlManager.readQuery("C_LOG_DATE"));
CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_STRUCTURE_ID")));
CmsLogEntryType type = CmsLogEntryType.valueOf(res.getInt(m_sqlManager.readQuery("C_LOG_TYPE")));
String[] data = CmsStringUtil.splitAsArray(res.getString(m_sqlManager.readQuery("C_LOG_DATA")), '|');
return new CmsLogEntry(userId, date, structureId, type, data);
} | [
"protected",
"CmsLogEntry",
"internalReadLogEntry",
"(",
"ResultSet",
"res",
")",
"throws",
"SQLException",
"{",
"CmsUUID",
"userId",
"=",
"new",
"CmsUUID",
"(",
"res",
".",
"getString",
"(",
"m_sqlManager",
".",
"readQuery",
"(",
"\"C_LOG_USER_ID\"",
")",
")",
... | Creates a new {@link CmsLogEntry} object from the given result set entry.<p>
@param res the result set
@return the new {@link CmsLogEntry} object
@throws SQLException if something goes wrong | [
"Creates",
"a",
"new",
"{",
"@link",
"CmsLogEntry",
"}",
"object",
"from",
"the",
"given",
"result",
"set",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsProjectDriver.java#L3164-L3172 |
VoltDB/voltdb | src/frontend/org/voltdb/plannodes/NodeSchema.java | NodeSchema.resetTableName | public NodeSchema resetTableName(String tbName, String tbAlias) {
m_columns.forEach(sc ->
sc.reset(tbName, tbAlias, sc.getColumnName(), sc.getColumnAlias()));
m_columnsMapHelper.forEach((k, v) ->
k.reset(tbName, tbAlias, k.getColumnName(), k.getColumnAlias()));
return this;
} | java | public NodeSchema resetTableName(String tbName, String tbAlias) {
m_columns.forEach(sc ->
sc.reset(tbName, tbAlias, sc.getColumnName(), sc.getColumnAlias()));
m_columnsMapHelper.forEach((k, v) ->
k.reset(tbName, tbAlias, k.getColumnName(), k.getColumnAlias()));
return this;
} | [
"public",
"NodeSchema",
"resetTableName",
"(",
"String",
"tbName",
",",
"String",
"tbAlias",
")",
"{",
"m_columns",
".",
"forEach",
"(",
"sc",
"->",
"sc",
".",
"reset",
"(",
"tbName",
",",
"tbAlias",
",",
"sc",
".",
"getColumnName",
"(",
")",
",",
"sc",
... | Substitute table name only for all schema columns and map entries | [
"Substitute",
"table",
"name",
"only",
"for",
"all",
"schema",
"columns",
"and",
"map",
"entries"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/NodeSchema.java#L74-L80 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java | CorsServiceBuilder.preflightResponseHeader | public CorsServiceBuilder preflightResponseHeader(CharSequence name, Iterable<?> values) {
firstPolicyBuilder.preflightResponseHeader(name, values);
return this;
} | java | public CorsServiceBuilder preflightResponseHeader(CharSequence name, Iterable<?> values) {
firstPolicyBuilder.preflightResponseHeader(name, values);
return this;
} | [
"public",
"CorsServiceBuilder",
"preflightResponseHeader",
"(",
"CharSequence",
"name",
",",
"Iterable",
"<",
"?",
">",
"values",
")",
"{",
"firstPolicyBuilder",
".",
"preflightResponseHeader",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Returns HTTP response headers that should be added to a CORS preflight response.
<p>An intermediary like a load balancer might require that a CORS preflight request
have certain headers set. This enables such headers to be added.
@param name the name of the HTTP header.
@param values the values for the HTTP header.
@return {@link CorsServiceBuilder} to support method chaining. | [
"Returns",
"HTTP",
"response",
"headers",
"that",
"should",
"be",
"added",
"to",
"a",
"CORS",
"preflight",
"response",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java#L316-L319 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java | ObjectCacheTwoLevelImpl.afterCommit | public void afterCommit(PBStateEvent event)
{
if(log.isDebugEnabled()) log.debug("afterCommit() call, push objects to application cache");
if(invokeCounter != 0)
{
log.error("** Please check method calls of ObjectCacheTwoLevelImpl#enableMaterialization and" +
" ObjectCacheTwoLevelImpl#disableMaterialization, number of calls have to be equals **");
}
try
{
// we only push "really modified objects" to the application cache
pushToApplicationCache(TYPE_WRITE, TYPE_CACHED_READ);
}
finally
{
resetSessionCache();
}
} | java | public void afterCommit(PBStateEvent event)
{
if(log.isDebugEnabled()) log.debug("afterCommit() call, push objects to application cache");
if(invokeCounter != 0)
{
log.error("** Please check method calls of ObjectCacheTwoLevelImpl#enableMaterialization and" +
" ObjectCacheTwoLevelImpl#disableMaterialization, number of calls have to be equals **");
}
try
{
// we only push "really modified objects" to the application cache
pushToApplicationCache(TYPE_WRITE, TYPE_CACHED_READ);
}
finally
{
resetSessionCache();
}
} | [
"public",
"void",
"afterCommit",
"(",
"PBStateEvent",
"event",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"afterCommit() call, push objects to application cache\"",
")",
";",
"if",
"(",
"invokeCounter",
"!=",
"0... | After committing the transaction push the object
from session cache ( 1st level cache) to the application cache
(2d level cache). Finally, clear the session cache. | [
"After",
"committing",
"the",
"transaction",
"push",
"the",
"object",
"from",
"session",
"cache",
"(",
"1st",
"level",
"cache",
")",
"to",
"the",
"application",
"cache",
"(",
"2d",
"level",
"cache",
")",
".",
"Finally",
"clear",
"the",
"session",
"cache",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java#L495-L512 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsResourceTypeConfig.java | CmsResourceTypeConfig.tryToUnlock | protected void tryToUnlock(CmsObject cms, String folderPath) throws CmsException {
// Get path of first ancestor that actually exists
while (!cms.existsResource(folderPath)) {
folderPath = CmsResource.getParentFolder(folderPath);
}
CmsResource resource = cms.readResource(folderPath);
CmsLock lock = cms.getLock(resource);
// we are only interested in locks we can safely unlock, i.e. locks by the current user
if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
// walk up the tree until we get to the location from which the lock is inherited
while (lock.isInherited()) {
folderPath = CmsResource.getParentFolder(folderPath);
resource = cms.readResource(folderPath);
lock = cms.getLock(resource);
}
cms.unlockResource(folderPath);
}
} | java | protected void tryToUnlock(CmsObject cms, String folderPath) throws CmsException {
// Get path of first ancestor that actually exists
while (!cms.existsResource(folderPath)) {
folderPath = CmsResource.getParentFolder(folderPath);
}
CmsResource resource = cms.readResource(folderPath);
CmsLock lock = cms.getLock(resource);
// we are only interested in locks we can safely unlock, i.e. locks by the current user
if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
// walk up the tree until we get to the location from which the lock is inherited
while (lock.isInherited()) {
folderPath = CmsResource.getParentFolder(folderPath);
resource = cms.readResource(folderPath);
lock = cms.getLock(resource);
}
cms.unlockResource(folderPath);
}
} | [
"protected",
"void",
"tryToUnlock",
"(",
"CmsObject",
"cms",
",",
"String",
"folderPath",
")",
"throws",
"CmsException",
"{",
"// Get path of first ancestor that actually exists",
"while",
"(",
"!",
"cms",
".",
"existsResource",
"(",
"folderPath",
")",
")",
"{",
"fo... | Tries to remove a lock on an ancestor of a given path owned by the current user.<p>
@param cms the CMS context
@param folderPath the path for which the lock should be removed
@throws CmsException if something goes wrong | [
"Tries",
"to",
"remove",
"a",
"lock",
"on",
"an",
"ancestor",
"of",
"a",
"given",
"path",
"owned",
"by",
"the",
"current",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L749-L767 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamper.java | PdfStamper.setPageAction | public void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException {
stamper.setPageAction(actionType, action, page);
} | java | public void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException {
stamper.setPageAction(actionType, action, page);
} | [
"public",
"void",
"setPageAction",
"(",
"PdfName",
"actionType",
",",
"PdfAction",
"action",
",",
"int",
"page",
")",
"throws",
"PdfException",
"{",
"stamper",
".",
"setPageAction",
"(",
"actionType",
",",
"action",
",",
"page",
")",
";",
"}"
] | Sets the open and close page additional action.
@param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE>
or <CODE>PdfWriter.PAGE_CLOSE</CODE>
@param action the action to perform
@param page the page where the action will be applied. The first page is 1
@throws PdfException if the action type is invalid | [
"Sets",
"the",
"open",
"and",
"close",
"page",
"additional",
"action",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L596-L598 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.randomShuffle | public static void randomShuffle(ArrayModifiableDBIDs ids, Random random, final int limit) {
final int end = ids.size();
for(int i = 1; i < limit; i++) {
ids.swap(i - 1, i + random.nextInt(end - i));
}
} | java | public static void randomShuffle(ArrayModifiableDBIDs ids, Random random, final int limit) {
final int end = ids.size();
for(int i = 1; i < limit; i++) {
ids.swap(i - 1, i + random.nextInt(end - i));
}
} | [
"public",
"static",
"void",
"randomShuffle",
"(",
"ArrayModifiableDBIDs",
"ids",
",",
"Random",
"random",
",",
"final",
"int",
"limit",
")",
"{",
"final",
"int",
"end",
"=",
"ids",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i... | Produce a random shuffling of the given DBID array.
Only the first {@code limit} elements will be fully randomized, but the
remaining objects will also be changed.
@param ids Original DBIDs, no duplicates allowed
@param random Random generator
@param limit Shuffling limit. | [
"Produce",
"a",
"random",
"shuffling",
"of",
"the",
"given",
"DBID",
"array",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L534-L539 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isInstanceOf | public static <T> T isInstanceOf(Class<?> type, T obj, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(type, "Type to check against must not be null");
if (false == type.isInstance(obj)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return obj;
} | java | public static <T> T isInstanceOf(Class<?> type, T obj, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(type, "Type to check against must not be null");
if (false == type.isInstance(obj)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return obj;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"isInstanceOf",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"obj",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"notNull",
"(",
"type",
",",
... | 断言给定对象是否是给定类的实例
<pre class="code">
Assert.instanceOf(Foo.class, foo);
</pre>
@param <T> 被检查对象泛型类型
@param type 被检查对象匹配的类型
@param obj 被检查对象
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 被检查对象
@throws IllegalArgumentException if the object is not an instance of clazz
@see Class#isInstance(Object) | [
"断言给定对象是否是给定类的实例"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L449-L455 |
OpenLiberty/open-liberty | dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/EndpointManager.java | EndpointManager.removeSession | public synchronized void removeSession(Endpoint ep, SessionExt sess) {
Class<?> cl = ep.getClass();
if (cl.equals(AnnotatedEndpoint.class)) {
AnnotatedEndpoint ae = (AnnotatedEndpoint) ep;
cl = ae.getServerEndpointClass();
}
// Always try to remove http session if we can.
String id = sess.getSessionImpl().getHttpSessionID();
if (id != null) {
httpSessionMap.remove(id);
}
// find the session array for the given endpoint
ArrayList<Session> sa = endpointSessionMap.get(cl);
// nothing to remove if we don't have a session
if (sa == null) {
return;
}
// remove the new session from the list for this endpoint
sa.remove(sess);
// put the updated list back into the Map
endpointSessionMap.put(cl, sa);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "removed session of: " + sess.getId() + " from endpoint class of: " + cl.getName() + " in endpointmanager of: " + this.hashCode());
}
} | java | public synchronized void removeSession(Endpoint ep, SessionExt sess) {
Class<?> cl = ep.getClass();
if (cl.equals(AnnotatedEndpoint.class)) {
AnnotatedEndpoint ae = (AnnotatedEndpoint) ep;
cl = ae.getServerEndpointClass();
}
// Always try to remove http session if we can.
String id = sess.getSessionImpl().getHttpSessionID();
if (id != null) {
httpSessionMap.remove(id);
}
// find the session array for the given endpoint
ArrayList<Session> sa = endpointSessionMap.get(cl);
// nothing to remove if we don't have a session
if (sa == null) {
return;
}
// remove the new session from the list for this endpoint
sa.remove(sess);
// put the updated list back into the Map
endpointSessionMap.put(cl, sa);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "removed session of: " + sess.getId() + " from endpoint class of: " + cl.getName() + " in endpointmanager of: " + this.hashCode());
}
} | [
"public",
"synchronized",
"void",
"removeSession",
"(",
"Endpoint",
"ep",
",",
"SessionExt",
"sess",
")",
"{",
"Class",
"<",
"?",
">",
"cl",
"=",
"ep",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"cl",
".",
"equals",
"(",
"AnnotatedEndpoint",
".",
"clas... | /*
closeAllSessions will call this with the session already removed... | [
"/",
"*",
"closeAllSessions",
"will",
"call",
"this",
"with",
"the",
"session",
"already",
"removed",
"..."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/EndpointManager.java#L114-L145 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/ListPathsServlet.java | ListPathsServlet.writeInfo | static void writeInfo(String parent, HdfsFileStatus i, XMLOutputter doc) throws IOException {
final SimpleDateFormat ldf = df.get();
doc.startTag(i.isDir() ? "directory" : "file");
doc.attribute("path", i.getFullPath(new Path(parent)).toUri().getPath());
doc.attribute("modified", ldf.format(new Date(i.getModificationTime())));
doc.attribute("accesstime", ldf.format(new Date(i.getAccessTime())));
if (!i.isDir()) {
doc.attribute("size", String.valueOf(i.getLen()));
doc.attribute("replication", String.valueOf(i.getReplication()));
doc.attribute("blocksize", String.valueOf(i.getBlockSize()));
}
doc.attribute("permission", (i.isDir()? "d": "-") + i.getPermission());
doc.attribute("owner", i.getOwner());
doc.attribute("group", i.getGroup());
doc.endTag();
} | java | static void writeInfo(String parent, HdfsFileStatus i, XMLOutputter doc) throws IOException {
final SimpleDateFormat ldf = df.get();
doc.startTag(i.isDir() ? "directory" : "file");
doc.attribute("path", i.getFullPath(new Path(parent)).toUri().getPath());
doc.attribute("modified", ldf.format(new Date(i.getModificationTime())));
doc.attribute("accesstime", ldf.format(new Date(i.getAccessTime())));
if (!i.isDir()) {
doc.attribute("size", String.valueOf(i.getLen()));
doc.attribute("replication", String.valueOf(i.getReplication()));
doc.attribute("blocksize", String.valueOf(i.getBlockSize()));
}
doc.attribute("permission", (i.isDir()? "d": "-") + i.getPermission());
doc.attribute("owner", i.getOwner());
doc.attribute("group", i.getGroup());
doc.endTag();
} | [
"static",
"void",
"writeInfo",
"(",
"String",
"parent",
",",
"HdfsFileStatus",
"i",
",",
"XMLOutputter",
"doc",
")",
"throws",
"IOException",
"{",
"final",
"SimpleDateFormat",
"ldf",
"=",
"df",
".",
"get",
"(",
")",
";",
"doc",
".",
"startTag",
"(",
"i",
... | Write a node to output.
Node information includes path, modification, permission, owner and group.
For files, it also includes size, replication and block-size. | [
"Write",
"a",
"node",
"to",
"output",
".",
"Node",
"information",
"includes",
"path",
"modification",
"permission",
"owner",
"and",
"group",
".",
"For",
"files",
"it",
"also",
"includes",
"size",
"replication",
"and",
"block",
"-",
"size",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ListPathsServlet.java#L64-L79 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Streams.java | Streams.copyStreamCount | public static int copyStreamCount(final InputStream in, final OutputStream out) throws IOException {
final byte[] buffer = new byte[10240];
int tot=0;
int c;
c = in.read(buffer);
while (c >= 0) {
if (c > 0) {
out.write(buffer, 0, c);
tot += c;
}
c = in.read(buffer);
}
return tot;
} | java | public static int copyStreamCount(final InputStream in, final OutputStream out) throws IOException {
final byte[] buffer = new byte[10240];
int tot=0;
int c;
c = in.read(buffer);
while (c >= 0) {
if (c > 0) {
out.write(buffer, 0, c);
tot += c;
}
c = in.read(buffer);
}
return tot;
} | [
"public",
"static",
"int",
"copyStreamCount",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"10240",
"]",
";",
"int",
"tot",
"=",
"... | Read the data from the input stream and copy to the outputstream.
@param in inputstream
@param out outpustream
@return number of bytes copied
@throws java.io.IOException if thrown by underlying io operations | [
"Read",
"the",
"data",
"from",
"the",
"input",
"stream",
"and",
"copy",
"to",
"the",
"outputstream",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Streams.java#L60-L73 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java | DirectoryConnection.sendPing | private ErrorCode sendPing() throws IOException {
if(LOGGER.isTraceEnabled()){
LOGGER.trace("......................send Ping");
}
lastPingSentNs = System.currentTimeMillis();
ProtocolHeader h = new ProtocolHeader(-2, ProtocolType.Ping);
sendAdminPacket(h, null);
int waitTime = session.pingWaitTimeOut;
synchronized(pingResponse){
while(waitTime > 0){
try {
pingResponse.wait(waitTime);
} catch (InterruptedException e) {
// Do nothing.
}
ResponseHeader header = pingResponse.get();
if (header != null) {
pingResponse.set(null);
return header.getErr();
}
waitTime -= (System.currentTimeMillis() - lastPingSentNs);
}
}
return ErrorCode.PING_TIMEOUT;
} | java | private ErrorCode sendPing() throws IOException {
if(LOGGER.isTraceEnabled()){
LOGGER.trace("......................send Ping");
}
lastPingSentNs = System.currentTimeMillis();
ProtocolHeader h = new ProtocolHeader(-2, ProtocolType.Ping);
sendAdminPacket(h, null);
int waitTime = session.pingWaitTimeOut;
synchronized(pingResponse){
while(waitTime > 0){
try {
pingResponse.wait(waitTime);
} catch (InterruptedException e) {
// Do nothing.
}
ResponseHeader header = pingResponse.get();
if (header != null) {
pingResponse.set(null);
return header.getErr();
}
waitTime -= (System.currentTimeMillis() - lastPingSentNs);
}
}
return ErrorCode.PING_TIMEOUT;
} | [
"private",
"ErrorCode",
"sendPing",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"LOGGER",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"......................send Ping\"",
")",
";",
"}",
"lastPingSentNs",
"=",
"System",
".",... | Send the Ping Request.
@return
the ErrorCode, OK for success.
@throws IOException
the IOException. | [
"Send",
"the",
"Ping",
"Request",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L911-L938 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/gen/PropertyData.java | PropertyData.resolveEqualsHashCodeStyle | public void resolveEqualsHashCodeStyle(File file, int lineIndex) {
if (equalsHashCodeStyle.equals("smart")) {
equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter");
}
if (equalsHashCodeStyle.equals("omit") ||
equalsHashCodeStyle.equals("getter") ||
equalsHashCodeStyle.equals("field")) {
return;
}
throw new BeanCodeGenException("Invalid equals/hashCode style: " + equalsHashCodeStyle +
" in " + getBean().getTypeRaw() + "." + getPropertyName(), file, lineIndex);
} | java | public void resolveEqualsHashCodeStyle(File file, int lineIndex) {
if (equalsHashCodeStyle.equals("smart")) {
equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter");
}
if (equalsHashCodeStyle.equals("omit") ||
equalsHashCodeStyle.equals("getter") ||
equalsHashCodeStyle.equals("field")) {
return;
}
throw new BeanCodeGenException("Invalid equals/hashCode style: " + equalsHashCodeStyle +
" in " + getBean().getTypeRaw() + "." + getPropertyName(), file, lineIndex);
} | [
"public",
"void",
"resolveEqualsHashCodeStyle",
"(",
"File",
"file",
",",
"int",
"lineIndex",
")",
"{",
"if",
"(",
"equalsHashCodeStyle",
".",
"equals",
"(",
"\"smart\"",
")",
")",
"{",
"equalsHashCodeStyle",
"=",
"(",
"bean",
".",
"isImmutable",
"(",
")",
"... | Resolves the equals hashCode generator.
@param file the file
@param lineIndex the line index | [
"Resolves",
"the",
"equals",
"hashCode",
"generator",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/PropertyData.java#L453-L464 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java | AbstractSetMandatory.applyMandatoryAction | private void applyMandatoryAction(final WComponent target, final boolean mandatory) {
if (target instanceof Mandatable) {
((Mandatable) target).setMandatory(mandatory);
} else if (target instanceof Container) { // Apply to the Mandatable children
Container cont = (Container) target;
final int size = cont.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = cont.getChildAt(i);
applyMandatoryAction(child, mandatory);
}
}
} | java | private void applyMandatoryAction(final WComponent target, final boolean mandatory) {
if (target instanceof Mandatable) {
((Mandatable) target).setMandatory(mandatory);
} else if (target instanceof Container) { // Apply to the Mandatable children
Container cont = (Container) target;
final int size = cont.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = cont.getChildAt(i);
applyMandatoryAction(child, mandatory);
}
}
} | [
"private",
"void",
"applyMandatoryAction",
"(",
"final",
"WComponent",
"target",
",",
"final",
"boolean",
"mandatory",
")",
"{",
"if",
"(",
"target",
"instanceof",
"Mandatable",
")",
"{",
"(",
"(",
"Mandatable",
")",
"target",
")",
".",
"setMandatory",
"(",
... | Apply the mandatory action against the target and its children.
@param target the target of this action
@param mandatory is the evaluated value | [
"Apply",
"the",
"mandatory",
"action",
"against",
"the",
"target",
"and",
"its",
"children",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java#L46-L58 |
jankotek/mapdb | src/main/java/org/mapdb/io/DataIO.java | DataIO.packRecid | static public void packRecid(DataOutput2 out, long value) throws IOException {
value = DataIO.parity1Set(value<<1);
out.writePackedLong(value);
} | java | static public void packRecid(DataOutput2 out, long value) throws IOException {
value = DataIO.parity1Set(value<<1);
out.writePackedLong(value);
} | [
"static",
"public",
"void",
"packRecid",
"(",
"DataOutput2",
"out",
",",
"long",
"value",
")",
"throws",
"IOException",
"{",
"value",
"=",
"DataIO",
".",
"parity1Set",
"(",
"value",
"<<",
"1",
")",
";",
"out",
".",
"writePackedLong",
"(",
"value",
")",
"... | Pack RECID into output stream with 3 bit checksum.
It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
@param out String to put value into
@param value to be serialized, must be non-negative
@throws java.io.IOException in case of IO error | [
"Pack",
"RECID",
"into",
"output",
"stream",
"with",
"3",
"bit",
"checksum",
".",
"It",
"will",
"occupy",
"1",
"-",
"10",
"bytes",
"depending",
"on",
"value",
"(",
"lower",
"values",
"occupy",
"smaller",
"space",
")"
] | train | https://github.com/jankotek/mapdb/blob/dfd873b2b9cc4e299228839c100adf93a98f1903/src/main/java/org/mapdb/io/DataIO.java#L186-L189 |
alkacon/opencms-core | src-gwt/org/opencms/ade/upload/client/ui/CmsDialogUploadButtonHandler.java | CmsDialogUploadButtonHandler.openDialogWithFiles | public void openDialogWithFiles(List<CmsFileInfo> files) {
if (m_uploadDialog == null) {
try {
m_uploadDialog = GWT.create(CmsUploadDialogImpl.class);
I_CmsUploadContext context = m_contextFactory.get();
m_uploadDialog.setContext(context);
updateDialog();
if (m_button != null) {
// the current upload button is located outside the dialog, reinitialize it with a new button handler instance
m_button.reinitButton(
new CmsDialogUploadButtonHandler(m_contextFactory, m_targetFolder, m_isTargetRootPath));
}
} catch (Exception e) {
CmsErrorDialog.handleException(
new Exception(
"Deserialization of dialog data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.",
e));
return;
}
}
m_uploadDialog.addFiles(files);
if (m_button != null) {
m_button.createFileInput();
}
} | java | public void openDialogWithFiles(List<CmsFileInfo> files) {
if (m_uploadDialog == null) {
try {
m_uploadDialog = GWT.create(CmsUploadDialogImpl.class);
I_CmsUploadContext context = m_contextFactory.get();
m_uploadDialog.setContext(context);
updateDialog();
if (m_button != null) {
// the current upload button is located outside the dialog, reinitialize it with a new button handler instance
m_button.reinitButton(
new CmsDialogUploadButtonHandler(m_contextFactory, m_targetFolder, m_isTargetRootPath));
}
} catch (Exception e) {
CmsErrorDialog.handleException(
new Exception(
"Deserialization of dialog data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.",
e));
return;
}
}
m_uploadDialog.addFiles(files);
if (m_button != null) {
m_button.createFileInput();
}
} | [
"public",
"void",
"openDialogWithFiles",
"(",
"List",
"<",
"CmsFileInfo",
">",
"files",
")",
"{",
"if",
"(",
"m_uploadDialog",
"==",
"null",
")",
"{",
"try",
"{",
"m_uploadDialog",
"=",
"GWT",
".",
"create",
"(",
"CmsUploadDialogImpl",
".",
"class",
")",
"... | Opens the upload dialog for the given file references.<p>
@param files the file references | [
"Opens",
"the",
"upload",
"dialog",
"for",
"the",
"given",
"file",
"references",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/upload/client/ui/CmsDialogUploadButtonHandler.java#L144-L169 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/document/PathsDocument.java | PathsDocument.apply | @Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, PathsDocument.Parameters params) {
Map<String, Path> paths = params.paths;
if (MapUtils.isNotEmpty(paths)) {
applyPathsDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder));
buildPathsTitle(markupDocBuilder);
applyPathsDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder));
buildsPathsSection(markupDocBuilder, paths);
applyPathsDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder));
applyPathsDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder));
}
return markupDocBuilder;
} | java | @Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, PathsDocument.Parameters params) {
Map<String, Path> paths = params.paths;
if (MapUtils.isNotEmpty(paths)) {
applyPathsDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder));
buildPathsTitle(markupDocBuilder);
applyPathsDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder));
buildsPathsSection(markupDocBuilder, paths);
applyPathsDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder));
applyPathsDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder));
}
return markupDocBuilder;
} | [
"@",
"Override",
"public",
"MarkupDocBuilder",
"apply",
"(",
"MarkupDocBuilder",
"markupDocBuilder",
",",
"PathsDocument",
".",
"Parameters",
"params",
")",
"{",
"Map",
"<",
"String",
",",
"Path",
">",
"paths",
"=",
"params",
".",
"paths",
";",
"if",
"(",
"M... | Builds the paths MarkupDocument.
@return the paths MarkupDocument | [
"Builds",
"the",
"paths",
"MarkupDocument",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/PathsDocument.java#L96-L108 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeString | public static int decodeString(byte[] src, int srcOffset, String[] valueRef)
throws CorruptEncodingException
{
try {
return decodeString(src, srcOffset, valueRef, 0);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static int decodeString(byte[] src, int srcOffset, String[] valueRef)
throws CorruptEncodingException
{
try {
return decodeString(src, srcOffset, valueRef, 0);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"int",
"decodeString",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
",",
"String",
"[",
"]",
"valueRef",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"return",
"decodeString",
"(",
"src",
",",
"srcOffset",
",",
... | Decodes an encoded string from the given byte array.
@param src source of encoded data
@param srcOffset offset into encoded data
@param valueRef decoded string is stored in element 0, which may be null
@return amount of bytes read from source
@throws CorruptEncodingException if source data is corrupt | [
"Decodes",
"an",
"encoded",
"string",
"from",
"the",
"given",
"byte",
"array",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L719-L727 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_forecast_GET | public OvhProjectForecast project_serviceName_forecast_GET(String serviceName, Date toDate) throws IOException {
String qPath = "/cloud/project/{serviceName}/forecast";
StringBuilder sb = path(qPath, serviceName);
query(sb, "toDate", toDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhProjectForecast.class);
} | java | public OvhProjectForecast project_serviceName_forecast_GET(String serviceName, Date toDate) throws IOException {
String qPath = "/cloud/project/{serviceName}/forecast";
StringBuilder sb = path(qPath, serviceName);
query(sb, "toDate", toDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhProjectForecast.class);
} | [
"public",
"OvhProjectForecast",
"project_serviceName_forecast_GET",
"(",
"String",
"serviceName",
",",
"Date",
"toDate",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/forecast\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
... | Get your consumption forecast
REST: GET /cloud/project/{serviceName}/forecast
@param serviceName [required] Service name
@param toDate [required] Forecast until date | [
"Get",
"your",
"consumption",
"forecast"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1426-L1432 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java | CommonOps_DDF4.elementMult | public static void elementMult( DMatrix4 a , DMatrix4 b) {
a.a1 *= b.a1;
a.a2 *= b.a2;
a.a3 *= b.a3;
a.a4 *= b.a4;
} | java | public static void elementMult( DMatrix4 a , DMatrix4 b) {
a.a1 *= b.a1;
a.a2 *= b.a2;
a.a3 *= b.a3;
a.a4 *= b.a4;
} | [
"public",
"static",
"void",
"elementMult",
"(",
"DMatrix4",
"a",
",",
"DMatrix4",
"b",
")",
"{",
"a",
".",
"a1",
"*=",
"b",
".",
"a1",
";",
"a",
".",
"a2",
"*=",
"b",
".",
"a2",
";",
"a",
".",
"a3",
"*=",
"b",
".",
"a3",
";",
"a",
".",
"a4"... | <p>Performs an element by element multiplication operation:<br>
<br>
a<sub>i</sub> = a<sub>i</sub> * b<sub>i</sub> <br>
</p>
@param a The left vector in the multiplication operation. Modified.
@param b The right vector in the multiplication operation. Not modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"multiplication",
"operation",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"*",
"b<sub",
">",
"i<",
"/",
"sub",
">",
"<br",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L1307-L1312 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/jvmti/FrameCache.java | FrameCache.shouldCacheThrowable | public static boolean shouldCacheThrowable(Throwable throwable, int numFrames) {
// only cache frames when 'in app' packages are provided
if (appPackages.isEmpty()) {
return false;
}
// many libraries/frameworks seem to rethrow the same object with trimmed
// stacktraces, which means later ("smaller") throws would overwrite the existing
// object in cache. for this reason we prefer the throw with the greatest stack
// length...
Map<Throwable, Frame[]> weakMap = cache.get();
Frame[] existing = weakMap.get(throwable);
if (existing != null && numFrames <= existing.length) {
return false;
}
// check each frame against all "in app" package prefixes
for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
for (String appFrame : appPackages) {
if (stackTraceElement.getClassName().startsWith(appFrame)) {
return true;
}
}
}
return false;
} | java | public static boolean shouldCacheThrowable(Throwable throwable, int numFrames) {
// only cache frames when 'in app' packages are provided
if (appPackages.isEmpty()) {
return false;
}
// many libraries/frameworks seem to rethrow the same object with trimmed
// stacktraces, which means later ("smaller") throws would overwrite the existing
// object in cache. for this reason we prefer the throw with the greatest stack
// length...
Map<Throwable, Frame[]> weakMap = cache.get();
Frame[] existing = weakMap.get(throwable);
if (existing != null && numFrames <= existing.length) {
return false;
}
// check each frame against all "in app" package prefixes
for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
for (String appFrame : appPackages) {
if (stackTraceElement.getClassName().startsWith(appFrame)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"shouldCacheThrowable",
"(",
"Throwable",
"throwable",
",",
"int",
"numFrames",
")",
"{",
"// only cache frames when 'in app' packages are provided",
"if",
"(",
"appPackages",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
... | Check whether the provided {@link Throwable} should be cached or not. Called by
the native agent code so that the Java side (this code) can check the existing
cache and user configuration, such as which packages are "in app".
@param throwable Throwable to be checked
@param numFrames Number of frames in the Throwable's stacktrace
@return true if the Throwable should be processed and cached | [
"Check",
"whether",
"the",
"provided",
"{",
"@link",
"Throwable",
"}",
"should",
"be",
"cached",
"or",
"not",
".",
"Called",
"by",
"the",
"native",
"agent",
"code",
"so",
"that",
"the",
"Java",
"side",
"(",
"this",
"code",
")",
"can",
"check",
"the",
"... | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/jvmti/FrameCache.java#L58-L84 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.getHeaderFieldDate | public long getHeaderFieldDate(String name, long Default) {
String value = getHeaderField(name);
try {
return Date.parse(value);
} catch (Exception e) { }
return Default;
} | java | public long getHeaderFieldDate(String name, long Default) {
String value = getHeaderField(name);
try {
return Date.parse(value);
} catch (Exception e) { }
return Default;
} | [
"public",
"long",
"getHeaderFieldDate",
"(",
"String",
"name",
",",
"long",
"Default",
")",
"{",
"String",
"value",
"=",
"getHeaderField",
"(",
"name",
")",
";",
"try",
"{",
"return",
"Date",
".",
"parse",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"Ex... | Returns the value of the named field parsed as date.
The result is the number of milliseconds since January 1, 1970 GMT
represented by the named field.
<p>
This form of <code>getHeaderField</code> exists because some
connection types (e.g., <code>http-ng</code>) have pre-parsed
headers. Classes for that connection type can override this method
and short-circuit the parsing.
@param name the name of the header field.
@param Default a default value.
@return the value of the field, parsed as a date. The value of the
<code>Default</code> argument is returned if the field is
missing or malformed. | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"field",
"parsed",
"as",
"date",
".",
"The",
"result",
"is",
"the",
"number",
"of",
"milliseconds",
"since",
"January",
"1",
"1970",
"GMT",
"represented",
"by",
"the",
"named",
"field",
".",
"<p",
">",
"Th... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L649-L655 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.registerOutParameter | @Override
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"void",
"registerOutParameter",
"(",
"String",
"parameterName",
",",
"int",
"sqlType",
",",
"int",
"scale",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"... | Registers the parameter named parameterName to be of JDBC type sqlType. | [
"Registers",
"the",
"parameter",
"named",
"parameterName",
"to",
"be",
"of",
"JDBC",
"type",
"sqlType",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L551-L556 |
infinispan/infinispan | core/src/main/java/org/infinispan/configuration/global/TransportConfigurationBuilder.java | TransportConfigurationBuilder.initialClusterTimeout | public TransportConfigurationBuilder initialClusterTimeout(long initialClusterTimeout, TimeUnit unit) {
attributes.attribute(INITIAL_CLUSTER_TIMEOUT).set(unit.toMillis(initialClusterTimeout));
return this;
} | java | public TransportConfigurationBuilder initialClusterTimeout(long initialClusterTimeout, TimeUnit unit) {
attributes.attribute(INITIAL_CLUSTER_TIMEOUT).set(unit.toMillis(initialClusterTimeout));
return this;
} | [
"public",
"TransportConfigurationBuilder",
"initialClusterTimeout",
"(",
"long",
"initialClusterTimeout",
",",
"TimeUnit",
"unit",
")",
"{",
"attributes",
".",
"attribute",
"(",
"INITIAL_CLUSTER_TIMEOUT",
")",
".",
"set",
"(",
"unit",
".",
"toMillis",
"(",
"initialClu... | Sets the timeout for the initial cluster to form. Defaults to 1 minute | [
"Sets",
"the",
"timeout",
"for",
"the",
"initial",
"cluster",
"to",
"form",
".",
"Defaults",
"to",
"1",
"minute"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/TransportConfigurationBuilder.java#L117-L120 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java | SystemProperties.setPropertyValue | @Nonnull
public static EChange setPropertyValue (@Nonnull final String sKey, final int nValue)
{
return setPropertyValue (sKey, Integer.toString (nValue));
} | java | @Nonnull
public static EChange setPropertyValue (@Nonnull final String sKey, final int nValue)
{
return setPropertyValue (sKey, Integer.toString (nValue));
} | [
"@",
"Nonnull",
"public",
"static",
"EChange",
"setPropertyValue",
"(",
"@",
"Nonnull",
"final",
"String",
"sKey",
",",
"final",
"int",
"nValue",
")",
"{",
"return",
"setPropertyValue",
"(",
"sKey",
",",
"Integer",
".",
"toString",
"(",
"nValue",
")",
")",
... | Set a system property value under consideration of an eventually present
{@link SecurityManager}.
@param sKey
The key of the system property. May not be <code>null</code>.
@param nValue
The value of the system property.
@since 8.5.7
@return {@link EChange} | [
"Set",
"a",
"system",
"property",
"value",
"under",
"consideration",
"of",
"an",
"eventually",
"present",
"{",
"@link",
"SecurityManager",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java#L162-L166 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_PUT | public void service_PUT(String service, OvhService body) throws IOException {
String qPath = "/email/pro/{service}";
StringBuilder sb = path(qPath, service);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void service_PUT(String service, OvhService body) throws IOException {
String qPath = "/email/pro/{service}";
StringBuilder sb = path(qPath, service);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"service_PUT",
"(",
"String",
"service",
",",
"OvhService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"service",
")",
";",
"exec"... | Alter this object properties
REST: PUT /email/pro/{service}
@param body [required] New object properties
@param service [required] The internal name of your pro organization
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L222-L226 |
apigee/usergrid-java-sdk | src/main/java/org/usergrid/java/client/Client.java | Client.postUserActivity | public ApiResponse postUserActivity(String userId, Activity activity) {
return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "users",
userId, "activities");
} | java | public ApiResponse postUserActivity(String userId, Activity activity) {
return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "users",
userId, "activities");
} | [
"public",
"ApiResponse",
"postUserActivity",
"(",
"String",
"userId",
",",
"Activity",
"activity",
")",
"{",
"return",
"apiRequest",
"(",
"HttpMethod",
".",
"POST",
",",
"null",
",",
"activity",
",",
"organizationId",
",",
"applicationId",
",",
"\"users\"",
",",... | Posts an activity to a user. Activity must already be created.
@param userId
@param activity
@return | [
"Posts",
"an",
"activity",
"to",
"a",
"user",
".",
"Activity",
"must",
"already",
"be",
"created",
"."
] | train | https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L674-L677 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java | VpnSitesInner.getByResourceGroupAsync | public Observable<VpnSiteInner> getByResourceGroupAsync(String resourceGroupName, String vpnSiteName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnSiteName).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() {
@Override
public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) {
return response.body();
}
});
} | java | public Observable<VpnSiteInner> getByResourceGroupAsync(String resourceGroupName, String vpnSiteName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnSiteName).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() {
@Override
public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VpnSiteInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vpnSiteName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vpnSiteName",
")",
".",
"map",
... | Retrieves the details of a VPNsite.
@param resourceGroupName The resource group name of the VpnSite.
@param vpnSiteName The name of the VpnSite being retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VpnSiteInner object | [
"Retrieves",
"the",
"details",
"of",
"a",
"VPNsite",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L151-L158 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/BitmapUtil.java | BitmapUtil.splitVertically | public static Pair<Bitmap, Bitmap> splitVertically(@NonNull final Bitmap bitmap) {
return splitVertically(bitmap, bitmap.getWidth() / 2);
} | java | public static Pair<Bitmap, Bitmap> splitVertically(@NonNull final Bitmap bitmap) {
return splitVertically(bitmap, bitmap.getWidth() / 2);
} | [
"public",
"static",
"Pair",
"<",
"Bitmap",
",",
"Bitmap",
">",
"splitVertically",
"(",
"@",
"NonNull",
"final",
"Bitmap",
"bitmap",
")",
"{",
"return",
"splitVertically",
"(",
"bitmap",
",",
"bitmap",
".",
"getWidth",
"(",
")",
"/",
"2",
")",
";",
"}"
] | Splits a specific bitmap vertically at half.
@param bitmap
The bitmap, which should be split, as an instance of the class {@link Bitmap}. The
bitmap may not be null
@return A pair, which contains the two bitmaps, the original bitmap has been split into, as
an instance of the class Pair | [
"Splits",
"a",
"specific",
"bitmap",
"vertically",
"at",
"half",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L407-L409 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/ArrayUtil.java | ArrayUtil.indexOfIgnoreCase | public static int indexOfIgnoreCase(String[] arr, String value) {
for (int i = 0; i < arr.length; i++) {
if (arr[i].equalsIgnoreCase(value)) return i;
}
return -1;
} | java | public static int indexOfIgnoreCase(String[] arr, String value) {
for (int i = 0; i < arr.length; i++) {
if (arr[i].equalsIgnoreCase(value)) return i;
}
return -1;
} | [
"public",
"static",
"int",
"indexOfIgnoreCase",
"(",
"String",
"[",
"]",
"arr",
",",
"String",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"arr",
"[",
"i",
"]",
... | return index of given value in Array or -1
@param arr
@param value
@return index of position in array | [
"return",
"index",
"of",
"given",
"value",
"in",
"Array",
"or",
"-",
"1"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L320-L325 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MethodUtils.java | MethodUtils.invokeMethod | public static Object invokeMethod(Object object, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Class<?>[] paramTypes;
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
int arguments = args.length;
if (arguments == 0) {
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
paramTypes = new Class<?>[arguments];
for (int i = 0; i < arguments; i++) {
if (args[i] != null) {
paramTypes[i] = args[i].getClass();
}
}
}
}
return invokeMethod(object, methodName, args, paramTypes);
} | java | public static Object invokeMethod(Object object, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Class<?>[] paramTypes;
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
int arguments = args.length;
if (arguments == 0) {
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
paramTypes = new Class<?>[arguments];
for (int i = 0; i < arguments; i++) {
if (args[i] != null) {
paramTypes[i] = args[i].getClass();
}
}
}
}
return invokeMethod(object, methodName, args, paramTypes);
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Class",
"<",
"?",
">... | <p>Invoke a named method whose parameter type matches the object type.</p>
<p>The behaviour of this method is less deterministic
than {@link #invokeExactMethod(Object object,String methodName,Object[] args)}.
It loops through all methods with names that match
and then executes the first it finds with compatible parameters.</p>
<p>This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a {@code Boolean} class
would match a {@code boolean} primitive.</p>
<p> This is a convenient wrapper for
{@link #invokeMethod(Object object,String methodName,Object[] args,Class[] paramTypes)}.
</p>
@param object invoke method on this object
@param methodName get method with this name
@param args use these arguments - treat null as empty array
@return the value returned by the invoked method
@throws NoSuchMethodException if there is no such accessible method
@throws InvocationTargetException wraps an exception thrown by the method invoked
@throws IllegalAccessException if the requested method is not accessible via reflection | [
"<p",
">",
"Invoke",
"a",
"named",
"method",
"whose",
"parameter",
"type",
"matches",
"the",
"object",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L211-L233 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java | AbstractMemberExpansionTransformer.compileExpansionDirectlyToArray | protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) {
// Evaluate the root and assign it to a temp variable
IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) );
IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) );
// Create the result array and assign it to a temp variable
IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) );
IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) );
// Create the loop that populates the array
IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray);
// Build the expansion out of the array creation, for loop, and identifier
IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) );
// Short-circuit if we're not dealing with primitive types
if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) {
return buildComposite(
tempRootAssignment,
buildNullCheckTernary( identifier( tempRoot ),
checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ),
checkCast( _expr().getType(), expansion ) )
);
} else {
return buildComposite(
tempRootAssignment,
checkCast( _expr().getType(), expansion ) );
}
} | java | protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) {
// Evaluate the root and assign it to a temp variable
IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) );
IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) );
// Create the result array and assign it to a temp variable
IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) );
IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) );
// Create the loop that populates the array
IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray);
// Build the expansion out of the array creation, for loop, and identifier
IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) );
// Short-circuit if we're not dealing with primitive types
if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) {
return buildComposite(
tempRootAssignment,
buildNullCheckTernary( identifier( tempRoot ),
checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ),
checkCast( _expr().getType(), expansion ) )
);
} else {
return buildComposite(
tempRootAssignment,
checkCast( _expr().getType(), expansion ) );
}
} | [
"protected",
"IRExpression",
"compileExpansionDirectlyToArray",
"(",
"IType",
"rootType",
",",
"IType",
"rootComponentType",
",",
"IType",
"resultType",
",",
"IType",
"resultCompType",
")",
"{",
"// Evaluate the root and assign it to a temp variable",
"IRSymbol",
"tempRoot",
... | If this method is being called, it means we're expanding a one-dimensional array or collection, with a right hand side
that evaluates to a property that's not an array or collection. In that case, we build up an array and simply store
values directly into it. We also null-short-circuit in the event that the root is null. The member expansion portion
ends up as a composite that looks like:
temp_array = new Foo[temp_root.length]
for (a in temp_root index i) {
temp_array[i] = a.Bar
}
temp_array
And the overall expression looks like:
temp_root = root
( temp_root == null ? (Bar[]) null : (Bar[]) member_expansion ) | [
"If",
"this",
"method",
"is",
"being",
"called",
"it",
"means",
"we",
"re",
"expanding",
"a",
"one",
"-",
"dimensional",
"array",
"or",
"collection",
"with",
"a",
"right",
"hand",
"side",
"that",
"evaluates",
"to",
"a",
"property",
"that",
"s",
"not",
"a... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java#L135-L163 |
Impetus/Kundera | src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java | DocumentIndexer.addSuperColumnNameToDocument | private void addSuperColumnNameToDocument(String superColumnName, Document currentDoc) {
Field luceneField = new Field(SUPERCOLUMN_INDEX, superColumnName, Store.YES, Field.Index.NO);
currentDoc.add(luceneField);
} | java | private void addSuperColumnNameToDocument(String superColumnName, Document currentDoc) {
Field luceneField = new Field(SUPERCOLUMN_INDEX, superColumnName, Store.YES, Field.Index.NO);
currentDoc.add(luceneField);
} | [
"private",
"void",
"addSuperColumnNameToDocument",
"(",
"String",
"superColumnName",
",",
"Document",
"currentDoc",
")",
"{",
"Field",
"luceneField",
"=",
"new",
"Field",
"(",
"SUPERCOLUMN_INDEX",
",",
"superColumnName",
",",
"Store",
".",
"YES",
",",
"Field",
"."... | Index super column name.
@param superColumnName
the super column name
@param currentDoc
the current doc | [
"Index",
"super",
"column",
"name",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java#L232-L235 |
digitalpetri/ethernet-ip | cip-core/src/main/java/com/digitalpetri/enip/cip/structs/ForwardCloseRequest.java | ForwardCloseRequest.encodeConnectionPath | private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) {
// length placeholder...
int lengthStartIndex = buffer.writerIndex();
buffer.writeByte(0);
// reserved
buffer.writeZero(1);
// encode the path segments...
int dataStartIndex = buffer.writerIndex();
for (EPathSegment segment : path.getSegments()) {
if (segment instanceof LogicalSegment) {
LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer);
} else if (segment instanceof PortSegment) {
PortSegment.encode((PortSegment) segment, path.isPadded(), buffer);
} else if (segment instanceof DataSegment) {
DataSegment.encode((DataSegment) segment, path.isPadded(), buffer);
} else {
throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName());
}
}
// go back and update the length
int bytesWritten = buffer.writerIndex() - dataStartIndex;
int wordsWritten = bytesWritten / 2;
buffer.markWriterIndex();
buffer.writerIndex(lengthStartIndex);
buffer.writeByte(wordsWritten);
buffer.resetWriterIndex();
} | java | private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) {
// length placeholder...
int lengthStartIndex = buffer.writerIndex();
buffer.writeByte(0);
// reserved
buffer.writeZero(1);
// encode the path segments...
int dataStartIndex = buffer.writerIndex();
for (EPathSegment segment : path.getSegments()) {
if (segment instanceof LogicalSegment) {
LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer);
} else if (segment instanceof PortSegment) {
PortSegment.encode((PortSegment) segment, path.isPadded(), buffer);
} else if (segment instanceof DataSegment) {
DataSegment.encode((DataSegment) segment, path.isPadded(), buffer);
} else {
throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName());
}
}
// go back and update the length
int bytesWritten = buffer.writerIndex() - dataStartIndex;
int wordsWritten = bytesWritten / 2;
buffer.markWriterIndex();
buffer.writerIndex(lengthStartIndex);
buffer.writeByte(wordsWritten);
buffer.resetWriterIndex();
} | [
"private",
"static",
"void",
"encodeConnectionPath",
"(",
"PaddedEPath",
"path",
",",
"ByteBuf",
"buffer",
")",
"{",
"// length placeholder...",
"int",
"lengthStartIndex",
"=",
"buffer",
".",
"writerIndex",
"(",
")",
";",
"buffer",
".",
"writeByte",
"(",
"0",
")... | Encode the connection path.
<p>
{@link PaddedEPath#encode(EPath, ByteBuf)} can't be used here because the {@link ForwardCloseRequest} has an
extra reserved byte after the connection path size for some reason.
@param path the {@link PaddedEPath} to encode.
@param buffer the {@link ByteBuf} to encode into. | [
"Encode",
"the",
"connection",
"path",
".",
"<p",
">",
"{",
"@link",
"PaddedEPath#encode",
"(",
"EPath",
"ByteBuf",
")",
"}",
"can",
"t",
"be",
"used",
"here",
"because",
"the",
"{",
"@link",
"ForwardCloseRequest",
"}",
"has",
"an",
"extra",
"reserved",
"b... | train | https://github.com/digitalpetri/ethernet-ip/blob/de69faa04f658ff8a086e66012308db851b5b51a/cip-core/src/main/java/com/digitalpetri/enip/cip/structs/ForwardCloseRequest.java#L79-L109 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseHeaderValidation | private void parseHeaderValidation(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_HEADER_VALIDATION);
if (null != value) {
this.bHeaderValidation = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: header validation is " + isHeaderValidationEnabled());
}
}
} | java | private void parseHeaderValidation(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_HEADER_VALIDATION);
if (null != value) {
this.bHeaderValidation = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: header validation is " + isHeaderValidationEnabled());
}
}
} | [
"private",
"void",
"parseHeaderValidation",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"Object",
"value",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_HEADER_VALIDATION",
")",
";",
"if",
"(",
"null",
"!=",
"valu... | Parse the configuration on whether to perform header validation or not.
@param props | [
"Parse",
"the",
"configuration",
"on",
"whether",
"to",
"perform",
"header",
"validation",
"or",
"not",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1013-L1021 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java | CountedCompleter.nextComplete | public final CountedCompleter<?> nextComplete() {
CountedCompleter<?> p;
if ((p = completer) != null)
return p.firstComplete();
else {
quietlyComplete();
return null;
}
} | java | public final CountedCompleter<?> nextComplete() {
CountedCompleter<?> p;
if ((p = completer) != null)
return p.firstComplete();
else {
quietlyComplete();
return null;
}
} | [
"public",
"final",
"CountedCompleter",
"<",
"?",
">",
"nextComplete",
"(",
")",
"{",
"CountedCompleter",
"<",
"?",
">",
"p",
";",
"if",
"(",
"(",
"p",
"=",
"completer",
")",
"!=",
"null",
")",
"return",
"p",
".",
"firstComplete",
"(",
")",
";",
"else... | If this task does not have a completer, invokes {@link ForkJoinTask#quietlyComplete} and
returns {@code null}. Or, if the completer's pending count is non-zero, decrements that pending
count and returns {@code null}. Otherwise, returns the completer. This method can be used as
part of a completion traversal loop for homogeneous task hierarchies:
<pre>
{@code
for (CountedCompleter<?> c = firstComplete();
c != null;
c = c.nextComplete()) {
// ... process c ...
}}
</pre>
@return the completer, or {@code null} if none | [
"If",
"this",
"task",
"does",
"not",
"have",
"a",
"completer",
"invokes",
"{",
"@link",
"ForkJoinTask#quietlyComplete",
"}",
"and",
"returns",
"{",
"@code",
"null",
"}",
".",
"Or",
"if",
"the",
"completer",
"s",
"pending",
"count",
"is",
"non",
"-",
"zero"... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java#L639-L647 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ObjectUtils.java | ObjectUtils.identityToString | public static void identityToString(final StringBuffer buffer, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null identity");
buffer.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
} | java | public static void identityToString(final StringBuffer buffer, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null identity");
buffer.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
} | [
"public",
"static",
"void",
"identityToString",
"(",
"final",
"StringBuffer",
"buffer",
",",
"final",
"Object",
"object",
")",
"{",
"Validate",
".",
"notNull",
"(",
"object",
",",
"\"Cannot get the toString of a null identity\"",
")",
";",
"buffer",
".",
"append",
... | <p>Appends the toString that would be produced by {@code Object}
if a class did not override toString itself. {@code null}
will throw a NullPointerException for either of the two parameters. </p>
<pre>
ObjectUtils.identityToString(buf, "") = buf.append("java.lang.String@1e23"
ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa"
ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa")
</pre>
@param buffer the buffer to append to
@param object the object to create a toString for
@since 2.4 | [
"<p",
">",
"Appends",
"the",
"toString",
"that",
"would",
"be",
"produced",
"by",
"{",
"@code",
"Object",
"}",
"if",
"a",
"class",
"did",
"not",
"override",
"toString",
"itself",
".",
"{",
"@code",
"null",
"}",
"will",
"throw",
"a",
"NullPointerException",... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L404-L409 |
calimero-project/calimero-core | src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java | KNXNetworkLinkIP.sendRequestWait | @Override
public void sendRequestWait(final KNXAddress dst, final Priority p, final byte[] nsdu)
throws KNXTimeoutException, KNXLinkClosedException
{
final int mc = mode == TUNNELING ? CEMILData.MC_LDATA_REQ : CEMILData.MC_LDATA_IND;
send(mc, dst, p, nsdu, true);
} | java | @Override
public void sendRequestWait(final KNXAddress dst, final Priority p, final byte[] nsdu)
throws KNXTimeoutException, KNXLinkClosedException
{
final int mc = mode == TUNNELING ? CEMILData.MC_LDATA_REQ : CEMILData.MC_LDATA_IND;
send(mc, dst, p, nsdu, true);
} | [
"@",
"Override",
"public",
"void",
"sendRequestWait",
"(",
"final",
"KNXAddress",
"dst",
",",
"final",
"Priority",
"p",
",",
"final",
"byte",
"[",
"]",
"nsdu",
")",
"throws",
"KNXTimeoutException",
",",
"KNXLinkClosedException",
"{",
"final",
"int",
"mc",
"=",... | {@inheritDoc} When communicating with a KNX network which uses open medium, messages are broadcasted within
domain (as opposite to system broadcast) by default. Specify <code>dst null</code> for system broadcast. | [
"{"
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L267-L273 |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/ServiceEventAdapter.java | ServiceEventAdapter.serviceChanged | @Override
public void serviceChanged(ServiceEvent serviceEvent) {
final String topic = getTopic(serviceEvent);
// Bail quickly if the event is one that should be ignored
if (topic == null) {
return;
}
// Event properties
Map<String, Object> eventProperties = new HashMap<String, Object>();
// "event" --> the original event object
eventProperties.put(EventConstants.EVENT, serviceEvent);
// "service" --> result of getServiceReference
// "service.id" --> the service's ID
// "service.pid" --> the service's persistent ID if not null
// "service.objectClass" --> the services object class
ServiceReference serviceReference = serviceEvent.getServiceReference();
if (serviceReference != null) {
eventProperties.put(EventConstants.SERVICE, serviceReference);
Long serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
eventProperties.put(EventConstants.SERVICE_ID, serviceId);
Object servicePersistentId = serviceReference.getProperty(Constants.SERVICE_PID);
if (servicePersistentId != null) {
// String[] must be coerced into Collection<String>
if (servicePersistentId instanceof String[]) {
servicePersistentId = Arrays.asList((String[]) servicePersistentId);
}
eventProperties.put(EventConstants.SERVICE_PID, servicePersistentId);
}
String[] objectClass = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
if (objectClass != null) {
eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
}
}
// Construct and fire the event
Event event = new Event(topic, eventProperties);
eventAdmin.postEvent(event);
} | java | @Override
public void serviceChanged(ServiceEvent serviceEvent) {
final String topic = getTopic(serviceEvent);
// Bail quickly if the event is one that should be ignored
if (topic == null) {
return;
}
// Event properties
Map<String, Object> eventProperties = new HashMap<String, Object>();
// "event" --> the original event object
eventProperties.put(EventConstants.EVENT, serviceEvent);
// "service" --> result of getServiceReference
// "service.id" --> the service's ID
// "service.pid" --> the service's persistent ID if not null
// "service.objectClass" --> the services object class
ServiceReference serviceReference = serviceEvent.getServiceReference();
if (serviceReference != null) {
eventProperties.put(EventConstants.SERVICE, serviceReference);
Long serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
eventProperties.put(EventConstants.SERVICE_ID, serviceId);
Object servicePersistentId = serviceReference.getProperty(Constants.SERVICE_PID);
if (servicePersistentId != null) {
// String[] must be coerced into Collection<String>
if (servicePersistentId instanceof String[]) {
servicePersistentId = Arrays.asList((String[]) servicePersistentId);
}
eventProperties.put(EventConstants.SERVICE_PID, servicePersistentId);
}
String[] objectClass = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
if (objectClass != null) {
eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
}
}
// Construct and fire the event
Event event = new Event(topic, eventProperties);
eventAdmin.postEvent(event);
} | [
"@",
"Override",
"public",
"void",
"serviceChanged",
"(",
"ServiceEvent",
"serviceEvent",
")",
"{",
"final",
"String",
"topic",
"=",
"getTopic",
"(",
"serviceEvent",
")",
";",
"// Bail quickly if the event is one that should be ignored",
"if",
"(",
"topic",
"==",
"nul... | Receive notification of a service lifecycle change event and adapt it to
the format required for the <code>EventAdmin</code> service.
@param serviceEvent
the service lifecycle event to publish as an <code>Event</code> | [
"Receive",
"notification",
"of",
"a",
"service",
"lifecycle",
"change",
"event",
"and",
"adapt",
"it",
"to",
"the",
"format",
"required",
"for",
"the",
"<code",
">",
"EventAdmin<",
"/",
"code",
">",
"service",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/ServiceEventAdapter.java#L55-L99 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/VirtualColumns.java | VirtualColumns.makeDimensionSelector | public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory)
{
final VirtualColumn virtualColumn = getVirtualColumn(dimensionSpec.getDimension());
if (virtualColumn == null) {
throw new IAE("No such virtual column[%s]", dimensionSpec.getDimension());
} else {
final DimensionSelector selector = virtualColumn.makeDimensionSelector(dimensionSpec, factory);
Preconditions.checkNotNull(selector, "selector");
return selector;
}
} | java | public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory)
{
final VirtualColumn virtualColumn = getVirtualColumn(dimensionSpec.getDimension());
if (virtualColumn == null) {
throw new IAE("No such virtual column[%s]", dimensionSpec.getDimension());
} else {
final DimensionSelector selector = virtualColumn.makeDimensionSelector(dimensionSpec, factory);
Preconditions.checkNotNull(selector, "selector");
return selector;
}
} | [
"public",
"DimensionSelector",
"makeDimensionSelector",
"(",
"DimensionSpec",
"dimensionSpec",
",",
"ColumnSelectorFactory",
"factory",
")",
"{",
"final",
"VirtualColumn",
"virtualColumn",
"=",
"getVirtualColumn",
"(",
"dimensionSpec",
".",
"getDimension",
"(",
")",
")",
... | Create a dimension (string) selector.
@param dimensionSpec the dimensionSpec for this selector
@param factory base column selector factory
@return selector
@throws IllegalArgumentException if the virtual column does not exist (see {@link #exists(String)} | [
"Create",
"a",
"dimension",
"(",
"string",
")",
"selector",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java#L162-L172 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.setTime | public <T extends Model> T setTime(String attributeName, Object value) {
Converter<Object, Time> converter = modelRegistryLocal.converterForValue(
attributeName, value, Time.class);
return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toTime(value));
} | java | public <T extends Model> T setTime(String attributeName, Object value) {
Converter<Object, Time> converter = modelRegistryLocal.converterForValue(
attributeName, value, Time.class);
return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toTime(value));
} | [
"public",
"<",
"T",
"extends",
"Model",
">",
"T",
"setTime",
"(",
"String",
"attributeName",
",",
"Object",
"value",
")",
"{",
"Converter",
"<",
"Object",
",",
"Time",
">",
"converter",
"=",
"modelRegistryLocal",
".",
"converterForValue",
"(",
"attributeName",... | Sets attribute value as <code>java.sql.Time</code>.
If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class
<code>java.sql.Time</code>, given the value is an instance of <code>S</code>, then it will be used,
otherwise performs a conversion using {@link Convert#toTime(Object)}.
@param attributeName name of attribute.
@param value value
@return reference to this model. | [
"Sets",
"attribute",
"value",
"as",
"<code",
">",
"java",
".",
"sql",
".",
"Time<",
"/",
"code",
">",
".",
"If",
"there",
"is",
"a",
"{",
"@link",
"Converter",
"}",
"registered",
"for",
"the",
"attribute",
"that",
"converts",
"from",
"Class",
"<code",
... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L1801-L1805 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java | FeatureInfoBuilder.projectGeometry | public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {
if (geometryData.getGeometry() != null) {
try {
SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
int srsId = geometryData.getSrsId();
SpatialReferenceSystem srs = srsDao.queryForId((long) srsId);
if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) {
Projection geomProjection = srs.getProjection();
ProjectionTransform transform = geomProjection.getTransformation(projection);
Geometry projectedGeometry = transform.transform(geometryData.getGeometry());
geometryData.setGeometry(projectedGeometry);
SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
geometryData.setSrsId((int) projectionSrs.getSrsId());
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to project geometry to projection with Authority: "
+ projection.getAuthority() + ", Code: " + projection.getCode(), e);
}
}
} | java | public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {
if (geometryData.getGeometry() != null) {
try {
SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
int srsId = geometryData.getSrsId();
SpatialReferenceSystem srs = srsDao.queryForId((long) srsId);
if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) {
Projection geomProjection = srs.getProjection();
ProjectionTransform transform = geomProjection.getTransformation(projection);
Geometry projectedGeometry = transform.transform(geometryData.getGeometry());
geometryData.setGeometry(projectedGeometry);
SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
geometryData.setSrsId((int) projectionSrs.getSrsId());
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to project geometry to projection with Authority: "
+ projection.getAuthority() + ", Code: " + projection.getCode(), e);
}
}
} | [
"public",
"void",
"projectGeometry",
"(",
"GeoPackageGeometryData",
"geometryData",
",",
"Projection",
"projection",
")",
"{",
"if",
"(",
"geometryData",
".",
"getGeometry",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"SpatialReferenceSystemDao",
"srsDao",
"=",
... | Project the geometry into the provided projection
@param geometryData geometry data
@param projection projection | [
"Project",
"the",
"geometry",
"into",
"the",
"provided",
"projection"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L528-L553 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getContinentInfo | public void getContinentInfo(int[] ids, Callback<List<Continent>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getContinentInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getContinentInfo(int[] ids, Callback<List<Continent>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getContinentInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getContinentInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Continent",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"i... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of continents id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Continent continents info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"use... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1032-L1035 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_house.java | Scs_house.cs_house | public static float cs_house(float[] x, int x_offset, float[] beta, int n) {
float s, sigma = 0;
int i;
if (x == null || beta == null)
return (-1); /* check inputs */
for (i = 1; i < n; i++)
sigma += x[x_offset + i] * x[x_offset + i];
if (sigma == 0) {
s = Math.abs(x[x_offset + 0]); /* s = |x(0)| */
beta[0] = (x[x_offset + 0] <= 0) ? 2.0f : 0.0f;
x[x_offset + 0] = 1;
} else {
s = (float)Math.sqrt(x[x_offset + 0] * x[x_offset + 0] + sigma); /* s = norm (x) */
x[x_offset + 0] = (x[x_offset + 0] <= 0) ? (x[x_offset + 0] - s) : (-sigma / (x[x_offset + 0] + s));
beta[0] = -1.0f / (s * x[x_offset + 0]);
}
return (s);
} | java | public static float cs_house(float[] x, int x_offset, float[] beta, int n) {
float s, sigma = 0;
int i;
if (x == null || beta == null)
return (-1); /* check inputs */
for (i = 1; i < n; i++)
sigma += x[x_offset + i] * x[x_offset + i];
if (sigma == 0) {
s = Math.abs(x[x_offset + 0]); /* s = |x(0)| */
beta[0] = (x[x_offset + 0] <= 0) ? 2.0f : 0.0f;
x[x_offset + 0] = 1;
} else {
s = (float)Math.sqrt(x[x_offset + 0] * x[x_offset + 0] + sigma); /* s = norm (x) */
x[x_offset + 0] = (x[x_offset + 0] <= 0) ? (x[x_offset + 0] - s) : (-sigma / (x[x_offset + 0] + s));
beta[0] = -1.0f / (s * x[x_offset + 0]);
}
return (s);
} | [
"public",
"static",
"float",
"cs_house",
"(",
"float",
"[",
"]",
"x",
",",
"int",
"x_offset",
",",
"float",
"[",
"]",
"beta",
",",
"int",
"n",
")",
"{",
"float",
"s",
",",
"sigma",
"=",
"0",
";",
"int",
"i",
";",
"if",
"(",
"x",
"==",
"null",
... | Compute a Householder reflection, overwrite x with v, where
(I-beta*v*v')*x = s*e1. See Algo 5.1f.1f, Golub & Van Loan, 3rd ed.
@param x
x on output, v on input
@param x_offset
the index of the first element in array x
@param beta
scalar beta
@param n
the length of x
@return norm2(x), -1 on error | [
"Compute",
"a",
"Householder",
"reflection",
"overwrite",
"x",
"with",
"v",
"where",
"(",
"I",
"-",
"beta",
"*",
"v",
"*",
"v",
")",
"*",
"x",
"=",
"s",
"*",
"e1",
".",
"See",
"Algo",
"5",
".",
"1f",
".",
"1f",
"Golub",
"&",
"Van",
"Loan",
"3rd... | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_house.java#L49-L66 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.