repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java | HiveCopyEntityHelper.getCopyEntities | Iterator<FileSet<CopyEntity>> getCopyEntities(CopyConfiguration configuration, Comparator<FileSet<CopyEntity>> prioritizer,
PushDownRequestor<FileSet<CopyEntity>> requestor) throws IOException {
if (HiveUtils.isPartitioned(this.dataset.table)) {
return new PartitionIterator(this.sourcePartitions, configuration, prioritizer, requestor);
} else {
FileSet<CopyEntity> fileSet = new UnpartitionedTableFileSet(this.dataset.table.getCompleteName(), this.dataset, this);
return Iterators.singletonIterator(fileSet);
}
} | java | Iterator<FileSet<CopyEntity>> getCopyEntities(CopyConfiguration configuration, Comparator<FileSet<CopyEntity>> prioritizer,
PushDownRequestor<FileSet<CopyEntity>> requestor) throws IOException {
if (HiveUtils.isPartitioned(this.dataset.table)) {
return new PartitionIterator(this.sourcePartitions, configuration, prioritizer, requestor);
} else {
FileSet<CopyEntity> fileSet = new UnpartitionedTableFileSet(this.dataset.table.getCompleteName(), this.dataset, this);
return Iterators.singletonIterator(fileSet);
}
} | [
"Iterator",
"<",
"FileSet",
"<",
"CopyEntity",
">",
">",
"getCopyEntities",
"(",
"CopyConfiguration",
"configuration",
",",
"Comparator",
"<",
"FileSet",
"<",
"CopyEntity",
">",
">",
"prioritizer",
",",
"PushDownRequestor",
"<",
"FileSet",
"<",
"CopyEntity",
">",
... | Finds all files read by the table and generates {@link CopyEntity}s for duplicating the table. The semantics are as follows:
1. Find all valid {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor}. If the table is partitioned, the
{@link org.apache.hadoop.hive.metastore.api.StorageDescriptor} of the base
table will be ignored, and we will instead process the {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor} of each partition.
2. For each {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor} find all files referred by it.
3. Generate a {@link CopyableFile} for each file referred by a {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor}.
4. If the table is partitioned, create a file set for each partition.
5. Create work units for registering, deregistering partitions / tables, and deleting unnecessary files in the target.
For computation of target locations see {@link HiveTargetPathHelper#getTargetPath} | [
"Finds",
"all",
"files",
"read",
"by",
"the",
"table",
"and",
"generates",
"{",
"@link",
"CopyEntity",
"}",
"s",
"for",
"duplicating",
"the",
"table",
".",
"The",
"semantics",
"are",
"as",
"follows",
":",
"1",
".",
"Find",
"all",
"valid",
"{",
"@link",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java#L408-L416 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/os/AsyncTask.java | AsyncTask.get | public final Result get(long timeout, TimeUnit unit) throws InterruptedException,
ExecutionException, TimeoutException {
return mFuture.get(timeout, unit);
} | java | public final Result get(long timeout, TimeUnit unit) throws InterruptedException,
ExecutionException, TimeoutException {
return mFuture.get(timeout, unit);
} | [
"public",
"final",
"Result",
"get",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"return",
"mFuture",
".",
"get",
"(",
"timeout",
",",
"unit",
")",
";",
"}"
] | Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result.
@param timeout Time to wait before cancelling the operation.
@param unit The time unit for the timeout.
@return The computed result.
@throws CancellationException If the computation was cancelled.
@throws ExecutionException If the computation threw an exception.
@throws InterruptedException If the current thread was interrupted
while waiting.
@throws TimeoutException If the wait timed out. | [
"Waits",
"if",
"necessary",
"for",
"at",
"most",
"the",
"given",
"time",
"for",
"the",
"computation",
"to",
"complete",
"and",
"then",
"retrieves",
"its",
"result",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/os/AsyncTask.java#L495-L498 |
aws/aws-sdk-java | aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJobDefinition.java | TrainingJobDefinition.withHyperParameters | public TrainingJobDefinition withHyperParameters(java.util.Map<String, String> hyperParameters) {
setHyperParameters(hyperParameters);
return this;
} | java | public TrainingJobDefinition withHyperParameters(java.util.Map<String, String> hyperParameters) {
setHyperParameters(hyperParameters);
return this;
} | [
"public",
"TrainingJobDefinition",
"withHyperParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"hyperParameters",
")",
"{",
"setHyperParameters",
"(",
"hyperParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The hyperparameters used for the training job.
</p>
@param hyperParameters
The hyperparameters used for the training job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"hyperparameters",
"used",
"for",
"the",
"training",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJobDefinition.java#L230-L233 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobQueueClient.java | JobQueueClient.displayQueueInfo | private void displayQueueInfo(String queue, boolean showJobs) throws IOException {
JobQueueInfo schedInfo = jc.getQueueInfo(queue);
if (schedInfo == null) {
System.out.printf("Queue Name : %s has no scheduling information \n", queue);
} else {
System.out.printf("Queue Name : %s \n", schedInfo.getQueueName());
System.out.printf("Scheduling Info : %s \n",schedInfo.getSchedulingInfo());
}
if (showJobs) {
System.out.printf("Job List\n");
JobStatus[] jobs = jc.getJobsFromQueue(queue);
if (jobs == null)
jobs = new JobStatus[0];
jc.displayJobList(jobs);
}
} | java | private void displayQueueInfo(String queue, boolean showJobs) throws IOException {
JobQueueInfo schedInfo = jc.getQueueInfo(queue);
if (schedInfo == null) {
System.out.printf("Queue Name : %s has no scheduling information \n", queue);
} else {
System.out.printf("Queue Name : %s \n", schedInfo.getQueueName());
System.out.printf("Scheduling Info : %s \n",schedInfo.getSchedulingInfo());
}
if (showJobs) {
System.out.printf("Job List\n");
JobStatus[] jobs = jc.getJobsFromQueue(queue);
if (jobs == null)
jobs = new JobStatus[0];
jc.displayJobList(jobs);
}
} | [
"private",
"void",
"displayQueueInfo",
"(",
"String",
"queue",
",",
"boolean",
"showJobs",
")",
"throws",
"IOException",
"{",
"JobQueueInfo",
"schedInfo",
"=",
"jc",
".",
"getQueueInfo",
"(",
"queue",
")",
";",
"if",
"(",
"schedInfo",
"==",
"null",
")",
"{",... | Method used to display information pertaining to a Single JobQueue
registered with the {@link QueueManager}. Display of the Jobs is
determine by the boolean
@throws IOException | [
"Method",
"used",
"to",
"display",
"information",
"pertaining",
"to",
"a",
"Single",
"JobQueue",
"registered",
"with",
"the",
"{",
"@link",
"QueueManager",
"}",
".",
"Display",
"of",
"the",
"Jobs",
"is",
"determine",
"by",
"the",
"boolean"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobQueueClient.java#L114-L129 |
biezhi/webp-io | src/main/java/io/github/biezhi/webp/WebpIO.java | WebpIO.toNormalImage | public void toNormalImage(File src, File dest) {
String command = commandDir + (dest.getName().endsWith(".gif") ? "/gif2webp" : "/dwebp ") + src.getPath() + " -o " + dest.getPath();
this.executeCommand(command);
} | java | public void toNormalImage(File src, File dest) {
String command = commandDir + (dest.getName().endsWith(".gif") ? "/gif2webp" : "/dwebp ") + src.getPath() + " -o " + dest.getPath();
this.executeCommand(command);
} | [
"public",
"void",
"toNormalImage",
"(",
"File",
"src",
",",
"File",
"dest",
")",
"{",
"String",
"command",
"=",
"commandDir",
"+",
"(",
"dest",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".gif\"",
")",
"?",
"\"/gif2webp\"",
":",
"\"/dwebp \"",
")"... | Converter webp file to normal image
@param src webp file path
@param dest normal image path | [
"Converter",
"webp",
"file",
"to",
"normal",
"image"
] | train | https://github.com/biezhi/webp-io/blob/8eefe535087b3abccacff76de2b6e27bb7301bcc/src/main/java/io/github/biezhi/webp/WebpIO.java#L86-L89 |
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.listByAgentWithServiceResponseAsync | public Observable<ServiceResponse<Page<JobExecutionInner>>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) {
return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<JobExecutionInner>>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) {
return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
"listByAgentWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"jobAgentName",
")",... | Lists all executions in a job agent.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object | [
"Lists",
"all",
"executions",
"in",
"a",
"job",
"agent",
"."
] | 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#L177-L189 |
carrotsearch/hppc | hppc/src/main/java/com/carrotsearch/hppc/BitUtil.java | BitUtil.pop_intersect | public static long pop_intersect(long[] arr1, long[] arr2, int wordOffset, int numWords) {
long popCount = 0;
for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i) {
popCount += Long.bitCount(arr1[i] & arr2[i]);
}
return popCount;
} | java | public static long pop_intersect(long[] arr1, long[] arr2, int wordOffset, int numWords) {
long popCount = 0;
for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i) {
popCount += Long.bitCount(arr1[i] & arr2[i]);
}
return popCount;
} | [
"public",
"static",
"long",
"pop_intersect",
"(",
"long",
"[",
"]",
"arr1",
",",
"long",
"[",
"]",
"arr2",
",",
"int",
"wordOffset",
",",
"int",
"numWords",
")",
"{",
"long",
"popCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"wordOffset",
",",
... | Returns the popcount or cardinality of the two sets after an intersection.
Neither array is modified. | [
"Returns",
"the",
"popcount",
"or",
"cardinality",
"of",
"the",
"two",
"sets",
"after",
"an",
"intersection",
".",
"Neither",
"array",
"is",
"modified",
"."
] | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/java/com/carrotsearch/hppc/BitUtil.java#L50-L56 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.invokeTaskAsync | private Observable<Indexable> invokeTaskAsync(final TaskGroupEntry<TaskItem> entry, final InvocationContext context) {
return Observable.defer(new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
if (isGroupCancelled.get()) {
// One or more tasks are in faulted state, though this task MAYBE invoked if it does not
// have faulted tasks as transitive dependencies, we won't do it since group is cancelled
// due to termination strategy TERMINATE_ON_IN_PROGRESS_TASKS_COMPLETION.
//
return processFaultedTaskAsync(entry, taskCancelledException, context);
} else {
// Any cached result will be ignored for root resource
//
boolean ignoreCachedResult = isRootEntry(entry) || (entry.proxy() != null && isRootEntry(entry.proxy()));
Observable<Indexable> taskObservable = entry.invokeTaskAsync(ignoreCachedResult, context);
Func1<Indexable, Observable<Indexable>> onResult = new Func1<Indexable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Indexable taskResult) {
return Observable.just(taskResult);
}
};
Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Throwable taskError) {
return processFaultedTaskAsync(entry, taskError, context);
}
};
Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
return processCompletedTaskAsync(entry, context);
}
};
return taskObservable.flatMap(onResult, onError, onComplete);
}
}
});
} | java | private Observable<Indexable> invokeTaskAsync(final TaskGroupEntry<TaskItem> entry, final InvocationContext context) {
return Observable.defer(new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
if (isGroupCancelled.get()) {
// One or more tasks are in faulted state, though this task MAYBE invoked if it does not
// have faulted tasks as transitive dependencies, we won't do it since group is cancelled
// due to termination strategy TERMINATE_ON_IN_PROGRESS_TASKS_COMPLETION.
//
return processFaultedTaskAsync(entry, taskCancelledException, context);
} else {
// Any cached result will be ignored for root resource
//
boolean ignoreCachedResult = isRootEntry(entry) || (entry.proxy() != null && isRootEntry(entry.proxy()));
Observable<Indexable> taskObservable = entry.invokeTaskAsync(ignoreCachedResult, context);
Func1<Indexable, Observable<Indexable>> onResult = new Func1<Indexable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Indexable taskResult) {
return Observable.just(taskResult);
}
};
Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Throwable taskError) {
return processFaultedTaskAsync(entry, taskError, context);
}
};
Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
return processCompletedTaskAsync(entry, context);
}
};
return taskObservable.flatMap(onResult, onError, onComplete);
}
}
});
} | [
"private",
"Observable",
"<",
"Indexable",
">",
"invokeTaskAsync",
"(",
"final",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"entry",
",",
"final",
"InvocationContext",
"context",
")",
"{",
"return",
"Observable",
".",
"defer",
"(",
"new",
"Func0",
"<",
"Observable"... | Invokes the task stored in the given entry.
<p>
if the task cannot be invoked because the group marked as cancelled then an observable
that emit {@link TaskCancelledException} will be returned.
@param entry the entry holding task
@param context a group level shared context that is passed to {@link TaskItem#invokeAsync(InvocationContext)}
method of the task item this entry wraps.
@return an observable that emits result of task in the given entry and result of subset of tasks which gets
scheduled after this task. | [
"Invokes",
"the",
"task",
"stored",
"in",
"the",
"given",
"entry",
".",
"<p",
">",
"if",
"the",
"task",
"cannot",
"be",
"invoked",
"because",
"the",
"group",
"marked",
"as",
"cancelled",
"then",
"an",
"observable",
"that",
"emit",
"{",
"@link",
"TaskCancel... | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L380-L418 |
code4everything/util | src/main/java/com/zhazhapan/util/ReflectUtils.java | ReflectUtils.addClassesInPackageByFile | public static void addClassesInPackageByFile(String packageName, String packagePath, List<Class<?>> classes) throws ClassNotFoundException {
File dir = new File(packagePath);
if (!dir.exists() || !dir.isDirectory()) {
return;
}
File[] files = dir.listFiles(file -> (file.isDirectory()) || (file.getName().endsWith(".class")));
if (Checker.isNotNull(files)) {
for (File file : files) {
if (file.isDirectory()) {
addClassesInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), classes);
} else {
String className = file.getName().substring(0, file.getName().length() - 6);
classes.add(Class.forName(packageName + '.' + className));
}
}
}
} | java | public static void addClassesInPackageByFile(String packageName, String packagePath, List<Class<?>> classes) throws ClassNotFoundException {
File dir = new File(packagePath);
if (!dir.exists() || !dir.isDirectory()) {
return;
}
File[] files = dir.listFiles(file -> (file.isDirectory()) || (file.getName().endsWith(".class")));
if (Checker.isNotNull(files)) {
for (File file : files) {
if (file.isDirectory()) {
addClassesInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), classes);
} else {
String className = file.getName().substring(0, file.getName().length() - 6);
classes.add(Class.forName(packageName + '.' + className));
}
}
}
} | [
"public",
"static",
"void",
"addClassesInPackageByFile",
"(",
"String",
"packageName",
",",
"String",
"packagePath",
",",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"throws",
"ClassNotFoundException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",... | 以文件的形式来获取包下的所有类
@param packageName 包名
@param packagePath 包路径
@param classes 文件列表
@throws ClassNotFoundException 异常 | [
"以文件的形式来获取包下的所有类"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/ReflectUtils.java#L277-L293 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java | ApiOvhVrack.serviceName_dedicatedCloud_dedicatedCloud_GET | public OvhDedicatedCloud serviceName_dedicatedCloud_dedicatedCloud_GET(String serviceName, String dedicatedCloud) throws IOException {
String qPath = "/vrack/{serviceName}/dedicatedCloud/{dedicatedCloud}";
StringBuilder sb = path(qPath, serviceName, dedicatedCloud);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDedicatedCloud.class);
} | java | public OvhDedicatedCloud serviceName_dedicatedCloud_dedicatedCloud_GET(String serviceName, String dedicatedCloud) throws IOException {
String qPath = "/vrack/{serviceName}/dedicatedCloud/{dedicatedCloud}";
StringBuilder sb = path(qPath, serviceName, dedicatedCloud);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDedicatedCloud.class);
} | [
"public",
"OvhDedicatedCloud",
"serviceName_dedicatedCloud_dedicatedCloud_GET",
"(",
"String",
"serviceName",
",",
"String",
"dedicatedCloud",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vrack/{serviceName}/dedicatedCloud/{dedicatedCloud}\"",
";",
"StringBuilde... | Get this object properties
REST: GET /vrack/{serviceName}/dedicatedCloud/{dedicatedCloud}
@param serviceName [required] The internal name of your vrack
@param dedicatedCloud [required] your dedicated cloud service | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L513-L518 |
toddfast/typeconverter | src/main/java/com/toddfast/util/convert/TypeConverter.java | TypeConverter.asLong | public static long asLong(Object value, long nullValue) {
value=convert(Long.class,value);
if (value!=null) {
return ((Long)value).longValue();
}
else {
return nullValue;
}
} | java | public static long asLong(Object value, long nullValue) {
value=convert(Long.class,value);
if (value!=null) {
return ((Long)value).longValue();
}
else {
return nullValue;
}
} | [
"public",
"static",
"long",
"asLong",
"(",
"Object",
"value",
",",
"long",
"nullValue",
")",
"{",
"value",
"=",
"convert",
"(",
"Long",
".",
"class",
",",
"value",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"(",
"(",
"Long",
")... | Return the value converted to a long
or the specified alternate value if the original value is null. Note,
this method still throws {@link IllegalArgumentException} if the value
is not null and could not be converted.
@param value
The value to be converted
@param nullValue
The value to be returned if {@link value} is null. Note, this
value will not be returned if the conversion fails otherwise.
@throws IllegalArgumentException
If the value cannot be converted | [
"Return",
"the",
"value",
"converted",
"to",
"a",
"long",
"or",
"the",
"specified",
"alternate",
"value",
"if",
"the",
"original",
"value",
"is",
"null",
".",
"Note",
"this",
"method",
"still",
"throws",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"... | train | https://github.com/toddfast/typeconverter/blob/44efa352254faa49edaba5c5935389705aa12b90/src/main/java/com/toddfast/util/convert/TypeConverter.java#L561-L569 |
apereo/cas | support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java | SamlMetadataUIParserAction.verifyRegisteredService | protected void verifyRegisteredService(final RequestContext requestContext, final RegisteredService registeredService) {
if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
LOGGER.debug("Service [{}] is not recognized/allowed by the CAS service registry", registeredService);
if (registeredService != null) {
WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(requestContext, registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
}
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
} | java | protected void verifyRegisteredService(final RequestContext requestContext, final RegisteredService registeredService) {
if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
LOGGER.debug("Service [{}] is not recognized/allowed by the CAS service registry", registeredService);
if (registeredService != null) {
WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(requestContext, registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
}
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
}
} | [
"protected",
"void",
"verifyRegisteredService",
"(",
"final",
"RequestContext",
"requestContext",
",",
"final",
"RegisteredService",
"registeredService",
")",
"{",
"if",
"(",
"registeredService",
"==",
"null",
"||",
"!",
"registeredService",
".",
"getAccessStrategy",
"(... | Verify registered service.
@param requestContext the request context
@param registeredService the registered service | [
"Verify",
"registered",
"service",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java#L89-L97 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.splitBracketsAsList | @Pure
@Inline(value = "textUtil.splitAsList('{', '}', $1)", imported = {TextUtil.class})
public static List<String> splitBracketsAsList(String str) {
return splitAsList('{', '}', str);
} | java | @Pure
@Inline(value = "textUtil.splitAsList('{', '}', $1)", imported = {TextUtil.class})
public static List<String> splitBracketsAsList(String str) {
return splitAsList('{', '}', str);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"textUtil.splitAsList('{', '}', $1)\"",
",",
"imported",
"=",
"{",
"TextUtil",
".",
"class",
"}",
")",
"public",
"static",
"List",
"<",
"String",
">",
"splitBracketsAsList",
"(",
"String",
"str",
")",
"{",
"re... | Split the given string according to brackets.
The brackets are used to delimit the groups
of characters.
<p>Examples:
<ul>
<li><code>splitBrackets("{a}{b}{cd}")</code> returns the array
<code>["a","b","cd"]</code></li>
<li><code>splitBrackets("abcd")</code> returns the array
<code>["abcd"]</code></li>
<li><code>splitBrackets("a{bcd")</code> returns the array
<code>["a","bcd"]</code></li>
</ul>
@param str is the elements enclosed by backets.
@return the groups of strings | [
"Split",
"the",
"given",
"string",
"according",
"to",
"brackets",
".",
"The",
"brackets",
"are",
"used",
"to",
"delimit",
"the",
"groups",
"of",
"characters",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L663-L667 |
knowm/XChange | xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/service/BitstampAccountService.java | BitstampAccountService.requestDepositAddress | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
if (currency.equals(Currency.BTC)) {
return getBitstampBitcoinDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.LTC)) {
return getBitstampLitecoinDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.XRP)) {
return getRippleDepositAddress().getAddressAndDt();
} else if (currency.equals(Currency.BCH)) {
return getBitstampBitcoinCashDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.ETH)) {
return getBitstampEthereumDepositAddress().getDepositAddress();
} else {
throw new IllegalStateException("Unsupported currency " + currency);
}
} | java | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
if (currency.equals(Currency.BTC)) {
return getBitstampBitcoinDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.LTC)) {
return getBitstampLitecoinDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.XRP)) {
return getRippleDepositAddress().getAddressAndDt();
} else if (currency.equals(Currency.BCH)) {
return getBitstampBitcoinCashDepositAddress().getDepositAddress();
} else if (currency.equals(Currency.ETH)) {
return getBitstampEthereumDepositAddress().getDepositAddress();
} else {
throw new IllegalStateException("Unsupported currency " + currency);
}
} | [
"@",
"Override",
"public",
"String",
"requestDepositAddress",
"(",
"Currency",
"currency",
",",
"String",
"...",
"arguments",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"BTC",
")",
")",
"{",
"return",
"getB... | This returns the currently set deposit address. It will not generate a new address (ie.
repeated calls will return the same address). | [
"This",
"returns",
"the",
"currently",
"set",
"deposit",
"address",
".",
"It",
"will",
"not",
"generate",
"a",
"new",
"address",
"(",
"ie",
".",
"repeated",
"calls",
"will",
"return",
"the",
"same",
"address",
")",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/service/BitstampAccountService.java#L113-L128 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintBackground | private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) {
// if the background color of the component is 100% transparent
// then we should not paint any background graphics. This is a solution
// for there being no way of turning off Nimbus background painting as
// basic components are all non-opaque by default.
Component c = ctx.getComponent();
Color bg = (c != null) ? c.getBackground() : null;
if (bg == null || bg.getAlpha() > 0) {
SeaGlassPainter backgroundPainter = style.getBackgroundPainter(ctx);
if (backgroundPainter != null) {
paint(backgroundPainter, ctx, g, x, y, w, h, transform);
}
}
} | java | private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) {
// if the background color of the component is 100% transparent
// then we should not paint any background graphics. This is a solution
// for there being no way of turning off Nimbus background painting as
// basic components are all non-opaque by default.
Component c = ctx.getComponent();
Color bg = (c != null) ? c.getBackground() : null;
if (bg == null || bg.getAlpha() > 0) {
SeaGlassPainter backgroundPainter = style.getBackgroundPainter(ctx);
if (backgroundPainter != null) {
paint(backgroundPainter, ctx, g, x, y, w, h, transform);
}
}
} | [
"private",
"void",
"paintBackground",
"(",
"SynthContext",
"ctx",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"AffineTransform",
"transform",
")",
"{",
"// if the background color of the component is 100% transpar... | Paint the object's background.
@param ctx the SynthContext.
@param g the Graphics context.
@param x the x location corresponding to the upper-left
coordinate to paint.
@param y the y location corresponding to the upper left
coordinate to paint.
@param w the width to paint.
@param h the height to paint.
@param transform the affine transform to apply, or {@code null} if none
is to be applied. | [
"Paint",
"the",
"object",
"s",
"background",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L133-L148 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java | PropertyHelper.convertToClass | public static Object convertToClass(String value, Class<?> clazz) {
Object propertyValue;
if (clazz.isAssignableFrom(int.class)) {
propertyValue = Integer.parseInt(value);
}
else if (clazz.isAssignableFrom(long.class)) {
propertyValue = Long.parseLong(value);
}
else if (clazz.isAssignableFrom(float.class)) {
propertyValue = Float.parseFloat(value);
}
else if (clazz.isAssignableFrom(boolean.class)) {
propertyValue = Boolean.parseBoolean(value);
} else {
propertyValue = value;
}
return propertyValue;
} | java | public static Object convertToClass(String value, Class<?> clazz) {
Object propertyValue;
if (clazz.isAssignableFrom(int.class)) {
propertyValue = Integer.parseInt(value);
}
else if (clazz.isAssignableFrom(long.class)) {
propertyValue = Long.parseLong(value);
}
else if (clazz.isAssignableFrom(float.class)) {
propertyValue = Float.parseFloat(value);
}
else if (clazz.isAssignableFrom(boolean.class)) {
propertyValue = Boolean.parseBoolean(value);
} else {
propertyValue = value;
}
return propertyValue;
} | [
"public",
"static",
"Object",
"convertToClass",
"(",
"String",
"value",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Object",
"propertyValue",
";",
"if",
"(",
"clazz",
".",
"isAssignableFrom",
"(",
"int",
".",
"class",
")",
")",
"{",
"propertyValue",
... | Converts a value to the type of the given field.
@param value
@param field
@return | [
"Converts",
"a",
"value",
"to",
"the",
"type",
"of",
"the",
"given",
"field",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java#L59-L76 |
groupon/odo | browsermob-proxy/src/main/java/com/groupon/odo/bmp/BrowserMobProxyHandler.java | BrowserMobProxyHandler.wireUpSslWithCyberVilliansCAOdo | protected X509Certificate wireUpSslWithCyberVilliansCAOdo(String host, SslListener listener) {
host = requestOriginalHostName.get();
// Add cybervillians CA(from browsermob)
try {
// see https://github.com/webmetrics/browsermob-proxy/issues/105
String escapedHost = host.replace('*', '_');
KeyStoreManager keyStoreManager = Utils.getKeyStoreManager(escapedHost);
keyStoreManager.getKeyStore().deleteEntry(KeyStoreManager._caPrivKeyAlias);
keyStoreManager.persist();
listener.setKeystore(new File("seleniumSslSupport" + File.separator + escapedHost + File.separator + "cybervillainsCA.jks").getAbsolutePath());
return keyStoreManager.getCertificateByAlias(escapedHost);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | protected X509Certificate wireUpSslWithCyberVilliansCAOdo(String host, SslListener listener) {
host = requestOriginalHostName.get();
// Add cybervillians CA(from browsermob)
try {
// see https://github.com/webmetrics/browsermob-proxy/issues/105
String escapedHost = host.replace('*', '_');
KeyStoreManager keyStoreManager = Utils.getKeyStoreManager(escapedHost);
keyStoreManager.getKeyStore().deleteEntry(KeyStoreManager._caPrivKeyAlias);
keyStoreManager.persist();
listener.setKeystore(new File("seleniumSslSupport" + File.separator + escapedHost + File.separator + "cybervillainsCA.jks").getAbsolutePath());
return keyStoreManager.getCertificateByAlias(escapedHost);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"protected",
"X509Certificate",
"wireUpSslWithCyberVilliansCAOdo",
"(",
"String",
"host",
",",
"SslListener",
"listener",
")",
"{",
"host",
"=",
"requestOriginalHostName",
".",
"get",
"(",
")",
";",
"// Add cybervillians CA(from browsermob)",
"try",
"{",
"// see https://g... | This function wires up a SSL Listener with the cyber villians root CA and cert with the correct CNAME for the request
@param host
@param listener | [
"This",
"function",
"wires",
"up",
"a",
"SSL",
"Listener",
"with",
"the",
"cyber",
"villians",
"root",
"CA",
"and",
"cert",
"with",
"the",
"correct",
"CNAME",
"for",
"the",
"request"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/browsermob-proxy/src/main/java/com/groupon/odo/bmp/BrowserMobProxyHandler.java#L450-L467 |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java | SystemPropertyContext.addOrReplaceProperty | @SuppressWarnings("WeakerAccess")
void addOrReplaceProperty(final String name, final Object value) {
final String currentValue = SecurityActions.setPropertyPrivileged(name, value.toString());
if (currentValue != null) {
propertiesToReset.put(name, currentValue);
} else {
propertiesToClear.add(name);
}
} | java | @SuppressWarnings("WeakerAccess")
void addOrReplaceProperty(final String name, final Object value) {
final String currentValue = SecurityActions.setPropertyPrivileged(name, value.toString());
if (currentValue != null) {
propertiesToReset.put(name, currentValue);
} else {
propertiesToClear.add(name);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"void",
"addOrReplaceProperty",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"String",
"currentValue",
"=",
"SecurityActions",
".",
"setPropertyPrivileged",
"(",
"name",
... | Adds or replaces the system property. If the system property already exists with a different value on
{@link #restore()} the system property will be set back to it's previous value.
@param name the name of the property
@param value the value to set | [
"Adds",
"or",
"replaces",
"the",
"system",
"property",
".",
"If",
"the",
"system",
"property",
"already",
"exists",
"with",
"a",
"different",
"value",
"on",
"{",
"@link",
"#restore",
"()",
"}",
"the",
"system",
"property",
"will",
"be",
"set",
"back",
"to"... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L105-L113 |
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/ManagedDatabasesInner.java | ManagedDatabasesInner.completeRestore | public void completeRestore(String locationName, UUID operationId, String lastBackupName) {
completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().last().body();
} | java | public void completeRestore(String locationName, UUID operationId, String lastBackupName) {
completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().last().body();
} | [
"public",
"void",
"completeRestore",
"(",
"String",
"locationName",
",",
"UUID",
"operationId",
",",
"String",
"lastBackupName",
")",
"{",
"completeRestoreWithServiceResponseAsync",
"(",
"locationName",
",",
"operationId",
",",
"lastBackupName",
")",
".",
"toBlocking",
... | Completes the restore operation on a managed database.
@param locationName The name of the region where the resource is located.
@param operationId Management operation id that this request tries to complete.
@param lastBackupName The last backup name to apply
@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 | [
"Completes",
"the",
"restore",
"operation",
"on",
"a",
"managed",
"database",
"."
] | 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/ManagedDatabasesInner.java#L125-L127 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.snapOnly30s | private static int snapOnly30s(int degrees, int forceHigherOrLower) {
int stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE;
int floor = (degrees / stepSize) * stepSize;
int ceiling = floor + stepSize;
if (forceHigherOrLower == 1) {
degrees = ceiling;
} else if (forceHigherOrLower == -1) {
if (degrees == floor) {
floor -= stepSize;
}
degrees = floor;
} else {
if ((degrees - floor) < (ceiling - degrees)) {
degrees = floor;
} else {
degrees = ceiling;
}
}
return degrees;
} | java | private static int snapOnly30s(int degrees, int forceHigherOrLower) {
int stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE;
int floor = (degrees / stepSize) * stepSize;
int ceiling = floor + stepSize;
if (forceHigherOrLower == 1) {
degrees = ceiling;
} else if (forceHigherOrLower == -1) {
if (degrees == floor) {
floor -= stepSize;
}
degrees = floor;
} else {
if ((degrees - floor) < (ceiling - degrees)) {
degrees = floor;
} else {
degrees = ceiling;
}
}
return degrees;
} | [
"private",
"static",
"int",
"snapOnly30s",
"(",
"int",
"degrees",
",",
"int",
"forceHigherOrLower",
")",
"{",
"int",
"stepSize",
"=",
"HOUR_VALUE_TO_DEGREES_STEP_SIZE",
";",
"int",
"floor",
"=",
"(",
"degrees",
"/",
"stepSize",
")",
"*",
"stepSize",
";",
"int"... | Returns mapping of any input degrees (0 to 360) to one of 12 visible output degrees (all
multiples of 30), where the input will be "snapped" to the closest visible degrees.
@param degrees The input degrees
@param forceHigherOrLower The output may be forced to either the higher or lower step, or may
be allowed to snap to whichever is closer. Use 1 to force strictly higher, -1 to force
strictly lower, and 0 to snap to the closer one.
@return output degrees, will be a multiple of 30 | [
"Returns",
"mapping",
"of",
"any",
"input",
"degrees",
"(",
"0",
"to",
"360",
")",
"to",
"one",
"of",
"12",
"visible",
"output",
"degrees",
"(",
"all",
"multiples",
"of",
"30",
")",
"where",
"the",
"input",
"will",
"be",
"snapped",
"to",
"the",
"closes... | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L411-L430 |
derari/cthul | log/src/main/java/org/cthul/log/CLogConfigurationBase.java | CLogConfigurationBase.detectClass | protected static String detectClass(int i) {
if (i < 1) {
throw new IllegalArgumentException("Expected value > 0, got " + i);
}
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
// 0 getStackTrace
// 1 detectClass
// 2 getLogger
// 3 caller
if (stack.length <= i+2) return "";
return stack[i+2].getClassName();
} | java | protected static String detectClass(int i) {
if (i < 1) {
throw new IllegalArgumentException("Expected value > 0, got " + i);
}
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
// 0 getStackTrace
// 1 detectClass
// 2 getLogger
// 3 caller
if (stack.length <= i+2) return "";
return stack[i+2].getClassName();
} | [
"protected",
"static",
"String",
"detectClass",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected value > 0, got \"",
"+",
"i",
")",
";",
"}",
"StackTraceElement",
"[",
"]",
"stack",
... | {@code i == 0} identifies the caller of this method, for {@code i > 0},
the stack is walked upwards.
@param i
@return class name | [
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/log/src/main/java/org/cthul/log/CLogConfigurationBase.java#L56-L67 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/ui/VdmEvaluationContextManager.java | VdmEvaluationContextManager.getEvaluationContext | public static IVdmStackFrame getEvaluationContext(IWorkbenchWindow window)
{
List<IWorkbenchWindow> alreadyVisited = new ArrayList<IWorkbenchWindow>();
if (window == null)
{
window = fgManager.fActiveWindow;
}
return getEvaluationContext(window, alreadyVisited);
} | java | public static IVdmStackFrame getEvaluationContext(IWorkbenchWindow window)
{
List<IWorkbenchWindow> alreadyVisited = new ArrayList<IWorkbenchWindow>();
if (window == null)
{
window = fgManager.fActiveWindow;
}
return getEvaluationContext(window, alreadyVisited);
} | [
"public",
"static",
"IVdmStackFrame",
"getEvaluationContext",
"(",
"IWorkbenchWindow",
"window",
")",
"{",
"List",
"<",
"IWorkbenchWindow",
">",
"alreadyVisited",
"=",
"new",
"ArrayList",
"<",
"IWorkbenchWindow",
">",
"(",
")",
";",
"if",
"(",
"window",
"==",
"n... | Returns the evaluation context for the given window, or <code>null</code> if none. The evaluation context
corresponds to the selected stack frame in the following priority order:
<ol>
<li>stack frame in active page of the window</li>
<li>stack frame in another page of the window</li>
<li>stack frame in active page of another window</li>
<li>stack frame in a page of another window</li>
</ol>
@param window
the window that the evaluation action was invoked from, or <code>null</code> if the current window
should be consulted
@return the stack frame that supplies an evaluation context, or <code>null</code> if none
@return IJavaStackFrame | [
"Returns",
"the",
"evaluation",
"context",
"for",
"the",
"given",
"window",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"none",
".",
"The",
"evaluation",
"context",
"corresponds",
"to",
"the",
"selected",
"stack",
"frame",
"in",
"the",
"following",
... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/VdmEvaluationContextManager.java#L264-L272 |
UrielCh/ovh-java-sdk | ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java | ApiOvhLicenseoffice.serviceName_user_POST | public OvhOfficeTask serviceName_user_POST(String serviceName, String domain, String firstName, String lastName, OvhLicenceEnum licence, String login) throws IOException {
String qPath = "/license/office/{serviceName}/user";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "firstName", firstName);
addBody(o, "lastName", lastName);
addBody(o, "licence", licence);
addBody(o, "login", login);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOfficeTask.class);
} | java | public OvhOfficeTask serviceName_user_POST(String serviceName, String domain, String firstName, String lastName, OvhLicenceEnum licence, String login) throws IOException {
String qPath = "/license/office/{serviceName}/user";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "firstName", firstName);
addBody(o, "lastName", lastName);
addBody(o, "licence", licence);
addBody(o, "login", login);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOfficeTask.class);
} | [
"public",
"OvhOfficeTask",
"serviceName_user_POST",
"(",
"String",
"serviceName",
",",
"String",
"domain",
",",
"String",
"firstName",
",",
"String",
"lastName",
",",
"OvhLicenceEnum",
"licence",
",",
"String",
"login",
")",
"throws",
"IOException",
"{",
"String",
... | Create new office user
REST: POST /license/office/{serviceName}/user
@param lastName [required] Account last name
@param firstName [required] Account first name
@param login [required] Account login
@param licence [required] Office licence
@param domain [required] Office domain
@param serviceName [required] The unique identifier of your Office service | [
"Create",
"new",
"office",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java#L217-L228 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.comparableTemplate | @Deprecated
public static <T extends Comparable<?>> ComparableTemplate<T> comparableTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
return comparableTemplate(cl, createTemplate(template), args);
} | java | @Deprecated
public static <T extends Comparable<?>> ComparableTemplate<T> comparableTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
return comparableTemplate(cl, createTemplate(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
">",
">",
"ComparableTemplate",
"<",
"T",
">",
"comparableTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"ImmutableList",
"<"... | Create a new Template expression
@deprecated Use {@link #comparableTemplate(Class, String, List)} instead.
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L413-L417 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/TypedCollections.java | TypedCollections.dynamicallyCastList | @SuppressWarnings("unchecked")
static <E> List<E> dynamicallyCastList(List<?> list, Class<E> type) {
return dynamicallyCastCollection(list, type, List.class);
} | java | @SuppressWarnings("unchecked")
static <E> List<E> dynamicallyCastList(List<?> list, Class<E> type) {
return dynamicallyCastCollection(list, type, List.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"dynamicallyCastList",
"(",
"List",
"<",
"?",
">",
"list",
",",
"Class",
"<",
"E",
">",
"type",
")",
"{",
"return",
"dynamicallyCastCollection",
"(",
"lis... | Dynamically check that the members of the list are all instances of
the given type (or null).
@param <E>
the list's element type
@param list
the list to cast
@param type
the class of the list's element type.
@return the dynamically-type checked list.
@throws java.lang.ClassCastException | [
"Dynamically",
"check",
"that",
"the",
"members",
"of",
"the",
"list",
"are",
"all",
"instances",
"of",
"the",
"given",
"type",
"(",
"or",
"null",
")",
"."
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/TypedCollections.java#L104-L107 |
aws/aws-sdk-java | aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateIdentityProviderRequest.java | UpdateIdentityProviderRequest.withAttributeMapping | public UpdateIdentityProviderRequest withAttributeMapping(java.util.Map<String, String> attributeMapping) {
setAttributeMapping(attributeMapping);
return this;
} | java | public UpdateIdentityProviderRequest withAttributeMapping(java.util.Map<String, String> attributeMapping) {
setAttributeMapping(attributeMapping);
return this;
} | [
"public",
"UpdateIdentityProviderRequest",
"withAttributeMapping",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributeMapping",
")",
"{",
"setAttributeMapping",
"(",
"attributeMapping",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The identity provider attribute mapping to be changed.
</p>
@param attributeMapping
The identity provider attribute mapping to be changed.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"identity",
"provider",
"attribute",
"mapping",
"to",
"be",
"changed",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateIdentityProviderRequest.java#L238-L241 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/BandwidthClient.java | BandwidthClient.generatePostRequest | protected HttpPost generatePostRequest(final String path, final Map<String, Object> paramMap) {
final HttpPost post = new HttpPost(buildUri(path));
post.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON));
return post;
} | java | protected HttpPost generatePostRequest(final String path, final Map<String, Object> paramMap) {
final HttpPost post = new HttpPost(buildUri(path));
post.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON));
return post;
} | [
"protected",
"HttpPost",
"generatePostRequest",
"(",
"final",
"String",
"path",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"final",
"HttpPost",
"post",
"=",
"new",
"HttpPost",
"(",
"buildUri",
"(",
"path",
")",
")",
";",
... | Helper method to build the POST request for the server.
@param path the path.
@param paramMap the parameters map.
@return the post object. | [
"Helper",
"method",
"to",
"build",
"the",
"POST",
"request",
"for",
"the",
"server",
"."
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L626-L630 |
udoprog/ffwd-client-java | src/main/java/com/google/protobuf250/CodedOutputStream.java | CodedOutputStream.writeMessage | public void writeMessage(final int fieldNumber, final MessageLite value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
writeMessageNoTag(value);
} | java | public void writeMessage(final int fieldNumber, final MessageLite value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
writeMessageNoTag(value);
} | [
"public",
"void",
"writeMessage",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"MessageLite",
"value",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"fieldNumber",
",",
"WireFormat",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
";",
"writeMessageNoTag",
"(",
... | Write an embedded message field, including tag, to the stream. | [
"Write",
"an",
"embedded",
"message",
"field",
"including",
"tag",
"to",
"the",
"stream",
"."
] | train | https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L219-L223 |
ag-gipp/MathMLTools | mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java | XMLHelper.getElementB | public static Node getElementB(Node node, XPathExpression xPath) throws XPathExpressionException {
return getElementsB(node, xPath).item(0);
} | java | public static Node getElementB(Node node, XPathExpression xPath) throws XPathExpressionException {
return getElementsB(node, xPath).item(0);
} | [
"public",
"static",
"Node",
"getElementB",
"(",
"Node",
"node",
",",
"XPathExpression",
"xPath",
")",
"throws",
"XPathExpressionException",
"{",
"return",
"getElementsB",
"(",
"node",
",",
"xPath",
")",
".",
"item",
"(",
"0",
")",
";",
"}"
] | Helper program: Extracts the specified XPATH expression
from an XML-String.
@param node the node
@param xPath the x path
@return NodeList
@throws XPathExpressionException the x path expression exception | [
"Helper",
"program",
":",
"Extracts",
"the",
"specified",
"XPATH",
"expression",
"from",
"an",
"XML",
"-",
"String",
"."
] | train | https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java#L154-L156 |
graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.buildRelation | RelationImpl buildRelation(EdgeElement edge) {
return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.get(edge)));
} | java | RelationImpl buildRelation(EdgeElement edge) {
return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.get(edge)));
} | [
"RelationImpl",
"buildRelation",
"(",
"EdgeElement",
"edge",
")",
"{",
"return",
"getOrBuildConcept",
"(",
"edge",
",",
"(",
"e",
")",
"-",
">",
"RelationImpl",
".",
"create",
"(",
"RelationEdge",
".",
"get",
"(",
"edge",
")",
")",
")",
";",
"}"
] | Used by RelationEdge to build a RelationImpl object out of a provided Edge | [
"Used",
"by",
"RelationEdge",
"to",
"build",
"a",
"RelationImpl",
"object",
"out",
"of",
"a",
"provided",
"Edge"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L113-L115 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/config/Schema.java | Schema.getColumnFamilyType | public ColumnFamilyType getColumnFamilyType(String ksName, String cfName)
{
assert ksName != null && cfName != null;
CFMetaData cfMetaData = getCFMetaData(ksName, cfName);
return (cfMetaData == null) ? null : cfMetaData.cfType;
} | java | public ColumnFamilyType getColumnFamilyType(String ksName, String cfName)
{
assert ksName != null && cfName != null;
CFMetaData cfMetaData = getCFMetaData(ksName, cfName);
return (cfMetaData == null) ? null : cfMetaData.cfType;
} | [
"public",
"ColumnFamilyType",
"getColumnFamilyType",
"(",
"String",
"ksName",
",",
"String",
"cfName",
")",
"{",
"assert",
"ksName",
"!=",
"null",
"&&",
"cfName",
"!=",
"null",
";",
"CFMetaData",
"cfMetaData",
"=",
"getCFMetaData",
"(",
"ksName",
",",
"cfName",
... | Get type of the ColumnFamily but it's keyspace/name
@param ksName The keyspace name
@param cfName The ColumnFamily name
@return The type of the ColumnFamily | [
"Get",
"type",
"of",
"the",
"ColumnFamily",
"but",
"it",
"s",
"keyspace",
"/",
"name"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/Schema.java#L223-L228 |
wanglinsong/thx-webservice | src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java | WebServiceCommunication.postEntity | public String postEntity(String endpoint, HttpEntity entity) throws IOException {
return this.postEntity(endpoint, "", entity, "");
} | java | public String postEntity(String endpoint, HttpEntity entity) throws IOException {
return this.postEntity(endpoint, "", entity, "");
} | [
"public",
"String",
"postEntity",
"(",
"String",
"endpoint",
",",
"HttpEntity",
"entity",
")",
"throws",
"IOException",
"{",
"return",
"this",
".",
"postEntity",
"(",
"endpoint",
",",
"\"\"",
",",
"entity",
",",
"\"\"",
")",
";",
"}"
] | Issues HTTP POST request, returns response body as string.
@param endpoint endpoint of request url
@param entity request entity
@return response body
@throws IOException in case of any IO related issue | [
"Issues",
"HTTP",
"POST",
"request",
"returns",
"response",
"body",
"as",
"string",
"."
] | train | https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L983-L985 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java | KeyManagementServiceClient.asymmetricSign | public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
AsymmetricSignRequest request =
AsymmetricSignRequest.newBuilder().setName(name).setDigest(digest).build();
return asymmetricSign(request);
} | java | public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
AsymmetricSignRequest request =
AsymmetricSignRequest.newBuilder().setName(name).setDigest(digest).build();
return asymmetricSign(request);
} | [
"public",
"final",
"AsymmetricSignResponse",
"asymmetricSign",
"(",
"String",
"name",
",",
"Digest",
"digest",
")",
"{",
"AsymmetricSignRequest",
"request",
"=",
"AsymmetricSignRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"setDiges... | Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a
signature that can be verified with the public key retrieved from
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
<p>Sample code:
<pre><code>
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = Digest.newBuilder().build();
AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name.toString(), digest);
}
</code></pre>
@param name Required. The resource name of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.
@param digest Required. The digest of the data to sign. The digest must be produced with the
same digest algorithm as specified by the key version's
[algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Signs",
"data",
"using",
"a",
"[",
"CryptoKeyVersion",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
".",
"CryptoKeyVersion",
"]",
"with",
"[",
"CryptoKey",
".",
"purpose",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
".",
"Cr... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L2413-L2418 |
jfinal/jfinal | src/main/java/com/jfinal/template/EngineConfig.java | EngineConfig.reloadSharedFunctionSourceList | private synchronized void reloadSharedFunctionSourceList() {
Map<String, Define> newMap = createSharedFunctionMap();
for (int i = 0, size = sharedFunctionSourceList.size(); i < size; i++) {
ISource source = sharedFunctionSourceList.get(i);
String fileName = source instanceof FileSource ? ((FileSource)source).getFileName() : null;
Env env = new Env(this);
new Parser(env, source.getContent(), fileName).parse();
addToSharedFunctionMap(newMap, env);
if (devMode) {
env.addSource(source);
}
}
this.sharedFunctionMap = newMap;
} | java | private synchronized void reloadSharedFunctionSourceList() {
Map<String, Define> newMap = createSharedFunctionMap();
for (int i = 0, size = sharedFunctionSourceList.size(); i < size; i++) {
ISource source = sharedFunctionSourceList.get(i);
String fileName = source instanceof FileSource ? ((FileSource)source).getFileName() : null;
Env env = new Env(this);
new Parser(env, source.getContent(), fileName).parse();
addToSharedFunctionMap(newMap, env);
if (devMode) {
env.addSource(source);
}
}
this.sharedFunctionMap = newMap;
} | [
"private",
"synchronized",
"void",
"reloadSharedFunctionSourceList",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Define",
">",
"newMap",
"=",
"createSharedFunctionMap",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"sharedFunctionSourceList... | Reload shared function source list
devMode 要照顾到 sharedFunctionFiles,所以暂不提供
removeSharedFunction(String functionName) 功能
开发者可直接使用模板注释功能将不需要的 function 直接注释掉 | [
"Reload",
"shared",
"function",
"source",
"list"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/EngineConfig.java#L183-L197 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/GeneralPath.java | GeneralPath.shapeOf | public static GeneralPath shapeOf(Shape shape, Color color) {
List<PathElement> elements = new ArrayList<PathElement>();
PathIterator pathIt = shape.getPathIterator(new AffineTransform());
double[] data = new double[6];
while (!pathIt.isDone()) {
switch (pathIt.currentSegment(data)) {
case PathIterator.SEG_MOVETO:
elements.add(new MoveTo(data));
break;
case PathIterator.SEG_LINETO:
elements.add(new LineTo(data));
break;
case PathIterator.SEG_CLOSE:
elements.add(new Close());
break;
case PathIterator.SEG_QUADTO:
elements.add(new QuadTo(data));
break;
case PathIterator.SEG_CUBICTO:
elements.add(new CubicTo(data));
break;
}
pathIt.next();
}
return new GeneralPath(elements, color, pathIt.getWindingRule(), 0d, true);
} | java | public static GeneralPath shapeOf(Shape shape, Color color) {
List<PathElement> elements = new ArrayList<PathElement>();
PathIterator pathIt = shape.getPathIterator(new AffineTransform());
double[] data = new double[6];
while (!pathIt.isDone()) {
switch (pathIt.currentSegment(data)) {
case PathIterator.SEG_MOVETO:
elements.add(new MoveTo(data));
break;
case PathIterator.SEG_LINETO:
elements.add(new LineTo(data));
break;
case PathIterator.SEG_CLOSE:
elements.add(new Close());
break;
case PathIterator.SEG_QUADTO:
elements.add(new QuadTo(data));
break;
case PathIterator.SEG_CUBICTO:
elements.add(new CubicTo(data));
break;
}
pathIt.next();
}
return new GeneralPath(elements, color, pathIt.getWindingRule(), 0d, true);
} | [
"public",
"static",
"GeneralPath",
"shapeOf",
"(",
"Shape",
"shape",
",",
"Color",
"color",
")",
"{",
"List",
"<",
"PathElement",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"PathElement",
">",
"(",
")",
";",
"PathIterator",
"pathIt",
"=",
"shape",
".",... | Create a filled path of the specified Java 2D Shape and color.
@param shape Java 2D shape
@param color the color to fill the shape with
@return a new general path | [
"Create",
"a",
"filled",
"path",
"of",
"the",
"specified",
"Java",
"2D",
"Shape",
"and",
"color",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/GeneralPath.java#L132-L157 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.unTar | public static void unTar(File inFile, File untarDir) throws IOException {
if (!untarDir.mkdirs()) {
if (!untarDir.isDirectory()) {
throw new IOException("Mkdirs failed to create " + untarDir);
}
}
StringBuffer untarCommand = new StringBuffer();
boolean gzipped = inFile.toString().endsWith("gz");
if (gzipped) {
untarCommand.append(" gzip -dc '");
untarCommand.append(FileUtil.makeShellPath(inFile));
untarCommand.append("' | (");
}
untarCommand.append("cd '");
untarCommand.append(FileUtil.makeShellPath(untarDir));
untarCommand.append("' ; ");
untarCommand.append("tar -xf ");
if (gzipped) {
untarCommand.append(" -)");
} else {
untarCommand.append(FileUtil.makeShellPath(inFile));
}
String[] shellCmd = { "bash", "-c", untarCommand.toString() };
ShellCommandExecutor shexec = new ShellCommandExecutor(shellCmd);
shexec.execute();
int exitcode = shexec.getExitCode();
if (exitcode != 0) {
throw new IOException("Error untarring file " + inFile +
". Tar process exited with exit code " + exitcode);
}
} | java | public static void unTar(File inFile, File untarDir) throws IOException {
if (!untarDir.mkdirs()) {
if (!untarDir.isDirectory()) {
throw new IOException("Mkdirs failed to create " + untarDir);
}
}
StringBuffer untarCommand = new StringBuffer();
boolean gzipped = inFile.toString().endsWith("gz");
if (gzipped) {
untarCommand.append(" gzip -dc '");
untarCommand.append(FileUtil.makeShellPath(inFile));
untarCommand.append("' | (");
}
untarCommand.append("cd '");
untarCommand.append(FileUtil.makeShellPath(untarDir));
untarCommand.append("' ; ");
untarCommand.append("tar -xf ");
if (gzipped) {
untarCommand.append(" -)");
} else {
untarCommand.append(FileUtil.makeShellPath(inFile));
}
String[] shellCmd = { "bash", "-c", untarCommand.toString() };
ShellCommandExecutor shexec = new ShellCommandExecutor(shellCmd);
shexec.execute();
int exitcode = shexec.getExitCode();
if (exitcode != 0) {
throw new IOException("Error untarring file " + inFile +
". Tar process exited with exit code " + exitcode);
}
} | [
"public",
"static",
"void",
"unTar",
"(",
"File",
"inFile",
",",
"File",
"untarDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"untarDir",
".",
"mkdirs",
"(",
")",
")",
"{",
"if",
"(",
"!",
"untarDir",
".",
"isDirectory",
"(",
")",
")",
"{",... | Given a Tar File as input it will untar the file in a the untar directory
passed as the second parameter
This utility will untar ".tar" files and ".tar.gz","tgz" files.
@param inFile The tar file as input.
@param untarDir The untar directory where to untar the tar file.
@throws IOException | [
"Given",
"a",
"Tar",
"File",
"as",
"input",
"it",
"will",
"untar",
"the",
"file",
"in",
"a",
"the",
"untar",
"directory",
"passed",
"as",
"the",
"second",
"parameter"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L680-L712 |
facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerCore.java | ServerCore.queueNotifications | private void queueNotifications(long clientId, NamespaceEvent event, long txId)
throws TransactionIdTooOldException, InvalidClientIdException {
if (txId == -1) {
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Queueing notifications for client " + clientId + " from txId " +
txId + " at [" + event.path + ", " +
EventType.fromByteValue(event.type) + "] ...");
}
ClientData clientData = clientsData.get(clientId);
if (clientData == null) {
LOG.error("Missing the client data for client id: " + clientId);
throw new InvalidClientIdException("Missing the client data");
}
// Store the notifications in the queue for this client
serverHistory.addNotificationsToQueue(event, txId, clientData.queue);
} | java | private void queueNotifications(long clientId, NamespaceEvent event, long txId)
throws TransactionIdTooOldException, InvalidClientIdException {
if (txId == -1) {
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Queueing notifications for client " + clientId + " from txId " +
txId + " at [" + event.path + ", " +
EventType.fromByteValue(event.type) + "] ...");
}
ClientData clientData = clientsData.get(clientId);
if (clientData == null) {
LOG.error("Missing the client data for client id: " + clientId);
throw new InvalidClientIdException("Missing the client data");
}
// Store the notifications in the queue for this client
serverHistory.addNotificationsToQueue(event, txId, clientData.queue);
} | [
"private",
"void",
"queueNotifications",
"(",
"long",
"clientId",
",",
"NamespaceEvent",
"event",
",",
"long",
"txId",
")",
"throws",
"TransactionIdTooOldException",
",",
"InvalidClientIdException",
"{",
"if",
"(",
"txId",
"==",
"-",
"1",
")",
"{",
"return",
";"... | Queues the notification for a client. The queued notifications will be sent
asynchronously after this method returns to the specified client.
The queued notifications will be notifications for the given event and
their associated transaction id is greater then the given transaction
id (exclusive).
@param clientId the client to which the notifications should be sent
@param event the subscribed event
@param txId the transaction id from which we should send the
notifications (exclusive). If this is -1, then
nothing will be queued for this client.
@throws TransactionIdTooOldException when the history has no records for
the given transaction id.
@throws InvalidClientIdException when the client isn't registered | [
"Queues",
"the",
"notification",
"for",
"a",
"client",
".",
"The",
"queued",
"notifications",
"will",
"be",
"sent",
"asynchronously",
"after",
"this",
"method",
"returns",
"to",
"the",
"specified",
"client",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerCore.java#L667-L687 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java | DeleteHandler.deleteEdgeReference | public boolean deleteEdgeReference(AtlasEdge edge, DataTypes.TypeCategory typeCategory, boolean isComposite,
boolean forceDeleteStructTrait) throws AtlasException {
if (LOG.isDebugEnabled()) {
LOG.debug("Deleting {}", string(edge));
}
boolean forceDelete =
(typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT) && forceDeleteStructTrait;
if (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT
|| (typeCategory == DataTypes.TypeCategory.CLASS && isComposite)) {
//If the vertex is of type struct/trait, delete the edge and then the reference vertex as the vertex is not shared by any other entities.
//If the vertex is of type class, and its composite attribute, this reference vertex' lifecycle is controlled
//through this delete, hence delete the edge and the reference vertex.
AtlasVertex vertexForDelete = edge.getInVertex();
//If deleting the edge and then the in vertex, reverse attribute shouldn't be updated
deleteEdge(edge, false, forceDelete);
deleteTypeVertex(vertexForDelete, typeCategory, forceDelete);
} else {
//If the vertex is of type class, and its not a composite attributes, the reference AtlasVertex' lifecycle is not controlled
//through this delete. Hence just remove the reference edge. Leave the reference AtlasVertex as is
//If deleting just the edge, reverse attribute should be updated for any references
//For example, for the department type system, if the person's manager edge is deleted, subordinates of manager should be updated
deleteEdge(edge, true, false);
}
return !softDelete || forceDelete;
} | java | public boolean deleteEdgeReference(AtlasEdge edge, DataTypes.TypeCategory typeCategory, boolean isComposite,
boolean forceDeleteStructTrait) throws AtlasException {
if (LOG.isDebugEnabled()) {
LOG.debug("Deleting {}", string(edge));
}
boolean forceDelete =
(typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT) && forceDeleteStructTrait;
if (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT
|| (typeCategory == DataTypes.TypeCategory.CLASS && isComposite)) {
//If the vertex is of type struct/trait, delete the edge and then the reference vertex as the vertex is not shared by any other entities.
//If the vertex is of type class, and its composite attribute, this reference vertex' lifecycle is controlled
//through this delete, hence delete the edge and the reference vertex.
AtlasVertex vertexForDelete = edge.getInVertex();
//If deleting the edge and then the in vertex, reverse attribute shouldn't be updated
deleteEdge(edge, false, forceDelete);
deleteTypeVertex(vertexForDelete, typeCategory, forceDelete);
} else {
//If the vertex is of type class, and its not a composite attributes, the reference AtlasVertex' lifecycle is not controlled
//through this delete. Hence just remove the reference edge. Leave the reference AtlasVertex as is
//If deleting just the edge, reverse attribute should be updated for any references
//For example, for the department type system, if the person's manager edge is deleted, subordinates of manager should be updated
deleteEdge(edge, true, false);
}
return !softDelete || forceDelete;
} | [
"public",
"boolean",
"deleteEdgeReference",
"(",
"AtlasEdge",
"edge",
",",
"DataTypes",
".",
"TypeCategory",
"typeCategory",
",",
"boolean",
"isComposite",
",",
"boolean",
"forceDeleteStructTrait",
")",
"throws",
"AtlasException",
"{",
"if",
"(",
"LOG",
".",
"isDebu... | Force delete is used to remove struct/trait in case of entity updates
@param edge
@param typeCategory
@param isComposite
@param forceDeleteStructTrait
@return returns true if the edge reference is hard deleted
@throws AtlasException | [
"Force",
"delete",
"is",
"used",
"to",
"remove",
"struct",
"/",
"trait",
"in",
"case",
"of",
"entity",
"updates"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java#L211-L238 |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java | TransformationPerformer.transformObject | public Object transformObject(TransformationDescription description, Object source, Object target)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
checkNeededValues(description);
Class<?> sourceClass = modelRegistry.loadModel(description.getSourceModel());
Class<?> targetClass = modelRegistry.loadModel(description.getTargetModel());
if (!sourceClass.isAssignableFrom(source.getClass())) {
throw new IllegalArgumentException("The given source object does not match the given description");
}
this.source = source;
if (target == null) {
this.target = targetClass.newInstance();
} else {
this.target = target;
}
for (TransformationStep step : description.getTransformingSteps()) {
performTransformationStep(step);
}
return this.target;
} | java | public Object transformObject(TransformationDescription description, Object source, Object target)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
checkNeededValues(description);
Class<?> sourceClass = modelRegistry.loadModel(description.getSourceModel());
Class<?> targetClass = modelRegistry.loadModel(description.getTargetModel());
if (!sourceClass.isAssignableFrom(source.getClass())) {
throw new IllegalArgumentException("The given source object does not match the given description");
}
this.source = source;
if (target == null) {
this.target = targetClass.newInstance();
} else {
this.target = target;
}
for (TransformationStep step : description.getTransformingSteps()) {
performTransformationStep(step);
}
return this.target;
} | [
"public",
"Object",
"transformObject",
"(",
"TransformationDescription",
"description",
",",
"Object",
"source",
",",
"Object",
"target",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"ClassNotFoundException",
"{",
"checkNeededValues",
"(",
... | Performs a transformation based merge of the given source object with the given target object based on the given
TransformationDescription. | [
"Performs",
"a",
"transformation",
"based",
"merge",
"of",
"the",
"given",
"source",
"object",
"with",
"the",
"given",
"target",
"object",
"based",
"on",
"the",
"given",
"TransformationDescription",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L90-L108 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/io/tbx/TbxExporter.java | TbxExporter.exportTBXDocument | private void exportTBXDocument(Document tbxDocument, Writer writer) throws TransformerException {
// Prepare the transformer to persist the file
TransformerFactory transformerFactory = TransformerFactory
.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
"http://ttc-project.googlecode.com/files/tbxcore.dtd");
transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
try {
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
} catch (IllegalArgumentException e) {
throw new TransformerException(e);
} // Ignore
// Actually persist the file
DOMSource source = new DOMSource(tbxDocument);
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
} | java | private void exportTBXDocument(Document tbxDocument, Writer writer) throws TransformerException {
// Prepare the transformer to persist the file
TransformerFactory transformerFactory = TransformerFactory
.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
"http://ttc-project.googlecode.com/files/tbxcore.dtd");
transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
try {
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
} catch (IllegalArgumentException e) {
throw new TransformerException(e);
} // Ignore
// Actually persist the file
DOMSource source = new DOMSource(tbxDocument);
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
} | [
"private",
"void",
"exportTBXDocument",
"(",
"Document",
"tbxDocument",
",",
"Writer",
"writer",
")",
"throws",
"TransformerException",
"{",
"// Prepare the transformer to persist the file",
"TransformerFactory",
"transformerFactory",
"=",
"TransformerFactory",
".",
"newInstanc... | Export the TBX document to a file specified in parameter.
@throws TransformerException | [
"Export",
"the",
"TBX",
"document",
"to",
"a",
"file",
"specified",
"in",
"parameter",
"."
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/io/tbx/TbxExporter.java#L133-L153 |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java | OneForOneBlockFetcher.failRemainingBlocks | private void failRemainingBlocks(String[] failedBlockIds, Throwable e) {
for (String blockId : failedBlockIds) {
try {
listener.onBlockFetchFailure(blockId, e);
} catch (Exception e2) {
logger.error("Error in block fetch failure callback", e2);
}
}
} | java | private void failRemainingBlocks(String[] failedBlockIds, Throwable e) {
for (String blockId : failedBlockIds) {
try {
listener.onBlockFetchFailure(blockId, e);
} catch (Exception e2) {
logger.error("Error in block fetch failure callback", e2);
}
}
} | [
"private",
"void",
"failRemainingBlocks",
"(",
"String",
"[",
"]",
"failedBlockIds",
",",
"Throwable",
"e",
")",
"{",
"for",
"(",
"String",
"blockId",
":",
"failedBlockIds",
")",
"{",
"try",
"{",
"listener",
".",
"onBlockFetchFailure",
"(",
"blockId",
",",
"... | Invokes the "onBlockFetchFailure" callback for every listed block id. | [
"Invokes",
"the",
"onBlockFetchFailure",
"callback",
"for",
"every",
"listed",
"block",
"id",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java#L145-L153 |
leancloud/java-sdk-all | realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java | AVIMConversation.set | public void set(String key, Object value) {
if (!StringUtil.isEmpty(key) && null != value) {
pendingInstanceData.put(key, value);
}
} | java | public void set(String key, Object value) {
if (!StringUtil.isEmpty(key) && null != value) {
pendingInstanceData.put(key, value);
}
} | [
"public",
"void",
"set",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"key",
")",
"&&",
"null",
"!=",
"value",
")",
"{",
"pendingInstanceData",
".",
"put",
"(",
"key",
",",
"value",
")",
... | Add a key-value pair to this conversation
@param key Keys must be alphanumerical plus underscore, and start with a letter.
@param value Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other
AVObjects. value may not be null. | [
"Add",
"a",
"key",
"-",
"value",
"pair",
"to",
"this",
"conversation"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L318-L322 |
line/armeria | it/spring/boot-tomcat/src/main/java/com/linecorp/armeria/spring/tomcat/demo/GreetingController.java | GreetingController.greetingSync | @GetMapping
public ResponseEntity<Greeting> greetingSync(
@RequestParam(value = "name", defaultValue = "World") String name) {
return ResponseEntity.ok(new Greeting(String.format(template, name)));
} | java | @GetMapping
public ResponseEntity<Greeting> greetingSync(
@RequestParam(value = "name", defaultValue = "World") String name) {
return ResponseEntity.ok(new Greeting(String.format(template, name)));
} | [
"@",
"GetMapping",
"public",
"ResponseEntity",
"<",
"Greeting",
">",
"greetingSync",
"(",
"@",
"RequestParam",
"(",
"value",
"=",
"\"name\"",
",",
"defaultValue",
"=",
"\"World\"",
")",
"String",
"name",
")",
"{",
"return",
"ResponseEntity",
".",
"ok",
"(",
... | Greeting endpoint.
@param name name to greet.
@return response the ResponseEntity. | [
"Greeting",
"endpoint",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/it/spring/boot-tomcat/src/main/java/com/linecorp/armeria/spring/tomcat/demo/GreetingController.java#L35-L39 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StreamUtil.java | StreamUtil.copy | public static void copy(final InputStream in, final OutputStream out, final int bufferSize)
throws IOException {
final byte[] buf = new byte[bufferSize];
int bytesRead = in.read(buf);
while (bytesRead != -1) {
out.write(buf, 0, bytesRead);
bytesRead = in.read(buf);
}
out.flush();
} | java | public static void copy(final InputStream in, final OutputStream out, final int bufferSize)
throws IOException {
final byte[] buf = new byte[bufferSize];
int bytesRead = in.read(buf);
while (bytesRead != -1) {
out.write(buf, 0, bytesRead);
bytesRead = in.read(buf);
}
out.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
",",
"final",
"int",
"bufferSize",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
... | Copies information from the input stream to the output stream using a specified buffer size.
@param in the source stream.
@param out the destination stream.
@param bufferSize the buffer size.
@throws IOException if there is an error reading or writing to the streams. | [
"Copies",
"information",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"using",
"a",
"specified",
"buffer",
"size",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StreamUtil.java#L54-L65 |
igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java | RosterEntry.toRosterItem | static RosterPacket.Item toRosterItem(RosterEntry entry, String name) {
return toRosterItem(entry, name, false);
} | java | static RosterPacket.Item toRosterItem(RosterEntry entry, String name) {
return toRosterItem(entry, name, false);
} | [
"static",
"RosterPacket",
".",
"Item",
"toRosterItem",
"(",
"RosterEntry",
"entry",
",",
"String",
"name",
")",
"{",
"return",
"toRosterItem",
"(",
"entry",
",",
"name",
",",
"false",
")",
";",
"}"
] | Convert the RosterEntry to a Roster stanza <item/> element.
@param entry the roster entry
@param name the name of the roster item.
@return the roster item. | [
"Convert",
"the",
"RosterEntry",
"to",
"a",
"Roster",
"stanza",
"<",
";",
"item",
"/",
">",
";",
"element",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java#L302-L304 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java | DatePickerDialog.newInstance | public static DatePickerDialog newInstance(OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
DatePickerDialog ret = new DatePickerDialog();
ret.initialize(callBack, year, monthOfYear, dayOfMonth);
return ret;
} | java | public static DatePickerDialog newInstance(OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
DatePickerDialog ret = new DatePickerDialog();
ret.initialize(callBack, year, monthOfYear, dayOfMonth);
return ret;
} | [
"public",
"static",
"DatePickerDialog",
"newInstance",
"(",
"OnDateSetListener",
"callBack",
",",
"int",
"year",
",",
"int",
"monthOfYear",
",",
"int",
"dayOfMonth",
")",
"{",
"DatePickerDialog",
"ret",
"=",
"new",
"DatePickerDialog",
"(",
")",
";",
"ret",
".",
... | Create a new DatePickerDialog instance with a specific initial selection.
@param callBack How the parent is notified that the date is set.
@param year The initial year of the dialog.
@param monthOfYear The initial month of the dialog.
@param dayOfMonth The initial day of the dialog.
@return a new DatePickerDialog instance. | [
"Create",
"a",
"new",
"DatePickerDialog",
"instance",
"with",
"a",
"specific",
"initial",
"selection",
"."
] | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L203-L207 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/MetricsCommand.java | MetricsCommand.printMetric | private void printMetric(String metricName, String nickName, boolean valueIsBytes) {
if (mMetricsMap == null || !mMetricsMap.containsKey(metricName)) {
return;
}
MetricValue metricValue = mMetricsMap.get(metricName);
String formattedValue = valueIsBytes ? FormatUtils.getSizeFromBytes(metricValue.getLongValue())
: getFormattedValue(metricValue);
mPrintStream.println(INDENT + String.format(mInfoFormat,
nickName == null ? metricName : nickName, formattedValue));
mMetricsMap.remove(metricName);
} | java | private void printMetric(String metricName, String nickName, boolean valueIsBytes) {
if (mMetricsMap == null || !mMetricsMap.containsKey(metricName)) {
return;
}
MetricValue metricValue = mMetricsMap.get(metricName);
String formattedValue = valueIsBytes ? FormatUtils.getSizeFromBytes(metricValue.getLongValue())
: getFormattedValue(metricValue);
mPrintStream.println(INDENT + String.format(mInfoFormat,
nickName == null ? metricName : nickName, formattedValue));
mMetricsMap.remove(metricName);
} | [
"private",
"void",
"printMetric",
"(",
"String",
"metricName",
",",
"String",
"nickName",
",",
"boolean",
"valueIsBytes",
")",
"{",
"if",
"(",
"mMetricsMap",
"==",
"null",
"||",
"!",
"mMetricsMap",
".",
"containsKey",
"(",
"metricName",
")",
")",
"{",
"retur... | Prints the metrics information.
@param metricName the metric name to get a metric value
@param nickName the metric name to print
@param valueIsBytes whether the metric value is bytes | [
"Prints",
"the",
"metrics",
"information",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/MetricsCommand.java#L160-L170 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/exceptions/DataStoreAdapterException.java | DataStoreAdapterException.formatMessage | private static final String formatMessage(String resourceKey, Throwable exception, Object... formatArguments) {
String message = Tr.formatMessage(tc, resourceKey, formatArguments);
if (exception instanceof SQLException) {
SQLException sqlX = (SQLException) exception;
StringBuilder st = new StringBuilder(message.length() + 40);
st.append(message).append(" with SQL State : ").append(sqlX.getSQLState()).append(" SQL Code : ").append(sqlX.getErrorCode());
message = st.toString();
}
return message;
} | java | private static final String formatMessage(String resourceKey, Throwable exception, Object... formatArguments) {
String message = Tr.formatMessage(tc, resourceKey, formatArguments);
if (exception instanceof SQLException) {
SQLException sqlX = (SQLException) exception;
StringBuilder st = new StringBuilder(message.length() + 40);
st.append(message).append(" with SQL State : ").append(sqlX.getSQLState()).append(" SQL Code : ").append(sqlX.getErrorCode());
message = st.toString();
}
return message;
} | [
"private",
"static",
"final",
"String",
"formatMessage",
"(",
"String",
"resourceKey",
",",
"Throwable",
"exception",
",",
"Object",
"...",
"formatArguments",
")",
"{",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"resourceKey",
",",
"... | Utility method that preserves existing behavior of appending SQL State/error code to a translated message. | [
"Utility",
"method",
"that",
"preserves",
"existing",
"behavior",
"of",
"appending",
"SQL",
"State",
"/",
"error",
"code",
"to",
"a",
"translated",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/exceptions/DataStoreAdapterException.java#L171-L180 |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/NelderMead.java | NelderMead.setReflection | public void setReflection(double reflection)
{
if(reflection <=0 || Double.isNaN(reflection) || Double.isInfinite(reflection) )
throw new ArithmeticException("Reflection constant must be > 0, not " + reflection);
this.reflection = reflection;
} | java | public void setReflection(double reflection)
{
if(reflection <=0 || Double.isNaN(reflection) || Double.isInfinite(reflection) )
throw new ArithmeticException("Reflection constant must be > 0, not " + reflection);
this.reflection = reflection;
} | [
"public",
"void",
"setReflection",
"(",
"double",
"reflection",
")",
"{",
"if",
"(",
"reflection",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"reflection",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"reflection",
")",
")",
"throw",
"new",
"ArithmeticE... | Sets the reflection constant, which must be greater than 0
@param reflection the reflection constant | [
"Sets",
"the",
"reflection",
"constant",
"which",
"must",
"be",
"greater",
"than",
"0"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/NelderMead.java#L61-L66 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBAssert.java | DBAssert.assertTableExistence | static void assertTableExistence(CallInfo callInfo, DB db, String tableName, boolean expected) {
boolean actual = tableExists(callInfo, db, tableName);
SimpleAssertion assertion = new SimpleAssertion(null, expected, actual);
db.log(callInfo, assertion);
if (!assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | java | static void assertTableExistence(CallInfo callInfo, DB db, String tableName, boolean expected) {
boolean actual = tableExists(callInfo, db, tableName);
SimpleAssertion assertion = new SimpleAssertion(null, expected, actual);
db.log(callInfo, assertion);
if (!assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | [
"static",
"void",
"assertTableExistence",
"(",
"CallInfo",
"callInfo",
",",
"DB",
"db",
",",
"String",
"tableName",
",",
"boolean",
"expected",
")",
"{",
"boolean",
"actual",
"=",
"tableExists",
"(",
"callInfo",
",",
"db",
",",
"tableName",
")",
";",
"Simple... | Assert if table exists or not.
@param callInfo Call info.
@param db Database.
@param tableName Table.
@param expected Expect if table exists or not. | [
"Assert",
"if",
"table",
"exists",
"or",
"not",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBAssert.java#L147-L154 |
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.addHierarchicalEntityChildWithServiceResponseAsync | public Observable<ServiceResponse<UUID>> addHierarchicalEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (hEntityId == null) {
throw new IllegalArgumentException("Parameter hEntityId is required and cannot be null.");
}
final String name = addHierarchicalEntityChildOptionalParameter != null ? addHierarchicalEntityChildOptionalParameter.name() : null;
return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, name);
} | java | public Observable<ServiceResponse<UUID>> addHierarchicalEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (hEntityId == null) {
throw new IllegalArgumentException("Parameter hEntityId is required and cannot be null.");
}
final String name = addHierarchicalEntityChildOptionalParameter != null ? addHierarchicalEntityChildOptionalParameter.name() : null;
return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"UUID",
">",
">",
"addHierarchicalEntityChildWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"AddHierarchicalEntityChildOptionalParameter",
"addHierarchicalEntityC... | Creates a single child in an existing hierarchical entity model.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param addHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Creates",
"a",
"single",
"child",
"in",
"an",
"existing",
"hierarchical",
"entity",
"model",
"."
] | 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#L6693-L6709 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPUnitInjectionBinding.java | JPAPUnitInjectionBinding.newPersistenceUnit | private static PersistenceUnit newPersistenceUnit(final String fJndiName, final String fUnitName)
{
return new PersistenceUnit()
{
@Override
public String name()
{
return fJndiName;
}
@Override
public Class<? extends Annotation> annotationType()
{
return javax.persistence.PersistenceUnit.class;
}
@Override
public String unitName()
{
return fUnitName;
}
@Override
public String toString()
{
return "JPA.PersistenceUnit(name=" + fJndiName +
", unitName=" + fUnitName + ")";
}
};
} | java | private static PersistenceUnit newPersistenceUnit(final String fJndiName, final String fUnitName)
{
return new PersistenceUnit()
{
@Override
public String name()
{
return fJndiName;
}
@Override
public Class<? extends Annotation> annotationType()
{
return javax.persistence.PersistenceUnit.class;
}
@Override
public String unitName()
{
return fUnitName;
}
@Override
public String toString()
{
return "JPA.PersistenceUnit(name=" + fJndiName +
", unitName=" + fUnitName + ")";
}
};
} | [
"private",
"static",
"PersistenceUnit",
"newPersistenceUnit",
"(",
"final",
"String",
"fJndiName",
",",
"final",
"String",
"fUnitName",
")",
"{",
"return",
"new",
"PersistenceUnit",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"name",
"(",
")",
"{",
"re... | This transient PersistencUnit annotation class has no default value.
i.e. null is a valid value for some fields. | [
"This",
"transient",
"PersistencUnit",
"annotation",
"class",
"has",
"no",
"default",
"value",
".",
"i",
".",
"e",
".",
"null",
"is",
"a",
"valid",
"value",
"for",
"some",
"fields",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPUnitInjectionBinding.java#L231-L260 |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java | OutgoingRequestContext.setAttribute | public void setAttribute(String id, Object obj, boolean save) {
if (save) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history == null) {
history = new LinkedList<>();
setAttribute(historyAttribute, history);
}
if (this.getAttribute(id) != null) {
history.add(getAttribute(id));
}
}
setAttribute(id, obj);
} | java | public void setAttribute(String id, Object obj, boolean save) {
if (save) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history == null) {
history = new LinkedList<>();
setAttribute(historyAttribute, history);
}
if (this.getAttribute(id) != null) {
history.add(getAttribute(id));
}
}
setAttribute(id, obj);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"id",
",",
"Object",
"obj",
",",
"boolean",
"save",
")",
"{",
"if",
"(",
"save",
")",
"{",
"String",
"historyAttribute",
"=",
"id",
"+",
"\"history\"",
";",
"Queue",
"<",
"Object",
">",
"history",
"=",
"... | Set attribute and save previous attribute value
@param id
attribute name
@param obj
value
@param save
save previous attribute value to restore later | [
"Set",
"attribute",
"and",
"save",
"previous",
"attribute",
"value"
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java#L92-L105 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java | ModelUtils.concreteConstructorFor | @Nullable
public ExecutableElement concreteConstructorFor(TypeElement classElement, AnnotationUtils annotationUtils) {
List<ExecutableElement> constructors = findNonPrivateConstructors(classElement);
if (constructors.isEmpty()) {
return null;
}
if (constructors.size() == 1) {
return constructors.get(0);
}
Optional<ExecutableElement> element = constructors.stream().filter(ctor -> {
final AnnotationMetadata annotationMetadata = annotationUtils.getAnnotationMetadata(ctor);
return annotationMetadata.hasStereotype(Inject.class) || annotationMetadata.hasStereotype(Creator.class);
}
).findFirst();
if (!element.isPresent()) {
element = constructors.stream().filter(ctor ->
ctor.getModifiers().contains(PUBLIC)
).findFirst();
}
return element.orElse(null);
} | java | @Nullable
public ExecutableElement concreteConstructorFor(TypeElement classElement, AnnotationUtils annotationUtils) {
List<ExecutableElement> constructors = findNonPrivateConstructors(classElement);
if (constructors.isEmpty()) {
return null;
}
if (constructors.size() == 1) {
return constructors.get(0);
}
Optional<ExecutableElement> element = constructors.stream().filter(ctor -> {
final AnnotationMetadata annotationMetadata = annotationUtils.getAnnotationMetadata(ctor);
return annotationMetadata.hasStereotype(Inject.class) || annotationMetadata.hasStereotype(Creator.class);
}
).findFirst();
if (!element.isPresent()) {
element = constructors.stream().filter(ctor ->
ctor.getModifiers().contains(PUBLIC)
).findFirst();
}
return element.orElse(null);
} | [
"@",
"Nullable",
"public",
"ExecutableElement",
"concreteConstructorFor",
"(",
"TypeElement",
"classElement",
",",
"AnnotationUtils",
"annotationUtils",
")",
"{",
"List",
"<",
"ExecutableElement",
">",
"constructors",
"=",
"findNonPrivateConstructors",
"(",
"classElement",
... | The constructor inject for the given class element.
@param classElement The class element
@param annotationUtils The annotation utilities
@return The constructor | [
"The",
"constructor",
"inject",
"for",
"the",
"given",
"class",
"element",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java#L214-L235 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java | OSMTablesFactory.createWayNodeTable | public static PreparedStatement createWayNodeTable(Connection connection, String wayNodeTableName) throws SQLException{
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayNodeTableName);
sb.append("(ID_WAY BIGINT, ID_NODE BIGINT, NODE_ORDER INT);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + wayNodeTableName + " VALUES ( ?, ?,?);");
} | java | public static PreparedStatement createWayNodeTable(Connection connection, String wayNodeTableName) throws SQLException{
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayNodeTableName);
sb.append("(ID_WAY BIGINT, ID_NODE BIGINT, NODE_ORDER INT);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + wayNodeTableName + " VALUES ( ?, ?,?);");
} | [
"public",
"static",
"PreparedStatement",
"createWayNodeTable",
"(",
"Connection",
"connection",
",",
"String",
"wayNodeTableName",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatement",
"(",
")",
")",
"{",
"... | Create a table to store the list of nodes for each way.
@param connection
@param wayNodeTableName
@return
@throws SQLException | [
"Create",
"a",
"table",
"to",
"store",
"the",
"list",
"of",
"nodes",
"for",
"each",
"way",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L205-L213 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java | FieldBuilder.buildFieldComments | public void buildFieldComments(XMLNode node, Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentElement, fieldDocTree);
}
} | java | public void buildFieldComments(XMLNode node, Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentElement, fieldDocTree);
}
} | [
"public",
"void",
"buildFieldComments",
"(",
"XMLNode",
"node",
",",
"Content",
"fieldDocTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"writer",
".",
"addComments",
"(",
"currentElement",
",",
"fieldDocTree",
")",
";",
"}",
"}... | Build the comments for the field. Do nothing if
{@link Configuration#nocomment} is set to true.
@param node the XML element that specifies which components to document
@param fieldDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"comments",
"for",
"the",
"field",
".",
"Do",
"nothing",
"if",
"{",
"@link",
"Configuration#nocomment",
"}",
"is",
"set",
"to",
"true",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java#L184-L188 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/impl/config/CustomPropertyConstructor.java | CustomPropertyConstructor.addPropertyAlias | protected final void addPropertyAlias(String alias, Class<?> type, String name) {
Map<String, Property> typeMap = properties.get(type);
if (typeMap == null) {
typeMap = new HashMap<String, Property>();
properties.put(type, typeMap);
}
try {
typeMap.put(alias, propertyUtils.getProperty(type, name));
} catch (IntrospectionException e) {
throw new RuntimeException(e);
}
} | java | protected final void addPropertyAlias(String alias, Class<?> type, String name) {
Map<String, Property> typeMap = properties.get(type);
if (typeMap == null) {
typeMap = new HashMap<String, Property>();
properties.put(type, typeMap);
}
try {
typeMap.put(alias, propertyUtils.getProperty(type, name));
} catch (IntrospectionException e) {
throw new RuntimeException(e);
}
} | [
"protected",
"final",
"void",
"addPropertyAlias",
"(",
"String",
"alias",
",",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Property",
">",
"typeMap",
"=",
"properties",
".",
"get",
"(",
"type",
")",
";",... | Adds an alias for a Javabean property name on a particular type.
The values of YAML keys with the alias name will be mapped to the
Javabean
property.
@param alias the bean property alias
@param type the bean property type
@param name the bean property name | [
"Adds",
"an",
"alias",
"for",
"a",
"Javabean",
"property",
"name",
"on",
"a",
"particular",
"type",
".",
"The",
"values",
"of",
"YAML",
"keys",
"with",
"the",
"alias",
"name",
"will",
"be",
"mapped",
"to",
"the",
"Javabean",
"property",
"."
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/impl/config/CustomPropertyConstructor.java#L50-L63 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java | HelixAxisAligner.calcPrincipalRotationVector | private void calcPrincipalRotationVector() {
// AxisAngle4d axisAngle = helixLayers.getByLowestAngle().getAxisAngle();
AxisAngle4d axisAngle = helixLayers.getByLargestContacts().getAxisAngle();
principalRotationVector = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z);
} | java | private void calcPrincipalRotationVector() {
// AxisAngle4d axisAngle = helixLayers.getByLowestAngle().getAxisAngle();
AxisAngle4d axisAngle = helixLayers.getByLargestContacts().getAxisAngle();
principalRotationVector = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z);
} | [
"private",
"void",
"calcPrincipalRotationVector",
"(",
")",
"{",
"//\t\tAxisAngle4d axisAngle = helixLayers.getByLowestAngle().getAxisAngle();",
"AxisAngle4d",
"axisAngle",
"=",
"helixLayers",
".",
"getByLargestContacts",
"(",
")",
".",
"getAxisAngle",
"(",
")",
";",
"princip... | Returns a vector along the principal rotation axis for the
alignment of structures along the z-axis
@return principal rotation vector | [
"Returns",
"a",
"vector",
"along",
"the",
"principal",
"rotation",
"axis",
"for",
"the",
"alignment",
"of",
"structures",
"along",
"the",
"z",
"-",
"axis"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java#L601-L605 |
buschmais/jqa-java-plugin | src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java | SignatureHelper.getMethodSignature | public static String getMethodSignature(String name, String rawSignature) {
StringBuilder signature = new StringBuilder();
String returnType = org.objectweb.asm.Type.getReturnType(rawSignature).getClassName();
if (returnType != null) {
signature.append(returnType);
signature.append(' ');
}
signature.append(name);
signature.append('(');
org.objectweb.asm.Type[] types = org.objectweb.asm.Type.getArgumentTypes(rawSignature);
for (int i = 0; i < types.length; i++) {
if (i > 0) {
signature.append(',');
}
signature.append(types[i].getClassName());
}
signature.append(')');
return signature.toString();
} | java | public static String getMethodSignature(String name, String rawSignature) {
StringBuilder signature = new StringBuilder();
String returnType = org.objectweb.asm.Type.getReturnType(rawSignature).getClassName();
if (returnType != null) {
signature.append(returnType);
signature.append(' ');
}
signature.append(name);
signature.append('(');
org.objectweb.asm.Type[] types = org.objectweb.asm.Type.getArgumentTypes(rawSignature);
for (int i = 0; i < types.length; i++) {
if (i > 0) {
signature.append(',');
}
signature.append(types[i].getClassName());
}
signature.append(')');
return signature.toString();
} | [
"public",
"static",
"String",
"getMethodSignature",
"(",
"String",
"name",
",",
"String",
"rawSignature",
")",
"{",
"StringBuilder",
"signature",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"returnType",
"=",
"org",
".",
"objectweb",
".",
"asm",
".",... | Return a method signature.
@param name
The method name.
@param rawSignature
The signature containing parameter, return and exception
values.
@return The method signature. | [
"Return",
"a",
"method",
"signature",
"."
] | train | https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java#L65-L83 |
VoltDB/voltdb | src/frontend/org/voltdb/exceptions/SQLException.java | SQLException.getSQLState | public String getSQLState()
{
String state = null;
try {
state = new String(m_sqlState, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
return state;
} | java | public String getSQLState()
{
String state = null;
try {
state = new String(m_sqlState, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
return state;
} | [
"public",
"String",
"getSQLState",
"(",
")",
"{",
"String",
"state",
"=",
"null",
";",
"try",
"{",
"state",
"=",
"new",
"String",
"(",
"m_sqlState",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"n... | Retrieve the SQLState code for the error that generated this exception.
@return Five character SQLState code. | [
"Retrieve",
"the",
"SQLState",
"code",
"for",
"the",
"error",
"that",
"generated",
"this",
"exception",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exceptions/SQLException.java#L66-L75 |
haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.setInput | private void setInput(double[] x) {
if (x.length != inputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, inputLayer.units));
}
System.arraycopy(x, 0, inputLayer.output, 0, inputLayer.units);
} | java | private void setInput(double[] x) {
if (x.length != inputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, inputLayer.units));
}
System.arraycopy(x, 0, inputLayer.output, 0, inputLayer.units);
} | [
"private",
"void",
"setInput",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"inputLayer",
".",
"units",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Invalid input vector size: %d,... | Sets the input vector into the input layer.
@param x the input vector. | [
"Sets",
"the",
"input",
"vector",
"into",
"the",
"input",
"layer",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L597-L602 |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java | EventEngineImpl.publishEvent | public EventImpl publishEvent(Event event, boolean async) {
EventImpl eventImpl = (EventImpl) event;
eventImpl.setReadOnly(true);
EventImpl currentEvent = (EventImpl) CurrentEvent.get();
if (null != currentEvent) {
eventImpl.setParent(currentEvent);
}
// Attempt to get the Topic object and cached TopicData but fallback
// to the topic name if the Topic object wasn't populated
Topic topic = eventImpl.getTopicObject();
String topicName = topic != null ? topic.getName() : eventImpl.getTopic();
TopicData topicData = topicCache.getTopicData(topic, topicName);
eventImpl.setTopicData(topicData);
// Required Java 2 Security check
checkTopicPublishPermission(topicName);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Publishing Event", topicName);
}
// Obtain list of matching handlers: returned list of handlers
// must be thread safe!
List<HandlerHolder> holders = topicData.getEventHandlers();
ExecutorService executor = topicData.getExecutorService();
if (async) {
int i = 0;
// Handle asynchronous events.
Future<?>[] futures = new Future<?>[holders.size()];
for (HandlerHolder holder : holders) {
holder.addEvent(eventImpl);
futures[i++] = queueWorkRequest(holder, executor);
}
eventImpl.setFutures(futures);
} else {
// fire synchronous events
for (HandlerHolder holder : holders) {
holder.fireSynchronousEvent(eventImpl);
}
}
return eventImpl;
} | java | public EventImpl publishEvent(Event event, boolean async) {
EventImpl eventImpl = (EventImpl) event;
eventImpl.setReadOnly(true);
EventImpl currentEvent = (EventImpl) CurrentEvent.get();
if (null != currentEvent) {
eventImpl.setParent(currentEvent);
}
// Attempt to get the Topic object and cached TopicData but fallback
// to the topic name if the Topic object wasn't populated
Topic topic = eventImpl.getTopicObject();
String topicName = topic != null ? topic.getName() : eventImpl.getTopic();
TopicData topicData = topicCache.getTopicData(topic, topicName);
eventImpl.setTopicData(topicData);
// Required Java 2 Security check
checkTopicPublishPermission(topicName);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Publishing Event", topicName);
}
// Obtain list of matching handlers: returned list of handlers
// must be thread safe!
List<HandlerHolder> holders = topicData.getEventHandlers();
ExecutorService executor = topicData.getExecutorService();
if (async) {
int i = 0;
// Handle asynchronous events.
Future<?>[] futures = new Future<?>[holders.size()];
for (HandlerHolder holder : holders) {
holder.addEvent(eventImpl);
futures[i++] = queueWorkRequest(holder, executor);
}
eventImpl.setFutures(futures);
} else {
// fire synchronous events
for (HandlerHolder holder : holders) {
holder.fireSynchronousEvent(eventImpl);
}
}
return eventImpl;
} | [
"public",
"EventImpl",
"publishEvent",
"(",
"Event",
"event",
",",
"boolean",
"async",
")",
"{",
"EventImpl",
"eventImpl",
"=",
"(",
"EventImpl",
")",
"event",
";",
"eventImpl",
".",
"setReadOnly",
"(",
"true",
")",
";",
"EventImpl",
"currentEvent",
"=",
"("... | Publish the specified event to all registered handlers that have an
interest in the event topic.
@param event
the Liberty <code>Event</code> to deliver
@param async
<code>true</code> if the event delivery can be done asynchronously
@return EventImpl | [
"Publish",
"the",
"specified",
"event",
"to",
"all",
"registered",
"handlers",
"that",
"have",
"an",
"interest",
"in",
"the",
"event",
"topic",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java#L270-L314 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java | BuildsInner.cancelAsync | public Observable<Void> cancelAsync(String resourceGroupName, String registryName, String buildId) {
return cancelWithServiceResponseAsync(resourceGroupName, registryName, buildId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> cancelAsync(String resourceGroupName, String registryName, String buildId) {
return cancelWithServiceResponseAsync(resourceGroupName, registryName, buildId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"cancelAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildId",
")",
"{",
"return",
"cancelWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildId",
... | Cancel an existing build.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildId The build ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Cancel",
"an",
"existing",
"build",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java#L911-L918 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.executeTx | @SuppressWarnings("unchecked")
protected <O> O executeTx(final TxCallable<O> c, final TxCallable<O> errorHandler) throws Exception {
Transaction transaction = beginTransaction();
configureTransDefault(transaction);
return processTransactionError(transaction, t -> {
Object o = null;
try {
o = c.call(t);
t.commit();
} catch (Throwable e) {
t.rollback(e);
throw e;
} finally {
t.end();
}
return (O) o;
}, errorHandler);
} | java | @SuppressWarnings("unchecked")
protected <O> O executeTx(final TxCallable<O> c, final TxCallable<O> errorHandler) throws Exception {
Transaction transaction = beginTransaction();
configureTransDefault(transaction);
return processTransactionError(transaction, t -> {
Object o = null;
try {
o = c.call(t);
t.commit();
} catch (Throwable e) {
t.rollback(e);
throw e;
} finally {
t.end();
}
return (O) o;
}, errorHandler);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"O",
">",
"O",
"executeTx",
"(",
"final",
"TxCallable",
"<",
"O",
">",
"c",
",",
"final",
"TxCallable",
"<",
"O",
">",
"errorHandler",
")",
"throws",
"Exception",
"{",
"Transaction",
"tr... | <p>executeTx.</p>
@param c a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object.
@param errorHandler a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object.
@param <O> a O object.
@return a O object.
@throws java.lang.Exception if any. | [
"<p",
">",
"executeTx",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1157-L1174 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java | PersistentExecutorImpl.notifyOfTaskAssignment | public void notifyOfTaskAssignment(long taskId, long nextExecTime, short binaryFlags, int transactionTimeout) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
Boolean previous = inMemoryTaskIds.put(taskId, Boolean.TRUE);
if (previous == null) {
InvokerTask task = new InvokerTask(this, taskId, nextExecTime, binaryFlags, transactionTimeout);
long delay = nextExecTime - new Date().getTime();
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " for " + delay + "ms from now");
scheduledExecutor.schedule(task, delay, TimeUnit.MILLISECONDS);
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " already scheduled");
}
} | java | public void notifyOfTaskAssignment(long taskId, long nextExecTime, short binaryFlags, int transactionTimeout) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
Boolean previous = inMemoryTaskIds.put(taskId, Boolean.TRUE);
if (previous == null) {
InvokerTask task = new InvokerTask(this, taskId, nextExecTime, binaryFlags, transactionTimeout);
long delay = nextExecTime - new Date().getTime();
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " for " + delay + "ms from now");
scheduledExecutor.schedule(task, delay, TimeUnit.MILLISECONDS);
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " already scheduled");
}
} | [
"public",
"void",
"notifyOfTaskAssignment",
"(",
"long",
"taskId",
",",
"long",
"nextExecTime",
",",
"short",
"binaryFlags",
",",
"int",
"transactionTimeout",
")",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
... | Invoked by a controller to notify a persistent executor that a task has been assigned to it.
@param taskId unique identifier for the task.
@param nextExecTime next execution time for the task.
@param binaryFlags combination of bits for various binary values.
@param transactionTimeout transaction timeout. | [
"Invoked",
"by",
"a",
"controller",
"to",
"notify",
"a",
"persistent",
"executor",
"that",
"a",
"task",
"has",
"been",
"assigned",
"to",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java#L1214-L1227 |
VoltDB/voltdb | src/frontend/org/voltdb/VoltZK.java | VoltZK.createActionBlocker | public static String createActionBlocker(ZooKeeper zk, String node, CreateMode mode, VoltLogger hostLog, String request) {
//Acquire a lock before creating a blocker and validate actions.
ZooKeeperLock zklock = new ZooKeeperLock(zk, VoltZK.actionLock, "lock");
String lockingMessage = null;
try {
if(!zklock.acquireLockWithTimeout(TimeUnit.SECONDS.toMillis(60))) {
lockingMessage = "Could not acquire a lock to create action blocker:" + request;
} else {
lockingMessage = setActionBlocker(zk, node, mode, hostLog, request);
}
} finally {
try {
zklock.releaseLock();
} catch (IOException e) {}
}
return lockingMessage;
} | java | public static String createActionBlocker(ZooKeeper zk, String node, CreateMode mode, VoltLogger hostLog, String request) {
//Acquire a lock before creating a blocker and validate actions.
ZooKeeperLock zklock = new ZooKeeperLock(zk, VoltZK.actionLock, "lock");
String lockingMessage = null;
try {
if(!zklock.acquireLockWithTimeout(TimeUnit.SECONDS.toMillis(60))) {
lockingMessage = "Could not acquire a lock to create action blocker:" + request;
} else {
lockingMessage = setActionBlocker(zk, node, mode, hostLog, request);
}
} finally {
try {
zklock.releaseLock();
} catch (IOException e) {}
}
return lockingMessage;
} | [
"public",
"static",
"String",
"createActionBlocker",
"(",
"ZooKeeper",
"zk",
",",
"String",
"node",
",",
"CreateMode",
"mode",
",",
"VoltLogger",
"hostLog",
",",
"String",
"request",
")",
"{",
"//Acquire a lock before creating a blocker and validate actions.",
"ZooKeeperL... | Create a ZK node under action blocker directory. Exclusive execution of elastic operation, rejoin or catalog
update is checked.
</p>
Catalog update can not happen during node rejoin.
</p>
Node rejoin can not happen during catalog update or elastic operation.
</p>
Elastic operation can not happen during node rejoin or catalog update.
@param zk
@param node
@param hostLog
@param request
@return null for success, non-null for error string | [
"Create",
"a",
"ZK",
"node",
"under",
"action",
"blocker",
"directory",
".",
"Exclusive",
"execution",
"of",
"elastic",
"operation",
"rejoin",
"or",
"catalog",
"update",
"is",
"checked",
".",
"<",
"/",
"p",
">",
"Catalog",
"update",
"can",
"not",
"happen",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltZK.java#L412-L428 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/websphere/exception/DistributedException.java | DistributedException.setLocalizationInfo | public void setLocalizationInfo(String resourceBundleName, String resourceKey, Object[] formatArguments)
{
exceptionInfo.setLocalizationInfo(resourceBundleName,resourceKey,formatArguments);
} | java | public void setLocalizationInfo(String resourceBundleName, String resourceKey, Object[] formatArguments)
{
exceptionInfo.setLocalizationInfo(resourceBundleName,resourceKey,formatArguments);
} | [
"public",
"void",
"setLocalizationInfo",
"(",
"String",
"resourceBundleName",
",",
"String",
"resourceKey",
",",
"Object",
"[",
"]",
"formatArguments",
")",
"{",
"exceptionInfo",
".",
"setLocalizationInfo",
"(",
"resourceBundleName",
",",
"resourceKey",
",",
"formatAr... | Set the values to be used for finding the correct
translated version of the message and formatting it.
@param resourceBundleName java.lang.String - the name of the
resource bundle, which is a subclass of java.util.PropertyResourceBundle.
@param resourceKey java.lang.String - the key in the resource bundle
that specifies the text for the exception message
@param arguments java.lang.Object[] -the arguments used to format the
message. Valid values are those that are
allowed for java.text.MessageFormat.format().
@see java.text.MessageFormat | [
"Set",
"the",
"values",
"to",
"be",
"used",
"for",
"finding",
"the",
"correct",
"translated",
"version",
"of",
"the",
"message",
"and",
"formatting",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/websphere/exception/DistributedException.java#L350-L353 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/process/PTBLexer.java | PTBLexer.delimit | private static String delimit(String s, char c) {
int i = s.indexOf(c);
while (i != -1) {
if (i == 0 || s.charAt(i - 1) != '\\') {
s = s.substring(0, i) + '\\' + s.substring(i);
i = s.indexOf(c, i + 2);
} else {
i = s.indexOf(c, i + 1);
}
}
return s;
} | java | private static String delimit(String s, char c) {
int i = s.indexOf(c);
while (i != -1) {
if (i == 0 || s.charAt(i - 1) != '\\') {
s = s.substring(0, i) + '\\' + s.substring(i);
i = s.indexOf(c, i + 2);
} else {
i = s.indexOf(c, i + 1);
}
}
return s;
} | [
"private",
"static",
"String",
"delimit",
"(",
"String",
"s",
",",
"char",
"c",
")",
"{",
"int",
"i",
"=",
"s",
".",
"indexOf",
"(",
"c",
")",
";",
"while",
"(",
"i",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"i",
"==",
"0",
"||",
"s",
".",
"cha... | This quotes a character with a backslash, but doesn't do it
if the character is already preceded by a backslash. | [
"This",
"quotes",
"a",
"character",
"with",
"a",
"backslash",
"but",
"doesn",
"t",
"do",
"it",
"if",
"the",
"character",
"is",
"already",
"preceded",
"by",
"a",
"backslash",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/PTBLexer.java#L10592-L10603 |
facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacitySchedulerConf.java | CapacitySchedulerConf.setCapacity | public void setCapacity(String queue,float capacity) {
rmConf.setFloat(toFullPropertyName(queue, CAPACITY_PROPERTY),capacity);
} | java | public void setCapacity(String queue,float capacity) {
rmConf.setFloat(toFullPropertyName(queue, CAPACITY_PROPERTY),capacity);
} | [
"public",
"void",
"setCapacity",
"(",
"String",
"queue",
",",
"float",
"capacity",
")",
"{",
"rmConf",
".",
"setFloat",
"(",
"toFullPropertyName",
"(",
"queue",
",",
"CAPACITY_PROPERTY",
")",
",",
"capacity",
")",
";",
"}"
] | Sets the capacity of the given queue.
@param queue name of the queue
@param capacity percent of the cluster for the queue. | [
"Sets",
"the",
"capacity",
"of",
"the",
"given",
"queue",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacitySchedulerConf.java#L183-L185 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java | RolloutStatusCache.getRolloutStatus | public Map<Long, List<TotalTargetCountActionStatus>> getRolloutStatus(final List<Long> rollouts) {
final Cache cache = cacheManager.getCache(CACHE_RO_NAME);
return retrieveFromCache(rollouts, cache);
} | java | public Map<Long, List<TotalTargetCountActionStatus>> getRolloutStatus(final List<Long> rollouts) {
final Cache cache = cacheManager.getCache(CACHE_RO_NAME);
return retrieveFromCache(rollouts, cache);
} | [
"public",
"Map",
"<",
"Long",
",",
"List",
"<",
"TotalTargetCountActionStatus",
">",
">",
"getRolloutStatus",
"(",
"final",
"List",
"<",
"Long",
">",
"rollouts",
")",
"{",
"final",
"Cache",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
"CACHE_RO_NAME",
... | Retrieves cached list of {@link TotalTargetCountActionStatus} of
{@link Rollout}s.
@param rollouts
rolloutIds to retrieve cache entries for
@return map of cached entries | [
"Retrieves",
"cached",
"list",
"of",
"{",
"@link",
"TotalTargetCountActionStatus",
"}",
"of",
"{",
"@link",
"Rollout",
"}",
"s",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L75-L79 |
intellimate/Izou | src/main/java/org/intellimate/izou/system/file/FileManager.java | FileManager.writeToFile | public boolean writeToFile(String defaultFilePath, String realFilePath) {
try {
Files.copy(Paths.get(defaultFilePath), Paths.get(realFilePath), StandardCopyOption.REPLACE_EXISTING);
return true;
} catch (IOException e) {
error("Unable to write to copy Properties-File", e);
return false;
}
} | java | public boolean writeToFile(String defaultFilePath, String realFilePath) {
try {
Files.copy(Paths.get(defaultFilePath), Paths.get(realFilePath), StandardCopyOption.REPLACE_EXISTING);
return true;
} catch (IOException e) {
error("Unable to write to copy Properties-File", e);
return false;
}
} | [
"public",
"boolean",
"writeToFile",
"(",
"String",
"defaultFilePath",
",",
"String",
"realFilePath",
")",
"{",
"try",
"{",
"Files",
".",
"copy",
"(",
"Paths",
".",
"get",
"(",
"defaultFilePath",
")",
",",
"Paths",
".",
"get",
"(",
"realFilePath",
")",
",",... | Writes default file to real file
The default file would be a file that can be packaged along with the code, from which a real file (say a
properties file for example) can be loaded. This is useful because there are files (like property files0 that
cannot be shipped with the package and have to be created at runtime. To still be able to fill these files, you
can create a default file (usually txt) from which the content, as mentioned above, can then be loaded into the
real file.
@param defaultFilePath path to default file (or where it should be created)
@param realFilePath path to real file (that should be filled with content of default file)
@return true if operation has succeeded, else false | [
"Writes",
"default",
"file",
"to",
"real",
"file",
"The",
"default",
"file",
"would",
"be",
"a",
"file",
"that",
"can",
"be",
"packaged",
"along",
"with",
"the",
"code",
"from",
"which",
"a",
"real",
"file",
"(",
"say",
"a",
"properties",
"file",
"for",
... | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/file/FileManager.java#L95-L103 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java | DerivativeIntegralImage.kernelDerivX | public static IntegralKernel kernelDerivX( int r , IntegralKernel ret ) {
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r-1,-r-1,-1,r);
ret.blocks[1].set(0,-r-1,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
} | java | public static IntegralKernel kernelDerivX( int r , IntegralKernel ret ) {
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r-1,-r-1,-1,r);
ret.blocks[1].set(0,-r-1,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
} | [
"public",
"static",
"IntegralKernel",
"kernelDerivX",
"(",
"int",
"r",
",",
"IntegralKernel",
"ret",
")",
"{",
"if",
"(",
"ret",
"==",
"null",
")",
"ret",
"=",
"new",
"IntegralKernel",
"(",
"2",
")",
";",
"ret",
".",
"blocks",
"[",
"0",
"]",
".",
"se... | Creates a kernel for a symmetric box derivative.
@param r Radius of the box. width is 2*r+1
@return Kernel Kernel for derivative. | [
"Creates",
"a",
"kernel",
"for",
"a",
"symmetric",
"box",
"derivative",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java#L35-L45 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasAsset.java | BaasAsset.fetchData | public static RequestToken fetchData(String id, BaasHandler<JsonObject> handler){
return fetchData(id, RequestOptions.DEFAULT, handler);
} | java | public static RequestToken fetchData(String id, BaasHandler<JsonObject> handler){
return fetchData(id, RequestOptions.DEFAULT, handler);
} | [
"public",
"static",
"RequestToken",
"fetchData",
"(",
"String",
"id",
",",
"BaasHandler",
"<",
"JsonObject",
">",
"handler",
")",
"{",
"return",
"fetchData",
"(",
"id",
",",
"RequestOptions",
".",
"DEFAULT",
",",
"handler",
")",
";",
"}"
] | Asynchronously retrieves named assets data,
If the named asset is a document, the document is retrieved
otherwise attached data to the file are returned.
This version of the method uses default priority.
@param id the name of the asset
@param handler an handler that will be handed the response
@return a request token | [
"Asynchronously",
"retrieves",
"named",
"assets",
"data",
"If",
"the",
"named",
"asset",
"is",
"a",
"document",
"the",
"document",
"is",
"retrieved",
"otherwise",
"attached",
"data",
"to",
"the",
"file",
"are",
"returned",
".",
"This",
"version",
"of",
"the",
... | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasAsset.java#L41-L43 |
atomix/atomix | protocols/primary-backup/src/main/java/io/atomix/protocols/backup/service/impl/PrimaryBackupServiceContext.java | PrimaryBackupServiceContext.createSession | public PrimaryBackupSession createSession(long sessionId, MemberId memberId) {
PrimaryBackupSession session = new PrimaryBackupSession(SessionId.from(sessionId), memberId, service.serializer(), this);
if (sessions.putIfAbsent(sessionId, session) == null) {
service.register(session);
}
return session;
} | java | public PrimaryBackupSession createSession(long sessionId, MemberId memberId) {
PrimaryBackupSession session = new PrimaryBackupSession(SessionId.from(sessionId), memberId, service.serializer(), this);
if (sessions.putIfAbsent(sessionId, session) == null) {
service.register(session);
}
return session;
} | [
"public",
"PrimaryBackupSession",
"createSession",
"(",
"long",
"sessionId",
",",
"MemberId",
"memberId",
")",
"{",
"PrimaryBackupSession",
"session",
"=",
"new",
"PrimaryBackupSession",
"(",
"SessionId",
".",
"from",
"(",
"sessionId",
")",
",",
"memberId",
",",
"... | Creates a service session.
@param sessionId the session to create
@param memberId the owning node ID
@return the service session | [
"Creates",
"a",
"service",
"session",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/service/impl/PrimaryBackupServiceContext.java#L519-L525 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/panels/result/ProgressInformationPanel.java | ProgressInformationPanel.printStackTrace | protected void printStackTrace(final PrintWriter printWriter, final Throwable throwable) {
throwable.printStackTrace(printWriter);
Throwable cause = throwable.getCause();
while (cause != null) {
if (cause instanceof SQLException) {
final SQLException nextException = ((SQLException) cause).getNextException();
if (nextException != null) {
printWriter.print("Next exception: ");
printStackTrace(printWriter, nextException);
}
}
cause = cause.getCause();
}
} | java | protected void printStackTrace(final PrintWriter printWriter, final Throwable throwable) {
throwable.printStackTrace(printWriter);
Throwable cause = throwable.getCause();
while (cause != null) {
if (cause instanceof SQLException) {
final SQLException nextException = ((SQLException) cause).getNextException();
if (nextException != null) {
printWriter.print("Next exception: ");
printStackTrace(printWriter, nextException);
}
}
cause = cause.getCause();
}
} | [
"protected",
"void",
"printStackTrace",
"(",
"final",
"PrintWriter",
"printWriter",
",",
"final",
"Throwable",
"throwable",
")",
"{",
"throwable",
".",
"printStackTrace",
"(",
"printWriter",
")",
";",
"Throwable",
"cause",
"=",
"throwable",
".",
"getCause",
"(",
... | Prints stacktraces to the string writer, and investigates the throwable
hierarchy to check if there's any {@link SQLException}s which also has
"next" exceptions.
@param printWriter
@param throwable | [
"Prints",
"stacktraces",
"to",
"the",
"string",
"writer",
"and",
"investigates",
"the",
"throwable",
"hierarchy",
"to",
"check",
"if",
"there",
"s",
"any",
"{",
"@link",
"SQLException",
"}",
"s",
"which",
"also",
"has",
"next",
"exceptions",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/result/ProgressInformationPanel.java#L176-L189 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/EpicsApi.java | EpicsApi.assignIssue | public EpicIssue assignIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid) throws GitLabApiException {
Response response = post(Response.Status.CREATED, (Form)null,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | java | public EpicIssue assignIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid) throws GitLabApiException {
Response response = post(Response.Status.CREATED, (Form)null,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | [
"public",
"EpicIssue",
"assignIssue",
"(",
"Object",
"groupIdOrPath",
",",
"Integer",
"epicIid",
",",
"Integer",
"issueIid",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"post",
"(",
"Response",
".",
"Status",
".",
"CREATED",
",",
"(",
... | Creates an epic - issue association. If the issue in question belongs to another epic
it is unassigned from that epic.
<pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epicIid the Epic IID to assign the issue to
@param issueIid the issue IID of the issue to assign to the epic
@return an EpicIssue instance containing info on the newly assigned epic issue
@throws GitLabApiException if any exception occurs | [
"Creates",
"an",
"epic",
"-",
"issue",
"association",
".",
"If",
"the",
"issue",
"in",
"question",
"belongs",
"to",
"another",
"epic",
"it",
"is",
"unassigned",
"from",
"that",
"epic",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L416-L420 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/enhance/EnhanceImageOps.java | EnhanceImageOps.applyTransform | public static void applyTransform(GrayU8 input , int transform[] , GrayU8 output ) {
output.reshape(input.width,input.height);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplEnhanceHistogram_MT.applyTransform(input, transform, output);
} else {
ImplEnhanceHistogram.applyTransform(input, transform, output);
}
} | java | public static void applyTransform(GrayU8 input , int transform[] , GrayU8 output ) {
output.reshape(input.width,input.height);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplEnhanceHistogram_MT.applyTransform(input, transform, output);
} else {
ImplEnhanceHistogram.applyTransform(input, transform, output);
}
} | [
"public",
"static",
"void",
"applyTransform",
"(",
"GrayU8",
"input",
",",
"int",
"transform",
"[",
"]",
",",
"GrayU8",
"output",
")",
"{",
"output",
".",
"reshape",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
")",
";",
"if",
"(",
"BoofCon... | Applies the transformation table to the provided input image.
@param input Input image.
@param transform Input transformation table.
@param output Output image. | [
"Applies",
"the",
"transformation",
"table",
"to",
"the",
"provided",
"input",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/enhance/EnhanceImageOps.java#L86-L94 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.namespaces | public T namespaces(Map<String, String> namespaceMappings) {
getXpathVariableExtractor().getNamespaces().putAll(namespaceMappings);
xmlMessageValidationContext.getNamespaces().putAll(namespaceMappings);
return self;
} | java | public T namespaces(Map<String, String> namespaceMappings) {
getXpathVariableExtractor().getNamespaces().putAll(namespaceMappings);
xmlMessageValidationContext.getNamespaces().putAll(namespaceMappings);
return self;
} | [
"public",
"T",
"namespaces",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMappings",
")",
"{",
"getXpathVariableExtractor",
"(",
")",
".",
"getNamespaces",
"(",
")",
".",
"putAll",
"(",
"namespaceMappings",
")",
";",
"xmlMessageValidationContext",
".... | Sets default namespace declarations on this action builder.
@param namespaceMappings
@return | [
"Sets",
"default",
"namespace",
"declarations",
"on",
"this",
"action",
"builder",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L667-L672 |
jenkinsci/jenkins | core/src/main/java/hudson/scm/SCM.java | SCM.poll | public final PollingResult poll(AbstractProject<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException {
if (is1_346OrLater()) {
// This is to work around HUDSON-5827 in a general way.
// don't let the SCM.compareRemoteRevisionWith(...) see SCMRevisionState that it didn't produce.
SCMRevisionState baseline2;
if (baseline!=SCMRevisionState.NONE) {
baseline2 = baseline;
} else {
baseline2 = calcRevisionsFromBuild(project.getLastBuild(), launcher, listener);
}
return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2);
} else {
return pollChanges(project,launcher,workspace,listener) ? PollingResult.SIGNIFICANT : PollingResult.NO_CHANGES;
}
} | java | public final PollingResult poll(AbstractProject<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException {
if (is1_346OrLater()) {
// This is to work around HUDSON-5827 in a general way.
// don't let the SCM.compareRemoteRevisionWith(...) see SCMRevisionState that it didn't produce.
SCMRevisionState baseline2;
if (baseline!=SCMRevisionState.NONE) {
baseline2 = baseline;
} else {
baseline2 = calcRevisionsFromBuild(project.getLastBuild(), launcher, listener);
}
return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2);
} else {
return pollChanges(project,launcher,workspace,listener) ? PollingResult.SIGNIFICANT : PollingResult.NO_CHANGES;
}
} | [
"public",
"final",
"PollingResult",
"poll",
"(",
"AbstractProject",
"<",
"?",
",",
"?",
">",
"project",
",",
"Launcher",
"launcher",
",",
"FilePath",
"workspace",
",",
"TaskListener",
"listener",
",",
"SCMRevisionState",
"baseline",
")",
"throws",
"IOException",
... | Convenience method for the caller to handle the backward compatibility between pre 1.345 SCMs. | [
"Convenience",
"method",
"for",
"the",
"caller",
"to",
"handle",
"the",
"backward",
"compatibility",
"between",
"pre",
"1",
".",
"345",
"SCMs",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/SCM.java#L406-L421 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/model/BubbleValue.java | BubbleValue.setTarget | public BubbleValue setTarget(float targetX, float targetY, float targetZ) {
set(x, y, z);
this.diffX = targetX - originX;
this.diffY = targetY - originY;
this.diffZ = targetZ - originZ;
return this;
} | java | public BubbleValue setTarget(float targetX, float targetY, float targetZ) {
set(x, y, z);
this.diffX = targetX - originX;
this.diffY = targetY - originY;
this.diffZ = targetZ - originZ;
return this;
} | [
"public",
"BubbleValue",
"setTarget",
"(",
"float",
"targetX",
",",
"float",
"targetY",
",",
"float",
"targetZ",
")",
"{",
"set",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"this",
".",
"diffX",
"=",
"targetX",
"-",
"originX",
";",
"this",
".",
"diffY",... | Set target values that should be reached when data animation finish then call {@link Chart#startDataAnimation()} | [
"Set",
"target",
"values",
"that",
"should",
"be",
"reached",
"when",
"data",
"animation",
"finish",
"then",
"call",
"{"
] | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/model/BubbleValue.java#L103-L109 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/InMemoryGraphLookupTable.java | InMemoryGraphLookupTable.calculateProb | public double calculateProb(int first, int second) {
//Get vector for first vertex, as well as code for second:
INDArray vec = vertexVectors.getRow(first);
int codeLength = tree.getCodeLength(second);
long code = tree.getCode(second);
int[] innerNodesForVertex = tree.getPathInnerNodes(second);
double prob = 1.0;
for (int i = 0; i < codeLength; i++) {
boolean path = getBit(code, i); //left or right?
//Inner node:
int innerNodeIdx = innerNodesForVertex[i];
INDArray nwi = outWeights.getRow(innerNodeIdx);
double dot = Nd4j.getBlasWrapper().dot(nwi, vec);
//double sigmoidDot = sigmoid(dot);
double innerProb = (path ? sigmoid(dot) : sigmoid(-dot)); //prob of going left or right at inner node
prob *= innerProb;
}
return prob;
} | java | public double calculateProb(int first, int second) {
//Get vector for first vertex, as well as code for second:
INDArray vec = vertexVectors.getRow(first);
int codeLength = tree.getCodeLength(second);
long code = tree.getCode(second);
int[] innerNodesForVertex = tree.getPathInnerNodes(second);
double prob = 1.0;
for (int i = 0; i < codeLength; i++) {
boolean path = getBit(code, i); //left or right?
//Inner node:
int innerNodeIdx = innerNodesForVertex[i];
INDArray nwi = outWeights.getRow(innerNodeIdx);
double dot = Nd4j.getBlasWrapper().dot(nwi, vec);
//double sigmoidDot = sigmoid(dot);
double innerProb = (path ? sigmoid(dot) : sigmoid(-dot)); //prob of going left or right at inner node
prob *= innerProb;
}
return prob;
} | [
"public",
"double",
"calculateProb",
"(",
"int",
"first",
",",
"int",
"second",
")",
"{",
"//Get vector for first vertex, as well as code for second:",
"INDArray",
"vec",
"=",
"vertexVectors",
".",
"getRow",
"(",
"first",
")",
";",
"int",
"codeLength",
"=",
"tree",
... | Calculate the probability of the second vertex given the first vertex
i.e., P(v_second | v_first)
@param first index of the first vertex
@param second index of the second vertex
@return probability, P(v_second | v_first) | [
"Calculate",
"the",
"probability",
"of",
"the",
"second",
"vertex",
"given",
"the",
"first",
"vertex",
"i",
".",
"e",
".",
"P",
"(",
"v_second",
"|",
"v_first",
")"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/InMemoryGraphLookupTable.java#L143-L164 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLQueryAction.java | ExecuteSQLQueryAction.fillContextVariables | private void fillContextVariables(Map<String, List<String>> columnValuesMap, TestContext context)
throws CitrusRuntimeException {
for (Entry<String, String> variableEntry : extractVariables.entrySet()) {
String columnName = variableEntry.getKey();
if (columnValuesMap.containsKey(columnName.toLowerCase())) {
context.setVariable(variableEntry.getValue(), constructVariableValue(columnValuesMap.get(columnName.toLowerCase())));
} else if (columnValuesMap.containsKey(columnName.toUpperCase())) {
context.setVariable(variableEntry.getValue(), constructVariableValue(columnValuesMap.get(columnName.toUpperCase())));
} else {
throw new CitrusRuntimeException("Failed to create variables from database values! " +
"Unable to find column '" + columnName + "' in database result set");
}
}
} | java | private void fillContextVariables(Map<String, List<String>> columnValuesMap, TestContext context)
throws CitrusRuntimeException {
for (Entry<String, String> variableEntry : extractVariables.entrySet()) {
String columnName = variableEntry.getKey();
if (columnValuesMap.containsKey(columnName.toLowerCase())) {
context.setVariable(variableEntry.getValue(), constructVariableValue(columnValuesMap.get(columnName.toLowerCase())));
} else if (columnValuesMap.containsKey(columnName.toUpperCase())) {
context.setVariable(variableEntry.getValue(), constructVariableValue(columnValuesMap.get(columnName.toUpperCase())));
} else {
throw new CitrusRuntimeException("Failed to create variables from database values! " +
"Unable to find column '" + columnName + "' in database result set");
}
}
} | [
"private",
"void",
"fillContextVariables",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"columnValuesMap",
",",
"TestContext",
"context",
")",
"throws",
"CitrusRuntimeException",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
... | Fills the (requested) test context variables with the db result values
@param columnValuesMap the map containing column names --> list of result values
@param context the test context the variables are stored to
@throws CitrusRuntimeException if requested column name was not found | [
"Fills",
"the",
"(",
"requested",
")",
"test",
"context",
"variables",
"with",
"the",
"db",
"result",
"values"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLQueryAction.java#L148-L161 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.removeModelPage | public void removeModelPage(final CmsUUID id, final AsyncCallback<Void> asyncCallback) {
CmsRpcAction<Void> action = new CmsRpcAction<Void>() {
@Override
public void execute() {
start(200, true);
getService().removeModelPage(getEntryPoint(), id, this);
}
@Override
protected void onResponse(Void result) {
stop(false);
loadNewElementInfo(null);
asyncCallback.onSuccess(null);
}
};
action.execute();
} | java | public void removeModelPage(final CmsUUID id, final AsyncCallback<Void> asyncCallback) {
CmsRpcAction<Void> action = new CmsRpcAction<Void>() {
@Override
public void execute() {
start(200, true);
getService().removeModelPage(getEntryPoint(), id, this);
}
@Override
protected void onResponse(Void result) {
stop(false);
loadNewElementInfo(null);
asyncCallback.onSuccess(null);
}
};
action.execute();
} | [
"public",
"void",
"removeModelPage",
"(",
"final",
"CmsUUID",
"id",
",",
"final",
"AsyncCallback",
"<",
"Void",
">",
"asyncCallback",
")",
"{",
"CmsRpcAction",
"<",
"Void",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"Void",
">",
"(",
")",
"{",
"@",
... | Removes a model page from the sitemap's configuration.<p>
@param id the structure id of the model page
@param asyncCallback the callback to call when done | [
"Removes",
"a",
"model",
"page",
"from",
"the",
"sitemap",
"s",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1838-L1861 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/fd/PhiAccrualFailureDetector.java | PhiAccrualFailureDetector.phi | private double phi(long timestampMillis) {
long timeDiffMillis;
double meanMillis;
double stdDeviationMillis;
synchronized (heartbeatHistory) {
long lastTimestampMillis = lastHeartbeatMillis;
if (lastTimestampMillis == NO_HEARTBEAT_TIMESTAMP) {
return 0.0;
}
timeDiffMillis = timestampMillis - lastTimestampMillis;
meanMillis = heartbeatHistory.mean();
stdDeviationMillis = ensureValidStdDeviation(heartbeatHistory.stdDeviation());
}
return phi(timeDiffMillis, meanMillis + acceptableHeartbeatPauseMillis, stdDeviationMillis);
} | java | private double phi(long timestampMillis) {
long timeDiffMillis;
double meanMillis;
double stdDeviationMillis;
synchronized (heartbeatHistory) {
long lastTimestampMillis = lastHeartbeatMillis;
if (lastTimestampMillis == NO_HEARTBEAT_TIMESTAMP) {
return 0.0;
}
timeDiffMillis = timestampMillis - lastTimestampMillis;
meanMillis = heartbeatHistory.mean();
stdDeviationMillis = ensureValidStdDeviation(heartbeatHistory.stdDeviation());
}
return phi(timeDiffMillis, meanMillis + acceptableHeartbeatPauseMillis, stdDeviationMillis);
} | [
"private",
"double",
"phi",
"(",
"long",
"timestampMillis",
")",
"{",
"long",
"timeDiffMillis",
";",
"double",
"meanMillis",
";",
"double",
"stdDeviationMillis",
";",
"synchronized",
"(",
"heartbeatHistory",
")",
"{",
"long",
"lastTimestampMillis",
"=",
"lastHeartbe... | The suspicion level of the accrual failure detector.
If a connection does not have any records in failure detector then it is
considered healthy. | [
"The",
"suspicion",
"level",
"of",
"the",
"accrual",
"failure",
"detector",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/fd/PhiAccrualFailureDetector.java#L109-L126 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setMessageId | public void setMessageId(String messageId) {
try {
this.messageId = new URI(messageId);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid messageId uri", e);
}
} | java | public void setMessageId(String messageId) {
try {
this.messageId = new URI(messageId);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid messageId uri", e);
}
} | [
"public",
"void",
"setMessageId",
"(",
"String",
"messageId",
")",
"{",
"try",
"{",
"this",
".",
"messageId",
"=",
"new",
"URI",
"(",
"messageId",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"... | Sets the message id from uri string.
@param messageId the messageId to set | [
"Sets",
"the",
"message",
"id",
"from",
"uri",
"string",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L146-L152 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java | AbstractSequenceClassifier.loadClassifier | public void loadClassifier(File file, Properties props) throws ClassCastException, IOException,
ClassNotFoundException {
Timing.startDoing("Loading classifier from " + file.getAbsolutePath());
BufferedInputStream bis;
if (file.getName().endsWith(".gz")) {
bis = new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)));
} else {
bis = new BufferedInputStream(new FileInputStream(file));
}
loadClassifier(bis, props);
bis.close();
Timing.endDoing();
} | java | public void loadClassifier(File file, Properties props) throws ClassCastException, IOException,
ClassNotFoundException {
Timing.startDoing("Loading classifier from " + file.getAbsolutePath());
BufferedInputStream bis;
if (file.getName().endsWith(".gz")) {
bis = new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)));
} else {
bis = new BufferedInputStream(new FileInputStream(file));
}
loadClassifier(bis, props);
bis.close();
Timing.endDoing();
} | [
"public",
"void",
"loadClassifier",
"(",
"File",
"file",
",",
"Properties",
"props",
")",
"throws",
"ClassCastException",
",",
"IOException",
",",
"ClassNotFoundException",
"{",
"Timing",
".",
"startDoing",
"(",
"\"Loading classifier from \"",
"+",
"file",
".",
"get... | Loads a classifier from the file specified. If the file's name ends in .gz,
uses a GZIPInputStream, else uses a regular FileInputStream. This method
closes the File when done.
@param file
Loads a classifier from this file.
@param props
Properties in this object will be used to overwrite those
specified in the serialized classifier
@throws IOException
If there are problems accessing the input stream
@throws ClassCastException
If there are problems interpreting the serialized data
@throws ClassNotFoundException
If there are problems interpreting the serialized data | [
"Loads",
"a",
"classifier",
"from",
"the",
"file",
"specified",
".",
"If",
"the",
"file",
"s",
"name",
"ends",
"in",
".",
"gz",
"uses",
"a",
"GZIPInputStream",
"else",
"uses",
"a",
"regular",
"FileInputStream",
".",
"This",
"method",
"closes",
"the",
"File... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L1649-L1661 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/DbPro.java | DbPro.batchSave | public int[] batchSave(List<? extends Model> modelList, int batchSize) {
if (modelList == null || modelList.size() == 0)
return new int[0];
Model model = modelList.get(0);
Map<String, Object> attrs = model._getAttrs();
int index = 0;
StringBuilder columns = new StringBuilder();
// the same as the iterator in Dialect.forModelSave() to ensure the order of the attrs
for (Entry<String, Object> e : attrs.entrySet()) {
if (config.dialect.isOracle()) { // 支持 oracle 自增主键
Object value = e.getValue();
if (value instanceof String && ((String)value).endsWith(".nextval")) {
continue ;
}
}
if (index++ > 0) {
columns.append(',');
}
columns.append(e.getKey());
}
StringBuilder sql = new StringBuilder();
List<Object> parasNoUse = new ArrayList<Object>();
config.dialect.forModelSave(TableMapping.me().getTable(model.getClass()), attrs, sql, parasNoUse);
return batch(sql.toString(), columns.toString(), modelList, batchSize);
} | java | public int[] batchSave(List<? extends Model> modelList, int batchSize) {
if (modelList == null || modelList.size() == 0)
return new int[0];
Model model = modelList.get(0);
Map<String, Object> attrs = model._getAttrs();
int index = 0;
StringBuilder columns = new StringBuilder();
// the same as the iterator in Dialect.forModelSave() to ensure the order of the attrs
for (Entry<String, Object> e : attrs.entrySet()) {
if (config.dialect.isOracle()) { // 支持 oracle 自增主键
Object value = e.getValue();
if (value instanceof String && ((String)value).endsWith(".nextval")) {
continue ;
}
}
if (index++ > 0) {
columns.append(',');
}
columns.append(e.getKey());
}
StringBuilder sql = new StringBuilder();
List<Object> parasNoUse = new ArrayList<Object>();
config.dialect.forModelSave(TableMapping.me().getTable(model.getClass()), attrs, sql, parasNoUse);
return batch(sql.toString(), columns.toString(), modelList, batchSize);
} | [
"public",
"int",
"[",
"]",
"batchSave",
"(",
"List",
"<",
"?",
"extends",
"Model",
">",
"modelList",
",",
"int",
"batchSize",
")",
"{",
"if",
"(",
"modelList",
"==",
"null",
"||",
"modelList",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"new",
... | Batch save models using the "insert into ..." sql generated by the first model in modelList.
Ensure all the models can use the same sql as the first model. | [
"Batch",
"save",
"models",
"using",
"the",
"insert",
"into",
"...",
"sql",
"generated",
"by",
"the",
"first",
"model",
"in",
"modelList",
".",
"Ensure",
"all",
"the",
"models",
"can",
"use",
"the",
"same",
"sql",
"as",
"the",
"first",
"model",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/DbPro.java#L1123-L1150 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/InlineDatePicker.java | InlineDatePicker.setDate | public void setDate(AjaxRequestTarget ajaxRequestTarget, DateOption dateOption)
{
ajaxRequestTarget.appendJavaScript(this.setDate(dateOption).render().toString());
} | java | public void setDate(AjaxRequestTarget ajaxRequestTarget, DateOption dateOption)
{
ajaxRequestTarget.appendJavaScript(this.setDate(dateOption).render().toString());
} | [
"public",
"void",
"setDate",
"(",
"AjaxRequestTarget",
"ajaxRequestTarget",
",",
"DateOption",
"dateOption",
")",
"{",
"ajaxRequestTarget",
".",
"appendJavaScript",
"(",
"this",
".",
"setDate",
"(",
"dateOption",
")",
".",
"render",
"(",
")",
".",
"toString",
"(... | Method to set the date of the datepicker within the ajax request
@param ajaxRequestTarget
@param dateOption
Date to set | [
"Method",
"to",
"set",
"the",
"date",
"of",
"the",
"datepicker",
"within",
"the",
"ajax",
"request"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/InlineDatePicker.java#L1319-L1322 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/SimonUtils.java | SimonUtils.calculateCounterAggregate | public static CounterAggregate calculateCounterAggregate(Simon simon, SimonFilter filter) {
CounterAggregate aggregate = new CounterAggregate();
aggregateCounters(aggregate, simon,
filter != null ? filter : SimonFilter.ACCEPT_ALL_FILTER);
return aggregate;
} | java | public static CounterAggregate calculateCounterAggregate(Simon simon, SimonFilter filter) {
CounterAggregate aggregate = new CounterAggregate();
aggregateCounters(aggregate, simon,
filter != null ? filter : SimonFilter.ACCEPT_ALL_FILTER);
return aggregate;
} | [
"public",
"static",
"CounterAggregate",
"calculateCounterAggregate",
"(",
"Simon",
"simon",
",",
"SimonFilter",
"filter",
")",
"{",
"CounterAggregate",
"aggregate",
"=",
"new",
"CounterAggregate",
"(",
")",
";",
"aggregateCounters",
"(",
"aggregate",
",",
"simon",
"... | Aggregate statistics from all counters in hierarchy that pass specified filter. Filter is applied
to all simons in the hierarchy of all types. If a simon is rejected by filter its children are not considered.
Simons are aggregated in the top-bottom fashion, i.e. parent simons are aggregated before children.
@param simon root of the hierarchy of simons for which statistics will be aggregated
@param filter filter to select subsets of simons to aggregate
@return aggregates statistics
@since 3.5 | [
"Aggregate",
"statistics",
"from",
"all",
"counters",
"in",
"hierarchy",
"that",
"pass",
"specified",
"filter",
".",
"Filter",
"is",
"applied",
"to",
"all",
"simons",
"in",
"the",
"hierarchy",
"of",
"all",
"types",
".",
"If",
"a",
"simon",
"is",
"rejected",
... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L448-L454 |
daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.startAutoCycle | public void startAutoCycle(long delay,long duration,boolean autoRecover){
if(mCycleTimer != null) mCycleTimer.cancel();
if(mCycleTask != null) mCycleTask.cancel();
if(mResumingTask != null) mResumingTask.cancel();
if(mResumingTimer != null) mResumingTimer.cancel();
mSliderDuration = duration;
mCycleTimer = new Timer();
mAutoRecover = autoRecover;
mCycleTask = new TimerTask() {
@Override
public void run() {
mh.sendEmptyMessage(0);
}
};
mCycleTimer.schedule(mCycleTask,delay,mSliderDuration);
mCycling = true;
mAutoCycle = true;
} | java | public void startAutoCycle(long delay,long duration,boolean autoRecover){
if(mCycleTimer != null) mCycleTimer.cancel();
if(mCycleTask != null) mCycleTask.cancel();
if(mResumingTask != null) mResumingTask.cancel();
if(mResumingTimer != null) mResumingTimer.cancel();
mSliderDuration = duration;
mCycleTimer = new Timer();
mAutoRecover = autoRecover;
mCycleTask = new TimerTask() {
@Override
public void run() {
mh.sendEmptyMessage(0);
}
};
mCycleTimer.schedule(mCycleTask,delay,mSliderDuration);
mCycling = true;
mAutoCycle = true;
} | [
"public",
"void",
"startAutoCycle",
"(",
"long",
"delay",
",",
"long",
"duration",
",",
"boolean",
"autoRecover",
")",
"{",
"if",
"(",
"mCycleTimer",
"!=",
"null",
")",
"mCycleTimer",
".",
"cancel",
"(",
")",
";",
"if",
"(",
"mCycleTask",
"!=",
"null",
"... | start auto cycle.
@param delay delay time
@param duration animation duration time.
@param autoRecover if recover after user touches the slider. | [
"start",
"auto",
"cycle",
"."
] | train | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L258-L275 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/CWSEvaluator.java | CWSEvaluator.evaluate | public static CWSEvaluator.Result evaluate(Segment segment, String testFile, String outputPath, String goldFile, String dictPath) throws IOException
{
return evaluate(segment, outputPath, goldFile, dictPath);
} | java | public static CWSEvaluator.Result evaluate(Segment segment, String testFile, String outputPath, String goldFile, String dictPath) throws IOException
{
return evaluate(segment, outputPath, goldFile, dictPath);
} | [
"public",
"static",
"CWSEvaluator",
".",
"Result",
"evaluate",
"(",
"Segment",
"segment",
",",
"String",
"testFile",
",",
"String",
"outputPath",
",",
"String",
"goldFile",
",",
"String",
"dictPath",
")",
"throws",
"IOException",
"{",
"return",
"evaluate",
"(",
... | 标准化评测分词器
@param segment 分词器
@param testFile 测试集raw text
@param outputPath 分词预测输出文件
@param goldFile 测试集segmented file
@param dictPath 训练集单词列表
@return 一个储存准确率的结构
@throws IOException | [
"标准化评测分词器"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/CWSEvaluator.java#L223-L226 |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java | Animate.styleElement | private static <T extends UIObject> String styleElement(Element element, String animation, int count, int duration, int delay) {
if (!usedStyles.contains(animation + " " + getStyleNameFromAnimation(animation,count,duration,delay))) {
String styleSheet = "." + getStyleNameFromAnimation(animation, count, duration, delay) + " {";
// 1 is default, 0 disable animation, any negative -> infinite loop
if (count >= 0) {
styleSheet += "-webkit-animation-iteration-count: " + count + ";" +
"-moz-animation-iteration-count:" + count + ";" +
"-ms-animation-iteration-count:" + count + ";" +
"-o-animation-iteration-count:" + count + ";" +
"animation-iteration-count:" + count + ";";
} else {
styleSheet += "-webkit-animation-iteration-count: infinite;" +
"-moz-animation-iteration-count: infinite;" +
"-ms-animation-iteration-count: infinite;" +
"-o-animation-iteration-count: infinite;" +
"animation-iteration-count: infinite;";
}
// if not default (any negative -> use default)
if (duration >= 0) {
styleSheet += "-webkit-animation-duration: " + duration + "ms;" +
"-moz-animation-duration:" + duration + "ms;" +
"-ms-animation-duration:" + duration + "ms;" +
"-o-animation-duration:" + duration + "ms;" +
"animation-duration:" + duration + "ms;";
}
// if not default (any negative -> use default)
if (delay >= 0) {
styleSheet += "-webkit-animation-delay: " + delay + "ms;" +
"-moz-animation-delay:" + delay + "ms;" +
"-ms-animation-delay:" + delay + "ms;" +
"-o-animation-delay:" + delay + "ms;" +
"animation-delay:" + delay + "ms;";
}
styleSheet += "}";
// inject new style
StyleInjector.injectAtEnd(styleSheet, true);
usedStyles.add(animation + " " + getStyleNameFromAnimation(animation, count, duration, delay));
}
// start animation
element.addClassName(animation + " " + getStyleNameFromAnimation(animation,count,duration,delay));
// remove animation on end so we could start it again
// removeAnimationOnEnd(element, animation + " anim-"+count+"-"+duration+"-"+delay);
return animation + " " + getStyleNameFromAnimation(animation,count,duration,delay);
} | java | private static <T extends UIObject> String styleElement(Element element, String animation, int count, int duration, int delay) {
if (!usedStyles.contains(animation + " " + getStyleNameFromAnimation(animation,count,duration,delay))) {
String styleSheet = "." + getStyleNameFromAnimation(animation, count, duration, delay) + " {";
// 1 is default, 0 disable animation, any negative -> infinite loop
if (count >= 0) {
styleSheet += "-webkit-animation-iteration-count: " + count + ";" +
"-moz-animation-iteration-count:" + count + ";" +
"-ms-animation-iteration-count:" + count + ";" +
"-o-animation-iteration-count:" + count + ";" +
"animation-iteration-count:" + count + ";";
} else {
styleSheet += "-webkit-animation-iteration-count: infinite;" +
"-moz-animation-iteration-count: infinite;" +
"-ms-animation-iteration-count: infinite;" +
"-o-animation-iteration-count: infinite;" +
"animation-iteration-count: infinite;";
}
// if not default (any negative -> use default)
if (duration >= 0) {
styleSheet += "-webkit-animation-duration: " + duration + "ms;" +
"-moz-animation-duration:" + duration + "ms;" +
"-ms-animation-duration:" + duration + "ms;" +
"-o-animation-duration:" + duration + "ms;" +
"animation-duration:" + duration + "ms;";
}
// if not default (any negative -> use default)
if (delay >= 0) {
styleSheet += "-webkit-animation-delay: " + delay + "ms;" +
"-moz-animation-delay:" + delay + "ms;" +
"-ms-animation-delay:" + delay + "ms;" +
"-o-animation-delay:" + delay + "ms;" +
"animation-delay:" + delay + "ms;";
}
styleSheet += "}";
// inject new style
StyleInjector.injectAtEnd(styleSheet, true);
usedStyles.add(animation + " " + getStyleNameFromAnimation(animation, count, duration, delay));
}
// start animation
element.addClassName(animation + " " + getStyleNameFromAnimation(animation,count,duration,delay));
// remove animation on end so we could start it again
// removeAnimationOnEnd(element, animation + " anim-"+count+"-"+duration+"-"+delay);
return animation + " " + getStyleNameFromAnimation(animation,count,duration,delay);
} | [
"private",
"static",
"<",
"T",
"extends",
"UIObject",
">",
"String",
"styleElement",
"(",
"Element",
"element",
",",
"String",
"animation",
",",
"int",
"count",
",",
"int",
"duration",
",",
"int",
"delay",
")",
"{",
"if",
"(",
"!",
"usedStyles",
".",
"co... | Styles element with animation class. New class name is generated to customize count, duration and delay.
Style is removed on animation end (if not set to infinite).
@param element Element to apply animation to.
@param animation Type of animation to apply.
@param count Number of animation repeats. 0 disables animation, any negative value set repeats to infinite.
@param duration Animation duration in ms. 0 disables animation, any negative value keeps default of original animation.
@param delay Delay before starting the animation loop in ms. Value <= 0 means no delay.
@param <T> Any object extending UIObject class (typically Widget).
@return Animation's CSS class name, which can be removed to stop animation. | [
"Styles",
"element",
"with",
"animation",
"class",
".",
"New",
"class",
"name",
"is",
"generated",
"to",
"customize",
"count",
"duration",
"and",
"delay",
".",
"Style",
"is",
"removed",
"on",
"animation",
"end",
"(",
"if",
"not",
"set",
"to",
"infinite",
"... | train | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java#L235-L299 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSecret | public DeletedSecretBundle getDeletedSecret(String vaultBaseUrl, String secretName) {
return getDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body();
} | java | public DeletedSecretBundle getDeletedSecret(String vaultBaseUrl, String secretName) {
return getDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body();
} | [
"public",
"DeletedSecretBundle",
"getDeletedSecret",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
")",
"{",
"return",
"getDeletedSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(... | Gets the specified deleted secret.
The Get Deleted Secret operation returns the specified deleted secret along with its attributes. This operation requires the secrets/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@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 DeletedSecretBundle object if successful. | [
"Gets",
"the",
"specified",
"deleted",
"secret",
".",
"The",
"Get",
"Deleted",
"Secret",
"operation",
"returns",
"the",
"specified",
"deleted",
"secret",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"get",
... | 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#L4643-L4645 |
alkacon/opencms-core | src/org/opencms/site/xmlsitemap/CmsXmlSitemapUrlBean.java | CmsXmlSitemapUrlBean.writeElement | public void writeElement(StringBuffer buffer, String tag, String content) {
buffer.append("<" + tag + ">");
buffer.append(CmsEncoder.escapeXml(content));
buffer.append("</" + tag + ">");
} | java | public void writeElement(StringBuffer buffer, String tag, String content) {
buffer.append("<" + tag + ">");
buffer.append(CmsEncoder.escapeXml(content));
buffer.append("</" + tag + ">");
} | [
"public",
"void",
"writeElement",
"(",
"StringBuffer",
"buffer",
",",
"String",
"tag",
",",
"String",
"content",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<\"",
"+",
"tag",
"+",
"\">\"",
")",
";",
"buffer",
".",
"append",
"(",
"CmsEncoder",
".",
"escape... | Writes a single XML element with text content to a string buffer.<p>
@param buffer the string buffer to write to
@param tag the XML tag name
@param content the content of the XML element | [
"Writes",
"a",
"single",
"XML",
"element",
"with",
"text",
"content",
"to",
"a",
"string",
"buffer",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapUrlBean.java#L265-L270 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/PhoneNumber.java | PhoneNumber.create | public static PhoneNumber create(final BandwidthClient client, final Map<String, Object> params) throws Exception {
final String uri = client.getUserResourceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH);
final RestResponse createResponse = client.post(uri, params);
final RestResponse getResponse = client.get(createResponse.getLocation(), null);
final JSONObject jsonObject = toJSONObject(getResponse);
return new PhoneNumber(client, jsonObject);
} | java | public static PhoneNumber create(final BandwidthClient client, final Map<String, Object> params) throws Exception {
final String uri = client.getUserResourceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH);
final RestResponse createResponse = client.post(uri, params);
final RestResponse getResponse = client.get(createResponse.getLocation(), null);
final JSONObject jsonObject = toJSONObject(getResponse);
return new PhoneNumber(client, jsonObject);
} | [
"public",
"static",
"PhoneNumber",
"create",
"(",
"final",
"BandwidthClient",
"client",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"Exception",
"{",
"final",
"String",
"uri",
"=",
"client",
".",
"getUserResourceUri",
"(",
... | Factory method to allocate a phone number given a set of params. Note that this assumes that the phone number
has been previously search for as an AvailableNumber
@param client the client
@param params the params
@return the PhoneNumber
@throws IOException unexpected error. | [
"Factory",
"method",
"to",
"allocate",
"a",
"phone",
"number",
"given",
"a",
"set",
"of",
"params",
".",
"Note",
"that",
"this",
"assumes",
"that",
"the",
"phone",
"number",
"has",
"been",
"previously",
"search",
"for",
"as",
"an",
"AvailableNumber"
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/PhoneNumber.java#L80-L86 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.setHeader | public void setHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_setHeader (sName, sValue);
} | java | public void setHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_setHeader (sName, sValue);
} | [
"public",
"void",
"setHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sValue",
")",
"{",
"if",
"(",
"sValue",
"!=",
"null",
")",
"_setHeader",
"(",
"sName",
",",
"sValue",
")",
";",
"... | Set the passed header as is.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param sValue
The value to be set. May be <code>null</code> in which case nothing
happens. | [
"Set",
"the",
"passed",
"header",
"as",
"is",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L190-L194 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java | AbstractUserTaskBuilder.camundaTaskListenerClass | @SuppressWarnings("rawtypes")
public B camundaTaskListenerClass(String eventName, Class listenerClass) {
return camundaTaskListenerClass(eventName, listenerClass.getName());
} | java | @SuppressWarnings("rawtypes")
public B camundaTaskListenerClass(String eventName, Class listenerClass) {
return camundaTaskListenerClass(eventName, listenerClass.getName());
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"B",
"camundaTaskListenerClass",
"(",
"String",
"eventName",
",",
"Class",
"listenerClass",
")",
"{",
"return",
"camundaTaskListenerClass",
"(",
"eventName",
",",
"listenerClass",
".",
"getName",
"(",
")",... | Add a class based task listener with specified event name
@param eventName - event names to listen to
@param fullQualifiedClassName - a string representing a class
@return the builder object | [
"Add",
"a",
"class",
"based",
"task",
"listener",
"with",
"specified",
"event",
"name"
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java#L189-L192 |
mapbox/mapbox-plugins-android | plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java | LocalizationPlugin.setCameraToLocaleCountry | public void setCameraToLocaleCountry(Locale locale, int padding) {
MapLocale mapLocale = MapLocale.getMapLocale(locale, false);
if (mapLocale != null) {
setCameraToLocaleCountry(mapLocale, padding);
} else {
Timber.e("Couldn't match Locale %s to a MapLocale", locale.getDisplayName());
}
} | java | public void setCameraToLocaleCountry(Locale locale, int padding) {
MapLocale mapLocale = MapLocale.getMapLocale(locale, false);
if (mapLocale != null) {
setCameraToLocaleCountry(mapLocale, padding);
} else {
Timber.e("Couldn't match Locale %s to a MapLocale", locale.getDisplayName());
}
} | [
"public",
"void",
"setCameraToLocaleCountry",
"(",
"Locale",
"locale",
",",
"int",
"padding",
")",
"{",
"MapLocale",
"mapLocale",
"=",
"MapLocale",
".",
"getMapLocale",
"(",
"locale",
",",
"false",
")",
";",
"if",
"(",
"mapLocale",
"!=",
"null",
")",
"{",
... | If you'd like to manually set the camera position to a specific map region or country, pass in
the locale (which must have a paired }{@link MapLocale}) to work properly
@param locale a {@link Locale} which has a complementary {@link MapLocale} for it
@param padding camera padding
@since 0.1.0 | [
"If",
"you",
"d",
"like",
"to",
"manually",
"set",
"the",
"camera",
"position",
"to",
"a",
"specific",
"map",
"region",
"or",
"country",
"pass",
"in",
"the",
"locale",
"(",
"which",
"must",
"have",
"a",
"paired",
"}",
"{",
"@link",
"MapLocale",
"}",
")... | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java#L327-L334 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsLinkManager.java | CmsLinkManager.getRelativeUri | public static String getRelativeUri(String fromUri, String toUri) {
StringBuffer result = new StringBuffer();
int pos = 0;
while (true) {
int i = fromUri.indexOf('/', pos);
int j = toUri.indexOf('/', pos);
if ((i == -1) || (i != j) || !fromUri.regionMatches(pos, toUri, pos, i - pos)) {
break;
}
pos = i + 1;
}
// count hops up from here to the common ancestor
for (int i = fromUri.indexOf('/', pos); i > 0; i = fromUri.indexOf('/', i + 1)) {
result.append("../");
}
// append path down from common ancestor to there
result.append(toUri.substring(pos));
if (result.length() == 0) {
// special case: relative link to the parent folder from a file in that folder
result.append("./");
}
return result.toString();
} | java | public static String getRelativeUri(String fromUri, String toUri) {
StringBuffer result = new StringBuffer();
int pos = 0;
while (true) {
int i = fromUri.indexOf('/', pos);
int j = toUri.indexOf('/', pos);
if ((i == -1) || (i != j) || !fromUri.regionMatches(pos, toUri, pos, i - pos)) {
break;
}
pos = i + 1;
}
// count hops up from here to the common ancestor
for (int i = fromUri.indexOf('/', pos); i > 0; i = fromUri.indexOf('/', i + 1)) {
result.append("../");
}
// append path down from common ancestor to there
result.append(toUri.substring(pos));
if (result.length() == 0) {
// special case: relative link to the parent folder from a file in that folder
result.append("./");
}
return result.toString();
} | [
"public",
"static",
"String",
"getRelativeUri",
"(",
"String",
"fromUri",
",",
"String",
"toUri",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"int",
"i",
"=... | Calculates a relative URI from "fromUri" to "toUri",
both URI must be absolute.<p>
@param fromUri the URI to start
@param toUri the URI to calculate a relative path to
@return a relative URI from "fromUri" to "toUri" | [
"Calculates",
"a",
"relative",
"URI",
"from",
"fromUri",
"to",
"toUri",
"both",
"URI",
"must",
"be",
"absolute",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L148-L176 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readUtf8Lines | public static List<String> readUtf8Lines(String path) throws IORuntimeException {
return readLines(path, CharsetUtil.CHARSET_UTF_8);
} | java | public static List<String> readUtf8Lines(String path) throws IORuntimeException {
return readLines(path, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readUtf8Lines",
"(",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 从文件中读取每一行数据,编码为UTF-8
@param path 文件路径
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常
@since 3.1.1 | [
"从文件中读取每一行数据,编码为UTF",
"-",
"8"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2331-L2333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.