repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.payment_thod_paymentMethodId_GET | public OvhPaymentMethod payment_thod_paymentMethodId_GET(Long paymentMethodId) throws IOException {
String qPath = "/me/payment/method/{paymentMethodId}";
StringBuilder sb = path(qPath, paymentMethodId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPaymentMethod.class);
} | java | public OvhPaymentMethod payment_thod_paymentMethodId_GET(Long paymentMethodId) throws IOException {
String qPath = "/me/payment/method/{paymentMethodId}";
StringBuilder sb = path(qPath, paymentMethodId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPaymentMethod.class);
} | [
"public",
"OvhPaymentMethod",
"payment_thod_paymentMethodId_GET",
"(",
"Long",
"paymentMethodId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/payment/method/{paymentMethodId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"paymentMet... | Get one payment method
REST: GET /me/payment/method/{paymentMethodId}
@param paymentMethodId [required] Payment method ID
API beta | [
"Get",
"one",
"payment",
"method"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1057-L1062 |
CloudSlang/cs-actions | cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java | StringEscapeUtilities.removeEscapedChar | @NotNull
public static String removeEscapedChar(@NotNull final String string, final char toRemove) {
return string.replaceAll("\\\\" + toRemove, "");
} | java | @NotNull
public static String removeEscapedChar(@NotNull final String string, final char toRemove) {
return string.replaceAll("\\\\" + toRemove, "");
} | [
"@",
"NotNull",
"public",
"static",
"String",
"removeEscapedChar",
"(",
"@",
"NotNull",
"final",
"String",
"string",
",",
"final",
"char",
"toRemove",
")",
"{",
"return",
"string",
".",
"replaceAll",
"(",
"\"\\\\\\\\\"",
"+",
"toRemove",
",",
"\"\"",
")",
";... | Removes all the occurrences of the \<toRemove> characters from the <string>
@param string the string from which to remove the character
@param toRemove the \character to remove from the <string>
@return a new string with the removed \<toRemove> character | [
"Removes",
"all",
"the",
"occurrences",
"of",
"the",
"\\",
"<toRemove",
">",
"characters",
"from",
"the",
"<string",
">"
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java#L97-L100 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.errorEventDefinition | public ErrorEventDefinitionBuilder errorEventDefinition() {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | java | public ErrorEventDefinitionBuilder errorEventDefinition() {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | [
"public",
"ErrorEventDefinitionBuilder",
"errorEventDefinition",
"(",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createEmptyErrorEventDefinition",
"(",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"errorEventDefinition",
... | Creates an error event definition
and returns a builder for the error event definition.
@return the error event definition builder object | [
"Creates",
"an",
"error",
"event",
"definition",
"and",
"returns",
"a",
"builder",
"for",
"the",
"error",
"event",
"definition",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L95-L99 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java | ClassPropertyUsageAnalyzer.printClassList | private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) {
out.print(",\"");
boolean first = true;
for (EntityIdValue superClass : classes) {
if (first) {
first = false;
} else {
out.print("@");
}
// makeshift escaping for Miga:
out.print(getClassLabel(superClass).replace("@", "@"));
}
out.print("\"");
} | java | private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) {
out.print(",\"");
boolean first = true;
for (EntityIdValue superClass : classes) {
if (first) {
first = false;
} else {
out.print("@");
}
// makeshift escaping for Miga:
out.print(getClassLabel(superClass).replace("@", "@"));
}
out.print("\"");
} | [
"private",
"void",
"printClassList",
"(",
"PrintStream",
"out",
",",
"Iterable",
"<",
"EntityIdValue",
">",
"classes",
")",
"{",
"out",
".",
"print",
"(",
"\",\\\"\"",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"EntityIdValue",
"superClass",... | Prints a list of classes to the given output. The list is encoded as a
single CSV value, using "@" as a separator. Miga can decode this.
Standard CSV processors do not support lists of entries as values,
however.
@param out
the output to write to
@param classes
the list of class items | [
"Prints",
"a",
"list",
"of",
"classes",
"to",
"the",
"given",
"output",
".",
"The",
"list",
"is",
"encoded",
"as",
"a",
"single",
"CSV",
"value",
"using",
"@",
"as",
"a",
"separator",
".",
"Miga",
"can",
"decode",
"this",
".",
"Standard",
"CSV",
"proce... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L575-L588 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java | LdapHelper.encodePassword | public static byte[] encodePassword(String password) throws WIMSystemException {
try {
return ("\"" + password + "\"").getBytes("UTF-16LE");
} catch (Exception e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.GENERIC, WIMMessageHelper.generateMsgParms(e.getMessage()));
throw new WIMSystemException(WIMMessageKey.GENERIC, msg, e);
}
} | java | public static byte[] encodePassword(String password) throws WIMSystemException {
try {
return ("\"" + password + "\"").getBytes("UTF-16LE");
} catch (Exception e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.GENERIC, WIMMessageHelper.generateMsgParms(e.getMessage()));
throw new WIMSystemException(WIMMessageKey.GENERIC, msg, e);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"encodePassword",
"(",
"String",
"password",
")",
"throws",
"WIMSystemException",
"{",
"try",
"{",
"return",
"(",
"\"\\\"\"",
"+",
"password",
"+",
"\"\\\"\"",
")",
".",
"getBytes",
"(",
"\"UTF-16LE\"",
")",
";",
"}",
... | Encode the input password from String format to special byte array format so that it can be stored in
attribute <code>unicodePwd</code> in Active Directory.
@param password The password to be encoded.
@return The encoded byte array which can be stored in <code>unicodePwd</code> attribute in Active Directory. | [
"Encode",
"the",
"input",
"password",
"from",
"String",
"format",
"to",
"special",
"byte",
"array",
"format",
"so",
"that",
"it",
"can",
"be",
"stored",
"in",
"attribute",
"<code",
">",
"unicodePwd<",
"/",
"code",
">",
"in",
"Active",
"Directory",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java#L682-L689 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java | JobHistoryService.getFlowTimeSeriesStats | public List<Flow> getFlowTimeSeriesStats(String cluster, String user,
String appId, String version, long startTime, long endTime, int limit,
byte[] startRow) throws IOException {
// app portion of row key
byte[] rowPrefix = Bytes.toBytes((cluster + Constants.SEP + user
+ Constants.SEP + appId + Constants.SEP));
byte[] scanStartRow;
if (startRow != null) {
scanStartRow = startRow;
} else {
if (endTime != 0) {
// use end time in start row, if present
long endRunId = FlowKey.encodeRunId(endTime);
scanStartRow =
Bytes.add(rowPrefix, Bytes.toBytes(endRunId), Constants.SEP_BYTES);
} else {
scanStartRow = rowPrefix;
}
}
// TODO: use RunMatchFilter to limit scan on the server side
Scan scan = new Scan();
scan.setStartRow(scanStartRow);
FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
if (startTime != 0) {
// if limited by start time, early out as soon as we hit it
long startRunId = FlowKey.encodeRunId(startTime);
// zero byte at the end makes the startRunId inclusive
byte[] scanEndRow = Bytes.add(rowPrefix, Bytes.toBytes(startRunId),
Constants.ZERO_SINGLE_BYTE);
scan.setStopRow(scanEndRow);
} else {
// require that all rows match the app prefix we're looking for
filters.addFilter(new WhileMatchFilter(new PrefixFilter(rowPrefix)));
}
// if version is passed, restrict the rows returned to that version
if (version != null && version.length() > 0) {
filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES,
Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL,
Bytes.toBytes(version)));
}
// filter out all config columns except the queue name
filters.addFilter(new QualifierFilter(CompareFilter.CompareOp.NOT_EQUAL,
new RegexStringComparator(
"^c\\!((?!" + Constants.HRAVEN_QUEUE + ").)*$")));
scan.setFilter(filters);
LOG.info("scan : \n " + scan.toJSON() + " \n");
return createFromResults(scan, false, limit);
} | java | public List<Flow> getFlowTimeSeriesStats(String cluster, String user,
String appId, String version, long startTime, long endTime, int limit,
byte[] startRow) throws IOException {
// app portion of row key
byte[] rowPrefix = Bytes.toBytes((cluster + Constants.SEP + user
+ Constants.SEP + appId + Constants.SEP));
byte[] scanStartRow;
if (startRow != null) {
scanStartRow = startRow;
} else {
if (endTime != 0) {
// use end time in start row, if present
long endRunId = FlowKey.encodeRunId(endTime);
scanStartRow =
Bytes.add(rowPrefix, Bytes.toBytes(endRunId), Constants.SEP_BYTES);
} else {
scanStartRow = rowPrefix;
}
}
// TODO: use RunMatchFilter to limit scan on the server side
Scan scan = new Scan();
scan.setStartRow(scanStartRow);
FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
if (startTime != 0) {
// if limited by start time, early out as soon as we hit it
long startRunId = FlowKey.encodeRunId(startTime);
// zero byte at the end makes the startRunId inclusive
byte[] scanEndRow = Bytes.add(rowPrefix, Bytes.toBytes(startRunId),
Constants.ZERO_SINGLE_BYTE);
scan.setStopRow(scanEndRow);
} else {
// require that all rows match the app prefix we're looking for
filters.addFilter(new WhileMatchFilter(new PrefixFilter(rowPrefix)));
}
// if version is passed, restrict the rows returned to that version
if (version != null && version.length() > 0) {
filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES,
Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL,
Bytes.toBytes(version)));
}
// filter out all config columns except the queue name
filters.addFilter(new QualifierFilter(CompareFilter.CompareOp.NOT_EQUAL,
new RegexStringComparator(
"^c\\!((?!" + Constants.HRAVEN_QUEUE + ").)*$")));
scan.setFilter(filters);
LOG.info("scan : \n " + scan.toJSON() + " \n");
return createFromResults(scan, false, limit);
} | [
"public",
"List",
"<",
"Flow",
">",
"getFlowTimeSeriesStats",
"(",
"String",
"cluster",
",",
"String",
"user",
",",
"String",
"appId",
",",
"String",
"version",
",",
"long",
"startTime",
",",
"long",
"endTime",
",",
"int",
"limit",
",",
"byte",
"[",
"]",
... | Returns the {@link Flow} runs' stats - summed up per flow If the
{@code version} parameter is non-null, the returned results will be
restricted to those matching this app version.
<p>
<strong>Note:</strong> this retrieval method will omit the configuration
data from all of the returned jobs.
</p>
@param cluster the cluster where the jobs were run
@param user the user running the jobs
@param appId the application identifier for the jobs
@param version if non-null, only flows matching this application version
will be returned
@param startTime the start time for the flows to be looked at
@param endTime the end time for the flows to be looked at
@param limit the maximum number of flows to return
@return | [
"Returns",
"the",
"{",
"@link",
"Flow",
"}",
"runs",
"stats",
"-",
"summed",
"up",
"per",
"flow",
"If",
"the",
"{",
"@code",
"version",
"}",
"parameter",
"is",
"non",
"-",
"null",
"the",
"returned",
"results",
"will",
"be",
"restricted",
"to",
"those",
... | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L338-L393 |
kuali/ojb-1.0.4 | src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java | RollbackBean.rollbackOtherBeanUsing_2 | public void rollbackOtherBeanUsing_2(ArticleVO article, List persons)
{
log.info("rollbackOtherBeanUsing_2 method was called");
ArticleManagerODMGLocal am = getArticleManager();
PersonManagerODMGLocal pm = getPersonManager();
pm.storePersons(persons);
am.failureStore(article);
} | java | public void rollbackOtherBeanUsing_2(ArticleVO article, List persons)
{
log.info("rollbackOtherBeanUsing_2 method was called");
ArticleManagerODMGLocal am = getArticleManager();
PersonManagerODMGLocal pm = getPersonManager();
pm.storePersons(persons);
am.failureStore(article);
} | [
"public",
"void",
"rollbackOtherBeanUsing_2",
"(",
"ArticleVO",
"article",
",",
"List",
"persons",
")",
"{",
"log",
".",
"info",
"(",
"\"rollbackOtherBeanUsing_2 method was called\"",
")",
";",
"ArticleManagerODMGLocal",
"am",
"=",
"getArticleManager",
"(",
")",
";",
... | First store a list of persons then we
store the article using a failure store
method in ArticleManager.
@ejb:interface-method | [
"First",
"store",
"a",
"list",
"of",
"persons",
"then",
"we",
"store",
"the",
"article",
"using",
"a",
"failure",
"store",
"method",
"in",
"ArticleManager",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java#L148-L155 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java | ExpressRouteCircuitConnectionsInner.getAsync | public Observable<ExpressRouteCircuitConnectionInner> getAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName) {
return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() {
@Override
public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitConnectionInner> getAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName) {
return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() {
@Override
public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitConnectionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"connectionName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"... | Gets the specified Express Route Circuit Connection from the specified express route circuit.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param connectionName The name of the express route circuit connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitConnectionInner object | [
"Gets",
"the",
"specified",
"Express",
"Route",
"Circuit",
"Connection",
"from",
"the",
"specified",
"express",
"route",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L300-L307 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java | ClassFile.addInnerClass | public ClassFile addInnerClass(String innerClassName,
String superClassName) {
String fullInnerClassName;
if (innerClassName == null) {
fullInnerClassName =
mClassName + '$' + (++mAnonymousInnerClassCount);
}
else {
fullInnerClassName = mClassName + '$' + innerClassName;
}
ClassFile inner = new ClassFile(fullInnerClassName, superClassName);
Modifiers access = inner.getModifiers();
access.setPrivate(true);
access.setStatic(true);
inner.mInnerClassName = innerClassName;
inner.mOuterClass = this;
if (mInnerClasses == null) {
mInnerClasses = new ArrayList<ClassFile>();
}
mInnerClasses.add(inner);
// Record the inner class in this, the outer class.
if (mInnerClassesAttr == null) {
addAttribute(new InnerClassesAttr(mCp));
}
mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
innerClassName, access);
// Record the inner class in itself.
inner.addAttribute(new InnerClassesAttr(inner.getConstantPool()));
inner.mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
innerClassName, access);
return inner;
} | java | public ClassFile addInnerClass(String innerClassName,
String superClassName) {
String fullInnerClassName;
if (innerClassName == null) {
fullInnerClassName =
mClassName + '$' + (++mAnonymousInnerClassCount);
}
else {
fullInnerClassName = mClassName + '$' + innerClassName;
}
ClassFile inner = new ClassFile(fullInnerClassName, superClassName);
Modifiers access = inner.getModifiers();
access.setPrivate(true);
access.setStatic(true);
inner.mInnerClassName = innerClassName;
inner.mOuterClass = this;
if (mInnerClasses == null) {
mInnerClasses = new ArrayList<ClassFile>();
}
mInnerClasses.add(inner);
// Record the inner class in this, the outer class.
if (mInnerClassesAttr == null) {
addAttribute(new InnerClassesAttr(mCp));
}
mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
innerClassName, access);
// Record the inner class in itself.
inner.addAttribute(new InnerClassesAttr(inner.getConstantPool()));
inner.mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
innerClassName, access);
return inner;
} | [
"public",
"ClassFile",
"addInnerClass",
"(",
"String",
"innerClassName",
",",
"String",
"superClassName",
")",
"{",
"String",
"fullInnerClassName",
";",
"if",
"(",
"innerClassName",
"==",
"null",
")",
"{",
"fullInnerClassName",
"=",
"mClassName",
"+",
"'",
"'",
... | Add an inner class to this class. By default, inner classes are private
static.
@param innerClassName Optional short inner class name.
@param superClassName Full super class name. | [
"Add",
"an",
"inner",
"class",
"to",
"this",
"class",
".",
"By",
"default",
"inner",
"classes",
"are",
"private",
"static",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L705-L743 |
googleapis/cloud-bigtable-client | bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Export.java | Export.createSubmittableJob | public static Job createSubmittableJob(Configuration conf, String[] args)
throws IOException {
conf.setIfUnset("hbase.client.connection.impl",
BigtableConfiguration.getConnectionClass().getName());
conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000");
conf.setBoolean(TableInputFormat.SHUFFLE_MAPS, true);
String tableName = args[0];
Path outputDir = new Path(args[1]);
Job job = Job.getInstance(conf, NAME + "_" + tableName);
job.setJobName(NAME + "_" + tableName);
job.setJarByClass(Export.class);
// Set optional scan parameters
Scan s = getConfiguredScanForJob(conf, args);
TableMapReduceUtil.initTableMapperJob(tableName, s, IdentityTableMapper.class, ImmutableBytesWritable.class, Result.class, job, false);
// No reducers. Just write straight to output files.
job.setNumReduceTasks(0);
job.setOutputFormatClass(SequenceFileOutputFormat.class);
job.setOutputKeyClass(ImmutableBytesWritable.class);
job.setOutputValueClass(Result.class);
FileOutputFormat.setOutputPath(job, outputDir); // job conf doesn't contain the conf so doesn't have a default fs.
return job;
} | java | public static Job createSubmittableJob(Configuration conf, String[] args)
throws IOException {
conf.setIfUnset("hbase.client.connection.impl",
BigtableConfiguration.getConnectionClass().getName());
conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000");
conf.setBoolean(TableInputFormat.SHUFFLE_MAPS, true);
String tableName = args[0];
Path outputDir = new Path(args[1]);
Job job = Job.getInstance(conf, NAME + "_" + tableName);
job.setJobName(NAME + "_" + tableName);
job.setJarByClass(Export.class);
// Set optional scan parameters
Scan s = getConfiguredScanForJob(conf, args);
TableMapReduceUtil.initTableMapperJob(tableName, s, IdentityTableMapper.class, ImmutableBytesWritable.class, Result.class, job, false);
// No reducers. Just write straight to output files.
job.setNumReduceTasks(0);
job.setOutputFormatClass(SequenceFileOutputFormat.class);
job.setOutputKeyClass(ImmutableBytesWritable.class);
job.setOutputValueClass(Result.class);
FileOutputFormat.setOutputPath(job, outputDir); // job conf doesn't contain the conf so doesn't have a default fs.
return job;
} | [
"public",
"static",
"Job",
"createSubmittableJob",
"(",
"Configuration",
"conf",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"conf",
".",
"setIfUnset",
"(",
"\"hbase.client.connection.impl\"",
",",
"BigtableConfiguration",
".",
"getConnectionCl... | Sets up the actual job.
@param conf The current configuration.
@param args The command line parameters.
@return The newly created job.
@throws java.io.IOException When setting up the job fails. | [
"Sets",
"up",
"the",
"actual",
"job",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Export.java#L77-L99 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java | OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLAsymmetricObjectPropertyAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}... | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java#L73-L76 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/compat/hadoop/TextSerializer.java | TextSerializer.writeVLong | private static void writeVLong(DataOutput stream, long i) throws IOException {
if (i >= -112 && i <= 127) {
stream.writeByte((byte)i);
return;
}
int len = -112;
if (i < 0) {
i ^= -1L; // take one's complement'
len = -120;
}
long tmp = i;
while (tmp != 0) {
tmp = tmp >> 8;
len--;
}
stream.writeByte((byte)len);
len = (len < -120) ? -(len + 120) : -(len + 112);
for (int idx = len; idx != 0; idx--) {
int shiftbits = (idx - 1) * 8;
long mask = 0xFFL << shiftbits;
stream.writeByte((byte)((i & mask) >> shiftbits));
}
} | java | private static void writeVLong(DataOutput stream, long i) throws IOException {
if (i >= -112 && i <= 127) {
stream.writeByte((byte)i);
return;
}
int len = -112;
if (i < 0) {
i ^= -1L; // take one's complement'
len = -120;
}
long tmp = i;
while (tmp != 0) {
tmp = tmp >> 8;
len--;
}
stream.writeByte((byte)len);
len = (len < -120) ? -(len + 120) : -(len + 112);
for (int idx = len; idx != 0; idx--) {
int shiftbits = (idx - 1) * 8;
long mask = 0xFFL << shiftbits;
stream.writeByte((byte)((i & mask) >> shiftbits));
}
} | [
"private",
"static",
"void",
"writeVLong",
"(",
"DataOutput",
"stream",
",",
"long",
"i",
")",
"throws",
"IOException",
"{",
"if",
"(",
"i",
">=",
"-",
"112",
"&&",
"i",
"<=",
"127",
")",
"{",
"stream",
".",
"writeByte",
"(",
"(",
"byte",
")",
"i",
... | From org.apache.hadoop.io.WritableUtis
Serializes a long to a binary stream with zero-compressed encoding.
For -112 <= i <= 127, only one byte is used with the actual value.
For other values of i, the first byte value indicates whether the
long is positive or negative, and the number of bytes that follow.
If the first byte value v is between -113 and -120, the following long
is positive, with number of bytes that follow are -(v+112).
If the first byte value v is between -121 and -128, the following long
is negative, with number of bytes that follow are -(v+120). Bytes are
stored in the high-non-zero-byte-first order.
@param stream Binary output stream
@param i Long to be serialized
@throws java.io.IOException | [
"From",
"org",
".",
"apache",
".",
"hadoop",
".",
"io",
".",
"WritableUtis"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/compat/hadoop/TextSerializer.java#L67-L94 |
database-rider/database-rider | rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java | DataSetExecutorImpl.performReplacements | @SuppressWarnings("unchecked")
private IDataSet performReplacements(IDataSet dataSet) {
if (!dbUnitConfig.getProperties().containsKey("replacers")) {
return dataSet;
}
return performReplacements(dataSet, (List<Replacer>) dbUnitConfig.getProperties().get("replacers"));
} | java | @SuppressWarnings("unchecked")
private IDataSet performReplacements(IDataSet dataSet) {
if (!dbUnitConfig.getProperties().containsKey("replacers")) {
return dataSet;
}
return performReplacements(dataSet, (List<Replacer>) dbUnitConfig.getProperties().get("replacers"));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"IDataSet",
"performReplacements",
"(",
"IDataSet",
"dataSet",
")",
"{",
"if",
"(",
"!",
"dbUnitConfig",
".",
"getProperties",
"(",
")",
".",
"containsKey",
"(",
"\"replacers\"",
")",
")",
"{",
"re... | Perform replacements from all {@link Replacer} implementations,
registered in {@link #dbUnitConfig}. | [
"Perform",
"replacements",
"from",
"all",
"{"
] | train | https://github.com/database-rider/database-rider/blob/7545cc31118df9cfef3f89e27223b433a24fb5dd/rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java#L446-L452 |
facebook/nailgun | nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java | AliasManager.loadFromProperties | public void loadFromProperties(java.util.Properties properties) {
for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
if (!key.endsWith(".desc")) {
try {
Class clazz = Class.forName(properties.getProperty(key));
String desc = properties.getProperty(key + ".desc", "");
addAlias(new Alias(key, desc, clazz));
} catch (ClassNotFoundException e) {
System.err.println("Unable to locate class " + properties.getProperty(key));
}
}
}
} | java | public void loadFromProperties(java.util.Properties properties) {
for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
if (!key.endsWith(".desc")) {
try {
Class clazz = Class.forName(properties.getProperty(key));
String desc = properties.getProperty(key + ".desc", "");
addAlias(new Alias(key, desc, clazz));
} catch (ClassNotFoundException e) {
System.err.println("Unable to locate class " + properties.getProperty(key));
}
}
}
} | [
"public",
"void",
"loadFromProperties",
"(",
"java",
".",
"util",
".",
"Properties",
"properties",
")",
"{",
"for",
"(",
"Iterator",
"i",
"=",
"properties",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
... | Loads Aliases from a java.util.Properties file located at the specified URL. The properties
must be of the form:
<pre><code>[alias name]=[fully qualified classname]</code></pre>
each of which may have an optional
<pre><code>[alias name].desc=[alias description]</code></pre>
For example, to create an alias called " <code>myprog</code>" for class <code>
com.mydomain.myapp.MyProg</code>, the following properties would be defined:
<pre><code>myprog=com.mydomain.myapp.MyProg
myprog.desc=Runs my program.
</code></pre>
@param properties the Properties to load. | [
"Loads",
"Aliases",
"from",
"a",
"java",
".",
"util",
".",
"Properties",
"file",
"located",
"at",
"the",
"specified",
"URL",
".",
"The",
"properties",
"must",
"be",
"of",
"the",
"form",
":"
] | train | https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java#L74-L87 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java | SVGHyperCube.drawFrame | public static Element drawFrame(SVGPlot svgp, Projection2D proj, double[] min, double[] max) {
SVGPath path = new SVGPath();
ArrayList<double[]> edges = getVisibleEdges(proj, min, max);
double[] rv_min = proj.fastProjectDataToRenderSpace(min);
recDrawEdges(path, rv_min[0], rv_min[1], edges, BitsUtil.zero(edges.size()));
return path.makeElement(svgp);
} | java | public static Element drawFrame(SVGPlot svgp, Projection2D proj, double[] min, double[] max) {
SVGPath path = new SVGPath();
ArrayList<double[]> edges = getVisibleEdges(proj, min, max);
double[] rv_min = proj.fastProjectDataToRenderSpace(min);
recDrawEdges(path, rv_min[0], rv_min[1], edges, BitsUtil.zero(edges.size()));
return path.makeElement(svgp);
} | [
"public",
"static",
"Element",
"drawFrame",
"(",
"SVGPlot",
"svgp",
",",
"Projection2D",
"proj",
",",
"double",
"[",
"]",
"min",
",",
"double",
"[",
"]",
"max",
")",
"{",
"SVGPath",
"path",
"=",
"new",
"SVGPath",
"(",
")",
";",
"ArrayList",
"<",
"doubl... | Wireframe hypercube.
@param svgp SVG Plot
@param proj Visualization projection
@param min First corner
@param max Opposite corner
@return path element | [
"Wireframe",
"hypercube",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java#L61-L67 |
apache/reef | lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java | REEFExecutor.launchTask | @Override
public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
driver.sendStatusUpdate(TaskStatus.newBuilder()
.setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build())
.setState(TaskState.TASK_STARTING)
.setSlaveId(task.getSlaveId())
.setMessage(this.mesosRemoteManager.getMyIdentifier())
.build());
} | java | @Override
public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
driver.sendStatusUpdate(TaskStatus.newBuilder()
.setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build())
.setState(TaskState.TASK_STARTING)
.setSlaveId(task.getSlaveId())
.setMessage(this.mesosRemoteManager.getMyIdentifier())
.build());
} | [
"@",
"Override",
"public",
"void",
"launchTask",
"(",
"final",
"ExecutorDriver",
"driver",
",",
"final",
"TaskInfo",
"task",
")",
"{",
"driver",
".",
"sendStatusUpdate",
"(",
"TaskStatus",
".",
"newBuilder",
"(",
")",
".",
"setTaskId",
"(",
"TaskID",
".",
"n... | We assume a long-running Mesos Task that manages a REEF Evaluator process, leveraging Mesos Executor's interface. | [
"We",
"assume",
"a",
"long",
"-",
"running",
"Mesos",
"Task",
"that",
"manages",
"a",
"REEF",
"Evaluator",
"process",
"leveraging",
"Mesos",
"Executor",
"s",
"interface",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java#L109-L117 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.queryIsEmpty | public static boolean queryIsEmpty(SQLiteDatabase db, String table) {
long isEmpty = longForQuery(db, "select exists(select 1 from " + table + ")", null);
return isEmpty == 0;
} | java | public static boolean queryIsEmpty(SQLiteDatabase db, String table) {
long isEmpty = longForQuery(db, "select exists(select 1 from " + table + ")", null);
return isEmpty == 0;
} | [
"public",
"static",
"boolean",
"queryIsEmpty",
"(",
"SQLiteDatabase",
"db",
",",
"String",
"table",
")",
"{",
"long",
"isEmpty",
"=",
"longForQuery",
"(",
"db",
",",
"\"select exists(select 1 from \"",
"+",
"table",
"+",
"\")\"",
",",
"null",
")",
";",
"return... | Query the table to check whether a table is empty or not
@param db the database the table is in
@param table the name of the table to query
@return True if the table is empty
@hide | [
"Query",
"the",
"table",
"to",
"check",
"whether",
"a",
"table",
"is",
"empty",
"or",
"not"
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L823-L826 |
carewebframework/carewebframework-vista | org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java | DocumentListRenderer.renderItem | @Override
public void renderItem(Listitem item, Document doc) {
log.trace("item render");
item.setSelectable(true);
item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK);
addCell(item, "");
addCell(item, doc.getDateTime());
addCell(item, doc.getTitle());
addCell(item, doc.getLocationName());
addCell(item, doc.getAuthorName());
} | java | @Override
public void renderItem(Listitem item, Document doc) {
log.trace("item render");
item.setSelectable(true);
item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK);
addCell(item, "");
addCell(item, doc.getDateTime());
addCell(item, doc.getTitle());
addCell(item, doc.getLocationName());
addCell(item, doc.getAuthorName());
} | [
"@",
"Override",
"public",
"void",
"renderItem",
"(",
"Listitem",
"item",
",",
"Document",
"doc",
")",
"{",
"log",
".",
"trace",
"(",
"\"item render\"",
")",
";",
"item",
".",
"setSelectable",
"(",
"true",
")",
";",
"item",
".",
"addForward",
"(",
"Event... | Render the list item for the specified document.
@param item List item to render.
@param doc The document associated with the list item. | [
"Render",
"the",
"list",
"item",
"for",
"the",
"specified",
"document",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java#L54-L64 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java | FileUtils.readableFileSize | public static String readableFileSize (long size) {
if (size <= 0) return "0 B";
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)).replace(",", ".") + " " + UNITS[digitGroups];
} | java | public static String readableFileSize (long size) {
if (size <= 0) return "0 B";
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)).replace(",", ".") + " " + UNITS[digitGroups];
} | [
"public",
"static",
"String",
"readableFileSize",
"(",
"long",
"size",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"return",
"\"0 B\"",
";",
"int",
"digitGroups",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"log10",
"(",
"size",
")",
"/",
"Math",
".",
... | Converts byte file size to human readable, eg:<br>
500 becomes 500 B<br>
1024 becomes 1 KB<br>
123456 becomes 120.6 KB<br>
10000000000 becomes 9.3 GB<br>
Max supported unit is yottabyte (YB).
@param size file size in bytes.
@return human readable file size. | [
"Converts",
"byte",
"file",
"size",
"to",
"human",
"readable",
"eg",
":",
"<br",
">",
"500",
"becomes",
"500",
"B<br",
">",
"1024",
"becomes",
"1",
"KB<br",
">",
"123456",
"becomes",
"120",
".",
"6",
"KB<br",
">",
"10000000000",
"becomes",
"9",
".",
"3... | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java#L77-L81 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newTimex3 | public Timex3 newTimex3(String type) {
String newId = idManager.getNextId(AnnotationType.TIMEX3);
Timex3 newTimex3 = new Timex3(newId, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | java | public Timex3 newTimex3(String type) {
String newId = idManager.getNextId(AnnotationType.TIMEX3);
Timex3 newTimex3 = new Timex3(newId, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | [
"public",
"Timex3",
"newTimex3",
"(",
"String",
"type",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"TIMEX3",
")",
";",
"Timex3",
"newTimex3",
"=",
"new",
"Timex3",
"(",
"newId",
",",
"type",
")",
";",
"an... | Creates a new timeExpressions. It assigns an appropriate ID to it. The Coref is added to the document.
@param references different mentions (list of targets) to the same entity.
@return a new timex3. | [
"Creates",
"a",
"new",
"timeExpressions",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"Coref",
"is",
"added",
"to",
"the",
"document",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L790-L795 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java | DeIdentifyUtil.deidentifyLeft | public static String deidentifyLeft(String str, int size) {
int repeat;
if (size > str.length()) {
repeat = str.length();
} else {
repeat = size;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), 0, size);
} | java | public static String deidentifyLeft(String str, int size) {
int repeat;
if (size > str.length()) {
repeat = str.length();
} else {
repeat = size;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), 0, size);
} | [
"public",
"static",
"String",
"deidentifyLeft",
"(",
"String",
"str",
",",
"int",
"size",
")",
"{",
"int",
"repeat",
";",
"if",
"(",
"size",
">",
"str",
".",
"length",
"(",
")",
")",
"{",
"repeat",
"=",
"str",
".",
"length",
"(",
")",
";",
"}",
"... | Deidentify left.
@param str the str
@param size the size
@return the string
@since 2.0.0 | [
"Deidentify",
"left",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java#L49-L57 |
roskenet/springboot-javafx-support | src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java | AbstractFxmlView.showViewAndWait | public void showViewAndWait(Window window, Modality modality) {
if (isPrimaryStageView) {
showView(modality); // this modality will be ignored anyway
return;
}
if (stage == null || currentStageModality != modality || !Objects.equals(stage.getOwner(), window)) {
stage = createStage(modality);
stage.initOwner(window);
}
stage.showAndWait();
} | java | public void showViewAndWait(Window window, Modality modality) {
if (isPrimaryStageView) {
showView(modality); // this modality will be ignored anyway
return;
}
if (stage == null || currentStageModality != modality || !Objects.equals(stage.getOwner(), window)) {
stage = createStage(modality);
stage.initOwner(window);
}
stage.showAndWait();
} | [
"public",
"void",
"showViewAndWait",
"(",
"Window",
"window",
",",
"Modality",
"modality",
")",
"{",
"if",
"(",
"isPrimaryStageView",
")",
"{",
"showView",
"(",
"modality",
")",
";",
"// this modality will be ignored anyway",
"return",
";",
"}",
"if",
"(",
"stag... | Shows the FxmlView instance being the child stage of the given {@link Window} and waits
to be closed before returning to the caller.
@param window
The owner of the FxmlView instance
@param modality
See {@code javafx.stage.Modality}. | [
"Shows",
"the",
"FxmlView",
"instance",
"being",
"the",
"child",
"stage",
"of",
"the",
"given",
"{",
"@link",
"Window",
"}",
"and",
"waits",
"to",
"be",
"closed",
"before",
"returning",
"to",
"the",
"caller",
"."
] | train | https://github.com/roskenet/springboot-javafx-support/blob/aed1da178ecb204eb00508b3ce1e2a11d4fa9619/src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java#L234-L244 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceManager.java | CmsWorkplaceManager.addExportPoint | public void addExportPoint(String uri, String destination) {
CmsExportPoint point = new CmsExportPoint(uri, destination);
m_exportPoints.add(point);
if (CmsLog.INIT.isInfoEnabled() && (point.getDestinationPath() != null)) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_ADD_EXPORT_POINT_2,
point.getUri(),
point.getDestinationPath()));
}
} | java | public void addExportPoint(String uri, String destination) {
CmsExportPoint point = new CmsExportPoint(uri, destination);
m_exportPoints.add(point);
if (CmsLog.INIT.isInfoEnabled() && (point.getDestinationPath() != null)) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_ADD_EXPORT_POINT_2,
point.getUri(),
point.getDestinationPath()));
}
} | [
"public",
"void",
"addExportPoint",
"(",
"String",
"uri",
",",
"String",
"destination",
")",
"{",
"CmsExportPoint",
"point",
"=",
"new",
"CmsExportPoint",
"(",
"uri",
",",
"destination",
")",
";",
"m_exportPoints",
".",
"add",
"(",
"point",
")",
";",
"if",
... | Adds newly created export point to the workplace configuration.<p>
@param uri the export point uri
@param destination the export point destination | [
"Adds",
"newly",
"created",
"export",
"point",
"to",
"the",
"workplace",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceManager.java#L560-L571 |
lets-blade/blade | src/main/java/com/blade/mvc/route/RouteBuilder.java | RouteBuilder.addRouter | public void addRouter(final Class<?> routeType, Object controller) {
Method[] methods = routeType.getDeclaredMethods();
if (BladeKit.isEmpty(methods)) {
return;
}
String nameSpace = null, suffix = null;
if (null != routeType.getAnnotation(Path.class)) {
nameSpace = routeType.getAnnotation(Path.class).value();
suffix = routeType.getAnnotation(Path.class).suffix();
}
if (null == nameSpace) {
log.warn("Route [{}] not path annotation", routeType.getName());
return;
}
for (Method method : methods) {
com.blade.mvc.annotation.Route mapping = method.getAnnotation(com.blade.mvc.annotation.Route.class);
GetRoute getRoute = method.getAnnotation(GetRoute.class);
PostRoute postRoute = method.getAnnotation(PostRoute.class);
PutRoute putRoute = method.getAnnotation(PutRoute.class);
DeleteRoute deleteRoute = method.getAnnotation(DeleteRoute.class);
this.parseRoute(RouteStruct.builder().mapping(mapping)
.getRoute(getRoute).postRoute(postRoute)
.putRoute(putRoute).deleteRoute(deleteRoute)
.nameSpace(nameSpace)
.suffix(suffix).routeType(routeType)
.controller(controller).method(method)
.build());
}
} | java | public void addRouter(final Class<?> routeType, Object controller) {
Method[] methods = routeType.getDeclaredMethods();
if (BladeKit.isEmpty(methods)) {
return;
}
String nameSpace = null, suffix = null;
if (null != routeType.getAnnotation(Path.class)) {
nameSpace = routeType.getAnnotation(Path.class).value();
suffix = routeType.getAnnotation(Path.class).suffix();
}
if (null == nameSpace) {
log.warn("Route [{}] not path annotation", routeType.getName());
return;
}
for (Method method : methods) {
com.blade.mvc.annotation.Route mapping = method.getAnnotation(com.blade.mvc.annotation.Route.class);
GetRoute getRoute = method.getAnnotation(GetRoute.class);
PostRoute postRoute = method.getAnnotation(PostRoute.class);
PutRoute putRoute = method.getAnnotation(PutRoute.class);
DeleteRoute deleteRoute = method.getAnnotation(DeleteRoute.class);
this.parseRoute(RouteStruct.builder().mapping(mapping)
.getRoute(getRoute).postRoute(postRoute)
.putRoute(putRoute).deleteRoute(deleteRoute)
.nameSpace(nameSpace)
.suffix(suffix).routeType(routeType)
.controller(controller).method(method)
.build());
}
} | [
"public",
"void",
"addRouter",
"(",
"final",
"Class",
"<",
"?",
">",
"routeType",
",",
"Object",
"controller",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"routeType",
".",
"getDeclaredMethods",
"(",
")",
";",
"if",
"(",
"BladeKit",
".",
"isEmpty",
"("... | Parse all routing in a controller
@param routeType resolve the routing class,
e.g RouteHandler.class or some controller class | [
"Parse",
"all",
"routing",
"in",
"a",
"controller"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteBuilder.java#L53-L87 |
wcm-io/wcm-io-tooling | commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/install/PackageInstaller.java | PackageInstaller.installFile | public void installFile(PackageFile packageFile) {
File file = packageFile.getFile();
if (!file.exists()) {
throw new PackageManagerException("File does not exist: " + file.getAbsolutePath());
}
try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {
// before install: if bundles are still stopping/starting, wait for completion
pkgmgr.waitForBundlesActivation(httpClient);
if (packageFile.isInstall()) {
log.info("Upload and install " + (packageFile.isForce() ? "(force) " : "") + file.getName() + " to " + props.getPackageManagerUrl());
}
else {
log.info("Upload " + file.getName() + " to " + props.getPackageManagerUrl());
}
VendorPackageInstaller installer = VendorInstallerFactory.getPackageInstaller(props.getPackageManagerUrl());
if (installer != null) {
installer.installPackage(packageFile, pkgmgr, httpClient, props, log);
}
}
catch (IOException ex) {
throw new PackageManagerException("Install operation failed.", ex);
}
} | java | public void installFile(PackageFile packageFile) {
File file = packageFile.getFile();
if (!file.exists()) {
throw new PackageManagerException("File does not exist: " + file.getAbsolutePath());
}
try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {
// before install: if bundles are still stopping/starting, wait for completion
pkgmgr.waitForBundlesActivation(httpClient);
if (packageFile.isInstall()) {
log.info("Upload and install " + (packageFile.isForce() ? "(force) " : "") + file.getName() + " to " + props.getPackageManagerUrl());
}
else {
log.info("Upload " + file.getName() + " to " + props.getPackageManagerUrl());
}
VendorPackageInstaller installer = VendorInstallerFactory.getPackageInstaller(props.getPackageManagerUrl());
if (installer != null) {
installer.installPackage(packageFile, pkgmgr, httpClient, props, log);
}
}
catch (IOException ex) {
throw new PackageManagerException("Install operation failed.", ex);
}
} | [
"public",
"void",
"installFile",
"(",
"PackageFile",
"packageFile",
")",
"{",
"File",
"file",
"=",
"packageFile",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"PackageManagerException",
"(",
"\... | Deploy file via package manager.
@param packageFile AEM content package | [
"Deploy",
"file",
"via",
"package",
"manager",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/install/PackageInstaller.java#L66-L92 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java | MealyFilter.pruneTransitionsWithOutput | public static <I, O> CompactMealy<I, O> pruneTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
Collection<? super O> outputs) {
return filterByOutput(in, inputs, o -> !outputs.contains(o));
} | java | public static <I, O> CompactMealy<I, O> pruneTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
Collection<? super O> outputs) {
return filterByOutput(in, inputs, o -> !outputs.contains(o));
} | [
"public",
"static",
"<",
"I",
",",
"O",
">",
"CompactMealy",
"<",
"I",
",",
"O",
">",
"pruneTransitionsWithOutput",
"(",
"MealyMachine",
"<",
"?",
",",
"I",
",",
"?",
",",
"O",
">",
"in",
",",
"Alphabet",
"<",
"I",
">",
"inputs",
",",
"Collection",
... | Returns a Mealy machine with all transitions removed that have one of the specified output values. The resulting
Mealy machine will not contain any unreachable states.
@param in
the input Mealy machine
@param inputs
the input alphabet
@param outputs
the outputs to remove
@return a Mealy machine with all transitions removed that have one of the specified outputs. | [
"Returns",
"a",
"Mealy",
"machine",
"with",
"all",
"transitions",
"removed",
"that",
"have",
"one",
"of",
"the",
"specified",
"output",
"values",
".",
"The",
"resulting",
"Mealy",
"machine",
"will",
"not",
"contain",
"any",
"unreachable",
"states",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java#L79-L83 |
airbnb/lottie-android | lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java | LottieAnimationView.updateBitmap | @Nullable
public Bitmap updateBitmap(String id, @Nullable Bitmap bitmap) {
return lottieDrawable.updateBitmap(id, bitmap);
} | java | @Nullable
public Bitmap updateBitmap(String id, @Nullable Bitmap bitmap) {
return lottieDrawable.updateBitmap(id, bitmap);
} | [
"@",
"Nullable",
"public",
"Bitmap",
"updateBitmap",
"(",
"String",
"id",
",",
"@",
"Nullable",
"Bitmap",
"bitmap",
")",
"{",
"return",
"lottieDrawable",
".",
"updateBitmap",
"(",
"id",
",",
"bitmap",
")",
";",
"}"
] | Allows you to modify or clear a bitmap that was loaded for an image either automatically
through {@link #setImageAssetsFolder(String)} or with an {@link ImageAssetDelegate}.
@return the previous Bitmap or null. | [
"Allows",
"you",
"to",
"modify",
"or",
"clear",
"a",
"bitmap",
"that",
"was",
"loaded",
"for",
"an",
"image",
"either",
"automatically",
"through",
"{",
"@link",
"#setImageAssetsFolder",
"(",
"String",
")",
"}",
"or",
"with",
"an",
"{",
"@link",
"ImageAssetD... | train | https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java#L660-L663 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java | AbstractModbusMaster.writeMultipleCoils | public void writeMultipleCoils(int unitId, int ref, BitVector coils) throws ModbusException {
checkTransaction();
if (writeMultipleCoilsRequest == null) {
writeMultipleCoilsRequest = new WriteMultipleCoilsRequest();
}
writeMultipleCoilsRequest.setUnitID(unitId);
writeMultipleCoilsRequest.setReference(ref);
writeMultipleCoilsRequest.setCoils(coils);
transaction.setRequest(writeMultipleCoilsRequest);
transaction.execute();
} | java | public void writeMultipleCoils(int unitId, int ref, BitVector coils) throws ModbusException {
checkTransaction();
if (writeMultipleCoilsRequest == null) {
writeMultipleCoilsRequest = new WriteMultipleCoilsRequest();
}
writeMultipleCoilsRequest.setUnitID(unitId);
writeMultipleCoilsRequest.setReference(ref);
writeMultipleCoilsRequest.setCoils(coils);
transaction.setRequest(writeMultipleCoilsRequest);
transaction.execute();
} | [
"public",
"void",
"writeMultipleCoils",
"(",
"int",
"unitId",
",",
"int",
"ref",
",",
"BitVector",
"coils",
")",
"throws",
"ModbusException",
"{",
"checkTransaction",
"(",
")",
";",
"if",
"(",
"writeMultipleCoilsRequest",
"==",
"null",
")",
"{",
"writeMultipleCo... | Writes a given number of coil states to the slave.
Note that the number of coils to be written is given
implicitly, through {@link BitVector#size()}.
@param unitId the slave unit id.
@param ref the offset of the coil to start writing to.
@param coils a <tt>BitVector</tt> which holds the coil states to be written.
@throws ModbusException if an I/O error, a slave exception or
a transaction error occurs. | [
"Writes",
"a",
"given",
"number",
"of",
"coil",
"states",
"to",
"the",
"slave",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L142-L152 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/UNode.java | UNode.addArrayNode | public UNode addArrayNode(String name, String tagName) {
return addChildNode(UNode.createArrayNode(name, tagName));
} | java | public UNode addArrayNode(String name, String tagName) {
return addChildNode(UNode.createArrayNode(name, tagName));
} | [
"public",
"UNode",
"addArrayNode",
"(",
"String",
"name",
",",
"String",
"tagName",
")",
"{",
"return",
"addChildNode",
"(",
"UNode",
".",
"createArrayNode",
"(",
"name",
",",
"tagName",
")",
")",
";",
"}"
] | Create a new ARRAY node with the given name and tag name and add it as a child of
this node. This node must be a MAP or ARRAY. This is a convenience method that
calls {@link UNode#createArrayNode(String, String)} and then
{@link #addChildNode(UNode)}.
@param name Name of new ARRAY node.
@param tagName Tag name of new ARRAY node (for XML).
@return New ARRAY node, added as a child of this node. | [
"Create",
"a",
"new",
"ARRAY",
"node",
"with",
"the",
"given",
"name",
"and",
"tag",
"name",
"and",
"add",
"it",
"as",
"a",
"child",
"of",
"this",
"node",
".",
"This",
"node",
"must",
"be",
"a",
"MAP",
"or",
"ARRAY",
".",
"This",
"is",
"a",
"conven... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/UNode.java#L821-L823 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.executeGetRequest | protected <T> Optional<T> executeGetRequest(URI uri, GenericType<T> returnType)
{
return executeGetRequest(uri, null, null, returnType);
} | java | protected <T> Optional<T> executeGetRequest(URI uri, GenericType<T> returnType)
{
return executeGetRequest(uri, null, null, returnType);
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"executeGetRequest",
"(",
"URI",
"uri",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")",
"{",
"return",
"executeGetRequest",
"(",
"uri",
",",
"null",
",",
"null",
",",
"returnType",
")",
";",
... | Execute a GET request and return the result.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param returnType The type to marshall the result back into
@return The return type | [
"Execute",
"a",
"GET",
"request",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L328-L331 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.doAppendClosingTag | private static StringBuffer doAppendClosingTag(StringBuffer buffer, String tag)
{
buffer.append(SEQUENCE__TAG__BEGIN_CLOSING_TAG).append(tag).append(SEQUENCE__TAG__END_OF_TAG);
return buffer;
} | java | private static StringBuffer doAppendClosingTag(StringBuffer buffer, String tag)
{
buffer.append(SEQUENCE__TAG__BEGIN_CLOSING_TAG).append(tag).append(SEQUENCE__TAG__END_OF_TAG);
return buffer;
} | [
"private",
"static",
"StringBuffer",
"doAppendClosingTag",
"(",
"StringBuffer",
"buffer",
",",
"String",
"tag",
")",
"{",
"buffer",
".",
"append",
"(",
"SEQUENCE__TAG__BEGIN_CLOSING_TAG",
")",
".",
"append",
"(",
"tag",
")",
".",
"append",
"(",
"SEQUENCE__TAG__END... | Add a closing tag to a StringBuffer.
If the buffer is null, a new one is created.
@param buffer
StringBuffer to fill
@param tag
the tag to close
@return the buffer | [
"Add",
"a",
"closing",
"tag",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L453-L457 |
alibaba/jstorm | example/sequence-split-merge/src/main/java/org/apache/storm/starter/tools/RankableObjectWithFields.java | RankableObjectWithFields.from | public static RankableObjectWithFields from(Tuple tuple) {
List<Object> otherFields = Lists.newArrayList(tuple.getValues());
Object obj = otherFields.remove(0);
Long count = (Long) otherFields.remove(0);
return new RankableObjectWithFields(obj, count, otherFields.toArray());
} | java | public static RankableObjectWithFields from(Tuple tuple) {
List<Object> otherFields = Lists.newArrayList(tuple.getValues());
Object obj = otherFields.remove(0);
Long count = (Long) otherFields.remove(0);
return new RankableObjectWithFields(obj, count, otherFields.toArray());
} | [
"public",
"static",
"RankableObjectWithFields",
"from",
"(",
"Tuple",
"tuple",
")",
"{",
"List",
"<",
"Object",
">",
"otherFields",
"=",
"Lists",
".",
"newArrayList",
"(",
"tuple",
".",
"getValues",
"(",
")",
")",
";",
"Object",
"obj",
"=",
"otherFields",
... | Construct a new instance based on the provided {@link Tuple}.
<p/>
This method expects the object to be ranked in the first field (index 0)
of the provided tuple, and the number of occurrences of the object (its
count) in the second field (index 1). Any further fields in the tuple
will be extracted and tracked, too. These fields can be accessed via
{@link RankableObjectWithFields#getFields()}.
@param tuple
@return new instance based on the provided tuple | [
"Construct",
"a",
"new",
"instance",
"based",
"on",
"the",
"provided",
"{",
"@link",
"Tuple",
"}",
".",
"<p",
"/",
">",
"This",
"method",
"expects",
"the",
"object",
"to",
"be",
"ranked",
"in",
"the",
"first",
"field",
"(",
"index",
"0",
")",
"of",
"... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/example/sequence-split-merge/src/main/java/org/apache/storm/starter/tools/RankableObjectWithFields.java#L69-L74 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java | ApiOvhHostingprivateDatabase.serviceName_user_userName_grant_databaseName_update_POST | public OvhTask serviceName_user_userName_grant_databaseName_update_POST(String serviceName, String userName, String databaseName, OvhGrantEnum grant) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/user/{userName}/grant/{databaseName}/update";
StringBuilder sb = path(qPath, serviceName, userName, databaseName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "grant", grant);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_user_userName_grant_databaseName_update_POST(String serviceName, String userName, String databaseName, OvhGrantEnum grant) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/user/{userName}/grant/{databaseName}/update";
StringBuilder sb = path(qPath, serviceName, userName, databaseName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "grant", grant);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_user_userName_grant_databaseName_update_POST",
"(",
"String",
"serviceName",
",",
"String",
"userName",
",",
"String",
"databaseName",
",",
"OvhGrantEnum",
"grant",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/pr... | Update user grant
REST: POST /hosting/privateDatabase/{serviceName}/user/{userName}/grant/{databaseName}/update
@param grant [required] Grant you want set on the database for this user
@param serviceName [required] The internal name of your private database
@param userName [required] User name used to connect to your databases
@param databaseName [required] Database name where grant is set | [
"Update",
"user",
"grant"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L277-L284 |
arnaudroger/SimpleFlatMapper | sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java | MapperBuilder.addMapping | public final B addMapping(final String column, final ColumnDefinition<K, ?> columnDefinition) {
return addMapping(column, calculatedIndex++, columnDefinition);
} | java | public final B addMapping(final String column, final ColumnDefinition<K, ?> columnDefinition) {
return addMapping(column, calculatedIndex++, columnDefinition);
} | [
"public",
"final",
"B",
"addMapping",
"(",
"final",
"String",
"column",
",",
"final",
"ColumnDefinition",
"<",
"K",
",",
"?",
">",
"columnDefinition",
")",
"{",
"return",
"addMapping",
"(",
"column",
",",
"calculatedIndex",
"++",
",",
"columnDefinition",
")",
... | add a new mapping to the specified property with the specified columnDefinition and an undefined type. The index is incremented for each non indexed property mapping.
@param column the property name
@param columnDefinition the definition
@return the current builder | [
"add",
"a",
"new",
"mapping",
"to",
"the",
"specified",
"property",
"with",
"the",
"specified",
"columnDefinition",
"and",
"an",
"undefined",
"type",
".",
"The",
"index",
"is",
"incremented",
"for",
"each",
"non",
"indexed",
"property",
"mapping",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java#L77-L79 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java | FilesInner.listAsync | public Observable<Page<ProjectFileInner>> listAsync(final String groupName, final String serviceName, final String projectName) {
return listWithServiceResponseAsync(groupName, serviceName, projectName)
.map(new Func1<ServiceResponse<Page<ProjectFileInner>>, Page<ProjectFileInner>>() {
@Override
public Page<ProjectFileInner> call(ServiceResponse<Page<ProjectFileInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ProjectFileInner>> listAsync(final String groupName, final String serviceName, final String projectName) {
return listWithServiceResponseAsync(groupName, serviceName, projectName)
.map(new Func1<ServiceResponse<Page<ProjectFileInner>>, Page<ProjectFileInner>>() {
@Override
public Page<ProjectFileInner> call(ServiceResponse<Page<ProjectFileInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ProjectFileInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"groupName",
",",
"final",
"String",
"serviceName",
",",
"final",
"String",
"projectName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"groupN... | Get files in a project.
The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource.
@param groupName Name of the resource group
@param serviceName Name of the service
@param projectName Name of the project
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ProjectFileInner> object | [
"Get",
"files",
"in",
"a",
"project",
".",
"The",
"project",
"resource",
"is",
"a",
"nested",
"resource",
"representing",
"a",
"stored",
"migration",
"project",
".",
"This",
"method",
"returns",
"a",
"list",
"of",
"files",
"owned",
"by",
"a",
"project",
"r... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L155-L163 |
DigitalPebble/TextClassification | src/main/java/com/digitalpebble/classification/TextClassifier.java | TextClassifier.getClassifier | public static TextClassifier getClassifier(File resourceDirectoryFile)
throws Exception {
// check whether we need to unzip the resources first
if (resourceDirectoryFile.toString().endsWith(".zip")
&& resourceDirectoryFile.isFile()) {
resourceDirectoryFile = UnZip.unzip(resourceDirectoryFile);
}
// check the existence of the path
if (resourceDirectoryFile.exists() == false)
throw new IOException("Directory "
+ resourceDirectoryFile.getAbsolutePath()
+ " does not exist");
// check that the lexicon files exists (e.g. its name should be simply
// 'lexicon')
File lexiconFile = new File(resourceDirectoryFile,
Parameters.lexiconName);
if (lexiconFile.exists() == false)
throw new IOException("Lexicon " + lexiconFile + " does not exist");
// and that there is a model file
File modelFile = new File(resourceDirectoryFile, Parameters.modelName);
if (modelFile.exists() == false)
throw new IOException("Model " + modelFile + " does not exist");
Lexicon lexicon = new Lexicon(lexiconFile.toString());
// ask the Lexicon for the classifier to use
String classifier = lexicon.getClassifierType();
TextClassifier instance = (TextClassifier) Class.forName(classifier)
.newInstance();
// set the last modification info
instance.lastmodifiedLexicon = lexiconFile.lastModified();
// set the pathResourceDirectory
instance.pathResourceDirectory = resourceDirectoryFile
.getAbsolutePath();
// set the model
instance.lexicon = lexicon;
instance.loadModel();
return instance;
} | java | public static TextClassifier getClassifier(File resourceDirectoryFile)
throws Exception {
// check whether we need to unzip the resources first
if (resourceDirectoryFile.toString().endsWith(".zip")
&& resourceDirectoryFile.isFile()) {
resourceDirectoryFile = UnZip.unzip(resourceDirectoryFile);
}
// check the existence of the path
if (resourceDirectoryFile.exists() == false)
throw new IOException("Directory "
+ resourceDirectoryFile.getAbsolutePath()
+ " does not exist");
// check that the lexicon files exists (e.g. its name should be simply
// 'lexicon')
File lexiconFile = new File(resourceDirectoryFile,
Parameters.lexiconName);
if (lexiconFile.exists() == false)
throw new IOException("Lexicon " + lexiconFile + " does not exist");
// and that there is a model file
File modelFile = new File(resourceDirectoryFile, Parameters.modelName);
if (modelFile.exists() == false)
throw new IOException("Model " + modelFile + " does not exist");
Lexicon lexicon = new Lexicon(lexiconFile.toString());
// ask the Lexicon for the classifier to use
String classifier = lexicon.getClassifierType();
TextClassifier instance = (TextClassifier) Class.forName(classifier)
.newInstance();
// set the last modification info
instance.lastmodifiedLexicon = lexiconFile.lastModified();
// set the pathResourceDirectory
instance.pathResourceDirectory = resourceDirectoryFile
.getAbsolutePath();
// set the model
instance.lexicon = lexicon;
instance.loadModel();
return instance;
} | [
"public",
"static",
"TextClassifier",
"getClassifier",
"(",
"File",
"resourceDirectoryFile",
")",
"throws",
"Exception",
"{",
"// check whether we need to unzip the resources first\r",
"if",
"(",
"resourceDirectoryFile",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
"\... | Returns a specific instance of a Text Classifier given a resource
Directory
@throws Exception | [
"Returns",
"a",
"specific",
"instance",
"of",
"a",
"Text",
"Classifier",
"given",
"a",
"resource",
"Directory"
] | train | https://github.com/DigitalPebble/TextClassification/blob/c510719c31633841af2bf393a20707d4624f865d/src/main/java/com/digitalpebble/classification/TextClassifier.java#L46-L82 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java | ManagedInstanceKeysInner.beginCreateOrUpdateAsync | public Observable<ManagedInstanceKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1<ServiceResponse<ManagedInstanceKeyInner>, ManagedInstanceKeyInner>() {
@Override
public ManagedInstanceKeyInner call(ServiceResponse<ManagedInstanceKeyInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedInstanceKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1<ServiceResponse<ManagedInstanceKeyInner>, ManagedInstanceKeyInner>() {
@Override
public ManagedInstanceKeyInner call(ServiceResponse<ManagedInstanceKeyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedInstanceKeyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"keyName",
",",
"ManagedInstanceKeyInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdat... | Creates or updates a managed instance key.
@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 managedInstanceName The name of the managed instance.
@param keyName The name of the managed instance key to be operated on (updated or created).
@param parameters The requested managed instance key resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedInstanceKeyInner object | [
"Creates",
"or",
"updates",
"a",
"managed",
"instance",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java#L557-L564 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java | RESTServlet.getApplication | private ApplicationDefinition getApplication(String uri, Tenant tenant) {
if (uri.length() < 2 || uri.startsWith("/_")) {
return null; // Non-application request
}
String[] pathNodes = uri.substring(1).split("/");
String appName = Utils.urlDecode(pathNodes[0]);
ApplicationDefinition appDef = SchemaService.instance().getApplication(tenant, appName);
if (appDef == null) {
throw new NotFoundException("Unknown application: " + appName);
}
return appDef;
} | java | private ApplicationDefinition getApplication(String uri, Tenant tenant) {
if (uri.length() < 2 || uri.startsWith("/_")) {
return null; // Non-application request
}
String[] pathNodes = uri.substring(1).split("/");
String appName = Utils.urlDecode(pathNodes[0]);
ApplicationDefinition appDef = SchemaService.instance().getApplication(tenant, appName);
if (appDef == null) {
throw new NotFoundException("Unknown application: " + appName);
}
return appDef;
} | [
"private",
"ApplicationDefinition",
"getApplication",
"(",
"String",
"uri",
",",
"Tenant",
"tenant",
")",
"{",
"if",
"(",
"uri",
".",
"length",
"(",
")",
"<",
"2",
"||",
"uri",
".",
"startsWith",
"(",
"\"/_\"",
")",
")",
"{",
"return",
"null",
";",
"//... | Get the definition of the referenced application or null if there is none. | [
"Get",
"the",
"definition",
"of",
"the",
"referenced",
"application",
"or",
"null",
"if",
"there",
"is",
"none",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java#L200-L211 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java | HtmlTool.addClass | public String addClass(String content, String selector, String className) {
return addClass(content, selector, Collections.singletonList(className));
} | java | public String addClass(String content, String selector, String className) {
return addClass(content, selector, Collections.singletonList(className));
} | [
"public",
"String",
"addClass",
"(",
"String",
"content",
",",
"String",
"selector",
",",
"String",
"className",
")",
"{",
"return",
"addClass",
"(",
"content",
",",
"selector",
",",
"Collections",
".",
"singletonList",
"(",
"className",
")",
")",
";",
"}"
] | Adds given class to the elements in HTML.
@param content
HTML content to modify
@param selector
CSS selector for elements to add the class to
@param className
Name of class to add to the selected elements
@return HTML content with modified elements. If no elements are found, the original content
is returned.
@since 1.0 | [
"Adds",
"given",
"class",
"to",
"the",
"elements",
"in",
"HTML",
"."
] | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L713-L715 |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java | ServersInner.beginUpdateAsync | public Observable<ServerInner> beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | java | public Observable<ServerInner> beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerUpdateParameters",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
@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 parameters The required parameters for updating a server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerInner object | [
"Updates",
"an",
"existing",
"server",
".",
"The",
"request",
"body",
"can",
"contain",
"one",
"to",
"many",
"of",
"the",
"properties",
"present",
"in",
"the",
"normal",
"server",
"definition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L393-L400 |
libgdx/gdx-ai | gdx-ai/src/com/badlogic/gdx/ai/utils/CircularBuffer.java | CircularBuffer.store | public boolean store (T item) {
if (size == items.length) {
if (!resizable) return false;
// Resize this queue
resize(Math.max(8, (int)(items.length * 1.75f)));
}
size++;
items[tail++] = item;
if (tail == items.length) tail = 0;
return true;
} | java | public boolean store (T item) {
if (size == items.length) {
if (!resizable) return false;
// Resize this queue
resize(Math.max(8, (int)(items.length * 1.75f)));
}
size++;
items[tail++] = item;
if (tail == items.length) tail = 0;
return true;
} | [
"public",
"boolean",
"store",
"(",
"T",
"item",
")",
"{",
"if",
"(",
"size",
"==",
"items",
".",
"length",
")",
"{",
"if",
"(",
"!",
"resizable",
")",
"return",
"false",
";",
"// Resize this queue",
"resize",
"(",
"Math",
".",
"max",
"(",
"8",
",",
... | Adds the given item to the tail of this circular buffer.
@param item the item to add
@return {@code true} if the item has been successfully added to this circular buffer; {@code false} otherwise. | [
"Adds",
"the",
"given",
"item",
"to",
"the",
"tail",
"of",
"this",
"circular",
"buffer",
"."
] | train | https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/utils/CircularBuffer.java#L57-L68 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/security/CryptoUtil.java | CryptoUtil.aesEncrypt | public static byte[] aesEncrypt(byte[] input, byte[] key, byte[] iv) {
return aes(input, key, iv, Cipher.ENCRYPT_MODE);
} | java | public static byte[] aesEncrypt(byte[] input, byte[] key, byte[] iv) {
return aes(input, key, iv, Cipher.ENCRYPT_MODE);
} | [
"public",
"static",
"byte",
"[",
"]",
"aesEncrypt",
"(",
"byte",
"[",
"]",
"input",
",",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"iv",
")",
"{",
"return",
"aes",
"(",
"input",
",",
"key",
",",
"iv",
",",
"Cipher",
".",
"ENCRYPT_MODE",
")"... | 使用AES加密原始字符串.
@param input 原始输入字符数组
@param key 符合AES要求的密钥
@param iv 初始向量 | [
"使用AES加密原始字符串",
"."
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/security/CryptoUtil.java#L97-L99 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/model/Recur.java | Recur.getDates | public final DateList getDates(final Date periodStart,
final Date periodEnd, final Value value) {
return getDates(periodStart, periodStart, periodEnd, value, -1);
} | java | public final DateList getDates(final Date periodStart,
final Date periodEnd, final Value value) {
return getDates(periodStart, periodStart, periodEnd, value, -1);
} | [
"public",
"final",
"DateList",
"getDates",
"(",
"final",
"Date",
"periodStart",
",",
"final",
"Date",
"periodEnd",
",",
"final",
"Value",
"value",
")",
"{",
"return",
"getDates",
"(",
"periodStart",
",",
"periodStart",
",",
"periodEnd",
",",
"value",
",",
"-... | Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by
this recur are retained from the period start, and as such you should ensure the period start is initialised
correctly.
@param periodStart the start of the period
@param periodEnd the end of the period
@param value the type of dates to generate (i.e. date/date-time)
@return a list of dates | [
"Returns",
"a",
"list",
"of",
"start",
"dates",
"in",
"the",
"specified",
"period",
"represented",
"by",
"this",
"recur",
".",
"Any",
"date",
"fields",
"not",
"specified",
"by",
"this",
"recur",
"are",
"retained",
"from",
"the",
"period",
"start",
"and",
"... | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/Recur.java#L627-L630 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.getJobSchedule | public CloudJobSchedule getJobSchedule(String jobScheduleId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleGetOptions options = new JobScheduleGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().jobSchedules().get(jobScheduleId, options);
} | java | public CloudJobSchedule getJobSchedule(String jobScheduleId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleGetOptions options = new JobScheduleGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().jobSchedules().get(jobScheduleId, options);
} | [
"public",
"CloudJobSchedule",
"getJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"DetailLevel",
"detailLevel",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobScheduleGetOptions"... | Gets the specified {@link CloudJobSchedule}.
@param jobScheduleId The ID of the job schedule.
@param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return A {@link CloudJobSchedule} containing information about the specified Azure Batch job schedule.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"the",
"specified",
"{",
"@link",
"CloudJobSchedule",
"}",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L159-L166 |
overturetool/overture | core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java | ProofObligation.makeOr | protected PExp makeOr(PExp root, PExp e)
{
if (root != null)
{
AOrBooleanBinaryExp o = new AOrBooleanBinaryExp();
o.setLeft(root.clone());
o.setOp(new LexKeywordToken(VDMToken.OR, null));
o.setType(new ABooleanBasicType());
o.setRight(e.clone());
return o;
} else
{
return e;
}
} | java | protected PExp makeOr(PExp root, PExp e)
{
if (root != null)
{
AOrBooleanBinaryExp o = new AOrBooleanBinaryExp();
o.setLeft(root.clone());
o.setOp(new LexKeywordToken(VDMToken.OR, null));
o.setType(new ABooleanBasicType());
o.setRight(e.clone());
return o;
} else
{
return e;
}
} | [
"protected",
"PExp",
"makeOr",
"(",
"PExp",
"root",
",",
"PExp",
"e",
")",
"{",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"AOrBooleanBinaryExp",
"o",
"=",
"new",
"AOrBooleanBinaryExp",
"(",
")",
";",
"o",
".",
"setLeft",
"(",
"root",
".",
"clone",
"... | Chain an OR expression onto a root, or just return the new expression if the root is null. Called in a loop, this
left-associates an OR tree. | [
"Chain",
"an",
"OR",
"expression",
"onto",
"a",
"root",
"or",
"just",
"return",
"the",
"new",
"expression",
"if",
"the",
"root",
"is",
"null",
".",
"Called",
"in",
"a",
"loop",
"this",
"left",
"-",
"associates",
"an",
"OR",
"tree",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java#L450-L464 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.usingFloatToleranceForFieldDescriptorsForValues | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(
float tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.usingFloatToleranceForFieldDescriptors(tolerance, fieldDescriptors));
} | java | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(
float tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.usingFloatToleranceForFieldDescriptors(tolerance, fieldDescriptors));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"usingFloatToleranceForFieldDescriptorsForValues",
"(",
"float",
"tolerance",
",",
"Iterable",
"<",
"FieldDescriptor",
">",
"fieldDescriptors",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"usingFloat... | Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance. | [
"Compares",
"float",
"fields",
"with",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"using",
"the",
"provided",
"absolute",
"tolerance",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L609-L612 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTierPriceEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
... | Returns a range of all the commerce tier price entries where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTierPriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of commerce tier price entries
@param end the upper bound of the range of commerce tier price entries (not inclusive)
@return the range of matching commerce tier price entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"tier",
"price",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L1544-L1548 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Crypts.java | Crypts.decryptByAES | public static String decryptByAES(final String content, final String key) {
try {
final byte[] data = Hex.decodeHex(content.toCharArray());
final KeyGenerator kgen = KeyGenerator.getInstance("AES");
final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(key.getBytes());
kgen.init(128, secureRandom);
final SecretKey secretKey = kgen.generateKey();
final byte[] enCodeFormat = secretKey.getEncoded();
final SecretKeySpec keySpec = new SecretKeySpec(enCodeFormat, "AES");
final Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, keySpec);
final byte[] result = cipher.doFinal(data);
return new String(result, "UTF-8");
} catch (final Exception e) {
LOGGER.log(Level.WARN, "Decrypt failed");
return null;
}
} | java | public static String decryptByAES(final String content, final String key) {
try {
final byte[] data = Hex.decodeHex(content.toCharArray());
final KeyGenerator kgen = KeyGenerator.getInstance("AES");
final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(key.getBytes());
kgen.init(128, secureRandom);
final SecretKey secretKey = kgen.generateKey();
final byte[] enCodeFormat = secretKey.getEncoded();
final SecretKeySpec keySpec = new SecretKeySpec(enCodeFormat, "AES");
final Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, keySpec);
final byte[] result = cipher.doFinal(data);
return new String(result, "UTF-8");
} catch (final Exception e) {
LOGGER.log(Level.WARN, "Decrypt failed");
return null;
}
} | [
"public",
"static",
"String",
"decryptByAES",
"(",
"final",
"String",
"content",
",",
"final",
"String",
"key",
")",
"{",
"try",
"{",
"final",
"byte",
"[",
"]",
"data",
"=",
"Hex",
".",
"decodeHex",
"(",
"content",
".",
"toCharArray",
"(",
")",
")",
";... | Decrypts by AES.
@param content the specified content to decrypt
@param key the specified key
@return original content
@see #encryptByAES(java.lang.String, java.lang.String) | [
"Decrypts",
"by",
"AES",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Crypts.java#L101-L121 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELProcessor.java | ELProcessor.setVariable | public void setVariable(String var, String expression) {
ValueExpression exp = factory.createValueExpression(
elManager.getELContext(),
bracket(expression), Object.class);
elManager.setVariable(var, exp);
} | java | public void setVariable(String var, String expression) {
ValueExpression exp = factory.createValueExpression(
elManager.getELContext(),
bracket(expression), Object.class);
elManager.setVariable(var, exp);
} | [
"public",
"void",
"setVariable",
"(",
"String",
"var",
",",
"String",
"expression",
")",
"{",
"ValueExpression",
"exp",
"=",
"factory",
".",
"createValueExpression",
"(",
"elManager",
".",
"getELContext",
"(",
")",
",",
"bracket",
"(",
"expression",
")",
",",
... | Assign an EL expression to an EL variable. The expression is parsed,
but not evaluated, and the parsed expression is mapped to the EL
variable in the local variable map.
Any previously assigned expression to the same variable will be replaced.
If the expression is <code>null</code>, the variable will be removed.
@param var The name of the variable.
@param expression The EL expression to be assigned to the variable. | [
"Assign",
"an",
"EL",
"expression",
"to",
"an",
"EL",
"variable",
".",
"The",
"expression",
"is",
"parsed",
"but",
"not",
"evaluated",
"and",
"the",
"parsed",
"expression",
"is",
"mapped",
"to",
"the",
"EL",
"variable",
"in",
"the",
"local",
"variable",
"m... | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELProcessor.java#L166-L171 |
pushbit/sprockets | src/main/java/net/sf/sprockets/lang/Classes.java | Classes.getTypeArgument | @Nullable
public static Type getTypeArgument(Class<?> cls, String typeParameter) {
while (cls != Object.class) { // walk up the Class hierarchy, searching for the type param
Class<?> parent = cls.getSuperclass();
Type parentType = cls.getGenericSuperclass();
if (parentType instanceof ParameterizedType) {
Type[] args = ((ParameterizedType) parentType).getActualTypeArguments();
TypeVariable<?>[] params = parent.getTypeParameters();
for (int i = 0, length = params.length; i < length; i++) {
if (params[i].getName().equals(typeParameter)) {
return args[i];
}
}
}
cls = parent;
}
return null;
} | java | @Nullable
public static Type getTypeArgument(Class<?> cls, String typeParameter) {
while (cls != Object.class) { // walk up the Class hierarchy, searching for the type param
Class<?> parent = cls.getSuperclass();
Type parentType = cls.getGenericSuperclass();
if (parentType instanceof ParameterizedType) {
Type[] args = ((ParameterizedType) parentType).getActualTypeArguments();
TypeVariable<?>[] params = parent.getTypeParameters();
for (int i = 0, length = params.length; i < length; i++) {
if (params[i].getName().equals(typeParameter)) {
return args[i];
}
}
}
cls = parent;
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"Type",
"getTypeArgument",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"typeParameter",
")",
"{",
"while",
"(",
"cls",
"!=",
"Object",
".",
"class",
")",
"{",
"// walk up the Class hierarchy, searching for the type param... | <p>
Get the Type that has been specified by the class or an ancestor for the generic type
parameter. For example:
</p>
<pre>{@code
class StringList extends ArrayList<String>
Classes.getTypeArgument(StringList.class, "E")
// returns: class java.lang.String
}</pre>
@return null if the type parameter was not found | [
"<p",
">",
"Get",
"the",
"Type",
"that",
"has",
"been",
"specified",
"by",
"the",
"class",
"or",
"an",
"ancestor",
"for",
"the",
"generic",
"type",
"parameter",
".",
"For",
"example",
":",
"<",
"/",
"p",
">",
"<pre",
">",
"{",
"@code",
"class",
"Stri... | train | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/lang/Classes.java#L73-L90 |
aoindustries/ao-encoding | src/main/java/com/aoindustries/encoding/ChainWriter.java | ChainWriter.encodeHtml | @Deprecated
public ChainWriter encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException {
com.aoindustries.util.EncodingUtils.encodeHtml(value, make_br, make_nbsp, out);
return this;
} | java | @Deprecated
public ChainWriter encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException {
com.aoindustries.util.EncodingUtils.encodeHtml(value, make_br, make_nbsp, out);
return this;
} | [
"@",
"Deprecated",
"public",
"ChainWriter",
"encodeHtml",
"(",
"Object",
"value",
",",
"boolean",
"make_br",
",",
"boolean",
"make_nbsp",
")",
"throws",
"IOException",
"{",
"com",
".",
"aoindustries",
".",
"util",
".",
"EncodingUtils",
".",
"encodeHtml",
"(",
... | Escapes HTML for displaying in browsers and writes to the internal <code>PrintWriter</code>.
@param S the string to be escaped.
@param make_br will write <BR> tags for every newline character
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property.
@see #encodeXhtml(java.lang.Object) | [
"Escapes",
"HTML",
"for",
"displaying",
"in",
"browsers",
"and",
"writes",
"to",
"the",
"internal",
"<code",
">",
"PrintWriter<",
"/",
"code",
">",
"."
] | train | https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/ChainWriter.java#L524-L528 |
janus-project/guava.janusproject.io | guava-gwt/src-super/com/google/common/base/super/com/google/common/base/CharMatcher.java | CharMatcher.is | public static CharMatcher is(final char match) {
return new FastMatcher() {
@Override public boolean matches(char c) {
return c == match;
}
@Override public String replaceFrom(CharSequence sequence, char replacement) {
return sequence.toString().replace(match, replacement);
}
@Override public CharMatcher and(CharMatcher other) {
return other.matches(match) ? this : NONE;
}
@Override public CharMatcher or(CharMatcher other) {
return other.matches(match) ? other : super.or(other);
}
@Override public CharMatcher negate() {
return isNot(match);
}
@Override public String toString() {
return "CharMatcher.is('" + showCharacter(match) + "')";
}
};
} | java | public static CharMatcher is(final char match) {
return new FastMatcher() {
@Override public boolean matches(char c) {
return c == match;
}
@Override public String replaceFrom(CharSequence sequence, char replacement) {
return sequence.toString().replace(match, replacement);
}
@Override public CharMatcher and(CharMatcher other) {
return other.matches(match) ? this : NONE;
}
@Override public CharMatcher or(CharMatcher other) {
return other.matches(match) ? other : super.or(other);
}
@Override public CharMatcher negate() {
return isNot(match);
}
@Override public String toString() {
return "CharMatcher.is('" + showCharacter(match) + "')";
}
};
} | [
"public",
"static",
"CharMatcher",
"is",
"(",
"final",
"char",
"match",
")",
"{",
"return",
"new",
"FastMatcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"char",
"c",
")",
"{",
"return",
"c",
"==",
"match",
";",
"}",
"@",
... | Returns a {@code char} matcher that matches only one specified character. | [
"Returns",
"a",
"{"
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/CharMatcher.java#L438-L464 |
diffplug/durian | src/com/diffplug/common/base/TreeQuery.java | TreeQuery.findByPath | public static <T, P> Optional<T> findByPath(TreeDef<T> treeDef, T node, Function<? super T, ?> treeMapper, List<P> path, Function<? super P, ?> pathMapper) {
return findByPath(treeDef, node, path, (treeSide, pathSide) -> {
return Objects.equals(treeMapper.apply(treeSide), pathMapper.apply(pathSide));
});
} | java | public static <T, P> Optional<T> findByPath(TreeDef<T> treeDef, T node, Function<? super T, ?> treeMapper, List<P> path, Function<? super P, ?> pathMapper) {
return findByPath(treeDef, node, path, (treeSide, pathSide) -> {
return Objects.equals(treeMapper.apply(treeSide), pathMapper.apply(pathSide));
});
} | [
"public",
"static",
"<",
"T",
",",
"P",
">",
"Optional",
"<",
"T",
">",
"findByPath",
"(",
"TreeDef",
"<",
"T",
">",
"treeDef",
",",
"T",
"node",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
">",
"treeMapper",
",",
"List",
"<",
"P",
">",
... | Finds a child TreeNode based on its path.
<p>
Searches the child nodes for the first element, then that
node's children for the second element, etc.
@param treeDef defines a tree
@param node starting point for the search
@param treeMapper maps elements in the tree to some value for comparison with the path elements
@param path the path of nodes which we're looking
@param pathMapper maps elements in the path to some value for comparison with the tree elements | [
"Finds",
"a",
"child",
"TreeNode",
"based",
"on",
"its",
"path",
".",
"<p",
">",
"Searches",
"the",
"child",
"nodes",
"for",
"the",
"first",
"element",
"then",
"that",
"node",
"s",
"children",
"for",
"the",
"second",
"element",
"etc",
"."
] | train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L287-L291 |
hal/core | gui/src/main/java/org/jboss/as/console/client/shared/subsys/jca/XADataSourcePresenter.java | XADataSourcePresenter.onSaveDatasource | public void onSaveDatasource(AddressTemplate template, final String dsName, final Map changeset) {
dataSourceStore.saveDatasource(template, dsName, changeset,
new SimpleCallback<ResponseWrapper<Boolean>>() {
@Override
public void onSuccess(ResponseWrapper<Boolean> response) {
if (response.getUnderlying()) {
Console.info(Console.MESSAGES.saved("Datasource " + dsName));
} else {
Console.error(Console.MESSAGES.saveFailed("Datasource ") + dsName,
response.getResponse().toString());
}
loadXADataSource();
}
});
} | java | public void onSaveDatasource(AddressTemplate template, final String dsName, final Map changeset) {
dataSourceStore.saveDatasource(template, dsName, changeset,
new SimpleCallback<ResponseWrapper<Boolean>>() {
@Override
public void onSuccess(ResponseWrapper<Boolean> response) {
if (response.getUnderlying()) {
Console.info(Console.MESSAGES.saved("Datasource " + dsName));
} else {
Console.error(Console.MESSAGES.saveFailed("Datasource ") + dsName,
response.getResponse().toString());
}
loadXADataSource();
}
});
} | [
"public",
"void",
"onSaveDatasource",
"(",
"AddressTemplate",
"template",
",",
"final",
"String",
"dsName",
",",
"final",
"Map",
"changeset",
")",
"{",
"dataSourceStore",
".",
"saveDatasource",
"(",
"template",
",",
"dsName",
",",
"changeset",
",",
"new",
"Simpl... | Saves the changes into data-source or xa-data-source using ModelNodeAdapter instead of autobean DataSource
@param template The AddressTemplate to use
@param dsName the datasource name
@param changeset | [
"Saves",
"the",
"changes",
"into",
"data",
"-",
"source",
"or",
"xa",
"-",
"data",
"-",
"source",
"using",
"ModelNodeAdapter",
"instead",
"of",
"autobean",
"DataSource"
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/subsys/jca/XADataSourcePresenter.java#L506-L521 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java | ListApi.getNullableOptional | public static <T> Optional<T> getNullableOptional(final List list, final Class<T> clazz, final Integer... path) {
return getNullable(list, Optional.class, path);
} | java | public static <T> Optional<T> getNullableOptional(final List list, final Class<T> clazz, final Integer... path) {
return getNullable(list, Optional.class, path);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getNullableOptional",
"(",
"final",
"List",
"list",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Integer",
"...",
"path",
")",
"{",
"return",
"getNullable",
"(",
"list",
",... | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param list subject
@param path nodes to walk in map
@return value | [
"Get",
"optional",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L256-L258 |
BlueBrain/bluima | modules/bluima_banner/src/main/java/banner/Sentence.java | Sentence.addOrMergeMention | public void addOrMergeMention(Mention mention)
{
if (!mention.getSentence().equals(this))
throw new IllegalArgumentException();
List<Mention> overlapping = new ArrayList<Mention>();
for (Mention mention2 : mentions)
{
if (mention.overlaps(mention2) && mention.getType().equals(mention2.getType()))
overlapping.add(mention2);
}
if (overlapping.size() == 0)
{
mentions.add(mention);
}
else
{
for (Mention mention2 : overlapping)
{
mentions.remove(mention2);
mentions.add(new Mention(this, mention.getType(), Math.min(mention.getStart(), mention2.getStart()), Math.max(mention.getEnd(),
mention2.getEnd())));
}
}
} | java | public void addOrMergeMention(Mention mention)
{
if (!mention.getSentence().equals(this))
throw new IllegalArgumentException();
List<Mention> overlapping = new ArrayList<Mention>();
for (Mention mention2 : mentions)
{
if (mention.overlaps(mention2) && mention.getType().equals(mention2.getType()))
overlapping.add(mention2);
}
if (overlapping.size() == 0)
{
mentions.add(mention);
}
else
{
for (Mention mention2 : overlapping)
{
mentions.remove(mention2);
mentions.add(new Mention(this, mention.getType(), Math.min(mention.getStart(), mention2.getStart()), Math.max(mention.getEnd(),
mention2.getEnd())));
}
}
} | [
"public",
"void",
"addOrMergeMention",
"(",
"Mention",
"mention",
")",
"{",
"if",
"(",
"!",
"mention",
".",
"getSentence",
"(",
")",
".",
"equals",
"(",
"this",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"List",
"<",
"Mention",
... | Adds a {@link Mention} to this Sentence or merges the {@link Mention} into an existing {@link Mention} which the new one would overlap.
Normally called by instance of {@link Tagger} or post-processors.
@param mention | [
"Adds",
"a",
"{",
"@link",
"Mention",
"}",
"to",
"this",
"Sentence",
"or",
"merges",
"the",
"{",
"@link",
"Mention",
"}",
"into",
"an",
"existing",
"{",
"@link",
"Mention",
"}",
"which",
"the",
"new",
"one",
"would",
"overlap",
".",
"Normally",
"called",... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_banner/src/main/java/banner/Sentence.java#L209-L232 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.setItem | public void setItem(String itemName, String value, String suffix) {
itemName = lookupItemName(itemName, suffix, value != null);
items.put(itemName, value);
} | java | public void setItem(String itemName, String value, String suffix) {
itemName = lookupItemName(itemName, suffix, value != null);
items.put(itemName, value);
} | [
"public",
"void",
"setItem",
"(",
"String",
"itemName",
",",
"String",
"value",
",",
"String",
"suffix",
")",
"{",
"itemName",
"=",
"lookupItemName",
"(",
"itemName",
",",
"suffix",
",",
"value",
"!=",
"null",
")",
";",
"items",
".",
"put",
"(",
"itemNam... | Sets a context item value, qualified with the specified suffix.
@param itemName Item name
@param value Item value
@param suffix Item suffix | [
"Sets",
"a",
"context",
"item",
"value",
"qualified",
"with",
"the",
"specified",
"suffix",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L273-L276 |
apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/StringUtils.java | StringUtils.removeChar | public static String removeChar(String s, char c)
{
int pos = s.indexOf(c);
if (pos < 0) {
return s;
}
StringBuilder sb = new StringBuilder(s.length() - 1);
int prevPos = 0;
do {
sb.append(s, prevPos, pos);
prevPos = pos + 1;
pos = s.indexOf(c, pos + 1);
} while (pos > 0);
sb.append(s, prevPos, s.length());
return sb.toString();
} | java | public static String removeChar(String s, char c)
{
int pos = s.indexOf(c);
if (pos < 0) {
return s;
}
StringBuilder sb = new StringBuilder(s.length() - 1);
int prevPos = 0;
do {
sb.append(s, prevPos, pos);
prevPos = pos + 1;
pos = s.indexOf(c, pos + 1);
} while (pos > 0);
sb.append(s, prevPos, s.length());
return sb.toString();
} | [
"public",
"static",
"String",
"removeChar",
"(",
"String",
"s",
",",
"char",
"c",
")",
"{",
"int",
"pos",
"=",
"s",
".",
"indexOf",
"(",
"c",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"s",
";",
"}",
"StringBuilder",
"sb",
"=",
"... | Removes all occurrences of the given char from the given string. This method is an optimal version of
{@link String#replace(CharSequence, CharSequence) s.replace("c", "")}. | [
"Removes",
"all",
"occurrences",
"of",
"the",
"given",
"char",
"from",
"the",
"given",
"string",
".",
"This",
"method",
"is",
"an",
"optimal",
"version",
"of",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/StringUtils.java#L202-L217 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java | CmsListItemWidget.setTopRightIcon | public void setTopRightIcon(String iconClass, String title) {
if (m_topRightIcon == null) {
m_topRightIcon = new HTML();
m_contentPanel.add(m_topRightIcon);
}
m_topRightIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().topRightIcon() + " " + iconClass);
if (title != null) {
m_topRightIcon.setTitle(title);
}
} | java | public void setTopRightIcon(String iconClass, String title) {
if (m_topRightIcon == null) {
m_topRightIcon = new HTML();
m_contentPanel.add(m_topRightIcon);
}
m_topRightIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().topRightIcon() + " " + iconClass);
if (title != null) {
m_topRightIcon.setTitle(title);
}
} | [
"public",
"void",
"setTopRightIcon",
"(",
"String",
"iconClass",
",",
"String",
"title",
")",
"{",
"if",
"(",
"m_topRightIcon",
"==",
"null",
")",
"{",
"m_topRightIcon",
"=",
"new",
"HTML",
"(",
")",
";",
"m_contentPanel",
".",
"add",
"(",
"m_topRightIcon",
... | Sets the icon in the top right corner and its title.<p>
@param iconClass the CSS class for the icon
@param title the value for the title attribute of the icon | [
"Sets",
"the",
"icon",
"in",
"the",
"top",
"right",
"corner",
"and",
"its",
"title",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L936-L946 |
scireum/s3ninja | src/main/java/ninja/S3Dispatcher.java | S3Dispatcher.getObject | private void getObject(WebContext ctx, Bucket bucket, String id, boolean sendFile) throws IOException {
StoredObject object = bucket.getObject(id);
if (!object.exists()) {
signalObjectError(ctx, HttpResponseStatus.NOT_FOUND, "Object does not exist");
return;
}
Response response = ctx.respondWith();
Properties properties = object.getProperties();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
response.addHeader(entry.getKey().toString(), entry.getValue().toString());
}
for (Map.Entry<String, String> entry : getOverridenHeaders(ctx).entrySet()) {
response.setHeader(entry.getKey(), entry.getValue());
}
String etag = properties.getProperty(HTTP_HEADER_NAME_ETAG);
if (Strings.isEmpty(etag)) {
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
etag = BaseEncoding.base16().encode(hash.asBytes());
Map<String, String> data = new HashMap<>();
properties.forEach((key, value) -> data.put(key.toString(), String.valueOf(value)));
data.put(HTTP_HEADER_NAME_ETAG, etag);
object.storeProperties(data);
}
response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag));
response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG);
if (sendFile) {
response.file(object.getFile());
} else {
String contentType = MimeHelper.guessMimeType(object.getFile().getName());
response.addHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
response.addHeader(HttpHeaderNames.LAST_MODIFIED,
RFC822_INSTANT.format(Instant.ofEpochMilli(object.getFile().lastModified())));
response.addHeader(HttpHeaderNames.CONTENT_LENGTH, object.getFile().length());
response.status(HttpResponseStatus.OK);
}
signalObjectSuccess(ctx);
} | java | private void getObject(WebContext ctx, Bucket bucket, String id, boolean sendFile) throws IOException {
StoredObject object = bucket.getObject(id);
if (!object.exists()) {
signalObjectError(ctx, HttpResponseStatus.NOT_FOUND, "Object does not exist");
return;
}
Response response = ctx.respondWith();
Properties properties = object.getProperties();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
response.addHeader(entry.getKey().toString(), entry.getValue().toString());
}
for (Map.Entry<String, String> entry : getOverridenHeaders(ctx).entrySet()) {
response.setHeader(entry.getKey(), entry.getValue());
}
String etag = properties.getProperty(HTTP_HEADER_NAME_ETAG);
if (Strings.isEmpty(etag)) {
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
etag = BaseEncoding.base16().encode(hash.asBytes());
Map<String, String> data = new HashMap<>();
properties.forEach((key, value) -> data.put(key.toString(), String.valueOf(value)));
data.put(HTTP_HEADER_NAME_ETAG, etag);
object.storeProperties(data);
}
response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag));
response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG);
if (sendFile) {
response.file(object.getFile());
} else {
String contentType = MimeHelper.guessMimeType(object.getFile().getName());
response.addHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
response.addHeader(HttpHeaderNames.LAST_MODIFIED,
RFC822_INSTANT.format(Instant.ofEpochMilli(object.getFile().lastModified())));
response.addHeader(HttpHeaderNames.CONTENT_LENGTH, object.getFile().length());
response.status(HttpResponseStatus.OK);
}
signalObjectSuccess(ctx);
} | [
"private",
"void",
"getObject",
"(",
"WebContext",
"ctx",
",",
"Bucket",
"bucket",
",",
"String",
"id",
",",
"boolean",
"sendFile",
")",
"throws",
"IOException",
"{",
"StoredObject",
"object",
"=",
"bucket",
".",
"getObject",
"(",
"id",
")",
";",
"if",
"("... | Handles GET /bucket/id
@param ctx the context describing the current request
@param bucket the bucket containing the object to download
@param id name of the object to use as download | [
"Handles",
"GET",
"/",
"bucket",
"/",
"id"
] | train | https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L587-L625 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java | BaseBo.removeAttribute | protected BaseBo removeAttribute(String attrName, boolean triggerChange) {
Lock lock = lockForWrite();
try {
attributes.remove(attrName);
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | java | protected BaseBo removeAttribute(String attrName, boolean triggerChange) {
Lock lock = lockForWrite();
try {
attributes.remove(attrName);
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | [
"protected",
"BaseBo",
"removeAttribute",
"(",
"String",
"attrName",
",",
"boolean",
"triggerChange",
")",
"{",
"Lock",
"lock",
"=",
"lockForWrite",
"(",
")",
";",
"try",
"{",
"attributes",
".",
"remove",
"(",
"attrName",
")",
";",
"if",
"(",
"triggerChange"... | Remove a BO's attribute.
@param attrName
@param triggerChange
if set to {@code true} {@link #triggerChange(String)} will be
called
@return
@since 0.7.1 | [
"Remove",
"a",
"BO",
"s",
"attribute",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java#L360-L372 |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java | SessionBuilder.withLocalDatacenter | public SelfT withLocalDatacenter(@NonNull String profileName, @NonNull String localDatacenter) {
this.localDatacenters.put(profileName, localDatacenter);
return self;
} | java | public SelfT withLocalDatacenter(@NonNull String profileName, @NonNull String localDatacenter) {
this.localDatacenters.put(profileName, localDatacenter);
return self;
} | [
"public",
"SelfT",
"withLocalDatacenter",
"(",
"@",
"NonNull",
"String",
"profileName",
",",
"@",
"NonNull",
"String",
"localDatacenter",
")",
"{",
"this",
".",
"localDatacenters",
".",
"put",
"(",
"profileName",
",",
"localDatacenter",
")",
";",
"return",
"self... | Specifies the datacenter that is considered "local" by the load balancing policy.
<p>This is a programmatic alternative to the configuration option {@code
basic.load-balancing-policy.local-datacenter}. If this method is used, it takes precedence and
overrides the configuration.
<p>Note that this setting may or may not be relevant depending on the load balancing policy
implementation in use. The driver's built-in {@code DefaultLoadBalancingPolicy} relies on it;
if you use a third-party implementation, refer to their documentation. | [
"Specifies",
"the",
"datacenter",
"that",
"is",
"considered",
"local",
"by",
"the",
"load",
"balancing",
"policy",
"."
] | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java#L237-L240 |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/Logger.java | Logger.printlnInternal | private void printlnInternal(int logLevel, String msg) {
String tag = logConfiguration.tag;
String thread = logConfiguration.withThread
? logConfiguration.threadFormatter.format(Thread.currentThread())
: null;
String stackTrace = logConfiguration.withStackTrace
? logConfiguration.stackTraceFormatter.format(
StackTraceUtil.getCroppedRealStackTrack(new Throwable().getStackTrace(),
logConfiguration.stackTraceOrigin,
logConfiguration.stackTraceDepth))
: null;
if (logConfiguration.interceptors != null) {
LogItem log = new LogItem(logLevel, tag, thread, stackTrace, msg);
for (Interceptor interceptor : logConfiguration.interceptors) {
log = interceptor.intercept(log);
if (log == null) {
// Log is eaten, don't print this log.
return;
}
// Check if the log still healthy.
if (log.tag == null || log.msg == null) {
throw new IllegalStateException("Interceptor " + interceptor
+ " should not remove the tag or message of a log,"
+ " if you don't want to print this log,"
+ " just return a null when intercept.");
}
}
// Use fields after interception.
logLevel = log.level;
tag = log.tag;
thread = log.threadInfo;
stackTrace = log.stackTraceInfo;
msg = log.msg;
}
printer.println(logLevel, tag, logConfiguration.withBorder
? logConfiguration.borderFormatter.format(new String[]{thread, stackTrace, msg})
: ((thread != null ? (thread + SystemCompat.lineSeparator) : "")
+ (stackTrace != null ? (stackTrace + SystemCompat.lineSeparator) : "")
+ msg));
} | java | private void printlnInternal(int logLevel, String msg) {
String tag = logConfiguration.tag;
String thread = logConfiguration.withThread
? logConfiguration.threadFormatter.format(Thread.currentThread())
: null;
String stackTrace = logConfiguration.withStackTrace
? logConfiguration.stackTraceFormatter.format(
StackTraceUtil.getCroppedRealStackTrack(new Throwable().getStackTrace(),
logConfiguration.stackTraceOrigin,
logConfiguration.stackTraceDepth))
: null;
if (logConfiguration.interceptors != null) {
LogItem log = new LogItem(logLevel, tag, thread, stackTrace, msg);
for (Interceptor interceptor : logConfiguration.interceptors) {
log = interceptor.intercept(log);
if (log == null) {
// Log is eaten, don't print this log.
return;
}
// Check if the log still healthy.
if (log.tag == null || log.msg == null) {
throw new IllegalStateException("Interceptor " + interceptor
+ " should not remove the tag or message of a log,"
+ " if you don't want to print this log,"
+ " just return a null when intercept.");
}
}
// Use fields after interception.
logLevel = log.level;
tag = log.tag;
thread = log.threadInfo;
stackTrace = log.stackTraceInfo;
msg = log.msg;
}
printer.println(logLevel, tag, logConfiguration.withBorder
? logConfiguration.borderFormatter.format(new String[]{thread, stackTrace, msg})
: ((thread != null ? (thread + SystemCompat.lineSeparator) : "")
+ (stackTrace != null ? (stackTrace + SystemCompat.lineSeparator) : "")
+ msg));
} | [
"private",
"void",
"printlnInternal",
"(",
"int",
"logLevel",
",",
"String",
"msg",
")",
"{",
"String",
"tag",
"=",
"logConfiguration",
".",
"tag",
";",
"String",
"thread",
"=",
"logConfiguration",
".",
"withThread",
"?",
"logConfiguration",
".",
"threadFormatte... | Print a log in a new line internally.
@param logLevel the log level of the printing log
@param msg the message you would like to log | [
"Print",
"a",
"log",
"in",
"a",
"new",
"line",
"internally",
"."
] | train | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/Logger.java#L557-L600 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.notEmpty | public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) {
return INSTANCE.notEmpty(collection, message, values);
} | java | public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) {
return INSTANCE.notEmpty(collection, message, values);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"notEmpty",
"(",
"final",
"T",
"collection",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"return",
"INSTANCE",
".",
"notEmpty",
"(",... | <p>Validate that the specified argument collection is neither {@code null} nor a size of zero (no elements); otherwise throwing an exception with the specified message.
<pre>Validate.notEmpty(myCollection, "The collection must not be empty");</pre>
@param <T>
the collection type
@param collection
the collection to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated collection (never {@code null} method for chaining)
@throws NullPointerValidationException
if the collection is {@code null}
@throws IllegalArgumentException
if the collection is empty
@see #notEmpty(Object[]) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"collection",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"a",
"size",
"of",
"zero",
"(",
"no",
"elements",
")",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specifie... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L866-L868 |
fabric8io/fabric8-forge | addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java | CamelCatalogHelper.getModelJavaType | public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String javaType = propertyMap.get("javaType");
if (javaType != null) {
return javaType;
}
}
}
return null;
} | java | public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String javaType = propertyMap.get("javaType");
if (javaType != null) {
return javaType;
}
}
}
return null;
} | [
"public",
"static",
"String",
"getModelJavaType",
"(",
"CamelCatalog",
"camelCatalog",
",",
"String",
"modelName",
")",
"{",
"// use the camel catalog",
"String",
"json",
"=",
"camelCatalog",
".",
"modelJSonSchema",
"(",
"modelName",
")",
";",
"if",
"(",
"json",
"... | Gets the java type of the given model
@param modelName the model name
@return the java type | [
"Gets",
"the",
"java",
"type",
"of",
"the",
"given",
"model"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L404-L421 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java | RequiresReflectionDeterminer.isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility )
{
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.INTERNAL ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.PRIVATE)
&& getTopLevelNamespace( callingClass ).equals( getTopLevelNamespace( declaringClass ) )
&& (isInSeparateClassLoader( callingClass, declaringClass ) ||
classesLoadInSeparateLoader( callingClass, declaringClass ));
} | java | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility )
{
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.INTERNAL ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.PRIVATE)
&& getTopLevelNamespace( callingClass ).equals( getTopLevelNamespace( declaringClass ) )
&& (isInSeparateClassLoader( callingClass, declaringClass ) ||
classesLoadInSeparateLoader( callingClass, declaringClass ));
} | [
"private",
"static",
"boolean",
"isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader",
"(",
"ICompilableTypeInternal",
"callingClass",
",",
"IType",
"declaringClass",
",",
"IRelativeTypeInfo",
".",
"Accessibility",
"accessibility",
")",
"{",
"return",
"(",
... | Java will blow up if the package-level access is relied upon across class loaders, though, so we make the call reflectively. | [
"Java",
"will",
"blow",
"up",
"if",
"the",
"package",
"-",
"level",
"access",
"is",
"relied",
"upon",
"across",
"class",
"loaders",
"though",
"so",
"we",
"make",
"the",
"call",
"reflectively",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java#L173-L182 |
jenkinsci/jenkins | core/src/main/java/hudson/model/ParameterValue.java | ParameterValue.buildEnvironment | public void buildEnvironment(Run<?,?> build, EnvVars env) {
if (build instanceof AbstractBuild) {
buildEnvVars((AbstractBuild) build, env);
}
// else do not know how to do it
} | java | public void buildEnvironment(Run<?,?> build, EnvVars env) {
if (build instanceof AbstractBuild) {
buildEnvVars((AbstractBuild) build, env);
}
// else do not know how to do it
} | [
"public",
"void",
"buildEnvironment",
"(",
"Run",
"<",
"?",
",",
"?",
">",
"build",
",",
"EnvVars",
"env",
")",
"{",
"if",
"(",
"build",
"instanceof",
"AbstractBuild",
")",
"{",
"buildEnvVars",
"(",
"(",
"AbstractBuild",
")",
"build",
",",
"env",
")",
... | Adds environmental variables for the builds to the given map.
<p>
This provides a means for a parameter to pass the parameter
values to the build to be performed.
<p>
When this method is invoked, the map already contains the
current "planned export" list. The implementation is
expected to add more values to this map (or do nothing)
@param env
never null.
@param build
The build for which this parameter is being used. Never null.
@since 1.556 | [
"Adds",
"environmental",
"variables",
"for",
"the",
"builds",
"to",
"the",
"given",
"map",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParameterValue.java#L193-L198 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java | LayerDrawable.setDrawable | public void setDrawable(int index, Drawable drawable) {
if (index >= mLayerState.mNum) {
throw new IndexOutOfBoundsException();
}
final ChildDrawable[] layers = mLayerState.mChildren;
final ChildDrawable childDrawable = layers[index];
if (childDrawable.mDrawable != null) {
if (drawable != null) {
final Rect bounds = childDrawable.mDrawable.getBounds();
drawable.setBounds(bounds);
}
childDrawable.mDrawable.setCallback(null);
}
if (drawable != null) {
drawable.setCallback(this);
}
childDrawable.mDrawable = drawable;
mLayerState.invalidateCache();
refreshChildPadding(index, childDrawable);
} | java | public void setDrawable(int index, Drawable drawable) {
if (index >= mLayerState.mNum) {
throw new IndexOutOfBoundsException();
}
final ChildDrawable[] layers = mLayerState.mChildren;
final ChildDrawable childDrawable = layers[index];
if (childDrawable.mDrawable != null) {
if (drawable != null) {
final Rect bounds = childDrawable.mDrawable.getBounds();
drawable.setBounds(bounds);
}
childDrawable.mDrawable.setCallback(null);
}
if (drawable != null) {
drawable.setCallback(this);
}
childDrawable.mDrawable = drawable;
mLayerState.invalidateCache();
refreshChildPadding(index, childDrawable);
} | [
"public",
"void",
"setDrawable",
"(",
"int",
"index",
",",
"Drawable",
"drawable",
")",
"{",
"if",
"(",
"index",
">=",
"mLayerState",
".",
"mNum",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"final",
"ChildDrawable",
"[",
"]"... | Sets the drawable for the layer at the specified index.
@param index The index of the layer to modify, must be in the range {@code
0...getNumberOfLayers()-1}.
@param drawable The drawable to set for the layer.
@attr ref android.R.styleable#LayerDrawableItem_drawable
@see #getDrawable(int) | [
"Sets",
"the",
"drawable",
"for",
"the",
"layer",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L523-L547 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageDNDController.java | CmsContainerpageDNDController.prepareDragInfo | private void prepareDragInfo(Element placeholder, I_CmsDropContainer target, CmsDNDHandler handler) {
target.getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
String positioning = CmsDomUtil.getCurrentStyle(
target.getElement(),
org.opencms.gwt.client.util.CmsDomUtil.Style.position);
// set target relative, if not absolute or fixed
if (!Position.ABSOLUTE.getCssName().equals(positioning) && !Position.FIXED.getCssName().equals(positioning)) {
target.getElement().getStyle().setPosition(Position.RELATIVE);
// check for empty containers that don't have a minimum top and bottom margin to avoid containers overlapping
if (target.getElement().getFirstChildElement() == null) {
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginTop) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginTop(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginBottom) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginBottom(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
}
}
m_dragInfos.put(target, placeholder);
handler.addTarget(target);
} | java | private void prepareDragInfo(Element placeholder, I_CmsDropContainer target, CmsDNDHandler handler) {
target.getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
String positioning = CmsDomUtil.getCurrentStyle(
target.getElement(),
org.opencms.gwt.client.util.CmsDomUtil.Style.position);
// set target relative, if not absolute or fixed
if (!Position.ABSOLUTE.getCssName().equals(positioning) && !Position.FIXED.getCssName().equals(positioning)) {
target.getElement().getStyle().setPosition(Position.RELATIVE);
// check for empty containers that don't have a minimum top and bottom margin to avoid containers overlapping
if (target.getElement().getFirstChildElement() == null) {
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginTop) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginTop(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginBottom) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginBottom(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
}
}
m_dragInfos.put(target, placeholder);
handler.addTarget(target);
} | [
"private",
"void",
"prepareDragInfo",
"(",
"Element",
"placeholder",
",",
"I_CmsDropContainer",
"target",
",",
"CmsDNDHandler",
"handler",
")",
"{",
"target",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"dragdr... | Sets styles of helper elements, appends the to the drop target and puts them into a drag info bean.<p>
@param placeholder the placeholder element
@param target the drop target
@param handler the drag and drop handler | [
"Sets",
"styles",
"of",
"helper",
"elements",
"appends",
"the",
"to",
"the",
"drop",
"target",
"and",
"puts",
"them",
"into",
"a",
"drag",
"info",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageDNDController.java#L851-L876 |
deeplearning4j/deeplearning4j | datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java | LocalTransformExecutor.executeSequenceToSeparate | public static List<List<Writable>> executeSequenceToSeparate(List<List<List<Writable>>> inputSequence,
TransformProcess transformProcess) {
if (transformProcess.getFinalSchema() instanceof SequenceSchema) {
throw new IllegalStateException("Cannot return sequence data with this method");
}
return execute(null, inputSequence, transformProcess).getFirst();
} | java | public static List<List<Writable>> executeSequenceToSeparate(List<List<List<Writable>>> inputSequence,
TransformProcess transformProcess) {
if (transformProcess.getFinalSchema() instanceof SequenceSchema) {
throw new IllegalStateException("Cannot return sequence data with this method");
}
return execute(null, inputSequence, transformProcess).getFirst();
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"executeSequenceToSeparate",
"(",
"List",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"inputSequence",
",",
"TransformProcess",
"transformProcess",
")",
"{",
"if",
"(",
"transf... | Execute the specified TransformProcess with the given <i>sequence</i> input data<br>
Note: this method can only be used if the TransformProcess starts with sequence data, but returns <i>non-sequential</i>
data (after reducing or converting sequential data to individual examples)
@param inputSequence Input sequence data to process
@param transformProcess TransformProcess to execute
@return Processed (non-sequential) data | [
"Execute",
"the",
"specified",
"TransformProcess",
"with",
"the",
"given",
"<i",
">",
"sequence<",
"/",
"i",
">",
"input",
"data<br",
">",
"Note",
":",
"this",
"method",
"can",
"only",
"be",
"used",
"if",
"the",
"TransformProcess",
"starts",
"with",
"sequenc... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java#L125-L132 |
upwork/java-upwork | src/com/Upwork/api/Routers/Reports/Time.java | Time._getByType | private JSONObject _getByType(String company, String team, String agency, HashMap<String, String> params, Boolean hideFinDetails) throws JSONException {
String url = "";
if (team != null) {
url = "/teams/" + team;
if (hideFinDetails) {
url = url + "/hours";
}
} else if (agency != null) {
url = "/agencies/" + agency;
}
return oClient.get("/timereports/v1/companies/" + company + url, params);
} | java | private JSONObject _getByType(String company, String team, String agency, HashMap<String, String> params, Boolean hideFinDetails) throws JSONException {
String url = "";
if (team != null) {
url = "/teams/" + team;
if (hideFinDetails) {
url = url + "/hours";
}
} else if (agency != null) {
url = "/agencies/" + agency;
}
return oClient.get("/timereports/v1/companies/" + company + url, params);
} | [
"private",
"JSONObject",
"_getByType",
"(",
"String",
"company",
",",
"String",
"team",
",",
"String",
"agency",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
",",
"Boolean",
"hideFinDetails",
")",
"throws",
"JSONException",
"{",
"String",
"url"... | Generate Time Reports for a Specific Team/Comapny/Agency
@param company Company ID
@param team (Optional) Team ID
@param agency (Optional) Agency ID
@param params (Optional) Parameters
@param hideFinDetails (Optional) Hides all financial details
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Generate",
"Time",
"Reports",
"for",
"a",
"Specific",
"Team",
"/",
"Comapny",
"/",
"Agency"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Time.java#L57-L69 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java | ScriptContext.resetFixedData | @Cmd
public void resetFixedData(final String dataSetKey, final String entryKey) {
if (dataSetKey == null) {
log.info("Resetting all fixed values.");
dataSourceProvider.get().resetFixedValues();
return;
}
String resolvedDataSetKey = resolveProperty(dataSetKey);
if (entryKey == null) {
log.info("Resetting fixed values for data set '{}'", resolvedDataSetKey);
dataSourceProvider.get().resetFixedValues(resolvedDataSetKey);
return;
}
String resolvedEntryKey = resolveProperty(entryKey);
log.info("Resetting fixed value for data set '{}' and entry '{}'", resolvedDataSetKey, resolvedEntryKey);
dataSourceProvider.get().resetFixedValue(resolvedDataSetKey, resolvedEntryKey);
} | java | @Cmd
public void resetFixedData(final String dataSetKey, final String entryKey) {
if (dataSetKey == null) {
log.info("Resetting all fixed values.");
dataSourceProvider.get().resetFixedValues();
return;
}
String resolvedDataSetKey = resolveProperty(dataSetKey);
if (entryKey == null) {
log.info("Resetting fixed values for data set '{}'", resolvedDataSetKey);
dataSourceProvider.get().resetFixedValues(resolvedDataSetKey);
return;
}
String resolvedEntryKey = resolveProperty(entryKey);
log.info("Resetting fixed value for data set '{}' and entry '{}'", resolvedDataSetKey, resolvedEntryKey);
dataSourceProvider.get().resetFixedValue(resolvedDataSetKey, resolvedEntryKey);
} | [
"@",
"Cmd",
"public",
"void",
"resetFixedData",
"(",
"final",
"String",
"dataSetKey",
",",
"final",
"String",
"entryKey",
")",
"{",
"if",
"(",
"dataSetKey",
"==",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"Resetting all fixed values.\"",
")",
";",
"dataSo... | Resets fixed values in the data source for the {@link DataSet} with the specified key and the
entry with the specified key.
@param dataSetKey
if {@code null}, all fixed values are reset
@param entryKey
if {@code null}, all fixed values in the {@link DataSet} are reset | [
"Resets",
"fixed",
"values",
"in",
"the",
"data",
"source",
"for",
"the",
"{",
"@link",
"DataSet",
"}",
"with",
"the",
"specified",
"key",
"and",
"the",
"entry",
"with",
"the",
"specified",
"key",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L504-L522 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/SunCalc.java | SunCalc.getAzimuth | private static double getAzimuth(double H, double phi, double d) {
return Math.atan2(Math.sin(H),
Math.cos(H) * Math.sin(phi) - Math.tan(d) * Math.cos(phi))+Math.PI;
} | java | private static double getAzimuth(double H, double phi, double d) {
return Math.atan2(Math.sin(H),
Math.cos(H) * Math.sin(phi) - Math.tan(d) * Math.cos(phi))+Math.PI;
} | [
"private",
"static",
"double",
"getAzimuth",
"(",
"double",
"H",
",",
"double",
"phi",
",",
"double",
"d",
")",
"{",
"return",
"Math",
".",
"atan2",
"(",
"Math",
".",
"sin",
"(",
"H",
")",
",",
"Math",
".",
"cos",
"(",
"H",
")",
"*",
"Math",
".",... | Sun azimuth in radians (direction along the horizon, measured from north to east)
e.g. 0 is north
@param H
@param phi
@param d
@return | [
"Sun",
"azimuth",
"in",
"radians",
"(",
"direction",
"along",
"the",
"horizon",
"measured",
"from",
"north",
"to",
"east",
")",
"e",
".",
"g",
".",
"0",
"is",
"north"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/SunCalc.java#L123-L126 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.dateTruncMillis | public static Expression dateTruncMillis(String expression, DatePart part) {
return dateTruncMillis(x(expression), part);
} | java | public static Expression dateTruncMillis(String expression, DatePart part) {
return dateTruncMillis(x(expression), part);
} | [
"public",
"static",
"Expression",
"dateTruncMillis",
"(",
"String",
"expression",
",",
"DatePart",
"part",
")",
"{",
"return",
"dateTruncMillis",
"(",
"x",
"(",
"expression",
")",
",",
"part",
")",
";",
"}"
] | Returned expression results in UNIX timestamp that has been truncated so that the given date part
is the least significant. | [
"Returned",
"expression",
"results",
"in",
"UNIX",
"timestamp",
"that",
"has",
"been",
"truncated",
"so",
"that",
"the",
"given",
"date",
"part",
"is",
"the",
"least",
"significant",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L180-L182 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java | NetworkProfilesInner.getByResourceGroupAsync | public Observable<NetworkProfileInner> getByResourceGroupAsync(String resourceGroupName, String networkProfileName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName, expand).map(new Func1<ServiceResponse<NetworkProfileInner>, NetworkProfileInner>() {
@Override
public NetworkProfileInner call(ServiceResponse<NetworkProfileInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkProfileInner> getByResourceGroupAsync(String resourceGroupName, String networkProfileName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName, expand).map(new Func1<ServiceResponse<NetworkProfileInner>, NetworkProfileInner>() {
@Override
public NetworkProfileInner call(ServiceResponse<NetworkProfileInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkProfileInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkProfileName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Gets the specified network profile in a specified resource group.
@param resourceGroupName The name of the resource group.
@param networkProfileName The name of the PublicIPPrefx.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkProfileInner object | [
"Gets",
"the",
"specified",
"network",
"profile",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java#L286-L293 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java | TypeMaker.getTypes | public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
} | java | public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
} | [
"public",
"static",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"[",
"]",
"getTypes",
"(",
"DocEnv",
"env",
",",
"List",
"<",
"Type",
">",
"ts",
")",
"{",
"return",
"getTypes",
"(",
"env",
",",
"ts",
",",
"new",
"com",
".",
"sun",
".",
"javad... | Convert a list of javac types into an array of javadoc types. | [
"Convert",
"a",
"list",
"of",
"javac",
"types",
"into",
"an",
"array",
"of",
"javadoc",
"types",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java#L118-L120 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java | DateIntervalInfo.getIntervalPattern | public PatternInfo getIntervalPattern(String skeleton, int field)
{
if ( field > MINIMUM_SUPPORTED_CALENDAR_FIELD ) {
throw new IllegalArgumentException("no support for field less than SECOND");
}
Map<String, PatternInfo> patternsOfOneSkeleton = fIntervalPatterns.get(skeleton);
if ( patternsOfOneSkeleton != null ) {
PatternInfo intervalPattern = patternsOfOneSkeleton.
get(CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
if ( intervalPattern != null ) {
return intervalPattern;
}
}
return null;
} | java | public PatternInfo getIntervalPattern(String skeleton, int field)
{
if ( field > MINIMUM_SUPPORTED_CALENDAR_FIELD ) {
throw new IllegalArgumentException("no support for field less than SECOND");
}
Map<String, PatternInfo> patternsOfOneSkeleton = fIntervalPatterns.get(skeleton);
if ( patternsOfOneSkeleton != null ) {
PatternInfo intervalPattern = patternsOfOneSkeleton.
get(CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
if ( intervalPattern != null ) {
return intervalPattern;
}
}
return null;
} | [
"public",
"PatternInfo",
"getIntervalPattern",
"(",
"String",
"skeleton",
",",
"int",
"field",
")",
"{",
"if",
"(",
"field",
">",
"MINIMUM_SUPPORTED_CALENDAR_FIELD",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"no support for field less than SECOND\"",
... | Get the interval pattern given the largest different calendar field.
@param skeleton the skeleton
@param field the largest different calendar field
@return interval pattern return null if interval pattern is not found.
@throws IllegalArgumentException if getting interval pattern on
a calendar field that is smaller
than the MINIMUM_SUPPORTED_CALENDAR_FIELD | [
"Get",
"the",
"interval",
"pattern",
"given",
"the",
"largest",
"different",
"calendar",
"field",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java#L842-L856 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java | ParallelIterate.forEach | public static <T> void forEach(Iterable<T> iterable, Procedure<? super T> procedure, int batchSize)
{
ParallelIterate.forEach(iterable, procedure, batchSize, ParallelIterate.EXECUTOR_SERVICE);
} | java | public static <T> void forEach(Iterable<T> iterable, Procedure<? super T> procedure, int batchSize)
{
ParallelIterate.forEach(iterable, procedure, batchSize, ParallelIterate.EXECUTOR_SERVICE);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forEach",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Procedure",
"<",
"?",
"super",
"T",
">",
"procedure",
",",
"int",
"batchSize",
")",
"{",
"ParallelIterate",
".",
"forEach",
"(",
"iterable",
",",
"p... | Iterate over the collection specified in parallel batches using default runtime parameter values. The
{@code Procedure} used must be stateless, or use concurrent aware objects if they are to be shared.
<p>
e.g.
<pre>
{@code final Map<Object, Boolean> chm = new ConcurrentHashMap<Object, Boolean>();}
ParallelIterate.<b>forEachBatchSize</b>(collection, new Procedure()
{
public void value(Object object)
{
chm.put(object, Boolean.TRUE);
}
}, 100);
</pre> | [
"Iterate",
"over",
"the",
"collection",
"specified",
"in",
"parallel",
"batches",
"using",
"default",
"runtime",
"parameter",
"values",
".",
"The",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java#L303-L306 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newApplicationException | public static ApplicationException newApplicationException(String message, Object... args) {
return newApplicationException(null, message, args);
} | java | public static ApplicationException newApplicationException(String message, Object... args) {
return newApplicationException(null, message, args);
} | [
"public",
"static",
"ApplicationException",
"newApplicationException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newApplicationException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link ApplicationException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link ApplicationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ApplicationException} with the given {@link String message}.
@see #newApplicationException(Throwable, String, Object...)
@see org.cp.elements.util.ApplicationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ApplicationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L761-L763 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java | ClientFactory.getNamedLoadBalancer | public static synchronized ILoadBalancer getNamedLoadBalancer(String name) {
ILoadBalancer lb = namedLBMap.get(name);
if (lb != null) {
return lb;
} else {
try {
lb = registerNamedLoadBalancerFromclientConfig(name, getNamedConfig(name));
} catch (ClientException e) {
throw new RuntimeException("Unable to create load balancer", e);
}
namedLBMap.put(name, lb);
return lb;
}
} | java | public static synchronized ILoadBalancer getNamedLoadBalancer(String name) {
ILoadBalancer lb = namedLBMap.get(name);
if (lb != null) {
return lb;
} else {
try {
lb = registerNamedLoadBalancerFromclientConfig(name, getNamedConfig(name));
} catch (ClientException e) {
throw new RuntimeException("Unable to create load balancer", e);
}
namedLBMap.put(name, lb);
return lb;
}
} | [
"public",
"static",
"synchronized",
"ILoadBalancer",
"getNamedLoadBalancer",
"(",
"String",
"name",
")",
"{",
"ILoadBalancer",
"lb",
"=",
"namedLBMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"lb",
"!=",
"null",
")",
"{",
"return",
"lb",
";",
"}",
... | Get the load balancer associated with the name, or create one with the default {@link ClientConfigFactory} if does not exist
@throws RuntimeException if any error occurs | [
"Get",
"the",
"load",
"balancer",
"associated",
"with",
"the",
"name",
"or",
"create",
"one",
"with",
"the",
"default",
"{",
"@link",
"ClientConfigFactory",
"}",
"if",
"does",
"not",
"exist"
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L137-L150 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java | ListWidget.updateSelectedItemsList | public boolean updateSelectedItemsList(int dataIndex, boolean select) {
boolean done = false;
boolean contains = isSelected(dataIndex);
if (select) {
if (!contains) {
if (!mMultiSelectionSupported) {
clearSelection(false);
}
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList add index = %d", dataIndex);
mSelectedItemsList.add(dataIndex);
done = true;
}
} else {
if (contains) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList remove index = %d", dataIndex);
mSelectedItemsList.remove(dataIndex);
done = true;
}
}
return done;
} | java | public boolean updateSelectedItemsList(int dataIndex, boolean select) {
boolean done = false;
boolean contains = isSelected(dataIndex);
if (select) {
if (!contains) {
if (!mMultiSelectionSupported) {
clearSelection(false);
}
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList add index = %d", dataIndex);
mSelectedItemsList.add(dataIndex);
done = true;
}
} else {
if (contains) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList remove index = %d", dataIndex);
mSelectedItemsList.remove(dataIndex);
done = true;
}
}
return done;
} | [
"public",
"boolean",
"updateSelectedItemsList",
"(",
"int",
"dataIndex",
",",
"boolean",
"select",
")",
"{",
"boolean",
"done",
"=",
"false",
";",
"boolean",
"contains",
"=",
"isSelected",
"(",
"dataIndex",
")",
";",
"if",
"(",
"select",
")",
"{",
"if",
"(... | Update the selection state of the item
@param dataIndex data set index
@param select if it is true the item is marked as selected, otherwise - unselected
@return true if the selection state has been changed successfully, otherwise - false | [
"Update",
"the",
"selection",
"state",
"of",
"the",
"item"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L546-L566 |
Waikato/moa | moa/src/main/java/moa/evaluation/ALWindowClassificationPerformanceEvaluator.java | ALWindowClassificationPerformanceEvaluator.doLabelAcqReport | @Override
public void doLabelAcqReport(Example<Instance> trainInst, int labelAcquired) {
this.acquisitionRateEstimator.add(labelAcquired);
this.acquiredInstances += labelAcquired;
} | java | @Override
public void doLabelAcqReport(Example<Instance> trainInst, int labelAcquired) {
this.acquisitionRateEstimator.add(labelAcquired);
this.acquiredInstances += labelAcquired;
} | [
"@",
"Override",
"public",
"void",
"doLabelAcqReport",
"(",
"Example",
"<",
"Instance",
">",
"trainInst",
",",
"int",
"labelAcquired",
")",
"{",
"this",
".",
"acquisitionRateEstimator",
".",
"add",
"(",
"labelAcquired",
")",
";",
"this",
".",
"acquiredInstances"... | Receives the information if a label has been acquired and increases counters.
@param trainInst the instance that was previously considered
@param labelAcquired bool type which indicates if trainInst
was acquired by the active learner | [
"Receives",
"the",
"information",
"if",
"a",
"label",
"has",
"been",
"acquired",
"and",
"increases",
"counters",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/ALWindowClassificationPerformanceEvaluator.java#L52-L56 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java | GVRPeriodicEngine.runEvery | public PeriodicEvent runEvery(Runnable task, float delay, float period,
int repetitions) {
if (repetitions < 1) {
return null;
} else if (repetitions == 1) {
// Better to burn a handful of CPU cycles than to churn memory by
// creating a new callback
return runAfter(task, delay);
} else {
return runEvery(task, delay, period, new RunFor(repetitions));
}
} | java | public PeriodicEvent runEvery(Runnable task, float delay, float period,
int repetitions) {
if (repetitions < 1) {
return null;
} else if (repetitions == 1) {
// Better to burn a handful of CPU cycles than to churn memory by
// creating a new callback
return runAfter(task, delay);
} else {
return runEvery(task, delay, period, new RunFor(repetitions));
}
} | [
"public",
"PeriodicEvent",
"runEvery",
"(",
"Runnable",
"task",
",",
"float",
"delay",
",",
"float",
"period",
",",
"int",
"repetitions",
")",
"{",
"if",
"(",
"repetitions",
"<",
"1",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"repetitions"... | Run a task periodically, for a set number of times.
@param task
Task to run.
@param delay
The first execution will happen in {@code delay} seconds.
@param period
Subsequent executions will happen every {@code period} seconds
after the first.
@param repetitions
Repeat count
@return {@code null} if {@code repetitions < 1}; otherwise, an interface
that lets you query the status; cancel; or reschedule the event. | [
"Run",
"a",
"task",
"periodically",
"for",
"a",
"set",
"number",
"of",
"times",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L157-L168 |
twitter/hbc | hbc-core/src/main/java/com/twitter/hbc/common/DelimitedStreamReader.java | DelimitedStreamReader.copyToStrBuffer | private void copyToStrBuffer(byte[] buffer, int offset, int length) {
Preconditions.checkArgument(length >= 0);
if (strBuffer.length - strBufferIndex < length) {
// cannot fit, expanding buffer
expandStrBuffer(length);
}
System.arraycopy(
buffer, offset, strBuffer, strBufferIndex, Math.min(length, MAX_ALLOWABLE_BUFFER_SIZE - strBufferIndex));
strBufferIndex += length;
} | java | private void copyToStrBuffer(byte[] buffer, int offset, int length) {
Preconditions.checkArgument(length >= 0);
if (strBuffer.length - strBufferIndex < length) {
// cannot fit, expanding buffer
expandStrBuffer(length);
}
System.arraycopy(
buffer, offset, strBuffer, strBufferIndex, Math.min(length, MAX_ALLOWABLE_BUFFER_SIZE - strBufferIndex));
strBufferIndex += length;
} | [
"private",
"void",
"copyToStrBuffer",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"length",
">=",
"0",
")",
";",
"if",
"(",
"strBuffer",
".",
"length",
"-",
"strBuffer... | Copies from buffer to our internal strBufferIndex, expanding the internal buffer if necessary
@param offset offset in the buffer to start copying from
@param length length to copy | [
"Copies",
"from",
"buffer",
"to",
"our",
"internal",
"strBufferIndex",
"expanding",
"the",
"internal",
"buffer",
"if",
"necessary"
] | train | https://github.com/twitter/hbc/blob/72a8d0b44ba824a722cf4ee7ed9f9bc34d02d92c/hbc-core/src/main/java/com/twitter/hbc/common/DelimitedStreamReader.java#L124-L133 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java | LocalTime.plusHours | public LocalTime plusHours(long hoursToAdd) {
if (hoursToAdd == 0) {
return this;
}
int newHour = ((int) (hoursToAdd % HOURS_PER_DAY) + hour + HOURS_PER_DAY) % HOURS_PER_DAY;
return create(newHour, minute, second, nano);
} | java | public LocalTime plusHours(long hoursToAdd) {
if (hoursToAdd == 0) {
return this;
}
int newHour = ((int) (hoursToAdd % HOURS_PER_DAY) + hour + HOURS_PER_DAY) % HOURS_PER_DAY;
return create(newHour, minute, second, nano);
} | [
"public",
"LocalTime",
"plusHours",
"(",
"long",
"hoursToAdd",
")",
"{",
"if",
"(",
"hoursToAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"int",
"newHour",
"=",
"(",
"(",
"int",
")",
"(",
"hoursToAdd",
"%",
"HOURS_PER_DAY",
")",
"+",
"hour",
... | Returns a copy of this {@code LocalTime} with the specified number of hours added.
<p>
This adds the specified number of hours to this time, returning a new time.
The calculation wraps around midnight.
<p>
This instance is immutable and unaffected by this method call.
@param hoursToAdd the hours to add, may be negative
@return a {@code LocalTime} based on this time with the hours added, not null | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"hours",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"specified",
"number",
"of",
"hours",
"to",
"this",
"time",
"returning",
"a",
"new"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L1066-L1072 |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureValidationCheck.java | FeatureValidationCheck.appendLocusTadAndGeneIDToMessage | public static void appendLocusTadAndGeneIDToMessage(Feature feature, ValidationMessage<Origin> message) {
if (SequenceEntryUtils.isQualifierAvailable(Qualifier.LOCUS_TAG_QUALIFIER_NAME, feature)) {
Qualifier locusTag = SequenceEntryUtils.getQualifier(Qualifier.LOCUS_TAG_QUALIFIER_NAME, feature);
if (locusTag.isValue()) {
message.appendCuratorMessage("locus tag = " + locusTag.getValue());
}
}
if (SequenceEntryUtils.isQualifierAvailable(Qualifier.GENE_QUALIFIER_NAME, feature)) {
Qualifier geneName = SequenceEntryUtils.getQualifier(Qualifier.GENE_QUALIFIER_NAME, feature);
if (geneName.isValue()) {
message.appendCuratorMessage("gene = " + geneName.getValue());
}
}
} | java | public static void appendLocusTadAndGeneIDToMessage(Feature feature, ValidationMessage<Origin> message) {
if (SequenceEntryUtils.isQualifierAvailable(Qualifier.LOCUS_TAG_QUALIFIER_NAME, feature)) {
Qualifier locusTag = SequenceEntryUtils.getQualifier(Qualifier.LOCUS_TAG_QUALIFIER_NAME, feature);
if (locusTag.isValue()) {
message.appendCuratorMessage("locus tag = " + locusTag.getValue());
}
}
if (SequenceEntryUtils.isQualifierAvailable(Qualifier.GENE_QUALIFIER_NAME, feature)) {
Qualifier geneName = SequenceEntryUtils.getQualifier(Qualifier.GENE_QUALIFIER_NAME, feature);
if (geneName.isValue()) {
message.appendCuratorMessage("gene = " + geneName.getValue());
}
}
} | [
"public",
"static",
"void",
"appendLocusTadAndGeneIDToMessage",
"(",
"Feature",
"feature",
",",
"ValidationMessage",
"<",
"Origin",
">",
"message",
")",
"{",
"if",
"(",
"SequenceEntryUtils",
".",
"isQualifierAvailable",
"(",
"Qualifier",
".",
"LOCUS_TAG_QUALIFIER_NAME",... | If a feature had locus_tag or gene qualifiers - appends the value of these to the message as a curator
comment. Useful for some submitters who want more of a handle on the origin than just a line number.
@param feature
@param message | [
"If",
"a",
"feature",
"had",
"locus_tag",
"or",
"gene",
"qualifiers",
"-",
"appends",
"the",
"value",
"of",
"these",
"to",
"the",
"message",
"as",
"a",
"curator",
"comment",
".",
"Useful",
"for",
"some",
"submitters",
"who",
"want",
"more",
"of",
"a",
"h... | train | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureValidationCheck.java#L97-L111 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/KeenClient.java | KeenClient.setProxy | public void setProxy(String proxyHost, int proxyPort) {
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
} | java | public void setProxy(String proxyHost, int proxyPort) {
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
} | [
"public",
"void",
"setProxy",
"(",
"String",
"proxyHost",
",",
"int",
"proxyPort",
")",
"{",
"this",
".",
"proxy",
"=",
"new",
"Proxy",
"(",
"Proxy",
".",
"Type",
".",
"HTTP",
",",
"new",
"InetSocketAddress",
"(",
"proxyHost",
",",
"proxyPort",
")",
")",... | Sets an HTTP proxy server configuration for this client.
@param proxyHost The proxy hostname or IP address.
@param proxyPort The proxy port number. | [
"Sets",
"an",
"HTTP",
"proxy",
"server",
"configuration",
"for",
"this",
"client",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L688-L690 |
Alexey1Gavrilov/ExpectIt | expectit-ant/src/main/java/net/sf/expectit/ant/ExpectSupportImpl.java | ExpectSupportImpl.setInput | public void setInput(int index, InputStream is) {
if (index >= inputStreams.length) {
inputStreams = Arrays.copyOf(inputStreams, index + 1);
}
this.inputStreams[index] = is;
} | java | public void setInput(int index, InputStream is) {
if (index >= inputStreams.length) {
inputStreams = Arrays.copyOf(inputStreams, index + 1);
}
this.inputStreams[index] = is;
} | [
"public",
"void",
"setInput",
"(",
"int",
"index",
",",
"InputStream",
"is",
")",
"{",
"if",
"(",
"index",
">=",
"inputStreams",
".",
"length",
")",
"{",
"inputStreams",
"=",
"Arrays",
".",
"copyOf",
"(",
"inputStreams",
",",
"index",
"+",
"1",
")",
";... | Sets the input streams for the expect instance.
@param index the number of the input stream
@param is the input stream
@see net.sf.expectit.ExpectBuilder#withInputs(java.io.InputStream...) | [
"Sets",
"the",
"input",
"streams",
"for",
"the",
"expect",
"instance",
"."
] | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-ant/src/main/java/net/sf/expectit/ant/ExpectSupportImpl.java#L144-L149 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java | SequenceFunctionRefiner.refineSymmetry | public static AFPChain refineSymmetry(AFPChain afpChain, Atom[] ca1, Atom[] ca2, int k)
throws StructureException, RefinerFailedException {
// Transform alignment to a Map
Map<Integer, Integer> alignment = AlignmentTools.alignmentAsMap(afpChain);
// Refine the alignment Map
Map<Integer, Integer> refined = refineSymmetry(alignment, k);
if (refined.size() < 1)
throw new RefinerFailedException("Refiner returned empty alignment");
//Substitute and partition the alignment
try {
AFPChain refinedAFP = AlignmentTools.replaceOptAln(afpChain, ca1, ca2, refined);
refinedAFP = partitionAFPchain(refinedAFP, ca1, ca2, k);
if (refinedAFP.getOptLength() < 1)
throw new IndexOutOfBoundsException("Refined alignment is empty.");
return refinedAFP;
} catch (IndexOutOfBoundsException e){
// This Exception is thrown when the refined alignment is not consistent
throw new RefinerFailedException("Refiner failure: non-consistent result", e);
}
} | java | public static AFPChain refineSymmetry(AFPChain afpChain, Atom[] ca1, Atom[] ca2, int k)
throws StructureException, RefinerFailedException {
// Transform alignment to a Map
Map<Integer, Integer> alignment = AlignmentTools.alignmentAsMap(afpChain);
// Refine the alignment Map
Map<Integer, Integer> refined = refineSymmetry(alignment, k);
if (refined.size() < 1)
throw new RefinerFailedException("Refiner returned empty alignment");
//Substitute and partition the alignment
try {
AFPChain refinedAFP = AlignmentTools.replaceOptAln(afpChain, ca1, ca2, refined);
refinedAFP = partitionAFPchain(refinedAFP, ca1, ca2, k);
if (refinedAFP.getOptLength() < 1)
throw new IndexOutOfBoundsException("Refined alignment is empty.");
return refinedAFP;
} catch (IndexOutOfBoundsException e){
// This Exception is thrown when the refined alignment is not consistent
throw new RefinerFailedException("Refiner failure: non-consistent result", e);
}
} | [
"public",
"static",
"AFPChain",
"refineSymmetry",
"(",
"AFPChain",
"afpChain",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
",",
"int",
"k",
")",
"throws",
"StructureException",
",",
"RefinerFailedException",
"{",
"// Transform alignment to a Map",
... | Refines a CE-Symm alignment so that it is perfectly symmetric.
The resulting alignment will have a one-to-one correspondance between
aligned residues of each symmetric part.
@param afpChain Input alignment from CE-Symm
@param k Symmetry order. This can be guessed by {@link CeSymm#getSymmetryOrder(AFPChain)}
@return The refined alignment
@throws StructureException
@throws RefinerFailedException | [
"Refines",
"a",
"CE",
"-",
"Symm",
"alignment",
"so",
"that",
"it",
"is",
"perfectly",
"symmetric",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java#L74-L96 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Parser.java | Parser.parseFunctionCallExpression | private FunctionCallExpression parseFunctionCallExpression(Token token)
throws IOException {
Token next = peek();
if (next.getID() != Token.LPAREN) {
return null;
}
SourceInfo info = token.getSourceInfo();
Name target = new Name(info, token.getStringValue());
// parse remainder of call expression
return parseCallExpression(FunctionCallExpression.class,
null, target, info);
} | java | private FunctionCallExpression parseFunctionCallExpression(Token token)
throws IOException {
Token next = peek();
if (next.getID() != Token.LPAREN) {
return null;
}
SourceInfo info = token.getSourceInfo();
Name target = new Name(info, token.getStringValue());
// parse remainder of call expression
return parseCallExpression(FunctionCallExpression.class,
null, target, info);
} | [
"private",
"FunctionCallExpression",
"parseFunctionCallExpression",
"(",
"Token",
"token",
")",
"throws",
"IOException",
"{",
"Token",
"next",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"next",
".",
"getID",
"(",
")",
"!=",
"Token",
".",
"LPAREN",
")",
"{",
"r... | a FunctionCallExpression. Token passed in must be an identifier. | [
"a",
"FunctionCallExpression",
".",
"Token",
"passed",
"in",
"must",
"be",
"an",
"identifier",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Parser.java#L1424-L1438 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java | AuthenticateApi.throwExceptionIfAlreadyAuthenticate | public void throwExceptionIfAlreadyAuthenticate(HttpServletRequest req, HttpServletResponse resp, WebAppSecurityConfig config, String username) throws ServletException {
Subject callerSubject = subjectManager.getCallerSubject();
if (subjectHelper.isUnauthenticated(callerSubject))
return;
if (!config.getWebAlwaysLogin()) {
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, username);
authResult.setAuditCredType(req.getAuthType());
authResult.setAuditCredValue(username);
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
Audit.audit(Audit.EventID.SECURITY_API_AUTHN_01, req, authResult, Integer.valueOf(HttpServletResponse.SC_UNAUTHORIZED));
throw new ServletException("Authentication had been already established");
}
logout(req, resp, config);
} | java | public void throwExceptionIfAlreadyAuthenticate(HttpServletRequest req, HttpServletResponse resp, WebAppSecurityConfig config, String username) throws ServletException {
Subject callerSubject = subjectManager.getCallerSubject();
if (subjectHelper.isUnauthenticated(callerSubject))
return;
if (!config.getWebAlwaysLogin()) {
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, username);
authResult.setAuditCredType(req.getAuthType());
authResult.setAuditCredValue(username);
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
Audit.audit(Audit.EventID.SECURITY_API_AUTHN_01, req, authResult, Integer.valueOf(HttpServletResponse.SC_UNAUTHORIZED));
throw new ServletException("Authentication had been already established");
}
logout(req, resp, config);
} | [
"public",
"void",
"throwExceptionIfAlreadyAuthenticate",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
",",
"WebAppSecurityConfig",
"config",
",",
"String",
"username",
")",
"throws",
"ServletException",
"{",
"Subject",
"callerSubject",
"=",
"subje... | This method throws an exception if the caller subject is already authenticated and
WebAlwaysLogin is false. If the caller subject is already authenticated and
WebAlwaysLogin is true, then it will logout the user.
@throws IOException
@throws ServletException | [
"This",
"method",
"throws",
"an",
"exception",
"if",
"the",
"caller",
"subject",
"is",
"already",
"authenticated",
"and",
"WebAlwaysLogin",
"is",
"false",
".",
"If",
"the",
"caller",
"subject",
"is",
"already",
"authenticated",
"and",
"WebAlwaysLogin",
"is",
"tr... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java#L425-L438 |
sangupta/jerry-web | src/main/java/com/sangupta/jerry/web/filters/JavascriptMinificationFilter.java | JavascriptMinificationFilter.compressJavascriptEmbedded | private String compressJavascriptEmbedded(final String uri, final String code) {
if(code == null || code.isEmpty()) {
return code;
}
int index = uri.lastIndexOf('/');
String name = uri;
if(index > 0) {
name = uri.substring(index + 1);
}
List<SourceFile> externs = Collections.emptyList();
List<SourceFile> inputs = Arrays.asList(SourceFile.fromCode(name, code));
CompilerOptions options = new CompilerOptions();
CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
com.google.javascript.jscomp.Compiler compiler = new com.google.javascript.jscomp.Compiler();
Result result = compiler.compile(externs, inputs, options);
if (result.success) {
return compiler.toSource();
}
throw new IllegalArgumentException("Unable to compress javascript");
} | java | private String compressJavascriptEmbedded(final String uri, final String code) {
if(code == null || code.isEmpty()) {
return code;
}
int index = uri.lastIndexOf('/');
String name = uri;
if(index > 0) {
name = uri.substring(index + 1);
}
List<SourceFile> externs = Collections.emptyList();
List<SourceFile> inputs = Arrays.asList(SourceFile.fromCode(name, code));
CompilerOptions options = new CompilerOptions();
CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
com.google.javascript.jscomp.Compiler compiler = new com.google.javascript.jscomp.Compiler();
Result result = compiler.compile(externs, inputs, options);
if (result.success) {
return compiler.toSource();
}
throw new IllegalArgumentException("Unable to compress javascript");
} | [
"private",
"String",
"compressJavascriptEmbedded",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"code",
")",
"{",
"if",
"(",
"code",
"==",
"null",
"||",
"code",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"code",
";",
"}",
"int",
"index",
"... | Compress the Javascript.
@param uri
the URI for the JS file
@param code
the actual Javascript code
@return the compressed code for the JS file | [
"Compress",
"the",
"Javascript",
"."
] | train | https://github.com/sangupta/jerry-web/blob/f0d02a5d6e7d1c15292509ce588caf52a4ddb895/src/main/java/com/sangupta/jerry/web/filters/JavascriptMinificationFilter.java#L233-L257 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleCounterRequest | private static BinaryMemcacheRequest handleCounterRequest(final ChannelHandlerContext ctx,
final CounterRequest msg) {
ByteBuf extras = ctx.alloc().buffer();
extras.writeLong(Math.abs(msg.delta()));
extras.writeLong(msg.initial());
extras.writeInt(msg.expiry());
byte[] key = msg.keyBytes();
short keyLength = (short) key.length;
byte extrasLength = (byte) extras.readableBytes();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key, extras);
request.setOpcode(msg.delta() < 0 ? OP_COUNTER_DECR : OP_COUNTER_INCR);
request.setKeyLength(keyLength);
request.setTotalBodyLength(keyLength + extrasLength);
request.setExtrasLength(extrasLength);
return request;
} | java | private static BinaryMemcacheRequest handleCounterRequest(final ChannelHandlerContext ctx,
final CounterRequest msg) {
ByteBuf extras = ctx.alloc().buffer();
extras.writeLong(Math.abs(msg.delta()));
extras.writeLong(msg.initial());
extras.writeInt(msg.expiry());
byte[] key = msg.keyBytes();
short keyLength = (short) key.length;
byte extrasLength = (byte) extras.readableBytes();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key, extras);
request.setOpcode(msg.delta() < 0 ? OP_COUNTER_DECR : OP_COUNTER_INCR);
request.setKeyLength(keyLength);
request.setTotalBodyLength(keyLength + extrasLength);
request.setExtrasLength(extrasLength);
return request;
} | [
"private",
"static",
"BinaryMemcacheRequest",
"handleCounterRequest",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"CounterRequest",
"msg",
")",
"{",
"ByteBuf",
"extras",
"=",
"ctx",
".",
"alloc",
"(",
")",
".",
"buffer",
"(",
")",
";",
"extras",
... | Encodes a {@link CounterRequest} into its lower level representation.
Depending on if the {@link CounterRequest#delta} is positive or negative, either the incr or decr memcached
commands are utilized. The value is converted to its absolute variant to conform with the protocol.
@return a ready {@link BinaryMemcacheRequest}. | [
"Encodes",
"a",
"{",
"@link",
"CounterRequest",
"}",
"into",
"its",
"lower",
"level",
"representation",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L608-L624 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.modifyAttributes | public void modifyAttributes(String dn, int mod_op, Attributes attrs) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
}
finally {
iContextManager.releaseDirContext(ctx);
}
} | java | public void modifyAttributes(String dn, int mod_op, Attributes attrs) throws NamingException, WIMException {
TimedDirContext ctx = iContextManager.getDirContext();
iContextManager.checkWritePermission(ctx);
try {
try {
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
ctx.modifyAttributes(new LdapName(dn), mod_op, attrs);
}
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} catch (NamingException e) {
throw e;
}
finally {
iContextManager.releaseDirContext(ctx);
}
} | [
"public",
"void",
"modifyAttributes",
"(",
"String",
"dn",
",",
"int",
"mod_op",
",",
"Attributes",
"attrs",
")",
"throws",
"NamingException",
",",
"WIMException",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"iCont... | Modify the attributes for the specified distinguished name.
@param dn The distinguished name to modify attributes on.
@param mod_op The operation to perform.
@param attrs The attributes to modify.
@throws NamingException If there was an issue writing the new attribute values.
@throws WIMException If there was an issue getting or releasing a context, or the context is on a
fail-over server and writing to fail-over servers is prohibited, or the distinguished
name does not exist. | [
"Modify",
"the",
"attributes",
"for",
"the",
"specified",
"distinguished",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2165-L2188 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/collection/LazyList.java | LazyList.addArray | public static Object addArray(Object list, Object[] array) {
for (int i = 0; array != null && i < array.length; i++)
list = LazyList.add(list, array[i]);
return list;
} | java | public static Object addArray(Object list, Object[] array) {
for (int i = 0; array != null && i < array.length; i++)
list = LazyList.add(list, array[i]);
return list;
} | [
"public",
"static",
"Object",
"addArray",
"(",
"Object",
"list",
",",
"Object",
"[",
"]",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"array",
"!=",
"null",
"&&",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"list",
"=",
... | Add the contents of an array to a LazyList
@param list The list to add to or null if none yet created.
@param array The array whose contents should be added.
@return The lazylist created or added to. | [
"Add",
"the",
"contents",
"of",
"an",
"array",
"to",
"a",
"LazyList"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/collection/LazyList.java#L126-L130 |
groundupworks/wings | wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java | DropboxEndpoint.storeAccountParams | private void storeAccountParams(String accountName, String shareUrl, String accessToken) {
Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit();
editor.putString(mContext.getString(R.string.wings_dropbox__account_name_key), accountName);
editor.putString(mContext.getString(R.string.wings_dropbox__share_url_key), shareUrl);
editor.putString(mContext.getString(R.string.wings_dropbox__access_token_key), accessToken);
// Set preference to linked.
editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), true);
editor.apply();
} | java | private void storeAccountParams(String accountName, String shareUrl, String accessToken) {
Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit();
editor.putString(mContext.getString(R.string.wings_dropbox__account_name_key), accountName);
editor.putString(mContext.getString(R.string.wings_dropbox__share_url_key), shareUrl);
editor.putString(mContext.getString(R.string.wings_dropbox__access_token_key), accessToken);
// Set preference to linked.
editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), true);
editor.apply();
} | [
"private",
"void",
"storeAccountParams",
"(",
"String",
"accountName",
",",
"String",
"shareUrl",
",",
"String",
"accessToken",
")",
"{",
"Editor",
"editor",
"=",
"PreferenceManager",
".",
"getDefaultSharedPreferences",
"(",
"mContext",
")",
".",
"edit",
"(",
")",... | Stores the account params in persisted storage.
@param accountName the user name associated with the account.
@param shareUrl the share url associated with the account.
@param accessToken the access token. | [
"Stores",
"the",
"account",
"params",
"in",
"persisted",
"storage",
"."
] | train | https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L248-L257 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.minAll | public static <T> Collector<T, ?, Seq<T>> minAll(Comparator<? super T> comparator) {
return minAllBy(t -> t, comparator);
} | java | public static <T> Collector<T, ?, Seq<T>> minAll(Comparator<? super T> comparator) {
return minAllBy(t -> t, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Seq",
"<",
"T",
">",
">",
"minAll",
"(",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"minAllBy",
"(",
"t",
"->",
"t",
",",
"comparator",
")... | Get a {@link Collector} that calculates the <code>MIN()</code> function, producing multiple results. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L228-L230 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapMultiPoint.java | MapMultiPoint.intersects | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
if (boundsIntersects(rectangle)) {
for (final PointGroup grp : groups()) {
for (final Point2d pts : grp) {
if (rectangle.contains(pts)) {
return true;
}
}
}
}
return false;
} | java | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
if (boundsIntersects(rectangle)) {
for (final PointGroup grp : groups()) {
for (final Point2d pts : grp) {
if (rectangle.contains(pts)) {
return true;
}
}
}
}
return false;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"boolean",
"intersects",
"(",
"Shape2D",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
"extends",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
">",
"re... | Replies if this element has an intersection
with the specified rectangle.
@return <code>true</code> if this MapElement is intersecting the specified area,
otherwise <code>false</code> | [
"Replies",
"if",
"this",
"element",
"has",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapMultiPoint.java#L106-L119 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.beginStopEnvironment | public void beginStopEnvironment(String userName, String environmentId) {
beginStopEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | java | public void beginStopEnvironment(String userName, String environmentId) {
beginStopEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | [
"public",
"void",
"beginStopEnvironment",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"beginStopEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"b... | Stops an environment by stopping all resources inside the environment This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@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 | [
"Stops",
"an",
"environment",
"by",
"stopping",
"all",
"resources",
"inside",
"the",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1301-L1303 |
aaberg/sql2o | core/src/main/java/org/sql2o/ArrayParameters.java | ArrayParameters.updateQueryAndParametersIndexes | static String updateQueryAndParametersIndexes(String parsedQuery,
Map<String, List<Integer>> parameterNamesToIndexes,
Map<String, Query.ParameterSetter> parameters,
boolean allowArrayParameters) {
List<ArrayParameter> arrayParametersSortedAsc = arrayParametersSortedAsc(parameterNamesToIndexes, parameters, allowArrayParameters);
if(arrayParametersSortedAsc.isEmpty()) {
return parsedQuery;
}
updateParameterNamesToIndexes(parameterNamesToIndexes, arrayParametersSortedAsc);
return updateQueryWithArrayParameters(parsedQuery, arrayParametersSortedAsc);
} | java | static String updateQueryAndParametersIndexes(String parsedQuery,
Map<String, List<Integer>> parameterNamesToIndexes,
Map<String, Query.ParameterSetter> parameters,
boolean allowArrayParameters) {
List<ArrayParameter> arrayParametersSortedAsc = arrayParametersSortedAsc(parameterNamesToIndexes, parameters, allowArrayParameters);
if(arrayParametersSortedAsc.isEmpty()) {
return parsedQuery;
}
updateParameterNamesToIndexes(parameterNamesToIndexes, arrayParametersSortedAsc);
return updateQueryWithArrayParameters(parsedQuery, arrayParametersSortedAsc);
} | [
"static",
"String",
"updateQueryAndParametersIndexes",
"(",
"String",
"parsedQuery",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Integer",
">",
">",
"parameterNamesToIndexes",
",",
"Map",
"<",
"String",
",",
"Query",
".",
"ParameterSetter",
">",
"parameters",
... | Update both the query and the parameter indexes to include the array parameters. | [
"Update",
"both",
"the",
"query",
"and",
"the",
"parameter",
"indexes",
"to",
"include",
"the",
"array",
"parameters",
"."
] | train | https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/ArrayParameters.java#L32-L44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.