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
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
couchbase/couchbase-java-client
|
src/main/java/com/couchbase/client/java/view/ViewQuery.java
|
ViewQuery.includeDocsOrdered
|
public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
"""
Proactively load the full document for the row returned, while strictly retaining view row order.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
@param includeDocs if it should be enabled or not.
@param target the custom document type target.
@return the {@link ViewQuery} DSL.
"""
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
}
|
java
|
public ViewQuery includeDocsOrdered(boolean includeDocs, Class<? extends Document<?>> target) {
this.includeDocs = includeDocs;
this.retainOrder = includeDocs; //deactivate if includeDocs is deactivated
this.includeDocsTarget = target;
return this;
}
|
[
"public",
"ViewQuery",
"includeDocsOrdered",
"(",
"boolean",
"includeDocs",
",",
"Class",
"<",
"?",
"extends",
"Document",
"<",
"?",
">",
">",
"target",
")",
"{",
"this",
".",
"includeDocs",
"=",
"includeDocs",
";",
"this",
".",
"retainOrder",
"=",
"includeDocs",
";",
"//deactivate if includeDocs is deactivated",
"this",
".",
"includeDocsTarget",
"=",
"target",
";",
"return",
"this",
";",
"}"
] |
Proactively load the full document for the row returned, while strictly retaining view row order.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
@param includeDocs if it should be enabled or not.
@param target the custom document type target.
@return the {@link ViewQuery} DSL.
|
[
"Proactively",
"load",
"the",
"full",
"document",
"for",
"the",
"row",
"returned",
"while",
"strictly",
"retaining",
"view",
"row",
"order",
"."
] |
train
|
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQuery.java#L141-L146
|
vipshop/vjtools
|
vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java
|
ValueValidator.checkAndGet
|
public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) {
"""
对目标值进行校验,并根据校验结果取值
使用示例(校验目标值是否大于0, 如果小于 0 则取值为 1)
ValueValidator.checkAndGet(idleTime, 1, Validator.INTEGER_GT_ZERO_VALIDATOR)
@param value 校验值
@param defaultValue 校验失败默认值
@param v 校验器
@return 经Validator校验后的返回值,校验成功返回 value, 校验失败返回 defaultValue
"""
if (v.validate(value)) {
return value;
}
return defaultValue;
}
|
java
|
public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) {
if (v.validate(value)) {
return value;
}
return defaultValue;
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"checkAndGet",
"(",
"T",
"value",
",",
"T",
"defaultValue",
",",
"Validator",
"<",
"T",
">",
"v",
")",
"{",
"if",
"(",
"v",
".",
"validate",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"return",
"defaultValue",
";",
"}"
] |
对目标值进行校验,并根据校验结果取值
使用示例(校验目标值是否大于0, 如果小于 0 则取值为 1)
ValueValidator.checkAndGet(idleTime, 1, Validator.INTEGER_GT_ZERO_VALIDATOR)
@param value 校验值
@param defaultValue 校验失败默认值
@param v 校验器
@return 经Validator校验后的返回值,校验成功返回 value, 校验失败返回 defaultValue
|
[
"对目标值进行校验,并根据校验结果取值"
] |
train
|
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java#L30-L36
|
jayantk/jklol
|
src/com/jayantkrish/jklol/lisp/LispUtil.java
|
LispUtil.checkArgument
|
public static void checkArgument(boolean condition, String message, Object ... values) {
"""
Identical to Preconditions.checkArgument but throws an
{@code EvalError} instead of an IllegalArgumentException.
Use this check to verify properties of a Lisp program
execution, i.e., whenever the raised exception should be
catchable by the evaluator of the program.
@param condition
@param message
@param values
"""
if (!condition) {
throw new EvalError(String.format(message, values));
}
}
|
java
|
public static void checkArgument(boolean condition, String message, Object ... values) {
if (!condition) {
throw new EvalError(String.format(message, values));
}
}
|
[
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"condition",
",",
"String",
"message",
",",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"EvalError",
"(",
"String",
".",
"format",
"(",
"message",
",",
"values",
")",
")",
";",
"}",
"}"
] |
Identical to Preconditions.checkArgument but throws an
{@code EvalError} instead of an IllegalArgumentException.
Use this check to verify properties of a Lisp program
execution, i.e., whenever the raised exception should be
catchable by the evaluator of the program.
@param condition
@param message
@param values
|
[
"Identical",
"to",
"Preconditions",
".",
"checkArgument",
"but",
"throws",
"an",
"{",
"@code",
"EvalError",
"}",
"instead",
"of",
"an",
"IllegalArgumentException",
".",
"Use",
"this",
"check",
"to",
"verify",
"properties",
"of",
"a",
"Lisp",
"program",
"execution",
"i",
".",
"e",
".",
"whenever",
"the",
"raised",
"exception",
"should",
"be",
"catchable",
"by",
"the",
"evaluator",
"of",
"the",
"program",
"."
] |
train
|
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/LispUtil.java#L56-L60
|
docusign/docusign-java-client
|
src/main/java/com/docusign/esign/api/TemplatesApi.java
|
TemplatesApi.listTabs
|
public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException {
"""
Gets the tabs information for a signer or sign-in-person recipient in a template.
Gets the tabs information for a signer or sign-in-person recipient in a template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param recipientId The ID of the recipient being accessed. (required)
@return Tabs
"""
return listTabs(accountId, templateId, recipientId, null);
}
|
java
|
public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException {
return listTabs(accountId, templateId, recipientId, null);
}
|
[
"public",
"Tabs",
"listTabs",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"listTabs",
"(",
"accountId",
",",
"templateId",
",",
"recipientId",
",",
"null",
")",
";",
"}"
] |
Gets the tabs information for a signer or sign-in-person recipient in a template.
Gets the tabs information for a signer or sign-in-person recipient in a template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param recipientId The ID of the recipient being accessed. (required)
@return Tabs
|
[
"Gets",
"the",
"tabs",
"information",
"for",
"a",
"signer",
"or",
"sign",
"-",
"in",
"-",
"person",
"recipient",
"in",
"a",
"template",
".",
"Gets",
"the",
"tabs",
"information",
"for",
"a",
"signer",
"or",
"sign",
"-",
"in",
"-",
"person",
"recipient",
"in",
"a",
"template",
"."
] |
train
|
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2363-L2365
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
|
ApiOvhMe.payment_thod_paymentMethodId_PUT
|
public net.minidev.ovh.api.billing.OvhPaymentMethod payment_thod_paymentMethodId_PUT(Long paymentMethodId, Long billingContactId, Boolean _default, String description) throws IOException {
"""
Edit payment method
REST: PUT /me/payment/method/{paymentMethodId}
@param paymentMethodId [required] Payment method ID
@param _default [required] Set this method like default
@param description [required] Customer personalized description
@param billingContactId [required] Change your billing contact
API beta
"""
String qPath = "/me/payment/method/{paymentMethodId}";
StringBuilder sb = path(qPath, paymentMethodId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "billingContactId", billingContactId);
addBody(o, "default", _default);
addBody(o, "description", description);
String resp = exec(qPath, "PUT", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.billing.OvhPaymentMethod.class);
}
|
java
|
public net.minidev.ovh.api.billing.OvhPaymentMethod payment_thod_paymentMethodId_PUT(Long paymentMethodId, Long billingContactId, Boolean _default, String description) throws IOException {
String qPath = "/me/payment/method/{paymentMethodId}";
StringBuilder sb = path(qPath, paymentMethodId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "billingContactId", billingContactId);
addBody(o, "default", _default);
addBody(o, "description", description);
String resp = exec(qPath, "PUT", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.billing.OvhPaymentMethod.class);
}
|
[
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"billing",
".",
"OvhPaymentMethod",
"payment_thod_paymentMethodId_PUT",
"(",
"Long",
"paymentMethodId",
",",
"Long",
"billingContactId",
",",
"Boolean",
"_default",
",",
"String",
"description",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/payment/method/{paymentMethodId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"paymentMethodId",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"billingContactId\"",
",",
"billingContactId",
")",
";",
"addBody",
"(",
"o",
",",
"\"default\"",
",",
"_default",
")",
";",
"addBody",
"(",
"o",
",",
"\"description\"",
",",
"description",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"billing",
".",
"OvhPaymentMethod",
".",
"class",
")",
";",
"}"
] |
Edit payment method
REST: PUT /me/payment/method/{paymentMethodId}
@param paymentMethodId [required] Payment method ID
@param _default [required] Set this method like default
@param description [required] Customer personalized description
@param billingContactId [required] Change your billing contact
API beta
|
[
"Edit",
"payment",
"method"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1075-L1084
|
reactiverse/reactive-pg-client
|
src/main/java/io/reactiverse/pgclient/impl/codec/encoder/MessageEncoder.java
|
MessageEncoder.writeExecute
|
public void writeExecute(String portal, int rowCount) {
"""
The message specifies the portal and a maximum row count (zero meaning "fetch all rows") of the result.
<p>
The row count of the result is only meaningful for portals containing commands that return row sets;
in other cases the command is always executed to completion, and the row count of the result is ignored.
<p>
The possible responses to this message are the same as {@link Query} message, except that
it doesn't cause {@link ReadyForQuery} or {@link RowDescription} to be issued.
<p>
If Execute terminates before completing the execution of a portal, it will send a {@link PortalSuspended} message;
the appearance of this message tells the frontend that another Execute should be issued against the same portal to
complete the operation. The {@link CommandComplete} message indicating completion of the source SQL command
is not sent until the portal's execution is completed. Therefore, This message is always terminated by
the appearance of exactly one of these messages: {@link CommandComplete},
{@link EmptyQueryResponse}, {@link ErrorResponse} or {@link PortalSuspended}.
@author <a href="mailto:[email protected]">Emad Alblueshi</a>
"""
ensureBuffer();
int pos = out.writerIndex();
out.writeByte(EXECUTE);
out.writeInt(0);
if (portal != null) {
out.writeCharSequence(portal, StandardCharsets.UTF_8);
}
out.writeByte(0);
out.writeInt(rowCount); // Zero denotes "no limit" maybe for ReadStream<Row>
out.setInt(pos + 1, out.writerIndex() - pos - 1);
}
|
java
|
public void writeExecute(String portal, int rowCount) {
ensureBuffer();
int pos = out.writerIndex();
out.writeByte(EXECUTE);
out.writeInt(0);
if (portal != null) {
out.writeCharSequence(portal, StandardCharsets.UTF_8);
}
out.writeByte(0);
out.writeInt(rowCount); // Zero denotes "no limit" maybe for ReadStream<Row>
out.setInt(pos + 1, out.writerIndex() - pos - 1);
}
|
[
"public",
"void",
"writeExecute",
"(",
"String",
"portal",
",",
"int",
"rowCount",
")",
"{",
"ensureBuffer",
"(",
")",
";",
"int",
"pos",
"=",
"out",
".",
"writerIndex",
"(",
")",
";",
"out",
".",
"writeByte",
"(",
"EXECUTE",
")",
";",
"out",
".",
"writeInt",
"(",
"0",
")",
";",
"if",
"(",
"portal",
"!=",
"null",
")",
"{",
"out",
".",
"writeCharSequence",
"(",
"portal",
",",
"StandardCharsets",
".",
"UTF_8",
")",
";",
"}",
"out",
".",
"writeByte",
"(",
"0",
")",
";",
"out",
".",
"writeInt",
"(",
"rowCount",
")",
";",
"// Zero denotes \"no limit\" maybe for ReadStream<Row>",
"out",
".",
"setInt",
"(",
"pos",
"+",
"1",
",",
"out",
".",
"writerIndex",
"(",
")",
"-",
"pos",
"-",
"1",
")",
";",
"}"
] |
The message specifies the portal and a maximum row count (zero meaning "fetch all rows") of the result.
<p>
The row count of the result is only meaningful for portals containing commands that return row sets;
in other cases the command is always executed to completion, and the row count of the result is ignored.
<p>
The possible responses to this message are the same as {@link Query} message, except that
it doesn't cause {@link ReadyForQuery} or {@link RowDescription} to be issued.
<p>
If Execute terminates before completing the execution of a portal, it will send a {@link PortalSuspended} message;
the appearance of this message tells the frontend that another Execute should be issued against the same portal to
complete the operation. The {@link CommandComplete} message indicating completion of the source SQL command
is not sent until the portal's execution is completed. Therefore, This message is always terminated by
the appearance of exactly one of these messages: {@link CommandComplete},
{@link EmptyQueryResponse}, {@link ErrorResponse} or {@link PortalSuspended}.
@author <a href="mailto:[email protected]">Emad Alblueshi</a>
|
[
"The",
"message",
"specifies",
"the",
"portal",
"and",
"a",
"maximum",
"row",
"count",
"(",
"zero",
"meaning",
"fetch",
"all",
"rows",
")",
"of",
"the",
"result",
".",
"<p",
">",
"The",
"row",
"count",
"of",
"the",
"result",
"is",
"only",
"meaningful",
"for",
"portals",
"containing",
"commands",
"that",
"return",
"row",
"sets",
";",
"in",
"other",
"cases",
"the",
"command",
"is",
"always",
"executed",
"to",
"completion",
"and",
"the",
"row",
"count",
"of",
"the",
"result",
"is",
"ignored",
".",
"<p",
">",
"The",
"possible",
"responses",
"to",
"this",
"message",
"are",
"the",
"same",
"as",
"{",
"@link",
"Query",
"}",
"message",
"except",
"that",
"it",
"doesn",
"t",
"cause",
"{",
"@link",
"ReadyForQuery",
"}",
"or",
"{",
"@link",
"RowDescription",
"}",
"to",
"be",
"issued",
".",
"<p",
">",
"If",
"Execute",
"terminates",
"before",
"completing",
"the",
"execution",
"of",
"a",
"portal",
"it",
"will",
"send",
"a",
"{",
"@link",
"PortalSuspended",
"}",
"message",
";",
"the",
"appearance",
"of",
"this",
"message",
"tells",
"the",
"frontend",
"that",
"another",
"Execute",
"should",
"be",
"issued",
"against",
"the",
"same",
"portal",
"to",
"complete",
"the",
"operation",
".",
"The",
"{",
"@link",
"CommandComplete",
"}",
"message",
"indicating",
"completion",
"of",
"the",
"source",
"SQL",
"command",
"is",
"not",
"sent",
"until",
"the",
"portal",
"s",
"execution",
"is",
"completed",
".",
"Therefore",
"This",
"message",
"is",
"always",
"terminated",
"by",
"the",
"appearance",
"of",
"exactly",
"one",
"of",
"these",
"messages",
":",
"{",
"@link",
"CommandComplete",
"}",
"{",
"@link",
"EmptyQueryResponse",
"}",
"{",
"@link",
"ErrorResponse",
"}",
"or",
"{",
"@link",
"PortalSuspended",
"}",
"."
] |
train
|
https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/impl/codec/encoder/MessageEncoder.java#L256-L267
|
Azure/azure-sdk-for-java
|
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java
|
AssetFiltersInner.createOrUpdate
|
public AssetFilterInner createOrUpdate(String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters) {
"""
Create or update an Asset Filter.
Creates or updates an Asset Filter associated with the specified Asset.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param assetName The Asset name.
@param filterName The Asset Filter name
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AssetFilterInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName, parameters).toBlocking().single().body();
}
|
java
|
public AssetFilterInner createOrUpdate(String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName, parameters).toBlocking().single().body();
}
|
[
"public",
"AssetFilterInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"assetName",
",",
"String",
"filterName",
",",
"AssetFilterInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"assetName",
",",
"filterName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Create or update an Asset Filter.
Creates or updates an Asset Filter associated with the specified Asset.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param assetName The Asset name.
@param filterName The Asset Filter name
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AssetFilterInner object if successful.
|
[
"Create",
"or",
"update",
"an",
"Asset",
"Filter",
".",
"Creates",
"or",
"updates",
"an",
"Asset",
"Filter",
"associated",
"with",
"the",
"specified",
"Asset",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java#L346-L348
|
b3dgs/lionengine
|
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
|
ToolsAwt.createBufferStrategy
|
public static void createBufferStrategy(java.awt.Canvas component, GraphicsConfiguration conf) {
"""
Create the buffer strategy using default capabilities.
@param component The component reference.
@param conf The current configuration.
"""
try
{
component.createBufferStrategy(2, conf.getBufferCapabilities());
}
catch (final AWTException exception)
{
Verbose.exception(exception);
component.createBufferStrategy(1);
}
}
|
java
|
public static void createBufferStrategy(java.awt.Canvas component, GraphicsConfiguration conf)
{
try
{
component.createBufferStrategy(2, conf.getBufferCapabilities());
}
catch (final AWTException exception)
{
Verbose.exception(exception);
component.createBufferStrategy(1);
}
}
|
[
"public",
"static",
"void",
"createBufferStrategy",
"(",
"java",
".",
"awt",
".",
"Canvas",
"component",
",",
"GraphicsConfiguration",
"conf",
")",
"{",
"try",
"{",
"component",
".",
"createBufferStrategy",
"(",
"2",
",",
"conf",
".",
"getBufferCapabilities",
"(",
")",
")",
";",
"}",
"catch",
"(",
"final",
"AWTException",
"exception",
")",
"{",
"Verbose",
".",
"exception",
"(",
"exception",
")",
";",
"component",
".",
"createBufferStrategy",
"(",
"1",
")",
";",
"}",
"}"
] |
Create the buffer strategy using default capabilities.
@param component The component reference.
@param conf The current configuration.
|
[
"Create",
"the",
"buffer",
"strategy",
"using",
"default",
"capabilities",
"."
] |
train
|
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L381-L392
|
craftercms/commons
|
utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java
|
HttpUtils.getFullRequestUri
|
public static final String getFullRequestUri(HttpServletRequest request, boolean includeQueryString) {
"""
Returns the full request URI, including scheme, server name, port number and server path. The query string
is optional.
@param request the request object used to build the URI
@param includeQueryString if the query string should be appended to the URI
@return the full request URI
"""
StringBuilder uri = getBaseRequestUrl(request, false).append(request.getRequestURI());
if (includeQueryString) {
String queryStr = request.getQueryString();
if (StringUtils.isNotEmpty(queryStr)) {
uri.append('?').append(queryStr);
}
}
return uri.toString();
}
|
java
|
public static final String getFullRequestUri(HttpServletRequest request, boolean includeQueryString) {
StringBuilder uri = getBaseRequestUrl(request, false).append(request.getRequestURI());
if (includeQueryString) {
String queryStr = request.getQueryString();
if (StringUtils.isNotEmpty(queryStr)) {
uri.append('?').append(queryStr);
}
}
return uri.toString();
}
|
[
"public",
"static",
"final",
"String",
"getFullRequestUri",
"(",
"HttpServletRequest",
"request",
",",
"boolean",
"includeQueryString",
")",
"{",
"StringBuilder",
"uri",
"=",
"getBaseRequestUrl",
"(",
"request",
",",
"false",
")",
".",
"append",
"(",
"request",
".",
"getRequestURI",
"(",
")",
")",
";",
"if",
"(",
"includeQueryString",
")",
"{",
"String",
"queryStr",
"=",
"request",
".",
"getQueryString",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"queryStr",
")",
")",
"{",
"uri",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"queryStr",
")",
";",
"}",
"}",
"return",
"uri",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the full request URI, including scheme, server name, port number and server path. The query string
is optional.
@param request the request object used to build the URI
@param includeQueryString if the query string should be appended to the URI
@return the full request URI
|
[
"Returns",
"the",
"full",
"request",
"URI",
"including",
"scheme",
"server",
"name",
"port",
"number",
"and",
"server",
"path",
".",
"The",
"query",
"string",
"is",
"optional",
"."
] |
train
|
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java#L127-L138
|
threerings/nenya
|
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
|
MisoScenePanel.paintDirtyItems
|
protected void paintDirtyItems (Graphics2D gfx, Rectangle clip) {
"""
Renders the dirty sprites and objects in the scene to the given graphics context.
"""
// add any sprites impacted by the dirty rectangle
_dirtySprites.clear();
_spritemgr.getIntersectingSprites(_dirtySprites, clip);
int size = _dirtySprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = _dirtySprites.get(ii);
Rectangle bounds = sprite.getBounds();
if (!bounds.intersects(clip)) {
continue;
}
appendDirtySprite(_dirtyItems, sprite);
// Log.info("Dirtied item: " + sprite);
}
// add any objects impacted by the dirty rectangle
for (SceneObject scobj : _vizobjs) {
if (!scobj.bounds.intersects(clip)) {
continue;
}
_dirtyItems.appendDirtyObject(scobj);
// Log.info("Dirtied item: " + scobj);
}
// Log.info("paintDirtyItems [items=" + _dirtyItems.size() + "].");
// sort the dirty items so that we can paint them back-to-front
_dirtyItems.sort();
_dirtyItems.paintAndClear(gfx);
}
|
java
|
protected void paintDirtyItems (Graphics2D gfx, Rectangle clip)
{
// add any sprites impacted by the dirty rectangle
_dirtySprites.clear();
_spritemgr.getIntersectingSprites(_dirtySprites, clip);
int size = _dirtySprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = _dirtySprites.get(ii);
Rectangle bounds = sprite.getBounds();
if (!bounds.intersects(clip)) {
continue;
}
appendDirtySprite(_dirtyItems, sprite);
// Log.info("Dirtied item: " + sprite);
}
// add any objects impacted by the dirty rectangle
for (SceneObject scobj : _vizobjs) {
if (!scobj.bounds.intersects(clip)) {
continue;
}
_dirtyItems.appendDirtyObject(scobj);
// Log.info("Dirtied item: " + scobj);
}
// Log.info("paintDirtyItems [items=" + _dirtyItems.size() + "].");
// sort the dirty items so that we can paint them back-to-front
_dirtyItems.sort();
_dirtyItems.paintAndClear(gfx);
}
|
[
"protected",
"void",
"paintDirtyItems",
"(",
"Graphics2D",
"gfx",
",",
"Rectangle",
"clip",
")",
"{",
"// add any sprites impacted by the dirty rectangle",
"_dirtySprites",
".",
"clear",
"(",
")",
";",
"_spritemgr",
".",
"getIntersectingSprites",
"(",
"_dirtySprites",
",",
"clip",
")",
";",
"int",
"size",
"=",
"_dirtySprites",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"size",
";",
"ii",
"++",
")",
"{",
"Sprite",
"sprite",
"=",
"_dirtySprites",
".",
"get",
"(",
"ii",
")",
";",
"Rectangle",
"bounds",
"=",
"sprite",
".",
"getBounds",
"(",
")",
";",
"if",
"(",
"!",
"bounds",
".",
"intersects",
"(",
"clip",
")",
")",
"{",
"continue",
";",
"}",
"appendDirtySprite",
"(",
"_dirtyItems",
",",
"sprite",
")",
";",
"// Log.info(\"Dirtied item: \" + sprite);",
"}",
"// add any objects impacted by the dirty rectangle",
"for",
"(",
"SceneObject",
"scobj",
":",
"_vizobjs",
")",
"{",
"if",
"(",
"!",
"scobj",
".",
"bounds",
".",
"intersects",
"(",
"clip",
")",
")",
"{",
"continue",
";",
"}",
"_dirtyItems",
".",
"appendDirtyObject",
"(",
"scobj",
")",
";",
"// Log.info(\"Dirtied item: \" + scobj);",
"}",
"// Log.info(\"paintDirtyItems [items=\" + _dirtyItems.size() + \"].\");",
"// sort the dirty items so that we can paint them back-to-front",
"_dirtyItems",
".",
"sort",
"(",
")",
";",
"_dirtyItems",
".",
"paintAndClear",
"(",
"gfx",
")",
";",
"}"
] |
Renders the dirty sprites and objects in the scene to the given graphics context.
|
[
"Renders",
"the",
"dirty",
"sprites",
"and",
"objects",
"in",
"the",
"scene",
"to",
"the",
"given",
"graphics",
"context",
"."
] |
train
|
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1272-L1302
|
grpc/grpc-java
|
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
|
NettyServerBuilder.keepAliveTimeout
|
public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
"""
Sets a custom keepalive timeout, the timeout for keepalive ping requests. An unreasonably small
value might be increased.
@since 1.3.0
"""
checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive");
keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout);
keepAliveTimeoutInNanos =
KeepAliveManager.clampKeepAliveTimeoutInNanos(keepAliveTimeoutInNanos);
if (keepAliveTimeoutInNanos < MIN_KEEPALIVE_TIMEOUT_NANO) {
// Bump keepalive timeout.
keepAliveTimeoutInNanos = MIN_KEEPALIVE_TIMEOUT_NANO;
}
return this;
}
|
java
|
public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive");
keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout);
keepAliveTimeoutInNanos =
KeepAliveManager.clampKeepAliveTimeoutInNanos(keepAliveTimeoutInNanos);
if (keepAliveTimeoutInNanos < MIN_KEEPALIVE_TIMEOUT_NANO) {
// Bump keepalive timeout.
keepAliveTimeoutInNanos = MIN_KEEPALIVE_TIMEOUT_NANO;
}
return this;
}
|
[
"public",
"NettyServerBuilder",
"keepAliveTimeout",
"(",
"long",
"keepAliveTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"checkArgument",
"(",
"keepAliveTimeout",
">",
"0L",
",",
"\"keepalive timeout must be positive\"",
")",
";",
"keepAliveTimeoutInNanos",
"=",
"timeUnit",
".",
"toNanos",
"(",
"keepAliveTimeout",
")",
";",
"keepAliveTimeoutInNanos",
"=",
"KeepAliveManager",
".",
"clampKeepAliveTimeoutInNanos",
"(",
"keepAliveTimeoutInNanos",
")",
";",
"if",
"(",
"keepAliveTimeoutInNanos",
"<",
"MIN_KEEPALIVE_TIMEOUT_NANO",
")",
"{",
"// Bump keepalive timeout.",
"keepAliveTimeoutInNanos",
"=",
"MIN_KEEPALIVE_TIMEOUT_NANO",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets a custom keepalive timeout, the timeout for keepalive ping requests. An unreasonably small
value might be increased.
@since 1.3.0
|
[
"Sets",
"a",
"custom",
"keepalive",
"timeout",
"the",
"timeout",
"for",
"keepalive",
"ping",
"requests",
".",
"An",
"unreasonably",
"small",
"value",
"might",
"be",
"increased",
"."
] |
train
|
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L392-L402
|
RestComm/sipunit
|
src/main/java/org/cafesip/sipunit/PresenceSubscriber.java
|
PresenceSubscriber.refreshBuddy
|
public boolean refreshBuddy(Request req, long timeout) {
"""
This method is the same as refreshBuddy(duration, eventId, timeout) except that instead of
creating the SUBSCRIBE request from parameters passed in, the given request message parameter
is used for sending out the SUBSCRIBE message.
<p>
The Request parameter passed into this method should come from calling createSubscribeMessage()
- see that javadoc. The subscription duration is reset to the passed in Request's expiry value.
If it is 0, this is an unsubscribe. Note, the buddy stays in the buddy list even though the
subscription won't be active. The event "id" in the given request will be used subsequently
(for error checking SUBSCRIBE responses and NOTIFYs from the server as well as for sending
subsequent SUBSCRIBEs).
"""
if (parent.getBuddyList().get(targetUri) == null) {
setReturnCode(SipSession.INVALID_ARGUMENT);
setErrorMessage("Buddy refresh for URI " + targetUri
+ " failed, uri was not found in the buddy list. Use fetchPresenceInfo() for users not in the buddy list");
return false;
}
return refreshSubscription(req, timeout, parent.getProxyHost() != null);
}
|
java
|
public boolean refreshBuddy(Request req, long timeout) {
if (parent.getBuddyList().get(targetUri) == null) {
setReturnCode(SipSession.INVALID_ARGUMENT);
setErrorMessage("Buddy refresh for URI " + targetUri
+ " failed, uri was not found in the buddy list. Use fetchPresenceInfo() for users not in the buddy list");
return false;
}
return refreshSubscription(req, timeout, parent.getProxyHost() != null);
}
|
[
"public",
"boolean",
"refreshBuddy",
"(",
"Request",
"req",
",",
"long",
"timeout",
")",
"{",
"if",
"(",
"parent",
".",
"getBuddyList",
"(",
")",
".",
"get",
"(",
"targetUri",
")",
"==",
"null",
")",
"{",
"setReturnCode",
"(",
"SipSession",
".",
"INVALID_ARGUMENT",
")",
";",
"setErrorMessage",
"(",
"\"Buddy refresh for URI \"",
"+",
"targetUri",
"+",
"\" failed, uri was not found in the buddy list. Use fetchPresenceInfo() for users not in the buddy list\"",
")",
";",
"return",
"false",
";",
"}",
"return",
"refreshSubscription",
"(",
"req",
",",
"timeout",
",",
"parent",
".",
"getProxyHost",
"(",
")",
"!=",
"null",
")",
";",
"}"
] |
This method is the same as refreshBuddy(duration, eventId, timeout) except that instead of
creating the SUBSCRIBE request from parameters passed in, the given request message parameter
is used for sending out the SUBSCRIBE message.
<p>
The Request parameter passed into this method should come from calling createSubscribeMessage()
- see that javadoc. The subscription duration is reset to the passed in Request's expiry value.
If it is 0, this is an unsubscribe. Note, the buddy stays in the buddy list even though the
subscription won't be active. The event "id" in the given request will be used subsequently
(for error checking SUBSCRIBE responses and NOTIFYs from the server as well as for sending
subsequent SUBSCRIBEs).
|
[
"This",
"method",
"is",
"the",
"same",
"as",
"refreshBuddy",
"(",
"duration",
"eventId",
"timeout",
")",
"except",
"that",
"instead",
"of",
"creating",
"the",
"SUBSCRIBE",
"request",
"from",
"parameters",
"passed",
"in",
"the",
"given",
"request",
"message",
"parameter",
"is",
"used",
"for",
"sending",
"out",
"the",
"SUBSCRIBE",
"message",
"."
] |
train
|
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/PresenceSubscriber.java#L387-L397
|
Waikato/moa
|
moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java
|
HSTreeNode.updateMass
|
public void updateMass(Instance inst, boolean referenceWindow) {
"""
Update the mass profile of this node.
@param inst the instance being passed through the HSTree.
@param referenceWindow if the HSTree is in the initial reference window: <b>true</b>, else: <b>false</b>
"""
if(referenceWindow)
r++;
else
l++;
if(internalNode)
{
if(inst.value(this.splitAttribute) > this.splitValue)
right.updateMass(inst, referenceWindow);
else
left.updateMass(inst, referenceWindow);
}
}
|
java
|
public void updateMass(Instance inst, boolean referenceWindow)
{
if(referenceWindow)
r++;
else
l++;
if(internalNode)
{
if(inst.value(this.splitAttribute) > this.splitValue)
right.updateMass(inst, referenceWindow);
else
left.updateMass(inst, referenceWindow);
}
}
|
[
"public",
"void",
"updateMass",
"(",
"Instance",
"inst",
",",
"boolean",
"referenceWindow",
")",
"{",
"if",
"(",
"referenceWindow",
")",
"r",
"++",
";",
"else",
"l",
"++",
";",
"if",
"(",
"internalNode",
")",
"{",
"if",
"(",
"inst",
".",
"value",
"(",
"this",
".",
"splitAttribute",
")",
">",
"this",
".",
"splitValue",
")",
"right",
".",
"updateMass",
"(",
"inst",
",",
"referenceWindow",
")",
";",
"else",
"left",
".",
"updateMass",
"(",
"inst",
",",
"referenceWindow",
")",
";",
"}",
"}"
] |
Update the mass profile of this node.
@param inst the instance being passed through the HSTree.
@param referenceWindow if the HSTree is in the initial reference window: <b>true</b>, else: <b>false</b>
|
[
"Update",
"the",
"mass",
"profile",
"of",
"this",
"node",
"."
] |
train
|
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java#L120-L134
|
datasalt/pangool
|
core/src/main/java/com/datasalt/pangool/io/Mutator.java
|
Mutator.superSetOf
|
public static Schema superSetOf(Schema schema, Field... newFields) {
"""
Creates a superset of the input Schema, taking all the Fields in the input schema
and adding some new ones. The new fields are fully specified in a Field class.
The name of the schema is auto-generated with a static counter.
"""
return superSetOf("superSetSchema" + (COUNTER++), schema, newFields);
}
|
java
|
public static Schema superSetOf(Schema schema, Field... newFields) {
return superSetOf("superSetSchema" + (COUNTER++), schema, newFields);
}
|
[
"public",
"static",
"Schema",
"superSetOf",
"(",
"Schema",
"schema",
",",
"Field",
"...",
"newFields",
")",
"{",
"return",
"superSetOf",
"(",
"\"superSetSchema\"",
"+",
"(",
"COUNTER",
"++",
")",
",",
"schema",
",",
"newFields",
")",
";",
"}"
] |
Creates a superset of the input Schema, taking all the Fields in the input schema
and adding some new ones. The new fields are fully specified in a Field class.
The name of the schema is auto-generated with a static counter.
|
[
"Creates",
"a",
"superset",
"of",
"the",
"input",
"Schema",
"taking",
"all",
"the",
"Fields",
"in",
"the",
"input",
"schema",
"and",
"adding",
"some",
"new",
"ones",
".",
"The",
"new",
"fields",
"are",
"fully",
"specified",
"in",
"a",
"Field",
"class",
".",
"The",
"name",
"of",
"the",
"schema",
"is",
"auto",
"-",
"generated",
"with",
"a",
"static",
"counter",
"."
] |
train
|
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L73-L75
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.toDigits
|
public static final IntStream toDigits(long v, int length, int radix) {
"""
Returns IntStream where each item is a digit. I.e zero leading digits.
@param v
@param length
@param radix
@return
"""
Spliterator.OfInt spliterator = Spliterators.spliterator(new PRimIt(v, length, radix), Long.MAX_VALUE, 0);
return StreamSupport.intStream(spliterator, false);
}
|
java
|
public static final IntStream toDigits(long v, int length, int radix)
{
Spliterator.OfInt spliterator = Spliterators.spliterator(new PRimIt(v, length, radix), Long.MAX_VALUE, 0);
return StreamSupport.intStream(spliterator, false);
}
|
[
"public",
"static",
"final",
"IntStream",
"toDigits",
"(",
"long",
"v",
",",
"int",
"length",
",",
"int",
"radix",
")",
"{",
"Spliterator",
".",
"OfInt",
"spliterator",
"=",
"Spliterators",
".",
"spliterator",
"(",
"new",
"PRimIt",
"(",
"v",
",",
"length",
",",
"radix",
")",
",",
"Long",
".",
"MAX_VALUE",
",",
"0",
")",
";",
"return",
"StreamSupport",
".",
"intStream",
"(",
"spliterator",
",",
"false",
")",
";",
"}"
] |
Returns IntStream where each item is a digit. I.e zero leading digits.
@param v
@param length
@param radix
@return
|
[
"Returns",
"IntStream",
"where",
"each",
"item",
"is",
"a",
"digit",
".",
"I",
".",
"e",
"zero",
"leading",
"digits",
"."
] |
train
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L79-L83
|
meraki-analytics/datapipelines-java
|
src/main/java/com/merakianalytics/datapipelines/DataPipeline.java
|
DataPipeline.getMany
|
public <T> CloseableIterator<T> getMany(final Class<T> type, final Map<String, Object> query) {
"""
Gets multiple data elements from the {@link com.merakianalytics.datapipelines.DataPipeline}
@param <T>
the type of the data that should be retrieved
@param type
the type of the data that should be retrieved
@param query
a query specifying the details of what data should fulfill this request
@return a {@link com.merakianalytics.datapipelines.iterators.CloseableIterator} of the request type if the query had a result, or null
"""
return getMany(type, query, false);
}
|
java
|
public <T> CloseableIterator<T> getMany(final Class<T> type, final Map<String, Object> query) {
return getMany(type, query, false);
}
|
[
"public",
"<",
"T",
">",
"CloseableIterator",
"<",
"T",
">",
"getMany",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"query",
")",
"{",
"return",
"getMany",
"(",
"type",
",",
"query",
",",
"false",
")",
";",
"}"
] |
Gets multiple data elements from the {@link com.merakianalytics.datapipelines.DataPipeline}
@param <T>
the type of the data that should be retrieved
@param type
the type of the data that should be retrieved
@param query
a query specifying the details of what data should fulfill this request
@return a {@link com.merakianalytics.datapipelines.iterators.CloseableIterator} of the request type if the query had a result, or null
|
[
"Gets",
"multiple",
"data",
"elements",
"from",
"the",
"{",
"@link",
"com",
".",
"merakianalytics",
".",
"datapipelines",
".",
"DataPipeline",
"}"
] |
train
|
https://github.com/meraki-analytics/datapipelines-java/blob/376ff1e8e1f7c67f2f2a5521d2a66e91467e56b0/src/main/java/com/merakianalytics/datapipelines/DataPipeline.java#L243-L245
|
Azure/azure-sdk-for-java
|
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/FirewallRulesInner.java
|
FirewallRulesInner.beginCreateOrUpdate
|
public FirewallRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
"""
Creates a new firewall rule or updates an existing firewall rule.
@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 firewallRuleName The name of the server firewall rule.
@param parameters The required parameters for creating or updating a firewall rule.
@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 FirewallRuleInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body();
}
|
java
|
public FirewallRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body();
}
|
[
"public",
"FirewallRuleInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"firewallRuleName",
",",
"FirewallRuleInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"firewallRuleName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Creates a new firewall rule or updates an existing firewall rule.
@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 firewallRuleName The name of the server firewall rule.
@param parameters The required parameters for creating or updating a firewall rule.
@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 FirewallRuleInner object if successful.
|
[
"Creates",
"a",
"new",
"firewall",
"rule",
"or",
"updates",
"an",
"existing",
"firewall",
"rule",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/FirewallRulesInner.java#L181-L183
|
davidmoten/grumpy
|
grumpy-ogc-layers/src/main/java/com/github/davidmoten/grumpy/wms/layer/darkness/SunUtil.java
|
SunUtil.getSubSolarPoint
|
public static Position getSubSolarPoint(Calendar time) {
"""
Returns the position on the Earth's surface for which the sun appears to
be straight above.
@param time
@return
"""
// convert time to Julian Day Number
double jd = TimeUtil.getJulianDayNumber(time);
// Julian centuries since Jan 1, 2000, 12:00 UTC
double T = (jd - 2451545.0) / 36525;
// mean anomaly, degree
double M = 357.52910 + 35999.05030 * T - 0.0001559 * T * T - 0.00000048
* T * T * T;
// mean longitude, degree
double L0 = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
double DL = (1.914600 - 0.004817 * T - 0.000014 * T * T)
* Math.sin(Math.toRadians(M)) + (0.019993 - 0.000101 * T)
* Math.sin(Math.toRadians(2.0 * M)) + 0.000290
* Math.sin(Math.toRadians(3.0 * M));
// true longitude, degree
double L = L0 + DL;
// obliquity eps of ecliptic in degrees:
double eps = 23.0 + 26.0 / 60.0 + 21.448 / 3600.0
- (46.8150 * T + 0.00059 * T * T - 0.001813 * T * T * T)
/ 3600.0;
double X = Math.cos(Math.toRadians(L));
double Y = Math.cos(Math.toRadians(eps)) * Math.sin(Math.toRadians(L));
double Z = Math.sin(Math.toRadians(eps)) * Math.sin(Math.toRadians(L));
double R = Math.sqrt(1.0 - Z * Z);
double delta = Math.toDegrees(Math.atan(Z / R)); // in degrees
double p = Y / (X + R);
double ra = Math.toDegrees(Math.atan(p));
double RA = (24.0 / 180.0) * ra; // in hours
// sidereal time (in hours)
double theta0 = 280.46061837 + 360.98564736629 * (jd - 2451545.0)
+ 0.000387933 * T * T - T * T * T / 38710000.0;
double sidTime = (theta0 % 360) / 15.0;
// lon and lat of sun
double sunHADeg = ((sidTime - RA) * 15.0) % 360.0;
double lon = 0.0;
if (sunHADeg < 180.0) {
lon = -sunHADeg;
} else {
lon = 360.0 - sunHADeg;
}
double lat = delta;
log.info("Sidereal time is " + sidTime + ", Sun RA/Dec is " + RA + "/"
+ delta + ", subSolar lat/long is " + lat + "/" + lon);
return new Position(lat, lon);
}
|
java
|
public static Position getSubSolarPoint(Calendar time) {
// convert time to Julian Day Number
double jd = TimeUtil.getJulianDayNumber(time);
// Julian centuries since Jan 1, 2000, 12:00 UTC
double T = (jd - 2451545.0) / 36525;
// mean anomaly, degree
double M = 357.52910 + 35999.05030 * T - 0.0001559 * T * T - 0.00000048
* T * T * T;
// mean longitude, degree
double L0 = 280.46645 + 36000.76983 * T + 0.0003032 * T * T;
double DL = (1.914600 - 0.004817 * T - 0.000014 * T * T)
* Math.sin(Math.toRadians(M)) + (0.019993 - 0.000101 * T)
* Math.sin(Math.toRadians(2.0 * M)) + 0.000290
* Math.sin(Math.toRadians(3.0 * M));
// true longitude, degree
double L = L0 + DL;
// obliquity eps of ecliptic in degrees:
double eps = 23.0 + 26.0 / 60.0 + 21.448 / 3600.0
- (46.8150 * T + 0.00059 * T * T - 0.001813 * T * T * T)
/ 3600.0;
double X = Math.cos(Math.toRadians(L));
double Y = Math.cos(Math.toRadians(eps)) * Math.sin(Math.toRadians(L));
double Z = Math.sin(Math.toRadians(eps)) * Math.sin(Math.toRadians(L));
double R = Math.sqrt(1.0 - Z * Z);
double delta = Math.toDegrees(Math.atan(Z / R)); // in degrees
double p = Y / (X + R);
double ra = Math.toDegrees(Math.atan(p));
double RA = (24.0 / 180.0) * ra; // in hours
// sidereal time (in hours)
double theta0 = 280.46061837 + 360.98564736629 * (jd - 2451545.0)
+ 0.000387933 * T * T - T * T * T / 38710000.0;
double sidTime = (theta0 % 360) / 15.0;
// lon and lat of sun
double sunHADeg = ((sidTime - RA) * 15.0) % 360.0;
double lon = 0.0;
if (sunHADeg < 180.0) {
lon = -sunHADeg;
} else {
lon = 360.0 - sunHADeg;
}
double lat = delta;
log.info("Sidereal time is " + sidTime + ", Sun RA/Dec is " + RA + "/"
+ delta + ", subSolar lat/long is " + lat + "/" + lon);
return new Position(lat, lon);
}
|
[
"public",
"static",
"Position",
"getSubSolarPoint",
"(",
"Calendar",
"time",
")",
"{",
"// convert time to Julian Day Number",
"double",
"jd",
"=",
"TimeUtil",
".",
"getJulianDayNumber",
"(",
"time",
")",
";",
"// Julian centuries since Jan 1, 2000, 12:00 UTC",
"double",
"T",
"=",
"(",
"jd",
"-",
"2451545.0",
")",
"/",
"36525",
";",
"// mean anomaly, degree",
"double",
"M",
"=",
"357.52910",
"+",
"35999.05030",
"*",
"T",
"-",
"0.0001559",
"*",
"T",
"*",
"T",
"-",
"0.00000048",
"*",
"T",
"*",
"T",
"*",
"T",
";",
"// mean longitude, degree",
"double",
"L0",
"=",
"280.46645",
"+",
"36000.76983",
"*",
"T",
"+",
"0.0003032",
"*",
"T",
"*",
"T",
";",
"double",
"DL",
"=",
"(",
"1.914600",
"-",
"0.004817",
"*",
"T",
"-",
"0.000014",
"*",
"T",
"*",
"T",
")",
"*",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"M",
")",
")",
"+",
"(",
"0.019993",
"-",
"0.000101",
"*",
"T",
")",
"*",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"2.0",
"*",
"M",
")",
")",
"+",
"0.000290",
"*",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"3.0",
"*",
"M",
")",
")",
";",
"// true longitude, degree",
"double",
"L",
"=",
"L0",
"+",
"DL",
";",
"// obliquity eps of ecliptic in degrees:",
"double",
"eps",
"=",
"23.0",
"+",
"26.0",
"/",
"60.0",
"+",
"21.448",
"/",
"3600.0",
"-",
"(",
"46.8150",
"*",
"T",
"+",
"0.00059",
"*",
"T",
"*",
"T",
"-",
"0.001813",
"*",
"T",
"*",
"T",
"*",
"T",
")",
"/",
"3600.0",
";",
"double",
"X",
"=",
"Math",
".",
"cos",
"(",
"Math",
".",
"toRadians",
"(",
"L",
")",
")",
";",
"double",
"Y",
"=",
"Math",
".",
"cos",
"(",
"Math",
".",
"toRadians",
"(",
"eps",
")",
")",
"*",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"L",
")",
")",
";",
"double",
"Z",
"=",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"eps",
")",
")",
"*",
"Math",
".",
"sin",
"(",
"Math",
".",
"toRadians",
"(",
"L",
")",
")",
";",
"double",
"R",
"=",
"Math",
".",
"sqrt",
"(",
"1.0",
"-",
"Z",
"*",
"Z",
")",
";",
"double",
"delta",
"=",
"Math",
".",
"toDegrees",
"(",
"Math",
".",
"atan",
"(",
"Z",
"/",
"R",
")",
")",
";",
"// in degrees",
"double",
"p",
"=",
"Y",
"/",
"(",
"X",
"+",
"R",
")",
";",
"double",
"ra",
"=",
"Math",
".",
"toDegrees",
"(",
"Math",
".",
"atan",
"(",
"p",
")",
")",
";",
"double",
"RA",
"=",
"(",
"24.0",
"/",
"180.0",
")",
"*",
"ra",
";",
"// in hours",
"// sidereal time (in hours)",
"double",
"theta0",
"=",
"280.46061837",
"+",
"360.98564736629",
"*",
"(",
"jd",
"-",
"2451545.0",
")",
"+",
"0.000387933",
"*",
"T",
"*",
"T",
"-",
"T",
"*",
"T",
"*",
"T",
"/",
"38710000.0",
";",
"double",
"sidTime",
"=",
"(",
"theta0",
"%",
"360",
")",
"/",
"15.0",
";",
"// lon and lat of sun",
"double",
"sunHADeg",
"=",
"(",
"(",
"sidTime",
"-",
"RA",
")",
"*",
"15.0",
")",
"%",
"360.0",
";",
"double",
"lon",
"=",
"0.0",
";",
"if",
"(",
"sunHADeg",
"<",
"180.0",
")",
"{",
"lon",
"=",
"-",
"sunHADeg",
";",
"}",
"else",
"{",
"lon",
"=",
"360.0",
"-",
"sunHADeg",
";",
"}",
"double",
"lat",
"=",
"delta",
";",
"log",
".",
"info",
"(",
"\"Sidereal time is \"",
"+",
"sidTime",
"+",
"\", Sun RA/Dec is \"",
"+",
"RA",
"+",
"\"/\"",
"+",
"delta",
"+",
"\", subSolar lat/long is \"",
"+",
"lat",
"+",
"\"/\"",
"+",
"lon",
")",
";",
"return",
"new",
"Position",
"(",
"lat",
",",
"lon",
")",
";",
"}"
] |
Returns the position on the Earth's surface for which the sun appears to
be straight above.
@param time
@return
|
[
"Returns",
"the",
"position",
"on",
"the",
"Earth",
"s",
"surface",
"for",
"which",
"the",
"sun",
"appears",
"to",
"be",
"straight",
"above",
"."
] |
train
|
https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-ogc-layers/src/main/java/com/github/davidmoten/grumpy/wms/layer/darkness/SunUtil.java#L82-L143
|
zxing/zxing
|
android/src/com/google/zxing/client/android/camera/CameraManager.java
|
CameraManager.setManualFramingRect
|
public synchronized void setManualFramingRect(int width, int height) {
"""
Allows third party apps to specify the scanning rectangle dimensions, rather than determine
them automatically based on screen resolution.
@param width The width in pixels to scan.
@param height The height in pixels to scan.
"""
if (initialized) {
Point screenResolution = configManager.getScreenResolution();
if (width > screenResolution.x) {
width = screenResolution.x;
}
if (height > screenResolution.y) {
height = screenResolution.y;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated manual framing rect: " + framingRect);
framingRectInPreview = null;
} else {
requestedFramingRectWidth = width;
requestedFramingRectHeight = height;
}
}
|
java
|
public synchronized void setManualFramingRect(int width, int height) {
if (initialized) {
Point screenResolution = configManager.getScreenResolution();
if (width > screenResolution.x) {
width = screenResolution.x;
}
if (height > screenResolution.y) {
height = screenResolution.y;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated manual framing rect: " + framingRect);
framingRectInPreview = null;
} else {
requestedFramingRectWidth = width;
requestedFramingRectHeight = height;
}
}
|
[
"public",
"synchronized",
"void",
"setManualFramingRect",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"initialized",
")",
"{",
"Point",
"screenResolution",
"=",
"configManager",
".",
"getScreenResolution",
"(",
")",
";",
"if",
"(",
"width",
">",
"screenResolution",
".",
"x",
")",
"{",
"width",
"=",
"screenResolution",
".",
"x",
";",
"}",
"if",
"(",
"height",
">",
"screenResolution",
".",
"y",
")",
"{",
"height",
"=",
"screenResolution",
".",
"y",
";",
"}",
"int",
"leftOffset",
"=",
"(",
"screenResolution",
".",
"x",
"-",
"width",
")",
"/",
"2",
";",
"int",
"topOffset",
"=",
"(",
"screenResolution",
".",
"y",
"-",
"height",
")",
"/",
"2",
";",
"framingRect",
"=",
"new",
"Rect",
"(",
"leftOffset",
",",
"topOffset",
",",
"leftOffset",
"+",
"width",
",",
"topOffset",
"+",
"height",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Calculated manual framing rect: \"",
"+",
"framingRect",
")",
";",
"framingRectInPreview",
"=",
"null",
";",
"}",
"else",
"{",
"requestedFramingRectWidth",
"=",
"width",
";",
"requestedFramingRectHeight",
"=",
"height",
";",
"}",
"}"
] |
Allows third party apps to specify the scanning rectangle dimensions, rather than determine
them automatically based on screen resolution.
@param width The width in pixels to scan.
@param height The height in pixels to scan.
|
[
"Allows",
"third",
"party",
"apps",
"to",
"specify",
"the",
"scanning",
"rectangle",
"dimensions",
"rather",
"than",
"determine",
"them",
"automatically",
"based",
"on",
"screen",
"resolution",
"."
] |
train
|
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L292-L310
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/CompositeELResolver.java
|
CompositeELResolver.getFeatureDescriptors
|
public Iterator<FeatureDescriptor> getFeatureDescriptors(
ELContext context,
Object base) {
"""
Returns information about the set of variables or properties that
can be resolved for the given <code>base</code> object. One use for
this method is to assist tools in auto-completion. The results are
collected from all component resolvers.
<p>The <code>propertyResolved</code> property of the
<code>ELContext</code> is not relevant to this method.
The results of all <code>ELResolver</code>s are concatenated.</p>
<p>The <code>Iterator</code> returned is an iterator over the
collection of <code>FeatureDescriptor</code> objects returned by
the iterators returned by each component resolver's
<code>getFeatureDescriptors</code> method. If <code>null</code> is
returned by a resolver, it is skipped.</p>
@param context The context of this evaluation.
@param base The base object whose set of valid properties is to
be enumerated, or <code>null</code> to enumerate the set of
top-level variables that this resolver can evaluate.
@return An <code>Iterator</code> containing zero or more (possibly
infinitely more) <code>FeatureDescriptor</code> objects, or
<code>null</code> if this resolver does not handle the given
<code>base</code> object or that the results are too complex to
represent with this method
"""
return new CompositeIterator(elResolvers, size, context, base);
}
|
java
|
public Iterator<FeatureDescriptor> getFeatureDescriptors(
ELContext context,
Object base) {
return new CompositeIterator(elResolvers, size, context, base);
}
|
[
"public",
"Iterator",
"<",
"FeatureDescriptor",
">",
"getFeatureDescriptors",
"(",
"ELContext",
"context",
",",
"Object",
"base",
")",
"{",
"return",
"new",
"CompositeIterator",
"(",
"elResolvers",
",",
"size",
",",
"context",
",",
"base",
")",
";",
"}"
] |
Returns information about the set of variables or properties that
can be resolved for the given <code>base</code> object. One use for
this method is to assist tools in auto-completion. The results are
collected from all component resolvers.
<p>The <code>propertyResolved</code> property of the
<code>ELContext</code> is not relevant to this method.
The results of all <code>ELResolver</code>s are concatenated.</p>
<p>The <code>Iterator</code> returned is an iterator over the
collection of <code>FeatureDescriptor</code> objects returned by
the iterators returned by each component resolver's
<code>getFeatureDescriptors</code> method. If <code>null</code> is
returned by a resolver, it is skipped.</p>
@param context The context of this evaluation.
@param base The base object whose set of valid properties is to
be enumerated, or <code>null</code> to enumerate the set of
top-level variables that this resolver can evaluate.
@return An <code>Iterator</code> containing zero or more (possibly
infinitely more) <code>FeatureDescriptor</code> objects, or
<code>null</code> if this resolver does not handle the given
<code>base</code> object or that the results are too complex to
represent with this method
|
[
"Returns",
"information",
"about",
"the",
"set",
"of",
"variables",
"or",
"properties",
"that",
"can",
"be",
"resolved",
"for",
"the",
"given",
"<code",
">",
"base<",
"/",
"code",
">",
"object",
".",
"One",
"use",
"for",
"this",
"method",
"is",
"to",
"assist",
"tools",
"in",
"auto",
"-",
"completion",
".",
"The",
"results",
"are",
"collected",
"from",
"all",
"component",
"resolvers",
"."
] |
train
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/CompositeELResolver.java#L495-L499
|
Jasig/uPortal
|
uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java
|
FavoritesEditController.initializeView
|
@RenderMapping
public String initializeView(Model model, RenderRequest renderRequest) {
"""
Handles all Favorites portlet EDIT mode renders. Populates model with user's favorites and
selects a view to display those favorites.
<p>View selection:
<p>Returns "jsp/Favorites/edit" in the normal case where the user has at least one favorited
portlet or favorited collection.
<p>Returns "jsp/Favorites/edit_zero" in the edge case where the user has zero favorited
portlets AND zero favorited collections.
<p>Model: marketPlaceFname --> String functional name of Marketplace portlet, or null if not
available. collections --> List of favorited collections (IUserLayoutNodeDescription s)
favorites --> List of favorited individual portlets (IUserLayoutNodeDescription s)
successMessageCode --> String success message bundle key, or null if none errorMessageCode
--> String error message bundle key, or null if none nameOfFavoriteActedUpon --> Name of
favorite acted upon, intended as parameter to success or error message
@param model . Spring model. This method adds five model attributes.
@return jsp/Favorites/edit[_zero]
"""
IUserInstance ui =
userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest());
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
IUserLayout userLayout = ulm.getUserLayout();
// TODO: the portlet could predicate including a non-null marketplace portlet fname
// on the accessing user having permission to render the portlet referenced by that fname
// so that portlet would gracefully degrade when configured with bad marketplace portlet
// fname
// and also gracefully degrade when the accessing user doesn't have permission to access an
// otherwise
// viable configured marketplace. This complexity may not be worth it. Anyway it is not
// yet implemented.
model.addAttribute("marketplaceFname", this.marketplaceFName);
List<IUserLayoutNodeDescription> collections =
favoritesUtils.getFavoriteCollections(userLayout);
model.addAttribute("collections", collections);
List<IUserLayoutNodeDescription> favorites =
favoritesUtils.getFavoritePortletLayoutNodes(userLayout);
model.addAttribute("favorites", favorites);
model.addAttribute("successMessageCode", renderRequest.getParameter("successMessageCode"));
model.addAttribute("errorMessageCode", renderRequest.getParameter("errorMessageCode"));
model.addAttribute(
"nameOfFavoriteActedUpon", renderRequest.getParameter("nameOfFavoriteActedUpon"));
// default to the regular old edit view
String viewName = "jsp/Favorites/edit";
if (collections.isEmpty() && favorites.isEmpty()) {
// use the special case view
viewName = "jsp/Favorites/edit_zero";
}
logger.trace(
"Favorites Portlet EDIT mode built model [{}] and selected view {}.",
model,
viewName);
return viewName;
}
|
java
|
@RenderMapping
public String initializeView(Model model, RenderRequest renderRequest) {
IUserInstance ui =
userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest());
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
IUserLayout userLayout = ulm.getUserLayout();
// TODO: the portlet could predicate including a non-null marketplace portlet fname
// on the accessing user having permission to render the portlet referenced by that fname
// so that portlet would gracefully degrade when configured with bad marketplace portlet
// fname
// and also gracefully degrade when the accessing user doesn't have permission to access an
// otherwise
// viable configured marketplace. This complexity may not be worth it. Anyway it is not
// yet implemented.
model.addAttribute("marketplaceFname", this.marketplaceFName);
List<IUserLayoutNodeDescription> collections =
favoritesUtils.getFavoriteCollections(userLayout);
model.addAttribute("collections", collections);
List<IUserLayoutNodeDescription> favorites =
favoritesUtils.getFavoritePortletLayoutNodes(userLayout);
model.addAttribute("favorites", favorites);
model.addAttribute("successMessageCode", renderRequest.getParameter("successMessageCode"));
model.addAttribute("errorMessageCode", renderRequest.getParameter("errorMessageCode"));
model.addAttribute(
"nameOfFavoriteActedUpon", renderRequest.getParameter("nameOfFavoriteActedUpon"));
// default to the regular old edit view
String viewName = "jsp/Favorites/edit";
if (collections.isEmpty() && favorites.isEmpty()) {
// use the special case view
viewName = "jsp/Favorites/edit_zero";
}
logger.trace(
"Favorites Portlet EDIT mode built model [{}] and selected view {}.",
model,
viewName);
return viewName;
}
|
[
"@",
"RenderMapping",
"public",
"String",
"initializeView",
"(",
"Model",
"model",
",",
"RenderRequest",
"renderRequest",
")",
"{",
"IUserInstance",
"ui",
"=",
"userInstanceManager",
".",
"getUserInstance",
"(",
"portalRequestUtils",
".",
"getCurrentPortalRequest",
"(",
")",
")",
";",
"UserPreferencesManager",
"upm",
"=",
"(",
"UserPreferencesManager",
")",
"ui",
".",
"getPreferencesManager",
"(",
")",
";",
"IUserLayoutManager",
"ulm",
"=",
"upm",
".",
"getUserLayoutManager",
"(",
")",
";",
"IUserLayout",
"userLayout",
"=",
"ulm",
".",
"getUserLayout",
"(",
")",
";",
"// TODO: the portlet could predicate including a non-null marketplace portlet fname",
"// on the accessing user having permission to render the portlet referenced by that fname",
"// so that portlet would gracefully degrade when configured with bad marketplace portlet",
"// fname",
"// and also gracefully degrade when the accessing user doesn't have permission to access an",
"// otherwise",
"// viable configured marketplace. This complexity may not be worth it. Anyway it is not",
"// yet implemented.",
"model",
".",
"addAttribute",
"(",
"\"marketplaceFname\"",
",",
"this",
".",
"marketplaceFName",
")",
";",
"List",
"<",
"IUserLayoutNodeDescription",
">",
"collections",
"=",
"favoritesUtils",
".",
"getFavoriteCollections",
"(",
"userLayout",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"collections\"",
",",
"collections",
")",
";",
"List",
"<",
"IUserLayoutNodeDescription",
">",
"favorites",
"=",
"favoritesUtils",
".",
"getFavoritePortletLayoutNodes",
"(",
"userLayout",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"favorites\"",
",",
"favorites",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"successMessageCode\"",
",",
"renderRequest",
".",
"getParameter",
"(",
"\"successMessageCode\"",
")",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"errorMessageCode\"",
",",
"renderRequest",
".",
"getParameter",
"(",
"\"errorMessageCode\"",
")",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"nameOfFavoriteActedUpon\"",
",",
"renderRequest",
".",
"getParameter",
"(",
"\"nameOfFavoriteActedUpon\"",
")",
")",
";",
"// default to the regular old edit view",
"String",
"viewName",
"=",
"\"jsp/Favorites/edit\"",
";",
"if",
"(",
"collections",
".",
"isEmpty",
"(",
")",
"&&",
"favorites",
".",
"isEmpty",
"(",
")",
")",
"{",
"// use the special case view",
"viewName",
"=",
"\"jsp/Favorites/edit_zero\"",
";",
"}",
"logger",
".",
"trace",
"(",
"\"Favorites Portlet EDIT mode built model [{}] and selected view {}.\"",
",",
"model",
",",
"viewName",
")",
";",
"return",
"viewName",
";",
"}"
] |
Handles all Favorites portlet EDIT mode renders. Populates model with user's favorites and
selects a view to display those favorites.
<p>View selection:
<p>Returns "jsp/Favorites/edit" in the normal case where the user has at least one favorited
portlet or favorited collection.
<p>Returns "jsp/Favorites/edit_zero" in the edge case where the user has zero favorited
portlets AND zero favorited collections.
<p>Model: marketPlaceFname --> String functional name of Marketplace portlet, or null if not
available. collections --> List of favorited collections (IUserLayoutNodeDescription s)
favorites --> List of favorited individual portlets (IUserLayoutNodeDescription s)
successMessageCode --> String success message bundle key, or null if none errorMessageCode
--> String error message bundle key, or null if none nameOfFavoriteActedUpon --> Name of
favorite acted upon, intended as parameter to success or error message
@param model . Spring model. This method adds five model attributes.
@return jsp/Favorites/edit[_zero]
|
[
"Handles",
"all",
"Favorites",
"portlet",
"EDIT",
"mode",
"renders",
".",
"Populates",
"model",
"with",
"user",
"s",
"favorites",
"and",
"selects",
"a",
"view",
"to",
"display",
"those",
"favorites",
"."
] |
train
|
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java#L69-L118
|
deeplearning4j/deeplearning4j
|
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java
|
AbstractMultiDataSetNormalizer.revertLabels
|
public void revertLabels(@NonNull INDArray labels, INDArray mask, int output) {
"""
Undo (revert) the normalization applied by this normalizer to a specific labels array.
If labels normalization is disabled (i.e., {@link #isFitLabel()} == false) then this is a no-op.
Can also be used to undo normalization for network output arrays, in the case of regression.
@param labels Labels arrays to revert the normalization on
@param output the index of the array to revert
"""
if (isFitLabel()) {
strategy.revert(labels, mask, getLabelStats(output));
}
}
|
java
|
public void revertLabels(@NonNull INDArray labels, INDArray mask, int output) {
if (isFitLabel()) {
strategy.revert(labels, mask, getLabelStats(output));
}
}
|
[
"public",
"void",
"revertLabels",
"(",
"@",
"NonNull",
"INDArray",
"labels",
",",
"INDArray",
"mask",
",",
"int",
"output",
")",
"{",
"if",
"(",
"isFitLabel",
"(",
")",
")",
"{",
"strategy",
".",
"revert",
"(",
"labels",
",",
"mask",
",",
"getLabelStats",
"(",
"output",
")",
")",
";",
"}",
"}"
] |
Undo (revert) the normalization applied by this normalizer to a specific labels array.
If labels normalization is disabled (i.e., {@link #isFitLabel()} == false) then this is a no-op.
Can also be used to undo normalization for network output arrays, in the case of regression.
@param labels Labels arrays to revert the normalization on
@param output the index of the array to revert
|
[
"Undo",
"(",
"revert",
")",
"the",
"normalization",
"applied",
"by",
"this",
"normalizer",
"to",
"a",
"specific",
"labels",
"array",
".",
"If",
"labels",
"normalization",
"is",
"disabled",
"(",
"i",
".",
"e",
".",
"{",
"@link",
"#isFitLabel",
"()",
"}",
"==",
"false",
")",
"then",
"this",
"is",
"a",
"no",
"-",
"op",
".",
"Can",
"also",
"be",
"used",
"to",
"undo",
"normalization",
"for",
"network",
"output",
"arrays",
"in",
"the",
"case",
"of",
"regression",
"."
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java#L272-L276
|
sockeqwe/mosby
|
mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpActivity.java
|
MvpActivity.getMvpDelegate
|
@NonNull protected ActivityMvpDelegate<V, P> getMvpDelegate() {
"""
Get the mvp delegate. This is internally used for creating presenter, attaching and detaching
view from presenter.
<p><b>Please note that only one instance of mvp delegate should be used per Activity
instance</b>.
</p>
<p>
Only override this method if you really know what you are doing.
</p>
@return {@link ActivityMvpDelegateImpl}
"""
if (mvpDelegate == null) {
mvpDelegate = new ActivityMvpDelegateImpl(this, this, true);
}
return mvpDelegate;
}
|
java
|
@NonNull protected ActivityMvpDelegate<V, P> getMvpDelegate() {
if (mvpDelegate == null) {
mvpDelegate = new ActivityMvpDelegateImpl(this, this, true);
}
return mvpDelegate;
}
|
[
"@",
"NonNull",
"protected",
"ActivityMvpDelegate",
"<",
"V",
",",
"P",
">",
"getMvpDelegate",
"(",
")",
"{",
"if",
"(",
"mvpDelegate",
"==",
"null",
")",
"{",
"mvpDelegate",
"=",
"new",
"ActivityMvpDelegateImpl",
"(",
"this",
",",
"this",
",",
"true",
")",
";",
"}",
"return",
"mvpDelegate",
";",
"}"
] |
Get the mvp delegate. This is internally used for creating presenter, attaching and detaching
view from presenter.
<p><b>Please note that only one instance of mvp delegate should be used per Activity
instance</b>.
</p>
<p>
Only override this method if you really know what you are doing.
</p>
@return {@link ActivityMvpDelegateImpl}
|
[
"Get",
"the",
"mvp",
"delegate",
".",
"This",
"is",
"internally",
"used",
"for",
"creating",
"presenter",
"attaching",
"and",
"detaching",
"view",
"from",
"presenter",
"."
] |
train
|
https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpActivity.java#L111-L117
|
apache/flink
|
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
|
TypeExtractionUtils.sameTypeVars
|
public static boolean sameTypeVars(Type t1, Type t2) {
"""
Checks whether two types are type variables describing the same.
"""
return t1 instanceof TypeVariable &&
t2 instanceof TypeVariable &&
((TypeVariable<?>) t1).getName().equals(((TypeVariable<?>) t2).getName()) &&
((TypeVariable<?>) t1).getGenericDeclaration().equals(((TypeVariable<?>) t2).getGenericDeclaration());
}
|
java
|
public static boolean sameTypeVars(Type t1, Type t2) {
return t1 instanceof TypeVariable &&
t2 instanceof TypeVariable &&
((TypeVariable<?>) t1).getName().equals(((TypeVariable<?>) t2).getName()) &&
((TypeVariable<?>) t1).getGenericDeclaration().equals(((TypeVariable<?>) t2).getGenericDeclaration());
}
|
[
"public",
"static",
"boolean",
"sameTypeVars",
"(",
"Type",
"t1",
",",
"Type",
"t2",
")",
"{",
"return",
"t1",
"instanceof",
"TypeVariable",
"&&",
"t2",
"instanceof",
"TypeVariable",
"&&",
"(",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"t1",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"(",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"t2",
")",
".",
"getName",
"(",
")",
")",
"&&",
"(",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"t1",
")",
".",
"getGenericDeclaration",
"(",
")",
".",
"equals",
"(",
"(",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"t2",
")",
".",
"getGenericDeclaration",
"(",
")",
")",
";",
"}"
] |
Checks whether two types are type variables describing the same.
|
[
"Checks",
"whether",
"two",
"types",
"are",
"type",
"variables",
"describing",
"the",
"same",
"."
] |
train
|
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L280-L285
|
petergeneric/stdlib
|
guice/common/src/main/java/com/peterphi/std/guice/restclient/jaxb/webquery/WQConstraint.java
|
WQConstraint.decode
|
public static WQConstraint decode(final String field, final String rawValue) {
"""
Produce a WebQueryConstraint from a Query String format parameter
@param field
@param rawValue
@return
"""
final WQFunctionType function;
final String value;
if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.IS_NULL.getPrefix()))
return new WQConstraint(field, WQFunctionType.IS_NULL, null);
else if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.NOT_NULL.getPrefix()))
return new WQConstraint(field, WQFunctionType.NOT_NULL, null);
else if (rawValue.startsWith("_f_"))
{
function = WQFunctionType.getByPrefix(rawValue);
if (function.hasParam())
{
// Strip the function name from the value
value = rawValue.substring(function.getPrefix().length());
if (function.hasBinaryParam())
{
final String[] splitValues = StringUtils.split(value, "..", 2);
final String left = splitValues[0];
final String right = splitValues[1];
return new WQConstraint(field, function, left, right);
}
}
else
{
value = null;
}
}
else
{
function = WQFunctionType.EQ;
value = rawValue;
}
return new WQConstraint(field, function, value);
}
|
java
|
public static WQConstraint decode(final String field, final String rawValue)
{
final WQFunctionType function;
final String value;
if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.IS_NULL.getPrefix()))
return new WQConstraint(field, WQFunctionType.IS_NULL, null);
else if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.NOT_NULL.getPrefix()))
return new WQConstraint(field, WQFunctionType.NOT_NULL, null);
else if (rawValue.startsWith("_f_"))
{
function = WQFunctionType.getByPrefix(rawValue);
if (function.hasParam())
{
// Strip the function name from the value
value = rawValue.substring(function.getPrefix().length());
if (function.hasBinaryParam())
{
final String[] splitValues = StringUtils.split(value, "..", 2);
final String left = splitValues[0];
final String right = splitValues[1];
return new WQConstraint(field, function, left, right);
}
}
else
{
value = null;
}
}
else
{
function = WQFunctionType.EQ;
value = rawValue;
}
return new WQConstraint(field, function, value);
}
|
[
"public",
"static",
"WQConstraint",
"decode",
"(",
"final",
"String",
"field",
",",
"final",
"String",
"rawValue",
")",
"{",
"final",
"WQFunctionType",
"function",
";",
"final",
"String",
"value",
";",
"if",
"(",
"StringUtils",
".",
"equalsIgnoreCase",
"(",
"rawValue",
",",
"WQFunctionType",
".",
"IS_NULL",
".",
"getPrefix",
"(",
")",
")",
")",
"return",
"new",
"WQConstraint",
"(",
"field",
",",
"WQFunctionType",
".",
"IS_NULL",
",",
"null",
")",
";",
"else",
"if",
"(",
"StringUtils",
".",
"equalsIgnoreCase",
"(",
"rawValue",
",",
"WQFunctionType",
".",
"NOT_NULL",
".",
"getPrefix",
"(",
")",
")",
")",
"return",
"new",
"WQConstraint",
"(",
"field",
",",
"WQFunctionType",
".",
"NOT_NULL",
",",
"null",
")",
";",
"else",
"if",
"(",
"rawValue",
".",
"startsWith",
"(",
"\"_f_\"",
")",
")",
"{",
"function",
"=",
"WQFunctionType",
".",
"getByPrefix",
"(",
"rawValue",
")",
";",
"if",
"(",
"function",
".",
"hasParam",
"(",
")",
")",
"{",
"// Strip the function name from the value",
"value",
"=",
"rawValue",
".",
"substring",
"(",
"function",
".",
"getPrefix",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"function",
".",
"hasBinaryParam",
"(",
")",
")",
"{",
"final",
"String",
"[",
"]",
"splitValues",
"=",
"StringUtils",
".",
"split",
"(",
"value",
",",
"\"..\"",
",",
"2",
")",
";",
"final",
"String",
"left",
"=",
"splitValues",
"[",
"0",
"]",
";",
"final",
"String",
"right",
"=",
"splitValues",
"[",
"1",
"]",
";",
"return",
"new",
"WQConstraint",
"(",
"field",
",",
"function",
",",
"left",
",",
"right",
")",
";",
"}",
"}",
"else",
"{",
"value",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"function",
"=",
"WQFunctionType",
".",
"EQ",
";",
"value",
"=",
"rawValue",
";",
"}",
"return",
"new",
"WQConstraint",
"(",
"field",
",",
"function",
",",
"value",
")",
";",
"}"
] |
Produce a WebQueryConstraint from a Query String format parameter
@param field
@param rawValue
@return
|
[
"Produce",
"a",
"WebQueryConstraint",
"from",
"a",
"Query",
"String",
"format",
"parameter"
] |
train
|
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/restclient/jaxb/webquery/WQConstraint.java#L238-L278
|
tweea/matrixjavalib-main-common
|
src/main/java/net/matrix/security/Cryptos.java
|
Cryptos.aesDecrypt
|
public static byte[] aesDecrypt(final byte[] input, final byte[] key, final byte[] iv)
throws GeneralSecurityException {
"""
使用 AES 解密。
@param input
密文
@param key
符合 AES 要求的密钥
@param iv
初始向量
@return 明文
@throws GeneralSecurityException
解密失败
"""
return aes(input, key, iv, Cipher.DECRYPT_MODE);
}
|
java
|
public static byte[] aesDecrypt(final byte[] input, final byte[] key, final byte[] iv)
throws GeneralSecurityException {
return aes(input, key, iv, Cipher.DECRYPT_MODE);
}
|
[
"public",
"static",
"byte",
"[",
"]",
"aesDecrypt",
"(",
"final",
"byte",
"[",
"]",
"input",
",",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"iv",
")",
"throws",
"GeneralSecurityException",
"{",
"return",
"aes",
"(",
"input",
",",
"key",
",",
"iv",
",",
"Cipher",
".",
"DECRYPT_MODE",
")",
";",
"}"
] |
使用 AES 解密。
@param input
密文
@param key
符合 AES 要求的密钥
@param iv
初始向量
@return 明文
@throws GeneralSecurityException
解密失败
|
[
"使用",
"AES",
"解密。"
] |
train
|
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/security/Cryptos.java#L192-L195
|
nmorel/gwt-jackson
|
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/bean/BeanPropertySerializer.java
|
BeanPropertySerializer.serializePropertyName
|
public void serializePropertyName( JsonWriter writer, T bean, JsonSerializationContext ctx ) {
"""
Serializes the property name
@param writer writer
@param bean bean containing the property to serialize
@param ctx context of the serialization process
"""
writer.unescapeName( propertyName );
}
|
java
|
public void serializePropertyName( JsonWriter writer, T bean, JsonSerializationContext ctx ) {
writer.unescapeName( propertyName );
}
|
[
"public",
"void",
"serializePropertyName",
"(",
"JsonWriter",
"writer",
",",
"T",
"bean",
",",
"JsonSerializationContext",
"ctx",
")",
"{",
"writer",
".",
"unescapeName",
"(",
"propertyName",
")",
";",
"}"
] |
Serializes the property name
@param writer writer
@param bean bean containing the property to serialize
@param ctx context of the serialization process
|
[
"Serializes",
"the",
"property",
"name"
] |
train
|
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/bean/BeanPropertySerializer.java#L82-L84
|
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.readAndLocalizeDesign
|
@SuppressWarnings("resource")
public static void readAndLocalizeDesign(Component component, CmsMessages messages, Map<String, String> macros) {
"""
Reads the declarative design for a component and localizes it using a messages object.<p>
The design will need to be located in the same directory as the component's class and have '.html' as a file extension.
@param component the component for which to read the design
@param messages the message bundle to use for localization
@param macros the macros to use on the HTML template
"""
Class<?> componentClass = component.getClass();
List<Class<?>> classes = Lists.newArrayList();
classes.add(componentClass);
classes.addAll(ClassUtils.getAllSuperclasses(componentClass));
InputStream designStream = null;
for (Class<?> cls : classes) {
if (cls.getName().startsWith("com.vaadin")) {
break;
}
String filename = cls.getSimpleName() + ".html";
designStream = cls.getResourceAsStream(filename);
if (designStream != null) {
break;
}
}
if (designStream == null) {
throw new IllegalArgumentException("Design not found for : " + component.getClass());
}
readAndLocalizeDesign(component, designStream, messages, macros);
}
|
java
|
@SuppressWarnings("resource")
public static void readAndLocalizeDesign(Component component, CmsMessages messages, Map<String, String> macros) {
Class<?> componentClass = component.getClass();
List<Class<?>> classes = Lists.newArrayList();
classes.add(componentClass);
classes.addAll(ClassUtils.getAllSuperclasses(componentClass));
InputStream designStream = null;
for (Class<?> cls : classes) {
if (cls.getName().startsWith("com.vaadin")) {
break;
}
String filename = cls.getSimpleName() + ".html";
designStream = cls.getResourceAsStream(filename);
if (designStream != null) {
break;
}
}
if (designStream == null) {
throw new IllegalArgumentException("Design not found for : " + component.getClass());
}
readAndLocalizeDesign(component, designStream, messages, macros);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"static",
"void",
"readAndLocalizeDesign",
"(",
"Component",
"component",
",",
"CmsMessages",
"messages",
",",
"Map",
"<",
"String",
",",
"String",
">",
"macros",
")",
"{",
"Class",
"<",
"?",
">",
"componentClass",
"=",
"component",
".",
"getClass",
"(",
")",
";",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"classes",
".",
"add",
"(",
"componentClass",
")",
";",
"classes",
".",
"addAll",
"(",
"ClassUtils",
".",
"getAllSuperclasses",
"(",
"componentClass",
")",
")",
";",
"InputStream",
"designStream",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"cls",
":",
"classes",
")",
"{",
"if",
"(",
"cls",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"com.vaadin\"",
")",
")",
"{",
"break",
";",
"}",
"String",
"filename",
"=",
"cls",
".",
"getSimpleName",
"(",
")",
"+",
"\".html\"",
";",
"designStream",
"=",
"cls",
".",
"getResourceAsStream",
"(",
"filename",
")",
";",
"if",
"(",
"designStream",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"designStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Design not found for : \"",
"+",
"component",
".",
"getClass",
"(",
")",
")",
";",
"}",
"readAndLocalizeDesign",
"(",
"component",
",",
"designStream",
",",
"messages",
",",
"macros",
")",
";",
"}"
] |
Reads the declarative design for a component and localizes it using a messages object.<p>
The design will need to be located in the same directory as the component's class and have '.html' as a file extension.
@param component the component for which to read the design
@param messages the message bundle to use for localization
@param macros the macros to use on the HTML template
|
[
"Reads",
"the",
"declarative",
"design",
"for",
"a",
"component",
"and",
"localizes",
"it",
"using",
"a",
"messages",
"object",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1048-L1071
|
code4everything/util
|
src/main/java/com/zhazhapan/util/FileExecutor.java
|
FileExecutor.saveLogFile
|
public static void saveLogFile(String logPath, String content) throws IOException {
"""
保存日志文件(插入方式)
@param logPath 路径
@param content 内容
@throws IOException 异常
"""
File file = new File(logPath);
if (file.exists()) {
content += readFile(file);
}
saveFile(file, content);
}
|
java
|
public static void saveLogFile(String logPath, String content) throws IOException {
File file = new File(logPath);
if (file.exists()) {
content += readFile(file);
}
saveFile(file, content);
}
|
[
"public",
"static",
"void",
"saveLogFile",
"(",
"String",
"logPath",
",",
"String",
"content",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"logPath",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"content",
"+=",
"readFile",
"(",
"file",
")",
";",
"}",
"saveFile",
"(",
"file",
",",
"content",
")",
";",
"}"
] |
保存日志文件(插入方式)
@param logPath 路径
@param content 内容
@throws IOException 异常
|
[
"保存日志文件(插入方式)"
] |
train
|
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L963-L969
|
citrusframework/citrus
|
modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java
|
AbstractSoapAttachmentValidator.buildValidationErrorMessage
|
private String buildValidationErrorMessage(String message, Object expectedValue, Object actualValue) {
"""
Constructs proper error message with expected value and actual value.
@param message the base error message.
@param expectedValue the expected value.
@param actualValue the actual value.
@return
"""
return message + ", expected '" + expectedValue + "' but was '" + actualValue + "'";
}
|
java
|
private String buildValidationErrorMessage(String message, Object expectedValue, Object actualValue) {
return message + ", expected '" + expectedValue + "' but was '" + actualValue + "'";
}
|
[
"private",
"String",
"buildValidationErrorMessage",
"(",
"String",
"message",
",",
"Object",
"expectedValue",
",",
"Object",
"actualValue",
")",
"{",
"return",
"message",
"+",
"\", expected '\"",
"+",
"expectedValue",
"+",
"\"' but was '\"",
"+",
"actualValue",
"+",
"\"'\"",
";",
"}"
] |
Constructs proper error message with expected value and actual value.
@param message the base error message.
@param expectedValue the expected value.
@param actualValue the actual value.
@return
|
[
"Constructs",
"proper",
"error",
"message",
"with",
"expected",
"value",
"and",
"actual",
"value",
"."
] |
train
|
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java#L165-L167
|
atomix/copycat
|
server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java
|
MinorCompactionTask.compactEntries
|
private void compactEntries(Segment segment, Segment compactSegment) {
"""
Compacts entries from the given segment, rewriting them to the compact segment.
@param segment The segment to compact.
@param compactSegment The compact segment.
"""
for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) {
checkEntry(i, segment, compactSegment);
}
}
|
java
|
private void compactEntries(Segment segment, Segment compactSegment) {
for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) {
checkEntry(i, segment, compactSegment);
}
}
|
[
"private",
"void",
"compactEntries",
"(",
"Segment",
"segment",
",",
"Segment",
"compactSegment",
")",
"{",
"for",
"(",
"long",
"i",
"=",
"segment",
".",
"firstIndex",
"(",
")",
";",
"i",
"<=",
"segment",
".",
"lastIndex",
"(",
")",
";",
"i",
"++",
")",
"{",
"checkEntry",
"(",
"i",
",",
"segment",
",",
"compactSegment",
")",
";",
"}",
"}"
] |
Compacts entries from the given segment, rewriting them to the compact segment.
@param segment The segment to compact.
@param compactSegment The compact segment.
|
[
"Compacts",
"entries",
"from",
"the",
"given",
"segment",
"rewriting",
"them",
"to",
"the",
"compact",
"segment",
"."
] |
train
|
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java#L99-L103
|
Azure/azure-sdk-for-java
|
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
|
BlobContainersInner.extendImmutabilityPolicy
|
public ImmutabilityPolicyInner extendImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) {
"""
Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied.
@param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days.
@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 ImmutabilityPolicyInner object if successful.
"""
return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).toBlocking().single().body();
}
|
java
|
public ImmutabilityPolicyInner extendImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) {
return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).toBlocking().single().body();
}
|
[
"public",
"ImmutabilityPolicyInner",
"extendImmutabilityPolicy",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
",",
"String",
"ifMatch",
",",
"int",
"immutabilityPeriodSinceCreationInDays",
")",
"{",
"return",
"extendImmutabilityPolicyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"containerName",
",",
"ifMatch",
",",
"immutabilityPeriodSinceCreationInDays",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied.
@param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days.
@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 ImmutabilityPolicyInner object if successful.
|
[
"Extends",
"the",
"immutabilityPeriodSinceCreationInDays",
"of",
"a",
"locked",
"immutabilityPolicy",
".",
"The",
"only",
"action",
"allowed",
"on",
"a",
"Locked",
"policy",
"will",
"be",
"this",
"action",
".",
"ETag",
"in",
"If",
"-",
"Match",
"is",
"required",
"for",
"this",
"operation",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1587-L1589
|
rpau/javalang
|
src/main/java/org/walkmod/javalang/ast/Refactorization.java
|
Refactorization.refactorVariable
|
public boolean refactorVariable(SymbolDefinition n, final String newName) {
"""
Generic method to rename a SymbolDefinition variable/parameter.
@param n variable to rename.
@param newName new name to set.
@return if the rename procedure has been applied successfully.
"""
Map<String, SymbolDefinition> scope = n.getVariableDefinitions();
if (!scope.containsKey(newName)) {
if (n.getUsages() != null) {
List<SymbolReference> usages = new LinkedList<SymbolReference>(n.getUsages());
VoidVisitorAdapter<?> visitor = new VoidVisitorAdapter<Object>() {
@Override
public void visit(NameExpr nexpr, Object ctx) {
Map<String, SymbolDefinition> innerScope = nexpr.getVariableDefinitions();
if (innerScope.containsKey(newName)) {
nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(new ThisExpr(), newName));
} else {
nexpr.getParentNode().replaceChildNode(nexpr, new NameExpr(newName));
}
}
@Override
public void visit(FieldAccessExpr nexpr, Object ctx) {
nexpr.getParentNode().replaceChildNode(nexpr,
new FieldAccessExpr(nexpr.getScope(), nexpr.getTypeArgs(), newName));
}
};
for (SymbolReference usage : usages) {
Node aux = (Node) usage;
aux.accept(visitor, null);
}
}
return true;
}
return false;
}
|
java
|
public boolean refactorVariable(SymbolDefinition n, final String newName) {
Map<String, SymbolDefinition> scope = n.getVariableDefinitions();
if (!scope.containsKey(newName)) {
if (n.getUsages() != null) {
List<SymbolReference> usages = new LinkedList<SymbolReference>(n.getUsages());
VoidVisitorAdapter<?> visitor = new VoidVisitorAdapter<Object>() {
@Override
public void visit(NameExpr nexpr, Object ctx) {
Map<String, SymbolDefinition> innerScope = nexpr.getVariableDefinitions();
if (innerScope.containsKey(newName)) {
nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(new ThisExpr(), newName));
} else {
nexpr.getParentNode().replaceChildNode(nexpr, new NameExpr(newName));
}
}
@Override
public void visit(FieldAccessExpr nexpr, Object ctx) {
nexpr.getParentNode().replaceChildNode(nexpr,
new FieldAccessExpr(nexpr.getScope(), nexpr.getTypeArgs(), newName));
}
};
for (SymbolReference usage : usages) {
Node aux = (Node) usage;
aux.accept(visitor, null);
}
}
return true;
}
return false;
}
|
[
"public",
"boolean",
"refactorVariable",
"(",
"SymbolDefinition",
"n",
",",
"final",
"String",
"newName",
")",
"{",
"Map",
"<",
"String",
",",
"SymbolDefinition",
">",
"scope",
"=",
"n",
".",
"getVariableDefinitions",
"(",
")",
";",
"if",
"(",
"!",
"scope",
".",
"containsKey",
"(",
"newName",
")",
")",
"{",
"if",
"(",
"n",
".",
"getUsages",
"(",
")",
"!=",
"null",
")",
"{",
"List",
"<",
"SymbolReference",
">",
"usages",
"=",
"new",
"LinkedList",
"<",
"SymbolReference",
">",
"(",
"n",
".",
"getUsages",
"(",
")",
")",
";",
"VoidVisitorAdapter",
"<",
"?",
">",
"visitor",
"=",
"new",
"VoidVisitorAdapter",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"visit",
"(",
"NameExpr",
"nexpr",
",",
"Object",
"ctx",
")",
"{",
"Map",
"<",
"String",
",",
"SymbolDefinition",
">",
"innerScope",
"=",
"nexpr",
".",
"getVariableDefinitions",
"(",
")",
";",
"if",
"(",
"innerScope",
".",
"containsKey",
"(",
"newName",
")",
")",
"{",
"nexpr",
".",
"getParentNode",
"(",
")",
".",
"replaceChildNode",
"(",
"nexpr",
",",
"new",
"FieldAccessExpr",
"(",
"new",
"ThisExpr",
"(",
")",
",",
"newName",
")",
")",
";",
"}",
"else",
"{",
"nexpr",
".",
"getParentNode",
"(",
")",
".",
"replaceChildNode",
"(",
"nexpr",
",",
"new",
"NameExpr",
"(",
"newName",
")",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"visit",
"(",
"FieldAccessExpr",
"nexpr",
",",
"Object",
"ctx",
")",
"{",
"nexpr",
".",
"getParentNode",
"(",
")",
".",
"replaceChildNode",
"(",
"nexpr",
",",
"new",
"FieldAccessExpr",
"(",
"nexpr",
".",
"getScope",
"(",
")",
",",
"nexpr",
".",
"getTypeArgs",
"(",
")",
",",
"newName",
")",
")",
";",
"}",
"}",
";",
"for",
"(",
"SymbolReference",
"usage",
":",
"usages",
")",
"{",
"Node",
"aux",
"=",
"(",
"Node",
")",
"usage",
";",
"aux",
".",
"accept",
"(",
"visitor",
",",
"null",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Generic method to rename a SymbolDefinition variable/parameter.
@param n variable to rename.
@param newName new name to set.
@return if the rename procedure has been applied successfully.
|
[
"Generic",
"method",
"to",
"rename",
"a",
"SymbolDefinition",
"variable",
"/",
"parameter",
"."
] |
train
|
https://github.com/rpau/javalang/blob/17ab1d6cbe7527a2f272049c4958354328de2171/src/main/java/org/walkmod/javalang/ast/Refactorization.java#L34-L71
|
Ordinastie/MalisisCore
|
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
|
Positions.rightOf
|
public static <T extends IPositioned & ISized> IntSupplier rightOf(T other, int spacing) {
"""
Positions the owner to the right of the other.
@param <T> the generic type
@param other the other
@param spacing the spacing
@return the int supplier
"""
checkNotNull(other);
return () -> {
return other.position().x() + other.size().width() + spacing;
};
}
|
java
|
public static <T extends IPositioned & ISized> IntSupplier rightOf(T other, int spacing)
{
checkNotNull(other);
return () -> {
return other.position().x() + other.size().width() + spacing;
};
}
|
[
"public",
"static",
"<",
"T",
"extends",
"IPositioned",
"&",
"ISized",
">",
"IntSupplier",
"rightOf",
"(",
"T",
"other",
",",
"int",
"spacing",
")",
"{",
"checkNotNull",
"(",
"other",
")",
";",
"return",
"(",
")",
"->",
"{",
"return",
"other",
".",
"position",
"(",
")",
".",
"x",
"(",
")",
"+",
"other",
".",
"size",
"(",
")",
".",
"width",
"(",
")",
"+",
"spacing",
";",
"}",
";",
"}"
] |
Positions the owner to the right of the other.
@param <T> the generic type
@param other the other
@param spacing the spacing
@return the int supplier
|
[
"Positions",
"the",
"owner",
"to",
"the",
"right",
"of",
"the",
"other",
"."
] |
train
|
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L177-L183
|
grpc/grpc-java
|
core/src/main/java/io/grpc/internal/ProxyDetectorImpl.java
|
ProxyDetectorImpl.overrideProxy
|
private static InetSocketAddress overrideProxy(String proxyHostPort) {
"""
GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.
"""
if (proxyHostPort == null) {
return null;
}
String[] parts = proxyHostPort.split(":", 2);
int port = 80;
if (parts.length > 1) {
port = Integer.parseInt(parts[1]);
}
log.warning(
"Detected GRPC_PROXY_EXP and will honor it, but this feature will "
+ "be removed in a future release. Use the JVM flags "
+ "\"-Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT\" to set the https proxy for "
+ "this JVM.");
return new InetSocketAddress(parts[0], port);
}
|
java
|
private static InetSocketAddress overrideProxy(String proxyHostPort) {
if (proxyHostPort == null) {
return null;
}
String[] parts = proxyHostPort.split(":", 2);
int port = 80;
if (parts.length > 1) {
port = Integer.parseInt(parts[1]);
}
log.warning(
"Detected GRPC_PROXY_EXP and will honor it, but this feature will "
+ "be removed in a future release. Use the JVM flags "
+ "\"-Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT\" to set the https proxy for "
+ "this JVM.");
return new InetSocketAddress(parts[0], port);
}
|
[
"private",
"static",
"InetSocketAddress",
"overrideProxy",
"(",
"String",
"proxyHostPort",
")",
"{",
"if",
"(",
"proxyHostPort",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"parts",
"=",
"proxyHostPort",
".",
"split",
"(",
"\":\"",
",",
"2",
")",
";",
"int",
"port",
"=",
"80",
";",
"if",
"(",
"parts",
".",
"length",
">",
"1",
")",
"{",
"port",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"1",
"]",
")",
";",
"}",
"log",
".",
"warning",
"(",
"\"Detected GRPC_PROXY_EXP and will honor it, but this feature will \"",
"+",
"\"be removed in a future release. Use the JVM flags \"",
"+",
"\"\\\"-Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT\\\" to set the https proxy for \"",
"+",
"\"this JVM.\"",
")",
";",
"return",
"new",
"InetSocketAddress",
"(",
"parts",
"[",
"0",
"]",
",",
"port",
")",
";",
"}"
] |
GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.
|
[
"GRPC_PROXY_EXP",
"is",
"deprecated",
"but",
"let",
"s",
"maintain",
"compatibility",
"for",
"now",
"."
] |
train
|
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ProxyDetectorImpl.java#L284-L300
|
atomix/catalyst
|
serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java
|
Serializer.readByClass
|
@SuppressWarnings("unchecked")
private <T> T readByClass(BufferInput<?> buffer) {
"""
Reads a writable object.
@param buffer The buffer from which to read the object.
@param <T> The object type.
@return The read object.
"""
String name = buffer.readUTF8();
if (whitelistRequired.get())
throw new SerializationException("cannot deserialize unregistered type: " + name);
Class<T> type = (Class<T>) types.get(name);
if (type == null) {
try {
type = (Class<T>) Class.forName(name);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
types.put(name, type);
} catch (ClassNotFoundException e) {
throw new SerializationException("object class not found: " + name, e);
}
}
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize unregistered type: " + name);
return serializer.read(type, buffer, this);
}
|
java
|
@SuppressWarnings("unchecked")
private <T> T readByClass(BufferInput<?> buffer) {
String name = buffer.readUTF8();
if (whitelistRequired.get())
throw new SerializationException("cannot deserialize unregistered type: " + name);
Class<T> type = (Class<T>) types.get(name);
if (type == null) {
try {
type = (Class<T>) Class.forName(name);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
types.put(name, type);
} catch (ClassNotFoundException e) {
throw new SerializationException("object class not found: " + name, e);
}
}
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize unregistered type: " + name);
return serializer.read(type, buffer, this);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"readByClass",
"(",
"BufferInput",
"<",
"?",
">",
"buffer",
")",
"{",
"String",
"name",
"=",
"buffer",
".",
"readUTF8",
"(",
")",
";",
"if",
"(",
"whitelistRequired",
".",
"get",
"(",
")",
")",
"throw",
"new",
"SerializationException",
"(",
"\"cannot deserialize unregistered type: \"",
"+",
"name",
")",
";",
"Class",
"<",
"T",
">",
"type",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"types",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"try",
"{",
"type",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"Class",
".",
"forName",
"(",
"name",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"SerializationException",
"(",
"\"cannot deserialize: unknown type\"",
")",
";",
"types",
".",
"put",
"(",
"name",
",",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"SerializationException",
"(",
"\"object class not found: \"",
"+",
"name",
",",
"e",
")",
";",
"}",
"}",
"TypeSerializer",
"<",
"T",
">",
"serializer",
"=",
"getSerializer",
"(",
"type",
")",
";",
"if",
"(",
"serializer",
"==",
"null",
")",
"throw",
"new",
"SerializationException",
"(",
"\"cannot deserialize unregistered type: \"",
"+",
"name",
")",
";",
"return",
"serializer",
".",
"read",
"(",
"type",
",",
"buffer",
",",
"this",
")",
";",
"}"
] |
Reads a writable object.
@param buffer The buffer from which to read the object.
@param <T> The object type.
@return The read object.
|
[
"Reads",
"a",
"writable",
"object",
"."
] |
train
|
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L1050-L1073
|
elki-project/elki
|
elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java
|
OfflineChangePointDetectionAlgorithm.bestChangeInMean
|
public static DoubleIntPair bestChangeInMean(double[] sums, int begin, int end) {
"""
Find the best position to assume a change in mean.
@param sums Cumulative sums
@param begin Interval begin
@param end Interval end
@return Best change position
"""
final int len = end - begin, last = end - 1;
final double suml = begin > 0 ? sums[begin - 1] : 0.;
final double sumr = sums[last];
int bestpos = begin;
double bestscore = Double.NEGATIVE_INFINITY;
// Iterate elements k=2..n-1 in math notation_
for(int j = begin, km1 = 1; j < last; j++, km1++) {
assert (km1 < len); // FIXME: remove eventually
final double sumj = sums[j]; // Sum _inclusive_ j'th element.
// Derive the left mean and right mean from the precomputed aggregates:
final double lmean = (sumj - suml) / km1;
final double rmean = (sumr - sumj) / (len - km1);
// Equation 2.6.17 from the Basseville book
final double dm = lmean - rmean;
final double score = km1 * (double) (len - km1) * dm * dm;
if(score > bestscore) {
bestpos = j + 1;
bestscore = score;
}
}
return new DoubleIntPair(bestscore, bestpos);
}
|
java
|
public static DoubleIntPair bestChangeInMean(double[] sums, int begin, int end) {
final int len = end - begin, last = end - 1;
final double suml = begin > 0 ? sums[begin - 1] : 0.;
final double sumr = sums[last];
int bestpos = begin;
double bestscore = Double.NEGATIVE_INFINITY;
// Iterate elements k=2..n-1 in math notation_
for(int j = begin, km1 = 1; j < last; j++, km1++) {
assert (km1 < len); // FIXME: remove eventually
final double sumj = sums[j]; // Sum _inclusive_ j'th element.
// Derive the left mean and right mean from the precomputed aggregates:
final double lmean = (sumj - suml) / km1;
final double rmean = (sumr - sumj) / (len - km1);
// Equation 2.6.17 from the Basseville book
final double dm = lmean - rmean;
final double score = km1 * (double) (len - km1) * dm * dm;
if(score > bestscore) {
bestpos = j + 1;
bestscore = score;
}
}
return new DoubleIntPair(bestscore, bestpos);
}
|
[
"public",
"static",
"DoubleIntPair",
"bestChangeInMean",
"(",
"double",
"[",
"]",
"sums",
",",
"int",
"begin",
",",
"int",
"end",
")",
"{",
"final",
"int",
"len",
"=",
"end",
"-",
"begin",
",",
"last",
"=",
"end",
"-",
"1",
";",
"final",
"double",
"suml",
"=",
"begin",
">",
"0",
"?",
"sums",
"[",
"begin",
"-",
"1",
"]",
":",
"0.",
";",
"final",
"double",
"sumr",
"=",
"sums",
"[",
"last",
"]",
";",
"int",
"bestpos",
"=",
"begin",
";",
"double",
"bestscore",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"// Iterate elements k=2..n-1 in math notation_",
"for",
"(",
"int",
"j",
"=",
"begin",
",",
"km1",
"=",
"1",
";",
"j",
"<",
"last",
";",
"j",
"++",
",",
"km1",
"++",
")",
"{",
"assert",
"(",
"km1",
"<",
"len",
")",
";",
"// FIXME: remove eventually",
"final",
"double",
"sumj",
"=",
"sums",
"[",
"j",
"]",
";",
"// Sum _inclusive_ j'th element.",
"// Derive the left mean and right mean from the precomputed aggregates:",
"final",
"double",
"lmean",
"=",
"(",
"sumj",
"-",
"suml",
")",
"/",
"km1",
";",
"final",
"double",
"rmean",
"=",
"(",
"sumr",
"-",
"sumj",
")",
"/",
"(",
"len",
"-",
"km1",
")",
";",
"// Equation 2.6.17 from the Basseville book",
"final",
"double",
"dm",
"=",
"lmean",
"-",
"rmean",
";",
"final",
"double",
"score",
"=",
"km1",
"*",
"(",
"double",
")",
"(",
"len",
"-",
"km1",
")",
"*",
"dm",
"*",
"dm",
";",
"if",
"(",
"score",
">",
"bestscore",
")",
"{",
"bestpos",
"=",
"j",
"+",
"1",
";",
"bestscore",
"=",
"score",
";",
"}",
"}",
"return",
"new",
"DoubleIntPair",
"(",
"bestscore",
",",
"bestpos",
")",
";",
"}"
] |
Find the best position to assume a change in mean.
@param sums Cumulative sums
@param begin Interval begin
@param end Interval end
@return Best change position
|
[
"Find",
"the",
"best",
"position",
"to",
"assume",
"a",
"change",
"in",
"mean",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java#L295-L318
|
jMotif/SAX
|
src/main/java/net/seninp/util/HeatChart.java
|
HeatChart.setYValues
|
public void setYValues(double yOffset, double yInterval) {
"""
Sets the y-values which are plotted along the y-axis. The y-values are calculated based upon
the indexes of the z-values array:
<pre>
{@code
<pre>
y-value = y-offset + (column-index * y-interval)
</pre>
}
</pre>
<p>
The y-interval defines the gap between each y-value and the y-offset is applied to each value
to offset them all from zero.
<p>
Alternatively the y-values can be set more directly with the <code>setYValues(Object[])</code>
method.
@param yOffset an offset value to be applied to the index of each z-value element.
@param yInterval an interval that will separate each y-value item.
"""
// Update the y-values according to the offset and interval.
yValues = new Object[zValues.length];
for (int i = 0; i < zValues.length; i++) {
yValues[i] = yOffset + (i * yInterval);
}
}
|
java
|
public void setYValues(double yOffset, double yInterval) {
// Update the y-values according to the offset and interval.
yValues = new Object[zValues.length];
for (int i = 0; i < zValues.length; i++) {
yValues[i] = yOffset + (i * yInterval);
}
}
|
[
"public",
"void",
"setYValues",
"(",
"double",
"yOffset",
",",
"double",
"yInterval",
")",
"{",
"// Update the y-values according to the offset and interval.",
"yValues",
"=",
"new",
"Object",
"[",
"zValues",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"zValues",
".",
"length",
";",
"i",
"++",
")",
"{",
"yValues",
"[",
"i",
"]",
"=",
"yOffset",
"+",
"(",
"i",
"*",
"yInterval",
")",
";",
"}",
"}"
] |
Sets the y-values which are plotted along the y-axis. The y-values are calculated based upon
the indexes of the z-values array:
<pre>
{@code
<pre>
y-value = y-offset + (column-index * y-interval)
</pre>
}
</pre>
<p>
The y-interval defines the gap between each y-value and the y-offset is applied to each value
to offset them all from zero.
<p>
Alternatively the y-values can be set more directly with the <code>setYValues(Object[])</code>
method.
@param yOffset an offset value to be applied to the index of each z-value element.
@param yInterval an interval that will separate each y-value item.
|
[
"Sets",
"the",
"y",
"-",
"values",
"which",
"are",
"plotted",
"along",
"the",
"y",
"-",
"axis",
".",
"The",
"y",
"-",
"values",
"are",
"calculated",
"based",
"upon",
"the",
"indexes",
"of",
"the",
"z",
"-",
"values",
"array",
":"
] |
train
|
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L422-L428
|
QSFT/Doradus
|
doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java
|
DoradusClient.setCredentials
|
public void setCredentials(String tenant, String username, String userpassword) {
"""
Set credentials such as tenant, username, password for use with a Doradus application.
@param tenant tenant name
@param username user name use when accessing applications within the specified tenant.
@param userpassword user password
"""
Credentials credentials = new Credentials(tenant, username, userpassword);
restClient.setCredentials(credentials);
}
|
java
|
public void setCredentials(String tenant, String username, String userpassword) {
Credentials credentials = new Credentials(tenant, username, userpassword);
restClient.setCredentials(credentials);
}
|
[
"public",
"void",
"setCredentials",
"(",
"String",
"tenant",
",",
"String",
"username",
",",
"String",
"userpassword",
")",
"{",
"Credentials",
"credentials",
"=",
"new",
"Credentials",
"(",
"tenant",
",",
"username",
",",
"userpassword",
")",
";",
"restClient",
".",
"setCredentials",
"(",
"credentials",
")",
";",
"}"
] |
Set credentials such as tenant, username, password for use with a Doradus application.
@param tenant tenant name
@param username user name use when accessing applications within the specified tenant.
@param userpassword user password
|
[
"Set",
"credentials",
"such",
"as",
"tenant",
"username",
"password",
"for",
"use",
"with",
"a",
"Doradus",
"application",
"."
] |
train
|
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java#L114-L117
|
biojava/biojava
|
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
|
MmtfUtils.addSeqRes
|
public static void addSeqRes(Chain modelChain, String sequence) {
"""
Add the missing groups to the SeqResGroups.
@param modelChain the chain to add the information for
@param sequence the sequence of the construct
"""
List<Group> seqResGroups = modelChain.getSeqResGroups();
GroupType chainType = getChainType(modelChain.getAtomGroups());
for(int i=0; i<sequence.length(); i++){
char singleLetterCode = sequence.charAt(i);
Group group = null;
if(seqResGroups.size()<=i){
}
else{
group=seqResGroups.get(i);
}
if(group!=null){
continue;
}
group = getSeqResGroup(modelChain, singleLetterCode, chainType);
addGroupAtId(seqResGroups, group, i);
seqResGroups.set(i, group);
}
}
|
java
|
public static void addSeqRes(Chain modelChain, String sequence) {
List<Group> seqResGroups = modelChain.getSeqResGroups();
GroupType chainType = getChainType(modelChain.getAtomGroups());
for(int i=0; i<sequence.length(); i++){
char singleLetterCode = sequence.charAt(i);
Group group = null;
if(seqResGroups.size()<=i){
}
else{
group=seqResGroups.get(i);
}
if(group!=null){
continue;
}
group = getSeqResGroup(modelChain, singleLetterCode, chainType);
addGroupAtId(seqResGroups, group, i);
seqResGroups.set(i, group);
}
}
|
[
"public",
"static",
"void",
"addSeqRes",
"(",
"Chain",
"modelChain",
",",
"String",
"sequence",
")",
"{",
"List",
"<",
"Group",
">",
"seqResGroups",
"=",
"modelChain",
".",
"getSeqResGroups",
"(",
")",
";",
"GroupType",
"chainType",
"=",
"getChainType",
"(",
"modelChain",
".",
"getAtomGroups",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sequence",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"singleLetterCode",
"=",
"sequence",
".",
"charAt",
"(",
"i",
")",
";",
"Group",
"group",
"=",
"null",
";",
"if",
"(",
"seqResGroups",
".",
"size",
"(",
")",
"<=",
"i",
")",
"{",
"}",
"else",
"{",
"group",
"=",
"seqResGroups",
".",
"get",
"(",
"i",
")",
";",
"}",
"if",
"(",
"group",
"!=",
"null",
")",
"{",
"continue",
";",
"}",
"group",
"=",
"getSeqResGroup",
"(",
"modelChain",
",",
"singleLetterCode",
",",
"chainType",
")",
";",
"addGroupAtId",
"(",
"seqResGroups",
",",
"group",
",",
"i",
")",
";",
"seqResGroups",
".",
"set",
"(",
"i",
",",
"group",
")",
";",
"}",
"}"
] |
Add the missing groups to the SeqResGroups.
@param modelChain the chain to add the information for
@param sequence the sequence of the construct
|
[
"Add",
"the",
"missing",
"groups",
"to",
"the",
"SeqResGroups",
"."
] |
train
|
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L502-L520
|
konvergeio/cofoja
|
src/main/java/com/google/java/contract/util/Predicates.java
|
Predicates.forValues
|
public static <K, V> Predicate<Map<K, V>> forValues(
final Predicate<? super Collection<V>> p) {
"""
Returns a predicate that evaluates to {@code true} if the value
collection of its argument satisfies {@code p}.
"""
return new Predicate<Map<K, V>>() {
@Override
public boolean apply(Map<K, V> obj) {
return p.apply(obj.values());
}
};
}
|
java
|
public static <K, V> Predicate<Map<K, V>> forValues(
final Predicate<? super Collection<V>> p) {
return new Predicate<Map<K, V>>() {
@Override
public boolean apply(Map<K, V> obj) {
return p.apply(obj.values());
}
};
}
|
[
"public",
"static",
"<",
"K",
",",
"V",
">",
"Predicate",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"forValues",
"(",
"final",
"Predicate",
"<",
"?",
"super",
"Collection",
"<",
"V",
">",
">",
"p",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"obj",
")",
"{",
"return",
"p",
".",
"apply",
"(",
"obj",
".",
"values",
"(",
")",
")",
";",
"}",
"}",
";",
"}"
] |
Returns a predicate that evaluates to {@code true} if the value
collection of its argument satisfies {@code p}.
|
[
"Returns",
"a",
"predicate",
"that",
"evaluates",
"to",
"{"
] |
train
|
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/util/Predicates.java#L268-L276
|
JodaOrg/joda-time
|
src/main/java/org/joda/time/Months.java
|
Months.monthsBetween
|
public static Months monthsBetween(ReadableInstant start, ReadableInstant end) {
"""
Creates a <code>Months</code> representing the number of whole months
between the two specified datetimes. This method correctly handles
any daylight savings time changes that may occur during the interval.
<p>
This method calculates by adding months to the start date until the result
is past the end date. As such, a period from the end of a "long" month to
the end of a "short" month is counted as a whole month.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in months
@throws IllegalArgumentException if the instants are null or invalid
"""
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.months());
return Months.months(amount);
}
|
java
|
public static Months monthsBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.months());
return Months.months(amount);
}
|
[
"public",
"static",
"Months",
"monthsBetween",
"(",
"ReadableInstant",
"start",
",",
"ReadableInstant",
"end",
")",
"{",
"int",
"amount",
"=",
"BaseSingleFieldPeriod",
".",
"between",
"(",
"start",
",",
"end",
",",
"DurationFieldType",
".",
"months",
"(",
")",
")",
";",
"return",
"Months",
".",
"months",
"(",
"amount",
")",
";",
"}"
] |
Creates a <code>Months</code> representing the number of whole months
between the two specified datetimes. This method correctly handles
any daylight savings time changes that may occur during the interval.
<p>
This method calculates by adding months to the start date until the result
is past the end date. As such, a period from the end of a "long" month to
the end of a "short" month is counted as a whole month.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in months
@throws IllegalArgumentException if the instants are null or invalid
|
[
"Creates",
"a",
"<code",
">",
"Months<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"months",
"between",
"the",
"two",
"specified",
"datetimes",
".",
"This",
"method",
"correctly",
"handles",
"any",
"daylight",
"savings",
"time",
"changes",
"that",
"may",
"occur",
"during",
"the",
"interval",
".",
"<p",
">",
"This",
"method",
"calculates",
"by",
"adding",
"months",
"to",
"the",
"start",
"date",
"until",
"the",
"result",
"is",
"past",
"the",
"end",
"date",
".",
"As",
"such",
"a",
"period",
"from",
"the",
"end",
"of",
"a",
"long",
"month",
"to",
"the",
"end",
"of",
"a",
"short",
"month",
"is",
"counted",
"as",
"a",
"whole",
"month",
"."
] |
train
|
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Months.java#L141-L144
|
bazaarvoice/emodb
|
common/json/src/main/java/com/bazaarvoice/emodb/common/json/deferred/LazyJsonMap.java
|
LazyJsonMap.put
|
@Override
public Object put(String key, Object value) {
"""
For efficiency this method breaks the contract that the old value is returned. Otherwise common operations such
as adding intrinsics and template attributes would require deserializing the object.
"""
DeserializationState deserializationState = _deserState.get();
if (deserializationState.isDeserialized()) {
return deserializationState.deserialized.put(key, value);
}
return deserializationState.overrides.put(key, value);
}
|
java
|
@Override
public Object put(String key, Object value) {
DeserializationState deserializationState = _deserState.get();
if (deserializationState.isDeserialized()) {
return deserializationState.deserialized.put(key, value);
}
return deserializationState.overrides.put(key, value);
}
|
[
"@",
"Override",
"public",
"Object",
"put",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"DeserializationState",
"deserializationState",
"=",
"_deserState",
".",
"get",
"(",
")",
";",
"if",
"(",
"deserializationState",
".",
"isDeserialized",
"(",
")",
")",
"{",
"return",
"deserializationState",
".",
"deserialized",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"return",
"deserializationState",
".",
"overrides",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] |
For efficiency this method breaks the contract that the old value is returned. Otherwise common operations such
as adding intrinsics and template attributes would require deserializing the object.
|
[
"For",
"efficiency",
"this",
"method",
"breaks",
"the",
"contract",
"that",
"the",
"old",
"value",
"is",
"returned",
".",
"Otherwise",
"common",
"operations",
"such",
"as",
"adding",
"intrinsics",
"and",
"template",
"attributes",
"would",
"require",
"deserializing",
"the",
"object",
"."
] |
train
|
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/json/src/main/java/com/bazaarvoice/emodb/common/json/deferred/LazyJsonMap.java#L183-L190
|
Azure/azure-sdk-for-java
|
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
|
TrainingsImpl.deleteIteration
|
public void deleteIteration(UUID projectId, UUID iterationId) {
"""
Delete a specific iteration of a project.
@param projectId The project id
@param iterationId The iteration 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
"""
deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body();
}
|
java
|
public void deleteIteration(UUID projectId, UUID iterationId) {
deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body();
}
|
[
"public",
"void",
"deleteIteration",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
")",
"{",
"deleteIterationWithServiceResponseAsync",
"(",
"projectId",
",",
"iterationId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Delete a specific iteration of a project.
@param projectId The project id
@param iterationId The iteration 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
|
[
"Delete",
"a",
"specific",
"iteration",
"of",
"a",
"project",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1881-L1883
|
wildfly-swarm-archive/ARCHIVE-wildfly-swarm
|
plugin/src/main/java/org/wildfly/swarm/plugin/Util.java
|
Util.filteredSystemProperties
|
public static Properties filteredSystemProperties(final Properties existing, final boolean withMaven) {
"""
Copies any jboss.*, swarm.*, or wildfly.* (and optionally maven.*) sysprops from System,
along with anything that shadows a specified property.
@return only the filtered properties, existing is unchanged
"""
final Properties properties = new Properties();
System.getProperties().stringPropertyNames().forEach(key -> {
if (key.startsWith("jboss.") ||
key.startsWith("swarm.") ||
key.startsWith("wildfly.") ||
(withMaven && key.startsWith("maven.")) ||
existing.containsKey(key)) {
properties.put(key, System.getProperty(key));
}
});
return properties;
}
|
java
|
public static Properties filteredSystemProperties(final Properties existing, final boolean withMaven) {
final Properties properties = new Properties();
System.getProperties().stringPropertyNames().forEach(key -> {
if (key.startsWith("jboss.") ||
key.startsWith("swarm.") ||
key.startsWith("wildfly.") ||
(withMaven && key.startsWith("maven.")) ||
existing.containsKey(key)) {
properties.put(key, System.getProperty(key));
}
});
return properties;
}
|
[
"public",
"static",
"Properties",
"filteredSystemProperties",
"(",
"final",
"Properties",
"existing",
",",
"final",
"boolean",
"withMaven",
")",
"{",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"System",
".",
"getProperties",
"(",
")",
".",
"stringPropertyNames",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"jboss.\"",
")",
"||",
"key",
".",
"startsWith",
"(",
"\"swarm.\"",
")",
"||",
"key",
".",
"startsWith",
"(",
"\"wildfly.\"",
")",
"||",
"(",
"withMaven",
"&&",
"key",
".",
"startsWith",
"(",
"\"maven.\"",
")",
")",
"||",
"existing",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"properties",
".",
"put",
"(",
"key",
",",
"System",
".",
"getProperty",
"(",
"key",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"properties",
";",
"}"
] |
Copies any jboss.*, swarm.*, or wildfly.* (and optionally maven.*) sysprops from System,
along with anything that shadows a specified property.
@return only the filtered properties, existing is unchanged
|
[
"Copies",
"any",
"jboss",
".",
"*",
"swarm",
".",
"*",
"or",
"wildfly",
".",
"*",
"(",
"and",
"optionally",
"maven",
".",
"*",
")",
"sysprops",
"from",
"System",
"along",
"with",
"anything",
"that",
"shadows",
"a",
"specified",
"property",
"."
] |
train
|
https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/plugin/src/main/java/org/wildfly/swarm/plugin/Util.java#L51-L65
|
google/error-prone
|
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
|
ASTHelpers.findEnclosingNode
|
@Nullable
public static <T> T findEnclosingNode(TreePath path, Class<T> klass) {
"""
Given a TreePath, walks up the tree until it finds a node of the given type. Returns null if no
such node is found.
"""
path = findPathFromEnclosingNodeToTopLevel(path, klass);
return (path == null) ? null : klass.cast(path.getLeaf());
}
|
java
|
@Nullable
public static <T> T findEnclosingNode(TreePath path, Class<T> klass) {
path = findPathFromEnclosingNodeToTopLevel(path, klass);
return (path == null) ? null : klass.cast(path.getLeaf());
}
|
[
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"findEnclosingNode",
"(",
"TreePath",
"path",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"path",
"=",
"findPathFromEnclosingNodeToTopLevel",
"(",
"path",
",",
"klass",
")",
";",
"return",
"(",
"path",
"==",
"null",
")",
"?",
"null",
":",
"klass",
".",
"cast",
"(",
"path",
".",
"getLeaf",
"(",
")",
")",
";",
"}"
] |
Given a TreePath, walks up the tree until it finds a node of the given type. Returns null if no
such node is found.
|
[
"Given",
"a",
"TreePath",
"walks",
"up",
"the",
"tree",
"until",
"it",
"finds",
"a",
"node",
"of",
"the",
"given",
"type",
".",
"Returns",
"null",
"if",
"no",
"such",
"node",
"is",
"found",
"."
] |
train
|
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L353-L357
|
SonarSource/sonarqube
|
sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
|
DefaultI18n.messageFromFile
|
String messageFromFile(Locale locale, String filename, String relatedProperty) {
"""
Only the given locale is searched. Contrary to java.util.ResourceBundle, no strategy for locating the bundle is implemented in
this method.
"""
String result = null;
String bundleBase = propertyToBundles.get(relatedProperty);
if (bundleBase == null) {
// this property has no translation
return null;
}
String filePath = bundleBase.replace('.', '/');
if (!"en".equals(locale.getLanguage())) {
filePath += "_" + locale.getLanguage();
}
filePath += "/" + filename;
InputStream input = classloader.getResourceAsStream(filePath);
if (input != null) {
result = readInputStream(filePath, input);
}
return result;
}
|
java
|
String messageFromFile(Locale locale, String filename, String relatedProperty) {
String result = null;
String bundleBase = propertyToBundles.get(relatedProperty);
if (bundleBase == null) {
// this property has no translation
return null;
}
String filePath = bundleBase.replace('.', '/');
if (!"en".equals(locale.getLanguage())) {
filePath += "_" + locale.getLanguage();
}
filePath += "/" + filename;
InputStream input = classloader.getResourceAsStream(filePath);
if (input != null) {
result = readInputStream(filePath, input);
}
return result;
}
|
[
"String",
"messageFromFile",
"(",
"Locale",
"locale",
",",
"String",
"filename",
",",
"String",
"relatedProperty",
")",
"{",
"String",
"result",
"=",
"null",
";",
"String",
"bundleBase",
"=",
"propertyToBundles",
".",
"get",
"(",
"relatedProperty",
")",
";",
"if",
"(",
"bundleBase",
"==",
"null",
")",
"{",
"// this property has no translation",
"return",
"null",
";",
"}",
"String",
"filePath",
"=",
"bundleBase",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"if",
"(",
"!",
"\"en\"",
".",
"equals",
"(",
"locale",
".",
"getLanguage",
"(",
")",
")",
")",
"{",
"filePath",
"+=",
"\"_\"",
"+",
"locale",
".",
"getLanguage",
"(",
")",
";",
"}",
"filePath",
"+=",
"\"/\"",
"+",
"filename",
";",
"InputStream",
"input",
"=",
"classloader",
".",
"getResourceAsStream",
"(",
"filePath",
")",
";",
"if",
"(",
"input",
"!=",
"null",
")",
"{",
"result",
"=",
"readInputStream",
"(",
"filePath",
",",
"input",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Only the given locale is searched. Contrary to java.util.ResourceBundle, no strategy for locating the bundle is implemented in
this method.
|
[
"Only",
"the",
"given",
"locale",
"is",
"searched",
".",
"Contrary",
"to",
"java",
".",
"util",
".",
"ResourceBundle",
"no",
"strategy",
"for",
"locating",
"the",
"bundle",
"is",
"implemented",
"in",
"this",
"method",
"."
] |
train
|
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java#L193-L211
|
Ordinastie/MalisisCore
|
src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java
|
BlockDataHandler.registerBlockData
|
public static <T> void registerBlockData(String identifier, Function<ByteBuf, T> fromBytes, Function<T, ByteBuf> toBytes) {
"""
Registers a custom block data with the specified identifier.
@param <T> the generic type
@param identifier the identifier
@param fromBytes the from bytes
@param toBytes the to bytes
"""
instance.handlerInfos.put(identifier, new HandlerInfo<>(identifier, fromBytes, toBytes));
}
|
java
|
public static <T> void registerBlockData(String identifier, Function<ByteBuf, T> fromBytes, Function<T, ByteBuf> toBytes)
{
instance.handlerInfos.put(identifier, new HandlerInfo<>(identifier, fromBytes, toBytes));
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"registerBlockData",
"(",
"String",
"identifier",
",",
"Function",
"<",
"ByteBuf",
",",
"T",
">",
"fromBytes",
",",
"Function",
"<",
"T",
",",
"ByteBuf",
">",
"toBytes",
")",
"{",
"instance",
".",
"handlerInfos",
".",
"put",
"(",
"identifier",
",",
"new",
"HandlerInfo",
"<>",
"(",
"identifier",
",",
"fromBytes",
",",
"toBytes",
")",
")",
";",
"}"
] |
Registers a custom block data with the specified identifier.
@param <T> the generic type
@param identifier the identifier
@param fromBytes the from bytes
@param toBytes the to bytes
|
[
"Registers",
"a",
"custom",
"block",
"data",
"with",
"the",
"specified",
"identifier",
"."
] |
train
|
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java#L276-L279
|
casbin/jcasbin
|
src/main/java/org/casbin/jcasbin/util/Util.java
|
Util.arrayEquals
|
public static boolean arrayEquals(List<String> a, List<String> b) {
"""
arrayEquals determines whether two string arrays are identical.
@param a the first array.
@param b the second array.
@return whether a equals to b.
"""
if (a == null) {
a = new ArrayList<>();
}
if (b == null) {
b = new ArrayList<>();
}
if (a.size() != b.size()) {
return false;
}
for (int i = 0; i < a.size(); i ++) {
if (!a.get(i).equals(b.get(i))) {
return false;
}
}
return true;
}
|
java
|
public static boolean arrayEquals(List<String> a, List<String> b) {
if (a == null) {
a = new ArrayList<>();
}
if (b == null) {
b = new ArrayList<>();
}
if (a.size() != b.size()) {
return false;
}
for (int i = 0; i < a.size(); i ++) {
if (!a.get(i).equals(b.get(i))) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"arrayEquals",
"(",
"List",
"<",
"String",
">",
"a",
",",
"List",
"<",
"String",
">",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"a",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"b",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"if",
"(",
"a",
".",
"size",
"(",
")",
"!=",
"b",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"a",
".",
"get",
"(",
"i",
")",
".",
"equals",
"(",
"b",
".",
"get",
"(",
"i",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
arrayEquals determines whether two string arrays are identical.
@param a the first array.
@param b the second array.
@return whether a equals to b.
|
[
"arrayEquals",
"determines",
"whether",
"two",
"string",
"arrays",
"are",
"identical",
"."
] |
train
|
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/util/Util.java#L100-L117
|
khuxtable/seaglass
|
src/main/java/com/seaglasslookandfeel/painter/ContentPanePainter.java
|
ContentPanePainter.getRootPaneInteriorPaint
|
public Paint getRootPaneInteriorPaint(Shape s, Which type) {
"""
DOCUMENT ME!
@param s DOCUMENT ME!
@param type DOCUMENT ME!
@return DOCUMENT ME!
"""
return createVerticalGradient(s, getRootPaneInteriorColors(type));
}
|
java
|
public Paint getRootPaneInteriorPaint(Shape s, Which type) {
return createVerticalGradient(s, getRootPaneInteriorColors(type));
}
|
[
"public",
"Paint",
"getRootPaneInteriorPaint",
"(",
"Shape",
"s",
",",
"Which",
"type",
")",
"{",
"return",
"createVerticalGradient",
"(",
"s",
",",
"getRootPaneInteriorColors",
"(",
"type",
")",
")",
";",
"}"
] |
DOCUMENT ME!
@param s DOCUMENT ME!
@param type DOCUMENT ME!
@return DOCUMENT ME!
|
[
"DOCUMENT",
"ME!"
] |
train
|
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ContentPanePainter.java#L110-L112
|
weld/core
|
impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
|
ClientProxyProvider.getClientProxy
|
public <T> T getClientProxy(final Bean<T> bean, Type requestedType) {
"""
Gets a client proxy for a bean
<p/>
Looks for a proxy in the pool. If not found, one is created and added to
the pool if the create argument is true.
@param bean The bean to get a proxy to
@return the client proxy for the bean
"""
// let's first try to use the proxy that implements all the bean types
T proxy = beanTypeClosureProxyPool.getCastValue(bean);
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
/*
* the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable
* type is not in the type closure of the requested type
* https://issues.jboss.org/browse/WELD-1052
*/
proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean));
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
throw Proxies.getUnproxyableTypeException(requestedType, services());
}
}
BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean);
return proxy;
}
|
java
|
public <T> T getClientProxy(final Bean<T> bean, Type requestedType) {
// let's first try to use the proxy that implements all the bean types
T proxy = beanTypeClosureProxyPool.getCastValue(bean);
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
/*
* the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable
* type is not in the type closure of the requested type
* https://issues.jboss.org/browse/WELD-1052
*/
proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean));
if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
throw Proxies.getUnproxyableTypeException(requestedType, services());
}
}
BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean);
return proxy;
}
|
[
"public",
"<",
"T",
">",
"T",
"getClientProxy",
"(",
"final",
"Bean",
"<",
"T",
">",
"bean",
",",
"Type",
"requestedType",
")",
"{",
"// let's first try to use the proxy that implements all the bean types",
"T",
"proxy",
"=",
"beanTypeClosureProxyPool",
".",
"getCastValue",
"(",
"bean",
")",
";",
"if",
"(",
"proxy",
"==",
"BEAN_NOT_PROXYABLE_MARKER",
")",
"{",
"/*\n * the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable\n * type is not in the type closure of the requested type\n * https://issues.jboss.org/browse/WELD-1052\n */",
"proxy",
"=",
"requestedTypeClosureProxyPool",
".",
"getCastValue",
"(",
"new",
"RequestedTypeHolder",
"(",
"requestedType",
",",
"bean",
")",
")",
";",
"if",
"(",
"proxy",
"==",
"BEAN_NOT_PROXYABLE_MARKER",
")",
"{",
"throw",
"Proxies",
".",
"getUnproxyableTypeException",
"(",
"requestedType",
",",
"services",
"(",
")",
")",
";",
"}",
"}",
"BeanLogger",
".",
"LOG",
".",
"lookedUpClientProxy",
"(",
"proxy",
".",
"getClass",
"(",
")",
",",
"bean",
")",
";",
"return",
"proxy",
";",
"}"
] |
Gets a client proxy for a bean
<p/>
Looks for a proxy in the pool. If not found, one is created and added to
the pool if the create argument is true.
@param bean The bean to get a proxy to
@return the client proxy for the bean
|
[
"Gets",
"a",
"client",
"proxy",
"for",
"a",
"bean",
"<p",
"/",
">",
"Looks",
"for",
"a",
"proxy",
"in",
"the",
"pool",
".",
"If",
"not",
"found",
"one",
"is",
"created",
"and",
"added",
"to",
"the",
"pool",
"if",
"the",
"create",
"argument",
"is",
"true",
"."
] |
train
|
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java#L227-L243
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
|
ApiOvhIp.loadBalancing_serviceName_portsRedirection_srcPort_DELETE
|
public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_srcPort_DELETE(String serviceName, net.minidev.ovh.api.ip.OvhLoadBalancingAdditionalPortEnum srcPort) throws IOException {
"""
Delete a port redirection
REST: DELETE /ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}
@param serviceName [required] The internal name of your IP load balancing
@param srcPort [required] The port you want to redirect from
"""
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}";
StringBuilder sb = path(qPath, serviceName, srcPort);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhLoadBalancingTask.class);
}
|
java
|
public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_srcPort_DELETE(String serviceName, net.minidev.ovh.api.ip.OvhLoadBalancingAdditionalPortEnum srcPort) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}";
StringBuilder sb = path(qPath, serviceName, srcPort);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhLoadBalancingTask.class);
}
|
[
"public",
"OvhLoadBalancingTask",
"loadBalancing_serviceName_portsRedirection_srcPort_DELETE",
"(",
"String",
"serviceName",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"ip",
".",
"OvhLoadBalancingAdditionalPortEnum",
"srcPort",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"srcPort",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhLoadBalancingTask",
".",
"class",
")",
";",
"}"
] |
Delete a port redirection
REST: DELETE /ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}
@param serviceName [required] The internal name of your IP load balancing
@param srcPort [required] The port you want to redirect from
|
[
"Delete",
"a",
"port",
"redirection"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1513-L1518
|
clanie/clanie-core
|
src/main/java/dk/clanie/collections/NumberMap.java
|
NumberMap.newBigIntegerMap
|
public static <K> NumberMap<K, BigInteger> newBigIntegerMap() {
"""
Creates a NumberMap for BigIntegers.
@param <K>
@return NumberMap<K, BigInteger>
"""
return new NumberMap<K, BigInteger>() {
@Override
public void add(K key, BigInteger addend) {
put(key, containsKey(key) ? get(key).add(addend) : addend);
}
@Override
public void sub(K key, BigInteger subtrahend) {
put(key, (containsKey(key) ? get(key) : BigInteger.ZERO).subtract(subtrahend));
}
};
}
|
java
|
public static <K> NumberMap<K, BigInteger> newBigIntegerMap() {
return new NumberMap<K, BigInteger>() {
@Override
public void add(K key, BigInteger addend) {
put(key, containsKey(key) ? get(key).add(addend) : addend);
}
@Override
public void sub(K key, BigInteger subtrahend) {
put(key, (containsKey(key) ? get(key) : BigInteger.ZERO).subtract(subtrahend));
}
};
}
|
[
"public",
"static",
"<",
"K",
">",
"NumberMap",
"<",
"K",
",",
"BigInteger",
">",
"newBigIntegerMap",
"(",
")",
"{",
"return",
"new",
"NumberMap",
"<",
"K",
",",
"BigInteger",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"add",
"(",
"K",
"key",
",",
"BigInteger",
"addend",
")",
"{",
"put",
"(",
"key",
",",
"containsKey",
"(",
"key",
")",
"?",
"get",
"(",
"key",
")",
".",
"add",
"(",
"addend",
")",
":",
"addend",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"sub",
"(",
"K",
"key",
",",
"BigInteger",
"subtrahend",
")",
"{",
"put",
"(",
"key",
",",
"(",
"containsKey",
"(",
"key",
")",
"?",
"get",
"(",
"key",
")",
":",
"BigInteger",
".",
"ZERO",
")",
".",
"subtract",
"(",
"subtrahend",
")",
")",
";",
"}",
"}",
";",
"}"
] |
Creates a NumberMap for BigIntegers.
@param <K>
@return NumberMap<K, BigInteger>
|
[
"Creates",
"a",
"NumberMap",
"for",
"BigIntegers",
"."
] |
train
|
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/NumberMap.java#L92-L103
|
Azure/azure-sdk-for-java
|
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
|
DatabaseAccountsInner.failoverPriorityChangeAsync
|
public Observable<Void> failoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
"""
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
|
java
|
public Observable<Void> failoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"Void",
">",
"failoverPriorityChangeAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"List",
"<",
"FailoverPolicy",
">",
"failoverPolicies",
")",
"{",
"return",
"failoverPriorityChangeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"failoverPolicies",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
|
[
"Changes",
"the",
"failover",
"priority",
"for",
"the",
"Azure",
"Cosmos",
"DB",
"database",
"account",
".",
"A",
"failover",
"priority",
"of",
"0",
"indicates",
"a",
"write",
"region",
".",
"The",
"maximum",
"value",
"for",
"a",
"failover",
"priority",
"=",
"(",
"total",
"number",
"of",
"regions",
"-",
"1",
")",
".",
"Failover",
"priority",
"values",
"must",
"be",
"unique",
"for",
"each",
"of",
"the",
"regions",
"in",
"which",
"the",
"database",
"account",
"exists",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L796-L803
|
stevespringett/Alpine
|
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
|
AlpineQueryManager.createConfigProperty
|
public ConfigProperty createConfigProperty(final String groupName, final String propertyName,
final String propertyValue, final ConfigProperty.PropertyType propertyType,
final String description) {
"""
Creates a ConfigProperty object.
@param groupName the group name of the property
@param propertyName the name of the property
@param propertyValue the value of the property
@param propertyType the type of property
@param description a description of the property
@return a ConfigProperty object
@since 1.3.0
"""
pm.currentTransaction().begin();
final ConfigProperty configProperty = new ConfigProperty();
configProperty.setGroupName(groupName);
configProperty.setPropertyName(propertyName);
configProperty.setPropertyValue(propertyValue);
configProperty.setPropertyType(propertyType);
configProperty.setDescription(description);
pm.makePersistent(configProperty);
pm.currentTransaction().commit();
return getObjectById(ConfigProperty.class, configProperty.getId());
}
|
java
|
public ConfigProperty createConfigProperty(final String groupName, final String propertyName,
final String propertyValue, final ConfigProperty.PropertyType propertyType,
final String description) {
pm.currentTransaction().begin();
final ConfigProperty configProperty = new ConfigProperty();
configProperty.setGroupName(groupName);
configProperty.setPropertyName(propertyName);
configProperty.setPropertyValue(propertyValue);
configProperty.setPropertyType(propertyType);
configProperty.setDescription(description);
pm.makePersistent(configProperty);
pm.currentTransaction().commit();
return getObjectById(ConfigProperty.class, configProperty.getId());
}
|
[
"public",
"ConfigProperty",
"createConfigProperty",
"(",
"final",
"String",
"groupName",
",",
"final",
"String",
"propertyName",
",",
"final",
"String",
"propertyValue",
",",
"final",
"ConfigProperty",
".",
"PropertyType",
"propertyType",
",",
"final",
"String",
"description",
")",
"{",
"pm",
".",
"currentTransaction",
"(",
")",
".",
"begin",
"(",
")",
";",
"final",
"ConfigProperty",
"configProperty",
"=",
"new",
"ConfigProperty",
"(",
")",
";",
"configProperty",
".",
"setGroupName",
"(",
"groupName",
")",
";",
"configProperty",
".",
"setPropertyName",
"(",
"propertyName",
")",
";",
"configProperty",
".",
"setPropertyValue",
"(",
"propertyValue",
")",
";",
"configProperty",
".",
"setPropertyType",
"(",
"propertyType",
")",
";",
"configProperty",
".",
"setDescription",
"(",
"description",
")",
";",
"pm",
".",
"makePersistent",
"(",
"configProperty",
")",
";",
"pm",
".",
"currentTransaction",
"(",
")",
".",
"commit",
"(",
")",
";",
"return",
"getObjectById",
"(",
"ConfigProperty",
".",
"class",
",",
"configProperty",
".",
"getId",
"(",
")",
")",
";",
"}"
] |
Creates a ConfigProperty object.
@param groupName the group name of the property
@param propertyName the name of the property
@param propertyValue the value of the property
@param propertyType the type of property
@param description a description of the property
@return a ConfigProperty object
@since 1.3.0
|
[
"Creates",
"a",
"ConfigProperty",
"object",
"."
] |
train
|
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L754-L767
|
Deep-Symmetry/beat-link
|
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
|
MetadataFinder.queryMetadata
|
TrackMetadata queryMetadata(final DataReference track, final CdjStatus.TrackType trackType, final Client client)
throws IOException, InterruptedException, TimeoutException {
"""
Request metadata for a specific track ID, given a dbserver connection to a player that has already been set up.
Separated into its own method so it could be used multiple times with the same connection when gathering
all track metadata.
@param track uniquely identifies the track whose metadata is desired
@param trackType identifies the type of track being requested, which affects the type of metadata request
message that must be used
@param client the dbserver client that is communicating with the appropriate player
@return the retrieved metadata, or {@code null} if there is no such track
@throws IOException if there is a communication problem
@throws InterruptedException if the thread is interrupted while trying to lock the client for menu operations
@throws TimeoutException if we are unable to lock the client for menu operations
"""
// Send the metadata menu request
if (client.tryLockingForMenuOperations(20, TimeUnit.SECONDS)) {
try {
final Message.KnownType requestType = (trackType == CdjStatus.TrackType.REKORDBOX) ?
Message.KnownType.REKORDBOX_METADATA_REQ : Message.KnownType.UNANALYZED_METADATA_REQ;
final Message response = client.menuRequestTyped(requestType, Message.MenuIdentifier.MAIN_MENU,
track.slot, trackType, new NumberField(track.rekordboxId));
final long count = response.getMenuResultsCount();
if (count == Message.NO_MENU_RESULTS_AVAILABLE) {
return null;
}
// Gather the cue list and all the metadata menu items
final List<Message> items = client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, track.slot, trackType, response);
final CueList cueList = getCueList(track.rekordboxId, track.slot, client);
return new TrackMetadata(track, trackType, items, cueList);
} finally {
client.unlockForMenuOperations();
}
} else {
throw new TimeoutException("Unable to lock the player for menu operations");
}
}
|
java
|
TrackMetadata queryMetadata(final DataReference track, final CdjStatus.TrackType trackType, final Client client)
throws IOException, InterruptedException, TimeoutException {
// Send the metadata menu request
if (client.tryLockingForMenuOperations(20, TimeUnit.SECONDS)) {
try {
final Message.KnownType requestType = (trackType == CdjStatus.TrackType.REKORDBOX) ?
Message.KnownType.REKORDBOX_METADATA_REQ : Message.KnownType.UNANALYZED_METADATA_REQ;
final Message response = client.menuRequestTyped(requestType, Message.MenuIdentifier.MAIN_MENU,
track.slot, trackType, new NumberField(track.rekordboxId));
final long count = response.getMenuResultsCount();
if (count == Message.NO_MENU_RESULTS_AVAILABLE) {
return null;
}
// Gather the cue list and all the metadata menu items
final List<Message> items = client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, track.slot, trackType, response);
final CueList cueList = getCueList(track.rekordboxId, track.slot, client);
return new TrackMetadata(track, trackType, items, cueList);
} finally {
client.unlockForMenuOperations();
}
} else {
throw new TimeoutException("Unable to lock the player for menu operations");
}
}
|
[
"TrackMetadata",
"queryMetadata",
"(",
"final",
"DataReference",
"track",
",",
"final",
"CdjStatus",
".",
"TrackType",
"trackType",
",",
"final",
"Client",
"client",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"TimeoutException",
"{",
"// Send the metadata menu request",
"if",
"(",
"client",
".",
"tryLockingForMenuOperations",
"(",
"20",
",",
"TimeUnit",
".",
"SECONDS",
")",
")",
"{",
"try",
"{",
"final",
"Message",
".",
"KnownType",
"requestType",
"=",
"(",
"trackType",
"==",
"CdjStatus",
".",
"TrackType",
".",
"REKORDBOX",
")",
"?",
"Message",
".",
"KnownType",
".",
"REKORDBOX_METADATA_REQ",
":",
"Message",
".",
"KnownType",
".",
"UNANALYZED_METADATA_REQ",
";",
"final",
"Message",
"response",
"=",
"client",
".",
"menuRequestTyped",
"(",
"requestType",
",",
"Message",
".",
"MenuIdentifier",
".",
"MAIN_MENU",
",",
"track",
".",
"slot",
",",
"trackType",
",",
"new",
"NumberField",
"(",
"track",
".",
"rekordboxId",
")",
")",
";",
"final",
"long",
"count",
"=",
"response",
".",
"getMenuResultsCount",
"(",
")",
";",
"if",
"(",
"count",
"==",
"Message",
".",
"NO_MENU_RESULTS_AVAILABLE",
")",
"{",
"return",
"null",
";",
"}",
"// Gather the cue list and all the metadata menu items",
"final",
"List",
"<",
"Message",
">",
"items",
"=",
"client",
".",
"renderMenuItems",
"(",
"Message",
".",
"MenuIdentifier",
".",
"MAIN_MENU",
",",
"track",
".",
"slot",
",",
"trackType",
",",
"response",
")",
";",
"final",
"CueList",
"cueList",
"=",
"getCueList",
"(",
"track",
".",
"rekordboxId",
",",
"track",
".",
"slot",
",",
"client",
")",
";",
"return",
"new",
"TrackMetadata",
"(",
"track",
",",
"trackType",
",",
"items",
",",
"cueList",
")",
";",
"}",
"finally",
"{",
"client",
".",
"unlockForMenuOperations",
"(",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"TimeoutException",
"(",
"\"Unable to lock the player for menu operations\"",
")",
";",
"}",
"}"
] |
Request metadata for a specific track ID, given a dbserver connection to a player that has already been set up.
Separated into its own method so it could be used multiple times with the same connection when gathering
all track metadata.
@param track uniquely identifies the track whose metadata is desired
@param trackType identifies the type of track being requested, which affects the type of metadata request
message that must be used
@param client the dbserver client that is communicating with the appropriate player
@return the retrieved metadata, or {@code null} if there is no such track
@throws IOException if there is a communication problem
@throws InterruptedException if the thread is interrupted while trying to lock the client for menu operations
@throws TimeoutException if we are unable to lock the client for menu operations
|
[
"Request",
"metadata",
"for",
"a",
"specific",
"track",
"ID",
"given",
"a",
"dbserver",
"connection",
"to",
"a",
"player",
"that",
"has",
"already",
"been",
"set",
"up",
".",
"Separated",
"into",
"its",
"own",
"method",
"so",
"it",
"could",
"be",
"used",
"multiple",
"times",
"with",
"the",
"same",
"connection",
"when",
"gathering",
"all",
"track",
"metadata",
"."
] |
train
|
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L150-L175
|
liferay/com-liferay-commerce
|
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java
|
CommerceDiscountPersistenceImpl.findByG_C
|
@Override
public List<CommerceDiscount> findByG_C(long groupId, String couponCode,
int start, int end) {
"""
Returns a range of all the commerce discounts where groupId = ? and couponCode = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param couponCode the coupon code
@param start the lower bound of the range of commerce discounts
@param end the upper bound of the range of commerce discounts (not inclusive)
@return the range of matching commerce discounts
"""
return findByG_C(groupId, couponCode, start, end, null);
}
|
java
|
@Override
public List<CommerceDiscount> findByG_C(long groupId, String couponCode,
int start, int end) {
return findByG_C(groupId, couponCode, start, end, null);
}
|
[
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscount",
">",
"findByG_C",
"(",
"long",
"groupId",
",",
"String",
"couponCode",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_C",
"(",
"groupId",
",",
"couponCode",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] |
Returns a range of all the commerce discounts where groupId = ? and couponCode = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param couponCode the coupon code
@param start the lower bound of the range of commerce discounts
@param end the upper bound of the range of commerce discounts (not inclusive)
@return the range of matching commerce discounts
|
[
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discounts",
"where",
"groupId",
"=",
"?",
";",
"and",
"couponCode",
"=",
"?",
";",
"."
] |
train
|
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L2405-L2409
|
NessComputing/syslog4j
|
src/main/java/com/nesscomputing/syslog4j/util/Base64.java
|
Base64.encodeObject
|
public static String encodeObject( java.io.Serializable serializableObject, int options ) {
"""
Serializes an object and returns the Base64-encoded
version of that serialized object. If the object
cannot be serialized or there is another error,
the method will return <tt>null</tt>.
<p>
Valid options:<pre>
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p>
Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
<p>
Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
@param serializableObject The object to encode
@param options Specified options
@return The Base64-encoded object
@see Base64#GZIP
@see Base64#DONT_BREAK_LINES
@since 2.0
"""
// Streams
java.io.ByteArrayOutputStream baos = null;
java.io.OutputStream b64os = null;
java.io.ObjectOutputStream oos = null;
java.util.zip.GZIPOutputStream gzos = null;
// Isolate options
int gzip = (options & GZIP);
try
{
// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | options );
// GZip?
if( gzip == GZIP )
{
gzos = new java.util.zip.GZIPOutputStream( b64os );
oos = new java.io.ObjectOutputStream( gzos );
} // end if: gzip
else
oos = new java.io.ObjectOutputStream( b64os );
oos.writeObject( serializableObject );
} // end try
catch( java.io.IOException e )
{
LOG.warn("While decoding:", e);
return null;
} // end catch
finally
{
Closeables.closeQuietly(oos);
Closeables.closeQuietly(gzos);
Closeables.closeQuietly(b64os);
Closeables.closeQuietly(baos);
} // end finally
// Return value according to relevant encoding.
return new String( baos.toByteArray(), Charsets.UTF_8 );
}
|
java
|
public static String encodeObject( java.io.Serializable serializableObject, int options )
{
// Streams
java.io.ByteArrayOutputStream baos = null;
java.io.OutputStream b64os = null;
java.io.ObjectOutputStream oos = null;
java.util.zip.GZIPOutputStream gzos = null;
// Isolate options
int gzip = (options & GZIP);
try
{
// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | options );
// GZip?
if( gzip == GZIP )
{
gzos = new java.util.zip.GZIPOutputStream( b64os );
oos = new java.io.ObjectOutputStream( gzos );
} // end if: gzip
else
oos = new java.io.ObjectOutputStream( b64os );
oos.writeObject( serializableObject );
} // end try
catch( java.io.IOException e )
{
LOG.warn("While decoding:", e);
return null;
} // end catch
finally
{
Closeables.closeQuietly(oos);
Closeables.closeQuietly(gzos);
Closeables.closeQuietly(b64os);
Closeables.closeQuietly(baos);
} // end finally
// Return value according to relevant encoding.
return new String( baos.toByteArray(), Charsets.UTF_8 );
}
|
[
"public",
"static",
"String",
"encodeObject",
"(",
"java",
".",
"io",
".",
"Serializable",
"serializableObject",
",",
"int",
"options",
")",
"{",
"// Streams\r",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
"baos",
"=",
"null",
";",
"java",
".",
"io",
".",
"OutputStream",
"b64os",
"=",
"null",
";",
"java",
".",
"io",
".",
"ObjectOutputStream",
"oos",
"=",
"null",
";",
"java",
".",
"util",
".",
"zip",
".",
"GZIPOutputStream",
"gzos",
"=",
"null",
";",
"// Isolate options\r",
"int",
"gzip",
"=",
"(",
"options",
"&",
"GZIP",
")",
";",
"try",
"{",
"// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream\r",
"baos",
"=",
"new",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
"(",
")",
";",
"b64os",
"=",
"new",
"Base64",
".",
"OutputStream",
"(",
"baos",
",",
"ENCODE",
"|",
"options",
")",
";",
"// GZip?\r",
"if",
"(",
"gzip",
"==",
"GZIP",
")",
"{",
"gzos",
"=",
"new",
"java",
".",
"util",
".",
"zip",
".",
"GZIPOutputStream",
"(",
"b64os",
")",
";",
"oos",
"=",
"new",
"java",
".",
"io",
".",
"ObjectOutputStream",
"(",
"gzos",
")",
";",
"}",
"// end if: gzip\r",
"else",
"oos",
"=",
"new",
"java",
".",
"io",
".",
"ObjectOutputStream",
"(",
"b64os",
")",
";",
"oos",
".",
"writeObject",
"(",
"serializableObject",
")",
";",
"}",
"// end try\r",
"catch",
"(",
"java",
".",
"io",
".",
"IOException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"While decoding:\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"// end catch\r",
"finally",
"{",
"Closeables",
".",
"closeQuietly",
"(",
"oos",
")",
";",
"Closeables",
".",
"closeQuietly",
"(",
"gzos",
")",
";",
"Closeables",
".",
"closeQuietly",
"(",
"b64os",
")",
";",
"Closeables",
".",
"closeQuietly",
"(",
"baos",
")",
";",
"}",
"// end finally\r",
"// Return value according to relevant encoding.\r",
"return",
"new",
"String",
"(",
"baos",
".",
"toByteArray",
"(",
")",
",",
"Charsets",
".",
"UTF_8",
")",
";",
"}"
] |
Serializes an object and returns the Base64-encoded
version of that serialized object. If the object
cannot be serialized or there is another error,
the method will return <tt>null</tt>.
<p>
Valid options:<pre>
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p>
Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
<p>
Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
@param serializableObject The object to encode
@param options Specified options
@return The Base64-encoded object
@see Base64#GZIP
@see Base64#DONT_BREAK_LINES
@since 2.0
|
[
"Serializes",
"an",
"object",
"and",
"returns",
"the",
"Base64",
"-",
"encoded",
"version",
"of",
"that",
"serialized",
"object",
".",
"If",
"the",
"object",
"cannot",
"be",
"serialized",
"or",
"there",
"is",
"another",
"error",
"the",
"method",
"will",
"return",
"<tt",
">",
"null<",
"/",
"tt",
">",
".",
"<p",
">",
"Valid",
"options",
":",
"<pre",
">",
"GZIP",
":",
"gzip",
"-",
"compresses",
"object",
"before",
"encoding",
"it",
".",
"DONT_BREAK_LINES",
":",
"don",
"t",
"break",
"lines",
"at",
"76",
"characters",
"<i",
">",
"Note",
":",
"Technically",
"this",
"makes",
"your",
"encoding",
"non",
"-",
"compliant",
".",
"<",
"/",
"i",
">",
"<",
"/",
"pre",
">",
"<p",
">",
"Example",
":",
"<code",
">",
"encodeObject",
"(",
"myObj",
"Base64",
".",
"GZIP",
")",
"<",
"/",
"code",
">",
"or",
"<p",
">",
"Example",
":",
"<code",
">",
"encodeObject",
"(",
"myObj",
"Base64",
".",
"GZIP",
"|",
"Base64",
".",
"DONT_BREAK_LINES",
")",
"<",
"/",
"code",
">"
] |
train
|
https://github.com/NessComputing/syslog4j/blob/698fe4ce926cfc46524329d089052507cdb8cba4/src/main/java/com/nesscomputing/syslog4j/util/Base64.java#L540-L583
|
GoodforGod/dummymaker
|
src/main/java/io/dummymaker/util/BasicCastUtils.java
|
BasicCastUtils.generateObject
|
@SuppressWarnings("unchecked")
public static <T> T generateObject(final IGenerator generator,
final Class<T> fieldType) {
"""
Try to generate and cast object to field type or string if possible
@param generator generator
@param fieldType actual field type
@return generated and casted object
"""
if(generator == null)
return null;
final Object object = generator.generate();
return castObject(object, fieldType);
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T generateObject(final IGenerator generator,
final Class<T> fieldType) {
if(generator == null)
return null;
final Object object = generator.generate();
return castObject(object, fieldType);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"generateObject",
"(",
"final",
"IGenerator",
"generator",
",",
"final",
"Class",
"<",
"T",
">",
"fieldType",
")",
"{",
"if",
"(",
"generator",
"==",
"null",
")",
"return",
"null",
";",
"final",
"Object",
"object",
"=",
"generator",
".",
"generate",
"(",
")",
";",
"return",
"castObject",
"(",
"object",
",",
"fieldType",
")",
";",
"}"
] |
Try to generate and cast object to field type or string if possible
@param generator generator
@param fieldType actual field type
@return generated and casted object
|
[
"Try",
"to",
"generate",
"and",
"cast",
"object",
"to",
"field",
"type",
"or",
"string",
"if",
"possible"
] |
train
|
https://github.com/GoodforGod/dummymaker/blob/a4809c0a8139ab9cdb42814a3e37772717a313b4/src/main/java/io/dummymaker/util/BasicCastUtils.java#L97-L105
|
ReactiveX/RxJavaAsyncUtil
|
src/main/java/rx/util/async/Async.java
|
Async.toAsyncThrowing
|
public static <T1, T2, T3, R> Func3<T1, T2, T3, Observable<R>> toAsyncThrowing(final ThrowingFunc3<? super T1, ? super T2, ? super T3, ? extends R> func, final Scheduler scheduler) {
"""
Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229287.aspx">MSDN: Observable.ToAsync</a>
"""
return new Func3<T1, T2, T3, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3), scheduler);
}
};
}
|
java
|
public static <T1, T2, T3, R> Func3<T1, T2, T3, Observable<R>> toAsyncThrowing(final ThrowingFunc3<? super T1, ? super T2, ? super T3, ? extends R> func, final Scheduler scheduler) {
return new Func3<T1, T2, T3, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3), scheduler);
}
};
}
|
[
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"Func3",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"final",
"ThrowingFunc3",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
"T2",
",",
"?",
"super",
"T3",
",",
"?",
"extends",
"R",
">",
"func",
",",
"final",
"Scheduler",
"scheduler",
")",
"{",
"return",
"new",
"Func3",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"Observable",
"<",
"R",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"R",
">",
"call",
"(",
"T1",
"t1",
",",
"T2",
"t2",
",",
"T3",
"t3",
")",
"{",
"return",
"startCallable",
"(",
"ThrowingFunctions",
".",
"toCallable",
"(",
"func",
",",
"t1",
",",
"t2",
",",
"t3",
")",
",",
"scheduler",
")",
";",
"}",
"}",
";",
"}"
] |
Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229287.aspx">MSDN: Observable.ToAsync</a>
|
[
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"toAsync",
".",
"s",
".",
"png",
"alt",
"=",
">"
] |
train
|
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1043-L1050
|
exoplatform/jcr
|
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java
|
NullResourceLocksHolder.addLock
|
public String addLock(Session session, String path) throws LockException {
"""
Locks the node.
@param session current session
@param path node path
@return thee lock token key
@throws LockException {@link LockException}
"""
String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;
if (!nullResourceLocks.containsKey(repoPath))
{
String newLockToken = IdGenerator.generate();
session.addLockToken(newLockToken);
nullResourceLocks.put(repoPath, newLockToken);
return newLockToken;
}
// check if lock owned by this session
String currentToken = nullResourceLocks.get(repoPath);
for (String t : session.getLockTokens())
{
if (t.equals(currentToken))
return t;
}
throw new LockException("Resource already locked " + repoPath);
}
|
java
|
public String addLock(Session session, String path) throws LockException
{
String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;
if (!nullResourceLocks.containsKey(repoPath))
{
String newLockToken = IdGenerator.generate();
session.addLockToken(newLockToken);
nullResourceLocks.put(repoPath, newLockToken);
return newLockToken;
}
// check if lock owned by this session
String currentToken = nullResourceLocks.get(repoPath);
for (String t : session.getLockTokens())
{
if (t.equals(currentToken))
return t;
}
throw new LockException("Resource already locked " + repoPath);
}
|
[
"public",
"String",
"addLock",
"(",
"Session",
"session",
",",
"String",
"path",
")",
"throws",
"LockException",
"{",
"String",
"repoPath",
"=",
"session",
".",
"getRepository",
"(",
")",
".",
"hashCode",
"(",
")",
"+",
"\"/\"",
"+",
"session",
".",
"getWorkspace",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"/\"",
"+",
"path",
";",
"if",
"(",
"!",
"nullResourceLocks",
".",
"containsKey",
"(",
"repoPath",
")",
")",
"{",
"String",
"newLockToken",
"=",
"IdGenerator",
".",
"generate",
"(",
")",
";",
"session",
".",
"addLockToken",
"(",
"newLockToken",
")",
";",
"nullResourceLocks",
".",
"put",
"(",
"repoPath",
",",
"newLockToken",
")",
";",
"return",
"newLockToken",
";",
"}",
"// check if lock owned by this session\r",
"String",
"currentToken",
"=",
"nullResourceLocks",
".",
"get",
"(",
"repoPath",
")",
";",
"for",
"(",
"String",
"t",
":",
"session",
".",
"getLockTokens",
"(",
")",
")",
"{",
"if",
"(",
"t",
".",
"equals",
"(",
"currentToken",
")",
")",
"return",
"t",
";",
"}",
"throw",
"new",
"LockException",
"(",
"\"Resource already locked \"",
"+",
"repoPath",
")",
";",
"}"
] |
Locks the node.
@param session current session
@param path node path
@return thee lock token key
@throws LockException {@link LockException}
|
[
"Locks",
"the",
"node",
"."
] |
train
|
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lock/NullResourceLocksHolder.java#L60-L81
|
agmip/acmo
|
src/main/java/org/agmip/acmo/util/AcmoUtil.java
|
AcmoUtil.createCsvFile
|
public static File createCsvFile(String outputCsvPath, String mode) {
"""
Generate an ACMO CSV file object with a non-repeated file name in the
given directory. The naming rule is as follow,
ACMO-[Region]-[stratum]-[climate_id]-[RAP_id]-[Management_id]-[model].csv
@param outputCsvPath The output path for CSV file
@param mode The name of model which provide the model output data
@return The {@code File} for CSV file
"""
return createCsvFile(outputCsvPath, mode, null);
}
|
java
|
public static File createCsvFile(String outputCsvPath, String mode) {
return createCsvFile(outputCsvPath, mode, null);
}
|
[
"public",
"static",
"File",
"createCsvFile",
"(",
"String",
"outputCsvPath",
",",
"String",
"mode",
")",
"{",
"return",
"createCsvFile",
"(",
"outputCsvPath",
",",
"mode",
",",
"null",
")",
";",
"}"
] |
Generate an ACMO CSV file object with a non-repeated file name in the
given directory. The naming rule is as follow,
ACMO-[Region]-[stratum]-[climate_id]-[RAP_id]-[Management_id]-[model].csv
@param outputCsvPath The output path for CSV file
@param mode The name of model which provide the model output data
@return The {@code File} for CSV file
|
[
"Generate",
"an",
"ACMO",
"CSV",
"file",
"object",
"with",
"a",
"non",
"-",
"repeated",
"file",
"name",
"in",
"the",
"given",
"directory",
".",
"The",
"naming",
"rule",
"is",
"as",
"follow",
"ACMO",
"-",
"[",
"Region",
"]",
"-",
"[",
"stratum",
"]",
"-",
"[",
"climate_id",
"]",
"-",
"[",
"RAP_id",
"]",
"-",
"[",
"Management_id",
"]",
"-",
"[",
"model",
"]",
".",
"csv"
] |
train
|
https://github.com/agmip/acmo/blob/cf609b272ed7344abd2e2bef3d0060d2afa81cb0/src/main/java/org/agmip/acmo/util/AcmoUtil.java#L503-L505
|
nyla-solutions/nyla
|
nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java
|
JavaBean.newBean
|
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass)
throws InstantiationException, IllegalAccessException {
"""
Create new instance of the object
@param aValues the map value
@param aClass the class to create
@param <T> the type of the bean
@return the create object instance
@throws InstantiationException
@throws IllegalAccessException
"""
return newBean(aValues,aClass,null);
}
|
java
|
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass)
throws InstantiationException, IllegalAccessException
{
return newBean(aValues,aClass,null);
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"newBean",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"aValues",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"return",
"newBean",
"(",
"aValues",
",",
"aClass",
",",
"null",
")",
";",
"}"
] |
Create new instance of the object
@param aValues the map value
@param aClass the class to create
@param <T> the type of the bean
@return the create object instance
@throws InstantiationException
@throws IllegalAccessException
|
[
"Create",
"new",
"instance",
"of",
"the",
"object"
] |
train
|
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java#L50-L54
|
joelittlejohn/jsonschema2pojo
|
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PrimitiveTypes.java
|
PrimitiveTypes.primitiveType
|
public static JPrimitiveType primitiveType(String name, JCodeModel owner) {
"""
Create a primitive type reference (for code generation) using the given
primitive type name.
@param name
the name of a primitive Java type
@param owner
the current code model for type generation
@return a type reference created by the given owner
"""
try {
return (JPrimitiveType) owner.parseType(name);
} catch (ClassNotFoundException e) {
throw new GenerationException(
"Given name does not refer to a primitive type, this type can't be found: "
+ name, e);
}
}
|
java
|
public static JPrimitiveType primitiveType(String name, JCodeModel owner) {
try {
return (JPrimitiveType) owner.parseType(name);
} catch (ClassNotFoundException e) {
throw new GenerationException(
"Given name does not refer to a primitive type, this type can't be found: "
+ name, e);
}
}
|
[
"public",
"static",
"JPrimitiveType",
"primitiveType",
"(",
"String",
"name",
",",
"JCodeModel",
"owner",
")",
"{",
"try",
"{",
"return",
"(",
"JPrimitiveType",
")",
"owner",
".",
"parseType",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"GenerationException",
"(",
"\"Given name does not refer to a primitive type, this type can't be found: \"",
"+",
"name",
",",
"e",
")",
";",
"}",
"}"
] |
Create a primitive type reference (for code generation) using the given
primitive type name.
@param name
the name of a primitive Java type
@param owner
the current code model for type generation
@return a type reference created by the given owner
|
[
"Create",
"a",
"primitive",
"type",
"reference",
"(",
"for",
"code",
"generation",
")",
"using",
"the",
"given",
"primitive",
"type",
"name",
"."
] |
train
|
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PrimitiveTypes.java#L61-L69
|
liferay/com-liferay-commerce
|
commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java
|
CPInstanceLocalServiceBaseImpl.getCPInstanceByUuidAndGroupId
|
@Override
public CPInstance getCPInstanceByUuidAndGroupId(String uuid, long groupId)
throws PortalException {
"""
Returns the cp instance matching the UUID and group.
@param uuid the cp instance's UUID
@param groupId the primary key of the group
@return the matching cp instance
@throws PortalException if a matching cp instance could not be found
"""
return cpInstancePersistence.findByUUID_G(uuid, groupId);
}
|
java
|
@Override
public CPInstance getCPInstanceByUuidAndGroupId(String uuid, long groupId)
throws PortalException {
return cpInstancePersistence.findByUUID_G(uuid, groupId);
}
|
[
"@",
"Override",
"public",
"CPInstance",
"getCPInstanceByUuidAndGroupId",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"PortalException",
"{",
"return",
"cpInstancePersistence",
".",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"}"
] |
Returns the cp instance matching the UUID and group.
@param uuid the cp instance's UUID
@param groupId the primary key of the group
@return the matching cp instance
@throws PortalException if a matching cp instance could not be found
|
[
"Returns",
"the",
"cp",
"instance",
"matching",
"the",
"UUID",
"and",
"group",
"."
] |
train
|
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java#L488-L492
|
kiswanij/jk-util
|
src/main/java/com/jk/util/UserPreferences.java
|
UserPreferences.getInt
|
public static int getInt(final String key, final int def) {
"""
Gets the int.
@param key the key
@param def the def
@return the int
@see java.util.prefs.Preferences#getInt(java.lang.String, int)
"""
try {
return systemRoot.getInt(fixKey(key), def);
} catch (final Exception e) {
// just eat the exception to avoid any system crash on system issues
return def;
}
}
|
java
|
public static int getInt(final String key, final int def) {
try {
return systemRoot.getInt(fixKey(key), def);
} catch (final Exception e) {
// just eat the exception to avoid any system crash on system issues
return def;
}
}
|
[
"public",
"static",
"int",
"getInt",
"(",
"final",
"String",
"key",
",",
"final",
"int",
"def",
")",
"{",
"try",
"{",
"return",
"systemRoot",
".",
"getInt",
"(",
"fixKey",
"(",
"key",
")",
",",
"def",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"// just eat the exception to avoid any system crash on system issues",
"return",
"def",
";",
"}",
"}"
] |
Gets the int.
@param key the key
@param def the def
@return the int
@see java.util.prefs.Preferences#getInt(java.lang.String, int)
|
[
"Gets",
"the",
"int",
"."
] |
train
|
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/UserPreferences.java#L153-L160
|
lessthanoptimal/ejml
|
main/ejml-simple/src/org/ejml/simple/SimpleBase.java
|
SimpleBase.extractMatrix
|
public T extractMatrix(int y0 , int y1, int x0 , int x1 ) {
"""
<p>
Creates a new SimpleMatrix which is a submatrix of this matrix.
</p>
<p>
s<sub>i-y0 , j-x0</sub> = o<sub>ij</sub> for all y0 ≤ i < y1 and x0 ≤ j < x1<br>
<br>
where 's<sub>ij</sub>' is an element in the submatrix and 'o<sub>ij</sub>' is an element in the
original matrix.
</p>
<p>
If any of the inputs are set to SimpleMatrix.END then it will be set to the last row
or column in the matrix.
</p>
@param y0 Start row.
@param y1 Stop row + 1.
@param x0 Start column.
@param x1 Stop column + 1.
@return The submatrix.
"""
if( y0 == SimpleMatrix.END ) y0 = mat.getNumRows();
if( y1 == SimpleMatrix.END ) y1 = mat.getNumRows();
if( x0 == SimpleMatrix.END ) x0 = mat.getNumCols();
if( x1 == SimpleMatrix.END ) x1 = mat.getNumCols();
T ret = createMatrix(y1-y0,x1-x0, mat.getType());
ops.extract(mat, y0, y1, x0, x1, ret.mat, 0, 0);
return ret;
}
|
java
|
public T extractMatrix(int y0 , int y1, int x0 , int x1 ) {
if( y0 == SimpleMatrix.END ) y0 = mat.getNumRows();
if( y1 == SimpleMatrix.END ) y1 = mat.getNumRows();
if( x0 == SimpleMatrix.END ) x0 = mat.getNumCols();
if( x1 == SimpleMatrix.END ) x1 = mat.getNumCols();
T ret = createMatrix(y1-y0,x1-x0, mat.getType());
ops.extract(mat, y0, y1, x0, x1, ret.mat, 0, 0);
return ret;
}
|
[
"public",
"T",
"extractMatrix",
"(",
"int",
"y0",
",",
"int",
"y1",
",",
"int",
"x0",
",",
"int",
"x1",
")",
"{",
"if",
"(",
"y0",
"==",
"SimpleMatrix",
".",
"END",
")",
"y0",
"=",
"mat",
".",
"getNumRows",
"(",
")",
";",
"if",
"(",
"y1",
"==",
"SimpleMatrix",
".",
"END",
")",
"y1",
"=",
"mat",
".",
"getNumRows",
"(",
")",
";",
"if",
"(",
"x0",
"==",
"SimpleMatrix",
".",
"END",
")",
"x0",
"=",
"mat",
".",
"getNumCols",
"(",
")",
";",
"if",
"(",
"x1",
"==",
"SimpleMatrix",
".",
"END",
")",
"x1",
"=",
"mat",
".",
"getNumCols",
"(",
")",
";",
"T",
"ret",
"=",
"createMatrix",
"(",
"y1",
"-",
"y0",
",",
"x1",
"-",
"x0",
",",
"mat",
".",
"getType",
"(",
")",
")",
";",
"ops",
".",
"extract",
"(",
"mat",
",",
"y0",
",",
"y1",
",",
"x0",
",",
"x1",
",",
"ret",
".",
"mat",
",",
"0",
",",
"0",
")",
";",
"return",
"ret",
";",
"}"
] |
<p>
Creates a new SimpleMatrix which is a submatrix of this matrix.
</p>
<p>
s<sub>i-y0 , j-x0</sub> = o<sub>ij</sub> for all y0 ≤ i < y1 and x0 ≤ j < x1<br>
<br>
where 's<sub>ij</sub>' is an element in the submatrix and 'o<sub>ij</sub>' is an element in the
original matrix.
</p>
<p>
If any of the inputs are set to SimpleMatrix.END then it will be set to the last row
or column in the matrix.
</p>
@param y0 Start row.
@param y1 Stop row + 1.
@param x0 Start column.
@param x1 Stop column + 1.
@return The submatrix.
|
[
"<p",
">",
"Creates",
"a",
"new",
"SimpleMatrix",
"which",
"is",
"a",
"submatrix",
"of",
"this",
"matrix",
".",
"<",
"/",
"p",
">",
"<p",
">",
"s<sub",
">",
"i",
"-",
"y0",
"j",
"-",
"x0<",
"/",
"sub",
">",
"=",
"o<sub",
">",
"ij<",
"/",
"sub",
">",
"for",
"all",
"y0",
"&le",
";",
"i",
"<",
";",
"y1",
"and",
"x0",
"&le",
";",
"j",
"<",
";",
"x1<br",
">",
"<br",
">",
"where",
"s<sub",
">",
"ij<",
"/",
"sub",
">",
"is",
"an",
"element",
"in",
"the",
"submatrix",
"and",
"o<sub",
">",
"ij<",
"/",
"sub",
">",
"is",
"an",
"element",
"in",
"the",
"original",
"matrix",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L851-L862
|
amzn/ion-java
|
src/com/amazon/ion/Timestamp.java
|
Timestamp.forSecond
|
public static Timestamp forSecond(int year, int month, int day,
int hour, int minute, int second,
Integer offset) {
"""
Returns a Timestamp, precise to the second, with a given local offset.
<p>
This is equivalent to the corresponding Ion value
{@code YYYY-MM-DDThh:mm:ss+-oo:oo}, where {@code oo:oo} represents the
hour and minutes of the local offset from UTC.
@param offset
the local offset from UTC, measured in minutes;
may be {@code null} to represent an unknown local offset
"""
return new Timestamp(year, month, day, hour, minute, second, offset);
}
|
java
|
public static Timestamp forSecond(int year, int month, int day,
int hour, int minute, int second,
Integer offset)
{
return new Timestamp(year, month, day, hour, minute, second, offset);
}
|
[
"public",
"static",
"Timestamp",
"forSecond",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
",",
"Integer",
"offset",
")",
"{",
"return",
"new",
"Timestamp",
"(",
"year",
",",
"month",
",",
"day",
",",
"hour",
",",
"minute",
",",
"second",
",",
"offset",
")",
";",
"}"
] |
Returns a Timestamp, precise to the second, with a given local offset.
<p>
This is equivalent to the corresponding Ion value
{@code YYYY-MM-DDThh:mm:ss+-oo:oo}, where {@code oo:oo} represents the
hour and minutes of the local offset from UTC.
@param offset
the local offset from UTC, measured in minutes;
may be {@code null} to represent an unknown local offset
|
[
"Returns",
"a",
"Timestamp",
"precise",
"to",
"the",
"second",
"with",
"a",
"given",
"local",
"offset",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
"the",
"corresponding",
"Ion",
"value",
"{",
"@code",
"YYYY",
"-",
"MM",
"-",
"DDThh",
":",
"mm",
":",
"ss",
"+",
"-",
"oo",
":",
"oo",
"}",
"where",
"{",
"@code",
"oo",
":",
"oo",
"}",
"represents",
"the",
"hour",
"and",
"minutes",
"of",
"the",
"local",
"offset",
"from",
"UTC",
"."
] |
train
|
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L1289-L1294
|
qiujuer/Genius-Android
|
caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java
|
Blur.onStackBlurPixels
|
public static int[] onStackBlurPixels(int[] pix, int w, int h, int radius) {
"""
StackBlur By Jni Pixels
@param pix Original Image, you can call:
<p>
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int[] pix = new int[w * h];
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
<p>
// Jni Pixels Blur
onStackBlurPixels(pix, w, h, radius);
<p>
bitmap.setPixels(pix, 0, w, 0, 0, w, h);
<p>
@param radius Blur radius
@return Image Bitmap
"""
if (radius < 0 || radius > 256) {
throw new RuntimeException("Blur bitmap radius must >= 1 and <=256.");
}
if (pix == null) {
throw new RuntimeException("Blur bitmap pix isn't null.");
}
if (pix.length < w * h) {
throw new RuntimeException("Blur bitmap pix length must >= w * h.");
}
// Jni Pixels Blur
nativeStackBlurPixels(pix, w, h, radius);
return (pix);
}
|
java
|
public static int[] onStackBlurPixels(int[] pix, int w, int h, int radius) {
if (radius < 0 || radius > 256) {
throw new RuntimeException("Blur bitmap radius must >= 1 and <=256.");
}
if (pix == null) {
throw new RuntimeException("Blur bitmap pix isn't null.");
}
if (pix.length < w * h) {
throw new RuntimeException("Blur bitmap pix length must >= w * h.");
}
// Jni Pixels Blur
nativeStackBlurPixels(pix, w, h, radius);
return (pix);
}
|
[
"public",
"static",
"int",
"[",
"]",
"onStackBlurPixels",
"(",
"int",
"[",
"]",
"pix",
",",
"int",
"w",
",",
"int",
"h",
",",
"int",
"radius",
")",
"{",
"if",
"(",
"radius",
"<",
"0",
"||",
"radius",
">",
"256",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Blur bitmap radius must >= 1 and <=256.\"",
")",
";",
"}",
"if",
"(",
"pix",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Blur bitmap pix isn't null.\"",
")",
";",
"}",
"if",
"(",
"pix",
".",
"length",
"<",
"w",
"*",
"h",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Blur bitmap pix length must >= w * h.\"",
")",
";",
"}",
"// Jni Pixels Blur",
"nativeStackBlurPixels",
"(",
"pix",
",",
"w",
",",
"h",
",",
"radius",
")",
";",
"return",
"(",
"pix",
")",
";",
"}"
] |
StackBlur By Jni Pixels
@param pix Original Image, you can call:
<p>
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int[] pix = new int[w * h];
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
<p>
// Jni Pixels Blur
onStackBlurPixels(pix, w, h, radius);
<p>
bitmap.setPixels(pix, 0, w, 0, 0, w, h);
<p>
@param radius Blur radius
@return Image Bitmap
|
[
"StackBlur",
"By",
"Jni",
"Pixels"
] |
train
|
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java#L150-L167
|
iobeam/iobeam-client-java
|
src/main/java/com/iobeam/api/client/Iobeam.java
|
Iobeam.addData
|
@Deprecated
public void addData(String seriesName, DataPoint dataPoint) {
"""
Adds a data value to a particular series in the data store.
@param seriesName The name of the series that the data belongs to.
@param dataPoint The DataPoint representing a data value at a particular time.
@deprecated Use DataStore and `trackDataStore()` instead.
"""
synchronized (dataStoreLock) {
_addDataWithoutLock(seriesName, dataPoint);
}
}
|
java
|
@Deprecated
public void addData(String seriesName, DataPoint dataPoint) {
synchronized (dataStoreLock) {
_addDataWithoutLock(seriesName, dataPoint);
}
}
|
[
"@",
"Deprecated",
"public",
"void",
"addData",
"(",
"String",
"seriesName",
",",
"DataPoint",
"dataPoint",
")",
"{",
"synchronized",
"(",
"dataStoreLock",
")",
"{",
"_addDataWithoutLock",
"(",
"seriesName",
",",
"dataPoint",
")",
";",
"}",
"}"
] |
Adds a data value to a particular series in the data store.
@param seriesName The name of the series that the data belongs to.
@param dataPoint The DataPoint representing a data value at a particular time.
@deprecated Use DataStore and `trackDataStore()` instead.
|
[
"Adds",
"a",
"data",
"value",
"to",
"a",
"particular",
"series",
"in",
"the",
"data",
"store",
"."
] |
train
|
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L753-L758
|
TheHortonMachine/hortonmachine
|
hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/flow/OmsLeastCostFlowDirections.java
|
OmsLeastCostFlowDirections.assignFlowDirection
|
private boolean assignFlowDirection( GridNode current, GridNode diagonal, GridNode node1, GridNode node2 ) {
"""
Checks if the path from the current to the first node is steeper than to the others.
@param current the current node.
@param diagonal the diagonal node to check.
@param node1 the first other node to check.
@param node2 the second other node to check.
@return <code>true</code> if the path to the first node is steeper in module than
that to the others.
"""
double diagonalSlope = abs(current.getSlopeTo(diagonal));
if (node1 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node1));
if (diagonalSlope < tmpSlope) {
return false;
}
}
if (node2 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node2));
if (diagonalSlope < tmpSlope) {
return false;
}
}
return true;
}
|
java
|
private boolean assignFlowDirection( GridNode current, GridNode diagonal, GridNode node1, GridNode node2 ) {
double diagonalSlope = abs(current.getSlopeTo(diagonal));
if (node1 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node1));
if (diagonalSlope < tmpSlope) {
return false;
}
}
if (node2 != null) {
double tmpSlope = abs(diagonal.getSlopeTo(node2));
if (diagonalSlope < tmpSlope) {
return false;
}
}
return true;
}
|
[
"private",
"boolean",
"assignFlowDirection",
"(",
"GridNode",
"current",
",",
"GridNode",
"diagonal",
",",
"GridNode",
"node1",
",",
"GridNode",
"node2",
")",
"{",
"double",
"diagonalSlope",
"=",
"abs",
"(",
"current",
".",
"getSlopeTo",
"(",
"diagonal",
")",
")",
";",
"if",
"(",
"node1",
"!=",
"null",
")",
"{",
"double",
"tmpSlope",
"=",
"abs",
"(",
"diagonal",
".",
"getSlopeTo",
"(",
"node1",
")",
")",
";",
"if",
"(",
"diagonalSlope",
"<",
"tmpSlope",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"node2",
"!=",
"null",
")",
"{",
"double",
"tmpSlope",
"=",
"abs",
"(",
"diagonal",
".",
"getSlopeTo",
"(",
"node2",
")",
")",
";",
"if",
"(",
"diagonalSlope",
"<",
"tmpSlope",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks if the path from the current to the first node is steeper than to the others.
@param current the current node.
@param diagonal the diagonal node to check.
@param node1 the first other node to check.
@param node2 the second other node to check.
@return <code>true</code> if the path to the first node is steeper in module than
that to the others.
|
[
"Checks",
"if",
"the",
"path",
"from",
"the",
"current",
"to",
"the",
"first",
"node",
"is",
"steeper",
"than",
"to",
"the",
"others",
"."
] |
train
|
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/flow/OmsLeastCostFlowDirections.java#L339-L354
|
tuenti/SmsRadar
|
library/src/main/java/com/tuenti/smsradar/SmsRadar.java
|
SmsRadar.stopSmsRadarService
|
public static void stopSmsRadarService(Context context) {
"""
Stops the service and remove the SmsListener added when the SmsRadar was initialized
@param context used to stop the service
"""
SmsRadar.smsListener = null;
Intent intent = new Intent(context, SmsRadarService.class);
context.stopService(intent);
}
|
java
|
public static void stopSmsRadarService(Context context) {
SmsRadar.smsListener = null;
Intent intent = new Intent(context, SmsRadarService.class);
context.stopService(intent);
}
|
[
"public",
"static",
"void",
"stopSmsRadarService",
"(",
"Context",
"context",
")",
"{",
"SmsRadar",
".",
"smsListener",
"=",
"null",
";",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"SmsRadarService",
".",
"class",
")",
";",
"context",
".",
"stopService",
"(",
"intent",
")",
";",
"}"
] |
Stops the service and remove the SmsListener added when the SmsRadar was initialized
@param context used to stop the service
|
[
"Stops",
"the",
"service",
"and",
"remove",
"the",
"SmsListener",
"added",
"when",
"the",
"SmsRadar",
"was",
"initialized"
] |
train
|
https://github.com/tuenti/SmsRadar/blob/598553c69c474634a1d4041a39f015f0b4c33a6d/library/src/main/java/com/tuenti/smsradar/SmsRadar.java#L50-L54
|
anothem/android-range-seek-bar
|
rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java
|
RangeSeekBar.drawThumb
|
private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) {
"""
Draws the "normal" resp. "pressed" thumb image on specified x-coordinate.
@param screenCoord The x-coordinate in screen space where to draw the image.
@param pressed Is the thumb currently in "pressed" state?
@param canvas The canvas to draw upon.
"""
Bitmap buttonToDraw;
if (!activateOnDefaultValues && areSelectedValuesDefault) {
buttonToDraw = thumbDisabledImage;
} else {
buttonToDraw = pressed ? thumbPressedImage : thumbImage;
}
canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth,
textOffset,
paint);
}
|
java
|
private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) {
Bitmap buttonToDraw;
if (!activateOnDefaultValues && areSelectedValuesDefault) {
buttonToDraw = thumbDisabledImage;
} else {
buttonToDraw = pressed ? thumbPressedImage : thumbImage;
}
canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth,
textOffset,
paint);
}
|
[
"private",
"void",
"drawThumb",
"(",
"float",
"screenCoord",
",",
"boolean",
"pressed",
",",
"Canvas",
"canvas",
",",
"boolean",
"areSelectedValuesDefault",
")",
"{",
"Bitmap",
"buttonToDraw",
";",
"if",
"(",
"!",
"activateOnDefaultValues",
"&&",
"areSelectedValuesDefault",
")",
"{",
"buttonToDraw",
"=",
"thumbDisabledImage",
";",
"}",
"else",
"{",
"buttonToDraw",
"=",
"pressed",
"?",
"thumbPressedImage",
":",
"thumbImage",
";",
"}",
"canvas",
".",
"drawBitmap",
"(",
"buttonToDraw",
",",
"screenCoord",
"-",
"thumbHalfWidth",
",",
"textOffset",
",",
"paint",
")",
";",
"}"
] |
Draws the "normal" resp. "pressed" thumb image on specified x-coordinate.
@param screenCoord The x-coordinate in screen space where to draw the image.
@param pressed Is the thumb currently in "pressed" state?
@param canvas The canvas to draw upon.
|
[
"Draws",
"the",
"normal",
"resp",
".",
"pressed",
"thumb",
"image",
"on",
"specified",
"x",
"-",
"coordinate",
"."
] |
train
|
https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L735-L746
|
jenkinsci/jenkins
|
core/src/main/java/hudson/model/Descriptor.java
|
Descriptor.getPropertyType
|
public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {
"""
Used by Jelly to abstract away the handling of global.jelly vs config.jelly databinding difference.
"""
// in global.jelly, instance==descriptor
return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);
}
|
java
|
public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {
// in global.jelly, instance==descriptor
return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);
}
|
[
"public",
"@",
"CheckForNull",
"PropertyType",
"getPropertyType",
"(",
"@",
"Nonnull",
"Object",
"instance",
",",
"@",
"Nonnull",
"String",
"field",
")",
"{",
"// in global.jelly, instance==descriptor",
"return",
"instance",
"==",
"this",
"?",
"getGlobalPropertyType",
"(",
"field",
")",
":",
"getPropertyType",
"(",
"field",
")",
";",
"}"
] |
Used by Jelly to abstract away the handling of global.jelly vs config.jelly databinding difference.
|
[
"Used",
"by",
"Jelly",
"to",
"abstract",
"away",
"the",
"handling",
"of",
"global",
".",
"jelly",
"vs",
"config",
".",
"jelly",
"databinding",
"difference",
"."
] |
train
|
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L466-L469
|
rometools/rome
|
rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java
|
FileBasedAtomHandler.putEntry
|
@Override
public void putEntry(final AtomRequest areq, final Entry entry) throws AtomException {
"""
Update entry specified by pathInfo and posted entry.
@param entry
@param areq Details of HTTP request
@throws com.rometools.rome.propono.atom.server.AtomException
"""
LOG.debug("putEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0];
final String collection = pathInfo[1];
final String fileName = pathInfo[2];
final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
try {
col.updateEntry(entry, fileName);
} catch (final Exception fe) {
throw new AtomException(fe);
}
}
|
java
|
@Override
public void putEntry(final AtomRequest areq, final Entry entry) throws AtomException {
LOG.debug("putEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0];
final String collection = pathInfo[1];
final String fileName = pathInfo[2];
final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
try {
col.updateEntry(entry, fileName);
} catch (final Exception fe) {
throw new AtomException(fe);
}
}
|
[
"@",
"Override",
"public",
"void",
"putEntry",
"(",
"final",
"AtomRequest",
"areq",
",",
"final",
"Entry",
"entry",
")",
"throws",
"AtomException",
"{",
"LOG",
".",
"debug",
"(",
"\"putEntry\"",
")",
";",
"final",
"String",
"[",
"]",
"pathInfo",
"=",
"StringUtils",
".",
"split",
"(",
"areq",
".",
"getPathInfo",
"(",
")",
",",
"\"/\"",
")",
";",
"final",
"String",
"handle",
"=",
"pathInfo",
"[",
"0",
"]",
";",
"final",
"String",
"collection",
"=",
"pathInfo",
"[",
"1",
"]",
";",
"final",
"String",
"fileName",
"=",
"pathInfo",
"[",
"2",
"]",
";",
"final",
"FileBasedCollection",
"col",
"=",
"service",
".",
"findCollectionByHandle",
"(",
"handle",
",",
"collection",
")",
";",
"try",
"{",
"col",
".",
"updateEntry",
"(",
"entry",
",",
"fileName",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"fe",
")",
"{",
"throw",
"new",
"AtomException",
"(",
"fe",
")",
";",
"}",
"}"
] |
Update entry specified by pathInfo and posted entry.
@param entry
@param areq Details of HTTP request
@throws com.rometools.rome.propono.atom.server.AtomException
|
[
"Update",
"entry",
"specified",
"by",
"pathInfo",
"and",
"posted",
"entry",
"."
] |
train
|
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java#L227-L241
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/BasicChannel.java
|
BasicChannel.transmit
|
public synchronized void transmit(Object o, ReceiverQueue t) {
"""
Dispatches an object to all connected receivers.
@param o the object to dispatch
@param t the transceiver sending the object
"""
if (!closed) {
ArrayList<Receiver> toBeRemoved = new ArrayList<Receiver>();
for (Receiver r : receivers) {
//cleanup
//TODO separate cleanup from transmit
//
if (r instanceof ReceiverQueue && ((ReceiverQueue)r).isClosed()) {
toBeRemoved.add(r);
}
else {
if (echo || r != t) {
r.onReceive(o);
}
}
}
for (Receiver r : toBeRemoved) {
receivers.remove(r);
}
}
}
|
java
|
public synchronized void transmit(Object o, ReceiverQueue t) {
if (!closed) {
ArrayList<Receiver> toBeRemoved = new ArrayList<Receiver>();
for (Receiver r : receivers) {
//cleanup
//TODO separate cleanup from transmit
//
if (r instanceof ReceiverQueue && ((ReceiverQueue)r).isClosed()) {
toBeRemoved.add(r);
}
else {
if (echo || r != t) {
r.onReceive(o);
}
}
}
for (Receiver r : toBeRemoved) {
receivers.remove(r);
}
}
}
|
[
"public",
"synchronized",
"void",
"transmit",
"(",
"Object",
"o",
",",
"ReceiverQueue",
"t",
")",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"ArrayList",
"<",
"Receiver",
">",
"toBeRemoved",
"=",
"new",
"ArrayList",
"<",
"Receiver",
">",
"(",
")",
";",
"for",
"(",
"Receiver",
"r",
":",
"receivers",
")",
"{",
"//cleanup",
"//TODO separate cleanup from transmit",
"//",
"if",
"(",
"r",
"instanceof",
"ReceiverQueue",
"&&",
"(",
"(",
"ReceiverQueue",
")",
"r",
")",
".",
"isClosed",
"(",
")",
")",
"{",
"toBeRemoved",
".",
"add",
"(",
"r",
")",
";",
"}",
"else",
"{",
"if",
"(",
"echo",
"||",
"r",
"!=",
"t",
")",
"{",
"r",
".",
"onReceive",
"(",
"o",
")",
";",
"}",
"}",
"}",
"for",
"(",
"Receiver",
"r",
":",
"toBeRemoved",
")",
"{",
"receivers",
".",
"remove",
"(",
"r",
")",
";",
"}",
"}",
"}"
] |
Dispatches an object to all connected receivers.
@param o the object to dispatch
@param t the transceiver sending the object
|
[
"Dispatches",
"an",
"object",
"to",
"all",
"connected",
"receivers",
"."
] |
train
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/BasicChannel.java#L102-L122
|
aspectran/aspectran
|
shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java
|
DefaultOptionParser.handleUnknownToken
|
private void handleUnknownToken(String token) throws OptionParserException {
"""
Handles an unknown token. If the token starts with a dash an
UnrecognizedOptionException is thrown. Otherwise the token is added
to the arguments of the command line. If the skipParsingAtNonOption flag
is set, this stops the parsing and the remaining tokens are added
as-is in the arguments of the command line.
@param token the command line token to handle
@throws OptionParserException if option parsing fails
"""
if (token.startsWith("-") && token.length() > 1 && !skipParsingAtNonOption) {
throw new UnrecognizedOptionException("Unrecognized option: " + token, token);
}
parsedOptions.addArg(token);
}
|
java
|
private void handleUnknownToken(String token) throws OptionParserException {
if (token.startsWith("-") && token.length() > 1 && !skipParsingAtNonOption) {
throw new UnrecognizedOptionException("Unrecognized option: " + token, token);
}
parsedOptions.addArg(token);
}
|
[
"private",
"void",
"handleUnknownToken",
"(",
"String",
"token",
")",
"throws",
"OptionParserException",
"{",
"if",
"(",
"token",
".",
"startsWith",
"(",
"\"-\"",
")",
"&&",
"token",
".",
"length",
"(",
")",
">",
"1",
"&&",
"!",
"skipParsingAtNonOption",
")",
"{",
"throw",
"new",
"UnrecognizedOptionException",
"(",
"\"Unrecognized option: \"",
"+",
"token",
",",
"token",
")",
";",
"}",
"parsedOptions",
".",
"addArg",
"(",
"token",
")",
";",
"}"
] |
Handles an unknown token. If the token starts with a dash an
UnrecognizedOptionException is thrown. Otherwise the token is added
to the arguments of the command line. If the skipParsingAtNonOption flag
is set, this stops the parsing and the remaining tokens are added
as-is in the arguments of the command line.
@param token the command line token to handle
@throws OptionParserException if option parsing fails
|
[
"Handles",
"an",
"unknown",
"token",
".",
"If",
"the",
"token",
"starts",
"with",
"a",
"dash",
"an",
"UnrecognizedOptionException",
"is",
"thrown",
".",
"Otherwise",
"the",
"token",
"is",
"added",
"to",
"the",
"arguments",
"of",
"the",
"command",
"line",
".",
"If",
"the",
"skipParsingAtNonOption",
"flag",
"is",
"set",
"this",
"stops",
"the",
"parsing",
"and",
"the",
"remaining",
"tokens",
"are",
"added",
"as",
"-",
"is",
"in",
"the",
"arguments",
"of",
"the",
"command",
"line",
"."
] |
train
|
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L392-L397
|
fabric8io/kubernetes-client
|
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java
|
OperationSupport.handlePatch
|
protected <T> T handlePatch(T current, T updated, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException {
"""
Send an http patch and handle the response.
@param current current object
@param updated updated object
@param type type of object
@param <T> template argument provided
@return returns de-serialized version of api server response
@throws ExecutionException Execution Exception
@throws InterruptedException Interrupted Exception
@throws KubernetesClientException KubernetesClientException
@throws IOException IOException
"""
JsonNode diff = JsonDiff.asJson(patchMapper().valueToTree(current), patchMapper().valueToTree(updated));
RequestBody body = RequestBody.create(JSON_PATCH, JSON_MAPPER.writeValueAsString(diff));
Request.Builder requestBuilder = new Request.Builder().patch(body).url(getResourceUrl(checkNamespace(updated), checkName(updated)));
return handleResponse(requestBuilder, type, Collections.<String, String>emptyMap());
}
|
java
|
protected <T> T handlePatch(T current, T updated, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException {
JsonNode diff = JsonDiff.asJson(patchMapper().valueToTree(current), patchMapper().valueToTree(updated));
RequestBody body = RequestBody.create(JSON_PATCH, JSON_MAPPER.writeValueAsString(diff));
Request.Builder requestBuilder = new Request.Builder().patch(body).url(getResourceUrl(checkNamespace(updated), checkName(updated)));
return handleResponse(requestBuilder, type, Collections.<String, String>emptyMap());
}
|
[
"protected",
"<",
"T",
">",
"T",
"handlePatch",
"(",
"T",
"current",
",",
"T",
"updated",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"KubernetesClientException",
",",
"IOException",
"{",
"JsonNode",
"diff",
"=",
"JsonDiff",
".",
"asJson",
"(",
"patchMapper",
"(",
")",
".",
"valueToTree",
"(",
"current",
")",
",",
"patchMapper",
"(",
")",
".",
"valueToTree",
"(",
"updated",
")",
")",
";",
"RequestBody",
"body",
"=",
"RequestBody",
".",
"create",
"(",
"JSON_PATCH",
",",
"JSON_MAPPER",
".",
"writeValueAsString",
"(",
"diff",
")",
")",
";",
"Request",
".",
"Builder",
"requestBuilder",
"=",
"new",
"Request",
".",
"Builder",
"(",
")",
".",
"patch",
"(",
"body",
")",
".",
"url",
"(",
"getResourceUrl",
"(",
"checkNamespace",
"(",
"updated",
")",
",",
"checkName",
"(",
"updated",
")",
")",
")",
";",
"return",
"handleResponse",
"(",
"requestBuilder",
",",
"type",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")",
")",
";",
"}"
] |
Send an http patch and handle the response.
@param current current object
@param updated updated object
@param type type of object
@param <T> template argument provided
@return returns de-serialized version of api server response
@throws ExecutionException Execution Exception
@throws InterruptedException Interrupted Exception
@throws KubernetesClientException KubernetesClientException
@throws IOException IOException
|
[
"Send",
"an",
"http",
"patch",
"and",
"handle",
"the",
"response",
"."
] |
train
|
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java#L289-L294
|
aspectran/aspectran
|
core/src/main/java/com/aspectran/core/util/StringUtils.java
|
StringUtils.searchIgnoreCase
|
public static int searchIgnoreCase(String str, String keyw) {
"""
Returns the number of times the specified string was found
in the target string, or 0 if there is no specified string.
When searching for the specified string, it is not case-sensitive.
@param str the target string
@param keyw the string to find
@return the number of times the specified string was found
"""
return search(str.toLowerCase(), keyw.toLowerCase());
}
|
java
|
public static int searchIgnoreCase(String str, String keyw) {
return search(str.toLowerCase(), keyw.toLowerCase());
}
|
[
"public",
"static",
"int",
"searchIgnoreCase",
"(",
"String",
"str",
",",
"String",
"keyw",
")",
"{",
"return",
"search",
"(",
"str",
".",
"toLowerCase",
"(",
")",
",",
"keyw",
".",
"toLowerCase",
"(",
")",
")",
";",
"}"
] |
Returns the number of times the specified string was found
in the target string, or 0 if there is no specified string.
When searching for the specified string, it is not case-sensitive.
@param str the target string
@param keyw the string to find
@return the number of times the specified string was found
|
[
"Returns",
"the",
"number",
"of",
"times",
"the",
"specified",
"string",
"was",
"found",
"in",
"the",
"target",
"string",
"or",
"0",
"if",
"there",
"is",
"no",
"specified",
"string",
".",
"When",
"searching",
"for",
"the",
"specified",
"string",
"it",
"is",
"not",
"case",
"-",
"sensitive",
"."
] |
train
|
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L560-L562
|
Azure/azure-sdk-for-java
|
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java
|
TransactionContext.rollbackAsync
|
public CompletableFuture<Void> rollbackAsync() {
"""
Asynchronously rollback the transaction.
@return a CompletableFuture for the rollback operation
"""
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, false);
}
|
java
|
public CompletableFuture<Void> rollbackAsync() {
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, false);
}
|
[
"public",
"CompletableFuture",
"<",
"Void",
">",
"rollbackAsync",
"(",
")",
"{",
"if",
"(",
"this",
".",
"messagingFactory",
"==",
"null",
")",
"{",
"CompletableFuture",
"<",
"Void",
">",
"exceptionCompletion",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"exceptionCompletion",
".",
"completeExceptionally",
"(",
"new",
"ServiceBusException",
"(",
"false",
",",
"\"MessagingFactory should not be null\"",
")",
")",
";",
"return",
"exceptionCompletion",
";",
"}",
"return",
"this",
".",
"messagingFactory",
".",
"endTransactionAsync",
"(",
"this",
",",
"false",
")",
";",
"}"
] |
Asynchronously rollback the transaction.
@return a CompletableFuture for the rollback operation
|
[
"Asynchronously",
"rollback",
"the",
"transaction",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L83-L91
|
EMCECS/nfs-client-java
|
src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java
|
RpcWrapper.handleRpcException
|
private void handleRpcException(RpcException e, int attemptNumber) throws IOException {
"""
Decide whether to retry or throw an exception.
@param e
The exception.
@param attemptNumber
The number of attempts so far.
@throws IOException
"""
String messageStart;
if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) {
messageStart = "rpc";
} else {
// check whether to retry
if (attemptNumber + 1 < _maximumRetries) {
try {
int waitTime = _retryWait * (attemptNumber + 1);
Thread.sleep(waitTime);
} catch (InterruptedException ie) {
// restore the interrupt status
Thread.currentThread().interrupt();
}
LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber });
return;
}
messageStart = "network";
}
throw new NfsException(NfsStatus.NFS3ERR_IO,
String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e);
}
|
java
|
private void handleRpcException(RpcException e, int attemptNumber) throws IOException {
String messageStart;
if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) {
messageStart = "rpc";
} else {
// check whether to retry
if (attemptNumber + 1 < _maximumRetries) {
try {
int waitTime = _retryWait * (attemptNumber + 1);
Thread.sleep(waitTime);
} catch (InterruptedException ie) {
// restore the interrupt status
Thread.currentThread().interrupt();
}
LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber });
return;
}
messageStart = "network";
}
throw new NfsException(NfsStatus.NFS3ERR_IO,
String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e);
}
|
[
"private",
"void",
"handleRpcException",
"(",
"RpcException",
"e",
",",
"int",
"attemptNumber",
")",
"throws",
"IOException",
"{",
"String",
"messageStart",
";",
"if",
"(",
"!",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"equals",
"(",
"RpcStatus",
".",
"NETWORK_ERROR",
")",
")",
")",
"{",
"messageStart",
"=",
"\"rpc\"",
";",
"}",
"else",
"{",
"// check whether to retry",
"if",
"(",
"attemptNumber",
"+",
"1",
"<",
"_maximumRetries",
")",
"{",
"try",
"{",
"int",
"waitTime",
"=",
"_retryWait",
"*",
"(",
"attemptNumber",
"+",
"1",
")",
";",
"Thread",
".",
"sleep",
"(",
"waitTime",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"// restore the interrupt status",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"LOG",
".",
"warn",
"(",
"\"network error happens, server {}, attemptNumber {}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_server",
",",
"attemptNumber",
"}",
")",
";",
"return",
";",
"}",
"messageStart",
"=",
"\"network\"",
";",
"}",
"throw",
"new",
"NfsException",
"(",
"NfsStatus",
".",
"NFS3ERR_IO",
",",
"String",
".",
"format",
"(",
"\"%s error, server: %s, RPC error: %s\"",
",",
"messageStart",
",",
"_server",
",",
"e",
".",
"getMessage",
"(",
")",
")",
",",
"e",
")",
";",
"}"
] |
Decide whether to retry or throw an exception.
@param e
The exception.
@param attemptNumber
The number of attempts so far.
@throws IOException
|
[
"Decide",
"whether",
"to",
"retry",
"or",
"throw",
"an",
"exception",
"."
] |
train
|
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L288-L312
|
kkopacz/agiso-core
|
bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java
|
ThreadUtils.putAttribute
|
public static Object putAttribute(String key, Object attribute) {
"""
Umieszcza wartość atrybutu pod określonym kluczem w lokalnym zasięgu wątku.
@param key Klucz, pod którym atrybut zostanie umieszczony
@param attribute Wartość atrybutu do umieszczenia w lokalnym zasięgu wątku
@return poprzednia wartość atrybutu powiązanego z klluczem, lub <code>null
</code> jeśli atrybut nie został ustawiony (albo posiadał wartość <code>
null</code>).
"""
return putAttribute(key, attribute, false);
}
|
java
|
public static Object putAttribute(String key, Object attribute) {
return putAttribute(key, attribute, false);
}
|
[
"public",
"static",
"Object",
"putAttribute",
"(",
"String",
"key",
",",
"Object",
"attribute",
")",
"{",
"return",
"putAttribute",
"(",
"key",
",",
"attribute",
",",
"false",
")",
";",
"}"
] |
Umieszcza wartość atrybutu pod określonym kluczem w lokalnym zasięgu wątku.
@param key Klucz, pod którym atrybut zostanie umieszczony
@param attribute Wartość atrybutu do umieszczenia w lokalnym zasięgu wątku
@return poprzednia wartość atrybutu powiązanego z klluczem, lub <code>null
</code> jeśli atrybut nie został ustawiony (albo posiadał wartość <code>
null</code>).
|
[
"Umieszcza",
"wartość",
"atrybutu",
"pod",
"określonym",
"kluczem",
"w",
"lokalnym",
"zasięgu",
"wątku",
"."
] |
train
|
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java#L107-L109
|
jMotif/SAX
|
src/main/java/net/seninp/util/HeatChart.java
|
HeatChart.setZValues
|
public void setZValues(double[][] zValues, double low, double high) {
"""
Replaces the z-values array. The number of elements should match the number of y-values, with
each element containing a double array with an equal number of elements that matches the number
of x-values. Use this method where the minimum and maximum values possible are not contained
within the dataset.
@param zValues the array to replace the current array with. The number of elements in each
inner array must be identical.
@param low the minimum possible value, which may or may not appear in the z-values.
@param high the maximum possible value, which may or may not appear in the z-values.
"""
this.zValues = zValues;
this.lowValue = low;
this.highValue = high;
}
|
java
|
public void setZValues(double[][] zValues, double low, double high) {
this.zValues = zValues;
this.lowValue = low;
this.highValue = high;
}
|
[
"public",
"void",
"setZValues",
"(",
"double",
"[",
"]",
"[",
"]",
"zValues",
",",
"double",
"low",
",",
"double",
"high",
")",
"{",
"this",
".",
"zValues",
"=",
"zValues",
";",
"this",
".",
"lowValue",
"=",
"low",
";",
"this",
".",
"highValue",
"=",
"high",
";",
"}"
] |
Replaces the z-values array. The number of elements should match the number of y-values, with
each element containing a double array with an equal number of elements that matches the number
of x-values. Use this method where the minimum and maximum values possible are not contained
within the dataset.
@param zValues the array to replace the current array with. The number of elements in each
inner array must be identical.
@param low the minimum possible value, which may or may not appear in the z-values.
@param high the maximum possible value, which may or may not appear in the z-values.
|
[
"Replaces",
"the",
"z",
"-",
"values",
"array",
".",
"The",
"number",
"of",
"elements",
"should",
"match",
"the",
"number",
"of",
"y",
"-",
"values",
"with",
"each",
"element",
"containing",
"a",
"double",
"array",
"with",
"an",
"equal",
"number",
"of",
"elements",
"that",
"matches",
"the",
"number",
"of",
"x",
"-",
"values",
".",
"Use",
"this",
"method",
"where",
"the",
"minimum",
"and",
"maximum",
"values",
"possible",
"are",
"not",
"contained",
"within",
"the",
"dataset",
"."
] |
train
|
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L341-L345
|
vznet/mongo-jackson-mapper
|
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
|
JacksonDBCollection.getCount
|
public long getCount(DBObject query, DBObject fields, long limit, long skip) throws MongoException {
"""
Returns the number of documents in the collection
that match the specified query
@param query query to select documents to count
@param fields fields to return
@param limit limit the count to this value
@param skip number of entries to skip
@return number of documents that match query and fields
@throws MongoException If an error occurred
"""
return dbCollection.getCount(serializeFields(query), fields, limit, skip);
}
|
java
|
public long getCount(DBObject query, DBObject fields, long limit, long skip) throws MongoException {
return dbCollection.getCount(serializeFields(query), fields, limit, skip);
}
|
[
"public",
"long",
"getCount",
"(",
"DBObject",
"query",
",",
"DBObject",
"fields",
",",
"long",
"limit",
",",
"long",
"skip",
")",
"throws",
"MongoException",
"{",
"return",
"dbCollection",
".",
"getCount",
"(",
"serializeFields",
"(",
"query",
")",
",",
"fields",
",",
"limit",
",",
"skip",
")",
";",
"}"
] |
Returns the number of documents in the collection
that match the specified query
@param query query to select documents to count
@param fields fields to return
@param limit limit the count to this value
@param skip number of entries to skip
@return number of documents that match query and fields
@throws MongoException If an error occurred
|
[
"Returns",
"the",
"number",
"of",
"documents",
"in",
"the",
"collection",
"that",
"match",
"the",
"specified",
"query"
] |
train
|
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L1135-L1137
|
virgo47/javasimon
|
core/src/main/java/org/javasimon/callback/FilterRule.java
|
FilterRule.checkCondition
|
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException {
"""
Checks the Simon and optional parameters against the condition specified for a rule.
@param simon related Simon
@param params optional parameters, e.g. value that is added to a Counter
@return true if no condition is specified or the condition is satisfied, otherwise false
@throws javax.script.ScriptException possible exception raised by the expression evaluation
"""
if (condition == null) {
return true;
}
if (simon instanceof Stopwatch) {
return checkStopwtach((Stopwatch) simon, params);
}
if (simon instanceof Counter) {
return checkCounter((Counter) simon, params);
}
return true;
}
|
java
|
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException {
if (condition == null) {
return true;
}
if (simon instanceof Stopwatch) {
return checkStopwtach((Stopwatch) simon, params);
}
if (simon instanceof Counter) {
return checkCounter((Counter) simon, params);
}
return true;
}
|
[
"public",
"synchronized",
"boolean",
"checkCondition",
"(",
"Simon",
"simon",
",",
"Object",
"...",
"params",
")",
"throws",
"ScriptException",
"{",
"if",
"(",
"condition",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"simon",
"instanceof",
"Stopwatch",
")",
"{",
"return",
"checkStopwtach",
"(",
"(",
"Stopwatch",
")",
"simon",
",",
"params",
")",
";",
"}",
"if",
"(",
"simon",
"instanceof",
"Counter",
")",
"{",
"return",
"checkCounter",
"(",
"(",
"Counter",
")",
"simon",
",",
"params",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Checks the Simon and optional parameters against the condition specified for a rule.
@param simon related Simon
@param params optional parameters, e.g. value that is added to a Counter
@return true if no condition is specified or the condition is satisfied, otherwise false
@throws javax.script.ScriptException possible exception raised by the expression evaluation
|
[
"Checks",
"the",
"Simon",
"and",
"optional",
"parameters",
"against",
"the",
"condition",
"specified",
"for",
"a",
"rule",
"."
] |
train
|
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/FilterRule.java#L174-L185
|
zaproxy/zaproxy
|
src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java
|
SpiderHtmlFormParser.processGetForm
|
private void processGetForm(HttpMessage message, int depth, String action, String baseURL, FormData formData) {
"""
Processes the given GET form data into, possibly, several URLs.
<p>
For each submit field present in the form data is processed one URL, which includes remaining normal fields.
@param message the source message
@param depth the current depth
@param action the action
@param baseURL the base URL
@param formData the GET form data
@see #processURL(HttpMessage, int, String, String)
"""
for (String submitData : formData) {
log.debug("Submiting form with GET method and query with form parameters: " + submitData);
processURL(message, depth, action + submitData, baseURL);
}
}
|
java
|
private void processGetForm(HttpMessage message, int depth, String action, String baseURL, FormData formData) {
for (String submitData : formData) {
log.debug("Submiting form with GET method and query with form parameters: " + submitData);
processURL(message, depth, action + submitData, baseURL);
}
}
|
[
"private",
"void",
"processGetForm",
"(",
"HttpMessage",
"message",
",",
"int",
"depth",
",",
"String",
"action",
",",
"String",
"baseURL",
",",
"FormData",
"formData",
")",
"{",
"for",
"(",
"String",
"submitData",
":",
"formData",
")",
"{",
"log",
".",
"debug",
"(",
"\"Submiting form with GET method and query with form parameters: \"",
"+",
"submitData",
")",
";",
"processURL",
"(",
"message",
",",
"depth",
",",
"action",
"+",
"submitData",
",",
"baseURL",
")",
";",
"}",
"}"
] |
Processes the given GET form data into, possibly, several URLs.
<p>
For each submit field present in the form data is processed one URL, which includes remaining normal fields.
@param message the source message
@param depth the current depth
@param action the action
@param baseURL the base URL
@param formData the GET form data
@see #processURL(HttpMessage, int, String, String)
|
[
"Processes",
"the",
"given",
"GET",
"form",
"data",
"into",
"possibly",
"several",
"URLs",
".",
"<p",
">",
"For",
"each",
"submit",
"field",
"present",
"in",
"the",
"form",
"data",
"is",
"processed",
"one",
"URL",
"which",
"includes",
"remaining",
"normal",
"fields",
"."
] |
train
|
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java#L214-L219
|
alkacon/opencms-core
|
src/org/opencms/search/documents/CmsDocumentDependency.java
|
CmsDocumentDependency.toJSON
|
public JSONObject toJSON(CmsObject cms, boolean includeLang) {
"""
Returns a JSON object describing this dependency document.<p>
@param cms the current cms object
@param includeLang flag if language versions should be included
@return a JSON object describing this dependency document
"""
try {
CmsObject clone = OpenCms.initCmsObject(cms);
clone.getRequestContext().setSiteRoot("");
JSONObject jsonAttachment = new JSONObject();
CmsResource res = clone.readResource(m_rootPath, CmsResourceFilter.IGNORE_EXPIRATION);
Map<String, String> props = CmsProperty.toMap(clone.readPropertyObjects(res, false));
// id and path
jsonAttachment.put(JSON_UUID, res.getStructureId());
jsonAttachment.put(JSON_PATH, res.getRootPath());
// title
jsonAttachment.put(JSON_TITLE, props.get(CmsPropertyDefinition.PROPERTY_TITLE));
// date created
jsonAttachment.put(JSON_DATE_CREATED, res.getDateCreated());
// date created
jsonAttachment.put(JSON_LOCALE, m_locale);
// date modified
jsonAttachment.put(JSON_DATE_MODIFIED, res.getDateLastModified());
if (includeLang) {
// get all language versions of the document
List<CmsDocumentDependency> langs = getVariants();
if (langs != null) {
JSONArray jsonLanguages = new JSONArray();
for (CmsDocumentDependency lang : langs) {
JSONObject jsonLanguage = lang.toJSON(cms, false);
jsonLanguages.put(jsonLanguage);
}
jsonAttachment.put(JSON_LANGUAGES, jsonLanguages);
}
}
return jsonAttachment;
} catch (Exception ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
return null;
}
|
java
|
public JSONObject toJSON(CmsObject cms, boolean includeLang) {
try {
CmsObject clone = OpenCms.initCmsObject(cms);
clone.getRequestContext().setSiteRoot("");
JSONObject jsonAttachment = new JSONObject();
CmsResource res = clone.readResource(m_rootPath, CmsResourceFilter.IGNORE_EXPIRATION);
Map<String, String> props = CmsProperty.toMap(clone.readPropertyObjects(res, false));
// id and path
jsonAttachment.put(JSON_UUID, res.getStructureId());
jsonAttachment.put(JSON_PATH, res.getRootPath());
// title
jsonAttachment.put(JSON_TITLE, props.get(CmsPropertyDefinition.PROPERTY_TITLE));
// date created
jsonAttachment.put(JSON_DATE_CREATED, res.getDateCreated());
// date created
jsonAttachment.put(JSON_LOCALE, m_locale);
// date modified
jsonAttachment.put(JSON_DATE_MODIFIED, res.getDateLastModified());
if (includeLang) {
// get all language versions of the document
List<CmsDocumentDependency> langs = getVariants();
if (langs != null) {
JSONArray jsonLanguages = new JSONArray();
for (CmsDocumentDependency lang : langs) {
JSONObject jsonLanguage = lang.toJSON(cms, false);
jsonLanguages.put(jsonLanguage);
}
jsonAttachment.put(JSON_LANGUAGES, jsonLanguages);
}
}
return jsonAttachment;
} catch (Exception ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
return null;
}
|
[
"public",
"JSONObject",
"toJSON",
"(",
"CmsObject",
"cms",
",",
"boolean",
"includeLang",
")",
"{",
"try",
"{",
"CmsObject",
"clone",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"cms",
")",
";",
"clone",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"\"\"",
")",
";",
"JSONObject",
"jsonAttachment",
"=",
"new",
"JSONObject",
"(",
")",
";",
"CmsResource",
"res",
"=",
"clone",
".",
"readResource",
"(",
"m_rootPath",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"props",
"=",
"CmsProperty",
".",
"toMap",
"(",
"clone",
".",
"readPropertyObjects",
"(",
"res",
",",
"false",
")",
")",
";",
"// id and path",
"jsonAttachment",
".",
"put",
"(",
"JSON_UUID",
",",
"res",
".",
"getStructureId",
"(",
")",
")",
";",
"jsonAttachment",
".",
"put",
"(",
"JSON_PATH",
",",
"res",
".",
"getRootPath",
"(",
")",
")",
";",
"// title",
"jsonAttachment",
".",
"put",
"(",
"JSON_TITLE",
",",
"props",
".",
"get",
"(",
"CmsPropertyDefinition",
".",
"PROPERTY_TITLE",
")",
")",
";",
"// date created",
"jsonAttachment",
".",
"put",
"(",
"JSON_DATE_CREATED",
",",
"res",
".",
"getDateCreated",
"(",
")",
")",
";",
"// date created",
"jsonAttachment",
".",
"put",
"(",
"JSON_LOCALE",
",",
"m_locale",
")",
";",
"// date modified",
"jsonAttachment",
".",
"put",
"(",
"JSON_DATE_MODIFIED",
",",
"res",
".",
"getDateLastModified",
"(",
")",
")",
";",
"if",
"(",
"includeLang",
")",
"{",
"// get all language versions of the document",
"List",
"<",
"CmsDocumentDependency",
">",
"langs",
"=",
"getVariants",
"(",
")",
";",
"if",
"(",
"langs",
"!=",
"null",
")",
"{",
"JSONArray",
"jsonLanguages",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"CmsDocumentDependency",
"lang",
":",
"langs",
")",
"{",
"JSONObject",
"jsonLanguage",
"=",
"lang",
".",
"toJSON",
"(",
"cms",
",",
"false",
")",
";",
"jsonLanguages",
".",
"put",
"(",
"jsonLanguage",
")",
";",
"}",
"jsonAttachment",
".",
"put",
"(",
"JSON_LANGUAGES",
",",
"jsonLanguages",
")",
";",
"}",
"}",
"return",
"jsonAttachment",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"error",
"(",
"ex",
".",
"getLocalizedMessage",
"(",
")",
",",
"ex",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns a JSON object describing this dependency document.<p>
@param cms the current cms object
@param includeLang flag if language versions should be included
@return a JSON object describing this dependency document
|
[
"Returns",
"a",
"JSON",
"object",
"describing",
"this",
"dependency",
"document",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentDependency.java#L957-L995
|
Whiley/WhileyCompiler
|
src/main/java/wyil/interpreter/Interpreter.java
|
Interpreter.executeAssume
|
private Status executeAssume(Stmt.Assume stmt, CallStack frame, EnclosingScope scope) {
"""
Execute an assert or assume statement. In both cases, if the condition
evaluates to false an exception is thrown.
@param stmt
--- Assert statement.
@param frame
--- The current stack frame
@return
"""
//
checkInvariants(frame,stmt.getCondition());
return Status.NEXT;
}
|
java
|
private Status executeAssume(Stmt.Assume stmt, CallStack frame, EnclosingScope scope) {
//
checkInvariants(frame,stmt.getCondition());
return Status.NEXT;
}
|
[
"private",
"Status",
"executeAssume",
"(",
"Stmt",
".",
"Assume",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"//",
"checkInvariants",
"(",
"frame",
",",
"stmt",
".",
"getCondition",
"(",
")",
")",
";",
"return",
"Status",
".",
"NEXT",
";",
"}"
] |
Execute an assert or assume statement. In both cases, if the condition
evaluates to false an exception is thrown.
@param stmt
--- Assert statement.
@param frame
--- The current stack frame
@return
|
[
"Execute",
"an",
"assert",
"or",
"assume",
"statement",
".",
"In",
"both",
"cases",
"if",
"the",
"condition",
"evaluates",
"to",
"false",
"an",
"exception",
"is",
"thrown",
"."
] |
train
|
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L266-L270
|
aspectran/aspectran
|
core/src/main/java/com/aspectran/core/util/apon/AponWriter.java
|
AponWriter.stringify
|
public static String stringify(Parameters parameters, String indentString) {
"""
Converts a Parameters object to an APON formatted string.
@param parameters the Parameters object to be converted
@param indentString the indentation string
@return a string that contains the APON text
"""
if (parameters == null) {
return null;
}
try {
Writer writer = new StringWriter();
AponWriter aponWriter = new AponWriter(writer);
aponWriter.setIndentString(indentString);
aponWriter.write(parameters);
aponWriter.close();
return writer.toString();
} catch (IOException e) {
return null;
}
}
|
java
|
public static String stringify(Parameters parameters, String indentString) {
if (parameters == null) {
return null;
}
try {
Writer writer = new StringWriter();
AponWriter aponWriter = new AponWriter(writer);
aponWriter.setIndentString(indentString);
aponWriter.write(parameters);
aponWriter.close();
return writer.toString();
} catch (IOException e) {
return null;
}
}
|
[
"public",
"static",
"String",
"stringify",
"(",
"Parameters",
"parameters",
",",
"String",
"indentString",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Writer",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"AponWriter",
"aponWriter",
"=",
"new",
"AponWriter",
"(",
"writer",
")",
";",
"aponWriter",
".",
"setIndentString",
"(",
"indentString",
")",
";",
"aponWriter",
".",
"write",
"(",
"parameters",
")",
";",
"aponWriter",
".",
"close",
"(",
")",
";",
"return",
"writer",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Converts a Parameters object to an APON formatted string.
@param parameters the Parameters object to be converted
@param indentString the indentation string
@return a string that contains the APON text
|
[
"Converts",
"a",
"Parameters",
"object",
"to",
"an",
"APON",
"formatted",
"string",
"."
] |
train
|
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/apon/AponWriter.java#L515-L529
|
JetBrains/xodus
|
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
|
VirtualFileSystem.renameFile
|
public boolean renameFile(@NotNull final Transaction txn, @NotNull final File origin, @NotNull final String newPath) {
"""
Renames {@code origin} file to the specified {@code newPath} and returns {@code true} if the file was actually
renamed. Otherwise another file with the path {@code newPath} exists. File contents and file descriptor are
not affected.
@param txn {@linkplain Transaction} instance
@param origin origin {@linkplain File}
@param newPath new name of the file
@return {@code true} if the file was actually renamed, otherwise another file with the path {@code newPath} exists
@see File
@see File#getDescriptor()
"""
final ArrayByteIterable key = StringBinding.stringToEntry(newPath);
final ByteIterable value = pathnames.get(txn, key);
if (value != null) {
return false;
}
final File newFile = new File(newPath, origin.getDescriptor(), origin.getCreated(), System.currentTimeMillis());
pathnames.put(txn, key, newFile.toByteIterable());
pathnames.delete(txn, StringBinding.stringToEntry(origin.getPath()));
return true;
}
|
java
|
public boolean renameFile(@NotNull final Transaction txn, @NotNull final File origin, @NotNull final String newPath) {
final ArrayByteIterable key = StringBinding.stringToEntry(newPath);
final ByteIterable value = pathnames.get(txn, key);
if (value != null) {
return false;
}
final File newFile = new File(newPath, origin.getDescriptor(), origin.getCreated(), System.currentTimeMillis());
pathnames.put(txn, key, newFile.toByteIterable());
pathnames.delete(txn, StringBinding.stringToEntry(origin.getPath()));
return true;
}
|
[
"public",
"boolean",
"renameFile",
"(",
"@",
"NotNull",
"final",
"Transaction",
"txn",
",",
"@",
"NotNull",
"final",
"File",
"origin",
",",
"@",
"NotNull",
"final",
"String",
"newPath",
")",
"{",
"final",
"ArrayByteIterable",
"key",
"=",
"StringBinding",
".",
"stringToEntry",
"(",
"newPath",
")",
";",
"final",
"ByteIterable",
"value",
"=",
"pathnames",
".",
"get",
"(",
"txn",
",",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"final",
"File",
"newFile",
"=",
"new",
"File",
"(",
"newPath",
",",
"origin",
".",
"getDescriptor",
"(",
")",
",",
"origin",
".",
"getCreated",
"(",
")",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"pathnames",
".",
"put",
"(",
"txn",
",",
"key",
",",
"newFile",
".",
"toByteIterable",
"(",
")",
")",
";",
"pathnames",
".",
"delete",
"(",
"txn",
",",
"StringBinding",
".",
"stringToEntry",
"(",
"origin",
".",
"getPath",
"(",
")",
")",
")",
";",
"return",
"true",
";",
"}"
] |
Renames {@code origin} file to the specified {@code newPath} and returns {@code true} if the file was actually
renamed. Otherwise another file with the path {@code newPath} exists. File contents and file descriptor are
not affected.
@param txn {@linkplain Transaction} instance
@param origin origin {@linkplain File}
@param newPath new name of the file
@return {@code true} if the file was actually renamed, otherwise another file with the path {@code newPath} exists
@see File
@see File#getDescriptor()
|
[
"Renames",
"{",
"@code",
"origin",
"}",
"file",
"to",
"the",
"specified",
"{",
"@code",
"newPath",
"}",
"and",
"returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"file",
"was",
"actually",
"renamed",
".",
"Otherwise",
"another",
"file",
"with",
"the",
"path",
"{",
"@code",
"newPath",
"}",
"exists",
".",
"File",
"contents",
"and",
"file",
"descriptor",
"are",
"not",
"affected",
"."
] |
train
|
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L289-L299
|
couchbase/couchbase-lite-java
|
src/main/java/com/couchbase/lite/MutableDocument.java
|
MutableDocument.setArray
|
@NonNull
@Override
public MutableDocument setArray(@NonNull String key, Array value) {
"""
Set an Array value for the given key
@param key the key.
@param key the Array value.
@return this MutableDocument instance
"""
return setValue(key, value);
}
|
java
|
@NonNull
@Override
public MutableDocument setArray(@NonNull String key, Array value) {
return setValue(key, value);
}
|
[
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDocument",
"setArray",
"(",
"@",
"NonNull",
"String",
"key",
",",
"Array",
"value",
")",
"{",
"return",
"setValue",
"(",
"key",
",",
"value",
")",
";",
"}"
] |
Set an Array value for the given key
@param key the key.
@param key the Array value.
@return this MutableDocument instance
|
[
"Set",
"an",
"Array",
"value",
"for",
"the",
"given",
"key"
] |
train
|
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L275-L279
|
elki-project/elki
|
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Clustering.java
|
Clustering.addChildCluster
|
public void addChildCluster(Cluster<M> parent, Cluster<M> child) {
"""
Add a cluster to the clustering.
@param parent Parent cluster
@param child Child cluster.
"""
hierarchy.add(parent, child);
}
|
java
|
public void addChildCluster(Cluster<M> parent, Cluster<M> child) {
hierarchy.add(parent, child);
}
|
[
"public",
"void",
"addChildCluster",
"(",
"Cluster",
"<",
"M",
">",
"parent",
",",
"Cluster",
"<",
"M",
">",
"child",
")",
"{",
"hierarchy",
".",
"add",
"(",
"parent",
",",
"child",
")",
";",
"}"
] |
Add a cluster to the clustering.
@param parent Parent cluster
@param child Child cluster.
|
[
"Add",
"a",
"cluster",
"to",
"the",
"clustering",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Clustering.java#L116-L118
|
deeplearning4j/deeplearning4j
|
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java
|
WeightInitUtil.initWeights
|
@Deprecated
public static INDArray initWeights(double fanIn, double fanOut, int[] shape, WeightInit initScheme,
Distribution dist, INDArray paramView) {
"""
Initializes a matrix with the given weight initialization scheme.
Note: Defaults to fortran ('f') order arrays for the weights. Use {@link #initWeights(int[], WeightInit, Distribution, char, INDArray)}
to control this
@param shape the shape of the matrix
@param initScheme the scheme to use
@return a matrix of the specified dimensions with the specified
distribution based on the initialization scheme
"""
return initWeights(fanIn, fanOut, ArrayUtil.toLongArray(shape), initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView);
}
|
java
|
@Deprecated
public static INDArray initWeights(double fanIn, double fanOut, int[] shape, WeightInit initScheme,
Distribution dist, INDArray paramView) {
return initWeights(fanIn, fanOut, ArrayUtil.toLongArray(shape), initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView);
}
|
[
"@",
"Deprecated",
"public",
"static",
"INDArray",
"initWeights",
"(",
"double",
"fanIn",
",",
"double",
"fanOut",
",",
"int",
"[",
"]",
"shape",
",",
"WeightInit",
"initScheme",
",",
"Distribution",
"dist",
",",
"INDArray",
"paramView",
")",
"{",
"return",
"initWeights",
"(",
"fanIn",
",",
"fanOut",
",",
"ArrayUtil",
".",
"toLongArray",
"(",
"shape",
")",
",",
"initScheme",
",",
"dist",
",",
"DEFAULT_WEIGHT_INIT_ORDER",
",",
"paramView",
")",
";",
"}"
] |
Initializes a matrix with the given weight initialization scheme.
Note: Defaults to fortran ('f') order arrays for the weights. Use {@link #initWeights(int[], WeightInit, Distribution, char, INDArray)}
to control this
@param shape the shape of the matrix
@param initScheme the scheme to use
@return a matrix of the specified dimensions with the specified
distribution based on the initialization scheme
|
[
"Initializes",
"a",
"matrix",
"with",
"the",
"given",
"weight",
"initialization",
"scheme",
".",
"Note",
":",
"Defaults",
"to",
"fortran",
"(",
"f",
")",
"order",
"arrays",
"for",
"the",
"weights",
".",
"Use",
"{",
"@link",
"#initWeights",
"(",
"int",
"[]",
"WeightInit",
"Distribution",
"char",
"INDArray",
")",
"}",
"to",
"control",
"this"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java#L59-L63
|
docusign/docusign-java-client
|
src/main/java/com/docusign/esign/api/UsersApi.java
|
UsersApi.getSignatureImage
|
public byte[] getSignatureImage(String accountId, String userId, String signatureId, String imageType) throws ApiException {
"""
Retrieves the user initials image or the user signature image for the specified user.
Retrieves the specified initials image or signature image for the specified user. The image is returned in the same format as uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image. The userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account. The `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. For example encode \"Bob Smith\" as \"Bob%20Smith\". ###### Note: Older envelopes might only have chromed images. If getting the non-chromed image fails, try getting the chromed image.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required)
@param signatureId The ID of the signature being accessed. (required)
@param imageType One of **signature_image** or **initials_image**. (required)
@return byte[]
"""
return getSignatureImage(accountId, userId, signatureId, imageType, null);
}
|
java
|
public byte[] getSignatureImage(String accountId, String userId, String signatureId, String imageType) throws ApiException {
return getSignatureImage(accountId, userId, signatureId, imageType, null);
}
|
[
"public",
"byte",
"[",
"]",
"getSignatureImage",
"(",
"String",
"accountId",
",",
"String",
"userId",
",",
"String",
"signatureId",
",",
"String",
"imageType",
")",
"throws",
"ApiException",
"{",
"return",
"getSignatureImage",
"(",
"accountId",
",",
"userId",
",",
"signatureId",
",",
"imageType",
",",
"null",
")",
";",
"}"
] |
Retrieves the user initials image or the user signature image for the specified user.
Retrieves the specified initials image or signature image for the specified user. The image is returned in the same format as uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image. The userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account. The `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. For example encode \"Bob Smith\" as \"Bob%20Smith\". ###### Note: Older envelopes might only have chromed images. If getting the non-chromed image fails, try getting the chromed image.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required)
@param signatureId The ID of the signature being accessed. (required)
@param imageType One of **signature_image** or **initials_image**. (required)
@return byte[]
|
[
"Retrieves",
"the",
"user",
"initials",
"image",
"or",
"the",
"user",
"signature",
"image",
"for",
"the",
"specified",
"user",
".",
"Retrieves",
"the",
"specified",
"initials",
"image",
"or",
"signature",
"image",
"for",
"the",
"specified",
"user",
".",
"The",
"image",
"is",
"returned",
"in",
"the",
"same",
"format",
"as",
"uploaded",
".",
"In",
"the",
"request",
"you",
"can",
"specify",
"if",
"the",
"chrome",
"(",
"the",
"added",
"line",
"and",
"identifier",
"around",
"the",
"initial",
"image",
")",
"is",
"returned",
"with",
"the",
"image",
".",
"The",
"userId",
"property",
"specified",
"in",
"the",
"endpoint",
"must",
"match",
"the",
"authenticated",
"user'",
";",
"s",
"user",
"ID",
"and",
"the",
"user",
"must",
"be",
"a",
"member",
"of",
"the",
"account",
".",
"The",
"`",
";",
"signatureId`",
";",
"parameter",
"accepts",
"a",
"signature",
"ID",
"or",
"a",
"signature",
"name",
".",
"DocuSign",
"recommends",
"you",
"use",
"signature",
"ID",
"(",
"`",
";",
"signatureId`",
";",
")",
"since",
"some",
"names",
"contain",
"characters",
"that",
"do",
"not",
"properly",
"encode",
"into",
"a",
"URL",
".",
"If",
"you",
"use",
"the",
"user",
"name",
"it",
"is",
"likely",
"that",
"the",
"name",
"includes",
"spaces",
".",
"In",
"that",
"case",
"URL",
"encode",
"the",
"name",
"before",
"using",
"it",
"in",
"the",
"endpoint",
".",
"For",
"example",
"encode",
"\\",
""",
";",
"Bob",
"Smith",
"\\",
""",
";",
"as",
"\\",
""",
";",
"Bob%20Smith",
"\\",
""",
";",
".",
"######",
"Note",
":",
"Older",
"envelopes",
"might",
"only",
"have",
"chromed",
"images",
".",
"If",
"getting",
"the",
"non",
"-",
"chromed",
"image",
"fails",
"try",
"getting",
"the",
"chromed",
"image",
"."
] |
train
|
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/UsersApi.java#L941-L943
|
santhosh-tekuri/jlibs
|
core/src/main/java/jlibs/core/util/CollectionUtil.java
|
CollectionUtil.readProperties
|
public static Properties readProperties(InputStream is, Properties props) throws IOException {
"""
Reads Properties from given inputStream and returns it.
NOTE: the given stream is closed by this method
"""
if(props==null)
props = new Properties();
try{
props.load(is);
}finally{
is.close();
}
return props;
}
|
java
|
public static Properties readProperties(InputStream is, Properties props) throws IOException{
if(props==null)
props = new Properties();
try{
props.load(is);
}finally{
is.close();
}
return props;
}
|
[
"public",
"static",
"Properties",
"readProperties",
"(",
"InputStream",
"is",
",",
"Properties",
"props",
")",
"throws",
"IOException",
"{",
"if",
"(",
"props",
"==",
"null",
")",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"props",
".",
"load",
"(",
"is",
")",
";",
"}",
"finally",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"return",
"props",
";",
"}"
] |
Reads Properties from given inputStream and returns it.
NOTE: the given stream is closed by this method
|
[
"Reads",
"Properties",
"from",
"given",
"inputStream",
"and",
"returns",
"it",
".",
"NOTE",
":",
"the",
"given",
"stream",
"is",
"closed",
"by",
"this",
"method"
] |
train
|
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/util/CollectionUtil.java#L34-L43
|
lestard/assertj-javafx
|
src/main/java/eu/lestard/assertj/javafx/api/DoubleBindingAssert.java
|
DoubleBindingAssert.hasValue
|
public DoubleBindingAssert hasValue(Double expectedValue, Offset offset) {
"""
Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one.
"""
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
}
|
java
|
public DoubleBindingAssert hasValue(Double expectedValue, Offset offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
}
|
[
"public",
"DoubleBindingAssert",
"hasValue",
"(",
"Double",
"expectedValue",
",",
"Offset",
"offset",
")",
"{",
"new",
"ObservableNumberValueAssertions",
"(",
"actual",
")",
".",
"hasValue",
"(",
"expectedValue",
",",
"offset",
")",
";",
"return",
"this",
";",
"}"
] |
Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one.
|
[
"Verifies",
"that",
"the",
"actual",
"observable",
"number",
"has",
"a",
"value",
"that",
"is",
"close",
"to",
"the",
"given",
"one",
"by",
"less",
"then",
"the",
"given",
"offset",
"."
] |
train
|
https://github.com/lestard/assertj-javafx/blob/f6b4d22e542a5501c7c1c2fae8700b0f69b956c1/src/main/java/eu/lestard/assertj/javafx/api/DoubleBindingAssert.java#L47-L51
|
Azure/azure-sdk-for-java
|
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java
|
DatabasesInner.beginUpdateAsync
|
public Observable<DatabaseInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) {
"""
Updates a database.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param parameters The database parameters supplied to the Update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseInner object
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<DatabaseInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"DatabaseInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"DatabaseUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"databaseName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DatabaseInner",
">",
",",
"DatabaseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DatabaseInner",
"call",
"(",
"ServiceResponse",
"<",
"DatabaseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Updates a database.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param parameters The database parameters supplied to the Update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseInner object
|
[
"Updates",
"a",
"database",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L705-L712
|
goldmansachs/gs-collections
|
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
|
StringIterate.occurrencesOfCodePoint
|
public static int occurrencesOfCodePoint(String string, final int value) {
"""
Count the number of occurrences of the specified int code point.
@since 7.0
"""
return StringIterate.countCodePoint(string, new CodePointPredicate()
{
public boolean accept(int codePoint)
{
return value == codePoint;
}
});
}
|
java
|
public static int occurrencesOfCodePoint(String string, final int value)
{
return StringIterate.countCodePoint(string, new CodePointPredicate()
{
public boolean accept(int codePoint)
{
return value == codePoint;
}
});
}
|
[
"public",
"static",
"int",
"occurrencesOfCodePoint",
"(",
"String",
"string",
",",
"final",
"int",
"value",
")",
"{",
"return",
"StringIterate",
".",
"countCodePoint",
"(",
"string",
",",
"new",
"CodePointPredicate",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"int",
"codePoint",
")",
"{",
"return",
"value",
"==",
"codePoint",
";",
"}",
"}",
")",
";",
"}"
] |
Count the number of occurrences of the specified int code point.
@since 7.0
|
[
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"specified",
"int",
"code",
"point",
"."
] |
train
|
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L763-L772
|
deeplearning4j/deeplearning4j
|
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java
|
AtomicAllocator.memcpyAsync
|
@Override
public void memcpyAsync(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset) {
"""
This method implements asynchronous memcpy, if that's available on current hardware
@param dstBuffer
@param srcPointer
@param length
@param dstOffset
"""
// if (dstBuffer.isConstant()) {
// this.memoryHandler.memcpySpecial(dstBuffer, srcPointer, length, dstOffset);
// } else
this.memoryHandler.memcpyAsync(dstBuffer, srcPointer, length, dstOffset);
}
|
java
|
@Override
public void memcpyAsync(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset) {
// if (dstBuffer.isConstant()) {
// this.memoryHandler.memcpySpecial(dstBuffer, srcPointer, length, dstOffset);
// } else
this.memoryHandler.memcpyAsync(dstBuffer, srcPointer, length, dstOffset);
}
|
[
"@",
"Override",
"public",
"void",
"memcpyAsync",
"(",
"DataBuffer",
"dstBuffer",
",",
"Pointer",
"srcPointer",
",",
"long",
"length",
",",
"long",
"dstOffset",
")",
"{",
"// if (dstBuffer.isConstant()) {",
"// this.memoryHandler.memcpySpecial(dstBuffer, srcPointer, length, dstOffset);",
"// } else",
"this",
".",
"memoryHandler",
".",
"memcpyAsync",
"(",
"dstBuffer",
",",
"srcPointer",
",",
"length",
",",
"dstOffset",
")",
";",
"}"
] |
This method implements asynchronous memcpy, if that's available on current hardware
@param dstBuffer
@param srcPointer
@param length
@param dstOffset
|
[
"This",
"method",
"implements",
"asynchronous",
"memcpy",
"if",
"that",
"s",
"available",
"on",
"current",
"hardware"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java#L949-L955
|
codeprimate-software/cp-elements
|
src/main/java/org/cp/elements/util/ArrayUtils.java
|
ArrayUtils.append
|
public static <T> T[] append(T element, T[] array) {
"""
Adds (inserts) the element to the end of the array.
@param <T> Class type of the elements stored in the array.
@param element element to insert at the end of the array.
@param array array in which to insert the element.
@return a new array with the element inserted at the end.
@throws IllegalArgumentException if the array is null.
@see #insert(Object, Object[], int)
@see #count(Object[])
"""
return insert(element, array, count(array));
}
|
java
|
public static <T> T[] append(T element, T[] array) {
return insert(element, array, count(array));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"append",
"(",
"T",
"element",
",",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"insert",
"(",
"element",
",",
"array",
",",
"count",
"(",
"array",
")",
")",
";",
"}"
] |
Adds (inserts) the element to the end of the array.
@param <T> Class type of the elements stored in the array.
@param element element to insert at the end of the array.
@param array array in which to insert the element.
@return a new array with the element inserted at the end.
@throws IllegalArgumentException if the array is null.
@see #insert(Object, Object[], int)
@see #count(Object[])
|
[
"Adds",
"(",
"inserts",
")",
"the",
"element",
"to",
"the",
"end",
"of",
"the",
"array",
"."
] |
train
|
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L81-L83
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.