repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/arithmetic/AtomicLongArithmeticExtensions.java | AtomicLongArithmeticExtensions.operator_minus | @Pure
@Inline(value = "($1.longValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicLong left, long right) {
return left.longValue() - right;
} | java | @Pure
@Inline(value = "($1.longValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicLong left, long right) {
return left.longValue() - right;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1.longValue() - $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"long",
"operator_minus",
"(",
"AtomicLong",
"left",
",",
"long",
"right",
")",
"{",
"return",
"left",
".",
"longValue"... | The binary {@code minus} operator. This is the equivalent to
the Java {@code -} operator. This function is not null-safe.
@param left a number.
@param right a number.
@return {@code left-right} | [
"The",
"binary",
"{",
"@code",
"minus",
"}",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"{",
"@code",
"-",
"}",
"operator",
".",
"This",
"function",
"is",
"not",
"null",
"-",
"safe",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/arithmetic/AtomicLongArithmeticExtensions.java#L65-L69 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelBasicFormatter.java | HpelBasicFormatter.formatRecord | @Override
public String formatRecord(RepositoryLogRecord record, Locale locale) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
StringBuilder sb = new StringBuilder(300);
String lineSeparatorPlusPadding = "";
// Use basic format
createEventHeader(record, sb);
lineSeparatorPlusPadding = svLineSeparatorPlusBasicPadding;
// add the localizedMsg
sb.append(formatMessage(record, locale));
// if we have a stack trace, append that to the formatted output.
if (record.getStackTrace() != null) {
sb.append(lineSeparatorPlusPadding);
sb.append(record.getStackTrace());
}
return sb.toString();
} | java | @Override
public String formatRecord(RepositoryLogRecord record, Locale locale) {
if (null == record) {
throw new IllegalArgumentException("Record cannot be null");
}
StringBuilder sb = new StringBuilder(300);
String lineSeparatorPlusPadding = "";
// Use basic format
createEventHeader(record, sb);
lineSeparatorPlusPadding = svLineSeparatorPlusBasicPadding;
// add the localizedMsg
sb.append(formatMessage(record, locale));
// if we have a stack trace, append that to the formatted output.
if (record.getStackTrace() != null) {
sb.append(lineSeparatorPlusPadding);
sb.append(record.getStackTrace());
}
return sb.toString();
} | [
"@",
"Override",
"public",
"String",
"formatRecord",
"(",
"RepositoryLogRecord",
"record",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"null",
"==",
"record",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Record cannot be null\"",
")",
";",
"}"... | Formats a RepositoryLogRecord into a localized basic format output String.
@param record the RepositoryLogRecord to be formatted
@param locale the Locale to use for localization when formatting this record.
@return the formated string output. | [
"Formats",
"a",
"RepositoryLogRecord",
"into",
"a",
"localized",
"basic",
"format",
"output",
"String",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelBasicFormatter.java#L36-L58 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsBreadCrumb.java | CmsBreadCrumb.setEntries | public void setEntries(Map<String, String> entries) {
String[][] entriesArray = null;
if ((entries != null) && !entries.isEmpty()) {
entriesArray = new String[entries.size()][];
int i = 0;
for (Entry<String, String> entry : entries.entrySet()) {
entriesArray[i] = new String[] {entry.getKey(), entry.getValue()};
i++;
}
}
getState().setEntries(entriesArray);
} | java | public void setEntries(Map<String, String> entries) {
String[][] entriesArray = null;
if ((entries != null) && !entries.isEmpty()) {
entriesArray = new String[entries.size()][];
int i = 0;
for (Entry<String, String> entry : entries.entrySet()) {
entriesArray[i] = new String[] {entry.getKey(), entry.getValue()};
i++;
}
}
getState().setEntries(entriesArray);
} | [
"public",
"void",
"setEntries",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"entries",
")",
"{",
"String",
"[",
"]",
"[",
"]",
"entriesArray",
"=",
"null",
";",
"if",
"(",
"(",
"entries",
"!=",
"null",
")",
"&&",
"!",
"entries",
".",
"isEmpty",
... | Sets the bread crumb entries.<p>
@param entries the bread crumb entries | [
"Sets",
"the",
"bread",
"crumb",
"entries",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBreadCrumb.java#L60-L73 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_ownLogs_id_userLogs_login_changePassword_POST | public String serviceName_ownLogs_id_userLogs_login_changePassword_POST(String serviceName, Long id, String login, String password) throws IOException {
String qPath = "/hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}/changePassword";
StringBuilder sb = path(qPath, serviceName, id, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | java | public String serviceName_ownLogs_id_userLogs_login_changePassword_POST(String serviceName, Long id, String login, String password) throws IOException {
String qPath = "/hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}/changePassword";
StringBuilder sb = path(qPath, serviceName, id, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | [
"public",
"String",
"serviceName_ownLogs_id_userLogs_login_changePassword_POST",
"(",
"String",
"serviceName",
",",
"Long",
"id",
",",
"String",
"login",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/ow... | Request a password change
REST: POST /hosting/web/{serviceName}/ownLogs/{id}/userLogs/{login}/changePassword
@param password [required] The new userLogs password
@param serviceName [required] The internal name of your hosting
@param id [required] Id of the object
@param login [required] The userLogs login used to connect to logs.ovh.net | [
"Request",
"a",
"password",
"change"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1050-L1057 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/ExistPolicyIndex.java | ExistPolicyIndex.sortDescending | protected static String[] sortDescending(String[] s) {
Arrays.sort(s,
new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if (o1.length() < o2.length())
return 1;
if (o1.length() > o2.length())
return -1;
return 0;
}
}
);
return s;
} | java | protected static String[] sortDescending(String[] s) {
Arrays.sort(s,
new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if (o1.length() < o2.length())
return 1;
if (o1.length() > o2.length())
return -1;
return 0;
}
}
);
return s;
} | [
"protected",
"static",
"String",
"[",
"]",
"sortDescending",
"(",
"String",
"[",
"]",
"s",
")",
"{",
"Arrays",
".",
"sort",
"(",
"s",
",",
"new",
"Comparator",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Stri... | sorts a string array in descending order of length
@param s
@return | [
"sorts",
"a",
"string",
"array",
"in",
"descending",
"order",
"of",
"length"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/ExistPolicyIndex.java#L342-L356 |
spotify/helios | helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java | HostResolver.scoreMatches | private List<ScoredHost> scoreMatches(final List<String> results) {
final ImmutableList.Builder<ScoredHost> scored = ImmutableList.builder();
for (final String name : results) {
int score = Integer.MAX_VALUE;
for (int i = 0; i < searchPath.length; i++) {
if (name.endsWith(searchPath[i].toString())) {
if (i < score) {
score = i;
}
}
}
scored.add(new ScoredHost(name, score));
}
return scored.build();
} | java | private List<ScoredHost> scoreMatches(final List<String> results) {
final ImmutableList.Builder<ScoredHost> scored = ImmutableList.builder();
for (final String name : results) {
int score = Integer.MAX_VALUE;
for (int i = 0; i < searchPath.length; i++) {
if (name.endsWith(searchPath[i].toString())) {
if (i < score) {
score = i;
}
}
}
scored.add(new ScoredHost(name, score));
}
return scored.build();
} | [
"private",
"List",
"<",
"ScoredHost",
">",
"scoreMatches",
"(",
"final",
"List",
"<",
"String",
">",
"results",
")",
"{",
"final",
"ImmutableList",
".",
"Builder",
"<",
"ScoredHost",
">",
"scored",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"for"... | Score matches based upon the position in the dns search domain that matches the result | [
"Score",
"matches",
"based",
"upon",
"the",
"position",
"in",
"the",
"dns",
"search",
"domain",
"that",
"matches",
"the",
"result"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java#L144-L158 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/MapFuncSup.java | MapFuncSup.forEach | public <R> R forEach(RFunc3<R, K, V, IteratorInfo<R>> func) {
return forEach(Style.$(func));
} | java | public <R> R forEach(RFunc3<R, K, V, IteratorInfo<R>> func) {
return forEach(Style.$(func));
} | [
"public",
"<",
"R",
">",
"R",
"forEach",
"(",
"RFunc3",
"<",
"R",
",",
"K",
",",
"V",
",",
"IteratorInfo",
"<",
"R",
">",
">",
"func",
")",
"{",
"return",
"forEach",
"(",
"Style",
".",
"$",
"(",
"func",
")",
")",
";",
"}"
] | define a function to deal with each entry in the map
@param func a function takes in each entry from map and iterator
info<br>
and returns 'last loop result'
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value'
@see IteratorInfo | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"entry",
"in",
"the",
"map"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L83-L85 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/CaretNode.java | CaretNode.moveContentBreaks | private void moveContentBreaks(int numOfBreaks, BreakIterator breakIterator, boolean followingNotPreceding) {
if (area.getLength() == 0) {
return;
}
breakIterator.setText(area.getText());
if (followingNotPreceding) {
breakIterator.following(getPosition());
} else {
breakIterator.preceding(getPosition());
}
for (int i = 1; i < numOfBreaks; i++) {
breakIterator.next();
}
moveTo(breakIterator.current());
} | java | private void moveContentBreaks(int numOfBreaks, BreakIterator breakIterator, boolean followingNotPreceding) {
if (area.getLength() == 0) {
return;
}
breakIterator.setText(area.getText());
if (followingNotPreceding) {
breakIterator.following(getPosition());
} else {
breakIterator.preceding(getPosition());
}
for (int i = 1; i < numOfBreaks; i++) {
breakIterator.next();
}
moveTo(breakIterator.current());
} | [
"private",
"void",
"moveContentBreaks",
"(",
"int",
"numOfBreaks",
",",
"BreakIterator",
"breakIterator",
",",
"boolean",
"followingNotPreceding",
")",
"{",
"if",
"(",
"area",
".",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"breakIterator"... | Helper method for reducing duplicate code
@param numOfBreaks the number of breaks
@param breakIterator the type of iterator to use
@param followingNotPreceding if true, use {@link BreakIterator#following(int)}.
Otherwise, use {@link BreakIterator#preceding(int)}. | [
"Helper",
"method",
"for",
"reducing",
"duplicate",
"code"
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/CaretNode.java#L372-L387 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeMethod | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, null, null, arguments);
} | java | @SuppressWarnings("unchecked")
public static synchronized <T> T invokeMethod(Object tested, Object... arguments) throws Exception {
return (T) doInvokeMethod(tested, null, null, arguments);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Object",
"tested",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"return",
"(",
"T",
")",
"doInvokeMethod",
... | Invoke a private or inner class method without the need to specify the
method name. This is thus a more refactor friendly version of the
@param <T> the generic type
@param tested the tested
@param arguments the arguments
@return the t
@throws Exception the exception
{@link #invokeMethod(Object, String, Object...)} method and
is recommend over this method for that reason. This method
might be useful to test private methods. | [
"Invoke",
"a",
"private",
"or",
"inner",
"class",
"method",
"without",
"the",
"need",
"to",
"specify",
"the",
"method",
"name",
".",
"This",
"is",
"thus",
"a",
"more",
"refactor",
"friendly",
"version",
"of",
"the"
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L644-L647 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/QueryParserBase.java | QueryParserBase.appendPagination | protected void appendPagination(SolrQuery query, @Nullable Long offset, @Nullable Integer rows) {
if (offset != null && offset.intValue() >= 0) {
query.setStart(offset.intValue());
}
if (rows != null && rows >= 0) {
query.setRows(rows);
}
} | java | protected void appendPagination(SolrQuery query, @Nullable Long offset, @Nullable Integer rows) {
if (offset != null && offset.intValue() >= 0) {
query.setStart(offset.intValue());
}
if (rows != null && rows >= 0) {
query.setRows(rows);
}
} | [
"protected",
"void",
"appendPagination",
"(",
"SolrQuery",
"query",
",",
"@",
"Nullable",
"Long",
"offset",
",",
"@",
"Nullable",
"Integer",
"rows",
")",
"{",
"if",
"(",
"offset",
"!=",
"null",
"&&",
"offset",
".",
"intValue",
"(",
")",
">=",
"0",
")",
... | Append pagination information {@code start, rows} to {@link SolrQuery}
@param query
@param offset
@param rows | [
"Append",
"pagination",
"information",
"{",
"@code",
"start",
"rows",
"}",
"to",
"{",
"@link",
"SolrQuery",
"}"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L420-L428 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.setLong | public static void setLong(MemorySegment[] segments, int offset, long value) {
if (inFirstSegment(segments, offset, 8)) {
segments[0].putLong(offset, value);
} else {
setLongMultiSegments(segments, offset, value);
}
} | java | public static void setLong(MemorySegment[] segments, int offset, long value) {
if (inFirstSegment(segments, offset, 8)) {
segments[0].putLong(offset, value);
} else {
setLongMultiSegments(segments, offset, value);
}
} | [
"public",
"static",
"void",
"setLong",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"long",
"value",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"8",
")",
")",
"{",
"segments",
"[",
"0",
"]",
... | set long from segments.
@param segments target segments.
@param offset value offset. | [
"set",
"long",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L755-L761 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/accordion/Accordion.java | Accordion.setIcons | public Accordion setIcons(UiIcon header, UiIcon headerSelected)
{
setIcons(new AccordionIcon(header, headerSelected));
return this;
} | java | public Accordion setIcons(UiIcon header, UiIcon headerSelected)
{
setIcons(new AccordionIcon(header, headerSelected));
return this;
} | [
"public",
"Accordion",
"setIcons",
"(",
"UiIcon",
"header",
",",
"UiIcon",
"headerSelected",
")",
"{",
"setIcons",
"(",
"new",
"AccordionIcon",
"(",
"header",
",",
"headerSelected",
")",
")",
";",
"return",
"this",
";",
"}"
] | Icons to use for headers.
@param header
@param headerSelected
@return instance of the current component | [
"Icons",
"to",
"use",
"for",
"headers",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/accordion/Accordion.java#L323-L327 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java | CommerceNotificationAttachmentPersistenceImpl.findByUuid | @Override
public List<CommerceNotificationAttachment> findByUuid(String uuid,
int start, int end) {
return findByUuid(uuid, start, end, null);
} | java | @Override
public List<CommerceNotificationAttachment> findByUuid(String uuid,
int start, int end) {
return findByUuid(uuid, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationAttachment",
">",
"findByUuid",
"(",
"String",
"uuid",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByUuid",
"(",
"uuid",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}... | Returns a range of all the commerce notification attachments where uuid = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param uuid the uuid
@param start the lower bound of the range of commerce notification attachments
@param end the upper bound of the range of commerce notification attachments (not inclusive)
@return the range of matching commerce notification attachments | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"attachments",
"where",
"uuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L145-L149 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java | Invariants.checkInvariantD | public static double checkInvariantD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
final Violations violations = singleViolation(failedPredicate(e));
throw new InvariantViolationException(
failedMessage(Double.valueOf(value), violations), e, violations.count());
}
return innerCheckInvariantD(value, ok, describer);
} | java | public static double checkInvariantD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
final Violations violations = singleViolation(failedPredicate(e));
throw new InvariantViolationException(
failedMessage(Double.valueOf(value), violations), e, violations.count());
}
return innerCheckInvariantD(value, ok, describer);
} | [
"public",
"static",
"double",
"checkInvariantD",
"(",
"final",
"double",
"value",
",",
"final",
"DoublePredicate",
"predicate",
",",
"final",
"DoubleFunction",
"<",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";",
"try",
"{",
"ok",
"=",
"... | A {@code double} specialized version of {@link #checkInvariant(Object,
Predicate, Function)}
@param value The value
@param predicate The predicate
@param describer The describer of the predicate
@return value
@throws InvariantViolationException If the predicate is false | [
"A",
"{",
"@code",
"double",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkInvariant",
"(",
"Object",
"Predicate",
"Function",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L521-L536 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getMetadata | public /*@Nullable*/DbxEntry getMetadata(final String path, boolean includeMediaInfo)
throws DbxException
{
DbxPathV1.checkArg("path", path);
String host = this.host.getApi();
String apiPath = "1/metadata/auto" + path;
/*@Nullable*/String[] params = {
"list", "false",
"include_media_info", includeMediaInfo ? "true" : null,
};
return doGet(host, apiPath, params, null, new DbxRequestUtil.ResponseHandler</*@Nullable*/DbxEntry>() {
@Override
public /*@Nullable*/DbxEntry handle(HttpRequestor.Response response) throws DbxException
{
if (response.getStatusCode() == 404) return null;
if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
// Will return 'null' for "is_deleted=true" entries.
return DbxRequestUtil.readJsonFromResponse(DbxEntry.ReaderMaybeDeleted, response);
}
});
} | java | public /*@Nullable*/DbxEntry getMetadata(final String path, boolean includeMediaInfo)
throws DbxException
{
DbxPathV1.checkArg("path", path);
String host = this.host.getApi();
String apiPath = "1/metadata/auto" + path;
/*@Nullable*/String[] params = {
"list", "false",
"include_media_info", includeMediaInfo ? "true" : null,
};
return doGet(host, apiPath, params, null, new DbxRequestUtil.ResponseHandler</*@Nullable*/DbxEntry>() {
@Override
public /*@Nullable*/DbxEntry handle(HttpRequestor.Response response) throws DbxException
{
if (response.getStatusCode() == 404) return null;
if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
// Will return 'null' for "is_deleted=true" entries.
return DbxRequestUtil.readJsonFromResponse(DbxEntry.ReaderMaybeDeleted, response);
}
});
} | [
"public",
"/*@Nullable*/",
"DbxEntry",
"getMetadata",
"(",
"final",
"String",
"path",
",",
"boolean",
"includeMediaInfo",
")",
"throws",
"DbxException",
"{",
"DbxPathV1",
".",
"checkArg",
"(",
"\"path\"",
",",
"path",
")",
";",
"String",
"host",
"=",
"this",
"... | Get the file or folder metadata for a given path.
<pre>
DbxClientV1 dbxClient = ...
DbxEntry entry = dbxClient.getMetadata("/Photos");
if (entry == null) {
System.out.println("No file or folder at that path.");
} else {
System.out.print(entry.toStringMultiline());
}
</pre>
@param path
The path to the file or folder (see {@link DbxPathV1}).
@param includeMediaInfo
If {@code true}, then if the return value is a {@link DbxEntry.File}, it might have
its {@code photoInfo} and {@code mediaInfo} fields filled in.
@return If there is a file or folder at the given path, return the
metadata for that path. If there is no file or folder there,
return {@code null}. | [
"Get",
"the",
"file",
"or",
"folder",
"metadata",
"for",
"a",
"given",
"path",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L115-L137 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultJPAService.java | DefaultJPAService.deleteEntity | protected <E extends Identifiable> void deleteEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
if (!em.contains(entity)) {
Identifiable attached = findEntity(em, entity.getId(), entity.getClass());
em.remove(attached);
} else {
em.remove(entity);
}
} | java | protected <E extends Identifiable> void deleteEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
if (!em.contains(entity)) {
Identifiable attached = findEntity(em, entity.getId(), entity.getClass());
em.remove(attached);
} else {
em.remove(entity);
}
} | [
"protected",
"<",
"E",
"extends",
"Identifiable",
">",
"void",
"deleteEntity",
"(",
"EntityManager",
"em",
",",
"E",
"entity",
")",
"{",
"requireArgument",
"(",
"em",
"!=",
"null",
",",
"\"The entity manager cannot be null.\"",
")",
";",
"requireArgument",
"(",
... | Removes an entity from the database.
@param <E> The entity type.
@param em The entity manager to use. Cannot be null.
@param entity The entity to remove. Cannot be null. | [
"Removes",
"an",
"entity",
"from",
"the",
"database",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultJPAService.java#L102-L111 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/HttpPath.java | HttpPath.fsWalk | public PathImpl fsWalk(String userPath,
Map<String,Object> attributes,
String uri)
{
String path;
String query = null;
int queryIndex = uri.indexOf('?');
if (queryIndex >= 0) {
path = uri.substring(0, queryIndex);
query = uri.substring(queryIndex + 1);
} else
path = uri;
if (path.length() == 0)
path = "/";
return create(_root, userPath, attributes, path, query);
} | java | public PathImpl fsWalk(String userPath,
Map<String,Object> attributes,
String uri)
{
String path;
String query = null;
int queryIndex = uri.indexOf('?');
if (queryIndex >= 0) {
path = uri.substring(0, queryIndex);
query = uri.substring(queryIndex + 1);
} else
path = uri;
if (path.length() == 0)
path = "/";
return create(_root, userPath, attributes, path, query);
} | [
"public",
"PathImpl",
"fsWalk",
"(",
"String",
"userPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
",",
"String",
"uri",
")",
"{",
"String",
"path",
";",
"String",
"query",
"=",
"null",
";",
"int",
"queryIndex",
"=",
"uri",
".",
"i... | Scans the path portion of the URI, i.e. everything after the
host and port.
@param userPath the user's supplied path
@param attributes the attributes for the new path
@param uri the full uri for the new path.
@return the found path. | [
"Scans",
"the",
"path",
"portion",
"of",
"the",
"URI",
"i",
".",
"e",
".",
"everything",
"after",
"the",
"host",
"and",
"port",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/HttpPath.java#L240-L257 |
TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java | LinuxTouchTransform.getValue | int getValue(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
int value = buffer.getEventValue();
int i;
for (i = 0; i < axes.length && axes[i] != -1; i++) {
if (axes[i] == axis) {
return transform(i, value);
}
}
if (i == axes.length) {
axes = Arrays.copyOf(axes, axes.length * 2);
Arrays.fill(axes, i + 1, axes.length - 1, -1);
translates = Arrays.copyOf(translates, translates.length * 2);
scalars = Arrays.copyOf(scalars, scalars.length * 2);
mins = Arrays.copyOf(mins, mins.length * 2);
maxs = Arrays.copyOf(maxs, maxs.length * 2);
}
initTransform(axis, i);
return transform(i, value);
} | java | int getValue(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
int value = buffer.getEventValue();
int i;
for (i = 0; i < axes.length && axes[i] != -1; i++) {
if (axes[i] == axis) {
return transform(i, value);
}
}
if (i == axes.length) {
axes = Arrays.copyOf(axes, axes.length * 2);
Arrays.fill(axes, i + 1, axes.length - 1, -1);
translates = Arrays.copyOf(translates, translates.length * 2);
scalars = Arrays.copyOf(scalars, scalars.length * 2);
mins = Arrays.copyOf(mins, mins.length * 2);
maxs = Arrays.copyOf(maxs, maxs.length * 2);
}
initTransform(axis, i);
return transform(i, value);
} | [
"int",
"getValue",
"(",
"LinuxEventBuffer",
"buffer",
")",
"{",
"int",
"axis",
"=",
"buffer",
".",
"getEventCode",
"(",
")",
";",
"int",
"value",
"=",
"buffer",
".",
"getEventValue",
"(",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"... | Gets the transformed pixel coordinate of the current event in the buffer
provided.
@param buffer A LinuxEventBuffer containing a raw event line
@return a transformed value in screen space | [
"Gets",
"the",
"transformed",
"pixel",
"coordinate",
"of",
"the",
"current",
"event",
"in",
"the",
"buffer",
"provided",
"."
] | train | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java#L72-L91 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharTrie.java | CharTrie.getSurrogateValue | public final char getSurrogateValue(char lead, char trail)
{
int offset = getSurrogateOffset(lead, trail);
if (offset > 0) {
return m_data_[offset];
}
return m_initialValue_;
} | java | public final char getSurrogateValue(char lead, char trail)
{
int offset = getSurrogateOffset(lead, trail);
if (offset > 0) {
return m_data_[offset];
}
return m_initialValue_;
} | [
"public",
"final",
"char",
"getSurrogateValue",
"(",
"char",
"lead",
",",
"char",
"trail",
")",
"{",
"int",
"offset",
"=",
"getSurrogateOffset",
"(",
"lead",
",",
"trail",
")",
";",
"if",
"(",
"offset",
">",
"0",
")",
"{",
"return",
"m_data_",
"[",
"of... | Get the value associated with a pair of surrogates.
@param lead a lead surrogate
@param trail a trail surrogate | [
"Get",
"the",
"value",
"associated",
"with",
"a",
"pair",
"of",
"surrogates",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharTrie.java#L166-L173 |
tzaeschke/zoodb | src/org/zoodb/internal/util/FormattedStringBuilder.java | FormattedStringBuilder.fillBuffer | private FormattedStringBuilder fillBuffer(int newLength, char c) {
for (int i = _delegate.length(); i < newLength; i++ ) {
_delegate.append(c);
}
return this;
} | java | private FormattedStringBuilder fillBuffer(int newLength, char c) {
for (int i = _delegate.length(); i < newLength; i++ ) {
_delegate.append(c);
}
return this;
} | [
"private",
"FormattedStringBuilder",
"fillBuffer",
"(",
"int",
"newLength",
",",
"char",
"c",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"_delegate",
".",
"length",
"(",
")",
";",
"i",
"<",
"newLength",
";",
"i",
"++",
")",
"{",
"_delegate",
".",
"append",... | Attempts to append <tt>c</tt> until the buffer gets the length <tt>
newLength</tt>. If the buffer is already as long or longer than <tt>
newLength</tt>, then nothing is appended.
@param newLength Minimal new length of the returned buffer.
@param c Character to append.
@return The updated instance of FormattedStringBuilder. | [
"Attempts",
"to",
"append",
"<tt",
">",
"c<",
"/",
"tt",
">",
"until",
"the",
"buffer",
"gets",
"the",
"length",
"<tt",
">",
"newLength<",
"/",
"tt",
">",
".",
"If",
"the",
"buffer",
"is",
"already",
"as",
"long",
"or",
"longer",
"than",
"<tt",
">",
... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L176-L181 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Clicker.java | Clicker.clickOn | public <T extends View> void clickOn(Class<T> viewClass, int index) {
clickOnScreen(waiter.waitForAndGetView(index, viewClass));
} | java | public <T extends View> void clickOn(Class<T> viewClass, int index) {
clickOnScreen(waiter.waitForAndGetView(index, viewClass));
} | [
"public",
"<",
"T",
"extends",
"View",
">",
"void",
"clickOn",
"(",
"Class",
"<",
"T",
">",
"viewClass",
",",
"int",
"index",
")",
"{",
"clickOnScreen",
"(",
"waiter",
".",
"waitForAndGetView",
"(",
"index",
",",
"viewClass",
")",
")",
";",
"}"
] | Clicks on a {@code View} of a specific class, with a certain index.
@param viewClass what kind of {@code View} to click, e.g. {@code Button.class} or {@code ImageView.class}
@param index the index of the {@code View} to be clicked, within {@code View}s of the specified class | [
"Clicks",
"on",
"a",
"{",
"@code",
"View",
"}",
"of",
"a",
"specific",
"class",
"with",
"a",
"certain",
"index",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L494-L496 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.setAccessToken | public void setAccessToken(String accessToken, String tokenType) throws HelloSignException {
auth.setAccessToken(accessToken, tokenType);
} | java | public void setAccessToken(String accessToken, String tokenType) throws HelloSignException {
auth.setAccessToken(accessToken, tokenType);
} | [
"public",
"void",
"setAccessToken",
"(",
"String",
"accessToken",
",",
"String",
"tokenType",
")",
"throws",
"HelloSignException",
"{",
"auth",
".",
"setAccessToken",
"(",
"accessToken",
",",
"tokenType",
")",
";",
"}"
] | Sets the access token for the OAuth user that this client will use to
perform requests.
@param accessToken String access token
@param tokenType String token type
@throws HelloSignException thrown if there's a problem setting the access
token. | [
"Sets",
"the",
"access",
"token",
"for",
"the",
"OAuth",
"user",
"that",
"this",
"client",
"will",
"use",
"to",
"perform",
"requests",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L1063-L1065 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/Client.java | Client.recoverState | public Completable recoverState(final StateFormat format, final byte[] persistedState) {
return Completable.create(new Completable.OnSubscribe() {
@Override
public void call(CompletableSubscriber subscriber) {
LOGGER.info("Recovering state from format {}", format);
LOGGER.debug("PersistedState on recovery is: {}", new String(persistedState, CharsetUtil.UTF_8));
try {
if (format == StateFormat.JSON) {
sessionState().setFromJson(persistedState);
subscriber.onCompleted();
} else {
subscriber.onError(new IllegalStateException("Unsupported StateFormat " + format));
}
} catch (Exception ex) {
subscriber.onError(ex);
}
}
});
} | java | public Completable recoverState(final StateFormat format, final byte[] persistedState) {
return Completable.create(new Completable.OnSubscribe() {
@Override
public void call(CompletableSubscriber subscriber) {
LOGGER.info("Recovering state from format {}", format);
LOGGER.debug("PersistedState on recovery is: {}", new String(persistedState, CharsetUtil.UTF_8));
try {
if (format == StateFormat.JSON) {
sessionState().setFromJson(persistedState);
subscriber.onCompleted();
} else {
subscriber.onError(new IllegalStateException("Unsupported StateFormat " + format));
}
} catch (Exception ex) {
subscriber.onError(ex);
}
}
});
} | [
"public",
"Completable",
"recoverState",
"(",
"final",
"StateFormat",
"format",
",",
"final",
"byte",
"[",
"]",
"persistedState",
")",
"{",
"return",
"Completable",
".",
"create",
"(",
"new",
"Completable",
".",
"OnSubscribe",
"(",
")",
"{",
"@",
"Override",
... | Initializes the {@link SessionState} from a previous snapshot with specific state information.
<p>
If a system needs to be built that withstands outages and needs to resume where left off, this method,
combined with the periodic persistence of the {@link SessionState} provides resume capabilities. If you
need to start fresh, take a look at {@link #initializeState(StreamFrom, StreamTo)} as well as
{@link #recoverOrInitializeState(StateFormat, byte[], StreamFrom, StreamTo)}.
@param format the format used when persisting.
@param persistedState the opaque byte array representing the persisted state.
@return A {@link Completable} indicating the success or failure of the state recovery. | [
"Initializes",
"the",
"{",
"@link",
"SessionState",
"}",
"from",
"a",
"previous",
"snapshot",
"with",
"specific",
"state",
"information",
".",
"<p",
">",
"If",
"a",
"system",
"needs",
"to",
"be",
"built",
"that",
"withstands",
"outages",
"and",
"needs",
"to"... | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/Client.java#L601-L620 |
biouno/figshare-java-api | src/main/java/org/biouno/figshare/FigShareClient.java | FigShareClient.getURL | private String getURL(String endpoint, int version, String method) {
StringBuilder sb = new StringBuilder();
sb.append(endpoint);
if (!endpoint.endsWith(FORWARD_SLASH)) {
sb.append(FORWARD_SLASH);
}
sb.append(VERSION_PREFIX + version + FORWARD_SLASH + method);
return sb.toString();
} | java | private String getURL(String endpoint, int version, String method) {
StringBuilder sb = new StringBuilder();
sb.append(endpoint);
if (!endpoint.endsWith(FORWARD_SLASH)) {
sb.append(FORWARD_SLASH);
}
sb.append(VERSION_PREFIX + version + FORWARD_SLASH + method);
return sb.toString();
} | [
"private",
"String",
"getURL",
"(",
"String",
"endpoint",
",",
"int",
"version",
",",
"String",
"method",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"endpoint",
")",
";",
"if",
"(",
"!",
"endp... | Create the FigShare API URL using the endpoint, version and API method.
@param endpoint endpoint URL
@param version API version
@param method API operation
@return the URL with the version and method | [
"Create",
"the",
"FigShare",
"API",
"URL",
"using",
"the",
"endpoint",
"version",
"and",
"API",
"method",
"."
] | train | https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L132-L140 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java | ContextRuntime.startTask | @SuppressWarnings("checkstyle:illegalcatch")
void startTask(final Configuration taskConfig) throws TaskClientCodeException {
synchronized (this.contextLifeCycle) {
if (this.task.isPresent() && this.task.get().hasEnded()) {
// clean up state
this.task = Optional.empty();
}
if (this.task.isPresent()) {
throw new IllegalStateException("Attempting to start a Task when a Task with id '" +
this.task.get().getId() + "' is running.");
}
if (this.childContext.isPresent()) {
throw new IllegalStateException(
"Attempting to start a Task on a context that is not the topmost active context");
}
try {
final Injector taskInjector = this.contextInjector.forkInjector(taskConfig);
final TaskRuntime taskRuntime = taskInjector.getInstance(TaskRuntime.class);
taskRuntime.initialize();
this.taskRuntimeThread = new Thread(taskRuntime, taskRuntime.getId());
this.taskRuntimeThread.start();
this.task = Optional.of(taskRuntime);
LOG.log(Level.FINEST, "Started task: {0}", taskRuntime.getTaskId());
} catch (final BindException | InjectionException e) {
throw new TaskClientCodeException(TaskClientCodeException.getTaskId(taskConfig),
this.getIdentifier(),
"Unable to instantiate the new task", e);
} catch (final Throwable t) {
throw new TaskClientCodeException(TaskClientCodeException.getTaskId(taskConfig),
this.getIdentifier(),
"Unable to start the new task", t);
}
}
} | java | @SuppressWarnings("checkstyle:illegalcatch")
void startTask(final Configuration taskConfig) throws TaskClientCodeException {
synchronized (this.contextLifeCycle) {
if (this.task.isPresent() && this.task.get().hasEnded()) {
// clean up state
this.task = Optional.empty();
}
if (this.task.isPresent()) {
throw new IllegalStateException("Attempting to start a Task when a Task with id '" +
this.task.get().getId() + "' is running.");
}
if (this.childContext.isPresent()) {
throw new IllegalStateException(
"Attempting to start a Task on a context that is not the topmost active context");
}
try {
final Injector taskInjector = this.contextInjector.forkInjector(taskConfig);
final TaskRuntime taskRuntime = taskInjector.getInstance(TaskRuntime.class);
taskRuntime.initialize();
this.taskRuntimeThread = new Thread(taskRuntime, taskRuntime.getId());
this.taskRuntimeThread.start();
this.task = Optional.of(taskRuntime);
LOG.log(Level.FINEST, "Started task: {0}", taskRuntime.getTaskId());
} catch (final BindException | InjectionException e) {
throw new TaskClientCodeException(TaskClientCodeException.getTaskId(taskConfig),
this.getIdentifier(),
"Unable to instantiate the new task", e);
} catch (final Throwable t) {
throw new TaskClientCodeException(TaskClientCodeException.getTaskId(taskConfig),
this.getIdentifier(),
"Unable to start the new task", t);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"void",
"startTask",
"(",
"final",
"Configuration",
"taskConfig",
")",
"throws",
"TaskClientCodeException",
"{",
"synchronized",
"(",
"this",
".",
"contextLifeCycle",
")",
"{",
"if",
"(",
"this",
".",... | Launches a Task on this context.
@param taskConfig the configuration to be used for the task.
@throws org.apache.reef.runtime.common.evaluator.task.TaskClientCodeException If the Task cannot be instantiated
due to user code / configuration issues.
@throws IllegalStateException If this method is called when
there is either a task or child context already present. | [
"Launches",
"a",
"Task",
"on",
"this",
"context",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java#L234-L272 |
spring-projects/spring-shell | spring-shell-standard-commands/src/main/java/org/springframework/shell/standard/commands/Help.java | Help.documentCommand | private CharSequence documentCommand(String command) {
MethodTarget methodTarget = commandRegistry.listCommands().get(command);
if (methodTarget == null) {
throw new IllegalArgumentException("Unknown command '" + command + "'");
}
AttributedStringBuilder result = new AttributedStringBuilder().append("\n\n");
List<ParameterDescription> parameterDescriptions = getParameterDescriptions(methodTarget);
// NAME
documentCommandName(result, command, methodTarget.getHelp());
// SYNOPSYS
documentSynopsys(result, command, parameterDescriptions);
// OPTIONS
documentOptions(result, parameterDescriptions);
// ALSO KNOWN AS
documentAliases(result, command, methodTarget);
// AVAILABILITY
documentAvailability(result, methodTarget);
result.append("\n");
return result;
} | java | private CharSequence documentCommand(String command) {
MethodTarget methodTarget = commandRegistry.listCommands().get(command);
if (methodTarget == null) {
throw new IllegalArgumentException("Unknown command '" + command + "'");
}
AttributedStringBuilder result = new AttributedStringBuilder().append("\n\n");
List<ParameterDescription> parameterDescriptions = getParameterDescriptions(methodTarget);
// NAME
documentCommandName(result, command, methodTarget.getHelp());
// SYNOPSYS
documentSynopsys(result, command, parameterDescriptions);
// OPTIONS
documentOptions(result, parameterDescriptions);
// ALSO KNOWN AS
documentAliases(result, command, methodTarget);
// AVAILABILITY
documentAvailability(result, methodTarget);
result.append("\n");
return result;
} | [
"private",
"CharSequence",
"documentCommand",
"(",
"String",
"command",
")",
"{",
"MethodTarget",
"methodTarget",
"=",
"commandRegistry",
".",
"listCommands",
"(",
")",
".",
"get",
"(",
"command",
")",
";",
"if",
"(",
"methodTarget",
"==",
"null",
")",
"{",
... | Return a description of a specific command. Uses a layout inspired by *nix man pages. | [
"Return",
"a",
"description",
"of",
"a",
"specific",
"command",
".",
"Uses",
"a",
"layout",
"inspired",
"by",
"*",
"nix",
"man",
"pages",
"."
] | train | https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-standard-commands/src/main/java/org/springframework/shell/standard/commands/Help.java#L119-L145 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.containsURL | public static boolean containsURL(final URL[] urls, final URL url) {
checkNotNull("urls", urls);
checkNotNull("url", url);
for (int i = 0; i < urls.length; i++) {
final URL element = urls[i];
final String elementStr = element.toExternalForm();
final String urlStr = url.toExternalForm();
if (elementStr.equals(urlStr)) {
return true;
}
}
return false;
} | java | public static boolean containsURL(final URL[] urls, final URL url) {
checkNotNull("urls", urls);
checkNotNull("url", url);
for (int i = 0; i < urls.length; i++) {
final URL element = urls[i];
final String elementStr = element.toExternalForm();
final String urlStr = url.toExternalForm();
if (elementStr.equals(urlStr)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsURL",
"(",
"final",
"URL",
"[",
"]",
"urls",
",",
"final",
"URL",
"url",
")",
"{",
"checkNotNull",
"(",
"\"urls\"",
",",
"urls",
")",
";",
"checkNotNull",
"(",
"\"url\"",
",",
"url",
")",
";",
"for",
"(",
"int",
... | Checks if the array or URLs contains the given URL.
@param urls
Array of URLs - Cannot be <code>null</code>.
@param url
URL to find - Cannot be <code>null</code>.
@return If the URL is in the array TRUE else FALSE. | [
"Checks",
"if",
"the",
"array",
"or",
"URLs",
"contains",
"the",
"given",
"URL",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L273-L285 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.insertBand | public static void insertBand( GrayI16 input, int band , InterleavedI16 output) {
final int numBands = output.numBands;
for (int y = 0; y < input.height; y++) {
int indexIn = input.getStartIndex() + y * input.getStride();
int indexOut = output.getStartIndex() + y * output.getStride() + band;
int end = indexOut + output.width*numBands - band;
for (; indexOut < end; indexOut += numBands , indexIn++ ) {
output.data[indexOut] = input.data[indexIn];
}
}
} | java | public static void insertBand( GrayI16 input, int band , InterleavedI16 output) {
final int numBands = output.numBands;
for (int y = 0; y < input.height; y++) {
int indexIn = input.getStartIndex() + y * input.getStride();
int indexOut = output.getStartIndex() + y * output.getStride() + band;
int end = indexOut + output.width*numBands - band;
for (; indexOut < end; indexOut += numBands , indexIn++ ) {
output.data[indexOut] = input.data[indexIn];
}
}
} | [
"public",
"static",
"void",
"insertBand",
"(",
"GrayI16",
"input",
",",
"int",
"band",
",",
"InterleavedI16",
"output",
")",
"{",
"final",
"int",
"numBands",
"=",
"output",
".",
"numBands",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"input",... | Inserts a single band into a multi-band image overwriting the original band
@param input Single band image
@param band Which band the image is to be inserted into
@param output The multi-band image which the input image is to be inserted into | [
"Inserts",
"a",
"single",
"band",
"into",
"a",
"multi",
"-",
"band",
"image",
"overwriting",
"the",
"original",
"band"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L714-L725 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.packagesIn | public static Set<PackageElement>
packagesIn(Set<? extends Element> elements) {
return setFilter(elements, PACKAGE_KIND, PackageElement.class);
} | java | public static Set<PackageElement>
packagesIn(Set<? extends Element> elements) {
return setFilter(elements, PACKAGE_KIND, PackageElement.class);
} | [
"public",
"static",
"Set",
"<",
"PackageElement",
">",
"packagesIn",
"(",
"Set",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"setFilter",
"(",
"elements",
",",
"PACKAGE_KIND",
",",
"PackageElement",
".",
"class",
")",
";",
"}"
] | Returns a set of packages in {@code elements}.
@return a set of packages in {@code elements}
@param elements the elements to filter | [
"Returns",
"a",
"set",
"of",
"packages",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L182-L185 |
google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.addChildren | public void addChildren(int index, List<? extends N> children) {
List<N> origChildren = Lists.newArrayList(this.children);
int origNumChildren = this.children.size();
// Temporarily remove the original children from index onward (in reverse order).
for (int i = origNumChildren - 1; i >= index; i--) {
removeChild(i);
}
// Add the new children.
addChildren(children);
// Add back the original children that we temporarily removed (in correct order).
addChildren(origChildren.subList(index, origNumChildren));
} | java | public void addChildren(int index, List<? extends N> children) {
List<N> origChildren = Lists.newArrayList(this.children);
int origNumChildren = this.children.size();
// Temporarily remove the original children from index onward (in reverse order).
for (int i = origNumChildren - 1; i >= index; i--) {
removeChild(i);
}
// Add the new children.
addChildren(children);
// Add back the original children that we temporarily removed (in correct order).
addChildren(origChildren.subList(index, origNumChildren));
} | [
"public",
"void",
"addChildren",
"(",
"int",
"index",
",",
"List",
"<",
"?",
"extends",
"N",
">",
"children",
")",
"{",
"List",
"<",
"N",
">",
"origChildren",
"=",
"Lists",
".",
"newArrayList",
"(",
"this",
".",
"children",
")",
";",
"int",
"origNumChi... | Adds the given children at the given index (shifting existing children if necessary).
@param index The index to add the children at.
@param children The children to add. | [
"Adds",
"the",
"given",
"children",
"at",
"the",
"given",
"index",
"(",
"shifting",
"existing",
"children",
"if",
"necessary",
")",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L211-L222 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java | SSLConfigManager.getGlobalProperty | public synchronized String getGlobalProperty(String name, String defaultValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getGlobalProperty", new Object[] { name, defaultValue });
String value = getGlobalProperty(name);
if (value == null) {
value = defaultValue;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getGlobalProperty -> " + value);
return value;
} | java | public synchronized String getGlobalProperty(String name, String defaultValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getGlobalProperty", new Object[] { name, defaultValue });
String value = getGlobalProperty(name);
if (value == null) {
value = defaultValue;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getGlobalProperty -> " + value);
return value;
} | [
"public",
"synchronized",
"String",
"getGlobalProperty",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
... | *
This method returns the value from the above getGlobalProperty call, if not
null. Otherwise it returns the default.
@param name
@param defaultValue
@return String
* | [
"*",
"This",
"method",
"returns",
"the",
"value",
"from",
"the",
"above",
"getGlobalProperty",
"call",
"if",
"not",
"null",
".",
"Otherwise",
"it",
"returns",
"the",
"default",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1218-L1229 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java | DrawerUIUtils.setDrawerVerticalPadding | public static void setDrawerVerticalPadding(View v, int level) {
int verticalPadding = v.getContext().getResources().getDimensionPixelSize(R.dimen.material_drawer_vertical_padding);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
v.setPaddingRelative(verticalPadding * level, 0, verticalPadding, 0);
} else {
v.setPadding(verticalPadding * level, 0, verticalPadding, 0);
}
} | java | public static void setDrawerVerticalPadding(View v, int level) {
int verticalPadding = v.getContext().getResources().getDimensionPixelSize(R.dimen.material_drawer_vertical_padding);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
v.setPaddingRelative(verticalPadding * level, 0, verticalPadding, 0);
} else {
v.setPadding(verticalPadding * level, 0, verticalPadding, 0);
}
} | [
"public",
"static",
"void",
"setDrawerVerticalPadding",
"(",
"View",
"v",
",",
"int",
"level",
")",
"{",
"int",
"verticalPadding",
"=",
"v",
".",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getDimensionPixelSize",
"(",
"R",
".",
"dimen",
"... | helper to set the vertical padding including the extra padding for deeper item hirachy level to the DrawerItems
this is required because on API Level 17 the padding is ignored which is set via the XML
@param v
@param level | [
"helper",
"to",
"set",
"the",
"vertical",
"padding",
"including",
"the",
"extra",
"padding",
"for",
"deeper",
"item",
"hirachy",
"level",
"to",
"the",
"DrawerItems",
"this",
"is",
"required",
"because",
"on",
"API",
"Level",
"17",
"the",
"padding",
"is",
"ig... | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java#L216-L224 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/tunnelip6_stats.java | tunnelip6_stats.get | public static tunnelip6_stats get(nitro_service service, String tunnelip6) throws Exception{
tunnelip6_stats obj = new tunnelip6_stats();
obj.set_tunnelip6(tunnelip6);
tunnelip6_stats response = (tunnelip6_stats) obj.stat_resource(service);
return response;
} | java | public static tunnelip6_stats get(nitro_service service, String tunnelip6) throws Exception{
tunnelip6_stats obj = new tunnelip6_stats();
obj.set_tunnelip6(tunnelip6);
tunnelip6_stats response = (tunnelip6_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"tunnelip6_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"tunnelip6",
")",
"throws",
"Exception",
"{",
"tunnelip6_stats",
"obj",
"=",
"new",
"tunnelip6_stats",
"(",
")",
";",
"obj",
".",
"set_tunnelip6",
"(",
"tunnelip6",
")"... | Use this API to fetch statistics of tunnelip6_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"tunnelip6_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/tunnelip6_stats.java#L209-L214 |
wildfly-extras/wildfly-camel | subsystem/core/src/main/java/org/wildfly/extension/camel/proxy/ProxyUtils.java | ProxyUtils.invokeProxied | public static void invokeProxied(final ProxiedAction action, final ClassLoader classLoader) throws Exception {
ProxiedAction proxy = (ProxiedAction) Proxy.newProxyInstance(classLoader, new Class<?>[] { ProxiedAction.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
action.run();
return Optional.empty();
}
});
proxy.run();
} | java | public static void invokeProxied(final ProxiedAction action, final ClassLoader classLoader) throws Exception {
ProxiedAction proxy = (ProxiedAction) Proxy.newProxyInstance(classLoader, new Class<?>[] { ProxiedAction.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
action.run();
return Optional.empty();
}
});
proxy.run();
} | [
"public",
"static",
"void",
"invokeProxied",
"(",
"final",
"ProxiedAction",
"action",
",",
"final",
"ClassLoader",
"classLoader",
")",
"throws",
"Exception",
"{",
"ProxiedAction",
"proxy",
"=",
"(",
"ProxiedAction",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"cla... | Runs a {@link ProxiedAction} within a {@link Proxy} instance. See the following issues for information
around its primary use case.
https://issues.jboss.org/browse/ENTESB-7117
https://github.com/wildfly-extras/wildfly-camel/issues/1919
@param action A ProxiedAction instance to invoke within a {@link Proxy} instance
@param classLoader The ClassLoader used to create the {@link Proxy} instance
@throws Exception | [
"Runs",
"a",
"{",
"@link",
"ProxiedAction",
"}",
"within",
"a",
"{",
"@link",
"Proxy",
"}",
"instance",
".",
"See",
"the",
"following",
"issues",
"for",
"information",
"around",
"its",
"primary",
"use",
"case",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/proxy/ProxyUtils.java#L47-L56 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/CSSHTMLBundleLinkRenderer.java | CSSHTMLBundleLinkRenderer.performGlobalBundleLinksRendering | @Override
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn)
throws IOException {
if (isForcedToRenderIeCssBundleInDebug(ctx, debugOn)) {
ResourceBundlePathsIterator resourceBundleIterator = bundler.getGlobalResourceBundlePaths(
DebugMode.FORCE_NON_DEBUG_IN_IE, new ConditionalCommentRenderer(out), ctx.getVariants());
while (resourceBundleIterator.hasNext()) {
BundlePath globalBundlePath = resourceBundleIterator.nextPath();
renderIeCssBundleLink(ctx, out, globalBundlePath);
}
} else {
super.performGlobalBundleLinksRendering(ctx, out, debugOn);
}
} | java | @Override
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn)
throws IOException {
if (isForcedToRenderIeCssBundleInDebug(ctx, debugOn)) {
ResourceBundlePathsIterator resourceBundleIterator = bundler.getGlobalResourceBundlePaths(
DebugMode.FORCE_NON_DEBUG_IN_IE, new ConditionalCommentRenderer(out), ctx.getVariants());
while (resourceBundleIterator.hasNext()) {
BundlePath globalBundlePath = resourceBundleIterator.nextPath();
renderIeCssBundleLink(ctx, out, globalBundlePath);
}
} else {
super.performGlobalBundleLinksRendering(ctx, out, debugOn);
}
} | [
"@",
"Override",
"protected",
"void",
"performGlobalBundleLinksRendering",
"(",
"BundleRendererContext",
"ctx",
",",
"Writer",
"out",
",",
"boolean",
"debugOn",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isForcedToRenderIeCssBundleInDebug",
"(",
"ctx",
",",
"debug... | Performs the global bundle rendering
@param ctx
the context
@param out
the writer
@param debugOn
the flag indicating if we are in debug mode or not
@throws IOException
if an IO exception occurs | [
"Performs",
"the",
"global",
"bundle",
"rendering"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/CSSHTMLBundleLinkRenderer.java#L190-L205 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathDomain.java | CathDomain.getChains | public Set<String> getChains() {
Set<String> chains = new HashSet<String>();
List<ResidueRange> rrs = toCanonical().getResidueRanges();
for (ResidueRange rr : rrs) chains.add(rr.getChainName());
return chains;
}
@Override
public String getIdentifier() {
return getCATH();
}
@Override
public SubstructureIdentifier toCanonical() {
List<ResidueRange> ranges = new ArrayList<ResidueRange>();
String chain = String.valueOf(getDomainName().charAt(getDomainName().length() - 3));
for (CathSegment segment : this.getSegments()) {
ranges.add(new ResidueRange(chain, segment.getStart(), segment.getStop()));
}
return new SubstructureIdentifier(getThePdbId(), ranges);
}
@Override
public Structure reduce(Structure input) throws StructureException {
return toCanonical().reduce(input);
}
@Override
public Structure loadStructure(AtomCache cache) throws StructureException,
IOException {
return cache.getStructure(getThePdbId());
}
} | java | public Set<String> getChains() {
Set<String> chains = new HashSet<String>();
List<ResidueRange> rrs = toCanonical().getResidueRanges();
for (ResidueRange rr : rrs) chains.add(rr.getChainName());
return chains;
}
@Override
public String getIdentifier() {
return getCATH();
}
@Override
public SubstructureIdentifier toCanonical() {
List<ResidueRange> ranges = new ArrayList<ResidueRange>();
String chain = String.valueOf(getDomainName().charAt(getDomainName().length() - 3));
for (CathSegment segment : this.getSegments()) {
ranges.add(new ResidueRange(chain, segment.getStart(), segment.getStop()));
}
return new SubstructureIdentifier(getThePdbId(), ranges);
}
@Override
public Structure reduce(Structure input) throws StructureException {
return toCanonical().reduce(input);
}
@Override
public Structure loadStructure(AtomCache cache) throws StructureException,
IOException {
return cache.getStructure(getThePdbId());
}
} | [
"public",
"Set",
"<",
"String",
">",
"getChains",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"chains",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"ResidueRange",
">",
"rrs",
"=",
"toCanonical",
"(",
")",
".",
"getResidueRan... | Returns the chains this domain is defined over; contains more than 1 element only if this domains is a multi-chain domain. | [
"Returns",
"the",
"chains",
"this",
"domain",
"is",
"defined",
"over",
";",
"contains",
"more",
"than",
"1",
"element",
"only",
"if",
"this",
"domains",
"is",
"a",
"multi",
"-",
"chain",
"domain",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathDomain.java#L424-L459 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java | ForwardCurveInterpolation.getForward | @Override
public double getForward(AnalyticModel model, double fixingTime, double paymentOffset)
{
double forward = this.getForward(model, fixingTime);
double curvePaymentOffset = this.getPaymentOffset(fixingTime);
if(paymentOffset != curvePaymentOffset) {
forward = (Math.exp(Math.log(1+forward*curvePaymentOffset) * paymentOffset/curvePaymentOffset)-1.0)/paymentOffset;
// logger.warning("Requesting forward with paymentOffsets not agreeing with original calibration. Requested: " + paymentOffset +". Calibrated: " + curvePaymentOffset + ".");
}
return forward;
} | java | @Override
public double getForward(AnalyticModel model, double fixingTime, double paymentOffset)
{
double forward = this.getForward(model, fixingTime);
double curvePaymentOffset = this.getPaymentOffset(fixingTime);
if(paymentOffset != curvePaymentOffset) {
forward = (Math.exp(Math.log(1+forward*curvePaymentOffset) * paymentOffset/curvePaymentOffset)-1.0)/paymentOffset;
// logger.warning("Requesting forward with paymentOffsets not agreeing with original calibration. Requested: " + paymentOffset +". Calibrated: " + curvePaymentOffset + ".");
}
return forward;
} | [
"@",
"Override",
"public",
"double",
"getForward",
"(",
"AnalyticModel",
"model",
",",
"double",
"fixingTime",
",",
"double",
"paymentOffset",
")",
"{",
"double",
"forward",
"=",
"this",
".",
"getForward",
"(",
"model",
",",
"fixingTime",
")",
";",
"double",
... | Returns the forward for the corresponding fixing time.
<b>Note:</b> This implementation currently ignores the provided <code>paymentOffset</code>.
Instead it uses the payment offset calculate from the curve specification.
@param model An analytic model providing a context. Some curves do not need this (can be null).
@param fixingTime The fixing time of the index associated with this forward curve.
@param paymentOffset The payment offset (as internal day count fraction) specifying the payment of this index. Used only as a fallback and/or consistency check.
@return The forward. | [
"Returns",
"the",
"forward",
"for",
"the",
"corresponding",
"fixing",
"time",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java#L337-L347 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getEnvVariable | public static String getEnvVariable( String name )
throws EnvironmentException
{
if( isUnix() )
{
Properties properties = getUnixShellVariables();
return properties.getProperty( name );
}
else if( isWindows() )
{
Properties properties = getWindowsShellVariables();
return properties.getProperty( name );
}
String osName = System.getProperty( "os.name" );
throw new EnvironmentException( name, "Non-supported operating system: " + osName );
} | java | public static String getEnvVariable( String name )
throws EnvironmentException
{
if( isUnix() )
{
Properties properties = getUnixShellVariables();
return properties.getProperty( name );
}
else if( isWindows() )
{
Properties properties = getWindowsShellVariables();
return properties.getProperty( name );
}
String osName = System.getProperty( "os.name" );
throw new EnvironmentException( name, "Non-supported operating system: " + osName );
} | [
"public",
"static",
"String",
"getEnvVariable",
"(",
"String",
"name",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"isUnix",
"(",
")",
")",
"{",
"Properties",
"properties",
"=",
"getUnixShellVariables",
"(",
")",
";",
"return",
"properties",
".",
"g... | Gets the value of a shell environment variable.
@param name the name of variable
@return the String representation of an environment variable value
@throws EnvironmentException if there is a problem accessing the environment | [
"Gets",
"the",
"value",
"of",
"a",
"shell",
"environment",
"variable",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L207-L223 |
Impetus/Kundera | src/data-as-object/src/main/java/com/impetus/dao/utils/JsonUtil.java | JsonUtil.readJson | public final static <T> T readJson(String json, Class<T> clazz)
{
ObjectMapper mapper = new ObjectMapper();
try
{
if (json != null && !json.isEmpty())
{
return mapper.readValue(json, clazz);
}
else
{
LOGGER.error("JSON is null or empty.");
throw new KunderaException("JSON is null or empty.");
}
}
catch (IOException e)
{
LOGGER.error("Error while converting in json{} presentation{}.", json, e);
throw new KunderaException("Error while mapping JSON to Object. Caused By: ", e);
}
} | java | public final static <T> T readJson(String json, Class<T> clazz)
{
ObjectMapper mapper = new ObjectMapper();
try
{
if (json != null && !json.isEmpty())
{
return mapper.readValue(json, clazz);
}
else
{
LOGGER.error("JSON is null or empty.");
throw new KunderaException("JSON is null or empty.");
}
}
catch (IOException e)
{
LOGGER.error("Error while converting in json{} presentation{}.", json, e);
throw new KunderaException("Error while mapping JSON to Object. Caused By: ", e);
}
} | [
"public",
"final",
"static",
"<",
"T",
">",
"T",
"readJson",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"try",
"{",
"if",
"(",
"json",
"!=",
"null",
"&... | Read json.
@param <T>
the generic type
@param json
the json
@param clazz
the clazz
@return the t | [
"Read",
"json",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/data-as-object/src/main/java/com/impetus/dao/utils/JsonUtil.java#L47-L68 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_userLogs_login_PUT | public void serviceName_userLogs_login_PUT(String serviceName, String login, OvhUserLogs body) throws IOException {
String qPath = "/hosting/web/{serviceName}/userLogs/{login}";
StringBuilder sb = path(qPath, serviceName, login);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_userLogs_login_PUT(String serviceName, String login, OvhUserLogs body) throws IOException {
String qPath = "/hosting/web/{serviceName}/userLogs/{login}";
StringBuilder sb = path(qPath, serviceName, login);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_userLogs_login_PUT",
"(",
"String",
"serviceName",
",",
"String",
"login",
",",
"OvhUserLogs",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/userLogs/{login}\"",
";",
"StringBuilder",
"sb",
... | Alter this object properties
REST: PUT /hosting/web/{serviceName}/userLogs/{login}
@param body [required] New object properties
@param serviceName [required] The internal name of your hosting
@param login [required] The userLogs login used to connect to logs.ovh.net | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L710-L714 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxRetentionPolicy.java | BoxRetentionPolicy.createRetentionPolicy | private static BoxRetentionPolicy.Info createRetentionPolicy(BoxAPIConnection api, String name, String type,
int length, String action) {
return createRetentionPolicy(api, name, type, length, action, null);
} | java | private static BoxRetentionPolicy.Info createRetentionPolicy(BoxAPIConnection api, String name, String type,
int length, String action) {
return createRetentionPolicy(api, name, type, length, action, null);
} | [
"private",
"static",
"BoxRetentionPolicy",
".",
"Info",
"createRetentionPolicy",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"name",
",",
"String",
"type",
",",
"int",
"length",
",",
"String",
"action",
")",
"{",
"return",
"createRetentionPolicy",
"(",
"api",
... | Used to create a new retention policy.
@param api the API connection to be used by the created user.
@param name the name of the retention policy.
@param type the type of the retention policy. Can be "finite" or "indefinite".
@param length the duration in days that the retention policy will be active for after being assigned to content.
@param action the disposition action can be "permanently_delete" or "remove_retention".
@return the created retention policy's info. | [
"Used",
"to",
"create",
"a",
"new",
"retention",
"policy",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicy.java#L145-L148 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/waiters/AWSOpsWorksWaiters.java | AWSOpsWorksWaiters.appExists | public Waiter<DescribeAppsRequest> appExists() {
return new WaiterBuilder<DescribeAppsRequest, DescribeAppsResult>().withSdkFunction(new DescribeAppsFunction(client))
.withAcceptors(new HttpSuccessStatusAcceptor(WaiterState.SUCCESS), new HttpFailureStatusAcceptor(400, WaiterState.FAILURE))
.withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(40), new FixedDelayStrategy(1)))
.withExecutorService(executorService).build();
} | java | public Waiter<DescribeAppsRequest> appExists() {
return new WaiterBuilder<DescribeAppsRequest, DescribeAppsResult>().withSdkFunction(new DescribeAppsFunction(client))
.withAcceptors(new HttpSuccessStatusAcceptor(WaiterState.SUCCESS), new HttpFailureStatusAcceptor(400, WaiterState.FAILURE))
.withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(40), new FixedDelayStrategy(1)))
.withExecutorService(executorService).build();
} | [
"public",
"Waiter",
"<",
"DescribeAppsRequest",
">",
"appExists",
"(",
")",
"{",
"return",
"new",
"WaiterBuilder",
"<",
"DescribeAppsRequest",
",",
"DescribeAppsResult",
">",
"(",
")",
".",
"withSdkFunction",
"(",
"new",
"DescribeAppsFunction",
"(",
"client",
")",... | Builds a AppExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters
specification, and then polls until it determines whether the resource entered the desired state or not, where
polling criteria is bound by either default polling strategy or custom polling strategy. | [
"Builds",
"a",
"AppExists",
"waiter",
"by",
"using",
"custom",
"parameters",
"waiterParameters",
"and",
"other",
"parameters",
"defined",
"in",
"the",
"waiters",
"specification",
"and",
"then",
"polls",
"until",
"it",
"determines",
"whether",
"the",
"resource",
"e... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/waiters/AWSOpsWorksWaiters.java#L69-L75 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArray | public static <T> Level0ArrayOperator<Integer[],Integer> onArray(final int[] target) {
return onArrayOf(Types.INTEGER, ArrayUtils.toObject(target));
} | java | public static <T> Level0ArrayOperator<Integer[],Integer> onArray(final int[] target) {
return onArrayOf(Types.INTEGER, ArrayUtils.toObject(target));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Integer",
"[",
"]",
",",
"Integer",
">",
"onArray",
"(",
"final",
"int",
"[",
"]",
"target",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"INTEGER",
",",
"ArrayUtils",
".",
"toObject"... | <p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"the",
"specified",
"target",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L585-L587 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_customStatus_POST | public OvhOvhPabxCustomStatus billingAccount_ovhPabx_serviceName_hunting_customStatus_POST(String billingAccount, String serviceName, String color, String description, String name) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/customStatus";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "color", color);
addBody(o, "description", description);
addBody(o, "name", name);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxCustomStatus.class);
} | java | public OvhOvhPabxCustomStatus billingAccount_ovhPabx_serviceName_hunting_customStatus_POST(String billingAccount, String serviceName, String color, String description, String name) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/customStatus";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "color", color);
addBody(o, "description", description);
addBody(o, "name", name);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxCustomStatus.class);
} | [
"public",
"OvhOvhPabxCustomStatus",
"billingAccount_ovhPabx_serviceName_hunting_customStatus_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"color",
",",
"String",
"description",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",... | Create a new custom status
REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/customStatus
@param name [required] The name of the status (Pause, Mission, etc...)
@param color [required] The color (in hexadecimal) of the status that will be displayed on agent banner web application
@param description [required] A short description of the status
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"new",
"custom",
"status"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6542-L6551 |
Red5/red5-server-common | src/main/java/org/red5/server/util/ScopeUtils.java | ScopeUtils.getScopeService | protected static Object getScopeService(IScope scope, String name) {
return getScopeService(scope, name, null);
} | java | protected static Object getScopeService(IScope scope, String name) {
return getScopeService(scope, name, null);
} | [
"protected",
"static",
"Object",
"getScopeService",
"(",
"IScope",
"scope",
",",
"String",
"name",
")",
"{",
"return",
"getScopeService",
"(",
"scope",
",",
"name",
",",
"null",
")",
";",
"}"
] | Returns scope service by bean name. See overloaded method for details.
@param scope
scope
@param name
name
@return object | [
"Returns",
"scope",
"service",
"by",
"bean",
"name",
".",
"See",
"overloaded",
"method",
"for",
"details",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L257-L259 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsADESessionCache.java | CmsADESessionCache.setDynamicValue | public void setDynamicValue(String attribute, String value) {
if (null == m_dynamicValues) {
m_dynamicValues = new ConcurrentHashMap<String, String>();
}
m_dynamicValues.put(attribute, value);
} | java | public void setDynamicValue(String attribute, String value) {
if (null == m_dynamicValues) {
m_dynamicValues = new ConcurrentHashMap<String, String>();
}
m_dynamicValues.put(attribute, value);
} | [
"public",
"void",
"setDynamicValue",
"(",
"String",
"attribute",
",",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"m_dynamicValues",
")",
"{",
"m_dynamicValues",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"... | Set cached value for the attribute. Used for dynamically loaded values in the Acacia content editor.
@param attribute the attribute for which the value should be cached
@param value the value to cache | [
"Set",
"cached",
"value",
"for",
"the",
"attribute",
".",
"Used",
"for",
"dynamically",
"loaded",
"values",
"in",
"the",
"Acacia",
"content",
"editor",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L429-L435 |
prestodb/presto | presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java | SemiTransactionalHiveMetastore.deleteIfExists | private static boolean deleteIfExists(FileSystem fileSystem, Path path, boolean recursive)
{
try {
// attempt to delete the path
if (fileSystem.delete(path, recursive)) {
return true;
}
// delete failed
// check if path still exists
return !fileSystem.exists(path);
}
catch (FileNotFoundException ignored) {
// path was already removed or never existed
return true;
}
catch (IOException ignored) {
}
return false;
} | java | private static boolean deleteIfExists(FileSystem fileSystem, Path path, boolean recursive)
{
try {
// attempt to delete the path
if (fileSystem.delete(path, recursive)) {
return true;
}
// delete failed
// check if path still exists
return !fileSystem.exists(path);
}
catch (FileNotFoundException ignored) {
// path was already removed or never existed
return true;
}
catch (IOException ignored) {
}
return false;
} | [
"private",
"static",
"boolean",
"deleteIfExists",
"(",
"FileSystem",
"fileSystem",
",",
"Path",
"path",
",",
"boolean",
"recursive",
")",
"{",
"try",
"{",
"// attempt to delete the path",
"if",
"(",
"fileSystem",
".",
"delete",
"(",
"path",
",",
"recursive",
")"... | Attempts to remove the file or empty directory.
@return true if the location no longer exists | [
"Attempts",
"to",
"remove",
"the",
"file",
"or",
"empty",
"directory",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L1837-L1856 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getPersistedItemData | protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
if (cache.isEnabled())
{
if (data == null)
{
if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
{
cache.put(new NullNodeData(parentData, name));
}
else
{
cache.put(new NullPropertyData(parentData, name));
}
}
else
{
cache.put(data);
}
}
return data;
} | java | protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
if (cache.isEnabled())
{
if (data == null)
{
if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
{
cache.put(new NullNodeData(parentData, name));
}
else
{
cache.put(new NullPropertyData(parentData, name));
}
}
else
{
cache.put(data);
}
}
return data;
} | [
"protected",
"ItemData",
"getPersistedItemData",
"(",
"NodeData",
"parentData",
",",
"QPathEntry",
"name",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
"{",
"ItemData",
"data",
"=",
"super",
".",
"getItemData",
"(",
"parentData",
",",
"name",
... | Get persisted ItemData.
@param parentData
parent
@param name
Item name
@param itemType
item type
@return ItemData
@throws RepositoryException
error | [
"Get",
"persisted",
"ItemData",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1975-L1998 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java | DefaultApplicationObjectConfigurer.configureColor | protected void configureColor(ColorConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
Color color = loadColor(objectName + ".foreground");
if (color != null)
configurable.setForeground(color);
color = loadColor(objectName + ".background");
if (color != null)
configurable.setBackground(color);
} | java | protected void configureColor(ColorConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
Color color = loadColor(objectName + ".foreground");
if (color != null)
configurable.setForeground(color);
color = loadColor(objectName + ".background");
if (color != null)
configurable.setBackground(color);
} | [
"protected",
"void",
"configureColor",
"(",
"ColorConfigurable",
"configurable",
",",
"String",
"objectName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"configurable",
",",
"\"configurable\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"objectName",
",",
"\"objectNam... | Sets the foreground and background colours of the given object.
Use the following message codes:
<pre>
<objectName>.foreground
<objectName>.background
</pre>
@param configurable The object to be configured. Must not be null.
@param objectName The name of the configurable object, unique within the
application. Must not be null.
@throws IllegalArgumentException if either argument is null. | [
"Sets",
"the",
"foreground",
"and",
"background",
"colours",
"of",
"the",
"given",
"object",
".",
"Use",
"the",
"following",
"message",
"codes",
":"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L399-L410 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/constraint/DMinMax.java | DMinMax.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final Double result;
if( value instanceof Double ) {
result = (Double) value;
} else {
try {
result = Double.parseDouble(value.toString());
}
catch(final NumberFormatException e) {
throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Double", value),
context, this, e);
}
}
if( result < min || result > max ) {
throw new SuperCsvConstraintViolationException(String.format(
"%f does not lie between the min (%f) and max (%f) values (inclusive)", result, min, max), context,
this);
}
return next.execute(result, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final Double result;
if( value instanceof Double ) {
result = (Double) value;
} else {
try {
result = Double.parseDouble(value.toString());
}
catch(final NumberFormatException e) {
throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Double", value),
context, this, e);
}
}
if( result < min || result > max ) {
throw new SuperCsvConstraintViolationException(String.format(
"%f does not lie between the min (%f) and max (%f) values (inclusive)", result, min, max), context,
this);
}
return next.execute(result, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"final",
"Double",
"result",
";",
"if",
"(",
"value",
"instanceof",
"Double",
")"... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or can't be parsed as a Double
@throws SuperCsvConstraintViolationException
if value doesn't lie between min and max (inclusive) | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/DMinMax.java#L133-L156 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java | AnnotationTypeRequiredMemberBuilder.buildSignature | public void buildSignature(XMLNode node, Content annotationDocTree) {
annotationDocTree.addContent(
writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
} | java | public void buildSignature(XMLNode node, Content annotationDocTree) {
annotationDocTree.addContent(
writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
} | [
"public",
"void",
"buildSignature",
"(",
"XMLNode",
"node",
",",
"Content",
"annotationDocTree",
")",
"{",
"annotationDocTree",
".",
"addContent",
"(",
"writer",
".",
"getSignature",
"(",
"(",
"MemberDoc",
")",
"members",
".",
"get",
"(",
"currentMemberIndex",
"... | Build the signature.
@param node the XML element that specifies which components to document
@param annotationDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"signature",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L191-L194 |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/ConstantNaryTreeNode.java | ConstantNaryTreeNode.setChildAt | @Override
public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsException {
final N oldChild = (index < this.children.length) ? this.children[index] : null;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(index, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
// set the element
this.children[index] = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(index, newChild);
}
return true;
} | java | @Override
public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsException {
final N oldChild = (index < this.children.length) ? this.children[index] : null;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(index, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
// set the element
this.children[index] = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(index, newChild);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"setChildAt",
"(",
"int",
"index",
",",
"N",
"newChild",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"final",
"N",
"oldChild",
"=",
"(",
"index",
"<",
"this",
".",
"children",
".",
"length",
")",
"?",
"this",
".",... | Set the child at the given index in this node.
@param index is the index of the new child between <code>0</code>
and <code>getChildCount()</code> (inclusive).
@param newChild is the child to insert. | [
"Set",
"the",
"child",
"at",
"the",
"given",
"index",
"in",
"this",
"node",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/ConstantNaryTreeNode.java#L219-L249 |
bwkimmel/java-util | src/main/java/ca/eandb/util/auth/FixedCallbackHandler.java | FixedCallbackHandler.forNameAndPassword | public static CallbackHandler forNameAndPassword(String name, String password) {
return FixedCallbackHandler.forNameAndPassword(name, password.toCharArray());
} | java | public static CallbackHandler forNameAndPassword(String name, String password) {
return FixedCallbackHandler.forNameAndPassword(name, password.toCharArray());
} | [
"public",
"static",
"CallbackHandler",
"forNameAndPassword",
"(",
"String",
"name",
",",
"String",
"password",
")",
"{",
"return",
"FixedCallbackHandler",
".",
"forNameAndPassword",
"(",
"name",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
";",
"}"
] | Creates a <code>CallbackHandler</code> that provides the specified user
name and password.
@param name The user name.
@param password The password.
@return The new <code>CallbackHandler</code>. | [
"Creates",
"a",
"<code",
">",
"CallbackHandler<",
"/",
"code",
">",
"that",
"provides",
"the",
"specified",
"user",
"name",
"and",
"password",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/auth/FixedCallbackHandler.java#L90-L92 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/ClassFilter.java | ClassFilter.checkPackage | private boolean checkPackage(String className, String packageName) {
if (packages.contains(packageName)) {
cacheClassname(className);
return true;
}
return false;
} | java | private boolean checkPackage(String className, String packageName) {
if (packages.contains(packageName)) {
cacheClassname(className);
return true;
}
return false;
} | [
"private",
"boolean",
"checkPackage",
"(",
"String",
"className",
",",
"String",
"packageName",
")",
"{",
"if",
"(",
"packages",
".",
"contains",
"(",
"packageName",
")",
")",
"{",
"cacheClassname",
"(",
"className",
")",
";",
"return",
"true",
";",
"}",
"... | Checks if given class name is listed by package. If it's listed, then performance optimization is used and classname is
added directly to {@code classes} collection.
@param className Class name to be checked.
@param packageName Package name of the checked class.
@return {@code true} iff class is listed by-package | [
"Checks",
"if",
"given",
"class",
"name",
"is",
"listed",
"by",
"package",
".",
"If",
"it",
"s",
"listed",
"then",
"performance",
"optimization",
"is",
"used",
"and",
"classname",
"is",
"added",
"directly",
"to",
"{",
"@code",
"classes",
"}",
"collection",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/ClassFilter.java#L153-L159 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/SetCoverage.java | SetCoverage.evaluate | public double evaluate(List<? extends Solution<?>> set1, List<? extends Solution<?>> set2) {
double result ;
int sum = 0 ;
if (set2.size()==0) {
if (set1.size()==0) {
result = 0.0 ;
} else {
result = 1.0 ;
}
} else {
for (Solution<?> solution : set2) {
if (SolutionListUtils.isSolutionDominatedBySolutionList(solution, set1)) {
sum++;
}
}
result = (double)sum/set2.size() ;
}
return result ;
} | java | public double evaluate(List<? extends Solution<?>> set1, List<? extends Solution<?>> set2) {
double result ;
int sum = 0 ;
if (set2.size()==0) {
if (set1.size()==0) {
result = 0.0 ;
} else {
result = 1.0 ;
}
} else {
for (Solution<?> solution : set2) {
if (SolutionListUtils.isSolutionDominatedBySolutionList(solution, set1)) {
sum++;
}
}
result = (double)sum/set2.size() ;
}
return result ;
} | [
"public",
"double",
"evaluate",
"(",
"List",
"<",
"?",
"extends",
"Solution",
"<",
"?",
">",
">",
"set1",
",",
"List",
"<",
"?",
"extends",
"Solution",
"<",
"?",
">",
">",
"set2",
")",
"{",
"double",
"result",
";",
"int",
"sum",
"=",
"0",
";",
"i... | Calculates the set coverage of set1 over set2
@param set1
@param set2
@return The value of the set coverage | [
"Calculates",
"the",
"set",
"coverage",
"of",
"set1",
"over",
"set2"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/SetCoverage.java#L52-L71 |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | BaseXMLBuilder.elementImpl | protected Element elementImpl(String name, String namespaceURI) {
assertElementContainsNoOrWhitespaceOnlyTextNodes(this.xmlNode);
if (namespaceURI == null) {
return getDocument().createElement(name);
} else {
return getDocument().createElementNS(namespaceURI, name);
}
} | java | protected Element elementImpl(String name, String namespaceURI) {
assertElementContainsNoOrWhitespaceOnlyTextNodes(this.xmlNode);
if (namespaceURI == null) {
return getDocument().createElement(name);
} else {
return getDocument().createElementNS(namespaceURI, name);
}
} | [
"protected",
"Element",
"elementImpl",
"(",
"String",
"name",
",",
"String",
"namespaceURI",
")",
"{",
"assertElementContainsNoOrWhitespaceOnlyTextNodes",
"(",
"this",
".",
"xmlNode",
")",
";",
"if",
"(",
"namespaceURI",
"==",
"null",
")",
"{",
"return",
"getDocum... | Add a named and namespaced XML element to the document as a child of
this builder's node.
@param name
the name of the XML element.
@param namespaceURI
a namespace URI
@return
@throws IllegalStateException
if you attempt to add a child element to an XML node that already
contains a text node value. | [
"Add",
"a",
"named",
"and",
"namespaced",
"XML",
"element",
"to",
"the",
"document",
"as",
"a",
"child",
"of",
"this",
"builder",
"s",
"node",
"."
] | train | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L542-L549 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonPopular | public ResultList<PersonFind> getPersonPopular(Integer page) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.POPULAR).buildUrl(parameters);
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person popular");
return wrapper.getResultsList();
} | java | public ResultList<PersonFind> getPersonPopular(Integer page) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.POPULAR).buildUrl(parameters);
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person popular");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"PersonFind",
">",
"getPersonPopular",
"(",
"Integer",
"page",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"PAGE",
... | Get the list of popular people on The Movie Database.
This list refreshes every day.
@param page
@return
@throws MovieDbException | [
"Get",
"the",
"list",
"of",
"popular",
"people",
"on",
"The",
"Movie",
"Database",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L287-L294 |
josesamuel/remoter | remoter/src/main/java/remoter/compiler/builder/BindingManager.java | BindingManager.getFieldBuilder | FieldBuilder getFieldBuilder(Element element) {
FieldBuilder fieldBuilder = new FieldBuilder(messager, element);
fieldBuilder.setBindingManager(this);
return fieldBuilder;
} | java | FieldBuilder getFieldBuilder(Element element) {
FieldBuilder fieldBuilder = new FieldBuilder(messager, element);
fieldBuilder.setBindingManager(this);
return fieldBuilder;
} | [
"FieldBuilder",
"getFieldBuilder",
"(",
"Element",
"element",
")",
"{",
"FieldBuilder",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"messager",
",",
"element",
")",
";",
"fieldBuilder",
".",
"setBindingManager",
"(",
"this",
")",
";",
"return",
"fieldBuilder"... | Returns the {@link FieldBuilder} that adds fields to the class spec | [
"Returns",
"the",
"{"
] | train | https://github.com/josesamuel/remoter/blob/007401868c319740d40134ebc07c3406988f9a86/remoter/src/main/java/remoter/compiler/builder/BindingManager.java#L121-L125 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readFolder | protected CmsFolder readFolder(CmsDbContext dbc, String resourcename, CmsResourceFilter filter)
throws CmsException {
CmsResource resource = readResource(dbc, resourcename, filter);
return m_driverManager.convertResourceToFolder(resource);
} | java | protected CmsFolder readFolder(CmsDbContext dbc, String resourcename, CmsResourceFilter filter)
throws CmsException {
CmsResource resource = readResource(dbc, resourcename, filter);
return m_driverManager.convertResourceToFolder(resource);
} | [
"protected",
"CmsFolder",
"readFolder",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"dbc",
",",
"resourcename",
",",
"filter",... | Reads a folder from the VFS, using the specified resource filter.<p>
@param dbc the current database context
@param resourcename the name of the folder to read (full path)
@param filter the resource filter to use while reading
@return the folder that was read
@throws CmsException if something goes wrong | [
"Reads",
"a",
"folder",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L7427-L7432 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java | BaseMessageTransport.processIncomingMessage | public BaseMessage processIncomingMessage(BaseMessage messageReplyIn, BaseMessage messageOut)
{
messageReplyIn = this.convertExternalReplyToInternal(messageReplyIn, messageOut);
String strMessageInfoType = this.getMessageInfoType(messageReplyIn);
String strDefaultProcessorClass = MessageInfoTypeModel.REQUEST.equals(strMessageInfoType) ? BaseMessageInProcessor.class.getName() : BaseMessageReplyInProcessor.class.getName();
BaseExternalMessageProcessor messageInProcessor = (BaseExternalMessageProcessor)BaseMessageProcessor.getMessageProcessor(this.getTask(), messageReplyIn, strDefaultProcessorClass);
Utility.getLogger().info("processIncommingMessage - processor: " + messageInProcessor);
BaseMessage messageReply = null;
if (messageInProcessor == null)
{
String strErrorMessage = "Message in processor not found " + strDefaultProcessorClass;
messageReply = BaseMessageProcessor.processErrorMessage(this, messageReplyIn, strErrorMessage);
}
else
{
messageReply = messageInProcessor.processMessage(messageReplyIn);
messageInProcessor.free();
}
// Next step - setup the reply
if (messageReply != null) // Never for replies.
{
this.setupReplyMessage(messageReply, messageReplyIn, null, null);
if ((messageReply.getMessageDataDesc(null) != null)
&& (messageReplyIn.getMessageDataDesc(null) != null))
((MessageRecordDesc)messageReply.getMessageDataDesc(null)).moveRequestInfoToReply(messageReplyIn);
Utility.getLogger().info("returning msgReplyInternal: " + messageReplyIn);
return messageReply; // Have the caller process (send) this return message
}
return null;
} | java | public BaseMessage processIncomingMessage(BaseMessage messageReplyIn, BaseMessage messageOut)
{
messageReplyIn = this.convertExternalReplyToInternal(messageReplyIn, messageOut);
String strMessageInfoType = this.getMessageInfoType(messageReplyIn);
String strDefaultProcessorClass = MessageInfoTypeModel.REQUEST.equals(strMessageInfoType) ? BaseMessageInProcessor.class.getName() : BaseMessageReplyInProcessor.class.getName();
BaseExternalMessageProcessor messageInProcessor = (BaseExternalMessageProcessor)BaseMessageProcessor.getMessageProcessor(this.getTask(), messageReplyIn, strDefaultProcessorClass);
Utility.getLogger().info("processIncommingMessage - processor: " + messageInProcessor);
BaseMessage messageReply = null;
if (messageInProcessor == null)
{
String strErrorMessage = "Message in processor not found " + strDefaultProcessorClass;
messageReply = BaseMessageProcessor.processErrorMessage(this, messageReplyIn, strErrorMessage);
}
else
{
messageReply = messageInProcessor.processMessage(messageReplyIn);
messageInProcessor.free();
}
// Next step - setup the reply
if (messageReply != null) // Never for replies.
{
this.setupReplyMessage(messageReply, messageReplyIn, null, null);
if ((messageReply.getMessageDataDesc(null) != null)
&& (messageReplyIn.getMessageDataDesc(null) != null))
((MessageRecordDesc)messageReply.getMessageDataDesc(null)).moveRequestInfoToReply(messageReplyIn);
Utility.getLogger().info("returning msgReplyInternal: " + messageReplyIn);
return messageReply; // Have the caller process (send) this return message
}
return null;
} | [
"public",
"BaseMessage",
"processIncomingMessage",
"(",
"BaseMessage",
"messageReplyIn",
",",
"BaseMessage",
"messageOut",
")",
"{",
"messageReplyIn",
"=",
"this",
".",
"convertExternalReplyToInternal",
"(",
"messageReplyIn",
",",
"messageOut",
")",
";",
"String",
"strM... | Here is an incoming message.
Figure out what it is and process it.
Note: the caller should have logged this message since I have no way to serialize the raw data.
@param messageReplyIn - The incoming message
@param messageOut - The (optional) outgoing message that this is a reply to (null if unknown).
@return The optional return message. | [
"Here",
"is",
"an",
"incoming",
"message",
".",
"Figure",
"out",
"what",
"it",
"is",
"and",
"process",
"it",
".",
"Note",
":",
"the",
"caller",
"should",
"have",
"logged",
"this",
"message",
"since",
"I",
"have",
"no",
"way",
"to",
"serialize",
"the",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java#L244-L275 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_spare_new_POST | public OvhOrder telephony_spare_new_POST(String brand, String mondialRelayId, Long quantity, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/spare/new";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "brand", brand);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "quantity", quantity);
addBody(o, "shippingContactId", shippingContactId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_spare_new_POST(String brand, String mondialRelayId, Long quantity, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/spare/new";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "brand", brand);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "quantity", quantity);
addBody(o, "shippingContactId", shippingContactId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_spare_new_POST",
"(",
"String",
"brand",
",",
"String",
"mondialRelayId",
",",
"Long",
"quantity",
",",
"Long",
"shippingContactId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/telephony/spare/new\"",
";",
"Str... | Create order
REST: POST /order/telephony/spare/new
@param shippingContactId [required] Shipping contact information id from /me entry point
@param brand [required] Spare phone brand model
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry.
@param quantity [required] Number of phone quantity | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6084-L6094 |
Terracotta-OSS/offheap-store | src/main/java/org/terracotta/offheapstore/storage/allocator/IntegerBestFitAllocator.java | IntegerBestFitAllocator.setInUseAndPreviousInUse | private void setInUseAndPreviousInUse(int p, int s) {
setSizeAndPreviousInUseOfInUseChunk(p, s);
head(p + s, head(p + s) | PINUSE_BIT);
} | java | private void setInUseAndPreviousInUse(int p, int s) {
setSizeAndPreviousInUseOfInUseChunk(p, s);
head(p + s, head(p + s) | PINUSE_BIT);
} | [
"private",
"void",
"setInUseAndPreviousInUse",
"(",
"int",
"p",
",",
"int",
"s",
")",
"{",
"setSizeAndPreviousInUseOfInUseChunk",
"(",
"p",
",",
"s",
")",
";",
"head",
"(",
"p",
"+",
"s",
",",
"head",
"(",
"p",
"+",
"s",
")",
"|",
"PINUSE_BIT",
")",
... | /* Set cinuse and pinuse of this chunk and pinuse of next chunk | [
"/",
"*",
"Set",
"cinuse",
"and",
"pinuse",
"of",
"this",
"chunk",
"and",
"pinuse",
"of",
"next",
"chunk"
] | train | https://github.com/Terracotta-OSS/offheap-store/blob/600486cddb33c0247025c0cb69eff289eb6d7d93/src/main/java/org/terracotta/offheapstore/storage/allocator/IntegerBestFitAllocator.java#L799-L802 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.scale | public static Atom scale(Atom a, double s) {
double x = a.getX();
double y = a.getY();
double z = a.getZ();
Atom b = new AtomImpl();
b.setX(x*s);
b.setY(y*s);
b.setZ(z*s);
return b;
} | java | public static Atom scale(Atom a, double s) {
double x = a.getX();
double y = a.getY();
double z = a.getZ();
Atom b = new AtomImpl();
b.setX(x*s);
b.setY(y*s);
b.setZ(z*s);
return b;
} | [
"public",
"static",
"Atom",
"scale",
"(",
"Atom",
"a",
",",
"double",
"s",
")",
"{",
"double",
"x",
"=",
"a",
".",
"getX",
"(",
")",
";",
"double",
"y",
"=",
"a",
".",
"getY",
"(",
")",
";",
"double",
"z",
"=",
"a",
".",
"getZ",
"(",
")",
"... | Multiply elements of a by s
@param a
@param s
@return A new Atom with s*a | [
"Multiply",
"elements",
"of",
"a",
"by",
"s"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L854-L865 |
forge/core | javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/AbstractFacesFacetImpl.java | AbstractFacesFacetImpl.buildFacesViewId | private String buildFacesViewId(final String servletMapping, final String resourcePath)
{
for (String suffix : getFacesSuffixes())
{
if (resourcePath.endsWith(suffix))
{
StringBuffer result = new StringBuffer();
Map<Pattern, String> patterns = new HashMap<>();
Pattern pathMapping = Pattern.compile("^(/.*)/\\*$");
Pattern extensionMapping = Pattern.compile("^\\*(\\..*)$");
Pattern defaultMapping = Pattern.compile("^/\\*$");
patterns.put(pathMapping, "$1" + resourcePath);
patterns.put(extensionMapping, resourcePath.replaceAll("^(.*)(\\.\\w+)$", "$1") + "$1");
patterns.put(defaultMapping, resourcePath);
boolean matched = false;
Iterator<Pattern> iterator = patterns.keySet().iterator();
while ((matched == false) && iterator.hasNext())
{
Pattern p = iterator.next();
Matcher m = p.matcher(servletMapping);
if (m.matches())
{
String replacement = patterns.get(p);
m.appendReplacement(result, replacement);
matched = true;
}
}
if (matched == false)
{
return null;
}
return result.toString();
}
}
return resourcePath;
} | java | private String buildFacesViewId(final String servletMapping, final String resourcePath)
{
for (String suffix : getFacesSuffixes())
{
if (resourcePath.endsWith(suffix))
{
StringBuffer result = new StringBuffer();
Map<Pattern, String> patterns = new HashMap<>();
Pattern pathMapping = Pattern.compile("^(/.*)/\\*$");
Pattern extensionMapping = Pattern.compile("^\\*(\\..*)$");
Pattern defaultMapping = Pattern.compile("^/\\*$");
patterns.put(pathMapping, "$1" + resourcePath);
patterns.put(extensionMapping, resourcePath.replaceAll("^(.*)(\\.\\w+)$", "$1") + "$1");
patterns.put(defaultMapping, resourcePath);
boolean matched = false;
Iterator<Pattern> iterator = patterns.keySet().iterator();
while ((matched == false) && iterator.hasNext())
{
Pattern p = iterator.next();
Matcher m = p.matcher(servletMapping);
if (m.matches())
{
String replacement = patterns.get(p);
m.appendReplacement(result, replacement);
matched = true;
}
}
if (matched == false)
{
return null;
}
return result.toString();
}
}
return resourcePath;
} | [
"private",
"String",
"buildFacesViewId",
"(",
"final",
"String",
"servletMapping",
",",
"final",
"String",
"resourcePath",
")",
"{",
"for",
"(",
"String",
"suffix",
":",
"getFacesSuffixes",
"(",
")",
")",
"{",
"if",
"(",
"resourcePath",
".",
"endsWith",
"(",
... | Build a Faces view ID for the given resource path, return null if not mapped by Faces Servlet | [
"Build",
"a",
"Faces",
"view",
"ID",
"for",
"the",
"given",
"resource",
"path",
"return",
"null",
"if",
"not",
"mapped",
"by",
"Faces",
"Servlet"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/AbstractFacesFacetImpl.java#L392-L433 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/CacheEntry.java | CacheEntry.persist | public void persist(final ICacheManager mgr) throws IOException {
if (delete) return;
if (sourceMapSize == 0) {
// No source map. Just stream the file
mgr.createCacheFileAsync("layer.", //$NON-NLS-1$
new ByteArrayInputStream(bytes),
new CreateCompletionCallback(mgr));
} else {
// cache entry contains source map info. Create a CacheData instance
// and serialize object.
Object data = new CacheData(bytes, sourceMap);
mgr.externalizeCacheObjectAsync("layer.", //$NON-NLS-1$
data,
new CreateCompletionCallback(mgr));
}
} | java | public void persist(final ICacheManager mgr) throws IOException {
if (delete) return;
if (sourceMapSize == 0) {
// No source map. Just stream the file
mgr.createCacheFileAsync("layer.", //$NON-NLS-1$
new ByteArrayInputStream(bytes),
new CreateCompletionCallback(mgr));
} else {
// cache entry contains source map info. Create a CacheData instance
// and serialize object.
Object data = new CacheData(bytes, sourceMap);
mgr.externalizeCacheObjectAsync("layer.", //$NON-NLS-1$
data,
new CreateCompletionCallback(mgr));
}
} | [
"public",
"void",
"persist",
"(",
"final",
"ICacheManager",
"mgr",
")",
"throws",
"IOException",
"{",
"if",
"(",
"delete",
")",
"return",
";",
"if",
"(",
"sourceMapSize",
"==",
"0",
")",
"{",
"// No source map. Just stream the file\r",
"mgr",
".",
"createCacheF... | Asynchronously write the layer build content to disk and set filename to the
name of the cache files when done.
@param mgr The cache manager
@throws IOException | [
"Asynchronously",
"write",
"the",
"layer",
"build",
"content",
"to",
"disk",
"and",
"set",
"filename",
"to",
"the",
"name",
"of",
"the",
"cache",
"files",
"when",
"done",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/CacheEntry.java#L232-L247 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.QGram | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget, Integer k) {
return (T) new QGram(baseTarget, k).update(compareTarget);
} | java | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget, Integer k) {
return (T) new QGram(baseTarget, k).update(compareTarget);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"QGram",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
",",
"Integer",
"k",
")",
"{",
"return",
"(",
"T",
")",
"new",
"QGra... | Returns a new Q-Gram (Ukkonen) instance with compare target string and k-shingling
@see QGram
@param baseTarget
@param compareTarget
@param k
@return | [
"Returns",
"a",
"new",
"Q",
"-",
"Gram",
"(",
"Ukkonen",
")",
"instance",
"with",
"compare",
"target",
"string",
"and",
"k",
"-",
"shingling"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L197-L200 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java | ExceptionFactory.planVersionNotFoundException | public static final PlanVersionNotFoundException planVersionNotFoundException(String planId, String version) {
return new PlanVersionNotFoundException(Messages.i18n.format("PlanVersionDoesNotExist", planId, version)); //$NON-NLS-1$
} | java | public static final PlanVersionNotFoundException planVersionNotFoundException(String planId, String version) {
return new PlanVersionNotFoundException(Messages.i18n.format("PlanVersionDoesNotExist", planId, version)); //$NON-NLS-1$
} | [
"public",
"static",
"final",
"PlanVersionNotFoundException",
"planVersionNotFoundException",
"(",
"String",
"planId",
",",
"String",
"version",
")",
"{",
"return",
"new",
"PlanVersionNotFoundException",
"(",
"Messages",
".",
"i18n",
".",
"format",
"(",
"\"PlanVersionDoe... | Creates an exception from an plan id and version.
@param planId the plan id
@param version the version id
@return the exception | [
"Creates",
"an",
"exception",
"from",
"an",
"plan",
"id",
"and",
"version",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java#L311-L313 |
Netflix/netflix-commons | netflix-commons-util/src/main/java/com/netflix/util/HashCode.java | HashCode.equalObjects | public static boolean equalObjects(Object o1, Object o2) {
if (o1 == null) {
return (o2 == null);
} else if (o2 == null) {
return false;
} else {
return o1.equals(o2);
}
} | java | public static boolean equalObjects(Object o1, Object o2) {
if (o1 == null) {
return (o2 == null);
} else if (o2 == null) {
return false;
} else {
return o1.equals(o2);
}
} | [
"public",
"static",
"boolean",
"equalObjects",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"if",
"(",
"o1",
"==",
"null",
")",
"{",
"return",
"(",
"o2",
"==",
"null",
")",
";",
"}",
"else",
"if",
"(",
"o2",
"==",
"null",
")",
"{",
"return... | Utility function to make it easy to compare two, possibly null, objects.
@param o1 first object
@param o2 second object
@return true iff either both objects are null, or
neither are null and they are equal. | [
"Utility",
"function",
"to",
"make",
"it",
"easy",
"to",
"compare",
"two",
"possibly",
"null",
"objects",
"."
] | train | https://github.com/Netflix/netflix-commons/blob/7a158af76906d4a9b753e9344ce3e7abeb91dc01/netflix-commons-util/src/main/java/com/netflix/util/HashCode.java#L318-L326 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java | CmsAliasBulkEditHelper.importAliases | public void importAliases(HttpServletRequest request, HttpServletResponse response) throws Exception {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
@SuppressWarnings("unchecked")
List<FileItem> items = upload.parseRequest(request);
byte[] data = null;
String siteRoot = null;
String separator = ",";
for (FileItem fileItem : items) {
String name = fileItem.getFieldName();
if (PARAM_IMPORTFILE.equals(name)) {
data = fileItem.get();
} else if (PARAM_SITEROOT.equals(name)) {
siteRoot = new String(fileItem.get(), request.getCharacterEncoding());
} else if (PARAM_SEPARATOR.equals(name)) {
separator = new String(fileItem.get(), request.getCharacterEncoding());
}
}
List<CmsAliasImportResult> result = new ArrayList<CmsAliasImportResult>();
if ((siteRoot != null) && (data != null)) {
result = OpenCms.getAliasManager().importAliases(m_cms, data, siteRoot, separator);
}
String key = CmsVfsSitemapService.addAliasImportResult(result);
// only respond with a key, then the client can get the data for the key via GWT-RPC
response.getWriter().print(key);
} | java | public void importAliases(HttpServletRequest request, HttpServletResponse response) throws Exception {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
@SuppressWarnings("unchecked")
List<FileItem> items = upload.parseRequest(request);
byte[] data = null;
String siteRoot = null;
String separator = ",";
for (FileItem fileItem : items) {
String name = fileItem.getFieldName();
if (PARAM_IMPORTFILE.equals(name)) {
data = fileItem.get();
} else if (PARAM_SITEROOT.equals(name)) {
siteRoot = new String(fileItem.get(), request.getCharacterEncoding());
} else if (PARAM_SEPARATOR.equals(name)) {
separator = new String(fileItem.get(), request.getCharacterEncoding());
}
}
List<CmsAliasImportResult> result = new ArrayList<CmsAliasImportResult>();
if ((siteRoot != null) && (data != null)) {
result = OpenCms.getAliasManager().importAliases(m_cms, data, siteRoot, separator);
}
String key = CmsVfsSitemapService.addAliasImportResult(result);
// only respond with a key, then the client can get the data for the key via GWT-RPC
response.getWriter().print(key);
} | [
"public",
"void",
"importAliases",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"FileItemFactory",
"factory",
"=",
"new",
"DiskFileItemFactory",
"(",
")",
";",
"ServletFileUpload",
"upload",
"=",
"new",... | Imports uploaded aliases from a request.<p>
@param request the request containing the uploaded aliases
@param response the response
@throws Exception if something goes wrong | [
"Imports",
"uploaded",
"aliases",
"from",
"a",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java#L94-L120 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagEnableAde.java | CmsJspTagEnableAde.getPreviewInclude | private static String getPreviewInclude(String buttonLeft, String titleMessage) {
StringBuffer buffer = new StringBuffer();
buffer.append("<style type=\"text/css\"> @import url(\"").append(
CmsGwtActionElement.getFontIconCssLink()).append("\"); </style>\n");
buffer.append(String.format(PREVIEW_INCLUDE_SCRIPT, buttonLeft, titleMessage));
return buffer.toString();
} | java | private static String getPreviewInclude(String buttonLeft, String titleMessage) {
StringBuffer buffer = new StringBuffer();
buffer.append("<style type=\"text/css\"> @import url(\"").append(
CmsGwtActionElement.getFontIconCssLink()).append("\"); </style>\n");
buffer.append(String.format(PREVIEW_INCLUDE_SCRIPT, buttonLeft, titleMessage));
return buffer.toString();
} | [
"private",
"static",
"String",
"getPreviewInclude",
"(",
"String",
"buttonLeft",
",",
"String",
"titleMessage",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"\"<style type=\\\"text/css\\\"> @import url(\\... | Returns the preview mode include.<p>
@param buttonLeft the button left parameter
@param titleMessage the title attribute of the "Editor mode" button rendered by the include
@return the preview mode include | [
"Returns",
"the",
"preview",
"mode",
"include",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEnableAde.java#L241-L248 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readAccessControlEntry | public CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
throws CmsException {
return getUserDriver(
dbc).readAccessControlEntry(dbc, dbc.currentProject(), resource.getResourceId(), principal);
} | java | public CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
throws CmsException {
return getUserDriver(
dbc).readAccessControlEntry(dbc, dbc.currentProject(), resource.getResourceId(), principal);
} | [
"public",
"CmsAccessControlEntry",
"readAccessControlEntry",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"CmsUUID",
"principal",
")",
"throws",
"CmsException",
"{",
"return",
"getUserDriver",
"(",
"dbc",
")",
".",
"readAccessControlEntry",
"(",
"d... | Reads an access control entry from the cms.<p>
The access control entries of a resource are readable by everyone.
@param dbc the current database context
@param resource the resource
@param principal the id of a group or a user any other entity
@return an access control entry that defines the permissions of the entity for the given resource
@throws CmsException if something goes wrong | [
"Reads",
"an",
"access",
"control",
"entry",
"from",
"the",
"cms",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6321-L6326 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.whereEqualTo | @Nonnull
public Query whereEqualTo(@Nonnull String field, @Nullable Object value) {
return whereEqualTo(FieldPath.fromDotSeparatedString(field), value);
} | java | @Nonnull
public Query whereEqualTo(@Nonnull String field, @Nullable Object value) {
return whereEqualTo(FieldPath.fromDotSeparatedString(field), value);
} | [
"@",
"Nonnull",
"public",
"Query",
"whereEqualTo",
"(",
"@",
"Nonnull",
"String",
"field",
",",
"@",
"Nullable",
"Object",
"value",
")",
"{",
"return",
"whereEqualTo",
"(",
"FieldPath",
".",
"fromDotSeparatedString",
"(",
"field",
")",
",",
"value",
")",
";"... | Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be equal to the specified value.
@param field The name of the field to compare.
@param value The value for comparison.
@return The created Query. | [
"Creates",
"and",
"returns",
"a",
"new",
"Query",
"with",
"the",
"additional",
"filter",
"that",
"documents",
"must",
"contain",
"the",
"specified",
"field",
"and",
"the",
"value",
"should",
"be",
"equal",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L416-L419 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItem.java | CmsListItem.initContent | protected void initContent() {
if (m_decoratedPanel != null) {
m_decoratedPanel.removeFromParent();
}
m_decoratedPanel = new CmsSimpleDecoratedPanel(m_decorationWidth, m_mainWidget, m_decorationWidgets);
m_panel.insert(m_decoratedPanel, 0);
setSmallView(m_smallView);
} | java | protected void initContent() {
if (m_decoratedPanel != null) {
m_decoratedPanel.removeFromParent();
}
m_decoratedPanel = new CmsSimpleDecoratedPanel(m_decorationWidth, m_mainWidget, m_decorationWidgets);
m_panel.insert(m_decoratedPanel, 0);
setSmallView(m_smallView);
} | [
"protected",
"void",
"initContent",
"(",
")",
"{",
"if",
"(",
"m_decoratedPanel",
"!=",
"null",
")",
"{",
"m_decoratedPanel",
".",
"removeFromParent",
"(",
")",
";",
"}",
"m_decoratedPanel",
"=",
"new",
"CmsSimpleDecoratedPanel",
"(",
"m_decorationWidth",
",",
"... | This internal helper method creates the actual contents of the widget by combining the decorators and the main widget.<p> | [
"This",
"internal",
"helper",
"method",
"creates",
"the",
"actual",
"contents",
"of",
"the",
"widget",
"by",
"combining",
"the",
"decorators",
"and",
"the",
"main",
"widget",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItem.java#L636-L644 |
looly/hulu | src/main/java/com/xiaoleilu/hulu/Request.java | Request.getDateParam | public static Date getDateParam(String name, Date defaultValue) {
String param = getParam(name);
return StrUtil.isBlank(param) ? defaultValue : DateUtil.parse(param);
} | java | public static Date getDateParam(String name, Date defaultValue) {
String param = getParam(name);
return StrUtil.isBlank(param) ? defaultValue : DateUtil.parse(param);
} | [
"public",
"static",
"Date",
"getDateParam",
"(",
"String",
"name",
",",
"Date",
"defaultValue",
")",
"{",
"String",
"param",
"=",
"getParam",
"(",
"name",
")",
";",
"return",
"StrUtil",
".",
"isBlank",
"(",
"param",
")",
"?",
"defaultValue",
":",
"DateUtil... | 格式:<br>
1、yyyy-MM-dd HH:mm:ss <br>
2、yyyy-MM-dd <br>
3、HH:mm:ss <br>
@param name 参数名
@param defaultValue 当客户端未传参的默认值
@return 获得Date类型请求参数,默认格式: | [
"格式:<br",
">",
"1、yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss",
"<br",
">",
"2、yyyy",
"-",
"MM",
"-",
"dd",
"<br",
">",
"3、HH",
":",
"mm",
":",
"ss",
"<br",
">"
] | train | https://github.com/looly/hulu/blob/4072de684e2e2f28ac8a3a44c0d5a690b289ef28/src/main/java/com/xiaoleilu/hulu/Request.java#L365-L368 |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.getSqlAddColumn | static String getSqlAddColumn(EntityType entityType, Attribute attr, ColumnMode columnMode) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
String columnSql = getSqlColumn(entityType, attr, columnMode);
sql.append(getTableName(entityType)).append(" ADD ").append(columnSql);
List<String> sqlTableConstraints = getSqlTableConstraints(entityType, attr);
if (!sqlTableConstraints.isEmpty()) {
sqlTableConstraints.forEach(
sqlTableConstraint -> sql.append(",ADD ").append(sqlTableConstraint));
}
return sql.toString();
} | java | static String getSqlAddColumn(EntityType entityType, Attribute attr, ColumnMode columnMode) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
String columnSql = getSqlColumn(entityType, attr, columnMode);
sql.append(getTableName(entityType)).append(" ADD ").append(columnSql);
List<String> sqlTableConstraints = getSqlTableConstraints(entityType, attr);
if (!sqlTableConstraints.isEmpty()) {
sqlTableConstraints.forEach(
sqlTableConstraint -> sql.append(",ADD ").append(sqlTableConstraint));
}
return sql.toString();
} | [
"static",
"String",
"getSqlAddColumn",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"ColumnMode",
"columnMode",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"ALTER TABLE \"",
")",
";",
"String",
"columnSql",
"=",
"getSql... | Returns SQL string to add a column to an existing table.
@param entityType entity meta data
@param attr attribute
@param columnMode column mode
@return SQL string | [
"Returns",
"SQL",
"string",
"to",
"add",
"a",
"column",
"to",
"an",
"existing",
"table",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L212-L224 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/workplace/CmsReInitWorkplace.java | CmsReInitWorkplace.actionReport | public void actionReport() throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
switch (getAction()) {
case ACTION_CONFIRMED:
default:
try {
// re-initialize the workplace
OpenCms.getWorkplaceManager().initialize(getCms());
// fire "clear caches" event to reload all cached resource bundles
OpenCms.fireCmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, new HashMap<String, Object>());
actionCloseDialog();
} catch (Throwable t) {
// create a new Exception with custom message
includeErrorpage(this, t);
}
break;
}
} | java | public void actionReport() throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
switch (getAction()) {
case ACTION_CONFIRMED:
default:
try {
// re-initialize the workplace
OpenCms.getWorkplaceManager().initialize(getCms());
// fire "clear caches" event to reload all cached resource bundles
OpenCms.fireCmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, new HashMap<String, Object>());
actionCloseDialog();
} catch (Throwable t) {
// create a new Exception with custom message
includeErrorpage(this, t);
}
break;
}
} | [
"public",
"void",
"actionReport",
"(",
")",
"throws",
"JspException",
"{",
"// save initialized instance of this class in request attribute for included sub-elements",
"getJsp",
"(",
")",
".",
"getRequest",
"(",
")",
".",
"setAttribute",
"(",
"SESSION_WORKPLACE_CLASS",
",",
... | Performs the re-initialization report, will be called by the JSP page.<p>
@throws JspException if including the error JSP element fails | [
"Performs",
"the",
"re",
"-",
"initialization",
"report",
"will",
"be",
"called",
"by",
"the",
"JSP",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/workplace/CmsReInitWorkplace.java#L80-L99 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.getQueueUrl | public GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) throws JMSException {
try {
prepareRequest(getQueueUrlRequest);
return amazonSQSClient.getQueueUrl(getQueueUrlRequest);
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | java | public GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) throws JMSException {
try {
prepareRequest(getQueueUrlRequest);
return amazonSQSClient.getQueueUrl(getQueueUrlRequest);
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | [
"public",
"GetQueueUrlResult",
"getQueueUrl",
"(",
"GetQueueUrlRequest",
"getQueueUrlRequest",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"prepareRequest",
"(",
"getQueueUrlRequest",
")",
";",
"return",
"amazonSQSClient",
".",
"getQueueUrl",
"(",
"getQueueUrlRequest"... | Calls <code>getQueueUrl</code> and wraps <code>AmazonClientException</code>
@param getQueueUrlRequest
Container for the necessary parameters to execute the
getQueueUrl service method on AmazonSQS.
@return The response from the GetQueueUrl service method, as returned by
AmazonSQS, which will include queue`s URL
@throws JMSException | [
"Calls",
"<code",
">",
"getQueueUrl<",
"/",
"code",
">",
"and",
"wraps",
"<code",
">",
"AmazonClientException<",
"/",
"code",
">"
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L291-L298 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleUDPSrvReg | protected void handleUDPSrvReg(SrvReg srvReg, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
try
{
boolean update = srvReg.isUpdating();
ServiceInfo service = ServiceInfo.from(srvReg);
cacheService(service, update);
udpSrvAck.perform(localAddress, remoteAddress, srvReg, SLPError.NO_ERROR);
}
catch (ServiceLocationException x)
{
udpSrvAck.perform(localAddress, remoteAddress, srvReg, x.getSLPError());
}
} | java | protected void handleUDPSrvReg(SrvReg srvReg, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
try
{
boolean update = srvReg.isUpdating();
ServiceInfo service = ServiceInfo.from(srvReg);
cacheService(service, update);
udpSrvAck.perform(localAddress, remoteAddress, srvReg, SLPError.NO_ERROR);
}
catch (ServiceLocationException x)
{
udpSrvAck.perform(localAddress, remoteAddress, srvReg, x.getSLPError());
}
} | [
"protected",
"void",
"handleUDPSrvReg",
"(",
"SrvReg",
"srvReg",
",",
"InetSocketAddress",
"localAddress",
",",
"InetSocketAddress",
"remoteAddress",
")",
"{",
"try",
"{",
"boolean",
"update",
"=",
"srvReg",
".",
"isUpdating",
"(",
")",
";",
"ServiceInfo",
"servic... | Handles unicast UDP SrvReg message arrived to this directory agent.
<br />
This directory agent will reply with an acknowledge containing the result of the registration.
@param srvReg the SrvReg message to handle
@param localAddress the socket address the message arrived to
@param remoteAddress the socket address the message was sent from | [
"Handles",
"unicast",
"UDP",
"SrvReg",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"an",
"acknowledge",
"containing",
"the",
"result",
"of",
"the",
"registration",
"."
] | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L524-L537 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java | StringSelectionListBinding.setSelectionList | public final void setSelectionList(Object[] keys, Object[] labels)
{
selectionListKeys = keys;
selectionListLabelMessages = createLabels(getId(), labels);
combobox.setModel(new DefaultComboBoxModel(selectionListLabelMessages));
selectItem(getValue());
} | java | public final void setSelectionList(Object[] keys, Object[] labels)
{
selectionListKeys = keys;
selectionListLabelMessages = createLabels(getId(), labels);
combobox.setModel(new DefaultComboBoxModel(selectionListLabelMessages));
selectItem(getValue());
} | [
"public",
"final",
"void",
"setSelectionList",
"(",
"Object",
"[",
"]",
"keys",
",",
"Object",
"[",
"]",
"labels",
")",
"{",
"selectionListKeys",
"=",
"keys",
";",
"selectionListLabelMessages",
"=",
"createLabels",
"(",
"getId",
"(",
")",
",",
"labels",
")",... | Replace the comboBoxModel in order to use the new keys/labels.
@param keys
array of objects to use as keys.
@param labels
array of objects to use as labels in the comboBox. | [
"Replace",
"the",
"comboBoxModel",
"in",
"order",
"to",
"use",
"the",
"new",
"keys",
"/",
"labels",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java#L251-L257 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setBaselineEstimatedStart | public void setBaselineEstimatedStart(int baselineNumber, Date value)
{
set(selectField(TaskFieldLists.BASELINE_ESTIMATED_STARTS, baselineNumber), value);
} | java | public void setBaselineEstimatedStart(int baselineNumber, Date value)
{
set(selectField(TaskFieldLists.BASELINE_ESTIMATED_STARTS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineEstimatedStart",
"(",
"int",
"baselineNumber",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"BASELINE_ESTIMATED_STARTS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4424-L4427 |
scoverage/scoverage-maven-plugin | src/main/java/org/scoverage/plugin/SCoverageForkedLifecycleConfigurator.java | SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit | public static void afterForkedLifecycleExit( MavenProject project, List<MavenProject> reactorProjects )
{
String forkedOutputDirectory = project.getExecutionProject().getBuild().getOutputDirectory();
project.getProperties().put( PROP_FORKED_OUTPUT_DIRECTORY, forkedOutputDirectory );
File forkedArtifactFile = project.getExecutionProject().getArtifact().getFile();
project.getProperties().put( PROP_FORKED_ARTIFACT_FILE,
forkedArtifactFile != null ? forkedArtifactFile.getAbsolutePath() : "" );
// Restore changed outputDirectory and artifact.file in other reactor projects
for ( MavenProject reactorProject : reactorProjects )
{
if ( reactorProject != project )
{
if ( reactorProject.getProperties().containsKey( PROP_ORIG_OUTPUT_DIRECTORY ) )
{
String originalOutputDirectory =
(String) reactorProject.getProperties().remove( PROP_ORIG_OUTPUT_DIRECTORY );
forkedOutputDirectory = reactorProject.getBuild().getOutputDirectory();
reactorProject.getProperties().put( PROP_FORKED_OUTPUT_DIRECTORY, forkedOutputDirectory );
reactorProject.getBuild().setOutputDirectory( originalOutputDirectory );
}
if ( reactorProject.getProperties().containsKey( PROP_ORIG_ARTIFACT_FILE ) )
{
String originalArtifactFilePath =
(String) reactorProject.getProperties().remove/* get */( PROP_ORIG_ARTIFACT_FILE );
forkedArtifactFile = reactorProject.getArtifact().getFile();
reactorProject.getProperties().put( PROP_FORKED_ARTIFACT_FILE,
forkedArtifactFile == null ? ""
: forkedArtifactFile.getAbsolutePath() );
reactorProject.getArtifact().setFile( "".equals( originalArtifactFilePath ) ? null
: new File( originalArtifactFilePath ) );
}
}
}
} | java | public static void afterForkedLifecycleExit( MavenProject project, List<MavenProject> reactorProjects )
{
String forkedOutputDirectory = project.getExecutionProject().getBuild().getOutputDirectory();
project.getProperties().put( PROP_FORKED_OUTPUT_DIRECTORY, forkedOutputDirectory );
File forkedArtifactFile = project.getExecutionProject().getArtifact().getFile();
project.getProperties().put( PROP_FORKED_ARTIFACT_FILE,
forkedArtifactFile != null ? forkedArtifactFile.getAbsolutePath() : "" );
// Restore changed outputDirectory and artifact.file in other reactor projects
for ( MavenProject reactorProject : reactorProjects )
{
if ( reactorProject != project )
{
if ( reactorProject.getProperties().containsKey( PROP_ORIG_OUTPUT_DIRECTORY ) )
{
String originalOutputDirectory =
(String) reactorProject.getProperties().remove( PROP_ORIG_OUTPUT_DIRECTORY );
forkedOutputDirectory = reactorProject.getBuild().getOutputDirectory();
reactorProject.getProperties().put( PROP_FORKED_OUTPUT_DIRECTORY, forkedOutputDirectory );
reactorProject.getBuild().setOutputDirectory( originalOutputDirectory );
}
if ( reactorProject.getProperties().containsKey( PROP_ORIG_ARTIFACT_FILE ) )
{
String originalArtifactFilePath =
(String) reactorProject.getProperties().remove/* get */( PROP_ORIG_ARTIFACT_FILE );
forkedArtifactFile = reactorProject.getArtifact().getFile();
reactorProject.getProperties().put( PROP_FORKED_ARTIFACT_FILE,
forkedArtifactFile == null ? ""
: forkedArtifactFile.getAbsolutePath() );
reactorProject.getArtifact().setFile( "".equals( originalArtifactFilePath ) ? null
: new File( originalArtifactFilePath ) );
}
}
}
} | [
"public",
"static",
"void",
"afterForkedLifecycleExit",
"(",
"MavenProject",
"project",
",",
"List",
"<",
"MavenProject",
">",
"reactorProjects",
")",
"{",
"String",
"forkedOutputDirectory",
"=",
"project",
".",
"getExecutionProject",
"(",
")",
".",
"getBuild",
"(",... | Restores original configuration after leaving forked {@code scoverage} life cycle.
<br>
{@code project} is a project in default life cycle, {@code project.getExecutionProject()}
is a project in just finished forked {@code scoverage} life cycle.
@param project Maven project in default life cycle.
@param reactorProjects all reactor Maven projects. | [
"Restores",
"original",
"configuration",
"after",
"leaving",
"forked",
"{",
"@code",
"scoverage",
"}",
"life",
"cycle",
".",
"<br",
">",
"{",
"@code",
"project",
"}",
"is",
"a",
"project",
"in",
"default",
"life",
"cycle",
"{",
"@code",
"project",
".",
"ge... | train | https://github.com/scoverage/scoverage-maven-plugin/blob/b1c874aba521a65c85bcccfa8bff2213b5639c78/src/main/java/org/scoverage/plugin/SCoverageForkedLifecycleConfigurator.java#L123-L161 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/utils/ParaObjectUtils.java | ParaObjectUtils.setUserDefinedProperties | private static <P> void setUserDefinedProperties(P pojo, Map<String, Object> props) {
if (props != null && pojo instanceof Sysprop) {
for (Map.Entry<String, Object> entry : props.entrySet()) {
String name = entry.getKey();
Object value = entry.getValue();
// handle the case where we have custom user-defined properties
// which are not defined as Java class fields
if (!PropertyUtils.isReadable(pojo, name) || isPropertiesFieldOfDifferentType(name, value)) {
if (value == null) {
((Sysprop) pojo).removeProperty(name);
} else {
((Sysprop) pojo).addProperty(name, value);
}
}
}
}
} | java | private static <P> void setUserDefinedProperties(P pojo, Map<String, Object> props) {
if (props != null && pojo instanceof Sysprop) {
for (Map.Entry<String, Object> entry : props.entrySet()) {
String name = entry.getKey();
Object value = entry.getValue();
// handle the case where we have custom user-defined properties
// which are not defined as Java class fields
if (!PropertyUtils.isReadable(pojo, name) || isPropertiesFieldOfDifferentType(name, value)) {
if (value == null) {
((Sysprop) pojo).removeProperty(name);
} else {
((Sysprop) pojo).addProperty(name, value);
}
}
}
}
} | [
"private",
"static",
"<",
"P",
">",
"void",
"setUserDefinedProperties",
"(",
"P",
"pojo",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"if",
"(",
"props",
"!=",
"null",
"&&",
"pojo",
"instanceof",
"Sysprop",
")",
"{",
"for",
"(",
... | Handles "unknown" or user-defined fields. The Para object is populated with custom fields
which are stored within the "properties" field of {@link Sysprop}. Unknown or user-defined properties are
those which are not declared inside a Java class, but come from an API request.
@param pojo a Para object
@param props properties to apply to the object. | [
"Handles",
"unknown",
"or",
"user",
"-",
"defined",
"fields",
".",
"The",
"Para",
"object",
"is",
"populated",
"with",
"custom",
"fields",
"which",
"are",
"stored",
"within",
"the",
"properties",
"field",
"of",
"{"
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/utils/ParaObjectUtils.java#L425-L441 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/registry/MalisisRegistry.java | MalisisRegistry.onPostSetBlock | public static void onPostSetBlock(ISetBlockCallback callback, CallbackOption<ISetBlockCallbackPredicate> option)
{
postSetBlockRegistry.registerCallback(callback, option);
} | java | public static void onPostSetBlock(ISetBlockCallback callback, CallbackOption<ISetBlockCallbackPredicate> option)
{
postSetBlockRegistry.registerCallback(callback, option);
} | [
"public",
"static",
"void",
"onPostSetBlock",
"(",
"ISetBlockCallback",
"callback",
",",
"CallbackOption",
"<",
"ISetBlockCallbackPredicate",
">",
"option",
")",
"{",
"postSetBlockRegistry",
".",
"registerCallback",
"(",
"callback",
",",
"option",
")",
";",
"}"
] | Registers a {@link ISetBlockCallback} with the specified {@link CallbackOption} to be called before a {@link Block} is placed in the
world.
@param callback the callback
@param option the option | [
"Registers",
"a",
"{",
"@link",
"ISetBlockCallback",
"}",
"with",
"the",
"specified",
"{",
"@link",
"CallbackOption",
"}",
"to",
"be",
"called",
"before",
"a",
"{",
"@link",
"Block",
"}",
"is",
"placed",
"in",
"the",
"world",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/MalisisRegistry.java#L187-L190 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/resources/ConfigurationBuilder.java | ConfigurationBuilder.setMinimumEntropy | public ConfigurationBuilder setMinimumEntropy(BigDecimal seconds_to_crack, String guess_type)
{
BigDecimal guesses_per_second;
if(guessTypes != null)
guesses_per_second = BigDecimal.valueOf(guessTypes.get(guess_type));
else
guesses_per_second = BigDecimal.valueOf(getDefaultGuessTypes(null != crackingHardwareCost ? crackingHardwareCost : getDefaultCrackingHardwareCost()).get(guess_type));
BigDecimal guesses = guesses_per_second.multiply(seconds_to_crack);
minimumEntropy = Nbvcxz.getEntropyFromGuesses(guesses);
return this;
} | java | public ConfigurationBuilder setMinimumEntropy(BigDecimal seconds_to_crack, String guess_type)
{
BigDecimal guesses_per_second;
if(guessTypes != null)
guesses_per_second = BigDecimal.valueOf(guessTypes.get(guess_type));
else
guesses_per_second = BigDecimal.valueOf(getDefaultGuessTypes(null != crackingHardwareCost ? crackingHardwareCost : getDefaultCrackingHardwareCost()).get(guess_type));
BigDecimal guesses = guesses_per_second.multiply(seconds_to_crack);
minimumEntropy = Nbvcxz.getEntropyFromGuesses(guesses);
return this;
} | [
"public",
"ConfigurationBuilder",
"setMinimumEntropy",
"(",
"BigDecimal",
"seconds_to_crack",
",",
"String",
"guess_type",
")",
"{",
"BigDecimal",
"guesses_per_second",
";",
"if",
"(",
"guessTypes",
"!=",
"null",
")",
"guesses_per_second",
"=",
"BigDecimal",
".",
"val... | Sets the minimum entropy based on time to crack, and a specific guess type.
<br>
If you are specifying a cracking hardware cost, you should set that prior to calling this.
@param seconds_to_crack Value in seconds that you want to consider the minimum for a password to be considered good
@param guess_type The guess type to use to figure out what the guesses per second are for this calculation
@return Builder | [
"Sets",
"the",
"minimum",
"entropy",
"based",
"on",
"time",
"to",
"crack",
"and",
"a",
"specific",
"guess",
"type",
".",
"<br",
">",
"If",
"you",
"are",
"specifying",
"a",
"cracking",
"hardware",
"cost",
"you",
"should",
"set",
"that",
"prior",
"to",
"ca... | train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/ConfigurationBuilder.java#L316-L328 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SecurityPolicyClient.java | SecurityPolicyClient.getRuleSecurityPolicy | @BetaApi
public final SecurityPolicyRule getRuleSecurityPolicy(Integer priority, String securityPolicy) {
GetRuleSecurityPolicyHttpRequest request =
GetRuleSecurityPolicyHttpRequest.newBuilder()
.setPriority(priority)
.setSecurityPolicy(securityPolicy)
.build();
return getRuleSecurityPolicy(request);
} | java | @BetaApi
public final SecurityPolicyRule getRuleSecurityPolicy(Integer priority, String securityPolicy) {
GetRuleSecurityPolicyHttpRequest request =
GetRuleSecurityPolicyHttpRequest.newBuilder()
.setPriority(priority)
.setSecurityPolicy(securityPolicy)
.build();
return getRuleSecurityPolicy(request);
} | [
"@",
"BetaApi",
"public",
"final",
"SecurityPolicyRule",
"getRuleSecurityPolicy",
"(",
"Integer",
"priority",
",",
"String",
"securityPolicy",
")",
"{",
"GetRuleSecurityPolicyHttpRequest",
"request",
"=",
"GetRuleSecurityPolicyHttpRequest",
".",
"newBuilder",
"(",
")",
".... | Gets a rule at the specified priority.
<p>Sample code:
<pre><code>
try (SecurityPolicyClient securityPolicyClient = SecurityPolicyClient.create()) {
Integer priority = 0;
ProjectGlobalSecurityPolicyName securityPolicy = ProjectGlobalSecurityPolicyName.of("[PROJECT]", "[SECURITY_POLICY]");
SecurityPolicyRule response = securityPolicyClient.getRuleSecurityPolicy(priority, securityPolicy.toString());
}
</code></pre>
@param priority The priority of the rule to get from the security policy.
@param securityPolicy Name of the security policy to which the queried rule belongs.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Gets",
"a",
"rule",
"at",
"the",
"specified",
"priority",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SecurityPolicyClient.java#L516-L525 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java | SymmetryAxes.addAxis | public void addAxis(Matrix4d axis, int order, SymmetryType type) {
axes.add(new Axis(axis,order,type,axes.size(),0));
} | java | public void addAxis(Matrix4d axis, int order, SymmetryType type) {
axes.add(new Axis(axis,order,type,axes.size(),0));
} | [
"public",
"void",
"addAxis",
"(",
"Matrix4d",
"axis",
",",
"int",
"order",
",",
"SymmetryType",
"type",
")",
"{",
"axes",
".",
"add",
"(",
"new",
"Axis",
"(",
"axis",
",",
"order",
",",
"type",
",",
"axes",
".",
"size",
"(",
")",
",",
"0",
")",
"... | Adds a new axis of symmetry to the bottom level of the tree
@param axis the new axis of symmetry found
@param order number of parts that this axis divides the structure in
@param type indicates whether the axis has OPEN or CLOSED symmetry | [
"Adds",
"a",
"new",
"axis",
"of",
"symmetry",
"to",
"the",
"bottom",
"level",
"of",
"the",
"tree"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java#L205-L207 |
aws/aws-sdk-java | aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/CreateProjectRequest.java | CreateProjectRequest.withTags | public CreateProjectRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateProjectRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateProjectRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags created for the project.
</p>
@param tags
The tags created for the project.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"created",
"for",
"the",
"project",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/CreateProjectRequest.java#L399-L402 |
forge/furnace | proxy/src/main/java/org/jboss/forge/furnace/proxy/ProxyTypeInspector.java | ProxyTypeInspector.superclassHierarchyContains | public static boolean superclassHierarchyContains(Class<?> haystack, Class<?> needle)
{
Class<?> superclass = haystack;
while (superclass != null && superclass != needle)
{
superclass = superclass.getSuperclass();
}
return superclass == needle;
} | java | public static boolean superclassHierarchyContains(Class<?> haystack, Class<?> needle)
{
Class<?> superclass = haystack;
while (superclass != null && superclass != needle)
{
superclass = superclass.getSuperclass();
}
return superclass == needle;
} | [
"public",
"static",
"boolean",
"superclassHierarchyContains",
"(",
"Class",
"<",
"?",
">",
"haystack",
",",
"Class",
"<",
"?",
">",
"needle",
")",
"{",
"Class",
"<",
"?",
">",
"superclass",
"=",
"haystack",
";",
"while",
"(",
"superclass",
"!=",
"null",
... | Search the given {@link Class} hierarchy for the specified {@link Class}. | [
"Search",
"the",
"given",
"{"
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/proxy/src/main/java/org/jboss/forge/furnace/proxy/ProxyTypeInspector.java#L66-L74 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/play/PlayUIServer.java | PlayUIServer.autoAttachStatsStorageBySessionId | public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
}
} | java | public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
}
} | [
"public",
"void",
"autoAttachStatsStorageBySessionId",
"(",
"Function",
"<",
"String",
",",
"StatsStorage",
">",
"statsStorageProvider",
")",
"{",
"if",
"(",
"statsStorageProvider",
"!=",
"null",
")",
"{",
"this",
".",
"statsStorageLoader",
"=",
"new",
"StatsStorage... | Auto-attach StatsStorage if an unknown session ID is passed as URL path parameter in multi-session mode
@param statsStorageProvider function that returns a StatsStorage containing the given session ID | [
"Auto",
"-",
"attach",
"StatsStorage",
"if",
"an",
"unknown",
"session",
"ID",
"is",
"passed",
"as",
"URL",
"path",
"parameter",
"in",
"multi",
"-",
"session",
"mode"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/play/PlayUIServer.java#L135-L139 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.initDefaultValues | protected void initDefaultValues(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException {
Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(root, APPINFO_DEFAULT);
while (i.hasNext()) {
// iterate all "default" elements in the "defaults" node
Element element = i.next();
String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT);
String defaultValue = element.attributeValue(APPINFO_ATTR_VALUE);
String resolveMacrosValue = element.attributeValue(APPINFO_ATTR_RESOLVE_MACROS);
if ((elementName != null) && (defaultValue != null)) {
// add a default value mapping for the element
addDefault(contentDefinition, elementName, defaultValue, resolveMacrosValue);
}
}
} | java | protected void initDefaultValues(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException {
Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(root, APPINFO_DEFAULT);
while (i.hasNext()) {
// iterate all "default" elements in the "defaults" node
Element element = i.next();
String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT);
String defaultValue = element.attributeValue(APPINFO_ATTR_VALUE);
String resolveMacrosValue = element.attributeValue(APPINFO_ATTR_RESOLVE_MACROS);
if ((elementName != null) && (defaultValue != null)) {
// add a default value mapping for the element
addDefault(contentDefinition, elementName, defaultValue, resolveMacrosValue);
}
}
} | [
"protected",
"void",
"initDefaultValues",
"(",
"Element",
"root",
",",
"CmsXmlContentDefinition",
"contentDefinition",
")",
"throws",
"CmsXmlException",
"{",
"Iterator",
"<",
"Element",
">",
"i",
"=",
"CmsXmlGenericWrapper",
".",
"elementIterator",
"(",
"root",
",",
... | Initializes the default values for this content handler.<p>
Using the default values from the appinfo node, it's possible to have more
sophisticated logic for generating the defaults then just using the XML schema "default"
attribute.<p>
@param root the "defaults" element from the appinfo node of the XML content definition
@param contentDefinition the content definition the default values belong to
@throws CmsXmlException if something goes wrong | [
"Initializes",
"the",
"default",
"values",
"for",
"this",
"content",
"handler",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2416-L2430 |
galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.setObjectGroups | public void setObjectGroups(Map<String, List<String>> objectGroups) {
this.objectGroups.clear();
if (objectGroups != null) {
this.objectGroups.putAll(objectGroups);
}
} | java | public void setObjectGroups(Map<String, List<String>> objectGroups) {
this.objectGroups.clear();
if (objectGroups != null) {
this.objectGroups.putAll(objectGroups);
}
} | [
"public",
"void",
"setObjectGroups",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"objectGroups",
")",
"{",
"this",
".",
"objectGroups",
".",
"clear",
"(",
")",
";",
"if",
"(",
"objectGroups",
"!=",
"null",
")",
"{",
"this",
".",
... | Clears the current object groups list and sets new group list
@param objectGroups | [
"Clears",
"the",
"current",
"object",
"groups",
"list",
"and",
"sets",
"new",
"group",
"list"
] | train | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L63-L68 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java | SpatialUtil.intersects | public static boolean intersects(SpatialComparable box1, SpatialComparable box2) {
final int dim = assertSameDimensionality(box1, box2);
for(int i = 0; i < dim; i++) {
if(box2.getMax(i) < box1.getMin(i) || box1.getMax(i) < box2.getMin(i)) {
return false;
}
}
return true;
} | java | public static boolean intersects(SpatialComparable box1, SpatialComparable box2) {
final int dim = assertSameDimensionality(box1, box2);
for(int i = 0; i < dim; i++) {
if(box2.getMax(i) < box1.getMin(i) || box1.getMax(i) < box2.getMin(i)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"intersects",
"(",
"SpatialComparable",
"box1",
",",
"SpatialComparable",
"box2",
")",
"{",
"final",
"int",
"dim",
"=",
"assertSameDimensionality",
"(",
"box1",
",",
"box2",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i... | Returns true if the two SpatialComparables intersect, false otherwise.
@param box1 the first SpatialComparable
@param box2 the first SpatialComparable
@return true if the SpatialComparables intersect, false otherwise | [
"Returns",
"true",
"if",
"the",
"two",
"SpatialComparables",
"intersect",
"false",
"otherwise",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java#L100-L108 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/P12Util.java | P12Util.getFirstPrivateKeyEntryFromP12InputStream | public static PrivateKeyEntry getFirstPrivateKeyEntryFromP12InputStream(final InputStream p12InputStream, final String password) throws KeyStoreException, IOException {
Objects.requireNonNull(password, "Password may be blank, but must not be null.");
final KeyStore keyStore = KeyStore.getInstance("PKCS12");
try {
keyStore.load(p12InputStream, password.toCharArray());
} catch (NoSuchAlgorithmException | CertificateException e) {
throw new KeyStoreException(e);
}
final Enumeration<String> aliases = keyStore.aliases();
final KeyStore.PasswordProtection passwordProtection = new KeyStore.PasswordProtection(password.toCharArray());
while (aliases.hasMoreElements()) {
final String alias = aliases.nextElement();
KeyStore.Entry entry;
try {
try {
entry = keyStore.getEntry(alias, passwordProtection);
} catch (final UnsupportedOperationException e) {
entry = keyStore.getEntry(alias, null);
}
} catch (final UnrecoverableEntryException | NoSuchAlgorithmException e) {
throw new KeyStoreException(e);
}
if (entry instanceof KeyStore.PrivateKeyEntry) {
return (PrivateKeyEntry) entry;
}
}
throw new KeyStoreException("Key store did not contain any private key entries.");
} | java | public static PrivateKeyEntry getFirstPrivateKeyEntryFromP12InputStream(final InputStream p12InputStream, final String password) throws KeyStoreException, IOException {
Objects.requireNonNull(password, "Password may be blank, but must not be null.");
final KeyStore keyStore = KeyStore.getInstance("PKCS12");
try {
keyStore.load(p12InputStream, password.toCharArray());
} catch (NoSuchAlgorithmException | CertificateException e) {
throw new KeyStoreException(e);
}
final Enumeration<String> aliases = keyStore.aliases();
final KeyStore.PasswordProtection passwordProtection = new KeyStore.PasswordProtection(password.toCharArray());
while (aliases.hasMoreElements()) {
final String alias = aliases.nextElement();
KeyStore.Entry entry;
try {
try {
entry = keyStore.getEntry(alias, passwordProtection);
} catch (final UnsupportedOperationException e) {
entry = keyStore.getEntry(alias, null);
}
} catch (final UnrecoverableEntryException | NoSuchAlgorithmException e) {
throw new KeyStoreException(e);
}
if (entry instanceof KeyStore.PrivateKeyEntry) {
return (PrivateKeyEntry) entry;
}
}
throw new KeyStoreException("Key store did not contain any private key entries.");
} | [
"public",
"static",
"PrivateKeyEntry",
"getFirstPrivateKeyEntryFromP12InputStream",
"(",
"final",
"InputStream",
"p12InputStream",
",",
"final",
"String",
"password",
")",
"throws",
"KeyStoreException",
",",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"pass... | Returns the first private key entry found in the given keystore. If more than one private key is present, the
key that is returned is undefined.
@param p12InputStream an input stream for a PKCS#12 keystore
@param password the password to be used to load the keystore and its entries; may be blank, but must not be
{@code null}
@return the first private key entry found in the given keystore
@throws KeyStoreException if a private key entry could not be extracted from the given keystore for any reason
@throws IOException if the given input stream could not be read for any reason | [
"Returns",
"the",
"first",
"private",
"key",
"entry",
"found",
"in",
"the",
"given",
"keystore",
".",
"If",
"more",
"than",
"one",
"private",
"key",
"is",
"present",
"the",
"key",
"that",
"is",
"returned",
"is",
"undefined",
"."
] | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/P12Util.java#L56-L91 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/DateUtils.java | DateUtils.strToDate | public static Date strToDate(String dateStr, String format) throws ParseException {
return new SimpleDateFormat(format).parse(dateStr);
} | java | public static Date strToDate(String dateStr, String format) throws ParseException {
return new SimpleDateFormat(format).parse(dateStr);
} | [
"public",
"static",
"Date",
"strToDate",
"(",
"String",
"dateStr",
",",
"String",
"format",
")",
"throws",
"ParseException",
"{",
"return",
"new",
"SimpleDateFormat",
"(",
"format",
")",
".",
"parse",
"(",
"dateStr",
")",
";",
"}"
] | 字符串转时间
@param dateStr 时间字符串
@param format 格式化格式
@return 时间字符串
@throws ParseException 解析异常 | [
"字符串转时间"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/DateUtils.java#L126-L128 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java | XcodeProjectWriter.createPBXGroup | private static PBXObjectRef createPBXGroup(final String name, final String sourceTree, final List children) {
final Map map = new HashMap();
map.put("isa", "PBXGroup");
map.put("name", name);
map.put("sourceTree", sourceTree);
map.put("children", children);
return new PBXObjectRef(map);
} | java | private static PBXObjectRef createPBXGroup(final String name, final String sourceTree, final List children) {
final Map map = new HashMap();
map.put("isa", "PBXGroup");
map.put("name", name);
map.put("sourceTree", sourceTree);
map.put("children", children);
return new PBXObjectRef(map);
} | [
"private",
"static",
"PBXObjectRef",
"createPBXGroup",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sourceTree",
",",
"final",
"List",
"children",
")",
"{",
"final",
"Map",
"map",
"=",
"new",
"HashMap",
"(",
")",
";",
"map",
".",
"put",
"(",
... | Create PBXGroup.
@param name
group name.
@param sourceTree
source tree.
@param children
list of PBXFileReferences.
@return group. | [
"Create",
"PBXGroup",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L245-L252 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethodByName | public static Method getMethodByName(Class<?> clazz, String methodName) throws SecurityException {
return getMethodByName(clazz, false, methodName);
} | java | public static Method getMethodByName(Class<?> clazz, String methodName) throws SecurityException {
return getMethodByName(clazz, false, methodName);
} | [
"public",
"static",
"Method",
"getMethodByName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
")",
"throws",
"SecurityException",
"{",
"return",
"getMethodByName",
"(",
"clazz",
",",
"false",
",",
"methodName",
")",
";",
"}"
] | 按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code>
<p>
此方法只检查方法名是否一致,并不检查参数的一致性。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@return 方法
@throws SecurityException 无权访问抛出异常
@since 4.3.2 | [
"按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L481-L483 |
m-m-m/util | nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsTemplate.java | AbstractNlsTemplate.createFormatter | protected NlsMessageFormatter createFormatter(String messageTemplate, Locale locale, NlsDependencies nlsDependencies) {
return nlsDependencies.getMessageFormatterFactory().create(messageTemplate);
} | java | protected NlsMessageFormatter createFormatter(String messageTemplate, Locale locale, NlsDependencies nlsDependencies) {
return nlsDependencies.getMessageFormatterFactory().create(messageTemplate);
} | [
"protected",
"NlsMessageFormatter",
"createFormatter",
"(",
"String",
"messageTemplate",
",",
"Locale",
"locale",
",",
"NlsDependencies",
"nlsDependencies",
")",
"{",
"return",
"nlsDependencies",
".",
"getMessageFormatterFactory",
"(",
")",
".",
"create",
"(",
"messageT... | This method creates an {@link NlsMessageFormatter} for the given {@code messageTemplate} and {@code locale}.
@param messageTemplate is the template of the message for the given {@code locale}.
@param locale is the locale to use. The implementation may ignore it here because it is also supplied to
{@link net.sf.mmm.util.nls.api.NlsFormatter#format(Object, Locale, Map, NlsTemplateResolver) format}. Anyhow
it allows the implementation to do smart caching of the parsed formatter in association with the locale.
@param nlsDependencies are the {@link NlsDependencies}.
@return the formatter instance. | [
"This",
"method",
"creates",
"an",
"{",
"@link",
"NlsMessageFormatter",
"}",
"for",
"the",
"given",
"{",
"@code",
"messageTemplate",
"}",
"and",
"{",
"@code",
"locale",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsTemplate.java#L41-L44 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.fidelityAccount_movements_movementId_GET | public OvhFidelityMovement fidelityAccount_movements_movementId_GET(Long movementId) throws IOException {
String qPath = "/me/fidelityAccount/movements/{movementId}";
StringBuilder sb = path(qPath, movementId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFidelityMovement.class);
} | java | public OvhFidelityMovement fidelityAccount_movements_movementId_GET(Long movementId) throws IOException {
String qPath = "/me/fidelityAccount/movements/{movementId}";
StringBuilder sb = path(qPath, movementId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFidelityMovement.class);
} | [
"public",
"OvhFidelityMovement",
"fidelityAccount_movements_movementId_GET",
"(",
"Long",
"movementId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/fidelityAccount/movements/{movementId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
... | Get this object properties
REST: GET /me/fidelityAccount/movements/{movementId}
@param movementId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1705-L1710 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java | AtomicAllocator.allocateMemory | @Override
public AllocationPoint allocateMemory(DataBuffer buffer, AllocationShape requiredMemory, boolean initialize) {
// by default we allocate on initial location
AllocationPoint point = null;
if (configuration.getMemoryModel() == Configuration.MemoryModel.IMMEDIATE) {
point = allocateMemory(buffer, requiredMemory, memoryHandler.getInitialLocation(), initialize);
} else if (configuration.getMemoryModel() == Configuration.MemoryModel.DELAYED) {
// for DELAYED memory model we allocate only host memory, regardless of firstMemory configuration value
point = allocateMemory(buffer, requiredMemory, AllocationStatus.HOST, initialize);
}
return point;
} | java | @Override
public AllocationPoint allocateMemory(DataBuffer buffer, AllocationShape requiredMemory, boolean initialize) {
// by default we allocate on initial location
AllocationPoint point = null;
if (configuration.getMemoryModel() == Configuration.MemoryModel.IMMEDIATE) {
point = allocateMemory(buffer, requiredMemory, memoryHandler.getInitialLocation(), initialize);
} else if (configuration.getMemoryModel() == Configuration.MemoryModel.DELAYED) {
// for DELAYED memory model we allocate only host memory, regardless of firstMemory configuration value
point = allocateMemory(buffer, requiredMemory, AllocationStatus.HOST, initialize);
}
return point;
} | [
"@",
"Override",
"public",
"AllocationPoint",
"allocateMemory",
"(",
"DataBuffer",
"buffer",
",",
"AllocationShape",
"requiredMemory",
",",
"boolean",
"initialize",
")",
"{",
"// by default we allocate on initial location",
"AllocationPoint",
"point",
"=",
"null",
";",
"i... | This method allocates required chunk of memory
@param requiredMemory | [
"This",
"method",
"allocates",
"required",
"chunk",
"of",
"memory"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java#L422-L435 |
bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java | Traversr.remove | public Optional<DataType> remove( Object tree, List<String> keys ) {
if ( keys.size() != traversalLength ) {
throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() );
}
if ( tree == null ) {
return Optional.empty();
}
return root.traverse( tree, TraversalStep.Operation.REMOVE, keys.iterator(), null );
} | java | public Optional<DataType> remove( Object tree, List<String> keys ) {
if ( keys.size() != traversalLength ) {
throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() );
}
if ( tree == null ) {
return Optional.empty();
}
return root.traverse( tree, TraversalStep.Operation.REMOVE, keys.iterator(), null );
} | [
"public",
"Optional",
"<",
"DataType",
">",
"remove",
"(",
"Object",
"tree",
",",
"List",
"<",
"String",
">",
"keys",
")",
"{",
"if",
"(",
"keys",
".",
"size",
"(",
")",
"!=",
"traversalLength",
")",
"{",
"throw",
"new",
"TraversrException",
"(",
"\"Tr... | Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed
for the traversal. This is determined by the behavior of the implementations of the
abstract methods of this class. | [
"Note",
":",
"Calling",
"this",
"method",
"MAY",
"modify",
"the",
"tree",
"object",
"by",
"adding",
"new",
"Maps",
"and",
"Lists",
"as",
"needed",
"for",
"the",
"traversal",
".",
"This",
"is",
"determined",
"by",
"the",
"behavior",
"of",
"the",
"implementa... | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java#L156-L167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.