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 |
|---|---|---|---|---|---|---|---|---|---|---|
cdk/cdk | base/data/src/main/java/org/openscience/cdk/AtomContainerSet.java | AtomContainerSet.addAtomContainer | @Override
public void addAtomContainer(IAtomContainer atomContainer, double multiplier) {
if (atomContainerCount + 1 >= atomContainers.length) {
growAtomContainerArray();
}
atomContainer.addListener(this);
atomContainers[atomContainerCount] = atomContainer;
multipliers[atomContainerCount] = multiplier;
atomContainerCount++;
notifyChanged();
} | java | @Override
public void addAtomContainer(IAtomContainer atomContainer, double multiplier) {
if (atomContainerCount + 1 >= atomContainers.length) {
growAtomContainerArray();
}
atomContainer.addListener(this);
atomContainers[atomContainerCount] = atomContainer;
multipliers[atomContainerCount] = multiplier;
atomContainerCount++;
notifyChanged();
} | [
"@",
"Override",
"public",
"void",
"addAtomContainer",
"(",
"IAtomContainer",
"atomContainer",
",",
"double",
"multiplier",
")",
"{",
"if",
"(",
"atomContainerCount",
"+",
"1",
">=",
"atomContainers",
".",
"length",
")",
"{",
"growAtomContainerArray",
"(",
")",
... | Adds an atomContainer to this container with the given
multiplier.
@param atomContainer The atomContainer to be added to this container
@param multiplier The multiplier of this atomContainer | [
"Adds",
"an",
"atomContainer",
"to",
"this",
"container",
"with",
"the",
"given",
"multiplier",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/data/src/main/java/org/openscience/cdk/AtomContainerSet.java#L226-L236 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/parsetree/Expression.java | Expression.setType | public void setType(Type type) {
Type actual = Type.preserveType(this.getType(), type);
mConversions.clear();
mExceptionPossible = false;
if (actual != null) {
// Prefer cast for initial type for correct operation of
// setInitialType if a conversion needs to be inserted at the
// beginning.
mConversions.add(new Conversion(null, actual, true));
}
} | java | public void setType(Type type) {
Type actual = Type.preserveType(this.getType(), type);
mConversions.clear();
mExceptionPossible = false;
if (actual != null) {
// Prefer cast for initial type for correct operation of
// setInitialType if a conversion needs to be inserted at the
// beginning.
mConversions.add(new Conversion(null, actual, true));
}
} | [
"public",
"void",
"setType",
"(",
"Type",
"type",
")",
"{",
"Type",
"actual",
"=",
"Type",
".",
"preserveType",
"(",
"this",
".",
"getType",
"(",
")",
",",
"type",
")",
";",
"mConversions",
".",
"clear",
"(",
")",
";",
"mExceptionPossible",
"=",
"false... | Sets the type of this expression, clearing the conversion chain. | [
"Sets",
"the",
"type",
"of",
"this",
"expression",
"clearing",
"the",
"conversion",
"chain",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/parsetree/Expression.java#L314-L325 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/masterslave/MasterSlaveUtils.java | MasterSlaveUtils.essentiallyEqualsTo | static boolean essentiallyEqualsTo(RedisNodeDescription o1, RedisNodeDescription o2) {
if (o2 == null) {
return false;
}
if (o1.getRole() != o2.getRole()) {
return false;
}
if (!o1.getUri().equals(o2.getUri())) {
return false;
}
return true;
} | java | static boolean essentiallyEqualsTo(RedisNodeDescription o1, RedisNodeDescription o2) {
if (o2 == null) {
return false;
}
if (o1.getRole() != o2.getRole()) {
return false;
}
if (!o1.getUri().equals(o2.getUri())) {
return false;
}
return true;
} | [
"static",
"boolean",
"essentiallyEqualsTo",
"(",
"RedisNodeDescription",
"o1",
",",
"RedisNodeDescription",
"o2",
")",
"{",
"if",
"(",
"o2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"o1",
".",
"getRole",
"(",
")",
"!=",
"o2",
".",
... | Check for {@code MASTER} or {@code SLAVE} roles and the URI.
@param o1 the first object to be compared.
@param o2 the second object to be compared.
@return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the URI changed. | [
"Check",
"for",
"{",
"@code",
"MASTER",
"}",
"or",
"{",
"@code",
"SLAVE",
"}",
"roles",
"and",
"the",
"URI",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/masterslave/MasterSlaveUtils.java#L89-L104 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java | FragmentJoiner.reduceFragments | public static boolean reduceFragments(List<FragmentPair> fragments, FragmentPair f, Matrix rmsmat){
boolean doNotAdd =false;
int i = f.getPos1();
int j = f.getPos2();
for ( int p =0; p < fragments.size(); p++){
FragmentPair tmp = fragments.get(p);
int di1 = Math.abs(f.getPos1() - tmp.getPos1());
int di2 = Math.abs(f.getPos2() - tmp.getPos2());
if (( Math.abs(di1-di2) == 2)) {
double rms1 = rmsmat.get(tmp.getPos1(),tmp.getPos2());
double rms2 = rmsmat.get(i,j);
doNotAdd = true;
if ( rms2 < rms1){
fragments.remove(p);
fragments.add(f);
break;
}
p = fragments.size();
}
}
return doNotAdd;
} | java | public static boolean reduceFragments(List<FragmentPair> fragments, FragmentPair f, Matrix rmsmat){
boolean doNotAdd =false;
int i = f.getPos1();
int j = f.getPos2();
for ( int p =0; p < fragments.size(); p++){
FragmentPair tmp = fragments.get(p);
int di1 = Math.abs(f.getPos1() - tmp.getPos1());
int di2 = Math.abs(f.getPos2() - tmp.getPos2());
if (( Math.abs(di1-di2) == 2)) {
double rms1 = rmsmat.get(tmp.getPos1(),tmp.getPos2());
double rms2 = rmsmat.get(i,j);
doNotAdd = true;
if ( rms2 < rms1){
fragments.remove(p);
fragments.add(f);
break;
}
p = fragments.size();
}
}
return doNotAdd;
} | [
"public",
"static",
"boolean",
"reduceFragments",
"(",
"List",
"<",
"FragmentPair",
">",
"fragments",
",",
"FragmentPair",
"f",
",",
"Matrix",
"rmsmat",
")",
"{",
"boolean",
"doNotAdd",
"=",
"false",
";",
"int",
"i",
"=",
"f",
".",
"getPos1",
"(",
")",
"... | In helices often many similar fragments can be found. To reduce these to a few
representative ones this check can be used. It does a distance check between
all known Fragments and a new one. If this one is on a similar diagonal and it
has a lower rms, this one is a better representation. Note: shifts of one are
not allowed.
@param fragments
@param f
@param rmsmat
@return true - if this is a better representant for a group of locala fragments. | [
"In",
"helices",
"often",
"many",
"similar",
"fragments",
"can",
"be",
"found",
".",
"To",
"reduce",
"these",
"to",
"a",
"few",
"representative",
"ones",
"this",
"check",
"can",
"be",
"used",
".",
"It",
"does",
"a",
"distance",
"check",
"between",
"all",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java#L91-L114 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/FastMathCalc.java | FastMathCalc.slowCos | static double slowCos(final double x, final double result[]) {
final double xs[] = new double[2];
final double ys[] = new double[2];
final double facts[] = new double[2];
final double as[] = new double[2];
split(x, xs);
ys[0] = ys[1] = 0.0;
for (int i = FACT.length-1; i >= 0; i--) {
splitMult(xs, ys, as);
ys[0] = as[0]; ys[1] = as[1];
if ( (i & 1) != 0) { // skip odd entries
continue;
}
split(FACT[i], as);
splitReciprocal(as, facts);
if ( (i & 2) != 0 ) { // alternate terms are negative
facts[0] = -facts[0];
facts[1] = -facts[1];
}
splitAdd(ys, facts, as);
ys[0] = as[0]; ys[1] = as[1];
}
if (result != null) {
result[0] = ys[0];
result[1] = ys[1];
}
return ys[0] + ys[1];
} | java | static double slowCos(final double x, final double result[]) {
final double xs[] = new double[2];
final double ys[] = new double[2];
final double facts[] = new double[2];
final double as[] = new double[2];
split(x, xs);
ys[0] = ys[1] = 0.0;
for (int i = FACT.length-1; i >= 0; i--) {
splitMult(xs, ys, as);
ys[0] = as[0]; ys[1] = as[1];
if ( (i & 1) != 0) { // skip odd entries
continue;
}
split(FACT[i], as);
splitReciprocal(as, facts);
if ( (i & 2) != 0 ) { // alternate terms are negative
facts[0] = -facts[0];
facts[1] = -facts[1];
}
splitAdd(ys, facts, as);
ys[0] = as[0]; ys[1] = as[1];
}
if (result != null) {
result[0] = ys[0];
result[1] = ys[1];
}
return ys[0] + ys[1];
} | [
"static",
"double",
"slowCos",
"(",
"final",
"double",
"x",
",",
"final",
"double",
"result",
"[",
"]",
")",
"{",
"final",
"double",
"xs",
"[",
"]",
"=",
"new",
"double",
"[",
"2",
"]",
";",
"final",
"double",
"ys",
"[",
"]",
"=",
"new",
"double",
... | For x between 0 and pi/4 compute cosine using Talor series
cos(x) = 1 - x^2/2! + x^4/4! ...
@param x number from which cosine is requested
@param result placeholder where to put the result in extended precision
(may be null)
@return cos(x) | [
"For",
"x",
"between",
"0",
"and",
"pi",
"/",
"4",
"compute",
"cosine",
"using",
"Talor",
"series",
"cos",
"(",
"x",
")",
"=",
"1",
"-",
"x^2",
"/",
"2!",
"+",
"x^4",
"/",
"4!",
"..."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L204-L239 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java | OAuth20HandlerInterceptorAdapter.requestRequiresAuthentication | protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
val accessTokenRequest = isAccessTokenRequest(request, response);
if (!accessTokenRequest) {
val extractor = extractAccessTokenGrantRequest(request);
if (extractor.isPresent()) {
val ext = extractor.get();
return ext.requestMustBeAuthenticated();
}
} else {
val extractor = extractAccessTokenGrantRequest(request);
if (extractor.isPresent()) {
val ext = extractor.get();
return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE;
}
}
return false;
} | java | protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
val accessTokenRequest = isAccessTokenRequest(request, response);
if (!accessTokenRequest) {
val extractor = extractAccessTokenGrantRequest(request);
if (extractor.isPresent()) {
val ext = extractor.get();
return ext.requestMustBeAuthenticated();
}
} else {
val extractor = extractAccessTokenGrantRequest(request);
if (extractor.isPresent()) {
val ext = extractor.get();
return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE;
}
}
return false;
} | [
"protected",
"boolean",
"requestRequiresAuthentication",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"val",
"accessTokenRequest",
"=",
"isAccessTokenRequest",
"(",
"request",
",",
"response",
")",
";",
"if",
... | Request requires authentication.
@param request the request
@param response the response
@return true/false | [
"Request",
"requires",
"authentication",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java#L88-L104 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.bindClass | protected void bindClass(PersistentEntity domainClass, PersistentClass persistentClass, InFlightMetadataCollector mappings) {
// set lazy loading for now
persistentClass.setLazy(true);
final String entityName = domainClass.getName();
persistentClass.setEntityName(entityName);
persistentClass.setJpaEntityName(unqualify(entityName));
persistentClass.setProxyInterfaceName(entityName);
persistentClass.setClassName(entityName);
// set dynamic insert to false
persistentClass.setDynamicInsert(false);
// set dynamic update to false
persistentClass.setDynamicUpdate(false);
// set select before update to false
persistentClass.setSelectBeforeUpdate(false);
// add import to mappings
String en = persistentClass.getEntityName();
if (mappings.getMetadataBuildingOptions().getMappingDefaults().isAutoImportEnabled() && en.indexOf('.') > 0) {
String unqualified = unqualify(en);
mappings.addImport(unqualified, en);
}
} | java | protected void bindClass(PersistentEntity domainClass, PersistentClass persistentClass, InFlightMetadataCollector mappings) {
// set lazy loading for now
persistentClass.setLazy(true);
final String entityName = domainClass.getName();
persistentClass.setEntityName(entityName);
persistentClass.setJpaEntityName(unqualify(entityName));
persistentClass.setProxyInterfaceName(entityName);
persistentClass.setClassName(entityName);
// set dynamic insert to false
persistentClass.setDynamicInsert(false);
// set dynamic update to false
persistentClass.setDynamicUpdate(false);
// set select before update to false
persistentClass.setSelectBeforeUpdate(false);
// add import to mappings
String en = persistentClass.getEntityName();
if (mappings.getMetadataBuildingOptions().getMappingDefaults().isAutoImportEnabled() && en.indexOf('.') > 0) {
String unqualified = unqualify(en);
mappings.addImport(unqualified, en);
}
} | [
"protected",
"void",
"bindClass",
"(",
"PersistentEntity",
"domainClass",
",",
"PersistentClass",
"persistentClass",
",",
"InFlightMetadataCollector",
"mappings",
")",
"{",
"// set lazy loading for now",
"persistentClass",
".",
"setLazy",
"(",
"true",
")",
";",
"final",
... | Binds the specified persistant class to the runtime model based on the
properties defined in the domain class
@param domainClass The Grails domain class
@param persistentClass The persistant class
@param mappings Existing mappings | [
"Binds",
"the",
"specified",
"persistant",
"class",
"to",
"the",
"runtime",
"model",
"based",
"on",
"the",
"properties",
"defined",
"in",
"the",
"domain",
"class"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L1341-L1364 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java | PebbleKit.getWatchFWVersion | public static FirmwareVersionInfo getWatchFWVersion(final Context context) {
Cursor c = null;
try {
c = queryProvider(context);
if (c == null || !c.moveToNext()) {
return null;
}
int majorVersion = c.getInt(KIT_STATE_COLUMN_VERSION_MAJOR);
int minorVersion = c.getInt(KIT_STATE_COLUMN_VERSION_MINOR);
int pointVersion = c.getInt(KIT_STATE_COLUMN_VERSION_POINT);
String versionTag = c.getString(KIT_STATE_COLUMN_VERSION_TAG);
return new FirmwareVersionInfo(majorVersion, minorVersion, pointVersion, versionTag);
} finally {
if (c != null) {
c.close();
}
}
} | java | public static FirmwareVersionInfo getWatchFWVersion(final Context context) {
Cursor c = null;
try {
c = queryProvider(context);
if (c == null || !c.moveToNext()) {
return null;
}
int majorVersion = c.getInt(KIT_STATE_COLUMN_VERSION_MAJOR);
int minorVersion = c.getInt(KIT_STATE_COLUMN_VERSION_MINOR);
int pointVersion = c.getInt(KIT_STATE_COLUMN_VERSION_POINT);
String versionTag = c.getString(KIT_STATE_COLUMN_VERSION_TAG);
return new FirmwareVersionInfo(majorVersion, minorVersion, pointVersion, versionTag);
} finally {
if (c != null) {
c.close();
}
}
} | [
"public",
"static",
"FirmwareVersionInfo",
"getWatchFWVersion",
"(",
"final",
"Context",
"context",
")",
"{",
"Cursor",
"c",
"=",
"null",
";",
"try",
"{",
"c",
"=",
"queryProvider",
"(",
"context",
")",
";",
"if",
"(",
"c",
"==",
"null",
"||",
"!",
"c",
... | Get the version information of the firmware running on a connected watch.
@param context
The Android context used to perform the query.
<em>Protip:</em> You probably want to use your ApplicationContext here.
@return null if the watch is disconnected or we can't get the version. Otherwise,
a FirmwareVersionObject containing info on the watch FW version | [
"Get",
"the",
"version",
"information",
"of",
"the",
"firmware",
"running",
"on",
"a",
"connected",
"watch",
"."
] | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L151-L170 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/DocumentationHelper.java | DocumentationHelper.prettyPrintsReport | public void prettyPrintsReport(File sessionDir, File prettyPrintReportFile)
throws Exception {
if ((!sessionDir.exists()) || (!sessionDir.isDirectory())) {
throw new Exception("Error: LOGDIR " + sessionDir.getAbsolutePath()
+ " seems not a valid directory. ");
}
File xml_logs_report_file = new File(sessionDir.getAbsolutePath()
+ File.separator + "report_logs.xml");
if (!xml_logs_report_file.exists()) {
// throw new Exception("Error: missing logfile " +
// xml_logs_report_file.getAbsolutePath() + " ! ");
System.out.println("Warning: missing logfile "
+ xml_logs_report_file.getAbsolutePath() + " ! ");
System.out.println("Trying to create it!");
LogUtils.createFullReportLog(sessionDir.getAbsolutePath());
}
File html_output_report_file = prettyPrintReportFile;
if (html_output_report_file.exists()) {
System.out.println("Report file \""
+ html_output_report_file.getAbsolutePath() + "\" reused!");
return;
}
// Fortify Mod: Close the FileOutputStream and releaase its resources
// prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(),
// new FileOutputStream(html_output_report_file));
FileOutputStream fos = new FileOutputStream(html_output_report_file);
prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(), fos);
fos.close();
System.out.println("Report file \""
+ html_output_report_file.getAbsolutePath() + "\" created!");
} | java | public void prettyPrintsReport(File sessionDir, File prettyPrintReportFile)
throws Exception {
if ((!sessionDir.exists()) || (!sessionDir.isDirectory())) {
throw new Exception("Error: LOGDIR " + sessionDir.getAbsolutePath()
+ " seems not a valid directory. ");
}
File xml_logs_report_file = new File(sessionDir.getAbsolutePath()
+ File.separator + "report_logs.xml");
if (!xml_logs_report_file.exists()) {
// throw new Exception("Error: missing logfile " +
// xml_logs_report_file.getAbsolutePath() + " ! ");
System.out.println("Warning: missing logfile "
+ xml_logs_report_file.getAbsolutePath() + " ! ");
System.out.println("Trying to create it!");
LogUtils.createFullReportLog(sessionDir.getAbsolutePath());
}
File html_output_report_file = prettyPrintReportFile;
if (html_output_report_file.exists()) {
System.out.println("Report file \""
+ html_output_report_file.getAbsolutePath() + "\" reused!");
return;
}
// Fortify Mod: Close the FileOutputStream and releaase its resources
// prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(),
// new FileOutputStream(html_output_report_file));
FileOutputStream fos = new FileOutputStream(html_output_report_file);
prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(), fos);
fos.close();
System.out.println("Report file \""
+ html_output_report_file.getAbsolutePath() + "\" created!");
} | [
"public",
"void",
"prettyPrintsReport",
"(",
"File",
"sessionDir",
",",
"File",
"prettyPrintReportFile",
")",
"throws",
"Exception",
"{",
"if",
"(",
"(",
"!",
"sessionDir",
".",
"exists",
"(",
")",
")",
"||",
"(",
"!",
"sessionDir",
".",
"isDirectory",
"(",
... | Create the pretty print HTML document of log report. Verify the content
of log root directory and create the report.html file if it not exists.
@param sessionDir
existing logs directory | [
"Create",
"the",
"pretty",
"print",
"HTML",
"document",
"of",
"log",
"report",
".",
"Verify",
"the",
"content",
"of",
"log",
"root",
"directory",
"and",
"create",
"the",
"report",
".",
"html",
"file",
"if",
"it",
"not",
"exists",
"."
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/DocumentationHelper.java#L153-L183 |
liferay/com-liferay-commerce | commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java | CommerceTaxMethodWrapper.getDescription | @Override
public String getDescription(String languageId, boolean useDefault) {
return _commerceTaxMethod.getDescription(languageId, useDefault);
} | java | @Override
public String getDescription(String languageId, boolean useDefault) {
return _commerceTaxMethod.getDescription(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getDescription",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_commerceTaxMethod",
".",
"getDescription",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized description of this commerce tax method in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized description of this commerce tax method | [
"Returns",
"the",
"localized",
"description",
"of",
"this",
"commerce",
"tax",
"method",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java#L263-L266 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.addValueEncryptionInfo | @InterfaceAudience.Private
private void addValueEncryptionInfo(String path, String providerName, boolean escape) {
if (escape) {
path = path.replaceAll("~", "~0").replaceAll("/", "~1");
}
if (this.encryptionPathInfo == null) {
this.encryptionPathInfo = new HashMap<String, String>();
}
this.encryptionPathInfo.put(path, providerName);
} | java | @InterfaceAudience.Private
private void addValueEncryptionInfo(String path, String providerName, boolean escape) {
if (escape) {
path = path.replaceAll("~", "~0").replaceAll("/", "~1");
}
if (this.encryptionPathInfo == null) {
this.encryptionPathInfo = new HashMap<String, String>();
}
this.encryptionPathInfo.put(path, providerName);
} | [
"@",
"InterfaceAudience",
".",
"Private",
"private",
"void",
"addValueEncryptionInfo",
"(",
"String",
"path",
",",
"String",
"providerName",
",",
"boolean",
"escape",
")",
"{",
"if",
"(",
"escape",
")",
"{",
"path",
"=",
"path",
".",
"replaceAll",
"(",
"\"~\... | Adds to the encryption info with optional escape for json pointer syntax
@param path Name of the key
@param providerName Value encryption configuration | [
"Adds",
"to",
"the",
"encryption",
"info",
"with",
"optional",
"escape",
"for",
"json",
"pointer",
"syntax"
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L1219-L1228 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.cosineOrHaversineRad | public static double cosineOrHaversineRad(double lat1, double lon1, double lat2, double lon2) {
if(lat1 == lat2 && lon1 == lon2) {
return 0.;
}
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double slat1 = sinAndCos(lat1, tmp), clat1 = tmp.value;
final double slat2 = sinAndCos(lat2, tmp), clat2 = tmp.value;
final double dlat = lat1 - lat2, dlon = lon1 - lon2;
// Use cosine, cheaper:
if(dlat > 0.01 || dlat < -0.01 || dlon > 0.01 || dlat < -0.01) {
final double a = slat1 * slat2 + clat1 * clat2 * cos(dlon);
return a < .9999_9999_9999_999 ? acos(a) : 0;
}
// Haversine formula, higher precision at < 1 meters
final double slat = sin(dlat * .5), slon = sin(dlon * .5);
return 2 * asin(sqrt(slat * slat + slon * slon * clat1 * clat2));
} | java | public static double cosineOrHaversineRad(double lat1, double lon1, double lat2, double lon2) {
if(lat1 == lat2 && lon1 == lon2) {
return 0.;
}
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double slat1 = sinAndCos(lat1, tmp), clat1 = tmp.value;
final double slat2 = sinAndCos(lat2, tmp), clat2 = tmp.value;
final double dlat = lat1 - lat2, dlon = lon1 - lon2;
// Use cosine, cheaper:
if(dlat > 0.01 || dlat < -0.01 || dlon > 0.01 || dlat < -0.01) {
final double a = slat1 * slat2 + clat1 * clat2 * cos(dlon);
return a < .9999_9999_9999_999 ? acos(a) : 0;
}
// Haversine formula, higher precision at < 1 meters
final double slat = sin(dlat * .5), slon = sin(dlon * .5);
return 2 * asin(sqrt(slat * slat + slon * slon * clat1 * clat2));
} | [
"public",
"static",
"double",
"cosineOrHaversineRad",
"(",
"double",
"lat1",
",",
"double",
"lon1",
",",
"double",
"lat2",
",",
"double",
"lon2",
")",
"{",
"if",
"(",
"lat1",
"==",
"lat2",
"&&",
"lon1",
"==",
"lon2",
")",
"{",
"return",
"0.",
";",
"}",... | Use cosine or haversine dynamically.
<p>
Complexity: 4-5 trigonometric functions, 1 sqrt.
@param lat1 Latitude of first point in degree
@param lon1 Longitude of first point in degree
@param lat2 Latitude of second point in degree
@param lon2 Longitude of second point in degree
@return Distance on unit sphere | [
"Use",
"cosine",
"or",
"haversine",
"dynamically",
".",
"<p",
">",
"Complexity",
":",
"4",
"-",
"5",
"trigonometric",
"functions",
"1",
"sqrt",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L215-L231 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java | JsiiRuntime.prepareBundledRuntime | private String prepareBundledRuntime() {
try {
String directory = Files.createTempDirectory("jsii-java-runtime").toString();
String entrypoint = extractResource(getClass(), "jsii-runtime.js", directory);
extractResource(getClass(), "jsii-runtime.js.map", directory);
extractResource(getClass(), "mappings.wasm", directory);
return entrypoint;
} catch (IOException e) {
throw new JsiiException("Unable to extract bundle of jsii-runtime.js from jar", e);
}
} | java | private String prepareBundledRuntime() {
try {
String directory = Files.createTempDirectory("jsii-java-runtime").toString();
String entrypoint = extractResource(getClass(), "jsii-runtime.js", directory);
extractResource(getClass(), "jsii-runtime.js.map", directory);
extractResource(getClass(), "mappings.wasm", directory);
return entrypoint;
} catch (IOException e) {
throw new JsiiException("Unable to extract bundle of jsii-runtime.js from jar", e);
}
} | [
"private",
"String",
"prepareBundledRuntime",
"(",
")",
"{",
"try",
"{",
"String",
"directory",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"jsii-java-runtime\"",
")",
".",
"toString",
"(",
")",
";",
"String",
"entrypoint",
"=",
"extractResource",
"(",
"get... | Extracts all files needed for jsii-runtime.js from JAR into a temp directory.
@return The full path for jsii-runtime.js | [
"Extracts",
"all",
"files",
"needed",
"for",
"jsii",
"-",
"runtime",
".",
"js",
"from",
"JAR",
"into",
"a",
"temp",
"directory",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L344-L355 |
aws/aws-sdk-java | aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java | StepFunctionBuilder.gt | public static NumericGreaterThanCondition.Builder gt(String variable, long expectedValue) {
return NumericGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue);
} | java | public static NumericGreaterThanCondition.Builder gt(String variable, long expectedValue) {
return NumericGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue);
} | [
"public",
"static",
"NumericGreaterThanCondition",
".",
"Builder",
"gt",
"(",
"String",
"variable",
",",
"long",
"expectedValue",
")",
"{",
"return",
"NumericGreaterThanCondition",
".",
"builder",
"(",
")",
".",
"variable",
"(",
"variable",
")",
".",
"expectedValu... | Binary condition for Numeric greater than comparison. Supports both integral and floating point numeric types.
@param variable The JSONPath expression that determines which piece of the input document is used for the comparison.
@param expectedValue The expected value for this condition.
@see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a>
@see com.amazonaws.services.stepfunctions.builder.states.Choice | [
"Binary",
"condition",
"for",
"Numeric",
"greater",
"than",
"comparison",
".",
"Supports",
"both",
"integral",
"and",
"floating",
"point",
"numeric",
"types",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L284-L286 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/legacy/internal/ParametersFactory.java | ParametersFactory.buildParameters | public Object[] buildParameters(Object[] firstParameters, Method method, QueryAdapter queryAdapter,
Class<? extends Annotation> annotationType) {
int parametersLength = method.getParameterTypes().length;
if (firstParameters.length > 0 && parametersLength < 1) {
throw new RepositoryMethodException(
String.format("Method with %s annotation should have at least one parameter.", annotationType));
}
int parametersToResolve = parametersLength - firstParameters.length;
Object[] additionalParameters = new Object[parametersToResolve];
for (int i = firstParameters.length; i < parametersLength; i++) {
Class<?> parameterType = method.getParameterTypes()[i];
if (isQueryType(parameterType)) {
additionalParameters[i - firstParameters.length] = toQueryObject(queryAdapter, parameterType);
} else {
additionalParameters[i - firstParameters.length] = parameterProvider.provide(method, i);
}
}
return concatenate(firstParameters, additionalParameters);
} | java | public Object[] buildParameters(Object[] firstParameters, Method method, QueryAdapter queryAdapter,
Class<? extends Annotation> annotationType) {
int parametersLength = method.getParameterTypes().length;
if (firstParameters.length > 0 && parametersLength < 1) {
throw new RepositoryMethodException(
String.format("Method with %s annotation should have at least one parameter.", annotationType));
}
int parametersToResolve = parametersLength - firstParameters.length;
Object[] additionalParameters = new Object[parametersToResolve];
for (int i = firstParameters.length; i < parametersLength; i++) {
Class<?> parameterType = method.getParameterTypes()[i];
if (isQueryType(parameterType)) {
additionalParameters[i - firstParameters.length] = toQueryObject(queryAdapter, parameterType);
} else {
additionalParameters[i - firstParameters.length] = parameterProvider.provide(method, i);
}
}
return concatenate(firstParameters, additionalParameters);
} | [
"public",
"Object",
"[",
"]",
"buildParameters",
"(",
"Object",
"[",
"]",
"firstParameters",
",",
"Method",
"method",
",",
"QueryAdapter",
"queryAdapter",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"int",
"parametersLength"... | Build a list of parameters that can be provided to a method.
@param firstParameters parameters to be returned as the firsts element in the return array
@param method repository method
@param annotationType method annotation
@param queryAdapter Ask remmo
@return array of resolved parameters | [
"Build",
"a",
"list",
"of",
"parameters",
"that",
"can",
"be",
"provided",
"to",
"a",
"method",
"."
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/internal/ParametersFactory.java#L31-L49 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetStageResult.java | GetStageResult.withTags | public GetStageResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public GetStageResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"GetStageResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The collection of tags. Each tag element is associated with a given resource.
</p>
@param tags
The collection of tags. Each tag element is associated with a given resource.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"collection",
"of",
"tags",
".",
"Each",
"tag",
"element",
"is",
"associated",
"with",
"a",
"given",
"resource",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetStageResult.java#L856-L859 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/ServerSocketChannelImpl.java | ServerSocketChannelImpl.translateAndSetInterestOps | public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
int newOps = 0;
// Translate ops
if ((ops & SelectionKey.OP_ACCEPT) != 0)
newOps |= PollArrayWrapper.POLLIN;
// Place ops into pollfd array
sk.selector.putEventOps(sk, newOps);
} | java | public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
int newOps = 0;
// Translate ops
if ((ops & SelectionKey.OP_ACCEPT) != 0)
newOps |= PollArrayWrapper.POLLIN;
// Place ops into pollfd array
sk.selector.putEventOps(sk, newOps);
} | [
"public",
"void",
"translateAndSetInterestOps",
"(",
"int",
"ops",
",",
"SelectionKeyImpl",
"sk",
")",
"{",
"int",
"newOps",
"=",
"0",
";",
"// Translate ops",
"if",
"(",
"(",
"ops",
"&",
"SelectionKey",
".",
"OP_ACCEPT",
")",
"!=",
"0",
")",
"newOps",
"|=... | Translates an interest operation set into a native poll event set | [
"Translates",
"an",
"interest",
"operation",
"set",
"into",
"a",
"native",
"poll",
"event",
"set"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/ServerSocketChannelImpl.java#L347-L355 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java | ModificationBuilderTarget.addModule | public T addModule(final String moduleName, final String slot, final byte[] newHash) {
final ContentItem item = createModuleItem(moduleName, slot, newHash);
addContentModification(createContentModification(item, ModificationType.ADD, NO_CONTENT));
return returnThis();
} | java | public T addModule(final String moduleName, final String slot, final byte[] newHash) {
final ContentItem item = createModuleItem(moduleName, slot, newHash);
addContentModification(createContentModification(item, ModificationType.ADD, NO_CONTENT));
return returnThis();
} | [
"public",
"T",
"addModule",
"(",
"final",
"String",
"moduleName",
",",
"final",
"String",
"slot",
",",
"final",
"byte",
"[",
"]",
"newHash",
")",
"{",
"final",
"ContentItem",
"item",
"=",
"createModuleItem",
"(",
"moduleName",
",",
"slot",
",",
"newHash",
... | Add a module.
@param moduleName the module name
@param slot the module slot
@param newHash the new hash of the added content
@return the builder | [
"Add",
"a",
"module",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/metadata/ModificationBuilderTarget.java#L174-L178 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java | MCMPHandler.sendResponse | static void sendResponse(final HttpServerExchange exchange, final String response) {
exchange.setStatusCode(StatusCodes.OK);
exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
final Sender sender = exchange.getResponseSender();
UndertowLogger.ROOT_LOGGER.mcmpSendingResponse(exchange.getSourceAddress(), exchange.getStatusCode(), exchange.getResponseHeaders(), response);
sender.send(response);
} | java | static void sendResponse(final HttpServerExchange exchange, final String response) {
exchange.setStatusCode(StatusCodes.OK);
exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
final Sender sender = exchange.getResponseSender();
UndertowLogger.ROOT_LOGGER.mcmpSendingResponse(exchange.getSourceAddress(), exchange.getStatusCode(), exchange.getResponseHeaders(), response);
sender.send(response);
} | [
"static",
"void",
"sendResponse",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"String",
"response",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"OK",
")",
";",
"exchange",
".",
"getResponseHeaders",
"(",
")",
".",
"ad... | Send a simple response string.
@param exchange the http server exchange
@param response the response string | [
"Send",
"a",
"simple",
"response",
"string",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java#L709-L715 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java | FieldList.getRecordResource | public ResourceBundle getRecordResource(Class<?> classResource, Locale locale)
{
ClassLoader classLoader = this.getClass().getClassLoader();
ResourceBundle resourceBundle = null;
String typicalResourceClassName = null;
try {
typicalResourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, 2) + "Resources";
resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(typicalResourceClassName, locale, null, classLoader);
} catch (MissingResourceException ex) {
resourceBundle = null;
}
int i = -1;
while (resourceBundle == null)
{
String resourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, i);
if (resourceClassName == null)
return null;
if (resourceClassName.equals(typicalResourceClassName))
return null; // Looked through them all
resourceClassName = resourceClassName + "Resources";
try {
resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(resourceClassName, locale, null, classLoader);
} catch (MissingResourceException ex) {
resourceBundle = null;
}
i--;
}
return resourceBundle;
} | java | public ResourceBundle getRecordResource(Class<?> classResource, Locale locale)
{
ClassLoader classLoader = this.getClass().getClassLoader();
ResourceBundle resourceBundle = null;
String typicalResourceClassName = null;
try {
typicalResourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, 2) + "Resources";
resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(typicalResourceClassName, locale, null, classLoader);
} catch (MissingResourceException ex) {
resourceBundle = null;
}
int i = -1;
while (resourceBundle == null)
{
String resourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, i);
if (resourceClassName == null)
return null;
if (resourceClassName.equals(typicalResourceClassName))
return null; // Looked through them all
resourceClassName = resourceClassName + "Resources";
try {
resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(resourceClassName, locale, null, classLoader);
} catch (MissingResourceException ex) {
resourceBundle = null;
}
i--;
}
return resourceBundle;
} | [
"public",
"ResourceBundle",
"getRecordResource",
"(",
"Class",
"<",
"?",
">",
"classResource",
",",
"Locale",
"locale",
")",
"{",
"ClassLoader",
"classLoader",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
";",
"ResourceBundle",
"res... | Get the record resource bundle.
@param classResource
@param locale
@return | [
"Get",
"the",
"record",
"resource",
"bundle",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java#L546-L574 |
linkhub-sdk/popbill.sdk.java | src/main/java/com/popbill/api/fax/FaxServiceImp.java | FaxServiceImp.resendFAXRN | @Override
public String resendFAXRN(String corpNum, String requestNum, String sendNum,
String senderName, String receiveNum, String receiveName,
Date reserveDT, String userID, String title, String originalFAXrequestNum)
throws PopbillException {
Receiver receiver = null;
if ( !receiveNum.isEmpty() || !receiveName.isEmpty() ) {
receiver = new Receiver();
receiver.setReceiveNum(receiveNum);
receiver.setReceiveName(receiveName);
return resendFAXRN(corpNum,requestNum, sendNum, senderName, new Receiver[]{receiver}, reserveDT, userID, title, originalFAXrequestNum);
}
return resendFAXRN(corpNum,requestNum, sendNum, senderName, null, reserveDT, userID, title, originalFAXrequestNum);
} | java | @Override
public String resendFAXRN(String corpNum, String requestNum, String sendNum,
String senderName, String receiveNum, String receiveName,
Date reserveDT, String userID, String title, String originalFAXrequestNum)
throws PopbillException {
Receiver receiver = null;
if ( !receiveNum.isEmpty() || !receiveName.isEmpty() ) {
receiver = new Receiver();
receiver.setReceiveNum(receiveNum);
receiver.setReceiveName(receiveName);
return resendFAXRN(corpNum,requestNum, sendNum, senderName, new Receiver[]{receiver}, reserveDT, userID, title, originalFAXrequestNum);
}
return resendFAXRN(corpNum,requestNum, sendNum, senderName, null, reserveDT, userID, title, originalFAXrequestNum);
} | [
"@",
"Override",
"public",
"String",
"resendFAXRN",
"(",
"String",
"corpNum",
",",
"String",
"requestNum",
",",
"String",
"sendNum",
",",
"String",
"senderName",
",",
"String",
"receiveNum",
",",
"String",
"receiveName",
",",
"Date",
"reserveDT",
",",
"String",
... | /*
(non-Javadoc)
@see com.popbill.api.FaxService#resendFAXRN(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Date, java.lang.String, java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/fax/FaxServiceImp.java#L898-L914 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java | PublicIPAddressesInner.listVirtualMachineScaleSetPublicIPAddressesAsync | public Observable<Page<PublicIPAddressInner>> listVirtualMachineScaleSetPublicIPAddressesAsync(final String resourceGroupName, final String virtualMachineScaleSetName) {
return listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName)
.map(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Page<PublicIPAddressInner>>() {
@Override
public Page<PublicIPAddressInner> call(ServiceResponse<Page<PublicIPAddressInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<PublicIPAddressInner>> listVirtualMachineScaleSetPublicIPAddressesAsync(final String resourceGroupName, final String virtualMachineScaleSetName) {
return listVirtualMachineScaleSetPublicIPAddressesWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName)
.map(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Page<PublicIPAddressInner>>() {
@Override
public Page<PublicIPAddressInner> call(ServiceResponse<Page<PublicIPAddressInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"PublicIPAddressInner",
">",
">",
"listVirtualMachineScaleSetPublicIPAddressesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualMachineScaleSetName",
")",
"{",
"return",
"listVirtualMachineScaleSetPu... | Gets information about all public IP addresses on a virtual machine scale set level.
@param resourceGroupName The name of the resource group.
@param virtualMachineScaleSetName The name of the virtual machine scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<PublicIPAddressInner> object | [
"Gets",
"information",
"about",
"all",
"public",
"IP",
"addresses",
"on",
"a",
"virtual",
"machine",
"scale",
"set",
"level",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L1202-L1210 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.verifySavedMD5 | public static void verifySavedMD5(File dataFile, MD5Hash expectedMD5)
throws IOException {
MD5Hash storedHash = readStoredMd5ForFile(dataFile);
// Check the hash itself
if (!expectedMD5.equals(storedHash)) {
throw new IOException(
"File " + dataFile + " did not match stored MD5 checksum " +
" (stored: " + storedHash + ", computed: " + expectedMD5);
}
} | java | public static void verifySavedMD5(File dataFile, MD5Hash expectedMD5)
throws IOException {
MD5Hash storedHash = readStoredMd5ForFile(dataFile);
// Check the hash itself
if (!expectedMD5.equals(storedHash)) {
throw new IOException(
"File " + dataFile + " did not match stored MD5 checksum " +
" (stored: " + storedHash + ", computed: " + expectedMD5);
}
} | [
"public",
"static",
"void",
"verifySavedMD5",
"(",
"File",
"dataFile",
",",
"MD5Hash",
"expectedMD5",
")",
"throws",
"IOException",
"{",
"MD5Hash",
"storedHash",
"=",
"readStoredMd5ForFile",
"(",
"dataFile",
")",
";",
"// Check the hash itself",
"if",
"(",
"!",
"e... | Verify that the previously saved md5 for the given file matches
expectedMd5.
@throws IOException | [
"Verify",
"that",
"the",
"previously",
"saved",
"md5",
"for",
"the",
"given",
"file",
"matches",
"expectedMd5",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L54-L63 |
apache/flink | flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java | HBaseTableSchema.addColumn | void addColumn(String family, String qualifier, Class<?> clazz) {
Preconditions.checkNotNull(family, "family name");
Preconditions.checkNotNull(qualifier, "qualifier name");
Preconditions.checkNotNull(clazz, "class type");
Map<String, TypeInformation<?>> qualifierMap = this.familyMap.get(family);
if (!HBaseRowInputFormat.isSupportedType(clazz)) {
// throw exception
throw new IllegalArgumentException("Unsupported class type found " + clazz + ". " +
"Better to use byte[].class and deserialize using user defined scalar functions");
}
if (qualifierMap == null) {
qualifierMap = new LinkedHashMap<>();
}
qualifierMap.put(qualifier, TypeExtractor.getForClass(clazz));
familyMap.put(family, qualifierMap);
} | java | void addColumn(String family, String qualifier, Class<?> clazz) {
Preconditions.checkNotNull(family, "family name");
Preconditions.checkNotNull(qualifier, "qualifier name");
Preconditions.checkNotNull(clazz, "class type");
Map<String, TypeInformation<?>> qualifierMap = this.familyMap.get(family);
if (!HBaseRowInputFormat.isSupportedType(clazz)) {
// throw exception
throw new IllegalArgumentException("Unsupported class type found " + clazz + ". " +
"Better to use byte[].class and deserialize using user defined scalar functions");
}
if (qualifierMap == null) {
qualifierMap = new LinkedHashMap<>();
}
qualifierMap.put(qualifier, TypeExtractor.getForClass(clazz));
familyMap.put(family, qualifierMap);
} | [
"void",
"addColumn",
"(",
"String",
"family",
",",
"String",
"qualifier",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"family",
",",
"\"family name\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"quali... | Adds a column defined by family, qualifier, and type to the table schema.
@param family the family name
@param qualifier the qualifier name
@param clazz the data type of the qualifier | [
"Adds",
"a",
"column",
"defined",
"by",
"family",
"qualifier",
"and",
"type",
"to",
"the",
"table",
"schema",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java#L48-L65 |
alkacon/opencms-core | src/org/opencms/gwt/CmsVfsService.java | CmsVfsService.formatDateTime | public static String formatDateTime(CmsObject cms, long date) {
return CmsDateUtil.getDateTime(
new Date(date),
DateFormat.MEDIUM,
OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
} | java | public static String formatDateTime(CmsObject cms, long date) {
return CmsDateUtil.getDateTime(
new Date(date),
DateFormat.MEDIUM,
OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
} | [
"public",
"static",
"String",
"formatDateTime",
"(",
"CmsObject",
"cms",
",",
"long",
"date",
")",
"{",
"return",
"CmsDateUtil",
".",
"getDateTime",
"(",
"new",
"Date",
"(",
"date",
")",
",",
"DateFormat",
".",
"MEDIUM",
",",
"OpenCms",
".",
"getWorkplaceMan... | Formats a date given the current user's workplace locale.<p>
@param cms the current CMS context
@param date the date to format
@return the formatted date | [
"Formats",
"a",
"date",
"given",
"the",
"current",
"user",
"s",
"workplace",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L218-L224 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/UnionFindRemSP.java | UnionFindRemSP.union | @Override
public boolean union(int x, int y) {
int rx = x;
int ry = y;
int px = p[rx];
int py = p[ry];
while (px != py) {
if (px < py) {
if (rx == px) {
p[rx] = py;
return true;
}
p[rx] = py;
rx = px;
px = p[rx];
} else {
if (ry == py) {
p[ry] = px;
return true;
}
p[ry] = px;
ry = py;
py = p[ry];
}
}
return false;
} | java | @Override
public boolean union(int x, int y) {
int rx = x;
int ry = y;
int px = p[rx];
int py = p[ry];
while (px != py) {
if (px < py) {
if (rx == px) {
p[rx] = py;
return true;
}
p[rx] = py;
rx = px;
px = p[rx];
} else {
if (ry == py) {
p[ry] = px;
return true;
}
p[ry] = px;
ry = py;
py = p[ry];
}
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"union",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"rx",
"=",
"x",
";",
"int",
"ry",
"=",
"y",
";",
"int",
"px",
"=",
"p",
"[",
"rx",
"]",
";",
"int",
"py",
"=",
"p",
"[",
"ry",
"]",
";",
"wh... | Unites the sets containing the two given elements.
@param x
the first element
@param y
the second element | [
"Unites",
"the",
"sets",
"containing",
"the",
"two",
"given",
"elements",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/UnionFindRemSP.java#L101-L127 |
apereo/cas | support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/TicketGrantingTicketCheckAction.java | TicketGrantingTicketCheckAction.doExecute | @Override
public Event doExecute(final RequestContext requestContext) {
val tgtId = WebUtils.getTicketGrantingTicketId(requestContext);
if (StringUtils.isBlank(tgtId)) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_NOT_EXISTS);
}
try {
val ticket = this.centralAuthenticationService.getTicket(tgtId, Ticket.class);
if (ticket != null && !ticket.isExpired()) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_VALID);
}
} catch (final AbstractTicketException e) {
LOGGER.trace("Could not retrieve ticket id [{}] from registry.", e.getMessage());
}
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_INVALID);
} | java | @Override
public Event doExecute(final RequestContext requestContext) {
val tgtId = WebUtils.getTicketGrantingTicketId(requestContext);
if (StringUtils.isBlank(tgtId)) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_NOT_EXISTS);
}
try {
val ticket = this.centralAuthenticationService.getTicket(tgtId, Ticket.class);
if (ticket != null && !ticket.isExpired()) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_VALID);
}
} catch (final AbstractTicketException e) {
LOGGER.trace("Could not retrieve ticket id [{}] from registry.", e.getMessage());
}
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_INVALID);
} | [
"@",
"Override",
"public",
"Event",
"doExecute",
"(",
"final",
"RequestContext",
"requestContext",
")",
"{",
"val",
"tgtId",
"=",
"WebUtils",
".",
"getTicketGrantingTicketId",
"(",
"requestContext",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"tgtId... | Determines whether the TGT in the flow request context is valid.
@param requestContext Flow request context.
@return webflow transition to indicate TGT status. | [
"Determines",
"whether",
"the",
"TGT",
"in",
"the",
"flow",
"request",
"context",
"is",
"valid",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/TicketGrantingTicketCheckAction.java#L35-L50 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformApplicationRequest.java | CreatePlatformApplicationRequest.withAttributes | public CreatePlatformApplicationRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public CreatePlatformApplicationRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"CreatePlatformApplicationRequest",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html"
>SetPlatformApplicationAttributes</a>
</p>
@param attributes
For a list of attributes, see <a
href="https://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html"
>SetPlatformApplicationAttributes</a>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"For",
"a",
"list",
"of",
"attributes",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"sns",
"/",
"latest",
"/",
"api",
"/",
"API_SetPlatformApplicationAttributes",
".",
"html",
">",
"SetPl... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformApplicationRequest.java#L196-L199 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java | MyStreamUtils.streamHasText | public static boolean streamHasText(InputStream in, String text) {
final byte[] readBuffer = new byte[8192];
StringBuffer sb = new StringBuffer();
try {
if (in.available() > 0) {
int bytesRead = 0;
while ((bytesRead = in.read(readBuffer)) != -1) {
sb.append(new String(readBuffer, 0, bytesRead));
if (sb.toString().contains(text)) {
sb = null;
return true;
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
} | java | public static boolean streamHasText(InputStream in, String text) {
final byte[] readBuffer = new byte[8192];
StringBuffer sb = new StringBuffer();
try {
if (in.available() > 0) {
int bytesRead = 0;
while ((bytesRead = in.read(readBuffer)) != -1) {
sb.append(new String(readBuffer, 0, bytesRead));
if (sb.toString().contains(text)) {
sb = null;
return true;
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
} | [
"public",
"static",
"boolean",
"streamHasText",
"(",
"InputStream",
"in",
",",
"String",
"text",
")",
"{",
"final",
"byte",
"[",
"]",
"readBuffer",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";"... | Checks if the InputStream have the text
@param in InputStream to read
@param text Text to check
@return whether the inputstream has the text | [
"Checks",
"if",
"the",
"InputStream",
"have",
"the",
"text"
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java#L89-L116 |
alkacon/opencms-core | src/org/opencms/configuration/CmsDefaultUserSettings.java | CmsDefaultUserSettings.addPreference | public void addPreference(
String name,
String value,
String widget,
String widgetConfig,
String niceName,
String description,
String ruleRegex,
String error,
String tab) {
CmsXmlContentProperty prop = new CmsXmlContentProperty(
name,
"string",
widget,
widgetConfig,
ruleRegex,
null,
null,
niceName,
description,
error,
null);
CmsPreferenceData pref = new CmsPreferenceData(name, value, prop, tab);
m_preferenceData.add(pref);
} | java | public void addPreference(
String name,
String value,
String widget,
String widgetConfig,
String niceName,
String description,
String ruleRegex,
String error,
String tab) {
CmsXmlContentProperty prop = new CmsXmlContentProperty(
name,
"string",
widget,
widgetConfig,
ruleRegex,
null,
null,
niceName,
description,
error,
null);
CmsPreferenceData pref = new CmsPreferenceData(name, value, prop, tab);
m_preferenceData.add(pref);
} | [
"public",
"void",
"addPreference",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"widget",
",",
"String",
"widgetConfig",
",",
"String",
"niceName",
",",
"String",
"description",
",",
"String",
"ruleRegex",
",",
"String",
"error",
",",
"String"... | Adds a preference.<p>
@param name the name of the preference
@param value the default value
@param widget the widget to use for the preference
@param widgetConfig the widget configuration
@param niceName the nice name of the preference
@param description the description of the preference
@param ruleRegex the regex used for validation
@param error the validation error message
@param tab the tab to display the preference on | [
"Adds",
"a",
"preference",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsDefaultUserSettings.java#L223-L248 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java | MapColumnFixture.translateFromTable | public static void translateFromTable(Map<String, Object> rowValues, String[][] translationTableWithHeader) {
translateFromTable(rowValues, translationTableWithHeader, 0, 1);
translateFromTable(rowValues, translationTableWithHeader, 1, 0);
} | java | public static void translateFromTable(Map<String, Object> rowValues, String[][] translationTableWithHeader) {
translateFromTable(rowValues, translationTableWithHeader, 0, 1);
translateFromTable(rowValues, translationTableWithHeader, 1, 0);
} | [
"public",
"static",
"void",
"translateFromTable",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"rowValues",
",",
"String",
"[",
"]",
"[",
"]",
"translationTableWithHeader",
")",
"{",
"translateFromTable",
"(",
"rowValues",
",",
"translationTableWithHeader",
",",... | Adds new key/value pairs to rowValues based on table supplied. If value in first column is present,
and there is no value for key of second column, the value in second column is added, and vice versa.
The first row describes the key for each column's values.
@param rowValues row to add values to.
@param translationTableWithHeader table describing equivalent key/value pairs. | [
"Adds",
"new",
"key",
"/",
"value",
"pairs",
"to",
"rowValues",
"based",
"on",
"table",
"supplied",
".",
"If",
"value",
"in",
"first",
"column",
"is",
"present",
"and",
"there",
"is",
"no",
"value",
"for",
"key",
"of",
"second",
"column",
"the",
"value",... | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java#L50-L53 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.errorv | public void errorv(String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, null);
} | java | public void errorv(String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, null);
} | [
"public",
"void",
"errorv",
"(",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLog",
"(",
"Level",
".",
"ERROR",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"null",
")",
";",
"}"
] | Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param params the parameters | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"ERROR",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1564-L1566 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java | BasicBondGenerator.generateBondElement | public IRenderingElement generateBondElement(IBond bond, IBond.Order type, RendererModel model) {
// More than 2 atoms per bond not supported by this module
if (bond.getAtomCount() > 2) return null;
// is object right? if not replace with a good one
Point2d point1 = bond.getBegin().getPoint2d();
Point2d point2 = bond.getEnd().getPoint2d();
Color color = this.getColorForBond(bond, model);
double bondWidth = this.getWidthForBond(bond, model);
double bondDistance = (Double) model.get(BondDistance.class) / model.getParameter(Scale.class).getValue();
if (type == IBond.Order.SINGLE) {
return new LineElement(point1.x, point1.y, point2.x, point2.y, bondWidth, color);
} else {
ElementGroup group = new ElementGroup();
switch (type) {
case DOUBLE:
createLines(point1, point2, bondWidth, bondDistance, color, group);
break;
case TRIPLE:
createLines(point1, point2, bondWidth, bondDistance * 2, color, group);
group.add(new LineElement(point1.x, point1.y, point2.x, point2.y, bondWidth, color));
break;
case QUADRUPLE:
createLines(point1, point2, bondWidth, bondDistance, color, group);
createLines(point1, point2, bondWidth, bondDistance * 4, color, group);
default:
break;
}
return group;
}
} | java | public IRenderingElement generateBondElement(IBond bond, IBond.Order type, RendererModel model) {
// More than 2 atoms per bond not supported by this module
if (bond.getAtomCount() > 2) return null;
// is object right? if not replace with a good one
Point2d point1 = bond.getBegin().getPoint2d();
Point2d point2 = bond.getEnd().getPoint2d();
Color color = this.getColorForBond(bond, model);
double bondWidth = this.getWidthForBond(bond, model);
double bondDistance = (Double) model.get(BondDistance.class) / model.getParameter(Scale.class).getValue();
if (type == IBond.Order.SINGLE) {
return new LineElement(point1.x, point1.y, point2.x, point2.y, bondWidth, color);
} else {
ElementGroup group = new ElementGroup();
switch (type) {
case DOUBLE:
createLines(point1, point2, bondWidth, bondDistance, color, group);
break;
case TRIPLE:
createLines(point1, point2, bondWidth, bondDistance * 2, color, group);
group.add(new LineElement(point1.x, point1.y, point2.x, point2.y, bondWidth, color));
break;
case QUADRUPLE:
createLines(point1, point2, bondWidth, bondDistance, color, group);
createLines(point1, point2, bondWidth, bondDistance * 4, color, group);
default:
break;
}
return group;
}
} | [
"public",
"IRenderingElement",
"generateBondElement",
"(",
"IBond",
"bond",
",",
"IBond",
".",
"Order",
"type",
",",
"RendererModel",
"model",
")",
"{",
"// More than 2 atoms per bond not supported by this module",
"if",
"(",
"bond",
".",
"getAtomCount",
"(",
")",
">"... | Generate a LineElement or an ElementGroup of LineElements for this bond.
This version should be used if you want to override the type - for
example, for ring double bonds.
@param bond the bond to generate for
@param type the type of the bond - single, double, etc
@param model the renderer model
@return one or more rendering elements | [
"Generate",
"a",
"LineElement",
"or",
"an",
"ElementGroup",
"of",
"LineElements",
"for",
"this",
"bond",
".",
"This",
"version",
"should",
"be",
"used",
"if",
"you",
"want",
"to",
"override",
"the",
"type",
"-",
"for",
"example",
"for",
"ring",
"double",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L309-L339 |
teknux-org/jetty-bootstrap | jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java | JettyBootstrap.addWarApp | public WebAppContext addWarApp(String war, String contextPath) throws JettyBootstrapException {
WarAppJettyHandler warAppJettyHandler = new WarAppJettyHandler(getInitializedConfiguration());
warAppJettyHandler.setWar(war);
warAppJettyHandler.setContextPath(contextPath);
WebAppContext webAppContext = warAppJettyHandler.getHandler();
handlers.addHandler(webAppContext);
return webAppContext;
} | java | public WebAppContext addWarApp(String war, String contextPath) throws JettyBootstrapException {
WarAppJettyHandler warAppJettyHandler = new WarAppJettyHandler(getInitializedConfiguration());
warAppJettyHandler.setWar(war);
warAppJettyHandler.setContextPath(contextPath);
WebAppContext webAppContext = warAppJettyHandler.getHandler();
handlers.addHandler(webAppContext);
return webAppContext;
} | [
"public",
"WebAppContext",
"addWarApp",
"(",
"String",
"war",
",",
"String",
"contextPath",
")",
"throws",
"JettyBootstrapException",
"{",
"WarAppJettyHandler",
"warAppJettyHandler",
"=",
"new",
"WarAppJettyHandler",
"(",
"getInitializedConfiguration",
"(",
")",
")",
";... | Add a War application specifying the context path.
@param war
the path to a war file
@param contextPath
the path (base URL) to make the war available
@return WebAppContext
@throws JettyBootstrapException
on failure | [
"Add",
"a",
"War",
"application",
"specifying",
"the",
"context",
"path",
"."
] | train | https://github.com/teknux-org/jetty-bootstrap/blob/c16e710b833084c650fce35aa8c1ccaf83cd93ef/jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java#L248-L257 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.splitBracketsAsUUIDs | @Pure
@Inline(value = "textUtil.splitAsUUIDs('{', '}', $1)", imported = {TextUtil.class})
public static List<UUID> splitBracketsAsUUIDs(String str) {
return splitAsUUIDs('{', '}', str);
} | java | @Pure
@Inline(value = "textUtil.splitAsUUIDs('{', '}', $1)", imported = {TextUtil.class})
public static List<UUID> splitBracketsAsUUIDs(String str) {
return splitAsUUIDs('{', '}', str);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"textUtil.splitAsUUIDs('{', '}', $1)\"",
",",
"imported",
"=",
"{",
"TextUtil",
".",
"class",
"}",
")",
"public",
"static",
"List",
"<",
"UUID",
">",
"splitBracketsAsUUIDs",
"(",
"String",
"str",
")",
"{",
"re... | Split the given string according to brackets.
The brackets are used to delimit the groups
of characters.
<p>Examples:
<ul>
<li><code>splitBrackets("{a}{b}{cd}")</code> returns the array
<code>["a","b","cd"]</code></li>
<li><code>splitBrackets("abcd")</code> returns the array
<code>["abcd"]</code></li>
<li><code>splitBrackets("a{bcd")</code> returns the array
<code>["a","bcd"]</code></li>
</ul>
@param str is the elements enclosed by backets.
@return the groups of strings | [
"Split",
"the",
"given",
"string",
"according",
"to",
"brackets",
".",
"The",
"brackets",
"are",
"used",
"to",
"delimit",
"the",
"groups",
"of",
"characters",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L793-L797 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java | Param.createConstant | @Nonnull
public static <T> Param createConstant (@Nonnull @Nonempty final String sParamName,
@Nonnull final Class <T> aParamClass,
@Nullable final T aDefault)
{
return new Param (sParamName, aParamClass, () -> aDefault);
} | java | @Nonnull
public static <T> Param createConstant (@Nonnull @Nonempty final String sParamName,
@Nonnull final Class <T> aParamClass,
@Nullable final T aDefault)
{
return new Param (sParamName, aParamClass, () -> aDefault);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"Param",
"createConstant",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sParamName",
",",
"@",
"Nonnull",
"final",
"Class",
"<",
"T",
">",
"aParamClass",
",",
"@",
"Nullable",
"final",
"T",
... | Create a {@link Param} with a constant default value.
@param sParamName
Parameter name. May neither be <code>null</code> nor empty.
@param aParamClass
The parameter class. May not be <code>null</code>.
@param aDefault
The constant default value to be used. May be <code>null</code>.
@return The {@link Param} object and never <code>null</code>. | [
"Create",
"a",
"{",
"@link",
"Param",
"}",
"with",
"a",
"constant",
"default",
"value",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java#L143-L149 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java | CommerceShipmentItemPersistenceImpl.findByCommerceShipment | @Override
public List<CommerceShipmentItem> findByCommerceShipment(
long commerceShipmentId, int start, int end) {
return findByCommerceShipment(commerceShipmentId, start, end, null);
} | java | @Override
public List<CommerceShipmentItem> findByCommerceShipment(
long commerceShipmentId, int start, int end) {
return findByCommerceShipment(commerceShipmentId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceShipmentItem",
">",
"findByCommerceShipment",
"(",
"long",
"commerceShipmentId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceShipment",
"(",
"commerceShipmentId",
",",
"start",
",",
"e... | Returns a range of all the commerce shipment items where commerceShipmentId = ?.
<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 CommerceShipmentItemModelImpl}. 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 commerceShipmentId the commerce shipment ID
@param start the lower bound of the range of commerce shipment items
@param end the upper bound of the range of commerce shipment items (not inclusive)
@return the range of matching commerce shipment items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"shipment",
"items",
"where",
"commerceShipmentId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java#L651-L655 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.forceCollectInvoice | public Invoice forceCollectInvoice(final String invoiceId) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/collect", null, Invoice.class);
} | java | public Invoice forceCollectInvoice(final String invoiceId) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/collect", null, Invoice.class);
} | [
"public",
"Invoice",
"forceCollectInvoice",
"(",
"final",
"String",
"invoiceId",
")",
"{",
"return",
"doPUT",
"(",
"Invoices",
".",
"INVOICES_RESOURCE",
"+",
"\"/\"",
"+",
"invoiceId",
"+",
"\"/collect\"",
",",
"null",
",",
"Invoice",
".",
"class",
")",
";",
... | Force collect an invoice
@param invoiceId String Recurly Invoice ID | [
"Force",
"collect",
"an",
"invoice"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1310-L1312 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java | StopWatch.formatThroughput | public String formatThroughput(int theNumOperations, TimeUnit theUnit) {
double throughput = getThroughput(theNumOperations, theUnit);
return new DecimalFormat("0.0").format(throughput);
} | java | public String formatThroughput(int theNumOperations, TimeUnit theUnit) {
double throughput = getThroughput(theNumOperations, theUnit);
return new DecimalFormat("0.0").format(throughput);
} | [
"public",
"String",
"formatThroughput",
"(",
"int",
"theNumOperations",
",",
"TimeUnit",
"theUnit",
")",
"{",
"double",
"throughput",
"=",
"getThroughput",
"(",
"theNumOperations",
",",
"theUnit",
")",
";",
"return",
"new",
"DecimalFormat",
"(",
"\"0.0\"",
")",
... | Determine the current throughput per unit of time (specified in theUnit)
assuming that theNumOperations operations have happened.
<p>
For example, if this stopwatch has 2 seconds elapsed, and this method is
called for theNumOperations=30 and TimeUnit=SECONDS,
this method will return 15
</p>
@see #getThroughput(int, TimeUnit) | [
"Determine",
"the",
"current",
"throughput",
"per",
"unit",
"of",
"time",
"(",
"specified",
"in",
"theUnit",
")",
"assuming",
"that",
"theNumOperations",
"operations",
"have",
"happened",
".",
"<p",
">",
"For",
"example",
"if",
"this",
"stopwatch",
"has",
"2",... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java#L168-L171 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassGraph.java | ClassGraph.scanAsync | public void scanAsync(final ExecutorService executorService, final int numParallelTasks,
final ScanResultProcessor scanResultProcessor, final FailureHandler failureHandler) {
if (scanResultProcessor == null) {
// If scanResultProcessor is null, the scan won't do anything after completion, and the ScanResult will
// simply be lost.
throw new IllegalArgumentException("scanResultProcessor cannot be null");
}
if (failureHandler == null) {
// The result of the Future<ScanObject> object returned by launchAsyncScan is discarded below, so we
// force the addition of a FailureHandler so that exceptions are not silently swallowed.
throw new IllegalArgumentException("failureHandler cannot be null");
}
// Use execute() rather than submit(), since a ScanResultProcessor and FailureHandler are used
executorService.execute(new Runnable() {
@Override
public void run() {
try {
new Scanner(scanSpec, executorService, numParallelTasks, scanResultProcessor, failureHandler,
topLevelLog);
} catch (final InterruptedException e) {
// Interrupted during the Scanner constructor's execution (specifically, by getModuleOrder(),
// which is unlikely to ever actually be interrupted -- but this exception needs to be caught)
failureHandler.onFailure(e);
}
}
});
} | java | public void scanAsync(final ExecutorService executorService, final int numParallelTasks,
final ScanResultProcessor scanResultProcessor, final FailureHandler failureHandler) {
if (scanResultProcessor == null) {
// If scanResultProcessor is null, the scan won't do anything after completion, and the ScanResult will
// simply be lost.
throw new IllegalArgumentException("scanResultProcessor cannot be null");
}
if (failureHandler == null) {
// The result of the Future<ScanObject> object returned by launchAsyncScan is discarded below, so we
// force the addition of a FailureHandler so that exceptions are not silently swallowed.
throw new IllegalArgumentException("failureHandler cannot be null");
}
// Use execute() rather than submit(), since a ScanResultProcessor and FailureHandler are used
executorService.execute(new Runnable() {
@Override
public void run() {
try {
new Scanner(scanSpec, executorService, numParallelTasks, scanResultProcessor, failureHandler,
topLevelLog);
} catch (final InterruptedException e) {
// Interrupted during the Scanner constructor's execution (specifically, by getModuleOrder(),
// which is unlikely to ever actually be interrupted -- but this exception needs to be caught)
failureHandler.onFailure(e);
}
}
});
} | [
"public",
"void",
"scanAsync",
"(",
"final",
"ExecutorService",
"executorService",
",",
"final",
"int",
"numParallelTasks",
",",
"final",
"ScanResultProcessor",
"scanResultProcessor",
",",
"final",
"FailureHandler",
"failureHandler",
")",
"{",
"if",
"(",
"scanResultProc... | Asynchronously scans the classpath, calling a {@link ScanResultProcessor} callback on success or a
{@link FailureHandler} callback on failure.
@param executorService
A custom {@link ExecutorService} to use for scheduling worker tasks.
@param numParallelTasks
The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available.
@param scanResultProcessor
A {@link ScanResultProcessor} callback to run on successful scan.
@param failureHandler
A {@link FailureHandler} callback to run on failed scan. This is passed any {@link Throwable}
thrown during the scan. | [
"Asynchronously",
"scans",
"the",
"classpath",
"calling",
"a",
"{",
"@link",
"ScanResultProcessor",
"}",
"callback",
"on",
"success",
"or",
"a",
"{",
"@link",
"FailureHandler",
"}",
"callback",
"on",
"failure",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassGraph.java#L1080-L1106 |
KyoriPowered/text | api/src/main/java/net/kyori/text/event/ClickEvent.java | ClickEvent.openUrl | public static @NonNull ClickEvent openUrl(final @NonNull String url) {
return new ClickEvent(Action.OPEN_URL, url);
} | java | public static @NonNull ClickEvent openUrl(final @NonNull String url) {
return new ClickEvent(Action.OPEN_URL, url);
} | [
"public",
"static",
"@",
"NonNull",
"ClickEvent",
"openUrl",
"(",
"final",
"@",
"NonNull",
"String",
"url",
")",
"{",
"return",
"new",
"ClickEvent",
"(",
"Action",
".",
"OPEN_URL",
",",
"url",
")",
";",
"}"
] | Creates a click event that opens a url.
@param url the url to open
@return a click event | [
"Creates",
"a",
"click",
"event",
"that",
"opens",
"a",
"url",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L54-L56 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/MCEDependenceMeasure.java | MCEDependenceMeasure.intersectionMatrix | private void intersectionMatrix(int[][] res, ArrayList<int[]> partsx, ArrayList<int[]> partsy, int gridsize) {
for(int x = 0; x < gridsize; x++) {
final int[] px = partsx.get(x);
final int[] rowx = res[x];
for(int y = 0; y < gridsize; y++) {
int[] py = partsy.get(y);
rowx[y] = intersectionSize(px, py);
}
}
} | java | private void intersectionMatrix(int[][] res, ArrayList<int[]> partsx, ArrayList<int[]> partsy, int gridsize) {
for(int x = 0; x < gridsize; x++) {
final int[] px = partsx.get(x);
final int[] rowx = res[x];
for(int y = 0; y < gridsize; y++) {
int[] py = partsy.get(y);
rowx[y] = intersectionSize(px, py);
}
}
} | [
"private",
"void",
"intersectionMatrix",
"(",
"int",
"[",
"]",
"[",
"]",
"res",
",",
"ArrayList",
"<",
"int",
"[",
"]",
">",
"partsx",
",",
"ArrayList",
"<",
"int",
"[",
"]",
">",
"partsy",
",",
"int",
"gridsize",
")",
"{",
"for",
"(",
"int",
"x",
... | Intersect the two 1d grid decompositions, to obtain a 2d matrix.
@param res Output matrix to fill
@param partsx Partitions in first component
@param partsy Partitions in second component.
@param gridsize Size of partition decomposition | [
"Intersect",
"the",
"two",
"1d",
"grid",
"decompositions",
"to",
"obtain",
"a",
"2d",
"matrix",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/MCEDependenceMeasure.java#L173-L182 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java | ServerAdvisorsInner.listByServerAsync | public Observable<AdvisorListResultInner> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() {
@Override
public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) {
return response.body();
}
});
} | java | public Observable<AdvisorListResultInner> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() {
@Override
public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AdvisorListResultInner",
">",
"listByServerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(... | Gets a list of server advisors.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AdvisorListResultInner object | [
"Gets",
"a",
"list",
"of",
"server",
"advisors",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java#L111-L118 |
graphql-java/graphql-java | src/main/java/graphql/execution/ExecutionStrategy.java | ExecutionStrategy.completeValueForList | protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Object result) {
Iterable<Object> resultIterable = toIterable(executionContext, parameters, result);
try {
resultIterable = parameters.getNonNullFieldValidator().validate(parameters.getPath(), resultIterable);
} catch (NonNullableFieldWasNullException e) {
return FieldValueInfo.newFieldValueInfo(LIST).fieldValue(exceptionallyCompletedFuture(e)).build();
}
if (resultIterable == null) {
return FieldValueInfo.newFieldValueInfo(LIST).fieldValue(completedFuture(new ExecutionResultImpl(null, null))).build();
}
return completeValueForList(executionContext, parameters, resultIterable);
} | java | protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Object result) {
Iterable<Object> resultIterable = toIterable(executionContext, parameters, result);
try {
resultIterable = parameters.getNonNullFieldValidator().validate(parameters.getPath(), resultIterable);
} catch (NonNullableFieldWasNullException e) {
return FieldValueInfo.newFieldValueInfo(LIST).fieldValue(exceptionallyCompletedFuture(e)).build();
}
if (resultIterable == null) {
return FieldValueInfo.newFieldValueInfo(LIST).fieldValue(completedFuture(new ExecutionResultImpl(null, null))).build();
}
return completeValueForList(executionContext, parameters, resultIterable);
} | [
"protected",
"FieldValueInfo",
"completeValueForList",
"(",
"ExecutionContext",
"executionContext",
",",
"ExecutionStrategyParameters",
"parameters",
",",
"Object",
"result",
")",
"{",
"Iterable",
"<",
"Object",
">",
"resultIterable",
"=",
"toIterable",
"(",
"executionCon... | Called to complete a list of value for a field based on a list type. This iterates the values and calls
{@link #completeValue(ExecutionContext, ExecutionStrategyParameters)} for each value.
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@param result the result to complete, raw result
@return a {@link FieldValueInfo} | [
"Called",
"to",
"complete",
"a",
"list",
"of",
"value",
"for",
"a",
"field",
"based",
"on",
"a",
"list",
"type",
".",
"This",
"iterates",
"the",
"values",
"and",
"calls",
"{",
"@link",
"#completeValue",
"(",
"ExecutionContext",
"ExecutionStrategyParameters",
"... | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L462-L473 |
infinispan/infinispan | query/src/main/java/org/infinispan/query/impl/LifecycleManager.java | LifecycleManager.unregisterQueryMBeans | private void unregisterQueryMBeans(ComponentRegistry cr, String cacheName) {
if (mbeanServer != null) {
try {
InfinispanQueryStatisticsInfo stats = cr.getComponent(InfinispanQueryStatisticsInfo.class);
if (stats != null) {
GlobalJmxStatisticsConfiguration jmxConfig = cr.getGlobalComponentRegistry().getGlobalConfiguration().globalJmxStatistics();
String queryGroupName = getQueryGroupName(jmxConfig.cacheManagerName(), cacheName);
String queryMBeanFilter = stats.getObjectName().getDomain() + ":" + queryGroupName + ",*";
JmxUtil.unregisterMBeans(queryMBeanFilter, mbeanServer);
}
} catch (Exception e) {
throw new CacheException("Unable to unregister query MBeans", e);
}
}
} | java | private void unregisterQueryMBeans(ComponentRegistry cr, String cacheName) {
if (mbeanServer != null) {
try {
InfinispanQueryStatisticsInfo stats = cr.getComponent(InfinispanQueryStatisticsInfo.class);
if (stats != null) {
GlobalJmxStatisticsConfiguration jmxConfig = cr.getGlobalComponentRegistry().getGlobalConfiguration().globalJmxStatistics();
String queryGroupName = getQueryGroupName(jmxConfig.cacheManagerName(), cacheName);
String queryMBeanFilter = stats.getObjectName().getDomain() + ":" + queryGroupName + ",*";
JmxUtil.unregisterMBeans(queryMBeanFilter, mbeanServer);
}
} catch (Exception e) {
throw new CacheException("Unable to unregister query MBeans", e);
}
}
} | [
"private",
"void",
"unregisterQueryMBeans",
"(",
"ComponentRegistry",
"cr",
",",
"String",
"cacheName",
")",
"{",
"if",
"(",
"mbeanServer",
"!=",
"null",
")",
"{",
"try",
"{",
"InfinispanQueryStatisticsInfo",
"stats",
"=",
"cr",
".",
"getComponent",
"(",
"Infini... | Unregister query related MBeans for a cache, primarily the statistics, but also all other MBeans from the same
related group. | [
"Unregister",
"query",
"related",
"MBeans",
"for",
"a",
"cache",
"primarily",
"the",
"statistics",
"but",
"also",
"all",
"other",
"MBeans",
"from",
"the",
"same",
"related",
"group",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java#L426-L440 |
samskivert/samskivert | src/main/java/com/samskivert/velocity/DispatcherServlet.java | DispatcherServlet.selectTemplate | protected Template selectTemplate (int siteId, InvocationContext ctx)
throws ResourceNotFoundException, ParseErrorException, Exception
{
String path = ctx.getRequest().getServletPath();
if (_usingSiteLoading) {
// if we're using site resource loading, we need to prefix the path with the site
// identifier
path = siteId + ":" + path;
}
// log.info("Loading template", "path", path);
return RuntimeSingleton.getTemplate(path);
} | java | protected Template selectTemplate (int siteId, InvocationContext ctx)
throws ResourceNotFoundException, ParseErrorException, Exception
{
String path = ctx.getRequest().getServletPath();
if (_usingSiteLoading) {
// if we're using site resource loading, we need to prefix the path with the site
// identifier
path = siteId + ":" + path;
}
// log.info("Loading template", "path", path);
return RuntimeSingleton.getTemplate(path);
} | [
"protected",
"Template",
"selectTemplate",
"(",
"int",
"siteId",
",",
"InvocationContext",
"ctx",
")",
"throws",
"ResourceNotFoundException",
",",
"ParseErrorException",
",",
"Exception",
"{",
"String",
"path",
"=",
"ctx",
".",
"getRequest",
"(",
")",
".",
"getSer... | This method is called to select the appropriate template for this request. The default
implementation simply loads the template using Velocity's default template loading services
based on the URI provided in the request.
@param ctx The context of this request.
@return The template to be used in generating the response. | [
"This",
"method",
"is",
"called",
"to",
"select",
"the",
"appropriate",
"template",
"for",
"this",
"request",
".",
"The",
"default",
"implementation",
"simply",
"loads",
"the",
"template",
"using",
"Velocity",
"s",
"default",
"template",
"loading",
"services",
"... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/DispatcherServlet.java#L504-L515 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/location.java | location.getLocationByCoordinates | public static LocationModel getLocationByCoordinates(Double latitude, Double longitude ){
try {
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(QuickUtils.getContext());
addresses = geocoder.getFromLocation(latitude, longitude, 1);
LocationModel locationModel = new LocationModel();
locationModel.latitude = latitude;
locationModel.longitude = longitude;
try{
locationModel.address = addresses.get(0).getAddressLine(0);
}catch(Exception ex){
QuickUtils.log.e("empty address");
}
try{
locationModel.city = addresses.get(0).getAddressLine(1);
}catch(Exception ex){
QuickUtils.log.e("empty city");
}
try{
locationModel.country = addresses.get(0).getAddressLine(2);
}catch(Exception ex){
QuickUtils.log.e("empty country");
}
return locationModel;
} catch (IOException e) {
QuickUtils.log.e("empty location");
return new LocationModel();
}
} | java | public static LocationModel getLocationByCoordinates(Double latitude, Double longitude ){
try {
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(QuickUtils.getContext());
addresses = geocoder.getFromLocation(latitude, longitude, 1);
LocationModel locationModel = new LocationModel();
locationModel.latitude = latitude;
locationModel.longitude = longitude;
try{
locationModel.address = addresses.get(0).getAddressLine(0);
}catch(Exception ex){
QuickUtils.log.e("empty address");
}
try{
locationModel.city = addresses.get(0).getAddressLine(1);
}catch(Exception ex){
QuickUtils.log.e("empty city");
}
try{
locationModel.country = addresses.get(0).getAddressLine(2);
}catch(Exception ex){
QuickUtils.log.e("empty country");
}
return locationModel;
} catch (IOException e) {
QuickUtils.log.e("empty location");
return new LocationModel();
}
} | [
"public",
"static",
"LocationModel",
"getLocationByCoordinates",
"(",
"Double",
"latitude",
",",
"Double",
"longitude",
")",
"{",
"try",
"{",
"Geocoder",
"geocoder",
";",
"List",
"<",
"Address",
">",
"addresses",
";",
"geocoder",
"=",
"new",
"Geocoder",
"(",
"... | Gets the location by Coordinates
@param latitude
@param longitude
@return Location model | [
"Gets",
"the",
"location",
"by",
"Coordinates"
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/location.java#L24-L55 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/math/SloppyMath.java | SloppyMath.exactBinomial | public static double exactBinomial(int k, int n, double p) {
double total = 0.0;
for (int m = k; m <= n; m++) {
double nChooseM = 1.0;
for (int r = 1; r <= m; r++) {
nChooseM *= (n - r) + 1;
nChooseM /= r;
}
// System.out.println(n + " choose " + m + " is " + nChooseM);
// System.out.println("prob contribution is " +
// (nChooseM * Math.pow(p, m) * Math.pow(1.0-p, n - m)));
total += nChooseM * Math.pow(p, m) * Math.pow(1.0 - p, n - m);
}
return total;
} | java | public static double exactBinomial(int k, int n, double p) {
double total = 0.0;
for (int m = k; m <= n; m++) {
double nChooseM = 1.0;
for (int r = 1; r <= m; r++) {
nChooseM *= (n - r) + 1;
nChooseM /= r;
}
// System.out.println(n + " choose " + m + " is " + nChooseM);
// System.out.println("prob contribution is " +
// (nChooseM * Math.pow(p, m) * Math.pow(1.0-p, n - m)));
total += nChooseM * Math.pow(p, m) * Math.pow(1.0 - p, n - m);
}
return total;
} | [
"public",
"static",
"double",
"exactBinomial",
"(",
"int",
"k",
",",
"int",
"n",
",",
"double",
"p",
")",
"{",
"double",
"total",
"=",
"0.0",
";",
"for",
"(",
"int",
"m",
"=",
"k",
";",
"m",
"<=",
"n",
";",
"m",
"++",
")",
"{",
"double",
"nChoo... | Find a one tailed exact binomial test probability. Finds the chance
of this or a higher result
@param k number of successes
@param n Number of trials
@param p Probability of a success | [
"Find",
"a",
"one",
"tailed",
"exact",
"binomial",
"test",
"probability",
".",
"Finds",
"the",
"chance",
"of",
"this",
"or",
"a",
"higher",
"result"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L509-L523 |
OSSIndex/heuristic-version | src/main/java/net/ossindex/version/impl/SemanticVersion.java | SemanticVersion.getPrevVersion | public SemanticVersion getPrevVersion() {
int major = head.getMajorVersion();
int minor = head.getMinorVersion();
int patch = head.getPatchVersion();
if (patch > 0) {
return new SemanticVersion(major, minor, patch - 1);
}
if (minor > 0) {
return new SemanticVersion(major, minor - 1, 999);
}
if (major > 0) {
return new SemanticVersion(major - 1, 999, 999);
}
return new SemanticVersion(0, 0, 0);
} | java | public SemanticVersion getPrevVersion() {
int major = head.getMajorVersion();
int minor = head.getMinorVersion();
int patch = head.getPatchVersion();
if (patch > 0) {
return new SemanticVersion(major, minor, patch - 1);
}
if (minor > 0) {
return new SemanticVersion(major, minor - 1, 999);
}
if (major > 0) {
return new SemanticVersion(major - 1, 999, 999);
}
return new SemanticVersion(0, 0, 0);
} | [
"public",
"SemanticVersion",
"getPrevVersion",
"(",
")",
"{",
"int",
"major",
"=",
"head",
".",
"getMajorVersion",
"(",
")",
";",
"int",
"minor",
"=",
"head",
".",
"getMinorVersion",
"(",
")",
";",
"int",
"patch",
"=",
"head",
".",
"getPatchVersion",
"(",
... | Get the prev logical version in line. For example:
1.2.3 becomes 1.2.2
This gets ugly if we underflow, cause we don't know what the top patch version
for the lower minor version could be. | [
"Get",
"the",
"prev",
"logical",
"version",
"in",
"line",
".",
"For",
"example",
":"
] | train | https://github.com/OSSIndex/heuristic-version/blob/9fe33a49d74acec54ddb91de9a3c3cd2f98fba40/src/main/java/net/ossindex/version/impl/SemanticVersion.java#L293-L307 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/tiles/UrlTileGenerator.java | UrlTileGenerator.replaceBoundingBox | private String replaceBoundingBox(String url, BoundingBox boundingBox) {
url = url.replaceAll(MIN_LAT_VARIABLE,
String.valueOf(boundingBox.getMinLatitude()));
url = url.replaceAll(MAX_LAT_VARIABLE,
String.valueOf(boundingBox.getMaxLatitude()));
url = url.replaceAll(MIN_LON_VARIABLE,
String.valueOf(boundingBox.getMinLongitude()));
url = url.replaceAll(MAX_LON_VARIABLE,
String.valueOf(boundingBox.getMaxLongitude()));
return url;
} | java | private String replaceBoundingBox(String url, BoundingBox boundingBox) {
url = url.replaceAll(MIN_LAT_VARIABLE,
String.valueOf(boundingBox.getMinLatitude()));
url = url.replaceAll(MAX_LAT_VARIABLE,
String.valueOf(boundingBox.getMaxLatitude()));
url = url.replaceAll(MIN_LON_VARIABLE,
String.valueOf(boundingBox.getMinLongitude()));
url = url.replaceAll(MAX_LON_VARIABLE,
String.valueOf(boundingBox.getMaxLongitude()));
return url;
} | [
"private",
"String",
"replaceBoundingBox",
"(",
"String",
"url",
",",
"BoundingBox",
"boundingBox",
")",
"{",
"url",
"=",
"url",
".",
"replaceAll",
"(",
"MIN_LAT_VARIABLE",
",",
"String",
".",
"valueOf",
"(",
"boundingBox",
".",
"getMinLatitude",
"(",
")",
")"... | Replace the url parts with the bounding box
@param url
@param boundingBox
@return | [
"Replace",
"the",
"url",
"parts",
"with",
"the",
"bounding",
"box"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/UrlTileGenerator.java#L276-L288 |
jamesagnew/hapi-fhir | hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/IdType.java | IdType.withServerBase | @Override
public IdType withServerBase(String theServerBase, String theResourceType) {
return new IdType(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
} | java | @Override
public IdType withServerBase(String theServerBase, String theResourceType) {
return new IdType(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
} | [
"@",
"Override",
"public",
"IdType",
"withServerBase",
"(",
"String",
"theServerBase",
",",
"String",
"theResourceType",
")",
"{",
"return",
"new",
"IdType",
"(",
"theServerBase",
",",
"theResourceType",
",",
"getIdPart",
"(",
")",
",",
"getVersionIdPart",
"(",
... | Returns a view of this ID as a fully qualified URL, given a server base and
resource name (which will only be used if the ID does not already contain
those respective parts). Essentially, because IdType can contain either a
complete URL or a partial one (or even jut a simple ID), this method may be
used to translate into a complete URL.
@param theServerBase
The server base (e.g. "http://example.com/fhir")
@param theResourceType
The resource name (e.g. "Patient")
@return A fully qualified URL for this ID (e.g.
"http://example.com/fhir/Patient/1") | [
"Returns",
"a",
"view",
"of",
"this",
"ID",
"as",
"a",
"fully",
"qualified",
"URL",
"given",
"a",
"server",
"base",
"and",
"resource",
"name",
"(",
"which",
"will",
"only",
"be",
"used",
"if",
"the",
"ID",
"does",
"not",
"already",
"contain",
"those",
... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/IdType.java#L668-L671 |
baratine/baratine | web/src/main/java/com/caucho/v5/util/CharCursor.java | CharCursor.regionMatchesIgnoreCase | public boolean regionMatchesIgnoreCase(char []cb, int offset, int length)
{
int pos = getIndex();
char ch = current();
for (int i = 0; i < length; i++) {
if (ch == DONE) {
setIndex(pos);
return false;
}
if (Character.toLowerCase(cb[i + offset]) != Character.toLowerCase(ch)) {
setIndex(pos);
return false;
}
ch = next();
}
return true;
} | java | public boolean regionMatchesIgnoreCase(char []cb, int offset, int length)
{
int pos = getIndex();
char ch = current();
for (int i = 0; i < length; i++) {
if (ch == DONE) {
setIndex(pos);
return false;
}
if (Character.toLowerCase(cb[i + offset]) != Character.toLowerCase(ch)) {
setIndex(pos);
return false;
}
ch = next();
}
return true;
} | [
"public",
"boolean",
"regionMatchesIgnoreCase",
"(",
"char",
"[",
"]",
"cb",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"pos",
"=",
"getIndex",
"(",
")",
";",
"char",
"ch",
"=",
"current",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=... | True if the cursor matches the character buffer
If match fails, return the pointer to its original. | [
"True",
"if",
"the",
"cursor",
"matches",
"the",
"character",
"buffer"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/util/CharCursor.java#L145-L165 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/xmlrpc/client/XmlRpcClientExecutorFactory.java | XmlRpcClientExecutorFactory.newExecutor | public static XmlRpcClientExecutor newExecutor(String url) throws XmlRpcClientExecutorException {
try {
LOGGER.debug("Instanciating new executor for url {} ", url);
return new XmlRpcV2ClientImpl(url);
} catch (Exception ex) {
throw new XmlRpcClientExecutorException(GreenPepperServerErrorKey.GENERAL_ERROR, ex);
}
} | java | public static XmlRpcClientExecutor newExecutor(String url) throws XmlRpcClientExecutorException {
try {
LOGGER.debug("Instanciating new executor for url {} ", url);
return new XmlRpcV2ClientImpl(url);
} catch (Exception ex) {
throw new XmlRpcClientExecutorException(GreenPepperServerErrorKey.GENERAL_ERROR, ex);
}
} | [
"public",
"static",
"XmlRpcClientExecutor",
"newExecutor",
"(",
"String",
"url",
")",
"throws",
"XmlRpcClientExecutorException",
"{",
"try",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Instanciating new executor for url {} \"",
",",
"url",
")",
";",
"return",
"new",
"XmlRpcV... | <p>newExecutor.</p>
@param url a {@link java.lang.String} object.
@return a {@link com.greenpepper.server.rpc.xmlrpc.client.XmlRpcClientExecutor} object.
@throws com.greenpepper.server.rpc.xmlrpc.client.XmlRpcClientExecutorException if any. | [
"<p",
">",
"newExecutor",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/xmlrpc/client/XmlRpcClientExecutorFactory.java#L41-L49 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.removePrincipals | public DatabasePrincipalListResultInner removePrincipals(String resourceGroupName, String clusterName, String databaseName) {
return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body();
} | java | public DatabasePrincipalListResultInner removePrincipals(String resourceGroupName, String clusterName, String databaseName) {
return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body();
} | [
"public",
"DatabasePrincipalListResultInner",
"removePrincipals",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
")",
"{",
"return",
"removePrincipalsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
","... | Remove Database principals permissions.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DatabasePrincipalListResultInner object if successful. | [
"Remove",
"Database",
"principals",
"permissions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L1234-L1236 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java | CronUtils.shrinkRepeating | private static String shrinkRepeating(String e, String min) {
String[] parts = e.split(",");
for (int i = 0; i < parts.length; ++i) {
int indSlash = parts[i].indexOf('/');
int indDash = parts[i].indexOf('-');
if (indSlash >= 0 && indDash == -1) {
if (parts[i].indexOf('*') >= 0) {
parts[i] = parts[i].substring(indSlash);
} else {
parts[i] = parts[i].substring(0, indSlash);
}
}
}
return concat(',', parts);
} | java | private static String shrinkRepeating(String e, String min) {
String[] parts = e.split(",");
for (int i = 0; i < parts.length; ++i) {
int indSlash = parts[i].indexOf('/');
int indDash = parts[i].indexOf('-');
if (indSlash >= 0 && indDash == -1) {
if (parts[i].indexOf('*') >= 0) {
parts[i] = parts[i].substring(indSlash);
} else {
parts[i] = parts[i].substring(0, indSlash);
}
}
}
return concat(',', parts);
} | [
"private",
"static",
"String",
"shrinkRepeating",
"(",
"String",
"e",
",",
"String",
"min",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"e",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"len... | Converts repeating segments from "extended" SauronSoftware to "short"
Quartz form form. For example "0-59/5" will be converted to
"0/5", "/3" will be converted to "*/3"
@param e Source item
@param max Maximal value in this item ("59" for minutes, "23" for hours, etc.)
@return Modified string | [
"Converts",
"repeating",
"segments",
"from",
"extended",
"SauronSoftware",
"to",
"short",
"Quartz",
"form",
"form",
".",
"For",
"example",
""",
";",
"0",
"-",
"59",
"/",
"5"",
";",
"will",
"be",
"converted",
"to",
""",
";",
"0",
"/",
"5"",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java#L222-L236 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLocalizationPersistenceImpl.java | CPDefinitionLocalizationPersistenceImpl.findAll | @Override
public List<CPDefinitionLocalization> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPDefinitionLocalization> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionLocalization",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definition localizations.
<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 CPDefinitionLocalizationModelImpl}. 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 start the lower bound of the range of cp definition localizations
@param end the upper bound of the range of cp definition localizations (not inclusive)
@return the range of cp definition localizations | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"localizations",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLocalizationPersistenceImpl.java#L1436-L1439 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/SpiUtil.java | SpiUtil.getFileParameterValue | private static String getFileParameterValue(FaxJob faxJob)
{
String value=null;
File file=faxJob.getFile();
if(file!=null)
{
try
{
//read file (only text files supported)
value=IOHelper.readTextFile(faxJob.getFile());
}
catch(IOException exception)
{
throw new FaxException("Error while reading file.",exception);
}
}
return value;
} | java | private static String getFileParameterValue(FaxJob faxJob)
{
String value=null;
File file=faxJob.getFile();
if(file!=null)
{
try
{
//read file (only text files supported)
value=IOHelper.readTextFile(faxJob.getFile());
}
catch(IOException exception)
{
throw new FaxException("Error while reading file.",exception);
}
}
return value;
} | [
"private",
"static",
"String",
"getFileParameterValue",
"(",
"FaxJob",
"faxJob",
")",
"{",
"String",
"value",
"=",
"null",
";",
"File",
"file",
"=",
"faxJob",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"try",
"{",
"//read... | This function returns the file parameter value based on the file
content.
@param faxJob
The fax job object
@return The file parameter value | [
"This",
"function",
"returns",
"the",
"file",
"parameter",
"value",
"based",
"on",
"the",
"file",
"content",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/SpiUtil.java#L261-L279 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java | ToStringStyle.appendDetail | protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) {
buffer.append(coll);
} | java | protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) {
buffer.append(coll);
} | [
"protected",
"void",
"appendDetail",
"(",
"final",
"StringBuffer",
"buffer",
",",
"final",
"String",
"fieldName",
",",
"final",
"Collection",
"<",
"?",
">",
"coll",
")",
"{",
"buffer",
".",
"append",
"(",
"coll",
")",
";",
"}"
] | <p>Append to the <code>toString</code> a <code>Collection</code>.</p>
@param buffer the <code>StringBuffer</code> to populate
@param fieldName the field name, typically not used as already appended
@param coll the <code>Collection</code> to add to the
<code>toString</code>, not <code>null</code> | [
"<p",
">",
"Append",
"to",
"the",
"<code",
">",
"toString<",
"/",
"code",
">",
"a",
"<code",
">",
"Collection<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java#L637-L639 |
treasure-data/td-client-java | src/main/java/com/treasuredata/client/TDHttpClient.java | TDHttpClient.call | public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Class<Result> resultType)
throws TDClientException
{
return call(apiRequest, apiKeyCache, objectMapper.getTypeFactory().constructType(resultType));
} | java | public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Class<Result> resultType)
throws TDClientException
{
return call(apiRequest, apiKeyCache, objectMapper.getTypeFactory().constructType(resultType));
} | [
"public",
"<",
"Result",
">",
"Result",
"call",
"(",
"TDApiRequest",
"apiRequest",
",",
"Optional",
"<",
"String",
">",
"apiKeyCache",
",",
"final",
"Class",
"<",
"Result",
">",
"resultType",
")",
"throws",
"TDClientException",
"{",
"return",
"call",
"(",
"a... | Submit an API request, and bind the returned JSON data into an object of the given result type.
For mapping it uses Jackson object mapper.
@param apiRequest
@param resultType
@param <Result>
@return
@throws TDClientException | [
"Submit",
"an",
"API",
"request",
"and",
"bind",
"the",
"returned",
"JSON",
"data",
"into",
"an",
"object",
"of",
"the",
"given",
"result",
"type",
".",
"For",
"mapping",
"it",
"uses",
"Jackson",
"object",
"mapper",
"."
] | train | https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L514-L518 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.createBean | protected @Nonnull <T> T createBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
ArgumentUtils.requireNonNull("beanType", beanType);
Optional<BeanDefinition<T>> concreteCandidate = findConcreteCandidate(beanType, qualifier, true, false);
if (concreteCandidate.isPresent()) {
BeanDefinition<T> candidate = concreteCandidate.get();
if (resolutionContext == null) {
resolutionContext = new DefaultBeanResolutionContext(this, candidate);
}
T createBean = doCreateBean(resolutionContext, candidate, qualifier, false, null);
if (createBean == null) {
throw new NoSuchBeanException(beanType);
}
return createBean;
}
throw new NoSuchBeanException(beanType);
} | java | protected @Nonnull <T> T createBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
ArgumentUtils.requireNonNull("beanType", beanType);
Optional<BeanDefinition<T>> concreteCandidate = findConcreteCandidate(beanType, qualifier, true, false);
if (concreteCandidate.isPresent()) {
BeanDefinition<T> candidate = concreteCandidate.get();
if (resolutionContext == null) {
resolutionContext = new DefaultBeanResolutionContext(this, candidate);
}
T createBean = doCreateBean(resolutionContext, candidate, qualifier, false, null);
if (createBean == null) {
throw new NoSuchBeanException(beanType);
}
return createBean;
}
throw new NoSuchBeanException(beanType);
} | [
"protected",
"@",
"Nonnull",
"<",
"T",
">",
"T",
"createBean",
"(",
"@",
"Nullable",
"BeanResolutionContext",
"resolutionContext",
",",
"@",
"Nonnull",
"Class",
"<",
"T",
">",
"beanType",
",",
"@",
"Nullable",
"Qualifier",
"<",
"T",
">",
"qualifier",
")",
... | Creates a bean.
@param resolutionContext The bean resolution context
@param beanType The bean type
@param qualifier The qualifier
@param <T> The bean generic type
@return The instance | [
"Creates",
"a",
"bean",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L804-L820 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java | RedBlackTreeLong.contains | @Override
public boolean contains(long value, T element) {
if (root == null) return false;
if (value < first.value) return false;
if (value > last.value) return false;
if (value == first.value && ObjectUtil.equalsOrNull(element, first.element)) return true;
if (value == last.value && ObjectUtil.equalsOrNull(element, last.element)) return true;
return contains(root, value, element);
} | java | @Override
public boolean contains(long value, T element) {
if (root == null) return false;
if (value < first.value) return false;
if (value > last.value) return false;
if (value == first.value && ObjectUtil.equalsOrNull(element, first.element)) return true;
if (value == last.value && ObjectUtil.equalsOrNull(element, last.element)) return true;
return contains(root, value, element);
} | [
"@",
"Override",
"public",
"boolean",
"contains",
"(",
"long",
"value",
",",
"T",
"element",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"value",
"<",
"first",
".",
"value",
")",
"return",
"false",
";",
"if",
... | Returns true if the given key exists in the tree and its associated value is the given element.
Comparison of the element is using the equals method. | [
"Returns",
"true",
"if",
"the",
"given",
"key",
"exists",
"in",
"the",
"tree",
"and",
"its",
"associated",
"value",
"is",
"the",
"given",
"element",
".",
"Comparison",
"of",
"the",
"element",
"is",
"using",
"the",
"equals",
"method",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java#L224-L232 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/VariableMapperWrapper.java | VariableMapperWrapper.resolveVariable | public ValueExpression resolveVariable(String variable)
{
ValueExpression ve = null;
try
{
if (_vars != null)
{
ve = (ValueExpression) _vars.get(variable);
// Is this code in a block that wants to cache
// the resulting expression(s) and variable has been resolved?
if (_trackResolveVariables && ve != null)
{
_variableResolved = true;
}
}
if (ve == null)
{
return _target.resolveVariable(variable);
}
return ve;
}
catch (StackOverflowError e)
{
throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
}
} | java | public ValueExpression resolveVariable(String variable)
{
ValueExpression ve = null;
try
{
if (_vars != null)
{
ve = (ValueExpression) _vars.get(variable);
// Is this code in a block that wants to cache
// the resulting expression(s) and variable has been resolved?
if (_trackResolveVariables && ve != null)
{
_variableResolved = true;
}
}
if (ve == null)
{
return _target.resolveVariable(variable);
}
return ve;
}
catch (StackOverflowError e)
{
throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
}
} | [
"public",
"ValueExpression",
"resolveVariable",
"(",
"String",
"variable",
")",
"{",
"ValueExpression",
"ve",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"_vars",
"!=",
"null",
")",
"{",
"ve",
"=",
"(",
"ValueExpression",
")",
"_vars",
".",
"get",
"(",
"var... | First tries to resolve agains the inner Map, then the wrapped ValueExpression.
@see javax.el.VariableMapper#resolveVariable(java.lang.String) | [
"First",
"tries",
"to",
"resolve",
"agains",
"the",
"inner",
"Map",
"then",
"the",
"wrapped",
"ValueExpression",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/VariableMapperWrapper.java#L70-L98 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/Files.java | Files.readBytes | @CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readBytes(File file, ByteProcessor<T> processor) throws IOException {
return asByteSource(file).read(processor);
} | java | @CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readBytes(File file, ByteProcessor<T> processor) throws IOException {
return asByteSource(file).read(processor);
} | [
"@",
"CanIgnoreReturnValue",
"// some processors won't return a useful result",
"public",
"static",
"<",
"T",
">",
"T",
"readBytes",
"(",
"File",
"file",
",",
"ByteProcessor",
"<",
"T",
">",
"processor",
")",
"throws",
"IOException",
"{",
"return",
"asByteSource",
"... | Process the bytes of a file.
<p>(If this seems too complicated, maybe you're looking for {@link #toByteArray}.)
@param file the file to read
@param processor the object to which the bytes of the file are passed.
@return the result of the byte processor
@throws IOException if an I/O error occurs | [
"Process",
"the",
"bytes",
"of",
"a",
"file",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L566-L569 |
fernandospr/java-wns | src/main/java/ar/com/fernandospr/wns/WnsService.java | WnsService.pushTile | public WnsNotificationResponse pushTile(String channelUri, WnsNotificationRequestOptional optional, WnsTile tile) throws WnsException {
return this.client.push(xmlResourceBuilder, channelUri, tile, this.retryPolicy, optional);
} | java | public WnsNotificationResponse pushTile(String channelUri, WnsNotificationRequestOptional optional, WnsTile tile) throws WnsException {
return this.client.push(xmlResourceBuilder, channelUri, tile, this.retryPolicy, optional);
} | [
"public",
"WnsNotificationResponse",
"pushTile",
"(",
"String",
"channelUri",
",",
"WnsNotificationRequestOptional",
"optional",
",",
"WnsTile",
"tile",
")",
"throws",
"WnsException",
"{",
"return",
"this",
".",
"client",
".",
"push",
"(",
"xmlResourceBuilder",
",",
... | Pushes a tile to channelUri using optional headers
@param channelUri
@param optional
@param tile which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsTileBuilder}
@return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a>
@throws WnsException when authentication fails | [
"Pushes",
"a",
"tile",
"to",
"channelUri",
"using",
"optional",
"headers"
] | train | https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L88-L90 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/models/stream/PendingParser.java | PendingParser.parseRange | @SuppressWarnings("unchecked")
public static List<PendingMessage> parseRange(List<?> xpendingOutput) {
LettuceAssert.notNull(xpendingOutput, "XPENDING output must not be null");
List<PendingMessage> result = new ArrayList<>();
for (Object element : xpendingOutput) {
LettuceAssert.isTrue(element instanceof List, "Output elements must be a List");
List<Object> message = (List) element;
String messageId = (String) message.get(0);
String consumer = (String) message.get(1);
Long msSinceLastDelivery = (Long) message.get(2);
Long deliveryCount = (Long) message.get(3);
result.add(new PendingMessage(messageId, consumer, msSinceLastDelivery, deliveryCount));
}
return result;
} | java | @SuppressWarnings("unchecked")
public static List<PendingMessage> parseRange(List<?> xpendingOutput) {
LettuceAssert.notNull(xpendingOutput, "XPENDING output must not be null");
List<PendingMessage> result = new ArrayList<>();
for (Object element : xpendingOutput) {
LettuceAssert.isTrue(element instanceof List, "Output elements must be a List");
List<Object> message = (List) element;
String messageId = (String) message.get(0);
String consumer = (String) message.get(1);
Long msSinceLastDelivery = (Long) message.get(2);
Long deliveryCount = (Long) message.get(3);
result.add(new PendingMessage(messageId, consumer, msSinceLastDelivery, deliveryCount));
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"PendingMessage",
">",
"parseRange",
"(",
"List",
"<",
"?",
">",
"xpendingOutput",
")",
"{",
"LettuceAssert",
".",
"notNull",
"(",
"xpendingOutput",
",",
"\"XPENDING output must n... | Parse the output of the Redis {@literal XPENDING} command with {@link Range}.
@param xpendingOutput output of the Redis {@literal XPENDING}.
@return list of {@link PendingMessage}s. | [
"Parse",
"the",
"output",
"of",
"the",
"Redis",
"{",
"@literal",
"XPENDING",
"}",
"command",
"with",
"{",
"@link",
"Range",
"}",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/models/stream/PendingParser.java#L43-L65 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java | ContainerKeyCache.includeExistingKey | long includeExistingKey(long segmentId, UUID keyHash, long segmentOffset) {
SegmentKeyCache cache;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache));
}
return cache.includeExistingKey(keyHash, segmentOffset, generation);
} | java | long includeExistingKey(long segmentId, UUID keyHash, long segmentOffset) {
SegmentKeyCache cache;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache));
}
return cache.includeExistingKey(keyHash, segmentOffset, generation);
} | [
"long",
"includeExistingKey",
"(",
"long",
"segmentId",
",",
"UUID",
"keyHash",
",",
"long",
"segmentOffset",
")",
"{",
"SegmentKeyCache",
"cache",
";",
"int",
"generation",
";",
"synchronized",
"(",
"this",
".",
"segmentCaches",
")",
"{",
"generation",
"=",
"... | Updates the contents of a Cache Entry associated with the given Segment Id and KeyHash. This method cannot be
used to remove values.
This method should be used for processing existing keys (that have already been indexed), as opposed from processing
new (un-indexed) keys.
@param segmentId The Segment Id.
@param keyHash A UUID representing the Key Hash to look up.
@param segmentOffset The segment offset where this Key has its latest value.
@return Either segmentOffset, or the offset which contains the most up-to-date information about this KeyHash.
If this value does not equal segmentOffset, it means some other concurrent update changed this value, and that
value prevailed. This value could be negative (see segmentOffset doc). | [
"Updates",
"the",
"contents",
"of",
"a",
"Cache",
"Entry",
"associated",
"with",
"the",
"given",
"Segment",
"Id",
"and",
"KeyHash",
".",
"This",
"method",
"cannot",
"be",
"used",
"to",
"remove",
"values",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L154-L163 |
casmi/casmi | src/main/java/casmi/graphics/element/Arc.java | Arc.setEdgeColor | public void setEdgeColor(Color color) {
if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0);
setGradation(true);
this.edgeColor = color;
} | java | public void setEdgeColor(Color color) {
if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0);
setGradation(true);
this.edgeColor = color;
} | [
"public",
"void",
"setEdgeColor",
"(",
"Color",
"color",
")",
"{",
"if",
"(",
"edgeColor",
"==",
"null",
")",
"edgeColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"setGradation",
"(",
"true",
")",
";",
"this",
".",
"edge... | Sets the color of the edge of this Arc.
@param color The color of the edge of the Arc. | [
"Sets",
"the",
"color",
"of",
"the",
"edge",
"of",
"this",
"Arc",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Arc.java#L436-L440 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Join.java | Join.crossJoin | @NonNull
public static Join crossJoin(@NonNull DataSource datasource) {
if (datasource == null) {
throw new IllegalArgumentException("datasource cannot be null.");
}
return new Join(Type.CROSS, datasource);
} | java | @NonNull
public static Join crossJoin(@NonNull DataSource datasource) {
if (datasource == null) {
throw new IllegalArgumentException("datasource cannot be null.");
}
return new Join(Type.CROSS, datasource);
} | [
"@",
"NonNull",
"public",
"static",
"Join",
"crossJoin",
"(",
"@",
"NonNull",
"DataSource",
"datasource",
")",
"{",
"if",
"(",
"datasource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"datasource cannot be null.\"",
")",
";",
"}",... | Create an CROSS JOIN component with the given data source.
Use the returned On component to specify join conditions.
@param datasource The DataSource object of the JOIN clause.
@return The Join object used for specifying join conditions. | [
"Create",
"an",
"CROSS",
"JOIN",
"component",
"with",
"the",
"given",
"data",
"source",
".",
"Use",
"the",
"returned",
"On",
"component",
"to",
"specify",
"join",
"conditions",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Join.java#L154-L160 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java | Ui.modulateColorAlpha | public static int modulateColorAlpha(int color, int alpha) {
int colorAlpha = color >>> 24;
int scale = alpha + (alpha >> 7);
int newAlpha = colorAlpha * scale >> 8;
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
return newAlpha << 24 | r << 16 | g << 8 | b;
} | java | public static int modulateColorAlpha(int color, int alpha) {
int colorAlpha = color >>> 24;
int scale = alpha + (alpha >> 7);
int newAlpha = colorAlpha * scale >> 8;
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
return newAlpha << 24 | r << 16 | g << 8 | b;
} | [
"public",
"static",
"int",
"modulateColorAlpha",
"(",
"int",
"color",
",",
"int",
"alpha",
")",
"{",
"int",
"colorAlpha",
"=",
"color",
">>>",
"24",
";",
"int",
"scale",
"=",
"alpha",
"+",
"(",
"alpha",
">>",
"7",
")",
";",
"int",
"newAlpha",
"=",
"c... | Modulate the color to new alpha
@param color Color
@param alpha Modulate alpha
@return Modulate alpha color | [
"Modulate",
"the",
"color",
"to",
"new",
"alpha"
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java#L106-L114 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java | GenJsCodeVisitorAssistantForMsgs.getMessageFormatCall | private static Expression getMessageFormatCall(GoogMsgCodeGenInfo codeGenInfo) {
return construct(GOOG_I18N_MESSAGE_FORMAT, codeGenInfo.googMsgVar)
.dotAccess("formatIgnoringPound")
.call(codeGenInfo.placeholders);
} | java | private static Expression getMessageFormatCall(GoogMsgCodeGenInfo codeGenInfo) {
return construct(GOOG_I18N_MESSAGE_FORMAT, codeGenInfo.googMsgVar)
.dotAccess("formatIgnoringPound")
.call(codeGenInfo.placeholders);
} | [
"private",
"static",
"Expression",
"getMessageFormatCall",
"(",
"GoogMsgCodeGenInfo",
"codeGenInfo",
")",
"{",
"return",
"construct",
"(",
"GOOG_I18N_MESSAGE_FORMAT",
",",
"codeGenInfo",
".",
"googMsgVar",
")",
".",
"dotAccess",
"(",
"\"formatIgnoringPound\"",
")",
".",... | Generates the {@code goog.i18n.MessageFormat} postprocessing call for a child plural/select
message. | [
"Generates",
"the",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java#L375-L379 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagBundle.java | CmsJspTagBundle.getLocalizationContext | public static LocalizationContext getLocalizationContext(PageContext pc, String basename) {
LocalizationContext locCtxt = null;
ResourceBundle bundle = null;
if ((basename == null) || basename.equals("")) {
return new LocalizationContext();
}
// Try preferred locales
Locale pref = getLocale(pc, javax.servlet.jsp.jstl.core.Config.FMT_LOCALE);
if (pref != null) {
// Preferred locale is application-based
bundle = findMatch(basename, pref);
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, pref);
}
}
if (locCtxt == null) {
// No match found with preferred locales, try using fallback locale
locCtxt = BundleSupport.getLocalizationContext(pc, basename);
} else {
// set response locale
if (locCtxt.getLocale() != null) {
setResponseLocale(pc, locCtxt.getLocale());
}
}
return locCtxt;
} | java | public static LocalizationContext getLocalizationContext(PageContext pc, String basename) {
LocalizationContext locCtxt = null;
ResourceBundle bundle = null;
if ((basename == null) || basename.equals("")) {
return new LocalizationContext();
}
// Try preferred locales
Locale pref = getLocale(pc, javax.servlet.jsp.jstl.core.Config.FMT_LOCALE);
if (pref != null) {
// Preferred locale is application-based
bundle = findMatch(basename, pref);
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, pref);
}
}
if (locCtxt == null) {
// No match found with preferred locales, try using fallback locale
locCtxt = BundleSupport.getLocalizationContext(pc, basename);
} else {
// set response locale
if (locCtxt.getLocale() != null) {
setResponseLocale(pc, locCtxt.getLocale());
}
}
return locCtxt;
} | [
"public",
"static",
"LocalizationContext",
"getLocalizationContext",
"(",
"PageContext",
"pc",
",",
"String",
"basename",
")",
"{",
"LocalizationContext",
"locCtxt",
"=",
"null",
";",
"ResourceBundle",
"bundle",
"=",
"null",
";",
"if",
"(",
"(",
"basename",
"==",
... | Returns the initialized localization context.<p>
@param pc the current page context
@param basename the bas name of the bundle
@return the initialized localization context | [
"Returns",
"the",
"initialized",
"localization",
"context",
".",
"<p",
">",
"@param",
"pc",
"the",
"current",
"page",
"context",
"@param",
"basename",
"the",
"bas",
"name",
"of",
"the",
"bundle"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagBundle.java#L85-L115 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.transformAffine | public Vector4d transformAffine(double x, double y, double z, double w, Vector4d dest) {
double rx = m00 * x + m10 * y + m20 * z + m30 * w;
double ry = m01 * x + m11 * y + m21 * z + m31 * w;
double rz = m02 * x + m12 * y + m22 * z + m32 * w;
dest.x = rx;
dest.y = ry;
dest.z = rz;
dest.w = w;
return dest;
} | java | public Vector4d transformAffine(double x, double y, double z, double w, Vector4d dest) {
double rx = m00 * x + m10 * y + m20 * z + m30 * w;
double ry = m01 * x + m11 * y + m21 * z + m31 * w;
double rz = m02 * x + m12 * y + m22 * z + m32 * w;
dest.x = rx;
dest.y = ry;
dest.z = rz;
dest.w = w;
return dest;
} | [
"public",
"Vector4d",
"transformAffine",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
",",
"double",
"w",
",",
"Vector4d",
"dest",
")",
"{",
"double",
"rx",
"=",
"m00",
"*",
"x",
"+",
"m10",
"*",
"y",
"+",
"m20",
"*",
"z",
"+",
"m3... | /* (non-Javadoc)
@see org.joml.Matrix4dc#transformAffine(double, double, double, double, org.joml.Vector4d) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4265-L4274 |
facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java | OneSidedPentomino.initializePieces | protected void initializePieces() {
pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation));
pieces.add(new Piece("v", "x /x /xxx", false, fourRotations));
pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations));
pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations));
pieces.add(new Piece("u", "x x/xxx", false, fourRotations));
pieces.add(new Piece("i", "xxxxx", false, twoRotations));
pieces.add(new Piece("f", " xx/xx / x ", false, fourRotations));
pieces.add(new Piece("p", "xx/xx/x ", false, fourRotations));
pieces.add(new Piece("z", "xx / x / xx", false, twoRotations));
pieces.add(new Piece("n", "xx / xxx", false, fourRotations));
pieces.add(new Piece("y", " x /xxxx", false, fourRotations));
pieces.add(new Piece("l", " x/xxxx", false, fourRotations));
pieces.add(new Piece("F", "xx / xx/ x ", false, fourRotations));
pieces.add(new Piece("P", "xx/xx/ x", false, fourRotations));
pieces.add(new Piece("Z", " xx/ x /xx ", false, twoRotations));
pieces.add(new Piece("N", " xx/xxx ", false, fourRotations));
pieces.add(new Piece("Y", " x /xxxx", false, fourRotations));
pieces.add(new Piece("L", "x /xxxx", false, fourRotations));
} | java | protected void initializePieces() {
pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation));
pieces.add(new Piece("v", "x /x /xxx", false, fourRotations));
pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations));
pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations));
pieces.add(new Piece("u", "x x/xxx", false, fourRotations));
pieces.add(new Piece("i", "xxxxx", false, twoRotations));
pieces.add(new Piece("f", " xx/xx / x ", false, fourRotations));
pieces.add(new Piece("p", "xx/xx/x ", false, fourRotations));
pieces.add(new Piece("z", "xx / x / xx", false, twoRotations));
pieces.add(new Piece("n", "xx / xxx", false, fourRotations));
pieces.add(new Piece("y", " x /xxxx", false, fourRotations));
pieces.add(new Piece("l", " x/xxxx", false, fourRotations));
pieces.add(new Piece("F", "xx / xx/ x ", false, fourRotations));
pieces.add(new Piece("P", "xx/xx/ x", false, fourRotations));
pieces.add(new Piece("Z", " xx/ x /xx ", false, twoRotations));
pieces.add(new Piece("N", " xx/xxx ", false, fourRotations));
pieces.add(new Piece("Y", " x /xxxx", false, fourRotations));
pieces.add(new Piece("L", "x /xxxx", false, fourRotations));
} | [
"protected",
"void",
"initializePieces",
"(",
")",
"{",
"pieces",
".",
"add",
"(",
"new",
"Piece",
"(",
"\"x\"",
",",
"\" x /xxx/ x \"",
",",
"false",
",",
"oneRotation",
")",
")",
";",
"pieces",
".",
"add",
"(",
"new",
"Piece",
"(",
"\"v\"",
",",
"\"x... | Define the one sided pieces. The flipped pieces have the same name with
a capital letter. | [
"Define",
"the",
"one",
"sided",
"pieces",
".",
"The",
"flipped",
"pieces",
"have",
"the",
"same",
"name",
"with",
"a",
"capital",
"letter",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java#L39-L58 |
square/dagger | compiler/src/main/java/dagger/internal/codegen/Util.java | Util.injectableType | public static TypeName injectableType(TypeMirror type) {
return type.accept(new SimpleTypeVisitor6<TypeName, Void>() {
@Override public TypeName visitPrimitive(PrimitiveType primitiveType, Void v) {
return box(primitiveType);
}
@Override public TypeName visitError(ErrorType errorType, Void v) {
// Error type found, a type may not yet have been generated, but we need the type
// so we can generate the correct code in anticipation of the type being available
// to the compiler.
// Paramterized types which don't exist are returned as an error type whose name is "<any>"
if ("<any>".equals(errorType.toString())) {
throw new CodeGenerationIncompleteException(
"Type reported as <any> is likely a not-yet generated parameterized type.");
}
return ClassName.bestGuess(errorType.toString());
}
@Override protected TypeName defaultAction(TypeMirror typeMirror, Void v) {
return TypeName.get(typeMirror);
}
}, null);
} | java | public static TypeName injectableType(TypeMirror type) {
return type.accept(new SimpleTypeVisitor6<TypeName, Void>() {
@Override public TypeName visitPrimitive(PrimitiveType primitiveType, Void v) {
return box(primitiveType);
}
@Override public TypeName visitError(ErrorType errorType, Void v) {
// Error type found, a type may not yet have been generated, but we need the type
// so we can generate the correct code in anticipation of the type being available
// to the compiler.
// Paramterized types which don't exist are returned as an error type whose name is "<any>"
if ("<any>".equals(errorType.toString())) {
throw new CodeGenerationIncompleteException(
"Type reported as <any> is likely a not-yet generated parameterized type.");
}
return ClassName.bestGuess(errorType.toString());
}
@Override protected TypeName defaultAction(TypeMirror typeMirror, Void v) {
return TypeName.get(typeMirror);
}
}, null);
} | [
"public",
"static",
"TypeName",
"injectableType",
"(",
"TypeMirror",
"type",
")",
"{",
"return",
"type",
".",
"accept",
"(",
"new",
"SimpleTypeVisitor6",
"<",
"TypeName",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"TypeName",
"visitPrimitive",... | Returns a string for {@code type}. Primitive types are always boxed. | [
"Returns",
"a",
"string",
"for",
"{"
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/Util.java#L182-L206 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.improperUseOfTheParameter | public static void improperUseOfTheParameter(String conversionName,String xmlPath,String className){
throw new XmlConversionParameterException(MSG.INSTANCE.message(xmlConversionParameterException,conversionName,xmlPath,className));
} | java | public static void improperUseOfTheParameter(String conversionName,String xmlPath,String className){
throw new XmlConversionParameterException(MSG.INSTANCE.message(xmlConversionParameterException,conversionName,xmlPath,className));
} | [
"public",
"static",
"void",
"improperUseOfTheParameter",
"(",
"String",
"conversionName",
",",
"String",
"xmlPath",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"XmlConversionParameterException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"xmlConvers... | Thrown if the use of the parameters is incorrect.
@param conversionName conversion name
@param xmlPath xml path
@param className class name | [
"Thrown",
"if",
"the",
"use",
"of",
"the",
"parameters",
"is",
"incorrect",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L347-L349 |
jamesagnew/hapi-fhir | hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java | FhirServerImpl.unregisterOsgiProvider | @Override
public void unregisterOsgiProvider (Object provider) throws FhirConfigurationException {
if (null == provider) {
throw new NullPointerException("FHIR Provider cannot be null");
}
try {
this.serverProviders.remove(provider);
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
super.unregisterProvider(provider);
} catch (Exception e) {
log.error("Error unregistering FHIR Provider", e);
throw new FhirConfigurationException("Error unregistering FHIR Provider", e);
}
} | java | @Override
public void unregisterOsgiProvider (Object provider) throws FhirConfigurationException {
if (null == provider) {
throw new NullPointerException("FHIR Provider cannot be null");
}
try {
this.serverProviders.remove(provider);
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
super.unregisterProvider(provider);
} catch (Exception e) {
log.error("Error unregistering FHIR Provider", e);
throw new FhirConfigurationException("Error unregistering FHIR Provider", e);
}
} | [
"@",
"Override",
"public",
"void",
"unregisterOsgiProvider",
"(",
"Object",
"provider",
")",
"throws",
"FhirConfigurationException",
"{",
"if",
"(",
"null",
"==",
"provider",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"FHIR Provider cannot be null\"",
")... | Dynamically unregisters a single provider with the RestfulServer
@param provider the provider to be unregistered
@throws FhirConfigurationException | [
"Dynamically",
"unregisters",
"a",
"single",
"provider",
"with",
"the",
"RestfulServer"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java#L81-L94 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.beginCreateOrUpdateAsync | public Observable<AppServiceEnvironmentResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceEnvironmentResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceEnvironmentResourceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServiceEnvironmentResourceInner",
"hostingEnvironmentEnvelope",
")",
"{",
"return",
"beginCreateOrUpdateWithServ... | Create or update an App Service Environment.
Create or update an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param hostingEnvironmentEnvelope Configuration details of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AppServiceEnvironmentResourceInner object | [
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
".",
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L796-L803 |
RestComm/sip-servlets | containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java | ConvergedServletContextImpl.invokeMethod | private Object invokeMethod(ServletContextImpl appContext, final String methodName, Object[] params) throws Throwable {
try {
Method method = objectCache.get(methodName);
if (method == null) {
method = appContext.getClass().getMethod(methodName, classCache.get(methodName));
objectCache.put(methodName, method);
}
return executeMethod(method, appContext, params);
} catch (Exception ex) {
handleException(ex);
return null;
} finally {
params = null;
}
} | java | private Object invokeMethod(ServletContextImpl appContext, final String methodName, Object[] params) throws Throwable {
try {
Method method = objectCache.get(methodName);
if (method == null) {
method = appContext.getClass().getMethod(methodName, classCache.get(methodName));
objectCache.put(methodName, method);
}
return executeMethod(method, appContext, params);
} catch (Exception ex) {
handleException(ex);
return null;
} finally {
params = null;
}
} | [
"private",
"Object",
"invokeMethod",
"(",
"ServletContextImpl",
"appContext",
",",
"final",
"String",
"methodName",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"Throwable",
"{",
"try",
"{",
"Method",
"method",
"=",
"objectCache",
".",
"get",
"(",
"method... | Use reflection to invoke the requested method. Cache the method object to speed up the process
@param appContext The AppliationContext object on which the method will be invoked
@param methodName The method to call.
@param params The arguments passed to the called method. | [
"Use",
"reflection",
"to",
"invoke",
"the",
"requested",
"method",
".",
"Cache",
"the",
"method",
"object",
"to",
"speed",
"up",
"the",
"process"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java#L809-L825 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoProcessingBase.java | StereoProcessingBase.setImages | public void setImages( T leftImage , T rightImage ) {
this.imageLeftInput = leftImage;
this.imageRightInput = rightImage;
// rectify input images
distortLeftRect.apply(imageLeftInput, imageLeftRect);
distortRightRect.apply(imageRightInput, imageRightRect);
} | java | public void setImages( T leftImage , T rightImage ) {
this.imageLeftInput = leftImage;
this.imageRightInput = rightImage;
// rectify input images
distortLeftRect.apply(imageLeftInput, imageLeftRect);
distortRightRect.apply(imageRightInput, imageRightRect);
} | [
"public",
"void",
"setImages",
"(",
"T",
"leftImage",
",",
"T",
"rightImage",
")",
"{",
"this",
".",
"imageLeftInput",
"=",
"leftImage",
";",
"this",
".",
"imageRightInput",
"=",
"rightImage",
";",
"// rectify input images",
"distortLeftRect",
".",
"apply",
"(",... | Sets the input images. Processing is delayed until {@link #initialize()} has been called.
@param leftImage Left image
@param rightImage Right image | [
"Sets",
"the",
"input",
"images",
".",
"Processing",
"is",
"delayed",
"until",
"{",
"@link",
"#initialize",
"()",
"}",
"has",
"been",
"called",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoProcessingBase.java#L163-L170 |
jbundle/jbundle | thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java | BaseMessageFilter.setFilterMap | public final void setFilterMap(Map<String, Object> propFilter)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, null, propFilter); // Update any remote copy of this.
} | java | public final void setFilterMap(Map<String, Object> propFilter)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, null, propFilter); // Update any remote copy of this.
} | [
"public",
"final",
"void",
"setFilterMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"propFilter",
")",
"{",
"if",
"(",
"this",
".",
"getMessageReceiver",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getMessageReceiver",
"(",
")",
".",
"setNewFilterProp... | Update the remote filter with this new map information.
@param propFilter New filter information (ie, bookmark=345). | [
"Update",
"the",
"remote",
"filter",
"with",
"this",
"new",
"map",
"information",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L478-L482 |
schallee/alib4j | core/src/main/java/net/darkmist/alib/str/CharSequenceUtil.java | CharSequenceUtil.indexOf | public static int indexOf(CharSequence str, char ch)
{
for(int i=0; i<str.length(); i++)
if(str.charAt(i) == ch)
return i;
return -1;
} | java | public static int indexOf(CharSequence str, char ch)
{
for(int i=0; i<str.length(); i++)
if(str.charAt(i) == ch)
return i;
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"CharSequence",
"str",
",",
"char",
"ch",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"str",
".",
"charAt",
"(",
"i",
")... | Find index of first occurance of a character. This is different
from {@link String#indexOf(String)} in that it works on
{@link CharSequence}s and looks for a single character
instead of a string.
@param str haystack
@param ch needle
@return position of needle in haystack or -1 if not found. | [
"Find",
"index",
"of",
"first",
"occurance",
"of",
"a",
"character",
".",
"This",
"is",
"different",
"from",
"{"
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/str/CharSequenceUtil.java#L82-L88 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/StringUtils.java | StringUtils.startsWith | public static boolean startsWith(String str, char prefix) {
return (str != null && !str.isEmpty() && (str.charAt(0) == prefix));
} | java | public static boolean startsWith(String str, char prefix) {
return (str != null && !str.isEmpty() && (str.charAt(0) == prefix));
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"String",
"str",
",",
"char",
"prefix",
")",
"{",
"return",
"(",
"str",
"!=",
"null",
"&&",
"!",
"str",
".",
"isEmpty",
"(",
")",
"&&",
"(",
"str",
".",
"charAt",
"(",
"0",
")",
"==",
"prefix",
")",... | Test if the given {@code String} starts with the specified prefix character.
@param str the {@code String} to check
@param prefix the prefix character to look for
@return true if the string starts with the specified prefix; otherwise false
@see java.lang.String#startsWith | [
"Test",
"if",
"the",
"given",
"{",
"@code",
"String",
"}",
"starts",
"with",
"the",
"specified",
"prefix",
"character",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L329-L331 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/util/URIUtils.java | URIUtils.isAllowed | private static boolean isAllowed(char c, String allow) {
return (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c >= '0' && c <= '9')
|| "_-!.~'()*".indexOf(c) != NOT_FOUND
|| (allow != null && allow.indexOf(c) != NOT_FOUND);
} | java | private static boolean isAllowed(char c, String allow) {
return (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c >= '0' && c <= '9')
|| "_-!.~'()*".indexOf(c) != NOT_FOUND
|| (allow != null && allow.indexOf(c) != NOT_FOUND);
} | [
"private",
"static",
"boolean",
"isAllowed",
"(",
"char",
"c",
",",
"String",
"allow",
")",
"{",
"return",
"(",
"c",
">=",
"'",
"'",
"&&",
"c",
"<=",
"'",
"'",
")",
"||",
"(",
"c",
">=",
"'",
"'",
"&&",
"c",
"<=",
"'",
"'",
")",
"||",
"(",
... | Returns true if the given character is allowed.
@param c character to check
@param allow characters to allow
@return true if the character is allowed or false if it should be
encoded | [
"Returns",
"true",
"if",
"the",
"given",
"character",
"is",
"allowed",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/util/URIUtils.java#L170-L176 |
landawn/AbacusUtil | src/com/landawn/abacus/hash/HashCode.java | HashCode.writeBytesTo | public int writeBytesTo(byte[] dest, int offset, int maxLength) {
maxLength = N.min(maxLength, bits() / 8);
Util.checkPositionIndexes(offset, offset + maxLength, dest.length);
writeBytesToImpl(dest, offset, maxLength);
return maxLength;
} | java | public int writeBytesTo(byte[] dest, int offset, int maxLength) {
maxLength = N.min(maxLength, bits() / 8);
Util.checkPositionIndexes(offset, offset + maxLength, dest.length);
writeBytesToImpl(dest, offset, maxLength);
return maxLength;
} | [
"public",
"int",
"writeBytesTo",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
",",
"int",
"maxLength",
")",
"{",
"maxLength",
"=",
"N",
".",
"min",
"(",
"maxLength",
",",
"bits",
"(",
")",
"/",
"8",
")",
";",
"Util",
".",
"checkPositionIndexe... | Copies bytes from this hash code into {@code dest}.
@param dest the byte array into which the hash code will be written
@param offset the start offset in the data
@param maxLength the maximum number of bytes to write
@return the number of bytes written to {@code dest}
@throws IndexOutOfBoundsException if there is not enough room in {@code dest} | [
"Copies",
"bytes",
"from",
"this",
"hash",
"code",
"into",
"{",
"@code",
"dest",
"}",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/hash/HashCode.java#L83-L88 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addConstraintsMinMessage | public FessMessages addConstraintsMinMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_Min_MESSAGE, value));
return this;
} | java | public FessMessages addConstraintsMinMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_Min_MESSAGE, value));
return this;
} | [
"public",
"FessMessages",
"addConstraintsMinMessage",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"CONSTRAINTS_Min_MESSAGE",
",",
"value",
... | Add the created action message for the key 'constraints.Min.message' with parameters.
<pre>
message: {item} must be greater than or equal to {value}.
</pre>
@param property The property name for the message. (NotNull)
@param value The parameter value for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"constraints",
".",
"Min",
".",
"message",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"{",
"item",
"}",
"must",
"be",
"greater",
"than",
"or",
"equal",
"to",
"{",
"value",
... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L711-L715 |
Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java | GrpcServerBuilder.keepAliveTime | public GrpcServerBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit) {
mNettyServerBuilder = mNettyServerBuilder.keepAliveTime(keepAliveTime, timeUnit);
return this;
} | java | public GrpcServerBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit) {
mNettyServerBuilder = mNettyServerBuilder.keepAliveTime(keepAliveTime, timeUnit);
return this;
} | [
"public",
"GrpcServerBuilder",
"keepAliveTime",
"(",
"long",
"keepAliveTime",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"mNettyServerBuilder",
"=",
"mNettyServerBuilder",
".",
"keepAliveTime",
"(",
"keepAliveTime",
",",
"timeUnit",
")",
";",
"return",
"this",
";",
"}"
... | Sets the keep alive time.
@param keepAliveTime the time to wait after idle before pinging client
@param timeUnit unit of the time
@return an updated instance of this {@link GrpcServerBuilder} | [
"Sets",
"the",
"keep",
"alive",
"time",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java#L122-L125 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/Instant.java | Instant.plus | private Instant plus(long secondsToAdd, long nanosToAdd) {
if ((secondsToAdd | nanosToAdd) == 0) {
return this;
}
long epochSec = Jdk8Methods.safeAdd(seconds, secondsToAdd);
epochSec = Jdk8Methods.safeAdd(epochSec, nanosToAdd / NANOS_PER_SECOND);
nanosToAdd = nanosToAdd % NANOS_PER_SECOND;
long nanoAdjustment = nanos + nanosToAdd; // safe int+NANOS_PER_SECOND
return ofEpochSecond(epochSec, nanoAdjustment);
} | java | private Instant plus(long secondsToAdd, long nanosToAdd) {
if ((secondsToAdd | nanosToAdd) == 0) {
return this;
}
long epochSec = Jdk8Methods.safeAdd(seconds, secondsToAdd);
epochSec = Jdk8Methods.safeAdd(epochSec, nanosToAdd / NANOS_PER_SECOND);
nanosToAdd = nanosToAdd % NANOS_PER_SECOND;
long nanoAdjustment = nanos + nanosToAdd; // safe int+NANOS_PER_SECOND
return ofEpochSecond(epochSec, nanoAdjustment);
} | [
"private",
"Instant",
"plus",
"(",
"long",
"secondsToAdd",
",",
"long",
"nanosToAdd",
")",
"{",
"if",
"(",
"(",
"secondsToAdd",
"|",
"nanosToAdd",
")",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"long",
"epochSec",
"=",
"Jdk8Methods",
".",
"safeAdd... | Returns a copy of this instant with the specified duration added.
<p>
This instance is immutable and unaffected by this method call.
@param secondsToAdd the seconds to add, positive or negative
@param nanosToAdd the nanos to add, positive or negative
@return an {@code Instant} based on this instant with the specified seconds added, not null
@throws DateTimeException if the result exceeds the maximum or minimum instant
@throws ArithmeticException if numeric overflow occurs | [
"Returns",
"a",
"copy",
"of",
"this",
"instant",
"with",
"the",
"specified",
"duration",
"added",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Instant.java#L781-L790 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.composeThroughMask | public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) {
int x = src.getMinX();
int y = src.getMinY();
int w = src.getWidth();
int h = src.getHeight();
int srcRGB[] = null;
int selRGB[] = null;
int dstRGB[] = null;
for ( int i = 0; i < h; i++ ) {
srcRGB = src.getPixels(x, y, w, 1, srcRGB);
selRGB = sel.getPixels(x, y, w, 1, selRGB);
dstRGB = dst.getPixels(x, y, w, 1, dstRGB);
int k = x;
for ( int j = 0; j < w; j++ ) {
int sr = srcRGB[k];
int dir = dstRGB[k];
int sg = srcRGB[k+1];
int dig = dstRGB[k+1];
int sb = srcRGB[k+2];
int dib = dstRGB[k+2];
int sa = srcRGB[k+3];
int dia = dstRGB[k+3];
float a = selRGB[k+3]/255f;
float ac = 1-a;
dstRGB[k] = (int)(a*sr + ac*dir);
dstRGB[k+1] = (int)(a*sg + ac*dig);
dstRGB[k+2] = (int)(a*sb + ac*dib);
dstRGB[k+3] = (int)(a*sa + ac*dia);
k += 4;
}
dst.setPixels(x, y, w, 1, dstRGB);
y++;
}
} | java | public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) {
int x = src.getMinX();
int y = src.getMinY();
int w = src.getWidth();
int h = src.getHeight();
int srcRGB[] = null;
int selRGB[] = null;
int dstRGB[] = null;
for ( int i = 0; i < h; i++ ) {
srcRGB = src.getPixels(x, y, w, 1, srcRGB);
selRGB = sel.getPixels(x, y, w, 1, selRGB);
dstRGB = dst.getPixels(x, y, w, 1, dstRGB);
int k = x;
for ( int j = 0; j < w; j++ ) {
int sr = srcRGB[k];
int dir = dstRGB[k];
int sg = srcRGB[k+1];
int dig = dstRGB[k+1];
int sb = srcRGB[k+2];
int dib = dstRGB[k+2];
int sa = srcRGB[k+3];
int dia = dstRGB[k+3];
float a = selRGB[k+3]/255f;
float ac = 1-a;
dstRGB[k] = (int)(a*sr + ac*dir);
dstRGB[k+1] = (int)(a*sg + ac*dig);
dstRGB[k+2] = (int)(a*sb + ac*dib);
dstRGB[k+3] = (int)(a*sa + ac*dia);
k += 4;
}
dst.setPixels(x, y, w, 1, dstRGB);
y++;
}
} | [
"public",
"static",
"void",
"composeThroughMask",
"(",
"Raster",
"src",
",",
"WritableRaster",
"dst",
",",
"Raster",
"sel",
")",
"{",
"int",
"x",
"=",
"src",
".",
"getMinX",
"(",
")",
";",
"int",
"y",
"=",
"src",
".",
"getMinY",
"(",
")",
";",
"int",... | Compose src onto dst using the alpha of sel to interpolate between the two.
I can't think of a way to do this using AlphaComposite.
@param src the source raster
@param dst the destination raster
@param sel the mask raster | [
"Compose",
"src",
"onto",
"dst",
"using",
"the",
"alpha",
"of",
"sel",
"to",
"interpolate",
"between",
"the",
"two",
".",
"I",
"can",
"t",
"think",
"of",
"a",
"way",
"to",
"do",
"this",
"using",
"AlphaComposite",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L208-L247 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/CmsListCollectorEditor.java | CmsListCollectorEditor.openEditDialog | protected void openEditDialog(boolean isNew, String mode, CmsEditHandlerData handlerDataForNew) {
CmsContainerpageController.get().getContentEditorHandler().openDialog(
m_editableData,
isNew,
m_parentResourceId,
mode,
handlerDataForNew);
} | java | protected void openEditDialog(boolean isNew, String mode, CmsEditHandlerData handlerDataForNew) {
CmsContainerpageController.get().getContentEditorHandler().openDialog(
m_editableData,
isNew,
m_parentResourceId,
mode,
handlerDataForNew);
} | [
"protected",
"void",
"openEditDialog",
"(",
"boolean",
"isNew",
",",
"String",
"mode",
",",
"CmsEditHandlerData",
"handlerDataForNew",
")",
"{",
"CmsContainerpageController",
".",
"get",
"(",
")",
".",
"getContentEditorHandler",
"(",
")",
".",
"openDialog",
"(",
"... | Opens the content editor.<p>
@param isNew <code>true</code> to create and edit a new resource
@param mode the content creation mode
@param handlerDataForNew the data for the edit handler if it is used for the 'new' function | [
"Opens",
"the",
"content",
"editor",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsListCollectorEditor.java#L371-L379 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/spi/MediaHandlerConfig.java | MediaHandlerConfig.getDefaultImageQuality | public double getDefaultImageQuality(String mimeType) {
if (StringUtils.isNotEmpty(mimeType)) {
String format = StringUtils.substringAfter(mimeType.toLowerCase(), "image/");
if (StringUtils.equals(format, "jpg") || StringUtils.equals(format, "jpeg")) {
return DEFAULT_JPEG_QUALITY;
}
else if (StringUtils.equals(format, "gif")) {
return 256d; // 256 colors
}
}
// return quality "1" for all other mime types
return 1d;
} | java | public double getDefaultImageQuality(String mimeType) {
if (StringUtils.isNotEmpty(mimeType)) {
String format = StringUtils.substringAfter(mimeType.toLowerCase(), "image/");
if (StringUtils.equals(format, "jpg") || StringUtils.equals(format, "jpeg")) {
return DEFAULT_JPEG_QUALITY;
}
else if (StringUtils.equals(format, "gif")) {
return 256d; // 256 colors
}
}
// return quality "1" for all other mime types
return 1d;
} | [
"public",
"double",
"getDefaultImageQuality",
"(",
"String",
"mimeType",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"mimeType",
")",
")",
"{",
"String",
"format",
"=",
"StringUtils",
".",
"substringAfter",
"(",
"mimeType",
".",
"toLowerCase",
... | Get the default quality for images in this app generated with the Layer API.
The meaning of the quality parameter for the different image formats is described in
{@link com.day.image.Layer#write(String, double, java.io.OutputStream)}.
@param mimeType MIME-type of the output format
@return Quality factor | [
"Get",
"the",
"default",
"quality",
"for",
"images",
"in",
"this",
"app",
"generated",
"with",
"the",
"Layer",
"API",
".",
"The",
"meaning",
"of",
"the",
"quality",
"parameter",
"for",
"the",
"different",
"image",
"formats",
"is",
"described",
"in",
"{"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaHandlerConfig.java#L93-L105 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java | DefaultPropertyPlaceholderResolver.resolveExpression | @Nullable
protected <T> T resolveExpression(String context, String expression, Class<T> type) {
if (environment.containsProperty(expression)) {
return environment.getProperty(expression, type)
.orElseThrow(() ->
new ConfigurationException("Could not resolve expression: [" + expression + "] in placeholder ${" + context + "}"));
}
if (NameUtils.isEnvironmentName(expression)) {
String envVar = System.getenv(expression);
if (StringUtils.isNotEmpty(envVar)) {
return conversionService.convert(envVar, type)
.orElseThrow(() ->
new ConfigurationException("Could not resolve expression: [" + expression + "] in placeholder ${" + context + "}"));
}
}
return null;
} | java | @Nullable
protected <T> T resolveExpression(String context, String expression, Class<T> type) {
if (environment.containsProperty(expression)) {
return environment.getProperty(expression, type)
.orElseThrow(() ->
new ConfigurationException("Could not resolve expression: [" + expression + "] in placeholder ${" + context + "}"));
}
if (NameUtils.isEnvironmentName(expression)) {
String envVar = System.getenv(expression);
if (StringUtils.isNotEmpty(envVar)) {
return conversionService.convert(envVar, type)
.orElseThrow(() ->
new ConfigurationException("Could not resolve expression: [" + expression + "] in placeholder ${" + context + "}"));
}
}
return null;
} | [
"@",
"Nullable",
"protected",
"<",
"T",
">",
"T",
"resolveExpression",
"(",
"String",
"context",
",",
"String",
"expression",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"environment",
".",
"containsProperty",
"(",
"expression",
")",
")",
"... | Resolves a single expression.
@param context The context of the expression
@param expression The expression
@param type The class
@param <T> The type the expression should be converted to
@return The resolved and converted expression | [
"Resolves",
"a",
"single",
"expression",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java#L173-L189 |
cantrowitz/RxBroadcast | rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java | RxBroadcast.fromBroadcast | public static Observable<Intent> fromBroadcast(
Context context,
IntentFilter intentFilter,
OrderedBroadcastAbortStrategy orderedBroadcastAbortStrategy) {
BroadcastRegistrar broadcastRegistrar = new BroadcastRegistrar(context, intentFilter);
return createBroadcastObservable(broadcastRegistrar, orderedBroadcastAbortStrategy);
} | java | public static Observable<Intent> fromBroadcast(
Context context,
IntentFilter intentFilter,
OrderedBroadcastAbortStrategy orderedBroadcastAbortStrategy) {
BroadcastRegistrar broadcastRegistrar = new BroadcastRegistrar(context, intentFilter);
return createBroadcastObservable(broadcastRegistrar, orderedBroadcastAbortStrategy);
} | [
"public",
"static",
"Observable",
"<",
"Intent",
">",
"fromBroadcast",
"(",
"Context",
"context",
",",
"IntentFilter",
"intentFilter",
",",
"OrderedBroadcastAbortStrategy",
"orderedBroadcastAbortStrategy",
")",
"{",
"BroadcastRegistrar",
"broadcastRegistrar",
"=",
"new",
... | Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
<p>
<em>This is only useful in conjunction with Ordered Broadcasts, e.g.,
{@link Context#sendOrderedBroadcast(Intent, String)}</em>
@param context the context the {@link BroadcastReceiver} will be
created from
@param intentFilter the filter for the particular intent
@param orderedBroadcastAbortStrategy the strategy to use for Ordered Broadcasts
@return {@link Observable} of {@link Intent} that matches the filter | [
"Create",
"{",
"@link",
"Observable",
"}",
"that",
"wraps",
"{",
"@link",
"BroadcastReceiver",
"}",
"and",
"emits",
"received",
"intents",
".",
"<p",
">",
"<em",
">",
"This",
"is",
"only",
"useful",
"in",
"conjunction",
"with",
"Ordered",
"Broadcasts",
"e",
... | train | https://github.com/cantrowitz/RxBroadcast/blob/8b479d0e28617e9b86fa4d462c6675c131b0c5d0/rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java#L57-L63 |
Alluxio/alluxio | core/common/src/main/java/alluxio/security/authentication/AuthenticatedUserInjector.java | AuthenticatedUserInjector.authenticateCall | private <ReqT, RespT> boolean authenticateCall(ServerCall<ReqT, RespT> call, Metadata headers) {
// Fail validation for cancelled server calls.
if (call.isCancelled()) {
LOG.debug("Server call has been cancelled: %s",
call.getMethodDescriptor().getFullMethodName());
return false;
}
// Try to fetch channel Id from the metadata.
UUID channelId = headers.get(ChannelIdInjector.S_CLIENT_ID_KEY);
boolean callAuthenticated = false;
if (channelId != null) {
try {
// Fetch authenticated username for this channel and set it.
AuthenticatedUserInfo userInfo = mAuthenticationServer.getUserInfoForChannel(channelId);
if (userInfo != null) {
AuthenticatedClientUser.set(userInfo.getAuthorizedUserName());
AuthenticatedClientUser.setConnectionUser(userInfo.getConnectionUserName());
AuthenticatedClientUser.setAuthMethod(userInfo.getAuthMethod());
} else {
AuthenticatedClientUser.remove();
}
callAuthenticated = true;
} catch (UnauthenticatedException e) {
String message = String.format("Channel: %s is not authenticated for call: %s",
channelId.toString(), call.getMethodDescriptor().getFullMethodName());
call.close(Status.UNAUTHENTICATED.withDescription(message), headers);
}
} else {
String message = String.format("Channel Id is missing for call: %s.",
call.getMethodDescriptor().getFullMethodName());
call.close(Status.UNAUTHENTICATED.withDescription(message), headers);
}
return callAuthenticated;
} | java | private <ReqT, RespT> boolean authenticateCall(ServerCall<ReqT, RespT> call, Metadata headers) {
// Fail validation for cancelled server calls.
if (call.isCancelled()) {
LOG.debug("Server call has been cancelled: %s",
call.getMethodDescriptor().getFullMethodName());
return false;
}
// Try to fetch channel Id from the metadata.
UUID channelId = headers.get(ChannelIdInjector.S_CLIENT_ID_KEY);
boolean callAuthenticated = false;
if (channelId != null) {
try {
// Fetch authenticated username for this channel and set it.
AuthenticatedUserInfo userInfo = mAuthenticationServer.getUserInfoForChannel(channelId);
if (userInfo != null) {
AuthenticatedClientUser.set(userInfo.getAuthorizedUserName());
AuthenticatedClientUser.setConnectionUser(userInfo.getConnectionUserName());
AuthenticatedClientUser.setAuthMethod(userInfo.getAuthMethod());
} else {
AuthenticatedClientUser.remove();
}
callAuthenticated = true;
} catch (UnauthenticatedException e) {
String message = String.format("Channel: %s is not authenticated for call: %s",
channelId.toString(), call.getMethodDescriptor().getFullMethodName());
call.close(Status.UNAUTHENTICATED.withDescription(message), headers);
}
} else {
String message = String.format("Channel Id is missing for call: %s.",
call.getMethodDescriptor().getFullMethodName());
call.close(Status.UNAUTHENTICATED.withDescription(message), headers);
}
return callAuthenticated;
} | [
"private",
"<",
"ReqT",
",",
"RespT",
">",
"boolean",
"authenticateCall",
"(",
"ServerCall",
"<",
"ReqT",
",",
"RespT",
">",
"call",
",",
"Metadata",
"headers",
")",
"{",
"// Fail validation for cancelled server calls.",
"if",
"(",
"call",
".",
"isCancelled",
"(... | Authenticates given call against auth-server state.
Fails the call if it's not originating from an authenticated client channel.
It sets thread-local authentication information for the call with the user information
that is kept on auth-server. | [
"Authenticates",
"given",
"call",
"against",
"auth",
"-",
"server",
"state",
".",
"Fails",
"the",
"call",
"if",
"it",
"s",
"not",
"originating",
"from",
"an",
"authenticated",
"client",
"channel",
".",
"It",
"sets",
"thread",
"-",
"local",
"authentication",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/security/authentication/AuthenticatedUserInjector.java#L79-L113 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/store/AbstractStoreResource.java | AbstractStoreResource.insertDefaults | protected void insertDefaults()
throws EFapsException
{
if (!getExist()[0] && getGeneralID() != null) {
try {
final ConnectionResource res = Context.getThreadContext().getConnectionResource();
Context.getDbType().newInsert(AbstractStoreResource.TABLENAME_STORE, "ID", false)
.column("ID", getGeneralID())
.column(AbstractStoreResource.COLNAME_FILENAME, "TMP")
.column(AbstractStoreResource.COLNAME_FILELENGTH, 0)
.execute(res);
this.fileName = "TMP";
this.fileLength = new Long(0);
} catch (final SQLException e) {
throw new EFapsException(AbstractStoreResource.class, "insertDefaults", e);
}
}
} | java | protected void insertDefaults()
throws EFapsException
{
if (!getExist()[0] && getGeneralID() != null) {
try {
final ConnectionResource res = Context.getThreadContext().getConnectionResource();
Context.getDbType().newInsert(AbstractStoreResource.TABLENAME_STORE, "ID", false)
.column("ID", getGeneralID())
.column(AbstractStoreResource.COLNAME_FILENAME, "TMP")
.column(AbstractStoreResource.COLNAME_FILELENGTH, 0)
.execute(res);
this.fileName = "TMP";
this.fileLength = new Long(0);
} catch (final SQLException e) {
throw new EFapsException(AbstractStoreResource.class, "insertDefaults", e);
}
}
} | [
"protected",
"void",
"insertDefaults",
"(",
")",
"throws",
"EFapsException",
"{",
"if",
"(",
"!",
"getExist",
"(",
")",
"[",
"0",
"]",
"&&",
"getGeneralID",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"ConnectionResource",
"res",
"=",
"Context... | Insert default values in the table. (if necessary).
@throws EFapsException on error | [
"Insert",
"default",
"values",
"in",
"the",
"table",
".",
"(",
"if",
"necessary",
")",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L227-L244 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java | AbstractSoapAttachmentValidator.findAttachment | protected SoapAttachment findAttachment(SoapMessage soapMessage, SoapAttachment controlAttachment) {
List<SoapAttachment> attachments = soapMessage.getAttachments();
Attachment matching = null;
if (controlAttachment.getContentId() == null) {
if (attachments.size() == 1) {
matching = attachments.get(0);
} else {
throw new ValidationException("Found more than one SOAP attachment - need control attachment content id for validation!");
}
} else {
// try to find attachment by its content id
for (Attachment attachment : attachments) {
if (controlAttachment.getContentId() != null &&
controlAttachment.getContentId().equals(attachment.getContentId())) {
matching = attachment;
}
}
}
if (matching != null) {
return SoapAttachment.from(matching);
} else {
throw new ValidationException(String.format("Unable to find SOAP attachment with content id '%s'", controlAttachment.getContentId()));
}
} | java | protected SoapAttachment findAttachment(SoapMessage soapMessage, SoapAttachment controlAttachment) {
List<SoapAttachment> attachments = soapMessage.getAttachments();
Attachment matching = null;
if (controlAttachment.getContentId() == null) {
if (attachments.size() == 1) {
matching = attachments.get(0);
} else {
throw new ValidationException("Found more than one SOAP attachment - need control attachment content id for validation!");
}
} else {
// try to find attachment by its content id
for (Attachment attachment : attachments) {
if (controlAttachment.getContentId() != null &&
controlAttachment.getContentId().equals(attachment.getContentId())) {
matching = attachment;
}
}
}
if (matching != null) {
return SoapAttachment.from(matching);
} else {
throw new ValidationException(String.format("Unable to find SOAP attachment with content id '%s'", controlAttachment.getContentId()));
}
} | [
"protected",
"SoapAttachment",
"findAttachment",
"(",
"SoapMessage",
"soapMessage",
",",
"SoapAttachment",
"controlAttachment",
")",
"{",
"List",
"<",
"SoapAttachment",
">",
"attachments",
"=",
"soapMessage",
".",
"getAttachments",
"(",
")",
";",
"Attachment",
"matchi... | Finds attachment in list of soap attachments on incoming soap message. By default
uses content id of control attachment as search key. If no proper attachment with this content id
was found in soap message throws validation exception.
@param soapMessage
@param controlAttachment
@return | [
"Finds",
"attachment",
"in",
"list",
"of",
"soap",
"attachments",
"on",
"incoming",
"soap",
"message",
".",
"By",
"default",
"uses",
"content",
"id",
"of",
"control",
"attachment",
"as",
"search",
"key",
".",
"If",
"no",
"proper",
"attachment",
"with",
"this... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java#L73-L98 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableId.java | TableId.of | public static TableId of(String project, String dataset, String table) {
return new TableId(checkNotNull(project), checkNotNull(dataset), checkNotNull(table));
} | java | public static TableId of(String project, String dataset, String table) {
return new TableId(checkNotNull(project), checkNotNull(dataset), checkNotNull(table));
} | [
"public",
"static",
"TableId",
"of",
"(",
"String",
"project",
",",
"String",
"dataset",
",",
"String",
"table",
")",
"{",
"return",
"new",
"TableId",
"(",
"checkNotNull",
"(",
"project",
")",
",",
"checkNotNull",
"(",
"dataset",
")",
",",
"checkNotNull",
... | Creates a table identity given project's, dataset's and table's user-defined ids. | [
"Creates",
"a",
"table",
"identity",
"given",
"project",
"s",
"dataset",
"s",
"and",
"table",
"s",
"user",
"-",
"defined",
"ids",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableId.java#L73-L75 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotGetString | public static Optional<String> dotGetString(final Map map, final String pathString) {
return dotGet(map, String.class, pathString);
} | java | public static Optional<String> dotGetString(final Map map, final String pathString) {
return dotGet(map, String.class, pathString);
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"dotGetString",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
")",
"{",
"return",
"dotGet",
"(",
"map",
",",
"String",
".",
"class",
",",
"pathString",
")",
";",
"}"
] | Get string value by path.
@param map subject
@param pathString nodes to walk in map
@return value | [
"Get",
"string",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L136-L138 |
DiUS/pact-jvm | pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java | LambdaDslObject.eachLike | public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) {
object.eachLike(name, value, numberExamples);
return this;
} | java | public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) {
object.eachLike(name, value, numberExamples);
return this;
} | [
"public",
"LambdaDslObject",
"eachLike",
"(",
"String",
"name",
",",
"PactDslJsonRootValue",
"value",
",",
"int",
"numberExamples",
")",
"{",
"object",
".",
"eachLike",
"(",
"name",
",",
"value",
",",
"numberExamples",
")",
";",
"return",
"this",
";",
"}"
] | Attribute that is an array where each item is a primitive that must match the provided value
@param name field name
@param value Value that each item in the array must match
@param numberExamples Number of examples to generate | [
"Attribute",
"that",
"is",
"an",
"array",
"where",
"each",
"item",
"is",
"a",
"primitive",
"that",
"must",
"match",
"the",
"provided",
"value"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L427-L430 |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.basicAuth | public RequestBuilder basicAuth(String user, String password) {
this.basicAuth = new BasicAuth(user, password);
return this;
} | java | public RequestBuilder basicAuth(String user, String password) {
this.basicAuth = new BasicAuth(user, password);
return this;
} | [
"public",
"RequestBuilder",
"basicAuth",
"(",
"String",
"user",
",",
"String",
"password",
")",
"{",
"this",
".",
"basicAuth",
"=",
"new",
"BasicAuth",
"(",
"user",
",",
"password",
")",
";",
"return",
"this",
";",
"}"
] | Set http basicAuth by BasicAuth(DigestAuth/NTLMAuth not supported now) | [
"Set",
"http",
"basicAuth",
"by",
"BasicAuth",
"(",
"DigestAuth",
"/",
"NTLMAuth",
"not",
"supported",
"now",
")"
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L385-L388 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(ActEvent event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(ActEvent event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"ActEvent",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Overload {@link #emitAsync(EventObject, Object...)} for performance
tuning.
@see #emitAsync(EventObject, Object...) | [
"Overload",
"{"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1044-L1046 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.