repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.beginCreateOrUpdate | public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
"""
Creates or updatess a job execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The job execution id to create the job execution under.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobExecutionInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body();
} | java | public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body();
} | [
"public",
"JobExecutionInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
",",
"UUID",
"jobExecutionId",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"jobAgentName",
",",
"jobName",
",",
"jobExecutionId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updatess a job execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The job execution id to create the job execution under.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobExecutionInner object if successful. | [
"Creates",
"or",
"updatess",
"a",
"job",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L1216-L1218 |
apereo/cas | core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/bypass/CredentialMultifactorAuthenticationProviderBypass.java | CredentialMultifactorAuthenticationProviderBypass.locateMatchingCredentialType | protected static boolean locateMatchingCredentialType(final Authentication authentication, final String credentialClassType) {
"""
Locate matching credential type boolean.
@param authentication the authentication
@param credentialClassType the credential class type
@return the boolean
"""
return StringUtils.isNotBlank(credentialClassType) && authentication.getCredentials()
.stream()
.anyMatch(e -> e.getCredentialClass().getName().matches(credentialClassType));
} | java | protected static boolean locateMatchingCredentialType(final Authentication authentication, final String credentialClassType) {
return StringUtils.isNotBlank(credentialClassType) && authentication.getCredentials()
.stream()
.anyMatch(e -> e.getCredentialClass().getName().matches(credentialClassType));
} | [
"protected",
"static",
"boolean",
"locateMatchingCredentialType",
"(",
"final",
"Authentication",
"authentication",
",",
"final",
"String",
"credentialClassType",
")",
"{",
"return",
"StringUtils",
".",
"isNotBlank",
"(",
"credentialClassType",
")",
"&&",
"authentication",
".",
"getCredentials",
"(",
")",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"e",
"->",
"e",
".",
"getCredentialClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"matches",
"(",
"credentialClassType",
")",
")",
";",
"}"
] | Locate matching credential type boolean.
@param authentication the authentication
@param credentialClassType the credential class type
@return the boolean | [
"Locate",
"matching",
"credential",
"type",
"boolean",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/bypass/CredentialMultifactorAuthenticationProviderBypass.java#L53-L57 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java | SARLJvmModelInferrer.appendCloneFunctionIfCloneable | protected void appendCloneFunctionIfCloneable(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) {
"""
Append the clone function only if the type is a subtype of {@link Cloneable}.
<p>The clone function replies a value of the current type, not {@code Object}.
@param context the current generation context.
@param source the source object.
@param target the inferred JVM object.
@since 0.6
@see #appendCloneFunction(GenerationContext, XtendTypeDeclaration, JvmGenericType)
"""
if (!target.isInterface() && this.inheritanceHelper.isSubTypeOf(target, Cloneable.class, null)) {
appendCloneFunction(context, source, target);
}
} | java | protected void appendCloneFunctionIfCloneable(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) {
if (!target.isInterface() && this.inheritanceHelper.isSubTypeOf(target, Cloneable.class, null)) {
appendCloneFunction(context, source, target);
}
} | [
"protected",
"void",
"appendCloneFunctionIfCloneable",
"(",
"GenerationContext",
"context",
",",
"XtendTypeDeclaration",
"source",
",",
"JvmGenericType",
"target",
")",
"{",
"if",
"(",
"!",
"target",
".",
"isInterface",
"(",
")",
"&&",
"this",
".",
"inheritanceHelper",
".",
"isSubTypeOf",
"(",
"target",
",",
"Cloneable",
".",
"class",
",",
"null",
")",
")",
"{",
"appendCloneFunction",
"(",
"context",
",",
"source",
",",
"target",
")",
";",
"}",
"}"
] | Append the clone function only if the type is a subtype of {@link Cloneable}.
<p>The clone function replies a value of the current type, not {@code Object}.
@param context the current generation context.
@param source the source object.
@param target the inferred JVM object.
@since 0.6
@see #appendCloneFunction(GenerationContext, XtendTypeDeclaration, JvmGenericType) | [
"Append",
"the",
"clone",
"function",
"only",
"if",
"the",
"type",
"is",
"a",
"subtype",
"of",
"{",
"@link",
"Cloneable",
"}",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L2877-L2881 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java | AccountOperations.listNodeAgentSkus | public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
"""
Lists the node agent SKU values supported by the Batch service.
@param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service.
@return A list of {@link NodeAgentSku} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
"""
return listNodeAgentSkus(detailLevel, null);
} | java | public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listNodeAgentSkus(detailLevel, null);
} | [
"public",
"PagedList",
"<",
"NodeAgentSku",
">",
"listNodeAgentSkus",
"(",
"DetailLevel",
"detailLevel",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listNodeAgentSkus",
"(",
"detailLevel",
",",
"null",
")",
";",
"}"
] | Lists the node agent SKU values supported by the Batch service.
@param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service.
@return A list of {@link NodeAgentSku} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"the",
"node",
"agent",
"SKU",
"values",
"supported",
"by",
"the",
"Batch",
"service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java#L73-L75 |
apache/incubator-shardingsphere | sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/PropertyUtil.java | PropertyUtil.handle | @SuppressWarnings("unchecked")
public static <T> T handle(final Environment environment, final String prefix, final Class<T> targetClass) {
"""
Spring Boot 1.x is compatible with Spring Boot 2.x by Using Java Reflect.
@param environment : the environment context
@param prefix : the prefix part of property key
@param targetClass : the target class type of result
@param <T> : refer to @param targetClass
@return T
"""
switch (springBootVersion) {
case 1:
return (T) v1(environment, prefix);
default:
return (T) v2(environment, prefix, targetClass);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T handle(final Environment environment, final String prefix, final Class<T> targetClass) {
switch (springBootVersion) {
case 1:
return (T) v1(environment, prefix);
default:
return (T) v2(environment, prefix, targetClass);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"handle",
"(",
"final",
"Environment",
"environment",
",",
"final",
"String",
"prefix",
",",
"final",
"Class",
"<",
"T",
">",
"targetClass",
")",
"{",
"switch",
"(",
"springBootVersion",
")",
"{",
"case",
"1",
":",
"return",
"(",
"T",
")",
"v1",
"(",
"environment",
",",
"prefix",
")",
";",
"default",
":",
"return",
"(",
"T",
")",
"v2",
"(",
"environment",
",",
"prefix",
",",
"targetClass",
")",
";",
"}",
"}"
] | Spring Boot 1.x is compatible with Spring Boot 2.x by Using Java Reflect.
@param environment : the environment context
@param prefix : the prefix part of property key
@param targetClass : the target class type of result
@param <T> : refer to @param targetClass
@return T | [
"Spring",
"Boot",
"1",
".",
"x",
"is",
"compatible",
"with",
"Spring",
"Boot",
"2",
".",
"x",
"by",
"Using",
"Java",
"Reflect",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/PropertyUtil.java#L55-L63 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/UnitVectorProperty3dfx.java | UnitVectorProperty3dfx.set | public void set(double x, double y, double z) {
"""
Change the coordinates of the vector.
@param x x coordinate of the vector.
@param y y coordinate of the vector.
@param z z coordinate of the vector.
"""
assert Vector3D.isUnitVector(x, y, z) : AssertMessages.normalizedParameters(0, 1, 2);
if ((x != getX() || y != getY() || z != getZ()) && !isBound()) {
final Vector3dfx v = super.get();
v.set(x, y, z);
fireValueChangedEvent();
}
} | java | public void set(double x, double y, double z) {
assert Vector3D.isUnitVector(x, y, z) : AssertMessages.normalizedParameters(0, 1, 2);
if ((x != getX() || y != getY() || z != getZ()) && !isBound()) {
final Vector3dfx v = super.get();
v.set(x, y, z);
fireValueChangedEvent();
}
} | [
"public",
"void",
"set",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"assert",
"Vector3D",
".",
"isUnitVector",
"(",
"x",
",",
"y",
",",
"z",
")",
":",
"AssertMessages",
".",
"normalizedParameters",
"(",
"0",
",",
"1",
",",
"2",
")",
";",
"if",
"(",
"(",
"x",
"!=",
"getX",
"(",
")",
"||",
"y",
"!=",
"getY",
"(",
")",
"||",
"z",
"!=",
"getZ",
"(",
")",
")",
"&&",
"!",
"isBound",
"(",
")",
")",
"{",
"final",
"Vector3dfx",
"v",
"=",
"super",
".",
"get",
"(",
")",
";",
"v",
".",
"set",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"fireValueChangedEvent",
"(",
")",
";",
"}",
"}"
] | Change the coordinates of the vector.
@param x x coordinate of the vector.
@param y y coordinate of the vector.
@param z z coordinate of the vector. | [
"Change",
"the",
"coordinates",
"of",
"the",
"vector",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/UnitVectorProperty3dfx.java#L137-L144 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.performMaintenanceAsync | public Observable<OperationStatusResponseInner> performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) {
"""
Perform maintenance on one or more virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) {
return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"performMaintenanceAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"performMaintenanceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
",",
"OperationStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Perform maintenance on one or more virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Perform",
"maintenance",
"on",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L3218-L3225 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/service/DockerAccessFactory.java | DockerAccessFactory.getDefaultDockerHostProviders | private List<DockerConnectionDetector.DockerHostProvider> getDefaultDockerHostProviders(DockerAccessContext dockerAccessContext, Logger log) {
"""
Return a list of providers which could delive connection parameters from
calling external commands. For this plugin this is docker-machine, but can be overridden
to add other config options, too.
@return list of providers or <code>null</code> if none are applicable
"""
DockerMachineConfiguration config = dockerAccessContext.getMachine();
if (dockerAccessContext.isSkipMachine()) {
config = null;
} else if (config == null) {
Properties projectProps = dockerAccessContext.getProjectProperties();
if (projectProps.containsKey(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP)) {
config = new DockerMachineConfiguration(
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_AUTO_CREATE_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP));
}
}
List<DockerConnectionDetector.DockerHostProvider> ret = new ArrayList<>();
ret.add(new DockerMachine(log, config));
return ret;
} | java | private List<DockerConnectionDetector.DockerHostProvider> getDefaultDockerHostProviders(DockerAccessContext dockerAccessContext, Logger log) {
DockerMachineConfiguration config = dockerAccessContext.getMachine();
if (dockerAccessContext.isSkipMachine()) {
config = null;
} else if (config == null) {
Properties projectProps = dockerAccessContext.getProjectProperties();
if (projectProps.containsKey(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP)) {
config = new DockerMachineConfiguration(
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_AUTO_CREATE_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP));
}
}
List<DockerConnectionDetector.DockerHostProvider> ret = new ArrayList<>();
ret.add(new DockerMachine(log, config));
return ret;
} | [
"private",
"List",
"<",
"DockerConnectionDetector",
".",
"DockerHostProvider",
">",
"getDefaultDockerHostProviders",
"(",
"DockerAccessContext",
"dockerAccessContext",
",",
"Logger",
"log",
")",
"{",
"DockerMachineConfiguration",
"config",
"=",
"dockerAccessContext",
".",
"getMachine",
"(",
")",
";",
"if",
"(",
"dockerAccessContext",
".",
"isSkipMachine",
"(",
")",
")",
"{",
"config",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"Properties",
"projectProps",
"=",
"dockerAccessContext",
".",
"getProjectProperties",
"(",
")",
";",
"if",
"(",
"projectProps",
".",
"containsKey",
"(",
"DockerMachineConfiguration",
".",
"DOCKER_MACHINE_NAME_PROP",
")",
")",
"{",
"config",
"=",
"new",
"DockerMachineConfiguration",
"(",
"projectProps",
".",
"getProperty",
"(",
"DockerMachineConfiguration",
".",
"DOCKER_MACHINE_NAME_PROP",
")",
",",
"projectProps",
".",
"getProperty",
"(",
"DockerMachineConfiguration",
".",
"DOCKER_MACHINE_AUTO_CREATE_PROP",
")",
",",
"projectProps",
".",
"getProperty",
"(",
"DockerMachineConfiguration",
".",
"DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP",
")",
")",
";",
"}",
"}",
"List",
"<",
"DockerConnectionDetector",
".",
"DockerHostProvider",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ret",
".",
"add",
"(",
"new",
"DockerMachine",
"(",
"log",
",",
"config",
")",
")",
";",
"return",
"ret",
";",
"}"
] | Return a list of providers which could delive connection parameters from
calling external commands. For this plugin this is docker-machine, but can be overridden
to add other config options, too.
@return list of providers or <code>null</code> if none are applicable | [
"Return",
"a",
"list",
"of",
"providers",
"which",
"could",
"delive",
"connection",
"parameters",
"from",
"calling",
"external",
"commands",
".",
"For",
"this",
"plugin",
"this",
"is",
"docker",
"-",
"machine",
"but",
"can",
"be",
"overridden",
"to",
"add",
"other",
"config",
"options",
"too",
"."
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/DockerAccessFactory.java#L67-L85 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readProject | public CmsProject readProject(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException {
"""
Reads a project given the projects id.<p>
@param dbc the current database context
@param id the id of the project
@return the project read
@throws CmsDataAccessException if something goes wrong
"""
CmsProject project = null;
project = m_monitor.getCachedProject(id.toString());
if (project == null) {
project = getProjectDriver(dbc).readProject(dbc, id);
m_monitor.cacheProject(project);
}
return project;
} | java | public CmsProject readProject(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException {
CmsProject project = null;
project = m_monitor.getCachedProject(id.toString());
if (project == null) {
project = getProjectDriver(dbc).readProject(dbc, id);
m_monitor.cacheProject(project);
}
return project;
} | [
"public",
"CmsProject",
"readProject",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"id",
")",
"throws",
"CmsDataAccessException",
"{",
"CmsProject",
"project",
"=",
"null",
";",
"project",
"=",
"m_monitor",
".",
"getCachedProject",
"(",
"id",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"project",
"==",
"null",
")",
"{",
"project",
"=",
"getProjectDriver",
"(",
"dbc",
")",
".",
"readProject",
"(",
"dbc",
",",
"id",
")",
";",
"m_monitor",
".",
"cacheProject",
"(",
"project",
")",
";",
"}",
"return",
"project",
";",
"}"
] | Reads a project given the projects id.<p>
@param dbc the current database context
@param id the id of the project
@return the project read
@throws CmsDataAccessException if something goes wrong | [
"Reads",
"a",
"project",
"given",
"the",
"projects",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7255-L7264 |
iipc/webarchive-commons | src/main/java/org/archive/io/RecordingOutputStream.java | RecordingOutputStream.setLimits | public void setLimits(long length, long milliseconds, long rateKBps) {
"""
Set limits on length, time, and rate to enforce.
@param length
@param milliseconds
@param rateKBps
"""
maxLength = (length>0) ? length : Long.MAX_VALUE;
timeoutMs = (milliseconds>0) ? milliseconds : Long.MAX_VALUE;
maxRateBytesPerMs = (rateKBps>0) ? rateKBps*1024/1000 : Long.MAX_VALUE;
} | java | public void setLimits(long length, long milliseconds, long rateKBps) {
maxLength = (length>0) ? length : Long.MAX_VALUE;
timeoutMs = (milliseconds>0) ? milliseconds : Long.MAX_VALUE;
maxRateBytesPerMs = (rateKBps>0) ? rateKBps*1024/1000 : Long.MAX_VALUE;
} | [
"public",
"void",
"setLimits",
"(",
"long",
"length",
",",
"long",
"milliseconds",
",",
"long",
"rateKBps",
")",
"{",
"maxLength",
"=",
"(",
"length",
">",
"0",
")",
"?",
"length",
":",
"Long",
".",
"MAX_VALUE",
";",
"timeoutMs",
"=",
"(",
"milliseconds",
">",
"0",
")",
"?",
"milliseconds",
":",
"Long",
".",
"MAX_VALUE",
";",
"maxRateBytesPerMs",
"=",
"(",
"rateKBps",
">",
"0",
")",
"?",
"rateKBps",
"*",
"1024",
"/",
"1000",
":",
"Long",
".",
"MAX_VALUE",
";",
"}"
] | Set limits on length, time, and rate to enforce.
@param length
@param milliseconds
@param rateKBps | [
"Set",
"limits",
"on",
"length",
"time",
"and",
"rate",
"to",
"enforce",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/RecordingOutputStream.java#L605-L609 |
app55/app55-java | src/support/java/com/googlecode/openbeans/Beans.java | Beans.instantiate | public static Object instantiate(ClassLoader loader, String name) throws IOException, ClassNotFoundException {
"""
Obtains an instance of a JavaBean specified the bean name using the specified class loader.
<p>
If the specified class loader is null, the system class loader is used.
</p>
@param loader
the specified class loader. It can be null.
@param name
the name of the JavaBean
@return an isntance of the bean.
@throws IOException
@throws ClassNotFoundException
"""
return internalInstantiate(loader, name, null, null);
} | java | public static Object instantiate(ClassLoader loader, String name) throws IOException, ClassNotFoundException
{
return internalInstantiate(loader, name, null, null);
} | [
"public",
"static",
"Object",
"instantiate",
"(",
"ClassLoader",
"loader",
",",
"String",
"name",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"internalInstantiate",
"(",
"loader",
",",
"name",
",",
"null",
",",
"null",
")",
";",
"}"
] | Obtains an instance of a JavaBean specified the bean name using the specified class loader.
<p>
If the specified class loader is null, the system class loader is used.
</p>
@param loader
the specified class loader. It can be null.
@param name
the name of the JavaBean
@return an isntance of the bean.
@throws IOException
@throws ClassNotFoundException | [
"Obtains",
"an",
"instance",
"of",
"a",
"JavaBean",
"specified",
"the",
"bean",
"name",
"using",
"the",
"specified",
"class",
"loader",
".",
"<p",
">",
"If",
"the",
"specified",
"class",
"loader",
"is",
"null",
"the",
"system",
"class",
"loader",
"is",
"used",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/Beans.java#L144-L147 |
pawelprazak/java-extended | hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/LongCloseTo.java | LongCloseTo.closeTo | public static Matcher<Long> closeTo(Long operand, Long error) {
"""
Creates a matcher of {@link Long}s that matches when an examined Long is equal
to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality
is done by BigDecimals {@link Long#compareTo(Long)} method.
For example:
<pre>assertThat(103L, is(closeTo(100, 0.03)))</pre>
@param operand the expected value of matching Long
@param error the delta (+/-) within which matches will be allowed
@return the matcher
"""
return new LongCloseTo(operand, error);
} | java | public static Matcher<Long> closeTo(Long operand, Long error) {
return new LongCloseTo(operand, error);
} | [
"public",
"static",
"Matcher",
"<",
"Long",
">",
"closeTo",
"(",
"Long",
"operand",
",",
"Long",
"error",
")",
"{",
"return",
"new",
"LongCloseTo",
"(",
"operand",
",",
"error",
")",
";",
"}"
] | Creates a matcher of {@link Long}s that matches when an examined Long is equal
to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality
is done by BigDecimals {@link Long#compareTo(Long)} method.
For example:
<pre>assertThat(103L, is(closeTo(100, 0.03)))</pre>
@param operand the expected value of matching Long
@param error the delta (+/-) within which matches will be allowed
@return the matcher | [
"Creates",
"a",
"matcher",
"of",
"{",
"@link",
"Long",
"}",
"s",
"that",
"matches",
"when",
"an",
"examined",
"Long",
"is",
"equal",
"to",
"the",
"specified",
"<code",
">",
"operand<",
"/",
"code",
">",
"within",
"a",
"range",
"of",
"+",
"/",
"-",
"<code",
">",
"error<",
"/",
"code",
">",
".",
"The",
"comparison",
"for",
"equality",
"is",
"done",
"by",
"BigDecimals",
"{",
"@link",
"Long#compareTo",
"(",
"Long",
")",
"}",
"method",
"."
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/LongCloseTo.java#L33-L35 |
jamesagnew/hapi-fhir | hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java | RestfulClientFactory.newClient | @Override
public synchronized <T extends IRestfulClient> T newClient(Class<T> theClientType, String theServerBase) {
"""
Instantiates a new client instance
@param theClientType
The client type, which is an interface type to be instantiated
@param theServerBase
The URL of the base for the restful FHIR server to connect to
@return A newly created client
@throws ConfigurationException
If the interface type is not an interface
"""
validateConfigured();
if (!theClientType.isInterface()) {
throw new ConfigurationException(theClientType.getCanonicalName() + " is not an interface");
}
ClientInvocationHandlerFactory invocationHandler = myInvocationHandlers.get(theClientType);
if (invocationHandler == null) {
IHttpClient httpClient = getHttpClient(theServerBase);
invocationHandler = new ClientInvocationHandlerFactory(httpClient, myContext, theServerBase, theClientType);
for (Method nextMethod : theClientType.getMethods()) {
BaseMethodBinding<?> binding = BaseMethodBinding.bindMethod(nextMethod, myContext, null);
invocationHandler.addBinding(nextMethod, binding);
}
myInvocationHandlers.put(theClientType, invocationHandler);
}
return instantiateProxy(theClientType, invocationHandler.newInvocationHandler(this));
} | java | @Override
public synchronized <T extends IRestfulClient> T newClient(Class<T> theClientType, String theServerBase) {
validateConfigured();
if (!theClientType.isInterface()) {
throw new ConfigurationException(theClientType.getCanonicalName() + " is not an interface");
}
ClientInvocationHandlerFactory invocationHandler = myInvocationHandlers.get(theClientType);
if (invocationHandler == null) {
IHttpClient httpClient = getHttpClient(theServerBase);
invocationHandler = new ClientInvocationHandlerFactory(httpClient, myContext, theServerBase, theClientType);
for (Method nextMethod : theClientType.getMethods()) {
BaseMethodBinding<?> binding = BaseMethodBinding.bindMethod(nextMethod, myContext, null);
invocationHandler.addBinding(nextMethod, binding);
}
myInvocationHandlers.put(theClientType, invocationHandler);
}
return instantiateProxy(theClientType, invocationHandler.newInvocationHandler(this));
} | [
"@",
"Override",
"public",
"synchronized",
"<",
"T",
"extends",
"IRestfulClient",
">",
"T",
"newClient",
"(",
"Class",
"<",
"T",
">",
"theClientType",
",",
"String",
"theServerBase",
")",
"{",
"validateConfigured",
"(",
")",
";",
"if",
"(",
"!",
"theClientType",
".",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
"ConfigurationException",
"(",
"theClientType",
".",
"getCanonicalName",
"(",
")",
"+",
"\" is not an interface\"",
")",
";",
"}",
"ClientInvocationHandlerFactory",
"invocationHandler",
"=",
"myInvocationHandlers",
".",
"get",
"(",
"theClientType",
")",
";",
"if",
"(",
"invocationHandler",
"==",
"null",
")",
"{",
"IHttpClient",
"httpClient",
"=",
"getHttpClient",
"(",
"theServerBase",
")",
";",
"invocationHandler",
"=",
"new",
"ClientInvocationHandlerFactory",
"(",
"httpClient",
",",
"myContext",
",",
"theServerBase",
",",
"theClientType",
")",
";",
"for",
"(",
"Method",
"nextMethod",
":",
"theClientType",
".",
"getMethods",
"(",
")",
")",
"{",
"BaseMethodBinding",
"<",
"?",
">",
"binding",
"=",
"BaseMethodBinding",
".",
"bindMethod",
"(",
"nextMethod",
",",
"myContext",
",",
"null",
")",
";",
"invocationHandler",
".",
"addBinding",
"(",
"nextMethod",
",",
"binding",
")",
";",
"}",
"myInvocationHandlers",
".",
"put",
"(",
"theClientType",
",",
"invocationHandler",
")",
";",
"}",
"return",
"instantiateProxy",
"(",
"theClientType",
",",
"invocationHandler",
".",
"newInvocationHandler",
"(",
"this",
")",
")",
";",
"}"
] | Instantiates a new client instance
@param theClientType
The client type, which is an interface type to be instantiated
@param theServerBase
The URL of the base for the restful FHIR server to connect to
@return A newly created client
@throws ConfigurationException
If the interface type is not an interface | [
"Instantiates",
"a",
"new",
"client",
"instance"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java#L139-L159 |
JavaMoney/jsr354-api | src/main/java/javax/money/convert/MonetaryConversions.java | MonetaryConversions.getConversion | public static CurrencyConversion getConversion(CurrencyUnit termCurrency, String... providers) {
"""
Access an instance of {@link CurrencyConversion} for the given providers.
Use {@link #getConversionProviderNames()} to check, which are available.
@param termCurrency the terminating or target currency, not {@code null}
@param providers Additional providers, for building a provider chain
@return the exchange rate type if this instance.
@throws IllegalArgumentException if no such {@link ExchangeRateProvider} is available.
"""
Objects.requireNonNull(providers);
Objects.requireNonNull(termCurrency);
if(providers.length == 0){
return getMonetaryConversionsSpi().getConversion(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(getDefaultConversionProviderChain())
.build());
}
return getMonetaryConversionsSpi().getConversion(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build());
} | java | public static CurrencyConversion getConversion(CurrencyUnit termCurrency, String... providers){
Objects.requireNonNull(providers);
Objects.requireNonNull(termCurrency);
if(providers.length == 0){
return getMonetaryConversionsSpi().getConversion(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(getDefaultConversionProviderChain())
.build());
}
return getMonetaryConversionsSpi().getConversion(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build());
} | [
"public",
"static",
"CurrencyConversion",
"getConversion",
"(",
"CurrencyUnit",
"termCurrency",
",",
"String",
"...",
"providers",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"providers",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"termCurrency",
")",
";",
"if",
"(",
"providers",
".",
"length",
"==",
"0",
")",
"{",
"return",
"getMonetaryConversionsSpi",
"(",
")",
".",
"getConversion",
"(",
"ConversionQueryBuilder",
".",
"of",
"(",
")",
".",
"setTermCurrency",
"(",
"termCurrency",
")",
".",
"setProviderNames",
"(",
"getDefaultConversionProviderChain",
"(",
")",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"return",
"getMonetaryConversionsSpi",
"(",
")",
".",
"getConversion",
"(",
"ConversionQueryBuilder",
".",
"of",
"(",
")",
".",
"setTermCurrency",
"(",
"termCurrency",
")",
".",
"setProviderNames",
"(",
"providers",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | Access an instance of {@link CurrencyConversion} for the given providers.
Use {@link #getConversionProviderNames()} to check, which are available.
@param termCurrency the terminating or target currency, not {@code null}
@param providers Additional providers, for building a provider chain
@return the exchange rate type if this instance.
@throws IllegalArgumentException if no such {@link ExchangeRateProvider} is available. | [
"Access",
"an",
"instance",
"of",
"{",
"@link",
"CurrencyConversion",
"}",
"for",
"the",
"given",
"providers",
".",
"Use",
"{",
"@link",
"#getConversionProviderNames",
"()",
"}",
"to",
"check",
"which",
"are",
"available",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/MonetaryConversions.java#L87-L97 |
wcm-io-caravan/caravan-commons | performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java | PerformanceMetrics.createNext | public PerformanceMetrics createNext(String nextAction, String nextDescriptor) {
"""
Creates new instance of performance metrics. Stores the key and correlation id of the parent metrics instance.
Assigns next level.
@param nextAction a short name of measured operation, typically a first prefix of descriptor
@param nextDescriptor a full description of measured operation
@return PerformanceMetrics a new instance of performance metrics with stored key and correlationId from the parent
metrics and assigned next level
"""
return createNext(nextAction, nextDescriptor, null);
} | java | public PerformanceMetrics createNext(String nextAction, String nextDescriptor) {
return createNext(nextAction, nextDescriptor, null);
} | [
"public",
"PerformanceMetrics",
"createNext",
"(",
"String",
"nextAction",
",",
"String",
"nextDescriptor",
")",
"{",
"return",
"createNext",
"(",
"nextAction",
",",
"nextDescriptor",
",",
"null",
")",
";",
"}"
] | Creates new instance of performance metrics. Stores the key and correlation id of the parent metrics instance.
Assigns next level.
@param nextAction a short name of measured operation, typically a first prefix of descriptor
@param nextDescriptor a full description of measured operation
@return PerformanceMetrics a new instance of performance metrics with stored key and correlationId from the parent
metrics and assigned next level | [
"Creates",
"new",
"instance",
"of",
"performance",
"metrics",
".",
"Stores",
"the",
"key",
"and",
"correlation",
"id",
"of",
"the",
"parent",
"metrics",
"instance",
".",
"Assigns",
"next",
"level",
"."
] | train | https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java#L83-L85 |
trustathsh/ironcommon | src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java | Properties.getString | public String getString(String propertyPath, String defaultValue) {
"""
Get the String-value from the property path. If the property path does
not exist, the default value is returned.
@param propertyPath
Example: foo.bar.key
@param defaultValue
is returned when the propertyPath does not exist
@return the value for the given propertyPath
"""
Object o = getValue(propertyPath, defaultValue);
if (o != null) {
return o.toString();
} else {
// if the defaultValue is null
return (String) o;
}
} | java | public String getString(String propertyPath, String defaultValue) {
Object o = getValue(propertyPath, defaultValue);
if (o != null) {
return o.toString();
} else {
// if the defaultValue is null
return (String) o;
}
} | [
"public",
"String",
"getString",
"(",
"String",
"propertyPath",
",",
"String",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getValue",
"(",
"propertyPath",
",",
"defaultValue",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"return",
"o",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"// if the defaultValue is null",
"return",
"(",
"String",
")",
"o",
";",
"}",
"}"
] | Get the String-value from the property path. If the property path does
not exist, the default value is returned.
@param propertyPath
Example: foo.bar.key
@param defaultValue
is returned when the propertyPath does not exist
@return the value for the given propertyPath | [
"Get",
"the",
"String",
"-",
"value",
"from",
"the",
"property",
"path",
".",
"If",
"the",
"property",
"path",
"does",
"not",
"exist",
"the",
"default",
"value",
"is",
"returned",
"."
] | train | https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java#L244-L252 |
undera/jmeter-plugins | plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java | CaseFormat.caseFormatWithDelimiter | private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) {
"""
Change case using delimiter between words
@param str
@param delimiter
@param isAllUpper
@param isAllLower
@return string after change case
"""
StringBuilder builder = new StringBuilder(str.length());
String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str);
boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter);
for (int i = 0; i < tokens.length; i++) {
String currentToken = tokens[i];
builder.append(currentToken);
boolean hasNextToken = i + 1 != tokens.length;
if (hasNextToken && shouldAddDelimiter) {
builder.append(delimiter);
}
}
String outputString = builder.toString();
if (isAllLower) {
return StringUtils.lowerCase(outputString);
} else if (isAllUpper) {
return StringUtils.upperCase(outputString);
}
return outputString;
} | java | private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) {
StringBuilder builder = new StringBuilder(str.length());
String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str);
boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter);
for (int i = 0; i < tokens.length; i++) {
String currentToken = tokens[i];
builder.append(currentToken);
boolean hasNextToken = i + 1 != tokens.length;
if (hasNextToken && shouldAddDelimiter) {
builder.append(delimiter);
}
}
String outputString = builder.toString();
if (isAllLower) {
return StringUtils.lowerCase(outputString);
} else if (isAllUpper) {
return StringUtils.upperCase(outputString);
}
return outputString;
} | [
"private",
"static",
"String",
"caseFormatWithDelimiter",
"(",
"String",
"str",
",",
"String",
"delimiter",
",",
"boolean",
"isAllUpper",
",",
"boolean",
"isAllLower",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"str",
".",
"length",
"(",
")",
")",
";",
"String",
"[",
"]",
"tokens",
"=",
"NOT_ALPHANUMERIC_REGEX",
".",
"split",
"(",
"str",
")",
";",
"boolean",
"shouldAddDelimiter",
"=",
"StringUtils",
".",
"isNotEmpty",
"(",
"delimiter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokens",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"currentToken",
"=",
"tokens",
"[",
"i",
"]",
";",
"builder",
".",
"append",
"(",
"currentToken",
")",
";",
"boolean",
"hasNextToken",
"=",
"i",
"+",
"1",
"!=",
"tokens",
".",
"length",
";",
"if",
"(",
"hasNextToken",
"&&",
"shouldAddDelimiter",
")",
"{",
"builder",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"}",
"String",
"outputString",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"if",
"(",
"isAllLower",
")",
"{",
"return",
"StringUtils",
".",
"lowerCase",
"(",
"outputString",
")",
";",
"}",
"else",
"if",
"(",
"isAllUpper",
")",
"{",
"return",
"StringUtils",
".",
"upperCase",
"(",
"outputString",
")",
";",
"}",
"return",
"outputString",
";",
"}"
] | Change case using delimiter between words
@param str
@param delimiter
@param isAllUpper
@param isAllLower
@return string after change case | [
"Change",
"case",
"using",
"delimiter",
"between",
"words"
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java#L178-L197 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java | WWindowInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
"""
Temporarily replaces the environment while the UI is being rendered.
@param renderContext the context to render to.
"""
if (windowId == null) {
super.paint(renderContext);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.paint(renderContext);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | java | @Override
public void paint(final RenderContext renderContext) {
if (windowId == null) {
super.paint(renderContext);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.paint(renderContext);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"if",
"(",
"windowId",
"==",
"null",
")",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"else",
"{",
"// Get the window component",
"ComponentWithContext",
"target",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"windowId",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No window component for id \"",
"+",
"windowId",
")",
";",
"}",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"Environment",
"originalEnvironment",
"=",
"uic",
".",
"getEnvironment",
"(",
")",
";",
"uic",
".",
"setEnvironment",
"(",
"new",
"EnvironmentDelegate",
"(",
"originalEnvironment",
",",
"windowId",
",",
"target",
")",
")",
";",
"UIContextHolder",
".",
"pushContext",
"(",
"target",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"finally",
"{",
"uic",
".",
"setEnvironment",
"(",
"originalEnvironment",
")",
";",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}"
] | Temporarily replaces the environment while the UI is being rendered.
@param renderContext the context to render to. | [
"Temporarily",
"replaces",
"the",
"environment",
"while",
"the",
"UI",
"is",
"being",
"rendered",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java#L120-L143 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/spawn/StandardSpawnService.java | StandardSpawnService.fireAgentSpawnedInAgent | protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
"""
Notify the agent's listeners about its spawning.
@param spawningAgent the spawning agent.
@param context the context in which the agent was spawned.
@param agent the spawned agent.
@param initializationParameters the initialization parameters.
"""
// Notify the listeners on the lifecycle events inside
// the just spawned agent.
// Usually, only BICs and the AgentLifeCycleSupport in
// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
// is invoked.
final ListenerCollection<SpawnServiceListener> list;
synchronized (this.agentLifecycleListeners) {
list = this.agentLifecycleListeners.get(agent.getID());
}
if (list != null) {
final List<Agent> singleton = Collections.singletonList(agent);
for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
l.agentSpawned(spawningAgent, context, singleton, initializationParameters);
}
}
} | java | protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
// Notify the listeners on the lifecycle events inside
// the just spawned agent.
// Usually, only BICs and the AgentLifeCycleSupport in
// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
// is invoked.
final ListenerCollection<SpawnServiceListener> list;
synchronized (this.agentLifecycleListeners) {
list = this.agentLifecycleListeners.get(agent.getID());
}
if (list != null) {
final List<Agent> singleton = Collections.singletonList(agent);
for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
l.agentSpawned(spawningAgent, context, singleton, initializationParameters);
}
}
} | [
"protected",
"void",
"fireAgentSpawnedInAgent",
"(",
"UUID",
"spawningAgent",
",",
"AgentContext",
"context",
",",
"Agent",
"agent",
",",
"Object",
"...",
"initializationParameters",
")",
"{",
"// Notify the listeners on the lifecycle events inside",
"// the just spawned agent.",
"// Usually, only BICs and the AgentLifeCycleSupport in",
"// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider",
"// is invoked.",
"final",
"ListenerCollection",
"<",
"SpawnServiceListener",
">",
"list",
";",
"synchronized",
"(",
"this",
".",
"agentLifecycleListeners",
")",
"{",
"list",
"=",
"this",
".",
"agentLifecycleListeners",
".",
"get",
"(",
"agent",
".",
"getID",
"(",
")",
")",
";",
"}",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"Agent",
">",
"singleton",
"=",
"Collections",
".",
"singletonList",
"(",
"agent",
")",
";",
"for",
"(",
"final",
"SpawnServiceListener",
"l",
":",
"list",
".",
"getListeners",
"(",
"SpawnServiceListener",
".",
"class",
")",
")",
"{",
"l",
".",
"agentSpawned",
"(",
"spawningAgent",
",",
"context",
",",
"singleton",
",",
"initializationParameters",
")",
";",
"}",
"}",
"}"
] | Notify the agent's listeners about its spawning.
@param spawningAgent the spawning agent.
@param context the context in which the agent was spawned.
@param agent the spawned agent.
@param initializationParameters the initialization parameters. | [
"Notify",
"the",
"agent",
"s",
"listeners",
"about",
"its",
"spawning",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/spawn/StandardSpawnService.java#L248-L264 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java | PostConditionException.validateGreaterThan | public static void validateGreaterThan( long value, long limit, String identifier )
throws PostConditionException {
"""
Validates that the value is greater than a limit.
This method ensures that <code>value > limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must exceed.
@param value The value to be tested.
@throws PostConditionException if the condition is not met.
"""
if( value > limit )
{
return;
}
throw new PostConditionException( identifier + " was not greater than " + limit + ". Was: " + value );
} | java | public static void validateGreaterThan( long value, long limit, String identifier )
throws PostConditionException
{
if( value > limit )
{
return;
}
throw new PostConditionException( identifier + " was not greater than " + limit + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateGreaterThan",
"(",
"long",
"value",
",",
"long",
"limit",
",",
"String",
"identifier",
")",
"throws",
"PostConditionException",
"{",
"if",
"(",
"value",
">",
"limit",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"PostConditionException",
"(",
"identifier",
"+",
"\" was not greater than \"",
"+",
"limit",
"+",
"\". Was: \"",
"+",
"value",
")",
";",
"}"
] | Validates that the value is greater than a limit.
This method ensures that <code>value > limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must exceed.
@param value The value to be tested.
@throws PostConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"is",
"greater",
"than",
"a",
"limit",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L86-L94 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/NamespaceResources.java | NamespaceResources.updateNamespace | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/ {
"""
Updates a namespace.
@param req The HTTP request.
@param namespaceId The ID of the namespace to update.
@param newNamespace The updated namespace data.
@return The updated namespace.
@throws WebApplicationException If an error occurs.
"""namespaceId}")
@Description("Update the namespace.")
public NamespaceDto updateNamespace(@Context HttpServletRequest req,
@PathParam("namespaceId") final BigInteger namespaceId, NamespaceDto newNamespace) {
PrincipalUser remoteUser = getRemoteUser(req);
if (namespaceId == null || namespaceId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Namespace Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (newNamespace == null) {
throw new WebApplicationException("Cannot update null namespace.", Status.BAD_REQUEST);
}
Namespace oldNamespace = _namespaceService.findNamespaceByPrimaryKey(namespaceId);
if (oldNamespace == null) {
throw new WebApplicationException("The namespace with id " + namespaceId + " does not exist", Response.Status.NOT_FOUND);
}
if (!oldNamespace.getQualifier().equals(newNamespace.getQualifier())) {
throw new WebApplicationException("The qualifier can not be updated.", Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, oldNamespace.getCreatedBy(), remoteUser);
Set<PrincipalUser> users = _getPrincipalUserByUserName(newNamespace.getUsernames());
if (!users.contains(oldNamespace.getOwner())) {
users.add(oldNamespace.getOwner());
}
oldNamespace.setUsers(users);
return NamespaceDto.transformToDto(_namespaceService.updateNamespace(oldNamespace));
} | java | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{namespaceId}")
@Description("Update the namespace.")
public NamespaceDto updateNamespace(@Context HttpServletRequest req,
@PathParam("namespaceId") final BigInteger namespaceId, NamespaceDto newNamespace) {
PrincipalUser remoteUser = getRemoteUser(req);
if (namespaceId == null || namespaceId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Namespace Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (newNamespace == null) {
throw new WebApplicationException("Cannot update null namespace.", Status.BAD_REQUEST);
}
Namespace oldNamespace = _namespaceService.findNamespaceByPrimaryKey(namespaceId);
if (oldNamespace == null) {
throw new WebApplicationException("The namespace with id " + namespaceId + " does not exist", Response.Status.NOT_FOUND);
}
if (!oldNamespace.getQualifier().equals(newNamespace.getQualifier())) {
throw new WebApplicationException("The qualifier can not be updated.", Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, oldNamespace.getCreatedBy(), remoteUser);
Set<PrincipalUser> users = _getPrincipalUserByUserName(newNamespace.getUsernames());
if (!users.contains(oldNamespace.getOwner())) {
users.add(oldNamespace.getOwner());
}
oldNamespace.setUsers(users);
return NamespaceDto.transformToDto(_namespaceService.updateNamespace(oldNamespace));
} | [
"@",
"PUT",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{namespaceId}\"",
")",
"@",
"Description",
"(",
"\"Update the namespace.\"",
")",
"public",
"NamespaceDto",
"updateNamespace",
"(",
"@",
"Context",
"HttpServletRequest",
"req",
",",
"@",
"PathParam",
"(",
"\"namespaceId\"",
")",
"final",
"BigInteger",
"namespaceId",
",",
"NamespaceDto",
"newNamespace",
")",
"{",
"PrincipalUser",
"remoteUser",
"=",
"getRemoteUser",
"(",
"req",
")",
";",
"if",
"(",
"namespaceId",
"==",
"null",
"||",
"namespaceId",
".",
"compareTo",
"(",
"BigInteger",
".",
"ZERO",
")",
"<",
"1",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Namespace Id cannot be null and must be a positive non-zero number.\"",
",",
"Status",
".",
"BAD_REQUEST",
")",
";",
"}",
"if",
"(",
"newNamespace",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Cannot update null namespace.\"",
",",
"Status",
".",
"BAD_REQUEST",
")",
";",
"}",
"Namespace",
"oldNamespace",
"=",
"_namespaceService",
".",
"findNamespaceByPrimaryKey",
"(",
"namespaceId",
")",
";",
"if",
"(",
"oldNamespace",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"The namespace with id \"",
"+",
"namespaceId",
"+",
"\" does not exist\"",
",",
"Response",
".",
"Status",
".",
"NOT_FOUND",
")",
";",
"}",
"if",
"(",
"!",
"oldNamespace",
".",
"getQualifier",
"(",
")",
".",
"equals",
"(",
"newNamespace",
".",
"getQualifier",
"(",
")",
")",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"The qualifier can not be updated.\"",
",",
"Response",
".",
"Status",
".",
"NOT_FOUND",
")",
";",
"}",
"validateResourceAuthorization",
"(",
"req",
",",
"oldNamespace",
".",
"getCreatedBy",
"(",
")",
",",
"remoteUser",
")",
";",
"Set",
"<",
"PrincipalUser",
">",
"users",
"=",
"_getPrincipalUserByUserName",
"(",
"newNamespace",
".",
"getUsernames",
"(",
")",
")",
";",
"if",
"(",
"!",
"users",
".",
"contains",
"(",
"oldNamespace",
".",
"getOwner",
"(",
")",
")",
")",
"{",
"users",
".",
"add",
"(",
"oldNamespace",
".",
"getOwner",
"(",
")",
")",
";",
"}",
"oldNamespace",
".",
"setUsers",
"(",
"users",
")",
";",
"return",
"NamespaceDto",
".",
"transformToDto",
"(",
"_namespaceService",
".",
"updateNamespace",
"(",
"oldNamespace",
")",
")",
";",
"}"
] | Updates a namespace.
@param req The HTTP request.
@param namespaceId The ID of the namespace to update.
@param newNamespace The updated namespace data.
@return The updated namespace.
@throws WebApplicationException If an error occurs. | [
"Updates",
"a",
"namespace",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/NamespaceResources.java#L167-L200 |
czyzby/gdx-lml | lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java | ColorPickerContainer.initiateInstance | public static void initiateInstance(final String title, final String styleName) {
"""
Creates an instance of {@link ColorPicker} which will be accessible through {@link #getInstance()} and
{@link #requestInstance()} methods.
@param title will become window's title.
@param styleName determines the style of {@link ColorPicker}.
"""
INSTANCE = new ColorPicker(styleName, title, null);
} | java | public static void initiateInstance(final String title, final String styleName) {
INSTANCE = new ColorPicker(styleName, title, null);
} | [
"public",
"static",
"void",
"initiateInstance",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"styleName",
")",
"{",
"INSTANCE",
"=",
"new",
"ColorPicker",
"(",
"styleName",
",",
"title",
",",
"null",
")",
";",
"}"
] | Creates an instance of {@link ColorPicker} which will be accessible through {@link #getInstance()} and
{@link #requestInstance()} methods.
@param title will become window's title.
@param styleName determines the style of {@link ColorPicker}. | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"ColorPicker",
"}",
"which",
"will",
"be",
"accessible",
"through",
"{",
"@link",
"#getInstance",
"()",
"}",
"and",
"{",
"@link",
"#requestInstance",
"()",
"}",
"methods",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java#L63-L65 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummoners | public Future<Map<String, Summoner>> getSummoners(String... names) {
"""
Get summoner information for the summoners with the specified names
@param names The names of the players
@return A map, mapping standardized player names to summoner information
@see <a href=https://developer.riotgames.com/api/methods#!/620/1930>Official API documentation</a>
@see net.boreeas.riotapi.Util#standardizeSummonerName(java.lang.String)
"""
return new ApiFuture<>(() -> handler.getSummoners(names));
} | java | public Future<Map<String, Summoner>> getSummoners(String... names) {
return new ApiFuture<>(() -> handler.getSummoners(names));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"Summoner",
">",
">",
"getSummoners",
"(",
"String",
"...",
"names",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getSummoners",
"(",
"names",
")",
")",
";",
"}"
] | Get summoner information for the summoners with the specified names
@param names The names of the players
@return A map, mapping standardized player names to summoner information
@see <a href=https://developer.riotgames.com/api/methods#!/620/1930>Official API documentation</a>
@see net.boreeas.riotapi.Util#standardizeSummonerName(java.lang.String) | [
"Get",
"summoner",
"information",
"for",
"the",
"summoners",
"with",
"the",
"specified",
"names"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1091-L1093 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_record_POST | public OvhRecord zone_zoneName_record_POST(String zoneName, OvhNamedResolutionFieldTypeEnum fieldType, String subDomain, String target, Long ttl) throws IOException {
"""
Create a new DNS record (Don't forget to refresh the zone)
REST: POST /domain/zone/{zoneName}/record
@param target [required] Resource record target
@param fieldType [required] Resource record Name
@param subDomain [required] Resource record subdomain
@param ttl [required] Resource record ttl
@param zoneName [required] The internal name of your zone
"""
String qPath = "/domain/zone/{zoneName}/record";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "fieldType", fieldType);
addBody(o, "subDomain", subDomain);
addBody(o, "target", target);
addBody(o, "ttl", ttl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRecord.class);
} | java | public OvhRecord zone_zoneName_record_POST(String zoneName, OvhNamedResolutionFieldTypeEnum fieldType, String subDomain, String target, Long ttl) throws IOException {
String qPath = "/domain/zone/{zoneName}/record";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "fieldType", fieldType);
addBody(o, "subDomain", subDomain);
addBody(o, "target", target);
addBody(o, "ttl", ttl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRecord.class);
} | [
"public",
"OvhRecord",
"zone_zoneName_record_POST",
"(",
"String",
"zoneName",
",",
"OvhNamedResolutionFieldTypeEnum",
"fieldType",
",",
"String",
"subDomain",
",",
"String",
"target",
",",
"Long",
"ttl",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/record\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"zoneName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"fieldType\"",
",",
"fieldType",
")",
";",
"addBody",
"(",
"o",
",",
"\"subDomain\"",
",",
"subDomain",
")",
";",
"addBody",
"(",
"o",
",",
"\"target\"",
",",
"target",
")",
";",
"addBody",
"(",
"o",
",",
"\"ttl\"",
",",
"ttl",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhRecord",
".",
"class",
")",
";",
"}"
] | Create a new DNS record (Don't forget to refresh the zone)
REST: POST /domain/zone/{zoneName}/record
@param target [required] Resource record target
@param fieldType [required] Resource record Name
@param subDomain [required] Resource record subdomain
@param ttl [required] Resource record ttl
@param zoneName [required] The internal name of your zone | [
"Create",
"a",
"new",
"DNS",
"record",
"(",
"Don",
"t",
"forget",
"to",
"refresh",
"the",
"zone",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L949-L959 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java | BaseTransport.addParam | public void addParam(String strParam, Object obj) {
"""
Add this method param to the param list.
@param strParam The param name.
@param strValue The param value.
"""
String strValue = this.objectToString(obj);
this.addParam(strParam, strValue);
} | java | public void addParam(String strParam, Object obj)
{
String strValue = this.objectToString(obj);
this.addParam(strParam, strValue);
} | [
"public",
"void",
"addParam",
"(",
"String",
"strParam",
",",
"Object",
"obj",
")",
"{",
"String",
"strValue",
"=",
"this",
".",
"objectToString",
"(",
"obj",
")",
";",
"this",
".",
"addParam",
"(",
"strParam",
",",
"strValue",
")",
";",
"}"
] | Add this method param to the param list.
@param strParam The param name.
@param strValue The param value. | [
"Add",
"this",
"method",
"param",
"to",
"the",
"param",
"list",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java#L110-L114 |
JodaOrg/joda-time | src/main/java/org/joda/time/Partial.java | Partial.without | public Partial without(DateTimeFieldType fieldType) {
"""
Gets a copy of this date with the specified field removed.
<p>
If this partial did not previously support the field, no error occurs.
@param fieldType the field type to remove, may be null
@return a copy of this instance with the field removed
"""
int index = indexOf(fieldType);
if (index != -1) {
DateTimeFieldType[] newTypes = new DateTimeFieldType[size() - 1];
int[] newValues = new int[size() - 1];
System.arraycopy(iTypes, 0, newTypes, 0, index);
System.arraycopy(iTypes, index + 1, newTypes, index, newTypes.length - index);
System.arraycopy(iValues, 0, newValues, 0, index);
System.arraycopy(iValues, index + 1, newValues, index, newValues.length - index);
Partial newPartial = new Partial(iChronology, newTypes, newValues);
iChronology.validate(newPartial, newValues);
return newPartial;
}
return this;
} | java | public Partial without(DateTimeFieldType fieldType) {
int index = indexOf(fieldType);
if (index != -1) {
DateTimeFieldType[] newTypes = new DateTimeFieldType[size() - 1];
int[] newValues = new int[size() - 1];
System.arraycopy(iTypes, 0, newTypes, 0, index);
System.arraycopy(iTypes, index + 1, newTypes, index, newTypes.length - index);
System.arraycopy(iValues, 0, newValues, 0, index);
System.arraycopy(iValues, index + 1, newValues, index, newValues.length - index);
Partial newPartial = new Partial(iChronology, newTypes, newValues);
iChronology.validate(newPartial, newValues);
return newPartial;
}
return this;
} | [
"public",
"Partial",
"without",
"(",
"DateTimeFieldType",
"fieldType",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"fieldType",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"DateTimeFieldType",
"[",
"]",
"newTypes",
"=",
"new",
"DateTimeFieldType",
"[",
"size",
"(",
")",
"-",
"1",
"]",
";",
"int",
"[",
"]",
"newValues",
"=",
"new",
"int",
"[",
"size",
"(",
")",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"iTypes",
",",
"0",
",",
"newTypes",
",",
"0",
",",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"iTypes",
",",
"index",
"+",
"1",
",",
"newTypes",
",",
"index",
",",
"newTypes",
".",
"length",
"-",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"iValues",
",",
"0",
",",
"newValues",
",",
"0",
",",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"iValues",
",",
"index",
"+",
"1",
",",
"newValues",
",",
"index",
",",
"newValues",
".",
"length",
"-",
"index",
")",
";",
"Partial",
"newPartial",
"=",
"new",
"Partial",
"(",
"iChronology",
",",
"newTypes",
",",
"newValues",
")",
";",
"iChronology",
".",
"validate",
"(",
"newPartial",
",",
"newValues",
")",
";",
"return",
"newPartial",
";",
"}",
"return",
"this",
";",
"}"
] | Gets a copy of this date with the specified field removed.
<p>
If this partial did not previously support the field, no error occurs.
@param fieldType the field type to remove, may be null
@return a copy of this instance with the field removed | [
"Gets",
"a",
"copy",
"of",
"this",
"date",
"with",
"the",
"specified",
"field",
"removed",
".",
"<p",
">",
"If",
"this",
"partial",
"did",
"not",
"previously",
"support",
"the",
"field",
"no",
"error",
"occurs",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Partial.java#L515-L529 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.mapToInt | public static <T, E extends Exception> IntList mapToInt(final T[] a, final int fromIndex, final int toIndex, final Try.ToIntFunction<? super T, E> func)
throws E {
"""
Mostly it's designed for one-step operation to complete the operation in one step.
<code>java.util.stream.Stream</code> is preferred for multiple phases operation.
@param a
@param fromIndex
@param toIndex
@param func
@return
"""
checkFromToIndex(fromIndex, toIndex, len(a));
N.checkArgNotNull(func);
if (N.isNullOrEmpty(a)) {
return new IntList();
}
final IntList result = new IntList(toIndex - fromIndex);
for (int i = fromIndex; i < toIndex; i++) {
result.add(func.applyAsInt(a[i]));
}
return result;
} | java | public static <T, E extends Exception> IntList mapToInt(final T[] a, final int fromIndex, final int toIndex, final Try.ToIntFunction<? super T, E> func)
throws E {
checkFromToIndex(fromIndex, toIndex, len(a));
N.checkArgNotNull(func);
if (N.isNullOrEmpty(a)) {
return new IntList();
}
final IntList result = new IntList(toIndex - fromIndex);
for (int i = fromIndex; i < toIndex; i++) {
result.add(func.applyAsInt(a[i]));
}
return result;
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Exception",
">",
"IntList",
"mapToInt",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
",",
"final",
"Try",
".",
"ToIntFunction",
"<",
"?",
"super",
"T",
",",
"E",
">",
"func",
")",
"throws",
"E",
"{",
"checkFromToIndex",
"(",
"fromIndex",
",",
"toIndex",
",",
"len",
"(",
"a",
")",
")",
";",
"N",
".",
"checkArgNotNull",
"(",
"func",
")",
";",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
"new",
"IntList",
"(",
")",
";",
"}",
"final",
"IntList",
"result",
"=",
"new",
"IntList",
"(",
"toIndex",
"-",
"fromIndex",
")",
";",
"for",
"(",
"int",
"i",
"=",
"fromIndex",
";",
"i",
"<",
"toIndex",
";",
"i",
"++",
")",
"{",
"result",
".",
"add",
"(",
"func",
".",
"applyAsInt",
"(",
"a",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Mostly it's designed for one-step operation to complete the operation in one step.
<code>java.util.stream.Stream</code> is preferred for multiple phases operation.
@param a
@param fromIndex
@param toIndex
@param func
@return | [
"Mostly",
"it",
"s",
"designed",
"for",
"one",
"-",
"step",
"operation",
"to",
"complete",
"the",
"operation",
"in",
"one",
"step",
".",
"<code",
">",
"java",
".",
"util",
".",
"stream",
".",
"Stream<",
"/",
"code",
">",
"is",
"preferred",
"for",
"multiple",
"phases",
"operation",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L14883-L14899 |
manupsunny/PinLock | pinlock/src/main/java/com/manusunny/pinlock/components/StatusDots.java | StatusDots.addDots | private void addDots(int length) {
"""
Adding Dot objects to layout
@param length Length of PIN entered so far
"""
removeAllViews();
final int pinLength = styledAttributes.getInt(R.styleable.PinLock_pinLength, 4);
for (int i = 0; i < pinLength; i++) {
Dot dot = new Dot(context, styledAttributes, i < length);
addView(dot);
}
} | java | private void addDots(int length) {
removeAllViews();
final int pinLength = styledAttributes.getInt(R.styleable.PinLock_pinLength, 4);
for (int i = 0; i < pinLength; i++) {
Dot dot = new Dot(context, styledAttributes, i < length);
addView(dot);
}
} | [
"private",
"void",
"addDots",
"(",
"int",
"length",
")",
"{",
"removeAllViews",
"(",
")",
";",
"final",
"int",
"pinLength",
"=",
"styledAttributes",
".",
"getInt",
"(",
"R",
".",
"styleable",
".",
"PinLock_pinLength",
",",
"4",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pinLength",
";",
"i",
"++",
")",
"{",
"Dot",
"dot",
"=",
"new",
"Dot",
"(",
"context",
",",
"styledAttributes",
",",
"i",
"<",
"length",
")",
";",
"addView",
"(",
"dot",
")",
";",
"}",
"}"
] | Adding Dot objects to layout
@param length Length of PIN entered so far | [
"Adding",
"Dot",
"objects",
"to",
"layout"
] | train | https://github.com/manupsunny/PinLock/blob/bbb5d53cc57d4e163be01a95157d335231b55dc0/pinlock/src/main/java/com/manusunny/pinlock/components/StatusDots.java#L59-L66 |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java | ExistingChannelModelControllerClient.createReceiving | public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
"""
Create a model controller client which is exclusively receiving messages on an existing channel.
@param channel the channel
@param executorService an executor
@return the created client
"""
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} | java | public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} | [
"public",
"static",
"ModelControllerClient",
"createReceiving",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ExecutorService",
"executorService",
")",
"{",
"final",
"ManagementClientChannelStrategy",
"strategy",
"=",
"ManagementClientChannelStrategy",
".",
"create",
"(",
"channel",
")",
";",
"final",
"ManagementChannelHandler",
"handler",
"=",
"new",
"ManagementChannelHandler",
"(",
"strategy",
",",
"executorService",
")",
";",
"final",
"ExistingChannelModelControllerClient",
"client",
"=",
"new",
"ExistingChannelModelControllerClient",
"(",
"handler",
")",
";",
"handler",
".",
"addHandlerFactory",
"(",
"client",
")",
";",
"channel",
".",
"addCloseHandler",
"(",
"new",
"CloseHandler",
"<",
"Channel",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handleClose",
"(",
"Channel",
"closed",
",",
"IOException",
"exception",
")",
"{",
"handler",
".",
"shutdown",
"(",
")",
";",
"try",
"{",
"handler",
".",
"awaitCompletion",
"(",
"1",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"finally",
"{",
"handler",
".",
"shutdownNow",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"channel",
".",
"receiveMessage",
"(",
"handler",
".",
"getReceiver",
"(",
")",
")",
";",
"return",
"client",
";",
"}"
] | Create a model controller client which is exclusively receiving messages on an existing channel.
@param channel the channel
@param executorService an executor
@return the created client | [
"Create",
"a",
"model",
"controller",
"client",
"which",
"is",
"exclusively",
"receiving",
"messages",
"on",
"an",
"existing",
"channel",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java#L76-L96 |
jglobus/JGlobus | gram/src/main/java/org/globus/rsl/NameOpValue.java | NameOpValue.toRSL | public void toRSL(StringBuffer buf, boolean explicitConcat) {
"""
Produces a RSL representation of this relation.
@param buf buffer to add the RSL representation to.
@param explicitConcat if true explicit concatination will
be used in RSL strings.
"""
buf.append("( ");
buf.append( getAttribute() );
buf.append(" ");
buf.append(getOperatorAsString(operator));
buf.append(" ");
toRSLSub(getValues(), buf, explicitConcat);
buf.append(" )");
} | java | public void toRSL(StringBuffer buf, boolean explicitConcat) {
buf.append("( ");
buf.append( getAttribute() );
buf.append(" ");
buf.append(getOperatorAsString(operator));
buf.append(" ");
toRSLSub(getValues(), buf, explicitConcat);
buf.append(" )");
} | [
"public",
"void",
"toRSL",
"(",
"StringBuffer",
"buf",
",",
"boolean",
"explicitConcat",
")",
"{",
"buf",
".",
"append",
"(",
"\"( \"",
")",
";",
"buf",
".",
"append",
"(",
"getAttribute",
"(",
")",
")",
";",
"buf",
".",
"append",
"(",
"\" \"",
")",
";",
"buf",
".",
"append",
"(",
"getOperatorAsString",
"(",
"operator",
")",
")",
";",
"buf",
".",
"append",
"(",
"\" \"",
")",
";",
"toRSLSub",
"(",
"getValues",
"(",
")",
",",
"buf",
",",
"explicitConcat",
")",
";",
"buf",
".",
"append",
"(",
"\" )\"",
")",
";",
"}"
] | Produces a RSL representation of this relation.
@param buf buffer to add the RSL representation to.
@param explicitConcat if true explicit concatination will
be used in RSL strings. | [
"Produces",
"a",
"RSL",
"representation",
"of",
"this",
"relation",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gram/src/main/java/org/globus/rsl/NameOpValue.java#L186-L194 |
xmlunit/xmlunit | xmlunit-placeholders/src/main/java/org/xmlunit/placeholder/PlaceholderSupport.java | PlaceholderSupport.withPlaceholderSupportChainedAfter | public static <D extends DifferenceEngineConfigurer<D>>
D withPlaceholderSupportChainedAfter(D configurer, DifferenceEvaluator evaluator) {
"""
Adds placeholder support to a {@link DifferenceEngineConfigurer} considering an additional {@link DifferenceEvaluator}.
@param configurer the configurer to add support to
@param evaluator the additional evaluator - placeholder support is
{@link DifferenceEvaluators#chain chain}ed after the given
evaluator
"""
return withPlaceholderSupportUsingDelimitersChainedAfter(configurer, null, null, evaluator);
} | java | public static <D extends DifferenceEngineConfigurer<D>>
D withPlaceholderSupportChainedAfter(D configurer, DifferenceEvaluator evaluator) {
return withPlaceholderSupportUsingDelimitersChainedAfter(configurer, null, null, evaluator);
} | [
"public",
"static",
"<",
"D",
"extends",
"DifferenceEngineConfigurer",
"<",
"D",
">",
">",
"D",
"withPlaceholderSupportChainedAfter",
"(",
"D",
"configurer",
",",
"DifferenceEvaluator",
"evaluator",
")",
"{",
"return",
"withPlaceholderSupportUsingDelimitersChainedAfter",
"(",
"configurer",
",",
"null",
",",
"null",
",",
"evaluator",
")",
";",
"}"
] | Adds placeholder support to a {@link DifferenceEngineConfigurer} considering an additional {@link DifferenceEvaluator}.
@param configurer the configurer to add support to
@param evaluator the additional evaluator - placeholder support is
{@link DifferenceEvaluators#chain chain}ed after the given
evaluator | [
"Adds",
"placeholder",
"support",
"to",
"a",
"{",
"@link",
"DifferenceEngineConfigurer",
"}",
"considering",
"an",
"additional",
"{",
"@link",
"DifferenceEvaluator",
"}",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-placeholders/src/main/java/org/xmlunit/placeholder/PlaceholderSupport.java#L72-L75 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java | DialogRootView.createListViewScrollListener | @NonNull
private AbsListView.OnScrollListener createListViewScrollListener() {
"""
Creates and returns a listener, which allows to observe the list view, which is contained by
the dialog, is scrolled.
@return The listener, which has been created, as an instance of the type {@link
android.widget.AbsListView.OnScrollListener}. The listener may not be null
"""
return new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(final AbsListView view, final int scrollState) {
}
@Override
public void onScroll(final AbsListView view, final int firstVisibleItem,
final int visibleItemCount, final int totalItemCount) {
adaptDividerVisibilities(isListViewScrolledToTop(view),
isListViewScrolledToBottom(view), true);
}
};
} | java | @NonNull
private AbsListView.OnScrollListener createListViewScrollListener() {
return new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(final AbsListView view, final int scrollState) {
}
@Override
public void onScroll(final AbsListView view, final int firstVisibleItem,
final int visibleItemCount, final int totalItemCount) {
adaptDividerVisibilities(isListViewScrolledToTop(view),
isListViewScrolledToBottom(view), true);
}
};
} | [
"@",
"NonNull",
"private",
"AbsListView",
".",
"OnScrollListener",
"createListViewScrollListener",
"(",
")",
"{",
"return",
"new",
"AbsListView",
".",
"OnScrollListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onScrollStateChanged",
"(",
"final",
"AbsListView",
"view",
",",
"final",
"int",
"scrollState",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onScroll",
"(",
"final",
"AbsListView",
"view",
",",
"final",
"int",
"firstVisibleItem",
",",
"final",
"int",
"visibleItemCount",
",",
"final",
"int",
"totalItemCount",
")",
"{",
"adaptDividerVisibilities",
"(",
"isListViewScrolledToTop",
"(",
"view",
")",
",",
"isListViewScrolledToBottom",
"(",
"view",
")",
",",
"true",
")",
";",
"}",
"}",
";",
"}"
] | Creates and returns a listener, which allows to observe the list view, which is contained by
the dialog, is scrolled.
@return The listener, which has been created, as an instance of the type {@link
android.widget.AbsListView.OnScrollListener}. The listener may not be null | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"observe",
"the",
"list",
"view",
"which",
"is",
"contained",
"by",
"the",
"dialog",
"is",
"scrolled",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L864-L881 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java | TitlePaneCloseButtonPainter.paintCloseEnabled | private void paintCloseEnabled(Graphics2D g, JComponent c, int width, int height) {
"""
Paint the background enabled state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component.
"""
paintClose(g, c, width, height, enabled);
} | java | private void paintCloseEnabled(Graphics2D g, JComponent c, int width, int height) {
paintClose(g, c, width, height, enabled);
} | [
"private",
"void",
"paintCloseEnabled",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"paintClose",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
",",
"enabled",
")",
";",
"}"
] | Paint the background enabled state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"background",
"enabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L115-L117 |
kennycason/kumo | kumo-core/src/main/java/com/kennycason/kumo/WordCloud.java | WordCloud.writeToStream | public void writeToStream(final String format, final OutputStream outputStream) {
"""
Write wordcloud image data to stream in the given format
@param format the image format
@param outputStream the output stream to write image data to
"""
try {
LOGGER.debug("Writing WordCloud image data to output stream");
ImageIO.write(bufferedImage, format, outputStream);
LOGGER.debug("Done writing WordCloud image data to output stream");
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
throw new KumoException("Could not write wordcloud to outputstream due to an IOException", e);
}
} | java | public void writeToStream(final String format, final OutputStream outputStream) {
try {
LOGGER.debug("Writing WordCloud image data to output stream");
ImageIO.write(bufferedImage, format, outputStream);
LOGGER.debug("Done writing WordCloud image data to output stream");
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
throw new KumoException("Could not write wordcloud to outputstream due to an IOException", e);
}
} | [
"public",
"void",
"writeToStream",
"(",
"final",
"String",
"format",
",",
"final",
"OutputStream",
"outputStream",
")",
"{",
"try",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Writing WordCloud image data to output stream\"",
")",
";",
"ImageIO",
".",
"write",
"(",
"bufferedImage",
",",
"format",
",",
"outputStream",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Done writing WordCloud image data to output stream\"",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"throw",
"new",
"KumoException",
"(",
"\"Could not write wordcloud to outputstream due to an IOException\"",
",",
"e",
")",
";",
"}",
"}"
] | Write wordcloud image data to stream in the given format
@param format the image format
@param outputStream the output stream to write image data to | [
"Write",
"wordcloud",
"image",
"data",
"to",
"stream",
"in",
"the",
"given",
"format"
] | train | https://github.com/kennycason/kumo/blob/bc577f468f162dbaf61c327a2d4f1989c61c57a0/kumo-core/src/main/java/com/kennycason/kumo/WordCloud.java#L131-L141 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixRedundantInterface | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
"""
Quick fix for "Redundant interface implementation".
@param issue the issue.
@param acceptor the quick fix acceptor.
"""
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"REDUNDANT_INTERFACE_IMPLEMENTATION",
")",
"public",
"void",
"fixRedundantInterface",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ImplementedTypeRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"acceptor",
")",
";",
"}"
] | Quick fix for "Redundant interface implementation".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Redundant",
"interface",
"implementation",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L729-L732 |
liferay/com-liferay-commerce | commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java | CommerceCountryUtil.findByUUID_G | public static CommerceCountry findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.exception.NoSuchCountryException {
"""
Returns the commerce country where uuid = ? and groupId = ? or throws a {@link NoSuchCountryException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce country
@throws NoSuchCountryException if a matching commerce country could not be found
"""
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CommerceCountry findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.exception.NoSuchCountryException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CommerceCountry",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"exception",
".",
"NoSuchCountryException",
"{",
"return",
"getPersistence",
"(",
")",
".",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"}"
] | Returns the commerce country where uuid = ? and groupId = ? or throws a {@link NoSuchCountryException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce country
@throws NoSuchCountryException if a matching commerce country could not be found | [
"Returns",
"the",
"commerce",
"country",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCountryException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java#L279-L282 |
scalecube/scalecube-services | services-api/src/main/java/io/scalecube/services/api/ServiceMessage.java | ServiceMessage.setHeaders | void setHeaders(Map<String, String> headers) {
"""
Sets headers for deserialization purpose.
@param headers headers to set
"""
this.headers = Collections.unmodifiableMap(new HashMap<>(headers));
} | java | void setHeaders(Map<String, String> headers) {
this.headers = Collections.unmodifiableMap(new HashMap<>(headers));
} | [
"void",
"setHeaders",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"this",
".",
"headers",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"new",
"HashMap",
"<>",
"(",
"headers",
")",
")",
";",
"}"
] | Sets headers for deserialization purpose.
@param headers headers to set | [
"Sets",
"headers",
"for",
"deserialization",
"purpose",
"."
] | train | https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services-api/src/main/java/io/scalecube/services/api/ServiceMessage.java#L93-L95 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ScriptVars.java | ScriptVars.getScriptVarImpl | private static String getScriptVarImpl(String scriptName, String key) {
"""
Internal method that gets a variable without validating the script name.
@param scriptName the name of the script.
@param key the key of the variable.
@return the value of the variable, might be {@code null} if no value was previously set.
"""
Map<String, String> scVars = scriptVars.get(scriptName);
if (scVars == null) {
// No vars have been associated with this script
return null;
}
return scVars.get(key);
} | java | private static String getScriptVarImpl(String scriptName, String key) {
Map<String, String> scVars = scriptVars.get(scriptName);
if (scVars == null) {
// No vars have been associated with this script
return null;
}
return scVars.get(key);
} | [
"private",
"static",
"String",
"getScriptVarImpl",
"(",
"String",
"scriptName",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"scVars",
"=",
"scriptVars",
".",
"get",
"(",
"scriptName",
")",
";",
"if",
"(",
"scVars",
"==",
"null",
")",
"{",
"// No vars have been associated with this script",
"return",
"null",
";",
"}",
"return",
"scVars",
".",
"get",
"(",
"key",
")",
";",
"}"
] | Internal method that gets a variable without validating the script name.
@param scriptName the name of the script.
@param key the key of the variable.
@return the value of the variable, might be {@code null} if no value was previously set. | [
"Internal",
"method",
"that",
"gets",
"a",
"variable",
"without",
"validating",
"the",
"script",
"name",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptVars.java#L274-L282 |
moparisthebest/beehive | beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java | ValidatableField.setDefaultArg0Element | void setDefaultArg0Element(XmlModelWriter xw, String displayName, boolean displayNameIsResource, Element element) {
"""
Find or create a default arg 0 element not associated with a specific rule and set it to the display name.
"""
Element defaultArg0Element = getArgElement(xw, element, 0, null, _rules.size() > 0);
if (defaultArg0Element != null)
{
setElementAttribute(defaultArg0Element, "key", displayName);
setElementAttribute(defaultArg0Element, "resource", Boolean.toString(displayNameIsResource));
defaultArg0Element.removeAttribute("bundle");
}
} | java | void setDefaultArg0Element(XmlModelWriter xw, String displayName, boolean displayNameIsResource, Element element)
{
Element defaultArg0Element = getArgElement(xw, element, 0, null, _rules.size() > 0);
if (defaultArg0Element != null)
{
setElementAttribute(defaultArg0Element, "key", displayName);
setElementAttribute(defaultArg0Element, "resource", Boolean.toString(displayNameIsResource));
defaultArg0Element.removeAttribute("bundle");
}
} | [
"void",
"setDefaultArg0Element",
"(",
"XmlModelWriter",
"xw",
",",
"String",
"displayName",
",",
"boolean",
"displayNameIsResource",
",",
"Element",
"element",
")",
"{",
"Element",
"defaultArg0Element",
"=",
"getArgElement",
"(",
"xw",
",",
"element",
",",
"0",
",",
"null",
",",
"_rules",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"if",
"(",
"defaultArg0Element",
"!=",
"null",
")",
"{",
"setElementAttribute",
"(",
"defaultArg0Element",
",",
"\"key\"",
",",
"displayName",
")",
";",
"setElementAttribute",
"(",
"defaultArg0Element",
",",
"\"resource\"",
",",
"Boolean",
".",
"toString",
"(",
"displayNameIsResource",
")",
")",
";",
"defaultArg0Element",
".",
"removeAttribute",
"(",
"\"bundle\"",
")",
";",
"}",
"}"
] | Find or create a default arg 0 element not associated with a specific rule and set it to the display name. | [
"Find",
"or",
"create",
"a",
"default",
"arg",
"0",
"element",
"not",
"associated",
"with",
"a",
"specific",
"rule",
"and",
"set",
"it",
"to",
"the",
"display",
"name",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java#L218-L228 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/walk/ComparatorTypesVisitor.java | ComparatorTypesVisitor.compareLowerBounds | private boolean compareLowerBounds(final Type one, final Type two) {
"""
Check lower bounded wildcard cases. Method is not called if upper bounds are not equal.
<p>
If right is not lower wildcard - no matter what left is - it's always more specific.
<p>
If right is lower wildcard and left is simple class then right could be more specific only when left is Object.
Note that in this case left could be not Object as any type is more specific then Object (lower wildcard upper
bound).
<p>
When both lower wildcards: lower bounds must be from one hierarchy and left type should be lower.
For example, ? super Integer and ? super BigInteger are not assignable in spite of the fact that they
share some common types. ? super Number is more specific then ? super Integer (super inverse meaning).
@param one first type
@param two second type
@return true when left is more specific, false otherwise
"""
final boolean res;
// ? super Object is impossible here due to types cleanup in tree walker
if (notLowerBounded(two)) {
// ignore possible left lower bound when simple type on the right (not Object - root condition above)
res = true;
} else if (notLowerBounded(one)) {
// special case: left is Object and right is lower bounded wildcard
// e.g Object and ? super String (last is more specific, while it's upper bound is Object too)
// otherwise, any non Object is more specific
res = one != Object.class;
} else {
// left type's bound must be lower: not a mistake! left (super inversion)!
res = TypeUtils.isMoreSpecific(
((WildcardType) two).getLowerBounds()[0],
((WildcardType) one).getLowerBounds()[0]);
}
return res;
} | java | private boolean compareLowerBounds(final Type one, final Type two) {
final boolean res;
// ? super Object is impossible here due to types cleanup in tree walker
if (notLowerBounded(two)) {
// ignore possible left lower bound when simple type on the right (not Object - root condition above)
res = true;
} else if (notLowerBounded(one)) {
// special case: left is Object and right is lower bounded wildcard
// e.g Object and ? super String (last is more specific, while it's upper bound is Object too)
// otherwise, any non Object is more specific
res = one != Object.class;
} else {
// left type's bound must be lower: not a mistake! left (super inversion)!
res = TypeUtils.isMoreSpecific(
((WildcardType) two).getLowerBounds()[0],
((WildcardType) one).getLowerBounds()[0]);
}
return res;
} | [
"private",
"boolean",
"compareLowerBounds",
"(",
"final",
"Type",
"one",
",",
"final",
"Type",
"two",
")",
"{",
"final",
"boolean",
"res",
";",
"// ? super Object is impossible here due to types cleanup in tree walker",
"if",
"(",
"notLowerBounded",
"(",
"two",
")",
")",
"{",
"// ignore possible left lower bound when simple type on the right (not Object - root condition above)",
"res",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"notLowerBounded",
"(",
"one",
")",
")",
"{",
"// special case: left is Object and right is lower bounded wildcard",
"// e.g Object and ? super String (last is more specific, while it's upper bound is Object too)",
"// otherwise, any non Object is more specific",
"res",
"=",
"one",
"!=",
"Object",
".",
"class",
";",
"}",
"else",
"{",
"// left type's bound must be lower: not a mistake! left (super inversion)!",
"res",
"=",
"TypeUtils",
".",
"isMoreSpecific",
"(",
"(",
"(",
"WildcardType",
")",
"two",
")",
".",
"getLowerBounds",
"(",
")",
"[",
"0",
"]",
",",
"(",
"(",
"WildcardType",
")",
"one",
")",
".",
"getLowerBounds",
"(",
")",
"[",
"0",
"]",
")",
";",
"}",
"return",
"res",
";",
"}"
] | Check lower bounded wildcard cases. Method is not called if upper bounds are not equal.
<p>
If right is not lower wildcard - no matter what left is - it's always more specific.
<p>
If right is lower wildcard and left is simple class then right could be more specific only when left is Object.
Note that in this case left could be not Object as any type is more specific then Object (lower wildcard upper
bound).
<p>
When both lower wildcards: lower bounds must be from one hierarchy and left type should be lower.
For example, ? super Integer and ? super BigInteger are not assignable in spite of the fact that they
share some common types. ? super Number is more specific then ? super Integer (super inverse meaning).
@param one first type
@param two second type
@return true when left is more specific, false otherwise | [
"Check",
"lower",
"bounded",
"wildcard",
"cases",
".",
"Method",
"is",
"not",
"called",
"if",
"upper",
"bounds",
"are",
"not",
"equal",
".",
"<p",
">",
"If",
"right",
"is",
"not",
"lower",
"wildcard",
"-",
"no",
"matter",
"what",
"left",
"is",
"-",
"it",
"s",
"always",
"more",
"specific",
".",
"<p",
">",
"If",
"right",
"is",
"lower",
"wildcard",
"and",
"left",
"is",
"simple",
"class",
"then",
"right",
"could",
"be",
"more",
"specific",
"only",
"when",
"left",
"is",
"Object",
".",
"Note",
"that",
"in",
"this",
"case",
"left",
"could",
"be",
"not",
"Object",
"as",
"any",
"type",
"is",
"more",
"specific",
"then",
"Object",
"(",
"lower",
"wildcard",
"upper",
"bound",
")",
".",
"<p",
">",
"When",
"both",
"lower",
"wildcards",
":",
"lower",
"bounds",
"must",
"be",
"from",
"one",
"hierarchy",
"and",
"left",
"type",
"should",
"be",
"lower",
".",
"For",
"example",
"?",
"super",
"Integer",
"and",
"?",
"super",
"BigInteger",
"are",
"not",
"assignable",
"in",
"spite",
"of",
"the",
"fact",
"that",
"they",
"share",
"some",
"common",
"types",
".",
"?",
"super",
"Number",
"is",
"more",
"specific",
"then",
"?",
"super",
"Integer",
"(",
"super",
"inverse",
"meaning",
")",
"."
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/walk/ComparatorTypesVisitor.java#L95-L113 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/SelectionVisibility.java | SelectionVisibility.hasSelectedBond | static boolean hasSelectedBond(List<IBond> bonds, RendererModel model) {
"""
Determines if any bond in the list is selected
@param bonds list of bonds
@return at least bond bond is selected
"""
for (IBond bond : bonds) {
if (isSelected(bond, model)) return true;
}
return false;
} | java | static boolean hasSelectedBond(List<IBond> bonds, RendererModel model) {
for (IBond bond : bonds) {
if (isSelected(bond, model)) return true;
}
return false;
} | [
"static",
"boolean",
"hasSelectedBond",
"(",
"List",
"<",
"IBond",
">",
"bonds",
",",
"RendererModel",
"model",
")",
"{",
"for",
"(",
"IBond",
"bond",
":",
"bonds",
")",
"{",
"if",
"(",
"isSelected",
"(",
"bond",
",",
"model",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Determines if any bond in the list is selected
@param bonds list of bonds
@return at least bond bond is selected | [
"Determines",
"if",
"any",
"bond",
"in",
"the",
"list",
"is",
"selected"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/SelectionVisibility.java#L111-L116 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logWebServiceMessage | protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) {
"""
Log WebService message (other than SOAP) with in memory
{@link ByteArrayOutputStream}
@param logMessage the customized log message.
@param message the message to log.
@param incoming
"""
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
message.writeTo(os);
logMessage(logMessage, os.toString(), incoming);
} catch (IOException e) {
log.warn("Unable to log WebService message", e);
}
} | java | protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
message.writeTo(os);
logMessage(logMessage, os.toString(), incoming);
} catch (IOException e) {
log.warn("Unable to log WebService message", e);
}
} | [
"protected",
"void",
"logWebServiceMessage",
"(",
"String",
"logMessage",
",",
"WebServiceMessage",
"message",
",",
"boolean",
"incoming",
")",
"{",
"ByteArrayOutputStream",
"os",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"message",
".",
"writeTo",
"(",
"os",
")",
";",
"logMessage",
"(",
"logMessage",
",",
"os",
".",
"toString",
"(",
")",
",",
"incoming",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Unable to log WebService message\"",
",",
"e",
")",
";",
"}",
"}"
] | Log WebService message (other than SOAP) with in memory
{@link ByteArrayOutputStream}
@param logMessage the customized log message.
@param message the message to log.
@param incoming | [
"Log",
"WebService",
"message",
"(",
"other",
"than",
"SOAP",
")",
"with",
"in",
"memory",
"{",
"@link",
"ByteArrayOutputStream",
"}"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L113-L122 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/connection/DataSourceConnectionSupplierImpl.java | DataSourceConnectionSupplierImpl.setTransactionIsolation | public void setTransactionIsolation(final String dataSourceName, final int transactionIsolation) {
"""
{@link DataSourceConnectionSupplierImpl#setDefaultDataSourceName(String)}
で指定したデータソースに対するtransactionIsolationオプションの指定
@see Connection#TRANSACTION_READ_UNCOMMITTED
@see Connection#TRANSACTION_READ_COMMITTED
@see Connection#TRANSACTION_REPEATABLE_READ
@see Connection#TRANSACTION_SERIALIZABLE
@param dataSourceName データソース名
@param transactionIsolation transactionIsolationオプション
"""
if (Connection.TRANSACTION_READ_UNCOMMITTED == transactionIsolation
|| Connection.TRANSACTION_READ_COMMITTED == transactionIsolation
|| Connection.TRANSACTION_REPEATABLE_READ == transactionIsolation
|| Connection.TRANSACTION_SERIALIZABLE == transactionIsolation) {
Map<String, String> props = getConnPropsByDataSourceName(dataSourceName);
props.put(PROPS_TRANSACTION_ISOLATION, String.valueOf(transactionIsolation));
} else {
throw new IllegalArgumentException("Unsupported level [" + transactionIsolation + "]");
}
} | java | public void setTransactionIsolation(final String dataSourceName, final int transactionIsolation) {
if (Connection.TRANSACTION_READ_UNCOMMITTED == transactionIsolation
|| Connection.TRANSACTION_READ_COMMITTED == transactionIsolation
|| Connection.TRANSACTION_REPEATABLE_READ == transactionIsolation
|| Connection.TRANSACTION_SERIALIZABLE == transactionIsolation) {
Map<String, String> props = getConnPropsByDataSourceName(dataSourceName);
props.put(PROPS_TRANSACTION_ISOLATION, String.valueOf(transactionIsolation));
} else {
throw new IllegalArgumentException("Unsupported level [" + transactionIsolation + "]");
}
} | [
"public",
"void",
"setTransactionIsolation",
"(",
"final",
"String",
"dataSourceName",
",",
"final",
"int",
"transactionIsolation",
")",
"{",
"if",
"(",
"Connection",
".",
"TRANSACTION_READ_UNCOMMITTED",
"==",
"transactionIsolation",
"||",
"Connection",
".",
"TRANSACTION_READ_COMMITTED",
"==",
"transactionIsolation",
"||",
"Connection",
".",
"TRANSACTION_REPEATABLE_READ",
"==",
"transactionIsolation",
"||",
"Connection",
".",
"TRANSACTION_SERIALIZABLE",
"==",
"transactionIsolation",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"props",
"=",
"getConnPropsByDataSourceName",
"(",
"dataSourceName",
")",
";",
"props",
".",
"put",
"(",
"PROPS_TRANSACTION_ISOLATION",
",",
"String",
".",
"valueOf",
"(",
"transactionIsolation",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unsupported level [\"",
"+",
"transactionIsolation",
"+",
"\"]\"",
")",
";",
"}",
"}"
] | {@link DataSourceConnectionSupplierImpl#setDefaultDataSourceName(String)}
で指定したデータソースに対するtransactionIsolationオプションの指定
@see Connection#TRANSACTION_READ_UNCOMMITTED
@see Connection#TRANSACTION_READ_COMMITTED
@see Connection#TRANSACTION_REPEATABLE_READ
@see Connection#TRANSACTION_SERIALIZABLE
@param dataSourceName データソース名
@param transactionIsolation transactionIsolationオプション | [
"{",
"@link",
"DataSourceConnectionSupplierImpl#setDefaultDataSourceName",
"(",
"String",
")",
"}",
"で指定したデータソースに対するtransactionIsolationオプションの指定"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/connection/DataSourceConnectionSupplierImpl.java#L266-L276 |
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.addIntent | public UUID addIntent(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) {
"""
Adds an intent classifier to the application.
@param appId The application ID.
@param versionId The version ID.
@param addIntentOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful.
"""
return addIntentWithServiceResponseAsync(appId, versionId, addIntentOptionalParameter).toBlocking().single().body();
} | java | public UUID addIntent(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) {
return addIntentWithServiceResponseAsync(appId, versionId, addIntentOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"addIntent",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddIntentOptionalParameter",
"addIntentOptionalParameter",
")",
"{",
"return",
"addIntentWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"addIntentOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Adds an intent classifier to the application.
@param appId The application ID.
@param versionId The version ID.
@param addIntentOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Adds",
"an",
"intent",
"classifier",
"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#L583-L585 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java | HttpClientMockBuilder.withHeader | public HttpClientMockBuilder withHeader(String header, String value) {
"""
Adds header condition. Header must be equal to provided value.
@param header header name
@param value expected value
@return condition builder
"""
return withHeader(header, equalTo(value));
} | java | public HttpClientMockBuilder withHeader(String header, String value) {
return withHeader(header, equalTo(value));
} | [
"public",
"HttpClientMockBuilder",
"withHeader",
"(",
"String",
"header",
",",
"String",
"value",
")",
"{",
"return",
"withHeader",
"(",
"header",
",",
"equalTo",
"(",
"value",
")",
")",
";",
"}"
] | Adds header condition. Header must be equal to provided value.
@param header header name
@param value expected value
@return condition builder | [
"Adds",
"header",
"condition",
".",
"Header",
"must",
"be",
"equal",
"to",
"provided",
"value",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L31-L33 |
OpenLiberty/open-liberty | dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionResourceFactoryBuilder.java | MailSessionResourceFactoryBuilder.getMailSessionID | private static final String getMailSessionID(String application, String module, String component, String jndiName) {
"""
Utility method that creates a unique identifier for an application defined data source.
For example,
application[MyApp]/module[MyModule]/connectionFactory[java:module/env/jdbc/cf1]
@param application application name if data source is in java:app, java:module, or java:comp. Otherwise null.
@param module module name if data source is in java:module or java:comp. Otherwise null.
@param component component name if data source is in java:comp and isn't in web container. Otherwise null.
@param jndiName configured JNDI name for the data source. For example, java:module/env/jca/cf1
@return the unique identifier
"""
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append("application").append('[').append(application).append(']').append('/');
if (module != null) {
sb.append("module").append('[').append(module).append(']').append('/');
if (component != null)
sb.append("component").append('[').append(component).append(']').append('/');
}
}
return sb.append(MailSessionService.MAILSESSIONID).append('[').append(jndiName).append(']').toString();
} | java | private static final String getMailSessionID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append("application").append('[').append(application).append(']').append('/');
if (module != null) {
sb.append("module").append('[').append(module).append(']').append('/');
if (component != null)
sb.append("component").append('[').append(component).append(']').append('/');
}
}
return sb.append(MailSessionService.MAILSESSIONID).append('[').append(jndiName).append(']').toString();
} | [
"private",
"static",
"final",
"String",
"getMailSessionID",
"(",
"String",
"application",
",",
"String",
"module",
",",
"String",
"component",
",",
"String",
"jndiName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"jndiName",
".",
"length",
"(",
")",
"+",
"80",
")",
";",
"if",
"(",
"application",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"\"application\"",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"application",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"module",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"\"module\"",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"module",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"component",
"!=",
"null",
")",
"sb",
".",
"append",
"(",
"\"component\"",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"component",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"return",
"sb",
".",
"append",
"(",
"MailSessionService",
".",
"MAILSESSIONID",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"jndiName",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Utility method that creates a unique identifier for an application defined data source.
For example,
application[MyApp]/module[MyModule]/connectionFactory[java:module/env/jdbc/cf1]
@param application application name if data source is in java:app, java:module, or java:comp. Otherwise null.
@param module module name if data source is in java:module or java:comp. Otherwise null.
@param component component name if data source is in java:comp and isn't in web container. Otherwise null.
@param jndiName configured JNDI name for the data source. For example, java:module/env/jca/cf1
@return the unique identifier | [
"Utility",
"method",
"that",
"creates",
"a",
"unique",
"identifier",
"for",
"an",
"application",
"defined",
"data",
"source",
".",
"For",
"example",
"application",
"[",
"MyApp",
"]",
"/",
"module",
"[",
"MyModule",
"]",
"/",
"connectionFactory",
"[",
"java",
":",
"module",
"/",
"env",
"/",
"jdbc",
"/",
"cf1",
"]"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionResourceFactoryBuilder.java#L159-L170 |
icode/ameba | src/main/java/ameba/feature/AmebaFeature.java | AmebaFeature.subscribeSystemEvent | protected <E extends Event> void subscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
"""
<p>subscribeSystemEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@since 0.1.6e
@param <E> a E object.
"""
locator.inject(listener);
locator.postConstruct(listener);
SystemEventBus.subscribe(eventClass, listener);
} | java | protected <E extends Event> void subscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
locator.inject(listener);
locator.postConstruct(listener);
SystemEventBus.subscribe(eventClass, listener);
} | [
"protected",
"<",
"E",
"extends",
"Event",
">",
"void",
"subscribeSystemEvent",
"(",
"Class",
"<",
"E",
">",
"eventClass",
",",
"final",
"Listener",
"<",
"E",
">",
"listener",
")",
"{",
"locator",
".",
"inject",
"(",
"listener",
")",
";",
"locator",
".",
"postConstruct",
"(",
"listener",
")",
";",
"SystemEventBus",
".",
"subscribe",
"(",
"eventClass",
",",
"listener",
")",
";",
"}"
] | <p>subscribeSystemEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@since 0.1.6e
@param <E> a E object. | [
"<p",
">",
"subscribeSystemEvent",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/feature/AmebaFeature.java#L128-L132 |
elki-project/elki | elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTreeNode.java | AbstractRStarTreeNode.integrityCheckParameters | protected void integrityCheckParameters(N parent, int index) {
"""
Tests, if the parameters of the entry representing this node, are correctly
set. Subclasses may need to overwrite this method.
@param parent the parent holding the entry representing this node
@param index the index of the entry in the parents child array
"""
// test if mbr is correctly set
E entry = parent.getEntry(index);
HyperBoundingBox mbr = computeMBR();
if(/* entry.getMBR() == null && */mbr == null) {
return;
}
if(!SpatialUtil.equals(entry, mbr)) {
String soll = mbr.toString();
String ist = new HyperBoundingBox(entry).toString();
throw new RuntimeException("Wrong MBR in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist);
}
} | java | protected void integrityCheckParameters(N parent, int index) {
// test if mbr is correctly set
E entry = parent.getEntry(index);
HyperBoundingBox mbr = computeMBR();
if(/* entry.getMBR() == null && */mbr == null) {
return;
}
if(!SpatialUtil.equals(entry, mbr)) {
String soll = mbr.toString();
String ist = new HyperBoundingBox(entry).toString();
throw new RuntimeException("Wrong MBR in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist);
}
} | [
"protected",
"void",
"integrityCheckParameters",
"(",
"N",
"parent",
",",
"int",
"index",
")",
"{",
"// test if mbr is correctly set",
"E",
"entry",
"=",
"parent",
".",
"getEntry",
"(",
"index",
")",
";",
"HyperBoundingBox",
"mbr",
"=",
"computeMBR",
"(",
")",
";",
"if",
"(",
"/* entry.getMBR() == null && */",
"mbr",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"SpatialUtil",
".",
"equals",
"(",
"entry",
",",
"mbr",
")",
")",
"{",
"String",
"soll",
"=",
"mbr",
".",
"toString",
"(",
")",
";",
"String",
"ist",
"=",
"new",
"HyperBoundingBox",
"(",
"entry",
")",
".",
"toString",
"(",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"\"Wrong MBR in node \"",
"+",
"parent",
".",
"getPageID",
"(",
")",
"+",
"\" at index \"",
"+",
"index",
"+",
"\" (child \"",
"+",
"entry",
"+",
"\")\"",
"+",
"\"\\nsoll: \"",
"+",
"soll",
"+",
"\",\\n ist: \"",
"+",
"ist",
")",
";",
"}",
"}"
] | Tests, if the parameters of the entry representing this node, are correctly
set. Subclasses may need to overwrite this method.
@param parent the parent holding the entry representing this node
@param index the index of the entry in the parents child array | [
"Tests",
"if",
"the",
"parameters",
"of",
"the",
"entry",
"representing",
"this",
"node",
"are",
"correctly",
"set",
".",
"Subclasses",
"may",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTreeNode.java#L197-L210 |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java | SelfRegisteringRemote.getHubConfiguration | private GridHubConfiguration getHubConfiguration() throws Exception {
"""
uses the hub API to get some of its configuration.
@return json object of the current hub configuration
"""
String hubApi =
"http://" + registrationRequest.getConfiguration().getHubHost() + ":"
+ registrationRequest.getConfiguration().getHubPort() + "/grid/api/hub";
URL api = new URL(hubApi);
HttpClient client = httpClientFactory.createClient(api);
String url = api.toExternalForm();
HttpRequest request = new HttpRequest(GET, url);
HttpResponse response = client.execute(request);
try (Reader reader = new StringReader(response.getContentString());
JsonInput jsonInput = new Json().newInput(reader)) {
return GridHubConfiguration.loadFromJSON(jsonInput);
}
} | java | private GridHubConfiguration getHubConfiguration() throws Exception {
String hubApi =
"http://" + registrationRequest.getConfiguration().getHubHost() + ":"
+ registrationRequest.getConfiguration().getHubPort() + "/grid/api/hub";
URL api = new URL(hubApi);
HttpClient client = httpClientFactory.createClient(api);
String url = api.toExternalForm();
HttpRequest request = new HttpRequest(GET, url);
HttpResponse response = client.execute(request);
try (Reader reader = new StringReader(response.getContentString());
JsonInput jsonInput = new Json().newInput(reader)) {
return GridHubConfiguration.loadFromJSON(jsonInput);
}
} | [
"private",
"GridHubConfiguration",
"getHubConfiguration",
"(",
")",
"throws",
"Exception",
"{",
"String",
"hubApi",
"=",
"\"http://\"",
"+",
"registrationRequest",
".",
"getConfiguration",
"(",
")",
".",
"getHubHost",
"(",
")",
"+",
"\":\"",
"+",
"registrationRequest",
".",
"getConfiguration",
"(",
")",
".",
"getHubPort",
"(",
")",
"+",
"\"/grid/api/hub\"",
";",
"URL",
"api",
"=",
"new",
"URL",
"(",
"hubApi",
")",
";",
"HttpClient",
"client",
"=",
"httpClientFactory",
".",
"createClient",
"(",
"api",
")",
";",
"String",
"url",
"=",
"api",
".",
"toExternalForm",
"(",
")",
";",
"HttpRequest",
"request",
"=",
"new",
"HttpRequest",
"(",
"GET",
",",
"url",
")",
";",
"HttpResponse",
"response",
"=",
"client",
".",
"execute",
"(",
"request",
")",
";",
"try",
"(",
"Reader",
"reader",
"=",
"new",
"StringReader",
"(",
"response",
".",
"getContentString",
"(",
")",
")",
";",
"JsonInput",
"jsonInput",
"=",
"new",
"Json",
"(",
")",
".",
"newInput",
"(",
"reader",
")",
")",
"{",
"return",
"GridHubConfiguration",
".",
"loadFromJSON",
"(",
"jsonInput",
")",
";",
"}",
"}"
] | uses the hub API to get some of its configuration.
@return json object of the current hub configuration | [
"uses",
"the",
"hub",
"API",
"to",
"get",
"some",
"of",
"its",
"configuration",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java#L359-L374 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java | ImageAnchorCell.setAttribute | public void setAttribute(String name, String value, String facet)
throws JspException {
"""
<p>
Implementation of the {@link org.apache.beehive.netui.tags.IAttributeConsumer} interface. This
allows users of this tag to extend the attribute set that is rendered by the HTML image or
anchor tags. This method accepts the following facets:
<table>
<tr><td>Facet Name</td><td>Operation</td></tr>
<tr><td><code>anchor</code></td><td>Adds an attribute with the provided <code>name</code> and <code>value</code> to the
attributes rendered on the <a> tag.</td></tr>
<tr><td><code>image</code></td><td>Adds an attribute with the provided <code>name</code> and <code>value</code> to the
attributes rendered on the <img> tag.</td></tr>
</table>
This tag defaults to the setting attributes on the anchor when the facet name is unset.
</p>
@param name the name of the attribute
@param value the value of the attribute
@param facet the facet for the attribute
@throws JspException thrown when the facet is not recognized
"""
if(facet == null || facet.equals(ANCHOR_FACET_NAME))
super.addStateAttribute(_anchorState, name, value);
else if(facet.equals(IMAGE_FACET_NAME))
super.addStateAttribute(_imageState, name, value);
else
super.setAttribute(name, value, facet);
} | java | public void setAttribute(String name, String value, String facet)
throws JspException {
if(facet == null || facet.equals(ANCHOR_FACET_NAME))
super.addStateAttribute(_anchorState, name, value);
else if(facet.equals(IMAGE_FACET_NAME))
super.addStateAttribute(_imageState, name, value);
else
super.setAttribute(name, value, facet);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"if",
"(",
"facet",
"==",
"null",
"||",
"facet",
".",
"equals",
"(",
"ANCHOR_FACET_NAME",
")",
")",
"super",
".",
"addStateAttribute",
"(",
"_anchorState",
",",
"name",
",",
"value",
")",
";",
"else",
"if",
"(",
"facet",
".",
"equals",
"(",
"IMAGE_FACET_NAME",
")",
")",
"super",
".",
"addStateAttribute",
"(",
"_imageState",
",",
"name",
",",
"value",
")",
";",
"else",
"super",
".",
"setAttribute",
"(",
"name",
",",
"value",
",",
"facet",
")",
";",
"}"
] | <p>
Implementation of the {@link org.apache.beehive.netui.tags.IAttributeConsumer} interface. This
allows users of this tag to extend the attribute set that is rendered by the HTML image or
anchor tags. This method accepts the following facets:
<table>
<tr><td>Facet Name</td><td>Operation</td></tr>
<tr><td><code>anchor</code></td><td>Adds an attribute with the provided <code>name</code> and <code>value</code> to the
attributes rendered on the <a> tag.</td></tr>
<tr><td><code>image</code></td><td>Adds an attribute with the provided <code>name</code> and <code>value</code> to the
attributes rendered on the <img> tag.</td></tr>
</table>
This tag defaults to the setting attributes on the anchor when the facet name is unset.
</p>
@param name the name of the attribute
@param value the value of the attribute
@param facet the facet for the attribute
@throws JspException thrown when the facet is not recognized | [
"<p",
">",
"Implementation",
"of",
"the",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java#L628-L636 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UcsApi.java | UcsApi.getLuceneIndexesAsync | public com.squareup.okhttp.Call getLuceneIndexesAsync(LuceneIndexesData luceneIndexesData, final ApiCallback<ConfigResponse> callback) throws ApiException {
"""
Get the lucene indexes for ucs (asynchronously)
This request returns all the lucene indexes for contact.
@param luceneIndexesData Request parameters. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object
"""
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getLuceneIndexesValidateBeforeCall(luceneIndexesData, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ConfigResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call getLuceneIndexesAsync(LuceneIndexesData luceneIndexesData, final ApiCallback<ConfigResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getLuceneIndexesValidateBeforeCall(luceneIndexesData, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ConfigResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"getLuceneIndexesAsync",
"(",
"LuceneIndexesData",
"luceneIndexesData",
",",
"final",
"ApiCallback",
"<",
"ConfigResponse",
">",
"callback",
")",
"throws",
"ApiException",
"{",
"ProgressResponseBody",
".",
"ProgressListener",
"progressListener",
"=",
"null",
";",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"progressRequestListener",
"=",
"null",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"progressListener",
"=",
"new",
"ProgressResponseBody",
".",
"ProgressListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"update",
"(",
"long",
"bytesRead",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onDownloadProgress",
"(",
"bytesRead",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"progressRequestListener",
"=",
"new",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onRequestProgress",
"(",
"long",
"bytesWritten",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onUploadProgress",
"(",
"bytesWritten",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"}",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"getLuceneIndexesValidateBeforeCall",
"(",
"luceneIndexesData",
",",
"progressListener",
",",
"progressRequestListener",
")",
";",
"Type",
"localVarReturnType",
"=",
"new",
"TypeToken",
"<",
"ConfigResponse",
">",
"(",
")",
"{",
"}",
".",
"getType",
"(",
")",
";",
"apiClient",
".",
"executeAsync",
"(",
"call",
",",
"localVarReturnType",
",",
"callback",
")",
";",
"return",
"call",
";",
"}"
] | Get the lucene indexes for ucs (asynchronously)
This request returns all the lucene indexes for contact.
@param luceneIndexesData Request parameters. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Get",
"the",
"lucene",
"indexes",
"for",
"ucs",
"(",
"asynchronously",
")",
"This",
"request",
"returns",
"all",
"the",
"lucene",
"indexes",
"for",
"contact",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L1305-L1330 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java | UnboundTypeReference.acceptHint | public void acceptHint(
LightweightTypeReference hint, BoundTypeArgumentSource source, Object origin,
VarianceInfo expectedVariance, VarianceInfo actualVariance) {
"""
<p>Attach a resolution hint to this unbound type reference.</p>
<p>
Only {@link #isValidHint() valid} hints can be accepted. The given source indicates the
quality of this hint. The {@link VarianceInfo variances} indicate how the hint was used and
how it was expected to be used. A hint from a co-variant location may not have the same impact
for a contra-variant usage as a contra-variant hint. Consider a return type of a method</p>
<p>
<code>
<T> Collection<? extends T> m(..) { }
</code>
</p>
and its usage
<p>
<code>
Collection<? super CharSequence> variable = m(..)
</code>
</p>
<p>
The hint that stems from the variable declaration may not be very useful since the variances
are not compatible. Nevertheless, it can be accepted to produce better error messages.</p>
@param hint the reference that provides the hint.
@param source the source of this hint, e.g. an inferred hint, or an expectation.
@param origin the object that produced the hint. Only for debugging purpose to trace the origin of a hint.
@param expectedVariance the expected variance, e.g. where this unbound type reference is used.
@param actualVariance how the hint is used.
@see LightweightTypeReference#isValidHint()
"""
if (!hint.isValidHint())
throw new IllegalArgumentException("Hint may not be primitive void, <any> or <unknown>");
if (hint instanceof UnboundTypeReference) {
if (((UnboundTypeReference) hint).getHandle() == getHandle()) {
return; // invalid input, e.g. List<T extends T>
}
}
acceptHint(new LightweightBoundTypeArgument(hint.getWrapperTypeIfPrimitive(), source, origin, expectedVariance, actualVariance));
} | java | public void acceptHint(
LightweightTypeReference hint, BoundTypeArgumentSource source, Object origin,
VarianceInfo expectedVariance, VarianceInfo actualVariance) {
if (!hint.isValidHint())
throw new IllegalArgumentException("Hint may not be primitive void, <any> or <unknown>");
if (hint instanceof UnboundTypeReference) {
if (((UnboundTypeReference) hint).getHandle() == getHandle()) {
return; // invalid input, e.g. List<T extends T>
}
}
acceptHint(new LightweightBoundTypeArgument(hint.getWrapperTypeIfPrimitive(), source, origin, expectedVariance, actualVariance));
} | [
"public",
"void",
"acceptHint",
"(",
"LightweightTypeReference",
"hint",
",",
"BoundTypeArgumentSource",
"source",
",",
"Object",
"origin",
",",
"VarianceInfo",
"expectedVariance",
",",
"VarianceInfo",
"actualVariance",
")",
"{",
"if",
"(",
"!",
"hint",
".",
"isValidHint",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Hint may not be primitive void, <any> or <unknown>\"",
")",
";",
"if",
"(",
"hint",
"instanceof",
"UnboundTypeReference",
")",
"{",
"if",
"(",
"(",
"(",
"UnboundTypeReference",
")",
"hint",
")",
".",
"getHandle",
"(",
")",
"==",
"getHandle",
"(",
")",
")",
"{",
"return",
";",
"// invalid input, e.g. List<T extends T>",
"}",
"}",
"acceptHint",
"(",
"new",
"LightweightBoundTypeArgument",
"(",
"hint",
".",
"getWrapperTypeIfPrimitive",
"(",
")",
",",
"source",
",",
"origin",
",",
"expectedVariance",
",",
"actualVariance",
")",
")",
";",
"}"
] | <p>Attach a resolution hint to this unbound type reference.</p>
<p>
Only {@link #isValidHint() valid} hints can be accepted. The given source indicates the
quality of this hint. The {@link VarianceInfo variances} indicate how the hint was used and
how it was expected to be used. A hint from a co-variant location may not have the same impact
for a contra-variant usage as a contra-variant hint. Consider a return type of a method</p>
<p>
<code>
<T> Collection<? extends T> m(..) { }
</code>
</p>
and its usage
<p>
<code>
Collection<? super CharSequence> variable = m(..)
</code>
</p>
<p>
The hint that stems from the variable declaration may not be very useful since the variances
are not compatible. Nevertheless, it can be accepted to produce better error messages.</p>
@param hint the reference that provides the hint.
@param source the source of this hint, e.g. an inferred hint, or an expectation.
@param origin the object that produced the hint. Only for debugging purpose to trace the origin of a hint.
@param expectedVariance the expected variance, e.g. where this unbound type reference is used.
@param actualVariance how the hint is used.
@see LightweightTypeReference#isValidHint() | [
"<p",
">",
"Attach",
"a",
"resolution",
"hint",
"to",
"this",
"unbound",
"type",
"reference",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Only",
"{",
"@link",
"#isValidHint",
"()",
"valid",
"}",
"hints",
"can",
"be",
"accepted",
".",
"The",
"given",
"source",
"indicates",
"the",
"quality",
"of",
"this",
"hint",
".",
"The",
"{",
"@link",
"VarianceInfo",
"variances",
"}",
"indicate",
"how",
"the",
"hint",
"was",
"used",
"and",
"how",
"it",
"was",
"expected",
"to",
"be",
"used",
".",
"A",
"hint",
"from",
"a",
"co",
"-",
"variant",
"location",
"may",
"not",
"have",
"the",
"same",
"impact",
"for",
"a",
"contra",
"-",
"variant",
"usage",
"as",
"a",
"contra",
"-",
"variant",
"hint",
".",
"Consider",
"a",
"return",
"type",
"of",
"a",
"method<",
"/",
"p",
">",
"<p",
">",
"<code",
">",
"<",
";",
"T>",
";",
"Collection<",
";",
"?",
"extends",
"T>",
";",
"m",
"(",
"..",
")",
"{",
"}",
"<",
"/",
"code",
">",
"<",
"/",
"p",
">",
"and",
"its",
"usage",
"<p",
">",
"<code",
">",
"Collection<",
";",
"?",
"super",
"CharSequence>",
";",
"variable",
"=",
"m",
"(",
"..",
")",
"<",
"/",
"code",
">",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"hint",
"that",
"stems",
"from",
"the",
"variable",
"declaration",
"may",
"not",
"be",
"very",
"useful",
"since",
"the",
"variances",
"are",
"not",
"compatible",
".",
"Nevertheless",
"it",
"can",
"be",
"accepted",
"to",
"produce",
"better",
"error",
"messages",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java#L801-L812 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getInstanceForSkeleton | public final static DateFormat getInstanceForSkeleton(String skeleton) {
"""
<strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
the default locale.
@param skeleton The skeleton that selects the fields to be formatted. (Uses the
{@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
{@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
"""
return getPatternInstance(skeleton, ULocale.getDefault(Category.FORMAT));
} | java | public final static DateFormat getInstanceForSkeleton(String skeleton) {
return getPatternInstance(skeleton, ULocale.getDefault(Category.FORMAT));
} | [
"public",
"final",
"static",
"DateFormat",
"getInstanceForSkeleton",
"(",
"String",
"skeleton",
")",
"{",
"return",
"getPatternInstance",
"(",
"skeleton",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"FORMAT",
")",
")",
";",
"}"
] | <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
the default locale.
@param skeleton The skeleton that selects the fields to be formatted. (Uses the
{@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
{@link DateFormat#MONTH_WEEKDAY_DAY}, etc. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"dates",
"and",
"times",
"in",
"the",
"default",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1949-L1951 |
Netflix/eureka | eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java | EndpointUtils.getDiscoveryServiceUrls | public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) {
"""
Get the list of all eureka service urls for the eureka client to talk to.
@param clientConfig the clientConfig to use
@param zone the zone in which the client resides
@param randomizer a randomizer to randomized returned urls, if loading from dns
@return The list of all eureka service urls for the eureka client to talk to.
"""
boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls();
if (shouldUseDns) {
return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer);
}
return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka());
} | java | public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) {
boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls();
if (shouldUseDns) {
return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer);
}
return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getDiscoveryServiceUrls",
"(",
"EurekaClientConfig",
"clientConfig",
",",
"String",
"zone",
",",
"ServiceUrlRandomizer",
"randomizer",
")",
"{",
"boolean",
"shouldUseDns",
"=",
"clientConfig",
".",
"shouldUseDnsForFetchingServiceUrls",
"(",
")",
";",
"if",
"(",
"shouldUseDns",
")",
"{",
"return",
"getServiceUrlsFromDNS",
"(",
"clientConfig",
",",
"zone",
",",
"clientConfig",
".",
"shouldPreferSameZoneEureka",
"(",
")",
",",
"randomizer",
")",
";",
"}",
"return",
"getServiceUrlsFromConfig",
"(",
"clientConfig",
",",
"zone",
",",
"clientConfig",
".",
"shouldPreferSameZoneEureka",
"(",
")",
")",
";",
"}"
] | Get the list of all eureka service urls for the eureka client to talk to.
@param clientConfig the clientConfig to use
@param zone the zone in which the client resides
@param randomizer a randomizer to randomized returned urls, if loading from dns
@return The list of all eureka service urls for the eureka client to talk to. | [
"Get",
"the",
"list",
"of",
"all",
"eureka",
"service",
"urls",
"for",
"the",
"eureka",
"client",
"to",
"talk",
"to",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java#L74-L80 |
vatbub/common | core/src/main/java/com/github/vatbub/common/core/StringCommon.java | StringCommon.getRequiredSpaces | private static String getRequiredSpaces(String reference, String message) {
"""
Formats a message to be printed on the console
@param message The line to be formatted
@return The formatted version of {@code message}
"""
StringBuilder res = new StringBuilder();
int requiredSpaces = reference.length() - message.length() - 4;
for (int i = 0; i < requiredSpaces; i++) {
res.append(" ");
}
return res.toString();
} | java | private static String getRequiredSpaces(String reference, String message) {
StringBuilder res = new StringBuilder();
int requiredSpaces = reference.length() - message.length() - 4;
for (int i = 0; i < requiredSpaces; i++) {
res.append(" ");
}
return res.toString();
} | [
"private",
"static",
"String",
"getRequiredSpaces",
"(",
"String",
"reference",
",",
"String",
"message",
")",
"{",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"requiredSpaces",
"=",
"reference",
".",
"length",
"(",
")",
"-",
"message",
".",
"length",
"(",
")",
"-",
"4",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"requiredSpaces",
";",
"i",
"++",
")",
"{",
"res",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}"
] | Formats a message to be printed on the console
@param message The line to be formatted
@return The formatted version of {@code message} | [
"Formats",
"a",
"message",
"to",
"be",
"printed",
"on",
"the",
"console"
] | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/core/src/main/java/com/github/vatbub/common/core/StringCommon.java#L90-L99 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java | FavoritesInner.getAsync | public Observable<ApplicationInsightsComponentFavoriteInner> getAsync(String resourceGroupName, String resourceName, String favoriteId) {
"""
Get a single favorite by its FavoriteId, defined within an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param favoriteId The Id of a specific favorite defined in the Application Insights component
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentFavoriteInner object
"""
return getWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() {
@Override
public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentFavoriteInner> getAsync(String resourceGroupName, String resourceName, String favoriteId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() {
@Override
public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"favoriteId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"favoriteId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
",",
"ApplicationInsightsComponentFavoriteInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationInsightsComponentFavoriteInner",
"call",
"(",
"ServiceResponse",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get a single favorite by its FavoriteId, defined within an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param favoriteId The Id of a specific favorite defined in the Application Insights component
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentFavoriteInner object | [
"Get",
"a",
"single",
"favorite",
"by",
"its",
"FavoriteId",
"defined",
"within",
"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/FavoritesInner.java#L311-L318 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptExecutor.java | ScriptExecutor.executeScript | public boolean executeScript(final File script, final Properties scriptProperties) {
"""
Executes the specified Groovy script.
@param script
the script file
@param scriptProperties
properties that are set to the script engine's binding and thus will be available
as variables in the Groovy script
@return the execution result, {@code true} if successful, {@code false} code
"""
checkState(script.exists(), "Script file does not exist: %s", script);
checkState(script.canRead(), "Script file is not readable: %s", script);
Reader reader = null;
boolean success = false;
Throwable throwable = null;
scriptScope.enterScope();
ScriptContext ctx = scriptContextProvider.get();
try {
reader = Files.newReader(script, charset);
ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByExtension("groovy");
ctx.setScript(script);
ctx.load(JFunkConstants.SCRIPT_PROPERTIES, false);
ctx.registerReporter(new SimpleReporter());
initGroovyCommands(scriptEngine, ctx);
initScriptProperties(scriptEngine, scriptProperties);
ScriptMetaData scriptMetaData = scriptMetaDataProvider.get();
scriptMetaData.setScriptName(script.getPath());
Date startDate = new Date();
scriptMetaData.setStartDate(startDate);
ctx.set(JFunkConstants.SCRIPT_START_MILLIS, String.valueOf(startDate.getTime()));
eventBus.post(scriptEngine);
eventBus.post(new BeforeScriptEvent(script.getAbsolutePath()));
scriptEngine.eval(reader);
success = true;
} catch (IOException ex) {
throwable = ex;
log.error("Error loading script: " + script, ex);
} catch (ScriptException ex) {
throwable = ex;
// Look up the cause hierarchy if we find a ModuleExecutionException.
// We only need to log exceptions other than ModuleExecutionException because they
// have already been logged and we don't want to pollute the log file any further.
// In fact, other exception cannot normally happen.
Throwable th = ex;
while (!(th instanceof ModuleExecutionException)) {
if (th == null) {
// log original exception
log.error("Error executing script: " + script, ex);
success = false;
break;
}
th = th.getCause();
}
} finally {
try {
ScriptMetaData scriptMetaData = scriptMetaDataProvider.get();
Date endDate = new Date();
scriptMetaData.setEndDate(endDate);
ctx.set(JFunkConstants.SCRIPT_END_MILLIS, String.valueOf(endDate.getTime()));
scriptMetaData.setThrowable(throwable);
eventBus.post(new AfterScriptEvent(script.getAbsolutePath(), success));
} finally {
scriptScope.exitScope();
closeQuietly(reader);
}
}
return success;
} | java | public boolean executeScript(final File script, final Properties scriptProperties) {
checkState(script.exists(), "Script file does not exist: %s", script);
checkState(script.canRead(), "Script file is not readable: %s", script);
Reader reader = null;
boolean success = false;
Throwable throwable = null;
scriptScope.enterScope();
ScriptContext ctx = scriptContextProvider.get();
try {
reader = Files.newReader(script, charset);
ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByExtension("groovy");
ctx.setScript(script);
ctx.load(JFunkConstants.SCRIPT_PROPERTIES, false);
ctx.registerReporter(new SimpleReporter());
initGroovyCommands(scriptEngine, ctx);
initScriptProperties(scriptEngine, scriptProperties);
ScriptMetaData scriptMetaData = scriptMetaDataProvider.get();
scriptMetaData.setScriptName(script.getPath());
Date startDate = new Date();
scriptMetaData.setStartDate(startDate);
ctx.set(JFunkConstants.SCRIPT_START_MILLIS, String.valueOf(startDate.getTime()));
eventBus.post(scriptEngine);
eventBus.post(new BeforeScriptEvent(script.getAbsolutePath()));
scriptEngine.eval(reader);
success = true;
} catch (IOException ex) {
throwable = ex;
log.error("Error loading script: " + script, ex);
} catch (ScriptException ex) {
throwable = ex;
// Look up the cause hierarchy if we find a ModuleExecutionException.
// We only need to log exceptions other than ModuleExecutionException because they
// have already been logged and we don't want to pollute the log file any further.
// In fact, other exception cannot normally happen.
Throwable th = ex;
while (!(th instanceof ModuleExecutionException)) {
if (th == null) {
// log original exception
log.error("Error executing script: " + script, ex);
success = false;
break;
}
th = th.getCause();
}
} finally {
try {
ScriptMetaData scriptMetaData = scriptMetaDataProvider.get();
Date endDate = new Date();
scriptMetaData.setEndDate(endDate);
ctx.set(JFunkConstants.SCRIPT_END_MILLIS, String.valueOf(endDate.getTime()));
scriptMetaData.setThrowable(throwable);
eventBus.post(new AfterScriptEvent(script.getAbsolutePath(), success));
} finally {
scriptScope.exitScope();
closeQuietly(reader);
}
}
return success;
} | [
"public",
"boolean",
"executeScript",
"(",
"final",
"File",
"script",
",",
"final",
"Properties",
"scriptProperties",
")",
"{",
"checkState",
"(",
"script",
".",
"exists",
"(",
")",
",",
"\"Script file does not exist: %s\"",
",",
"script",
")",
";",
"checkState",
"(",
"script",
".",
"canRead",
"(",
")",
",",
"\"Script file is not readable: %s\"",
",",
"script",
")",
";",
"Reader",
"reader",
"=",
"null",
";",
"boolean",
"success",
"=",
"false",
";",
"Throwable",
"throwable",
"=",
"null",
";",
"scriptScope",
".",
"enterScope",
"(",
")",
";",
"ScriptContext",
"ctx",
"=",
"scriptContextProvider",
".",
"get",
"(",
")",
";",
"try",
"{",
"reader",
"=",
"Files",
".",
"newReader",
"(",
"script",
",",
"charset",
")",
";",
"ScriptEngine",
"scriptEngine",
"=",
"new",
"ScriptEngineManager",
"(",
")",
".",
"getEngineByExtension",
"(",
"\"groovy\"",
")",
";",
"ctx",
".",
"setScript",
"(",
"script",
")",
";",
"ctx",
".",
"load",
"(",
"JFunkConstants",
".",
"SCRIPT_PROPERTIES",
",",
"false",
")",
";",
"ctx",
".",
"registerReporter",
"(",
"new",
"SimpleReporter",
"(",
")",
")",
";",
"initGroovyCommands",
"(",
"scriptEngine",
",",
"ctx",
")",
";",
"initScriptProperties",
"(",
"scriptEngine",
",",
"scriptProperties",
")",
";",
"ScriptMetaData",
"scriptMetaData",
"=",
"scriptMetaDataProvider",
".",
"get",
"(",
")",
";",
"scriptMetaData",
".",
"setScriptName",
"(",
"script",
".",
"getPath",
"(",
")",
")",
";",
"Date",
"startDate",
"=",
"new",
"Date",
"(",
")",
";",
"scriptMetaData",
".",
"setStartDate",
"(",
"startDate",
")",
";",
"ctx",
".",
"set",
"(",
"JFunkConstants",
".",
"SCRIPT_START_MILLIS",
",",
"String",
".",
"valueOf",
"(",
"startDate",
".",
"getTime",
"(",
")",
")",
")",
";",
"eventBus",
".",
"post",
"(",
"scriptEngine",
")",
";",
"eventBus",
".",
"post",
"(",
"new",
"BeforeScriptEvent",
"(",
"script",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"scriptEngine",
".",
"eval",
"(",
"reader",
")",
";",
"success",
"=",
"true",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throwable",
"=",
"ex",
";",
"log",
".",
"error",
"(",
"\"Error loading script: \"",
"+",
"script",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"ScriptException",
"ex",
")",
"{",
"throwable",
"=",
"ex",
";",
"// Look up the cause hierarchy if we find a ModuleExecutionException.",
"// We only need to log exceptions other than ModuleExecutionException because they",
"// have already been logged and we don't want to pollute the log file any further.",
"// In fact, other exception cannot normally happen.",
"Throwable",
"th",
"=",
"ex",
";",
"while",
"(",
"!",
"(",
"th",
"instanceof",
"ModuleExecutionException",
")",
")",
"{",
"if",
"(",
"th",
"==",
"null",
")",
"{",
"// log original exception",
"log",
".",
"error",
"(",
"\"Error executing script: \"",
"+",
"script",
",",
"ex",
")",
";",
"success",
"=",
"false",
";",
"break",
";",
"}",
"th",
"=",
"th",
".",
"getCause",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"try",
"{",
"ScriptMetaData",
"scriptMetaData",
"=",
"scriptMetaDataProvider",
".",
"get",
"(",
")",
";",
"Date",
"endDate",
"=",
"new",
"Date",
"(",
")",
";",
"scriptMetaData",
".",
"setEndDate",
"(",
"endDate",
")",
";",
"ctx",
".",
"set",
"(",
"JFunkConstants",
".",
"SCRIPT_END_MILLIS",
",",
"String",
".",
"valueOf",
"(",
"endDate",
".",
"getTime",
"(",
")",
")",
")",
";",
"scriptMetaData",
".",
"setThrowable",
"(",
"throwable",
")",
";",
"eventBus",
".",
"post",
"(",
"new",
"AfterScriptEvent",
"(",
"script",
".",
"getAbsolutePath",
"(",
")",
",",
"success",
")",
")",
";",
"}",
"finally",
"{",
"scriptScope",
".",
"exitScope",
"(",
")",
";",
"closeQuietly",
"(",
"reader",
")",
";",
"}",
"}",
"return",
"success",
";",
"}"
] | Executes the specified Groovy script.
@param script
the script file
@param scriptProperties
properties that are set to the script engine's binding and thus will be available
as variables in the Groovy script
@return the execution result, {@code true} if successful, {@code false} code | [
"Executes",
"the",
"specified",
"Groovy",
"script",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptExecutor.java#L92-L159 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.forceFailoverAllowDataLoss | public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) {
"""
Fails over from the current primary managed instance to this managed instance. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the InstanceFailoverGroupInner object if successful.
"""
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body();
} | java | public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) {
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body();
} | [
"public",
"InstanceFailoverGroupInner",
"forceFailoverAllowDataLoss",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"forceFailoverAllowDataLossWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"locationName",
",",
"failoverGroupName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Fails over from the current primary managed instance to this managed instance. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the InstanceFailoverGroupInner object if successful. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"managed",
"instance",
"to",
"this",
"managed",
"instance",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L864-L866 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.checkIsComplexType | public static ComplexType checkIsComplexType(Type type) {
"""
Checks if the specified OData type is a complex type and throws an exception if it is not.
@param type The OData type.
@return The OData type.
@throws ODataSystemException If the OData type is not a complex type.
"""
if (!isComplexType(type)) {
throw new ODataSystemException("A complex type is required, but '" + type.getFullyQualifiedName() +
"' is not a complex type: " + type.getMetaType());
}
return (ComplexType) type;
} | java | public static ComplexType checkIsComplexType(Type type) {
if (!isComplexType(type)) {
throw new ODataSystemException("A complex type is required, but '" + type.getFullyQualifiedName() +
"' is not a complex type: " + type.getMetaType());
}
return (ComplexType) type;
} | [
"public",
"static",
"ComplexType",
"checkIsComplexType",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"!",
"isComplexType",
"(",
"type",
")",
")",
"{",
"throw",
"new",
"ODataSystemException",
"(",
"\"A complex type is required, but '\"",
"+",
"type",
".",
"getFullyQualifiedName",
"(",
")",
"+",
"\"' is not a complex type: \"",
"+",
"type",
".",
"getMetaType",
"(",
")",
")",
";",
"}",
"return",
"(",
"ComplexType",
")",
"type",
";",
"}"
] | Checks if the specified OData type is a complex type and throws an exception if it is not.
@param type The OData type.
@return The OData type.
@throws ODataSystemException If the OData type is not a complex type. | [
"Checks",
"if",
"the",
"specified",
"OData",
"type",
"is",
"a",
"complex",
"type",
"and",
"throws",
"an",
"exception",
"if",
"it",
"is",
"not",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L257-L263 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java | AuditLogUsedEvent.addAccessingParticipant | public void addAccessingParticipant(String userId, String altUserId, String userName, String networkId) {
"""
Adds the Active Participant of the User or System that accessed the log
@param userId The Active Participant's User ID
@param altUserId The Active Participant's Alternate UserID
@param userName The Active Participant's UserName
@param networkId The Active Participant's Network Access Point ID
"""
addActiveParticipant(
userId,
altUserId,
userName,
true,
null,
networkId);
} | java | public void addAccessingParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
true,
null,
networkId);
} | [
"public",
"void",
"addAccessingParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
"userName",
",",
"true",
",",
"null",
",",
"networkId",
")",
";",
"}"
] | Adds the Active Participant of the User or System that accessed the log
@param userId The Active Participant's User ID
@param altUserId The Active Participant's Alternate UserID
@param userName The Active Participant's UserName
@param networkId The Active Participant's Network Access Point ID | [
"Adds",
"the",
"Active",
"Participant",
"of",
"the",
"User",
"or",
"System",
"that",
"accessed",
"the",
"log"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java#L51-L60 |
apache/incubator-gobblin | gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileEncryptor.java | GPGFileEncryptor.encryptFile | public OutputStream encryptFile(OutputStream outputStream, InputStream keyIn, long keyId, String cipher)
throws IOException {
"""
Taking in an input {@link OutputStream}, keyring inputstream and a passPhrase, generate an encrypted {@link OutputStream}.
@param outputStream {@link OutputStream} that will receive the encrypted content
@param keyIn keyring inputstream. This InputStream is owned by the caller.
@param keyId key identifier
@param cipher the symmetric cipher to use for encryption. If null or empty then a default cipher is used.
@return an {@link OutputStream} to write content to for encryption
@throws IOException
"""
try {
if (Security.getProvider(PROVIDER_NAME) == null) {
Security.addProvider(new BouncyCastleProvider());
}
PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(
new JcePGPDataEncryptorBuilder(symmetricKeyAlgorithmNameToTag(cipher))
.setSecureRandom(new SecureRandom())
.setProvider(PROVIDER_NAME));
PGPPublicKey publicKey;
PGPPublicKeyRingCollection keyRings = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(keyIn),
new BcKeyFingerprintCalculator());
publicKey = keyRings.getPublicKey(keyId);
if (publicKey == null) {
throw new IllegalArgumentException("public key for encryption not found");
}
cPk.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(publicKey).setProvider(PROVIDER_NAME));
OutputStream cOut = cPk.open(outputStream, new byte[BUFFER_SIZE]);
PGPLiteralDataGenerator literalGen = new PGPLiteralDataGenerator();
OutputStream _literalOut =
literalGen.open(cOut, PGPLiteralDataGenerator.BINARY, PAYLOAD_NAME, new Date(), new byte[BUFFER_SIZE]);
return new ClosingWrapperOutputStream(_literalOut, cOut, outputStream);
} catch (PGPException e) {
throw new IOException(e);
}
} | java | public OutputStream encryptFile(OutputStream outputStream, InputStream keyIn, long keyId, String cipher)
throws IOException {
try {
if (Security.getProvider(PROVIDER_NAME) == null) {
Security.addProvider(new BouncyCastleProvider());
}
PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(
new JcePGPDataEncryptorBuilder(symmetricKeyAlgorithmNameToTag(cipher))
.setSecureRandom(new SecureRandom())
.setProvider(PROVIDER_NAME));
PGPPublicKey publicKey;
PGPPublicKeyRingCollection keyRings = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(keyIn),
new BcKeyFingerprintCalculator());
publicKey = keyRings.getPublicKey(keyId);
if (publicKey == null) {
throw new IllegalArgumentException("public key for encryption not found");
}
cPk.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(publicKey).setProvider(PROVIDER_NAME));
OutputStream cOut = cPk.open(outputStream, new byte[BUFFER_SIZE]);
PGPLiteralDataGenerator literalGen = new PGPLiteralDataGenerator();
OutputStream _literalOut =
literalGen.open(cOut, PGPLiteralDataGenerator.BINARY, PAYLOAD_NAME, new Date(), new byte[BUFFER_SIZE]);
return new ClosingWrapperOutputStream(_literalOut, cOut, outputStream);
} catch (PGPException e) {
throw new IOException(e);
}
} | [
"public",
"OutputStream",
"encryptFile",
"(",
"OutputStream",
"outputStream",
",",
"InputStream",
"keyIn",
",",
"long",
"keyId",
",",
"String",
"cipher",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"Security",
".",
"getProvider",
"(",
"PROVIDER_NAME",
")",
"==",
"null",
")",
"{",
"Security",
".",
"addProvider",
"(",
"new",
"BouncyCastleProvider",
"(",
")",
")",
";",
"}",
"PGPEncryptedDataGenerator",
"cPk",
"=",
"new",
"PGPEncryptedDataGenerator",
"(",
"new",
"JcePGPDataEncryptorBuilder",
"(",
"symmetricKeyAlgorithmNameToTag",
"(",
"cipher",
")",
")",
".",
"setSecureRandom",
"(",
"new",
"SecureRandom",
"(",
")",
")",
".",
"setProvider",
"(",
"PROVIDER_NAME",
")",
")",
";",
"PGPPublicKey",
"publicKey",
";",
"PGPPublicKeyRingCollection",
"keyRings",
"=",
"new",
"PGPPublicKeyRingCollection",
"(",
"PGPUtil",
".",
"getDecoderStream",
"(",
"keyIn",
")",
",",
"new",
"BcKeyFingerprintCalculator",
"(",
")",
")",
";",
"publicKey",
"=",
"keyRings",
".",
"getPublicKey",
"(",
"keyId",
")",
";",
"if",
"(",
"publicKey",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"public key for encryption not found\"",
")",
";",
"}",
"cPk",
".",
"addMethod",
"(",
"new",
"JcePublicKeyKeyEncryptionMethodGenerator",
"(",
"publicKey",
")",
".",
"setProvider",
"(",
"PROVIDER_NAME",
")",
")",
";",
"OutputStream",
"cOut",
"=",
"cPk",
".",
"open",
"(",
"outputStream",
",",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
")",
";",
"PGPLiteralDataGenerator",
"literalGen",
"=",
"new",
"PGPLiteralDataGenerator",
"(",
")",
";",
"OutputStream",
"_literalOut",
"=",
"literalGen",
".",
"open",
"(",
"cOut",
",",
"PGPLiteralDataGenerator",
".",
"BINARY",
",",
"PAYLOAD_NAME",
",",
"new",
"Date",
"(",
")",
",",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
")",
";",
"return",
"new",
"ClosingWrapperOutputStream",
"(",
"_literalOut",
",",
"cOut",
",",
"outputStream",
")",
";",
"}",
"catch",
"(",
"PGPException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}"
] | Taking in an input {@link OutputStream}, keyring inputstream and a passPhrase, generate an encrypted {@link OutputStream}.
@param outputStream {@link OutputStream} that will receive the encrypted content
@param keyIn keyring inputstream. This InputStream is owned by the caller.
@param keyId key identifier
@param cipher the symmetric cipher to use for encryption. If null or empty then a default cipher is used.
@return an {@link OutputStream} to write content to for encryption
@throws IOException | [
"Taking",
"in",
"an",
"input",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileEncryptor.java#L103-L136 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.createTempFile | public static File createTempFile(File dir, boolean isReCreat) throws IORuntimeException {
"""
创建临时文件<br>
创建后的文件名为 prefix[Randon].tmp
@param dir 临时文件创建的所在目录
@param isReCreat 是否重新创建文件(删掉原来的,创建新的)
@return 临时文件
@throws IORuntimeException IO异常
"""
return createTempFile("hutool", null, dir, isReCreat);
} | java | public static File createTempFile(File dir, boolean isReCreat) throws IORuntimeException {
return createTempFile("hutool", null, dir, isReCreat);
} | [
"public",
"static",
"File",
"createTempFile",
"(",
"File",
"dir",
",",
"boolean",
"isReCreat",
")",
"throws",
"IORuntimeException",
"{",
"return",
"createTempFile",
"(",
"\"hutool\"",
",",
"null",
",",
"dir",
",",
"isReCreat",
")",
";",
"}"
] | 创建临时文件<br>
创建后的文件名为 prefix[Randon].tmp
@param dir 临时文件创建的所在目录
@param isReCreat 是否重新创建文件(删掉原来的,创建新的)
@return 临时文件
@throws IORuntimeException IO异常 | [
"创建临时文件<br",
">",
"创建后的文件名为",
"prefix",
"[",
"Randon",
"]",
".",
"tmp"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L882-L884 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/PasswordImpl.java | PasswordImpl.readFromXML | public static Password readFromXML(Element el, String salt, boolean isDefault) {
"""
reads the password defined in the Lucee configuration, this can also in older formats (only
hashed or encrypted)
@param el
@param salt
@param isDefault
@return
"""
String prefix = isDefault ? "default-" : "";
// first we look for the hashed and salted password
String pw = el.getAttribute(prefix + "hspw");
if (!StringUtil.isEmpty(pw, true)) {
// password is only of use when there is a salt as well
if (salt == null) return null;
return new PasswordImpl(ORIGIN_HASHED_SALTED, pw, salt, HASHED_SALTED);
}
// fall back to password that is hashed but not salted
pw = el.getAttribute(prefix + "pw");
if (!StringUtil.isEmpty(pw, true)) {
return new PasswordImpl(ORIGIN_HASHED, pw, null, HASHED);
}
// fall back to encrypted password
String pwEnc = el.getAttribute(prefix + "password");
if (!StringUtil.isEmpty(pwEnc, true)) {
String rawPassword = new BlowfishEasy("tpwisgh").decryptString(pwEnc);
return new PasswordImpl(ORIGIN_ENCRYPTED, rawPassword, salt);
}
return null;
} | java | public static Password readFromXML(Element el, String salt, boolean isDefault) {
String prefix = isDefault ? "default-" : "";
// first we look for the hashed and salted password
String pw = el.getAttribute(prefix + "hspw");
if (!StringUtil.isEmpty(pw, true)) {
// password is only of use when there is a salt as well
if (salt == null) return null;
return new PasswordImpl(ORIGIN_HASHED_SALTED, pw, salt, HASHED_SALTED);
}
// fall back to password that is hashed but not salted
pw = el.getAttribute(prefix + "pw");
if (!StringUtil.isEmpty(pw, true)) {
return new PasswordImpl(ORIGIN_HASHED, pw, null, HASHED);
}
// fall back to encrypted password
String pwEnc = el.getAttribute(prefix + "password");
if (!StringUtil.isEmpty(pwEnc, true)) {
String rawPassword = new BlowfishEasy("tpwisgh").decryptString(pwEnc);
return new PasswordImpl(ORIGIN_ENCRYPTED, rawPassword, salt);
}
return null;
} | [
"public",
"static",
"Password",
"readFromXML",
"(",
"Element",
"el",
",",
"String",
"salt",
",",
"boolean",
"isDefault",
")",
"{",
"String",
"prefix",
"=",
"isDefault",
"?",
"\"default-\"",
":",
"\"\"",
";",
"// first we look for the hashed and salted password",
"String",
"pw",
"=",
"el",
".",
"getAttribute",
"(",
"prefix",
"+",
"\"hspw\"",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"pw",
",",
"true",
")",
")",
"{",
"// password is only of use when there is a salt as well",
"if",
"(",
"salt",
"==",
"null",
")",
"return",
"null",
";",
"return",
"new",
"PasswordImpl",
"(",
"ORIGIN_HASHED_SALTED",
",",
"pw",
",",
"salt",
",",
"HASHED_SALTED",
")",
";",
"}",
"// fall back to password that is hashed but not salted",
"pw",
"=",
"el",
".",
"getAttribute",
"(",
"prefix",
"+",
"\"pw\"",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"pw",
",",
"true",
")",
")",
"{",
"return",
"new",
"PasswordImpl",
"(",
"ORIGIN_HASHED",
",",
"pw",
",",
"null",
",",
"HASHED",
")",
";",
"}",
"// fall back to encrypted password",
"String",
"pwEnc",
"=",
"el",
".",
"getAttribute",
"(",
"prefix",
"+",
"\"password\"",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"pwEnc",
",",
"true",
")",
")",
"{",
"String",
"rawPassword",
"=",
"new",
"BlowfishEasy",
"(",
"\"tpwisgh\"",
")",
".",
"decryptString",
"(",
"pwEnc",
")",
";",
"return",
"new",
"PasswordImpl",
"(",
"ORIGIN_ENCRYPTED",
",",
"rawPassword",
",",
"salt",
")",
";",
"}",
"return",
"null",
";",
"}"
] | reads the password defined in the Lucee configuration, this can also in older formats (only
hashed or encrypted)
@param el
@param salt
@param isDefault
@return | [
"reads",
"the",
"password",
"defined",
"in",
"the",
"Lucee",
"configuration",
"this",
"can",
"also",
"in",
"older",
"formats",
"(",
"only",
"hashed",
"or",
"encrypted",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/PasswordImpl.java#L135-L159 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java | Constraints.gt | public PropertyConstraint gt(String propertyName, Comparable propertyValue) {
"""
Apply a "greater than" constraint to a bean property.
@param propertyName The first property
@param propertyValue The constraint value
@return The constraint
"""
return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue));
} | java | public PropertyConstraint gt(String propertyName, Comparable propertyValue) {
return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue));
} | [
"public",
"PropertyConstraint",
"gt",
"(",
"String",
"propertyName",
",",
"Comparable",
"propertyValue",
")",
"{",
"return",
"new",
"ParameterizedPropertyConstraint",
"(",
"propertyName",
",",
"gt",
"(",
"propertyValue",
")",
")",
";",
"}"
] | Apply a "greater than" constraint to a bean property.
@param propertyName The first property
@param propertyValue The constraint value
@return The constraint | [
"Apply",
"a",
"greater",
"than",
"constraint",
"to",
"a",
"bean",
"property",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L691-L693 |
kiegroup/droolsjbpm-integration | kie-camel/src/main/java/org/kie/camel/embedded/component/FastCloner.java | FastCloner.shallowClone | public <T> T shallowClone(final T o) {
"""
shallow clones "o". This means that if c=shallowClone(o) then c!=o. Any change to c won't affect o.
@param <T>
the type of o
@param o
the object to be shallow-cloned
@return a shallow clone of "o"
"""
if (o == null) {
return null;
}
if (!this.cloningEnabled) {
return o;
}
try {
return cloneInternal(o, null);
} catch (final IllegalAccessException e) {
throw new RuntimeException("error during cloning of " + o, e);
}
} | java | public <T> T shallowClone(final T o) {
if (o == null) {
return null;
}
if (!this.cloningEnabled) {
return o;
}
try {
return cloneInternal(o, null);
} catch (final IllegalAccessException e) {
throw new RuntimeException("error during cloning of " + o, e);
}
} | [
"public",
"<",
"T",
">",
"T",
"shallowClone",
"(",
"final",
"T",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"this",
".",
"cloningEnabled",
")",
"{",
"return",
"o",
";",
"}",
"try",
"{",
"return",
"cloneInternal",
"(",
"o",
",",
"null",
")",
";",
"}",
"catch",
"(",
"final",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"error during cloning of \"",
"+",
"o",
",",
"e",
")",
";",
"}",
"}"
] | shallow clones "o". This means that if c=shallowClone(o) then c!=o. Any change to c won't affect o.
@param <T>
the type of o
@param o
the object to be shallow-cloned
@return a shallow clone of "o" | [
"shallow",
"clones",
"o",
".",
"This",
"means",
"that",
"if",
"c",
"=",
"shallowClone",
"(",
"o",
")",
"then",
"c!",
"=",
"o",
".",
"Any",
"change",
"to",
"c",
"won",
"t",
"affect",
"o",
"."
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-camel/src/main/java/org/kie/camel/embedded/component/FastCloner.java#L266-L278 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | GenericEncodingStrategy.getLobLocator | private void getLobLocator(CodeAssembler a, StorablePropertyInfo info) {
"""
Generates code to get a Lob locator value from RawSupport. RawSupport
instance and Lob instance must be on the stack. Result is a long locator
value on the stack.
"""
if (!info.isLob()) {
throw new IllegalArgumentException();
}
a.invokeInterface(TypeDesc.forClass(RawSupport.class), "getLocator",
TypeDesc.LONG, new TypeDesc[] {info.getStorageType()});
} | java | private void getLobLocator(CodeAssembler a, StorablePropertyInfo info) {
if (!info.isLob()) {
throw new IllegalArgumentException();
}
a.invokeInterface(TypeDesc.forClass(RawSupport.class), "getLocator",
TypeDesc.LONG, new TypeDesc[] {info.getStorageType()});
} | [
"private",
"void",
"getLobLocator",
"(",
"CodeAssembler",
"a",
",",
"StorablePropertyInfo",
"info",
")",
"{",
"if",
"(",
"!",
"info",
".",
"isLob",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"a",
".",
"invokeInterface",
"(",
"TypeDesc",
".",
"forClass",
"(",
"RawSupport",
".",
"class",
")",
",",
"\"getLocator\"",
",",
"TypeDesc",
".",
"LONG",
",",
"new",
"TypeDesc",
"[",
"]",
"{",
"info",
".",
"getStorageType",
"(",
")",
"}",
")",
";",
"}"
] | Generates code to get a Lob locator value from RawSupport. RawSupport
instance and Lob instance must be on the stack. Result is a long locator
value on the stack. | [
"Generates",
"code",
"to",
"get",
"a",
"Lob",
"locator",
"value",
"from",
"RawSupport",
".",
"RawSupport",
"instance",
"and",
"Lob",
"instance",
"must",
"be",
"on",
"the",
"stack",
".",
"Result",
"is",
"a",
"long",
"locator",
"value",
"on",
"the",
"stack",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java#L1795-L1801 |
cdk/cdk | descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/AtomPairs2DFingerprinter.java | AtomPairs2DFingerprinter.encodePath | private static String encodePath(int dist, IAtom a, IAtom b) {
"""
Creates the fingerprint name which is used as a key in our hashes
@param dist
@param a
@param b
@return
"""
return dist + "_" + a.getSymbol() + "_" + b.getSymbol();
} | java | private static String encodePath(int dist, IAtom a, IAtom b) {
return dist + "_" + a.getSymbol() + "_" + b.getSymbol();
} | [
"private",
"static",
"String",
"encodePath",
"(",
"int",
"dist",
",",
"IAtom",
"a",
",",
"IAtom",
"b",
")",
"{",
"return",
"dist",
"+",
"\"_\"",
"+",
"a",
".",
"getSymbol",
"(",
")",
"+",
"\"_\"",
"+",
"b",
".",
"getSymbol",
"(",
")",
";",
"}"
] | Creates the fingerprint name which is used as a key in our hashes
@param dist
@param a
@param b
@return | [
"Creates",
"the",
"fingerprint",
"name",
"which",
"is",
"used",
"as",
"a",
"key",
"in",
"our",
"hashes"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/AtomPairs2DFingerprinter.java#L114-L116 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.internalReleaseLeaseOne | void internalReleaseLeaseOne(Lease lease, String src) throws IOException {
"""
Move a file that is being written to be immutable.
@param src The filename
@param lease The lease for the client creating the file
"""
internalReleaseLeaseOne(lease, src, false);
} | java | void internalReleaseLeaseOne(Lease lease, String src) throws IOException {
internalReleaseLeaseOne(lease, src, false);
} | [
"void",
"internalReleaseLeaseOne",
"(",
"Lease",
"lease",
",",
"String",
"src",
")",
"throws",
"IOException",
"{",
"internalReleaseLeaseOne",
"(",
"lease",
",",
"src",
",",
"false",
")",
";",
"}"
] | Move a file that is being written to be immutable.
@param src The filename
@param lease The lease for the client creating the file | [
"Move",
"a",
"file",
"that",
"is",
"being",
"written",
"to",
"be",
"immutable",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4160-L4162 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java | KeyTable.addValueInRefsTable | private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) {
"""
Add an association between a ref and a node in the m_refsTable.
Requires that m_refsTable != null
@param xctxt XPath context
@param ref the value of the use clause of the current key for the given node
@param node the node to reference
"""
XNodeSet nodes = (XNodeSet) m_refsTable.get(ref);
if (nodes == null)
{
nodes = new XNodeSet(node, xctxt.getDTMManager());
nodes.nextNode();
m_refsTable.put(ref, nodes);
}
else
{
// Nodes are passed to this method in document order. Since we need to
// suppress duplicates, we only need to check against the last entry
// in each nodeset. We use nodes.nextNode after each entry so we can
// easily compare node against the current node.
if (nodes.getCurrentNode() != node) {
nodes.mutableNodeset().addNode(node);
nodes.nextNode();
}
}
} | java | private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) {
XNodeSet nodes = (XNodeSet) m_refsTable.get(ref);
if (nodes == null)
{
nodes = new XNodeSet(node, xctxt.getDTMManager());
nodes.nextNode();
m_refsTable.put(ref, nodes);
}
else
{
// Nodes are passed to this method in document order. Since we need to
// suppress duplicates, we only need to check against the last entry
// in each nodeset. We use nodes.nextNode after each entry so we can
// easily compare node against the current node.
if (nodes.getCurrentNode() != node) {
nodes.mutableNodeset().addNode(node);
nodes.nextNode();
}
}
} | [
"private",
"void",
"addValueInRefsTable",
"(",
"XPathContext",
"xctxt",
",",
"XMLString",
"ref",
",",
"int",
"node",
")",
"{",
"XNodeSet",
"nodes",
"=",
"(",
"XNodeSet",
")",
"m_refsTable",
".",
"get",
"(",
"ref",
")",
";",
"if",
"(",
"nodes",
"==",
"null",
")",
"{",
"nodes",
"=",
"new",
"XNodeSet",
"(",
"node",
",",
"xctxt",
".",
"getDTMManager",
"(",
")",
")",
";",
"nodes",
".",
"nextNode",
"(",
")",
";",
"m_refsTable",
".",
"put",
"(",
"ref",
",",
"nodes",
")",
";",
"}",
"else",
"{",
"// Nodes are passed to this method in document order. Since we need to",
"// suppress duplicates, we only need to check against the last entry",
"// in each nodeset. We use nodes.nextNode after each entry so we can",
"// easily compare node against the current node.",
"if",
"(",
"nodes",
".",
"getCurrentNode",
"(",
")",
"!=",
"node",
")",
"{",
"nodes",
".",
"mutableNodeset",
"(",
")",
".",
"addNode",
"(",
"node",
")",
";",
"nodes",
".",
"nextNode",
"(",
")",
";",
"}",
"}",
"}"
] | Add an association between a ref and a node in the m_refsTable.
Requires that m_refsTable != null
@param xctxt XPath context
@param ref the value of the use clause of the current key for the given node
@param node the node to reference | [
"Add",
"an",
"association",
"between",
"a",
"ref",
"and",
"a",
"node",
"in",
"the",
"m_refsTable",
".",
"Requires",
"that",
"m_refsTable",
"!",
"=",
"null"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java#L239-L259 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.redirectWith | protected HtmlResponse redirectWith(Class<?> actionType, UrlChain moreUrl_or_params) {
"""
Redirect to the action with the more URL parts and the the parameters on GET.
<pre>
<span style="color: #3F7E5E">// e.g. /member/edit/3/ *same as redirectById()</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3 *same as redirectByParam()</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/</span>
return redirectWith(MemberAction.class, <span style="color: #FD4747">moreUrl</span>("edit", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/#profile</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId).<span style="color: #FD4747">hash</span>("profile"));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3#profile</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId).<span style="color: #FD4747">hash</span>("profile"));
</pre>
@param actionType The class type of action that it redirects to. (NotNull)
@param moreUrl_or_params The chain of URL. (NotNull)
@return The HTML response for redirect containing GET parameters. (NotNull)
"""
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("moreUrl_or_params", moreUrl_or_params);
return doRedirect(actionType, moreUrl_or_params);
} | java | protected HtmlResponse redirectWith(Class<?> actionType, UrlChain moreUrl_or_params) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("moreUrl_or_params", moreUrl_or_params);
return doRedirect(actionType, moreUrl_or_params);
} | [
"protected",
"HtmlResponse",
"redirectWith",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"UrlChain",
"moreUrl_or_params",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"moreUrl_or_params\"",
",",
"moreUrl_or_params",
")",
";",
"return",
"doRedirect",
"(",
"actionType",
",",
"moreUrl_or_params",
")",
";",
"}"
] | Redirect to the action with the more URL parts and the the parameters on GET.
<pre>
<span style="color: #3F7E5E">// e.g. /member/edit/3/ *same as redirectById()</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3 *same as redirectByParam()</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/</span>
return redirectWith(MemberAction.class, <span style="color: #FD4747">moreUrl</span>("edit", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/#profile</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId).<span style="color: #FD4747">hash</span>("profile"));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3#profile</span>
return redirectWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId).<span style="color: #FD4747">hash</span>("profile"));
</pre>
@param actionType The class type of action that it redirects to. (NotNull)
@param moreUrl_or_params The chain of URL. (NotNull)
@return The HTML response for redirect containing GET parameters. (NotNull) | [
"Redirect",
"to",
"the",
"action",
"with",
"the",
"more",
"URL",
"parts",
"and",
"the",
"the",
"parameters",
"on",
"GET",
".",
"<pre",
">",
"<span",
"style",
"=",
"color",
":",
"#3F7E5E",
">",
"//",
"e",
".",
"g",
".",
"/",
"member",
"/",
"edit",
"/",
"3",
"/",
"*",
"same",
"as",
"redirectById",
"()",
"<",
"/",
"span",
">",
"return",
"redirectWith",
"(",
"MemberEditAction",
".",
"class",
"<span",
"style",
"=",
"color",
":",
"#FD4747",
">",
"moreUrl<",
"/",
"span",
">",
"(",
"memberId",
"))",
";"
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L334-L338 |
ModeShape/modeshape | index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java | CompareNameQuery.createQueryForNodesWithNameEqualTo | public static Query createQueryForNodesWithNameEqualTo( Name constraintValue,
String fieldName,
ValueFactories factories,
Function<String, String> caseOperation) {
"""
Construct a {@link Query} implementation that scores documents such that the node represented by the document has a name
that is greater than the supplied constraint name.
@param constraintValue the constraint value; may not be null
@param fieldName the name of the document field containing the name value; may not be null
@param factories the value factories that can be used during the scoring; may not be null
@param caseOperation the operation that should be performed on the indexed values before the constraint value is being
evaluated; may be null which indicates that no case conversion should be done
@return the query; never null
"""
return new CompareNameQuery(fieldName, constraintValue, factories.getNameFactory(),
Objects::equals, caseOperation);
} | java | public static Query createQueryForNodesWithNameEqualTo( Name constraintValue,
String fieldName,
ValueFactories factories,
Function<String, String> caseOperation) {
return new CompareNameQuery(fieldName, constraintValue, factories.getNameFactory(),
Objects::equals, caseOperation);
} | [
"public",
"static",
"Query",
"createQueryForNodesWithNameEqualTo",
"(",
"Name",
"constraintValue",
",",
"String",
"fieldName",
",",
"ValueFactories",
"factories",
",",
"Function",
"<",
"String",
",",
"String",
">",
"caseOperation",
")",
"{",
"return",
"new",
"CompareNameQuery",
"(",
"fieldName",
",",
"constraintValue",
",",
"factories",
".",
"getNameFactory",
"(",
")",
",",
"Objects",
"::",
"equals",
",",
"caseOperation",
")",
";",
"}"
] | Construct a {@link Query} implementation that scores documents such that the node represented by the document has a name
that is greater than the supplied constraint name.
@param constraintValue the constraint value; may not be null
@param fieldName the name of the document field containing the name value; may not be null
@param factories the value factories that can be used during the scoring; may not be null
@param caseOperation the operation that should be performed on the indexed values before the constraint value is being
evaluated; may be null which indicates that no case conversion should be done
@return the query; never null | [
"Construct",
"a",
"{",
"@link",
"Query",
"}",
"implementation",
"that",
"scores",
"documents",
"such",
"that",
"the",
"node",
"represented",
"by",
"the",
"document",
"has",
"a",
"name",
"that",
"is",
"greater",
"than",
"the",
"supplied",
"constraint",
"name",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java#L83-L89 |
bwkimmel/jdcp | jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java | JobStatus.withProgress | public JobStatus withProgress(double newProgress) {
"""
Creates a copy of this <code>JobStatus</code> with the progress set to
the specified value.
@param newProgress The progress toward completion (complete = 1.0). If
equal to <code>Double.NaN</code>, the progress is indeterminant.
@return A copy of this <code>JobStatus</code> with the progress set to
the specified value.
"""
return new JobStatus(jobId, description, state, newProgress, status, eventId);
} | java | public JobStatus withProgress(double newProgress) {
return new JobStatus(jobId, description, state, newProgress, status, eventId);
} | [
"public",
"JobStatus",
"withProgress",
"(",
"double",
"newProgress",
")",
"{",
"return",
"new",
"JobStatus",
"(",
"jobId",
",",
"description",
",",
"state",
",",
"newProgress",
",",
"status",
",",
"eventId",
")",
";",
"}"
] | Creates a copy of this <code>JobStatus</code> with the progress set to
the specified value.
@param newProgress The progress toward completion (complete = 1.0). If
equal to <code>Double.NaN</code>, the progress is indeterminant.
@return A copy of this <code>JobStatus</code> with the progress set to
the specified value. | [
"Creates",
"a",
"copy",
"of",
"this",
"<code",
">",
"JobStatus<",
"/",
"code",
">",
"with",
"the",
"progress",
"set",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L122-L124 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Interval.java | Interval.withDates | public Interval withDates(LocalDateTime startDateTime, LocalDateTime endDateTime) {
"""
Returns a new interval based on this interval but with a different start
and end date.
@param startDateTime the new start date
@param endDateTime the new end date
@return a new interval
"""
requireNonNull(startDateTime);
requireNonNull(endDateTime);
return new Interval(startDateTime, endDateTime, this.zoneId);
} | java | public Interval withDates(LocalDateTime startDateTime, LocalDateTime endDateTime) {
requireNonNull(startDateTime);
requireNonNull(endDateTime);
return new Interval(startDateTime, endDateTime, this.zoneId);
} | [
"public",
"Interval",
"withDates",
"(",
"LocalDateTime",
"startDateTime",
",",
"LocalDateTime",
"endDateTime",
")",
"{",
"requireNonNull",
"(",
"startDateTime",
")",
";",
"requireNonNull",
"(",
"endDateTime",
")",
";",
"return",
"new",
"Interval",
"(",
"startDateTime",
",",
"endDateTime",
",",
"this",
".",
"zoneId",
")",
";",
"}"
] | Returns a new interval based on this interval but with a different start
and end date.
@param startDateTime the new start date
@param endDateTime the new end date
@return a new interval | [
"Returns",
"a",
"new",
"interval",
"based",
"on",
"this",
"interval",
"but",
"with",
"a",
"different",
"start",
"and",
"end",
"date",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Interval.java#L292-L296 |
mpetazzoni/ttorrent | common/src/main/java/com/turn/ttorrent/common/TorrentCreator.java | TorrentCreator.hashFile | private static String hashFile(final File file, final int pieceSize)
throws InterruptedException, IOException {
"""
Return the concatenation of the SHA-1 hashes of a file's pieces.
<p>
Hashes the given file piece by piece using the default Torrent piece
length (see {@link #DEFAULT_PIECE_LENGTH}) and returns the concatenation of
these hashes, as a string.
</p>
<p>
This is used for creating Torrent meta-info structures from a file.
</p>
@param file The file to hash.
"""
return hashFiles(Collections.singletonList(file), pieceSize);
} | java | private static String hashFile(final File file, final int pieceSize)
throws InterruptedException, IOException {
return hashFiles(Collections.singletonList(file), pieceSize);
} | [
"private",
"static",
"String",
"hashFile",
"(",
"final",
"File",
"file",
",",
"final",
"int",
"pieceSize",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"return",
"hashFiles",
"(",
"Collections",
".",
"singletonList",
"(",
"file",
")",
",",
"pieceSize",
")",
";",
"}"
] | Return the concatenation of the SHA-1 hashes of a file's pieces.
<p>
Hashes the given file piece by piece using the default Torrent piece
length (see {@link #DEFAULT_PIECE_LENGTH}) and returns the concatenation of
these hashes, as a string.
</p>
<p>
This is used for creating Torrent meta-info structures from a file.
</p>
@param file The file to hash. | [
"Return",
"the",
"concatenation",
"of",
"the",
"SHA",
"-",
"1",
"hashes",
"of",
"a",
"file",
"s",
"pieces",
"."
] | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/common/src/main/java/com/turn/ttorrent/common/TorrentCreator.java#L252-L255 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java | ProjectiveDependencyParser.insideOutsideSingleRoot | public static DepIoChart insideOutsideSingleRoot(double[] fracRoot, double[][] fracChild) {
"""
Runs the inside-outside algorithm for dependency parsing.
@param fracRoot Input: The edge weights from the wall to each child.
@param fracChild Input: The edge weights from parent to child.
@return The parse chart.
"""
final boolean singleRoot = true;
return insideOutside(fracRoot, fracChild, singleRoot);
} | java | public static DepIoChart insideOutsideSingleRoot(double[] fracRoot, double[][] fracChild) {
final boolean singleRoot = true;
return insideOutside(fracRoot, fracChild, singleRoot);
} | [
"public",
"static",
"DepIoChart",
"insideOutsideSingleRoot",
"(",
"double",
"[",
"]",
"fracRoot",
",",
"double",
"[",
"]",
"[",
"]",
"fracChild",
")",
"{",
"final",
"boolean",
"singleRoot",
"=",
"true",
";",
"return",
"insideOutside",
"(",
"fracRoot",
",",
"fracChild",
",",
"singleRoot",
")",
";",
"}"
] | Runs the inside-outside algorithm for dependency parsing.
@param fracRoot Input: The edge weights from the wall to each child.
@param fracChild Input: The edge weights from parent to child.
@return The parse chart. | [
"Runs",
"the",
"inside",
"-",
"outside",
"algorithm",
"for",
"dependency",
"parsing",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java#L113-L116 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java | HistoryCleanupHelper.isWithinBatchWindow | public static boolean isWithinBatchWindow(Date date, ProcessEngineConfigurationImpl configuration) {
"""
Checks if given date is within a batch window. Batch window start time is checked inclusively.
@param date
@return
"""
if (configuration.getBatchWindowManager().isBatchWindowConfigured(configuration)) {
BatchWindow batchWindow = configuration.getBatchWindowManager().getCurrentOrNextBatchWindow(date, configuration);
if (batchWindow == null) {
return false;
}
return batchWindow.isWithin(date);
} else {
return false;
}
} | java | public static boolean isWithinBatchWindow(Date date, ProcessEngineConfigurationImpl configuration) {
if (configuration.getBatchWindowManager().isBatchWindowConfigured(configuration)) {
BatchWindow batchWindow = configuration.getBatchWindowManager().getCurrentOrNextBatchWindow(date, configuration);
if (batchWindow == null) {
return false;
}
return batchWindow.isWithin(date);
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"isWithinBatchWindow",
"(",
"Date",
"date",
",",
"ProcessEngineConfigurationImpl",
"configuration",
")",
"{",
"if",
"(",
"configuration",
".",
"getBatchWindowManager",
"(",
")",
".",
"isBatchWindowConfigured",
"(",
"configuration",
")",
")",
"{",
"BatchWindow",
"batchWindow",
"=",
"configuration",
".",
"getBatchWindowManager",
"(",
")",
".",
"getCurrentOrNextBatchWindow",
"(",
"date",
",",
"configuration",
")",
";",
"if",
"(",
"batchWindow",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"batchWindow",
".",
"isWithin",
"(",
"date",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Checks if given date is within a batch window. Batch window start time is checked inclusively.
@param date
@return | [
"Checks",
"if",
"given",
"date",
"is",
"within",
"a",
"batch",
"window",
".",
"Batch",
"window",
"start",
"time",
"is",
"checked",
"inclusively",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java#L45-L55 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java | ModelRegistry.dateFormat | void dateFormat(DateFormat format, String... attributes) {
"""
Registers date converters (Date -> String -> java.sql.Date) for specified model attributes.
"""
convertWith(new DateToStringConverter(format), attributes);
convertWith(new StringToSqlDateConverter(format), attributes);
} | java | void dateFormat(DateFormat format, String... attributes) {
convertWith(new DateToStringConverter(format), attributes);
convertWith(new StringToSqlDateConverter(format), attributes);
} | [
"void",
"dateFormat",
"(",
"DateFormat",
"format",
",",
"String",
"...",
"attributes",
")",
"{",
"convertWith",
"(",
"new",
"DateToStringConverter",
"(",
"format",
")",
",",
"attributes",
")",
";",
"convertWith",
"(",
"new",
"StringToSqlDateConverter",
"(",
"format",
")",
",",
"attributes",
")",
";",
"}"
] | Registers date converters (Date -> String -> java.sql.Date) for specified model attributes. | [
"Registers",
"date",
"converters",
"(",
"Date",
"-",
">",
"String",
"-",
">",
"java",
".",
"sql",
".",
"Date",
")",
"for",
"specified",
"model",
"attributes",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java#L65-L68 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WToggleButtonRenderer.java | WToggleButtonRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
"""
Paints the given WCheckBox.
@param component the WCheckBox to paint.
@param renderContext the RenderContext to paint to.
"""
WToggleButton toggle = (WToggleButton) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = toggle.isReadOnly();
xml.appendTagOpen("ui:togglebutton");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", toggle.isHidden(), "true");
xml.appendOptionalAttribute("selected", toggle.isSelected(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
WComponentGroup<WCheckBox> group = toggle.getGroup();
String groupName = group == null ? null : group.getId();
xml.appendOptionalAttribute("groupName", groupName);
xml.appendOptionalAttribute("disabled", toggle.isDisabled(), "true");
xml.appendOptionalAttribute("submitOnChange", toggle.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", toggle.getToolTip());
xml.appendOptionalAttribute("accessibleText", toggle.getAccessibleText());
}
xml.appendClose();
String text = toggle.getText();
if (text != null) {
xml.appendEscaped(text);
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(toggle, renderContext);
}
xml.appendEndTag("ui:togglebutton");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WToggleButton toggle = (WToggleButton) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = toggle.isReadOnly();
xml.appendTagOpen("ui:togglebutton");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", toggle.isHidden(), "true");
xml.appendOptionalAttribute("selected", toggle.isSelected(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
WComponentGroup<WCheckBox> group = toggle.getGroup();
String groupName = group == null ? null : group.getId();
xml.appendOptionalAttribute("groupName", groupName);
xml.appendOptionalAttribute("disabled", toggle.isDisabled(), "true");
xml.appendOptionalAttribute("submitOnChange", toggle.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", toggle.getToolTip());
xml.appendOptionalAttribute("accessibleText", toggle.getAccessibleText());
}
xml.appendClose();
String text = toggle.getText();
if (text != null) {
xml.appendEscaped(text);
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(toggle, renderContext);
}
xml.appendEndTag("ui:togglebutton");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WToggleButton",
"toggle",
"=",
"(",
"WToggleButton",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"boolean",
"readOnly",
"=",
"toggle",
".",
"isReadOnly",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:togglebutton\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"toggle",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"selected\"",
",",
"toggle",
".",
"isSelected",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"readOnly",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"readOnly\"",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"WComponentGroup",
"<",
"WCheckBox",
">",
"group",
"=",
"toggle",
".",
"getGroup",
"(",
")",
";",
"String",
"groupName",
"=",
"group",
"==",
"null",
"?",
"null",
":",
"group",
".",
"getId",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"groupName\"",
",",
"groupName",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"toggle",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"submitOnChange\"",
",",
"toggle",
".",
"isSubmitOnChange",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toolTip\"",
",",
"toggle",
".",
"getToolTip",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"accessibleText\"",
",",
"toggle",
".",
"getAccessibleText",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"String",
"text",
"=",
"toggle",
".",
"getText",
"(",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"xml",
".",
"appendEscaped",
"(",
"text",
")",
";",
"}",
"if",
"(",
"!",
"readOnly",
")",
"{",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"toggle",
",",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:togglebutton\"",
")",
";",
"}"
] | Paints the given WCheckBox.
@param component the WCheckBox to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WCheckBox",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WToggleButtonRenderer.java#L25-L58 |
apache/incubator-atlas | client/src/main/java/org/apache/atlas/AtlasClientV2.java | AtlasClientV2.getAllTypeDefs | public AtlasTypesDef getAllTypeDefs(SearchFilter searchFilter) throws AtlasServiceException {
"""
Bulk retrieval API for retrieving all type definitions in Atlas
@return A composite wrapper object with lists of all type definitions
"""
return callAPI(GET_ALL_TYPE_DEFS, AtlasTypesDef.class, searchFilter.getParams());
} | java | public AtlasTypesDef getAllTypeDefs(SearchFilter searchFilter) throws AtlasServiceException {
return callAPI(GET_ALL_TYPE_DEFS, AtlasTypesDef.class, searchFilter.getParams());
} | [
"public",
"AtlasTypesDef",
"getAllTypeDefs",
"(",
"SearchFilter",
"searchFilter",
")",
"throws",
"AtlasServiceException",
"{",
"return",
"callAPI",
"(",
"GET_ALL_TYPE_DEFS",
",",
"AtlasTypesDef",
".",
"class",
",",
"searchFilter",
".",
"getParams",
"(",
")",
")",
";",
"}"
] | Bulk retrieval API for retrieving all type definitions in Atlas
@return A composite wrapper object with lists of all type definitions | [
"Bulk",
"retrieval",
"API",
"for",
"retrieving",
"all",
"type",
"definitions",
"in",
"Atlas"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClientV2.java#L157-L159 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java | AzureFirewallsInner.createOrUpdateAsync | public Observable<AzureFirewallInner> createOrUpdateAsync(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) {
"""
Creates or updates the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@param parameters Parameters supplied to the create or update Azure Firewall operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, azureFirewallName, parameters).map(new Func1<ServiceResponse<AzureFirewallInner>, AzureFirewallInner>() {
@Override
public AzureFirewallInner call(ServiceResponse<AzureFirewallInner> response) {
return response.body();
}
});
} | java | public Observable<AzureFirewallInner> createOrUpdateAsync(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, azureFirewallName, parameters).map(new Func1<ServiceResponse<AzureFirewallInner>, AzureFirewallInner>() {
@Override
public AzureFirewallInner call(ServiceResponse<AzureFirewallInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AzureFirewallInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"azureFirewallName",
",",
"AzureFirewallInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"azureFirewallName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"AzureFirewallInner",
">",
",",
"AzureFirewallInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"AzureFirewallInner",
"call",
"(",
"ServiceResponse",
"<",
"AzureFirewallInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates or updates the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@param parameters Parameters supplied to the create or update Azure Firewall operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"the",
"specified",
"Azure",
"Firewall",
"."
] | 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/AzureFirewallsInner.java#L378-L385 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java | OrphanedDOMNode.visitCode | @Override
public void visitCode(Code obj) {
"""
implements the visitor to clear the opcode stack for the next code
@param obj
the context object for the currently parsed code block
"""
stack.resetForMethodEntry(this);
nodeCreations.clear();
nodeStores.clear();
super.visitCode(obj);
BitSet reportedPCs = new BitSet();
for (Integer pc : nodeCreations.values()) {
if (!reportedPCs.get(pc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, pc.intValue()));
reportedPCs.set(pc.intValue());
}
}
for (Integer pc : nodeStores.values()) {
if (!reportedPCs.get(pc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, pc.intValue()));
reportedPCs.set(pc.intValue());
}
}
} | java | @Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
nodeCreations.clear();
nodeStores.clear();
super.visitCode(obj);
BitSet reportedPCs = new BitSet();
for (Integer pc : nodeCreations.values()) {
if (!reportedPCs.get(pc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, pc.intValue()));
reportedPCs.set(pc.intValue());
}
}
for (Integer pc : nodeStores.values()) {
if (!reportedPCs.get(pc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, pc.intValue()));
reportedPCs.set(pc.intValue());
}
}
} | [
"@",
"Override",
"public",
"void",
"visitCode",
"(",
"Code",
"obj",
")",
"{",
"stack",
".",
"resetForMethodEntry",
"(",
"this",
")",
";",
"nodeCreations",
".",
"clear",
"(",
")",
";",
"nodeStores",
".",
"clear",
"(",
")",
";",
"super",
".",
"visitCode",
"(",
"obj",
")",
";",
"BitSet",
"reportedPCs",
"=",
"new",
"BitSet",
"(",
")",
";",
"for",
"(",
"Integer",
"pc",
":",
"nodeCreations",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"reportedPCs",
".",
"get",
"(",
"pc",
".",
"intValue",
"(",
")",
")",
")",
"{",
"bugReporter",
".",
"reportBug",
"(",
"new",
"BugInstance",
"(",
"this",
",",
"BugType",
".",
"ODN_ORPHANED_DOM_NODE",
".",
"name",
"(",
")",
",",
"NORMAL_PRIORITY",
")",
".",
"addClass",
"(",
"this",
")",
".",
"addMethod",
"(",
"this",
")",
".",
"addSourceLine",
"(",
"this",
",",
"pc",
".",
"intValue",
"(",
")",
")",
")",
";",
"reportedPCs",
".",
"set",
"(",
"pc",
".",
"intValue",
"(",
")",
")",
";",
"}",
"}",
"for",
"(",
"Integer",
"pc",
":",
"nodeStores",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"reportedPCs",
".",
"get",
"(",
"pc",
".",
"intValue",
"(",
")",
")",
")",
"{",
"bugReporter",
".",
"reportBug",
"(",
"new",
"BugInstance",
"(",
"this",
",",
"BugType",
".",
"ODN_ORPHANED_DOM_NODE",
".",
"name",
"(",
")",
",",
"NORMAL_PRIORITY",
")",
".",
"addClass",
"(",
"this",
")",
".",
"addMethod",
"(",
"this",
")",
".",
"addSourceLine",
"(",
"this",
",",
"pc",
".",
"intValue",
"(",
")",
")",
")",
";",
"reportedPCs",
".",
"set",
"(",
"pc",
".",
"intValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | implements the visitor to clear the opcode stack for the next code
@param obj
the context object for the currently parsed code block | [
"implements",
"the",
"visitor",
"to",
"clear",
"the",
"opcode",
"stack",
"for",
"the",
"next",
"code"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L95-L117 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java | JobOperatorImpl.markInstanceExecutionFailed | private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) {
"""
/*
Used to mark job failed if start attempt fails.
Example failure is a bad jsl name.
"""
//Disregard any attempted transitions out of the ABANDONED state.
if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. ");
}
return;
}
getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(),
InstanceState.FAILED,
BatchStatus.FAILED,
new Date());
publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId);
getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(),
BatchStatus.FAILED,
new Date());
publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId);
} | java | private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) {
//Disregard any attempted transitions out of the ABANDONED state.
if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. ");
}
return;
}
getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(),
InstanceState.FAILED,
BatchStatus.FAILED,
new Date());
publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId);
getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(),
BatchStatus.FAILED,
new Date());
publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId);
} | [
"private",
"void",
"markInstanceExecutionFailed",
"(",
"WSJobInstance",
"jobInstance",
",",
"WSJobExecution",
"jobExecution",
",",
"String",
"correlationId",
")",
"{",
"//Disregard any attempted transitions out of the ABANDONED state.",
"if",
"(",
"jobInstance",
".",
"getBatchStatus",
"(",
")",
"==",
"BatchStatus",
".",
"ABANDONED",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. \"",
")",
";",
"}",
"return",
";",
"}",
"getPersistenceManagerService",
"(",
")",
".",
"updateJobInstanceWithInstanceStateAndBatchStatus",
"(",
"jobInstance",
".",
"getInstanceId",
"(",
")",
",",
"InstanceState",
".",
"FAILED",
",",
"BatchStatus",
".",
"FAILED",
",",
"new",
"Date",
"(",
")",
")",
";",
"publishEvent",
"(",
"jobInstance",
",",
"BatchEventsPublisher",
".",
"TOPIC_INSTANCE_FAILED",
",",
"correlationId",
")",
";",
"getPersistenceManagerService",
"(",
")",
".",
"updateJobExecutionAndInstanceOnStatusChange",
"(",
"jobExecution",
".",
"getExecutionId",
"(",
")",
",",
"BatchStatus",
".",
"FAILED",
",",
"new",
"Date",
"(",
")",
")",
";",
"publishEvent",
"(",
"jobExecution",
",",
"BatchEventsPublisher",
".",
"TOPIC_EXECUTION_FAILED",
",",
"correlationId",
")",
";",
"}"
] | /*
Used to mark job failed if start attempt fails.
Example failure is a bad jsl name. | [
"/",
"*",
"Used",
"to",
"mark",
"job",
"failed",
"if",
"start",
"attempt",
"fails",
".",
"Example",
"failure",
"is",
"a",
"bad",
"jsl",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L284-L308 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.getRelativeDateTimeString | public static CharSequence getRelativeDateTimeString(Context context, ReadableInstant time,
ReadablePeriod transitionResolution, int flags) {
"""
Return string describing the time until/elapsed time since 'time' formatted like
"[relative time/date], [time]".
See {@link android.text.format.DateUtils#getRelativeDateTimeString} for full docs.
@param context the context
@param time some time
@param transitionResolution the elapsed time (period) at which
to stop reporting relative measurements. Periods greater
than this resolution will default to normal date formatting.
For example, will transition from "6 days ago" to "Dec 12"
when using Weeks.ONE. If null, defaults to Days.ONE.
Clamps to min value of Days.ONE, max of Weeks.ONE.
@param flags flags for getRelativeTimeSpanString() (if duration is less than transitionResolution)
"""
Resources r = context.getResources();
// We set the millis to 0 so we aren't off by a fraction of a second when counting duration
DateTime now = DateTime.now(time.getZone()).withMillisOfSecond(0);
DateTime timeDt = new DateTime(time).withMillisOfSecond(0);
boolean past = !now.isBefore(timeDt);
Duration duration = past ? new Duration(timeDt, now) : new Duration(now, timeDt);
// getRelativeTimeSpanString() doesn't correctly format relative dates
// above a week or exact dates below a day, so clamp
// transitionResolution as needed.
Duration transitionDuration;
Duration minDuration = Days.ONE.toPeriod().toDurationTo(timeDt);
if (transitionResolution == null) {
transitionDuration = minDuration;
}
else {
transitionDuration = past ? transitionResolution.toPeriod().toDurationTo(now) :
transitionResolution.toPeriod().toDurationFrom(now);
Duration maxDuration = Weeks.ONE.toPeriod().toDurationTo(timeDt);
if (transitionDuration.isLongerThan(maxDuration)) {
transitionDuration = maxDuration;
}
else if (transitionDuration.isShorterThan(minDuration)) {
transitionDuration = minDuration;
}
}
CharSequence timeClause = formatDateRange(context, time, time, FORMAT_SHOW_TIME);
String result;
if (!duration.isLongerThan(transitionDuration)) {
CharSequence relativeClause = getRelativeTimeSpanString(context, time, flags);
result = r.getString(R.string.joda_time_android_relative_time, relativeClause, timeClause);
}
else {
CharSequence dateClause = getRelativeTimeSpanString(context, time, false);
result = r.getString(R.string.joda_time_android_date_time, dateClause, timeClause);
}
return result;
} | java | public static CharSequence getRelativeDateTimeString(Context context, ReadableInstant time,
ReadablePeriod transitionResolution, int flags) {
Resources r = context.getResources();
// We set the millis to 0 so we aren't off by a fraction of a second when counting duration
DateTime now = DateTime.now(time.getZone()).withMillisOfSecond(0);
DateTime timeDt = new DateTime(time).withMillisOfSecond(0);
boolean past = !now.isBefore(timeDt);
Duration duration = past ? new Duration(timeDt, now) : new Duration(now, timeDt);
// getRelativeTimeSpanString() doesn't correctly format relative dates
// above a week or exact dates below a day, so clamp
// transitionResolution as needed.
Duration transitionDuration;
Duration minDuration = Days.ONE.toPeriod().toDurationTo(timeDt);
if (transitionResolution == null) {
transitionDuration = minDuration;
}
else {
transitionDuration = past ? transitionResolution.toPeriod().toDurationTo(now) :
transitionResolution.toPeriod().toDurationFrom(now);
Duration maxDuration = Weeks.ONE.toPeriod().toDurationTo(timeDt);
if (transitionDuration.isLongerThan(maxDuration)) {
transitionDuration = maxDuration;
}
else if (transitionDuration.isShorterThan(minDuration)) {
transitionDuration = minDuration;
}
}
CharSequence timeClause = formatDateRange(context, time, time, FORMAT_SHOW_TIME);
String result;
if (!duration.isLongerThan(transitionDuration)) {
CharSequence relativeClause = getRelativeTimeSpanString(context, time, flags);
result = r.getString(R.string.joda_time_android_relative_time, relativeClause, timeClause);
}
else {
CharSequence dateClause = getRelativeTimeSpanString(context, time, false);
result = r.getString(R.string.joda_time_android_date_time, dateClause, timeClause);
}
return result;
} | [
"public",
"static",
"CharSequence",
"getRelativeDateTimeString",
"(",
"Context",
"context",
",",
"ReadableInstant",
"time",
",",
"ReadablePeriod",
"transitionResolution",
",",
"int",
"flags",
")",
"{",
"Resources",
"r",
"=",
"context",
".",
"getResources",
"(",
")",
";",
"// We set the millis to 0 so we aren't off by a fraction of a second when counting duration",
"DateTime",
"now",
"=",
"DateTime",
".",
"now",
"(",
"time",
".",
"getZone",
"(",
")",
")",
".",
"withMillisOfSecond",
"(",
"0",
")",
";",
"DateTime",
"timeDt",
"=",
"new",
"DateTime",
"(",
"time",
")",
".",
"withMillisOfSecond",
"(",
"0",
")",
";",
"boolean",
"past",
"=",
"!",
"now",
".",
"isBefore",
"(",
"timeDt",
")",
";",
"Duration",
"duration",
"=",
"past",
"?",
"new",
"Duration",
"(",
"timeDt",
",",
"now",
")",
":",
"new",
"Duration",
"(",
"now",
",",
"timeDt",
")",
";",
"// getRelativeTimeSpanString() doesn't correctly format relative dates",
"// above a week or exact dates below a day, so clamp",
"// transitionResolution as needed.",
"Duration",
"transitionDuration",
";",
"Duration",
"minDuration",
"=",
"Days",
".",
"ONE",
".",
"toPeriod",
"(",
")",
".",
"toDurationTo",
"(",
"timeDt",
")",
";",
"if",
"(",
"transitionResolution",
"==",
"null",
")",
"{",
"transitionDuration",
"=",
"minDuration",
";",
"}",
"else",
"{",
"transitionDuration",
"=",
"past",
"?",
"transitionResolution",
".",
"toPeriod",
"(",
")",
".",
"toDurationTo",
"(",
"now",
")",
":",
"transitionResolution",
".",
"toPeriod",
"(",
")",
".",
"toDurationFrom",
"(",
"now",
")",
";",
"Duration",
"maxDuration",
"=",
"Weeks",
".",
"ONE",
".",
"toPeriod",
"(",
")",
".",
"toDurationTo",
"(",
"timeDt",
")",
";",
"if",
"(",
"transitionDuration",
".",
"isLongerThan",
"(",
"maxDuration",
")",
")",
"{",
"transitionDuration",
"=",
"maxDuration",
";",
"}",
"else",
"if",
"(",
"transitionDuration",
".",
"isShorterThan",
"(",
"minDuration",
")",
")",
"{",
"transitionDuration",
"=",
"minDuration",
";",
"}",
"}",
"CharSequence",
"timeClause",
"=",
"formatDateRange",
"(",
"context",
",",
"time",
",",
"time",
",",
"FORMAT_SHOW_TIME",
")",
";",
"String",
"result",
";",
"if",
"(",
"!",
"duration",
".",
"isLongerThan",
"(",
"transitionDuration",
")",
")",
"{",
"CharSequence",
"relativeClause",
"=",
"getRelativeTimeSpanString",
"(",
"context",
",",
"time",
",",
"flags",
")",
";",
"result",
"=",
"r",
".",
"getString",
"(",
"R",
".",
"string",
".",
"joda_time_android_relative_time",
",",
"relativeClause",
",",
"timeClause",
")",
";",
"}",
"else",
"{",
"CharSequence",
"dateClause",
"=",
"getRelativeTimeSpanString",
"(",
"context",
",",
"time",
",",
"false",
")",
";",
"result",
"=",
"r",
".",
"getString",
"(",
"R",
".",
"string",
".",
"joda_time_android_date_time",
",",
"dateClause",
",",
"timeClause",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Return string describing the time until/elapsed time since 'time' formatted like
"[relative time/date], [time]".
See {@link android.text.format.DateUtils#getRelativeDateTimeString} for full docs.
@param context the context
@param time some time
@param transitionResolution the elapsed time (period) at which
to stop reporting relative measurements. Periods greater
than this resolution will default to normal date formatting.
For example, will transition from "6 days ago" to "Dec 12"
when using Weeks.ONE. If null, defaults to Days.ONE.
Clamps to min value of Days.ONE, max of Weeks.ONE.
@param flags flags for getRelativeTimeSpanString() (if duration is less than transitionResolution) | [
"Return",
"string",
"describing",
"the",
"time",
"until",
"/",
"elapsed",
"time",
"since",
"time",
"formatted",
"like",
"[",
"relative",
"time",
"/",
"date",
"]",
"[",
"time",
"]",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L433-L476 |
VoltDB/voltdb | src/frontend/org/voltdb/plannodes/AbstractPlanNode.java | AbstractPlanNode.isOutputOrdered | public boolean isOutputOrdered (List<AbstractExpression> sortExpressions, List<SortDirectionType> sortDirections) {
"""
Does the plan guarantee a result sorted according to the required sort order.
The default implementation delegates the question to its child if there is only one child.
@param sortExpressions list of ordering columns expressions
@param sortDirections list of corresponding sort orders
@return TRUE if the node's output table is ordered. FALSE otherwise
"""
assert(sortExpressions.size() == sortDirections.size());
if (m_children.size() == 1) {
return m_children.get(0).isOutputOrdered(sortExpressions, sortDirections);
}
return false;
} | java | public boolean isOutputOrdered (List<AbstractExpression> sortExpressions, List<SortDirectionType> sortDirections) {
assert(sortExpressions.size() == sortDirections.size());
if (m_children.size() == 1) {
return m_children.get(0).isOutputOrdered(sortExpressions, sortDirections);
}
return false;
} | [
"public",
"boolean",
"isOutputOrdered",
"(",
"List",
"<",
"AbstractExpression",
">",
"sortExpressions",
",",
"List",
"<",
"SortDirectionType",
">",
"sortDirections",
")",
"{",
"assert",
"(",
"sortExpressions",
".",
"size",
"(",
")",
"==",
"sortDirections",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"m_children",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"m_children",
".",
"get",
"(",
"0",
")",
".",
"isOutputOrdered",
"(",
"sortExpressions",
",",
"sortDirections",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Does the plan guarantee a result sorted according to the required sort order.
The default implementation delegates the question to its child if there is only one child.
@param sortExpressions list of ordering columns expressions
@param sortDirections list of corresponding sort orders
@return TRUE if the node's output table is ordered. FALSE otherwise | [
"Does",
"the",
"plan",
"guarantee",
"a",
"result",
"sorted",
"according",
"to",
"the",
"required",
"sort",
"order",
".",
"The",
"default",
"implementation",
"delegates",
"the",
"question",
"to",
"its",
"child",
"if",
"there",
"is",
"only",
"one",
"child",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/AbstractPlanNode.java#L385-L391 |
b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.putOnce | public JSONObject putOnce(String key, Object value) throws JSONException {
"""
Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null, and only if there is not already a member with that
name.
@param key
key to insert into
@param value
value to insert
@return this.
@throws JSONException
if the key is a duplicate
"""
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
return this.put(key, value);
}
return this;
} | java | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
return this.put(key, value);
}
return this;
} | [
"public",
"JSONObject",
"putOnce",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"key",
"!=",
"null",
"&&",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"opt",
"(",
"key",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Duplicate key \\\"\"",
"+",
"key",
"+",
"\"\\\"\"",
")",
";",
"}",
"return",
"this",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null, and only if there is not already a member with that
name.
@param key
key to insert into
@param value
value to insert
@return this.
@throws JSONException
if the key is a duplicate | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"and",
"only",
"if",
"there",
"is",
"not",
"already",
"a",
"member",
"with",
"that",
"name",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1811-L1819 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectOne | public Object collectOne(InputStream inputStream, JsonPath... paths) {
"""
Collect the first matched value and stop parsing immediately
@param inputStream json inpustream
@param paths JsonPath
@return Matched value
"""
return collectOne(inputStream, Object.class, paths);
} | java | public Object collectOne(InputStream inputStream, JsonPath... paths) {
return collectOne(inputStream, Object.class, paths);
} | [
"public",
"Object",
"collectOne",
"(",
"InputStream",
"inputStream",
",",
"JsonPath",
"...",
"paths",
")",
"{",
"return",
"collectOne",
"(",
"inputStream",
",",
"Object",
".",
"class",
",",
"paths",
")",
";",
"}"
] | Collect the first matched value and stop parsing immediately
@param inputStream json inpustream
@param paths JsonPath
@return Matched value | [
"Collect",
"the",
"first",
"matched",
"value",
"and",
"stop",
"parsing",
"immediately"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L488-L490 |
datacleaner/AnalyzerBeans | components/date-gap/src/main/java/org/eobjects/analyzer/beans/dategap/TimeLine.java | TimeLine.getTimeGapIntervals | public SortedSet<TimeInterval> getTimeGapIntervals() {
"""
Gets a set of intervals representing the times that are NOT represented
in this timeline.
@return
"""
SortedSet<TimeInterval> flattenedIntervals = getFlattenedIntervals();
SortedSet<TimeInterval> gaps = new TreeSet<TimeInterval>();
TimeInterval previous = null;
for (TimeInterval timeInterval : flattenedIntervals) {
if (previous != null) {
long from = previous.getTo();
long to = timeInterval.getFrom();
TimeInterval gap = new TimeInterval(from, to);
gaps.add(gap);
}
previous = timeInterval;
}
return gaps;
} | java | public SortedSet<TimeInterval> getTimeGapIntervals() {
SortedSet<TimeInterval> flattenedIntervals = getFlattenedIntervals();
SortedSet<TimeInterval> gaps = new TreeSet<TimeInterval>();
TimeInterval previous = null;
for (TimeInterval timeInterval : flattenedIntervals) {
if (previous != null) {
long from = previous.getTo();
long to = timeInterval.getFrom();
TimeInterval gap = new TimeInterval(from, to);
gaps.add(gap);
}
previous = timeInterval;
}
return gaps;
} | [
"public",
"SortedSet",
"<",
"TimeInterval",
">",
"getTimeGapIntervals",
"(",
")",
"{",
"SortedSet",
"<",
"TimeInterval",
">",
"flattenedIntervals",
"=",
"getFlattenedIntervals",
"(",
")",
";",
"SortedSet",
"<",
"TimeInterval",
">",
"gaps",
"=",
"new",
"TreeSet",
"<",
"TimeInterval",
">",
"(",
")",
";",
"TimeInterval",
"previous",
"=",
"null",
";",
"for",
"(",
"TimeInterval",
"timeInterval",
":",
"flattenedIntervals",
")",
"{",
"if",
"(",
"previous",
"!=",
"null",
")",
"{",
"long",
"from",
"=",
"previous",
".",
"getTo",
"(",
")",
";",
"long",
"to",
"=",
"timeInterval",
".",
"getFrom",
"(",
")",
";",
"TimeInterval",
"gap",
"=",
"new",
"TimeInterval",
"(",
"from",
",",
"to",
")",
";",
"gaps",
".",
"add",
"(",
"gap",
")",
";",
"}",
"previous",
"=",
"timeInterval",
";",
"}",
"return",
"gaps",
";",
"}"
] | Gets a set of intervals representing the times that are NOT represented
in this timeline.
@return | [
"Gets",
"a",
"set",
"of",
"intervals",
"representing",
"the",
"times",
"that",
"are",
"NOT",
"represented",
"in",
"this",
"timeline",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/date-gap/src/main/java/org/eobjects/analyzer/beans/dategap/TimeLine.java#L127-L143 |
Red5/red5-server-common | src/main/java/org/red5/server/service/ReflectionUtils.java | ReflectionUtils.findMethodWithExactParameters | public static Object[] findMethodWithExactParameters(Object service, String methodName, List<?> args) {
"""
Returns (method, params) for the given service or (null, null) if no method was found.
@param service
Service
@param methodName
Method name
@param args
Arguments
@return Method/params pairs
"""
Object[] arguments = new Object[args.size()];
for (int i = 0; i < args.size(); i++) {
arguments[i] = args.get(i);
}
return findMethodWithExactParameters(service, methodName, arguments);
} | java | public static Object[] findMethodWithExactParameters(Object service, String methodName, List<?> args) {
Object[] arguments = new Object[args.size()];
for (int i = 0; i < args.size(); i++) {
arguments[i] = args.get(i);
}
return findMethodWithExactParameters(service, methodName, arguments);
} | [
"public",
"static",
"Object",
"[",
"]",
"findMethodWithExactParameters",
"(",
"Object",
"service",
",",
"String",
"methodName",
",",
"List",
"<",
"?",
">",
"args",
")",
"{",
"Object",
"[",
"]",
"arguments",
"=",
"new",
"Object",
"[",
"args",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"arguments",
"[",
"i",
"]",
"=",
"args",
".",
"get",
"(",
"i",
")",
";",
"}",
"return",
"findMethodWithExactParameters",
"(",
"service",
",",
"methodName",
",",
"arguments",
")",
";",
"}"
] | Returns (method, params) for the given service or (null, null) if no method was found.
@param service
Service
@param methodName
Method name
@param args
Arguments
@return Method/params pairs | [
"Returns",
"(",
"method",
"params",
")",
"for",
"the",
"given",
"service",
"or",
"(",
"null",
"null",
")",
"if",
"no",
"method",
"was",
"found",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/service/ReflectionUtils.java#L51-L57 |
Chorus-bdd/Chorus | interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/StepProcessor.java | StepProcessor.sortInvokersByPattern | private void sortInvokersByPattern(List<StepInvoker> stepInvokers) {
"""
prefer fully determinate behaviour. The only sensible solution is to sort by pattern
"""
Collections.sort(stepInvokers, new Comparator<StepInvoker>() {
public int compare(StepInvoker o1, StepInvoker o2) {
return o1.getStepPattern().toString().compareTo(o2.getStepPattern().toString());
}
});
} | java | private void sortInvokersByPattern(List<StepInvoker> stepInvokers) {
Collections.sort(stepInvokers, new Comparator<StepInvoker>() {
public int compare(StepInvoker o1, StepInvoker o2) {
return o1.getStepPattern().toString().compareTo(o2.getStepPattern().toString());
}
});
} | [
"private",
"void",
"sortInvokersByPattern",
"(",
"List",
"<",
"StepInvoker",
">",
"stepInvokers",
")",
"{",
"Collections",
".",
"sort",
"(",
"stepInvokers",
",",
"new",
"Comparator",
"<",
"StepInvoker",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"StepInvoker",
"o1",
",",
"StepInvoker",
"o2",
")",
"{",
"return",
"o1",
".",
"getStepPattern",
"(",
")",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"o2",
".",
"getStepPattern",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | prefer fully determinate behaviour. The only sensible solution is to sort by pattern | [
"prefer",
"fully",
"determinate",
"behaviour",
".",
"The",
"only",
"sensible",
"solution",
"is",
"to",
"sort",
"by",
"pattern"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/StepProcessor.java#L190-L196 |
pushtorefresh/storio | storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/delete/DeleteResult.java | DeleteResult.newInstance | @NonNull
public static DeleteResult newInstance(int numberOfRowsDeleted, @NonNull Uri affectedUri) {
"""
Creates new instance of immutable container for results of Delete Operation.
@param numberOfRowsDeleted number of rows that were deleted.
@param affectedUri non-null Uri that was affected.
@return new instance of immutable container for results of Delete Operation.
"""
checkNotNull(affectedUri, "Please specify affected Uri");
return new DeleteResult(numberOfRowsDeleted, Collections.singleton(affectedUri));
} | java | @NonNull
public static DeleteResult newInstance(int numberOfRowsDeleted, @NonNull Uri affectedUri) {
checkNotNull(affectedUri, "Please specify affected Uri");
return new DeleteResult(numberOfRowsDeleted, Collections.singleton(affectedUri));
} | [
"@",
"NonNull",
"public",
"static",
"DeleteResult",
"newInstance",
"(",
"int",
"numberOfRowsDeleted",
",",
"@",
"NonNull",
"Uri",
"affectedUri",
")",
"{",
"checkNotNull",
"(",
"affectedUri",
",",
"\"Please specify affected Uri\"",
")",
";",
"return",
"new",
"DeleteResult",
"(",
"numberOfRowsDeleted",
",",
"Collections",
".",
"singleton",
"(",
"affectedUri",
")",
")",
";",
"}"
] | Creates new instance of immutable container for results of Delete Operation.
@param numberOfRowsDeleted number of rows that were deleted.
@param affectedUri non-null Uri that was affected.
@return new instance of immutable container for results of Delete Operation. | [
"Creates",
"new",
"instance",
"of",
"immutable",
"container",
"for",
"results",
"of",
"Delete",
"Operation",
"."
] | train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/delete/DeleteResult.java#L48-L52 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/TransformerFactoryImpl.java | TransformerFactoryImpl.setErrorListener | public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException {
"""
Set an error listener for the TransformerFactory.
@param listener Must be a non-null reference to an ErrorListener.
@throws IllegalArgumentException if the listener argument is null.
"""
if (null == listener)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ERRORLISTENER, null));
// "ErrorListener");
m_errorListener = listener;
} | java | public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
{
if (null == listener)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ERRORLISTENER, null));
// "ErrorListener");
m_errorListener = listener;
} | [
"public",
"void",
"setErrorListener",
"(",
"ErrorListener",
"listener",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"null",
"==",
"listener",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"XSLMessages",
".",
"createMessage",
"(",
"XSLTErrorResources",
".",
"ER_ERRORLISTENER",
",",
"null",
")",
")",
";",
"// \"ErrorListener\");",
"m_errorListener",
"=",
"listener",
";",
"}"
] | Set an error listener for the TransformerFactory.
@param listener Must be a non-null reference to an ErrorListener.
@throws IllegalArgumentException if the listener argument is null. | [
"Set",
"an",
"error",
"listener",
"for",
"the",
"TransformerFactory",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/TransformerFactoryImpl.java#L1027-L1036 |
openengsb/openengsb | api/core/src/main/java/org/openengsb/core/api/model/ModelWrapper.java | ModelWrapper.getModelDescription | public ModelDescription getModelDescription() {
"""
Creates the model description object for the underlying model object.
"""
String modelName = retrieveModelName();
String modelVersion = retrieveModelVersion();
if (modelName == null || modelVersion == null) {
throw new IllegalArgumentException("Unsufficient information to create model description.");
}
return new ModelDescription(modelName, modelVersion);
} | java | public ModelDescription getModelDescription() {
String modelName = retrieveModelName();
String modelVersion = retrieveModelVersion();
if (modelName == null || modelVersion == null) {
throw new IllegalArgumentException("Unsufficient information to create model description.");
}
return new ModelDescription(modelName, modelVersion);
} | [
"public",
"ModelDescription",
"getModelDescription",
"(",
")",
"{",
"String",
"modelName",
"=",
"retrieveModelName",
"(",
")",
";",
"String",
"modelVersion",
"=",
"retrieveModelVersion",
"(",
")",
";",
"if",
"(",
"modelName",
"==",
"null",
"||",
"modelVersion",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unsufficient information to create model description.\"",
")",
";",
"}",
"return",
"new",
"ModelDescription",
"(",
"modelName",
",",
"modelVersion",
")",
";",
"}"
] | Creates the model description object for the underlying model object. | [
"Creates",
"the",
"model",
"description",
"object",
"for",
"the",
"underlying",
"model",
"object",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/core/src/main/java/org/openengsb/core/api/model/ModelWrapper.java#L64-L71 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.getInfoFormat | private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) {
"""
Gets the info format according to the longest worker name.
@param workerInfoList the worker info list to get info from
@param isShort whether exists only one tier
@return the info format for printing long/short worker info
"""
int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length())
.max(Comparator.comparing(Integer::intValue)).get();
int firstIndent = 16;
if (firstIndent <= maxWorkerNameLength) {
// extend first indent according to the longest worker name by default 5
firstIndent = maxWorkerNameLength + 5;
}
if (isShort) {
return "%-" + firstIndent + "s %-16s %-13s %s";
}
return "%-" + firstIndent + "s %-16s %-13s %-16s %s";
} | java | private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) {
int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length())
.max(Comparator.comparing(Integer::intValue)).get();
int firstIndent = 16;
if (firstIndent <= maxWorkerNameLength) {
// extend first indent according to the longest worker name by default 5
firstIndent = maxWorkerNameLength + 5;
}
if (isShort) {
return "%-" + firstIndent + "s %-16s %-13s %s";
}
return "%-" + firstIndent + "s %-16s %-13s %-16s %s";
} | [
"private",
"String",
"getInfoFormat",
"(",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
",",
"boolean",
"isShort",
")",
"{",
"int",
"maxWorkerNameLength",
"=",
"workerInfoList",
".",
"stream",
"(",
")",
".",
"map",
"(",
"w",
"->",
"w",
".",
"getAddress",
"(",
")",
".",
"getHost",
"(",
")",
".",
"length",
"(",
")",
")",
".",
"max",
"(",
"Comparator",
".",
"comparing",
"(",
"Integer",
"::",
"intValue",
")",
")",
".",
"get",
"(",
")",
";",
"int",
"firstIndent",
"=",
"16",
";",
"if",
"(",
"firstIndent",
"<=",
"maxWorkerNameLength",
")",
"{",
"// extend first indent according to the longest worker name by default 5",
"firstIndent",
"=",
"maxWorkerNameLength",
"+",
"5",
";",
"}",
"if",
"(",
"isShort",
")",
"{",
"return",
"\"%-\"",
"+",
"firstIndent",
"+",
"\"s %-16s %-13s %s\"",
";",
"}",
"return",
"\"%-\"",
"+",
"firstIndent",
"+",
"\"s %-16s %-13s %-16s %s\"",
";",
"}"
] | Gets the info format according to the longest worker name.
@param workerInfoList the worker info list to get info from
@param isShort whether exists only one tier
@return the info format for printing long/short worker info | [
"Gets",
"the",
"info",
"format",
"according",
"to",
"the",
"longest",
"worker",
"name",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L255-L267 |
Impetus/Kundera | src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java | DefaultCouchbaseDataHandler.iterateAndPopulateJsonObject | private JsonObject iterateAndPopulateJsonObject(Object entity, Iterator<Attribute> iterator, String tableName) {
"""
Iterate and populate json object.
@param entity
the entity
@param iterator
the iterator
@return the json object
"""
JsonObject obj = JsonObject.create();
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
obj.put(((AbstractAttribute) attribute).getJPAColumnName(), value);
}
obj.put(CouchbaseConstants.KUNDERA_ENTITY, tableName);
return obj;
} | java | private JsonObject iterateAndPopulateJsonObject(Object entity, Iterator<Attribute> iterator, String tableName)
{
JsonObject obj = JsonObject.create();
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
obj.put(((AbstractAttribute) attribute).getJPAColumnName(), value);
}
obj.put(CouchbaseConstants.KUNDERA_ENTITY, tableName);
return obj;
} | [
"private",
"JsonObject",
"iterateAndPopulateJsonObject",
"(",
"Object",
"entity",
",",
"Iterator",
"<",
"Attribute",
">",
"iterator",
",",
"String",
"tableName",
")",
"{",
"JsonObject",
"obj",
"=",
"JsonObject",
".",
"create",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Attribute",
"attribute",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"Field",
"field",
"=",
"(",
"Field",
")",
"attribute",
".",
"getJavaMember",
"(",
")",
";",
"Object",
"value",
"=",
"PropertyAccessorHelper",
".",
"getObject",
"(",
"entity",
",",
"field",
")",
";",
"obj",
".",
"put",
"(",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getJPAColumnName",
"(",
")",
",",
"value",
")",
";",
"}",
"obj",
".",
"put",
"(",
"CouchbaseConstants",
".",
"KUNDERA_ENTITY",
",",
"tableName",
")",
";",
"return",
"obj",
";",
"}"
] | Iterate and populate json object.
@param entity
the entity
@param iterator
the iterator
@return the json object | [
"Iterate",
"and",
"populate",
"json",
"object",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java#L108-L121 |
javagl/ND | nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java | LongArraysND.wrap | public static LongArrayND wrap(LongTuple t, IntTuple size) {
"""
Creates a <i>view</i> on the given tuple as a {@link LongArrayND}.
Changes in the given tuple will be visible in the returned array.
@param t The tuple
@param size The size of the array
@return The view on the tuple
@throws NullPointerException If any argument is <code>null</code>
@throws IllegalArgumentException If the
{@link LongTuple#getSize() size} of the tuple does not match the
given array size (that is, the product of all elements of the given
tuple).
"""
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleLongArrayND(t, size);
} | java | public static LongArrayND wrap(LongTuple t, IntTuple size)
{
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleLongArrayND(t, size);
} | [
"public",
"static",
"LongArrayND",
"wrap",
"(",
"LongTuple",
"t",
",",
"IntTuple",
"size",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"t",
",",
"\"The tuple is null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"size",
",",
"\"The size is null\"",
")",
";",
"int",
"totalSize",
"=",
"IntTupleFunctions",
".",
"reduce",
"(",
"size",
",",
"1",
",",
"(",
"a",
",",
"b",
")",
"->",
"a",
"*",
"b",
")",
";",
"if",
"(",
"t",
".",
"getSize",
"(",
")",
"!=",
"totalSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The tuple has a size of \"",
"+",
"t",
".",
"getSize",
"(",
")",
"+",
"\", the expected \"",
"+",
"\"array size is \"",
"+",
"size",
"+",
"\" (total: \"",
"+",
"totalSize",
"+",
"\")\"",
")",
";",
"}",
"return",
"new",
"TupleLongArrayND",
"(",
"t",
",",
"size",
")",
";",
"}"
] | Creates a <i>view</i> on the given tuple as a {@link LongArrayND}.
Changes in the given tuple will be visible in the returned array.
@param t The tuple
@param size The size of the array
@return The view on the tuple
@throws NullPointerException If any argument is <code>null</code>
@throws IllegalArgumentException If the
{@link LongTuple#getSize() size} of the tuple does not match the
given array size (that is, the product of all elements of the given
tuple). | [
"Creates",
"a",
"<i",
">",
"view<",
"/",
"i",
">",
"on",
"the",
"given",
"tuple",
"as",
"a",
"{",
"@link",
"LongArrayND",
"}",
".",
"Changes",
"in",
"the",
"given",
"tuple",
"will",
"be",
"visible",
"in",
"the",
"returned",
"array",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java#L112-L124 |
timehop/sticky-headers-recyclerview | library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java | HeaderPositionCalculator.hasStickyHeader | public boolean hasStickyHeader(View itemView, int orientation, int position) {
"""
Determines if a view should have a sticky header.
The view has a sticky header if:
1. It is the first element in the recycler view
2. It has a valid ID associated to its position
@param itemView given by the RecyclerView
@param orientation of the Recyclerview
@param position of the list item in question
@return True if the view should have a sticky header
"""
int offset, margin;
mDimensionCalculator.initMargins(mTempRect1, itemView);
if (orientation == LinearLayout.VERTICAL) {
offset = itemView.getTop();
margin = mTempRect1.top;
} else {
offset = itemView.getLeft();
margin = mTempRect1.left;
}
return offset <= margin && mAdapter.getHeaderId(position) >= 0;
} | java | public boolean hasStickyHeader(View itemView, int orientation, int position) {
int offset, margin;
mDimensionCalculator.initMargins(mTempRect1, itemView);
if (orientation == LinearLayout.VERTICAL) {
offset = itemView.getTop();
margin = mTempRect1.top;
} else {
offset = itemView.getLeft();
margin = mTempRect1.left;
}
return offset <= margin && mAdapter.getHeaderId(position) >= 0;
} | [
"public",
"boolean",
"hasStickyHeader",
"(",
"View",
"itemView",
",",
"int",
"orientation",
",",
"int",
"position",
")",
"{",
"int",
"offset",
",",
"margin",
";",
"mDimensionCalculator",
".",
"initMargins",
"(",
"mTempRect1",
",",
"itemView",
")",
";",
"if",
"(",
"orientation",
"==",
"LinearLayout",
".",
"VERTICAL",
")",
"{",
"offset",
"=",
"itemView",
".",
"getTop",
"(",
")",
";",
"margin",
"=",
"mTempRect1",
".",
"top",
";",
"}",
"else",
"{",
"offset",
"=",
"itemView",
".",
"getLeft",
"(",
")",
";",
"margin",
"=",
"mTempRect1",
".",
"left",
";",
"}",
"return",
"offset",
"<=",
"margin",
"&&",
"mAdapter",
".",
"getHeaderId",
"(",
"position",
")",
">=",
"0",
";",
"}"
] | Determines if a view should have a sticky header.
The view has a sticky header if:
1. It is the first element in the recycler view
2. It has a valid ID associated to its position
@param itemView given by the RecyclerView
@param orientation of the Recyclerview
@param position of the list item in question
@return True if the view should have a sticky header | [
"Determines",
"if",
"a",
"view",
"should",
"have",
"a",
"sticky",
"header",
".",
"The",
"view",
"has",
"a",
"sticky",
"header",
"if",
":",
"1",
".",
"It",
"is",
"the",
"first",
"element",
"in",
"the",
"recycler",
"view",
"2",
".",
"It",
"has",
"a",
"valid",
"ID",
"associated",
"to",
"its",
"position"
] | train | https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java#L50-L62 |
grpc/grpc-java | okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java | OkHttpClientTransport.onError | private void onError(ErrorCode errorCode, String moreDetail) {
"""
Send GOAWAY to the server, then finish all active streams and close the transport.
"""
startGoAway(0, errorCode, toGrpcStatus(errorCode).augmentDescription(moreDetail));
} | java | private void onError(ErrorCode errorCode, String moreDetail) {
startGoAway(0, errorCode, toGrpcStatus(errorCode).augmentDescription(moreDetail));
} | [
"private",
"void",
"onError",
"(",
"ErrorCode",
"errorCode",
",",
"String",
"moreDetail",
")",
"{",
"startGoAway",
"(",
"0",
",",
"errorCode",
",",
"toGrpcStatus",
"(",
"errorCode",
")",
".",
"augmentDescription",
"(",
"moreDetail",
")",
")",
";",
"}"
] | Send GOAWAY to the server, then finish all active streams and close the transport. | [
"Send",
"GOAWAY",
"to",
"the",
"server",
"then",
"finish",
"all",
"active",
"streams",
"and",
"close",
"the",
"transport",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L837-L839 |
domaframework/doma-gen | src/main/java/org/seasar/doma/extension/gen/Generator.java | Generator.process | protected void process(Template template, Object dataModel, Writer writer) {
"""
テンプレートを処理します。
@param template テンプレート
@param dataModel データモデル
@param writer ライタ
"""
try {
template.process(dataModel, writer);
} catch (IOException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
} catch (TemplateException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
}
} | java | protected void process(Template template, Object dataModel, Writer writer) {
try {
template.process(dataModel, writer);
} catch (IOException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
} catch (TemplateException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
}
} | [
"protected",
"void",
"process",
"(",
"Template",
"template",
",",
"Object",
"dataModel",
",",
"Writer",
"writer",
")",
"{",
"try",
"{",
"template",
".",
"process",
"(",
"dataModel",
",",
"writer",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"GenException",
"(",
"Message",
".",
"DOMAGEN9001",
",",
"e",
",",
"e",
")",
";",
"}",
"catch",
"(",
"TemplateException",
"e",
")",
"{",
"throw",
"new",
"GenException",
"(",
"Message",
".",
"DOMAGEN9001",
",",
"e",
",",
"e",
")",
";",
"}",
"}"
] | テンプレートを処理します。
@param template テンプレート
@param dataModel データモデル
@param writer ライタ | [
"テンプレートを処理します。"
] | train | https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/Generator.java#L180-L188 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configurations.java | Configurations.getFileAsStream | static InputStream getFileAsStream(File resourceFile) throws ConfigurationException {
"""
Gets the file as stream.
@param resourceFile
the resource file
@return the file as stream
@throws ConfigurationException
"""
try {
return new FileInputStream(resourceFile);
} catch (FileNotFoundException e) {
Log.error("File Resource could not be resolved. Given Resource:" + resourceFile, e);
throw new ConfigurationException("File Resource could not be resolve", FILE_NOT_FOUND_EXCEPTION_ID,e);
}
} | java | static InputStream getFileAsStream(File resourceFile) throws ConfigurationException {
try {
return new FileInputStream(resourceFile);
} catch (FileNotFoundException e) {
Log.error("File Resource could not be resolved. Given Resource:" + resourceFile, e);
throw new ConfigurationException("File Resource could not be resolve", FILE_NOT_FOUND_EXCEPTION_ID,e);
}
} | [
"static",
"InputStream",
"getFileAsStream",
"(",
"File",
"resourceFile",
")",
"throws",
"ConfigurationException",
"{",
"try",
"{",
"return",
"new",
"FileInputStream",
"(",
"resourceFile",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"Log",
".",
"error",
"(",
"\"File Resource could not be resolved. Given Resource:\"",
"+",
"resourceFile",
",",
"e",
")",
";",
"throw",
"new",
"ConfigurationException",
"(",
"\"File Resource could not be resolve\"",
",",
"FILE_NOT_FOUND_EXCEPTION_ID",
",",
"e",
")",
";",
"}",
"}"
] | Gets the file as stream.
@param resourceFile
the resource file
@return the file as stream
@throws ConfigurationException | [
"Gets",
"the",
"file",
"as",
"stream",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configurations.java#L278-L285 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setSasDefinition | public SasDefinitionBundle setSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod, SasDefinitionAttributes sasDefinitionAttributes, Map<String, String> tags) {
"""
Creates or updates a new SAS definition for the specified storage account. This operation requires the storage/setsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@param templateUri The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template.
@param sasType The type of SAS token the SAS definition will create. Possible values include: 'account', 'service'
@param validityPeriod The validity period of SAS tokens created according to the SAS definition.
@param sasDefinitionAttributes The attributes of the SAS definition.
@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 SasDefinitionBundle object if successful.
"""
return setSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, sasDefinitionAttributes, tags).toBlocking().single().body();
} | java | public SasDefinitionBundle setSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod, SasDefinitionAttributes sasDefinitionAttributes, Map<String, String> tags) {
return setSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod, sasDefinitionAttributes, tags).toBlocking().single().body();
} | [
"public",
"SasDefinitionBundle",
"setSasDefinition",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
",",
"String",
"templateUri",
",",
"SasTokenType",
"sasType",
",",
"String",
"validityPeriod",
",",
"SasDefinitionAttributes",
"sasDefinitionAttributes",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"setSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
",",
"sasDefinitionName",
",",
"templateUri",
",",
"sasType",
",",
"validityPeriod",
",",
"sasDefinitionAttributes",
",",
"tags",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a new SAS definition for the specified storage account. This operation requires the storage/setsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@param templateUri The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template.
@param sasType The type of SAS token the SAS definition will create. Possible values include: 'account', 'service'
@param validityPeriod The validity period of SAS tokens created according to the SAS definition.
@param sasDefinitionAttributes The attributes of the SAS definition.
@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 SasDefinitionBundle object if successful. | [
"Creates",
"or",
"updates",
"a",
"new",
"SAS",
"definition",
"for",
"the",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"setsas",
"permission",
"."
] | 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#L11369-L11371 |