repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPTimephasedBaselineWorkNormaliser.java | MPPTimephasedBaselineWorkNormaliser.mergeSameDay | @Override protected void mergeSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) {
"""
This method merges together assignment data for the same day.
@param calendar current calendar
@param list assignment data
"""
LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();
TimephasedWork previousAssignment = null;
for (TimephasedWork assignment : list)
{
if (previousAssignment == null)
{
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
else
{
Date previousAssignmentStart = previousAssignment.getStart();
Date previousAssignmentStartDay = DateHelper.getDayStartDate(previousAssignmentStart);
Date assignmentStart = assignment.getStart();
Date assignmentStartDay = DateHelper.getDayStartDate(assignmentStart);
if (previousAssignmentStartDay.getTime() == assignmentStartDay.getTime())
{
result.removeLast();
double work = previousAssignment.getTotalAmount().getDuration();
work += assignment.getTotalAmount().getDuration();
Duration totalWork = Duration.getInstance(work, TimeUnit.MINUTES);
TimephasedWork merged = new TimephasedWork();
merged.setStart(previousAssignment.getStart());
merged.setFinish(assignment.getFinish());
merged.setTotalAmount(totalWork);
assignment = merged;
}
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
previousAssignment = assignment;
}
list.clear();
list.addAll(result);
} | java | @Override protected void mergeSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list)
{
LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();
TimephasedWork previousAssignment = null;
for (TimephasedWork assignment : list)
{
if (previousAssignment == null)
{
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
else
{
Date previousAssignmentStart = previousAssignment.getStart();
Date previousAssignmentStartDay = DateHelper.getDayStartDate(previousAssignmentStart);
Date assignmentStart = assignment.getStart();
Date assignmentStartDay = DateHelper.getDayStartDate(assignmentStart);
if (previousAssignmentStartDay.getTime() == assignmentStartDay.getTime())
{
result.removeLast();
double work = previousAssignment.getTotalAmount().getDuration();
work += assignment.getTotalAmount().getDuration();
Duration totalWork = Duration.getInstance(work, TimeUnit.MINUTES);
TimephasedWork merged = new TimephasedWork();
merged.setStart(previousAssignment.getStart());
merged.setFinish(assignment.getFinish());
merged.setTotalAmount(totalWork);
assignment = merged;
}
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
previousAssignment = assignment;
}
list.clear();
list.addAll(result);
} | [
"@",
"Override",
"protected",
"void",
"mergeSameDay",
"(",
"ProjectCalendar",
"calendar",
",",
"LinkedList",
"<",
"TimephasedWork",
">",
"list",
")",
"{",
"LinkedList",
"<",
"TimephasedWork",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"TimephasedWork",
"previousAssignment",
"=",
"null",
";",
"for",
"(",
"TimephasedWork",
"assignment",
":",
"list",
")",
"{",
"if",
"(",
"previousAssignment",
"==",
"null",
")",
"{",
"assignment",
".",
"setAmountPerDay",
"(",
"assignment",
".",
"getTotalAmount",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"assignment",
")",
";",
"}",
"else",
"{",
"Date",
"previousAssignmentStart",
"=",
"previousAssignment",
".",
"getStart",
"(",
")",
";",
"Date",
"previousAssignmentStartDay",
"=",
"DateHelper",
".",
"getDayStartDate",
"(",
"previousAssignmentStart",
")",
";",
"Date",
"assignmentStart",
"=",
"assignment",
".",
"getStart",
"(",
")",
";",
"Date",
"assignmentStartDay",
"=",
"DateHelper",
".",
"getDayStartDate",
"(",
"assignmentStart",
")",
";",
"if",
"(",
"previousAssignmentStartDay",
".",
"getTime",
"(",
")",
"==",
"assignmentStartDay",
".",
"getTime",
"(",
")",
")",
"{",
"result",
".",
"removeLast",
"(",
")",
";",
"double",
"work",
"=",
"previousAssignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
";",
"work",
"+=",
"assignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
";",
"Duration",
"totalWork",
"=",
"Duration",
".",
"getInstance",
"(",
"work",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"TimephasedWork",
"merged",
"=",
"new",
"TimephasedWork",
"(",
")",
";",
"merged",
".",
"setStart",
"(",
"previousAssignment",
".",
"getStart",
"(",
")",
")",
";",
"merged",
".",
"setFinish",
"(",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"merged",
".",
"setTotalAmount",
"(",
"totalWork",
")",
";",
"assignment",
"=",
"merged",
";",
"}",
"assignment",
".",
"setAmountPerDay",
"(",
"assignment",
".",
"getTotalAmount",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"assignment",
")",
";",
"}",
"previousAssignment",
"=",
"assignment",
";",
"}",
"list",
".",
"clear",
"(",
")",
";",
"list",
".",
"addAll",
"(",
"result",
")",
";",
"}"
] | This method merges together assignment data for the same day.
@param calendar current calendar
@param list assignment data | [
"This",
"method",
"merges",
"together",
"assignment",
"data",
"for",
"the",
"same",
"day",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPTimephasedBaselineWorkNormaliser.java#L46-L89 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java | JavacState.taintPackagesDependingOnChangedPackages | public void taintPackagesDependingOnChangedPackages(Set<String> pkgsWithChangedPubApi, Set<String> recentlyCompiled) {
"""
Propagate recompilation through the dependency chains.
Avoid re-tainting packages that have already been compiled.
"""
// For each to-be-recompiled-candidates...
for (Package pkg : new HashSet<>(prev.packages().values())) {
// Find out what it depends upon...
Set<String> deps = pkg.typeDependencies()
.values()
.stream()
.flatMap(Collection::stream)
.collect(Collectors.toSet());
for (String dep : deps) {
String depPkg = ":" + dep.substring(0, dep.lastIndexOf('.'));
if (depPkg.equals(pkg.name()))
continue;
// Checking if that dependency has changed
if (pkgsWithChangedPubApi.contains(depPkg) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), "its depending on " + depPkg);
}
}
}
} | java | public void taintPackagesDependingOnChangedPackages(Set<String> pkgsWithChangedPubApi, Set<String> recentlyCompiled) {
// For each to-be-recompiled-candidates...
for (Package pkg : new HashSet<>(prev.packages().values())) {
// Find out what it depends upon...
Set<String> deps = pkg.typeDependencies()
.values()
.stream()
.flatMap(Collection::stream)
.collect(Collectors.toSet());
for (String dep : deps) {
String depPkg = ":" + dep.substring(0, dep.lastIndexOf('.'));
if (depPkg.equals(pkg.name()))
continue;
// Checking if that dependency has changed
if (pkgsWithChangedPubApi.contains(depPkg) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), "its depending on " + depPkg);
}
}
}
} | [
"public",
"void",
"taintPackagesDependingOnChangedPackages",
"(",
"Set",
"<",
"String",
">",
"pkgsWithChangedPubApi",
",",
"Set",
"<",
"String",
">",
"recentlyCompiled",
")",
"{",
"// For each to-be-recompiled-candidates...",
"for",
"(",
"Package",
"pkg",
":",
"new",
"HashSet",
"<>",
"(",
"prev",
".",
"packages",
"(",
")",
".",
"values",
"(",
")",
")",
")",
"{",
"// Find out what it depends upon...",
"Set",
"<",
"String",
">",
"deps",
"=",
"pkg",
".",
"typeDependencies",
"(",
")",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"Collection",
"::",
"stream",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"for",
"(",
"String",
"dep",
":",
"deps",
")",
"{",
"String",
"depPkg",
"=",
"\":\"",
"+",
"dep",
".",
"substring",
"(",
"0",
",",
"dep",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"if",
"(",
"depPkg",
".",
"equals",
"(",
"pkg",
".",
"name",
"(",
")",
")",
")",
"continue",
";",
"// Checking if that dependency has changed",
"if",
"(",
"pkgsWithChangedPubApi",
".",
"contains",
"(",
"depPkg",
")",
"&&",
"!",
"recentlyCompiled",
".",
"contains",
"(",
"pkg",
".",
"name",
"(",
")",
")",
")",
"{",
"taintPackage",
"(",
"pkg",
".",
"name",
"(",
")",
",",
"\"its depending on \"",
"+",
"depPkg",
")",
";",
"}",
"}",
"}",
"}"
] | Propagate recompilation through the dependency chains.
Avoid re-tainting packages that have already been compiled. | [
"Propagate",
"recompilation",
"through",
"the",
"dependency",
"chains",
".",
"Avoid",
"re",
"-",
"tainting",
"packages",
"that",
"have",
"already",
"been",
"compiled",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L483-L502 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.virtualNumbers_number_serviceInfos_PUT | public void virtualNumbers_number_serviceInfos_PUT(String number, OvhService body) throws IOException {
"""
Alter this object properties
REST: PUT /sms/virtualNumbers/{number}/serviceInfos
@param body [required] New object properties
@param number [required] Your virtual number
"""
String qPath = "/sms/virtualNumbers/{number}/serviceInfos";
StringBuilder sb = path(qPath, number);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void virtualNumbers_number_serviceInfos_PUT(String number, OvhService body) throws IOException {
String qPath = "/sms/virtualNumbers/{number}/serviceInfos";
StringBuilder sb = path(qPath, number);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"virtualNumbers_number_serviceInfos_PUT",
"(",
"String",
"number",
",",
"OvhService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/virtualNumbers/{number}/serviceInfos\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"number",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /sms/virtualNumbers/{number}/serviceInfos
@param body [required] New object properties
@param number [required] Your virtual number | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1761-L1765 |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.replace | public static String replace(String string, String oldString, String newString) {
"""
替换字符串之前检查字符串是否为空
@param string 需要检测的字符串
@param oldString 需要替换的字符串
@param newString 新的字符串
@return {@link String}
"""
return checkNull(string).replace(oldString, newString);
} | java | public static String replace(String string, String oldString, String newString) {
return checkNull(string).replace(oldString, newString);
} | [
"public",
"static",
"String",
"replace",
"(",
"String",
"string",
",",
"String",
"oldString",
",",
"String",
"newString",
")",
"{",
"return",
"checkNull",
"(",
"string",
")",
".",
"replace",
"(",
"oldString",
",",
"newString",
")",
";",
"}"
] | 替换字符串之前检查字符串是否为空
@param string 需要检测的字符串
@param oldString 需要替换的字符串
@param newString 新的字符串
@return {@link String} | [
"替换字符串之前检查字符串是否为空"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L834-L836 |
lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonEquals | public static void assertJsonEquals(Object expected, Object actual, Configuration configuration) {
"""
Compares to JSON documents. Throws {@link AssertionError} if they are different.
"""
assertJsonPartEquals(expected, actual, ROOT, configuration);
} | java | public static void assertJsonEquals(Object expected, Object actual, Configuration configuration) {
assertJsonPartEquals(expected, actual, ROOT, configuration);
} | [
"public",
"static",
"void",
"assertJsonEquals",
"(",
"Object",
"expected",
",",
"Object",
"actual",
",",
"Configuration",
"configuration",
")",
"{",
"assertJsonPartEquals",
"(",
"expected",
",",
"actual",
",",
"ROOT",
",",
"configuration",
")",
";",
"}"
] | Compares to JSON documents. Throws {@link AssertionError} if they are different. | [
"Compares",
"to",
"JSON",
"documents",
".",
"Throws",
"{"
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L66-L68 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java | Collator.registerInstance | public static final Object registerInstance(Collator collator, ULocale locale) {
"""
<strong>[icu]</strong> Registers a collator as the default collator for the provided locale. The
collator should not be modified after it is registered.
<p>Because ICU may choose to cache Collator objects internally, this must
be called at application startup, prior to any calls to
Collator.getInstance to avoid undefined behavior.
@param collator the collator to register
@param locale the locale for which this is the default collator
@return an object that can be used to unregister the registered collator.
@hide unsupported on Android
"""
return getShim().registerInstance(collator, locale);
} | java | public static final Object registerInstance(Collator collator, ULocale locale) {
return getShim().registerInstance(collator, locale);
} | [
"public",
"static",
"final",
"Object",
"registerInstance",
"(",
"Collator",
"collator",
",",
"ULocale",
"locale",
")",
"{",
"return",
"getShim",
"(",
")",
".",
"registerInstance",
"(",
"collator",
",",
"locale",
")",
";",
"}"
] | <strong>[icu]</strong> Registers a collator as the default collator for the provided locale. The
collator should not be modified after it is registered.
<p>Because ICU may choose to cache Collator objects internally, this must
be called at application startup, prior to any calls to
Collator.getInstance to avoid undefined behavior.
@param collator the collator to register
@param locale the locale for which this is the default collator
@return an object that can be used to unregister the registered collator.
@hide unsupported on Android | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Registers",
"a",
"collator",
"as",
"the",
"default",
"collator",
"for",
"the",
"provided",
"locale",
".",
"The",
"collator",
"should",
"not",
"be",
"modified",
"after",
"it",
"is",
"registered",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L843-L845 |
raydac/netbeans-mmd-plugin | mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java | Utils.findFirstElement | @Nullable
public static Element findFirstElement(@Nonnull final Element node, @Nonnull final String elementName) {
"""
Get first direct child for name.
@param node element to find children
@param elementName name of child element
@return found first child or null if not found
@since 1.4.0
"""
Element result = null;
for (final Element l : Utils.findDirectChildrenForName(node, elementName)) {
result = l;
break;
}
return result;
} | java | @Nullable
public static Element findFirstElement(@Nonnull final Element node, @Nonnull final String elementName) {
Element result = null;
for (final Element l : Utils.findDirectChildrenForName(node, elementName)) {
result = l;
break;
}
return result;
} | [
"@",
"Nullable",
"public",
"static",
"Element",
"findFirstElement",
"(",
"@",
"Nonnull",
"final",
"Element",
"node",
",",
"@",
"Nonnull",
"final",
"String",
"elementName",
")",
"{",
"Element",
"result",
"=",
"null",
";",
"for",
"(",
"final",
"Element",
"l",
":",
"Utils",
".",
"findDirectChildrenForName",
"(",
"node",
",",
"elementName",
")",
")",
"{",
"result",
"=",
"l",
";",
"break",
";",
"}",
"return",
"result",
";",
"}"
] | Get first direct child for name.
@param node element to find children
@param elementName name of child element
@return found first child or null if not found
@since 1.4.0 | [
"Get",
"first",
"direct",
"child",
"for",
"name",
"."
] | train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java#L209-L217 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.moveToLostAndFound | public String moveToLostAndFound(CmsRequestContext context, CmsResource resource, boolean returnNameOnly)
throws CmsException {
"""
Moves a resource to the "lost and found" folder.<p>
The method can also be used to check get the name of a resource
in the "lost and found" folder only without actually moving the
the resource. To do this, the <code>returnNameOnly</code> flag
must be set to <code>true</code>.<p>
In general, it is the same name as the given resource has, the only exception is
if a resource in the "lost and found" folder with the same name already exists.
In such case, a counter is added to the resource name.<p>
@param context the current request context
@param resource the resource to apply this operation to
@param returnNameOnly if <code>true</code>, only the name of the resource in the "lost and found"
folder is returned, the move operation is not really performed
@return the name of the resource inside the "lost and found" folder
@throws CmsException if something goes wrong
@see CmsObject#moveToLostAndFound(String)
@see CmsObject#getLostAndFoundName(String)
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
String result = null;
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL);
if (!returnNameOnly) {
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
}
result = m_driverManager.moveToLostAndFound(dbc, resource, returnNameOnly);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_MOVE_TO_LOST_AND_FOUND_1,
dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
return result;
} | java | public String moveToLostAndFound(CmsRequestContext context, CmsResource resource, boolean returnNameOnly)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
String result = null;
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL);
if (!returnNameOnly) {
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
}
result = m_driverManager.moveToLostAndFound(dbc, resource, returnNameOnly);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_MOVE_TO_LOST_AND_FOUND_1,
dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"String",
"moveToLostAndFound",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"boolean",
"returnNameOnly",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"checkOfflineProject",
"(",
"dbc",
")",
";",
"checkPermissions",
"(",
"dbc",
",",
"resource",
",",
"CmsPermissionSet",
".",
"ACCESS_READ",
",",
"true",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"if",
"(",
"!",
"returnNameOnly",
")",
"{",
"checkPermissions",
"(",
"dbc",
",",
"resource",
",",
"CmsPermissionSet",
".",
"ACCESS_WRITE",
",",
"true",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"}",
"result",
"=",
"m_driverManager",
".",
"moveToLostAndFound",
"(",
"dbc",
",",
"resource",
",",
"returnNameOnly",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_MOVE_TO_LOST_AND_FOUND_1",
",",
"dbc",
".",
"removeSiteRoot",
"(",
"resource",
".",
"getRootPath",
"(",
")",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Moves a resource to the "lost and found" folder.<p>
The method can also be used to check get the name of a resource
in the "lost and found" folder only without actually moving the
the resource. To do this, the <code>returnNameOnly</code> flag
must be set to <code>true</code>.<p>
In general, it is the same name as the given resource has, the only exception is
if a resource in the "lost and found" folder with the same name already exists.
In such case, a counter is added to the resource name.<p>
@param context the current request context
@param resource the resource to apply this operation to
@param returnNameOnly if <code>true</code>, only the name of the resource in the "lost and found"
folder is returned, the move operation is not really performed
@return the name of the resource inside the "lost and found" folder
@throws CmsException if something goes wrong
@see CmsObject#moveToLostAndFound(String)
@see CmsObject#getLostAndFoundName(String) | [
"Moves",
"a",
"resource",
"to",
"the",
"lost",
"and",
"found",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3816-L3839 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setBaselineEstimatedFinish | public void setBaselineEstimatedFinish(int baselineNumber, Date value) {
"""
Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value
"""
set(selectField(TaskFieldLists.BASELINE_ESTIMATED_FINISHES, baselineNumber), value);
} | java | public void setBaselineEstimatedFinish(int baselineNumber, Date value)
{
set(selectField(TaskFieldLists.BASELINE_ESTIMATED_FINISHES, baselineNumber), value);
} | [
"public",
"void",
"setBaselineEstimatedFinish",
"(",
"int",
"baselineNumber",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"BASELINE_ESTIMATED_FINISHES",
",",
"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#L4471-L4474 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java | CertificatesInner.updateAsync | public Observable<CertificateInner> updateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateUpdateParameters parameters) {
"""
Update a certificate.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param certificateName The parameters supplied to the update certificate operation.
@param parameters The parameters supplied to the update certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() {
@Override
public CertificateInner call(ServiceResponse<CertificateInner> response) {
return response.body();
}
});
} | java | public Observable<CertificateInner> updateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() {
@Override
public CertificateInner call(ServiceResponse<CertificateInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"certificateName",
",",
"CertificateUpdateParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"certificateName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"CertificateInner",
">",
",",
"CertificateInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"CertificateInner",
"call",
"(",
"ServiceResponse",
"<",
"CertificateInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Update a certificate.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param certificateName The parameters supplied to the update certificate operation.
@param parameters The parameters supplied to the update certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateInner object | [
"Update",
"a",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java#L415-L422 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkConstant | private SemanticType checkConstant(Expr.Constant expr, Environment env) {
"""
Check the type of a given constant expression. This is straightforward since
the determine is fully determined by the kind of constant we have.
@param expr
@return
"""
Value item = expr.getValue();
switch (item.getOpcode()) {
case ITEM_null:
return Type.Null;
case ITEM_bool:
return Type.Bool;
case ITEM_int:
return Type.Int;
case ITEM_byte:
return Type.Byte;
case ITEM_utf8:
// FIXME: this is not an optimal solution. The reason being that we
// have lost nominal information regarding whether it is an instance
// of std::ascii or std::utf8, for example.
return new SemanticType.Array(Type.Int);
default:
return internalFailure("unknown constant encountered: " + expr, expr);
}
} | java | private SemanticType checkConstant(Expr.Constant expr, Environment env) {
Value item = expr.getValue();
switch (item.getOpcode()) {
case ITEM_null:
return Type.Null;
case ITEM_bool:
return Type.Bool;
case ITEM_int:
return Type.Int;
case ITEM_byte:
return Type.Byte;
case ITEM_utf8:
// FIXME: this is not an optimal solution. The reason being that we
// have lost nominal information regarding whether it is an instance
// of std::ascii or std::utf8, for example.
return new SemanticType.Array(Type.Int);
default:
return internalFailure("unknown constant encountered: " + expr, expr);
}
} | [
"private",
"SemanticType",
"checkConstant",
"(",
"Expr",
".",
"Constant",
"expr",
",",
"Environment",
"env",
")",
"{",
"Value",
"item",
"=",
"expr",
".",
"getValue",
"(",
")",
";",
"switch",
"(",
"item",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"ITEM_null",
":",
"return",
"Type",
".",
"Null",
";",
"case",
"ITEM_bool",
":",
"return",
"Type",
".",
"Bool",
";",
"case",
"ITEM_int",
":",
"return",
"Type",
".",
"Int",
";",
"case",
"ITEM_byte",
":",
"return",
"Type",
".",
"Byte",
";",
"case",
"ITEM_utf8",
":",
"// FIXME: this is not an optimal solution. The reason being that we",
"// have lost nominal information regarding whether it is an instance",
"// of std::ascii or std::utf8, for example.",
"return",
"new",
"SemanticType",
".",
"Array",
"(",
"Type",
".",
"Int",
")",
";",
"default",
":",
"return",
"internalFailure",
"(",
"\"unknown constant encountered: \"",
"+",
"expr",
",",
"expr",
")",
";",
"}",
"}"
] | Check the type of a given constant expression. This is straightforward since
the determine is fully determined by the kind of constant we have.
@param expr
@return | [
"Check",
"the",
"type",
"of",
"a",
"given",
"constant",
"expression",
".",
"This",
"is",
"straightforward",
"since",
"the",
"determine",
"is",
"fully",
"determined",
"by",
"the",
"kind",
"of",
"constant",
"we",
"have",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1451-L1470 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/emoji/EmojiUtil.java | EmojiUtil.toAlias | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
"""
将字符串中的Unicode Emoji字符转换为别名表现形式(两个":"包围的格式),别名后会增加"|"并追加fitzpatrick类型
<p>
例如:<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
@param str 包含Emoji Unicode字符的字符串
@return 替换后的字符串
"""
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | java | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | [
"public",
"static",
"String",
"toAlias",
"(",
"String",
"str",
",",
"FitzpatrickAction",
"fitzpatrickAction",
")",
"{",
"return",
"EmojiParser",
".",
"parseToAliases",
"(",
"str",
",",
"fitzpatrickAction",
")",
";",
"}"
] | 将字符串中的Unicode Emoji字符转换为别名表现形式(两个":"包围的格式),别名后会增加"|"并追加fitzpatrick类型
<p>
例如:<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
@param str 包含Emoji Unicode字符的字符串
@return 替换后的字符串 | [
"将字符串中的Unicode",
"Emoji字符转换为别名表现形式(两个",
":",
"包围的格式),别名后会增加",
"|",
"并追加fitzpatrick类型",
"<p",
">",
"例如:<code",
">",
"👦🏿<",
"/",
"code",
">",
"转换为",
"<code",
">",
":",
"boy|type_6",
":",
"<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/emoji/EmojiUtil.java#L104-L106 |
google/closure-templates | java/src/com/google/template/soy/shared/internal/SharedRuntime.java | SharedRuntime.compareString | public static boolean compareString(String string, SoyValue other) {
"""
Determines if the operand's string form can be equality-compared with a string.
"""
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString());
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | java | public static boolean compareString(String string, SoyValue other) {
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString());
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | [
"public",
"static",
"boolean",
"compareString",
"(",
"String",
"string",
",",
"SoyValue",
"other",
")",
"{",
"// This follows similarly to the Javascript specification, to ensure similar operation",
"// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3",
"if",
"(",
"other",
"instanceof",
"StringData",
"||",
"other",
"instanceof",
"SanitizedContent",
")",
"{",
"return",
"string",
".",
"equals",
"(",
"other",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"other",
"instanceof",
"NumberData",
")",
"{",
"try",
"{",
"// Parse the string as a number.",
"return",
"Double",
".",
"parseDouble",
"(",
"string",
")",
"==",
"other",
".",
"numberValue",
"(",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"// Didn't parse as a number.",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines if the operand's string form can be equality-compared with a string. | [
"Determines",
"if",
"the",
"operand",
"s",
"string",
"form",
"can",
"be",
"equality",
"-",
"compared",
"with",
"a",
"string",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/SharedRuntime.java#L122-L138 |
Netflix/zeno | src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java | DiffHtmlGenerator.generateDiff | public String generateDiff(GenericObject from, GenericObject to) {
"""
Generate the HTML difference between two GenericObjects.
@return
"""
StringBuilder builder = new StringBuilder();
builder.append("<table class=\"nomargin diff\">");
builder.append("<thead>");
builder.append("<tr>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">From</th>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">To</th>");
builder.append("</tr>");
builder.append("</thead>");
builder.append("<tbody>");
writeDiff(builder, from, to);
builder.append("</tbody>");
builder.append("</table>");
return builder.toString();
} | java | public String generateDiff(GenericObject from, GenericObject to) {
StringBuilder builder = new StringBuilder();
builder.append("<table class=\"nomargin diff\">");
builder.append("<thead>");
builder.append("<tr>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">From</th>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">To</th>");
builder.append("</tr>");
builder.append("</thead>");
builder.append("<tbody>");
writeDiff(builder, from, to);
builder.append("</tbody>");
builder.append("</table>");
return builder.toString();
} | [
"public",
"String",
"generateDiff",
"(",
"GenericObject",
"from",
",",
"GenericObject",
"to",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<table class=\\\"nomargin diff\\\">\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<thead>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<tr>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<th/>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<th class=\\\"texttitle\\\">From</th>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<th/>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<th class=\\\"texttitle\\\">To</th>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"</tr>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"</thead>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<tbody>\"",
")",
";",
"writeDiff",
"(",
"builder",
",",
"from",
",",
"to",
")",
";",
"builder",
".",
"append",
"(",
"\"</tbody>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"</table>\"",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Generate the HTML difference between two GenericObjects.
@return | [
"Generate",
"the",
"HTML",
"difference",
"between",
"two",
"GenericObjects",
"."
] | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java#L77-L98 |
SeleniumJT/seleniumjt-core | src/main/java/com/jt/selenium/SeleniumJT.java | SeleniumJT.fireEvent | @LogExecTime
public void fireEvent(String locator, String eventName) {
"""
This requires a jquery locator or an ID. The leading hash (#) should not be provided to this method if it is just an ID
"""
jtCore.fireEvent(locator, eventName);
} | java | @LogExecTime
public void fireEvent(String locator, String eventName)
{
jtCore.fireEvent(locator, eventName);
} | [
"@",
"LogExecTime",
"public",
"void",
"fireEvent",
"(",
"String",
"locator",
",",
"String",
"eventName",
")",
"{",
"jtCore",
".",
"fireEvent",
"(",
"locator",
",",
"eventName",
")",
";",
"}"
] | This requires a jquery locator or an ID. The leading hash (#) should not be provided to this method if it is just an ID | [
"This",
"requires",
"a",
"jquery",
"locator",
"or",
"an",
"ID",
".",
"The",
"leading",
"hash",
"(",
"#",
")",
"should",
"not",
"be",
"provided",
"to",
"this",
"method",
"if",
"it",
"is",
"just",
"an",
"ID"
] | train | https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/SeleniumJT.java#L741-L745 |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.sendPermanentCookie | public void sendPermanentCookie(String name, String value) {
"""
Sends long to live cookie to browse with response. This cookie will be asked to live for 20 years.
@param name name of cookie
@param value value of cookie.
"""
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(60*60*24*365*20);
RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie));
} | java | public void sendPermanentCookie(String name, String value) {
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(60*60*24*365*20);
RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie));
} | [
"public",
"void",
"sendPermanentCookie",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"60",
"*",
"60",
"*",
"24",
"*",
"365",
"*",
"20",
")",
";",
"RequestContext",
".",
"getHttpResponse",
"(",
")",
".",
"addCookie",
"(",
"Cookie",
".",
"toServletCookie",
"(",
"cookie",
")",
")",
";",
"}"
] | Sends long to live cookie to browse with response. This cookie will be asked to live for 20 years.
@param name name of cookie
@param value value of cookie. | [
"Sends",
"long",
"to",
"live",
"cookie",
"to",
"browse",
"with",
"response",
".",
"This",
"cookie",
"will",
"be",
"asked",
"to",
"live",
"for",
"20",
"years",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1330-L1334 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java | KeyRange.closedClosed | public static KeyRange closedClosed(Key start, Key end) {
"""
Returns a key range from {@code start} inclusive to {@code end} inclusive.
"""
return new KeyRange(checkNotNull(start), Endpoint.CLOSED, checkNotNull(end), Endpoint.CLOSED);
} | java | public static KeyRange closedClosed(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.CLOSED, checkNotNull(end), Endpoint.CLOSED);
} | [
"public",
"static",
"KeyRange",
"closedClosed",
"(",
"Key",
"start",
",",
"Key",
"end",
")",
"{",
"return",
"new",
"KeyRange",
"(",
"checkNotNull",
"(",
"start",
")",
",",
"Endpoint",
".",
"CLOSED",
",",
"checkNotNull",
"(",
"end",
")",
",",
"Endpoint",
".",
"CLOSED",
")",
";",
"}"
] | Returns a key range from {@code start} inclusive to {@code end} inclusive. | [
"Returns",
"a",
"key",
"range",
"from",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java#L157-L159 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java | AbstractScaleThesisQueryPageHandler.synchronizeFieldCaption | protected void synchronizeFieldCaption(QueryPage queryPage, String fieldName, String fieldCaption) {
"""
Updates field caption if field can be found. Used only when query already contains replies.
@param queryPage query page
@param fieldName field name
@param fieldCaption field caption
"""
QueryFieldDAO queryFieldDAO = new QueryFieldDAO();
QueryOptionField queryField = (QueryOptionField) queryFieldDAO.findByQueryPageAndName(queryPage, fieldName);
if (queryField != null)
queryFieldDAO.updateCaption(queryField, fieldCaption);
} | java | protected void synchronizeFieldCaption(QueryPage queryPage, String fieldName, String fieldCaption) {
QueryFieldDAO queryFieldDAO = new QueryFieldDAO();
QueryOptionField queryField = (QueryOptionField) queryFieldDAO.findByQueryPageAndName(queryPage, fieldName);
if (queryField != null)
queryFieldDAO.updateCaption(queryField, fieldCaption);
} | [
"protected",
"void",
"synchronizeFieldCaption",
"(",
"QueryPage",
"queryPage",
",",
"String",
"fieldName",
",",
"String",
"fieldCaption",
")",
"{",
"QueryFieldDAO",
"queryFieldDAO",
"=",
"new",
"QueryFieldDAO",
"(",
")",
";",
"QueryOptionField",
"queryField",
"=",
"(",
"QueryOptionField",
")",
"queryFieldDAO",
".",
"findByQueryPageAndName",
"(",
"queryPage",
",",
"fieldName",
")",
";",
"if",
"(",
"queryField",
"!=",
"null",
")",
"queryFieldDAO",
".",
"updateCaption",
"(",
"queryField",
",",
"fieldCaption",
")",
";",
"}"
] | Updates field caption if field can be found. Used only when query already contains replies.
@param queryPage query page
@param fieldName field name
@param fieldCaption field caption | [
"Updates",
"field",
"caption",
"if",
"field",
"can",
"be",
"found",
".",
"Used",
"only",
"when",
"query",
"already",
"contains",
"replies",
"."
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java#L113-L119 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/actors/ActorSystem.java | ActorSystem.addDispatcher | public void addDispatcher(String dispatcherId, int threadsCount) {
"""
Adding dispatcher with specific threads count
@param dispatcherId dispatcher id
@param threadsCount threads count
"""
synchronized (dispatchers) {
if (dispatchers.containsKey(dispatcherId)) {
return;
}
ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this,
Runtime.isSingleThread() ? 1 : threadsCount);
dispatchers.put(dispatcherId, dispatcher);
}
} | java | public void addDispatcher(String dispatcherId, int threadsCount) {
synchronized (dispatchers) {
if (dispatchers.containsKey(dispatcherId)) {
return;
}
ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this,
Runtime.isSingleThread() ? 1 : threadsCount);
dispatchers.put(dispatcherId, dispatcher);
}
} | [
"public",
"void",
"addDispatcher",
"(",
"String",
"dispatcherId",
",",
"int",
"threadsCount",
")",
"{",
"synchronized",
"(",
"dispatchers",
")",
"{",
"if",
"(",
"dispatchers",
".",
"containsKey",
"(",
"dispatcherId",
")",
")",
"{",
"return",
";",
"}",
"ActorDispatcher",
"dispatcher",
"=",
"new",
"ActorDispatcher",
"(",
"dispatcherId",
",",
"ThreadPriority",
".",
"LOW",
",",
"this",
",",
"Runtime",
".",
"isSingleThread",
"(",
")",
"?",
"1",
":",
"threadsCount",
")",
";",
"dispatchers",
".",
"put",
"(",
"dispatcherId",
",",
"dispatcher",
")",
";",
"}",
"}"
] | Adding dispatcher with specific threads count
@param dispatcherId dispatcher id
@param threadsCount threads count | [
"Adding",
"dispatcher",
"with",
"specific",
"threads",
"count"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/actors/ActorSystem.java#L61-L72 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java | JRDF.sameSubject | public static boolean sameSubject(SubjectNode s1, SubjectNode s2) {
"""
Tells whether the given subjects are equivalent.
<p>
Two subjects are equivalent if they are both resources and they match
according to the rules for resources.
@param s1
first subject.
@param s2
second subject.
@return true if equivalent, false otherwise.
"""
if (s1 instanceof URIReference && s2 instanceof URIReference) {
return sameResource((URIReference) s1, (URIReference) s2);
} else {
return false;
}
} | java | public static boolean sameSubject(SubjectNode s1, SubjectNode s2) {
if (s1 instanceof URIReference && s2 instanceof URIReference) {
return sameResource((URIReference) s1, (URIReference) s2);
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"sameSubject",
"(",
"SubjectNode",
"s1",
",",
"SubjectNode",
"s2",
")",
"{",
"if",
"(",
"s1",
"instanceof",
"URIReference",
"&&",
"s2",
"instanceof",
"URIReference",
")",
"{",
"return",
"sameResource",
"(",
"(",
"URIReference",
")",
"s1",
",",
"(",
"URIReference",
")",
"s2",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Tells whether the given subjects are equivalent.
<p>
Two subjects are equivalent if they are both resources and they match
according to the rules for resources.
@param s1
first subject.
@param s2
second subject.
@return true if equivalent, false otherwise. | [
"Tells",
"whether",
"the",
"given",
"subjects",
"are",
"equivalent",
".",
"<p",
">",
"Two",
"subjects",
"are",
"equivalent",
"if",
"they",
"are",
"both",
"resources",
"and",
"they",
"match",
"according",
"to",
"the",
"rules",
"for",
"resources",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L133-L139 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.areSameTsi | private static boolean areSameTsi(String a, String b) {
"""
Compares two TSI intervals. It is
@param a first interval to compare
@param b second interval to compare
@return true when both intervals are equal (case insensitive)
"""
return a.length() == b.length() && b.length() > SQL_TSI_ROOT.length()
&& a.regionMatches(true, SQL_TSI_ROOT.length(), b, SQL_TSI_ROOT.length(), b.length() - SQL_TSI_ROOT.length());
} | java | private static boolean areSameTsi(String a, String b) {
return a.length() == b.length() && b.length() > SQL_TSI_ROOT.length()
&& a.regionMatches(true, SQL_TSI_ROOT.length(), b, SQL_TSI_ROOT.length(), b.length() - SQL_TSI_ROOT.length());
} | [
"private",
"static",
"boolean",
"areSameTsi",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"return",
"a",
".",
"length",
"(",
")",
"==",
"b",
".",
"length",
"(",
")",
"&&",
"b",
".",
"length",
"(",
")",
">",
"SQL_TSI_ROOT",
".",
"length",
"(",
")",
"&&",
"a",
".",
"regionMatches",
"(",
"true",
",",
"SQL_TSI_ROOT",
".",
"length",
"(",
")",
",",
"b",
",",
"SQL_TSI_ROOT",
".",
"length",
"(",
")",
",",
"b",
".",
"length",
"(",
")",
"-",
"SQL_TSI_ROOT",
".",
"length",
"(",
")",
")",
";",
"}"
] | Compares two TSI intervals. It is
@param a first interval to compare
@param b second interval to compare
@return true when both intervals are equal (case insensitive) | [
"Compares",
"two",
"TSI",
"intervals",
".",
"It",
"is"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L546-L549 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutRestApiRequest.java | PutRestApiRequest.withParameters | public PutRestApiRequest withParameters(java.util.Map<String, String> parameters) {
"""
<p>
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI command
of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
</p>
@param parameters
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI
command of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
@return Returns a reference to this object so that method calls can be chained together.
"""
setParameters(parameters);
return this;
} | java | public PutRestApiRequest withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"PutRestApiRequest",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI command
of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
</p>
@param parameters
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI
command of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Custom",
"header",
"parameters",
"as",
"part",
"of",
"the",
"request",
".",
"For",
"example",
"to",
"exclude",
"<a",
">",
"DocumentationParts<",
"/",
"a",
">",
"from",
"an",
"imported",
"API",
"set",
"<code",
">",
"ignore",
"=",
"documentation<",
"/",
"code",
">",
"as",
"a",
"<code",
">",
"parameters<",
"/",
"code",
">",
"value",
"as",
"in",
"the",
"AWS",
"CLI",
"command",
"of",
"<code",
">",
"aws",
"apigateway",
"import",
"-",
"rest",
"-",
"api",
"--",
"parameters",
"ignore",
"=",
"documentation",
"--",
"body",
"file",
":",
"///",
"path",
"/",
"to",
"/",
"imported",
"-",
"api",
"-",
"body",
".",
"json",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutRestApiRequest.java#L308-L311 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java | JsonRpcHttpAsyncClient.readResponse | private <T> T readResponse(Type returnType, InputStream ips) throws Throwable {
"""
Reads a JSON-PRC response from the server. This blocks until a response
is received.
@param returnType the expected return type
@param ips the {@link InputStream} to read from
@return the object returned by the JSON-RPC response
@throws Throwable on error
"""
JsonNode response = mapper.readTree(new NoCloseInputStream(ips));
logger.debug("JSON-PRC Response: {}", response);
if (!response.isObject()) {
throw new JsonRpcClientException(0, "Invalid JSON-RPC response", response);
}
ObjectNode jsonObject = ObjectNode.class.cast(response);
if (jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull()) {
throw exceptionResolver.resolveException(jsonObject);
}
if (jsonObject.has(RESULT) && !jsonObject.get(RESULT).isNull() && jsonObject.get(RESULT) != null) {
JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);
return mapper.readValue(returnJsonParser, returnJavaType);
}
return null;
} | java | private <T> T readResponse(Type returnType, InputStream ips) throws Throwable {
JsonNode response = mapper.readTree(new NoCloseInputStream(ips));
logger.debug("JSON-PRC Response: {}", response);
if (!response.isObject()) {
throw new JsonRpcClientException(0, "Invalid JSON-RPC response", response);
}
ObjectNode jsonObject = ObjectNode.class.cast(response);
if (jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull()) {
throw exceptionResolver.resolveException(jsonObject);
}
if (jsonObject.has(RESULT) && !jsonObject.get(RESULT).isNull() && jsonObject.get(RESULT) != null) {
JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);
return mapper.readValue(returnJsonParser, returnJavaType);
}
return null;
} | [
"private",
"<",
"T",
">",
"T",
"readResponse",
"(",
"Type",
"returnType",
",",
"InputStream",
"ips",
")",
"throws",
"Throwable",
"{",
"JsonNode",
"response",
"=",
"mapper",
".",
"readTree",
"(",
"new",
"NoCloseInputStream",
"(",
"ips",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"JSON-PRC Response: {}\"",
",",
"response",
")",
";",
"if",
"(",
"!",
"response",
".",
"isObject",
"(",
")",
")",
"{",
"throw",
"new",
"JsonRpcClientException",
"(",
"0",
",",
"\"Invalid JSON-RPC response\"",
",",
"response",
")",
";",
"}",
"ObjectNode",
"jsonObject",
"=",
"ObjectNode",
".",
"class",
".",
"cast",
"(",
"response",
")",
";",
"if",
"(",
"jsonObject",
".",
"has",
"(",
"ERROR",
")",
"&&",
"jsonObject",
".",
"get",
"(",
"ERROR",
")",
"!=",
"null",
"&&",
"!",
"jsonObject",
".",
"get",
"(",
"ERROR",
")",
".",
"isNull",
"(",
")",
")",
"{",
"throw",
"exceptionResolver",
".",
"resolveException",
"(",
"jsonObject",
")",
";",
"}",
"if",
"(",
"jsonObject",
".",
"has",
"(",
"RESULT",
")",
"&&",
"!",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
".",
"isNull",
"(",
")",
"&&",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
"!=",
"null",
")",
"{",
"JsonParser",
"returnJsonParser",
"=",
"mapper",
".",
"treeAsTokens",
"(",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
")",
";",
"JavaType",
"returnJavaType",
"=",
"mapper",
".",
"getTypeFactory",
"(",
")",
".",
"constructType",
"(",
"returnType",
")",
";",
"return",
"mapper",
".",
"readValue",
"(",
"returnJsonParser",
",",
"returnJavaType",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Reads a JSON-PRC response from the server. This blocks until a response
is received.
@param returnType the expected return type
@param ips the {@link InputStream} to read from
@return the object returned by the JSON-RPC response
@throws Throwable on error | [
"Reads",
"a",
"JSON",
"-",
"PRC",
"response",
"from",
"the",
"server",
".",
"This",
"blocks",
"until",
"a",
"response",
"is",
"received",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java#L380-L399 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java | StringSerializer.canRead | @Override
public boolean canRead(@Nonnull MediaType mimeType, Class<?> resultType) {
"""
Checks whether mime types is supported by this serializer implementation
"""
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(resultType);
} | java | @Override
public boolean canRead(@Nonnull MediaType mimeType, Class<?> resultType) {
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(resultType);
} | [
"@",
"Override",
"public",
"boolean",
"canRead",
"(",
"@",
"Nonnull",
"MediaType",
"mimeType",
",",
"Class",
"<",
"?",
">",
"resultType",
")",
"{",
"MediaType",
"type",
"=",
"mimeType",
".",
"withoutParameters",
"(",
")",
";",
"return",
"(",
"type",
".",
"is",
"(",
"MediaType",
".",
"ANY_TEXT_TYPE",
")",
"||",
"MediaType",
".",
"APPLICATION_XML_UTF_8",
".",
"withoutParameters",
"(",
")",
".",
"is",
"(",
"type",
")",
"||",
"MediaType",
".",
"JSON_UTF_8",
".",
"withoutParameters",
"(",
")",
".",
"is",
"(",
"type",
")",
")",
"&&",
"String",
".",
"class",
".",
"equals",
"(",
"resultType",
")",
";",
"}"
] | Checks whether mime types is supported by this serializer implementation | [
"Checks",
"whether",
"mime",
"types",
"is",
"supported",
"by",
"this",
"serializer",
"implementation"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java#L77-L82 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ProactiveDetectionConfigurationsInner.java | ProactiveDetectionConfigurationsInner.getAsync | public Observable<ApplicationInsightsComponentProactiveDetectionConfigurationInner> getAsync(String resourceGroupName, String resourceName, String configurationId) {
"""
Get the ProactiveDetection configuration for this configuration id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param configurationId The ProactiveDetection configuration ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentProactiveDetectionConfigurationInner object
"""
return getWithServiceResponseAsync(resourceGroupName, resourceName, configurationId).map(new Func1<ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner>, ApplicationInsightsComponentProactiveDetectionConfigurationInner>() {
@Override
public ApplicationInsightsComponentProactiveDetectionConfigurationInner call(ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentProactiveDetectionConfigurationInner> getAsync(String resourceGroupName, String resourceName, String configurationId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, configurationId).map(new Func1<ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner>, ApplicationInsightsComponentProactiveDetectionConfigurationInner>() {
@Override
public ApplicationInsightsComponentProactiveDetectionConfigurationInner call(ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"configurationId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"configurationId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
">",
",",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
"call",
"(",
"ServiceResponse",
"<",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get the ProactiveDetection configuration for this configuration id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param configurationId The ProactiveDetection configuration ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentProactiveDetectionConfigurationInner object | [
"Get",
"the",
"ProactiveDetection",
"configuration",
"for",
"this",
"configuration",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ProactiveDetectionConfigurationsInner.java#L196-L203 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java | CommerceWarehouseItemPersistenceImpl.countByCWI_CPIU | @Override
public int countByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) {
"""
Returns the number of commerce warehouse items where commerceWarehouseId = ? and CPInstanceUuid = ?.
@param commerceWarehouseId the commerce warehouse ID
@param CPInstanceUuid the cp instance uuid
@return the number of matching commerce warehouse items
"""
FinderPath finderPath = FINDER_PATH_COUNT_BY_CWI_CPIU;
Object[] finderArgs = new Object[] { commerceWarehouseId, CPInstanceUuid };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE);
query.append(_FINDER_COLUMN_CWI_CPIU_COMMERCEWAREHOUSEID_2);
boolean bindCPInstanceUuid = false;
if (CPInstanceUuid == null) {
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_1);
}
else if (CPInstanceUuid.equals("")) {
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_3);
}
else {
bindCPInstanceUuid = true;
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(commerceWarehouseId);
if (bindCPInstanceUuid) {
qPos.add(CPInstanceUuid);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_CWI_CPIU;
Object[] finderArgs = new Object[] { commerceWarehouseId, CPInstanceUuid };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE);
query.append(_FINDER_COLUMN_CWI_CPIU_COMMERCEWAREHOUSEID_2);
boolean bindCPInstanceUuid = false;
if (CPInstanceUuid == null) {
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_1);
}
else if (CPInstanceUuid.equals("")) {
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_3);
}
else {
bindCPInstanceUuid = true;
query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(commerceWarehouseId);
if (bindCPInstanceUuid) {
qPos.add(CPInstanceUuid);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByCWI_CPIU",
"(",
"long",
"commerceWarehouseId",
",",
"String",
"CPInstanceUuid",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_CWI_CPIU",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"commerceWarehouseId",
",",
"CPInstanceUuid",
"}",
";",
"Long",
"count",
"=",
"(",
"Long",
")",
"finderCache",
".",
"getResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"this",
")",
";",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"StringBundler",
"query",
"=",
"new",
"StringBundler",
"(",
"3",
")",
";",
"query",
".",
"append",
"(",
"_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE",
")",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_CWI_CPIU_COMMERCEWAREHOUSEID_2",
")",
";",
"boolean",
"bindCPInstanceUuid",
"=",
"false",
";",
"if",
"(",
"CPInstanceUuid",
"==",
"null",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_1",
")",
";",
"}",
"else",
"if",
"(",
"CPInstanceUuid",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_3",
")",
";",
"}",
"else",
"{",
"bindCPInstanceUuid",
"=",
"true",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_2",
")",
";",
"}",
"String",
"sql",
"=",
"query",
".",
"toString",
"(",
")",
";",
"Session",
"session",
"=",
"null",
";",
"try",
"{",
"session",
"=",
"openSession",
"(",
")",
";",
"Query",
"q",
"=",
"session",
".",
"createQuery",
"(",
"sql",
")",
";",
"QueryPos",
"qPos",
"=",
"QueryPos",
".",
"getInstance",
"(",
"q",
")",
";",
"qPos",
".",
"add",
"(",
"commerceWarehouseId",
")",
";",
"if",
"(",
"bindCPInstanceUuid",
")",
"{",
"qPos",
".",
"add",
"(",
"CPInstanceUuid",
")",
";",
"}",
"count",
"=",
"(",
"Long",
")",
"q",
".",
"uniqueResult",
"(",
")",
";",
"finderCache",
".",
"putResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"count",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"finderCache",
".",
"removeResult",
"(",
"finderPath",
",",
"finderArgs",
")",
";",
"throw",
"processException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"closeSession",
"(",
"session",
")",
";",
"}",
"}",
"return",
"count",
".",
"intValue",
"(",
")",
";",
"}"
] | Returns the number of commerce warehouse items where commerceWarehouseId = ? and CPInstanceUuid = ?.
@param commerceWarehouseId the commerce warehouse ID
@param CPInstanceUuid the cp instance uuid
@return the number of matching commerce warehouse items | [
"Returns",
"the",
"number",
"of",
"commerce",
"warehouse",
"items",
"where",
"commerceWarehouseId",
"=",
"?",
";",
"and",
"CPInstanceUuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L807-L868 |
tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getParameterTypes | public static final Class[] getParameterTypes(Object bean, String property) {
"""
Returns actual parameter types for property
@param bean
@param property
@return
"""
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | java | public static final Class[] getParameterTypes(Object bean, String property)
{
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | [
"public",
"static",
"final",
"Class",
"[",
"]",
"getParameterTypes",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"Type",
"type",
"=",
"(",
"Type",
")",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Object",
"a",
",",
"int",
"i",
")",
"->",
"{",
"Object",
"o",
"=",
"Array",
".",
"get",
"(",
"a",
",",
"i",
")",
";",
"return",
"o",
"!=",
"null",
"?",
"o",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
":",
"null",
";",
"}",
",",
"(",
"List",
"l",
",",
"int",
"i",
")",
"->",
"{",
"return",
"l",
".",
"get",
"(",
"i",
")",
".",
"getClass",
"(",
")",
".",
"getGenericSuperclass",
"(",
")",
";",
"}",
",",
"(",
"Object",
"o",
",",
"Class",
"c",
",",
"String",
"p",
")",
"->",
"{",
"return",
"getField",
"(",
"c",
",",
"p",
")",
".",
"getGenericType",
"(",
")",
";",
"}",
",",
"(",
"Object",
"o",
",",
"Method",
"m",
")",
"->",
"{",
"return",
"m",
".",
"getGenericReturnType",
"(",
")",
";",
"}",
")",
";",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"ParameterizedType",
"pt",
"=",
"(",
"ParameterizedType",
")",
"type",
";",
"Type",
"[",
"]",
"ata",
"=",
"pt",
".",
"getActualTypeArguments",
"(",
")",
";",
"if",
"(",
"ata",
".",
"length",
">",
"0",
")",
"{",
"Class",
"[",
"]",
"ca",
"=",
"new",
"Class",
"[",
"ata",
".",
"length",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"ca",
".",
"length",
";",
"ii",
"++",
")",
"{",
"ca",
"[",
"ii",
"]",
"=",
"(",
"Class",
")",
"ata",
"[",
"ii",
"]",
";",
"}",
"return",
"ca",
";",
"}",
"}",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"Class",
"cls",
"=",
"(",
"Class",
")",
"type",
";",
"if",
"(",
"cls",
".",
"isArray",
"(",
")",
")",
"{",
"cls",
"=",
"cls",
".",
"getComponentType",
"(",
")",
";",
"}",
"return",
"new",
"Class",
"[",
"]",
"{",
"cls",
"}",
";",
"}",
"return",
"null",
";",
"}"
] | Returns actual parameter types for property
@param bean
@param property
@return | [
"Returns",
"actual",
"parameter",
"types",
"for",
"property"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L227-L261 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_cumsum.java | Scs_cumsum.cs_cumsum | public static int cs_cumsum(int[] p, int[] c, int n) {
"""
p [0.f.n] = cumulative sum of c [0.f.n-1], and then copy p [0.f.n-1] into c
@param p
size n+1, cumulative sum of c
@param c
size n, overwritten with p [0.f.n-1] on output
@param n
length of c
@return sum (c), null on error
"""
int i, nz = 0;
float nz2 = 0;
if (p == null || c == null)
return (-1); /* check inputs */
for (i = 0; i < n; i++) {
p[i] = nz;
nz += c[i];
nz2 += c[i]; /* also in float to avoid int overflow */
c[i] = p[i]; /* also copy p[0.f.n-1] back into c[0.f.n-1]*/
}
p[n] = nz;
return (int) nz2; /* return sum (c [0.f.n-1]) */
} | java | public static int cs_cumsum(int[] p, int[] c, int n) {
int i, nz = 0;
float nz2 = 0;
if (p == null || c == null)
return (-1); /* check inputs */
for (i = 0; i < n; i++) {
p[i] = nz;
nz += c[i];
nz2 += c[i]; /* also in float to avoid int overflow */
c[i] = p[i]; /* also copy p[0.f.n-1] back into c[0.f.n-1]*/
}
p[n] = nz;
return (int) nz2; /* return sum (c [0.f.n-1]) */
} | [
"public",
"static",
"int",
"cs_cumsum",
"(",
"int",
"[",
"]",
"p",
",",
"int",
"[",
"]",
"c",
",",
"int",
"n",
")",
"{",
"int",
"i",
",",
"nz",
"=",
"0",
";",
"float",
"nz2",
"=",
"0",
";",
"if",
"(",
"p",
"==",
"null",
"||",
"c",
"==",
"null",
")",
"return",
"(",
"-",
"1",
")",
";",
"/* check inputs */",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"p",
"[",
"i",
"]",
"=",
"nz",
";",
"nz",
"+=",
"c",
"[",
"i",
"]",
";",
"nz2",
"+=",
"c",
"[",
"i",
"]",
";",
"/* also in float to avoid int overflow */",
"c",
"[",
"i",
"]",
"=",
"p",
"[",
"i",
"]",
";",
"/* also copy p[0.f.n-1] back into c[0.f.n-1]*/",
"}",
"p",
"[",
"n",
"]",
"=",
"nz",
";",
"return",
"(",
"int",
")",
"nz2",
";",
"/* return sum (c [0.f.n-1]) */",
"}"
] | p [0.f.n] = cumulative sum of c [0.f.n-1], and then copy p [0.f.n-1] into c
@param p
size n+1, cumulative sum of c
@param c
size n, overwritten with p [0.f.n-1] on output
@param n
length of c
@return sum (c), null on error | [
"p",
"[",
"0",
".",
"f",
".",
"n",
"]",
"=",
"cumulative",
"sum",
"of",
"c",
"[",
"0",
".",
"f",
".",
"n",
"-",
"1",
"]",
"and",
"then",
"copy",
"p",
"[",
"0",
".",
"f",
".",
"n",
"-",
"1",
"]",
"into",
"c"
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_cumsum.java#L46-L59 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.xmmword_ptr | public static final Mem xmmword_ptr(Register base, Register index, int shift, long disp) {
"""
Create xmmword (16 Bytes) pointer operand.
!
! @note This constructor is provided only for convenience for sse programming.
"""
return _ptr_build(base, index, shift, disp, SIZE_DQWORD);
} | java | public static final Mem xmmword_ptr(Register base, Register index, int shift, long disp) {
return _ptr_build(base, index, shift, disp, SIZE_DQWORD);
} | [
"public",
"static",
"final",
"Mem",
"xmmword_ptr",
"(",
"Register",
"base",
",",
"Register",
"index",
",",
"int",
"shift",
",",
"long",
"disp",
")",
"{",
"return",
"_ptr_build",
"(",
"base",
",",
"index",
",",
"shift",
",",
"disp",
",",
"SIZE_DQWORD",
")",
";",
"}"
] | Create xmmword (16 Bytes) pointer operand.
!
! @note This constructor is provided only for convenience for sse programming. | [
"Create",
"xmmword",
"(",
"16",
"Bytes",
")",
"pointer",
"operand",
".",
"!",
"!"
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L594-L596 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/MediaUtils.java | MediaUtils.createAccessibleTempFile | private static Uri createAccessibleTempFile(Context ctx, String authority) throws IOException {
"""
Generate an accessible temporary file URI to be used for camera captures
@param ctx
@return
@throws IOException
"""
File dir = new File(ctx.getCacheDir(), "camera");
File tmp = createTempFile(dir);
// Give permissions
return FileProvider.getUriForFile(ctx, authority, tmp);
} | java | private static Uri createAccessibleTempFile(Context ctx, String authority) throws IOException {
File dir = new File(ctx.getCacheDir(), "camera");
File tmp = createTempFile(dir);
// Give permissions
return FileProvider.getUriForFile(ctx, authority, tmp);
} | [
"private",
"static",
"Uri",
"createAccessibleTempFile",
"(",
"Context",
"ctx",
",",
"String",
"authority",
")",
"throws",
"IOException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"ctx",
".",
"getCacheDir",
"(",
")",
",",
"\"camera\"",
")",
";",
"File",
"tmp",
"=",
"createTempFile",
"(",
"dir",
")",
";",
"// Give permissions",
"return",
"FileProvider",
".",
"getUriForFile",
"(",
"ctx",
",",
"authority",
",",
"tmp",
")",
";",
"}"
] | Generate an accessible temporary file URI to be used for camera captures
@param ctx
@return
@throws IOException | [
"Generate",
"an",
"accessible",
"temporary",
"file",
"URI",
"to",
"be",
"used",
"for",
"camera",
"captures"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L236-L242 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/AnnotationsUtil.java | AnnotationsUtil.checkAnnotationPresent | public static <T extends Annotation> T checkAnnotationPresent(AnnotatedElement annotatedType,
Class<T> annotationClass) {
"""
Check if the annotation is present and if not throws an exception,
this is just an overload for more clear naming.
@param annotatedType The source type to tcheck the annotation on
@param annotationClass The annotation to look for
@param <T> The annotation subtype
@return The annotation that was requested
@throws ODataSystemException If unable to find the annotation or nullpointer in case null source was specified
"""
return getAnnotation(annotatedType, annotationClass);
} | java | public static <T extends Annotation> T checkAnnotationPresent(AnnotatedElement annotatedType,
Class<T> annotationClass) {
return getAnnotation(annotatedType, annotationClass);
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"checkAnnotationPresent",
"(",
"AnnotatedElement",
"annotatedType",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"return",
"getAnnotation",
"(",
"annotatedType",
",",
"annotationClass",
")",
";",
"}"
] | Check if the annotation is present and if not throws an exception,
this is just an overload for more clear naming.
@param annotatedType The source type to tcheck the annotation on
@param annotationClass The annotation to look for
@param <T> The annotation subtype
@return The annotation that was requested
@throws ODataSystemException If unable to find the annotation or nullpointer in case null source was specified | [
"Check",
"if",
"the",
"annotation",
"is",
"present",
"and",
"if",
"not",
"throws",
"an",
"exception",
"this",
"is",
"just",
"an",
"overload",
"for",
"more",
"clear",
"naming",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/AnnotationsUtil.java#L43-L46 |
incodehq-legacy/incode-module-document | dom/src/main/java/org/incode/module/document/dom/impl/docs/DocumentTemplateRepository.java | DocumentTemplateRepository.findFirstByTypeAndApplicableToAtPath | @Programmatic
public DocumentTemplate findFirstByTypeAndApplicableToAtPath(final DocumentType documentType, final String atPath) {
"""
Returns all document templates for the specified {@link DocumentType}, ordered by type, then most specific to
provided application tenancy, and then by date (desc).
"""
final List<DocumentTemplate> templates = findByTypeAndApplicableToAtPath(documentType, atPath);
return templates.isEmpty() ? null : templates.get(0);
} | java | @Programmatic
public DocumentTemplate findFirstByTypeAndApplicableToAtPath(final DocumentType documentType, final String atPath) {
final List<DocumentTemplate> templates = findByTypeAndApplicableToAtPath(documentType, atPath);
return templates.isEmpty() ? null : templates.get(0);
} | [
"@",
"Programmatic",
"public",
"DocumentTemplate",
"findFirstByTypeAndApplicableToAtPath",
"(",
"final",
"DocumentType",
"documentType",
",",
"final",
"String",
"atPath",
")",
"{",
"final",
"List",
"<",
"DocumentTemplate",
">",
"templates",
"=",
"findByTypeAndApplicableToAtPath",
"(",
"documentType",
",",
"atPath",
")",
";",
"return",
"templates",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"templates",
".",
"get",
"(",
"0",
")",
";",
"}"
] | Returns all document templates for the specified {@link DocumentType}, ordered by type, then most specific to
provided application tenancy, and then by date (desc). | [
"Returns",
"all",
"document",
"templates",
"for",
"the",
"specified",
"{"
] | train | https://github.com/incodehq-legacy/incode-module-document/blob/c62f064e96d6e6007f7fd6a4bc06e03b78b1816c/dom/src/main/java/org/incode/module/document/dom/impl/docs/DocumentTemplateRepository.java#L147-L151 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java | CommonsAssert.assertEquals | public static <T> void assertEquals (@Nullable final T x, @Nullable final T y) {
"""
Like JUnit assertEquals but using {@link EqualsHelper}.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>.
"""
assertEquals ((String) null, x, y);
} | java | public static <T> void assertEquals (@Nullable final T x, @Nullable final T y)
{
assertEquals ((String) null, x, y);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertEquals",
"(",
"@",
"Nullable",
"final",
"T",
"x",
",",
"@",
"Nullable",
"final",
"T",
"y",
")",
"{",
"assertEquals",
"(",
"(",
"String",
")",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Like JUnit assertEquals but using {@link EqualsHelper}.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>. | [
"Like",
"JUnit",
"assertEquals",
"but",
"using",
"{",
"@link",
"EqualsHelper",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java#L170-L173 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java | FileSystemShellUtils.getFilePath | public static String getFilePath(String path, AlluxioConfiguration alluxioConf)
throws IOException {
"""
Removes {@link Constants#HEADER} / {@link Constants#HEADER_FT} and hostname:port information
from a path, leaving only the local file path.
@param path the path to obtain the local path from
@param alluxioConf Alluxio configuration
@return the local path in string format
"""
path = validatePath(path, alluxioConf);
if (path.startsWith(Constants.HEADER)) {
path = path.substring(Constants.HEADER.length());
} else if (path.startsWith(Constants.HEADER_FT)) {
path = path.substring(Constants.HEADER_FT.length());
}
return path.substring(path.indexOf(AlluxioURI.SEPARATOR));
} | java | public static String getFilePath(String path, AlluxioConfiguration alluxioConf)
throws IOException {
path = validatePath(path, alluxioConf);
if (path.startsWith(Constants.HEADER)) {
path = path.substring(Constants.HEADER.length());
} else if (path.startsWith(Constants.HEADER_FT)) {
path = path.substring(Constants.HEADER_FT.length());
}
return path.substring(path.indexOf(AlluxioURI.SEPARATOR));
} | [
"public",
"static",
"String",
"getFilePath",
"(",
"String",
"path",
",",
"AlluxioConfiguration",
"alluxioConf",
")",
"throws",
"IOException",
"{",
"path",
"=",
"validatePath",
"(",
"path",
",",
"alluxioConf",
")",
";",
"if",
"(",
"path",
".",
"startsWith",
"(",
"Constants",
".",
"HEADER",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"Constants",
".",
"HEADER",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"startsWith",
"(",
"Constants",
".",
"HEADER_FT",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"Constants",
".",
"HEADER_FT",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"path",
".",
"substring",
"(",
"path",
".",
"indexOf",
"(",
"AlluxioURI",
".",
"SEPARATOR",
")",
")",
";",
"}"
] | Removes {@link Constants#HEADER} / {@link Constants#HEADER_FT} and hostname:port information
from a path, leaving only the local file path.
@param path the path to obtain the local path from
@param alluxioConf Alluxio configuration
@return the local path in string format | [
"Removes",
"{",
"@link",
"Constants#HEADER",
"}",
"/",
"{",
"@link",
"Constants#HEADER_FT",
"}",
"and",
"hostname",
":",
"port",
"information",
"from",
"a",
"path",
"leaving",
"only",
"the",
"local",
"file",
"path",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L59-L68 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.createVerificationContext | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
"""
Builds the verification context.
@return instance of verification context
@throws KSIException when error occurs (e.g mandatory parameters aren't present)
"""
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KSIException("Failed to createSignature verification context. KSI extending service must be present.");
}
if (publicationsFile == null) {
throw new KSIException("Failed to createSignature verification context. PublicationsFile must be present.");
}
return new KSIVerificationContext(publicationsFile, signature, userPublication, extendingAllowed, extendingService, documentHash, inputHashLevel);
} | java | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KSIException("Failed to createSignature verification context. KSI extending service must be present.");
}
if (publicationsFile == null) {
throw new KSIException("Failed to createSignature verification context. PublicationsFile must be present.");
}
return new KSIVerificationContext(publicationsFile, signature, userPublication, extendingAllowed, extendingService, documentHash, inputHashLevel);
} | [
"@",
"Deprecated",
"public",
"final",
"VerificationContext",
"createVerificationContext",
"(",
")",
"throws",
"KSIException",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. Signature must be present.\"",
")",
";",
"}",
"if",
"(",
"extendingService",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. KSI extending service must be present.\"",
")",
";",
"}",
"if",
"(",
"publicationsFile",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. PublicationsFile must be present.\"",
")",
";",
"}",
"return",
"new",
"KSIVerificationContext",
"(",
"publicationsFile",
",",
"signature",
",",
"userPublication",
",",
"extendingAllowed",
",",
"extendingService",
",",
"documentHash",
",",
"inputHashLevel",
")",
";",
"}"
] | Builds the verification context.
@return instance of verification context
@throws KSIException when error occurs (e.g mandatory parameters aren't present) | [
"Builds",
"the",
"verification",
"context",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L149-L161 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/swing/ScreenUtil.java | ScreenUtil.captureScreen | public static File captureScreen(Rectangle screenRect, File outFile) {
"""
截屏
@param screenRect 截屏的矩形区域
@param outFile 写出到的文件
@return 写出到的文件
@see RobotUtil#captureScreen(Rectangle, File)
"""
return RobotUtil.captureScreen(screenRect, outFile);
} | java | public static File captureScreen(Rectangle screenRect, File outFile) {
return RobotUtil.captureScreen(screenRect, outFile);
} | [
"public",
"static",
"File",
"captureScreen",
"(",
"Rectangle",
"screenRect",
",",
"File",
"outFile",
")",
"{",
"return",
"RobotUtil",
".",
"captureScreen",
"(",
"screenRect",
",",
"outFile",
")",
";",
"}"
] | 截屏
@param screenRect 截屏的矩形区域
@param outFile 写出到的文件
@return 写出到的文件
@see RobotUtil#captureScreen(Rectangle, File) | [
"截屏"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/ScreenUtil.java#L85-L87 |
killbill/killbill | api/src/main/java/org/killbill/billing/callcontext/InternalCallContext.java | InternalCallContext.toCallContext | public CallContext toCallContext(final UUID accountId, final UUID tenantId) {
"""
Unfortunately not true as some APIs ae hidden in object -- e.g OverdueStateApplicator is doing subscription.cancelEntitlementWithDateOverrideBillingPolicy
"""
return new DefaultCallContext(accountId, tenantId, createdBy, callOrigin, contextUserType, reasonCode, comments, userToken, createdDate, updatedDate);
} | java | public CallContext toCallContext(final UUID accountId, final UUID tenantId) {
return new DefaultCallContext(accountId, tenantId, createdBy, callOrigin, contextUserType, reasonCode, comments, userToken, createdDate, updatedDate);
} | [
"public",
"CallContext",
"toCallContext",
"(",
"final",
"UUID",
"accountId",
",",
"final",
"UUID",
"tenantId",
")",
"{",
"return",
"new",
"DefaultCallContext",
"(",
"accountId",
",",
"tenantId",
",",
"createdBy",
",",
"callOrigin",
",",
"contextUserType",
",",
"reasonCode",
",",
"comments",
",",
"userToken",
",",
"createdDate",
",",
"updatedDate",
")",
";",
"}"
] | Unfortunately not true as some APIs ae hidden in object -- e.g OverdueStateApplicator is doing subscription.cancelEntitlementWithDateOverrideBillingPolicy | [
"Unfortunately",
"not",
"true",
"as",
"some",
"APIs",
"ae",
"hidden",
"in",
"object",
"--",
"e",
".",
"g",
"OverdueStateApplicator",
"is",
"doing",
"subscription",
".",
"cancelEntitlementWithDateOverrideBillingPolicy"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/api/src/main/java/org/killbill/billing/callcontext/InternalCallContext.java#L107-L109 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | PropertiesUtil.getLongProperty | public long getLongProperty(final String name, final long defaultValue) {
"""
Gets the named property as a long.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed.
"""
final String prop = getStringProperty(name);
if (prop != null) {
try {
return Long.parseLong(prop);
} catch (final Exception ignored) {
return defaultValue;
}
}
return defaultValue;
} | java | public long getLongProperty(final String name, final long defaultValue) {
final String prop = getStringProperty(name);
if (prop != null) {
try {
return Long.parseLong(prop);
} catch (final Exception ignored) {
return defaultValue;
}
}
return defaultValue;
} | [
"public",
"long",
"getLongProperty",
"(",
"final",
"String",
"name",
",",
"final",
"long",
"defaultValue",
")",
"{",
"final",
"String",
"prop",
"=",
"getStringProperty",
"(",
"name",
")",
";",
"if",
"(",
"prop",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"prop",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"ignored",
")",
"{",
"return",
"defaultValue",
";",
"}",
"}",
"return",
"defaultValue",
";",
"}"
] | Gets the named property as a long.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed. | [
"Gets",
"the",
"named",
"property",
"as",
"a",
"long",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L225-L235 |
alkacon/opencms-core | src/org/opencms/security/CmsOrganizationalUnit.java | CmsOrganizationalUnit.prefixWithOu | public static String prefixWithOu(String ou, String principal) {
"""
Prefixes a simple name with an OU.<p>
@param ou the OU to use as a prefix
@param principal the simple name to which the OU should be prepended
@return the FQN
"""
String result = CmsStringUtil.joinPaths(ou, principal);
if (result.startsWith("/")) {
result = result.substring(1);
}
return result;
} | java | public static String prefixWithOu(String ou, String principal) {
String result = CmsStringUtil.joinPaths(ou, principal);
if (result.startsWith("/")) {
result = result.substring(1);
}
return result;
} | [
"public",
"static",
"String",
"prefixWithOu",
"(",
"String",
"ou",
",",
"String",
"principal",
")",
"{",
"String",
"result",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"ou",
",",
"principal",
")",
";",
"if",
"(",
"result",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"result",
"=",
"result",
".",
"substring",
"(",
"1",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Prefixes a simple name with an OU.<p>
@param ou the OU to use as a prefix
@param principal the simple name to which the OU should be prepended
@return the FQN | [
"Prefixes",
"a",
"simple",
"name",
"with",
"an",
"OU",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrganizationalUnit.java#L144-L151 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.toggleProfile | public boolean toggleProfile(Boolean enabled) {
"""
Turn this profile on or off
@param enabled true or false
@return true on success, false otherwise
"""
// TODO: make this return values properly
BasicNameValuePair[] params = {
new BasicNameValuePair("active", enabled.toString())
};
try {
String uri = BASE_PROFILE + uriEncode(this._profileName) + "/" + BASE_CLIENTS + "/";
if (_clientId == null) {
uri += "-1";
} else {
uri += _clientId;
}
JSONObject response = new JSONObject(doPost(uri, params));
} catch (Exception e) {
// some sort of error
System.out.println(e.getMessage());
return false;
}
return true;
} | java | public boolean toggleProfile(Boolean enabled) {
// TODO: make this return values properly
BasicNameValuePair[] params = {
new BasicNameValuePair("active", enabled.toString())
};
try {
String uri = BASE_PROFILE + uriEncode(this._profileName) + "/" + BASE_CLIENTS + "/";
if (_clientId == null) {
uri += "-1";
} else {
uri += _clientId;
}
JSONObject response = new JSONObject(doPost(uri, params));
} catch (Exception e) {
// some sort of error
System.out.println(e.getMessage());
return false;
}
return true;
} | [
"public",
"boolean",
"toggleProfile",
"(",
"Boolean",
"enabled",
")",
"{",
"// TODO: make this return values properly",
"BasicNameValuePair",
"[",
"]",
"params",
"=",
"{",
"new",
"BasicNameValuePair",
"(",
"\"active\"",
",",
"enabled",
".",
"toString",
"(",
")",
")",
"}",
";",
"try",
"{",
"String",
"uri",
"=",
"BASE_PROFILE",
"+",
"uriEncode",
"(",
"this",
".",
"_profileName",
")",
"+",
"\"/\"",
"+",
"BASE_CLIENTS",
"+",
"\"/\"",
";",
"if",
"(",
"_clientId",
"==",
"null",
")",
"{",
"uri",
"+=",
"\"-1\"",
";",
"}",
"else",
"{",
"uri",
"+=",
"_clientId",
";",
"}",
"JSONObject",
"response",
"=",
"new",
"JSONObject",
"(",
"doPost",
"(",
"uri",
",",
"params",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// some sort of error",
"System",
".",
"out",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Turn this profile on or off
@param enabled true or false
@return true on success, false otherwise | [
"Turn",
"this",
"profile",
"on",
"or",
"off"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L403-L422 |
twilio/twilio-java | src/main/java/com/twilio/rest/fax/v1/fax/FaxMediaReader.java | FaxMediaReader.previousPage | @Override
public Page<FaxMedia> previousPage(final Page<FaxMedia> page,
final TwilioRestClient client) {
"""
Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page
"""
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.FAX.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<FaxMedia> previousPage(final Page<FaxMedia> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.FAX.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"FaxMedia",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"FaxMedia",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
"page",
".",
"getPreviousPageUrl",
"(",
"Domains",
".",
"FAX",
".",
"toString",
"(",
")",
",",
"client",
".",
"getRegion",
"(",
")",
")",
")",
";",
"return",
"pageForRequest",
"(",
"client",
",",
"request",
")",
";",
"}"
] | Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page | [
"Retrieve",
"the",
"previous",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/fax/v1/fax/FaxMediaReader.java#L114-L125 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/io/UrlIO.java | UrlIO.addRequestProperty | @Scope(DocScope.IO)
public UrlIO addRequestProperty(final String name, final String value) {
"""
Allows to add a single request property.
@param name
@param value
@return this for convenience.
"""
requestProperties.put(name, value);
return this;
} | java | @Scope(DocScope.IO)
public UrlIO addRequestProperty(final String name, final String value) {
requestProperties.put(name, value);
return this;
} | [
"@",
"Scope",
"(",
"DocScope",
".",
"IO",
")",
"public",
"UrlIO",
"addRequestProperty",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"requestProperties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Allows to add a single request property.
@param name
@param value
@return this for convenience. | [
"Allows",
"to",
"add",
"a",
"single",
"request",
"property",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/io/UrlIO.java#L111-L115 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java | FindElementAction.validateElementProperty | private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
"""
Validates web element property value with validation matcher support.
@param propertyName
@param controlValue
@param resultValue
@param context
"""
if (StringUtils.hasText(controlValue)) {
String control = context.replaceDynamicContentInString(controlValue);
if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
} else {
Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
}
}
} | java | private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
if (StringUtils.hasText(controlValue)) {
String control = context.replaceDynamicContentInString(controlValue);
if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
} else {
Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
}
}
} | [
"private",
"void",
"validateElementProperty",
"(",
"String",
"propertyName",
",",
"String",
"controlValue",
",",
"String",
"resultValue",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"controlValue",
")",
")",
"{",
"String",
"control",
"=",
"context",
".",
"replaceDynamicContentInString",
"(",
"controlValue",
")",
";",
"if",
"(",
"ValidationMatcherUtils",
".",
"isValidationMatcherExpression",
"(",
"control",
")",
")",
"{",
"ValidationMatcherUtils",
".",
"resolveValidationMatcher",
"(",
"\"payload\"",
",",
"resultValue",
",",
"control",
",",
"context",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"control",
".",
"equals",
"(",
"resultValue",
")",
",",
"String",
".",
"format",
"(",
"\"Selenium web element validation failed, %s expected '%s', but was '%s'\"",
",",
"propertyName",
",",
"control",
",",
"resultValue",
")",
")",
";",
"}",
"}",
"}"
] | Validates web element property value with validation matcher support.
@param propertyName
@param controlValue
@param resultValue
@param context | [
"Validates",
"web",
"element",
"property",
"value",
"with",
"validation",
"matcher",
"support",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L114-L124 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/common/Checksums.java | Checksums.calculateMod10CheckSum | public static int calculateMod10CheckSum(int[] weights, StringNumber number) {
"""
Calculate the check sum for the given weights and number.
@param weights The weights
@param number The number
@return The checksum
"""
int c = calculateChecksum(weights, number, true) % 10;
return c == 0 ? 0 : 10 - c;
} | java | public static int calculateMod10CheckSum(int[] weights, StringNumber number) {
int c = calculateChecksum(weights, number, true) % 10;
return c == 0 ? 0 : 10 - c;
} | [
"public",
"static",
"int",
"calculateMod10CheckSum",
"(",
"int",
"[",
"]",
"weights",
",",
"StringNumber",
"number",
")",
"{",
"int",
"c",
"=",
"calculateChecksum",
"(",
"weights",
",",
"number",
",",
"true",
")",
"%",
"10",
";",
"return",
"c",
"==",
"0",
"?",
"0",
":",
"10",
"-",
"c",
";",
"}"
] | Calculate the check sum for the given weights and number.
@param weights The weights
@param number The number
@return The checksum | [
"Calculate",
"the",
"check",
"sum",
"for",
"the",
"given",
"weights",
"and",
"number",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/common/Checksums.java#L29-L32 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java | RichClientFramework.isEqual | private boolean isEqual(Object o1, Object o2) {
"""
Compares two objects. Returns false if one is null but the other isn't, returns true if both
are null, otherwise returns the result of their equals() method.
@param o1
@param o2
@return Returns true if o1 and o2 are equal.
"""
// Both null - they are equal
if (o1 == null && o2 == null)
{
return true;
}
// One is null and the other isn't - they are not equal
if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
{
return false;
}
// Otherwise fight it out amongst themselves
return o1.equals(o2);
} | java | private boolean isEqual(Object o1, Object o2)
{
// Both null - they are equal
if (o1 == null && o2 == null)
{
return true;
}
// One is null and the other isn't - they are not equal
if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
{
return false;
}
// Otherwise fight it out amongst themselves
return o1.equals(o2);
} | [
"private",
"boolean",
"isEqual",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"// Both null - they are equal",
"if",
"(",
"o1",
"==",
"null",
"&&",
"o2",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"// One is null and the other isn't - they are not equal",
"if",
"(",
"(",
"o1",
"==",
"null",
"&&",
"o2",
"!=",
"null",
")",
"||",
"(",
"o1",
"!=",
"null",
"&&",
"o2",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Otherwise fight it out amongst themselves",
"return",
"o1",
".",
"equals",
"(",
"o2",
")",
";",
"}"
] | Compares two objects. Returns false if one is null but the other isn't, returns true if both
are null, otherwise returns the result of their equals() method.
@param o1
@param o2
@return Returns true if o1 and o2 are equal. | [
"Compares",
"two",
"objects",
".",
"Returns",
"false",
"if",
"one",
"is",
"null",
"but",
"the",
"other",
"isn",
"t",
"returns",
"true",
"if",
"both",
"are",
"null",
"otherwise",
"returns",
"the",
"result",
"of",
"their",
"equals",
"()",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java#L638-L653 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java | TransactionEventListener.addMeterValuesToTransaction | private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) {
"""
Adds the {@code List} of {@code MeterValue}s to the {@code Transaction}.
@param transaction the {@code Transaction} to which to add the {@code MeterValue}s.
@param meterValues the {@code List} of {@code MeterValue}s to add.
"""
for (MeterValue meterValue : meterValues) {
addMeterValueToTransaction(transaction, meterValue);
}
} | java | private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) {
for (MeterValue meterValue : meterValues) {
addMeterValueToTransaction(transaction, meterValue);
}
} | [
"private",
"void",
"addMeterValuesToTransaction",
"(",
"final",
"Transaction",
"transaction",
",",
"final",
"List",
"<",
"MeterValue",
">",
"meterValues",
")",
"{",
"for",
"(",
"MeterValue",
"meterValue",
":",
"meterValues",
")",
"{",
"addMeterValueToTransaction",
"(",
"transaction",
",",
"meterValue",
")",
";",
"}",
"}"
] | Adds the {@code List} of {@code MeterValue}s to the {@code Transaction}.
@param transaction the {@code Transaction} to which to add the {@code MeterValue}s.
@param meterValues the {@code List} of {@code MeterValue}s to add. | [
"Adds",
"the",
"{",
"@code",
"List",
"}",
"of",
"{",
"@code",
"MeterValue",
"}",
"s",
"to",
"the",
"{",
"@code",
"Transaction",
"}",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java#L87-L91 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java | FindingReplacing.setBetnNext | public AsymmMultiPos<S, String, String> setBetnNext(String leftSameWithRight) {
"""
Sets the substrings in given same left tag and right tag as the result string, Adjacent tag matches
<p><b>The look result same as {@link StrMatcher#finder()}'s behavior</b>
@see StrMatcher#finder()
@param leftSameWithRight
@return
"""
return new AsymmMultiPos<S, String, String>(leftSameWithRight, leftSameWithRight) {
@Override protected S result() {
if (Strs.isEmpty(asymmLR)) {
return delegateQueue('N', left, right, pos, position, inclusive, plusminus, filltgt);
} else { return delegateQueue('Z', left, left, pos, asymmLR, inclusive, plusminus, filltgt); }
}
};
} | java | public AsymmMultiPos<S, String, String> setBetnNext(String leftSameWithRight) {
return new AsymmMultiPos<S, String, String>(leftSameWithRight, leftSameWithRight) {
@Override protected S result() {
if (Strs.isEmpty(asymmLR)) {
return delegateQueue('N', left, right, pos, position, inclusive, plusminus, filltgt);
} else { return delegateQueue('Z', left, left, pos, asymmLR, inclusive, plusminus, filltgt); }
}
};
} | [
"public",
"AsymmMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"setBetnNext",
"(",
"String",
"leftSameWithRight",
")",
"{",
"return",
"new",
"AsymmMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"(",
"leftSameWithRight",
",",
"leftSameWithRight",
")",
"{",
"@",
"Override",
"protected",
"S",
"result",
"(",
")",
"{",
"if",
"(",
"Strs",
".",
"isEmpty",
"(",
"asymmLR",
")",
")",
"{",
"return",
"delegateQueue",
"(",
"'",
"'",
",",
"left",
",",
"right",
",",
"pos",
",",
"position",
",",
"inclusive",
",",
"plusminus",
",",
"filltgt",
")",
";",
"}",
"else",
"{",
"return",
"delegateQueue",
"(",
"'",
"'",
",",
"left",
",",
"left",
",",
"pos",
",",
"asymmLR",
",",
"inclusive",
",",
"plusminus",
",",
"filltgt",
")",
";",
"}",
"}",
"}",
";",
"}"
] | Sets the substrings in given same left tag and right tag as the result string, Adjacent tag matches
<p><b>The look result same as {@link StrMatcher#finder()}'s behavior</b>
@see StrMatcher#finder()
@param leftSameWithRight
@return | [
"Sets",
"the",
"substrings",
"in",
"given",
"same",
"left",
"tag",
"and",
"right",
"tag",
"as",
"the",
"result",
"string",
"Adjacent",
"tag",
"matches",
"<p",
">",
"<b",
">",
"The",
"look",
"result",
"same",
"as",
"{",
"@link",
"StrMatcher#finder",
"()",
"}",
"s",
"behavior<",
"/",
"b",
">"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L454-L463 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.completeTransfer | public ApiSuccessResponse completeTransfer(String id, CompleteTransferData completeTransferData) throws ApiException {
"""
Complete a transfer
Complete a previously initiated two-step transfer using the provided IDs.
@param id The connection ID of the consult call (established). (required)
@param completeTransferData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = completeTransferWithHttpInfo(id, completeTransferData);
return resp.getData();
} | java | public ApiSuccessResponse completeTransfer(String id, CompleteTransferData completeTransferData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = completeTransferWithHttpInfo(id, completeTransferData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"completeTransfer",
"(",
"String",
"id",
",",
"CompleteTransferData",
"completeTransferData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"completeTransferWithHttpInfo",
"(",
"id",
",",
"completeTransferData",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Complete a transfer
Complete a previously initiated two-step transfer using the provided IDs.
@param id The connection ID of the consult call (established). (required)
@param completeTransferData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Complete",
"a",
"transfer",
"Complete",
"a",
"previously",
"initiated",
"two",
"-",
"step",
"transfer",
"using",
"the",
"provided",
"IDs",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1079-L1082 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/BillingApi.java | BillingApi.updatePlan | public BillingPlanUpdateResponse updatePlan(String accountId, BillingPlanInformation billingPlanInformation) throws ApiException {
"""
Updates the account billing plan.
Updates the billing plan information, billing address, and credit card information for the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param billingPlanInformation (optional)
@return BillingPlanUpdateResponse
"""
return updatePlan(accountId, billingPlanInformation, null);
} | java | public BillingPlanUpdateResponse updatePlan(String accountId, BillingPlanInformation billingPlanInformation) throws ApiException {
return updatePlan(accountId, billingPlanInformation, null);
} | [
"public",
"BillingPlanUpdateResponse",
"updatePlan",
"(",
"String",
"accountId",
",",
"BillingPlanInformation",
"billingPlanInformation",
")",
"throws",
"ApiException",
"{",
"return",
"updatePlan",
"(",
"accountId",
",",
"billingPlanInformation",
",",
"null",
")",
";",
"}"
] | Updates the account billing plan.
Updates the billing plan information, billing address, and credit card information for the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param billingPlanInformation (optional)
@return BillingPlanUpdateResponse | [
"Updates",
"the",
"account",
"billing",
"plan",
".",
"Updates",
"the",
"billing",
"plan",
"information",
"billing",
"address",
"and",
"credit",
"card",
"information",
"for",
"the",
"specified",
"account",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/BillingApi.java#L692-L694 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.hincrBy | public Long hincrBy(Object key, Object field, long value) {
"""
为哈希表 key 中的域 field 的值加上增量 increment 。
增量也可以为负数,相当于对给定域进行减法操作。
如果 key 不存在,一个新的哈希表被创建并执行 HINCRBY 命令。
如果域 field 不存在,那么在执行命令前,域的值被初始化为 0 。
对一个储存字符串值的域 field 执行 HINCRBY 命令将造成一个错误。
本操作的值被限制在 64 位(bit)有符号数字表示之内。
"""
Jedis jedis = getJedis();
try {
return jedis.hincrBy(keyToBytes(key), fieldToBytes(field), value);
}
finally {close(jedis);}
} | java | public Long hincrBy(Object key, Object field, long value) {
Jedis jedis = getJedis();
try {
return jedis.hincrBy(keyToBytes(key), fieldToBytes(field), value);
}
finally {close(jedis);}
} | [
"public",
"Long",
"hincrBy",
"(",
"Object",
"key",
",",
"Object",
"field",
",",
"long",
"value",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"return",
"jedis",
".",
"hincrBy",
"(",
"keyToBytes",
"(",
"key",
")",
",",
"fieldToBytes",
"(",
"field",
")",
",",
"value",
")",
";",
"}",
"finally",
"{",
"close",
"(",
"jedis",
")",
";",
"}",
"}"
] | 为哈希表 key 中的域 field 的值加上增量 increment 。
增量也可以为负数,相当于对给定域进行减法操作。
如果 key 不存在,一个新的哈希表被创建并执行 HINCRBY 命令。
如果域 field 不存在,那么在执行命令前,域的值被初始化为 0 。
对一个储存字符串值的域 field 执行 HINCRBY 命令将造成一个错误。
本操作的值被限制在 64 位(bit)有符号数字表示之内。 | [
"为哈希表",
"key",
"中的域",
"field",
"的值加上增量",
"increment",
"。",
"增量也可以为负数,相当于对给定域进行减法操作。",
"如果",
"key",
"不存在,一个新的哈希表被创建并执行",
"HINCRBY",
"命令。",
"如果域",
"field",
"不存在,那么在执行命令前,域的值被初始化为",
"0",
"。",
"对一个储存字符串值的域",
"field",
"执行",
"HINCRBY",
"命令将造成一个错误。",
"本操作的值被限制在",
"64",
"位",
"(",
"bit",
")",
"有符号数字表示之内。"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L580-L586 |
sdl/Testy | src/main/java/com/sdl/selenium/extjs3/grid/GridPanel.java | GridPanel.getRowIndex | public int getRowIndex(String searchElement, int startRowIndex) {
"""
this method is working only for normal grids (no buffer views), and first page if grid has buffer view
"""
int index = -1;
if (ready()) {
String path = getGridCell(startRowIndex).getXPath();
WebLocator currentElement = new WebLocator().setElPath(path);
while (currentElement.isElementPresent()) {
String option = currentElement.getText();
//LOGGER.debug("row[" + i + "]" + option);
if (option != null && option.contains(searchElement)) {
LOGGER.debug("The '" + searchElement + "' element index is " + startRowIndex);
index = startRowIndex;
break;
}
startRowIndex++;
path = getGridCell(startRowIndex).getXPath();
currentElement.setElPath(path);
}
if (index == -1) {
LOGGER.warn("The element '" + searchElement + "' was not found.");
}
} else {
LOGGER.warn("getRowIndex : grid is not ready for use: " + toString());
}
return index;
} | java | public int getRowIndex(String searchElement, int startRowIndex) {
int index = -1;
if (ready()) {
String path = getGridCell(startRowIndex).getXPath();
WebLocator currentElement = new WebLocator().setElPath(path);
while (currentElement.isElementPresent()) {
String option = currentElement.getText();
//LOGGER.debug("row[" + i + "]" + option);
if (option != null && option.contains(searchElement)) {
LOGGER.debug("The '" + searchElement + "' element index is " + startRowIndex);
index = startRowIndex;
break;
}
startRowIndex++;
path = getGridCell(startRowIndex).getXPath();
currentElement.setElPath(path);
}
if (index == -1) {
LOGGER.warn("The element '" + searchElement + "' was not found.");
}
} else {
LOGGER.warn("getRowIndex : grid is not ready for use: " + toString());
}
return index;
} | [
"public",
"int",
"getRowIndex",
"(",
"String",
"searchElement",
",",
"int",
"startRowIndex",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"ready",
"(",
")",
")",
"{",
"String",
"path",
"=",
"getGridCell",
"(",
"startRowIndex",
")",
".",
"getXPath",
"(",
")",
";",
"WebLocator",
"currentElement",
"=",
"new",
"WebLocator",
"(",
")",
".",
"setElPath",
"(",
"path",
")",
";",
"while",
"(",
"currentElement",
".",
"isElementPresent",
"(",
")",
")",
"{",
"String",
"option",
"=",
"currentElement",
".",
"getText",
"(",
")",
";",
"//LOGGER.debug(\"row[\" + i + \"]\" + option);",
"if",
"(",
"option",
"!=",
"null",
"&&",
"option",
".",
"contains",
"(",
"searchElement",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"The '\"",
"+",
"searchElement",
"+",
"\"' element index is \"",
"+",
"startRowIndex",
")",
";",
"index",
"=",
"startRowIndex",
";",
"break",
";",
"}",
"startRowIndex",
"++",
";",
"path",
"=",
"getGridCell",
"(",
"startRowIndex",
")",
".",
"getXPath",
"(",
")",
";",
"currentElement",
".",
"setElPath",
"(",
"path",
")",
";",
"}",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"The element '\"",
"+",
"searchElement",
"+",
"\"' was not found.\"",
")",
";",
"}",
"}",
"else",
"{",
"LOGGER",
".",
"warn",
"(",
"\"getRowIndex : grid is not ready for use: \"",
"+",
"toString",
"(",
")",
")",
";",
"}",
"return",
"index",
";",
"}"
] | this method is working only for normal grids (no buffer views), and first page if grid has buffer view | [
"this",
"method",
"is",
"working",
"only",
"for",
"normal",
"grids",
"(",
"no",
"buffer",
"views",
")",
"and",
"first",
"page",
"if",
"grid",
"has",
"buffer",
"view"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs3/grid/GridPanel.java#L394-L418 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java | MCMPHandler.checkHostUp | protected void checkHostUp(final String scheme, final String host, final int port, final HttpServerExchange exchange, final NodePingUtil.PingCallback callback) {
"""
Check whether a host is up.
@param scheme the scheme
@param host the host
@param port the port
@param exchange the http server exchange
@param callback the ping callback
"""
final XnioSsl xnioSsl = null; // TODO
final OptionMap options = OptionMap.builder()
.set(Options.TCP_NODELAY, true)
.getMap();
try {
// http, ajp and maybe more in future
if ("ajp".equalsIgnoreCase(scheme) || "http".equalsIgnoreCase(scheme)) {
final URI uri = new URI(scheme, null, host, port, "/", null, null);
NodePingUtil.pingHttpClient(uri, callback, exchange, container.getClient(), xnioSsl, options);
} else {
final InetSocketAddress address = new InetSocketAddress(host, port);
NodePingUtil.pingHost(address, exchange, callback, options);
}
} catch (URISyntaxException e) {
callback.failed();
}
} | java | protected void checkHostUp(final String scheme, final String host, final int port, final HttpServerExchange exchange, final NodePingUtil.PingCallback callback) {
final XnioSsl xnioSsl = null; // TODO
final OptionMap options = OptionMap.builder()
.set(Options.TCP_NODELAY, true)
.getMap();
try {
// http, ajp and maybe more in future
if ("ajp".equalsIgnoreCase(scheme) || "http".equalsIgnoreCase(scheme)) {
final URI uri = new URI(scheme, null, host, port, "/", null, null);
NodePingUtil.pingHttpClient(uri, callback, exchange, container.getClient(), xnioSsl, options);
} else {
final InetSocketAddress address = new InetSocketAddress(host, port);
NodePingUtil.pingHost(address, exchange, callback, options);
}
} catch (URISyntaxException e) {
callback.failed();
}
} | [
"protected",
"void",
"checkHostUp",
"(",
"final",
"String",
"scheme",
",",
"final",
"String",
"host",
",",
"final",
"int",
"port",
",",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"NodePingUtil",
".",
"PingCallback",
"callback",
")",
"{",
"final",
"XnioSsl",
"xnioSsl",
"=",
"null",
";",
"// TODO",
"final",
"OptionMap",
"options",
"=",
"OptionMap",
".",
"builder",
"(",
")",
".",
"set",
"(",
"Options",
".",
"TCP_NODELAY",
",",
"true",
")",
".",
"getMap",
"(",
")",
";",
"try",
"{",
"// http, ajp and maybe more in future",
"if",
"(",
"\"ajp\"",
".",
"equalsIgnoreCase",
"(",
"scheme",
")",
"||",
"\"http\"",
".",
"equalsIgnoreCase",
"(",
"scheme",
")",
")",
"{",
"final",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"scheme",
",",
"null",
",",
"host",
",",
"port",
",",
"\"/\"",
",",
"null",
",",
"null",
")",
";",
"NodePingUtil",
".",
"pingHttpClient",
"(",
"uri",
",",
"callback",
",",
"exchange",
",",
"container",
".",
"getClient",
"(",
")",
",",
"xnioSsl",
",",
"options",
")",
";",
"}",
"else",
"{",
"final",
"InetSocketAddress",
"address",
"=",
"new",
"InetSocketAddress",
"(",
"host",
",",
"port",
")",
";",
"NodePingUtil",
".",
"pingHost",
"(",
"address",
",",
"exchange",
",",
"callback",
",",
"options",
")",
";",
"}",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"callback",
".",
"failed",
"(",
")",
";",
"}",
"}"
] | Check whether a host is up.
@param scheme the scheme
@param host the host
@param port the port
@param exchange the http server exchange
@param callback the ping callback | [
"Check",
"whether",
"a",
"host",
"is",
"up",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java#L682-L701 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updateEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateEntityRoleOptionalParameter updateEntityRoleOptionalParameter) {
"""
Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateEntityRoleOptionalParameter != null ? updateEntityRoleOptionalParameter.name() : null;
return updateEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | java | public Observable<ServiceResponse<OperationStatus>> updateEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateEntityRoleOptionalParameter updateEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateEntityRoleOptionalParameter != null ? updateEntityRoleOptionalParameter.name() : null;
return updateEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updateEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdateEntityRoleOptionalParameter",
"updateEntityRoleOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"versionId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter versionId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"entityId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter entityId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"roleId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter roleId is required and cannot be null.\"",
")",
";",
"}",
"final",
"String",
"name",
"=",
"updateEntityRoleOptionalParameter",
"!=",
"null",
"?",
"updateEntityRoleOptionalParameter",
".",
"name",
"(",
")",
":",
"null",
";",
"return",
"updateEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
"roleId",
",",
"name",
")",
";",
"}"
] | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10893-L10912 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MessageAPI.java | MessageAPI.messageMassPreview | public static MessageSendResult messageMassPreview(String access_token, Preview preview) {
"""
预览接口
@param access_token access_token
@param preview preview
@return MessageSendResult
@since 2.6.3
"""
String previewJson = JsonUtil.toJSONString(preview);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/message/mass/preview")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(previewJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class);
} | java | public static MessageSendResult messageMassPreview(String access_token, Preview preview) {
String previewJson = JsonUtil.toJSONString(preview);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/message/mass/preview")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(previewJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class);
} | [
"public",
"static",
"MessageSendResult",
"messageMassPreview",
"(",
"String",
"access_token",
",",
"Preview",
"preview",
")",
"{",
"String",
"previewJson",
"=",
"JsonUtil",
".",
"toJSONString",
"(",
"preview",
")",
";",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"post",
"(",
")",
".",
"setHeader",
"(",
"jsonHeader",
")",
".",
"setUri",
"(",
"BASE_URI",
"+",
"\"/cgi-bin/message/mass/preview\"",
")",
".",
"addParameter",
"(",
"PARAM_ACCESS_TOKEN",
",",
"API",
".",
"accessToken",
"(",
"access_token",
")",
")",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"previewJson",
",",
"Charset",
".",
"forName",
"(",
"\"utf-8\"",
")",
")",
")",
".",
"build",
"(",
")",
";",
"return",
"LocalHttpClient",
".",
"executeJsonResult",
"(",
"httpUriRequest",
",",
"MessageSendResult",
".",
"class",
")",
";",
"}"
] | 预览接口
@param access_token access_token
@param preview preview
@return MessageSendResult
@since 2.6.3 | [
"预览接口"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MessageAPI.java#L234-L243 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/ObjectIdentifier.java | ObjectIdentifier.verifyNonEmpty | protected static String verifyNonEmpty(String value, String argName) {
"""
Verifies a value is null or empty. Returns the value if non-empty and throws exception if empty.
@param value the value to verify.
@param argName the name of the value.
@return Returns the value if non-empty.
"""
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
value = null;
}
}
if (value == null) {
throw new IllegalArgumentException(argName);
}
return value;
} | java | protected static String verifyNonEmpty(String value, String argName) {
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
value = null;
}
}
if (value == null) {
throw new IllegalArgumentException(argName);
}
return value;
} | [
"protected",
"static",
"String",
"verifyNonEmpty",
"(",
"String",
"value",
",",
"String",
"argName",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"if",
"(",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"value",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"argName",
")",
";",
"}",
"return",
"value",
";",
"}"
] | Verifies a value is null or empty. Returns the value if non-empty and throws exception if empty.
@param value the value to verify.
@param argName the name of the value.
@return Returns the value if non-empty. | [
"Verifies",
"a",
"value",
"is",
"null",
"or",
"empty",
".",
"Returns",
"the",
"value",
"if",
"non",
"-",
"empty",
"and",
"throws",
"exception",
"if",
"empty",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/ObjectIdentifier.java#L52-L63 |
js-lib-com/commons | src/main/java/js/util/TextTemplate.java | TextTemplate.put | public void put(String name, Object value) {
"""
Set variables value. If variable name already exists its value is overridden. Convert variable value to string before
storing to variables map. Null is not accepted for either variable name or its value.
<p>
This method uses {@link Converter} to convert variable value to string. If there is no converter able to handle given
variable value type this method rise exception.
@param name variable name,
@param value variable value.
@throws IllegalArgumentException if variable name is null or empty or value is null.
@throws ConverterException if there is no converter able to handle given value type.
"""
Params.notNullOrEmpty(name, "Variable name");
Params.notNull(value, "Variable %s value", name);
variables.put(name, ConverterRegistry.getConverter().asString(value));
} | java | public void put(String name, Object value) {
Params.notNullOrEmpty(name, "Variable name");
Params.notNull(value, "Variable %s value", name);
variables.put(name, ConverterRegistry.getConverter().asString(value));
} | [
"public",
"void",
"put",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"Params",
".",
"notNullOrEmpty",
"(",
"name",
",",
"\"Variable name\"",
")",
";",
"Params",
".",
"notNull",
"(",
"value",
",",
"\"Variable %s value\"",
",",
"name",
")",
";",
"variables",
".",
"put",
"(",
"name",
",",
"ConverterRegistry",
".",
"getConverter",
"(",
")",
".",
"asString",
"(",
"value",
")",
")",
";",
"}"
] | Set variables value. If variable name already exists its value is overridden. Convert variable value to string before
storing to variables map. Null is not accepted for either variable name or its value.
<p>
This method uses {@link Converter} to convert variable value to string. If there is no converter able to handle given
variable value type this method rise exception.
@param name variable name,
@param value variable value.
@throws IllegalArgumentException if variable name is null or empty or value is null.
@throws ConverterException if there is no converter able to handle given value type. | [
"Set",
"variables",
"value",
".",
"If",
"variable",
"name",
"already",
"exists",
"its",
"value",
"is",
"overridden",
".",
"Convert",
"variable",
"value",
"to",
"string",
"before",
"storing",
"to",
"variables",
"map",
".",
"Null",
"is",
"not",
"accepted",
"for",
"either",
"variable",
"name",
"or",
"its",
"value",
".",
"<p",
">",
"This",
"method",
"uses",
"{",
"@link",
"Converter",
"}",
"to",
"convert",
"variable",
"value",
"to",
"string",
".",
"If",
"there",
"is",
"no",
"converter",
"able",
"to",
"handle",
"given",
"variable",
"value",
"type",
"this",
"method",
"rise",
"exception",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/TextTemplate.java#L65-L69 |
mbenson/therian | core/src/main/java/therian/util/Types.java | Types.resolveAt | public static Type resolveAt(Object o, TypeVariable<?> var) {
"""
Tries to "read" a {@link TypeVariable} from an object instance, taking into account {@link BindTypeVariable} and
{@link Typed} before falling back to basic type
@param o
@param var
@return Type resolved or {@code null}
"""
Validate.notNull(var, "no variable to read");
final GenericDeclaration genericDeclaration = var.getGenericDeclaration();
Validate.isInstanceOf(Class.class, genericDeclaration, "%s is not declared by a Class",
TypeUtils.toLongString(var));
return resolveAt(o, var, TypeUtils.getTypeArguments(o.getClass(), (Class<?>) genericDeclaration));
} | java | public static Type resolveAt(Object o, TypeVariable<?> var) {
Validate.notNull(var, "no variable to read");
final GenericDeclaration genericDeclaration = var.getGenericDeclaration();
Validate.isInstanceOf(Class.class, genericDeclaration, "%s is not declared by a Class",
TypeUtils.toLongString(var));
return resolveAt(o, var, TypeUtils.getTypeArguments(o.getClass(), (Class<?>) genericDeclaration));
} | [
"public",
"static",
"Type",
"resolveAt",
"(",
"Object",
"o",
",",
"TypeVariable",
"<",
"?",
">",
"var",
")",
"{",
"Validate",
".",
"notNull",
"(",
"var",
",",
"\"no variable to read\"",
")",
";",
"final",
"GenericDeclaration",
"genericDeclaration",
"=",
"var",
".",
"getGenericDeclaration",
"(",
")",
";",
"Validate",
".",
"isInstanceOf",
"(",
"Class",
".",
"class",
",",
"genericDeclaration",
",",
"\"%s is not declared by a Class\"",
",",
"TypeUtils",
".",
"toLongString",
"(",
"var",
")",
")",
";",
"return",
"resolveAt",
"(",
"o",
",",
"var",
",",
"TypeUtils",
".",
"getTypeArguments",
"(",
"o",
".",
"getClass",
"(",
")",
",",
"(",
"Class",
"<",
"?",
">",
")",
"genericDeclaration",
")",
")",
";",
"}"
] | Tries to "read" a {@link TypeVariable} from an object instance, taking into account {@link BindTypeVariable} and
{@link Typed} before falling back to basic type
@param o
@param var
@return Type resolved or {@code null} | [
"Tries",
"to",
"read",
"a",
"{",
"@link",
"TypeVariable",
"}",
"from",
"an",
"object",
"instance",
"taking",
"into",
"account",
"{",
"@link",
"BindTypeVariable",
"}",
"and",
"{",
"@link",
"Typed",
"}",
"before",
"falling",
"back",
"to",
"basic",
"type"
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Types.java#L94-L100 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.matchConditionCount | public SDVariable matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, int... dimensions) {
"""
Returns a count of the number of elements that satisfy the condition (for each slice along the specified dimensions)<br>
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
the mean along a dimension).<br>
Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
keepDims = true: [a,1,c]<br>
keepDims = false: [a,c]
@param name Name of the output variable
@param in Input variable
@param condition Condition
@param keepDim If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Number of elements that the condition is satisfied for
"""
SDVariable ret = f().matchConditionCount(in, condition, keepDim, dimensions);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, int... dimensions) {
SDVariable ret = f().matchConditionCount(in, condition, keepDim, dimensions);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"matchConditionCount",
"(",
"String",
"name",
",",
"SDVariable",
"in",
",",
"Condition",
"condition",
",",
"boolean",
"keepDim",
",",
"int",
"...",
"dimensions",
")",
"{",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"matchConditionCount",
"(",
"in",
",",
"condition",
",",
"keepDim",
",",
"dimensions",
")",
";",
"return",
"updateVariableNameAndReference",
"(",
"ret",
",",
"name",
")",
";",
"}"
] | Returns a count of the number of elements that satisfy the condition (for each slice along the specified dimensions)<br>
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
the mean along a dimension).<br>
Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
keepDims = true: [a,1,c]<br>
keepDims = false: [a,c]
@param name Name of the output variable
@param in Input variable
@param condition Condition
@param keepDim If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Number of elements that the condition is satisfied for | [
"Returns",
"a",
"count",
"of",
"the",
"number",
"of",
"elements",
"that",
"satisfy",
"the",
"condition",
"(",
"for",
"each",
"slice",
"along",
"the",
"specified",
"dimensions",
")",
"<br",
">",
"Note",
"that",
"if",
"keepDims",
"=",
"true",
"the",
"output",
"variable",
"has",
"the",
"same",
"rank",
"as",
"the",
"input",
"variable",
"with",
"the",
"reduced",
"dimensions",
"having",
"size",
"1",
".",
"This",
"can",
"be",
"useful",
"for",
"later",
"broadcast",
"operations",
"(",
"such",
"as",
"subtracting",
"the",
"mean",
"along",
"a",
"dimension",
")",
".",
"<br",
">",
"Example",
":",
"if",
"input",
"has",
"shape",
"[",
"a",
"b",
"c",
"]",
"and",
"dimensions",
"=",
"[",
"1",
"]",
"then",
"output",
"has",
"shape",
":",
"keepDims",
"=",
"true",
":",
"[",
"a",
"1",
"c",
"]",
"<br",
">",
"keepDims",
"=",
"false",
":",
"[",
"a",
"c",
"]"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1029-L1032 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/SearchIndex.java | SearchIndex.findByDatastorePath | public VirtualMachine findByDatastorePath(Datacenter datacenter, String dPath) throws InvalidDatastore, RuntimeFault, RemoteException {
"""
Find a VM by its location on a datastore
@param datacenter The datacenter within which it searches.
@param dPath The datastore path, for example, "[storage1] WinXP/WinXP.vmx".
@return A VirtualMachine that pointed by the dPath
@throws RemoteException
@throws RuntimeFault
@throws InvalidDatastore
"""
if (datacenter == null) {
throw new IllegalArgumentException("datacenter must not be null.");
}
ManagedObjectReference mor = getVimService().findByDatastorePath(getMOR(), datacenter.getMOR(), dPath);
return (VirtualMachine) MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | java | public VirtualMachine findByDatastorePath(Datacenter datacenter, String dPath) throws InvalidDatastore, RuntimeFault, RemoteException {
if (datacenter == null) {
throw new IllegalArgumentException("datacenter must not be null.");
}
ManagedObjectReference mor = getVimService().findByDatastorePath(getMOR(), datacenter.getMOR(), dPath);
return (VirtualMachine) MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | [
"public",
"VirtualMachine",
"findByDatastorePath",
"(",
"Datacenter",
"datacenter",
",",
"String",
"dPath",
")",
"throws",
"InvalidDatastore",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"if",
"(",
"datacenter",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"datacenter must not be null.\"",
")",
";",
"}",
"ManagedObjectReference",
"mor",
"=",
"getVimService",
"(",
")",
".",
"findByDatastorePath",
"(",
"getMOR",
"(",
")",
",",
"datacenter",
".",
"getMOR",
"(",
")",
",",
"dPath",
")",
";",
"return",
"(",
"VirtualMachine",
")",
"MorUtil",
".",
"createExactManagedEntity",
"(",
"getServerConnection",
"(",
")",
",",
"mor",
")",
";",
"}"
] | Find a VM by its location on a datastore
@param datacenter The datacenter within which it searches.
@param dPath The datastore path, for example, "[storage1] WinXP/WinXP.vmx".
@return A VirtualMachine that pointed by the dPath
@throws RemoteException
@throws RuntimeFault
@throws InvalidDatastore | [
"Find",
"a",
"VM",
"by",
"its",
"location",
"on",
"a",
"datastore"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/SearchIndex.java#L132-L139 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.vps_serviceName_additionalDisk_GET | public ArrayList<String> vps_serviceName_additionalDisk_GET(String serviceName, OvhAdditionalDiskSizeEnum additionalDiskSize) throws IOException {
"""
Get allowed durations for 'additionalDisk' option
REST: GET /order/vps/{serviceName}/additionalDisk
@param additionalDiskSize [required] Size of the additional disk
@param serviceName [required] The internal name of your VPS offer
"""
String qPath = "/order/vps/{serviceName}/additionalDisk";
StringBuilder sb = path(qPath, serviceName);
query(sb, "additionalDiskSize", additionalDiskSize);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> vps_serviceName_additionalDisk_GET(String serviceName, OvhAdditionalDiskSizeEnum additionalDiskSize) throws IOException {
String qPath = "/order/vps/{serviceName}/additionalDisk";
StringBuilder sb = path(qPath, serviceName);
query(sb, "additionalDiskSize", additionalDiskSize);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"vps_serviceName_additionalDisk_GET",
"(",
"String",
"serviceName",
",",
"OvhAdditionalDiskSizeEnum",
"additionalDiskSize",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/vps/{serviceName}/additionalDisk\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"additionalDiskSize\"",
",",
"additionalDiskSize",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Get allowed durations for 'additionalDisk' option
REST: GET /order/vps/{serviceName}/additionalDisk
@param additionalDiskSize [required] Size of the additional disk
@param serviceName [required] The internal name of your VPS offer | [
"Get",
"allowed",
"durations",
"for",
"additionalDisk",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3586-L3592 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/errors/ApplicationException.java | ApplicationException.withDetails | public ApplicationException withDetails(String key, Object value) {
"""
Sets a parameter for additional error details. This details can be used to
restore error description in other languages.
This method returns reference to this exception to implement Builder pattern
to chain additional calls.
@param key a details parameter name
@param value a details parameter name
@return this exception object
"""
_details = _details != null ? _details : new StringValueMap();
_details.setAsObject(key, value);
return this;
} | java | public ApplicationException withDetails(String key, Object value) {
_details = _details != null ? _details : new StringValueMap();
_details.setAsObject(key, value);
return this;
} | [
"public",
"ApplicationException",
"withDetails",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"_details",
"=",
"_details",
"!=",
"null",
"?",
"_details",
":",
"new",
"StringValueMap",
"(",
")",
";",
"_details",
".",
"setAsObject",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets a parameter for additional error details. This details can be used to
restore error description in other languages.
This method returns reference to this exception to implement Builder pattern
to chain additional calls.
@param key a details parameter name
@param value a details parameter name
@return this exception object | [
"Sets",
"a",
"parameter",
"for",
"additional",
"error",
"details",
".",
"This",
"details",
"can",
"be",
"used",
"to",
"restore",
"error",
"description",
"in",
"other",
"languages",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/errors/ApplicationException.java#L240-L244 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java | Util.isSameType | public static boolean isSameType(@Nonnull TypeMirror t1, @Nonnull TypeMirror t2) {
"""
To be used to compare types from different compilations (which are not comparable by standard means in Types).
This just compares the type names.
@param t1 first type
@param t2 second type
@return true if the types have the same fqn, false otherwise
"""
String t1Name = toUniqueString(t1);
String t2Name = toUniqueString(t2);
return t1Name.equals(t2Name);
} | java | public static boolean isSameType(@Nonnull TypeMirror t1, @Nonnull TypeMirror t2) {
String t1Name = toUniqueString(t1);
String t2Name = toUniqueString(t2);
return t1Name.equals(t2Name);
} | [
"public",
"static",
"boolean",
"isSameType",
"(",
"@",
"Nonnull",
"TypeMirror",
"t1",
",",
"@",
"Nonnull",
"TypeMirror",
"t2",
")",
"{",
"String",
"t1Name",
"=",
"toUniqueString",
"(",
"t1",
")",
";",
"String",
"t2Name",
"=",
"toUniqueString",
"(",
"t2",
")",
";",
"return",
"t1Name",
".",
"equals",
"(",
"t2Name",
")",
";",
"}"
] | To be used to compare types from different compilations (which are not comparable by standard means in Types).
This just compares the type names.
@param t1 first type
@param t2 second type
@return true if the types have the same fqn, false otherwise | [
"To",
"be",
"used",
"to",
"compare",
"types",
"from",
"different",
"compilations",
"(",
"which",
"are",
"not",
"comparable",
"by",
"standard",
"means",
"in",
"Types",
")",
".",
"This",
"just",
"compares",
"the",
"type",
"names",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java#L718-L723 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.buildListableBeanFactory | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
"""
Builds a listable bean factory with the given beans.
@param extraBeans
@return new Created BeanFactory
"""
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | java | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | [
"private",
"static",
"DefaultListableBeanFactory",
"buildListableBeanFactory",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
")",
"{",
"//new empty context",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"new",
"DefaultListableBeanFactory",
"(",
")",
";",
"//Injection of the new beans in the context",
"for",
"(",
"String",
"key",
":",
"extraBeans",
".",
"keySet",
"(",
")",
")",
"{",
"parentBeanFactory",
".",
"registerSingleton",
"(",
"key",
",",
"extraBeans",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"return",
"parentBeanFactory",
";",
"}"
] | Builds a listable bean factory with the given beans.
@param extraBeans
@return new Created BeanFactory | [
"Builds",
"a",
"listable",
"bean",
"factory",
"with",
"the",
"given",
"beans",
"."
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L112-L121 |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java | BotmReflectionUtil.assertStringNotNullAndNotTrimmedEmpty | public static void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
"""
Assert that the entity is not null and not trimmed empty.
@param variableName The check name of variable for message. (NotNull)
@param value The checked value. (NotNull)
"""
assertObjectNotNull("variableName", variableName);
assertObjectNotNull("value", value);
if (value.trim().length() == 0) {
String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
throw new IllegalArgumentException(msg);
}
} | java | public static void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
assertObjectNotNull("variableName", variableName);
assertObjectNotNull("value", value);
if (value.trim().length() == 0) {
String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
throw new IllegalArgumentException(msg);
}
} | [
"public",
"static",
"void",
"assertStringNotNullAndNotTrimmedEmpty",
"(",
"String",
"variableName",
",",
"String",
"value",
")",
"{",
"assertObjectNotNull",
"(",
"\"variableName\"",
",",
"variableName",
")",
";",
"assertObjectNotNull",
"(",
"\"value\"",
",",
"value",
")",
";",
"if",
"(",
"value",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"String",
"msg",
"=",
"\"The value should not be empty: variableName=\"",
"+",
"variableName",
"+",
"\" value=\"",
"+",
"value",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")",
";",
"}",
"}"
] | Assert that the entity is not null and not trimmed empty.
@param variableName The check name of variable for message. (NotNull)
@param value The checked value. (NotNull) | [
"Assert",
"that",
"the",
"entity",
"is",
"not",
"null",
"and",
"not",
"trimmed",
"empty",
"."
] | train | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L859-L866 |
needle4j/needle4j | src/main/java/org/needle4j/common/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(final boolean condition, final String message, final Object... parameters) {
"""
Throws an {@link IllegalArgumentException} with formatted message if
condition is not met.
@param condition
a boolean condition that must be <code>true</code> to pass
@param message
text to use as exception message
@param parameters
optional parameters used in
{@link String#format(String, Object...)}
"""
if (!condition) {
throw new IllegalArgumentException(format(message, parameters));
}
} | java | public static void checkArgument(final boolean condition, final String message, final Object... parameters) {
if (!condition) {
throw new IllegalArgumentException(format(message, parameters));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"final",
"boolean",
"condition",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"message",
",",
"parameters",
")",
")",
";",
"}",
"}"
] | Throws an {@link IllegalArgumentException} with formatted message if
condition is not met.
@param condition
a boolean condition that must be <code>true</code> to pass
@param message
text to use as exception message
@param parameters
optional parameters used in
{@link String#format(String, Object...)} | [
"Throws",
"an",
"{",
"@link",
"IllegalArgumentException",
"}",
"with",
"formatted",
"message",
"if",
"condition",
"is",
"not",
"met",
"."
] | train | https://github.com/needle4j/needle4j/blob/55fbcdeed72be5cf26e4404b0fe40282792b51f2/src/main/java/org/needle4j/common/Preconditions.java#L47-L51 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java | JNStorage.findFinalizedEditsFile | File findFinalizedEditsFile(long startTxId, long endTxId) throws IOException {
"""
Find an edits file spanning the given transaction ID range.
If no such file exists, an exception is thrown.
"""
File ret = new File(sd.getCurrentDir(),
NNStorage.getFinalizedEditsFileName(startTxId, endTxId));
if (!ret.exists()) {
throw new IOException(
"No edits file for range " + startTxId + "-" + endTxId);
}
return ret;
} | java | File findFinalizedEditsFile(long startTxId, long endTxId) throws IOException {
File ret = new File(sd.getCurrentDir(),
NNStorage.getFinalizedEditsFileName(startTxId, endTxId));
if (!ret.exists()) {
throw new IOException(
"No edits file for range " + startTxId + "-" + endTxId);
}
return ret;
} | [
"File",
"findFinalizedEditsFile",
"(",
"long",
"startTxId",
",",
"long",
"endTxId",
")",
"throws",
"IOException",
"{",
"File",
"ret",
"=",
"new",
"File",
"(",
"sd",
".",
"getCurrentDir",
"(",
")",
",",
"NNStorage",
".",
"getFinalizedEditsFileName",
"(",
"startTxId",
",",
"endTxId",
")",
")",
";",
"if",
"(",
"!",
"ret",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"No edits file for range \"",
"+",
"startTxId",
"+",
"\"-\"",
"+",
"endTxId",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Find an edits file spanning the given transaction ID range.
If no such file exists, an exception is thrown. | [
"Find",
"an",
"edits",
"file",
"spanning",
"the",
"given",
"transaction",
"ID",
"range",
".",
"If",
"no",
"such",
"file",
"exists",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L101-L109 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java | MergeTableHandler.init | public void init(BaseField field, Record mergeTable, Record subTable, ScreenParent gridScreen) {
"""
Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param mergeTable The parent merge record.
@param subTable The sub-record to add and remove from the parent merge record.
@param gridScreen The (optional) grid screen to requery on change.
"""
super.init(field);
m_gridScreen = gridScreen;
m_mergeRecord = mergeTable;
m_subRecord = subTable;
if (subTable != null)
{ // Remove this listener when the file closes
FileListener listener = new FileRemoveBOnCloseHandler(this); // If this closes first, this will remove FileListener
subTable.addListener(listener); // Remove this if you close the file first
}
} | java | public void init(BaseField field, Record mergeTable, Record subTable, ScreenParent gridScreen)
{
super.init(field);
m_gridScreen = gridScreen;
m_mergeRecord = mergeTable;
m_subRecord = subTable;
if (subTable != null)
{ // Remove this listener when the file closes
FileListener listener = new FileRemoveBOnCloseHandler(this); // If this closes first, this will remove FileListener
subTable.addListener(listener); // Remove this if you close the file first
}
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"Record",
"mergeTable",
",",
"Record",
"subTable",
",",
"ScreenParent",
"gridScreen",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_gridScreen",
"=",
"gridScreen",
";",
"m_mergeRecord",
"=",
"mergeTable",
";",
"m_subRecord",
"=",
"subTable",
";",
"if",
"(",
"subTable",
"!=",
"null",
")",
"{",
"// Remove this listener when the file closes",
"FileListener",
"listener",
"=",
"new",
"FileRemoveBOnCloseHandler",
"(",
"this",
")",
";",
"// If this closes first, this will remove FileListener",
"subTable",
".",
"addListener",
"(",
"listener",
")",
";",
"// Remove this if you close the file first",
"}",
"}"
] | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param mergeTable The parent merge record.
@param subTable The sub-record to add and remove from the parent merge record.
@param gridScreen The (optional) grid screen to requery on change. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java#L71-L82 |
otto-de/edison-microservice | edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java | DefaultJobDefinition.manuallyTriggerableJobDefinition | public static JobDefinition manuallyTriggerableJobDefinition(final String jobType,
final String jobName,
final String description,
final int restarts,
final Optional<Duration> maxAge) {
"""
Create a JobDefinition for a job that will not be triggered automatically by a job trigger.
@param jobType The type of the Job
@param jobName A human readable name of the Job
@param description A short description of the job's purpose
@param restarts The number of restarts if the job failed because of errors or exceptions
@param maxAge Optional maximum age of a job. When the job is not run for longer than this duration,
a warning is displayed on the status page
@return JobDefinition
"""
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.empty(), restarts, 0, Optional.empty());
} | java | public static JobDefinition manuallyTriggerableJobDefinition(final String jobType,
final String jobName,
final String description,
final int restarts,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.empty(), restarts, 0, Optional.empty());
} | [
"public",
"static",
"JobDefinition",
"manuallyTriggerableJobDefinition",
"(",
"final",
"String",
"jobType",
",",
"final",
"String",
"jobName",
",",
"final",
"String",
"description",
",",
"final",
"int",
"restarts",
",",
"final",
"Optional",
"<",
"Duration",
">",
"maxAge",
")",
"{",
"return",
"new",
"DefaultJobDefinition",
"(",
"jobType",
",",
"jobName",
",",
"description",
",",
"maxAge",
",",
"Optional",
".",
"empty",
"(",
")",
",",
"Optional",
".",
"empty",
"(",
")",
",",
"restarts",
",",
"0",
",",
"Optional",
".",
"empty",
"(",
")",
")",
";",
"}"
] | Create a JobDefinition for a job that will not be triggered automatically by a job trigger.
@param jobType The type of the Job
@param jobName A human readable name of the Job
@param description A short description of the job's purpose
@param restarts The number of restarts if the job failed because of errors or exceptions
@param maxAge Optional maximum age of a job. When the job is not run for longer than this duration,
a warning is displayed on the status page
@return JobDefinition | [
"Create",
"a",
"JobDefinition",
"for",
"a",
"job",
"that",
"will",
"not",
"be",
"triggered",
"automatically",
"by",
"a",
"job",
"trigger",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java#L38-L44 |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.publishProject | public CmsUUID publishProject(CmsObject cms, I_CmsReport report, CmsPublishList publishList) throws CmsException {
"""
Publishes the resources of a specified publish list.<p>
@param cms the cms request context
@param report an instance of <code>{@link I_CmsReport}</code> to print messages
@param publishList a publish list
@return the publish history id of the published project
@throws CmsException if something goes wrong
@see #getPublishList(CmsObject)
@see #getPublishList(CmsObject, CmsResource, boolean)
@see #getPublishList(CmsObject, List, boolean)
"""
return m_securityManager.publishProject(cms, publishList, report);
} | java | public CmsUUID publishProject(CmsObject cms, I_CmsReport report, CmsPublishList publishList) throws CmsException {
return m_securityManager.publishProject(cms, publishList, report);
} | [
"public",
"CmsUUID",
"publishProject",
"(",
"CmsObject",
"cms",
",",
"I_CmsReport",
"report",
",",
"CmsPublishList",
"publishList",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"publishProject",
"(",
"cms",
",",
"publishList",
",",
"report",
")",
";",
"}"
] | Publishes the resources of a specified publish list.<p>
@param cms the cms request context
@param report an instance of <code>{@link I_CmsReport}</code> to print messages
@param publishList a publish list
@return the publish history id of the published project
@throws CmsException if something goes wrong
@see #getPublishList(CmsObject)
@see #getPublishList(CmsObject, CmsResource, boolean)
@see #getPublishList(CmsObject, List, boolean) | [
"Publishes",
"the",
"resources",
"of",
"a",
"specified",
"publish",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L560-L563 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StreamCharBuffer.java | StreamCharBuffer.toCharArray | public char[] toCharArray() {
"""
Reads the buffer to a char[].
Caches the result if there aren't any readers.
@return the chars
"""
// check if there is a cached single charbuffer
if (firstChunk == lastChunk && firstChunk instanceof CharBufferChunk
&& allocBuffer.charsUsed() == 0
&& ((CharBufferChunk) firstChunk).isSingleBuffer())
{
return ((CharBufferChunk) firstChunk).buffer;
}
int initialReaderCount = readerCount;
char[] buf = readAsCharArray();
if (initialReaderCount == 0)
{
// if there are no readers, the result can be cached
reset();
if (buf.length > 0)
{
addChunk(new CharBufferChunk(-1, buf, 0, buf.length));
}
}
return buf;
} | java | public char[] toCharArray()
{
// check if there is a cached single charbuffer
if (firstChunk == lastChunk && firstChunk instanceof CharBufferChunk
&& allocBuffer.charsUsed() == 0
&& ((CharBufferChunk) firstChunk).isSingleBuffer())
{
return ((CharBufferChunk) firstChunk).buffer;
}
int initialReaderCount = readerCount;
char[] buf = readAsCharArray();
if (initialReaderCount == 0)
{
// if there are no readers, the result can be cached
reset();
if (buf.length > 0)
{
addChunk(new CharBufferChunk(-1, buf, 0, buf.length));
}
}
return buf;
} | [
"public",
"char",
"[",
"]",
"toCharArray",
"(",
")",
"{",
"// check if there is a cached single charbuffer",
"if",
"(",
"firstChunk",
"==",
"lastChunk",
"&&",
"firstChunk",
"instanceof",
"CharBufferChunk",
"&&",
"allocBuffer",
".",
"charsUsed",
"(",
")",
"==",
"0",
"&&",
"(",
"(",
"CharBufferChunk",
")",
"firstChunk",
")",
".",
"isSingleBuffer",
"(",
")",
")",
"{",
"return",
"(",
"(",
"CharBufferChunk",
")",
"firstChunk",
")",
".",
"buffer",
";",
"}",
"int",
"initialReaderCount",
"=",
"readerCount",
";",
"char",
"[",
"]",
"buf",
"=",
"readAsCharArray",
"(",
")",
";",
"if",
"(",
"initialReaderCount",
"==",
"0",
")",
"{",
"// if there are no readers, the result can be cached",
"reset",
"(",
")",
";",
"if",
"(",
"buf",
".",
"length",
">",
"0",
")",
"{",
"addChunk",
"(",
"new",
"CharBufferChunk",
"(",
"-",
"1",
",",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
")",
";",
"}",
"}",
"return",
"buf",
";",
"}"
] | Reads the buffer to a char[].
Caches the result if there aren't any readers.
@return the chars | [
"Reads",
"the",
"buffer",
"to",
"a",
"char",
"[]",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StreamCharBuffer.java#L698-L720 |
joniles/mpxj | src/main/java/net/sf/mpxj/sample/MpxjFilter.java | MpxjFilter.processResourceFilter | private static void processResourceFilter(ProjectFile project, Filter filter) {
"""
Apply a filter to the list of all resources, and show the results.
@param project project file
@param filter filter
"""
for (Resource resource : project.getResources())
{
if (filter.evaluate(resource, null))
{
System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName());
}
}
} | java | private static void processResourceFilter(ProjectFile project, Filter filter)
{
for (Resource resource : project.getResources())
{
if (filter.evaluate(resource, null))
{
System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName());
}
}
} | [
"private",
"static",
"void",
"processResourceFilter",
"(",
"ProjectFile",
"project",
",",
"Filter",
"filter",
")",
"{",
"for",
"(",
"Resource",
"resource",
":",
"project",
".",
"getResources",
"(",
")",
")",
"{",
"if",
"(",
"filter",
".",
"evaluate",
"(",
"resource",
",",
"null",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"resource",
".",
"getID",
"(",
")",
"+",
"\",\"",
"+",
"resource",
".",
"getUniqueID",
"(",
")",
"+",
"\",\"",
"+",
"resource",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Apply a filter to the list of all resources, and show the results.
@param project project file
@param filter filter | [
"Apply",
"a",
"filter",
"to",
"the",
"list",
"of",
"all",
"resources",
"and",
"show",
"the",
"results",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L145-L154 |
yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/Assert.java | Assert.noNullElements | public static void noNullElements(Object[] array, String message) {
"""
Assert that an array contains no {@code null} elements. <p>Note: Does not complain if the array is empty! <pre
class="code">Assert.noNullElements(array, "The array must contain non-null elements");</pre>
@param array the array to check.
@param message the exception message to use if the assertion fails.
@throws IllegalArgumentException if the object array contains a {@code null} element.
"""
if (array != null) {
for (Object element : array) {
if (element == null) {
throw new IllegalArgumentException(message);
}
}
}
} | java | public static void noNullElements(Object[] array, String message) {
if (array != null) {
for (Object element : array) {
if (element == null) {
throw new IllegalArgumentException(message);
}
}
}
} | [
"public",
"static",
"void",
"noNullElements",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"message",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"element",
":",
"array",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}",
"}",
"}"
] | Assert that an array contains no {@code null} elements. <p>Note: Does not complain if the array is empty! <pre
class="code">Assert.noNullElements(array, "The array must contain non-null elements");</pre>
@param array the array to check.
@param message the exception message to use if the assertion fails.
@throws IllegalArgumentException if the object array contains a {@code null} element. | [
"Assert",
"that",
"an",
"array",
"contains",
"no",
"{",
"@code",
"null",
"}",
"elements",
".",
"<p",
">",
"Note",
":",
"Does",
"not",
"complain",
"if",
"the",
"array",
"is",
"empty!",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
"noNullElements",
"(",
"array",
"The",
"array",
"must",
"contain",
"non",
"-",
"null",
"elements",
")",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/Assert.java#L146-L154 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.split | public static <T> List<List<T>> split(final Collection<? extends T> c, final int size) {
"""
Returns consecutive sub lists of a collection, each of the same size (the final list may be smaller).
or an empty List if the specified collection is null or empty. The order of elements in the original collection is kept
@param c
@param size
@return
"""
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return split(c, 0, c.size(), size);
} | java | public static <T> List<List<T>> split(final Collection<? extends T> c, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return split(c, 0, c.size(), size);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"split",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"T",
">",
"c",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The parameter 'size' can not be zero or less than zero\"",
")",
";",
"}",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"c",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"return",
"split",
"(",
"c",
",",
"0",
",",
"c",
".",
"size",
"(",
")",
",",
"size",
")",
";",
"}"
] | Returns consecutive sub lists of a collection, each of the same size (the final list may be smaller).
or an empty List if the specified collection is null or empty. The order of elements in the original collection is kept
@param c
@param size
@return | [
"Returns",
"consecutive",
"sub",
"lists",
"of",
"a",
"collection",
"each",
"of",
"the",
"same",
"size",
"(",
"the",
"final",
"list",
"may",
"be",
"smaller",
")",
".",
"or",
"an",
"empty",
"List",
"if",
"the",
"specified",
"collection",
"is",
"null",
"or",
"empty",
".",
"The",
"order",
"of",
"elements",
"in",
"the",
"original",
"collection",
"is",
"kept"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18665-L18675 |
threerings/narya | core/src/main/java/com/threerings/presents/data/InvocationMarshaller.java | InvocationMarshaller.sendRequest | protected void sendRequest (int methodId, Object[] args, Transport transport) {
"""
Called by generated invocation marshaller code; packages up and sends the specified
invocation service request.
"""
_invdir.sendRequest(_invOid, _invCode, methodId, args, transport);
} | java | protected void sendRequest (int methodId, Object[] args, Transport transport)
{
_invdir.sendRequest(_invOid, _invCode, methodId, args, transport);
} | [
"protected",
"void",
"sendRequest",
"(",
"int",
"methodId",
",",
"Object",
"[",
"]",
"args",
",",
"Transport",
"transport",
")",
"{",
"_invdir",
".",
"sendRequest",
"(",
"_invOid",
",",
"_invCode",
",",
"methodId",
",",
"args",
",",
"transport",
")",
";",
"}"
] | Called by generated invocation marshaller code; packages up and sends the specified
invocation service request. | [
"Called",
"by",
"generated",
"invocation",
"marshaller",
"code",
";",
"packages",
"up",
"and",
"sends",
"the",
"specified",
"invocation",
"service",
"request",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/InvocationMarshaller.java#L293-L296 |
authorjapps/zerocode | core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java | BasicHttpClient.createDefaultRequestBuilder | public RequestBuilder createDefaultRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) {
"""
This is the usual http request builder most widely used using Apache Http Client. In case you want to build
or prepare the requests differently, you can override this method.
Please see the following request builder to handle file uploads.
- BasicHttpClient#createFileUploadRequestBuilder(java.lang.String, java.lang.String, java.lang.String)
You can override this method via @UseHttpClient(YourCustomHttpClient.class)
@param httpUrl
@param methodName
@param reqBodyAsString
@return
"""
RequestBuilder requestBuilder = RequestBuilder
.create(methodName)
.setUri(httpUrl);
if (reqBodyAsString != null) {
HttpEntity httpEntity = EntityBuilder.create()
.setContentType(APPLICATION_JSON)
.setText(reqBodyAsString)
.build();
requestBuilder.setEntity(httpEntity);
}
return requestBuilder;
} | java | public RequestBuilder createDefaultRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) {
RequestBuilder requestBuilder = RequestBuilder
.create(methodName)
.setUri(httpUrl);
if (reqBodyAsString != null) {
HttpEntity httpEntity = EntityBuilder.create()
.setContentType(APPLICATION_JSON)
.setText(reqBodyAsString)
.build();
requestBuilder.setEntity(httpEntity);
}
return requestBuilder;
} | [
"public",
"RequestBuilder",
"createDefaultRequestBuilder",
"(",
"String",
"httpUrl",
",",
"String",
"methodName",
",",
"String",
"reqBodyAsString",
")",
"{",
"RequestBuilder",
"requestBuilder",
"=",
"RequestBuilder",
".",
"create",
"(",
"methodName",
")",
".",
"setUri",
"(",
"httpUrl",
")",
";",
"if",
"(",
"reqBodyAsString",
"!=",
"null",
")",
"{",
"HttpEntity",
"httpEntity",
"=",
"EntityBuilder",
".",
"create",
"(",
")",
".",
"setContentType",
"(",
"APPLICATION_JSON",
")",
".",
"setText",
"(",
"reqBodyAsString",
")",
".",
"build",
"(",
")",
";",
"requestBuilder",
".",
"setEntity",
"(",
"httpEntity",
")",
";",
"}",
"return",
"requestBuilder",
";",
"}"
] | This is the usual http request builder most widely used using Apache Http Client. In case you want to build
or prepare the requests differently, you can override this method.
Please see the following request builder to handle file uploads.
- BasicHttpClient#createFileUploadRequestBuilder(java.lang.String, java.lang.String, java.lang.String)
You can override this method via @UseHttpClient(YourCustomHttpClient.class)
@param httpUrl
@param methodName
@param reqBodyAsString
@return | [
"This",
"is",
"the",
"usual",
"http",
"request",
"builder",
"most",
"widely",
"used",
"using",
"Apache",
"Http",
"Client",
".",
"In",
"case",
"you",
"want",
"to",
"build",
"or",
"prepare",
"the",
"requests",
"differently",
"you",
"can",
"override",
"this",
"method",
"."
] | train | https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L279-L292 |
xm-online/xm-commons | xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java | DatabaseUtil.createSchema | public static void createSchema(DataSource dataSource, String name) {
"""
Creates new database scheme.
@param dataSource the datasource
@param name schema name
"""
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
} catch (SQLException e) {
throw new RuntimeException("Can not connect to database", e);
}
} | java | public static void createSchema(DataSource dataSource, String name) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
} catch (SQLException e) {
throw new RuntimeException("Can not connect to database", e);
}
} | [
"public",
"static",
"void",
"createSchema",
"(",
"DataSource",
"dataSource",
",",
"String",
"name",
")",
"{",
"try",
"(",
"Connection",
"connection",
"=",
"dataSource",
".",
"getConnection",
"(",
")",
";",
"Statement",
"statement",
"=",
"connection",
".",
"createStatement",
"(",
")",
")",
"{",
"statement",
".",
"executeUpdate",
"(",
"String",
".",
"format",
"(",
"Constants",
".",
"DDL_CREATE_SCHEMA",
",",
"name",
")",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can not connect to database\"",
",",
"e",
")",
";",
"}",
"}"
] | Creates new database scheme.
@param dataSource the datasource
@param name schema name | [
"Creates",
"new",
"database",
"scheme",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java#L25-L32 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.getNewValue | public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue) {
"""
Given the read, original, and current values for this key, decide which to use.
@param strKey
@param strReadValue
@param strOrigValue
@param strCurrentValue
@return
"""
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
} | java | public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue)
{
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
} | [
"public",
"String",
"getNewValue",
"(",
"String",
"strKey",
",",
"String",
"strReadValue",
",",
"String",
"strOrigValue",
",",
"String",
"strCurrentValue",
")",
"{",
"String",
"strNewValue",
"=",
"null",
";",
"if",
"(",
"(",
"(",
"strCurrentValue",
"!=",
"null",
")",
"&&",
"(",
"strCurrentValue",
".",
"equals",
"(",
"strOrigValue",
")",
")",
")",
"||",
"(",
"(",
"strCurrentValue",
"==",
"null",
")",
"&&",
"(",
"strOrigValue",
"==",
"null",
")",
")",
")",
"{",
"// I have't changed it, so use the read value",
"strNewValue",
"=",
"strReadValue",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"strReadValue",
"!=",
"null",
")",
"&&",
"(",
"strReadValue",
".",
"equals",
"(",
"strOrigValue",
")",
")",
")",
"||",
"(",
"(",
"strReadValue",
"==",
"null",
")",
"&&",
"(",
"strOrigValue",
"==",
"null",
")",
")",
")",
"{",
"// Someone else didn't change it, use current value",
"strNewValue",
"=",
"strCurrentValue",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"strReadValue",
"!=",
"null",
")",
"&&",
"(",
"strReadValue",
".",
"equals",
"(",
"strCurrentValue",
")",
")",
")",
"||",
"(",
"(",
"strReadValue",
"==",
"null",
")",
"&&",
"(",
"strCurrentValue",
"==",
"null",
")",
")",
")",
"{",
"// The read value and my value are the same... good, use it",
"strNewValue",
"=",
"strCurrentValue",
";",
"}",
"else",
"{",
"// All three values are different... figure out which to use",
"strNewValue",
"=",
"this",
".",
"mergeKey",
"(",
"strKey",
",",
"strReadValue",
",",
"strCurrentValue",
")",
";",
"// I HAVE changed it, so I need to figure out which one is better",
"}",
"return",
"strNewValue",
";",
"}"
] | Given the read, original, and current values for this key, decide which to use.
@param strKey
@param strReadValue
@param strOrigValue
@param strCurrentValue
@return | [
"Given",
"the",
"read",
"original",
"and",
"current",
"values",
"for",
"this",
"key",
"decide",
"which",
"to",
"use",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L557-L580 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.listByElasticPoolWithServiceResponseAsync | public Observable<ServiceResponse<Page<DatabaseInner>>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) {
"""
Gets a list of databases in an elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DatabaseInner> object
"""
return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)
.concatMap(new Func1<ServiceResponse<Page<DatabaseInner>>, Observable<ServiceResponse<Page<DatabaseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DatabaseInner>>> call(ServiceResponse<Page<DatabaseInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByElasticPoolNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<DatabaseInner>>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) {
return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)
.concatMap(new Func1<ServiceResponse<Page<DatabaseInner>>, Observable<ServiceResponse<Page<DatabaseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DatabaseInner>>> call(ServiceResponse<Page<DatabaseInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByElasticPoolNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DatabaseInner",
">",
">",
">",
"listByElasticPoolWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"elasticPoolName",
")",
"{",
"return",
"listByElasticPoolSinglePageAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"elasticPoolName",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DatabaseInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DatabaseInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DatabaseInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"DatabaseInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listByElasticPoolNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of databases in an elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DatabaseInner> object | [
"Gets",
"a",
"list",
"of",
"databases",
"in",
"an",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L1328-L1340 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/scale/Models.java | Models.createPolynom | public static MathModel createPolynom(int degree) {
"""
Create an n<sup>th</sup> degree polynomial model.
e.g. <code>createPolynom(4)</code> would create an O(n<sup>4</sup>)
model.
@param degree
the polynomial degree
@return a MathModel representing the specified degree.
"""
if (degree < 0) {
throw new IllegalArgumentException("Degree must be positive");
}
double[] params = new double[degree + 1];
params[0] = 1;
StringBuilder format = new StringBuilder();
for (int i = degree; i >= 0; i--) {
if (i > 0) {
format.append("%f*n");
if (i > 1) {
format.append('^');
format.append(i);
}
format.append(" + ");
}
}
format.append("%f");
Function<double[], DoubleUnaryOperator> equation = new Function<double[], DoubleUnaryOperator>() {
@Override
public DoubleUnaryOperator apply(double[] doubles) {
return x -> {
double sum = 0;
for (int i = degree; i >= 0; i--) {
sum += doubles[degree - i] * Math.pow(x, i);
}
return sum;
};
}
};
String name;
switch (degree) {
case 0:
name = "O(1)";
break;
case 1:
name = "O(n)";
break;
default:
name = "O(n^" + degree + ")";
break;
}
return new MathModel(name, format.toString(), equation, params);
} | java | public static MathModel createPolynom(int degree) {
if (degree < 0) {
throw new IllegalArgumentException("Degree must be positive");
}
double[] params = new double[degree + 1];
params[0] = 1;
StringBuilder format = new StringBuilder();
for (int i = degree; i >= 0; i--) {
if (i > 0) {
format.append("%f*n");
if (i > 1) {
format.append('^');
format.append(i);
}
format.append(" + ");
}
}
format.append("%f");
Function<double[], DoubleUnaryOperator> equation = new Function<double[], DoubleUnaryOperator>() {
@Override
public DoubleUnaryOperator apply(double[] doubles) {
return x -> {
double sum = 0;
for (int i = degree; i >= 0; i--) {
sum += doubles[degree - i] * Math.pow(x, i);
}
return sum;
};
}
};
String name;
switch (degree) {
case 0:
name = "O(1)";
break;
case 1:
name = "O(n)";
break;
default:
name = "O(n^" + degree + ")";
break;
}
return new MathModel(name, format.toString(), equation, params);
} | [
"public",
"static",
"MathModel",
"createPolynom",
"(",
"int",
"degree",
")",
"{",
"if",
"(",
"degree",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Degree must be positive\"",
")",
";",
"}",
"double",
"[",
"]",
"params",
"=",
"new",
"double",
"[",
"degree",
"+",
"1",
"]",
";",
"params",
"[",
"0",
"]",
"=",
"1",
";",
"StringBuilder",
"format",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"degree",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"format",
".",
"append",
"(",
"\"%f*n\"",
")",
";",
"if",
"(",
"i",
">",
"1",
")",
"{",
"format",
".",
"append",
"(",
"'",
"'",
")",
";",
"format",
".",
"append",
"(",
"i",
")",
";",
"}",
"format",
".",
"append",
"(",
"\" + \"",
")",
";",
"}",
"}",
"format",
".",
"append",
"(",
"\"%f\"",
")",
";",
"Function",
"<",
"double",
"[",
"]",
",",
"DoubleUnaryOperator",
">",
"equation",
"=",
"new",
"Function",
"<",
"double",
"[",
"]",
",",
"DoubleUnaryOperator",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DoubleUnaryOperator",
"apply",
"(",
"double",
"[",
"]",
"doubles",
")",
"{",
"return",
"x",
"->",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"degree",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"sum",
"+=",
"doubles",
"[",
"degree",
"-",
"i",
"]",
"*",
"Math",
".",
"pow",
"(",
"x",
",",
"i",
")",
";",
"}",
"return",
"sum",
";",
"}",
";",
"}",
"}",
";",
"String",
"name",
";",
"switch",
"(",
"degree",
")",
"{",
"case",
"0",
":",
"name",
"=",
"\"O(1)\"",
";",
"break",
";",
"case",
"1",
":",
"name",
"=",
"\"O(n)\"",
";",
"break",
";",
"default",
":",
"name",
"=",
"\"O(n^\"",
"+",
"degree",
"+",
"\")\"",
";",
"break",
";",
"}",
"return",
"new",
"MathModel",
"(",
"name",
",",
"format",
".",
"toString",
"(",
")",
",",
"equation",
",",
"params",
")",
";",
"}"
] | Create an n<sup>th</sup> degree polynomial model.
e.g. <code>createPolynom(4)</code> would create an O(n<sup>4</sup>)
model.
@param degree
the polynomial degree
@return a MathModel representing the specified degree. | [
"Create",
"an",
"n<sup",
">",
"th<",
"/",
"sup",
">",
"degree",
"polynomial",
"model",
"."
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/scale/Models.java#L56-L99 |
kite-sdk/kite | kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/BaseNCodec.java | BaseNCodec.isInAlphabet | public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) {
"""
Tests a given byte array to see if it contains only valid characters within the alphabet.
The method optionally treats whitespace and pad as valid.
@param arrayOctet byte array to test
@param allowWSPad if {@code true}, then whitespace and PAD are also allowed
@return {@code true} if all bytes are valid characters in the alphabet or if the byte array is empty;
{@code false}, otherwise
"""
for (int i = 0; i < arrayOctet.length; i++) {
if (!isInAlphabet(arrayOctet[i]) &&
(!allowWSPad || (arrayOctet[i] != PAD) && !isWhiteSpace(arrayOctet[i]))) {
return false;
}
}
return true;
} | java | public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) {
for (int i = 0; i < arrayOctet.length; i++) {
if (!isInAlphabet(arrayOctet[i]) &&
(!allowWSPad || (arrayOctet[i] != PAD) && !isWhiteSpace(arrayOctet[i]))) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"isInAlphabet",
"(",
"final",
"byte",
"[",
"]",
"arrayOctet",
",",
"final",
"boolean",
"allowWSPad",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arrayOctet",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isInAlphabet",
"(",
"arrayOctet",
"[",
"i",
"]",
")",
"&&",
"(",
"!",
"allowWSPad",
"||",
"(",
"arrayOctet",
"[",
"i",
"]",
"!=",
"PAD",
")",
"&&",
"!",
"isWhiteSpace",
"(",
"arrayOctet",
"[",
"i",
"]",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Tests a given byte array to see if it contains only valid characters within the alphabet.
The method optionally treats whitespace and pad as valid.
@param arrayOctet byte array to test
@param allowWSPad if {@code true}, then whitespace and PAD are also allowed
@return {@code true} if all bytes are valid characters in the alphabet or if the byte array is empty;
{@code false}, otherwise | [
"Tests",
"a",
"given",
"byte",
"array",
"to",
"see",
"if",
"it",
"contains",
"only",
"valid",
"characters",
"within",
"the",
"alphabet",
".",
"The",
"method",
"optionally",
"treats",
"whitespace",
"and",
"pad",
"as",
"valid",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/BaseNCodec.java#L437-L445 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java | N1qlQueryExecutor.prepareAndExecute | protected Observable<AsyncN1qlQueryResult> prepareAndExecute(final N1qlQuery query, final CouchbaseEnvironment env, final long timeout, final TimeUnit timeUnit) {
"""
Issues a N1QL PREPARE, puts the plan in cache then EXECUTE it.
"""
return prepare(query.statement())
.flatMap(new Func1<PreparedPayload, Observable<AsyncN1qlQueryResult>>() {
@Override
public Observable<AsyncN1qlQueryResult> call(PreparedPayload payload) {
queryCache.put(query.statement().toString(), payload);
return executePrepared(query, payload, env, timeout, timeUnit);
}
});
} | java | protected Observable<AsyncN1qlQueryResult> prepareAndExecute(final N1qlQuery query, final CouchbaseEnvironment env, final long timeout, final TimeUnit timeUnit) {
return prepare(query.statement())
.flatMap(new Func1<PreparedPayload, Observable<AsyncN1qlQueryResult>>() {
@Override
public Observable<AsyncN1qlQueryResult> call(PreparedPayload payload) {
queryCache.put(query.statement().toString(), payload);
return executePrepared(query, payload, env, timeout, timeUnit);
}
});
} | [
"protected",
"Observable",
"<",
"AsyncN1qlQueryResult",
">",
"prepareAndExecute",
"(",
"final",
"N1qlQuery",
"query",
",",
"final",
"CouchbaseEnvironment",
"env",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"prepare",
"(",
"query",
".",
"statement",
"(",
")",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"PreparedPayload",
",",
"Observable",
"<",
"AsyncN1qlQueryResult",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"AsyncN1qlQueryResult",
">",
"call",
"(",
"PreparedPayload",
"payload",
")",
"{",
"queryCache",
".",
"put",
"(",
"query",
".",
"statement",
"(",
")",
".",
"toString",
"(",
")",
",",
"payload",
")",
";",
"return",
"executePrepared",
"(",
"query",
",",
"payload",
",",
"env",
",",
"timeout",
",",
"timeUnit",
")",
";",
"}",
"}",
")",
";",
"}"
] | Issues a N1QL PREPARE, puts the plan in cache then EXECUTE it. | [
"Issues",
"a",
"N1QL",
"PREPARE",
"puts",
"the",
"plan",
"in",
"cache",
"then",
"EXECUTE",
"it",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java#L396-L405 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java | OpenWatcomCompiler.addWarningSwitch | @Override
protected final void addWarningSwitch(final Vector<String> args, final int level) {
"""
Add warning switch.
@param args
Vector command line arguments
@param level
int warning level
"""
OpenWatcomProcessor.addWarningSwitch(args, level);
} | java | @Override
protected final void addWarningSwitch(final Vector<String> args, final int level) {
OpenWatcomProcessor.addWarningSwitch(args, level);
} | [
"@",
"Override",
"protected",
"final",
"void",
"addWarningSwitch",
"(",
"final",
"Vector",
"<",
"String",
">",
"args",
",",
"final",
"int",
"level",
")",
"{",
"OpenWatcomProcessor",
".",
"addWarningSwitch",
"(",
"args",
",",
"level",
")",
";",
"}"
] | Add warning switch.
@param args
Vector command line arguments
@param level
int warning level | [
"Add",
"warning",
"switch",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java#L116-L119 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java | CryptoPrimitives.certificationRequestToPEM | private String certificationRequestToPEM(PKCS10CertificationRequest csr) throws IOException {
"""
certificationRequestToPEM - Convert a PKCS10CertificationRequest to PEM
format.
@param csr The Certificate to convert
@return An equivalent PEM format certificate.
@throws IOException
"""
PemObject pemCSR = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
StringWriter str = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(str);
pemWriter.writeObject(pemCSR);
pemWriter.close();
str.close();
return str.toString();
} | java | private String certificationRequestToPEM(PKCS10CertificationRequest csr) throws IOException {
PemObject pemCSR = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
StringWriter str = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(str);
pemWriter.writeObject(pemCSR);
pemWriter.close();
str.close();
return str.toString();
} | [
"private",
"String",
"certificationRequestToPEM",
"(",
"PKCS10CertificationRequest",
"csr",
")",
"throws",
"IOException",
"{",
"PemObject",
"pemCSR",
"=",
"new",
"PemObject",
"(",
"\"CERTIFICATE REQUEST\"",
",",
"csr",
".",
"getEncoded",
"(",
")",
")",
";",
"StringWriter",
"str",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JcaPEMWriter",
"pemWriter",
"=",
"new",
"JcaPEMWriter",
"(",
"str",
")",
";",
"pemWriter",
".",
"writeObject",
"(",
"pemCSR",
")",
";",
"pemWriter",
".",
"close",
"(",
")",
";",
"str",
".",
"close",
"(",
")",
";",
"return",
"str",
".",
"toString",
"(",
")",
";",
"}"
] | certificationRequestToPEM - Convert a PKCS10CertificationRequest to PEM
format.
@param csr The Certificate to convert
@return An equivalent PEM format certificate.
@throws IOException | [
"certificationRequestToPEM",
"-",
"Convert",
"a",
"PKCS10CertificationRequest",
"to",
"PEM",
"format",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java#L815-L824 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java | PathfindableModel.getMovementForce | private Force getMovementForce(double x, double y, double dx, double dy) {
"""
Get the movement force depending of the current location and the destination location.
@param x The current horizontal location.
@param y The current vertical location.
@param dx The destination horizontal location.
@param dy The destination vertical location.
@return The movement force pointing to the destination.
"""
double sx = 0.0;
double sy = 0.0;
// Horizontal speed
if (dx - x < 0)
{
sx = -getSpeedX();
}
else if (dx - x > 0)
{
sx = getSpeedX();
}
// Vertical speed
if (dy - y < 0)
{
sy = -getSpeedX();
}
else if (dy - y > 0)
{
sy = getSpeedX();
}
// Diagonal speed
if (Double.compare(sx, 0) != 0 && Double.compare(sy, 0) != 0)
{
sx *= PathfindableModel.DIAGONAL_SPEED;
sy *= PathfindableModel.DIAGONAL_SPEED;
}
return new Force(sx, sy);
} | java | private Force getMovementForce(double x, double y, double dx, double dy)
{
double sx = 0.0;
double sy = 0.0;
// Horizontal speed
if (dx - x < 0)
{
sx = -getSpeedX();
}
else if (dx - x > 0)
{
sx = getSpeedX();
}
// Vertical speed
if (dy - y < 0)
{
sy = -getSpeedX();
}
else if (dy - y > 0)
{
sy = getSpeedX();
}
// Diagonal speed
if (Double.compare(sx, 0) != 0 && Double.compare(sy, 0) != 0)
{
sx *= PathfindableModel.DIAGONAL_SPEED;
sy *= PathfindableModel.DIAGONAL_SPEED;
}
return new Force(sx, sy);
} | [
"private",
"Force",
"getMovementForce",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"dx",
",",
"double",
"dy",
")",
"{",
"double",
"sx",
"=",
"0.0",
";",
"double",
"sy",
"=",
"0.0",
";",
"// Horizontal speed",
"if",
"(",
"dx",
"-",
"x",
"<",
"0",
")",
"{",
"sx",
"=",
"-",
"getSpeedX",
"(",
")",
";",
"}",
"else",
"if",
"(",
"dx",
"-",
"x",
">",
"0",
")",
"{",
"sx",
"=",
"getSpeedX",
"(",
")",
";",
"}",
"// Vertical speed",
"if",
"(",
"dy",
"-",
"y",
"<",
"0",
")",
"{",
"sy",
"=",
"-",
"getSpeedX",
"(",
")",
";",
"}",
"else",
"if",
"(",
"dy",
"-",
"y",
">",
"0",
")",
"{",
"sy",
"=",
"getSpeedX",
"(",
")",
";",
"}",
"// Diagonal speed",
"if",
"(",
"Double",
".",
"compare",
"(",
"sx",
",",
"0",
")",
"!=",
"0",
"&&",
"Double",
".",
"compare",
"(",
"sy",
",",
"0",
")",
"!=",
"0",
")",
"{",
"sx",
"*=",
"PathfindableModel",
".",
"DIAGONAL_SPEED",
";",
"sy",
"*=",
"PathfindableModel",
".",
"DIAGONAL_SPEED",
";",
"}",
"return",
"new",
"Force",
"(",
"sx",
",",
"sy",
")",
";",
"}"
] | Get the movement force depending of the current location and the destination location.
@param x The current horizontal location.
@param y The current vertical location.
@param dx The destination horizontal location.
@param dy The destination vertical location.
@return The movement force pointing to the destination. | [
"Get",
"the",
"movement",
"force",
"depending",
"of",
"the",
"current",
"location",
"and",
"the",
"destination",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L478-L509 |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java | RScriptExporter.writeScriptHeader | protected void writeScriptHeader(Writer writer, Engine engine) throws IOException {
"""
Writes the header of the R script (e.g., import libraries)
@param writer is the output where the header will be written to
@param engine is the engine to export
@throws IOException if any error occurs upon writing on the writer
"""
writer.append("#Code automatically generated with " + FuzzyLite.LIBRARY + ".\n\n");
writer.append("library(ggplot2);\n");
writer.append("\n");
writer.append("engine.name = \"" + engine.getName() + "\"\n");
if (!Op.isEmpty(engine.getDescription())) {
writer.append(String.format(
"engine.description = \"%s\"\n", engine.getDescription()));
}
writer.append("engine.fll = \"" + new FllExporter().toString(engine) + "\"\n\n");
} | java | protected void writeScriptHeader(Writer writer, Engine engine) throws IOException {
writer.append("#Code automatically generated with " + FuzzyLite.LIBRARY + ".\n\n");
writer.append("library(ggplot2);\n");
writer.append("\n");
writer.append("engine.name = \"" + engine.getName() + "\"\n");
if (!Op.isEmpty(engine.getDescription())) {
writer.append(String.format(
"engine.description = \"%s\"\n", engine.getDescription()));
}
writer.append("engine.fll = \"" + new FllExporter().toString(engine) + "\"\n\n");
} | [
"protected",
"void",
"writeScriptHeader",
"(",
"Writer",
"writer",
",",
"Engine",
"engine",
")",
"throws",
"IOException",
"{",
"writer",
".",
"append",
"(",
"\"#Code automatically generated with \"",
"+",
"FuzzyLite",
".",
"LIBRARY",
"+",
"\".\\n\\n\"",
")",
";",
"writer",
".",
"append",
"(",
"\"library(ggplot2);\\n\"",
")",
";",
"writer",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"writer",
".",
"append",
"(",
"\"engine.name = \\\"\"",
"+",
"engine",
".",
"getName",
"(",
")",
"+",
"\"\\\"\\n\"",
")",
";",
"if",
"(",
"!",
"Op",
".",
"isEmpty",
"(",
"engine",
".",
"getDescription",
"(",
")",
")",
")",
"{",
"writer",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"engine.description = \\\"%s\\\"\\n\"",
",",
"engine",
".",
"getDescription",
"(",
")",
")",
")",
";",
"}",
"writer",
".",
"append",
"(",
"\"engine.fll = \\\"\"",
"+",
"new",
"FllExporter",
"(",
")",
".",
"toString",
"(",
"engine",
")",
"+",
"\"\\\"\\n\\n\"",
")",
";",
"}"
] | Writes the header of the R script (e.g., import libraries)
@param writer is the output where the header will be written to
@param engine is the engine to export
@throws IOException if any error occurs upon writing on the writer | [
"Writes",
"the",
"header",
"of",
"the",
"R",
"script",
"(",
"e",
".",
"g",
".",
"import",
"libraries",
")"
] | train | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java#L375-L385 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java | JmsBytesMessageImpl.recordInteger | private void recordInteger(int offset, int length) {
"""
Records the presence of an integer-style item in the bytes message stream. This method is called by the writeXXX methods
to keep a track of where the integer items are, so they can be byteswapped if necessary at send time.
NB. The arrays and vector maintained by this method are read directly by the _exportBody() method, so these two method
implementations need to be kept in step
@param offset int offset of start of numeric item
@param length int length of the item (2,4,8 bytes)
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length });
// If the current arrays are full, save them in the vector and allocate some new ones
if (integer_count == ARRAY_SIZE) {
if (integers == null)
integers = new Vector();
integers.addElement(integer_offsets);
integers.addElement(integer_sizes);
integer_offsets = new int[ARRAY_SIZE];
integer_sizes = new int[ARRAY_SIZE];
integer_count = 0;
}
// Add the offset and size of the current numeric item to the arrays
integer_offsets[integer_count] = offset;
integer_sizes[integer_count++] = length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "recordInteger");
} | java | private void recordInteger(int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length });
// If the current arrays are full, save them in the vector and allocate some new ones
if (integer_count == ARRAY_SIZE) {
if (integers == null)
integers = new Vector();
integers.addElement(integer_offsets);
integers.addElement(integer_sizes);
integer_offsets = new int[ARRAY_SIZE];
integer_sizes = new int[ARRAY_SIZE];
integer_count = 0;
}
// Add the offset and size of the current numeric item to the arrays
integer_offsets[integer_count] = offset;
integer_sizes[integer_count++] = length;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "recordInteger");
} | [
"private",
"void",
"recordInteger",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"recordInteger\"",
",",
"new",
"Object",
"[",
"]",
"{",
"offset",
",",
"length",
"}",
")",
";",
"// If the current arrays are full, save them in the vector and allocate some new ones",
"if",
"(",
"integer_count",
"==",
"ARRAY_SIZE",
")",
"{",
"if",
"(",
"integers",
"==",
"null",
")",
"integers",
"=",
"new",
"Vector",
"(",
")",
";",
"integers",
".",
"addElement",
"(",
"integer_offsets",
")",
";",
"integers",
".",
"addElement",
"(",
"integer_sizes",
")",
";",
"integer_offsets",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"integer_sizes",
"=",
"new",
"int",
"[",
"ARRAY_SIZE",
"]",
";",
"integer_count",
"=",
"0",
";",
"}",
"// Add the offset and size of the current numeric item to the arrays",
"integer_offsets",
"[",
"integer_count",
"]",
"=",
"offset",
";",
"integer_sizes",
"[",
"integer_count",
"++",
"]",
"=",
"length",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"recordInteger\"",
")",
";",
"}"
] | Records the presence of an integer-style item in the bytes message stream. This method is called by the writeXXX methods
to keep a track of where the integer items are, so they can be byteswapped if necessary at send time.
NB. The arrays and vector maintained by this method are read directly by the _exportBody() method, so these two method
implementations need to be kept in step
@param offset int offset of start of numeric item
@param length int length of the item (2,4,8 bytes) | [
"Records",
"the",
"presence",
"of",
"an",
"integer",
"-",
"style",
"item",
"in",
"the",
"bytes",
"message",
"stream",
".",
"This",
"method",
"is",
"called",
"by",
"the",
"writeXXX",
"methods",
"to",
"keep",
"a",
"track",
"of",
"where",
"the",
"integer",
"items",
"are",
"so",
"they",
"can",
"be",
"byteswapped",
"if",
"necessary",
"at",
"send",
"time",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2226-L2247 |
vladmihalcea/flexy-pool | flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/Slf4jMetricReporter.java | Slf4jMetricReporter.init | @Override
public Slf4jMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
"""
Create a Log Reporter and activate it if the metricLogReporterMillis property is greater than zero.
@param configurationProperties configuration properties
@param metricRegistry metric registry
@return {@link Slf4jMetricReporter}
"""
metricLogReporterMillis = configurationProperties.getMetricLogReporterMillis();
if (metricLogReporterMillis > 0) {
this.slf4jReporter = Slf4jReporter
.forRegistry(metricRegistry)
.outputTo(LOGGER)
.build();
}
return this;
} | java | @Override
public Slf4jMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
metricLogReporterMillis = configurationProperties.getMetricLogReporterMillis();
if (metricLogReporterMillis > 0) {
this.slf4jReporter = Slf4jReporter
.forRegistry(metricRegistry)
.outputTo(LOGGER)
.build();
}
return this;
} | [
"@",
"Override",
"public",
"Slf4jMetricReporter",
"init",
"(",
"ConfigurationProperties",
"configurationProperties",
",",
"MetricRegistry",
"metricRegistry",
")",
"{",
"metricLogReporterMillis",
"=",
"configurationProperties",
".",
"getMetricLogReporterMillis",
"(",
")",
";",
"if",
"(",
"metricLogReporterMillis",
">",
"0",
")",
"{",
"this",
".",
"slf4jReporter",
"=",
"Slf4jReporter",
".",
"forRegistry",
"(",
"metricRegistry",
")",
".",
"outputTo",
"(",
"LOGGER",
")",
".",
"build",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Create a Log Reporter and activate it if the metricLogReporterMillis property is greater than zero.
@param configurationProperties configuration properties
@param metricRegistry metric registry
@return {@link Slf4jMetricReporter} | [
"Create",
"a",
"Log",
"Reporter",
"and",
"activate",
"it",
"if",
"the",
"metricLogReporterMillis",
"property",
"is",
"greater",
"than",
"zero",
"."
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/Slf4jMetricReporter.java#L32-L42 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/source/FileSourceDto.java | FileSourceDto.encodeSourceData | public static byte[] encodeSourceData(DbFileSources.Data data) {
"""
Serialize and compress protobuf message {@link org.sonar.db.protobuf.DbFileSources.Data}
in the column BINARY_DATA.
"""
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput);
try {
data.writeTo(compressedOutput);
compressedOutput.close();
return byteOutput.toByteArray();
} catch (IOException e) {
throw new IllegalStateException("Fail to serialize and compress source data", e);
} finally {
IOUtils.closeQuietly(compressedOutput);
}
} | java | public static byte[] encodeSourceData(DbFileSources.Data data) {
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput);
try {
data.writeTo(compressedOutput);
compressedOutput.close();
return byteOutput.toByteArray();
} catch (IOException e) {
throw new IllegalStateException("Fail to serialize and compress source data", e);
} finally {
IOUtils.closeQuietly(compressedOutput);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeSourceData",
"(",
"DbFileSources",
".",
"Data",
"data",
")",
"{",
"ByteArrayOutputStream",
"byteOutput",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"LZ4BlockOutputStream",
"compressedOutput",
"=",
"new",
"LZ4BlockOutputStream",
"(",
"byteOutput",
")",
";",
"try",
"{",
"data",
".",
"writeTo",
"(",
"compressedOutput",
")",
";",
"compressedOutput",
".",
"close",
"(",
")",
";",
"return",
"byteOutput",
".",
"toByteArray",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Fail to serialize and compress source data\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"compressedOutput",
")",
";",
"}",
"}"
] | Serialize and compress protobuf message {@link org.sonar.db.protobuf.DbFileSources.Data}
in the column BINARY_DATA. | [
"Serialize",
"and",
"compress",
"protobuf",
"message",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/source/FileSourceDto.java#L156-L168 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java | BuildsInner.getLogLink | public BuildGetLogResultInner getLogLink(String resourceGroupName, String registryName, String buildId) {
"""
Gets a link to download the build logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildId The build ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BuildGetLogResultInner object if successful.
"""
return getLogLinkWithServiceResponseAsync(resourceGroupName, registryName, buildId).toBlocking().single().body();
} | java | public BuildGetLogResultInner getLogLink(String resourceGroupName, String registryName, String buildId) {
return getLogLinkWithServiceResponseAsync(resourceGroupName, registryName, buildId).toBlocking().single().body();
} | [
"public",
"BuildGetLogResultInner",
"getLogLink",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildId",
")",
"{",
"return",
"getLogLinkWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Gets a link to download the build logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildId The build ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BuildGetLogResultInner object if successful. | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"build",
"logs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java#L794-L796 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java | XmlValidationUtils.isElementIgnored | public static boolean isElementIgnored(Node source, Node received, Set<String> ignoreExpressions, NamespaceContext namespaceContext) {
"""
Checks if given element node is either on ignore list or
contains @ignore@ tag inside control message
@param source
@param received
@param ignoreExpressions
@param namespaceContext
@return
"""
if (isElementIgnored(received, ignoreExpressions, namespaceContext)) {
if (log.isDebugEnabled()) {
log.debug("Element: '" + received.getLocalName() + "' is on ignore list - skipped validation");
}
return true;
} else if (source.getFirstChild() != null &&
StringUtils.hasText(source.getFirstChild().getNodeValue()) &&
source.getFirstChild().getNodeValue().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
if (log.isDebugEnabled()) {
log.debug("Element: '" + received.getLocalName() + "' is ignored by placeholder '" +
Citrus.IGNORE_PLACEHOLDER + "'");
}
return true;
}
return false;
} | java | public static boolean isElementIgnored(Node source, Node received, Set<String> ignoreExpressions, NamespaceContext namespaceContext) {
if (isElementIgnored(received, ignoreExpressions, namespaceContext)) {
if (log.isDebugEnabled()) {
log.debug("Element: '" + received.getLocalName() + "' is on ignore list - skipped validation");
}
return true;
} else if (source.getFirstChild() != null &&
StringUtils.hasText(source.getFirstChild().getNodeValue()) &&
source.getFirstChild().getNodeValue().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
if (log.isDebugEnabled()) {
log.debug("Element: '" + received.getLocalName() + "' is ignored by placeholder '" +
Citrus.IGNORE_PLACEHOLDER + "'");
}
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isElementIgnored",
"(",
"Node",
"source",
",",
"Node",
"received",
",",
"Set",
"<",
"String",
">",
"ignoreExpressions",
",",
"NamespaceContext",
"namespaceContext",
")",
"{",
"if",
"(",
"isElementIgnored",
"(",
"received",
",",
"ignoreExpressions",
",",
"namespaceContext",
")",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Element: '\"",
"+",
"received",
".",
"getLocalName",
"(",
")",
"+",
"\"' is on ignore list - skipped validation\"",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"source",
".",
"getFirstChild",
"(",
")",
"!=",
"null",
"&&",
"StringUtils",
".",
"hasText",
"(",
"source",
".",
"getFirstChild",
"(",
")",
".",
"getNodeValue",
"(",
")",
")",
"&&",
"source",
".",
"getFirstChild",
"(",
")",
".",
"getNodeValue",
"(",
")",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"Citrus",
".",
"IGNORE_PLACEHOLDER",
")",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Element: '\"",
"+",
"received",
".",
"getLocalName",
"(",
")",
"+",
"\"' is ignored by placeholder '\"",
"+",
"Citrus",
".",
"IGNORE_PLACEHOLDER",
"+",
"\"'\"",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if given element node is either on ignore list or
contains @ignore@ tag inside control message
@param source
@param received
@param ignoreExpressions
@param namespaceContext
@return | [
"Checks",
"if",
"given",
"element",
"node",
"is",
"either",
"on",
"ignore",
"list",
"or",
"contains"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java#L57-L73 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/layer/download/TileDownloadLayer.java | TileDownloadLayer.isTileStale | @Override
protected boolean isTileStale(Tile tile, TileBitmap bitmap) {
"""
Whether the tile is stale and should be refreshed.
<p/>
This method is called from {@link #draw(BoundingBox, byte, Canvas, Point)} to determine whether the tile needs to
be refreshed.
<p/>
A tile is considered stale if one or more of the following two conditions apply:
<ul>
<li>The {@code bitmap}'s {@link org.mapsforge.core.graphics.TileBitmap#isExpired()} method returns {@code True}.</li>
<li>The layer has a time-to-live (TTL) set ({@link #getCacheTimeToLive()} returns a nonzero value) and the sum of
the {@code bitmap}'s {@link org.mapsforge.core.graphics.TileBitmap#getTimestamp()} and TTL is less than current
time (as returned by {@link java.lang.System#currentTimeMillis()}).</li>
</ul>
<p/>
When a tile has become stale, the layer will first display the tile referenced by {@code bitmap} and attempt to
obtain a fresh copy in the background. When a fresh copy becomes available, the layer will replace it and update
the cache. If a fresh copy cannot be obtained (e.g. because the tile is obtained from an online source which
cannot be reached), the stale tile will continue to be used until another
{@code #draw(BoundingBox, byte, Canvas, Point)} operation requests it again.
@param tile A tile. This parameter is not used for a {@code TileDownloadLayer} and can be null.
@param bitmap The bitmap for {@code tile} currently held in the layer's cache.
"""
if (bitmap.isExpired())
return true;
return cacheTimeToLive != 0 && ((bitmap.getTimestamp() + cacheTimeToLive) < System.currentTimeMillis());
} | java | @Override
protected boolean isTileStale(Tile tile, TileBitmap bitmap) {
if (bitmap.isExpired())
return true;
return cacheTimeToLive != 0 && ((bitmap.getTimestamp() + cacheTimeToLive) < System.currentTimeMillis());
} | [
"@",
"Override",
"protected",
"boolean",
"isTileStale",
"(",
"Tile",
"tile",
",",
"TileBitmap",
"bitmap",
")",
"{",
"if",
"(",
"bitmap",
".",
"isExpired",
"(",
")",
")",
"return",
"true",
";",
"return",
"cacheTimeToLive",
"!=",
"0",
"&&",
"(",
"(",
"bitmap",
".",
"getTimestamp",
"(",
")",
"+",
"cacheTimeToLive",
")",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}"
] | Whether the tile is stale and should be refreshed.
<p/>
This method is called from {@link #draw(BoundingBox, byte, Canvas, Point)} to determine whether the tile needs to
be refreshed.
<p/>
A tile is considered stale if one or more of the following two conditions apply:
<ul>
<li>The {@code bitmap}'s {@link org.mapsforge.core.graphics.TileBitmap#isExpired()} method returns {@code True}.</li>
<li>The layer has a time-to-live (TTL) set ({@link #getCacheTimeToLive()} returns a nonzero value) and the sum of
the {@code bitmap}'s {@link org.mapsforge.core.graphics.TileBitmap#getTimestamp()} and TTL is less than current
time (as returned by {@link java.lang.System#currentTimeMillis()}).</li>
</ul>
<p/>
When a tile has become stale, the layer will first display the tile referenced by {@code bitmap} and attempt to
obtain a fresh copy in the background. When a fresh copy becomes available, the layer will replace it and update
the cache. If a fresh copy cannot be obtained (e.g. because the tile is obtained from an online source which
cannot be reached), the stale tile will continue to be used until another
{@code #draw(BoundingBox, byte, Canvas, Point)} operation requests it again.
@param tile A tile. This parameter is not used for a {@code TileDownloadLayer} and can be null.
@param bitmap The bitmap for {@code tile} currently held in the layer's cache. | [
"Whether",
"the",
"tile",
"is",
"stale",
"and",
"should",
"be",
"refreshed",
".",
"<p",
"/",
">",
"This",
"method",
"is",
"called",
"from",
"{",
"@link",
"#draw",
"(",
"BoundingBox",
"byte",
"Canvas",
"Point",
")",
"}",
"to",
"determine",
"whether",
"the",
"tile",
"needs",
"to",
"be",
"refreshed",
".",
"<p",
"/",
">",
"A",
"tile",
"is",
"considered",
"stale",
"if",
"one",
"or",
"more",
"of",
"the",
"following",
"two",
"conditions",
"apply",
":",
"<ul",
">",
"<li",
">",
"The",
"{",
"@code",
"bitmap",
"}",
"s",
"{",
"@link",
"org",
".",
"mapsforge",
".",
"core",
".",
"graphics",
".",
"TileBitmap#isExpired",
"()",
"}",
"method",
"returns",
"{",
"@code",
"True",
"}",
".",
"<",
"/",
"li",
">",
"<li",
">",
"The",
"layer",
"has",
"a",
"time",
"-",
"to",
"-",
"live",
"(",
"TTL",
")",
"set",
"(",
"{",
"@link",
"#getCacheTimeToLive",
"()",
"}",
"returns",
"a",
"nonzero",
"value",
")",
"and",
"the",
"sum",
"of",
"the",
"{",
"@code",
"bitmap",
"}",
"s",
"{",
"@link",
"org",
".",
"mapsforge",
".",
"core",
".",
"graphics",
".",
"TileBitmap#getTimestamp",
"()",
"}",
"and",
"TTL",
"is",
"less",
"than",
"current",
"time",
"(",
"as",
"returned",
"by",
"{",
"@link",
"java",
".",
"lang",
".",
"System#currentTimeMillis",
"()",
"}",
")",
".",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<p",
"/",
">",
"When",
"a",
"tile",
"has",
"become",
"stale",
"the",
"layer",
"will",
"first",
"display",
"the",
"tile",
"referenced",
"by",
"{",
"@code",
"bitmap",
"}",
"and",
"attempt",
"to",
"obtain",
"a",
"fresh",
"copy",
"in",
"the",
"background",
".",
"When",
"a",
"fresh",
"copy",
"becomes",
"available",
"the",
"layer",
"will",
"replace",
"it",
"and",
"update",
"the",
"cache",
".",
"If",
"a",
"fresh",
"copy",
"cannot",
"be",
"obtained",
"(",
"e",
".",
"g",
".",
"because",
"the",
"tile",
"is",
"obtained",
"from",
"an",
"online",
"source",
"which",
"cannot",
"be",
"reached",
")",
"the",
"stale",
"tile",
"will",
"continue",
"to",
"be",
"used",
"until",
"another",
"{",
"@code",
"#draw",
"(",
"BoundingBox",
"byte",
"Canvas",
"Point",
")",
"}",
"operation",
"requests",
"it",
"again",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/download/TileDownloadLayer.java#L161-L166 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java | SheetBindingErrors.pushNestedPath | public void pushNestedPath(final String subPath, final String key) {
"""
マップなどのキー付きのパスを1つ下位に移動します。
@param subPath ネストするパス
@param key マップのキー
@throws IllegalArgumentException {@literal subPath is empty or key is empty}
"""
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notEmpty(key, "key");
pushNestedPath(String.format("%s[%s]", canonicalPath, key));
} | java | public void pushNestedPath(final String subPath, final String key) {
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notEmpty(key, "key");
pushNestedPath(String.format("%s[%s]", canonicalPath, key));
} | [
"public",
"void",
"pushNestedPath",
"(",
"final",
"String",
"subPath",
",",
"final",
"String",
"key",
")",
"{",
"final",
"String",
"canonicalPath",
"=",
"normalizePath",
"(",
"subPath",
")",
";",
"ArgUtils",
".",
"notEmpty",
"(",
"subPath",
",",
"\"subPath\"",
")",
";",
"ArgUtils",
".",
"notEmpty",
"(",
"key",
",",
"\"key\"",
")",
";",
"pushNestedPath",
"(",
"String",
".",
"format",
"(",
"\"%s[%s]\"",
",",
"canonicalPath",
",",
"key",
")",
")",
";",
"}"
] | マップなどのキー付きのパスを1つ下位に移動します。
@param subPath ネストするパス
@param key マップのキー
@throws IllegalArgumentException {@literal subPath is empty or key is empty} | [
"マップなどのキー付きのパスを1つ下位に移動します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L332-L338 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/KNNDistancesSampler.java | KNNDistancesSampler.run | public KNNDistanceOrderResult run(Database database, Relation<O> relation) {
"""
Provides an order of the kNN-distances for all objects within the specified
database.
@param database Database
@param relation Relation
@return Result
"""
final DistanceQuery<O> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
final KNNQuery<O> knnQuery = database.getKNNQuery(distanceQuery, k + 1);
final int size = (int) ((sample <= 1.) ? Math.ceil(relation.size() * sample) : sample);
DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), size, rnd);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling kNN distances", size, LOG) : null;
double[] knnDistances = new double[size];
int i = 0;
for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance(), i++) {
final KNNList neighbors = knnQuery.getKNNForDBID(iditer, k + 1);
knnDistances[i] = neighbors.getKNNDistance();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return new KNNDistanceOrderResult(knnDistances, k);
} | java | public KNNDistanceOrderResult run(Database database, Relation<O> relation) {
final DistanceQuery<O> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
final KNNQuery<O> knnQuery = database.getKNNQuery(distanceQuery, k + 1);
final int size = (int) ((sample <= 1.) ? Math.ceil(relation.size() * sample) : sample);
DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), size, rnd);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling kNN distances", size, LOG) : null;
double[] knnDistances = new double[size];
int i = 0;
for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance(), i++) {
final KNNList neighbors = knnQuery.getKNNForDBID(iditer, k + 1);
knnDistances[i] = neighbors.getKNNDistance();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return new KNNDistanceOrderResult(knnDistances, k);
} | [
"public",
"KNNDistanceOrderResult",
"run",
"(",
"Database",
"database",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"final",
"DistanceQuery",
"<",
"O",
">",
"distanceQuery",
"=",
"database",
".",
"getDistanceQuery",
"(",
"relation",
",",
"getDistanceFunction",
"(",
")",
")",
";",
"final",
"KNNQuery",
"<",
"O",
">",
"knnQuery",
"=",
"database",
".",
"getKNNQuery",
"(",
"distanceQuery",
",",
"k",
"+",
"1",
")",
";",
"final",
"int",
"size",
"=",
"(",
"int",
")",
"(",
"(",
"sample",
"<=",
"1.",
")",
"?",
"Math",
".",
"ceil",
"(",
"relation",
".",
"size",
"(",
")",
"*",
"sample",
")",
":",
"sample",
")",
";",
"DBIDs",
"sample",
"=",
"DBIDUtil",
".",
"randomSample",
"(",
"relation",
".",
"getDBIDs",
"(",
")",
",",
"size",
",",
"rnd",
")",
";",
"FiniteProgress",
"prog",
"=",
"LOG",
".",
"isVerbose",
"(",
")",
"?",
"new",
"FiniteProgress",
"(",
"\"Sampling kNN distances\"",
",",
"size",
",",
"LOG",
")",
":",
"null",
";",
"double",
"[",
"]",
"knnDistances",
"=",
"new",
"double",
"[",
"size",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"DBIDIter",
"iditer",
"=",
"sample",
".",
"iter",
"(",
")",
";",
"iditer",
".",
"valid",
"(",
")",
";",
"iditer",
".",
"advance",
"(",
")",
",",
"i",
"++",
")",
"{",
"final",
"KNNList",
"neighbors",
"=",
"knnQuery",
".",
"getKNNForDBID",
"(",
"iditer",
",",
"k",
"+",
"1",
")",
";",
"knnDistances",
"[",
"i",
"]",
"=",
"neighbors",
".",
"getKNNDistance",
"(",
")",
";",
"LOG",
".",
"incrementProcessed",
"(",
"prog",
")",
";",
"}",
"LOG",
".",
"ensureCompleted",
"(",
"prog",
")",
";",
"return",
"new",
"KNNDistanceOrderResult",
"(",
"knnDistances",
",",
"k",
")",
";",
"}"
] | Provides an order of the kNN-distances for all objects within the specified
database.
@param database Database
@param relation Relation
@return Result | [
"Provides",
"an",
"order",
"of",
"the",
"kNN",
"-",
"distances",
"for",
"all",
"objects",
"within",
"the",
"specified",
"database",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/KNNDistancesSampler.java#L137-L155 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.fetchByUUID_G | @Override
public CommerceTierPriceEntry fetchByUUID_G(String uuid, long groupId) {
"""
Returns the commerce tier price entry where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce tier price entry, or <code>null</code> if a matching commerce tier price entry could not be found
"""
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CommerceTierPriceEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CommerceTierPriceEntry",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the commerce tier price entry where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce tier price entry, or <code>null</code> if a matching commerce tier price entry could not be found | [
"Returns",
"the",
"commerce",
"tier",
"price",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L707-L710 |
lightblueseas/email-tails | src/main/java/de/alpharogroup/email/messages/EmailWithAttachments.java | EmailWithAttachments.addAttachment | public void addAttachment(final byte[] content, final String filename, final String mimetype)
throws MessagingException {
"""
Adds the attachment.
@param content
The bytearray with the content.
@param filename
The new Filename for the attachment.
@param mimetype
The mimetype.
@throws MessagingException
is thrown if the underlying implementation does not support modification of
existing values
"""
final DataSource dataSource = new ByteArrayDataSource(content, mimetype);
final DataHandler dataHandler = new DataHandler(dataSource);
addAttachment(dataHandler, filename);
} | java | public void addAttachment(final byte[] content, final String filename, final String mimetype)
throws MessagingException
{
final DataSource dataSource = new ByteArrayDataSource(content, mimetype);
final DataHandler dataHandler = new DataHandler(dataSource);
addAttachment(dataHandler, filename);
} | [
"public",
"void",
"addAttachment",
"(",
"final",
"byte",
"[",
"]",
"content",
",",
"final",
"String",
"filename",
",",
"final",
"String",
"mimetype",
")",
"throws",
"MessagingException",
"{",
"final",
"DataSource",
"dataSource",
"=",
"new",
"ByteArrayDataSource",
"(",
"content",
",",
"mimetype",
")",
";",
"final",
"DataHandler",
"dataHandler",
"=",
"new",
"DataHandler",
"(",
"dataSource",
")",
";",
"addAttachment",
"(",
"dataHandler",
",",
"filename",
")",
";",
"}"
] | Adds the attachment.
@param content
The bytearray with the content.
@param filename
The new Filename for the attachment.
@param mimetype
The mimetype.
@throws MessagingException
is thrown if the underlying implementation does not support modification of
existing values | [
"Adds",
"the",
"attachment",
"."
] | train | https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/messages/EmailWithAttachments.java#L97-L103 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/BaseTable.java | BaseTable.getDataRecord | public DataRecord getDataRecord(boolean bCacheData, int iFieldsTypes) {
"""
Create a representation of the current record and optionally cache all the data fields.
<p>Use the setDataRecord call to make this record current again
@param bCacheData boolean Cache the data?
@param iFieldTypes The types of fields to cache (see BaseBuffer).
@return DataRecord The information needed to recreate this record.
"""
if ((this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS)
&& (this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_CURRENT))
return null;
DataRecord dataRecord = new DataRecord(null);
try {
dataRecord.setHandle(this.getHandle(DBConstants.BOOKMARK_HANDLE), DBConstants.BOOKMARK_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.DATA_SOURCE_HANDLE), DBConstants.DATA_SOURCE_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_ID_HANDLE), DBConstants.OBJECT_ID_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_SOURCE_HANDLE), DBConstants.OBJECT_SOURCE_HANDLE);
} catch (DBException ex) {
dataRecord.free();
dataRecord = null;
}
if (dataRecord != null) if (bCacheData)
{
BaseBuffer buffer = new VectorBuffer(null, iFieldsTypes);
buffer.fieldsToBuffer(this.getCurrentTable().getRecord(), iFieldsTypes);
dataRecord.setBuffer(buffer);
}
return dataRecord;
} | java | public DataRecord getDataRecord(boolean bCacheData, int iFieldsTypes)
{
if ((this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS)
&& (this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_CURRENT))
return null;
DataRecord dataRecord = new DataRecord(null);
try {
dataRecord.setHandle(this.getHandle(DBConstants.BOOKMARK_HANDLE), DBConstants.BOOKMARK_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.DATA_SOURCE_HANDLE), DBConstants.DATA_SOURCE_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_ID_HANDLE), DBConstants.OBJECT_ID_HANDLE);
dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_SOURCE_HANDLE), DBConstants.OBJECT_SOURCE_HANDLE);
} catch (DBException ex) {
dataRecord.free();
dataRecord = null;
}
if (dataRecord != null) if (bCacheData)
{
BaseBuffer buffer = new VectorBuffer(null, iFieldsTypes);
buffer.fieldsToBuffer(this.getCurrentTable().getRecord(), iFieldsTypes);
dataRecord.setBuffer(buffer);
}
return dataRecord;
} | [
"public",
"DataRecord",
"getDataRecord",
"(",
"boolean",
"bCacheData",
",",
"int",
"iFieldsTypes",
")",
"{",
"if",
"(",
"(",
"this",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getEditMode",
"(",
")",
"!=",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"&&",
"(",
"this",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getEditMode",
"(",
")",
"!=",
"Constants",
".",
"EDIT_CURRENT",
")",
")",
"return",
"null",
";",
"DataRecord",
"dataRecord",
"=",
"new",
"DataRecord",
"(",
"null",
")",
";",
"try",
"{",
"dataRecord",
".",
"setHandle",
"(",
"this",
".",
"getHandle",
"(",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
",",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"dataRecord",
".",
"setHandle",
"(",
"this",
".",
"getHandle",
"(",
"DBConstants",
".",
"DATA_SOURCE_HANDLE",
")",
",",
"DBConstants",
".",
"DATA_SOURCE_HANDLE",
")",
";",
"dataRecord",
".",
"setHandle",
"(",
"this",
".",
"getHandle",
"(",
"DBConstants",
".",
"OBJECT_ID_HANDLE",
")",
",",
"DBConstants",
".",
"OBJECT_ID_HANDLE",
")",
";",
"dataRecord",
".",
"setHandle",
"(",
"this",
".",
"getHandle",
"(",
"DBConstants",
".",
"OBJECT_SOURCE_HANDLE",
")",
",",
"DBConstants",
".",
"OBJECT_SOURCE_HANDLE",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"dataRecord",
".",
"free",
"(",
")",
";",
"dataRecord",
"=",
"null",
";",
"}",
"if",
"(",
"dataRecord",
"!=",
"null",
")",
"if",
"(",
"bCacheData",
")",
"{",
"BaseBuffer",
"buffer",
"=",
"new",
"VectorBuffer",
"(",
"null",
",",
"iFieldsTypes",
")",
";",
"buffer",
".",
"fieldsToBuffer",
"(",
"this",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
",",
"iFieldsTypes",
")",
";",
"dataRecord",
".",
"setBuffer",
"(",
"buffer",
")",
";",
"}",
"return",
"dataRecord",
";",
"}"
] | Create a representation of the current record and optionally cache all the data fields.
<p>Use the setDataRecord call to make this record current again
@param bCacheData boolean Cache the data?
@param iFieldTypes The types of fields to cache (see BaseBuffer).
@return DataRecord The information needed to recreate this record. | [
"Create",
"a",
"representation",
"of",
"the",
"current",
"record",
"and",
"optionally",
"cache",
"all",
"the",
"data",
"fields",
".",
"<p",
">",
"Use",
"the",
"setDataRecord",
"call",
"to",
"make",
"this",
"record",
"current",
"again"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L353-L375 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.noNullElements | public <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
"""
<p>Validate that the specified argument iterable is neither {@code null} nor contains any elements that are {@code null}; otherwise throwing an exception with the specified message. </p>
<pre>Validate.noNullElements(myCollection, "The collection contains null at position %d");</pre>
<p>If the iterable is {@code null}, then the message in the exception is "The validated object is null".</p><p>If the iterable has a {@code null} element, then the iteration index of
the invalid element is appended to the {@code values} argument.</p>
@param <T>
the iterable type
@param iterable
the iterable to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated iterable (never {@code null} method for chaining)
@throws NullPointerValidationException
if the array is {@code null}
@throws IllegalArgumentException
if an element is {@code null}
@see #noNullElements(Iterable)
"""
notNull(iterable);
final int index = indexOfNullElement(iterable);
if (index != -1) {
fail(String.format(message, ArrayUtils.addAll(this, values, index)));
}
return iterable;
} | java | public <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
notNull(iterable);
final int index = indexOfNullElement(iterable);
if (index != -1) {
fail(String.format(message, ArrayUtils.addAll(this, values, index)));
}
return iterable;
} | [
"public",
"<",
"T",
"extends",
"Iterable",
"<",
"?",
">",
">",
"T",
"noNullElements",
"(",
"final",
"T",
"iterable",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"notNull",
"(",
"iterable",
")",
";",
"final",
"int",
"index",
"=",
"indexOfNullElement",
"(",
"iterable",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"fail",
"(",
"String",
".",
"format",
"(",
"message",
",",
"ArrayUtils",
".",
"addAll",
"(",
"this",
",",
"values",
",",
"index",
")",
")",
")",
";",
"}",
"return",
"iterable",
";",
"}"
] | <p>Validate that the specified argument iterable is neither {@code null} nor contains any elements that are {@code null}; otherwise throwing an exception with the specified message. </p>
<pre>Validate.noNullElements(myCollection, "The collection contains null at position %d");</pre>
<p>If the iterable is {@code null}, then the message in the exception is "The validated object is null".</p><p>If the iterable has a {@code null} element, then the iteration index of
the invalid element is appended to the {@code values} argument.</p>
@param <T>
the iterable type
@param iterable
the iterable to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated iterable (never {@code null} method for chaining)
@throws NullPointerValidationException
if the array is {@code null}
@throws IllegalArgumentException
if an element is {@code null}
@see #noNullElements(Iterable) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"iterable",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"contains",
"any",
"elements",
"that",
"are",
"{",
"@code",
"null",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"<",
"/",
"p",
">",
"<pre",
">",
"Validate",
".",
"noNullElements",
"(",
"myCollection",
"The",
"collection",
"contains",
"null",
"at",
"position",
"%d",
")",
";",
"<",
"/",
"pre",
">",
"<p",
">",
"If",
"the",
"iterable",
"is",
"{",
"@code",
"null",
"}",
"then",
"the",
"message",
"in",
"the",
"exception",
"is",
""",
";",
"The",
"validated",
"object",
"is",
"null"",
";",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"the",
"iterable",
"has",
"a",
"{",
"@code",
"null",
"}",
"element",
"then",
"the",
"iteration",
"index",
"of",
"the",
"invalid",
"element",
"is",
"appended",
"to",
"the",
"{",
"@code",
"values",
"}",
"argument",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L892-L900 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java | RelationType.withAlias | public RelationType withAlias(String relationAlias, List<String> columnAliases) {
"""
Creates a new tuple descriptor with the relation, and, optionally, the columns aliased.
"""
if (columnAliases != null) {
checkArgument(columnAliases.size() == visibleFields.size(),
"Column alias list has %s entries but '%s' has %s columns available",
columnAliases.size(),
relationAlias,
visibleFields.size());
}
ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder();
for (int i = 0; i < allFields.size(); i++) {
Field field = allFields.get(i);
Optional<String> columnAlias = field.getName();
if (columnAliases == null) {
fieldsBuilder.add(Field.newQualified(
QualifiedName.of(relationAlias),
columnAlias,
field.getType(),
field.isHidden(),
field.getOriginTable(),
field.getOriginColumnName(),
field.isAliased()));
}
else if (!field.isHidden()) {
// hidden fields are not exposed when there are column aliases
columnAlias = Optional.of(columnAliases.get(i));
fieldsBuilder.add(Field.newQualified(
QualifiedName.of(relationAlias),
columnAlias,
field.getType(),
false,
field.getOriginTable(),
field.getOriginColumnName(),
field.isAliased()));
}
}
return new RelationType(fieldsBuilder.build());
} | java | public RelationType withAlias(String relationAlias, List<String> columnAliases)
{
if (columnAliases != null) {
checkArgument(columnAliases.size() == visibleFields.size(),
"Column alias list has %s entries but '%s' has %s columns available",
columnAliases.size(),
relationAlias,
visibleFields.size());
}
ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder();
for (int i = 0; i < allFields.size(); i++) {
Field field = allFields.get(i);
Optional<String> columnAlias = field.getName();
if (columnAliases == null) {
fieldsBuilder.add(Field.newQualified(
QualifiedName.of(relationAlias),
columnAlias,
field.getType(),
field.isHidden(),
field.getOriginTable(),
field.getOriginColumnName(),
field.isAliased()));
}
else if (!field.isHidden()) {
// hidden fields are not exposed when there are column aliases
columnAlias = Optional.of(columnAliases.get(i));
fieldsBuilder.add(Field.newQualified(
QualifiedName.of(relationAlias),
columnAlias,
field.getType(),
false,
field.getOriginTable(),
field.getOriginColumnName(),
field.isAliased()));
}
}
return new RelationType(fieldsBuilder.build());
} | [
"public",
"RelationType",
"withAlias",
"(",
"String",
"relationAlias",
",",
"List",
"<",
"String",
">",
"columnAliases",
")",
"{",
"if",
"(",
"columnAliases",
"!=",
"null",
")",
"{",
"checkArgument",
"(",
"columnAliases",
".",
"size",
"(",
")",
"==",
"visibleFields",
".",
"size",
"(",
")",
",",
"\"Column alias list has %s entries but '%s' has %s columns available\"",
",",
"columnAliases",
".",
"size",
"(",
")",
",",
"relationAlias",
",",
"visibleFields",
".",
"size",
"(",
")",
")",
";",
"}",
"ImmutableList",
".",
"Builder",
"<",
"Field",
">",
"fieldsBuilder",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allFields",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Field",
"field",
"=",
"allFields",
".",
"get",
"(",
"i",
")",
";",
"Optional",
"<",
"String",
">",
"columnAlias",
"=",
"field",
".",
"getName",
"(",
")",
";",
"if",
"(",
"columnAliases",
"==",
"null",
")",
"{",
"fieldsBuilder",
".",
"add",
"(",
"Field",
".",
"newQualified",
"(",
"QualifiedName",
".",
"of",
"(",
"relationAlias",
")",
",",
"columnAlias",
",",
"field",
".",
"getType",
"(",
")",
",",
"field",
".",
"isHidden",
"(",
")",
",",
"field",
".",
"getOriginTable",
"(",
")",
",",
"field",
".",
"getOriginColumnName",
"(",
")",
",",
"field",
".",
"isAliased",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"field",
".",
"isHidden",
"(",
")",
")",
"{",
"// hidden fields are not exposed when there are column aliases",
"columnAlias",
"=",
"Optional",
".",
"of",
"(",
"columnAliases",
".",
"get",
"(",
"i",
")",
")",
";",
"fieldsBuilder",
".",
"add",
"(",
"Field",
".",
"newQualified",
"(",
"QualifiedName",
".",
"of",
"(",
"relationAlias",
")",
",",
"columnAlias",
",",
"field",
".",
"getType",
"(",
")",
",",
"false",
",",
"field",
".",
"getOriginTable",
"(",
")",
",",
"field",
".",
"getOriginColumnName",
"(",
")",
",",
"field",
".",
"isAliased",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"new",
"RelationType",
"(",
"fieldsBuilder",
".",
"build",
"(",
")",
")",
";",
"}"
] | Creates a new tuple descriptor with the relation, and, optionally, the columns aliased. | [
"Creates",
"a",
"new",
"tuple",
"descriptor",
"with",
"the",
"relation",
"and",
"optionally",
"the",
"columns",
"aliased",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L162-L201 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.availableOffer_GET | public ArrayList<OvhOfferEnum> availableOffer_GET(String domain) throws IOException {
"""
Get available offer
REST: GET /hosting/web/availableOffer
@param domain [required] Domain you want to add or upgrade a hosting
"""
String qPath = "/hosting/web/availableOffer";
StringBuilder sb = path(qPath);
query(sb, "domain", domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhOfferEnum> availableOffer_GET(String domain) throws IOException {
String qPath = "/hosting/web/availableOffer";
StringBuilder sb = path(qPath);
query(sb, "domain", domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhOfferEnum",
">",
"availableOffer_GET",
"(",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/availableOffer\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\"domain\"",
",",
"domain",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t2",
")",
";",
"}"
] | Get available offer
REST: GET /hosting/web/availableOffer
@param domain [required] Domain you want to add or upgrade a hosting | [
"Get",
"available",
"offer"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L109-L115 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageWithNoStoreAsync | public Observable<ImagePrediction> predictImageWithNoStoreAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) {
"""
Predict an image without saving the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object
"""
return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, predictImageWithNoStoreOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | java | public Observable<ImagePrediction> predictImageWithNoStoreAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) {
return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, predictImageWithNoStoreOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImagePrediction",
">",
"predictImageWithNoStoreAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"PredictImageWithNoStoreOptionalParameter",
"predictImageWithNoStoreOptionalParameter",
")",
"{",
"return",
"predictImageWithNoStoreWithServiceResponseAsync",
"(",
"projectId",
",",
"imageData",
",",
"predictImageWithNoStoreOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ImagePrediction",
">",
",",
"ImagePrediction",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ImagePrediction",
"call",
"(",
"ServiceResponse",
"<",
"ImagePrediction",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Predict an image without saving the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object | [
"Predict",
"an",
"image",
"without",
"saving",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L124-L131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.