repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
exoplatform/jcr | exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java | JCRAPIAspect.getStatistics | private static Statistics getStatistics(Class<?> target, String signature) {
"""
Gives the corresponding statistics for the given target class and AspectJ signature
@param target the target {@link Class}
@param signature the AspectJ signature
@return the related {@link Statistics} or <code>null</code> if it cannot be found
"""
initIfNeeded();
Statistics statistics = MAPPING.get(signature);
if (statistics == null)
{
synchronized (JCRAPIAspect.class)
{
Class<?> interfaceClass = findInterface(target);
if (interfaceClass != null)
{
Map<String, Statistics> allStatistics = ALL_STATISTICS.get(interfaceClass.getSimpleName());
if (allStatistics != null)
{
int index1 = signature.indexOf('(');
int index = signature.substring(0, index1).lastIndexOf('.');
String name = signature.substring(index + 1);
statistics = allStatistics.get(name);
}
}
if (statistics == null)
{
statistics = UNKNOWN;
}
Map<String, Statistics> tempMapping = new HashMap<String, Statistics>(MAPPING);
tempMapping.put(signature, statistics);
MAPPING = Collections.unmodifiableMap(tempMapping);
}
}
if (statistics == UNKNOWN) // NOSONAR
{
return null;
}
return statistics;
} | java | private static Statistics getStatistics(Class<?> target, String signature)
{
initIfNeeded();
Statistics statistics = MAPPING.get(signature);
if (statistics == null)
{
synchronized (JCRAPIAspect.class)
{
Class<?> interfaceClass = findInterface(target);
if (interfaceClass != null)
{
Map<String, Statistics> allStatistics = ALL_STATISTICS.get(interfaceClass.getSimpleName());
if (allStatistics != null)
{
int index1 = signature.indexOf('(');
int index = signature.substring(0, index1).lastIndexOf('.');
String name = signature.substring(index + 1);
statistics = allStatistics.get(name);
}
}
if (statistics == null)
{
statistics = UNKNOWN;
}
Map<String, Statistics> tempMapping = new HashMap<String, Statistics>(MAPPING);
tempMapping.put(signature, statistics);
MAPPING = Collections.unmodifiableMap(tempMapping);
}
}
if (statistics == UNKNOWN) // NOSONAR
{
return null;
}
return statistics;
} | [
"private",
"static",
"Statistics",
"getStatistics",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"signature",
")",
"{",
"initIfNeeded",
"(",
")",
";",
"Statistics",
"statistics",
"=",
"MAPPING",
".",
"get",
"(",
"signature",
")",
";",
"if",
"(",
"statistics",
"==",
"null",
")",
"{",
"synchronized",
"(",
"JCRAPIAspect",
".",
"class",
")",
"{",
"Class",
"<",
"?",
">",
"interfaceClass",
"=",
"findInterface",
"(",
"target",
")",
";",
"if",
"(",
"interfaceClass",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Statistics",
">",
"allStatistics",
"=",
"ALL_STATISTICS",
".",
"get",
"(",
"interfaceClass",
".",
"getSimpleName",
"(",
")",
")",
";",
"if",
"(",
"allStatistics",
"!=",
"null",
")",
"{",
"int",
"index1",
"=",
"signature",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"index",
"=",
"signature",
".",
"substring",
"(",
"0",
",",
"index1",
")",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"String",
"name",
"=",
"signature",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"statistics",
"=",
"allStatistics",
".",
"get",
"(",
"name",
")",
";",
"}",
"}",
"if",
"(",
"statistics",
"==",
"null",
")",
"{",
"statistics",
"=",
"UNKNOWN",
";",
"}",
"Map",
"<",
"String",
",",
"Statistics",
">",
"tempMapping",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Statistics",
">",
"(",
"MAPPING",
")",
";",
"tempMapping",
".",
"put",
"(",
"signature",
",",
"statistics",
")",
";",
"MAPPING",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"tempMapping",
")",
";",
"}",
"}",
"if",
"(",
"statistics",
"==",
"UNKNOWN",
")",
"// NOSONAR",
"{",
"return",
"null",
";",
"}",
"return",
"statistics",
";",
"}"
] | Gives the corresponding statistics for the given target class and AspectJ signature
@param target the target {@link Class}
@param signature the AspectJ signature
@return the related {@link Statistics} or <code>null</code> if it cannot be found | [
"Gives",
"the",
"corresponding",
"statistics",
"for",
"the",
"given",
"target",
"class",
"and",
"AspectJ",
"signature"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.statistics/src/main/java/org/exoplatform/services/jcr/statistics/JCRAPIAspect.java#L128-L162 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.isSortedFromTo | public boolean isSortedFromTo(int from, int to) {
"""
Determines whether the receiver is sorted ascending, according to the <i>natural ordering</i> of its
elements. All elements in this range must implement the
<tt>Comparable</tt> interface. Furthermore, all elements in this range
must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt>
must not throw a <tt>ClassCastException</tt> for any elements
<tt>e1</tt> and <tt>e2</tt> in the array).<p>
@param from the index of the first element (inclusive) to be sorted.
@param to the index of the last element (inclusive) to be sorted.
@return <tt>true</tt> if the receiver is sorted ascending, <tt>false</tt> otherwise.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
"""
if (size==0) return true;
checkRangeFromTo(from, to, size);
Object[] theElements = elements;
for (int i=from+1; i<=to; i++ ) {
if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
}
return true;
} | java | public boolean isSortedFromTo(int from, int to) {
if (size==0) return true;
checkRangeFromTo(from, to, size);
Object[] theElements = elements;
for (int i=from+1; i<=to; i++ ) {
if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
}
return true;
} | [
"public",
"boolean",
"isSortedFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"true",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"Object",
"[",
"]",
"theElements",
"=",
"elements",
";",
"for",
"(",
"int",
"i",
"=",
"from",
"+",
"1",
";",
"i",
"<=",
"to",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"(",
"Comparable",
")",
"theElements",
"[",
"i",
"]",
")",
".",
"compareTo",
"(",
"(",
"Comparable",
")",
"theElements",
"[",
"i",
"-",
"1",
"]",
")",
"<",
"0",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Determines whether the receiver is sorted ascending, according to the <i>natural ordering</i> of its
elements. All elements in this range must implement the
<tt>Comparable</tt> interface. Furthermore, all elements in this range
must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt>
must not throw a <tt>ClassCastException</tt> for any elements
<tt>e1</tt> and <tt>e2</tt> in the array).<p>
@param from the index of the first element (inclusive) to be sorted.
@param to the index of the last element (inclusive) to be sorted.
@return <tt>true</tt> if the receiver is sorted ascending, <tt>false</tt> otherwise.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>). | [
"Determines",
"whether",
"the",
"receiver",
"is",
"sorted",
"ascending",
"according",
"to",
"the",
"<i",
">",
"natural",
"ordering<",
"/",
"i",
">",
"of",
"its",
"elements",
".",
"All",
"elements",
"in",
"this",
"range",
"must",
"implement",
"the",
"<tt",
">",
"Comparable<",
"/",
"tt",
">",
"interface",
".",
"Furthermore",
"all",
"elements",
"in",
"this",
"range",
"must",
"be",
"<i",
">",
"mutually",
"comparable<",
"/",
"i",
">",
"(",
"that",
"is",
"<tt",
">",
"e1",
".",
"compareTo",
"(",
"e2",
")",
"<",
"/",
"tt",
">",
"must",
"not",
"throw",
"a",
"<tt",
">",
"ClassCastException<",
"/",
"tt",
">",
"for",
"any",
"elements",
"<tt",
">",
"e1<",
"/",
"tt",
">",
"and",
"<tt",
">",
"e2<",
"/",
"tt",
">",
"in",
"the",
"array",
")",
".",
"<p",
">"
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L472-L481 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_account_POST | public OvhTask organizationName_service_exchangeService_account_POST(String organizationName, String exchangeService, String SAMAccountName, String company, String displayName, String domain, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhOvhLicenceEnum license, Boolean litigation, Long litigationPeriod, String login, OvhMailingFilterEnum[] mailingFilter, Boolean outlookLicense, String password, OvhSpamAndVirusConfiguration spamAndVirusConfiguration) throws IOException {
"""
Create new mailbox in exchange server
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account
@param outlookLicense [required] Buy outlook license
@param displayName [required] Account display name
@param license [required] Exchange license
@param company [required] Company name
@param initials [required] Account initials
@param hiddenFromGAL [required] Hide the account in Global Address List
@param login [required] Account login
@param lastName [required] Account last name
@param firstName [required] Account first name
@param litigationPeriod [required] Litigation length in days, 0 means unlimited
@param SAMAccountName [required] SAM account name (exchange 2010 login)
@param litigation [required] Litigation status
@param password [required] Account password
@param mailingFilter [required] Enable mailing filtrering
@param domain [required] Email domain
@param spamAndVirusConfiguration [required] Antispam and Antivirus configuration
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "SAMAccountName", SAMAccountName);
addBody(o, "company", company);
addBody(o, "displayName", displayName);
addBody(o, "domain", domain);
addBody(o, "firstName", firstName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "initials", initials);
addBody(o, "lastName", lastName);
addBody(o, "license", license);
addBody(o, "litigation", litigation);
addBody(o, "litigationPeriod", litigationPeriod);
addBody(o, "login", login);
addBody(o, "mailingFilter", mailingFilter);
addBody(o, "outlookLicense", outlookLicense);
addBody(o, "password", password);
addBody(o, "spamAndVirusConfiguration", spamAndVirusConfiguration);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_account_POST(String organizationName, String exchangeService, String SAMAccountName, String company, String displayName, String domain, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhOvhLicenceEnum license, Boolean litigation, Long litigationPeriod, String login, OvhMailingFilterEnum[] mailingFilter, Boolean outlookLicense, String password, OvhSpamAndVirusConfiguration spamAndVirusConfiguration) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "SAMAccountName", SAMAccountName);
addBody(o, "company", company);
addBody(o, "displayName", displayName);
addBody(o, "domain", domain);
addBody(o, "firstName", firstName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "initials", initials);
addBody(o, "lastName", lastName);
addBody(o, "license", license);
addBody(o, "litigation", litigation);
addBody(o, "litigationPeriod", litigationPeriod);
addBody(o, "login", login);
addBody(o, "mailingFilter", mailingFilter);
addBody(o, "outlookLicense", outlookLicense);
addBody(o, "password", password);
addBody(o, "spamAndVirusConfiguration", spamAndVirusConfiguration);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_account_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"SAMAccountName",
",",
"String",
"company",
",",
"String",
"displayName",
",",
"String",
"domain",
",",
"String",
"firstName",
",",
"Boolean",
"hiddenFromGAL",
",",
"String",
"initials",
",",
"String",
"lastName",
",",
"OvhOvhLicenceEnum",
"license",
",",
"Boolean",
"litigation",
",",
"Long",
"litigationPeriod",
",",
"String",
"login",
",",
"OvhMailingFilterEnum",
"[",
"]",
"mailingFilter",
",",
"Boolean",
"outlookLicense",
",",
"String",
"password",
",",
"OvhSpamAndVirusConfiguration",
"spamAndVirusConfiguration",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/account\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"SAMAccountName\"",
",",
"SAMAccountName",
")",
";",
"addBody",
"(",
"o",
",",
"\"company\"",
",",
"company",
")",
";",
"addBody",
"(",
"o",
",",
"\"displayName\"",
",",
"displayName",
")",
";",
"addBody",
"(",
"o",
",",
"\"domain\"",
",",
"domain",
")",
";",
"addBody",
"(",
"o",
",",
"\"firstName\"",
",",
"firstName",
")",
";",
"addBody",
"(",
"o",
",",
"\"hiddenFromGAL\"",
",",
"hiddenFromGAL",
")",
";",
"addBody",
"(",
"o",
",",
"\"initials\"",
",",
"initials",
")",
";",
"addBody",
"(",
"o",
",",
"\"lastName\"",
",",
"lastName",
")",
";",
"addBody",
"(",
"o",
",",
"\"license\"",
",",
"license",
")",
";",
"addBody",
"(",
"o",
",",
"\"litigation\"",
",",
"litigation",
")",
";",
"addBody",
"(",
"o",
",",
"\"litigationPeriod\"",
",",
"litigationPeriod",
")",
";",
"addBody",
"(",
"o",
",",
"\"login\"",
",",
"login",
")",
";",
"addBody",
"(",
"o",
",",
"\"mailingFilter\"",
",",
"mailingFilter",
")",
";",
"addBody",
"(",
"o",
",",
"\"outlookLicense\"",
",",
"outlookLicense",
")",
";",
"addBody",
"(",
"o",
",",
"\"password\"",
",",
"password",
")",
";",
"addBody",
"(",
"o",
",",
"\"spamAndVirusConfiguration\"",
",",
"spamAndVirusConfiguration",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Create new mailbox in exchange server
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account
@param outlookLicense [required] Buy outlook license
@param displayName [required] Account display name
@param license [required] Exchange license
@param company [required] Company name
@param initials [required] Account initials
@param hiddenFromGAL [required] Hide the account in Global Address List
@param login [required] Account login
@param lastName [required] Account last name
@param firstName [required] Account first name
@param litigationPeriod [required] Litigation length in days, 0 means unlimited
@param SAMAccountName [required] SAM account name (exchange 2010 login)
@param litigation [required] Litigation status
@param password [required] Account password
@param mailingFilter [required] Enable mailing filtrering
@param domain [required] Email domain
@param spamAndVirusConfiguration [required] Antispam and Antivirus configuration
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Create",
"new",
"mailbox",
"in",
"exchange",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2186-L2208 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/SButtonBox.java | SButtonBox.setSFieldValue | public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) {
"""
Set this control's converter to this HTML param.
ie., Check to see if this button was pressed.
"""
String strButtonDesc = this.getButtonDesc();
String strButtonCommand = this.getButtonCommand();
if (strButtonCommand != null)
if (strButtonDesc != null)
if (strButtonDesc.equals(strParamValue))
{ // Button was pressed, do command
this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW);
return DBConstants.NORMAL_RETURN;
}
// Often this is called in a report needing a value set, so set it:
return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
} | java | public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode)
{
String strButtonDesc = this.getButtonDesc();
String strButtonCommand = this.getButtonCommand();
if (strButtonCommand != null)
if (strButtonDesc != null)
if (strButtonDesc.equals(strParamValue))
{ // Button was pressed, do command
this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW);
return DBConstants.NORMAL_RETURN;
}
// Often this is called in a report needing a value set, so set it:
return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setSFieldValue",
"(",
"String",
"strParamValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"String",
"strButtonDesc",
"=",
"this",
".",
"getButtonDesc",
"(",
")",
";",
"String",
"strButtonCommand",
"=",
"this",
".",
"getButtonCommand",
"(",
")",
";",
"if",
"(",
"strButtonCommand",
"!=",
"null",
")",
"if",
"(",
"strButtonDesc",
"!=",
"null",
")",
"if",
"(",
"strButtonDesc",
".",
"equals",
"(",
"strParamValue",
")",
")",
"{",
"// Button was pressed, do command",
"this",
".",
"handleCommand",
"(",
"strButtonCommand",
",",
"this",
",",
"ScreenConstants",
".",
"USE_NEW_WINDOW",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}",
"// Often this is called in a report needing a value set, so set it:",
"return",
"super",
".",
"setSFieldValue",
"(",
"strParamValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] | Set this control's converter to this HTML param.
ie., Check to see if this button was pressed. | [
"Set",
"this",
"control",
"s",
"converter",
"to",
"this",
"HTML",
"param",
".",
"ie",
".",
"Check",
"to",
"see",
"if",
"this",
"button",
"was",
"pressed",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SButtonBox.java#L177-L190 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/records/RetentionSet.java | RetentionSet.removeStreamCutBefore | public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
"""
Creates a new retention set object by removing all records on or before given record.
@param set retention set to update
@param record reference record
@return updated retention set record after removing all elements before given reference record.
"""
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set;
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of());
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} | java | public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set;
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of());
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} | [
"public",
"static",
"RetentionSet",
"removeStreamCutBefore",
"(",
"RetentionSet",
"set",
",",
"StreamCutReferenceRecord",
"record",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"record",
")",
";",
"// remove all stream cuts with recordingTime before supplied cut",
"int",
"beforeIndex",
"=",
"getGreatestLowerBound",
"(",
"set",
",",
"record",
".",
"getRecordingTime",
"(",
")",
",",
"StreamCutReferenceRecord",
"::",
"getRecordingTime",
")",
";",
"if",
"(",
"beforeIndex",
"<",
"0",
")",
"{",
"return",
"set",
";",
"}",
"if",
"(",
"beforeIndex",
"+",
"1",
"==",
"set",
".",
"retentionRecords",
".",
"size",
"(",
")",
")",
"{",
"return",
"new",
"RetentionSet",
"(",
"ImmutableList",
".",
"of",
"(",
")",
")",
";",
"}",
"return",
"new",
"RetentionSet",
"(",
"set",
".",
"retentionRecords",
".",
"subList",
"(",
"beforeIndex",
"+",
"1",
",",
"set",
".",
"retentionRecords",
".",
"size",
"(",
")",
")",
")",
";",
"}"
] | Creates a new retention set object by removing all records on or before given record.
@param set retention set to update
@param record reference record
@return updated retention set record after removing all elements before given reference record. | [
"Creates",
"a",
"new",
"retention",
"set",
"object",
"by",
"removing",
"all",
"records",
"on",
"or",
"before",
"given",
"record",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/RetentionSet.java#L109-L122 |
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/config/Configs.java | Configs.modifyHavePathSelfConfig | public static void modifyHavePathSelfConfig(IConfigKeyWithPath key, String value) throws IOException {
"""
Modify one self config.
@param key need update config's key with configAbsoluteClassPath
@param value new config value
@throws IOException
"""
String configAbsoluteClassPath = key.getConfigPath();
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(key, value);
} | java | public static void modifyHavePathSelfConfig(IConfigKeyWithPath key, String value) throws IOException {
String configAbsoluteClassPath = key.getConfigPath();
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(key, value);
} | [
"public",
"static",
"void",
"modifyHavePathSelfConfig",
"(",
"IConfigKeyWithPath",
"key",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"String",
"configAbsoluteClassPath",
"=",
"key",
".",
"getConfigPath",
"(",
")",
";",
"OneProperties",
"configs",
"=",
"otherConfigs",
".",
"get",
"(",
"configAbsoluteClassPath",
")",
";",
"if",
"(",
"configs",
"==",
"null",
")",
"{",
"return",
";",
"}",
"configs",
".",
"modifyConfig",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Modify one self config.
@param key need update config's key with configAbsoluteClassPath
@param value new config value
@throws IOException | [
"Modify",
"one",
"self",
"config",
"."
] | train | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L577-L584 |
petergeneric/stdlib | guice/webapp/src/main/java/com/peterphi/std/guice/web/servlet/GuiceServlet.java | GuiceServlet.doService | protected void doService(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
"""
Calls {@link HttpServlet#service} should a subclass need to implement that method
@param req
@param resp
@throws ServletException
@throws IOException
"""
super.service(req, resp);
} | java | protected void doService(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException
{
super.service(req, resp);
} | [
"protected",
"void",
"doService",
"(",
"final",
"HttpServletRequest",
"req",
",",
"final",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"super",
".",
"service",
"(",
"req",
",",
"resp",
")",
";",
"}"
] | Calls {@link HttpServlet#service} should a subclass need to implement that method
@param req
@param resp
@throws ServletException
@throws IOException | [
"Calls",
"{",
"@link",
"HttpServlet#service",
"}",
"should",
"a",
"subclass",
"need",
"to",
"implement",
"that",
"method"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/servlet/GuiceServlet.java#L71-L74 |
icode/ameba | src/main/java/ameba/db/ebean/EbeanUtils.java | EbeanUtils.forceUpdateAllProperties | public static <T> void forceUpdateAllProperties(BeanDescriptor<T> beanDescriptor, T model) {
"""
<p>forceUpdateAllProperties.</p>
@param beanDescriptor a {@link io.ebeaninternal.server.deploy.BeanDescriptor} object.
@param model a T object.
@param <T> a T object.
"""
EntityBeanIntercept intercept = ((EntityBean) model)._ebean_getIntercept();
intercept.setLoaded();
int idIndex = beanDescriptor.getIdProperty().getPropertyIndex();
for (int i = 0; i < intercept.getPropertyLength(); i++) {
if (i != idIndex) {
intercept.markPropertyAsChanged(i);
intercept.setLoadedProperty(i);
}
}
} | java | public static <T> void forceUpdateAllProperties(BeanDescriptor<T> beanDescriptor, T model) {
EntityBeanIntercept intercept = ((EntityBean) model)._ebean_getIntercept();
intercept.setLoaded();
int idIndex = beanDescriptor.getIdProperty().getPropertyIndex();
for (int i = 0; i < intercept.getPropertyLength(); i++) {
if (i != idIndex) {
intercept.markPropertyAsChanged(i);
intercept.setLoadedProperty(i);
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forceUpdateAllProperties",
"(",
"BeanDescriptor",
"<",
"T",
">",
"beanDescriptor",
",",
"T",
"model",
")",
"{",
"EntityBeanIntercept",
"intercept",
"=",
"(",
"(",
"EntityBean",
")",
"model",
")",
".",
"_ebean_getIntercept",
"(",
")",
";",
"intercept",
".",
"setLoaded",
"(",
")",
";",
"int",
"idIndex",
"=",
"beanDescriptor",
".",
"getIdProperty",
"(",
")",
".",
"getPropertyIndex",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intercept",
".",
"getPropertyLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"idIndex",
")",
"{",
"intercept",
".",
"markPropertyAsChanged",
"(",
"i",
")",
";",
"intercept",
".",
"setLoadedProperty",
"(",
"i",
")",
";",
"}",
"}",
"}"
] | <p>forceUpdateAllProperties.</p>
@param beanDescriptor a {@link io.ebeaninternal.server.deploy.BeanDescriptor} object.
@param model a T object.
@param <T> a T object. | [
"<p",
">",
"forceUpdateAllProperties",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/EbeanUtils.java#L69-L79 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/xwiki/xwiki20/XWikiScannerUtil.java | XWikiScannerUtil.unescapeVerbatim | public static String unescapeVerbatim(String content) {
"""
To have }}} or {{{ inside inline block we need to escape it in some
condition. This method remove this escaping to send the correct text to
the event.
"""
StringBuffer unescapedContent = new StringBuffer();
boolean escaped = false;
char[] buff = content.toCharArray();
for (int i = 0; i < buff.length; ++i) {
if (!escaped) {
if (buff[i] == '~') {
escaped = true;
continue;
}
} else {
if (i < (i = matchVerbatimSyntax(buff, i, '{'))) {
unescapedContent.append("{{{");
escaped = false;
continue;
} else if (i < (i = matchVerbatimSyntax(buff, i, '}'))) {
unescapedContent.append("}}}");
escaped = false;
continue;
} else {
unescapedContent.append('~');
}
escaped = false;
}
unescapedContent.append(buff[i]);
}
return unescapedContent.toString();
} | java | public static String unescapeVerbatim(String content)
{
StringBuffer unescapedContent = new StringBuffer();
boolean escaped = false;
char[] buff = content.toCharArray();
for (int i = 0; i < buff.length; ++i) {
if (!escaped) {
if (buff[i] == '~') {
escaped = true;
continue;
}
} else {
if (i < (i = matchVerbatimSyntax(buff, i, '{'))) {
unescapedContent.append("{{{");
escaped = false;
continue;
} else if (i < (i = matchVerbatimSyntax(buff, i, '}'))) {
unescapedContent.append("}}}");
escaped = false;
continue;
} else {
unescapedContent.append('~');
}
escaped = false;
}
unescapedContent.append(buff[i]);
}
return unescapedContent.toString();
} | [
"public",
"static",
"String",
"unescapeVerbatim",
"(",
"String",
"content",
")",
"{",
"StringBuffer",
"unescapedContent",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"boolean",
"escaped",
"=",
"false",
";",
"char",
"[",
"]",
"buff",
"=",
"content",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buff",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"!",
"escaped",
")",
"{",
"if",
"(",
"buff",
"[",
"i",
"]",
"==",
"'",
"'",
")",
"{",
"escaped",
"=",
"true",
";",
"continue",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"i",
"<",
"(",
"i",
"=",
"matchVerbatimSyntax",
"(",
"buff",
",",
"i",
",",
"'",
"'",
")",
")",
")",
"{",
"unescapedContent",
".",
"append",
"(",
"\"{{{\"",
")",
";",
"escaped",
"=",
"false",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"i",
"<",
"(",
"i",
"=",
"matchVerbatimSyntax",
"(",
"buff",
",",
"i",
",",
"'",
"'",
")",
")",
")",
"{",
"unescapedContent",
".",
"append",
"(",
"\"}}}\"",
")",
";",
"escaped",
"=",
"false",
";",
"continue",
";",
"}",
"else",
"{",
"unescapedContent",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"escaped",
"=",
"false",
";",
"}",
"unescapedContent",
".",
"append",
"(",
"buff",
"[",
"i",
"]",
")",
";",
"}",
"return",
"unescapedContent",
".",
"toString",
"(",
")",
";",
"}"
] | To have }}} or {{{ inside inline block we need to escape it in some
condition. This method remove this escaping to send the correct text to
the event. | [
"To",
"have",
"}}}",
"or",
"{{{",
"inside",
"inline",
"block",
"we",
"need",
"to",
"escape",
"it",
"in",
"some",
"condition",
".",
"This",
"method",
"remove",
"this",
"escaping",
"to",
"send",
"the",
"correct",
"text",
"to",
"the",
"event",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/xwiki/xwiki20/XWikiScannerUtil.java#L35-L67 |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.writeDefaultFileRegion | private int writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region) throws Exception {
"""
Write a {@link DefaultFileRegion}
@param in the collection which contains objects to write.
@param region the {@link DefaultFileRegion} from which the bytes should be written
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul>
"""
final long offset = region.transferred();
final long regionCount = region.count();
if (offset >= regionCount) {
in.remove();
return 0;
}
final long flushedAmount = socket.sendFile(region, region.position(), offset, regionCount - offset);
if (flushedAmount > 0) {
in.progress(flushedAmount);
if (region.transferred() >= regionCount) {
in.remove();
}
return 1;
} else if (flushedAmount == 0) {
validateFileRegion(region, offset);
}
return WRITE_STATUS_SNDBUF_FULL;
} | java | private int writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region) throws Exception {
final long offset = region.transferred();
final long regionCount = region.count();
if (offset >= regionCount) {
in.remove();
return 0;
}
final long flushedAmount = socket.sendFile(region, region.position(), offset, regionCount - offset);
if (flushedAmount > 0) {
in.progress(flushedAmount);
if (region.transferred() >= regionCount) {
in.remove();
}
return 1;
} else if (flushedAmount == 0) {
validateFileRegion(region, offset);
}
return WRITE_STATUS_SNDBUF_FULL;
} | [
"private",
"int",
"writeDefaultFileRegion",
"(",
"ChannelOutboundBuffer",
"in",
",",
"DefaultFileRegion",
"region",
")",
"throws",
"Exception",
"{",
"final",
"long",
"offset",
"=",
"region",
".",
"transferred",
"(",
")",
";",
"final",
"long",
"regionCount",
"=",
"region",
".",
"count",
"(",
")",
";",
"if",
"(",
"offset",
">=",
"regionCount",
")",
"{",
"in",
".",
"remove",
"(",
")",
";",
"return",
"0",
";",
"}",
"final",
"long",
"flushedAmount",
"=",
"socket",
".",
"sendFile",
"(",
"region",
",",
"region",
".",
"position",
"(",
")",
",",
"offset",
",",
"regionCount",
"-",
"offset",
")",
";",
"if",
"(",
"flushedAmount",
">",
"0",
")",
"{",
"in",
".",
"progress",
"(",
"flushedAmount",
")",
";",
"if",
"(",
"region",
".",
"transferred",
"(",
")",
">=",
"regionCount",
")",
"{",
"in",
".",
"remove",
"(",
")",
";",
"}",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"flushedAmount",
"==",
"0",
")",
"{",
"validateFileRegion",
"(",
"region",
",",
"offset",
")",
";",
"}",
"return",
"WRITE_STATUS_SNDBUF_FULL",
";",
"}"
] | Write a {@link DefaultFileRegion}
@param in the collection which contains objects to write.
@param region the {@link DefaultFileRegion} from which the bytes should be written
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul> | [
"Write",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L369-L388 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.paymentMean_bankAccount_POST | public OvhPaymentMeanValidation paymentMean_bankAccount_POST(String bic, String description, String iban, String ownerAddress, String ownerName, Boolean setDefault) throws IOException {
"""
Enable payment through a new account
REST: POST /me/paymentMean/bankAccount
@param ownerAddress [required] Account owner's address
@param bic [required] Account's BIC
@param iban [required] Account's IBAN
@param ownerName [required] Account owner's name
@param setDefault [required] Set as default payment mean once validated
@param description [required] Custom description of this account
"""
String qPath = "/me/paymentMean/bankAccount";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bic", bic);
addBody(o, "description", description);
addBody(o, "iban", iban);
addBody(o, "ownerAddress", ownerAddress);
addBody(o, "ownerName", ownerName);
addBody(o, "setDefault", setDefault);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhPaymentMeanValidation.class);
} | java | public OvhPaymentMeanValidation paymentMean_bankAccount_POST(String bic, String description, String iban, String ownerAddress, String ownerName, Boolean setDefault) throws IOException {
String qPath = "/me/paymentMean/bankAccount";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bic", bic);
addBody(o, "description", description);
addBody(o, "iban", iban);
addBody(o, "ownerAddress", ownerAddress);
addBody(o, "ownerName", ownerName);
addBody(o, "setDefault", setDefault);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhPaymentMeanValidation.class);
} | [
"public",
"OvhPaymentMeanValidation",
"paymentMean_bankAccount_POST",
"(",
"String",
"bic",
",",
"String",
"description",
",",
"String",
"iban",
",",
"String",
"ownerAddress",
",",
"String",
"ownerName",
",",
"Boolean",
"setDefault",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/paymentMean/bankAccount\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"bic\"",
",",
"bic",
")",
";",
"addBody",
"(",
"o",
",",
"\"description\"",
",",
"description",
")",
";",
"addBody",
"(",
"o",
",",
"\"iban\"",
",",
"iban",
")",
";",
"addBody",
"(",
"o",
",",
"\"ownerAddress\"",
",",
"ownerAddress",
")",
";",
"addBody",
"(",
"o",
",",
"\"ownerName\"",
",",
"ownerName",
")",
";",
"addBody",
"(",
"o",
",",
"\"setDefault\"",
",",
"setDefault",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPaymentMeanValidation",
".",
"class",
")",
";",
"}"
] | Enable payment through a new account
REST: POST /me/paymentMean/bankAccount
@param ownerAddress [required] Account owner's address
@param bic [required] Account's BIC
@param iban [required] Account's IBAN
@param ownerName [required] Account owner's name
@param setDefault [required] Set as default payment mean once validated
@param description [required] Custom description of this account | [
"Enable",
"payment",
"through",
"a",
"new",
"account"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L717-L729 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertNotNull | public static void assertNotNull(String message, Object o) {
"""
Assert that a value is not null.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param o value to test
"""
if (o != null) {
pass(message);
} else {
fail(message, null);
}
} | java | public static void assertNotNull(String message, Object o) {
if (o != null) {
pass(message);
} else {
fail(message, null);
}
} | [
"public",
"static",
"void",
"assertNotNull",
"(",
"String",
"message",
",",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"message",
",",
"null",
")",
";",
"}",
"}"
] | Assert that a value is not null.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param o value to test | [
"Assert",
"that",
"a",
"value",
"is",
"not",
"null",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L295-L301 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java | TmdbAccount.getUserLists | public ResultList<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException {
"""
Get all lists of a given user
@param sessionId
@param accountId
@return The lists
@throws MovieDbException
"""
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.SESSION_ID, sessionId);
parameters.add(Param.ID, accountId);
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.LISTS).buildUrl(parameters);
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "user list");
return wrapper.getResultsList();
} | java | public ResultList<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.SESSION_ID, sessionId);
parameters.add(Param.ID, accountId);
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.LISTS).buildUrl(parameters);
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "user list");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"UserList",
">",
"getUserLists",
"(",
"String",
"sessionId",
",",
"int",
"accountId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"SESSION_ID",
",",
"sessionId",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",
"accountId",
")",
";",
"URL",
"url",
"=",
"new",
"ApiUrl",
"(",
"apiKey",
",",
"MethodBase",
".",
"ACCOUNT",
")",
".",
"subMethod",
"(",
"MethodSub",
".",
"LISTS",
")",
".",
"buildUrl",
"(",
"parameters",
")",
";",
"WrapperGenericList",
"<",
"UserList",
">",
"wrapper",
"=",
"processWrapper",
"(",
"getTypeReference",
"(",
"UserList",
".",
"class",
")",
",",
"url",
",",
"\"user list\"",
")",
";",
"return",
"wrapper",
".",
"getResultsList",
"(",
")",
";",
"}"
] | Get all lists of a given user
@param sessionId
@param accountId
@return The lists
@throws MovieDbException | [
"Get",
"all",
"lists",
"of",
"a",
"given",
"user"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java#L90-L98 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginDeallocateAsync | public Observable<OperationStatusResponseInner> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName) {
"""
Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object
"""
return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName) {
return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"beginDeallocateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"beginDeallocateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
",",
"OperationStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object | [
"Deallocates",
"specific",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Shuts",
"down",
"the",
"virtual",
"machines",
"and",
"releases",
"the",
"compute",
"resources",
".",
"You",
"are",
"not",
"billed",
"for",
"the",
"compute",
"resources",
"that",
"this",
"virtual",
"machine",
"scale",
"set",
"deallocates",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L965-L972 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java | DeLiClu.reinsertExpanded | private void reinsertExpanded(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluTree index, IndexTreePath<DeLiCluEntry> path, DataStore<KNNList> knns) {
"""
Reinserts the objects of the already expanded nodes.
@param distFunction the spatial distance function of this algorithm
@param index the index storing the objects
@param path the path of the object inserted last
@param knns the knn list
"""
int l = 0; // Count the number of components.
for(IndexTreePath<DeLiCluEntry> it = path; it != null; it = it.getParentPath()) {
l++;
}
ArrayList<IndexTreePath<DeLiCluEntry>> p = new ArrayList<>(l - 1);
// All except the last (= root).
IndexTreePath<DeLiCluEntry> it = path;
for(; it.getParentPath() != null; it = it.getParentPath()) {
p.add(it);
}
assert (p.size() == l - 1);
DeLiCluEntry rootEntry = it.getEntry();
reinsertExpanded(distFunction, index, p, l - 2, rootEntry, knns);
} | java | private void reinsertExpanded(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluTree index, IndexTreePath<DeLiCluEntry> path, DataStore<KNNList> knns) {
int l = 0; // Count the number of components.
for(IndexTreePath<DeLiCluEntry> it = path; it != null; it = it.getParentPath()) {
l++;
}
ArrayList<IndexTreePath<DeLiCluEntry>> p = new ArrayList<>(l - 1);
// All except the last (= root).
IndexTreePath<DeLiCluEntry> it = path;
for(; it.getParentPath() != null; it = it.getParentPath()) {
p.add(it);
}
assert (p.size() == l - 1);
DeLiCluEntry rootEntry = it.getEntry();
reinsertExpanded(distFunction, index, p, l - 2, rootEntry, knns);
} | [
"private",
"void",
"reinsertExpanded",
"(",
"SpatialPrimitiveDistanceFunction",
"<",
"V",
">",
"distFunction",
",",
"DeLiCluTree",
"index",
",",
"IndexTreePath",
"<",
"DeLiCluEntry",
">",
"path",
",",
"DataStore",
"<",
"KNNList",
">",
"knns",
")",
"{",
"int",
"l",
"=",
"0",
";",
"// Count the number of components.",
"for",
"(",
"IndexTreePath",
"<",
"DeLiCluEntry",
">",
"it",
"=",
"path",
";",
"it",
"!=",
"null",
";",
"it",
"=",
"it",
".",
"getParentPath",
"(",
")",
")",
"{",
"l",
"++",
";",
"}",
"ArrayList",
"<",
"IndexTreePath",
"<",
"DeLiCluEntry",
">",
">",
"p",
"=",
"new",
"ArrayList",
"<>",
"(",
"l",
"-",
"1",
")",
";",
"// All except the last (= root).",
"IndexTreePath",
"<",
"DeLiCluEntry",
">",
"it",
"=",
"path",
";",
"for",
"(",
";",
"it",
".",
"getParentPath",
"(",
")",
"!=",
"null",
";",
"it",
"=",
"it",
".",
"getParentPath",
"(",
")",
")",
"{",
"p",
".",
"add",
"(",
"it",
")",
";",
"}",
"assert",
"(",
"p",
".",
"size",
"(",
")",
"==",
"l",
"-",
"1",
")",
";",
"DeLiCluEntry",
"rootEntry",
"=",
"it",
".",
"getEntry",
"(",
")",
";",
"reinsertExpanded",
"(",
"distFunction",
",",
"index",
",",
"p",
",",
"l",
"-",
"2",
",",
"rootEntry",
",",
"knns",
")",
";",
"}"
] | Reinserts the objects of the already expanded nodes.
@param distFunction the spatial distance function of this algorithm
@param index the index storing the objects
@param path the path of the object inserted last
@param knns the knn list | [
"Reinserts",
"the",
"objects",
"of",
"the",
"already",
"expanded",
"nodes",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java#L299-L313 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.getEmbeddedTemplateEditUrl | public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId) throws HelloSignException {
"""
Retrieves the necessary information to edit an embedded template.
@param templateId String ID of the signature request to embed
@return EmbeddedResponse
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response.
"""
return getEmbeddedTemplateEditUrl(templateId, false, false, false);
} | java | public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId) throws HelloSignException {
return getEmbeddedTemplateEditUrl(templateId, false, false, false);
} | [
"public",
"EmbeddedResponse",
"getEmbeddedTemplateEditUrl",
"(",
"String",
"templateId",
")",
"throws",
"HelloSignException",
"{",
"return",
"getEmbeddedTemplateEditUrl",
"(",
"templateId",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"}"
] | Retrieves the necessary information to edit an embedded template.
@param templateId String ID of the signature request to embed
@return EmbeddedResponse
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response. | [
"Retrieves",
"the",
"necessary",
"information",
"to",
"edit",
"an",
"embedded",
"template",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L856-L858 |
alibaba/jstorm | jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java | UIUtils.getTaskEntities | public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo, String componentName) {
"""
get the task entities in the specific component
@param topologyInfo topology info
@param componentName component name
@return the list of task entities
"""
TreeMap<Integer, TaskEntity> tasks = new TreeMap<>();
for (ComponentSummary cs : topologyInfo.get_components()) {
String compName = cs.get_name();
String type = cs.get_type();
if (componentName.equals(compName)) {
for (int id : cs.get_taskIds()) {
tasks.put(id, new TaskEntity(id, compName, type));
}
}
}
for (TaskSummary ts : topologyInfo.get_tasks()) {
if (tasks.containsKey(ts.get_taskId())) {
TaskEntity te = tasks.get(ts.get_taskId());
te.setHost(ts.get_host());
te.setPort(ts.get_port());
te.setStatus(ts.get_status());
te.setUptime(ts.get_uptime());
te.setErrors(ts.get_errors());
}
}
return new ArrayList<>(tasks.values());
} | java | public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo, String componentName) {
TreeMap<Integer, TaskEntity> tasks = new TreeMap<>();
for (ComponentSummary cs : topologyInfo.get_components()) {
String compName = cs.get_name();
String type = cs.get_type();
if (componentName.equals(compName)) {
for (int id : cs.get_taskIds()) {
tasks.put(id, new TaskEntity(id, compName, type));
}
}
}
for (TaskSummary ts : topologyInfo.get_tasks()) {
if (tasks.containsKey(ts.get_taskId())) {
TaskEntity te = tasks.get(ts.get_taskId());
te.setHost(ts.get_host());
te.setPort(ts.get_port());
te.setStatus(ts.get_status());
te.setUptime(ts.get_uptime());
te.setErrors(ts.get_errors());
}
}
return new ArrayList<>(tasks.values());
} | [
"public",
"static",
"List",
"<",
"TaskEntity",
">",
"getTaskEntities",
"(",
"TopologyInfo",
"topologyInfo",
",",
"String",
"componentName",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"TaskEntity",
">",
"tasks",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"for",
"(",
"ComponentSummary",
"cs",
":",
"topologyInfo",
".",
"get_components",
"(",
")",
")",
"{",
"String",
"compName",
"=",
"cs",
".",
"get_name",
"(",
")",
";",
"String",
"type",
"=",
"cs",
".",
"get_type",
"(",
")",
";",
"if",
"(",
"componentName",
".",
"equals",
"(",
"compName",
")",
")",
"{",
"for",
"(",
"int",
"id",
":",
"cs",
".",
"get_taskIds",
"(",
")",
")",
"{",
"tasks",
".",
"put",
"(",
"id",
",",
"new",
"TaskEntity",
"(",
"id",
",",
"compName",
",",
"type",
")",
")",
";",
"}",
"}",
"}",
"for",
"(",
"TaskSummary",
"ts",
":",
"topologyInfo",
".",
"get_tasks",
"(",
")",
")",
"{",
"if",
"(",
"tasks",
".",
"containsKey",
"(",
"ts",
".",
"get_taskId",
"(",
")",
")",
")",
"{",
"TaskEntity",
"te",
"=",
"tasks",
".",
"get",
"(",
"ts",
".",
"get_taskId",
"(",
")",
")",
";",
"te",
".",
"setHost",
"(",
"ts",
".",
"get_host",
"(",
")",
")",
";",
"te",
".",
"setPort",
"(",
"ts",
".",
"get_port",
"(",
")",
")",
";",
"te",
".",
"setStatus",
"(",
"ts",
".",
"get_status",
"(",
")",
")",
";",
"te",
".",
"setUptime",
"(",
"ts",
".",
"get_uptime",
"(",
")",
")",
";",
"te",
".",
"setErrors",
"(",
"ts",
".",
"get_errors",
"(",
")",
")",
";",
"}",
"}",
"return",
"new",
"ArrayList",
"<>",
"(",
"tasks",
".",
"values",
"(",
")",
")",
";",
"}"
] | get the task entities in the specific component
@param topologyInfo topology info
@param componentName component name
@return the list of task entities | [
"get",
"the",
"task",
"entities",
"in",
"the",
"specific",
"component"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java#L254-L279 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/provider/AuthResolver.java | AuthResolver.providerFor | @Nullable
public static AuthProvider providerFor(@Nullable String strategy, @NonNull String connection) {
"""
Get an AuthProvider that can handle a given strategy and connection name, or null if there are no
providers to handle them.
@param strategy to handle
@param connection to handle
@return an AuthProvider to handle the authentication or null if no providers are available.
"""
if (authHandlers == null) {
return null;
}
AuthProvider provider = null;
for (AuthHandler p : authHandlers) {
provider = p.providerFor(strategy, connection);
if (provider != null) {
break;
}
}
return provider;
} | java | @Nullable
public static AuthProvider providerFor(@Nullable String strategy, @NonNull String connection) {
if (authHandlers == null) {
return null;
}
AuthProvider provider = null;
for (AuthHandler p : authHandlers) {
provider = p.providerFor(strategy, connection);
if (provider != null) {
break;
}
}
return provider;
} | [
"@",
"Nullable",
"public",
"static",
"AuthProvider",
"providerFor",
"(",
"@",
"Nullable",
"String",
"strategy",
",",
"@",
"NonNull",
"String",
"connection",
")",
"{",
"if",
"(",
"authHandlers",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"AuthProvider",
"provider",
"=",
"null",
";",
"for",
"(",
"AuthHandler",
"p",
":",
"authHandlers",
")",
"{",
"provider",
"=",
"p",
".",
"providerFor",
"(",
"strategy",
",",
"connection",
")",
";",
"if",
"(",
"provider",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"return",
"provider",
";",
"}"
] | Get an AuthProvider that can handle a given strategy and connection name, or null if there are no
providers to handle them.
@param strategy to handle
@param connection to handle
@return an AuthProvider to handle the authentication or null if no providers are available. | [
"Get",
"an",
"AuthProvider",
"that",
"can",
"handle",
"a",
"given",
"strategy",
"and",
"connection",
"name",
"or",
"null",
"if",
"there",
"are",
"no",
"providers",
"to",
"handle",
"them",
"."
] | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/provider/AuthResolver.java#L41-L55 |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java | ExtendedConfigurationImpl.updateCache | @Override
public void updateCache(Dictionary<String, Object> properties, Set<ConfigID> references, Set<String> newUniques) throws IOException {
"""
Updates ConfigurationAdmin's cache with current config properties.
If replaceProp is set to true, current config properties is replace with
the given properties before caching
and the internal pid-to-config table is updated to reflect the new config
properties.
@param properties
@param replaceProp
@param isMetaTypeProperties
true if properties is MetaType converted properties
@param newUniques
@throws IOException
"""
lock.lock();
try {
removeReferences();
setProperties(properties);
this.references = references;
this.uniqueVariables = newUniques;
caFactory.getConfigurationStore().saveConfiguration(pid, this);
changeCount.incrementAndGet();
addReferences();
sendEvents = true;
} finally {
lock.unlock();
}
} | java | @Override
public void updateCache(Dictionary<String, Object> properties, Set<ConfigID> references, Set<String> newUniques) throws IOException {
lock.lock();
try {
removeReferences();
setProperties(properties);
this.references = references;
this.uniqueVariables = newUniques;
caFactory.getConfigurationStore().saveConfiguration(pid, this);
changeCount.incrementAndGet();
addReferences();
sendEvents = true;
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"void",
"updateCache",
"(",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"Set",
"<",
"ConfigID",
">",
"references",
",",
"Set",
"<",
"String",
">",
"newUniques",
")",
"throws",
"IOException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"removeReferences",
"(",
")",
";",
"setProperties",
"(",
"properties",
")",
";",
"this",
".",
"references",
"=",
"references",
";",
"this",
".",
"uniqueVariables",
"=",
"newUniques",
";",
"caFactory",
".",
"getConfigurationStore",
"(",
")",
".",
"saveConfiguration",
"(",
"pid",
",",
"this",
")",
";",
"changeCount",
".",
"incrementAndGet",
"(",
")",
";",
"addReferences",
"(",
")",
";",
"sendEvents",
"=",
"true",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Updates ConfigurationAdmin's cache with current config properties.
If replaceProp is set to true, current config properties is replace with
the given properties before caching
and the internal pid-to-config table is updated to reflect the new config
properties.
@param properties
@param replaceProp
@param isMetaTypeProperties
true if properties is MetaType converted properties
@param newUniques
@throws IOException | [
"Updates",
"ConfigurationAdmin",
"s",
"cache",
"with",
"current",
"config",
"properties",
".",
"If",
"replaceProp",
"is",
"set",
"to",
"true",
"current",
"config",
"properties",
"is",
"replace",
"with",
"the",
"given",
"properties",
"before",
"caching",
"and",
"the",
"internal",
"pid",
"-",
"to",
"-",
"config",
"table",
"is",
"updated",
"to",
"reflect",
"the",
"new",
"config",
"properties",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ExtendedConfigurationImpl.java#L474-L492 |
probedock/probedock-java | src/main/java/io/probedock/client/core/connector/Connector.java | Connector.openConnection | private HttpURLConnection openConnection(ServerConfiguration configuration, URL url) throws IOException {
"""
Open a connection regarding the configuration and the URL
@param configuration The configuration to get the proxy information if necessary
@param url The URL to open the connection from
@return The opened connection
@throws IOException In case of error when opening the connection
"""
if (configuration.hasProxyConfiguration()) {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(configuration.getProxyConfiguration().getHost(), configuration.getProxyConfiguration().getPort()));
return (HttpURLConnection) url.openConnection(proxy);
}
else {
return (HttpURLConnection) url.openConnection();
}
} | java | private HttpURLConnection openConnection(ServerConfiguration configuration, URL url) throws IOException {
if (configuration.hasProxyConfiguration()) {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(configuration.getProxyConfiguration().getHost(), configuration.getProxyConfiguration().getPort()));
return (HttpURLConnection) url.openConnection(proxy);
}
else {
return (HttpURLConnection) url.openConnection();
}
} | [
"private",
"HttpURLConnection",
"openConnection",
"(",
"ServerConfiguration",
"configuration",
",",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"configuration",
".",
"hasProxyConfiguration",
"(",
")",
")",
"{",
"Proxy",
"proxy",
"=",
"new",
"Proxy",
"(",
"Proxy",
".",
"Type",
".",
"HTTP",
",",
"new",
"InetSocketAddress",
"(",
"configuration",
".",
"getProxyConfiguration",
"(",
")",
".",
"getHost",
"(",
")",
",",
"configuration",
".",
"getProxyConfiguration",
"(",
")",
".",
"getPort",
"(",
")",
")",
")",
";",
"return",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
"proxy",
")",
";",
"}",
"else",
"{",
"return",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"}",
"}"
] | Open a connection regarding the configuration and the URL
@param configuration The configuration to get the proxy information if necessary
@param url The URL to open the connection from
@return The opened connection
@throws IOException In case of error when opening the connection | [
"Open",
"a",
"connection",
"regarding",
"the",
"configuration",
"and",
"the",
"URL"
] | train | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/connector/Connector.java#L172-L180 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/query/filter/JavaScriptDimFilter.java | JavaScriptDimFilter.getPredicateFactory | @EnsuresNonNull("predicateFactory")
private JavaScriptPredicateFactory getPredicateFactory() {
"""
This class can be used by multiple threads, so this function should be thread-safe to avoid extra
script compilation.
"""
// JavaScript configuration should be checked when it's actually used because someone might still want Druid
// nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.
Preconditions.checkState(config.isEnabled(), "JavaScript is disabled");
JavaScriptPredicateFactory syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
synchronized (config) {
syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
syncedFnPredicateFactory = new JavaScriptPredicateFactory(function, extractionFn);
predicateFactory = syncedFnPredicateFactory;
}
}
}
return syncedFnPredicateFactory;
} | java | @EnsuresNonNull("predicateFactory")
private JavaScriptPredicateFactory getPredicateFactory()
{
// JavaScript configuration should be checked when it's actually used because someone might still want Druid
// nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.
Preconditions.checkState(config.isEnabled(), "JavaScript is disabled");
JavaScriptPredicateFactory syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
synchronized (config) {
syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
syncedFnPredicateFactory = new JavaScriptPredicateFactory(function, extractionFn);
predicateFactory = syncedFnPredicateFactory;
}
}
}
return syncedFnPredicateFactory;
} | [
"@",
"EnsuresNonNull",
"(",
"\"predicateFactory\"",
")",
"private",
"JavaScriptPredicateFactory",
"getPredicateFactory",
"(",
")",
"{",
"// JavaScript configuration should be checked when it's actually used because someone might still want Druid",
"// nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.",
"Preconditions",
".",
"checkState",
"(",
"config",
".",
"isEnabled",
"(",
")",
",",
"\"JavaScript is disabled\"",
")",
";",
"JavaScriptPredicateFactory",
"syncedFnPredicateFactory",
"=",
"predicateFactory",
";",
"if",
"(",
"syncedFnPredicateFactory",
"==",
"null",
")",
"{",
"synchronized",
"(",
"config",
")",
"{",
"syncedFnPredicateFactory",
"=",
"predicateFactory",
";",
"if",
"(",
"syncedFnPredicateFactory",
"==",
"null",
")",
"{",
"syncedFnPredicateFactory",
"=",
"new",
"JavaScriptPredicateFactory",
"(",
"function",
",",
"extractionFn",
")",
";",
"predicateFactory",
"=",
"syncedFnPredicateFactory",
";",
"}",
"}",
"}",
"return",
"syncedFnPredicateFactory",
";",
"}"
] | This class can be used by multiple threads, so this function should be thread-safe to avoid extra
script compilation. | [
"This",
"class",
"can",
"be",
"used",
"by",
"multiple",
"threads",
"so",
"this",
"function",
"should",
"be",
"thread",
"-",
"safe",
"to",
"avoid",
"extra",
"script",
"compilation",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/filter/JavaScriptDimFilter.java#L128-L146 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.processChange | protected void processChange(String propertyName, Object oldValue, Object newValue) {
"""
Processes the change in state to the particular property of this Bean. A PropertyChangeEvent is created
to notify all listeners of the state change. First, VetoableChangeListeners are notified of the pending change
in order to validate the change and veto any undesired change to the specified property. Next, the state change
is effected followed by notification of all PropertyChangeListeners. Finally, a change event is sent to all
ChangeListeners notifying them this Bean has been changed.
This particular implementation uses property-to-field mapping and reflection to change the state of this Bean.
Subclasses are allowed to create a mapping of property names to actual fields of this particular Bean by calling
the mapPropertyNameToFieldName method. However, if no such mapping exists, then the field name is derived from
the name of the specified property. Essentially, the field name is expected to be the same as the property name.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@throws IllegalPropertyValueException if the property change violates a constraint imposed by one of the
VetoableChangeListeners listening to property change events on this Bean.
@see #processChange(String, Object, Object, org.cp.elements.beans.AbstractBean.StateChangeCallback)
"""
processChange(propertyName, oldValue, newValue, null);
} | java | protected void processChange(String propertyName, Object oldValue, Object newValue) {
processChange(propertyName, oldValue, newValue, null);
} | [
"protected",
"void",
"processChange",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"processChange",
"(",
"propertyName",
",",
"oldValue",
",",
"newValue",
",",
"null",
")",
";",
"}"
] | Processes the change in state to the particular property of this Bean. A PropertyChangeEvent is created
to notify all listeners of the state change. First, VetoableChangeListeners are notified of the pending change
in order to validate the change and veto any undesired change to the specified property. Next, the state change
is effected followed by notification of all PropertyChangeListeners. Finally, a change event is sent to all
ChangeListeners notifying them this Bean has been changed.
This particular implementation uses property-to-field mapping and reflection to change the state of this Bean.
Subclasses are allowed to create a mapping of property names to actual fields of this particular Bean by calling
the mapPropertyNameToFieldName method. However, if no such mapping exists, then the field name is derived from
the name of the specified property. Essentially, the field name is expected to be the same as the property name.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@throws IllegalPropertyValueException if the property change violates a constraint imposed by one of the
VetoableChangeListeners listening to property change events on this Bean.
@see #processChange(String, Object, Object, org.cp.elements.beans.AbstractBean.StateChangeCallback) | [
"Processes",
"the",
"change",
"in",
"state",
"to",
"the",
"particular",
"property",
"of",
"this",
"Bean",
".",
"A",
"PropertyChangeEvent",
"is",
"created",
"to",
"notify",
"all",
"listeners",
"of",
"the",
"state",
"change",
".",
"First",
"VetoableChangeListeners",
"are",
"notified",
"of",
"the",
"pending",
"change",
"in",
"order",
"to",
"validate",
"the",
"change",
"and",
"veto",
"any",
"undesired",
"change",
"to",
"the",
"specified",
"property",
".",
"Next",
"the",
"state",
"change",
"is",
"effected",
"followed",
"by",
"notification",
"of",
"all",
"PropertyChangeListeners",
".",
"Finally",
"a",
"change",
"event",
"is",
"sent",
"to",
"all",
"ChangeListeners",
"notifying",
"them",
"this",
"Bean",
"has",
"been",
"changed",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L642-L644 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getUsersBatch | public OneLoginResponse<User> getUsersBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
"""
Get a batch of Users.
@param queryParameters Query parameters of the Resource
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of User (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the getResource call
@see com.onelogin.sdk.model.User
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-users">Get Users documentation</a>
"""
ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_USERS_URL);
List<User> users = new ArrayList<User>(batchSize);
afterCursor = getUsersBatch(users, context.url, context.bearerRequest, context.oAuthResponse);
return new OneLoginResponse<User>(users, afterCursor);
} | java | public OneLoginResponse<User> getUsersBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_USERS_URL);
List<User> users = new ArrayList<User>(batchSize);
afterCursor = getUsersBatch(users, context.url, context.bearerRequest, context.oAuthResponse);
return new OneLoginResponse<User>(users, afterCursor);
} | [
"public",
"OneLoginResponse",
"<",
"User",
">",
"getUsersBatch",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"queryParameters",
",",
"int",
"batchSize",
",",
"String",
"afterCursor",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"ExtractionContext",
"context",
"=",
"extractResourceBatch",
"(",
"queryParameters",
",",
"batchSize",
",",
"afterCursor",
",",
"Constants",
".",
"GET_USERS_URL",
")",
";",
"List",
"<",
"User",
">",
"users",
"=",
"new",
"ArrayList",
"<",
"User",
">",
"(",
"batchSize",
")",
";",
"afterCursor",
"=",
"getUsersBatch",
"(",
"users",
",",
"context",
".",
"url",
",",
"context",
".",
"bearerRequest",
",",
"context",
".",
"oAuthResponse",
")",
";",
"return",
"new",
"OneLoginResponse",
"<",
"User",
">",
"(",
"users",
",",
"afterCursor",
")",
";",
"}"
] | Get a batch of Users.
@param queryParameters Query parameters of the Resource
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of User (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the getResource call
@see com.onelogin.sdk.model.User
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-users">Get Users documentation</a> | [
"Get",
"a",
"batch",
"of",
"Users",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L397-L403 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java | DoubleHistogram.getCountBetweenValues | public double getCountBetweenValues(final double lowValue, final double highValue)
throws ArrayIndexOutOfBoundsException {
"""
Get the count of recorded values within a range of value levels (inclusive to within the histogram's resolution).
@param lowValue The lower value bound on the range for which
to provide the recorded count. Will be rounded down with
{@link DoubleHistogram#lowestEquivalentValue lowestEquivalentValue}.
@param highValue The higher value bound on the range for which to provide the recorded count.
Will be rounded up with {@link DoubleHistogram#highestEquivalentValue highestEquivalentValue}.
@return the total count of values recorded in the histogram within the value range that is
{@literal >=} lowestEquivalentValue(<i>lowValue</i>) and {@literal <=} highestEquivalentValue(<i>highValue</i>)
"""
return integerValuesHistogram.getCountBetweenValues(
(long)(lowValue * doubleToIntegerValueConversionRatio),
(long)(highValue * doubleToIntegerValueConversionRatio)
);
} | java | public double getCountBetweenValues(final double lowValue, final double highValue)
throws ArrayIndexOutOfBoundsException {
return integerValuesHistogram.getCountBetweenValues(
(long)(lowValue * doubleToIntegerValueConversionRatio),
(long)(highValue * doubleToIntegerValueConversionRatio)
);
} | [
"public",
"double",
"getCountBetweenValues",
"(",
"final",
"double",
"lowValue",
",",
"final",
"double",
"highValue",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"return",
"integerValuesHistogram",
".",
"getCountBetweenValues",
"(",
"(",
"long",
")",
"(",
"lowValue",
"*",
"doubleToIntegerValueConversionRatio",
")",
",",
"(",
"long",
")",
"(",
"highValue",
"*",
"doubleToIntegerValueConversionRatio",
")",
")",
";",
"}"
] | Get the count of recorded values within a range of value levels (inclusive to within the histogram's resolution).
@param lowValue The lower value bound on the range for which
to provide the recorded count. Will be rounded down with
{@link DoubleHistogram#lowestEquivalentValue lowestEquivalentValue}.
@param highValue The higher value bound on the range for which to provide the recorded count.
Will be rounded up with {@link DoubleHistogram#highestEquivalentValue highestEquivalentValue}.
@return the total count of values recorded in the histogram within the value range that is
{@literal >=} lowestEquivalentValue(<i>lowValue</i>) and {@literal <=} highestEquivalentValue(<i>highValue</i>) | [
"Get",
"the",
"count",
"of",
"recorded",
"values",
"within",
"a",
"range",
"of",
"value",
"levels",
"(",
"inclusive",
"to",
"within",
"the",
"histogram",
"s",
"resolution",
")",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L1078-L1084 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java | BTools.getSDbl | public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ) {
"""
<b>getSDbl</b><br>
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign )<br>
Returns double converted to string.<br>
If Value is Double.NaN returns "NaN".<br>
If DecPrec is < 0 is DecPrec set 0.<br>
If ShowPlusSign is true:<br>
- If Value is > 0 sign is '+'.<br>
- If Value is 0 sign is ' '.<br>
@param Value - value
@param DecPrec - decimal precision
@param ShowPlusSign - show plus sign
@return double as string
"""
//
String PlusSign = "";
//
if ( ShowPlusSign && Value > 0 ) PlusSign = "+";
if ( ShowPlusSign && Value == 0 ) PlusSign = " ";
//
return PlusSign + getSDbl( Value, DecPrec );
} | java | public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ) {
//
String PlusSign = "";
//
if ( ShowPlusSign && Value > 0 ) PlusSign = "+";
if ( ShowPlusSign && Value == 0 ) PlusSign = " ";
//
return PlusSign + getSDbl( Value, DecPrec );
} | [
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
",",
"int",
"DecPrec",
",",
"boolean",
"ShowPlusSign",
")",
"{",
"//",
"String",
"PlusSign",
"=",
"\"\"",
";",
"//",
"if",
"(",
"ShowPlusSign",
"&&",
"Value",
">",
"0",
")",
"PlusSign",
"=",
"\"+\"",
";",
"if",
"(",
"ShowPlusSign",
"&&",
"Value",
"==",
"0",
")",
"PlusSign",
"=",
"\" \"",
";",
"//",
"return",
"PlusSign",
"+",
"getSDbl",
"(",
"Value",
",",
"DecPrec",
")",
";",
"}"
] | <b>getSDbl</b><br>
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign )<br>
Returns double converted to string.<br>
If Value is Double.NaN returns "NaN".<br>
If DecPrec is < 0 is DecPrec set 0.<br>
If ShowPlusSign is true:<br>
- If Value is > 0 sign is '+'.<br>
- If Value is 0 sign is ' '.<br>
@param Value - value
@param DecPrec - decimal precision
@param ShowPlusSign - show plus sign
@return double as string | [
"<b",
">",
"getSDbl<",
"/",
"b",
">",
"<br",
">",
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
"int",
"DecPrec",
"boolean",
"ShowPlusSign",
")",
"<br",
">",
"Returns",
"double",
"converted",
"to",
"string",
".",
"<br",
">",
"If",
"Value",
"is",
"Double",
".",
"NaN",
"returns",
"NaN",
".",
"<br",
">",
"If",
"DecPrec",
"is",
"<",
"0",
"is",
"DecPrec",
"set",
"0",
".",
"<br",
">",
"If",
"ShowPlusSign",
"is",
"true",
":",
"<br",
">",
"-",
"If",
"Value",
"is",
">",
"0",
"sign",
"is",
"+",
".",
"<br",
">",
"-",
"If",
"Value",
"is",
"0",
"sign",
"is",
".",
"<br",
">"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java#L193-L201 |
aragozin/jvm-tools | hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/HeapFactory.java | HeapFactory.createFastHeap | public static Heap createFastHeap(File heapDump, long bufferSize) throws FileNotFoundException, IOException {
"""
Fast {@link Heap} implementation is optimized for batch processing of dump.
Unlike normal {@link Heap} it doesn't create/use any temporary files.
@param bufferSize if file can be mapped to memory no buffer would be used, overwise limits memory used for buffering
"""
return new FastHprofHeap(createBuffer(heapDump, bufferSize), 0);
} | java | public static Heap createFastHeap(File heapDump, long bufferSize) throws FileNotFoundException, IOException {
return new FastHprofHeap(createBuffer(heapDump, bufferSize), 0);
} | [
"public",
"static",
"Heap",
"createFastHeap",
"(",
"File",
"heapDump",
",",
"long",
"bufferSize",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"new",
"FastHprofHeap",
"(",
"createBuffer",
"(",
"heapDump",
",",
"bufferSize",
")",
",",
"0",
")",
";",
"}"
] | Fast {@link Heap} implementation is optimized for batch processing of dump.
Unlike normal {@link Heap} it doesn't create/use any temporary files.
@param bufferSize if file can be mapped to memory no buffer would be used, overwise limits memory used for buffering | [
"Fast",
"{",
"@link",
"Heap",
"}",
"implementation",
"is",
"optimized",
"for",
"batch",
"processing",
"of",
"dump",
".",
"Unlike",
"normal",
"{",
"@link",
"Heap",
"}",
"it",
"doesn",
"t",
"create",
"/",
"use",
"any",
"temporary",
"files",
"."
] | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/HeapFactory.java#L102-L104 |
square/javapoet | src/main/java/com/squareup/javapoet/ParameterizedTypeName.java | ParameterizedTypeName.nestedClass | public ParameterizedTypeName nestedClass(String name, List<TypeName> typeArguments) {
"""
Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested
inside this class, with the specified {@code typeArguments}.
"""
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), typeArguments,
new ArrayList<>());
} | java | public ParameterizedTypeName nestedClass(String name, List<TypeName> typeArguments) {
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), typeArguments,
new ArrayList<>());
} | [
"public",
"ParameterizedTypeName",
"nestedClass",
"(",
"String",
"name",
",",
"List",
"<",
"TypeName",
">",
"typeArguments",
")",
"{",
"checkNotNull",
"(",
"name",
",",
"\"name == null\"",
")",
";",
"return",
"new",
"ParameterizedTypeName",
"(",
"this",
",",
"rawType",
".",
"nestedClass",
"(",
"name",
")",
",",
"typeArguments",
",",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"}"
] | Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested
inside this class, with the specified {@code typeArguments}. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java#L106-L110 |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/Collectors.java | Collectors.last | public static <T> Collector<T, ?, List<T>> last(final int n) {
"""
Only works for sequential Stream.
@param n
@return
@throws UnsupportedOperationException operated by multiple threads
"""
N.checkArgNotNegative(n, "n");
final Supplier<Deque<T>> supplier = new Supplier<Deque<T>>() {
@Override
public Deque<T> get() {
return n <= 1024 ? new ArrayDeque<T>(n) : new LinkedList<T>();
}
};
final BiConsumer<Deque<T>, T> accumulator = new BiConsumer<Deque<T>, T>() {
@Override
public void accept(Deque<T> dqueue, T t) {
if (n > 0) {
if (dqueue.size() >= n) {
dqueue.pollFirst();
}
dqueue.offerLast(t);
}
}
};
final BinaryOperator<Deque<T>> combiner = new BinaryOperator<Deque<T>>() {
@Override
public Deque<T> apply(Deque<T> a, Deque<T> b) {
if (N.notNullOrEmpty(a) && N.notNullOrEmpty(b)) {
throw new UnsupportedOperationException("The 'first' and 'last' Collector only can be used in sequential stream");
}
while (b.size() < n && !a.isEmpty()) {
b.addFirst(a.pollLast());
}
return b;
}
};
final Function<Deque<T>, List<T>> finisher = new Function<Deque<T>, List<T>>() {
@Override
public List<T> apply(Deque<T> dqueue) {
return new ArrayList<>(dqueue);
}
};
return new CollectorImpl<>(supplier, accumulator, combiner, finisher, CH_NOID);
} | java | public static <T> Collector<T, ?, List<T>> last(final int n) {
N.checkArgNotNegative(n, "n");
final Supplier<Deque<T>> supplier = new Supplier<Deque<T>>() {
@Override
public Deque<T> get() {
return n <= 1024 ? new ArrayDeque<T>(n) : new LinkedList<T>();
}
};
final BiConsumer<Deque<T>, T> accumulator = new BiConsumer<Deque<T>, T>() {
@Override
public void accept(Deque<T> dqueue, T t) {
if (n > 0) {
if (dqueue.size() >= n) {
dqueue.pollFirst();
}
dqueue.offerLast(t);
}
}
};
final BinaryOperator<Deque<T>> combiner = new BinaryOperator<Deque<T>>() {
@Override
public Deque<T> apply(Deque<T> a, Deque<T> b) {
if (N.notNullOrEmpty(a) && N.notNullOrEmpty(b)) {
throw new UnsupportedOperationException("The 'first' and 'last' Collector only can be used in sequential stream");
}
while (b.size() < n && !a.isEmpty()) {
b.addFirst(a.pollLast());
}
return b;
}
};
final Function<Deque<T>, List<T>> finisher = new Function<Deque<T>, List<T>>() {
@Override
public List<T> apply(Deque<T> dqueue) {
return new ArrayList<>(dqueue);
}
};
return new CollectorImpl<>(supplier, accumulator, combiner, finisher, CH_NOID);
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"List",
"<",
"T",
">",
">",
"last",
"(",
"final",
"int",
"n",
")",
"{",
"N",
".",
"checkArgNotNegative",
"(",
"n",
",",
"\"n\"",
")",
";",
"final",
"Supplier",
"<",
"Deque",
"<",
"T",
">",
">",
"supplier",
"=",
"new",
"Supplier",
"<",
"Deque",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Deque",
"<",
"T",
">",
"get",
"(",
")",
"{",
"return",
"n",
"<=",
"1024",
"?",
"new",
"ArrayDeque",
"<",
"T",
">",
"(",
"n",
")",
":",
"new",
"LinkedList",
"<",
"T",
">",
"(",
")",
";",
"}",
"}",
";",
"final",
"BiConsumer",
"<",
"Deque",
"<",
"T",
">",
",",
"T",
">",
"accumulator",
"=",
"new",
"BiConsumer",
"<",
"Deque",
"<",
"T",
">",
",",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"accept",
"(",
"Deque",
"<",
"T",
">",
"dqueue",
",",
"T",
"t",
")",
"{",
"if",
"(",
"n",
">",
"0",
")",
"{",
"if",
"(",
"dqueue",
".",
"size",
"(",
")",
">=",
"n",
")",
"{",
"dqueue",
".",
"pollFirst",
"(",
")",
";",
"}",
"dqueue",
".",
"offerLast",
"(",
"t",
")",
";",
"}",
"}",
"}",
";",
"final",
"BinaryOperator",
"<",
"Deque",
"<",
"T",
">",
">",
"combiner",
"=",
"new",
"BinaryOperator",
"<",
"Deque",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Deque",
"<",
"T",
">",
"apply",
"(",
"Deque",
"<",
"T",
">",
"a",
",",
"Deque",
"<",
"T",
">",
"b",
")",
"{",
"if",
"(",
"N",
".",
"notNullOrEmpty",
"(",
"a",
")",
"&&",
"N",
".",
"notNullOrEmpty",
"(",
"b",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"The 'first' and 'last' Collector only can be used in sequential stream\"",
")",
";",
"}",
"while",
"(",
"b",
".",
"size",
"(",
")",
"<",
"n",
"&&",
"!",
"a",
".",
"isEmpty",
"(",
")",
")",
"{",
"b",
".",
"addFirst",
"(",
"a",
".",
"pollLast",
"(",
")",
")",
";",
"}",
"return",
"b",
";",
"}",
"}",
";",
"final",
"Function",
"<",
"Deque",
"<",
"T",
">",
",",
"List",
"<",
"T",
">",
">",
"finisher",
"=",
"new",
"Function",
"<",
"Deque",
"<",
"T",
">",
",",
"List",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"T",
">",
"apply",
"(",
"Deque",
"<",
"T",
">",
"dqueue",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"dqueue",
")",
";",
"}",
"}",
";",
"return",
"new",
"CollectorImpl",
"<>",
"(",
"supplier",
",",
"accumulator",
",",
"combiner",
",",
"finisher",
",",
"CH_NOID",
")",
";",
"}"
] | Only works for sequential Stream.
@param n
@return
@throws UnsupportedOperationException operated by multiple threads | [
"Only",
"works",
"for",
"sequential",
"Stream",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Collectors.java#L1501-L1547 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getSharedFlow | public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request ) {
"""
Get the shared flow with the given class name.
@deprecated Use {@link #getSharedFlow(String, HttpServletRequest, ServletContext)} instead.
@param sharedFlowClassName the class name of the shared flow to retrieve.
@param request the current HttpServletRequest.
@return the {@link SharedFlowController} of the given class name which is stored in the user session.
"""
ServletContext servletContext = InternalUtils.getServletContext( request );
return getSharedFlow( sharedFlowClassName, request, servletContext );
} | java | public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request )
{
ServletContext servletContext = InternalUtils.getServletContext( request );
return getSharedFlow( sharedFlowClassName, request, servletContext );
} | [
"public",
"static",
"SharedFlowController",
"getSharedFlow",
"(",
"String",
"sharedFlowClassName",
",",
"HttpServletRequest",
"request",
")",
"{",
"ServletContext",
"servletContext",
"=",
"InternalUtils",
".",
"getServletContext",
"(",
"request",
")",
";",
"return",
"getSharedFlow",
"(",
"sharedFlowClassName",
",",
"request",
",",
"servletContext",
")",
";",
"}"
] | Get the shared flow with the given class name.
@deprecated Use {@link #getSharedFlow(String, HttpServletRequest, ServletContext)} instead.
@param sharedFlowClassName the class name of the shared flow to retrieve.
@param request the current HttpServletRequest.
@return the {@link SharedFlowController} of the given class name which is stored in the user session. | [
"Get",
"the",
"shared",
"flow",
"with",
"the",
"given",
"class",
"name",
".",
"@deprecated",
"Use",
"{",
"@link",
"#getSharedFlow",
"(",
"String",
"HttpServletRequest",
"ServletContext",
")",
"}",
"instead",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L361-L365 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.retrieveBean | @Override
public <T> T retrieveBean(String name, T bean) throws CpoException {
"""
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve
function defined for this beans returns more than one row, an exception will be thrown.
@param name DOCUMENT ME!
@param bean This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The
input bean is used to specify the search criteria, the output bean is populated with the results of the function.
@return An bean of the same type as the result argument that is filled in as specified the metadata for the
retireve.
@throws CpoException Thrown if there are errors accessing the datasource
"""
return processSelectGroup(bean, name, null, null, null);
} | java | @Override
public <T> T retrieveBean(String name, T bean) throws CpoException {
return processSelectGroup(bean, name, null, null, null);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"retrieveBean",
"(",
"String",
"name",
",",
"T",
"bean",
")",
"throws",
"CpoException",
"{",
"return",
"processSelectGroup",
"(",
"bean",
",",
"name",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve
function defined for this beans returns more than one row, an exception will be thrown.
@param name DOCUMENT ME!
@param bean This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The
input bean is used to specify the search criteria, the output bean is populated with the results of the function.
@return An bean of the same type as the result argument that is filled in as specified the metadata for the
retireve.
@throws CpoException Thrown if there are errors accessing the datasource | [
"Retrieves",
"the",
"bean",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"bean",
"exists",
"in",
"the",
"datasource",
".",
"If",
"the",
"retrieve",
"function",
"defined",
"for",
"this",
"beans",
"returns",
"more",
"than",
"one",
"row",
"an",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1359-L1362 |
Clivern/Racter | src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java | ReceiptTemplate.setSummary | public void setSummary(String subtotal, String shipping_cost, String total_tax, String total_cost) {
"""
Set Summary
@param subtotal the receipt sub-total
@param shipping_cost the receipt shipping cost
@param total_tax the receipt total tax
@param total_cost the receipt total cost
"""
this.summary.put("subtotal", subtotal);
this.summary.put("shipping_cost", shipping_cost);
this.summary.put("total_tax", total_tax);
this.summary.put("total_cost", total_cost);
} | java | public void setSummary(String subtotal, String shipping_cost, String total_tax, String total_cost)
{
this.summary.put("subtotal", subtotal);
this.summary.put("shipping_cost", shipping_cost);
this.summary.put("total_tax", total_tax);
this.summary.put("total_cost", total_cost);
} | [
"public",
"void",
"setSummary",
"(",
"String",
"subtotal",
",",
"String",
"shipping_cost",
",",
"String",
"total_tax",
",",
"String",
"total_cost",
")",
"{",
"this",
".",
"summary",
".",
"put",
"(",
"\"subtotal\"",
",",
"subtotal",
")",
";",
"this",
".",
"summary",
".",
"put",
"(",
"\"shipping_cost\"",
",",
"shipping_cost",
")",
";",
"this",
".",
"summary",
".",
"put",
"(",
"\"total_tax\"",
",",
"total_tax",
")",
";",
"this",
".",
"summary",
".",
"put",
"(",
"\"total_cost\"",
",",
"total_cost",
")",
";",
"}"
] | Set Summary
@param subtotal the receipt sub-total
@param shipping_cost the receipt shipping cost
@param total_tax the receipt total tax
@param total_cost the receipt total cost | [
"Set",
"Summary"
] | train | https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java#L172-L178 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java | PathTemplate.matchFromFullName | @Nullable
public ImmutableMap<String, String> matchFromFullName(String path) {
"""
Matches the path, where the first segment is interpreted as the host name regardless of whether
it starts with '//' or not. Example: <pre>
assert template("{name=shelves/*}").matchFromFullName("somewhere.io/shelves/s1")
.equals(ImmutableMap.of(HOSTNAME_VAR, "somewhere.io", "name", "shelves/s1"));
</pre>
"""
return match(path, true);
} | java | @Nullable
public ImmutableMap<String, String> matchFromFullName(String path) {
return match(path, true);
} | [
"@",
"Nullable",
"public",
"ImmutableMap",
"<",
"String",
",",
"String",
">",
"matchFromFullName",
"(",
"String",
"path",
")",
"{",
"return",
"match",
"(",
"path",
",",
"true",
")",
";",
"}"
] | Matches the path, where the first segment is interpreted as the host name regardless of whether
it starts with '//' or not. Example: <pre>
assert template("{name=shelves/*}").matchFromFullName("somewhere.io/shelves/s1")
.equals(ImmutableMap.of(HOSTNAME_VAR, "somewhere.io", "name", "shelves/s1"));
</pre> | [
"Matches",
"the",
"path",
"where",
"the",
"first",
"segment",
"is",
"interpreted",
"as",
"the",
"host",
"name",
"regardless",
"of",
"whether",
"it",
"starts",
"with",
"//",
"or",
"not",
".",
"Example",
":",
"<pre",
">",
"assert",
"template",
"(",
"{",
"name",
"=",
"shelves",
"/",
"*",
"}",
")",
".",
"matchFromFullName",
"(",
"somewhere",
".",
"io",
"/",
"shelves",
"/",
"s1",
")",
".",
"equals",
"(",
"ImmutableMap",
".",
"of",
"(",
"HOSTNAME_VAR",
"somewhere",
".",
"io",
"name",
"shelves",
"/",
"s1",
"))",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java#L459-L462 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/MustBeSmallerOrEqualValidator.java | MustBeSmallerOrEqualValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
"""
{@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext)
"""
if (pvalue == null) {
return true;
}
try {
final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name);
final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name);
if (!smaller(field1Value, field2Value)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
try {
final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name);
final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name);
if (!smaller(field1Value, field2Value)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"pvalue",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"final",
"Object",
"field1Value",
"=",
"BeanPropertyReaderUtil",
".",
"getNullSaveProperty",
"(",
"pvalue",
",",
"field1Name",
")",
";",
"final",
"Object",
"field2Value",
"=",
"BeanPropertyReaderUtil",
".",
"getNullSaveProperty",
"(",
"pvalue",
",",
"field2Name",
")",
";",
"if",
"(",
"!",
"smaller",
"(",
"field1Value",
",",
"field2Value",
")",
")",
"{",
"switchContext",
"(",
"pcontext",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"final",
"Exception",
"ignore",
")",
"{",
"switchContext",
"(",
"pcontext",
")",
";",
"return",
"false",
";",
"}",
"}"
] | {@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"object",
"is",
"valid",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/MustBeSmallerOrEqualValidator.java#L76-L93 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.multiplyAndRound | private static BigDecimal multiplyAndRound(long x, long y, int scale, MathContext mc) {
"""
Multiplies two long values and rounds according {@code MathContext}
"""
long product = multiply(x, y);
if(product!=INFLATED) {
return doRound(product, scale, mc);
}
// attempt to do it in 128 bits
int rsign = 1;
if(x < 0) {
x = -x;
rsign = -1;
}
if(y < 0) {
y = -y;
rsign *= -1;
}
// multiply dividend0 * dividend1
long m0_hi = x >>> 32;
long m0_lo = x & LONG_MASK;
long m1_hi = y >>> 32;
long m1_lo = y & LONG_MASK;
product = m0_lo * m1_lo;
long m0 = product & LONG_MASK;
long m1 = product >>> 32;
product = m0_hi * m1_lo + m1;
m1 = product & LONG_MASK;
long m2 = product >>> 32;
product = m0_lo * m1_hi + m1;
m1 = product & LONG_MASK;
m2 += product >>> 32;
long m3 = m2>>>32;
m2 &= LONG_MASK;
product = m0_hi*m1_hi + m2;
m2 = product & LONG_MASK;
m3 = ((product>>>32) + m3) & LONG_MASK;
final long mHi = make64(m3,m2);
final long mLo = make64(m1,m0);
BigDecimal res = doRound128(mHi, mLo, rsign, scale, mc);
if(res!=null) {
return res;
}
res = new BigDecimal(BigInteger.valueOf(x).multiply(y*rsign), INFLATED, scale, 0);
return doRound(res,mc);
} | java | private static BigDecimal multiplyAndRound(long x, long y, int scale, MathContext mc) {
long product = multiply(x, y);
if(product!=INFLATED) {
return doRound(product, scale, mc);
}
// attempt to do it in 128 bits
int rsign = 1;
if(x < 0) {
x = -x;
rsign = -1;
}
if(y < 0) {
y = -y;
rsign *= -1;
}
// multiply dividend0 * dividend1
long m0_hi = x >>> 32;
long m0_lo = x & LONG_MASK;
long m1_hi = y >>> 32;
long m1_lo = y & LONG_MASK;
product = m0_lo * m1_lo;
long m0 = product & LONG_MASK;
long m1 = product >>> 32;
product = m0_hi * m1_lo + m1;
m1 = product & LONG_MASK;
long m2 = product >>> 32;
product = m0_lo * m1_hi + m1;
m1 = product & LONG_MASK;
m2 += product >>> 32;
long m3 = m2>>>32;
m2 &= LONG_MASK;
product = m0_hi*m1_hi + m2;
m2 = product & LONG_MASK;
m3 = ((product>>>32) + m3) & LONG_MASK;
final long mHi = make64(m3,m2);
final long mLo = make64(m1,m0);
BigDecimal res = doRound128(mHi, mLo, rsign, scale, mc);
if(res!=null) {
return res;
}
res = new BigDecimal(BigInteger.valueOf(x).multiply(y*rsign), INFLATED, scale, 0);
return doRound(res,mc);
} | [
"private",
"static",
"BigDecimal",
"multiplyAndRound",
"(",
"long",
"x",
",",
"long",
"y",
",",
"int",
"scale",
",",
"MathContext",
"mc",
")",
"{",
"long",
"product",
"=",
"multiply",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"product",
"!=",
"INFLATED",
")",
"{",
"return",
"doRound",
"(",
"product",
",",
"scale",
",",
"mc",
")",
";",
"}",
"// attempt to do it in 128 bits",
"int",
"rsign",
"=",
"1",
";",
"if",
"(",
"x",
"<",
"0",
")",
"{",
"x",
"=",
"-",
"x",
";",
"rsign",
"=",
"-",
"1",
";",
"}",
"if",
"(",
"y",
"<",
"0",
")",
"{",
"y",
"=",
"-",
"y",
";",
"rsign",
"*=",
"-",
"1",
";",
"}",
"// multiply dividend0 * dividend1",
"long",
"m0_hi",
"=",
"x",
">>>",
"32",
";",
"long",
"m0_lo",
"=",
"x",
"&",
"LONG_MASK",
";",
"long",
"m1_hi",
"=",
"y",
">>>",
"32",
";",
"long",
"m1_lo",
"=",
"y",
"&",
"LONG_MASK",
";",
"product",
"=",
"m0_lo",
"*",
"m1_lo",
";",
"long",
"m0",
"=",
"product",
"&",
"LONG_MASK",
";",
"long",
"m1",
"=",
"product",
">>>",
"32",
";",
"product",
"=",
"m0_hi",
"*",
"m1_lo",
"+",
"m1",
";",
"m1",
"=",
"product",
"&",
"LONG_MASK",
";",
"long",
"m2",
"=",
"product",
">>>",
"32",
";",
"product",
"=",
"m0_lo",
"*",
"m1_hi",
"+",
"m1",
";",
"m1",
"=",
"product",
"&",
"LONG_MASK",
";",
"m2",
"+=",
"product",
">>>",
"32",
";",
"long",
"m3",
"=",
"m2",
">>>",
"32",
";",
"m2",
"&=",
"LONG_MASK",
";",
"product",
"=",
"m0_hi",
"*",
"m1_hi",
"+",
"m2",
";",
"m2",
"=",
"product",
"&",
"LONG_MASK",
";",
"m3",
"=",
"(",
"(",
"product",
">>>",
"32",
")",
"+",
"m3",
")",
"&",
"LONG_MASK",
";",
"final",
"long",
"mHi",
"=",
"make64",
"(",
"m3",
",",
"m2",
")",
";",
"final",
"long",
"mLo",
"=",
"make64",
"(",
"m1",
",",
"m0",
")",
";",
"BigDecimal",
"res",
"=",
"doRound128",
"(",
"mHi",
",",
"mLo",
",",
"rsign",
",",
"scale",
",",
"mc",
")",
";",
"if",
"(",
"res",
"!=",
"null",
")",
"{",
"return",
"res",
";",
"}",
"res",
"=",
"new",
"BigDecimal",
"(",
"BigInteger",
".",
"valueOf",
"(",
"x",
")",
".",
"multiply",
"(",
"y",
"*",
"rsign",
")",
",",
"INFLATED",
",",
"scale",
",",
"0",
")",
";",
"return",
"doRound",
"(",
"res",
",",
"mc",
")",
";",
"}"
] | Multiplies two long values and rounds according {@code MathContext} | [
"Multiplies",
"two",
"long",
"values",
"and",
"rounds",
"according",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L5024-L5066 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.put | public static void put(Writer writer, Enum<?> value) throws IOException {
"""
Writes the given value with the given writer.
@param writer
@param value
@throws IOException
@author vvakame
"""
if (value == null) {
writer.write("null");
} else {
writer.write("\"");
writer.write(sanitize(value.name()));
writer.write("\"");
}
} | java | public static void put(Writer writer, Enum<?> value) throws IOException {
if (value == null) {
writer.write("null");
} else {
writer.write("\"");
writer.write(sanitize(value.name()));
writer.write("\"");
}
} | [
"public",
"static",
"void",
"put",
"(",
"Writer",
"writer",
",",
"Enum",
"<",
"?",
">",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"writer",
".",
"write",
"(",
"\"\\\"\"",
")",
";",
"writer",
".",
"write",
"(",
"sanitize",
"(",
"value",
".",
"name",
"(",
")",
")",
")",
";",
"writer",
".",
"write",
"(",
"\"\\\"\"",
")",
";",
"}",
"}"
] | Writes the given value with the given writer.
@param writer
@param value
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L585-L593 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java | ImplRectifyImageOps_F64.adjustCalibrated | private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
DMatrixRMaj rectifyK,
RectangleLength2D_F64 bound, double scale) {
"""
Internal function which applies the rectification adjustment to a calibrated stereo pair
"""
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getDDRM());
rectifyLeft.set(K.mult(rL).getDDRM());
rectifyRight.set(K.mult(rR).getDDRM());
} | java | private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
DMatrixRMaj rectifyK,
RectangleLength2D_F64 bound, double scale) {
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getDDRM());
rectifyLeft.set(K.mult(rL).getDDRM());
rectifyRight.set(K.mult(rR).getDDRM());
} | [
"private",
"static",
"void",
"adjustCalibrated",
"(",
"DMatrixRMaj",
"rectifyLeft",
",",
"DMatrixRMaj",
"rectifyRight",
",",
"DMatrixRMaj",
"rectifyK",
",",
"RectangleLength2D_F64",
"bound",
",",
"double",
"scale",
")",
"{",
"// translation",
"double",
"deltaX",
"=",
"-",
"bound",
".",
"x0",
"*",
"scale",
";",
"double",
"deltaY",
"=",
"-",
"bound",
".",
"y0",
"*",
"scale",
";",
"// adjustment matrix",
"SimpleMatrix",
"A",
"=",
"new",
"SimpleMatrix",
"(",
"3",
",",
"3",
",",
"true",
",",
"new",
"double",
"[",
"]",
"{",
"scale",
",",
"0",
",",
"deltaX",
",",
"0",
",",
"scale",
",",
"deltaY",
",",
"0",
",",
"0",
",",
"1",
"}",
")",
";",
"SimpleMatrix",
"rL",
"=",
"SimpleMatrix",
".",
"wrap",
"(",
"rectifyLeft",
")",
";",
"SimpleMatrix",
"rR",
"=",
"SimpleMatrix",
".",
"wrap",
"(",
"rectifyRight",
")",
";",
"SimpleMatrix",
"K",
"=",
"SimpleMatrix",
".",
"wrap",
"(",
"rectifyK",
")",
";",
"// remove previous calibration matrix",
"SimpleMatrix",
"K_inv",
"=",
"K",
".",
"invert",
"(",
")",
";",
"rL",
"=",
"K_inv",
".",
"mult",
"(",
"rL",
")",
";",
"rR",
"=",
"K_inv",
".",
"mult",
"(",
"rR",
")",
";",
"// compute new calibration matrix and apply it",
"K",
"=",
"A",
".",
"mult",
"(",
"K",
")",
";",
"rectifyK",
".",
"set",
"(",
"K",
".",
"getDDRM",
"(",
")",
")",
";",
"rectifyLeft",
".",
"set",
"(",
"K",
".",
"mult",
"(",
"rL",
")",
".",
"getDDRM",
"(",
")",
")",
";",
"rectifyRight",
".",
"set",
"(",
"K",
".",
"mult",
"(",
"rR",
")",
".",
"getDDRM",
"(",
")",
")",
";",
"}"
] | Internal function which applies the rectification adjustment to a calibrated stereo pair | [
"Internal",
"function",
"which",
"applies",
"the",
"rectification",
"adjustment",
"to",
"a",
"calibrated",
"stereo",
"pair"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java#L127-L151 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deletePublishList | public void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
"""
Deletes the publish list assigned to a publish job.<p>
@param dbc the current database context
@param publishHistoryId the history id identifying the publish job
@throws CmsException if something goes wrong
"""
getProjectDriver(dbc).deletePublishList(dbc, publishHistoryId);
} | java | public void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
getProjectDriver(dbc).deletePublishList(dbc, publishHistoryId);
} | [
"public",
"void",
"deletePublishList",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"publishHistoryId",
")",
"throws",
"CmsException",
"{",
"getProjectDriver",
"(",
"dbc",
")",
".",
"deletePublishList",
"(",
"dbc",
",",
"publishHistoryId",
")",
";",
"}"
] | Deletes the publish list assigned to a publish job.<p>
@param dbc the current database context
@param publishHistoryId the history id identifying the publish job
@throws CmsException if something goes wrong | [
"Deletes",
"the",
"publish",
"list",
"assigned",
"to",
"a",
"publish",
"job",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2787-L2790 |
ragnor/simple-spring-memcached | simple-spring-memcached/src/main/java/com/google/code/ssm/CacheFactory.java | CacheFactory.createCache | protected Cache createCache() throws IOException {
"""
Only one cache is created.
@return cache
@throws IOException
"""
// this factory creates only one single cache and return it if someone invoked this method twice or
// more
if (cache != null) {
throw new IllegalStateException(String.format("This factory has already created memcached client for cache %s", cacheName));
}
if (isCacheDisabled()) {
LOGGER.warn("Cache {} is disabled", cacheName);
cache = (Cache) Proxy.newProxyInstance(Cache.class.getClassLoader(), new Class[] { Cache.class },
new DisabledCacheInvocationHandler(cacheName, cacheAliases));
return cache;
}
if (configuration == null) {
throw new RuntimeException(String.format("The MemcachedConnectionBean for cache %s must be defined!", cacheName));
}
List<InetSocketAddress> addrs = addressProvider.getAddresses();
cache = new CacheImpl(cacheName, cacheAliases, createClient(addrs), defaultSerializationType, jsonTranscoder, javaTranscoder,
customTranscoder, new CacheProperties(configuration.isUseNameAsKeyPrefix(), configuration.getKeyPrefixSeparator()));
return cache;
} | java | protected Cache createCache() throws IOException {
// this factory creates only one single cache and return it if someone invoked this method twice or
// more
if (cache != null) {
throw new IllegalStateException(String.format("This factory has already created memcached client for cache %s", cacheName));
}
if (isCacheDisabled()) {
LOGGER.warn("Cache {} is disabled", cacheName);
cache = (Cache) Proxy.newProxyInstance(Cache.class.getClassLoader(), new Class[] { Cache.class },
new DisabledCacheInvocationHandler(cacheName, cacheAliases));
return cache;
}
if (configuration == null) {
throw new RuntimeException(String.format("The MemcachedConnectionBean for cache %s must be defined!", cacheName));
}
List<InetSocketAddress> addrs = addressProvider.getAddresses();
cache = new CacheImpl(cacheName, cacheAliases, createClient(addrs), defaultSerializationType, jsonTranscoder, javaTranscoder,
customTranscoder, new CacheProperties(configuration.isUseNameAsKeyPrefix(), configuration.getKeyPrefixSeparator()));
return cache;
} | [
"protected",
"Cache",
"createCache",
"(",
")",
"throws",
"IOException",
"{",
"// this factory creates only one single cache and return it if someone invoked this method twice or",
"// more",
"if",
"(",
"cache",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"This factory has already created memcached client for cache %s\"",
",",
"cacheName",
")",
")",
";",
"}",
"if",
"(",
"isCacheDisabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Cache {} is disabled\"",
",",
"cacheName",
")",
";",
"cache",
"=",
"(",
"Cache",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"Cache",
".",
"class",
".",
"getClassLoader",
"(",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"Cache",
".",
"class",
"}",
",",
"new",
"DisabledCacheInvocationHandler",
"(",
"cacheName",
",",
"cacheAliases",
")",
")",
";",
"return",
"cache",
";",
"}",
"if",
"(",
"configuration",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"The MemcachedConnectionBean for cache %s must be defined!\"",
",",
"cacheName",
")",
")",
";",
"}",
"List",
"<",
"InetSocketAddress",
">",
"addrs",
"=",
"addressProvider",
".",
"getAddresses",
"(",
")",
";",
"cache",
"=",
"new",
"CacheImpl",
"(",
"cacheName",
",",
"cacheAliases",
",",
"createClient",
"(",
"addrs",
")",
",",
"defaultSerializationType",
",",
"jsonTranscoder",
",",
"javaTranscoder",
",",
"customTranscoder",
",",
"new",
"CacheProperties",
"(",
"configuration",
".",
"isUseNameAsKeyPrefix",
"(",
")",
",",
"configuration",
".",
"getKeyPrefixSeparator",
"(",
")",
")",
")",
";",
"return",
"cache",
";",
"}"
] | Only one cache is created.
@return cache
@throws IOException | [
"Only",
"one",
"cache",
"is",
"created",
"."
] | train | https://github.com/ragnor/simple-spring-memcached/blob/83db68aa1af219397e132426e377d45f397d31e7/simple-spring-memcached/src/main/java/com/google/code/ssm/CacheFactory.java#L182-L205 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java | FavoritesInner.updateAsync | public Observable<ApplicationInsightsComponentFavoriteInner> updateAsync(String resourceGroupName, String resourceName, String favoriteId, ApplicationInsightsComponentFavoriteInner favoriteProperties) {
"""
Updates a favorite that has already been added to an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param favoriteId The Id of a specific favorite defined in the Application Insights component
@param favoriteProperties Properties that need to be specified to update the existing favorite.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentFavoriteInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() {
@Override
public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentFavoriteInner> updateAsync(String resourceGroupName, String resourceName, String favoriteId, ApplicationInsightsComponentFavoriteInner favoriteProperties) {
return updateWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() {
@Override
public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"favoriteId",
",",
"ApplicationInsightsComponentFavoriteInner",
"favoriteProperties",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"favoriteId",
",",
"favoriteProperties",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
",",
"ApplicationInsightsComponentFavoriteInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationInsightsComponentFavoriteInner",
"call",
"(",
"ServiceResponse",
"<",
"ApplicationInsightsComponentFavoriteInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Updates a favorite that has already been added to an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param favoriteId The Id of a specific favorite defined in the Application Insights component
@param favoriteProperties Properties that need to be specified to update the existing favorite.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentFavoriteInner object | [
"Updates",
"a",
"favorite",
"that",
"has",
"already",
"been",
"added",
"to",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java#L508-L515 |
profesorfalken/jPowerShell | src/main/java/com/profesorfalken/jpowershell/PowerShell.java | PowerShell.executeScript | public PowerShellResponse executeScript(BufferedReader srcReader, String params) {
"""
Execute the provided PowerShell script in PowerShell console and gets
result.
@param srcReader the script as BufferedReader (when loading File from jar)
@param params the parameters of the script
@return response with the output of the command
"""
PowerShellResponse response;
if (srcReader != null) {
File tmpFile = createWriteTempFile(srcReader);
if (tmpFile != null) {
this.scriptMode = true;
response = executeCommand(tmpFile.getAbsolutePath() + " " + params);
tmpFile.delete();
} else {
response = new PowerShellResponse(true, "Cannot create temp script file!", false);
}
} else {
logger.log(Level.SEVERE, "Script buffered reader is null!");
response = new PowerShellResponse(true, "Script buffered reader is null!", false);
}
return response;
} | java | public PowerShellResponse executeScript(BufferedReader srcReader, String params) {
PowerShellResponse response;
if (srcReader != null) {
File tmpFile = createWriteTempFile(srcReader);
if (tmpFile != null) {
this.scriptMode = true;
response = executeCommand(tmpFile.getAbsolutePath() + " " + params);
tmpFile.delete();
} else {
response = new PowerShellResponse(true, "Cannot create temp script file!", false);
}
} else {
logger.log(Level.SEVERE, "Script buffered reader is null!");
response = new PowerShellResponse(true, "Script buffered reader is null!", false);
}
return response;
} | [
"public",
"PowerShellResponse",
"executeScript",
"(",
"BufferedReader",
"srcReader",
",",
"String",
"params",
")",
"{",
"PowerShellResponse",
"response",
";",
"if",
"(",
"srcReader",
"!=",
"null",
")",
"{",
"File",
"tmpFile",
"=",
"createWriteTempFile",
"(",
"srcReader",
")",
";",
"if",
"(",
"tmpFile",
"!=",
"null",
")",
"{",
"this",
".",
"scriptMode",
"=",
"true",
";",
"response",
"=",
"executeCommand",
"(",
"tmpFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" \"",
"+",
"params",
")",
";",
"tmpFile",
".",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"response",
"=",
"new",
"PowerShellResponse",
"(",
"true",
",",
"\"Cannot create temp script file!\"",
",",
"false",
")",
";",
"}",
"}",
"else",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Script buffered reader is null!\"",
")",
";",
"response",
"=",
"new",
"PowerShellResponse",
"(",
"true",
",",
"\"Script buffered reader is null!\"",
",",
"false",
")",
";",
"}",
"return",
"response",
";",
"}"
] | Execute the provided PowerShell script in PowerShell console and gets
result.
@param srcReader the script as BufferedReader (when loading File from jar)
@param params the parameters of the script
@return response with the output of the command | [
"Execute",
"the",
"provided",
"PowerShell",
"script",
"in",
"PowerShell",
"console",
"and",
"gets",
"result",
"."
] | train | https://github.com/profesorfalken/jPowerShell/blob/a0fb9d3b9db12dd5635de810e6366e17b932ee10/src/main/java/com/profesorfalken/jpowershell/PowerShell.java#L332-L349 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java | ContentPackage.writeXmlDocument | private void writeXmlDocument(String path, Document doc) throws IOException {
"""
Writes an XML document as binary file entry to the ZIP output stream.
@param path Content path
@param doc XML content
@throws IOException I/O exception
"""
zip.putNextEntry(new ZipEntry(path));
try {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(zip);
transformer.transform(source, result);
}
catch (TransformerException ex) {
throw new IOException("Failed to generate XML: " + ex.getMessage(), ex);
}
finally {
zip.closeEntry();
}
} | java | private void writeXmlDocument(String path, Document doc) throws IOException {
zip.putNextEntry(new ZipEntry(path));
try {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(zip);
transformer.transform(source, result);
}
catch (TransformerException ex) {
throw new IOException("Failed to generate XML: " + ex.getMessage(), ex);
}
finally {
zip.closeEntry();
}
} | [
"private",
"void",
"writeXmlDocument",
"(",
"String",
"path",
",",
"Document",
"doc",
")",
"throws",
"IOException",
"{",
"zip",
".",
"putNextEntry",
"(",
"new",
"ZipEntry",
"(",
"path",
")",
")",
";",
"try",
"{",
"DOMSource",
"source",
"=",
"new",
"DOMSource",
"(",
"doc",
")",
";",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"zip",
")",
";",
"transformer",
".",
"transform",
"(",
"source",
",",
"result",
")",
";",
"}",
"catch",
"(",
"TransformerException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Failed to generate XML: \"",
"+",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"zip",
".",
"closeEntry",
"(",
")",
";",
"}",
"}"
] | Writes an XML document as binary file entry to the ZIP output stream.
@param path Content path
@param doc XML content
@throws IOException I/O exception | [
"Writes",
"an",
"XML",
"document",
"as",
"binary",
"file",
"entry",
"to",
"the",
"ZIP",
"output",
"stream",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L351-L364 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.deletePath | public static void deletePath(FileSystem fs, Path f, boolean recursive) throws IOException {
"""
A wrapper around {@link FileSystem#delete(Path, boolean)} which throws {@link IOException} if the given
{@link Path} exists, and {@link FileSystem#delete(Path, boolean)} returns False.
"""
if (fs.exists(f) && !fs.delete(f, recursive)) {
throw new IOException("Failed to delete: " + f);
}
} | java | public static void deletePath(FileSystem fs, Path f, boolean recursive) throws IOException {
if (fs.exists(f) && !fs.delete(f, recursive)) {
throw new IOException("Failed to delete: " + f);
}
} | [
"public",
"static",
"void",
"deletePath",
"(",
"FileSystem",
"fs",
",",
"Path",
"f",
",",
"boolean",
"recursive",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fs",
".",
"exists",
"(",
"f",
")",
"&&",
"!",
"fs",
".",
"delete",
"(",
"f",
",",
"recursive",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Failed to delete: \"",
"+",
"f",
")",
";",
"}",
"}"
] | A wrapper around {@link FileSystem#delete(Path, boolean)} which throws {@link IOException} if the given
{@link Path} exists, and {@link FileSystem#delete(Path, boolean)} returns False. | [
"A",
"wrapper",
"around",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L147-L151 |
Karumi/Dexter | dexter/src/main/java/com/karumi/dexter/DexterInstance.java | DexterInstance.checkPermission | void checkPermission(PermissionListener listener, String permission, Thread thread) {
"""
Checks the state of a specific permission reporting it when ready to the listener.
@param listener The class that will be reported when the state of the permission is ready
@param permission One of the values found in {@link android.Manifest.permission}
@param thread thread the Listener methods will be called on
"""
checkSinglePermission(listener, permission, thread);
} | java | void checkPermission(PermissionListener listener, String permission, Thread thread) {
checkSinglePermission(listener, permission, thread);
} | [
"void",
"checkPermission",
"(",
"PermissionListener",
"listener",
",",
"String",
"permission",
",",
"Thread",
"thread",
")",
"{",
"checkSinglePermission",
"(",
"listener",
",",
"permission",
",",
"thread",
")",
";",
"}"
] | Checks the state of a specific permission reporting it when ready to the listener.
@param listener The class that will be reported when the state of the permission is ready
@param permission One of the values found in {@link android.Manifest.permission}
@param thread thread the Listener methods will be called on | [
"Checks",
"the",
"state",
"of",
"a",
"specific",
"permission",
"reporting",
"it",
"when",
"ready",
"to",
"the",
"listener",
"."
] | train | https://github.com/Karumi/Dexter/blob/11cfa35a2eaa51f01f6678adb69bed0382a867e7/dexter/src/main/java/com/karumi/dexter/DexterInstance.java#L85-L87 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java | PageFlowTagUtils.rewriteActionURL | public static String rewriteActionURL(PageContext pageContext, String action, Map params, String location)
throws URISyntaxException {
"""
Create a fully-rewritten url from an initial action url with query parameters
and an anchor (location on page), checking if it needs to be secure then call
the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#ACTION}.
@param pageContext the current PageContext.
@param action the action url to rewrite.
@param params the query parameters for this url.
@param location the location (anchor or fragment) for this url.
@return a uri that has been run through the URL rewriter service.
"""
ServletContext servletContext = pageContext.getServletContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
if (action.length() > 0 && action.charAt(0) == '/') action = action.substring(1);
return PageFlowUtils.getRewrittenActionURI(servletContext, request, response, action, params, location, forXML);
} | java | public static String rewriteActionURL(PageContext pageContext, String action, Map params, String location)
throws URISyntaxException
{
ServletContext servletContext = pageContext.getServletContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
if (action.length() > 0 && action.charAt(0) == '/') action = action.substring(1);
return PageFlowUtils.getRewrittenActionURI(servletContext, request, response, action, params, location, forXML);
} | [
"public",
"static",
"String",
"rewriteActionURL",
"(",
"PageContext",
"pageContext",
",",
"String",
"action",
",",
"Map",
"params",
",",
"String",
"location",
")",
"throws",
"URISyntaxException",
"{",
"ServletContext",
"servletContext",
"=",
"pageContext",
".",
"getServletContext",
"(",
")",
";",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pageContext",
".",
"getRequest",
"(",
")",
";",
"HttpServletResponse",
"response",
"=",
"(",
"HttpServletResponse",
")",
"pageContext",
".",
"getResponse",
"(",
")",
";",
"boolean",
"forXML",
"=",
"TagRenderingBase",
".",
"Factory",
".",
"isXHTML",
"(",
"request",
")",
";",
"if",
"(",
"action",
".",
"length",
"(",
")",
">",
"0",
"&&",
"action",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"action",
"=",
"action",
".",
"substring",
"(",
"1",
")",
";",
"return",
"PageFlowUtils",
".",
"getRewrittenActionURI",
"(",
"servletContext",
",",
"request",
",",
"response",
",",
"action",
",",
"params",
",",
"location",
",",
"forXML",
")",
";",
"}"
] | Create a fully-rewritten url from an initial action url with query parameters
and an anchor (location on page), checking if it needs to be secure then call
the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#ACTION}.
@param pageContext the current PageContext.
@param action the action url to rewrite.
@param params the query parameters for this url.
@param location the location (anchor or fragment) for this url.
@return a uri that has been run through the URL rewriter service. | [
"Create",
"a",
"fully",
"-",
"rewritten",
"url",
"from",
"an",
"initial",
"action",
"url",
"with",
"query",
"parameters",
"and",
"an",
"anchor",
"(",
"location",
"on",
"page",
")",
"checking",
"if",
"it",
"needs",
"to",
"be",
"secure",
"then",
"call",
"the",
"rewriter",
"service",
"using",
"a",
"type",
"of",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java#L60-L69 |
google/auto | value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java | AutoValueOrOneOfProcessor.fixReservedIdentifiers | static void fixReservedIdentifiers(Map<?, String> methodToIdentifier) {
"""
Modifies the values of the given map to avoid reserved words. If we have a getter called {@code
getPackage()} then we can't use the identifier {@code package} to represent its value since
that's a reserved word.
"""
for (Map.Entry<?, String> entry : methodToIdentifier.entrySet()) {
if (SourceVersion.isKeyword(entry.getValue())) {
entry.setValue(disambiguate(entry.getValue(), methodToIdentifier.values()));
}
}
} | java | static void fixReservedIdentifiers(Map<?, String> methodToIdentifier) {
for (Map.Entry<?, String> entry : methodToIdentifier.entrySet()) {
if (SourceVersion.isKeyword(entry.getValue())) {
entry.setValue(disambiguate(entry.getValue(), methodToIdentifier.values()));
}
}
} | [
"static",
"void",
"fixReservedIdentifiers",
"(",
"Map",
"<",
"?",
",",
"String",
">",
"methodToIdentifier",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
",",
"String",
">",
"entry",
":",
"methodToIdentifier",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"SourceVersion",
".",
"isKeyword",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
"{",
"entry",
".",
"setValue",
"(",
"disambiguate",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"methodToIdentifier",
".",
"values",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] | Modifies the values of the given map to avoid reserved words. If we have a getter called {@code
getPackage()} then we can't use the identifier {@code package} to represent its value since
that's a reserved word. | [
"Modifies",
"the",
"values",
"of",
"the",
"given",
"map",
"to",
"avoid",
"reserved",
"words",
".",
"If",
"we",
"have",
"a",
"getter",
"called",
"{"
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java#L639-L645 |
rzwitserloot/lombok | src/core/lombok/eclipse/handlers/HandleSuperBuilder.java | HandleSuperBuilder.generateStaticFillValuesMethod | private MethodDeclaration generateStaticFillValuesMethod(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, java.util.List<BuilderFieldData> builderFields, ASTNode source) {
"""
Generates a <code>$fillValuesFromInstanceIntoBuilder()</code> method in
the builder implementation class that copies all fields from the instance
to the builder. It looks like this:
<pre>
protected B $fillValuesFromInstanceIntoBuilder(Foobar instance, FoobarBuilder<?, ?> b) {
b.field(instance.field);
}
</pre>
"""
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_STATIC_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic;
out.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
TypeReference[] wildcards = new TypeReference[] {new Wildcard(Wildcard.UNBOUND), new Wildcard(Wildcard.UNBOUND)};
TypeReference builderType = new ParameterizedSingleTypeReference(builderClassName.toCharArray(), mergeToTypeReferences(typeParams, wildcards), 0, 0);
Argument builderArgument = new Argument(BUILDER_VARIABLE_NAME, 0, builderType, Modifier.FINAL);
TypeReference parentArgument = createTypeReferenceWithTypeParameters(tdParent.getName(), typeParams);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, parentArgument, Modifier.FINAL), builderArgument};
// Add type params if there are any.
if (typeParams.length > 0) out.typeParameters = copyTypeParams(typeParams, source);
List<Statement> body = new ArrayList<Statement>();
// Call the builder's setter methods to fill the values from the instance.
for (BuilderFieldData bfd : builderFields) {
MessageSend exec = createSetterCallWithInstanceValue(bfd, tdParent, source);
body.add(exec);
}
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | java | private MethodDeclaration generateStaticFillValuesMethod(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, java.util.List<BuilderFieldData> builderFields, ASTNode source) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_STATIC_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic;
out.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
TypeReference[] wildcards = new TypeReference[] {new Wildcard(Wildcard.UNBOUND), new Wildcard(Wildcard.UNBOUND)};
TypeReference builderType = new ParameterizedSingleTypeReference(builderClassName.toCharArray(), mergeToTypeReferences(typeParams, wildcards), 0, 0);
Argument builderArgument = new Argument(BUILDER_VARIABLE_NAME, 0, builderType, Modifier.FINAL);
TypeReference parentArgument = createTypeReferenceWithTypeParameters(tdParent.getName(), typeParams);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, parentArgument, Modifier.FINAL), builderArgument};
// Add type params if there are any.
if (typeParams.length > 0) out.typeParameters = copyTypeParams(typeParams, source);
List<Statement> body = new ArrayList<Statement>();
// Call the builder's setter methods to fill the values from the instance.
for (BuilderFieldData bfd : builderFields) {
MessageSend exec = createSetterCallWithInstanceValue(bfd, tdParent, source);
body.add(exec);
}
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | [
"private",
"MethodDeclaration",
"generateStaticFillValuesMethod",
"(",
"EclipseNode",
"tdParent",
",",
"String",
"builderClassName",
",",
"TypeParameter",
"[",
"]",
"typeParams",
",",
"java",
".",
"util",
".",
"List",
"<",
"BuilderFieldData",
">",
"builderFields",
",",
"ASTNode",
"source",
")",
"{",
"MethodDeclaration",
"out",
"=",
"new",
"MethodDeclaration",
"(",
"(",
"(",
"CompilationUnitDeclaration",
")",
"tdParent",
".",
"top",
"(",
")",
".",
"get",
"(",
")",
")",
".",
"compilationResult",
")",
";",
"out",
".",
"selector",
"=",
"FILL_VALUES_STATIC_METHOD_NAME",
";",
"out",
".",
"bits",
"|=",
"ECLIPSE_DO_NOT_TOUCH_FLAG",
";",
"out",
".",
"modifiers",
"=",
"ClassFileConstants",
".",
"AccPrivate",
"|",
"ClassFileConstants",
".",
"AccStatic",
";",
"out",
".",
"returnType",
"=",
"TypeReference",
".",
"baseTypeReference",
"(",
"TypeIds",
".",
"T_void",
",",
"0",
")",
";",
"TypeReference",
"[",
"]",
"wildcards",
"=",
"new",
"TypeReference",
"[",
"]",
"{",
"new",
"Wildcard",
"(",
"Wildcard",
".",
"UNBOUND",
")",
",",
"new",
"Wildcard",
"(",
"Wildcard",
".",
"UNBOUND",
")",
"}",
";",
"TypeReference",
"builderType",
"=",
"new",
"ParameterizedSingleTypeReference",
"(",
"builderClassName",
".",
"toCharArray",
"(",
")",
",",
"mergeToTypeReferences",
"(",
"typeParams",
",",
"wildcards",
")",
",",
"0",
",",
"0",
")",
";",
"Argument",
"builderArgument",
"=",
"new",
"Argument",
"(",
"BUILDER_VARIABLE_NAME",
",",
"0",
",",
"builderType",
",",
"Modifier",
".",
"FINAL",
")",
";",
"TypeReference",
"parentArgument",
"=",
"createTypeReferenceWithTypeParameters",
"(",
"tdParent",
".",
"getName",
"(",
")",
",",
"typeParams",
")",
";",
"out",
".",
"arguments",
"=",
"new",
"Argument",
"[",
"]",
"{",
"new",
"Argument",
"(",
"INSTANCE_VARIABLE_NAME",
",",
"0",
",",
"parentArgument",
",",
"Modifier",
".",
"FINAL",
")",
",",
"builderArgument",
"}",
";",
"// Add type params if there are any.",
"if",
"(",
"typeParams",
".",
"length",
">",
"0",
")",
"out",
".",
"typeParameters",
"=",
"copyTypeParams",
"(",
"typeParams",
",",
"source",
")",
";",
"List",
"<",
"Statement",
">",
"body",
"=",
"new",
"ArrayList",
"<",
"Statement",
">",
"(",
")",
";",
"// Call the builder's setter methods to fill the values from the instance.",
"for",
"(",
"BuilderFieldData",
"bfd",
":",
"builderFields",
")",
"{",
"MessageSend",
"exec",
"=",
"createSetterCallWithInstanceValue",
"(",
"bfd",
",",
"tdParent",
",",
"source",
")",
";",
"body",
".",
"add",
"(",
"exec",
")",
";",
"}",
"out",
".",
"statements",
"=",
"body",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"body",
".",
"toArray",
"(",
"new",
"Statement",
"[",
"0",
"]",
")",
";",
"return",
"out",
";",
"}"
] | Generates a <code>$fillValuesFromInstanceIntoBuilder()</code> method in
the builder implementation class that copies all fields from the instance
to the builder. It looks like this:
<pre>
protected B $fillValuesFromInstanceIntoBuilder(Foobar instance, FoobarBuilder<?, ?> b) {
b.field(instance.field);
}
</pre> | [
"Generates",
"a",
"<code",
">",
"$fillValuesFromInstanceIntoBuilder",
"()",
"<",
"/",
"code",
">",
"method",
"in",
"the",
"builder",
"implementation",
"class",
"that",
"copies",
"all",
"fields",
"from",
"the",
"instance",
"to",
"the",
"builder",
".",
"It",
"looks",
"like",
"this",
":"
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java#L688-L715 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.stripTrailingZeros | public BigDecimal stripTrailingZeros() {
"""
Returns a {@code BigDecimal} which is numerically equal to
this one but with any trailing zeros removed from the
representation. For example, stripping the trailing zeros from
the {@code BigDecimal} value {@code 600.0}, which has
[{@code BigInteger}, {@code scale}] components equals to
[6000, 1], yields {@code 6E2} with [{@code BigInteger},
{@code scale}] components equals to [6, -2]. If
this BigDecimal is numerically equal to zero, then
{@code BigDecimal.ZERO} is returned.
@return a numerically equal {@code BigDecimal} with any
trailing zeros removed.
@since 1.5
"""
if (intCompact == 0 || (intVal != null && intVal.signum() == 0)) {
return BigDecimal.ZERO;
} else if (intCompact != INFLATED) {
return createAndStripZerosToMatchScale(intCompact, scale, Long.MIN_VALUE);
} else {
return createAndStripZerosToMatchScale(intVal, scale, Long.MIN_VALUE);
}
} | java | public BigDecimal stripTrailingZeros() {
if (intCompact == 0 || (intVal != null && intVal.signum() == 0)) {
return BigDecimal.ZERO;
} else if (intCompact != INFLATED) {
return createAndStripZerosToMatchScale(intCompact, scale, Long.MIN_VALUE);
} else {
return createAndStripZerosToMatchScale(intVal, scale, Long.MIN_VALUE);
}
} | [
"public",
"BigDecimal",
"stripTrailingZeros",
"(",
")",
"{",
"if",
"(",
"intCompact",
"==",
"0",
"||",
"(",
"intVal",
"!=",
"null",
"&&",
"intVal",
".",
"signum",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"BigDecimal",
".",
"ZERO",
";",
"}",
"else",
"if",
"(",
"intCompact",
"!=",
"INFLATED",
")",
"{",
"return",
"createAndStripZerosToMatchScale",
"(",
"intCompact",
",",
"scale",
",",
"Long",
".",
"MIN_VALUE",
")",
";",
"}",
"else",
"{",
"return",
"createAndStripZerosToMatchScale",
"(",
"intVal",
",",
"scale",
",",
"Long",
".",
"MIN_VALUE",
")",
";",
"}",
"}"
] | Returns a {@code BigDecimal} which is numerically equal to
this one but with any trailing zeros removed from the
representation. For example, stripping the trailing zeros from
the {@code BigDecimal} value {@code 600.0}, which has
[{@code BigInteger}, {@code scale}] components equals to
[6000, 1], yields {@code 6E2} with [{@code BigInteger},
{@code scale}] components equals to [6, -2]. If
this BigDecimal is numerically equal to zero, then
{@code BigDecimal.ZERO} is returned.
@return a numerically equal {@code BigDecimal} with any
trailing zeros removed.
@since 1.5 | [
"Returns",
"a",
"{",
"@code",
"BigDecimal",
"}",
"which",
"is",
"numerically",
"equal",
"to",
"this",
"one",
"but",
"with",
"any",
"trailing",
"zeros",
"removed",
"from",
"the",
"representation",
".",
"For",
"example",
"stripping",
"the",
"trailing",
"zeros",
"from",
"the",
"{",
"@code",
"BigDecimal",
"}",
"value",
"{",
"@code",
"600",
".",
"0",
"}",
"which",
"has",
"[",
"{",
"@code",
"BigInteger",
"}",
"{",
"@code",
"scale",
"}",
"]",
"components",
"equals",
"to",
"[",
"6000",
"1",
"]",
"yields",
"{",
"@code",
"6E2",
"}",
"with",
"[",
"{",
"@code",
"BigInteger",
"}",
"{",
"@code",
"scale",
"}",
"]",
"components",
"equals",
"to",
"[",
"6",
"-",
"2",
"]",
".",
"If",
"this",
"BigDecimal",
"is",
"numerically",
"equal",
"to",
"zero",
"then",
"{",
"@code",
"BigDecimal",
".",
"ZERO",
"}",
"is",
"returned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L2596-L2604 |
Azure/azure-sdk-for-java | devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java | ControllersInner.beginCreate | public ControllerInner beginCreate(String resourceGroupName, String name, ControllerInner controller) {
"""
Creates an Azure Dev Spaces Controller.
Creates an Azure Dev Spaces Controller with the specified create parameters.
@param resourceGroupName Resource group to which the resource belongs.
@param name Name of the resource.
@param controller Controller create parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ControllerInner object if successful.
"""
return beginCreateWithServiceResponseAsync(resourceGroupName, name, controller).toBlocking().single().body();
} | java | public ControllerInner beginCreate(String resourceGroupName, String name, ControllerInner controller) {
return beginCreateWithServiceResponseAsync(resourceGroupName, name, controller).toBlocking().single().body();
} | [
"public",
"ControllerInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"ControllerInner",
"controller",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"controller",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates an Azure Dev Spaces Controller.
Creates an Azure Dev Spaces Controller with the specified create parameters.
@param resourceGroupName Resource group to which the resource belongs.
@param name Name of the resource.
@param controller Controller create parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ControllerInner object if successful. | [
"Creates",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
".",
"Creates",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
"with",
"the",
"specified",
"create",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java#L300-L302 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.removeEle | public static <T> T[] removeEle(T[] array, T element) throws IllegalArgumentException {
"""
移除数组中指定的元素<br>
只会移除匹配到的第一个元素 copy from commons-lang
@param <T> 数组元素类型
@param array 数组对象,可以是对象数组,也可以原始类型数组
@param element 要移除的元素
@return 去掉指定元素后的新数组或原数组
@throws IllegalArgumentException 参数对象不为数组对象
@since 3.0.8
"""
return remove(array, indexOf(array, element));
} | java | public static <T> T[] removeEle(T[] array, T element) throws IllegalArgumentException {
return remove(array, indexOf(array, element));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"removeEle",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"remove",
"(",
"array",
",",
"indexOf",
"(",
"array",
",",
"element",
")",
")",
";",
"}"
] | 移除数组中指定的元素<br>
只会移除匹配到的第一个元素 copy from commons-lang
@param <T> 数组元素类型
@param array 数组对象,可以是对象数组,也可以原始类型数组
@param element 要移除的元素
@return 去掉指定元素后的新数组或原数组
@throws IllegalArgumentException 参数对象不为数组对象
@since 3.0.8 | [
"移除数组中指定的元素<br",
">",
"只会移除匹配到的第一个元素",
"copy",
"from",
"commons",
"-",
"lang"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2805-L2807 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java | InMemoryTopology.getImportsRecursively | @Override
public List<ConfigKeyPath> getImportsRecursively(ConfigKeyPath configKey) {
"""
{@inheritDoc}.
<p>
If the result is already in cache, return the result.
Otherwise, delegate the functionality to the fallback object.
If the fallback did not support this operation, will build the entire topology of the {@link org.apache.gobblin.config.store.api.ConfigStore}
using default breath first search.
</p>
"""
return getImportsRecursively(configKey, Optional.<Config>absent());
} | java | @Override
public List<ConfigKeyPath> getImportsRecursively(ConfigKeyPath configKey) {
return getImportsRecursively(configKey, Optional.<Config>absent());
} | [
"@",
"Override",
"public",
"List",
"<",
"ConfigKeyPath",
">",
"getImportsRecursively",
"(",
"ConfigKeyPath",
"configKey",
")",
"{",
"return",
"getImportsRecursively",
"(",
"configKey",
",",
"Optional",
".",
"<",
"Config",
">",
"absent",
"(",
")",
")",
";",
"}"
] | {@inheritDoc}.
<p>
If the result is already in cache, return the result.
Otherwise, delegate the functionality to the fallback object.
If the fallback did not support this operation, will build the entire topology of the {@link org.apache.gobblin.config.store.api.ConfigStore}
using default breath first search.
</p> | [
"{",
"@inheritDoc",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java#L184-L187 |
apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java | BaseAppenderatorDriver.getAppendableSegment | private SegmentIdWithShardSpec getAppendableSegment(final DateTime timestamp, final String sequenceName) {
"""
Find a segment in the {@link SegmentState#APPENDING} state for the given timestamp and sequenceName.
"""
synchronized (segments) {
final SegmentsForSequence segmentsForSequence = segments.get(sequenceName);
if (segmentsForSequence == null) {
return null;
}
final Map.Entry<Long, SegmentsOfInterval> candidateEntry = segmentsForSequence.floor(
timestamp.getMillis()
);
if (candidateEntry != null) {
final SegmentsOfInterval segmentsOfInterval = candidateEntry.getValue();
if (segmentsOfInterval.interval.contains(timestamp)) {
return segmentsOfInterval.appendingSegment == null ?
null :
segmentsOfInterval.appendingSegment.getSegmentIdentifier();
} else {
return null;
}
} else {
return null;
}
}
} | java | private SegmentIdWithShardSpec getAppendableSegment(final DateTime timestamp, final String sequenceName)
{
synchronized (segments) {
final SegmentsForSequence segmentsForSequence = segments.get(sequenceName);
if (segmentsForSequence == null) {
return null;
}
final Map.Entry<Long, SegmentsOfInterval> candidateEntry = segmentsForSequence.floor(
timestamp.getMillis()
);
if (candidateEntry != null) {
final SegmentsOfInterval segmentsOfInterval = candidateEntry.getValue();
if (segmentsOfInterval.interval.contains(timestamp)) {
return segmentsOfInterval.appendingSegment == null ?
null :
segmentsOfInterval.appendingSegment.getSegmentIdentifier();
} else {
return null;
}
} else {
return null;
}
}
} | [
"private",
"SegmentIdWithShardSpec",
"getAppendableSegment",
"(",
"final",
"DateTime",
"timestamp",
",",
"final",
"String",
"sequenceName",
")",
"{",
"synchronized",
"(",
"segments",
")",
"{",
"final",
"SegmentsForSequence",
"segmentsForSequence",
"=",
"segments",
".",
"get",
"(",
"sequenceName",
")",
";",
"if",
"(",
"segmentsForSequence",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Map",
".",
"Entry",
"<",
"Long",
",",
"SegmentsOfInterval",
">",
"candidateEntry",
"=",
"segmentsForSequence",
".",
"floor",
"(",
"timestamp",
".",
"getMillis",
"(",
")",
")",
";",
"if",
"(",
"candidateEntry",
"!=",
"null",
")",
"{",
"final",
"SegmentsOfInterval",
"segmentsOfInterval",
"=",
"candidateEntry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"segmentsOfInterval",
".",
"interval",
".",
"contains",
"(",
"timestamp",
")",
")",
"{",
"return",
"segmentsOfInterval",
".",
"appendingSegment",
"==",
"null",
"?",
"null",
":",
"segmentsOfInterval",
".",
"appendingSegment",
".",
"getSegmentIdentifier",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"}"
] | Find a segment in the {@link SegmentState#APPENDING} state for the given timestamp and sequenceName. | [
"Find",
"a",
"segment",
"in",
"the",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java#L279-L305 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.beginDelete | public void beginDelete(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
"""
Deletes a connection to a ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@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
"""
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
",",
"connectionName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Deletes a connection to a ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@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 | [
"Deletes",
"a",
"connection",
"to",
"a",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L440-L442 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagEditable.java | CmsJspTagEditable.setDirectEditProviderParams | protected static void setDirectEditProviderParams(PageContext context, CmsDirectEditParams params) {
"""
Sets the current initialized instance of the direct edit provider parameters to the page context.<p>
@param context the current JSP page context
@param params the current initialized instance of the direct edit provider parameters to set
"""
// set the direct edit params as attribute to the request
context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS, params);
} | java | protected static void setDirectEditProviderParams(PageContext context, CmsDirectEditParams params) {
// set the direct edit params as attribute to the request
context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS, params);
} | [
"protected",
"static",
"void",
"setDirectEditProviderParams",
"(",
"PageContext",
"context",
",",
"CmsDirectEditParams",
"params",
")",
"{",
"// set the direct edit params as attribute to the request",
"context",
".",
"getRequest",
"(",
")",
".",
"setAttribute",
"(",
"I_CmsDirectEditProvider",
".",
"ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS",
",",
"params",
")",
";",
"}"
] | Sets the current initialized instance of the direct edit provider parameters to the page context.<p>
@param context the current JSP page context
@param params the current initialized instance of the direct edit provider parameters to set | [
"Sets",
"the",
"current",
"initialized",
"instance",
"of",
"the",
"direct",
"edit",
"provider",
"parameters",
"to",
"the",
"page",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEditable.java#L355-L359 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasSimpleRnn.java | KerasSimpleRnn.setWeights | @Override
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException {
"""
Set weights for layer.
@param weights Simple RNN weights
@throws InvalidKerasConfigurationException Invalid Keras configuration exception
"""
this.weights = new HashMap<>();
INDArray W;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_W()))
W = weights.get(conf.getKERAS_PARAM_NAME_W());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_W());
this.weights.put(SimpleRnnParamInitializer.WEIGHT_KEY, W);
INDArray RW;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_RW()))
RW = weights.get(conf.getKERAS_PARAM_NAME_RW());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_RW());
this.weights.put(SimpleRnnParamInitializer.RECURRENT_WEIGHT_KEY, RW);
INDArray b;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_B()))
b = weights.get(conf.getKERAS_PARAM_NAME_B());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_B());
this.weights.put(SimpleRnnParamInitializer.BIAS_KEY, b);
if (weights.size() > NUM_TRAINABLE_PARAMS) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_RW());
String unknownParamNames = paramNames.toString();
log.warn("Attemping to set weights for unknown parameters: "
+ unknownParamNames.substring(1, unknownParamNames.length() - 1));
}
} | java | @Override
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException {
this.weights = new HashMap<>();
INDArray W;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_W()))
W = weights.get(conf.getKERAS_PARAM_NAME_W());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_W());
this.weights.put(SimpleRnnParamInitializer.WEIGHT_KEY, W);
INDArray RW;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_RW()))
RW = weights.get(conf.getKERAS_PARAM_NAME_RW());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_RW());
this.weights.put(SimpleRnnParamInitializer.RECURRENT_WEIGHT_KEY, RW);
INDArray b;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_B()))
b = weights.get(conf.getKERAS_PARAM_NAME_B());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_B());
this.weights.put(SimpleRnnParamInitializer.BIAS_KEY, b);
if (weights.size() > NUM_TRAINABLE_PARAMS) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_RW());
String unknownParamNames = paramNames.toString();
log.warn("Attemping to set weights for unknown parameters: "
+ unknownParamNames.substring(1, unknownParamNames.length() - 1));
}
} | [
"@",
"Override",
"public",
"void",
"setWeights",
"(",
"Map",
"<",
"String",
",",
"INDArray",
">",
"weights",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"this",
".",
"weights",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"INDArray",
"W",
";",
"if",
"(",
"weights",
".",
"containsKey",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_W",
"(",
")",
")",
")",
"W",
"=",
"weights",
".",
"get",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_W",
"(",
")",
")",
";",
"else",
"throw",
"new",
"InvalidKerasConfigurationException",
"(",
"\"Keras SimpleRNN layer does not contain parameter \"",
"+",
"conf",
".",
"getKERAS_PARAM_NAME_W",
"(",
")",
")",
";",
"this",
".",
"weights",
".",
"put",
"(",
"SimpleRnnParamInitializer",
".",
"WEIGHT_KEY",
",",
"W",
")",
";",
"INDArray",
"RW",
";",
"if",
"(",
"weights",
".",
"containsKey",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_RW",
"(",
")",
")",
")",
"RW",
"=",
"weights",
".",
"get",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_RW",
"(",
")",
")",
";",
"else",
"throw",
"new",
"InvalidKerasConfigurationException",
"(",
"\"Keras SimpleRNN layer does not contain parameter \"",
"+",
"conf",
".",
"getKERAS_PARAM_NAME_RW",
"(",
")",
")",
";",
"this",
".",
"weights",
".",
"put",
"(",
"SimpleRnnParamInitializer",
".",
"RECURRENT_WEIGHT_KEY",
",",
"RW",
")",
";",
"INDArray",
"b",
";",
"if",
"(",
"weights",
".",
"containsKey",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_B",
"(",
")",
")",
")",
"b",
"=",
"weights",
".",
"get",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_B",
"(",
")",
")",
";",
"else",
"throw",
"new",
"InvalidKerasConfigurationException",
"(",
"\"Keras SimpleRNN layer does not contain parameter \"",
"+",
"conf",
".",
"getKERAS_PARAM_NAME_B",
"(",
")",
")",
";",
"this",
".",
"weights",
".",
"put",
"(",
"SimpleRnnParamInitializer",
".",
"BIAS_KEY",
",",
"b",
")",
";",
"if",
"(",
"weights",
".",
"size",
"(",
")",
">",
"NUM_TRAINABLE_PARAMS",
")",
"{",
"Set",
"<",
"String",
">",
"paramNames",
"=",
"weights",
".",
"keySet",
"(",
")",
";",
"paramNames",
".",
"remove",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_B",
"(",
")",
")",
";",
"paramNames",
".",
"remove",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_W",
"(",
")",
")",
";",
"paramNames",
".",
"remove",
"(",
"conf",
".",
"getKERAS_PARAM_NAME_RW",
"(",
")",
")",
";",
"String",
"unknownParamNames",
"=",
"paramNames",
".",
"toString",
"(",
")",
";",
"log",
".",
"warn",
"(",
"\"Attemping to set weights for unknown parameters: \"",
"+",
"unknownParamNames",
".",
"substring",
"(",
"1",
",",
"unknownParamNames",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
";",
"}",
"}"
] | Set weights for layer.
@param weights Simple RNN weights
@throws InvalidKerasConfigurationException Invalid Keras configuration exception | [
"Set",
"weights",
"for",
"layer",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasSimpleRnn.java#L249-L290 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.importMethodWithServiceResponseAsync | public Observable<ServiceResponse<String>> importMethodWithServiceResponseAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
"""
Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (luisApp == null) {
throw new IllegalArgumentException("Parameter luisApp is required and cannot be null.");
}
Validator.validate(luisApp);
final String versionId = importMethodOptionalParameter != null ? importMethodOptionalParameter.versionId() : null;
return importMethodWithServiceResponseAsync(appId, luisApp, versionId);
} | java | public Observable<ServiceResponse<String>> importMethodWithServiceResponseAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (luisApp == null) {
throw new IllegalArgumentException("Parameter luisApp is required and cannot be null.");
}
Validator.validate(luisApp);
final String versionId = importMethodOptionalParameter != null ? importMethodOptionalParameter.versionId() : null;
return importMethodWithServiceResponseAsync(appId, luisApp, versionId);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"String",
">",
">",
"importMethodWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"LuisApp",
"luisApp",
",",
"ImportMethodVersionsOptionalParameter",
"importMethodOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"luisApp",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter luisApp is required and cannot be null.\"",
")",
";",
"}",
"Validator",
".",
"validate",
"(",
"luisApp",
")",
";",
"final",
"String",
"versionId",
"=",
"importMethodOptionalParameter",
"!=",
"null",
"?",
"importMethodOptionalParameter",
".",
"versionId",
"(",
")",
":",
"null",
";",
"return",
"importMethodWithServiceResponseAsync",
"(",
"appId",
",",
"luisApp",
",",
"versionId",
")",
";",
"}"
] | Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L919-L933 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/collections/JMListTimeSeries.java | JMListTimeSeries.addAll | public void addAll(long timestamp, List<T> objectList) {
"""
Add all.
@param timestamp the timestamp
@param objectList the object list
"""
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds()
+ ", timeSeriesMap=" + timeSeriesMap.toString() + ")";
}
} | java | public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds()
+ ", timeSeriesMap=" + timeSeriesMap.toString() + ")";
}
} | [
"public",
"void",
"addAll",
"(",
"long",
"timestamp",
",",
"List",
"<",
"T",
">",
"objectList",
")",
"{",
"for",
"(",
"T",
"object",
":",
"objectList",
")",
"add",
"(",
"timestamp",
",",
"object",
")",
";",
"}",
"/*\n\t * (non-Javadoc)\n *\n * @see kr.jm.utils.collections.JMTimeSeries#toString()\n */",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"JMListTimeSeries(intervalSeconds=\"",
"+",
"getIntervalSeconds",
"(",
")",
"+",
"\", timeSeriesMap=\"",
"+",
"timeSeriesMap",
".",
"toString",
"(",
")",
"+",
"\")\"",
";",
"}",
"}"
] | Add all.
@param timestamp the timestamp
@param objectList the object list | [
"Add",
"all",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/JMListTimeSeries.java#L41-L57 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/random/Random.java | Random.nextDouble | public double nextDouble(double lo, double hi) {
"""
Generate a uniform random number in the range [lo, hi)
@param lo lower limit of range
@param hi upper limit of range
@return a uniform random real in the range [lo, hi)
"""
if (lo < 0) {
if (nextInt(2) == 0)
return -nextDouble(0, -lo);
else
return nextDouble(0, hi);
} else {
return (lo + (hi - lo) * nextDouble());
}
} | java | public double nextDouble(double lo, double hi) {
if (lo < 0) {
if (nextInt(2) == 0)
return -nextDouble(0, -lo);
else
return nextDouble(0, hi);
} else {
return (lo + (hi - lo) * nextDouble());
}
} | [
"public",
"double",
"nextDouble",
"(",
"double",
"lo",
",",
"double",
"hi",
")",
"{",
"if",
"(",
"lo",
"<",
"0",
")",
"{",
"if",
"(",
"nextInt",
"(",
"2",
")",
"==",
"0",
")",
"return",
"-",
"nextDouble",
"(",
"0",
",",
"-",
"lo",
")",
";",
"else",
"return",
"nextDouble",
"(",
"0",
",",
"hi",
")",
";",
"}",
"else",
"{",
"return",
"(",
"lo",
"+",
"(",
"hi",
"-",
"lo",
")",
"*",
"nextDouble",
"(",
")",
")",
";",
"}",
"}"
] | Generate a uniform random number in the range [lo, hi)
@param lo lower limit of range
@param hi upper limit of range
@return a uniform random real in the range [lo, hi) | [
"Generate",
"a",
"uniform",
"random",
"number",
"in",
"the",
"range",
"[",
"lo",
"hi",
")"
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/random/Random.java#L92-L101 |
roboconf/roboconf-platform | core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java | Ec2MachineConfigurator.associateElasticIp | private boolean associateElasticIp() {
"""
Associates an elastic IP with the VM.
@return true if there is nothing more to do about elastic IP configuration, false otherwise
"""
String elasticIp = this.targetProperties.get( Ec2Constants.ELASTIC_IP );
if( ! Utils.isEmptyOrWhitespaces( elasticIp )) {
this.logger.fine( "Associating an elastic IP with the instance. IP = " + elasticIp );
AssociateAddressRequest associateAddressRequest = new AssociateAddressRequest( this.machineId, elasticIp );
this.ec2Api.associateAddress( associateAddressRequest );
}
return true;
} | java | private boolean associateElasticIp() {
String elasticIp = this.targetProperties.get( Ec2Constants.ELASTIC_IP );
if( ! Utils.isEmptyOrWhitespaces( elasticIp )) {
this.logger.fine( "Associating an elastic IP with the instance. IP = " + elasticIp );
AssociateAddressRequest associateAddressRequest = new AssociateAddressRequest( this.machineId, elasticIp );
this.ec2Api.associateAddress( associateAddressRequest );
}
return true;
} | [
"private",
"boolean",
"associateElasticIp",
"(",
")",
"{",
"String",
"elasticIp",
"=",
"this",
".",
"targetProperties",
".",
"get",
"(",
"Ec2Constants",
".",
"ELASTIC_IP",
")",
";",
"if",
"(",
"!",
"Utils",
".",
"isEmptyOrWhitespaces",
"(",
"elasticIp",
")",
")",
"{",
"this",
".",
"logger",
".",
"fine",
"(",
"\"Associating an elastic IP with the instance. IP = \"",
"+",
"elasticIp",
")",
";",
"AssociateAddressRequest",
"associateAddressRequest",
"=",
"new",
"AssociateAddressRequest",
"(",
"this",
".",
"machineId",
",",
"elasticIp",
")",
";",
"this",
".",
"ec2Api",
".",
"associateAddress",
"(",
"associateAddressRequest",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Associates an elastic IP with the VM.
@return true if there is nothing more to do about elastic IP configuration, false otherwise | [
"Associates",
"an",
"elastic",
"IP",
"with",
"the",
"VM",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java#L207-L217 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/format/impl/MediaFormatHandlerImpl.java | MediaFormatHandlerImpl.isRenditionMatchSizeSameSmaller | private boolean isRenditionMatchSizeSameSmaller(MediaFormat mediaFormat, MediaFormat mediaFormatRequested) {
"""
Checks if the given media format size is same size or smaller than the requested one.
@param mediaFormat Media format
@param mediaFormatRequested Requested media format
@return true if media format is same size or smaller
"""
long widthRequested = mediaFormatRequested.getEffectiveMinWidth();
long heightRequested = mediaFormatRequested.getEffectiveMinHeight();
long widthMin = mediaFormat.getEffectiveMinWidth();
long heightMin = mediaFormat.getEffectiveMinHeight();
return widthMin <= widthRequested && heightMin <= heightRequested;
} | java | private boolean isRenditionMatchSizeSameSmaller(MediaFormat mediaFormat, MediaFormat mediaFormatRequested) {
long widthRequested = mediaFormatRequested.getEffectiveMinWidth();
long heightRequested = mediaFormatRequested.getEffectiveMinHeight();
long widthMin = mediaFormat.getEffectiveMinWidth();
long heightMin = mediaFormat.getEffectiveMinHeight();
return widthMin <= widthRequested && heightMin <= heightRequested;
} | [
"private",
"boolean",
"isRenditionMatchSizeSameSmaller",
"(",
"MediaFormat",
"mediaFormat",
",",
"MediaFormat",
"mediaFormatRequested",
")",
"{",
"long",
"widthRequested",
"=",
"mediaFormatRequested",
".",
"getEffectiveMinWidth",
"(",
")",
";",
"long",
"heightRequested",
"=",
"mediaFormatRequested",
".",
"getEffectiveMinHeight",
"(",
")",
";",
"long",
"widthMin",
"=",
"mediaFormat",
".",
"getEffectiveMinWidth",
"(",
")",
";",
"long",
"heightMin",
"=",
"mediaFormat",
".",
"getEffectiveMinHeight",
"(",
")",
";",
"return",
"widthMin",
"<=",
"widthRequested",
"&&",
"heightMin",
"<=",
"heightRequested",
";",
"}"
] | Checks if the given media format size is same size or smaller than the requested one.
@param mediaFormat Media format
@param mediaFormatRequested Requested media format
@return true if media format is same size or smaller | [
"Checks",
"if",
"the",
"given",
"media",
"format",
"size",
"is",
"same",
"size",
"or",
"smaller",
"than",
"the",
"requested",
"one",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/format/impl/MediaFormatHandlerImpl.java#L228-L236 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java | TreeInfo.positionFor | public static int positionFor(final Symbol sym, final JCTree tree) {
"""
Find the position for reporting an error about a symbol, where
that symbol is defined somewhere in the given tree.
"""
JCTree decl = declarationFor(sym, tree);
return ((decl != null) ? decl : tree).pos;
} | java | public static int positionFor(final Symbol sym, final JCTree tree) {
JCTree decl = declarationFor(sym, tree);
return ((decl != null) ? decl : tree).pos;
} | [
"public",
"static",
"int",
"positionFor",
"(",
"final",
"Symbol",
"sym",
",",
"final",
"JCTree",
"tree",
")",
"{",
"JCTree",
"decl",
"=",
"declarationFor",
"(",
"sym",
",",
"tree",
")",
";",
"return",
"(",
"(",
"decl",
"!=",
"null",
")",
"?",
"decl",
":",
"tree",
")",
".",
"pos",
";",
"}"
] | Find the position for reporting an error about a symbol, where
that symbol is defined somewhere in the given tree. | [
"Find",
"the",
"position",
"for",
"reporting",
"an",
"error",
"about",
"a",
"symbol",
"where",
"that",
"symbol",
"is",
"defined",
"somewhere",
"in",
"the",
"given",
"tree",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L599-L602 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withKeyCopier | public CacheConfigurationBuilder<K, V> withKeyCopier(Copier<K> keyCopier) {
"""
Adds by-value semantic using the provided {@link Copier} for the key on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param keyCopier the key copier to use
@return a new builder with the added key copier
"""
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(keyCopier, "Null key copier"), DefaultCopierConfiguration.Type.KEY));
} | java | public CacheConfigurationBuilder<K, V> withKeyCopier(Copier<K> keyCopier) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(keyCopier, "Null key copier"), DefaultCopierConfiguration.Type.KEY));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withKeyCopier",
"(",
"Copier",
"<",
"K",
">",
"keyCopier",
")",
"{",
"return",
"withCopier",
"(",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"requireNonNull",
"(",
"keyCopier",
",",
"\"Null key copier\"",
")",
",",
"DefaultCopierConfiguration",
".",
"Type",
".",
"KEY",
")",
")",
";",
"}"
] | Adds by-value semantic using the provided {@link Copier} for the key on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param keyCopier the key copier to use
@return a new builder with the added key copier | [
"Adds",
"by",
"-",
"value",
"semantic",
"using",
"the",
"provided",
"{",
"@link",
"Copier",
"}",
"for",
"the",
"key",
"on",
"heap",
".",
"<p",
">",
"{",
"@link",
"Copier",
"}",
"s",
"are",
"what",
"enable",
"control",
"of",
"by",
"-",
"reference",
"/",
"by",
"-",
"value",
"semantics",
"for",
"on",
"-",
"heap",
"tier",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L408-L410 |
derari/cthul | xml/src/main/java/org/cthul/resolve/RRequest.java | RRequest.expandSystemId | protected String expandSystemId(String baseId, String systemId) {
"""
Calculates the schema file location.
@param baseId
@param systemId
@return schema file path
"""
if (baseId == null || baseId.isEmpty()) return systemId;
if (systemId == null || systemId.isEmpty()) return baseId;
try {
return new URI(baseId).resolve(new URI(systemId)).toASCIIString();
//
// int lastSep = baseId.lastIndexOf('/');
// return baseId.substring(0, lastSep+1) + systemId;
// return baseId.substring(0, lastSep+1) + systemId;
} catch (URISyntaxException ex) {
throw new ResolvingException(toString(), ex);
}
} | java | protected String expandSystemId(String baseId, String systemId) {
if (baseId == null || baseId.isEmpty()) return systemId;
if (systemId == null || systemId.isEmpty()) return baseId;
try {
return new URI(baseId).resolve(new URI(systemId)).toASCIIString();
//
// int lastSep = baseId.lastIndexOf('/');
// return baseId.substring(0, lastSep+1) + systemId;
// return baseId.substring(0, lastSep+1) + systemId;
} catch (URISyntaxException ex) {
throw new ResolvingException(toString(), ex);
}
} | [
"protected",
"String",
"expandSystemId",
"(",
"String",
"baseId",
",",
"String",
"systemId",
")",
"{",
"if",
"(",
"baseId",
"==",
"null",
"||",
"baseId",
".",
"isEmpty",
"(",
")",
")",
"return",
"systemId",
";",
"if",
"(",
"systemId",
"==",
"null",
"||",
"systemId",
".",
"isEmpty",
"(",
")",
")",
"return",
"baseId",
";",
"try",
"{",
"return",
"new",
"URI",
"(",
"baseId",
")",
".",
"resolve",
"(",
"new",
"URI",
"(",
"systemId",
")",
")",
".",
"toASCIIString",
"(",
")",
";",
"// \r",
"// int lastSep = baseId.lastIndexOf('/');\r",
"// return baseId.substring(0, lastSep+1) + systemId;\r",
"// return baseId.substring(0, lastSep+1) + systemId;\r",
"}",
"catch",
"(",
"URISyntaxException",
"ex",
")",
"{",
"throw",
"new",
"ResolvingException",
"(",
"toString",
"(",
")",
",",
"ex",
")",
";",
"}",
"}"
] | Calculates the schema file location.
@param baseId
@param systemId
@return schema file path | [
"Calculates",
"the",
"schema",
"file",
"location",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/RRequest.java#L117-L129 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.post_request | private base_response post_request(nitro_service service, options option) throws Exception {
"""
Use this method to perform a Add operation on netscaler resource.
@param service nitro_service object.
@param option Options class object.
@return status of the operation performed.
@throws Exception if invalid input is given.
"""
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return post_data(service,request);
} | java | private base_response post_request(nitro_service service, options option) throws Exception
{
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return post_data(service,request);
} | [
"private",
"base_response",
"post_request",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"String",
"sessionid",
"=",
"service",
".",
"get_sessionid",
"(",
")",
";",
"String",
"request",
"=",
"resource_to_string",
"(",
"service",
",",
"sessionid",
",",
"option",
")",
";",
"return",
"post_data",
"(",
"service",
",",
"request",
")",
";",
"}"
] | Use this method to perform a Add operation on netscaler resource.
@param service nitro_service object.
@param option Options class object.
@return status of the operation performed.
@throws Exception if invalid input is given. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"Add",
"operation",
"on",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L124-L129 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/spi/SecurityDocumentExtension.java | SecurityDocumentExtension.levelOffset | protected int levelOffset(Context context) {
"""
Returns title level offset from 1 to apply to content
@param context context
@return title level offset
"""
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case SECURITY_SCHEME_BEFORE:
case SECURITY_SCHEME_AFTER:
levelOffset = 1;
break;
case SECURITY_SCHEME_BEGIN:
case SECURITY_SCHEME_END:
levelOffset = 2;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | java | protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case SECURITY_SCHEME_BEFORE:
case SECURITY_SCHEME_AFTER:
levelOffset = 1;
break;
case SECURITY_SCHEME_BEGIN:
case SECURITY_SCHEME_END:
levelOffset = 2;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | [
"protected",
"int",
"levelOffset",
"(",
"Context",
"context",
")",
"{",
"//TODO: Unused method, make sure this is never used and then remove it.",
"int",
"levelOffset",
";",
"switch",
"(",
"context",
".",
"position",
")",
"{",
"case",
"DOCUMENT_BEFORE",
":",
"case",
"DOCUMENT_AFTER",
":",
"levelOffset",
"=",
"0",
";",
"break",
";",
"case",
"DOCUMENT_BEGIN",
":",
"case",
"DOCUMENT_END",
":",
"case",
"SECURITY_SCHEME_BEFORE",
":",
"case",
"SECURITY_SCHEME_AFTER",
":",
"levelOffset",
"=",
"1",
";",
"break",
";",
"case",
"SECURITY_SCHEME_BEGIN",
":",
"case",
"SECURITY_SCHEME_END",
":",
"levelOffset",
"=",
"2",
";",
"break",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"Unknown position '%s'\"",
",",
"context",
".",
"position",
")",
")",
";",
"}",
"return",
"levelOffset",
";",
"}"
] | Returns title level offset from 1 to apply to content
@param context context
@return title level offset | [
"Returns",
"title",
"level",
"offset",
"from",
"1",
"to",
"apply",
"to",
"content"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/spi/SecurityDocumentExtension.java#L38-L61 |
tdunning/t-digest | core/src/main/java/com/tdunning/math/stats/Sort.java | Sort.insertionSort | @SuppressWarnings("SameParameterValue")
private static void insertionSort(int[] order, double[] values, int start, int n, int limit) {
"""
Limited range insertion sort. We assume that no element has to move more than limit steps
because quick sort has done its thing.
@param order The permutation index
@param values The values we are sorting
@param start Where to start the sort
@param n How many elements to sort
@param limit The largest amount of disorder
"""
for (int i = start + 1; i < n; i++) {
int t = order[i];
double v = values[order[i]];
int m = Math.max(i - limit, start);
for (int j = i; j >= m; j--) {
if (j == 0 || values[order[j - 1]] <= v) {
if (j < i) {
System.arraycopy(order, j, order, j + 1, i - j);
order[j] = t;
}
break;
}
}
}
} | java | @SuppressWarnings("SameParameterValue")
private static void insertionSort(int[] order, double[] values, int start, int n, int limit) {
for (int i = start + 1; i < n; i++) {
int t = order[i];
double v = values[order[i]];
int m = Math.max(i - limit, start);
for (int j = i; j >= m; j--) {
if (j == 0 || values[order[j - 1]] <= v) {
if (j < i) {
System.arraycopy(order, j, order, j + 1, i - j);
order[j] = t;
}
break;
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"private",
"static",
"void",
"insertionSort",
"(",
"int",
"[",
"]",
"order",
",",
"double",
"[",
"]",
"values",
",",
"int",
"start",
",",
"int",
"n",
",",
"int",
"limit",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
"+",
"1",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"int",
"t",
"=",
"order",
"[",
"i",
"]",
";",
"double",
"v",
"=",
"values",
"[",
"order",
"[",
"i",
"]",
"]",
";",
"int",
"m",
"=",
"Math",
".",
"max",
"(",
"i",
"-",
"limit",
",",
"start",
")",
";",
"for",
"(",
"int",
"j",
"=",
"i",
";",
"j",
">=",
"m",
";",
"j",
"--",
")",
"{",
"if",
"(",
"j",
"==",
"0",
"||",
"values",
"[",
"order",
"[",
"j",
"-",
"1",
"]",
"]",
"<=",
"v",
")",
"{",
"if",
"(",
"j",
"<",
"i",
")",
"{",
"System",
".",
"arraycopy",
"(",
"order",
",",
"j",
",",
"order",
",",
"j",
"+",
"1",
",",
"i",
"-",
"j",
")",
";",
"order",
"[",
"j",
"]",
"=",
"t",
";",
"}",
"break",
";",
"}",
"}",
"}",
"}"
] | Limited range insertion sort. We assume that no element has to move more than limit steps
because quick sort has done its thing.
@param order The permutation index
@param values The values we are sorting
@param start Where to start the sort
@param n How many elements to sort
@param limit The largest amount of disorder | [
"Limited",
"range",
"insertion",
"sort",
".",
"We",
"assume",
"that",
"no",
"element",
"has",
"to",
"move",
"more",
"than",
"limit",
"steps",
"because",
"quick",
"sort",
"has",
"done",
"its",
"thing",
"."
] | train | https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L423-L439 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java | FastAdapterDialog.withNeutralButton | public FastAdapterDialog<Item> withNeutralButton(String text, OnClickListener listener) {
"""
Set a listener to be invoked when the neutral button of the dialog is pressed.
@param text The text to display in the neutral button
@param listener The {@link DialogInterface.OnClickListener} to use.
@return This Builder object to allow for chaining of calls to set methods
"""
return withButton(BUTTON_NEUTRAL, text, listener);
} | java | public FastAdapterDialog<Item> withNeutralButton(String text, OnClickListener listener) {
return withButton(BUTTON_NEUTRAL, text, listener);
} | [
"public",
"FastAdapterDialog",
"<",
"Item",
">",
"withNeutralButton",
"(",
"String",
"text",
",",
"OnClickListener",
"listener",
")",
"{",
"return",
"withButton",
"(",
"BUTTON_NEUTRAL",
",",
"text",
",",
"listener",
")",
";",
"}"
] | Set a listener to be invoked when the neutral button of the dialog is pressed.
@param text The text to display in the neutral button
@param listener The {@link DialogInterface.OnClickListener} to use.
@return This Builder object to allow for chaining of calls to set methods | [
"Set",
"a",
"listener",
"to",
"be",
"invoked",
"when",
"the",
"neutral",
"button",
"of",
"the",
"dialog",
"is",
"pressed",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L195-L197 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.getLong | public static Long getLong(final LdapEntry ctx, final String attribute) {
"""
Reads a Long value from the LdapEntry.
@param ctx the ldap entry
@param attribute the attribute name
@return the long value
"""
return getLong(ctx, attribute, Long.MIN_VALUE);
} | java | public static Long getLong(final LdapEntry ctx, final String attribute) {
return getLong(ctx, attribute, Long.MIN_VALUE);
} | [
"public",
"static",
"Long",
"getLong",
"(",
"final",
"LdapEntry",
"ctx",
",",
"final",
"String",
"attribute",
")",
"{",
"return",
"getLong",
"(",
"ctx",
",",
"attribute",
",",
"Long",
".",
"MIN_VALUE",
")",
";",
"}"
] | Reads a Long value from the LdapEntry.
@param ctx the ldap entry
@param attribute the attribute name
@return the long value | [
"Reads",
"a",
"Long",
"value",
"from",
"the",
"LdapEntry",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L163-L165 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java | CmsResourceWrapperXmlPage.getSubPath | private String getSubPath(CmsObject cms, CmsResource xmlPage, String resourcename) {
"""
Returns the path inside a xml page.<p>
The remaining path inside a xml page can be the locale and the element name
or the name of the control code file.<p>
@param cms the initialized CmsObject
@param xmlPage the xml page where the resourcename belongs to
@param resourcename the full path of the resource (pointing inside the xml page)
@return the remaining path inside the xml page without the leading slash
"""
if (xmlPage != null) {
String rootPath = cms.getRequestContext().addSiteRoot(resourcename);
String path = rootPath.substring(xmlPage.getRootPath().length());
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
return null;
} | java | private String getSubPath(CmsObject cms, CmsResource xmlPage, String resourcename) {
if (xmlPage != null) {
String rootPath = cms.getRequestContext().addSiteRoot(resourcename);
String path = rootPath.substring(xmlPage.getRootPath().length());
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
return null;
} | [
"private",
"String",
"getSubPath",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"xmlPage",
",",
"String",
"resourcename",
")",
"{",
"if",
"(",
"xmlPage",
"!=",
"null",
")",
"{",
"String",
"rootPath",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"addSiteRoot",
"(",
"resourcename",
")",
";",
"String",
"path",
"=",
"rootPath",
".",
"substring",
"(",
"xmlPage",
".",
"getRootPath",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"1",
")",
";",
"}",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"path",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the path inside a xml page.<p>
The remaining path inside a xml page can be the locale and the element name
or the name of the control code file.<p>
@param cms the initialized CmsObject
@param xmlPage the xml page where the resourcename belongs to
@param resourcename the full path of the resource (pointing inside the xml page)
@return the remaining path inside the xml page without the leading slash | [
"Returns",
"the",
"path",
"inside",
"a",
"xml",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java#L1101-L1119 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_account_GET | public ArrayList<String> organizationName_service_exchangeService_account_GET(String organizationName, String exchangeService, OvhOvhLicenceEnum accountLicense, Long id, String primaryEmailAddress) throws IOException {
"""
Accounts associated to this exchange service
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/account
@param accountLicense [required] Filter the value of accountLicense property (=)
@param primaryEmailAddress [required] Filter the value of primaryEmailAddress property (like)
@param id [required] Filter the value of id property (like)
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "accountLicense", accountLicense);
query(sb, "id", id);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> organizationName_service_exchangeService_account_GET(String organizationName, String exchangeService, OvhOvhLicenceEnum accountLicense, Long id, String primaryEmailAddress) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "accountLicense", accountLicense);
query(sb, "id", id);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"organizationName_service_exchangeService_account_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"OvhOvhLicenceEnum",
"accountLicense",
",",
"Long",
"id",
",",
"String",
"primaryEmailAddress",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/account\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
")",
";",
"query",
"(",
"sb",
",",
"\"accountLicense\"",
",",
"accountLicense",
")",
";",
"query",
"(",
"sb",
",",
"\"id\"",
",",
"id",
")",
";",
"query",
"(",
"sb",
",",
"\"primaryEmailAddress\"",
",",
"primaryEmailAddress",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Accounts associated to this exchange service
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/account
@param accountLicense [required] Filter the value of accountLicense property (=)
@param primaryEmailAddress [required] Filter the value of primaryEmailAddress property (like)
@param id [required] Filter the value of id property (like)
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Accounts",
"associated",
"to",
"this",
"exchange",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2153-L2161 |
lookfirst/WePay-Java-SDK | src/main/java/com/lookfirst/wepay/WePayApi.java | WePayApi.getAuthorizationUri | public String getAuthorizationUri(List<Scope> scopes, String redirectUri, String state) {
"""
Generate URI used during oAuth authorization
Redirect your user to this URI where they can grant your application
permission to make API calls
@see <a href="https://www.wepay.com/developer/reference/oauth2">https://www.wepay.com/developer/reference/oauth2</a>
@param scopes List of scope fields for which your application wants access
@param redirectUri Where user goes after logging in at WePay (domain must match application settings)
@param state The opaque value the client application uses to maintain state.
@return string URI to which you must redirect your user to grant access to your application
"""
return getAuthorizationUri(scopes, redirectUri, state, null, null);
} | java | public String getAuthorizationUri(List<Scope> scopes, String redirectUri, String state) {
return getAuthorizationUri(scopes, redirectUri, state, null, null);
} | [
"public",
"String",
"getAuthorizationUri",
"(",
"List",
"<",
"Scope",
">",
"scopes",
",",
"String",
"redirectUri",
",",
"String",
"state",
")",
"{",
"return",
"getAuthorizationUri",
"(",
"scopes",
",",
"redirectUri",
",",
"state",
",",
"null",
",",
"null",
")",
";",
"}"
] | Generate URI used during oAuth authorization
Redirect your user to this URI where they can grant your application
permission to make API calls
@see <a href="https://www.wepay.com/developer/reference/oauth2">https://www.wepay.com/developer/reference/oauth2</a>
@param scopes List of scope fields for which your application wants access
@param redirectUri Where user goes after logging in at WePay (domain must match application settings)
@param state The opaque value the client application uses to maintain state.
@return string URI to which you must redirect your user to grant access to your application | [
"Generate",
"URI",
"used",
"during",
"oAuth",
"authorization",
"Redirect",
"your",
"user",
"to",
"this",
"URI",
"where",
"they",
"can",
"grant",
"your",
"application",
"permission",
"to",
"make",
"API",
"calls"
] | train | https://github.com/lookfirst/WePay-Java-SDK/blob/3c0a47d6fa051d531c8fdbbfd54a0ef2891aa8f0/src/main/java/com/lookfirst/wepay/WePayApi.java#L162-L164 |
james-hu/jabb-core | src/main/java/net/sf/jabb/cache/AbstractEhCachedKeyValueRepository.java | AbstractEhCachedKeyValueRepository.refreshAheadNeeded | protected boolean refreshAheadNeeded(long accessTime, long createdTime, long expirationTime) {
"""
Determine if a refresh ahead is needed.
The default implementation checks if accessTime falls into the 3rd quarter of (expirationTime - createdTime)
@param accessTime last access time
@param createdTime created time
@param expirationTime end of TTL/TTI time
@return true if a refresh is needed, false otherwise
"""
long ttl4 = (expirationTime - createdTime) / 4;
if (ttl4 < 0){
ttl4 = 0;
}
long start = createdTime + ttl4 * 2;
long end = expirationTime - ttl4;
return accessTime > start && accessTime < end;
} | java | protected boolean refreshAheadNeeded(long accessTime, long createdTime, long expirationTime){
long ttl4 = (expirationTime - createdTime) / 4;
if (ttl4 < 0){
ttl4 = 0;
}
long start = createdTime + ttl4 * 2;
long end = expirationTime - ttl4;
return accessTime > start && accessTime < end;
} | [
"protected",
"boolean",
"refreshAheadNeeded",
"(",
"long",
"accessTime",
",",
"long",
"createdTime",
",",
"long",
"expirationTime",
")",
"{",
"long",
"ttl4",
"=",
"(",
"expirationTime",
"-",
"createdTime",
")",
"/",
"4",
";",
"if",
"(",
"ttl4",
"<",
"0",
")",
"{",
"ttl4",
"=",
"0",
";",
"}",
"long",
"start",
"=",
"createdTime",
"+",
"ttl4",
"*",
"2",
";",
"long",
"end",
"=",
"expirationTime",
"-",
"ttl4",
";",
"return",
"accessTime",
">",
"start",
"&&",
"accessTime",
"<",
"end",
";",
"}"
] | Determine if a refresh ahead is needed.
The default implementation checks if accessTime falls into the 3rd quarter of (expirationTime - createdTime)
@param accessTime last access time
@param createdTime created time
@param expirationTime end of TTL/TTI time
@return true if a refresh is needed, false otherwise | [
"Determine",
"if",
"a",
"refresh",
"ahead",
"is",
"needed",
".",
"The",
"default",
"implementation",
"checks",
"if",
"accessTime",
"falls",
"into",
"the",
"3rd",
"quarter",
"of",
"(",
"expirationTime",
"-",
"createdTime",
")"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/cache/AbstractEhCachedKeyValueRepository.java#L75-L85 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java | QueryParameters.updateDirection | public QueryParameters updateDirection(String key, Direction direction) {
"""
Updates direction of specified key
@param key Key
@param direction Direction
@return this instance of QueryParameters
"""
this.direction.put(processKey(key), direction);
return this;
} | java | public QueryParameters updateDirection(String key, Direction direction) {
this.direction.put(processKey(key), direction);
return this;
} | [
"public",
"QueryParameters",
"updateDirection",
"(",
"String",
"key",
",",
"Direction",
"direction",
")",
"{",
"this",
".",
"direction",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"direction",
")",
";",
"return",
"this",
";",
"}"
] | Updates direction of specified key
@param key Key
@param direction Direction
@return this instance of QueryParameters | [
"Updates",
"direction",
"of",
"specified",
"key"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L301-L305 |
jMotif/SAX | src/main/java/net/seninp/util/HeatChart.java | HeatChart.saveToFile | public void saveToFile(File outputFile) throws IOException {
"""
Generates a new chart <code>Image</code> based upon the currently held settings and then
attempts to save that image to disk, to the location provided as a File parameter. The image
type of the saved file will equal the extension of the filename provided, so it is essential
that a suitable extension be included on the file name.
<p>
All supported <code>ImageIO</code> file types are supported, including PNG, JPG and GIF.
<p>
No chart will be generated until this or the related <code>getChartImage()</code> method are
called. All successive calls will result in the generation of a new chart image, no caching is
used.
@param outputFile the file location that the generated image file should be written to. The
File must have a suitable filename, with an extension of a valid image format (as supported by
<code>ImageIO</code>).
@throws IOException if the output file's filename has no extension or if there the file is
unable to written to. Reasons for this include a non-existant file location (check with the
File exists() method on the parent directory), or the permissions of the write location may be
incorrect.
"""
String filename = outputFile.getName();
int extPoint = filename.lastIndexOf('.');
if (extPoint < 0) {
throw new IOException("Illegal filename, no extension used.");
}
// Determine the extension of the filename.
String ext = filename.substring(extPoint + 1);
// Handle jpg without transparency.
if (ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg")) {
BufferedImage chart = (BufferedImage) getChartImage(false);
// Save our graphic.
saveGraphicJpeg(chart, outputFile, 1.0f);
}
else {
BufferedImage chart = (BufferedImage) getChartImage(true);
ImageIO.write(chart, ext, outputFile);
}
} | java | public void saveToFile(File outputFile) throws IOException {
String filename = outputFile.getName();
int extPoint = filename.lastIndexOf('.');
if (extPoint < 0) {
throw new IOException("Illegal filename, no extension used.");
}
// Determine the extension of the filename.
String ext = filename.substring(extPoint + 1);
// Handle jpg without transparency.
if (ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg")) {
BufferedImage chart = (BufferedImage) getChartImage(false);
// Save our graphic.
saveGraphicJpeg(chart, outputFile, 1.0f);
}
else {
BufferedImage chart = (BufferedImage) getChartImage(true);
ImageIO.write(chart, ext, outputFile);
}
} | [
"public",
"void",
"saveToFile",
"(",
"File",
"outputFile",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"outputFile",
".",
"getName",
"(",
")",
";",
"int",
"extPoint",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"extPoint",
"<",
"0",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Illegal filename, no extension used.\"",
")",
";",
"}",
"// Determine the extension of the filename.",
"String",
"ext",
"=",
"filename",
".",
"substring",
"(",
"extPoint",
"+",
"1",
")",
";",
"// Handle jpg without transparency.",
"if",
"(",
"ext",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
"\"jpg\"",
")",
"||",
"ext",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
"\"jpeg\"",
")",
")",
"{",
"BufferedImage",
"chart",
"=",
"(",
"BufferedImage",
")",
"getChartImage",
"(",
"false",
")",
";",
"// Save our graphic.",
"saveGraphicJpeg",
"(",
"chart",
",",
"outputFile",
",",
"1.0f",
")",
";",
"}",
"else",
"{",
"BufferedImage",
"chart",
"=",
"(",
"BufferedImage",
")",
"getChartImage",
"(",
"true",
")",
";",
"ImageIO",
".",
"write",
"(",
"chart",
",",
"ext",
",",
"outputFile",
")",
";",
"}",
"}"
] | Generates a new chart <code>Image</code> based upon the currently held settings and then
attempts to save that image to disk, to the location provided as a File parameter. The image
type of the saved file will equal the extension of the filename provided, so it is essential
that a suitable extension be included on the file name.
<p>
All supported <code>ImageIO</code> file types are supported, including PNG, JPG and GIF.
<p>
No chart will be generated until this or the related <code>getChartImage()</code> method are
called. All successive calls will result in the generation of a new chart image, no caching is
used.
@param outputFile the file location that the generated image file should be written to. The
File must have a suitable filename, with an extension of a valid image format (as supported by
<code>ImageIO</code>).
@throws IOException if the output file's filename has no extension or if there the file is
unable to written to. Reasons for this include a non-existant file location (check with the
File exists() method on the parent directory), or the permissions of the write location may be
incorrect. | [
"Generates",
"a",
"new",
"chart",
"<code",
">",
"Image<",
"/",
"code",
">",
"based",
"upon",
"the",
"currently",
"held",
"settings",
"and",
"then",
"attempts",
"to",
"save",
"that",
"image",
"to",
"disk",
"to",
"the",
"location",
"provided",
"as",
"a",
"File",
"parameter",
".",
"The",
"image",
"type",
"of",
"the",
"saved",
"file",
"will",
"equal",
"the",
"extension",
"of",
"the",
"filename",
"provided",
"so",
"it",
"is",
"essential",
"that",
"a",
"suitable",
"extension",
"be",
"included",
"on",
"the",
"file",
"name",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L1167-L1191 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java | AnnotationUtil.populateUsermeta | public static <T> T populateUsermeta(RiakUserMetadata usermetaData, T domainObject) {
"""
Attempts to populate a domain object with user metadata by looking for a
{@literal @RiakUsermeta} annotated member.
@param <T> the type of the domain object
@param usermetaData a Map of user metadata.
@param domainObject the domain object.
@return the domain object.
"""
return AnnotationHelper.getInstance().setUsermetaData(usermetaData, domainObject);
} | java | public static <T> T populateUsermeta(RiakUserMetadata usermetaData, T domainObject)
{
return AnnotationHelper.getInstance().setUsermetaData(usermetaData, domainObject);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"populateUsermeta",
"(",
"RiakUserMetadata",
"usermetaData",
",",
"T",
"domainObject",
")",
"{",
"return",
"AnnotationHelper",
".",
"getInstance",
"(",
")",
".",
"setUsermetaData",
"(",
"usermetaData",
",",
"domainObject",
")",
";",
"}"
] | Attempts to populate a domain object with user metadata by looking for a
{@literal @RiakUsermeta} annotated member.
@param <T> the type of the domain object
@param usermetaData a Map of user metadata.
@param domainObject the domain object.
@return the domain object. | [
"Attempts",
"to",
"populate",
"a",
"domain",
"object",
"with",
"user",
"metadata",
"by",
"looking",
"for",
"a",
"{",
"@literal",
"@RiakUsermeta",
"}",
"annotated",
"member",
"."
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L279-L282 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSasDefinitionAsync | public Observable<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
"""
Gets the specified deleted sas definition.
The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedSasDefinitionBundle object
"""
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() {
@Override
public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) {
return response.body();
}
});
} | java | public Observable<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() {
@Override
public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeletedSasDefinitionBundle",
">",
"getDeletedSasDefinitionAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
")",
"{",
"return",
"getDeletedSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
",",
"sasDefinitionName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DeletedSasDefinitionBundle",
">",
",",
"DeletedSasDefinitionBundle",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DeletedSasDefinitionBundle",
"call",
"(",
"ServiceResponse",
"<",
"DeletedSasDefinitionBundle",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the specified deleted sas definition.
The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedSasDefinitionBundle object | [
"Gets",
"the",
"specified",
"deleted",
"sas",
"definition",
".",
"The",
"Get",
"Deleted",
"SAS",
"Definition",
"operation",
"returns",
"the",
"specified",
"deleted",
"SAS",
"definition",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"getsas",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10909-L10916 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optLong | public long optLong(String name, long fallback) {
"""
Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Returns {@code fallback} otherwise. Note that JSON represents
numbers as doubles, so this is <a href="#lossy">lossy</a>; use strings to transfer
numbers via JSON.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback}
"""
Object object = opt(name);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | java | public long optLong(String name, long fallback) {
Object object = opt(name);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | [
"public",
"long",
"optLong",
"(",
"String",
"name",
",",
"long",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Long",
"result",
"=",
"JSON",
".",
"toLong",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"result",
":",
"fallback",
";",
"}"
] | Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Returns {@code fallback} otherwise. Note that JSON represents
numbers as doubles, so this is <a href="#lossy">lossy</a>; use strings to transfer
numbers via JSON.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L548-L552 |
kirgor/enklib | ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java | Bean.createSession | protected Session createSession() throws Exception {
"""
Creates {@link Session} instance, connected to the database.
@throws NamingException
@throws SQLException
"""
Config config = configBean.getConfig();
DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
return new Session(dataSource, config.getDialect());
} | java | protected Session createSession() throws Exception {
Config config = configBean.getConfig();
DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
return new Session(dataSource, config.getDialect());
} | [
"protected",
"Session",
"createSession",
"(",
")",
"throws",
"Exception",
"{",
"Config",
"config",
"=",
"configBean",
".",
"getConfig",
"(",
")",
";",
"DataSource",
"dataSource",
"=",
"InitialContext",
".",
"doLookup",
"(",
"config",
".",
"getDataSourceJNDI",
"(",
")",
")",
";",
"return",
"new",
"Session",
"(",
"dataSource",
",",
"config",
".",
"getDialect",
"(",
")",
")",
";",
"}"
] | Creates {@link Session} instance, connected to the database.
@throws NamingException
@throws SQLException | [
"Creates",
"{",
"@link",
"Session",
"}",
"instance",
"connected",
"to",
"the",
"database",
"."
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L175-L179 |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.configureNetty | public void configureNetty(String host, int port) {
"""
Call this method once after a constructor in order to create a Netty instance to accept out of VM messages.
@param host host to bind to
@param port port to listen on
"""
Map<String, Object> params = map(TransportConstants.HOST_PROP_NAME, host, TransportConstants.PORT_PROP_NAME, port);
config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), params));
} | java | public void configureNetty(String host, int port){
Map<String, Object> params = map(TransportConstants.HOST_PROP_NAME, host, TransportConstants.PORT_PROP_NAME, port);
config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), params));
} | [
"public",
"void",
"configureNetty",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"map",
"(",
"TransportConstants",
".",
"HOST_PROP_NAME",
",",
"host",
",",
"TransportConstants",
".",
"PORT_PROP_NAME",
",",
"port",
")",
";",
"config",
".",
"getAcceptorConfigurations",
"(",
")",
".",
"add",
"(",
"new",
"TransportConfiguration",
"(",
"NettyAcceptorFactory",
".",
"class",
".",
"getName",
"(",
")",
",",
"params",
")",
")",
";",
"}"
] | Call this method once after a constructor in order to create a Netty instance to accept out of VM messages.
@param host host to bind to
@param port port to listen on | [
"Call",
"this",
"method",
"once",
"after",
"a",
"constructor",
"in",
"order",
"to",
"create",
"a",
"Netty",
"instance",
"to",
"accept",
"out",
"of",
"VM",
"messages",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L307-L310 |
Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java | DirectiveParser.checkDirectivesForKeyword | public void checkDirectivesForKeyword(DirectiveParser directiveParser, KeyWord keyWord) throws ParseException {
"""
If a keyword supports directives, then we can have one more more 'keyword' directives but no 'step' directives before a keyword
"""
checkNoStepDirectiveBeforeKeyword(directiveParser, keyWord);
checkForInvalidKeywordDirective(directiveParser, keyWord);
} | java | public void checkDirectivesForKeyword(DirectiveParser directiveParser, KeyWord keyWord) throws ParseException {
checkNoStepDirectiveBeforeKeyword(directiveParser, keyWord);
checkForInvalidKeywordDirective(directiveParser, keyWord);
} | [
"public",
"void",
"checkDirectivesForKeyword",
"(",
"DirectiveParser",
"directiveParser",
",",
"KeyWord",
"keyWord",
")",
"throws",
"ParseException",
"{",
"checkNoStepDirectiveBeforeKeyword",
"(",
"directiveParser",
",",
"keyWord",
")",
";",
"checkForInvalidKeywordDirective",
"(",
"directiveParser",
",",
"keyWord",
")",
";",
"}"
] | If a keyword supports directives, then we can have one more more 'keyword' directives but no 'step' directives before a keyword | [
"If",
"a",
"keyword",
"supports",
"directives",
"then",
"we",
"can",
"have",
"one",
"more",
"more",
"keyword",
"directives",
"but",
"no",
"step",
"directives",
"before",
"a",
"keyword"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java#L98-L101 |
hdecarne/java-default | src/main/java/de/carne/util/SystemProperties.java | SystemProperties.longValue | public static long longValue(Class<?> clazz, String key, long defaultValue) {
"""
Gets a {@code long} system property value.
@param clazz the {@linkplain Class} to derive the property key from.
@param key the property key (relative to the submitted {@linkplain Class}) to get.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined.
"""
return longValue(clazz.getName() + key, defaultValue);
} | java | public static long longValue(Class<?> clazz, String key, long defaultValue) {
return longValue(clazz.getName() + key, defaultValue);
} | [
"public",
"static",
"long",
"longValue",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"return",
"longValue",
"(",
"clazz",
".",
"getName",
"(",
")",
"+",
"key",
",",
"defaultValue",
")",
";",
"}"
] | Gets a {@code long} system property value.
@param clazz the {@linkplain Class} to derive the property key from.
@param key the property key (relative to the submitted {@linkplain Class}) to get.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined. | [
"Gets",
"a",
"{",
"@code",
"long",
"}",
"system",
"property",
"value",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/SystemProperties.java#L211-L213 |
Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/BaseProducer.java | BaseProducer.letterify | public String letterify(String letterString, char from, char to) {
"""
Replaces all {@code '?'} characters with random chars from [{@code from} - {@code to}] range
@param letterString text to process
@param from start of the range
@param to end of the range
@return text with replaced {@code '?'} chars
"""
return replaceSymbolWithCharsFromTo(letterString, '?', from, to);
} | java | public String letterify(String letterString, char from, char to) {
return replaceSymbolWithCharsFromTo(letterString, '?', from, to);
} | [
"public",
"String",
"letterify",
"(",
"String",
"letterString",
",",
"char",
"from",
",",
"char",
"to",
")",
"{",
"return",
"replaceSymbolWithCharsFromTo",
"(",
"letterString",
",",
"'",
"'",
",",
"from",
",",
"to",
")",
";",
"}"
] | Replaces all {@code '?'} characters with random chars from [{@code from} - {@code to}] range
@param letterString text to process
@param from start of the range
@param to end of the range
@return text with replaced {@code '?'} chars | [
"Replaces",
"all",
"{",
"@code",
"?",
"}",
"characters",
"with",
"random",
"chars",
"from",
"[",
"{",
"@code",
"from",
"}",
"-",
"{",
"@code",
"to",
"}",
"]",
"range"
] | train | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/BaseProducer.java#L155-L157 |
jtrfp/javamod | src/main/java/de/quippy/mp3/decoder/Decoder.java | Decoder.decodeFrame | public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException {
"""
Decodes one frame from an MPEG audio bitstream.
@param header The header describing the frame to decode.
@param bitstream The bistream that provides the bits for the body of the frame.
@return A SampleBuffer containing the decoded samples.
"""
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
} | java | public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
} | [
"public",
"Obuffer",
"decodeFrame",
"(",
"Header",
"header",
",",
"Bitstream",
"stream",
")",
"throws",
"DecoderException",
"{",
"try",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"initialize",
"(",
"header",
")",
";",
"}",
"int",
"layer",
"=",
"header",
".",
"layer",
"(",
")",
";",
"output",
".",
"clear_buffer",
"(",
")",
";",
"FrameDecoder",
"decoder",
"=",
"retrieveDecoder",
"(",
"header",
",",
"stream",
",",
"layer",
")",
";",
"decoder",
".",
"decodeFrame",
"(",
")",
";",
"output",
".",
"write_buffer",
"(",
"1",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"ex",
")",
"{",
"// UUPS - this frame seems to be corrupt - let's continue to the next one",
"}",
"return",
"output",
";",
"}"
] | Decodes one frame from an MPEG audio bitstream.
@param header The header describing the frame to decode.
@param bitstream The bistream that provides the bits for the body of the frame.
@return A SampleBuffer containing the decoded samples. | [
"Decodes",
"one",
"frame",
"from",
"an",
"MPEG",
"audio",
"bitstream",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Decoder.java#L133-L159 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.renderPixel | public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) {
"""
Renders a point in camera coordinates into the image plane in pixels.
@param intrinsic Intrinsic camera parameters.
@param X 3D Point in world reference frame..
@return 2D Render point on image plane or null if it's behind the camera
"""
Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z);
return convertNormToPixel(intrinsic, norm, norm);
} | java | public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) {
Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z);
return convertNormToPixel(intrinsic, norm, norm);
} | [
"public",
"static",
"Point2D_F64",
"renderPixel",
"(",
"CameraPinhole",
"intrinsic",
",",
"Point3D_F64",
"X",
")",
"{",
"Point2D_F64",
"norm",
"=",
"new",
"Point2D_F64",
"(",
"X",
".",
"x",
"/",
"X",
".",
"z",
",",
"X",
".",
"y",
"/",
"X",
".",
"z",
")",
";",
"return",
"convertNormToPixel",
"(",
"intrinsic",
",",
"norm",
",",
"norm",
")",
";",
"}"
] | Renders a point in camera coordinates into the image plane in pixels.
@param intrinsic Intrinsic camera parameters.
@param X 3D Point in world reference frame..
@return 2D Render point on image plane or null if it's behind the camera | [
"Renders",
"a",
"point",
"in",
"camera",
"coordinates",
"into",
"the",
"image",
"plane",
"in",
"pixels",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L538-L541 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java | PolylineSplitMerge.computePotentialSplitScore | void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit ) {
"""
Computes the split location and the score of the two new sides if it's split there
"""
Element<Corner> e1 = next(e0);
e0.object.splitable = canBeSplit(contour,e0,mustSplit);
if( e0.object.splitable ) {
setSplitVariables(contour, e0, e1);
}
} | java | void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit )
{
Element<Corner> e1 = next(e0);
e0.object.splitable = canBeSplit(contour,e0,mustSplit);
if( e0.object.splitable ) {
setSplitVariables(contour, e0, e1);
}
} | [
"void",
"computePotentialSplitScore",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"Element",
"<",
"Corner",
">",
"e0",
",",
"boolean",
"mustSplit",
")",
"{",
"Element",
"<",
"Corner",
">",
"e1",
"=",
"next",
"(",
"e0",
")",
";",
"e0",
".",
"object",
".",
"splitable",
"=",
"canBeSplit",
"(",
"contour",
",",
"e0",
",",
"mustSplit",
")",
";",
"if",
"(",
"e0",
".",
"object",
".",
"splitable",
")",
"{",
"setSplitVariables",
"(",
"contour",
",",
"e0",
",",
"e1",
")",
";",
"}",
"}"
] | Computes the split location and the score of the two new sides if it's split there | [
"Computes",
"the",
"split",
"location",
"and",
"the",
"score",
"of",
"the",
"two",
"new",
"sides",
"if",
"it",
"s",
"split",
"there"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L663-L672 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java | PdfFileSpecification.fileEmbedded | public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[]) throws IOException {
"""
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array. The data is flate compressed.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not <CODE>null</CODE>
it takes precedence over <CODE>filePath</CODE>
@throws IOException on error
@return the file specification
"""
return fileEmbedded(writer, filePath, fileDisplay, fileStore, PdfStream.BEST_COMPRESSION);
} | java | public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[]) throws IOException {
return fileEmbedded(writer, filePath, fileDisplay, fileStore, PdfStream.BEST_COMPRESSION);
} | [
"public",
"static",
"PdfFileSpecification",
"fileEmbedded",
"(",
"PdfWriter",
"writer",
",",
"String",
"filePath",
",",
"String",
"fileDisplay",
",",
"byte",
"fileStore",
"[",
"]",
")",
"throws",
"IOException",
"{",
"return",
"fileEmbedded",
"(",
"writer",
",",
"filePath",
",",
"fileDisplay",
",",
"fileStore",
",",
"PdfStream",
".",
"BEST_COMPRESSION",
")",
";",
"}"
] | Creates a file specification with the file embedded. The file may
come from the file system or from a byte array. The data is flate compressed.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not <CODE>null</CODE>
it takes precedence over <CODE>filePath</CODE>
@throws IOException on error
@return the file specification | [
"Creates",
"a",
"file",
"specification",
"with",
"the",
"file",
"embedded",
".",
"The",
"file",
"may",
"come",
"from",
"the",
"file",
"system",
"or",
"from",
"a",
"byte",
"array",
".",
"The",
"data",
"is",
"flate",
"compressed",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L95-L97 |
upwork/java-upwork | src/com/Upwork/api/Routers/Messages.java | Messages.sendMessageToRoom | public JSONObject sendMessageToRoom(String company, String roomId, HashMap<String, String> params) throws JSONException {
"""
Send a message to a room
@param company Company ID
@param roomId Room ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
"""
return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
} | java | public JSONObject sendMessageToRoom(String company, String roomId, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
} | [
"public",
"JSONObject",
"sendMessageToRoom",
"(",
"String",
"company",
",",
"String",
"roomId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms/\"",
"+",
"roomId",
"+",
"\"/stories\"",
",",
"params",
")",
";",
"}"
] | Send a message to a room
@param company Company ID
@param roomId Room ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Send",
"a",
"message",
"to",
"a",
"room"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L126-L128 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseMenuScreen.java | HBaseMenuScreen.printData | public boolean printData(PrintWriter out, int iHtmlAttributes) {
"""
Code to display a Menu.
@param out The html out stream.
@param iHtmlAttributes The HTML attributes.
@return true If fields have been found.
@exception DBException File exception.
"""
boolean bFieldsFound = false;
Record recMenu = ((BaseMenuScreen)this.getScreenField()).getMainRecord();
String strCellFormat = this.getHtmlString(recMenu);
XMLParser parser = ((BaseMenuScreen)this.getScreenField()).getXMLParser(recMenu);
parser.parseHtmlData(out, strCellFormat);
parser.free();
parser = null;
return bFieldsFound;
} | java | public boolean printData(PrintWriter out, int iHtmlAttributes)
{
boolean bFieldsFound = false;
Record recMenu = ((BaseMenuScreen)this.getScreenField()).getMainRecord();
String strCellFormat = this.getHtmlString(recMenu);
XMLParser parser = ((BaseMenuScreen)this.getScreenField()).getXMLParser(recMenu);
parser.parseHtmlData(out, strCellFormat);
parser.free();
parser = null;
return bFieldsFound;
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iHtmlAttributes",
")",
"{",
"boolean",
"bFieldsFound",
"=",
"false",
";",
"Record",
"recMenu",
"=",
"(",
"(",
"BaseMenuScreen",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"getMainRecord",
"(",
")",
";",
"String",
"strCellFormat",
"=",
"this",
".",
"getHtmlString",
"(",
"recMenu",
")",
";",
"XMLParser",
"parser",
"=",
"(",
"(",
"BaseMenuScreen",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"getXMLParser",
"(",
"recMenu",
")",
";",
"parser",
".",
"parseHtmlData",
"(",
"out",
",",
"strCellFormat",
")",
";",
"parser",
".",
"free",
"(",
")",
";",
"parser",
"=",
"null",
";",
"return",
"bFieldsFound",
";",
"}"
] | Code to display a Menu.
@param out The html out stream.
@param iHtmlAttributes The HTML attributes.
@return true If fields have been found.
@exception DBException File exception. | [
"Code",
"to",
"display",
"a",
"Menu",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseMenuScreen.java#L82-L92 |
spring-projects/spring-hateoas | src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java | PropertyUtils.toBeIgnoredByJackson | private static boolean toBeIgnoredByJackson(Class<?> clazz, String field) {
"""
Check if a field name is to be ignored due to {@link JsonIgnoreProperties}.
@param clazz
@param field
@return
"""
Annotation[] annotations = AnnotationUtils.getAnnotations(clazz);
return annotations == null //
? false //
: Arrays.stream(annotations) //
.filter(annotation -> annotation.annotationType().equals(JsonIgnoreProperties.class)) //
.map(annotation -> (String[]) AnnotationUtils.getAnnotationAttributes(annotation).get("value")) //
.flatMap(Arrays::stream) //
.anyMatch(propertyName -> propertyName.equalsIgnoreCase(field));
} | java | private static boolean toBeIgnoredByJackson(Class<?> clazz, String field) {
Annotation[] annotations = AnnotationUtils.getAnnotations(clazz);
return annotations == null //
? false //
: Arrays.stream(annotations) //
.filter(annotation -> annotation.annotationType().equals(JsonIgnoreProperties.class)) //
.map(annotation -> (String[]) AnnotationUtils.getAnnotationAttributes(annotation).get("value")) //
.flatMap(Arrays::stream) //
.anyMatch(propertyName -> propertyName.equalsIgnoreCase(field));
} | [
"private",
"static",
"boolean",
"toBeIgnoredByJackson",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"field",
")",
"{",
"Annotation",
"[",
"]",
"annotations",
"=",
"AnnotationUtils",
".",
"getAnnotations",
"(",
"clazz",
")",
";",
"return",
"annotations",
"==",
"null",
"//",
"?",
"false",
"//",
":",
"Arrays",
".",
"stream",
"(",
"annotations",
")",
"//",
".",
"filter",
"(",
"annotation",
"->",
"annotation",
".",
"annotationType",
"(",
")",
".",
"equals",
"(",
"JsonIgnoreProperties",
".",
"class",
")",
")",
"//",
".",
"map",
"(",
"annotation",
"->",
"(",
"String",
"[",
"]",
")",
"AnnotationUtils",
".",
"getAnnotationAttributes",
"(",
"annotation",
")",
".",
"get",
"(",
"\"value\"",
")",
")",
"//",
".",
"flatMap",
"(",
"Arrays",
"::",
"stream",
")",
"//",
".",
"anyMatch",
"(",
"propertyName",
"->",
"propertyName",
".",
"equalsIgnoreCase",
"(",
"field",
")",
")",
";",
"}"
] | Check if a field name is to be ignored due to {@link JsonIgnoreProperties}.
@param clazz
@param field
@return | [
"Check",
"if",
"a",
"field",
"name",
"is",
"to",
"be",
"ignored",
"due",
"to",
"{",
"@link",
"JsonIgnoreProperties",
"}",
"."
] | train | https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java#L208-L219 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java | BackPropagationNet.computeOutputDelta | private double computeOutputDelta(DataSet dataSet, final int idx, Vec delta_out, Vec a_i, Vec d_i) {
"""
Computes the delta between the networks output for a same and its true value
@param dataSet the data set we are learning from
@param idx the index into the data set for the current data point
@param delta_out the place to store the delta, may already be initialized with random noise
@param a_i the activation of the final output layer for the data point
@param d_i the derivative of the activation of the final output layer
@return the error that occurred in predicting this data point
"""
double error = 0;
if (dataSet instanceof ClassificationDataSet)
{
ClassificationDataSet cds = (ClassificationDataSet) dataSet;
final int ct = cds.getDataPointCategory(idx);
for (int i = 0; i < outputSize; i++)
if (i == ct)
delta_out.set(i, f.max() - targetBump);
else
delta_out.set(i, f.min() + targetBump);
for (int j = 0; j < delta_out.length(); j++)
{
double val = delta_out.get(j);
error += pow((val - a_i.get(j)), 2);
val = -(val - a_i.get(j)) * d_i.get(j);
delta_out.set(j, val);
}
}
else if(dataSet instanceof RegressionDataSet)
{
RegressionDataSet rds = (RegressionDataSet) dataSet;
double val = rds.getTargetValue(idx);
val = f.min()+targetBump + targetMultiplier*(val-targetMin);
error += pow((val - a_i.get(0)), 2);
delta_out.set(0, -(val - a_i.get(0)) * d_i.get(0));
}
else
{
throw new RuntimeException("BUG: please report");
}
return error;
} | java | private double computeOutputDelta(DataSet dataSet, final int idx, Vec delta_out, Vec a_i, Vec d_i)
{
double error = 0;
if (dataSet instanceof ClassificationDataSet)
{
ClassificationDataSet cds = (ClassificationDataSet) dataSet;
final int ct = cds.getDataPointCategory(idx);
for (int i = 0; i < outputSize; i++)
if (i == ct)
delta_out.set(i, f.max() - targetBump);
else
delta_out.set(i, f.min() + targetBump);
for (int j = 0; j < delta_out.length(); j++)
{
double val = delta_out.get(j);
error += pow((val - a_i.get(j)), 2);
val = -(val - a_i.get(j)) * d_i.get(j);
delta_out.set(j, val);
}
}
else if(dataSet instanceof RegressionDataSet)
{
RegressionDataSet rds = (RegressionDataSet) dataSet;
double val = rds.getTargetValue(idx);
val = f.min()+targetBump + targetMultiplier*(val-targetMin);
error += pow((val - a_i.get(0)), 2);
delta_out.set(0, -(val - a_i.get(0)) * d_i.get(0));
}
else
{
throw new RuntimeException("BUG: please report");
}
return error;
} | [
"private",
"double",
"computeOutputDelta",
"(",
"DataSet",
"dataSet",
",",
"final",
"int",
"idx",
",",
"Vec",
"delta_out",
",",
"Vec",
"a_i",
",",
"Vec",
"d_i",
")",
"{",
"double",
"error",
"=",
"0",
";",
"if",
"(",
"dataSet",
"instanceof",
"ClassificationDataSet",
")",
"{",
"ClassificationDataSet",
"cds",
"=",
"(",
"ClassificationDataSet",
")",
"dataSet",
";",
"final",
"int",
"ct",
"=",
"cds",
".",
"getDataPointCategory",
"(",
"idx",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"outputSize",
";",
"i",
"++",
")",
"if",
"(",
"i",
"==",
"ct",
")",
"delta_out",
".",
"set",
"(",
"i",
",",
"f",
".",
"max",
"(",
")",
"-",
"targetBump",
")",
";",
"else",
"delta_out",
".",
"set",
"(",
"i",
",",
"f",
".",
"min",
"(",
")",
"+",
"targetBump",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"delta_out",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"double",
"val",
"=",
"delta_out",
".",
"get",
"(",
"j",
")",
";",
"error",
"+=",
"pow",
"(",
"(",
"val",
"-",
"a_i",
".",
"get",
"(",
"j",
")",
")",
",",
"2",
")",
";",
"val",
"=",
"-",
"(",
"val",
"-",
"a_i",
".",
"get",
"(",
"j",
")",
")",
"*",
"d_i",
".",
"get",
"(",
"j",
")",
";",
"delta_out",
".",
"set",
"(",
"j",
",",
"val",
")",
";",
"}",
"}",
"else",
"if",
"(",
"dataSet",
"instanceof",
"RegressionDataSet",
")",
"{",
"RegressionDataSet",
"rds",
"=",
"(",
"RegressionDataSet",
")",
"dataSet",
";",
"double",
"val",
"=",
"rds",
".",
"getTargetValue",
"(",
"idx",
")",
";",
"val",
"=",
"f",
".",
"min",
"(",
")",
"+",
"targetBump",
"+",
"targetMultiplier",
"*",
"(",
"val",
"-",
"targetMin",
")",
";",
"error",
"+=",
"pow",
"(",
"(",
"val",
"-",
"a_i",
".",
"get",
"(",
"0",
")",
")",
",",
"2",
")",
";",
"delta_out",
".",
"set",
"(",
"0",
",",
"-",
"(",
"val",
"-",
"a_i",
".",
"get",
"(",
"0",
")",
")",
"*",
"d_i",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"BUG: please report\"",
")",
";",
"}",
"return",
"error",
";",
"}"
] | Computes the delta between the networks output for a same and its true value
@param dataSet the data set we are learning from
@param idx the index into the data set for the current data point
@param delta_out the place to store the delta, may already be initialized with random noise
@param a_i the activation of the final output layer for the data point
@param d_i the derivative of the activation of the final output layer
@return the error that occurred in predicting this data point | [
"Computes",
"the",
"delta",
"between",
"the",
"networks",
"output",
"for",
"a",
"same",
"and",
"its",
"true",
"value"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L780-L816 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java | FieldBuilder.getInstance | public static FieldBuilder getInstance(Context context,
TypeElement typeElement,
FieldWriter writer) {
"""
Construct a new FieldBuilder.
@param context the build context.
@param typeElement the class whoses members are being documented.
@param writer the doclet specific writer.
@return the new FieldBuilder
"""
return new FieldBuilder(context, typeElement, writer);
} | java | public static FieldBuilder getInstance(Context context,
TypeElement typeElement,
FieldWriter writer) {
return new FieldBuilder(context, typeElement, writer);
} | [
"public",
"static",
"FieldBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"TypeElement",
"typeElement",
",",
"FieldWriter",
"writer",
")",
"{",
"return",
"new",
"FieldBuilder",
"(",
"context",
",",
"typeElement",
",",
"writer",
")",
";",
"}"
] | Construct a new FieldBuilder.
@param context the build context.
@param typeElement the class whoses members are being documented.
@param writer the doclet specific writer.
@return the new FieldBuilder | [
"Construct",
"a",
"new",
"FieldBuilder",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java#L106-L110 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/PTSaxton2006.java | PTSaxton2006.getSKSAT | public static String getSKSAT(String[] soilParas) {
"""
For calculating SKSAT
@param soilParas should include 1. Sand weight percentage by layer
([0,100]%), 2. Clay weight percentage by layer ([0,100]%), 3. Organic
matter weight percentage by layer ([0,100]%), (= SLOC * 1.72), 4. Grave
weight percentage by layer ([0,100]%)
@return Saturated hydraulic conductivity, cm/h
"""
if (soilParas != null && soilParas.length >= 3) {
if (soilParas.length >= 4) {
return divide(calcSatBulk(soilParas[0], soilParas[1], soilParas[2], divide(soilParas[3], "100")), "10", 3);
} else {
return divide(calcSatMatric(soilParas[0], soilParas[1], soilParas[2]), "10", 3);
}
} else {
return null;
}
} | java | public static String getSKSAT(String[] soilParas) {
if (soilParas != null && soilParas.length >= 3) {
if (soilParas.length >= 4) {
return divide(calcSatBulk(soilParas[0], soilParas[1], soilParas[2], divide(soilParas[3], "100")), "10", 3);
} else {
return divide(calcSatMatric(soilParas[0], soilParas[1], soilParas[2]), "10", 3);
}
} else {
return null;
}
} | [
"public",
"static",
"String",
"getSKSAT",
"(",
"String",
"[",
"]",
"soilParas",
")",
"{",
"if",
"(",
"soilParas",
"!=",
"null",
"&&",
"soilParas",
".",
"length",
">=",
"3",
")",
"{",
"if",
"(",
"soilParas",
".",
"length",
">=",
"4",
")",
"{",
"return",
"divide",
"(",
"calcSatBulk",
"(",
"soilParas",
"[",
"0",
"]",
",",
"soilParas",
"[",
"1",
"]",
",",
"soilParas",
"[",
"2",
"]",
",",
"divide",
"(",
"soilParas",
"[",
"3",
"]",
",",
"\"100\"",
")",
")",
",",
"\"10\"",
",",
"3",
")",
";",
"}",
"else",
"{",
"return",
"divide",
"(",
"calcSatMatric",
"(",
"soilParas",
"[",
"0",
"]",
",",
"soilParas",
"[",
"1",
"]",
",",
"soilParas",
"[",
"2",
"]",
")",
",",
"\"10\"",
",",
"3",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | For calculating SKSAT
@param soilParas should include 1. Sand weight percentage by layer
([0,100]%), 2. Clay weight percentage by layer ([0,100]%), 3. Organic
matter weight percentage by layer ([0,100]%), (= SLOC * 1.72), 4. Grave
weight percentage by layer ([0,100]%)
@return Saturated hydraulic conductivity, cm/h | [
"For",
"calculating",
"SKSAT"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L80-L90 |
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.listOf | public static <R> Function<Object,List<R>> listOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) {
"""
<p>
Abbreviation for {{@link #methodForListOf(Type, String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution
"""
return methodForListOf(resultType, methodName, optionalParameters);
} | java | public static <R> Function<Object,List<R>> listOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) {
return methodForListOf(resultType, methodName, optionalParameters);
} | [
"public",
"static",
"<",
"R",
">",
"Function",
"<",
"Object",
",",
"List",
"<",
"R",
">",
">",
"listOf",
"(",
"final",
"Type",
"<",
"R",
">",
"resultType",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
"{",
"return",
"methodForListOf",
"(",
"resultType",
",",
"methodName",
",",
"optionalParameters",
")",
";",
"}"
] | <p>
Abbreviation for {{@link #methodForListOf(Type, String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForListOf",
"(",
"Type",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L644-L646 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java | JschUtil.createSession | public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) {
"""
新建一个新的SSH会话
@param sshHost 主机
@param sshPort 端口
@param sshUser 机用户名
@param sshPass 密码
@return SSH会话
@since 4.5.2
"""
if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) {
return null;
}
Session session;
try {
session = new JSch().getSession(sshUser, sshHost, sshPort);
session.setPassword(sshPass);
// 设置第一次登陆的时候提示,可选值:(ask | yes | no)
session.setConfig("StrictHostKeyChecking", "no");
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return session;
} | java | public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) {
if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) {
return null;
}
Session session;
try {
session = new JSch().getSession(sshUser, sshHost, sshPort);
session.setPassword(sshPass);
// 设置第一次登陆的时候提示,可选值:(ask | yes | no)
session.setConfig("StrictHostKeyChecking", "no");
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return session;
} | [
"public",
"static",
"Session",
"createSession",
"(",
"String",
"sshHost",
",",
"int",
"sshPort",
",",
"String",
"sshUser",
",",
"String",
"sshPass",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"sshHost",
")",
"||",
"sshPort",
"<",
"0",
"||",
"StrUtil",
".",
"isEmpty",
"(",
"sshUser",
")",
"||",
"StrUtil",
".",
"isEmpty",
"(",
"sshPass",
")",
")",
"{",
"return",
"null",
";",
"}",
"Session",
"session",
";",
"try",
"{",
"session",
"=",
"new",
"JSch",
"(",
")",
".",
"getSession",
"(",
"sshUser",
",",
"sshHost",
",",
"sshPort",
")",
";",
"session",
".",
"setPassword",
"(",
"sshPass",
")",
";",
"// 设置第一次登陆的时候提示,可选值:(ask | yes | no)\r",
"session",
".",
"setConfig",
"(",
"\"StrictHostKeyChecking\"",
",",
"\"no\"",
")",
";",
"}",
"catch",
"(",
"JSchException",
"e",
")",
"{",
"throw",
"new",
"JschRuntimeException",
"(",
"e",
")",
";",
"}",
"return",
"session",
";",
"}"
] | 新建一个新的SSH会话
@param sshHost 主机
@param sshPort 端口
@param sshUser 机用户名
@param sshPass 密码
@return SSH会话
@since 4.5.2 | [
"新建一个新的SSH会话"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java#L89-L104 |
js-lib-com/commons | src/main/java/js/io/FilesOutputStream.java | FilesOutputStream.putMeta | public void putMeta(String key, Object value) {
"""
Put meta data to this archive manifest. If <code>key</code> already exists is overridden. Meta <code>value</code> is
converted to string and can be any type for which there is a {@link Converter} registered.
@param key meta data key,
@param value meta data value.
"""
manifest.getMainAttributes().putValue(key, ConverterRegistry.getConverter().asString(value));
} | java | public void putMeta(String key, Object value) {
manifest.getMainAttributes().putValue(key, ConverterRegistry.getConverter().asString(value));
} | [
"public",
"void",
"putMeta",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"putValue",
"(",
"key",
",",
"ConverterRegistry",
".",
"getConverter",
"(",
")",
".",
"asString",
"(",
"value",
")",
")",
";",
"}"
] | Put meta data to this archive manifest. If <code>key</code> already exists is overridden. Meta <code>value</code> is
converted to string and can be any type for which there is a {@link Converter} registered.
@param key meta data key,
@param value meta data value. | [
"Put",
"meta",
"data",
"to",
"this",
"archive",
"manifest",
".",
"If",
"<code",
">",
"key<",
"/",
"code",
">",
"already",
"exists",
"is",
"overridden",
".",
"Meta",
"<code",
">",
"value<",
"/",
"code",
">",
"is",
"converted",
"to",
"string",
"and",
"can",
"be",
"any",
"type",
"for",
"which",
"there",
"is",
"a",
"{",
"@link",
"Converter",
"}",
"registered",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L100-L102 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java | AbstractLabel.removeColumn | void removeColumn(String schema, String table, String column) {
"""
remove a column from the table
@param schema the schema
@param table the table name
@param column the column name
"""
StringBuilder sql = new StringBuilder("ALTER TABLE ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema));
sql.append(".");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table));
sql.append(" DROP COLUMN IF EXISTS ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(column));
if (sqlgGraph.getSqlDialect().supportsCascade()) {
sql.append(" CASCADE");
}
if (sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";");
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
Connection conn = sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | java | void removeColumn(String schema, String table, String column) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema));
sql.append(".");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table));
sql.append(" DROP COLUMN IF EXISTS ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(column));
if (sqlgGraph.getSqlDialect().supportsCascade()) {
sql.append(" CASCADE");
}
if (sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";");
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
Connection conn = sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | [
"void",
"removeColumn",
"(",
"String",
"schema",
",",
"String",
"table",
",",
"String",
"column",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"ALTER TABLE \"",
")",
";",
"sql",
".",
"append",
"(",
"sqlgGraph",
".",
"getSqlDialect",
"(",
")",
".",
"maybeWrapInQoutes",
"(",
"schema",
")",
")",
";",
"sql",
".",
"append",
"(",
"\".\"",
")",
";",
"sql",
".",
"append",
"(",
"sqlgGraph",
".",
"getSqlDialect",
"(",
")",
".",
"maybeWrapInQoutes",
"(",
"table",
")",
")",
";",
"sql",
".",
"append",
"(",
"\" DROP COLUMN IF EXISTS \"",
")",
";",
"sql",
".",
"append",
"(",
"sqlgGraph",
".",
"getSqlDialect",
"(",
")",
".",
"maybeWrapInQoutes",
"(",
"column",
")",
")",
";",
"if",
"(",
"sqlgGraph",
".",
"getSqlDialect",
"(",
")",
".",
"supportsCascade",
"(",
")",
")",
"{",
"sql",
".",
"append",
"(",
"\" CASCADE\"",
")",
";",
"}",
"if",
"(",
"sqlgGraph",
".",
"getSqlDialect",
"(",
")",
".",
"needsSemicolon",
"(",
")",
")",
"{",
"sql",
".",
"append",
"(",
"\";\"",
")",
";",
"}",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"sql",
".",
"toString",
"(",
")",
")",
";",
"}",
"Connection",
"conn",
"=",
"sqlgGraph",
".",
"tx",
"(",
")",
".",
"getConnection",
"(",
")",
";",
"try",
"(",
"Statement",
"stmt",
"=",
"conn",
".",
"createStatement",
"(",
")",
")",
"{",
"stmt",
".",
"execute",
"(",
"sql",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | remove a column from the table
@param schema the schema
@param table the table name
@param column the column name | [
"remove",
"a",
"column",
"from",
"the",
"table"
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1002-L1024 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Condition.java | Condition.buildValuePartForBETWEEN | private void buildValuePartForBETWEEN(StringBuilder conditionStrBuilder, List<Object> paramValues) {
"""
构建BETWEEN语句中的值部分<br>
开头必须加空格,类似:" ? AND ?" 或者 " 1 AND 2"
@param conditionStrBuilder 条件语句构建器
@param paramValues 参数集合,用于参数占位符对应参数回填
"""
// BETWEEN x AND y 的情况,两个参数
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.value);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.value);
}
// 处理 AND y
conditionStrBuilder.append(StrUtil.SPACE).append(LogicalOperator.AND.toString());
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.secondValue);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.secondValue);
}
} | java | private void buildValuePartForBETWEEN(StringBuilder conditionStrBuilder, List<Object> paramValues) {
// BETWEEN x AND y 的情况,两个参数
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.value);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.value);
}
// 处理 AND y
conditionStrBuilder.append(StrUtil.SPACE).append(LogicalOperator.AND.toString());
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.secondValue);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.secondValue);
}
} | [
"private",
"void",
"buildValuePartForBETWEEN",
"(",
"StringBuilder",
"conditionStrBuilder",
",",
"List",
"<",
"Object",
">",
"paramValues",
")",
"{",
"// BETWEEN x AND y 的情况,两个参数\r",
"if",
"(",
"isPlaceHolder",
"(",
")",
")",
"{",
"// 使用条件表达式占位符\r",
"conditionStrBuilder",
".",
"append",
"(",
"\" ?\"",
")",
";",
"if",
"(",
"null",
"!=",
"paramValues",
")",
"{",
"paramValues",
".",
"add",
"(",
"this",
".",
"value",
")",
";",
"}",
"}",
"else",
"{",
"// 直接使用条件值\r",
"conditionStrBuilder",
".",
"append",
"(",
"CharUtil",
".",
"SPACE",
")",
".",
"append",
"(",
"this",
".",
"value",
")",
";",
"}",
"// 处理 AND y\r",
"conditionStrBuilder",
".",
"append",
"(",
"StrUtil",
".",
"SPACE",
")",
".",
"append",
"(",
"LogicalOperator",
".",
"AND",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"isPlaceHolder",
"(",
")",
")",
"{",
"// 使用条件表达式占位符\r",
"conditionStrBuilder",
".",
"append",
"(",
"\" ?\"",
")",
";",
"if",
"(",
"null",
"!=",
"paramValues",
")",
"{",
"paramValues",
".",
"add",
"(",
"this",
".",
"secondValue",
")",
";",
"}",
"}",
"else",
"{",
"// 直接使用条件值\r",
"conditionStrBuilder",
".",
"append",
"(",
"CharUtil",
".",
"SPACE",
")",
".",
"append",
"(",
"this",
".",
"secondValue",
")",
";",
"}",
"}"
] | 构建BETWEEN语句中的值部分<br>
开头必须加空格,类似:" ? AND ?" 或者 " 1 AND 2"
@param conditionStrBuilder 条件语句构建器
@param paramValues 参数集合,用于参数占位符对应参数回填 | [
"构建BETWEEN语句中的值部分<br",
">",
"开头必须加空格,类似:",
"?",
"AND",
"?",
"或者",
"1",
"AND",
"2"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Condition.java#L320-L345 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.copyStream | public static void copyStream(InputStream is, OutputStream os, int size)
throws IOException {
"""
Write all bytes from is to os. Does not close either stream.
@param is to copy bytes from
@param os to copy bytes to
@param size number of bytes to buffer between read and write operations
@throws IOException for usual reasons
"""
byte[] buffer = new byte[size];
for (int r = -1; (r = is.read(buffer, 0, size)) != -1;) {
os.write(buffer, 0, r);
}
} | java | public static void copyStream(InputStream is, OutputStream os, int size)
throws IOException {
byte[] buffer = new byte[size];
for (int r = -1; (r = is.read(buffer, 0, size)) != -1;) {
os.write(buffer, 0, r);
}
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"r",
"=",
"-",
"1",
";",
"(",
"r",
"=",
"is",
".",
"read",
"(",
"buffer",
",",
"0",
",",
"size",
")",
")",
"!=",
"-",
"1",
";",
")",
"{",
"os",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"r",
")",
";",
"}",
"}"
] | Write all bytes from is to os. Does not close either stream.
@param is to copy bytes from
@param os to copy bytes to
@param size number of bytes to buffer between read and write operations
@throws IOException for usual reasons | [
"Write",
"all",
"bytes",
"from",
"is",
"to",
"os",
".",
"Does",
"not",
"close",
"either",
"stream",
"."
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L141-L147 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java | MultipleAlignmentCoordManager.getPanelPos | public Point getPanelPos(int structure, int pos) {
"""
Get the X position on the Panel of a particular sequence position.
@param structure index of the structure for the sequence position.
@param pos sequence position, the aligned position index
@return the point on a panel for a sequence position
"""
Point p = new Point();
int lineNr = pos / DEFAULT_LINE_LENGTH;
int linePos = pos % DEFAULT_LINE_LENGTH;
int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE +
DEFAULT_LEGEND_SIZE;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += DEFAULT_LINE_SEPARATION * structure;
p.setLocation(x, y);
return p;
} | java | public Point getPanelPos(int structure, int pos) {
Point p = new Point();
int lineNr = pos / DEFAULT_LINE_LENGTH;
int linePos = pos % DEFAULT_LINE_LENGTH;
int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE +
DEFAULT_LEGEND_SIZE;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += DEFAULT_LINE_SEPARATION * structure;
p.setLocation(x, y);
return p;
} | [
"public",
"Point",
"getPanelPos",
"(",
"int",
"structure",
",",
"int",
"pos",
")",
"{",
"Point",
"p",
"=",
"new",
"Point",
"(",
")",
";",
"int",
"lineNr",
"=",
"pos",
"/",
"DEFAULT_LINE_LENGTH",
";",
"int",
"linePos",
"=",
"pos",
"%",
"DEFAULT_LINE_LENGTH",
";",
"int",
"x",
"=",
"linePos",
"*",
"DEFAULT_CHAR_SIZE",
"+",
"DEFAULT_X_SPACE",
"+",
"DEFAULT_LEGEND_SIZE",
";",
"int",
"y",
"=",
"lineNr",
"*",
"DEFAULT_Y_STEP",
"+",
"DEFAULT_Y_SPACE",
";",
"y",
"+=",
"DEFAULT_LINE_SEPARATION",
"*",
"structure",
";",
"p",
".",
"setLocation",
"(",
"x",
",",
"y",
")",
";",
"return",
"p",
";",
"}"
] | Get the X position on the Panel of a particular sequence position.
@param structure index of the structure for the sequence position.
@param pos sequence position, the aligned position index
@return the point on a panel for a sequence position | [
"Get",
"the",
"X",
"position",
"on",
"the",
"Panel",
"of",
"a",
"particular",
"sequence",
"position",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L145-L159 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newCloneException | public static CloneException newCloneException(Throwable cause, String message, Object... args) {
"""
Constructs and initializes a new {@link CloneException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link CloneException} was thrown.
@param message {@link String} describing the {@link CloneException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link CloneException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.lang.CloneException
"""
return new CloneException(format(message, args), cause);
} | java | public static CloneException newCloneException(Throwable cause, String message, Object... args) {
return new CloneException(format(message, args), cause);
} | [
"public",
"static",
"CloneException",
"newCloneException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"CloneException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
")",
";",
"}"
] | Constructs and initializes a new {@link CloneException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link CloneException} was thrown.
@param message {@link String} describing the {@link CloneException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link CloneException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.lang.CloneException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"CloneException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L285-L287 |
Waikato/moa | moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java | MTree.getNearest | public Query getNearest(DATA queryData, double range, int limit) {
"""
Performs a nearest-neighbor query on the M-Tree, constrained by distance
and/or the number of neighbors.
@param queryData The query data object.
@param range The maximum distance from {@code queryData} to fetched
neighbors.
@param limit The maximum number of neighbors to fetch.
@return A {@link Query} object used to iterate on the results.
"""
return new Query(queryData, range, limit);
} | java | public Query getNearest(DATA queryData, double range, int limit) {
return new Query(queryData, range, limit);
} | [
"public",
"Query",
"getNearest",
"(",
"DATA",
"queryData",
",",
"double",
"range",
",",
"int",
"limit",
")",
"{",
"return",
"new",
"Query",
"(",
"queryData",
",",
"range",
",",
"limit",
")",
";",
"}"
] | Performs a nearest-neighbor query on the M-Tree, constrained by distance
and/or the number of neighbors.
@param queryData The query data object.
@param range The maximum distance from {@code queryData} to fetched
neighbors.
@param limit The maximum number of neighbors to fetch.
@return A {@link Query} object used to iterate on the results. | [
"Performs",
"a",
"nearest",
"-",
"neighbor",
"query",
"on",
"the",
"M",
"-",
"Tree",
"constrained",
"by",
"distance",
"and",
"/",
"or",
"the",
"number",
"of",
"neighbors",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java#L435-L437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.