repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteCustomEntityRole | public OperationStatus deleteCustomEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
"""
Delete an entity role.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful.
"""
return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | java | public OperationStatus deleteCustomEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deleteCustomEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"deleteCustomEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
"roleId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Delete an entity role.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Delete",
"an",
"entity",
"role",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13868-L13870 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Db.java | Db.findFirst | public static Record findFirst(String sql, Object... paras) {
"""
Find first record. I recommend add "limit 1" in your sql.
@param sql an SQL statement that may contain one or more '?' IN parameter placeholders
@param paras the parameters of sql
@return the Record object
"""
return MAIN.findFirst(sql, paras);
} | java | public static Record findFirst(String sql, Object... paras) {
return MAIN.findFirst(sql, paras);
} | [
"public",
"static",
"Record",
"findFirst",
"(",
"String",
"sql",
",",
"Object",
"...",
"paras",
")",
"{",
"return",
"MAIN",
".",
"findFirst",
"(",
"sql",
",",
"paras",
")",
";",
"}"
] | Find first record. I recommend add "limit 1" in your sql.
@param sql an SQL statement that may contain one or more '?' IN parameter placeholders
@param paras the parameters of sql
@return the Record object | [
"Find",
"first",
"record",
".",
"I",
"recommend",
"add",
"limit",
"1",
"in",
"your",
"sql",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Db.java#L292-L294 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.replaceAll | public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
"""
Replaces each substring of this CharSequence that matches the given
regular expression with the given replacement.
@param self a CharSequence
@param regex the capturing regex
@param replacement the string to be substituted for each match
@return the toString() of the CharSequence with content replaced
@throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
@see String#replaceAll(String, String)
@since 1.8.2
"""
return self.toString().replaceAll(regex.toString(), replacement.toString());
} | java | public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) {
return self.toString().replaceAll(regex.toString(), replacement.toString());
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"CharSequence",
"self",
",",
"final",
"CharSequence",
"regex",
",",
"final",
"CharSequence",
"replacement",
")",
"{",
"return",
"self",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"regex",
".",
"toString",
"(",
")",
",",
"replacement",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Replaces each substring of this CharSequence that matches the given
regular expression with the given replacement.
@param self a CharSequence
@param regex the capturing regex
@param replacement the string to be substituted for each match
@return the toString() of the CharSequence with content replaced
@throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
@see String#replaceAll(String, String)
@since 1.8.2 | [
"Replaces",
"each",
"substring",
"of",
"this",
"CharSequence",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2468-L2470 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getMetadataWithChildrenC | public <C> DbxEntry./*@Nullable*/WithChildrenC<C> getMetadataWithChildrenC(String path, boolean includeMediaInfo, final Collector<DbxEntry, ? extends C> collector)
throws DbxException {
"""
Same as {@link #getMetadataWithChildren} except instead of always returning a list of
{@link DbxEntry} objects, you specify a {@link Collector} that processes the {@link DbxEntry}
objects one by one and aggregates them however you want.
<p>
This allows your to process the {@link DbxEntry} values as they arrive, instead of having to
wait for the entire API call to finish before processing the first one. Be careful, though,
because the API call may fail in the middle (after you've already processed some entries).
Make sure your code can handle that situation. For example, if you're inserting stuff into a
database as they arrive, you might want do everything in a transaction and commit only if
the entire call succeeds.
</p>
"""
return getMetadataWithChildrenBase(path, includeMediaInfo, new DbxEntry.WithChildrenC.ReaderMaybeDeleted<C>(collector));
} | java | public <C> DbxEntry./*@Nullable*/WithChildrenC<C> getMetadataWithChildrenC(String path, boolean includeMediaInfo, final Collector<DbxEntry, ? extends C> collector)
throws DbxException
{
return getMetadataWithChildrenBase(path, includeMediaInfo, new DbxEntry.WithChildrenC.ReaderMaybeDeleted<C>(collector));
} | [
"public",
"<",
"C",
">",
"DbxEntry",
".",
"/*@Nullable*/",
"WithChildrenC",
"<",
"C",
">",
"getMetadataWithChildrenC",
"(",
"String",
"path",
",",
"boolean",
"includeMediaInfo",
",",
"final",
"Collector",
"<",
"DbxEntry",
",",
"?",
"extends",
"C",
">",
"collector",
")",
"throws",
"DbxException",
"{",
"return",
"getMetadataWithChildrenBase",
"(",
"path",
",",
"includeMediaInfo",
",",
"new",
"DbxEntry",
".",
"WithChildrenC",
".",
"ReaderMaybeDeleted",
"<",
"C",
">",
"(",
"collector",
")",
")",
";",
"}"
] | Same as {@link #getMetadataWithChildren} except instead of always returning a list of
{@link DbxEntry} objects, you specify a {@link Collector} that processes the {@link DbxEntry}
objects one by one and aggregates them however you want.
<p>
This allows your to process the {@link DbxEntry} values as they arrive, instead of having to
wait for the entire API call to finish before processing the first one. Be careful, though,
because the API call may fail in the middle (after you've already processed some entries).
Make sure your code can handle that situation. For example, if you're inserting stuff into a
database as they arrive, you might want do everything in a transaction and commit only if
the entire call succeeds.
</p> | [
"Same",
"as",
"{",
"@link",
"#getMetadataWithChildren",
"}",
"except",
"instead",
"of",
"always",
"returning",
"a",
"list",
"of",
"{",
"@link",
"DbxEntry",
"}",
"objects",
"you",
"specify",
"a",
"{",
"@link",
"Collector",
"}",
"that",
"processes",
"the",
"{",
"@link",
"DbxEntry",
"}",
"objects",
"one",
"by",
"one",
"and",
"aggregates",
"them",
"however",
"you",
"want",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L204-L208 |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataCollection.java | TransposeDataCollection.put | public final FlatDataCollection put(Object key, FlatDataCollection value) {
"""
Adds a particular key-value into the internal map. It returns the previous
value which was associated with that key.
@param key
@param value
@return
"""
return internalData.put(key, value);
} | java | public final FlatDataCollection put(Object key, FlatDataCollection value) {
return internalData.put(key, value);
} | [
"public",
"final",
"FlatDataCollection",
"put",
"(",
"Object",
"key",
",",
"FlatDataCollection",
"value",
")",
"{",
"return",
"internalData",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Adds a particular key-value into the internal map. It returns the previous
value which was associated with that key.
@param key
@param value
@return | [
"Adds",
"a",
"particular",
"key",
"-",
"value",
"into",
"the",
"internal",
"map",
".",
"It",
"returns",
"the",
"previous",
"value",
"which",
"was",
"associated",
"with",
"that",
"key",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataCollection.java#L79-L81 |
jbundle/jbundle | thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java | JHtmlView.linkActivated | public void linkActivated(URL url, BaseApplet applet, int iOptions) {
"""
Follows the reference in an
link. The given url is the requested reference.
By default this calls <a href="#setPage">setPage</a>,
and if an exception is thrown the original previous
document is restored and a beep sounded. If an
attempt was made to follow a link, but it represented
a malformed url, this method will be called with a
null argument.
@param url the URL to follow
"""
m_editorPane.linkActivated(url, applet, iOptions);
} | java | public void linkActivated(URL url, BaseApplet applet, int iOptions)
{
m_editorPane.linkActivated(url, applet, iOptions);
} | [
"public",
"void",
"linkActivated",
"(",
"URL",
"url",
",",
"BaseApplet",
"applet",
",",
"int",
"iOptions",
")",
"{",
"m_editorPane",
".",
"linkActivated",
"(",
"url",
",",
"applet",
",",
"iOptions",
")",
";",
"}"
] | Follows the reference in an
link. The given url is the requested reference.
By default this calls <a href="#setPage">setPage</a>,
and if an exception is thrown the original previous
document is restored and a beep sounded. If an
attempt was made to follow a link, but it represented
a malformed url, this method will be called with a
null argument.
@param url the URL to follow | [
"Follows",
"the",
"reference",
"in",
"an",
"link",
".",
"The",
"given",
"url",
"is",
"the",
"requested",
"reference",
".",
"By",
"default",
"this",
"calls",
"<a",
"href",
"=",
"#setPage",
">",
"setPage<",
"/",
"a",
">",
"and",
"if",
"an",
"exception",
"is",
"thrown",
"the",
"original",
"previous",
"document",
"is",
"restored",
"and",
"a",
"beep",
"sounded",
".",
"If",
"an",
"attempt",
"was",
"made",
"to",
"follow",
"a",
"link",
"but",
"it",
"represented",
"a",
"malformed",
"url",
"this",
"method",
"will",
"be",
"called",
"with",
"a",
"null",
"argument",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java#L225-L228 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java | DurationHelper.getDurationByTimeValues | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
"""
converts values of time constants to a Duration object..
@param hours
count of hours
@param minutes
count of minutes
@param seconds
count of seconds
@return duration
"""
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | java | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | [
"public",
"static",
"Duration",
"getDurationByTimeValues",
"(",
"final",
"long",
"hours",
",",
"final",
"long",
"minutes",
",",
"final",
"long",
"seconds",
")",
"{",
"return",
"Duration",
".",
"ofHours",
"(",
"hours",
")",
".",
"plusMinutes",
"(",
"minutes",
")",
".",
"plusSeconds",
"(",
"seconds",
")",
";",
"}"
] | converts values of time constants to a Duration object..
@param hours
count of hours
@param minutes
count of minutes
@param seconds
count of seconds
@return duration | [
"converts",
"values",
"of",
"time",
"constants",
"to",
"a",
"Duration",
"object",
".."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java#L118-L120 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.findNodeInList | public ModelNode findNodeInList(Address addr, String haystack, String needle) throws Exception {
"""
This tries to find specific node within a list of nodes. Given an address and a named node
at that address (the "haystack"), it is assumed that haystack is actually a list of other
nodes. This method looks in the haystack and tries to find the named needle. If it finds it,
that list item is returned. If it does not find the needle in the haystack, it returns null.
For example, if you want to find a specific datasource in the list of datasources, you
can pass in the address for the datasource subsystem, and ask to look in the data-source
node list (the haystack) and return the named datasource (the needle).
@param addr resource address
@param haystack the collection
@param needle the item to find in the collection
@return the found item or null if not found
@throws Exception if the lookup fails for some reason
"""
final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
final ModelNode results = execute(queryNode);
if (isSuccess(results)) {
final ModelNode haystackNode = getResults(results).get(haystack);
if (haystackNode.getType() != ModelType.UNDEFINED) {
final List<ModelNode> haystackList = haystackNode.asList();
for (ModelNode needleNode : haystackList) {
if (needleNode.has(needle)) {
return needleNode;
}
}
}
return null;
} else {
throw new FailureException(results, "Failed to get data for [" + addr + "]");
}
} | java | public ModelNode findNodeInList(Address addr, String haystack, String needle) throws Exception {
final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
final ModelNode results = execute(queryNode);
if (isSuccess(results)) {
final ModelNode haystackNode = getResults(results).get(haystack);
if (haystackNode.getType() != ModelType.UNDEFINED) {
final List<ModelNode> haystackList = haystackNode.asList();
for (ModelNode needleNode : haystackList) {
if (needleNode.has(needle)) {
return needleNode;
}
}
}
return null;
} else {
throw new FailureException(results, "Failed to get data for [" + addr + "]");
}
} | [
"public",
"ModelNode",
"findNodeInList",
"(",
"Address",
"addr",
",",
"String",
"haystack",
",",
"String",
"needle",
")",
"throws",
"Exception",
"{",
"final",
"ModelNode",
"queryNode",
"=",
"createRequest",
"(",
"READ_RESOURCE",
",",
"addr",
")",
";",
"final",
"ModelNode",
"results",
"=",
"execute",
"(",
"queryNode",
")",
";",
"if",
"(",
"isSuccess",
"(",
"results",
")",
")",
"{",
"final",
"ModelNode",
"haystackNode",
"=",
"getResults",
"(",
"results",
")",
".",
"get",
"(",
"haystack",
")",
";",
"if",
"(",
"haystackNode",
".",
"getType",
"(",
")",
"!=",
"ModelType",
".",
"UNDEFINED",
")",
"{",
"final",
"List",
"<",
"ModelNode",
">",
"haystackList",
"=",
"haystackNode",
".",
"asList",
"(",
")",
";",
"for",
"(",
"ModelNode",
"needleNode",
":",
"haystackList",
")",
"{",
"if",
"(",
"needleNode",
".",
"has",
"(",
"needle",
")",
")",
"{",
"return",
"needleNode",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"else",
"{",
"throw",
"new",
"FailureException",
"(",
"results",
",",
"\"Failed to get data for [\"",
"+",
"addr",
"+",
"\"]\"",
")",
";",
"}",
"}"
] | This tries to find specific node within a list of nodes. Given an address and a named node
at that address (the "haystack"), it is assumed that haystack is actually a list of other
nodes. This method looks in the haystack and tries to find the named needle. If it finds it,
that list item is returned. If it does not find the needle in the haystack, it returns null.
For example, if you want to find a specific datasource in the list of datasources, you
can pass in the address for the datasource subsystem, and ask to look in the data-source
node list (the haystack) and return the named datasource (the needle).
@param addr resource address
@param haystack the collection
@param needle the item to find in the collection
@return the found item or null if not found
@throws Exception if the lookup fails for some reason | [
"This",
"tries",
"to",
"find",
"specific",
"node",
"within",
"a",
"list",
"of",
"nodes",
".",
"Given",
"an",
"address",
"and",
"a",
"named",
"node",
"at",
"that",
"address",
"(",
"the",
"haystack",
")",
"it",
"is",
"assumed",
"that",
"haystack",
"is",
"actually",
"a",
"list",
"of",
"other",
"nodes",
".",
"This",
"method",
"looks",
"in",
"the",
"haystack",
"and",
"tries",
"to",
"find",
"the",
"named",
"needle",
".",
"If",
"it",
"finds",
"it",
"that",
"list",
"item",
"is",
"returned",
".",
"If",
"it",
"does",
"not",
"find",
"the",
"needle",
"in",
"the",
"haystack",
"it",
"returns",
"null",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L417-L434 |
jaxio/javaee-lab | javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java | GenericRepository.getVersionAttribute | protected SingularAttribute<? super E, ?> getVersionAttribute(EntityType<E> entityType) {
"""
/*
_HACK_ too bad that JPA does not provide this entityType.getVersion();
<p>
http://stackoverflow.com/questions/13265094/generic-way-to-get-jpa-entity-version
"""
for (SingularAttribute<? super E, ?> sa : entityType.getSingularAttributes()) {
if (sa.isVersion()) {
return sa;
}
}
return null;
} | java | protected SingularAttribute<? super E, ?> getVersionAttribute(EntityType<E> entityType) {
for (SingularAttribute<? super E, ?> sa : entityType.getSingularAttributes()) {
if (sa.isVersion()) {
return sa;
}
}
return null;
} | [
"protected",
"SingularAttribute",
"<",
"?",
"super",
"E",
",",
"?",
">",
"getVersionAttribute",
"(",
"EntityType",
"<",
"E",
">",
"entityType",
")",
"{",
"for",
"(",
"SingularAttribute",
"<",
"?",
"super",
"E",
",",
"?",
">",
"sa",
":",
"entityType",
".",
"getSingularAttributes",
"(",
")",
")",
"{",
"if",
"(",
"sa",
".",
"isVersion",
"(",
")",
")",
"{",
"return",
"sa",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | /*
_HACK_ too bad that JPA does not provide this entityType.getVersion();
<p>
http://stackoverflow.com/questions/13265094/generic-way-to-get-jpa-entity-version | [
"/",
"*",
"_HACK_",
"too",
"bad",
"that",
"JPA",
"does",
"not",
"provide",
"this",
"entityType",
".",
"getVersion",
"()",
";",
"<p",
">",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"13265094",
"/",
"generic",
"-",
"way",
"-",
"to",
"-",
"get",
"-",
"jpa",
"-",
"entity",
"-",
"version"
] | train | https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L679-L686 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java | UriComponentsBuilder.queryParam | public UriComponentsBuilder queryParam(String name, Object... values) {
"""
Append the given query parameter to the existing query parameters. The
given name or any of the values may contain URI template variables. If no
values are given, the resulting URI will contain the query parameter name
only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
@param name the query parameter name
@param values the query parameter values
@return this UriComponentsBuilder
"""
Assert.notNull(name, "'name' must not be null");
if (!ObjectUtils.isEmpty(values)) {
for (Object value : values) {
String valueAsString = (value != null ? value.toString() : null);
this.queryParams.add(name, valueAsString);
}
}
else {
this.queryParams.add(name, null);
}
resetSchemeSpecificPart();
return this;
} | java | public UriComponentsBuilder queryParam(String name, Object... values) {
Assert.notNull(name, "'name' must not be null");
if (!ObjectUtils.isEmpty(values)) {
for (Object value : values) {
String valueAsString = (value != null ? value.toString() : null);
this.queryParams.add(name, valueAsString);
}
}
else {
this.queryParams.add(name, null);
}
resetSchemeSpecificPart();
return this;
} | [
"public",
"UriComponentsBuilder",
"queryParam",
"(",
"String",
"name",
",",
"Object",
"...",
"values",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"'name' must not be null\"",
")",
";",
"if",
"(",
"!",
"ObjectUtils",
".",
"isEmpty",
"(",
"values",
")",
")",
"{",
"for",
"(",
"Object",
"value",
":",
"values",
")",
"{",
"String",
"valueAsString",
"=",
"(",
"value",
"!=",
"null",
"?",
"value",
".",
"toString",
"(",
")",
":",
"null",
")",
";",
"this",
".",
"queryParams",
".",
"add",
"(",
"name",
",",
"valueAsString",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"queryParams",
".",
"add",
"(",
"name",
",",
"null",
")",
";",
"}",
"resetSchemeSpecificPart",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Append the given query parameter to the existing query parameters. The
given name or any of the values may contain URI template variables. If no
values are given, the resulting URI will contain the query parameter name
only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
@param name the query parameter name
@param values the query parameter values
@return this UriComponentsBuilder | [
"Append",
"the",
"given",
"query",
"parameter",
"to",
"the",
"existing",
"query",
"parameters",
".",
"The",
"given",
"name",
"or",
"any",
"of",
"the",
"values",
"may",
"contain",
"URI",
"template",
"variables",
".",
"If",
"no",
"values",
"are",
"given",
"the",
"resulting",
"URI",
"will",
"contain",
"the",
"query",
"parameter",
"name",
"only",
"(",
"i",
".",
"e",
".",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriComponentsBuilder.java#L570-L583 |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.getBatchReceiver | public BatchReceiver getBatchReceiver(String queueName, long timeout) {
"""
Generate a {@link BatchReceiver} to receive and process stored messages.
This method ALWAYS works in the context of a transaction.
@param queueName name of queue
@param timeout timeout to wait.
@return instance of {@link BatchReceiver}.
"""
try {
return new BatchReceiver((Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName), timeout, consumerConnection);
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public BatchReceiver getBatchReceiver(String queueName, long timeout){
try {
return new BatchReceiver((Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName), timeout, consumerConnection);
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"BatchReceiver",
"getBatchReceiver",
"(",
"String",
"queueName",
",",
"long",
"timeout",
")",
"{",
"try",
"{",
"return",
"new",
"BatchReceiver",
"(",
"(",
"Queue",
")",
"jmsServer",
".",
"lookup",
"(",
"QUEUE_NAMESPACE",
"+",
"queueName",
")",
",",
"timeout",
",",
"consumerConnection",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncException",
"(",
"e",
")",
";",
"}",
"}"
] | Generate a {@link BatchReceiver} to receive and process stored messages.
This method ALWAYS works in the context of a transaction.
@param queueName name of queue
@param timeout timeout to wait.
@return instance of {@link BatchReceiver}. | [
"Generate",
"a",
"{",
"@link",
"BatchReceiver",
"}",
"to",
"receive",
"and",
"process",
"stored",
"messages",
".",
"This",
"method",
"ALWAYS",
"works",
"in",
"the",
"context",
"of",
"a",
"transaction",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L528-L534 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/image/Planar.java | Planar.get32u8 | public int get32u8( int x , int y ) {
"""
Returns an integer formed from 4 bands. band[0]<<24 | band[1] << 16 | band[2]<<8 | band[3]. Assumes
arrays are U8 type.
@param x column
@param y row
@return 32 bit integer
"""
int i = startIndex + y*stride+x;
return ((((GrayU8)bands[0]).data[i]&0xFF) << 24) |
((((GrayU8)bands[1]).data[i]&0xFF) << 16) |
((((GrayU8)bands[2]).data[i]&0xFF) << 8) |
(((GrayU8)bands[3]).data[i]&0xFF);
} | java | public int get32u8( int x , int y ) {
int i = startIndex + y*stride+x;
return ((((GrayU8)bands[0]).data[i]&0xFF) << 24) |
((((GrayU8)bands[1]).data[i]&0xFF) << 16) |
((((GrayU8)bands[2]).data[i]&0xFF) << 8) |
(((GrayU8)bands[3]).data[i]&0xFF);
} | [
"public",
"int",
"get32u8",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"i",
"=",
"startIndex",
"+",
"y",
"*",
"stride",
"+",
"x",
";",
"return",
"(",
"(",
"(",
"(",
"GrayU8",
")",
"bands",
"[",
"0",
"]",
")",
".",
"data",
"[",
"i",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"(",
"(",
"GrayU8",
")",
"bands",
"[",
"1",
"]",
")",
".",
"data",
"[",
"i",
"]",
"&",
"0xFF",
")",
"<<",
"16",
")",
"|",
"(",
"(",
"(",
"(",
"GrayU8",
")",
"bands",
"[",
"2",
"]",
")",
".",
"data",
"[",
"i",
"]",
"&",
"0xFF",
")",
"<<",
"8",
")",
"|",
"(",
"(",
"(",
"GrayU8",
")",
"bands",
"[",
"3",
"]",
")",
".",
"data",
"[",
"i",
"]",
"&",
"0xFF",
")",
";",
"}"
] | Returns an integer formed from 4 bands. band[0]<<24 | band[1] << 16 | band[2]<<8 | band[3]. Assumes
arrays are U8 type.
@param x column
@param y row
@return 32 bit integer | [
"Returns",
"an",
"integer",
"formed",
"from",
"4",
"bands",
".",
"band",
"[",
"0",
"]",
"<<24",
"|",
"band",
"[",
"1",
"]",
"<<",
"16",
"|",
"band",
"[",
"2",
"]",
"<<8",
"|",
"band",
"[",
"3",
"]",
".",
"Assumes",
"arrays",
"are",
"U8",
"type",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/Planar.java#L322-L328 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.setDefault | public static synchronized void setDefault(Category category, ULocale newLocale) {
"""
Sets the default <code>ULocale</code> for the specified <code>Category</code>.
This also sets the default <code>Locale</code> for the specified <code>Category</code>
of the JVM. If the caller does not have write permission to the
user.language property, a security exception will be thrown,
and the default ULocale for the specified Category will remain unchanged.
@param category the specified category to set the default locale
@param newLocale the new default locale
@see SecurityManager#checkPermission(java.security.Permission)
@see java.util.PropertyPermission
@hide unsupported on Android
"""
Locale newJavaDefault = newLocale.toLocale();
int idx = category.ordinal();
defaultCategoryULocales[idx] = newLocale;
defaultCategoryLocales[idx] = newJavaDefault;
JDKLocaleHelper.setDefault(category, newJavaDefault);
} | java | public static synchronized void setDefault(Category category, ULocale newLocale) {
Locale newJavaDefault = newLocale.toLocale();
int idx = category.ordinal();
defaultCategoryULocales[idx] = newLocale;
defaultCategoryLocales[idx] = newJavaDefault;
JDKLocaleHelper.setDefault(category, newJavaDefault);
} | [
"public",
"static",
"synchronized",
"void",
"setDefault",
"(",
"Category",
"category",
",",
"ULocale",
"newLocale",
")",
"{",
"Locale",
"newJavaDefault",
"=",
"newLocale",
".",
"toLocale",
"(",
")",
";",
"int",
"idx",
"=",
"category",
".",
"ordinal",
"(",
")",
";",
"defaultCategoryULocales",
"[",
"idx",
"]",
"=",
"newLocale",
";",
"defaultCategoryLocales",
"[",
"idx",
"]",
"=",
"newJavaDefault",
";",
"JDKLocaleHelper",
".",
"setDefault",
"(",
"category",
",",
"newJavaDefault",
")",
";",
"}"
] | Sets the default <code>ULocale</code> for the specified <code>Category</code>.
This also sets the default <code>Locale</code> for the specified <code>Category</code>
of the JVM. If the caller does not have write permission to the
user.language property, a security exception will be thrown,
and the default ULocale for the specified Category will remain unchanged.
@param category the specified category to set the default locale
@param newLocale the new default locale
@see SecurityManager#checkPermission(java.security.Permission)
@see java.util.PropertyPermission
@hide unsupported on Android | [
"Sets",
"the",
"default",
"<code",
">",
"ULocale<",
"/",
"code",
">",
"for",
"the",
"specified",
"<code",
">",
"Category<",
"/",
"code",
">",
".",
"This",
"also",
"sets",
"the",
"default",
"<code",
">",
"Locale<",
"/",
"code",
">",
"for",
"the",
"specified",
"<code",
">",
"Category<",
"/",
"code",
">",
"of",
"the",
"JVM",
".",
"If",
"the",
"caller",
"does",
"not",
"have",
"write",
"permission",
"to",
"the",
"user",
".",
"language",
"property",
"a",
"security",
"exception",
"will",
"be",
"thrown",
"and",
"the",
"default",
"ULocale",
"for",
"the",
"specified",
"Category",
"will",
"remain",
"unchanged",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L716-L722 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/SceneBlock.java | SceneBlock.blockKey | protected final int blockKey (int tx, int ty) {
"""
Computes the key for the block that holds the specified tile.
"""
int bx = MathUtil.floorDiv(tx, _bounds.width);
int by = MathUtil.floorDiv(ty, _bounds.height);
return MisoScenePanel.compose(bx, by);
} | java | protected final int blockKey (int tx, int ty)
{
int bx = MathUtil.floorDiv(tx, _bounds.width);
int by = MathUtil.floorDiv(ty, _bounds.height);
return MisoScenePanel.compose(bx, by);
} | [
"protected",
"final",
"int",
"blockKey",
"(",
"int",
"tx",
",",
"int",
"ty",
")",
"{",
"int",
"bx",
"=",
"MathUtil",
".",
"floorDiv",
"(",
"tx",
",",
"_bounds",
".",
"width",
")",
";",
"int",
"by",
"=",
"MathUtil",
".",
"floorDiv",
"(",
"ty",
",",
"_bounds",
".",
"height",
")",
";",
"return",
"MisoScenePanel",
".",
"compose",
"(",
"bx",
",",
"by",
")",
";",
"}"
] | Computes the key for the block that holds the specified tile. | [
"Computes",
"the",
"key",
"for",
"the",
"block",
"that",
"holds",
"the",
"specified",
"tile",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L547-L552 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java | BELUtilities.computeHashSHA256 | public static String computeHashSHA256(final InputStream input)
throws IOException {
"""
Computes a SHA-256 hash of data from the {@link InputStream input}.
@param input the data {@link InputStream input stream}, which cannot be
{@code null}
@return the {@link String SHA-256 hash}
@throws IOException Thrown if an IO error occurred reading from the
{@link InputStream input}
@throws InvalidArgument Thrown if {@code input} is {@code null}
"""
if (input == null) {
throw new InvalidArgument("input", input);
}
MessageDigest sha256;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new MissingAlgorithmException(SHA_256, e);
}
final DigestInputStream dis = new DigestInputStream(input, sha256);
while (dis.read() != -1) {}
byte[] mdbytes = sha256.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < mdbytes.length; i++) {
sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16)
.substring(1));
}
return sb.toString();
} | java | public static String computeHashSHA256(final InputStream input)
throws IOException {
if (input == null) {
throw new InvalidArgument("input", input);
}
MessageDigest sha256;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new MissingAlgorithmException(SHA_256, e);
}
final DigestInputStream dis = new DigestInputStream(input, sha256);
while (dis.read() != -1) {}
byte[] mdbytes = sha256.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < mdbytes.length; i++) {
sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16)
.substring(1));
}
return sb.toString();
} | [
"public",
"static",
"String",
"computeHashSHA256",
"(",
"final",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"input\"",
",",
"input",
")",
";",
"}",
"MessageDigest",
"sha256",
";",
"try",
"{",
"sha256",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA-256\"",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"throw",
"new",
"MissingAlgorithmException",
"(",
"SHA_256",
",",
"e",
")",
";",
"}",
"final",
"DigestInputStream",
"dis",
"=",
"new",
"DigestInputStream",
"(",
"input",
",",
"sha256",
")",
";",
"while",
"(",
"dis",
".",
"read",
"(",
")",
"!=",
"-",
"1",
")",
"{",
"}",
"byte",
"[",
"]",
"mdbytes",
"=",
"sha256",
".",
"digest",
"(",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mdbytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"(",
"mdbytes",
"[",
"i",
"]",
"&",
"0xff",
")",
"+",
"0x100",
",",
"16",
")",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Computes a SHA-256 hash of data from the {@link InputStream input}.
@param input the data {@link InputStream input stream}, which cannot be
{@code null}
@return the {@link String SHA-256 hash}
@throws IOException Thrown if an IO error occurred reading from the
{@link InputStream input}
@throws InvalidArgument Thrown if {@code input} is {@code null} | [
"Computes",
"a",
"SHA",
"-",
"256",
"hash",
"of",
"data",
"from",
"the",
"{",
"@link",
"InputStream",
"input",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L208-L233 |
google/identity-toolkit-java-client | src/main/java/com/google/identitytoolkit/GitkitClient.java | GitkitClient.getOobResponse | public OobResponse getOobResponse(HttpServletRequest req)
throws GitkitServerException {
"""
Gets out-of-band response. Used by oob endpoint for ResetPassword and ChangeEmail operation.
The web site needs to send user an email containing the oobUrl in the response. The user needs
to click the oobUrl to finish the operation.
@param req http request for the oob endpoint
@return the oob response.
@throws GitkitServerException
"""
String gitkitToken = lookupCookie(req, cookieName);
return getOobResponse(req, gitkitToken);
} | java | public OobResponse getOobResponse(HttpServletRequest req)
throws GitkitServerException {
String gitkitToken = lookupCookie(req, cookieName);
return getOobResponse(req, gitkitToken);
} | [
"public",
"OobResponse",
"getOobResponse",
"(",
"HttpServletRequest",
"req",
")",
"throws",
"GitkitServerException",
"{",
"String",
"gitkitToken",
"=",
"lookupCookie",
"(",
"req",
",",
"cookieName",
")",
";",
"return",
"getOobResponse",
"(",
"req",
",",
"gitkitToken",
")",
";",
"}"
] | Gets out-of-band response. Used by oob endpoint for ResetPassword and ChangeEmail operation.
The web site needs to send user an email containing the oobUrl in the response. The user needs
to click the oobUrl to finish the operation.
@param req http request for the oob endpoint
@return the oob response.
@throws GitkitServerException | [
"Gets",
"out",
"-",
"of",
"-",
"band",
"response",
".",
"Used",
"by",
"oob",
"endpoint",
"for",
"ResetPassword",
"and",
"ChangeEmail",
"operation",
".",
"The",
"web",
"site",
"needs",
"to",
"send",
"user",
"an",
"email",
"containing",
"the",
"oobUrl",
"in",
"the",
"response",
".",
"The",
"user",
"needs",
"to",
"click",
"the",
"oobUrl",
"to",
"finish",
"the",
"operation",
"."
] | train | https://github.com/google/identity-toolkit-java-client/blob/61dda1aabbd541ad5e431e840fd266bfca5f8a4a/src/main/java/com/google/identitytoolkit/GitkitClient.java#L444-L448 |
nextreports/nextreports-engine | src/ro/nextreports/engine/exporter/XlsxExporter.java | XlsxExporter.updateSubreportBandElementStyle | private XSSFCellStyle updateSubreportBandElementStyle(XSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) {
"""
If a border style is set on a ReportBandElement we must apply it to all subreport cells
"""
if (subreportCellStyle == null) {
return cellStyle;
}
if (gridColumn == 0) {
cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft());
cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor());
} else if (gridColumn+colSpan-1 == bean.getReportLayout().getColumnCount()-1) {
cellStyle.setBorderRight(subreportCellStyle.getBorderRight());
cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor());
}
if (pageRow == 0) {
cellStyle.setBorderTop(subreportCellStyle.getBorderTop());
cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor());
} else if ( (pageRow+1) == getRowsCount()) {
cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom());
cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor());
}
return cellStyle;
} | java | private XSSFCellStyle updateSubreportBandElementStyle(XSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) {
if (subreportCellStyle == null) {
return cellStyle;
}
if (gridColumn == 0) {
cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft());
cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor());
} else if (gridColumn+colSpan-1 == bean.getReportLayout().getColumnCount()-1) {
cellStyle.setBorderRight(subreportCellStyle.getBorderRight());
cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor());
}
if (pageRow == 0) {
cellStyle.setBorderTop(subreportCellStyle.getBorderTop());
cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor());
} else if ( (pageRow+1) == getRowsCount()) {
cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom());
cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor());
}
return cellStyle;
} | [
"private",
"XSSFCellStyle",
"updateSubreportBandElementStyle",
"(",
"XSSFCellStyle",
"cellStyle",
",",
"BandElement",
"bandElement",
",",
"Object",
"value",
",",
"int",
"gridRow",
",",
"int",
"gridColumn",
",",
"int",
"colSpan",
")",
"{",
"if",
"(",
"subreportCellStyle",
"==",
"null",
")",
"{",
"return",
"cellStyle",
";",
"}",
"if",
"(",
"gridColumn",
"==",
"0",
")",
"{",
"cellStyle",
".",
"setBorderLeft",
"(",
"subreportCellStyle",
".",
"getBorderLeft",
"(",
")",
")",
";",
"cellStyle",
".",
"setLeftBorderColor",
"(",
"subreportCellStyle",
".",
"getLeftBorderColor",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"gridColumn",
"+",
"colSpan",
"-",
"1",
"==",
"bean",
".",
"getReportLayout",
"(",
")",
".",
"getColumnCount",
"(",
")",
"-",
"1",
")",
"{",
"cellStyle",
".",
"setBorderRight",
"(",
"subreportCellStyle",
".",
"getBorderRight",
"(",
")",
")",
";",
"cellStyle",
".",
"setRightBorderColor",
"(",
"subreportCellStyle",
".",
"getRightBorderColor",
"(",
")",
")",
";",
"}",
"if",
"(",
"pageRow",
"==",
"0",
")",
"{",
"cellStyle",
".",
"setBorderTop",
"(",
"subreportCellStyle",
".",
"getBorderTop",
"(",
")",
")",
";",
"cellStyle",
".",
"setTopBorderColor",
"(",
"subreportCellStyle",
".",
"getTopBorderColor",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"(",
"pageRow",
"+",
"1",
")",
"==",
"getRowsCount",
"(",
")",
")",
"{",
"cellStyle",
".",
"setBorderBottom",
"(",
"subreportCellStyle",
".",
"getBorderBottom",
"(",
")",
")",
";",
"cellStyle",
".",
"setBottomBorderColor",
"(",
"subreportCellStyle",
".",
"getBottomBorderColor",
"(",
")",
")",
";",
"}",
"return",
"cellStyle",
";",
"}"
] | If a border style is set on a ReportBandElement we must apply it to all subreport cells | [
"If",
"a",
"border",
"style",
"is",
"set",
"on",
"a",
"ReportBandElement",
"we",
"must",
"apply",
"it",
"to",
"all",
"subreport",
"cells"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/exporter/XlsxExporter.java#L470-L492 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.rangeLimit | private int rangeLimit(int size, int min, int max) {
"""
Take the user input size variable and make sure it is inside
the given range of min and max. If it is outside the range,
then set the value to the closest limit.
@param size
@param min
@param max
@return int
"""
if (size < min) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too small");
}
return min;
} else if (size > max) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too large");
}
return max;
}
return size;
} | java | private int rangeLimit(int size, int min, int max) {
if (size < min) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too small");
}
return min;
} else if (size > max) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too large");
}
return max;
}
return size;
} | [
"private",
"int",
"rangeLimit",
"(",
"int",
"size",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"if",
"(",
"size",
"<",
"min",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Config: \"",
"+",
"size",
"+",
"\" too small\"",
")",
";",
"}",
"return",
"min",
";",
"}",
"else",
"if",
"(",
"size",
">",
"max",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Config: \"",
"+",
"size",
"+",
"\" too large\"",
")",
";",
"}",
"return",
"max",
";",
"}",
"return",
"size",
";",
"}"
] | Take the user input size variable and make sure it is inside
the given range of min and max. If it is outside the range,
then set the value to the closest limit.
@param size
@param min
@param max
@return int | [
"Take",
"the",
"user",
"input",
"size",
"variable",
"and",
"make",
"sure",
"it",
"is",
"inside",
"the",
"given",
"range",
"of",
"min",
"and",
"max",
".",
"If",
"it",
"is",
"outside",
"the",
"range",
"then",
"set",
"the",
"value",
"to",
"the",
"closest",
"limit",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1487-L1500 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/TouchManager.java | TouchManager.makeTouchable | public void makeTouchable(GVRSceneObject sceneObject, OnTouch handler) {
"""
Makes the scene object touchable and associates the {@link OnTouch handler} with it.
The TouchManager will not hold strong references to sceneObject and handler.
@param sceneObject
@param handler
"""
if (handler != null) {
if (sceneObject.getRenderData() != null) {
if (!touchHandlers.containsKey(sceneObject)) {
makePickable(sceneObject);
touchHandlers.put(sceneObject, new WeakReference<>(handler));
}
} else if (sceneObject.getChildrenCount() > 0) {
for (GVRSceneObject child : sceneObject.getChildren()) {
makeTouchable(child, handler);
}
}
}
} | java | public void makeTouchable(GVRSceneObject sceneObject, OnTouch handler) {
if (handler != null) {
if (sceneObject.getRenderData() != null) {
if (!touchHandlers.containsKey(sceneObject)) {
makePickable(sceneObject);
touchHandlers.put(sceneObject, new WeakReference<>(handler));
}
} else if (sceneObject.getChildrenCount() > 0) {
for (GVRSceneObject child : sceneObject.getChildren()) {
makeTouchable(child, handler);
}
}
}
} | [
"public",
"void",
"makeTouchable",
"(",
"GVRSceneObject",
"sceneObject",
",",
"OnTouch",
"handler",
")",
"{",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"if",
"(",
"sceneObject",
".",
"getRenderData",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"touchHandlers",
".",
"containsKey",
"(",
"sceneObject",
")",
")",
"{",
"makePickable",
"(",
"sceneObject",
")",
";",
"touchHandlers",
".",
"put",
"(",
"sceneObject",
",",
"new",
"WeakReference",
"<>",
"(",
"handler",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"sceneObject",
".",
"getChildrenCount",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"GVRSceneObject",
"child",
":",
"sceneObject",
".",
"getChildren",
"(",
")",
")",
"{",
"makeTouchable",
"(",
"child",
",",
"handler",
")",
";",
"}",
"}",
"}",
"}"
] | Makes the scene object touchable and associates the {@link OnTouch handler} with it.
The TouchManager will not hold strong references to sceneObject and handler.
@param sceneObject
@param handler | [
"Makes",
"the",
"scene",
"object",
"touchable",
"and",
"associates",
"the",
"{",
"@link",
"OnTouch",
"handler",
"}",
"with",
"it",
".",
"The",
"TouchManager",
"will",
"not",
"hold",
"strong",
"references",
"to",
"sceneObject",
"and",
"handler",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/TouchManager.java#L73-L86 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/RoundHelper.java | RoundHelper.getRoundedEvenExp | public static double getRoundedEvenExp (final double dValue, @Nonnegative final int nScale) {
"""
Round using the {@link RoundingMode#HALF_EVEN} mode and exponential
representation
@param dValue
The value to be rounded
@param nScale
The precision scale
@return the rounded value
"""
return getRounded (dValue, nScale, RoundingMode.HALF_EVEN, EDecimalType.EXP);
} | java | public static double getRoundedEvenExp (final double dValue, @Nonnegative final int nScale)
{
return getRounded (dValue, nScale, RoundingMode.HALF_EVEN, EDecimalType.EXP);
} | [
"public",
"static",
"double",
"getRoundedEvenExp",
"(",
"final",
"double",
"dValue",
",",
"@",
"Nonnegative",
"final",
"int",
"nScale",
")",
"{",
"return",
"getRounded",
"(",
"dValue",
",",
"nScale",
",",
"RoundingMode",
".",
"HALF_EVEN",
",",
"EDecimalType",
".",
"EXP",
")",
";",
"}"
] | Round using the {@link RoundingMode#HALF_EVEN} mode and exponential
representation
@param dValue
The value to be rounded
@param nScale
The precision scale
@return the rounded value | [
"Round",
"using",
"the",
"{",
"@link",
"RoundingMode#HALF_EVEN",
"}",
"mode",
"and",
"exponential",
"representation"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/RoundHelper.java#L144-L147 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java | BaseImageRecordReader.initialize | public void initialize(Configuration conf, InputSplit split, ImageTransform imageTransform)
throws IOException, InterruptedException {
"""
Called once at initialization.
@param conf a configuration for initialization
@param split the split that defines the range of records to read
@param imageTransform the image transform to use to transform images while loading them
@throws java.io.IOException
@throws InterruptedException
"""
this.imageLoader = null;
this.imageTransform = imageTransform;
initialize(conf, split);
} | java | public void initialize(Configuration conf, InputSplit split, ImageTransform imageTransform)
throws IOException, InterruptedException {
this.imageLoader = null;
this.imageTransform = imageTransform;
initialize(conf, split);
} | [
"public",
"void",
"initialize",
"(",
"Configuration",
"conf",
",",
"InputSplit",
"split",
",",
"ImageTransform",
"imageTransform",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"this",
".",
"imageLoader",
"=",
"null",
";",
"this",
".",
"imageTransform",
"=",
"imageTransform",
";",
"initialize",
"(",
"conf",
",",
"split",
")",
";",
"}"
] | Called once at initialization.
@param conf a configuration for initialization
@param split the split that defines the range of records to read
@param imageTransform the image transform to use to transform images while loading them
@throws java.io.IOException
@throws InterruptedException | [
"Called",
"once",
"at",
"initialization",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java#L211-L216 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java | ClassReflectionIndex.getMethod | public Method getMethod(String returnType, String name, String... paramTypeNames) {
"""
Get a method declared on this object.
@param returnType the method return type name
@param name the name of the method
@param paramTypeNames the parameter type names of the method
@return the method, or {@code null} if no method of that description exists
"""
final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(name);
if (nameMap == null) {
return null;
}
final Map<String, Method> paramsMap = nameMap.get(createParamNameList(paramTypeNames));
if (paramsMap == null) {
return null;
}
return paramsMap.get(returnType);
} | java | public Method getMethod(String returnType, String name, String... paramTypeNames) {
final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(name);
if (nameMap == null) {
return null;
}
final Map<String, Method> paramsMap = nameMap.get(createParamNameList(paramTypeNames));
if (paramsMap == null) {
return null;
}
return paramsMap.get(returnType);
} | [
"public",
"Method",
"getMethod",
"(",
"String",
"returnType",
",",
"String",
"name",
",",
"String",
"...",
"paramTypeNames",
")",
"{",
"final",
"Map",
"<",
"ParamNameList",
",",
"Map",
"<",
"String",
",",
"Method",
">",
">",
"nameMap",
"=",
"methodsByTypeName",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"nameMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"Method",
">",
"paramsMap",
"=",
"nameMap",
".",
"get",
"(",
"createParamNameList",
"(",
"paramTypeNames",
")",
")",
";",
"if",
"(",
"paramsMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"paramsMap",
".",
"get",
"(",
"returnType",
")",
";",
"}"
] | Get a method declared on this object.
@param returnType the method return type name
@param name the name of the method
@param paramTypeNames the parameter type names of the method
@return the method, or {@code null} if no method of that description exists | [
"Get",
"a",
"method",
"declared",
"on",
"this",
"object",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L235-L245 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java | ShareResourcesImpl.deleteShare | public void deleteShare(long objectId, String shareId) throws SmartsheetException {
"""
Delete a share.
It mirrors to the following Smartsheet REST API method:
DELETE /workspaces/{workspaceId}/shares/{shareId}
DELETE /sheets/{sheetId}/shares/{shareId}
DELETE /sights/{sheetId}/shares/{shareId}
DELETE /reports/{reportId}/shares/{shareId}
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param objectId the ID of the object to share
@param shareId the ID of the share to delete
@throws SmartsheetException the smartsheet exception
"""
this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class);
} | java | public void deleteShare(long objectId, String shareId) throws SmartsheetException {
this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class);
} | [
"public",
"void",
"deleteShare",
"(",
"long",
"objectId",
",",
"String",
"shareId",
")",
"throws",
"SmartsheetException",
"{",
"this",
".",
"deleteResource",
"(",
"getMasterResourceType",
"(",
")",
"+",
"\"/\"",
"+",
"objectId",
"+",
"\"/shares/\"",
"+",
"shareId",
",",
"Share",
".",
"class",
")",
";",
"}"
] | Delete a share.
It mirrors to the following Smartsheet REST API method:
DELETE /workspaces/{workspaceId}/shares/{shareId}
DELETE /sheets/{sheetId}/shares/{shareId}
DELETE /sights/{sheetId}/shares/{shareId}
DELETE /reports/{reportId}/shares/{shareId}
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param objectId the ID of the object to share
@param shareId the ID of the share to delete
@throws SmartsheetException the smartsheet exception | [
"Delete",
"a",
"share",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L199-L201 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspScopedVarBodyTagSuport.java | CmsJspScopedVarBodyTagSuport.storeAttribute | protected void storeAttribute(String name, Object obj) {
"""
Stores the provided Object as attribute with the provided name in the JSP page context.<p>
The value of {@link #getScope()} is used to determine how the Object is stored.<p>
@param name the name of the attribute to store the Object in
@param obj the Object to store in the JSP page context
"""
pageContext.setAttribute(name, obj, getScopeInt());
} | java | protected void storeAttribute(String name, Object obj) {
pageContext.setAttribute(name, obj, getScopeInt());
} | [
"protected",
"void",
"storeAttribute",
"(",
"String",
"name",
",",
"Object",
"obj",
")",
"{",
"pageContext",
".",
"setAttribute",
"(",
"name",
",",
"obj",
",",
"getScopeInt",
"(",
")",
")",
";",
"}"
] | Stores the provided Object as attribute with the provided name in the JSP page context.<p>
The value of {@link #getScope()} is used to determine how the Object is stored.<p>
@param name the name of the attribute to store the Object in
@param obj the Object to store in the JSP page context | [
"Stores",
"the",
"provided",
"Object",
"as",
"attribute",
"with",
"the",
"provided",
"name",
"in",
"the",
"JSP",
"page",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspScopedVarBodyTagSuport.java#L211-L214 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.instantiateDataNode | public static DataNode instantiateDataNode(String args[],
Configuration conf) throws IOException {
"""
Instantiate a single datanode object. This must be run by invoking
{@link DataNode#runDatanodeDaemon(DataNode)} subsequently.
"""
if (conf == null)
conf = new Configuration();
if (!parseArguments(args, conf)) {
printUsage();
return null;
}
if (conf.get("dfs.network.script") != null) {
LOG.error("This configuration for rack identification is not supported" +
" anymore. RackID resolution is handled by the NameNode.");
System.exit(-1);
}
String[] dataDirs = getListOfDataDirs(conf);
dnThreadName = "DataNode: [" +
StringUtils.arrayToString(dataDirs) + "]";
return makeInstance(dataDirs, conf);
} | java | public static DataNode instantiateDataNode(String args[],
Configuration conf) throws IOException {
if (conf == null)
conf = new Configuration();
if (!parseArguments(args, conf)) {
printUsage();
return null;
}
if (conf.get("dfs.network.script") != null) {
LOG.error("This configuration for rack identification is not supported" +
" anymore. RackID resolution is handled by the NameNode.");
System.exit(-1);
}
String[] dataDirs = getListOfDataDirs(conf);
dnThreadName = "DataNode: [" +
StringUtils.arrayToString(dataDirs) + "]";
return makeInstance(dataDirs, conf);
} | [
"public",
"static",
"DataNode",
"instantiateDataNode",
"(",
"String",
"args",
"[",
"]",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"conf",
"==",
"null",
")",
"conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"if",
"(",
"!",
"parseArguments",
"(",
"args",
",",
"conf",
")",
")",
"{",
"printUsage",
"(",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"conf",
".",
"get",
"(",
"\"dfs.network.script\"",
")",
"!=",
"null",
")",
"{",
"LOG",
".",
"error",
"(",
"\"This configuration for rack identification is not supported\"",
"+",
"\" anymore. RackID resolution is handled by the NameNode.\"",
")",
";",
"System",
".",
"exit",
"(",
"-",
"1",
")",
";",
"}",
"String",
"[",
"]",
"dataDirs",
"=",
"getListOfDataDirs",
"(",
"conf",
")",
";",
"dnThreadName",
"=",
"\"DataNode: [\"",
"+",
"StringUtils",
".",
"arrayToString",
"(",
"dataDirs",
")",
"+",
"\"]\"",
";",
"return",
"makeInstance",
"(",
"dataDirs",
",",
"conf",
")",
";",
"}"
] | Instantiate a single datanode object. This must be run by invoking
{@link DataNode#runDatanodeDaemon(DataNode)} subsequently. | [
"Instantiate",
"a",
"single",
"datanode",
"object",
".",
"This",
"must",
"be",
"run",
"by",
"invoking",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2347-L2364 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/Branch.java | Branch.getCreditHistory | public void getCreditHistory(final String bucket, final String afterId, final int length,
@NonNull final CreditHistoryOrder order, BranchListResponseListener callback) {
"""
<p>Gets the credit history of the specified bucket and triggers a callback to handle the
response.</p>
@param bucket A {@link String} value containing the name of the referral bucket that the
code will belong to.
@param afterId A {@link String} value containing the ID of the history record to begin after.
This allows for a partial history to be retrieved, rather than the entire
credit history of the bucket.
@param length A {@link Integer} value containing the number of credit history records to
return.
@param order A {@link CreditHistoryOrder} object indicating which order the results should
be returned in.
<p>Valid choices:</p>
<ul>
<li>{@link CreditHistoryOrder#kMostRecentFirst}</li>
<li>{@link CreditHistoryOrder#kLeastRecentFirst}</li>
</ul>
@param callback A {@link BranchListResponseListener} callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.
"""
ServerRequest req = new ServerRequestGetRewardHistory(context_, bucket, afterId, length, order, callback);
if (!req.constructError_ && !req.handleErrors(context_)) {
handleNewRequest(req);
}
} | java | public void getCreditHistory(final String bucket, final String afterId, final int length,
@NonNull final CreditHistoryOrder order, BranchListResponseListener callback) {
ServerRequest req = new ServerRequestGetRewardHistory(context_, bucket, afterId, length, order, callback);
if (!req.constructError_ && !req.handleErrors(context_)) {
handleNewRequest(req);
}
} | [
"public",
"void",
"getCreditHistory",
"(",
"final",
"String",
"bucket",
",",
"final",
"String",
"afterId",
",",
"final",
"int",
"length",
",",
"@",
"NonNull",
"final",
"CreditHistoryOrder",
"order",
",",
"BranchListResponseListener",
"callback",
")",
"{",
"ServerRequest",
"req",
"=",
"new",
"ServerRequestGetRewardHistory",
"(",
"context_",
",",
"bucket",
",",
"afterId",
",",
"length",
",",
"order",
",",
"callback",
")",
";",
"if",
"(",
"!",
"req",
".",
"constructError_",
"&&",
"!",
"req",
".",
"handleErrors",
"(",
"context_",
")",
")",
"{",
"handleNewRequest",
"(",
"req",
")",
";",
"}",
"}"
] | <p>Gets the credit history of the specified bucket and triggers a callback to handle the
response.</p>
@param bucket A {@link String} value containing the name of the referral bucket that the
code will belong to.
@param afterId A {@link String} value containing the ID of the history record to begin after.
This allows for a partial history to be retrieved, rather than the entire
credit history of the bucket.
@param length A {@link Integer} value containing the number of credit history records to
return.
@param order A {@link CreditHistoryOrder} object indicating which order the results should
be returned in.
<p>Valid choices:</p>
<ul>
<li>{@link CreditHistoryOrder#kMostRecentFirst}</li>
<li>{@link CreditHistoryOrder#kLeastRecentFirst}</li>
</ul>
@param callback A {@link BranchListResponseListener} callback instance that will trigger
actions defined therein upon receipt of a response to a create link request. | [
"<p",
">",
"Gets",
"the",
"credit",
"history",
"of",
"the",
"specified",
"bucket",
"and",
"triggers",
"a",
"callback",
"to",
"handle",
"the",
"response",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1994-L2000 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterServiceImpl.java | ClusterServiceImpl.shouldAcceptMastership | private boolean shouldAcceptMastership(MemberMap memberMap, MemberImpl candidate) {
"""
mastership is accepted when all members before the candidate is suspected
"""
assert lock.isHeldByCurrentThread() : "Called without holding cluster service lock!";
for (MemberImpl member : memberMap.headMemberSet(candidate, false)) {
if (!membershipManager.isMemberSuspected(member.getAddress())) {
if (logger.isFineEnabled()) {
logger.fine("Should not accept mastership claim of " + candidate + ", because " + member
+ " is not suspected at the moment and is before than " + candidate + " in the member list.");
}
return false;
}
}
return true;
} | java | private boolean shouldAcceptMastership(MemberMap memberMap, MemberImpl candidate) {
assert lock.isHeldByCurrentThread() : "Called without holding cluster service lock!";
for (MemberImpl member : memberMap.headMemberSet(candidate, false)) {
if (!membershipManager.isMemberSuspected(member.getAddress())) {
if (logger.isFineEnabled()) {
logger.fine("Should not accept mastership claim of " + candidate + ", because " + member
+ " is not suspected at the moment and is before than " + candidate + " in the member list.");
}
return false;
}
}
return true;
} | [
"private",
"boolean",
"shouldAcceptMastership",
"(",
"MemberMap",
"memberMap",
",",
"MemberImpl",
"candidate",
")",
"{",
"assert",
"lock",
".",
"isHeldByCurrentThread",
"(",
")",
":",
"\"Called without holding cluster service lock!\"",
";",
"for",
"(",
"MemberImpl",
"member",
":",
"memberMap",
".",
"headMemberSet",
"(",
"candidate",
",",
"false",
")",
")",
"{",
"if",
"(",
"!",
"membershipManager",
".",
"isMemberSuspected",
"(",
"member",
".",
"getAddress",
"(",
")",
")",
")",
"{",
"if",
"(",
"logger",
".",
"isFineEnabled",
"(",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Should not accept mastership claim of \"",
"+",
"candidate",
"+",
"\", because \"",
"+",
"member",
"+",
"\" is not suspected at the moment and is before than \"",
"+",
"candidate",
"+",
"\" in the member list.\"",
")",
";",
"}",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | mastership is accepted when all members before the candidate is suspected | [
"mastership",
"is",
"accepted",
"when",
"all",
"members",
"before",
"the",
"candidate",
"is",
"suspected"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterServiceImpl.java#L285-L298 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/Json.java | Json.resource_to_string | public String resource_to_string(base_resource resources[], options option) {
"""
Converts NetScaler SDX resources to Json string.
@param resources API resources.
@param option options class object.
@return returns a String
"""
String objecttype = resources[0].get_object_type();
String request = "{";
if (option != null && option.get_action() != null)
request = request + "\"params\": {\"action\": \"" + option.get_action() + "\"},";
request = request + "\"" + objecttype + "\":[";
for (int i = 0; i < resources.length ; i++)
{
String str = this.resource_to_string(resources[i]);
request = request + str + ",";
}
request = request + "]}";
return request;
} | java | public String resource_to_string(base_resource resources[], options option)
{
String objecttype = resources[0].get_object_type();
String request = "{";
if (option != null && option.get_action() != null)
request = request + "\"params\": {\"action\": \"" + option.get_action() + "\"},";
request = request + "\"" + objecttype + "\":[";
for (int i = 0; i < resources.length ; i++)
{
String str = this.resource_to_string(resources[i]);
request = request + str + ",";
}
request = request + "]}";
return request;
} | [
"public",
"String",
"resource_to_string",
"(",
"base_resource",
"resources",
"[",
"]",
",",
"options",
"option",
")",
"{",
"String",
"objecttype",
"=",
"resources",
"[",
"0",
"]",
".",
"get_object_type",
"(",
")",
";",
"String",
"request",
"=",
"\"{\"",
";",
"if",
"(",
"option",
"!=",
"null",
"&&",
"option",
".",
"get_action",
"(",
")",
"!=",
"null",
")",
"request",
"=",
"request",
"+",
"\"\\\"params\\\": {\\\"action\\\": \\\"\"",
"+",
"option",
".",
"get_action",
"(",
")",
"+",
"\"\\\"},\"",
";",
"request",
"=",
"request",
"+",
"\"\\\"\"",
"+",
"objecttype",
"+",
"\"\\\":[\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"str",
"=",
"this",
".",
"resource_to_string",
"(",
"resources",
"[",
"i",
"]",
")",
";",
"request",
"=",
"request",
"+",
"str",
"+",
"\",\"",
";",
"}",
"request",
"=",
"request",
"+",
"\"]}\"",
";",
"return",
"request",
";",
"}"
] | Converts NetScaler SDX resources to Json string.
@param resources API resources.
@param option options class object.
@return returns a String | [
"Converts",
"NetScaler",
"SDX",
"resources",
"to",
"Json",
"string",
"."
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L80-L96 |
netty/netty | common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java | ThreadExecutorMap.apply | public static Executor apply(final Executor executor, final EventExecutor eventExecutor) {
"""
Decorate the given {@link Executor} and ensure {@link #currentExecutor()} will return {@code eventExecutor}
when called from within the {@link Runnable} during execution.
"""
ObjectUtil.checkNotNull(executor, "executor");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new Executor() {
@Override
public void execute(final Runnable command) {
executor.execute(apply(command, eventExecutor));
}
};
} | java | public static Executor apply(final Executor executor, final EventExecutor eventExecutor) {
ObjectUtil.checkNotNull(executor, "executor");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new Executor() {
@Override
public void execute(final Runnable command) {
executor.execute(apply(command, eventExecutor));
}
};
} | [
"public",
"static",
"Executor",
"apply",
"(",
"final",
"Executor",
"executor",
",",
"final",
"EventExecutor",
"eventExecutor",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"executor",
",",
"\"executor\"",
")",
";",
"ObjectUtil",
".",
"checkNotNull",
"(",
"eventExecutor",
",",
"\"eventExecutor\"",
")",
";",
"return",
"new",
"Executor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"Runnable",
"command",
")",
"{",
"executor",
".",
"execute",
"(",
"apply",
"(",
"command",
",",
"eventExecutor",
")",
")",
";",
"}",
"}",
";",
"}"
] | Decorate the given {@link Executor} and ensure {@link #currentExecutor()} will return {@code eventExecutor}
when called from within the {@link Runnable} during execution. | [
"Decorate",
"the",
"given",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L51-L60 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/ClusteringKeyMapper.java | ClusteringKeyMapper.sortFields | public SortField[] sortFields() {
"""
Returns a Lucene {@link SortField} array for sorting documents/rows according to the column family name.
@return A Lucene {@link SortField} array for sorting documents/rows according to the column family name.
"""
return new SortField[]{new SortField(FIELD_NAME, new FieldComparatorSource() {
@Override
public FieldComparator<?> newComparator(String field,
int hits,
int sort,
boolean reversed) throws IOException {
return new ClusteringKeySorter(ClusteringKeyMapper.this, hits, field);
}
})};
} | java | public SortField[] sortFields() {
return new SortField[]{new SortField(FIELD_NAME, new FieldComparatorSource() {
@Override
public FieldComparator<?> newComparator(String field,
int hits,
int sort,
boolean reversed) throws IOException {
return new ClusteringKeySorter(ClusteringKeyMapper.this, hits, field);
}
})};
} | [
"public",
"SortField",
"[",
"]",
"sortFields",
"(",
")",
"{",
"return",
"new",
"SortField",
"[",
"]",
"{",
"new",
"SortField",
"(",
"FIELD_NAME",
",",
"new",
"FieldComparatorSource",
"(",
")",
"{",
"@",
"Override",
"public",
"FieldComparator",
"<",
"?",
">",
"newComparator",
"(",
"String",
"field",
",",
"int",
"hits",
",",
"int",
"sort",
",",
"boolean",
"reversed",
")",
"throws",
"IOException",
"{",
"return",
"new",
"ClusteringKeySorter",
"(",
"ClusteringKeyMapper",
".",
"this",
",",
"hits",
",",
"field",
")",
";",
"}",
"}",
")",
"}",
";",
"}"
] | Returns a Lucene {@link SortField} array for sorting documents/rows according to the column family name.
@return A Lucene {@link SortField} array for sorting documents/rows according to the column family name. | [
"Returns",
"a",
"Lucene",
"{",
"@link",
"SortField",
"}",
"array",
"for",
"sorting",
"documents",
"/",
"rows",
"according",
"to",
"the",
"column",
"family",
"name",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/ClusteringKeyMapper.java#L326-L336 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/reflect/RecursiveObjectReader.java | RecursiveObjectReader.hasProperty | public static boolean hasProperty(Object obj, String name) {
"""
Checks recursively if object or its subobjects has a property with specified
name.
The object can be a user defined object, map or array. The property name
correspondently must be object property, map key or array index.
@param obj an object to introspect.
@param name a name of the property to check.
@return true if the object has the property and false if it doesn't.
"""
if (obj == null || name == null)
return false;
String[] names = name.split("\\.");
if (names == null || names.length == 0)
return false;
return performHasProperty(obj, names, 0);
} | java | public static boolean hasProperty(Object obj, String name) {
if (obj == null || name == null)
return false;
String[] names = name.split("\\.");
if (names == null || names.length == 0)
return false;
return performHasProperty(obj, names, 0);
} | [
"public",
"static",
"boolean",
"hasProperty",
"(",
"Object",
"obj",
",",
"String",
"name",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"name",
"==",
"null",
")",
"return",
"false",
";",
"String",
"[",
"]",
"names",
"=",
"name",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"names",
"==",
"null",
"||",
"names",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"return",
"performHasProperty",
"(",
"obj",
",",
"names",
",",
"0",
")",
";",
"}"
] | Checks recursively if object or its subobjects has a property with specified
name.
The object can be a user defined object, map or array. The property name
correspondently must be object property, map key or array index.
@param obj an object to introspect.
@param name a name of the property to check.
@return true if the object has the property and false if it doesn't. | [
"Checks",
"recursively",
"if",
"object",
"or",
"its",
"subobjects",
"has",
"a",
"property",
"with",
"specified",
"name",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/RecursiveObjectReader.java#L41-L50 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java | ModuleSpecProcessor.addAllDependenciesAndPermissions | private void addAllDependenciesAndPermissions(final ModuleSpecification moduleSpecification, final AdditionalModuleSpecification module) {
"""
Gives any additional modules the same dependencies and permissions as the primary module.
<p/>
This makes sure they can access all API classes etc.
@param moduleSpecification The primary module spec
@param module The additional module
"""
module.addSystemDependencies(moduleSpecification.getSystemDependencies());
module.addLocalDependencies(moduleSpecification.getLocalDependencies());
for(ModuleDependency dep : moduleSpecification.getUserDependencies()) {
if(!dep.getIdentifier().equals(module.getModuleIdentifier())) {
module.addUserDependency(dep);
}
}
for(PermissionFactory factory : moduleSpecification.getPermissionFactories()) {
module.addPermissionFactory(factory);
}
} | java | private void addAllDependenciesAndPermissions(final ModuleSpecification moduleSpecification, final AdditionalModuleSpecification module) {
module.addSystemDependencies(moduleSpecification.getSystemDependencies());
module.addLocalDependencies(moduleSpecification.getLocalDependencies());
for(ModuleDependency dep : moduleSpecification.getUserDependencies()) {
if(!dep.getIdentifier().equals(module.getModuleIdentifier())) {
module.addUserDependency(dep);
}
}
for(PermissionFactory factory : moduleSpecification.getPermissionFactories()) {
module.addPermissionFactory(factory);
}
} | [
"private",
"void",
"addAllDependenciesAndPermissions",
"(",
"final",
"ModuleSpecification",
"moduleSpecification",
",",
"final",
"AdditionalModuleSpecification",
"module",
")",
"{",
"module",
".",
"addSystemDependencies",
"(",
"moduleSpecification",
".",
"getSystemDependencies",
"(",
")",
")",
";",
"module",
".",
"addLocalDependencies",
"(",
"moduleSpecification",
".",
"getLocalDependencies",
"(",
")",
")",
";",
"for",
"(",
"ModuleDependency",
"dep",
":",
"moduleSpecification",
".",
"getUserDependencies",
"(",
")",
")",
"{",
"if",
"(",
"!",
"dep",
".",
"getIdentifier",
"(",
")",
".",
"equals",
"(",
"module",
".",
"getModuleIdentifier",
"(",
")",
")",
")",
"{",
"module",
".",
"addUserDependency",
"(",
"dep",
")",
";",
"}",
"}",
"for",
"(",
"PermissionFactory",
"factory",
":",
"moduleSpecification",
".",
"getPermissionFactories",
"(",
")",
")",
"{",
"module",
".",
"addPermissionFactory",
"(",
"factory",
")",
";",
"}",
"}"
] | Gives any additional modules the same dependencies and permissions as the primary module.
<p/>
This makes sure they can access all API classes etc.
@param moduleSpecification The primary module spec
@param module The additional module | [
"Gives",
"any",
"additional",
"modules",
"the",
"same",
"dependencies",
"and",
"permissions",
"as",
"the",
"primary",
"module",
".",
"<p",
"/",
">",
"This",
"makes",
"sure",
"they",
"can",
"access",
"all",
"API",
"classes",
"etc",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java#L161-L172 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.inWindow | private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) {
"""
Verifies if testing node is within right windows of first node
@param first first node being considered
@param testing node we are testing to check if it is within window or not
@return We return true if it is successful, and not otherwise
"""
readLock();
try {
RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(first);
assert (machineId != null);
final int rackWindowStart = rackInfo.index;
final RackRingInfo rackTest = racksMap.get(testing.getNetworkLocation());
assert (rackTest != null);
final int rackDist = (rackTest.index - rackWindowStart + racks.size())
% racks.size();
if (rackDist < rackWindow + 1 && rackTest.index != rackInfo.index) {
// inside rack window
final Integer idFirst = rackInfo.findNode(first);
assert (idFirst != null);
final int sizeFirstRack = rackInfo.rackNodes.size();
final int sizeTestRack = rackTest.rackNodes.size();
final int start = idFirst * sizeTestRack / sizeFirstRack;
final Integer idTest = rackTest.findNode(testing);
assert (idTest != null);
final int dist = (idTest - start + sizeTestRack) % sizeTestRack;
if (dist < machineWindow) { // inside machine Window
return true;
}
}
return false;
} finally {
readUnlock();
}
} | java | private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(first);
assert (machineId != null);
final int rackWindowStart = rackInfo.index;
final RackRingInfo rackTest = racksMap.get(testing.getNetworkLocation());
assert (rackTest != null);
final int rackDist = (rackTest.index - rackWindowStart + racks.size())
% racks.size();
if (rackDist < rackWindow + 1 && rackTest.index != rackInfo.index) {
// inside rack window
final Integer idFirst = rackInfo.findNode(first);
assert (idFirst != null);
final int sizeFirstRack = rackInfo.rackNodes.size();
final int sizeTestRack = rackTest.rackNodes.size();
final int start = idFirst * sizeTestRack / sizeFirstRack;
final Integer idTest = rackTest.findNode(testing);
assert (idTest != null);
final int dist = (idTest - start + sizeTestRack) % sizeTestRack;
if (dist < machineWindow) { // inside machine Window
return true;
}
}
return false;
} finally {
readUnlock();
}
} | [
"private",
"boolean",
"inWindow",
"(",
"DatanodeDescriptor",
"first",
",",
"DatanodeDescriptor",
"testing",
")",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"RackRingInfo",
"rackInfo",
"=",
"racksMap",
".",
"get",
"(",
"first",
".",
"getNetworkLocation",
"(",
")",
")",
";",
"assert",
"(",
"rackInfo",
"!=",
"null",
")",
";",
"Integer",
"machineId",
"=",
"rackInfo",
".",
"findNode",
"(",
"first",
")",
";",
"assert",
"(",
"machineId",
"!=",
"null",
")",
";",
"final",
"int",
"rackWindowStart",
"=",
"rackInfo",
".",
"index",
";",
"final",
"RackRingInfo",
"rackTest",
"=",
"racksMap",
".",
"get",
"(",
"testing",
".",
"getNetworkLocation",
"(",
")",
")",
";",
"assert",
"(",
"rackTest",
"!=",
"null",
")",
";",
"final",
"int",
"rackDist",
"=",
"(",
"rackTest",
".",
"index",
"-",
"rackWindowStart",
"+",
"racks",
".",
"size",
"(",
")",
")",
"%",
"racks",
".",
"size",
"(",
")",
";",
"if",
"(",
"rackDist",
"<",
"rackWindow",
"+",
"1",
"&&",
"rackTest",
".",
"index",
"!=",
"rackInfo",
".",
"index",
")",
"{",
"// inside rack window",
"final",
"Integer",
"idFirst",
"=",
"rackInfo",
".",
"findNode",
"(",
"first",
")",
";",
"assert",
"(",
"idFirst",
"!=",
"null",
")",
";",
"final",
"int",
"sizeFirstRack",
"=",
"rackInfo",
".",
"rackNodes",
".",
"size",
"(",
")",
";",
"final",
"int",
"sizeTestRack",
"=",
"rackTest",
".",
"rackNodes",
".",
"size",
"(",
")",
";",
"final",
"int",
"start",
"=",
"idFirst",
"*",
"sizeTestRack",
"/",
"sizeFirstRack",
";",
"final",
"Integer",
"idTest",
"=",
"rackTest",
".",
"findNode",
"(",
"testing",
")",
";",
"assert",
"(",
"idTest",
"!=",
"null",
")",
";",
"final",
"int",
"dist",
"=",
"(",
"idTest",
"-",
"start",
"+",
"sizeTestRack",
")",
"%",
"sizeTestRack",
";",
"if",
"(",
"dist",
"<",
"machineWindow",
")",
"{",
"// inside machine Window",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"finally",
"{",
"readUnlock",
"(",
")",
";",
"}",
"}"
] | Verifies if testing node is within right windows of first node
@param first first node being considered
@param testing node we are testing to check if it is within window or not
@return We return true if it is successful, and not otherwise | [
"Verifies",
"if",
"testing",
"node",
"is",
"within",
"right",
"windows",
"of",
"first",
"node"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L448-L489 |
negusoft/holoaccent | HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java | BitmapUtils.createTintTransformationMap | public static Bitmap createTintTransformationMap(Bitmap bitmap, int tintColor) {
"""
Create a bitmap that contains the transformation to make to create the final
bitmap with a new tint color. You can then call processTintTransformationMap()
to get a bitmap with the desired tint.
@param bitmap The original bitmap.
@param tintColor Tint color in the original bitmap.
@return A transformation map to be used with processTintTransformationMap(). The
transformation values are stored in the red and green values. The alpha value is
significant and the blue value can be ignored.
"""
// tint color
int[] t = new int[] {
Color.red(tintColor),
Color.green(tintColor),
Color.blue(tintColor) };
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
int maxIndex = getMaxIndex(t);
int mintIndex = getMinIndex(t);
for (int i=0; i<pixels.length; i++) {
int color = pixels[i];
// pixel color
int[] p = new int[] {
Color.red(color),
Color.green(color),
Color.blue(color) };
int alpha = Color.alpha(color);
float[] transformation = calculateTransformation(t[maxIndex], t[mintIndex], p[maxIndex], p[mintIndex]);
pixels[i] = Color.argb(alpha, (int)(transformation[0]*255), (int)(transformation[1]*255), 0);
}
return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
} | java | public static Bitmap createTintTransformationMap(Bitmap bitmap, int tintColor) {
// tint color
int[] t = new int[] {
Color.red(tintColor),
Color.green(tintColor),
Color.blue(tintColor) };
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
int maxIndex = getMaxIndex(t);
int mintIndex = getMinIndex(t);
for (int i=0; i<pixels.length; i++) {
int color = pixels[i];
// pixel color
int[] p = new int[] {
Color.red(color),
Color.green(color),
Color.blue(color) };
int alpha = Color.alpha(color);
float[] transformation = calculateTransformation(t[maxIndex], t[mintIndex], p[maxIndex], p[mintIndex]);
pixels[i] = Color.argb(alpha, (int)(transformation[0]*255), (int)(transformation[1]*255), 0);
}
return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
} | [
"public",
"static",
"Bitmap",
"createTintTransformationMap",
"(",
"Bitmap",
"bitmap",
",",
"int",
"tintColor",
")",
"{",
"// tint color",
"int",
"[",
"]",
"t",
"=",
"new",
"int",
"[",
"]",
"{",
"Color",
".",
"red",
"(",
"tintColor",
")",
",",
"Color",
".",
"green",
"(",
"tintColor",
")",
",",
"Color",
".",
"blue",
"(",
"tintColor",
")",
"}",
";",
"int",
"width",
"=",
"bitmap",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"bitmap",
".",
"getHeight",
"(",
")",
";",
"int",
"[",
"]",
"pixels",
"=",
"new",
"int",
"[",
"width",
"*",
"height",
"]",
";",
"bitmap",
".",
"getPixels",
"(",
"pixels",
",",
"0",
",",
"width",
",",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"int",
"maxIndex",
"=",
"getMaxIndex",
"(",
"t",
")",
";",
"int",
"mintIndex",
"=",
"getMinIndex",
"(",
"t",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pixels",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"color",
"=",
"pixels",
"[",
"i",
"]",
";",
"// pixel color",
"int",
"[",
"]",
"p",
"=",
"new",
"int",
"[",
"]",
"{",
"Color",
".",
"red",
"(",
"color",
")",
",",
"Color",
".",
"green",
"(",
"color",
")",
",",
"Color",
".",
"blue",
"(",
"color",
")",
"}",
";",
"int",
"alpha",
"=",
"Color",
".",
"alpha",
"(",
"color",
")",
";",
"float",
"[",
"]",
"transformation",
"=",
"calculateTransformation",
"(",
"t",
"[",
"maxIndex",
"]",
",",
"t",
"[",
"mintIndex",
"]",
",",
"p",
"[",
"maxIndex",
"]",
",",
"p",
"[",
"mintIndex",
"]",
")",
";",
"pixels",
"[",
"i",
"]",
"=",
"Color",
".",
"argb",
"(",
"alpha",
",",
"(",
"int",
")",
"(",
"transformation",
"[",
"0",
"]",
"*",
"255",
")",
",",
"(",
"int",
")",
"(",
"transformation",
"[",
"1",
"]",
"*",
"255",
")",
",",
"0",
")",
";",
"}",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"pixels",
",",
"width",
",",
"height",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"}"
] | Create a bitmap that contains the transformation to make to create the final
bitmap with a new tint color. You can then call processTintTransformationMap()
to get a bitmap with the desired tint.
@param bitmap The original bitmap.
@param tintColor Tint color in the original bitmap.
@return A transformation map to be used with processTintTransformationMap(). The
transformation values are stored in the red and green values. The alpha value is
significant and the blue value can be ignored. | [
"Create",
"a",
"bitmap",
"that",
"contains",
"the",
"transformation",
"to",
"make",
"to",
"create",
"the",
"final",
"bitmap",
"with",
"a",
"new",
"tint",
"color",
".",
"You",
"can",
"then",
"call",
"processTintTransformationMap",
"()",
"to",
"get",
"a",
"bitmap",
"with",
"the",
"desired",
"tint",
"."
] | train | https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java#L124-L152 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/ec2/provision/HostProvisioner.java | HostProvisioner.uploadForDeployment | public void uploadForDeployment(String from, String to) throws Exception {
"""
Creates the directory for the file if necessary
and uploads the file
@param from the directory to upload from
@param to the destination directory on the remote server
@throws Exception
"""
File fromFile = new File(from);
if (!to.isEmpty() && fromFile.isDirectory())
mkDir(to);
else
upload(from, to);
} | java | public void uploadForDeployment(String from, String to) throws Exception {
File fromFile = new File(from);
if (!to.isEmpty() && fromFile.isDirectory())
mkDir(to);
else
upload(from, to);
} | [
"public",
"void",
"uploadForDeployment",
"(",
"String",
"from",
",",
"String",
"to",
")",
"throws",
"Exception",
"{",
"File",
"fromFile",
"=",
"new",
"File",
"(",
"from",
")",
";",
"if",
"(",
"!",
"to",
".",
"isEmpty",
"(",
")",
"&&",
"fromFile",
".",
"isDirectory",
"(",
")",
")",
"mkDir",
"(",
"to",
")",
";",
"else",
"upload",
"(",
"from",
",",
"to",
")",
";",
"}"
] | Creates the directory for the file if necessary
and uploads the file
@param from the directory to upload from
@param to the destination directory on the remote server
@throws Exception | [
"Creates",
"the",
"directory",
"for",
"the",
"file",
"if",
"necessary",
"and",
"uploads",
"the",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/ec2/provision/HostProvisioner.java#L150-L158 |
javagl/Common | src/main/java/de/javagl/common/xml/XmlUtils.java | XmlUtils.getFirstChild | public static Node getFirstChild(Node node, String childNodeName) {
"""
Returns the first child of the given node with the given name (ignoring
upper/lower case), or <code>null</code> if no such child is found.
@param node The node
@param childNodeName The child node name
@return The child with the given name, or <code>null</code>
"""
NodeList childNodes = node.getChildNodes();
for (int i=0; i<childNodes.getLength(); i++)
{
Node child = childNodes.item(i);
String childName = child.getNodeName();
if (childName.equalsIgnoreCase(childNodeName))
{
return child;
}
}
return null;
} | java | public static Node getFirstChild(Node node, String childNodeName)
{
NodeList childNodes = node.getChildNodes();
for (int i=0; i<childNodes.getLength(); i++)
{
Node child = childNodes.item(i);
String childName = child.getNodeName();
if (childName.equalsIgnoreCase(childNodeName))
{
return child;
}
}
return null;
} | [
"public",
"static",
"Node",
"getFirstChild",
"(",
"Node",
"node",
",",
"String",
"childNodeName",
")",
"{",
"NodeList",
"childNodes",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childNodes",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"child",
"=",
"childNodes",
".",
"item",
"(",
"i",
")",
";",
"String",
"childName",
"=",
"child",
".",
"getNodeName",
"(",
")",
";",
"if",
"(",
"childName",
".",
"equalsIgnoreCase",
"(",
"childNodeName",
")",
")",
"{",
"return",
"child",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns the first child of the given node with the given name (ignoring
upper/lower case), or <code>null</code> if no such child is found.
@param node The node
@param childNodeName The child node name
@return The child with the given name, or <code>null</code> | [
"Returns",
"the",
"first",
"child",
"of",
"the",
"given",
"node",
"with",
"the",
"given",
"name",
"(",
"ignoring",
"upper",
"/",
"lower",
"case",
")",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"such",
"child",
"is",
"found",
"."
] | train | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L388-L401 |
dyu/protostuff-1.0.x | protostuff-core/src/main/java/com/dyuproject/protostuff/ProtostuffIOUtil.java | ProtostuffIOUtil.writeListTo | public static <T> int writeListTo(final OutputStream out, final List<T> messages,
final Schema<T> schema, final LinkedBuffer buffer) throws IOException {
"""
Serializes the {@code messages} (delimited) into an {@link OutputStream}
using the given schema.
@return the bytes written
"""
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final int size = messages.size();
if(size == 0)
return 0;
final ProtostuffOutput output = new ProtostuffOutput(buffer, out);
output.sink.writeVarInt32(size, output, buffer);
for(T m : messages)
{
schema.writeTo(output, m);
output.sink.writeByte((byte)WireFormat.WIRETYPE_TAIL_DELIMITER, output,
buffer);
}
LinkedBuffer.writeTo(out, buffer);
return output.size;
} | java | public static <T> int writeListTo(final OutputStream out, final List<T> messages,
final Schema<T> schema, final LinkedBuffer buffer) throws IOException
{
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final int size = messages.size();
if(size == 0)
return 0;
final ProtostuffOutput output = new ProtostuffOutput(buffer, out);
output.sink.writeVarInt32(size, output, buffer);
for(T m : messages)
{
schema.writeTo(output, m);
output.sink.writeByte((byte)WireFormat.WIRETYPE_TAIL_DELIMITER, output,
buffer);
}
LinkedBuffer.writeTo(out, buffer);
return output.size;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"writeListTo",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"List",
"<",
"T",
">",
"messages",
",",
"final",
"Schema",
"<",
"T",
">",
"schema",
",",
"final",
"LinkedBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"start",
"!=",
"buffer",
".",
"offset",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Buffer previously used and had not been reset.\"",
")",
";",
"final",
"int",
"size",
"=",
"messages",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"0",
";",
"final",
"ProtostuffOutput",
"output",
"=",
"new",
"ProtostuffOutput",
"(",
"buffer",
",",
"out",
")",
";",
"output",
".",
"sink",
".",
"writeVarInt32",
"(",
"size",
",",
"output",
",",
"buffer",
")",
";",
"for",
"(",
"T",
"m",
":",
"messages",
")",
"{",
"schema",
".",
"writeTo",
"(",
"output",
",",
"m",
")",
";",
"output",
".",
"sink",
".",
"writeByte",
"(",
"(",
"byte",
")",
"WireFormat",
".",
"WIRETYPE_TAIL_DELIMITER",
",",
"output",
",",
"buffer",
")",
";",
"}",
"LinkedBuffer",
".",
"writeTo",
"(",
"out",
",",
"buffer",
")",
";",
"return",
"output",
".",
"size",
";",
"}"
] | Serializes the {@code messages} (delimited) into an {@link OutputStream}
using the given schema.
@return the bytes written | [
"Serializes",
"the",
"{",
"@code",
"messages",
"}",
"(",
"delimited",
")",
"into",
"an",
"{",
"@link",
"OutputStream",
"}",
"using",
"the",
"given",
"schema",
"."
] | train | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-core/src/main/java/com/dyuproject/protostuff/ProtostuffIOUtil.java#L277-L300 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java | VariableScopeImpl.setVariableLocal | public Object setVariableLocal(String variableName, Object value, boolean fetchAllVariables) {
"""
The default {@link #setVariableLocal(String, Object)} fetches all variables (for historical and backwards compatible reasons) while setting the variables.
Setting the fetchAllVariables parameter to true is the default behaviour (ie fetching all variables) Setting the fetchAllVariables parameter to false does not do that.
"""
return setVariableLocal(variableName, value, getSourceActivityExecution(), fetchAllVariables);
} | java | public Object setVariableLocal(String variableName, Object value, boolean fetchAllVariables) {
return setVariableLocal(variableName, value, getSourceActivityExecution(), fetchAllVariables);
} | [
"public",
"Object",
"setVariableLocal",
"(",
"String",
"variableName",
",",
"Object",
"value",
",",
"boolean",
"fetchAllVariables",
")",
"{",
"return",
"setVariableLocal",
"(",
"variableName",
",",
"value",
",",
"getSourceActivityExecution",
"(",
")",
",",
"fetchAllVariables",
")",
";",
"}"
] | The default {@link #setVariableLocal(String, Object)} fetches all variables (for historical and backwards compatible reasons) while setting the variables.
Setting the fetchAllVariables parameter to true is the default behaviour (ie fetching all variables) Setting the fetchAllVariables parameter to false does not do that. | [
"The",
"default",
"{",
"@link",
"#setVariableLocal",
"(",
"String",
"Object",
")",
"}",
"fetches",
"all",
"variables",
"(",
"for",
"historical",
"and",
"backwards",
"compatible",
"reasons",
")",
"while",
"setting",
"the",
"variables",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java#L724-L726 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java | CPSpecificationOptionPersistenceImpl.removeByUUID_G | @Override
public CPSpecificationOption removeByUUID_G(String uuid, long groupId)
throws NoSuchCPSpecificationOptionException {
"""
Removes the cp specification option where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp specification option that was removed
"""
CPSpecificationOption cpSpecificationOption = findByUUID_G(uuid, groupId);
return remove(cpSpecificationOption);
} | java | @Override
public CPSpecificationOption removeByUUID_G(String uuid, long groupId)
throws NoSuchCPSpecificationOptionException {
CPSpecificationOption cpSpecificationOption = findByUUID_G(uuid, groupId);
return remove(cpSpecificationOption);
} | [
"@",
"Override",
"public",
"CPSpecificationOption",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPSpecificationOptionException",
"{",
"CPSpecificationOption",
"cpSpecificationOption",
"=",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"return",
"remove",
"(",
"cpSpecificationOption",
")",
";",
"}"
] | Removes the cp specification option where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp specification option that was removed | [
"Removes",
"the",
"cp",
"specification",
"option",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L817-L823 |
scireum/s3ninja | src/main/java/ninja/S3Dispatcher.java | S3Dispatcher.copyObject | private void copyObject(WebContext ctx, Bucket bucket, String id, String copy) throws IOException {
"""
Handles GET /bucket/id with an <tt>x-amz-copy-source</tt> header.
@param ctx the context describing the current request
@param bucket the bucket containing the object to use as destination
@param id name of the object to use as destination
"""
StoredObject object = bucket.getObject(id);
if (!copy.contains(PATH_DELIMITER)) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source must contain '/'");
return;
}
String srcBucketName = copy.substring(1, copy.lastIndexOf(PATH_DELIMITER));
String srcId = copy.substring(copy.lastIndexOf(PATH_DELIMITER) + 1);
Bucket srcBucket = storage.getBucket(srcBucketName);
if (!srcBucket.exists()) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source bucket does not exist");
return;
}
StoredObject src = srcBucket.getObject(srcId);
if (!src.exists()) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source object does not exist");
return;
}
Files.copy(src.getFile(), object.getFile());
if (src.getPropertiesFile().exists()) {
Files.copy(src.getPropertiesFile(), object.getPropertiesFile());
}
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
String etag = BaseEncoding.base16().encode(hash.asBytes());
XMLStructuredOutput structuredOutput = ctx.respondWith().addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).xml();
structuredOutput.beginOutput("CopyObjectResult");
structuredOutput.beginObject("LastModified");
structuredOutput.text(RFC822_INSTANT.format(object.getLastModifiedInstant()));
structuredOutput.endObject();
structuredOutput.beginObject(HTTP_HEADER_NAME_ETAG);
structuredOutput.text(etag(etag));
structuredOutput.endObject();
structuredOutput.endOutput();
signalObjectSuccess(ctx);
} | java | private void copyObject(WebContext ctx, Bucket bucket, String id, String copy) throws IOException {
StoredObject object = bucket.getObject(id);
if (!copy.contains(PATH_DELIMITER)) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source must contain '/'");
return;
}
String srcBucketName = copy.substring(1, copy.lastIndexOf(PATH_DELIMITER));
String srcId = copy.substring(copy.lastIndexOf(PATH_DELIMITER) + 1);
Bucket srcBucket = storage.getBucket(srcBucketName);
if (!srcBucket.exists()) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source bucket does not exist");
return;
}
StoredObject src = srcBucket.getObject(srcId);
if (!src.exists()) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "Source object does not exist");
return;
}
Files.copy(src.getFile(), object.getFile());
if (src.getPropertiesFile().exists()) {
Files.copy(src.getPropertiesFile(), object.getPropertiesFile());
}
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
String etag = BaseEncoding.base16().encode(hash.asBytes());
XMLStructuredOutput structuredOutput = ctx.respondWith().addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).xml();
structuredOutput.beginOutput("CopyObjectResult");
structuredOutput.beginObject("LastModified");
structuredOutput.text(RFC822_INSTANT.format(object.getLastModifiedInstant()));
structuredOutput.endObject();
structuredOutput.beginObject(HTTP_HEADER_NAME_ETAG);
structuredOutput.text(etag(etag));
structuredOutput.endObject();
structuredOutput.endOutput();
signalObjectSuccess(ctx);
} | [
"private",
"void",
"copyObject",
"(",
"WebContext",
"ctx",
",",
"Bucket",
"bucket",
",",
"String",
"id",
",",
"String",
"copy",
")",
"throws",
"IOException",
"{",
"StoredObject",
"object",
"=",
"bucket",
".",
"getObject",
"(",
"id",
")",
";",
"if",
"(",
"!",
"copy",
".",
"contains",
"(",
"PATH_DELIMITER",
")",
")",
"{",
"signalObjectError",
"(",
"ctx",
",",
"HttpResponseStatus",
".",
"BAD_REQUEST",
",",
"\"Source must contain '/'\"",
")",
";",
"return",
";",
"}",
"String",
"srcBucketName",
"=",
"copy",
".",
"substring",
"(",
"1",
",",
"copy",
".",
"lastIndexOf",
"(",
"PATH_DELIMITER",
")",
")",
";",
"String",
"srcId",
"=",
"copy",
".",
"substring",
"(",
"copy",
".",
"lastIndexOf",
"(",
"PATH_DELIMITER",
")",
"+",
"1",
")",
";",
"Bucket",
"srcBucket",
"=",
"storage",
".",
"getBucket",
"(",
"srcBucketName",
")",
";",
"if",
"(",
"!",
"srcBucket",
".",
"exists",
"(",
")",
")",
"{",
"signalObjectError",
"(",
"ctx",
",",
"HttpResponseStatus",
".",
"BAD_REQUEST",
",",
"\"Source bucket does not exist\"",
")",
";",
"return",
";",
"}",
"StoredObject",
"src",
"=",
"srcBucket",
".",
"getObject",
"(",
"srcId",
")",
";",
"if",
"(",
"!",
"src",
".",
"exists",
"(",
")",
")",
"{",
"signalObjectError",
"(",
"ctx",
",",
"HttpResponseStatus",
".",
"BAD_REQUEST",
",",
"\"Source object does not exist\"",
")",
";",
"return",
";",
"}",
"Files",
".",
"copy",
"(",
"src",
".",
"getFile",
"(",
")",
",",
"object",
".",
"getFile",
"(",
")",
")",
";",
"if",
"(",
"src",
".",
"getPropertiesFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"Files",
".",
"copy",
"(",
"src",
".",
"getPropertiesFile",
"(",
")",
",",
"object",
".",
"getPropertiesFile",
"(",
")",
")",
";",
"}",
"HashCode",
"hash",
"=",
"Files",
".",
"hash",
"(",
"object",
".",
"getFile",
"(",
")",
",",
"Hashing",
".",
"md5",
"(",
")",
")",
";",
"String",
"etag",
"=",
"BaseEncoding",
".",
"base16",
"(",
")",
".",
"encode",
"(",
"hash",
".",
"asBytes",
"(",
")",
")",
";",
"XMLStructuredOutput",
"structuredOutput",
"=",
"ctx",
".",
"respondWith",
"(",
")",
".",
"addHeader",
"(",
"HTTP_HEADER_NAME_ETAG",
",",
"etag",
"(",
"etag",
")",
")",
".",
"xml",
"(",
")",
";",
"structuredOutput",
".",
"beginOutput",
"(",
"\"CopyObjectResult\"",
")",
";",
"structuredOutput",
".",
"beginObject",
"(",
"\"LastModified\"",
")",
";",
"structuredOutput",
".",
"text",
"(",
"RFC822_INSTANT",
".",
"format",
"(",
"object",
".",
"getLastModifiedInstant",
"(",
")",
")",
")",
";",
"structuredOutput",
".",
"endObject",
"(",
")",
";",
"structuredOutput",
".",
"beginObject",
"(",
"HTTP_HEADER_NAME_ETAG",
")",
";",
"structuredOutput",
".",
"text",
"(",
"etag",
"(",
"etag",
")",
")",
";",
"structuredOutput",
".",
"endObject",
"(",
")",
";",
"structuredOutput",
".",
"endOutput",
"(",
")",
";",
"signalObjectSuccess",
"(",
"ctx",
")",
";",
"}"
] | Handles GET /bucket/id with an <tt>x-amz-copy-source</tt> header.
@param ctx the context describing the current request
@param bucket the bucket containing the object to use as destination
@param id name of the object to use as destination | [
"Handles",
"GET",
"/",
"bucket",
"/",
"id",
"with",
"an",
"<tt",
">",
"x",
"-",
"amz",
"-",
"copy",
"-",
"source<",
"/",
"tt",
">",
"header",
"."
] | train | https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L543-L578 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.deleteConversation | public void deleteConversation(@NonNull final String conversationId, final String eTag, @Nullable Callback<ComapiResult<Void>> callback) {
"""
Returns observable to create a conversation.
@param conversationId ID of a conversation to delete.
@param eTag ETag for server to check if local version of the data is the same as the one the server side.
@param callback Callback to deliver new session instance.
"""
adapter.adapt(deleteConversation(conversationId, eTag), callback);
} | java | public void deleteConversation(@NonNull final String conversationId, final String eTag, @Nullable Callback<ComapiResult<Void>> callback) {
adapter.adapt(deleteConversation(conversationId, eTag), callback);
} | [
"public",
"void",
"deleteConversation",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"final",
"String",
"eTag",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"Void",
">",
">",
"callback",
")",
"{",
"adapter",
".",
"adapt",
"(",
"deleteConversation",
"(",
"conversationId",
",",
"eTag",
")",
",",
"callback",
")",
";",
"}"
] | Returns observable to create a conversation.
@param conversationId ID of a conversation to delete.
@param eTag ETag for server to check if local version of the data is the same as the one the server side.
@param callback Callback to deliver new session instance. | [
"Returns",
"observable",
"to",
"create",
"a",
"conversation",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L464-L466 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java | BasicEvaluationCtx.checkContext | private Attribute checkContext(URI type, URI id, URI issuer,
URI category, int designatorType) {
"""
Private helper that checks the request context for an attribute, or else returns
null
"""
if (!STRING_ATTRIBUTE_TYPE_URI.equals(type)) return null;
String [] values = null;
switch(designatorType){
case AttributeDesignator.SUBJECT_TARGET:
values = context.getSubjectValues(id.toString());
break;
case AttributeDesignator.RESOURCE_TARGET:
values = context.getResourceValues(id);
break;
case AttributeDesignator.ACTION_TARGET:
values = context.getActionValues(id);
break;
case AttributeDesignator.ENVIRONMENT_TARGET:
values = context.getEnvironmentValues(id);
break;
}
if (values == null || values.length == 0) return null;
String iString = (issuer == null) ? null : issuer.toString();
String tString = type.toString();
if (values.length == 1) {
AttributeValue val = stringToValue(values[0], tString);
return (val == null) ? null :
new SingletonAttribute(id, iString, getCurrentDateTime(), val);
} else {
ArrayList<AttributeValue> valCollection = new ArrayList<AttributeValue>(values.length);
for (int i=0;i<values.length;i++) {
AttributeValue val = stringToValue(values[i], tString);
if (val != null) valCollection.add(val);
}
return new BasicAttribute(id, type, iString, getCurrentDateTime(), valCollection);
}
} | java | private Attribute checkContext(URI type, URI id, URI issuer,
URI category, int designatorType) {
if (!STRING_ATTRIBUTE_TYPE_URI.equals(type)) return null;
String [] values = null;
switch(designatorType){
case AttributeDesignator.SUBJECT_TARGET:
values = context.getSubjectValues(id.toString());
break;
case AttributeDesignator.RESOURCE_TARGET:
values = context.getResourceValues(id);
break;
case AttributeDesignator.ACTION_TARGET:
values = context.getActionValues(id);
break;
case AttributeDesignator.ENVIRONMENT_TARGET:
values = context.getEnvironmentValues(id);
break;
}
if (values == null || values.length == 0) return null;
String iString = (issuer == null) ? null : issuer.toString();
String tString = type.toString();
if (values.length == 1) {
AttributeValue val = stringToValue(values[0], tString);
return (val == null) ? null :
new SingletonAttribute(id, iString, getCurrentDateTime(), val);
} else {
ArrayList<AttributeValue> valCollection = new ArrayList<AttributeValue>(values.length);
for (int i=0;i<values.length;i++) {
AttributeValue val = stringToValue(values[i], tString);
if (val != null) valCollection.add(val);
}
return new BasicAttribute(id, type, iString, getCurrentDateTime(), valCollection);
}
} | [
"private",
"Attribute",
"checkContext",
"(",
"URI",
"type",
",",
"URI",
"id",
",",
"URI",
"issuer",
",",
"URI",
"category",
",",
"int",
"designatorType",
")",
"{",
"if",
"(",
"!",
"STRING_ATTRIBUTE_TYPE_URI",
".",
"equals",
"(",
"type",
")",
")",
"return",
"null",
";",
"String",
"[",
"]",
"values",
"=",
"null",
";",
"switch",
"(",
"designatorType",
")",
"{",
"case",
"AttributeDesignator",
".",
"SUBJECT_TARGET",
":",
"values",
"=",
"context",
".",
"getSubjectValues",
"(",
"id",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"case",
"AttributeDesignator",
".",
"RESOURCE_TARGET",
":",
"values",
"=",
"context",
".",
"getResourceValues",
"(",
"id",
")",
";",
"break",
";",
"case",
"AttributeDesignator",
".",
"ACTION_TARGET",
":",
"values",
"=",
"context",
".",
"getActionValues",
"(",
"id",
")",
";",
"break",
";",
"case",
"AttributeDesignator",
".",
"ENVIRONMENT_TARGET",
":",
"values",
"=",
"context",
".",
"getEnvironmentValues",
"(",
"id",
")",
";",
"break",
";",
"}",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"String",
"iString",
"=",
"(",
"issuer",
"==",
"null",
")",
"?",
"null",
":",
"issuer",
".",
"toString",
"(",
")",
";",
"String",
"tString",
"=",
"type",
".",
"toString",
"(",
")",
";",
"if",
"(",
"values",
".",
"length",
"==",
"1",
")",
"{",
"AttributeValue",
"val",
"=",
"stringToValue",
"(",
"values",
"[",
"0",
"]",
",",
"tString",
")",
";",
"return",
"(",
"val",
"==",
"null",
")",
"?",
"null",
":",
"new",
"SingletonAttribute",
"(",
"id",
",",
"iString",
",",
"getCurrentDateTime",
"(",
")",
",",
"val",
")",
";",
"}",
"else",
"{",
"ArrayList",
"<",
"AttributeValue",
">",
"valCollection",
"=",
"new",
"ArrayList",
"<",
"AttributeValue",
">",
"(",
"values",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"length",
";",
"i",
"++",
")",
"{",
"AttributeValue",
"val",
"=",
"stringToValue",
"(",
"values",
"[",
"i",
"]",
",",
"tString",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"valCollection",
".",
"add",
"(",
"val",
")",
";",
"}",
"return",
"new",
"BasicAttribute",
"(",
"id",
",",
"type",
",",
"iString",
",",
"getCurrentDateTime",
"(",
")",
",",
"valCollection",
")",
";",
"}",
"}"
] | Private helper that checks the request context for an attribute, or else returns
null | [
"Private",
"helper",
"that",
"checks",
"the",
"request",
"context",
"for",
"an",
"attribute",
"or",
"else",
"returns",
"null"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java#L706-L739 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java | ConstructState.addConstructState | public void addConstructState(Constructs construct, ConstructState constructState, Optional<String> infix) {
"""
Merge a {@link ConstructState} for a child construct into this {@link ConstructState}.
<p>
Non-override property names will be mutated as follows: key -> construct.name() + infix + key
</p>
@param construct type of the child construct.
@param constructState {@link ConstructState} to merge.
@param infix infix added to each non-override key (for example converter number if there are multiple converters).
"""
addOverwriteProperties(constructState.getOverwritePropertiesMap());
constructState.removeProp(OVERWRITE_PROPS_KEY);
for (String key : constructState.getPropertyNames()) {
setProp(construct.name() + "." + (infix.isPresent() ? infix.get() + "." : "") + key, constructState.getProp(key));
}
addAll(constructState);
} | java | public void addConstructState(Constructs construct, ConstructState constructState, Optional<String> infix) {
addOverwriteProperties(constructState.getOverwritePropertiesMap());
constructState.removeProp(OVERWRITE_PROPS_KEY);
for (String key : constructState.getPropertyNames()) {
setProp(construct.name() + "." + (infix.isPresent() ? infix.get() + "." : "") + key, constructState.getProp(key));
}
addAll(constructState);
} | [
"public",
"void",
"addConstructState",
"(",
"Constructs",
"construct",
",",
"ConstructState",
"constructState",
",",
"Optional",
"<",
"String",
">",
"infix",
")",
"{",
"addOverwriteProperties",
"(",
"constructState",
".",
"getOverwritePropertiesMap",
"(",
")",
")",
";",
"constructState",
".",
"removeProp",
"(",
"OVERWRITE_PROPS_KEY",
")",
";",
"for",
"(",
"String",
"key",
":",
"constructState",
".",
"getPropertyNames",
"(",
")",
")",
"{",
"setProp",
"(",
"construct",
".",
"name",
"(",
")",
"+",
"\".\"",
"+",
"(",
"infix",
".",
"isPresent",
"(",
")",
"?",
"infix",
".",
"get",
"(",
")",
"+",
"\".\"",
":",
"\"\"",
")",
"+",
"key",
",",
"constructState",
".",
"getProp",
"(",
"key",
")",
")",
";",
"}",
"addAll",
"(",
"constructState",
")",
";",
"}"
] | Merge a {@link ConstructState} for a child construct into this {@link ConstructState}.
<p>
Non-override property names will be mutated as follows: key -> construct.name() + infix + key
</p>
@param construct type of the child construct.
@param constructState {@link ConstructState} to merge.
@param infix infix added to each non-override key (for example converter number if there are multiple converters). | [
"Merge",
"a",
"{",
"@link",
"ConstructState",
"}",
"for",
"a",
"child",
"construct",
"into",
"this",
"{",
"@link",
"ConstructState",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L105-L114 |
Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsEquals | public static void checkNumOfArgsEquals(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
"""
Checks the number of non-option arguments equals n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number does not equal n
"""
if (cl.getArgs().length != n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | java | public static void checkNumOfArgsEquals(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length != n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | [
"public",
"static",
"void",
"checkNumOfArgsEquals",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
"!=",
"n",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"ExceptionMessage",
".",
"INVALID_ARGS_NUM",
".",
"getMessage",
"(",
"cmd",
".",
"getCommandName",
"(",
")",
",",
"n",
",",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
")",
")",
";",
"}",
"}"
] | Checks the number of non-option arguments equals n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number does not equal n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"equals",
"n",
"for",
"command",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L68-L74 |
ModeShape/modeshape | modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java | DocumentFactory.newArray | public static EditableArray newArray( Collection<?> values ) {
"""
Create a new editable array that can be used as a new array value in other documents.
@param values the initial values for the array
@return the editable array; never null
"""
BasicArray array = new BasicArray(values.size());
array.addAllValues(values);
return new ArrayEditor(array, DEFAULT_FACTORY);
} | java | public static EditableArray newArray( Collection<?> values ) {
BasicArray array = new BasicArray(values.size());
array.addAllValues(values);
return new ArrayEditor(array, DEFAULT_FACTORY);
} | [
"public",
"static",
"EditableArray",
"newArray",
"(",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"BasicArray",
"array",
"=",
"new",
"BasicArray",
"(",
"values",
".",
"size",
"(",
")",
")",
";",
"array",
".",
"addAllValues",
"(",
"values",
")",
";",
"return",
"new",
"ArrayEditor",
"(",
"array",
",",
"DEFAULT_FACTORY",
")",
";",
"}"
] | Create a new editable array that can be used as a new array value in other documents.
@param values the initial values for the array
@return the editable array; never null | [
"Create",
"a",
"new",
"editable",
"array",
"that",
"can",
"be",
"used",
"as",
"a",
"new",
"array",
"value",
"in",
"other",
"documents",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java#L171-L175 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/factory/feature/tracker/FactoryPointTracker.java | FactoryPointTracker.combined_ST_SURF_KLT | public static <I extends ImageGray<I>, D extends ImageGray<D>>
PointTracker<I> combined_ST_SURF_KLT(ConfigGeneralDetector configExtract,
PkltConfig kltConfig,
int reactivateThreshold,
ConfigSurfDescribe.Stability configDescribe,
ConfigSlidingIntegral configOrientation,
Class<I> imageType,
@Nullable Class<D> derivType) {
"""
Creates a tracker which detects Shi-Tomasi corner features, describes them with SURF, and
nominally tracks them using KLT.
@see ShiTomasiCornerIntensity
@see DescribePointSurf
@see boofcv.abst.feature.tracker.DdaManagerDetectDescribePoint
@param configExtract Configuration for extracting features
@param kltConfig Configuration for KLT
@param reactivateThreshold Tracks are reactivated after this many have been dropped. Try 10% of maxMatches
@param configDescribe Configuration for SURF descriptor
@param configOrientation Configuration for region orientation. If null then orientation isn't estimated
@param imageType Type of image the input is.
@param derivType Image derivative type. @return SURF based tracker.
"""
if( derivType == null )
derivType = GImageDerivativeOps.getDerivativeType(imageType);
GeneralFeatureDetector<I, D> corner = createShiTomasi(configExtract, derivType);
InterestPointDetector<I> detector = FactoryInterestPoint.wrapPoint(corner, 1, imageType, derivType);
DescribeRegionPoint<I,BrightFeature> regionDesc
= FactoryDescribeRegionPoint.surfStable(configDescribe, imageType);
ScoreAssociation<TupleDesc_F64> score = FactoryAssociation.scoreEuclidean(TupleDesc_F64.class, true);
AssociateSurfBasic assoc = new AssociateSurfBasic(FactoryAssociation.greedy(score, 100000, true));
AssociateDescription<BrightFeature> generalAssoc = new WrapAssociateSurfBasic(assoc);
OrientationImage<I> orientation = null;
if( configOrientation != null ) {
Class integralType = GIntegralImageOps.getIntegralType(imageType);
OrientationIntegral orientationII = FactoryOrientationAlgs.sliding_ii(configOrientation, integralType);
orientation = FactoryOrientation.convertImage(orientationII,imageType);
}
return combined(detector,orientation,regionDesc,generalAssoc, kltConfig,reactivateThreshold,
imageType);
} | java | public static <I extends ImageGray<I>, D extends ImageGray<D>>
PointTracker<I> combined_ST_SURF_KLT(ConfigGeneralDetector configExtract,
PkltConfig kltConfig,
int reactivateThreshold,
ConfigSurfDescribe.Stability configDescribe,
ConfigSlidingIntegral configOrientation,
Class<I> imageType,
@Nullable Class<D> derivType) {
if( derivType == null )
derivType = GImageDerivativeOps.getDerivativeType(imageType);
GeneralFeatureDetector<I, D> corner = createShiTomasi(configExtract, derivType);
InterestPointDetector<I> detector = FactoryInterestPoint.wrapPoint(corner, 1, imageType, derivType);
DescribeRegionPoint<I,BrightFeature> regionDesc
= FactoryDescribeRegionPoint.surfStable(configDescribe, imageType);
ScoreAssociation<TupleDesc_F64> score = FactoryAssociation.scoreEuclidean(TupleDesc_F64.class, true);
AssociateSurfBasic assoc = new AssociateSurfBasic(FactoryAssociation.greedy(score, 100000, true));
AssociateDescription<BrightFeature> generalAssoc = new WrapAssociateSurfBasic(assoc);
OrientationImage<I> orientation = null;
if( configOrientation != null ) {
Class integralType = GIntegralImageOps.getIntegralType(imageType);
OrientationIntegral orientationII = FactoryOrientationAlgs.sliding_ii(configOrientation, integralType);
orientation = FactoryOrientation.convertImage(orientationII,imageType);
}
return combined(detector,orientation,regionDesc,generalAssoc, kltConfig,reactivateThreshold,
imageType);
} | [
"public",
"static",
"<",
"I",
"extends",
"ImageGray",
"<",
"I",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"PointTracker",
"<",
"I",
">",
"combined_ST_SURF_KLT",
"(",
"ConfigGeneralDetector",
"configExtract",
",",
"PkltConfig",
"kltConfig",
",",
"int",
"reactivateThreshold",
",",
"ConfigSurfDescribe",
".",
"Stability",
"configDescribe",
",",
"ConfigSlidingIntegral",
"configOrientation",
",",
"Class",
"<",
"I",
">",
"imageType",
",",
"@",
"Nullable",
"Class",
"<",
"D",
">",
"derivType",
")",
"{",
"if",
"(",
"derivType",
"==",
"null",
")",
"derivType",
"=",
"GImageDerivativeOps",
".",
"getDerivativeType",
"(",
"imageType",
")",
";",
"GeneralFeatureDetector",
"<",
"I",
",",
"D",
">",
"corner",
"=",
"createShiTomasi",
"(",
"configExtract",
",",
"derivType",
")",
";",
"InterestPointDetector",
"<",
"I",
">",
"detector",
"=",
"FactoryInterestPoint",
".",
"wrapPoint",
"(",
"corner",
",",
"1",
",",
"imageType",
",",
"derivType",
")",
";",
"DescribeRegionPoint",
"<",
"I",
",",
"BrightFeature",
">",
"regionDesc",
"=",
"FactoryDescribeRegionPoint",
".",
"surfStable",
"(",
"configDescribe",
",",
"imageType",
")",
";",
"ScoreAssociation",
"<",
"TupleDesc_F64",
">",
"score",
"=",
"FactoryAssociation",
".",
"scoreEuclidean",
"(",
"TupleDesc_F64",
".",
"class",
",",
"true",
")",
";",
"AssociateSurfBasic",
"assoc",
"=",
"new",
"AssociateSurfBasic",
"(",
"FactoryAssociation",
".",
"greedy",
"(",
"score",
",",
"100000",
",",
"true",
")",
")",
";",
"AssociateDescription",
"<",
"BrightFeature",
">",
"generalAssoc",
"=",
"new",
"WrapAssociateSurfBasic",
"(",
"assoc",
")",
";",
"OrientationImage",
"<",
"I",
">",
"orientation",
"=",
"null",
";",
"if",
"(",
"configOrientation",
"!=",
"null",
")",
"{",
"Class",
"integralType",
"=",
"GIntegralImageOps",
".",
"getIntegralType",
"(",
"imageType",
")",
";",
"OrientationIntegral",
"orientationII",
"=",
"FactoryOrientationAlgs",
".",
"sliding_ii",
"(",
"configOrientation",
",",
"integralType",
")",
";",
"orientation",
"=",
"FactoryOrientation",
".",
"convertImage",
"(",
"orientationII",
",",
"imageType",
")",
";",
"}",
"return",
"combined",
"(",
"detector",
",",
"orientation",
",",
"regionDesc",
",",
"generalAssoc",
",",
"kltConfig",
",",
"reactivateThreshold",
",",
"imageType",
")",
";",
"}"
] | Creates a tracker which detects Shi-Tomasi corner features, describes them with SURF, and
nominally tracks them using KLT.
@see ShiTomasiCornerIntensity
@see DescribePointSurf
@see boofcv.abst.feature.tracker.DdaManagerDetectDescribePoint
@param configExtract Configuration for extracting features
@param kltConfig Configuration for KLT
@param reactivateThreshold Tracks are reactivated after this many have been dropped. Try 10% of maxMatches
@param configDescribe Configuration for SURF descriptor
@param configOrientation Configuration for region orientation. If null then orientation isn't estimated
@param imageType Type of image the input is.
@param derivType Image derivative type. @return SURF based tracker. | [
"Creates",
"a",
"tracker",
"which",
"detects",
"Shi",
"-",
"Tomasi",
"corner",
"features",
"describes",
"them",
"with",
"SURF",
"and",
"nominally",
"tracks",
"them",
"using",
"KLT",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/feature/tracker/FactoryPointTracker.java#L422-L455 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java | JdbcUtil.queryJsonObject | public static JSONObject queryJsonObject(final String sql, final List<Object> paramList, final Connection connection,
final String tableName, final boolean isDebug) throws SQLException, JSONException, RepositoryException {
"""
queryJsonObject.
@param sql sql
@param paramList paramList
@param connection connection
@param tableName tableName
@param isDebug the specified debug flag
@return JSONObject only one record.
@throws SQLException SQLException
@throws JSONException JSONException
@throws RepositoryException repositoryException
"""
return queryJson(sql, paramList, connection, true, tableName, isDebug);
} | java | public static JSONObject queryJsonObject(final String sql, final List<Object> paramList, final Connection connection,
final String tableName, final boolean isDebug) throws SQLException, JSONException, RepositoryException {
return queryJson(sql, paramList, connection, true, tableName, isDebug);
} | [
"public",
"static",
"JSONObject",
"queryJsonObject",
"(",
"final",
"String",
"sql",
",",
"final",
"List",
"<",
"Object",
">",
"paramList",
",",
"final",
"Connection",
"connection",
",",
"final",
"String",
"tableName",
",",
"final",
"boolean",
"isDebug",
")",
"throws",
"SQLException",
",",
"JSONException",
",",
"RepositoryException",
"{",
"return",
"queryJson",
"(",
"sql",
",",
"paramList",
",",
"connection",
",",
"true",
",",
"tableName",
",",
"isDebug",
")",
";",
"}"
] | queryJsonObject.
@param sql sql
@param paramList paramList
@param connection connection
@param tableName tableName
@param isDebug the specified debug flag
@return JSONObject only one record.
@throws SQLException SQLException
@throws JSONException JSONException
@throws RepositoryException repositoryException | [
"queryJsonObject",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java#L110-L113 |
febit/wit | wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java | ClassWriter.newLong | private Item newLong(final long value) {
"""
Adds a long to the constant pool of the class being build. Does nothing if the constant pool already contains a
similar item.
@param value the long value.
@return a new or already existing long item.
"""
Item result = get(key.set(LONG, value));
if (result == null) {
pool.putByte(LONG).putLong(value);
result = new Item(poolIndex, key);
put(result);
poolIndex += 2;
}
return result;
} | java | private Item newLong(final long value) {
Item result = get(key.set(LONG, value));
if (result == null) {
pool.putByte(LONG).putLong(value);
result = new Item(poolIndex, key);
put(result);
poolIndex += 2;
}
return result;
} | [
"private",
"Item",
"newLong",
"(",
"final",
"long",
"value",
")",
"{",
"Item",
"result",
"=",
"get",
"(",
"key",
".",
"set",
"(",
"LONG",
",",
"value",
")",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"pool",
".",
"putByte",
"(",
"LONG",
")",
".",
"putLong",
"(",
"value",
")",
";",
"result",
"=",
"new",
"Item",
"(",
"poolIndex",
",",
"key",
")",
";",
"put",
"(",
"result",
")",
";",
"poolIndex",
"+=",
"2",
";",
"}",
"return",
"result",
";",
"}"
] | Adds a long to the constant pool of the class being build. Does nothing if the constant pool already contains a
similar item.
@param value the long value.
@return a new or already existing long item. | [
"Adds",
"a",
"long",
"to",
"the",
"constant",
"pool",
"of",
"the",
"class",
"being",
"build",
".",
"Does",
"nothing",
"if",
"the",
"constant",
"pool",
"already",
"contains",
"a",
"similar",
"item",
"."
] | train | https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L648-L657 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java | FlowPath.planRewind | public void planRewind(@NonNull String frameName, boolean reallyPlan) {
"""
This method announces future rewind of graph execution to specified position
@param frameName
"""
frames.get(frameName).setRewindPlanned(reallyPlan);
} | java | public void planRewind(@NonNull String frameName, boolean reallyPlan) {
frames.get(frameName).setRewindPlanned(reallyPlan);
} | [
"public",
"void",
"planRewind",
"(",
"@",
"NonNull",
"String",
"frameName",
",",
"boolean",
"reallyPlan",
")",
"{",
"frames",
".",
"get",
"(",
"frameName",
")",
".",
"setRewindPlanned",
"(",
"reallyPlan",
")",
";",
"}"
] | This method announces future rewind of graph execution to specified position
@param frameName | [
"This",
"method",
"announces",
"future",
"rewind",
"of",
"graph",
"execution",
"to",
"specified",
"position"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java#L177-L179 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/idemix/RevocationAuthority.java | RevocationAuthority.createCRI | public static Idemix.CredentialRevocationInformation createCRI(PrivateKey key, BIG[] unrevokedHandles, int epoch, RevocationAlgorithm alg) throws CryptoException {
"""
Creates a Credential Revocation Information object
@param key Private key
@param unrevokedHandles Array of unrevoked revocation handles
@param epoch The counter (representing a time window) in which this CRI is valid
@param alg Revocation algorithm
@return CredentialRevocationInformation object
"""
Idemix.CredentialRevocationInformation.Builder builder = Idemix.CredentialRevocationInformation.newBuilder();
builder.setRevocationAlg(alg.ordinal());
builder.setEpoch(epoch);
// Create epoch key
WeakBB.KeyPair keyPair = WeakBB.weakBBKeyGen();
if (alg == RevocationAlgorithm.ALG_NO_REVOCATION) {
// Dummy PK in the proto
builder.setEpochPk(IdemixUtils.transformToProto(IdemixUtils.genG2));
} else {
// Real PK only if we are going to use it
builder.setEpochPk(IdemixUtils.transformToProto(keyPair.getPk()));
}
// Sign epoch + epoch key with the long term key
byte[] signed;
try {
Idemix.CredentialRevocationInformation cri = builder.build();
Signature ecdsa = Signature.getInstance("SHA256withECDSA");
ecdsa.initSign(key);
ecdsa.update(cri.toByteArray());
signed = ecdsa.sign();
builder.setEpochPkSig(ByteString.copyFrom(signed));
} catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException e) {
throw new CryptoException("Error processing the signature");
}
if (alg == RevocationAlgorithm.ALG_NO_REVOCATION) {
// build and return the credential information object
return builder.build();
} else {
// If alg not supported, return null
throw new IllegalArgumentException("Algorithm " + alg.name() + " not supported");
}
} | java | public static Idemix.CredentialRevocationInformation createCRI(PrivateKey key, BIG[] unrevokedHandles, int epoch, RevocationAlgorithm alg) throws CryptoException {
Idemix.CredentialRevocationInformation.Builder builder = Idemix.CredentialRevocationInformation.newBuilder();
builder.setRevocationAlg(alg.ordinal());
builder.setEpoch(epoch);
// Create epoch key
WeakBB.KeyPair keyPair = WeakBB.weakBBKeyGen();
if (alg == RevocationAlgorithm.ALG_NO_REVOCATION) {
// Dummy PK in the proto
builder.setEpochPk(IdemixUtils.transformToProto(IdemixUtils.genG2));
} else {
// Real PK only if we are going to use it
builder.setEpochPk(IdemixUtils.transformToProto(keyPair.getPk()));
}
// Sign epoch + epoch key with the long term key
byte[] signed;
try {
Idemix.CredentialRevocationInformation cri = builder.build();
Signature ecdsa = Signature.getInstance("SHA256withECDSA");
ecdsa.initSign(key);
ecdsa.update(cri.toByteArray());
signed = ecdsa.sign();
builder.setEpochPkSig(ByteString.copyFrom(signed));
} catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException e) {
throw new CryptoException("Error processing the signature");
}
if (alg == RevocationAlgorithm.ALG_NO_REVOCATION) {
// build and return the credential information object
return builder.build();
} else {
// If alg not supported, return null
throw new IllegalArgumentException("Algorithm " + alg.name() + " not supported");
}
} | [
"public",
"static",
"Idemix",
".",
"CredentialRevocationInformation",
"createCRI",
"(",
"PrivateKey",
"key",
",",
"BIG",
"[",
"]",
"unrevokedHandles",
",",
"int",
"epoch",
",",
"RevocationAlgorithm",
"alg",
")",
"throws",
"CryptoException",
"{",
"Idemix",
".",
"CredentialRevocationInformation",
".",
"Builder",
"builder",
"=",
"Idemix",
".",
"CredentialRevocationInformation",
".",
"newBuilder",
"(",
")",
";",
"builder",
".",
"setRevocationAlg",
"(",
"alg",
".",
"ordinal",
"(",
")",
")",
";",
"builder",
".",
"setEpoch",
"(",
"epoch",
")",
";",
"// Create epoch key",
"WeakBB",
".",
"KeyPair",
"keyPair",
"=",
"WeakBB",
".",
"weakBBKeyGen",
"(",
")",
";",
"if",
"(",
"alg",
"==",
"RevocationAlgorithm",
".",
"ALG_NO_REVOCATION",
")",
"{",
"// Dummy PK in the proto",
"builder",
".",
"setEpochPk",
"(",
"IdemixUtils",
".",
"transformToProto",
"(",
"IdemixUtils",
".",
"genG2",
")",
")",
";",
"}",
"else",
"{",
"// Real PK only if we are going to use it",
"builder",
".",
"setEpochPk",
"(",
"IdemixUtils",
".",
"transformToProto",
"(",
"keyPair",
".",
"getPk",
"(",
")",
")",
")",
";",
"}",
"// Sign epoch + epoch key with the long term key",
"byte",
"[",
"]",
"signed",
";",
"try",
"{",
"Idemix",
".",
"CredentialRevocationInformation",
"cri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"Signature",
"ecdsa",
"=",
"Signature",
".",
"getInstance",
"(",
"\"SHA256withECDSA\"",
")",
";",
"ecdsa",
".",
"initSign",
"(",
"key",
")",
";",
"ecdsa",
".",
"update",
"(",
"cri",
".",
"toByteArray",
"(",
")",
")",
";",
"signed",
"=",
"ecdsa",
".",
"sign",
"(",
")",
";",
"builder",
".",
"setEpochPkSig",
"(",
"ByteString",
".",
"copyFrom",
"(",
"signed",
")",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"|",
"SignatureException",
"|",
"InvalidKeyException",
"e",
")",
"{",
"throw",
"new",
"CryptoException",
"(",
"\"Error processing the signature\"",
")",
";",
"}",
"if",
"(",
"alg",
"==",
"RevocationAlgorithm",
".",
"ALG_NO_REVOCATION",
")",
"{",
"// build and return the credential information object",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}",
"else",
"{",
"// If alg not supported, return null",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Algorithm \"",
"+",
"alg",
".",
"name",
"(",
")",
"+",
"\" not supported\"",
")",
";",
"}",
"}"
] | Creates a Credential Revocation Information object
@param key Private key
@param unrevokedHandles Array of unrevoked revocation handles
@param epoch The counter (representing a time window) in which this CRI is valid
@param alg Revocation algorithm
@return CredentialRevocationInformation object | [
"Creates",
"a",
"Credential",
"Revocation",
"Information",
"object"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/idemix/RevocationAuthority.java#L87-L123 |
alkacon/opencms-core | src/org/opencms/loader/CmsTemplateContextManager.java | CmsTemplateContextManager.shouldShowType | public boolean shouldShowType(String contextKey, String typeName) {
"""
Helper method to check whether a given type should not be shown in a context.<p>
@param contextKey the key of the template context
@param typeName the type name
@return true if the context does not prohibit showing the type
"""
Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
if (allowedContexts == null) {
return true;
}
return allowedContexts.contains(contextKey);
} | java | public boolean shouldShowType(String contextKey, String typeName) {
Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
if (allowedContexts == null) {
return true;
}
return allowedContexts.contains(contextKey);
} | [
"public",
"boolean",
"shouldShowType",
"(",
"String",
"contextKey",
",",
"String",
"typeName",
")",
"{",
"Map",
"<",
"String",
",",
"CmsDefaultSet",
"<",
"String",
">",
">",
"allowedContextMap",
"=",
"safeGetAllowedContextMap",
"(",
")",
";",
"CmsDefaultSet",
"<",
"String",
">",
"allowedContexts",
"=",
"allowedContextMap",
".",
"get",
"(",
"typeName",
")",
";",
"if",
"(",
"allowedContexts",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"allowedContexts",
".",
"contains",
"(",
"contextKey",
")",
";",
"}"
] | Helper method to check whether a given type should not be shown in a context.<p>
@param contextKey the key of the template context
@param typeName the type name
@return true if the context does not prohibit showing the type | [
"Helper",
"method",
"to",
"check",
"whether",
"a",
"given",
"type",
"should",
"not",
"be",
"shown",
"in",
"a",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsTemplateContextManager.java#L355-L363 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTemplateMatching.java | TldTemplateMatching.computeNccDescriptor | public void computeNccDescriptor( NccFeature f , float x0 , float y0 , float x1 , float y1 ) {
"""
Computes the NCC descriptor by sample points at evenly spaced distances inside the rectangle
"""
double mean = 0;
float widthStep = (x1-x0)/15.0f;
float heightStep = (y1-y0)/15.0f;
// compute the mean value
int index = 0;
for( int y = 0; y < 15; y++ ) {
float sampleY = y0 + y*heightStep;
for( int x = 0; x < 15; x++ ) {
mean += f.value[index++] = interpolate.get_fast(x0 + x * widthStep, sampleY);
}
}
mean /= 15*15;
// compute the variance and save the difference from the mean
double variance = 0;
index = 0;
for( int y = 0; y < 15; y++ ) {
for( int x = 0; x < 15; x++ ) {
double v = f.value[index++] -= mean;
variance += v*v;
}
}
variance /= 15*15;
f.mean = mean;
f.sigma = Math.sqrt(variance);
} | java | public void computeNccDescriptor( NccFeature f , float x0 , float y0 , float x1 , float y1 ) {
double mean = 0;
float widthStep = (x1-x0)/15.0f;
float heightStep = (y1-y0)/15.0f;
// compute the mean value
int index = 0;
for( int y = 0; y < 15; y++ ) {
float sampleY = y0 + y*heightStep;
for( int x = 0; x < 15; x++ ) {
mean += f.value[index++] = interpolate.get_fast(x0 + x * widthStep, sampleY);
}
}
mean /= 15*15;
// compute the variance and save the difference from the mean
double variance = 0;
index = 0;
for( int y = 0; y < 15; y++ ) {
for( int x = 0; x < 15; x++ ) {
double v = f.value[index++] -= mean;
variance += v*v;
}
}
variance /= 15*15;
f.mean = mean;
f.sigma = Math.sqrt(variance);
} | [
"public",
"void",
"computeNccDescriptor",
"(",
"NccFeature",
"f",
",",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"x1",
",",
"float",
"y1",
")",
"{",
"double",
"mean",
"=",
"0",
";",
"float",
"widthStep",
"=",
"(",
"x1",
"-",
"x0",
")",
"/",
"15.0f",
";",
"float",
"heightStep",
"=",
"(",
"y1",
"-",
"y0",
")",
"/",
"15.0f",
";",
"// compute the mean value",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"15",
";",
"y",
"++",
")",
"{",
"float",
"sampleY",
"=",
"y0",
"+",
"y",
"*",
"heightStep",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"15",
";",
"x",
"++",
")",
"{",
"mean",
"+=",
"f",
".",
"value",
"[",
"index",
"++",
"]",
"=",
"interpolate",
".",
"get_fast",
"(",
"x0",
"+",
"x",
"*",
"widthStep",
",",
"sampleY",
")",
";",
"}",
"}",
"mean",
"/=",
"15",
"*",
"15",
";",
"// compute the variance and save the difference from the mean",
"double",
"variance",
"=",
"0",
";",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"15",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"15",
";",
"x",
"++",
")",
"{",
"double",
"v",
"=",
"f",
".",
"value",
"[",
"index",
"++",
"]",
"-=",
"mean",
";",
"variance",
"+=",
"v",
"*",
"v",
";",
"}",
"}",
"variance",
"/=",
"15",
"*",
"15",
";",
"f",
".",
"mean",
"=",
"mean",
";",
"f",
".",
"sigma",
"=",
"Math",
".",
"sqrt",
"(",
"variance",
")",
";",
"}"
] | Computes the NCC descriptor by sample points at evenly spaced distances inside the rectangle | [
"Computes",
"the",
"NCC",
"descriptor",
"by",
"sample",
"points",
"at",
"evenly",
"spaced",
"distances",
"inside",
"the",
"rectangle"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTemplateMatching.java#L129-L156 |
vatbub/common | internet/src/main/java/com/github/vatbub/common/internet/Internet.java | Internet.sendEventToIFTTTMakerChannel | public static String sendEventToIFTTTMakerChannel(String IFTTTMakerChannelApiKey, String eventName, String details1)
throws IOException {
"""
Sends an event to the IFTTT Maker Channel. See
<a href="https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a>
for more information.
@param IFTTTMakerChannelApiKey Your Maker API Key. Get your one on
<a href="https://ifttt.com/maker">https://ifttt.com/maker</a>
@param eventName The name of the event to trigger.
@param details1 You can send up to three additional fields to the Maker
channel which you can use then as IFTTT ingredients. See
<a href=
"https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a>
for more information.
@return The response text from IFTTT
@throws IOException Should actually never be thrown but occurs if something is
wrong with the connection (e. g. not connected)
"""
return sendEventToIFTTTMakerChannel(IFTTTMakerChannelApiKey, eventName, details1, "");
} | java | public static String sendEventToIFTTTMakerChannel(String IFTTTMakerChannelApiKey, String eventName, String details1)
throws IOException {
return sendEventToIFTTTMakerChannel(IFTTTMakerChannelApiKey, eventName, details1, "");
} | [
"public",
"static",
"String",
"sendEventToIFTTTMakerChannel",
"(",
"String",
"IFTTTMakerChannelApiKey",
",",
"String",
"eventName",
",",
"String",
"details1",
")",
"throws",
"IOException",
"{",
"return",
"sendEventToIFTTTMakerChannel",
"(",
"IFTTTMakerChannelApiKey",
",",
"eventName",
",",
"details1",
",",
"\"\"",
")",
";",
"}"
] | Sends an event to the IFTTT Maker Channel. See
<a href="https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a>
for more information.
@param IFTTTMakerChannelApiKey Your Maker API Key. Get your one on
<a href="https://ifttt.com/maker">https://ifttt.com/maker</a>
@param eventName The name of the event to trigger.
@param details1 You can send up to three additional fields to the Maker
channel which you can use then as IFTTT ingredients. See
<a href=
"https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a>
for more information.
@return The response text from IFTTT
@throws IOException Should actually never be thrown but occurs if something is
wrong with the connection (e. g. not connected) | [
"Sends",
"an",
"event",
"to",
"the",
"IFTTT",
"Maker",
"Channel",
".",
"See",
"<a",
"href",
"=",
"https",
":",
"//",
"maker",
".",
"ifttt",
".",
"com",
"/",
"use",
"/",
">",
"https",
":",
"//",
"maker",
".",
"ifttt",
".",
"com",
"/",
"use",
"/",
"<",
"/",
"a",
">",
"for",
"more",
"information",
"."
] | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/internet/src/main/java/com/github/vatbub/common/internet/Internet.java#L88-L91 |
BoltsFramework/Bolts-Android | bolts-tasks/src/main/java/bolts/Task.java | Task.continueWithTask | public <TContinuationResult> Task<TContinuationResult> continueWithTask(
Continuation<TResult, Task<TContinuationResult>> continuation) {
"""
Adds an asynchronous continuation to this task, returning a new task that completes after the
task returned by the continuation has completed.
"""
return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null);
} | java | public <TContinuationResult> Task<TContinuationResult> continueWithTask(
Continuation<TResult, Task<TContinuationResult>> continuation) {
return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null);
} | [
"public",
"<",
"TContinuationResult",
">",
"Task",
"<",
"TContinuationResult",
">",
"continueWithTask",
"(",
"Continuation",
"<",
"TResult",
",",
"Task",
"<",
"TContinuationResult",
">",
">",
"continuation",
")",
"{",
"return",
"continueWithTask",
"(",
"continuation",
",",
"IMMEDIATE_EXECUTOR",
",",
"null",
")",
";",
"}"
] | Adds an asynchronous continuation to this task, returning a new task that completes after the
task returned by the continuation has completed. | [
"Adds",
"an",
"asynchronous",
"continuation",
"to",
"this",
"task",
"returning",
"a",
"new",
"task",
"that",
"completes",
"after",
"the",
"task",
"returned",
"by",
"the",
"continuation",
"has",
"completed",
"."
] | train | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L721-L724 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/EncryptedPrivateKeyWriter.java | EncryptedPrivateKeyWriter.encryptPrivateKeyWithPassword | public static byte[] encryptPrivateKeyWithPassword(final PrivateKey privateKey,
final String password) throws NoSuchAlgorithmException, InvalidKeySpecException,
NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException,
IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException {
"""
Encrypt the given {@link PrivateKey} with the given password and return the resulted byte
array.
@param privateKey
the private key to encrypt
@param password
the password
@return the byte[]
@throws NoSuchAlgorithmException
is thrown if instantiation of the SecretKeyFactory object fails.
@throws InvalidKeySpecException
is thrown if generation of the SecretKey object fails.
@throws NoSuchPaddingException
the no such padding exception
@throws InvalidKeyException
is thrown if initialization of the cipher object fails
@throws InvalidAlgorithmParameterException
is thrown if initialization of the cypher object fails.
@throws IllegalBlockSizeException
the illegal block size exception
@throws BadPaddingException
the bad padding exception
@throws InvalidParameterSpecException
the invalid parameter spec exception
@throws IOException
Signals that an I/O exception has occurred.
"""
final byte[] privateKeyEncoded = privateKey.getEncoded();
final SecureRandom random = new SecureRandom();
final byte[] salt = new byte[8];
random.nextBytes(salt);
final AlgorithmParameterSpec algorithmParameterSpec = AlgorithmParameterSpecFactory
.newPBEParameterSpec(salt, 20);
final SecretKey secretKey = SecretKeyFactoryExtensions.newSecretKey(password.toCharArray(),
CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
final Cipher pbeCipher = Cipher
.getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
pbeCipher.init(Cipher.ENCRYPT_MODE, secretKey, algorithmParameterSpec);
final byte[] ciphertext = pbeCipher.doFinal(privateKeyEncoded);
final AlgorithmParameters algparms = AlgorithmParameters
.getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
algparms.init(algorithmParameterSpec);
final EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo(algparms, ciphertext);
return encinfo.getEncoded();
} | java | public static byte[] encryptPrivateKeyWithPassword(final PrivateKey privateKey,
final String password) throws NoSuchAlgorithmException, InvalidKeySpecException,
NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException,
IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException
{
final byte[] privateKeyEncoded = privateKey.getEncoded();
final SecureRandom random = new SecureRandom();
final byte[] salt = new byte[8];
random.nextBytes(salt);
final AlgorithmParameterSpec algorithmParameterSpec = AlgorithmParameterSpecFactory
.newPBEParameterSpec(salt, 20);
final SecretKey secretKey = SecretKeyFactoryExtensions.newSecretKey(password.toCharArray(),
CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
final Cipher pbeCipher = Cipher
.getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
pbeCipher.init(Cipher.ENCRYPT_MODE, secretKey, algorithmParameterSpec);
final byte[] ciphertext = pbeCipher.doFinal(privateKeyEncoded);
final AlgorithmParameters algparms = AlgorithmParameters
.getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm());
algparms.init(algorithmParameterSpec);
final EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo(algparms, ciphertext);
return encinfo.getEncoded();
} | [
"public",
"static",
"byte",
"[",
"]",
"encryptPrivateKeyWithPassword",
"(",
"final",
"PrivateKey",
"privateKey",
",",
"final",
"String",
"password",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
",",
"NoSuchPaddingException",
",",
"InvalidKeyException",
",",
"InvalidAlgorithmParameterException",
",",
"IllegalBlockSizeException",
",",
"BadPaddingException",
",",
"InvalidParameterSpecException",
",",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"privateKeyEncoded",
"=",
"privateKey",
".",
"getEncoded",
"(",
")",
";",
"final",
"SecureRandom",
"random",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"salt",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"random",
".",
"nextBytes",
"(",
"salt",
")",
";",
"final",
"AlgorithmParameterSpec",
"algorithmParameterSpec",
"=",
"AlgorithmParameterSpecFactory",
".",
"newPBEParameterSpec",
"(",
"salt",
",",
"20",
")",
";",
"final",
"SecretKey",
"secretKey",
"=",
"SecretKeyFactoryExtensions",
".",
"newSecretKey",
"(",
"password",
".",
"toCharArray",
"(",
")",
",",
"CompoundAlgorithm",
".",
"PBE_WITH_SHA1_AND_DES_EDE",
".",
"getAlgorithm",
"(",
")",
")",
";",
"final",
"Cipher",
"pbeCipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"CompoundAlgorithm",
".",
"PBE_WITH_SHA1_AND_DES_EDE",
".",
"getAlgorithm",
"(",
")",
")",
";",
"pbeCipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
",",
"secretKey",
",",
"algorithmParameterSpec",
")",
";",
"final",
"byte",
"[",
"]",
"ciphertext",
"=",
"pbeCipher",
".",
"doFinal",
"(",
"privateKeyEncoded",
")",
";",
"final",
"AlgorithmParameters",
"algparms",
"=",
"AlgorithmParameters",
".",
"getInstance",
"(",
"CompoundAlgorithm",
".",
"PBE_WITH_SHA1_AND_DES_EDE",
".",
"getAlgorithm",
"(",
")",
")",
";",
"algparms",
".",
"init",
"(",
"algorithmParameterSpec",
")",
";",
"final",
"EncryptedPrivateKeyInfo",
"encinfo",
"=",
"new",
"EncryptedPrivateKeyInfo",
"(",
"algparms",
",",
"ciphertext",
")",
";",
"return",
"encinfo",
".",
"getEncoded",
"(",
")",
";",
"}"
] | Encrypt the given {@link PrivateKey} with the given password and return the resulted byte
array.
@param privateKey
the private key to encrypt
@param password
the password
@return the byte[]
@throws NoSuchAlgorithmException
is thrown if instantiation of the SecretKeyFactory object fails.
@throws InvalidKeySpecException
is thrown if generation of the SecretKey object fails.
@throws NoSuchPaddingException
the no such padding exception
@throws InvalidKeyException
is thrown if initialization of the cipher object fails
@throws InvalidAlgorithmParameterException
is thrown if initialization of the cypher object fails.
@throws IllegalBlockSizeException
the illegal block size exception
@throws BadPaddingException
the bad padding exception
@throws InvalidParameterSpecException
the invalid parameter spec exception
@throws IOException
Signals that an I/O exception has occurred. | [
"Encrypt",
"the",
"given",
"{",
"@link",
"PrivateKey",
"}",
"with",
"the",
"given",
"password",
"and",
"return",
"the",
"resulted",
"byte",
"array",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/EncryptedPrivateKeyWriter.java#L92-L122 |
threerings/nenya | tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java | MapFileTileSetIDBroker.writeMapFile | public static void writeMapFile (BufferedWriter bout, HashMap<String, Integer> map)
throws IOException {
"""
Writes out a mapping from strings to integers in a manner that can
be read back in via {@link #readMapFile}.
"""
String[] lines = new String[map.size()];
Iterator<String> iter = map.keySet().iterator();
for (int ii = 0; iter.hasNext(); ii++) {
String key = iter.next();
Integer value = map.get(key);
lines[ii] = key + SEP_STR + value;
}
QuickSort.sort(lines);
for (String line : lines) {
bout.write(line, 0, line.length());
bout.newLine();
}
bout.flush();
} | java | public static void writeMapFile (BufferedWriter bout, HashMap<String, Integer> map)
throws IOException
{
String[] lines = new String[map.size()];
Iterator<String> iter = map.keySet().iterator();
for (int ii = 0; iter.hasNext(); ii++) {
String key = iter.next();
Integer value = map.get(key);
lines[ii] = key + SEP_STR + value;
}
QuickSort.sort(lines);
for (String line : lines) {
bout.write(line, 0, line.length());
bout.newLine();
}
bout.flush();
} | [
"public",
"static",
"void",
"writeMapFile",
"(",
"BufferedWriter",
"bout",
",",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"map",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"lines",
"=",
"new",
"String",
"[",
"map",
".",
"size",
"(",
")",
"]",
";",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"map",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
"ii",
"++",
")",
"{",
"String",
"key",
"=",
"iter",
".",
"next",
"(",
")",
";",
"Integer",
"value",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"lines",
"[",
"ii",
"]",
"=",
"key",
"+",
"SEP_STR",
"+",
"value",
";",
"}",
"QuickSort",
".",
"sort",
"(",
"lines",
")",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"bout",
".",
"write",
"(",
"line",
",",
"0",
",",
"line",
".",
"length",
"(",
")",
")",
";",
"bout",
".",
"newLine",
"(",
")",
";",
"}",
"bout",
".",
"flush",
"(",
")",
";",
"}"
] | Writes out a mapping from strings to integers in a manner that can
be read back in via {@link #readMapFile}. | [
"Writes",
"out",
"a",
"mapping",
"from",
"strings",
"to",
"integers",
"in",
"a",
"manner",
"that",
"can",
"be",
"read",
"back",
"in",
"via",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java#L162-L178 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java | ODataRendererUtils.checkNotNull | public static <T> T checkNotNull(T reference, String message, Object... args) {
"""
Check if the reference is not null.
This differs from Guava that throws Illegal Argument Exception + message.
@param reference reference
@param message error message
@param args arguments
@param <T> type
@return reference or exception
"""
if (reference == null) {
throw new IllegalArgumentException(String.format(message, args));
}
return reference;
} | java | public static <T> T checkNotNull(T reference, String message, Object... args) {
if (reference == null) {
throw new IllegalArgumentException(String.format(message, args));
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"message",
",",
"args",
")",
")",
";",
"}",
"return",
"reference",
";",
"}"
] | Check if the reference is not null.
This differs from Guava that throws Illegal Argument Exception + message.
@param reference reference
@param message error message
@param args arguments
@param <T> type
@return reference or exception | [
"Check",
"if",
"the",
"reference",
"is",
"not",
"null",
".",
"This",
"differs",
"from",
"Guava",
"that",
"throws",
"Illegal",
"Argument",
"Exception",
"+",
"message",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L122-L127 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.updateExpirationTime | public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
"""
This method is used to update expiration times in GC and disk emtry header
"""
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"updateExpirationTime",
"(",
"Object",
"id",
",",
"long",
"oldExpirationTime",
",",
"int",
"size",
",",
"long",
"newExpirationTime",
",",
"long",
"newValidatorExpirationTime",
")",
"{",
"int",
"returnCode",
"=",
"this",
".",
"htod",
".",
"updateExpirationTime",
"(",
"id",
",",
"oldExpirationTime",
",",
"size",
",",
"newExpirationTime",
",",
"newValidatorExpirationTime",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"this",
".",
"htod",
".",
"diskCacheException",
")",
";",
"}",
"return",
"returnCode",
";",
"}"
] | This method is used to update expiration times in GC and disk emtry header | [
"This",
"method",
"is",
"used",
"to",
"update",
"expiration",
"times",
"in",
"GC",
"and",
"disk",
"emtry",
"header"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1742-L1748 |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java | ItemIdValueImpl.fromIri | static ItemIdValueImpl fromIri(String iri) {
"""
Parses an item IRI
@param iri
the item IRI like http://www.wikidata.org/entity/Q42
@throws IllegalArgumentException
if the IRI is invalid or does not ends with an item id
"""
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | java | static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | [
"static",
"ItemIdValueImpl",
"fromIri",
"(",
"String",
"iri",
")",
"{",
"int",
"separator",
"=",
"iri",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"try",
"{",
"return",
"new",
"ItemIdValueImpl",
"(",
"iri",
".",
"substring",
"(",
"separator",
")",
",",
"iri",
".",
"substring",
"(",
"0",
",",
"separator",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid Wikibase entity IRI: \"",
"+",
"iri",
",",
"e",
")",
";",
"}",
"}"
] | Parses an item IRI
@param iri
the item IRI like http://www.wikidata.org/entity/Q42
@throws IllegalArgumentException
if the IRI is invalid or does not ends with an item id | [
"Parses",
"an",
"item",
"IRI"
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java#L67-L74 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.addSingleton | public void addSingleton(BeanMetaData bmd, boolean startup, Set<String> dependsOnLinks) {
"""
Adds a singleton bean belonging to this application.
@param bmd
the bean metadata
@param startup
true if this is a startup singleton bean
@param dependsOnLinks
list of dependency EJB links
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addSingleton: " + bmd.j2eeName + " (startup=" + startup + ", dependsOn=" + (dependsOnLinks != null) + ")");
if (startup) {
if (ivStartupSingletonList == null) {
ivStartupSingletonList = new ArrayList<J2EEName>();
}
ivStartupSingletonList.add(bmd.j2eeName);
}
if (dependsOnLinks != null) {
if (ivSingletonDependencies == null) {
ivSingletonDependencies = new LinkedHashMap<BeanMetaData, Set<String>>();
}
ivSingletonDependencies.put(bmd, dependsOnLinks);
}
} | java | public void addSingleton(BeanMetaData bmd, boolean startup, Set<String> dependsOnLinks) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "addSingleton: " + bmd.j2eeName + " (startup=" + startup + ", dependsOn=" + (dependsOnLinks != null) + ")");
if (startup) {
if (ivStartupSingletonList == null) {
ivStartupSingletonList = new ArrayList<J2EEName>();
}
ivStartupSingletonList.add(bmd.j2eeName);
}
if (dependsOnLinks != null) {
if (ivSingletonDependencies == null) {
ivSingletonDependencies = new LinkedHashMap<BeanMetaData, Set<String>>();
}
ivSingletonDependencies.put(bmd, dependsOnLinks);
}
} | [
"public",
"void",
"addSingleton",
"(",
"BeanMetaData",
"bmd",
",",
"boolean",
"startup",
",",
"Set",
"<",
"String",
">",
"dependsOnLinks",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addSingleton: \"",
"+",
"bmd",
".",
"j2eeName",
"+",
"\" (startup=\"",
"+",
"startup",
"+",
"\", dependsOn=\"",
"+",
"(",
"dependsOnLinks",
"!=",
"null",
")",
"+",
"\")\"",
")",
";",
"if",
"(",
"startup",
")",
"{",
"if",
"(",
"ivStartupSingletonList",
"==",
"null",
")",
"{",
"ivStartupSingletonList",
"=",
"new",
"ArrayList",
"<",
"J2EEName",
">",
"(",
")",
";",
"}",
"ivStartupSingletonList",
".",
"add",
"(",
"bmd",
".",
"j2eeName",
")",
";",
"}",
"if",
"(",
"dependsOnLinks",
"!=",
"null",
")",
"{",
"if",
"(",
"ivSingletonDependencies",
"==",
"null",
")",
"{",
"ivSingletonDependencies",
"=",
"new",
"LinkedHashMap",
"<",
"BeanMetaData",
",",
"Set",
"<",
"String",
">",
">",
"(",
")",
";",
"}",
"ivSingletonDependencies",
".",
"put",
"(",
"bmd",
",",
"dependsOnLinks",
")",
";",
"}",
"}"
] | Adds a singleton bean belonging to this application.
@param bmd
the bean metadata
@param startup
true if this is a startup singleton bean
@param dependsOnLinks
list of dependency EJB links | [
"Adds",
"a",
"singleton",
"bean",
"belonging",
"to",
"this",
"application",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L408-L425 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.getReadAlignedLength | private int getReadAlignedLength(long offset, int readLength) {
"""
Returns an adjusted read length based on the given input, making sure the end of the Read Request is aligned with
a multiple of STORAGE_READ_MAX_LEN.
@param offset The read offset.
@param readLength The requested read length.
@return The adjusted (aligned) read length.
"""
// Calculate how many bytes over the last alignment marker the offset is.
int lengthSinceLastMultiple = (int) (offset % this.config.getStorageReadAlignment());
// Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested
// in order to read-align the reads.
return Math.min(readLength, this.config.getStorageReadAlignment() - lengthSinceLastMultiple);
} | java | private int getReadAlignedLength(long offset, int readLength) {
// Calculate how many bytes over the last alignment marker the offset is.
int lengthSinceLastMultiple = (int) (offset % this.config.getStorageReadAlignment());
// Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested
// in order to read-align the reads.
return Math.min(readLength, this.config.getStorageReadAlignment() - lengthSinceLastMultiple);
} | [
"private",
"int",
"getReadAlignedLength",
"(",
"long",
"offset",
",",
"int",
"readLength",
")",
"{",
"// Calculate how many bytes over the last alignment marker the offset is.",
"int",
"lengthSinceLastMultiple",
"=",
"(",
"int",
")",
"(",
"offset",
"%",
"this",
".",
"config",
".",
"getStorageReadAlignment",
"(",
")",
")",
";",
"// Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested",
"// in order to read-align the reads.",
"return",
"Math",
".",
"min",
"(",
"readLength",
",",
"this",
".",
"config",
".",
"getStorageReadAlignment",
"(",
")",
"-",
"lengthSinceLastMultiple",
")",
";",
"}"
] | Returns an adjusted read length based on the given input, making sure the end of the Read Request is aligned with
a multiple of STORAGE_READ_MAX_LEN.
@param offset The read offset.
@param readLength The requested read length.
@return The adjusted (aligned) read length. | [
"Returns",
"an",
"adjusted",
"read",
"length",
"based",
"on",
"the",
"given",
"input",
"making",
"sure",
"the",
"end",
"of",
"the",
"Read",
"Request",
"is",
"aligned",
"with",
"a",
"multiple",
"of",
"STORAGE_READ_MAX_LEN",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L1027-L1034 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.naturalDay | @Expose
public static String naturalDay(Date then, Locale locale) {
"""
Same as {@link #naturalDay(Date)} with the given locale.
@param then
The date
@param locale
Target locale
@return String with 'today', 'tomorrow' or 'yesterday' compared to
current day. Otherwise, returns a string formatted according to a
locale sensitive DateFormat.
"""
return naturalDay(DateFormat.SHORT, then, locale);
} | java | @Expose
public static String naturalDay(Date then, Locale locale)
{
return naturalDay(DateFormat.SHORT, then, locale);
} | [
"@",
"Expose",
"public",
"static",
"String",
"naturalDay",
"(",
"Date",
"then",
",",
"Locale",
"locale",
")",
"{",
"return",
"naturalDay",
"(",
"DateFormat",
".",
"SHORT",
",",
"then",
",",
"locale",
")",
";",
"}"
] | Same as {@link #naturalDay(Date)} with the given locale.
@param then
The date
@param locale
Target locale
@return String with 'today', 'tomorrow' or 'yesterday' compared to
current day. Otherwise, returns a string formatted according to a
locale sensitive DateFormat. | [
"Same",
"as",
"{",
"@link",
"#naturalDay",
"(",
"Date",
")",
"}",
"with",
"the",
"given",
"locale",
"."
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1473-L1477 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java | ComparatorChain.compare | @Override
public int compare(final E o1, final E o2) throws UnsupportedOperationException {
"""
执行比较<br>
按照比较器链的顺序分别比较,如果比较出相等则转向下一个比较器,否则直接返回
@param o1 第一个对象
@param o2 第二个对象
@return -1, 0, or 1
@throws UnsupportedOperationException 如果比较器链为空,无法完成比较
"""
if (lock == false) {
checkChainIntegrity();
lock = true;
}
final Iterator<Comparator<E>> comparators = chain.iterator();
Comparator<? super E> comparator;
int retval;
for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) {
comparator = comparators.next();
retval = comparator.compare(o1, o2);
if (retval != 0) {
// invert the order if it is a reverse sort
if (true == orderingBits.get(comparatorIndex)) {
retval = (retval > 0) ? -1 : 1;
}
return retval;
}
}
// if comparators are exhausted, return 0
return 0;
} | java | @Override
public int compare(final E o1, final E o2) throws UnsupportedOperationException {
if (lock == false) {
checkChainIntegrity();
lock = true;
}
final Iterator<Comparator<E>> comparators = chain.iterator();
Comparator<? super E> comparator;
int retval;
for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) {
comparator = comparators.next();
retval = comparator.compare(o1, o2);
if (retval != 0) {
// invert the order if it is a reverse sort
if (true == orderingBits.get(comparatorIndex)) {
retval = (retval > 0) ? -1 : 1;
}
return retval;
}
}
// if comparators are exhausted, return 0
return 0;
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"E",
"o1",
",",
"final",
"E",
"o2",
")",
"throws",
"UnsupportedOperationException",
"{",
"if",
"(",
"lock",
"==",
"false",
")",
"{",
"checkChainIntegrity",
"(",
")",
";",
"lock",
"=",
"true",
";",
"}",
"final",
"Iterator",
"<",
"Comparator",
"<",
"E",
">",
">",
"comparators",
"=",
"chain",
".",
"iterator",
"(",
")",
";",
"Comparator",
"<",
"?",
"super",
"E",
">",
"comparator",
";",
"int",
"retval",
";",
"for",
"(",
"int",
"comparatorIndex",
"=",
"0",
";",
"comparators",
".",
"hasNext",
"(",
")",
";",
"++",
"comparatorIndex",
")",
"{",
"comparator",
"=",
"comparators",
".",
"next",
"(",
")",
";",
"retval",
"=",
"comparator",
".",
"compare",
"(",
"o1",
",",
"o2",
")",
";",
"if",
"(",
"retval",
"!=",
"0",
")",
"{",
"// invert the order if it is a reverse sort\r",
"if",
"(",
"true",
"==",
"orderingBits",
".",
"get",
"(",
"comparatorIndex",
")",
")",
"{",
"retval",
"=",
"(",
"retval",
">",
"0",
")",
"?",
"-",
"1",
":",
"1",
";",
"}",
"return",
"retval",
";",
"}",
"}",
"// if comparators are exhausted, return 0\r",
"return",
"0",
";",
"}"
] | 执行比较<br>
按照比较器链的顺序分别比较,如果比较出相等则转向下一个比较器,否则直接返回
@param o1 第一个对象
@param o2 第二个对象
@return -1, 0, or 1
@throws UnsupportedOperationException 如果比较器链为空,无法完成比较 | [
"执行比较<br",
">",
"按照比较器链的顺序分别比较,如果比较出相等则转向下一个比较器,否则直接返回"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L203-L227 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java | LocalMapStatsProvider.finalizeFreshIndexStats | private static void finalizeFreshIndexStats(Map<String, OnDemandIndexStats> freshStats) {
"""
Finalizes the aggregation of the freshly obtained on-demand index
statistics by computing the final average values which are accumulated
as total sums in {@link #aggregateFreshIndexStats}.
@param freshStats the fresh stats to finalize, can be {@code null} if no
stats was produced during the aggregation.
"""
if (freshStats == null) {
return;
}
for (OnDemandIndexStats freshIndexStats : freshStats.values()) {
long totalHitCount = freshIndexStats.getTotalHitCount();
if (totalHitCount != 0) {
double averageHitSelectivity = 1.0 - freshIndexStats.getAverageHitSelectivity() / totalHitCount;
averageHitSelectivity = Math.max(0.0, averageHitSelectivity);
freshIndexStats.setAverageHitSelectivity(averageHitSelectivity);
freshIndexStats.setAverageHitLatency(freshIndexStats.getAverageHitLatency() / totalHitCount);
}
}
} | java | private static void finalizeFreshIndexStats(Map<String, OnDemandIndexStats> freshStats) {
if (freshStats == null) {
return;
}
for (OnDemandIndexStats freshIndexStats : freshStats.values()) {
long totalHitCount = freshIndexStats.getTotalHitCount();
if (totalHitCount != 0) {
double averageHitSelectivity = 1.0 - freshIndexStats.getAverageHitSelectivity() / totalHitCount;
averageHitSelectivity = Math.max(0.0, averageHitSelectivity);
freshIndexStats.setAverageHitSelectivity(averageHitSelectivity);
freshIndexStats.setAverageHitLatency(freshIndexStats.getAverageHitLatency() / totalHitCount);
}
}
} | [
"private",
"static",
"void",
"finalizeFreshIndexStats",
"(",
"Map",
"<",
"String",
",",
"OnDemandIndexStats",
">",
"freshStats",
")",
"{",
"if",
"(",
"freshStats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"OnDemandIndexStats",
"freshIndexStats",
":",
"freshStats",
".",
"values",
"(",
")",
")",
"{",
"long",
"totalHitCount",
"=",
"freshIndexStats",
".",
"getTotalHitCount",
"(",
")",
";",
"if",
"(",
"totalHitCount",
"!=",
"0",
")",
"{",
"double",
"averageHitSelectivity",
"=",
"1.0",
"-",
"freshIndexStats",
".",
"getAverageHitSelectivity",
"(",
")",
"/",
"totalHitCount",
";",
"averageHitSelectivity",
"=",
"Math",
".",
"max",
"(",
"0.0",
",",
"averageHitSelectivity",
")",
";",
"freshIndexStats",
".",
"setAverageHitSelectivity",
"(",
"averageHitSelectivity",
")",
";",
"freshIndexStats",
".",
"setAverageHitLatency",
"(",
"freshIndexStats",
".",
"getAverageHitLatency",
"(",
")",
"/",
"totalHitCount",
")",
";",
"}",
"}",
"}"
] | Finalizes the aggregation of the freshly obtained on-demand index
statistics by computing the final average values which are accumulated
as total sums in {@link #aggregateFreshIndexStats}.
@param freshStats the fresh stats to finalize, can be {@code null} if no
stats was produced during the aggregation. | [
"Finalizes",
"the",
"aggregation",
"of",
"the",
"freshly",
"obtained",
"on",
"-",
"demand",
"index",
"statistics",
"by",
"computing",
"the",
"final",
"average",
"values",
"which",
"are",
"accumulated",
"as",
"total",
"sums",
"in",
"{",
"@link",
"#aggregateFreshIndexStats",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java#L413-L427 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java | DocFile.copyFile | public void copyFile(DocFile fromFile) throws DocFileIOException {
"""
Copy the contents of another file directly to this file.
@param fromFile the file to be copied
@throws DocFileIOException if there is a problem file copying the file
"""
try (OutputStream output = openOutputStream()) {
try (InputStream input = fromFile.openInputStream()) {
byte[] bytearr = new byte[1024];
int len;
while ((len = read(fromFile, input, bytearr)) != -1) {
write(this, output, bytearr, len);
}
} catch (IOException e) {
throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
}
} catch (IOException e) {
throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
}
} | java | public void copyFile(DocFile fromFile) throws DocFileIOException {
try (OutputStream output = openOutputStream()) {
try (InputStream input = fromFile.openInputStream()) {
byte[] bytearr = new byte[1024];
int len;
while ((len = read(fromFile, input, bytearr)) != -1) {
write(this, output, bytearr, len);
}
} catch (IOException e) {
throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
}
} catch (IOException e) {
throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
}
} | [
"public",
"void",
"copyFile",
"(",
"DocFile",
"fromFile",
")",
"throws",
"DocFileIOException",
"{",
"try",
"(",
"OutputStream",
"output",
"=",
"openOutputStream",
"(",
")",
")",
"{",
"try",
"(",
"InputStream",
"input",
"=",
"fromFile",
".",
"openInputStream",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"bytearr",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"int",
"len",
";",
"while",
"(",
"(",
"len",
"=",
"read",
"(",
"fromFile",
",",
"input",
",",
"bytearr",
")",
")",
"!=",
"-",
"1",
")",
"{",
"write",
"(",
"this",
",",
"output",
",",
"bytearr",
",",
"len",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"DocFileIOException",
"(",
"fromFile",
",",
"DocFileIOException",
".",
"Mode",
".",
"READ",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"DocFileIOException",
"(",
"this",
",",
"DocFileIOException",
".",
"Mode",
".",
"WRITE",
",",
"e",
")",
";",
"}",
"}"
] | Copy the contents of another file directly to this file.
@param fromFile the file to be copied
@throws DocFileIOException if there is a problem file copying the file | [
"Copy",
"the",
"contents",
"of",
"another",
"file",
"directly",
"to",
"this",
"file",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java#L142-L156 |
stapler/stapler | core/src/main/java/org/kohsuke/stapler/Stapler.java | Stapler.invoke | public void invoke(HttpServletRequest req, HttpServletResponse rsp, Object root, String url) throws IOException, ServletException {
"""
Performs stapler processing on the given root object and request URL.
"""
RequestImpl sreq = new RequestImpl(this, req, new ArrayList<AncestorImpl>(), new TokenList(url));
RequestImpl oreq = CURRENT_REQUEST.get();
CURRENT_REQUEST.set(sreq);
ResponseImpl srsp = new ResponseImpl(this, rsp);
ResponseImpl orsp = CURRENT_RESPONSE.get();
CURRENT_RESPONSE.set(srsp);
try {
invoke(sreq,srsp,root);
} finally {
CURRENT_REQUEST.set(oreq);
CURRENT_RESPONSE.set(orsp);
}
} | java | public void invoke(HttpServletRequest req, HttpServletResponse rsp, Object root, String url) throws IOException, ServletException {
RequestImpl sreq = new RequestImpl(this, req, new ArrayList<AncestorImpl>(), new TokenList(url));
RequestImpl oreq = CURRENT_REQUEST.get();
CURRENT_REQUEST.set(sreq);
ResponseImpl srsp = new ResponseImpl(this, rsp);
ResponseImpl orsp = CURRENT_RESPONSE.get();
CURRENT_RESPONSE.set(srsp);
try {
invoke(sreq,srsp,root);
} finally {
CURRENT_REQUEST.set(oreq);
CURRENT_RESPONSE.set(orsp);
}
} | [
"public",
"void",
"invoke",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"rsp",
",",
"Object",
"root",
",",
"String",
"url",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"RequestImpl",
"sreq",
"=",
"new",
"RequestImpl",
"(",
"this",
",",
"req",
",",
"new",
"ArrayList",
"<",
"AncestorImpl",
">",
"(",
")",
",",
"new",
"TokenList",
"(",
"url",
")",
")",
";",
"RequestImpl",
"oreq",
"=",
"CURRENT_REQUEST",
".",
"get",
"(",
")",
";",
"CURRENT_REQUEST",
".",
"set",
"(",
"sreq",
")",
";",
"ResponseImpl",
"srsp",
"=",
"new",
"ResponseImpl",
"(",
"this",
",",
"rsp",
")",
";",
"ResponseImpl",
"orsp",
"=",
"CURRENT_RESPONSE",
".",
"get",
"(",
")",
";",
"CURRENT_RESPONSE",
".",
"set",
"(",
"srsp",
")",
";",
"try",
"{",
"invoke",
"(",
"sreq",
",",
"srsp",
",",
"root",
")",
";",
"}",
"finally",
"{",
"CURRENT_REQUEST",
".",
"set",
"(",
"oreq",
")",
";",
"CURRENT_RESPONSE",
".",
"set",
"(",
"orsp",
")",
";",
"}",
"}"
] | Performs stapler processing on the given root object and request URL. | [
"Performs",
"stapler",
"processing",
"on",
"the",
"given",
"root",
"object",
"and",
"request",
"URL",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/Stapler.java#L666-L681 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzleResultSet.java | DrizzleResultSet.getTime | public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
"""
Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a
<code>java.sql.Time</code> object in the Java programming language. This method uses the given calendar to
construct an appropriate millisecond value for the time if the underlying database does not store timezone
information.
@param columnIndex the first column is 1, the second is 2, ...
@param cal the <code>java.util.Calendar</code> object to use in constructing the time
@return the column value as a <code>java.sql.Time</code> object; if the value is SQL <code>NULL</code>, the value
returned is <code>null</code> in the Java programming language
@throws java.sql.SQLException if the columnIndex is not valid; if a database access error occurs or this method
is called on a closed result set
@since 1.2
"""
return getValueObject(columnIndex).getTime(cal);
} | java | public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
return getValueObject(columnIndex).getTime(cal);
} | [
"public",
"Time",
"getTime",
"(",
"final",
"int",
"columnIndex",
",",
"final",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"return",
"getValueObject",
"(",
"columnIndex",
")",
".",
"getTime",
"(",
"cal",
")",
";",
"}"
] | Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a
<code>java.sql.Time</code> object in the Java programming language. This method uses the given calendar to
construct an appropriate millisecond value for the time if the underlying database does not store timezone
information.
@param columnIndex the first column is 1, the second is 2, ...
@param cal the <code>java.util.Calendar</code> object to use in constructing the time
@return the column value as a <code>java.sql.Time</code> object; if the value is SQL <code>NULL</code>, the value
returned is <code>null</code> in the Java programming language
@throws java.sql.SQLException if the columnIndex is not valid; if a database access error occurs or this method
is called on a closed result set
@since 1.2 | [
"Retrieves",
"the",
"value",
"of",
"the",
"designated",
"column",
"in",
"the",
"current",
"row",
"of",
"this",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"as",
"a",
"<code",
">",
"java",
".",
"sql",
".",
"Time<",
"/",
"code",
">",
"object",
"in",
"the",
"Java",
"programming",
"language",
".",
"This",
"method",
"uses",
"the",
"given",
"calendar",
"to",
"construct",
"an",
"appropriate",
"millisecond",
"value",
"for",
"the",
"time",
"if",
"the",
"underlying",
"database",
"does",
"not",
"store",
"timezone",
"information",
"."
] | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2123-L2125 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java | FaceletsCompilerSupport.loadDecorators | public void loadDecorators(FacesContext context, Compiler compiler) {
"""
Load the various decorators for Facelets.
@param context
the current FacesContext
@param compiler
the page compiler
"""
String param = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(), PARAMS_DECORATORS);
if (param != null)
{
for (String decorator : param.split(";"))
{
try
{
compiler.addTagDecorator((TagDecorator) ReflectionUtil.forName(decorator).newInstance());
if (log.isLoggable(Level.FINE))
{
log.fine("Successfully loaded decorator: " + decorator);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "Error Loading decorator: " + decorator, e);
}
}
}
} | java | public void loadDecorators(FacesContext context, Compiler compiler)
{
String param = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(), PARAMS_DECORATORS);
if (param != null)
{
for (String decorator : param.split(";"))
{
try
{
compiler.addTagDecorator((TagDecorator) ReflectionUtil.forName(decorator).newInstance());
if (log.isLoggable(Level.FINE))
{
log.fine("Successfully loaded decorator: " + decorator);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "Error Loading decorator: " + decorator, e);
}
}
}
} | [
"public",
"void",
"loadDecorators",
"(",
"FacesContext",
"context",
",",
"Compiler",
"compiler",
")",
"{",
"String",
"param",
"=",
"WebConfigParamUtils",
".",
"getStringInitParameter",
"(",
"context",
".",
"getExternalContext",
"(",
")",
",",
"PARAMS_DECORATORS",
")",
";",
"if",
"(",
"param",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"decorator",
":",
"param",
".",
"split",
"(",
"\";\"",
")",
")",
"{",
"try",
"{",
"compiler",
".",
"addTagDecorator",
"(",
"(",
"TagDecorator",
")",
"ReflectionUtil",
".",
"forName",
"(",
"decorator",
")",
".",
"newInstance",
"(",
")",
")",
";",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"Successfully loaded decorator: \"",
"+",
"decorator",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Error Loading decorator: \"",
"+",
"decorator",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Load the various decorators for Facelets.
@param context
the current FacesContext
@param compiler
the page compiler | [
"Load",
"the",
"various",
"decorators",
"for",
"Facelets",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java#L173-L194 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/util/SecretDetector.java | SecretDetector.getAWSSecretPos | private static List<SecretRange> getAWSSecretPos(String text) {
"""
Find all the positions of aws key id and aws secret key.
The time complexity is O(n)
@param text the sql text which may contain aws key
@return Return a list of begin/end positions of aws key id and
aws secret key.
"""
// log before and after in case this is causing StackOverflowError
LOGGER.debug("pre-regex getAWSSecretPos");
Matcher matcher = AWS_KEY_PATTERN.matcher(text);
ArrayList<SecretRange> awsSecretRanges = new ArrayList<>();
while (matcher.find())
{
int beginPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
while (beginPos > 0 && beginPos < text.length() &&
isBase64(text.charAt(beginPos)))
{
beginPos--;
}
int endPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
while (endPos < text.length() && isBase64(text.charAt(endPos)))
{
endPos++;
}
if (beginPos < text.length() && endPos <= text.length()
&& beginPos >= 0 && endPos >= 0)
{
awsSecretRanges.add(new SecretRange(beginPos + 1, endPos));
}
}
LOGGER.debug("post-regex getAWSSecretPos");
return awsSecretRanges;
} | java | private static List<SecretRange> getAWSSecretPos(String text)
{
// log before and after in case this is causing StackOverflowError
LOGGER.debug("pre-regex getAWSSecretPos");
Matcher matcher = AWS_KEY_PATTERN.matcher(text);
ArrayList<SecretRange> awsSecretRanges = new ArrayList<>();
while (matcher.find())
{
int beginPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
while (beginPos > 0 && beginPos < text.length() &&
isBase64(text.charAt(beginPos)))
{
beginPos--;
}
int endPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
while (endPos < text.length() && isBase64(text.charAt(endPos)))
{
endPos++;
}
if (beginPos < text.length() && endPos <= text.length()
&& beginPos >= 0 && endPos >= 0)
{
awsSecretRanges.add(new SecretRange(beginPos + 1, endPos));
}
}
LOGGER.debug("post-regex getAWSSecretPos");
return awsSecretRanges;
} | [
"private",
"static",
"List",
"<",
"SecretRange",
">",
"getAWSSecretPos",
"(",
"String",
"text",
")",
"{",
"// log before and after in case this is causing StackOverflowError",
"LOGGER",
".",
"debug",
"(",
"\"pre-regex getAWSSecretPos\"",
")",
";",
"Matcher",
"matcher",
"=",
"AWS_KEY_PATTERN",
".",
"matcher",
"(",
"text",
")",
";",
"ArrayList",
"<",
"SecretRange",
">",
"awsSecretRanges",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"int",
"beginPos",
"=",
"Math",
".",
"min",
"(",
"matcher",
".",
"end",
"(",
")",
"+",
"LOOK_AHEAD",
",",
"text",
".",
"length",
"(",
")",
")",
";",
"while",
"(",
"beginPos",
">",
"0",
"&&",
"beginPos",
"<",
"text",
".",
"length",
"(",
")",
"&&",
"isBase64",
"(",
"text",
".",
"charAt",
"(",
"beginPos",
")",
")",
")",
"{",
"beginPos",
"--",
";",
"}",
"int",
"endPos",
"=",
"Math",
".",
"min",
"(",
"matcher",
".",
"end",
"(",
")",
"+",
"LOOK_AHEAD",
",",
"text",
".",
"length",
"(",
")",
")",
";",
"while",
"(",
"endPos",
"<",
"text",
".",
"length",
"(",
")",
"&&",
"isBase64",
"(",
"text",
".",
"charAt",
"(",
"endPos",
")",
")",
")",
"{",
"endPos",
"++",
";",
"}",
"if",
"(",
"beginPos",
"<",
"text",
".",
"length",
"(",
")",
"&&",
"endPos",
"<=",
"text",
".",
"length",
"(",
")",
"&&",
"beginPos",
">=",
"0",
"&&",
"endPos",
">=",
"0",
")",
"{",
"awsSecretRanges",
".",
"add",
"(",
"new",
"SecretRange",
"(",
"beginPos",
"+",
"1",
",",
"endPos",
")",
")",
";",
"}",
"}",
"LOGGER",
".",
"debug",
"(",
"\"post-regex getAWSSecretPos\"",
")",
";",
"return",
"awsSecretRanges",
";",
"}"
] | Find all the positions of aws key id and aws secret key.
The time complexity is O(n)
@param text the sql text which may contain aws key
@return Return a list of begin/end positions of aws key id and
aws secret key. | [
"Find",
"all",
"the",
"positions",
"of",
"aws",
"key",
"id",
"and",
"aws",
"secret",
"key",
".",
"The",
"time",
"complexity",
"is",
"O",
"(",
"n",
")"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/util/SecretDetector.java#L55-L91 |
dita-ot/dita-ot | src/main/java/org/dita/dost/writer/DitaWriterFilter.java | DitaWriterFilter.getAttributeValue | private String getAttributeValue(final String elemQName, final QName attQName, final String value) {
"""
Get attribute value or default if attribute is not defined
@param elemQName element QName
@param attQName attribute QName
@param value attribute value
@return attribute value or default
"""
if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) {
final Map<String, String> defaultMap = defaultValueMap.get(attQName);
if (defaultMap != null) {
final String defaultValue = defaultMap.get(elemQName);
if (defaultValue != null) {
return defaultValue;
}
}
}
return value;
} | java | private String getAttributeValue(final String elemQName, final QName attQName, final String value) {
if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) {
final Map<String, String> defaultMap = defaultValueMap.get(attQName);
if (defaultMap != null) {
final String defaultValue = defaultMap.get(elemQName);
if (defaultValue != null) {
return defaultValue;
}
}
}
return value;
} | [
"private",
"String",
"getAttributeValue",
"(",
"final",
"String",
"elemQName",
",",
"final",
"QName",
"attQName",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmptyString",
"(",
"value",
")",
"&&",
"!",
"defaultValueMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"defaultMap",
"=",
"defaultValueMap",
".",
"get",
"(",
"attQName",
")",
";",
"if",
"(",
"defaultMap",
"!=",
"null",
")",
"{",
"final",
"String",
"defaultValue",
"=",
"defaultMap",
".",
"get",
"(",
"elemQName",
")",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"}",
"}",
"return",
"value",
";",
"}"
] | Get attribute value or default if attribute is not defined
@param elemQName element QName
@param attQName attribute QName
@param value attribute value
@return attribute value or default | [
"Get",
"attribute",
"value",
"or",
"default",
"if",
"attribute",
"is",
"not",
"defined"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/DitaWriterFilter.java#L180-L191 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java | CEMILDataEx.getAdditionalInfo | public synchronized List getAdditionalInfo() {
"""
Returns all additional information currently set.
<p>
@return a List with {@link AddInfo} objects
"""
final List l = new ArrayList();
for (int i = 0; i < addInfo.length; ++i)
if (addInfo[i] != null)
l.add(new AddInfo(i, (byte[]) addInfo[i].clone()));
return l;
} | java | public synchronized List getAdditionalInfo()
{
final List l = new ArrayList();
for (int i = 0; i < addInfo.length; ++i)
if (addInfo[i] != null)
l.add(new AddInfo(i, (byte[]) addInfo[i].clone()));
return l;
} | [
"public",
"synchronized",
"List",
"getAdditionalInfo",
"(",
")",
"{",
"final",
"List",
"l",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"addInfo",
".",
"length",
";",
"++",
"i",
")",
"if",
"(",
"addInfo",
"[",
"i",
"]",
"!=",
"null",
")",
"l",
".",
"add",
"(",
"new",
"AddInfo",
"(",
"i",
",",
"(",
"byte",
"[",
"]",
")",
"addInfo",
"[",
"i",
"]",
".",
"clone",
"(",
")",
")",
")",
";",
"return",
"l",
";",
"}"
] | Returns all additional information currently set.
<p>
@return a List with {@link AddInfo} objects | [
"Returns",
"all",
"additional",
"information",
"currently",
"set",
".",
"<p",
">"
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java#L342-L349 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java | ApiOvhCdndedicated.pops_name_GET | public OvhPop pops_name_GET(String name) throws IOException {
"""
Get this object properties
REST: GET /cdn/dedicated/pops/{name}
@param name [required] Name of the pop
"""
String qPath = "/cdn/dedicated/pops/{name}";
StringBuilder sb = path(qPath, name);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPop.class);
} | java | public OvhPop pops_name_GET(String name) throws IOException {
String qPath = "/cdn/dedicated/pops/{name}";
StringBuilder sb = path(qPath, name);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPop.class);
} | [
"public",
"OvhPop",
"pops_name_GET",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cdn/dedicated/pops/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"name",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPop",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /cdn/dedicated/pops/{name}
@param name [required] Name of the pop | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L56-L61 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java | JsonRpcUtils.callHttpGet | public static RequestResponse callHttpGet(String url, Map<String, Object> headers,
Map<String, Object> urlParams) {
"""
Perform a HTTP GET request.
@param url
@param headers
@param urlParams
@return
"""
return callHttpGet(httpJsonRpcClient, url, headers, urlParams);
} | java | public static RequestResponse callHttpGet(String url, Map<String, Object> headers,
Map<String, Object> urlParams) {
return callHttpGet(httpJsonRpcClient, url, headers, urlParams);
} | [
"public",
"static",
"RequestResponse",
"callHttpGet",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"urlParams",
")",
"{",
"return",
"callHttpGet",
"(",
"httpJsonRpcClient",
",",
"url",
",",
"headers",
",",
"urlParams",
")",
";",
"}"
] | Perform a HTTP GET request.
@param url
@param headers
@param urlParams
@return | [
"Perform",
"a",
"HTTP",
"GET",
"request",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java#L90-L93 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/PainGeneratorFactory.java | PainGeneratorFactory.get | public static PainGeneratorIf get(AbstractHBCIJob job, SepaVersion version) throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
"""
Gibt den passenden SEPA Generator für die angegebene PAIN-Version.
@param job der zu erzeugende Job.
@param version die PAIN-Version.
@return ISEPAGenerator
@throws IllegalAccessException
@throws InstantiationException
@throws ClassNotFoundException
"""
String jobname = ((AbstractSEPAGV) job).getPainJobName(); // referenzierter pain-Geschäftsvorfall
return get(jobname, version);
} | java | public static PainGeneratorIf get(AbstractHBCIJob job, SepaVersion version) throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
String jobname = ((AbstractSEPAGV) job).getPainJobName(); // referenzierter pain-Geschäftsvorfall
return get(jobname, version);
} | [
"public",
"static",
"PainGeneratorIf",
"get",
"(",
"AbstractHBCIJob",
"job",
",",
"SepaVersion",
"version",
")",
"throws",
"ClassNotFoundException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"String",
"jobname",
"=",
"(",
"(",
"AbstractSEPAGV",
")",
"job",
")",
".",
"getPainJobName",
"(",
")",
";",
"// referenzierter pain-Geschäftsvorfall",
"return",
"get",
"(",
"jobname",
",",
"version",
")",
";",
"}"
] | Gibt den passenden SEPA Generator für die angegebene PAIN-Version.
@param job der zu erzeugende Job.
@param version die PAIN-Version.
@return ISEPAGenerator
@throws IllegalAccessException
@throws InstantiationException
@throws ClassNotFoundException | [
"Gibt",
"den",
"passenden",
"SEPA",
"Generator",
"für",
"die",
"angegebene",
"PAIN",
"-",
"Version",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/PainGeneratorFactory.java#L31-L35 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigurationSequence.java | CmsADEConfigurationSequence.getParent | public Optional<CmsADEConfigurationSequence> getParent() {
"""
Returns a sequence which only differs from this instance in that its index is one less.<p>
However, if the index of this instance is already 0, Optional.absent will be returned.
@return the parent sequence, or Optional.absent if we are already at the start of the sequence
"""
if (m_configIndex <= 0) {
return Optional.absent();
}
return Optional.fromNullable(new CmsADEConfigurationSequence(m_configDatas, m_configIndex - 1));
} | java | public Optional<CmsADEConfigurationSequence> getParent() {
if (m_configIndex <= 0) {
return Optional.absent();
}
return Optional.fromNullable(new CmsADEConfigurationSequence(m_configDatas, m_configIndex - 1));
} | [
"public",
"Optional",
"<",
"CmsADEConfigurationSequence",
">",
"getParent",
"(",
")",
"{",
"if",
"(",
"m_configIndex",
"<=",
"0",
")",
"{",
"return",
"Optional",
".",
"absent",
"(",
")",
";",
"}",
"return",
"Optional",
".",
"fromNullable",
"(",
"new",
"CmsADEConfigurationSequence",
"(",
"m_configDatas",
",",
"m_configIndex",
"-",
"1",
")",
")",
";",
"}"
] | Returns a sequence which only differs from this instance in that its index is one less.<p>
However, if the index of this instance is already 0, Optional.absent will be returned.
@return the parent sequence, or Optional.absent if we are already at the start of the sequence | [
"Returns",
"a",
"sequence",
"which",
"only",
"differs",
"from",
"this",
"instance",
"in",
"that",
"its",
"index",
"is",
"one",
"less",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigurationSequence.java#L89-L95 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_ipMigration_duration_GET | public OvhOrder dedicated_server_serviceName_ipMigration_duration_GET(String serviceName, String duration, String ip, String token) throws IOException {
"""
Get prices and contracts information
REST: GET /order/dedicated/server/{serviceName}/ipMigration/{duration}
@param ip [required] The IP to move to this server
@param token [required] IP migration token
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration
"""
String qPath = "/order/dedicated/server/{serviceName}/ipMigration/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "ip", ip);
query(sb, "token", token);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_ipMigration_duration_GET(String serviceName, String duration, String ip, String token) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ipMigration/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "ip", ip);
query(sb, "token", token);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_ipMigration_duration_GET",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"String",
"ip",
",",
"String",
"token",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/ipMigration/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"query",
"(",
"sb",
",",
"\"ip\"",
",",
"ip",
")",
";",
"query",
"(",
"sb",
",",
"\"token\"",
",",
"token",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Get prices and contracts information
REST: GET /order/dedicated/server/{serviceName}/ipMigration/{duration}
@param ip [required] The IP to move to this server
@param token [required] IP migration token
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2572-L2579 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java | BackupLongTermRetentionPoliciesInner.createOrUpdate | public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
"""
Creates or updates a database backup long term retention policy.
@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 databaseName The name of the database
@param parameters The required parameters to update a backup long term retention policy
@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 BackupLongTermRetentionPolicyInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | java | public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | [
"public",
"BackupLongTermRetentionPolicyInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"BackupLongTermRetentionPolicyInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a database backup long term retention policy.
@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 databaseName The name of the database
@param parameters The required parameters to update a backup long term retention policy
@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 BackupLongTermRetentionPolicyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"database",
"backup",
"long",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java#L182-L184 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java | IntervalST.put | public void put(Interval1D<K> interval, V value) {
"""
Insert a new node in the tree. If the tree contained that interval already, the value is
replaced.
"""
Node<K, V> origNode = get(interval);
if (origNode != null) {
//System.err.println("Dupe is being put into the map. Interval: " + interval +
// "\n\tOld: " + origNode.getValue() + " New: " + value);
origNode.setValue(value);
} else {
root = randomizedInsert(root, interval, value);
}
} | java | public void put(Interval1D<K> interval, V value) {
Node<K, V> origNode = get(interval);
if (origNode != null) {
//System.err.println("Dupe is being put into the map. Interval: " + interval +
// "\n\tOld: " + origNode.getValue() + " New: " + value);
origNode.setValue(value);
} else {
root = randomizedInsert(root, interval, value);
}
} | [
"public",
"void",
"put",
"(",
"Interval1D",
"<",
"K",
">",
"interval",
",",
"V",
"value",
")",
"{",
"Node",
"<",
"K",
",",
"V",
">",
"origNode",
"=",
"get",
"(",
"interval",
")",
";",
"if",
"(",
"origNode",
"!=",
"null",
")",
"{",
"//System.err.println(\"Dupe is being put into the map. Interval: \" + interval +",
"// \"\\n\\tOld: \" + origNode.getValue() + \" New: \" + value);",
"origNode",
".",
"setValue",
"(",
"value",
")",
";",
"}",
"else",
"{",
"root",
"=",
"randomizedInsert",
"(",
"root",
",",
"interval",
",",
"value",
")",
";",
"}",
"}"
] | Insert a new node in the tree. If the tree contained that interval already, the value is
replaced. | [
"Insert",
"a",
"new",
"node",
"in",
"the",
"tree",
".",
"If",
"the",
"tree",
"contained",
"that",
"interval",
"already",
"the",
"value",
"is",
"replaced",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L269-L278 |
j256/ormlite-core | src/main/java/com/j256/ormlite/misc/TransactionManager.java | TransactionManager.callInTransaction | public static <T> T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable) throws SQLException {
"""
Same as {@link #callInTransaction(Callable)} except as a static method on a connection with database-type.
<p>
WARNING: it is up to you to properly synchronize around this method if multiple threads are using the same
database connection or if your connection-source is single-connection. The reason why this is necessary is that
multiple operations are performed on the connection and race-conditions will exist with multiple threads working
on the same connection.
</p>
"""
return callInTransaction(connection, false, databaseType, callable);
} | java | public static <T> T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable) throws SQLException {
return callInTransaction(connection, false, databaseType, callable);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"callInTransaction",
"(",
"final",
"DatabaseConnection",
"connection",
",",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"Callable",
"<",
"T",
">",
"callable",
")",
"throws",
"SQLException",
"{",
"return",
"callInTransaction",
"(",
"connection",
",",
"false",
",",
"databaseType",
",",
"callable",
")",
";",
"}"
] | Same as {@link #callInTransaction(Callable)} except as a static method on a connection with database-type.
<p>
WARNING: it is up to you to properly synchronize around this method if multiple threads are using the same
database connection or if your connection-source is single-connection. The reason why this is necessary is that
multiple operations are performed on the connection and race-conditions will exist with multiple threads working
on the same connection.
</p> | [
"Same",
"as",
"{",
"@link",
"#callInTransaction",
"(",
"Callable",
")",
"}",
"except",
"as",
"a",
"static",
"method",
"on",
"a",
"connection",
"with",
"database",
"-",
"type",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/TransactionManager.java#L195-L198 |
crnk-project/crnk-framework | crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaModule.java | JpaModule.createServerModule | public static JpaModule createServerModule(JpaModuleConfig config, EntityManager em, TransactionRunner transactionRunner) {
"""
Creates a new JpaModule for a Crnk server. No entities are by
default exposed as JSON API resources. Make use of
{@link #addRepository(JpaRepositoryConfig)} to add resources.
@param em to use
@param transactionRunner to use
@return created module
"""
return createServerModule(config, () -> em, transactionRunner);
} | java | public static JpaModule createServerModule(JpaModuleConfig config, EntityManager em, TransactionRunner transactionRunner) {
return createServerModule(config, () -> em, transactionRunner);
} | [
"public",
"static",
"JpaModule",
"createServerModule",
"(",
"JpaModuleConfig",
"config",
",",
"EntityManager",
"em",
",",
"TransactionRunner",
"transactionRunner",
")",
"{",
"return",
"createServerModule",
"(",
"config",
",",
"(",
")",
"->",
"em",
",",
"transactionRunner",
")",
";",
"}"
] | Creates a new JpaModule for a Crnk server. No entities are by
default exposed as JSON API resources. Make use of
{@link #addRepository(JpaRepositoryConfig)} to add resources.
@param em to use
@param transactionRunner to use
@return created module | [
"Creates",
"a",
"new",
"JpaModule",
"for",
"a",
"Crnk",
"server",
".",
"No",
"entities",
"are",
"by",
"default",
"exposed",
"as",
"JSON",
"API",
"resources",
".",
"Make",
"use",
"of",
"{",
"@link",
"#addRepository",
"(",
"JpaRepositoryConfig",
")",
"}",
"to",
"add",
"resources",
"."
] | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaModule.java#L185-L187 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.asum | public SDVariable asum(String name, SDVariable in, int... dimensions) {
"""
Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
@param name Name of the output variable
@param in Input variable
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Reduced array of rank (input rank - num dimensions)
"""
validateNumerical("asum", in);
SDVariable ret = f().asum(in, dimensions);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable asum(String name, SDVariable in, int... dimensions) {
validateNumerical("asum", in);
SDVariable ret = f().asum(in, dimensions);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"asum",
"(",
"String",
"name",
",",
"SDVariable",
"in",
",",
"int",
"...",
"dimensions",
")",
"{",
"validateNumerical",
"(",
"\"asum\"",
",",
"in",
")",
";",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"asum",
"(",
"in",
",",
"dimensions",
")",
";",
"return",
"updateVariableNameAndReference",
"(",
"ret",
",",
"name",
")",
";",
"}"
] | Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
@param name Name of the output variable
@param in Input variable
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Reduced array of rank (input rank - num dimensions) | [
"Absolute",
"sum",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions",
":",
"out",
"=",
"sum",
"(",
"abs",
"(",
"x",
"))"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L270-L274 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java | SingleInputGate.assignExclusiveSegments | public void assignExclusiveSegments(NetworkBufferPool networkBufferPool, int networkBuffersPerChannel) throws IOException {
"""
Assign the exclusive buffers to all remote input channels directly for credit-based mode.
@param networkBufferPool The global pool to request and recycle exclusive buffers
@param networkBuffersPerChannel The number of exclusive buffers for each channel
"""
checkState(this.isCreditBased, "Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control.");
checkState(this.networkBufferPool == null, "Bug in input gate setup logic: global buffer pool has" +
"already been set for this input gate.");
this.networkBufferPool = checkNotNull(networkBufferPool);
this.networkBuffersPerChannel = networkBuffersPerChannel;
synchronized (requestLock) {
for (InputChannel inputChannel : inputChannels.values()) {
if (inputChannel instanceof RemoteInputChannel) {
((RemoteInputChannel) inputChannel).assignExclusiveSegments(
networkBufferPool.requestMemorySegments(networkBuffersPerChannel));
}
}
}
} | java | public void assignExclusiveSegments(NetworkBufferPool networkBufferPool, int networkBuffersPerChannel) throws IOException {
checkState(this.isCreditBased, "Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control.");
checkState(this.networkBufferPool == null, "Bug in input gate setup logic: global buffer pool has" +
"already been set for this input gate.");
this.networkBufferPool = checkNotNull(networkBufferPool);
this.networkBuffersPerChannel = networkBuffersPerChannel;
synchronized (requestLock) {
for (InputChannel inputChannel : inputChannels.values()) {
if (inputChannel instanceof RemoteInputChannel) {
((RemoteInputChannel) inputChannel).assignExclusiveSegments(
networkBufferPool.requestMemorySegments(networkBuffersPerChannel));
}
}
}
} | [
"public",
"void",
"assignExclusiveSegments",
"(",
"NetworkBufferPool",
"networkBufferPool",
",",
"int",
"networkBuffersPerChannel",
")",
"throws",
"IOException",
"{",
"checkState",
"(",
"this",
".",
"isCreditBased",
",",
"\"Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control.\"",
")",
";",
"checkState",
"(",
"this",
".",
"networkBufferPool",
"==",
"null",
",",
"\"Bug in input gate setup logic: global buffer pool has\"",
"+",
"\"already been set for this input gate.\"",
")",
";",
"this",
".",
"networkBufferPool",
"=",
"checkNotNull",
"(",
"networkBufferPool",
")",
";",
"this",
".",
"networkBuffersPerChannel",
"=",
"networkBuffersPerChannel",
";",
"synchronized",
"(",
"requestLock",
")",
"{",
"for",
"(",
"InputChannel",
"inputChannel",
":",
"inputChannels",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"inputChannel",
"instanceof",
"RemoteInputChannel",
")",
"{",
"(",
"(",
"RemoteInputChannel",
")",
"inputChannel",
")",
".",
"assignExclusiveSegments",
"(",
"networkBufferPool",
".",
"requestMemorySegments",
"(",
"networkBuffersPerChannel",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Assign the exclusive buffers to all remote input channels directly for credit-based mode.
@param networkBufferPool The global pool to request and recycle exclusive buffers
@param networkBuffersPerChannel The number of exclusive buffers for each channel | [
"Assign",
"the",
"exclusive",
"buffers",
"to",
"all",
"remote",
"input",
"channels",
"directly",
"for",
"credit",
"-",
"based",
"mode",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java#L305-L321 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseBlock | private Stmt.Block parseBlock(EnclosingScope scope, boolean isLoop) {
"""
Parse a block of zero or more statements which share the same indentation
level. Their indentation level must be strictly greater than that of
their parent, otherwise the end of block is signaled. The <i>indentation
level</i> for the block is set by the first statement encountered
(assuming their is one). An error occurs if a subsequent statement is
reached with an indentation level <i>greater</i> than the block's
indentation level.
@param parentIndent
The indentation level of the parent, for which all statements
in this block must have a greater indent. May not be
<code>null</code>.
@param isLoop
Indicates whether or not this block represents the body of a
loop. This is important in order to setup the scope for this
block appropriately.
@return
"""
// First, determine the initial indentation of this block based on the
// first statement (or null if there is no statement).
Indent indent = getIndent();
// We must clone the environment here, in order to ensure variables
// declared within this block are properly scoped.
EnclosingScope blockScope = scope.newEnclosingScope(indent, isLoop);
// Second, check that this is indeed the initial indentation for this
// block (i.e. that it is strictly greater than parent indent).
if (indent == null || indent.lessThanEq(scope.getIndent())) {
// Initial indent either doesn't exist or is not strictly greater
// than parent indent and,therefore, signals an empty block.
//
return new Stmt.Block();
} else {
// Initial indent is valid, so we proceed parsing statements with
// the appropriate level of indent.
ArrayList<Stmt> stmts = new ArrayList<>();
Indent nextIndent;
while ((nextIndent = getIndent()) != null && indent.lessThanEq(nextIndent)) {
// At this point, nextIndent contains the indent of the current
// statement. However, this still may not be equivalent to this
// block's indentation level.
//
// First, check the indentation matches that for this block.
if (!indent.equivalent(nextIndent)) {
// No, it's not equivalent so signal an error.
syntaxError("unexpected end-of-block", nextIndent);
}
// Second, parse the actual statement at this point!
stmts.add(parseStatement(blockScope));
}
// Finally, construct the block
return new Stmt.Block(stmts.toArray(new Stmt[stmts.size()]));
}
} | java | private Stmt.Block parseBlock(EnclosingScope scope, boolean isLoop) {
// First, determine the initial indentation of this block based on the
// first statement (or null if there is no statement).
Indent indent = getIndent();
// We must clone the environment here, in order to ensure variables
// declared within this block are properly scoped.
EnclosingScope blockScope = scope.newEnclosingScope(indent, isLoop);
// Second, check that this is indeed the initial indentation for this
// block (i.e. that it is strictly greater than parent indent).
if (indent == null || indent.lessThanEq(scope.getIndent())) {
// Initial indent either doesn't exist or is not strictly greater
// than parent indent and,therefore, signals an empty block.
//
return new Stmt.Block();
} else {
// Initial indent is valid, so we proceed parsing statements with
// the appropriate level of indent.
ArrayList<Stmt> stmts = new ArrayList<>();
Indent nextIndent;
while ((nextIndent = getIndent()) != null && indent.lessThanEq(nextIndent)) {
// At this point, nextIndent contains the indent of the current
// statement. However, this still may not be equivalent to this
// block's indentation level.
//
// First, check the indentation matches that for this block.
if (!indent.equivalent(nextIndent)) {
// No, it's not equivalent so signal an error.
syntaxError("unexpected end-of-block", nextIndent);
}
// Second, parse the actual statement at this point!
stmts.add(parseStatement(blockScope));
}
// Finally, construct the block
return new Stmt.Block(stmts.toArray(new Stmt[stmts.size()]));
}
} | [
"private",
"Stmt",
".",
"Block",
"parseBlock",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"isLoop",
")",
"{",
"// First, determine the initial indentation of this block based on the",
"// first statement (or null if there is no statement).",
"Indent",
"indent",
"=",
"getIndent",
"(",
")",
";",
"// We must clone the environment here, in order to ensure variables",
"// declared within this block are properly scoped.",
"EnclosingScope",
"blockScope",
"=",
"scope",
".",
"newEnclosingScope",
"(",
"indent",
",",
"isLoop",
")",
";",
"// Second, check that this is indeed the initial indentation for this",
"// block (i.e. that it is strictly greater than parent indent).",
"if",
"(",
"indent",
"==",
"null",
"||",
"indent",
".",
"lessThanEq",
"(",
"scope",
".",
"getIndent",
"(",
")",
")",
")",
"{",
"// Initial indent either doesn't exist or is not strictly greater",
"// than parent indent and,therefore, signals an empty block.",
"//",
"return",
"new",
"Stmt",
".",
"Block",
"(",
")",
";",
"}",
"else",
"{",
"// Initial indent is valid, so we proceed parsing statements with",
"// the appropriate level of indent.",
"ArrayList",
"<",
"Stmt",
">",
"stmts",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Indent",
"nextIndent",
";",
"while",
"(",
"(",
"nextIndent",
"=",
"getIndent",
"(",
")",
")",
"!=",
"null",
"&&",
"indent",
".",
"lessThanEq",
"(",
"nextIndent",
")",
")",
"{",
"// At this point, nextIndent contains the indent of the current",
"// statement. However, this still may not be equivalent to this",
"// block's indentation level.",
"//",
"// First, check the indentation matches that for this block.",
"if",
"(",
"!",
"indent",
".",
"equivalent",
"(",
"nextIndent",
")",
")",
"{",
"// No, it's not equivalent so signal an error.",
"syntaxError",
"(",
"\"unexpected end-of-block\"",
",",
"nextIndent",
")",
";",
"}",
"// Second, parse the actual statement at this point!",
"stmts",
".",
"add",
"(",
"parseStatement",
"(",
"blockScope",
")",
")",
";",
"}",
"// Finally, construct the block",
"return",
"new",
"Stmt",
".",
"Block",
"(",
"stmts",
".",
"toArray",
"(",
"new",
"Stmt",
"[",
"stmts",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"}",
"}"
] | Parse a block of zero or more statements which share the same indentation
level. Their indentation level must be strictly greater than that of
their parent, otherwise the end of block is signaled. The <i>indentation
level</i> for the block is set by the first statement encountered
(assuming their is one). An error occurs if a subsequent statement is
reached with an indentation level <i>greater</i> than the block's
indentation level.
@param parentIndent
The indentation level of the parent, for which all statements
in this block must have a greater indent. May not be
<code>null</code>.
@param isLoop
Indicates whether or not this block represents the body of a
loop. This is important in order to setup the scope for this
block appropriately.
@return | [
"Parse",
"a",
"block",
"of",
"zero",
"or",
"more",
"statements",
"which",
"share",
"the",
"same",
"indentation",
"level",
".",
"Their",
"indentation",
"level",
"must",
"be",
"strictly",
"greater",
"than",
"that",
"of",
"their",
"parent",
"otherwise",
"the",
"end",
"of",
"block",
"is",
"signaled",
".",
"The",
"<i",
">",
"indentation",
"level<",
"/",
"i",
">",
"for",
"the",
"block",
"is",
"set",
"by",
"the",
"first",
"statement",
"encountered",
"(",
"assuming",
"their",
"is",
"one",
")",
".",
"An",
"error",
"occurs",
"if",
"a",
"subsequent",
"statement",
"is",
"reached",
"with",
"an",
"indentation",
"level",
"<i",
">",
"greater<",
"/",
"i",
">",
"than",
"the",
"block",
"s",
"indentation",
"level",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L628-L663 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setPerspectiveLH | public Matrix4f setPerspectiveLH(float fovy, float aspect, float zNear, float zFar, boolean zZeroToOne) {
"""
Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system
using the given NDC z range of <code>[-1..+1]</code>.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveLH(float, float, float, float, boolean) perspectiveLH()}.
@see #perspectiveLH(float, float, float, float, boolean)
@param fovy
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
@param aspect
the aspect ratio (i.e. width / height; must be greater than zero)
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this
"""
MemUtil.INSTANCE.zero(this);
float h = (float) Math.tan(fovy * 0.5f);
this._m00(1.0f / (h * aspect));
this._m11(1.0f / h);
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(1.0f - e);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(1.0f);
_properties(PROPERTY_PERSPECTIVE);
return this;
} | java | public Matrix4f setPerspectiveLH(float fovy, float aspect, float zNear, float zFar, boolean zZeroToOne) {
MemUtil.INSTANCE.zero(this);
float h = (float) Math.tan(fovy * 0.5f);
this._m00(1.0f / (h * aspect));
this._m11(1.0f / h);
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(1.0f - e);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(1.0f);
_properties(PROPERTY_PERSPECTIVE);
return this;
} | [
"public",
"Matrix4f",
"setPerspectiveLH",
"(",
"float",
"fovy",
",",
"float",
"aspect",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"zero",
"(",
"this",
")",
";",
"float",
"h",
"=",
"(",
"float",
")",
"Math",
".",
"tan",
"(",
"fovy",
"*",
"0.5f",
")",
";",
"this",
".",
"_m00",
"(",
"1.0f",
"/",
"(",
"h",
"*",
"aspect",
")",
")",
";",
"this",
".",
"_m11",
"(",
"1.0f",
"/",
"h",
")",
";",
"boolean",
"farInf",
"=",
"zFar",
">",
"0",
"&&",
"Float",
".",
"isInfinite",
"(",
"zFar",
")",
";",
"boolean",
"nearInf",
"=",
"zNear",
">",
"0",
"&&",
"Float",
".",
"isInfinite",
"(",
"zNear",
")",
";",
"if",
"(",
"farInf",
")",
"{",
"// See: \"Infinite Projection Matrix\" (http://www.terathon.com/gdc07_lengyel.pdf)",
"float",
"e",
"=",
"1E-6f",
";",
"this",
".",
"_m22",
"(",
"1.0f",
"-",
"e",
")",
";",
"this",
".",
"_m32",
"(",
"(",
"e",
"-",
"(",
"zZeroToOne",
"?",
"1.0f",
":",
"2.0f",
")",
")",
"*",
"zNear",
")",
";",
"}",
"else",
"if",
"(",
"nearInf",
")",
"{",
"float",
"e",
"=",
"1E-6f",
";",
"this",
".",
"_m22",
"(",
"(",
"zZeroToOne",
"?",
"0.0f",
":",
"1.0f",
")",
"-",
"e",
")",
";",
"this",
".",
"_m32",
"(",
"(",
"(",
"zZeroToOne",
"?",
"1.0f",
":",
"2.0f",
")",
"-",
"e",
")",
"*",
"zFar",
")",
";",
"}",
"else",
"{",
"this",
".",
"_m22",
"(",
"(",
"zZeroToOne",
"?",
"zFar",
":",
"zFar",
"+",
"zNear",
")",
"/",
"(",
"zFar",
"-",
"zNear",
")",
")",
";",
"this",
".",
"_m32",
"(",
"(",
"zZeroToOne",
"?",
"zFar",
":",
"zFar",
"+",
"zFar",
")",
"*",
"zNear",
"/",
"(",
"zNear",
"-",
"zFar",
")",
")",
";",
"}",
"this",
".",
"_m23",
"(",
"1.0f",
")",
";",
"_properties",
"(",
"PROPERTY_PERSPECTIVE",
")",
";",
"return",
"this",
";",
"}"
] | Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system
using the given NDC z range of <code>[-1..+1]</code>.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveLH(float, float, float, float, boolean) perspectiveLH()}.
@see #perspectiveLH(float, float, float, float, boolean)
@param fovy
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
@param aspect
the aspect ratio (i.e. width / height; must be greater than zero)
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/",
"code",
">",
".",
"<p",
">",
"In",
"order",
"to",
"apply",
"the",
"perspective",
"projection",
"transformation",
"to",
"an",
"existing",
"transformation",
"use",
"{",
"@link",
"#perspectiveLH",
"(",
"float",
"float",
"float",
"float",
"boolean",
")",
"perspectiveLH",
"()",
"}",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L10235-L10258 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java | StreamUtils.iteratorToStream | public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator, final Boolean parallel) {
"""
Convert an Iterator to a Stream
@param <T> the type of the Stream
@param iterator the iterator
@param parallel whether to parallelize the stream
@return the stream
"""
return stream(spliteratorUnknownSize(iterator, IMMUTABLE), parallel);
} | java | public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator, final Boolean parallel) {
return stream(spliteratorUnknownSize(iterator, IMMUTABLE), parallel);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"iteratorToStream",
"(",
"final",
"Iterator",
"<",
"T",
">",
"iterator",
",",
"final",
"Boolean",
"parallel",
")",
"{",
"return",
"stream",
"(",
"spliteratorUnknownSize",
"(",
"iterator",
",",
"IMMUTABLE",
")",
",",
"parallel",
")",
";",
"}"
] | Convert an Iterator to a Stream
@param <T> the type of the Stream
@param iterator the iterator
@param parallel whether to parallelize the stream
@return the stream | [
"Convert",
"an",
"Iterator",
"to",
"a",
"Stream"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java#L76-L78 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java | ChainedIoHandler.messageReceived | @Override
public void messageReceived(IoSession session, Object message)
throws Exception {
"""
Handles the specified <tt>messageReceived</tt> event with the
{@link IoHandlerCommand} or {@link IoHandlerChain} you specified
in the constructor.
"""
chain.execute(null, session, message);
} | java | @Override
public void messageReceived(IoSession session, Object message)
throws Exception {
chain.execute(null, session, message);
} | [
"@",
"Override",
"public",
"void",
"messageReceived",
"(",
"IoSession",
"session",
",",
"Object",
"message",
")",
"throws",
"Exception",
"{",
"chain",
".",
"execute",
"(",
"null",
",",
"session",
",",
"message",
")",
";",
"}"
] | Handles the specified <tt>messageReceived</tt> event with the
{@link IoHandlerCommand} or {@link IoHandlerChain} you specified
in the constructor. | [
"Handles",
"the",
"specified",
"<tt",
">",
"messageReceived<",
"/",
"tt",
">",
"event",
"with",
"the",
"{"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java#L64-L68 |
banq/jdonframework | src/main/java/com/jdon/util/MultiHashMap.java | MultiHashMap.get | public Object get(Object key,Object subKey) {
"""
Returns the value to which this map maps the specified key and subKey. Returns null if the map contains no mapping
for this key and subKey. A return value of null does not necessarily indicate that the map contains no mapping
for the key and subKey; it's also possible that the map explicitly maps the key to null.
The containsKey operation may be used to distinguish these two cases.
@param key whose associated value is to be returned.
@param subKey whose associated value is to be returned
@return the value to which this map maps the specified key.
"""
HashMap a = (HashMap)super.get(key);
if(a!=null){
Object b=a.get(subKey);
return b;
}
return null;
} | java | public Object get(Object key,Object subKey){
HashMap a = (HashMap)super.get(key);
if(a!=null){
Object b=a.get(subKey);
return b;
}
return null;
} | [
"public",
"Object",
"get",
"(",
"Object",
"key",
",",
"Object",
"subKey",
")",
"{",
"HashMap",
"a",
"=",
"(",
"HashMap",
")",
"super",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"Object",
"b",
"=",
"a",
".",
"get",
"(",
"subKey",
")",
";",
"return",
"b",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the value to which this map maps the specified key and subKey. Returns null if the map contains no mapping
for this key and subKey. A return value of null does not necessarily indicate that the map contains no mapping
for the key and subKey; it's also possible that the map explicitly maps the key to null.
The containsKey operation may be used to distinguish these two cases.
@param key whose associated value is to be returned.
@param subKey whose associated value is to be returned
@return the value to which this map maps the specified key. | [
"Returns",
"the",
"value",
"to",
"which",
"this",
"map",
"maps",
"the",
"specified",
"key",
"and",
"subKey",
".",
"Returns",
"null",
"if",
"the",
"map",
"contains",
"no",
"mapping",
"for",
"this",
"key",
"and",
"subKey",
".",
"A",
"return",
"value",
"of",
"null",
"does",
"not",
"necessarily",
"indicate",
"that",
"the",
"map",
"contains",
"no",
"mapping",
"for",
"the",
"key",
"and",
"subKey",
";",
"it",
"s",
"also",
"possible",
"that",
"the",
"map",
"explicitly",
"maps",
"the",
"key",
"to",
"null",
".",
"The",
"containsKey",
"operation",
"may",
"be",
"used",
"to",
"distinguish",
"these",
"two",
"cases",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/MultiHashMap.java#L51-L58 |
TheHortonMachine/hortonmachine | apps/src/main/java/org/hortonmachine/nww/utils/NwwUtilities.java | NwwUtilities.computeDistance | public static double computeDistance( double lat1, double lon1, double lat2, double lon2 ) {
"""
Calculates distance between 2 lat/long points on WGS84.
<p>Taken from Android sources.</p>
@param lat1
@param lon1
@param lat2
@param lon2
@return
"""
// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4)
int MAXITERS = 20;
// Convert lat/long to radians
lat1 *= Math.PI / 180.0;
lat2 *= Math.PI / 180.0;
lon1 *= Math.PI / 180.0;
lon2 *= Math.PI / 180.0;
double a = 6378137.0; // WGS84 major axis
double b = 6356752.3142; // WGS84 semi-major axis
double f = (a - b) / a;
double aSqMinusBSqOverBSq = (a * a - b * b) / (b * b);
double L = lon2 - lon1;
double A = 0.0;
double U1 = Math.atan((1.0 - f) * Math.tan(lat1));
double U2 = Math.atan((1.0 - f) * Math.tan(lat2));
double cosU1 = Math.cos(U1);
double cosU2 = Math.cos(U2);
double sinU1 = Math.sin(U1);
double sinU2 = Math.sin(U2);
double cosU1cosU2 = cosU1 * cosU2;
double sinU1sinU2 = sinU1 * sinU2;
double sigma = 0.0;
double deltaSigma = 0.0;
double cosSqAlpha = 0.0;
double cos2SM = 0.0;
double cosSigma = 0.0;
double sinSigma = 0.0;
double cosLambda = 0.0;
double sinLambda = 0.0;
double lambda = L; // initial guess
for( int iter = 0; iter < MAXITERS; iter++ ) {
double lambdaOrig = lambda;
cosLambda = Math.cos(lambda);
sinLambda = Math.sin(lambda);
double t1 = cosU2 * sinLambda;
double t2 = cosU1 * sinU2 - sinU1 * cosU2 * cosLambda;
double sinSqSigma = t1 * t1 + t2 * t2; // (14)
sinSigma = Math.sqrt(sinSqSigma);
cosSigma = sinU1sinU2 + cosU1cosU2 * cosLambda; // (15)
sigma = Math.atan2(sinSigma, cosSigma); // (16)
double sinAlpha = (sinSigma == 0) ? 0.0 : cosU1cosU2 * sinLambda / sinSigma; // (17)
cosSqAlpha = 1.0 - sinAlpha * sinAlpha;
cos2SM = (cosSqAlpha == 0) ? 0.0 : cosSigma - 2.0 * sinU1sinU2 / cosSqAlpha; // (18)
double uSquared = cosSqAlpha * aSqMinusBSqOverBSq; // defn
A = 1 + (uSquared / 16384.0) * // (3)
(4096.0 + uSquared * (-768 + uSquared * (320.0 - 175.0 * uSquared)));
double B = (uSquared / 1024.0) * // (4)
(256.0 + uSquared * (-128.0 + uSquared * (74.0 - 47.0 * uSquared)));
double C = (f / 16.0) * cosSqAlpha * (4.0 + f * (4.0 - 3.0 * cosSqAlpha)); // (10)
double cos2SMSq = cos2SM * cos2SM;
deltaSigma = B * sinSigma * // (6)
(cos2SM + (B / 4.0) * (cosSigma * (-1.0 + 2.0 * cos2SMSq)
- (B / 6.0) * cos2SM * (-3.0 + 4.0 * sinSigma * sinSigma) * (-3.0 + 4.0 * cos2SMSq)));
lambda = L + (1.0 - C) * f * sinAlpha
* (sigma + C * sinSigma * (cos2SM + C * cosSigma * (-1.0 + 2.0 * cos2SM * cos2SM))); // (11)
double delta = (lambda - lambdaOrig) / lambda;
if (Math.abs(delta) < 1.0e-12) {
break;
}
}
float distance = (float) (b * A * (sigma - deltaSigma));
return distance;
} | java | public static double computeDistance( double lat1, double lon1, double lat2, double lon2 ) {
// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4)
int MAXITERS = 20;
// Convert lat/long to radians
lat1 *= Math.PI / 180.0;
lat2 *= Math.PI / 180.0;
lon1 *= Math.PI / 180.0;
lon2 *= Math.PI / 180.0;
double a = 6378137.0; // WGS84 major axis
double b = 6356752.3142; // WGS84 semi-major axis
double f = (a - b) / a;
double aSqMinusBSqOverBSq = (a * a - b * b) / (b * b);
double L = lon2 - lon1;
double A = 0.0;
double U1 = Math.atan((1.0 - f) * Math.tan(lat1));
double U2 = Math.atan((1.0 - f) * Math.tan(lat2));
double cosU1 = Math.cos(U1);
double cosU2 = Math.cos(U2);
double sinU1 = Math.sin(U1);
double sinU2 = Math.sin(U2);
double cosU1cosU2 = cosU1 * cosU2;
double sinU1sinU2 = sinU1 * sinU2;
double sigma = 0.0;
double deltaSigma = 0.0;
double cosSqAlpha = 0.0;
double cos2SM = 0.0;
double cosSigma = 0.0;
double sinSigma = 0.0;
double cosLambda = 0.0;
double sinLambda = 0.0;
double lambda = L; // initial guess
for( int iter = 0; iter < MAXITERS; iter++ ) {
double lambdaOrig = lambda;
cosLambda = Math.cos(lambda);
sinLambda = Math.sin(lambda);
double t1 = cosU2 * sinLambda;
double t2 = cosU1 * sinU2 - sinU1 * cosU2 * cosLambda;
double sinSqSigma = t1 * t1 + t2 * t2; // (14)
sinSigma = Math.sqrt(sinSqSigma);
cosSigma = sinU1sinU2 + cosU1cosU2 * cosLambda; // (15)
sigma = Math.atan2(sinSigma, cosSigma); // (16)
double sinAlpha = (sinSigma == 0) ? 0.0 : cosU1cosU2 * sinLambda / sinSigma; // (17)
cosSqAlpha = 1.0 - sinAlpha * sinAlpha;
cos2SM = (cosSqAlpha == 0) ? 0.0 : cosSigma - 2.0 * sinU1sinU2 / cosSqAlpha; // (18)
double uSquared = cosSqAlpha * aSqMinusBSqOverBSq; // defn
A = 1 + (uSquared / 16384.0) * // (3)
(4096.0 + uSquared * (-768 + uSquared * (320.0 - 175.0 * uSquared)));
double B = (uSquared / 1024.0) * // (4)
(256.0 + uSquared * (-128.0 + uSquared * (74.0 - 47.0 * uSquared)));
double C = (f / 16.0) * cosSqAlpha * (4.0 + f * (4.0 - 3.0 * cosSqAlpha)); // (10)
double cos2SMSq = cos2SM * cos2SM;
deltaSigma = B * sinSigma * // (6)
(cos2SM + (B / 4.0) * (cosSigma * (-1.0 + 2.0 * cos2SMSq)
- (B / 6.0) * cos2SM * (-3.0 + 4.0 * sinSigma * sinSigma) * (-3.0 + 4.0 * cos2SMSq)));
lambda = L + (1.0 - C) * f * sinAlpha
* (sigma + C * sinSigma * (cos2SM + C * cosSigma * (-1.0 + 2.0 * cos2SM * cos2SM))); // (11)
double delta = (lambda - lambdaOrig) / lambda;
if (Math.abs(delta) < 1.0e-12) {
break;
}
}
float distance = (float) (b * A * (sigma - deltaSigma));
return distance;
} | [
"public",
"static",
"double",
"computeDistance",
"(",
"double",
"lat1",
",",
"double",
"lon1",
",",
"double",
"lat2",
",",
"double",
"lon2",
")",
"{",
"// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf",
"// using the \"Inverse Formula\" (section 4)",
"int",
"MAXITERS",
"=",
"20",
";",
"// Convert lat/long to radians",
"lat1",
"*=",
"Math",
".",
"PI",
"/",
"180.0",
";",
"lat2",
"*=",
"Math",
".",
"PI",
"/",
"180.0",
";",
"lon1",
"*=",
"Math",
".",
"PI",
"/",
"180.0",
";",
"lon2",
"*=",
"Math",
".",
"PI",
"/",
"180.0",
";",
"double",
"a",
"=",
"6378137.0",
";",
"// WGS84 major axis",
"double",
"b",
"=",
"6356752.3142",
";",
"// WGS84 semi-major axis",
"double",
"f",
"=",
"(",
"a",
"-",
"b",
")",
"/",
"a",
";",
"double",
"aSqMinusBSqOverBSq",
"=",
"(",
"a",
"*",
"a",
"-",
"b",
"*",
"b",
")",
"/",
"(",
"b",
"*",
"b",
")",
";",
"double",
"L",
"=",
"lon2",
"-",
"lon1",
";",
"double",
"A",
"=",
"0.0",
";",
"double",
"U1",
"=",
"Math",
".",
"atan",
"(",
"(",
"1.0",
"-",
"f",
")",
"*",
"Math",
".",
"tan",
"(",
"lat1",
")",
")",
";",
"double",
"U2",
"=",
"Math",
".",
"atan",
"(",
"(",
"1.0",
"-",
"f",
")",
"*",
"Math",
".",
"tan",
"(",
"lat2",
")",
")",
";",
"double",
"cosU1",
"=",
"Math",
".",
"cos",
"(",
"U1",
")",
";",
"double",
"cosU2",
"=",
"Math",
".",
"cos",
"(",
"U2",
")",
";",
"double",
"sinU1",
"=",
"Math",
".",
"sin",
"(",
"U1",
")",
";",
"double",
"sinU2",
"=",
"Math",
".",
"sin",
"(",
"U2",
")",
";",
"double",
"cosU1cosU2",
"=",
"cosU1",
"*",
"cosU2",
";",
"double",
"sinU1sinU2",
"=",
"sinU1",
"*",
"sinU2",
";",
"double",
"sigma",
"=",
"0.0",
";",
"double",
"deltaSigma",
"=",
"0.0",
";",
"double",
"cosSqAlpha",
"=",
"0.0",
";",
"double",
"cos2SM",
"=",
"0.0",
";",
"double",
"cosSigma",
"=",
"0.0",
";",
"double",
"sinSigma",
"=",
"0.0",
";",
"double",
"cosLambda",
"=",
"0.0",
";",
"double",
"sinLambda",
"=",
"0.0",
";",
"double",
"lambda",
"=",
"L",
";",
"// initial guess",
"for",
"(",
"int",
"iter",
"=",
"0",
";",
"iter",
"<",
"MAXITERS",
";",
"iter",
"++",
")",
"{",
"double",
"lambdaOrig",
"=",
"lambda",
";",
"cosLambda",
"=",
"Math",
".",
"cos",
"(",
"lambda",
")",
";",
"sinLambda",
"=",
"Math",
".",
"sin",
"(",
"lambda",
")",
";",
"double",
"t1",
"=",
"cosU2",
"*",
"sinLambda",
";",
"double",
"t2",
"=",
"cosU1",
"*",
"sinU2",
"-",
"sinU1",
"*",
"cosU2",
"*",
"cosLambda",
";",
"double",
"sinSqSigma",
"=",
"t1",
"*",
"t1",
"+",
"t2",
"*",
"t2",
";",
"// (14)",
"sinSigma",
"=",
"Math",
".",
"sqrt",
"(",
"sinSqSigma",
")",
";",
"cosSigma",
"=",
"sinU1sinU2",
"+",
"cosU1cosU2",
"*",
"cosLambda",
";",
"// (15)",
"sigma",
"=",
"Math",
".",
"atan2",
"(",
"sinSigma",
",",
"cosSigma",
")",
";",
"// (16)",
"double",
"sinAlpha",
"=",
"(",
"sinSigma",
"==",
"0",
")",
"?",
"0.0",
":",
"cosU1cosU2",
"*",
"sinLambda",
"/",
"sinSigma",
";",
"// (17)",
"cosSqAlpha",
"=",
"1.0",
"-",
"sinAlpha",
"*",
"sinAlpha",
";",
"cos2SM",
"=",
"(",
"cosSqAlpha",
"==",
"0",
")",
"?",
"0.0",
":",
"cosSigma",
"-",
"2.0",
"*",
"sinU1sinU2",
"/",
"cosSqAlpha",
";",
"// (18)",
"double",
"uSquared",
"=",
"cosSqAlpha",
"*",
"aSqMinusBSqOverBSq",
";",
"// defn",
"A",
"=",
"1",
"+",
"(",
"uSquared",
"/",
"16384.0",
")",
"*",
"// (3)",
"(",
"4096.0",
"+",
"uSquared",
"*",
"(",
"-",
"768",
"+",
"uSquared",
"*",
"(",
"320.0",
"-",
"175.0",
"*",
"uSquared",
")",
")",
")",
";",
"double",
"B",
"=",
"(",
"uSquared",
"/",
"1024.0",
")",
"*",
"// (4)",
"(",
"256.0",
"+",
"uSquared",
"*",
"(",
"-",
"128.0",
"+",
"uSquared",
"*",
"(",
"74.0",
"-",
"47.0",
"*",
"uSquared",
")",
")",
")",
";",
"double",
"C",
"=",
"(",
"f",
"/",
"16.0",
")",
"*",
"cosSqAlpha",
"*",
"(",
"4.0",
"+",
"f",
"*",
"(",
"4.0",
"-",
"3.0",
"*",
"cosSqAlpha",
")",
")",
";",
"// (10)",
"double",
"cos2SMSq",
"=",
"cos2SM",
"*",
"cos2SM",
";",
"deltaSigma",
"=",
"B",
"*",
"sinSigma",
"*",
"// (6)",
"(",
"cos2SM",
"+",
"(",
"B",
"/",
"4.0",
")",
"*",
"(",
"cosSigma",
"*",
"(",
"-",
"1.0",
"+",
"2.0",
"*",
"cos2SMSq",
")",
"-",
"(",
"B",
"/",
"6.0",
")",
"*",
"cos2SM",
"*",
"(",
"-",
"3.0",
"+",
"4.0",
"*",
"sinSigma",
"*",
"sinSigma",
")",
"*",
"(",
"-",
"3.0",
"+",
"4.0",
"*",
"cos2SMSq",
")",
")",
")",
";",
"lambda",
"=",
"L",
"+",
"(",
"1.0",
"-",
"C",
")",
"*",
"f",
"*",
"sinAlpha",
"*",
"(",
"sigma",
"+",
"C",
"*",
"sinSigma",
"*",
"(",
"cos2SM",
"+",
"C",
"*",
"cosSigma",
"*",
"(",
"-",
"1.0",
"+",
"2.0",
"*",
"cos2SM",
"*",
"cos2SM",
")",
")",
")",
";",
"// (11)",
"double",
"delta",
"=",
"(",
"lambda",
"-",
"lambdaOrig",
")",
"/",
"lambda",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"delta",
")",
"<",
"1.0e-12",
")",
"{",
"break",
";",
"}",
"}",
"float",
"distance",
"=",
"(",
"float",
")",
"(",
"b",
"*",
"A",
"*",
"(",
"sigma",
"-",
"deltaSigma",
")",
")",
";",
"return",
"distance",
";",
"}"
] | Calculates distance between 2 lat/long points on WGS84.
<p>Taken from Android sources.</p>
@param lat1
@param lon1
@param lat2
@param lon2
@return | [
"Calculates",
"distance",
"between",
"2",
"lat",
"/",
"long",
"points",
"on",
"WGS84",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/utils/NwwUtilities.java#L281-L345 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java | AnnotationUtils.findTypeAnnotation | public static <A extends Annotation> A findTypeAnnotation(final Class<?> type, final Class<A> targetAnnotationClass) {
"""
Recursive annotation search on type, it annotations and parents hierarchy. Interfaces ignored.
@param type
{@link Class}
@param targetAnnotationClass
required {@link Annotation} class
@param <A>
type param
@return {@link A} in case if found, {@code null} otherwise
"""
Objects.requireNonNull(type, "incoming 'type' is not valid");
Objects.requireNonNull(targetAnnotationClass, "incoming 'targetAnnotationClass' is not valid");
if (type.equals(Object.class))
return null;
//check annotation presence on class itself and its annotations if any
final A annotation = findAnnotation(type, targetAnnotationClass);
if (annotation != null)
return annotation;
//recursive call to check superclass if present
final Class<?> superClass = type.getSuperclass();
if (superClass != null)
return findTypeAnnotation(superClass, targetAnnotationClass);
return null;
} | java | public static <A extends Annotation> A findTypeAnnotation(final Class<?> type, final Class<A> targetAnnotationClass) {
Objects.requireNonNull(type, "incoming 'type' is not valid");
Objects.requireNonNull(targetAnnotationClass, "incoming 'targetAnnotationClass' is not valid");
if (type.equals(Object.class))
return null;
//check annotation presence on class itself and its annotations if any
final A annotation = findAnnotation(type, targetAnnotationClass);
if (annotation != null)
return annotation;
//recursive call to check superclass if present
final Class<?> superClass = type.getSuperclass();
if (superClass != null)
return findTypeAnnotation(superClass, targetAnnotationClass);
return null;
} | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"findTypeAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Class",
"<",
"A",
">",
"targetAnnotationClass",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"type",
",",
"\"incoming 'type' is not valid\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"targetAnnotationClass",
",",
"\"incoming 'targetAnnotationClass' is not valid\"",
")",
";",
"if",
"(",
"type",
".",
"equals",
"(",
"Object",
".",
"class",
")",
")",
"return",
"null",
";",
"//check annotation presence on class itself and its annotations if any",
"final",
"A",
"annotation",
"=",
"findAnnotation",
"(",
"type",
",",
"targetAnnotationClass",
")",
";",
"if",
"(",
"annotation",
"!=",
"null",
")",
"return",
"annotation",
";",
"//recursive call to check superclass if present",
"final",
"Class",
"<",
"?",
">",
"superClass",
"=",
"type",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"superClass",
"!=",
"null",
")",
"return",
"findTypeAnnotation",
"(",
"superClass",
",",
"targetAnnotationClass",
")",
";",
"return",
"null",
";",
"}"
] | Recursive annotation search on type, it annotations and parents hierarchy. Interfaces ignored.
@param type
{@link Class}
@param targetAnnotationClass
required {@link Annotation} class
@param <A>
type param
@return {@link A} in case if found, {@code null} otherwise | [
"Recursive",
"annotation",
"search",
"on",
"type",
"it",
"annotations",
"and",
"parents",
"hierarchy",
".",
"Interfaces",
"ignored",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java#L129-L144 |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java | FedoraBaseResource.getResourceFromPath | @VisibleForTesting
public FedoraResource getResourceFromPath(final String externalPath) {
"""
Get the FedoraResource for the resource at the external path
@param externalPath the external path
@return the fedora resource at the external path
"""
final Resource resource = translator().toDomain(externalPath);
final FedoraResource fedoraResource = translator().convert(resource);
if (fedoraResource instanceof Tombstone) {
final String resourceURI = TRAILING_SLASH_REGEX.matcher(resource.getURI()).replaceAll("");
throw new TombstoneException(fedoraResource, resourceURI + "/fcr:tombstone");
}
return fedoraResource;
} | java | @VisibleForTesting
public FedoraResource getResourceFromPath(final String externalPath) {
final Resource resource = translator().toDomain(externalPath);
final FedoraResource fedoraResource = translator().convert(resource);
if (fedoraResource instanceof Tombstone) {
final String resourceURI = TRAILING_SLASH_REGEX.matcher(resource.getURI()).replaceAll("");
throw new TombstoneException(fedoraResource, resourceURI + "/fcr:tombstone");
}
return fedoraResource;
} | [
"@",
"VisibleForTesting",
"public",
"FedoraResource",
"getResourceFromPath",
"(",
"final",
"String",
"externalPath",
")",
"{",
"final",
"Resource",
"resource",
"=",
"translator",
"(",
")",
".",
"toDomain",
"(",
"externalPath",
")",
";",
"final",
"FedoraResource",
"fedoraResource",
"=",
"translator",
"(",
")",
".",
"convert",
"(",
"resource",
")",
";",
"if",
"(",
"fedoraResource",
"instanceof",
"Tombstone",
")",
"{",
"final",
"String",
"resourceURI",
"=",
"TRAILING_SLASH_REGEX",
".",
"matcher",
"(",
"resource",
".",
"getURI",
"(",
")",
")",
".",
"replaceAll",
"(",
"\"\"",
")",
";",
"throw",
"new",
"TombstoneException",
"(",
"fedoraResource",
",",
"resourceURI",
"+",
"\"/fcr:tombstone\"",
")",
";",
"}",
"return",
"fedoraResource",
";",
"}"
] | Get the FedoraResource for the resource at the external path
@param externalPath the external path
@return the fedora resource at the external path | [
"Get",
"the",
"FedoraResource",
"for",
"the",
"resource",
"at",
"the",
"external",
"path"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java#L91-L102 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.rawComparison | public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException {
"""
Make a comparison where the operator is specified by the caller. It is up to the caller to specify an appropriate
operator for the database and that it be formatted correctly.
"""
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator));
return this;
} | java | public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"rawComparison",
"(",
"String",
"columnName",
",",
"String",
"rawOperator",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"SimpleComparison",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
",",
"value",
",",
"rawOperator",
")",
")",
";",
"return",
"this",
";",
"}"
] | Make a comparison where the operator is specified by the caller. It is up to the caller to specify an appropriate
operator for the database and that it be formatted correctly. | [
"Make",
"a",
"comparison",
"where",
"the",
"operator",
"is",
"specified",
"by",
"the",
"caller",
".",
"It",
"is",
"up",
"to",
"the",
"caller",
"to",
"specify",
"an",
"appropriate",
"operator",
"for",
"the",
"database",
"and",
"that",
"it",
"be",
"formatted",
"correctly",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L464-L467 |
code4everything/util | src/main/java/com/zhazhapan/util/Formatter.java | Formatter.toCurrency | public static String toCurrency(Locale locale, double number) {
"""
格式化为货币字符串
@param locale {@link Locale},比如:{@link Locale#CHINA}
@param number 数字
@return 货币字符串
@since 1.0.9
"""
return NumberFormat.getCurrencyInstance(locale).format(number);
} | java | public static String toCurrency(Locale locale, double number) {
return NumberFormat.getCurrencyInstance(locale).format(number);
} | [
"public",
"static",
"String",
"toCurrency",
"(",
"Locale",
"locale",
",",
"double",
"number",
")",
"{",
"return",
"NumberFormat",
".",
"getCurrencyInstance",
"(",
"locale",
")",
".",
"format",
"(",
"number",
")",
";",
"}"
] | 格式化为货币字符串
@param locale {@link Locale},比如:{@link Locale#CHINA}
@param number 数字
@return 货币字符串
@since 1.0.9 | [
"格式化为货币字符串"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Formatter.java#L156-L158 |
JRebirth/JRebirth | org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java | AbstractSlideModel.buildHorizontalAnimation | protected Animation buildHorizontalAnimation(final double fromX, final double toX, final double fromY, final double toY) {
"""
Build a scaling animation.
@param fromX the x starting point coordinate
@param toX the x arrival point coordinate
@param fromY the y starting point coordinate
@param toY the y arrival point coordinate
@return a translate animation
"""
final double angle = findAngle(fromX, toX, fromY, toY);
final MotionBlur mb = MotionBlurBuilder.create().angle(angle).build();
node().setEffect(mb);
return ParallelTransitionBuilder.create()
.children(
TranslateTransitionBuilder.create()
.node(node())
.fromX(fromX)
.toX(toX)
.fromY(fromY)
.toY(toY)
.duration(Duration.seconds(1))
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0), new KeyValue(mb.radiusProperty(), 0)),
new KeyFrame(Duration.millis(100), new KeyValue(mb.radiusProperty(), 50)),
new KeyFrame(Duration.millis(500), new KeyValue(mb.radiusProperty(), 63)),
new KeyFrame(Duration.millis(900), new KeyValue(mb.radiusProperty(), 50)),
new KeyFrame(Duration.millis(1000), new KeyValue(mb.radiusProperty(), 0)))
.build())
.build();
} | java | protected Animation buildHorizontalAnimation(final double fromX, final double toX, final double fromY, final double toY) {
final double angle = findAngle(fromX, toX, fromY, toY);
final MotionBlur mb = MotionBlurBuilder.create().angle(angle).build();
node().setEffect(mb);
return ParallelTransitionBuilder.create()
.children(
TranslateTransitionBuilder.create()
.node(node())
.fromX(fromX)
.toX(toX)
.fromY(fromY)
.toY(toY)
.duration(Duration.seconds(1))
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0), new KeyValue(mb.radiusProperty(), 0)),
new KeyFrame(Duration.millis(100), new KeyValue(mb.radiusProperty(), 50)),
new KeyFrame(Duration.millis(500), new KeyValue(mb.radiusProperty(), 63)),
new KeyFrame(Duration.millis(900), new KeyValue(mb.radiusProperty(), 50)),
new KeyFrame(Duration.millis(1000), new KeyValue(mb.radiusProperty(), 0)))
.build())
.build();
} | [
"protected",
"Animation",
"buildHorizontalAnimation",
"(",
"final",
"double",
"fromX",
",",
"final",
"double",
"toX",
",",
"final",
"double",
"fromY",
",",
"final",
"double",
"toY",
")",
"{",
"final",
"double",
"angle",
"=",
"findAngle",
"(",
"fromX",
",",
"toX",
",",
"fromY",
",",
"toY",
")",
";",
"final",
"MotionBlur",
"mb",
"=",
"MotionBlurBuilder",
".",
"create",
"(",
")",
".",
"angle",
"(",
"angle",
")",
".",
"build",
"(",
")",
";",
"node",
"(",
")",
".",
"setEffect",
"(",
"mb",
")",
";",
"return",
"ParallelTransitionBuilder",
".",
"create",
"(",
")",
".",
"children",
"(",
"TranslateTransitionBuilder",
".",
"create",
"(",
")",
".",
"node",
"(",
"node",
"(",
")",
")",
".",
"fromX",
"(",
"fromX",
")",
".",
"toX",
"(",
"toX",
")",
".",
"fromY",
"(",
"fromY",
")",
".",
"toY",
"(",
"toY",
")",
".",
"duration",
"(",
"Duration",
".",
"seconds",
"(",
"1",
")",
")",
".",
"build",
"(",
")",
",",
"TimelineBuilder",
".",
"create",
"(",
")",
".",
"keyFrames",
"(",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"0",
")",
",",
"new",
"KeyValue",
"(",
"mb",
".",
"radiusProperty",
"(",
")",
",",
"0",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"100",
")",
",",
"new",
"KeyValue",
"(",
"mb",
".",
"radiusProperty",
"(",
")",
",",
"50",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"500",
")",
",",
"new",
"KeyValue",
"(",
"mb",
".",
"radiusProperty",
"(",
")",
",",
"63",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"900",
")",
",",
"new",
"KeyValue",
"(",
"mb",
".",
"radiusProperty",
"(",
")",
",",
"50",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"1000",
")",
",",
"new",
"KeyValue",
"(",
"mb",
".",
"radiusProperty",
"(",
")",
",",
"0",
")",
")",
")",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] | Build a scaling animation.
@param fromX the x starting point coordinate
@param toX the x arrival point coordinate
@param fromY the y starting point coordinate
@param toY the y arrival point coordinate
@return a translate animation | [
"Build",
"a",
"scaling",
"animation",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L495-L522 |
alipay/sofa-rpc | extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/ProviderInfoWeightManager.java | ProviderInfoWeightManager.degradeWeight | public static boolean degradeWeight(ProviderInfo providerInfo, int weight) {
"""
Degrade weight of provider info
@param providerInfo ProviderInfo
@param weight degraded weight
@return is degrade success
"""
providerInfo.setStatus(ProviderStatus.DEGRADED);
providerInfo.setWeight(weight);
return true;
} | java | public static boolean degradeWeight(ProviderInfo providerInfo, int weight) {
providerInfo.setStatus(ProviderStatus.DEGRADED);
providerInfo.setWeight(weight);
return true;
} | [
"public",
"static",
"boolean",
"degradeWeight",
"(",
"ProviderInfo",
"providerInfo",
",",
"int",
"weight",
")",
"{",
"providerInfo",
".",
"setStatus",
"(",
"ProviderStatus",
".",
"DEGRADED",
")",
";",
"providerInfo",
".",
"setWeight",
"(",
"weight",
")",
";",
"return",
"true",
";",
"}"
] | Degrade weight of provider info
@param providerInfo ProviderInfo
@param weight degraded weight
@return is degrade success | [
"Degrade",
"weight",
"of",
"provider",
"info"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/ProviderInfoWeightManager.java#L49-L53 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel03SaxReader.java | Excel03SaxReader.read | public Excel03SaxReader read(POIFSFileSystem fs, int sheetIndex) throws POIException {
"""
读取
@param fs {@link POIFSFileSystem}
@param sheetIndex sheet序号
@return this
@throws POIException IO异常包装
"""
this.sheetIndex = sheetIndex;
formatListener = new FormatTrackingHSSFListener(new MissingRecordAwareHSSFListener(this));
final HSSFRequest request = new HSSFRequest();
if (isOutputFormulaValues) {
request.addListenerForAllRecords(formatListener);
} else {
workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
request.addListenerForAllRecords(workbookBuildingListener);
}
final HSSFEventFactory factory = new HSSFEventFactory();
try {
factory.processWorkbookEvents(request, fs);
} catch (IOException e) {
throw new POIException(e);
}
return this;
} | java | public Excel03SaxReader read(POIFSFileSystem fs, int sheetIndex) throws POIException {
this.sheetIndex = sheetIndex;
formatListener = new FormatTrackingHSSFListener(new MissingRecordAwareHSSFListener(this));
final HSSFRequest request = new HSSFRequest();
if (isOutputFormulaValues) {
request.addListenerForAllRecords(formatListener);
} else {
workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
request.addListenerForAllRecords(workbookBuildingListener);
}
final HSSFEventFactory factory = new HSSFEventFactory();
try {
factory.processWorkbookEvents(request, fs);
} catch (IOException e) {
throw new POIException(e);
}
return this;
} | [
"public",
"Excel03SaxReader",
"read",
"(",
"POIFSFileSystem",
"fs",
",",
"int",
"sheetIndex",
")",
"throws",
"POIException",
"{",
"this",
".",
"sheetIndex",
"=",
"sheetIndex",
";",
"formatListener",
"=",
"new",
"FormatTrackingHSSFListener",
"(",
"new",
"MissingRecordAwareHSSFListener",
"(",
"this",
")",
")",
";",
"final",
"HSSFRequest",
"request",
"=",
"new",
"HSSFRequest",
"(",
")",
";",
"if",
"(",
"isOutputFormulaValues",
")",
"{",
"request",
".",
"addListenerForAllRecords",
"(",
"formatListener",
")",
";",
"}",
"else",
"{",
"workbookBuildingListener",
"=",
"new",
"SheetRecordCollectingListener",
"(",
"formatListener",
")",
";",
"request",
".",
"addListenerForAllRecords",
"(",
"workbookBuildingListener",
")",
";",
"}",
"final",
"HSSFEventFactory",
"factory",
"=",
"new",
"HSSFEventFactory",
"(",
")",
";",
"try",
"{",
"factory",
".",
"processWorkbookEvents",
"(",
"request",
",",
"fs",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"POIException",
"(",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 读取
@param fs {@link POIFSFileSystem}
@param sheetIndex sheet序号
@return this
@throws POIException IO异常包装 | [
"读取"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel03SaxReader.java#L109-L127 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/tools/Tools.java | Tools.selectRules | public static void selectRules(JLanguageTool lt, List<String> disabledRuleIds, List<String> enabledRuleIds, boolean useEnabledOnly) {
"""
Enable and disable rules of the given LanguageTool instance.
@param lt LanguageTool object
@param disabledRuleIds ids of the rules to be disabled
@param enabledRuleIds ids of the rules to be enabled
@param useEnabledOnly if set to {@code true}, disable all rules except those enabled explicitly
"""
Set<String> disabledRuleIdsSet = new HashSet<>();
disabledRuleIdsSet.addAll(disabledRuleIds);
Set<String> enabledRuleIdsSet = new HashSet<>();
enabledRuleIdsSet.addAll(enabledRuleIds);
selectRules(lt, Collections.emptySet(), Collections.emptySet(), disabledRuleIdsSet, enabledRuleIdsSet, useEnabledOnly);
} | java | public static void selectRules(JLanguageTool lt, List<String> disabledRuleIds, List<String> enabledRuleIds, boolean useEnabledOnly) {
Set<String> disabledRuleIdsSet = new HashSet<>();
disabledRuleIdsSet.addAll(disabledRuleIds);
Set<String> enabledRuleIdsSet = new HashSet<>();
enabledRuleIdsSet.addAll(enabledRuleIds);
selectRules(lt, Collections.emptySet(), Collections.emptySet(), disabledRuleIdsSet, enabledRuleIdsSet, useEnabledOnly);
} | [
"public",
"static",
"void",
"selectRules",
"(",
"JLanguageTool",
"lt",
",",
"List",
"<",
"String",
">",
"disabledRuleIds",
",",
"List",
"<",
"String",
">",
"enabledRuleIds",
",",
"boolean",
"useEnabledOnly",
")",
"{",
"Set",
"<",
"String",
">",
"disabledRuleIdsSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"disabledRuleIdsSet",
".",
"addAll",
"(",
"disabledRuleIds",
")",
";",
"Set",
"<",
"String",
">",
"enabledRuleIdsSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"enabledRuleIdsSet",
".",
"addAll",
"(",
"enabledRuleIds",
")",
";",
"selectRules",
"(",
"lt",
",",
"Collections",
".",
"emptySet",
"(",
")",
",",
"Collections",
".",
"emptySet",
"(",
")",
",",
"disabledRuleIdsSet",
",",
"enabledRuleIdsSet",
",",
"useEnabledOnly",
")",
";",
"}"
] | Enable and disable rules of the given LanguageTool instance.
@param lt LanguageTool object
@param disabledRuleIds ids of the rules to be disabled
@param enabledRuleIds ids of the rules to be enabled
@param useEnabledOnly if set to {@code true}, disable all rules except those enabled explicitly | [
"Enable",
"and",
"disable",
"rules",
"of",
"the",
"given",
"LanguageTool",
"instance",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L286-L292 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java | current_timezone.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
current_timezone_responses result = (current_timezone_responses) service.get_payload_formatter().string_to_resource(current_timezone_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_timezone_response_array);
}
current_timezone[] result_current_timezone = new current_timezone[result.current_timezone_response_array.length];
for(int i = 0; i < result.current_timezone_response_array.length; i++)
{
result_current_timezone[i] = result.current_timezone_response_array[i].current_timezone[0];
}
return result_current_timezone;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
current_timezone_responses result = (current_timezone_responses) service.get_payload_formatter().string_to_resource(current_timezone_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_timezone_response_array);
}
current_timezone[] result_current_timezone = new current_timezone[result.current_timezone_response_array.length];
for(int i = 0; i < result.current_timezone_response_array.length; i++)
{
result_current_timezone[i] = result.current_timezone_response_array[i].current_timezone[0];
}
return result_current_timezone;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"current_timezone_responses",
"result",
"=",
"(",
"current_timezone_responses",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"current_timezone_responses",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"SESSION_NOT_EXISTS",
")",
"service",
".",
"clear_session",
"(",
")",
";",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
",",
"(",
"base_response",
"[",
"]",
")",
"result",
".",
"current_timezone_response_array",
")",
";",
"}",
"current_timezone",
"[",
"]",
"result_current_timezone",
"=",
"new",
"current_timezone",
"[",
"result",
".",
"current_timezone_response_array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"current_timezone_response_array",
".",
"length",
";",
"i",
"++",
")",
"{",
"result_current_timezone",
"[",
"i",
"]",
"=",
"result",
".",
"current_timezone_response_array",
"[",
"i",
"]",
".",
"current_timezone",
"[",
"0",
"]",
";",
"}",
"return",
"result_current_timezone",
";",
"}"
] | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java#L203-L220 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DatabaseSpec.java | DatabaseSpec.assertTableDoesNotExistOnCassandraKeyspace | @Then("^a Cassandra keyspace '(.+?)' does not contain a table '(.+?)'$")
public void assertTableDoesNotExistOnCassandraKeyspace(String keyspace, String tableName) {
"""
Checks a cassandra keyspace does not contain a table.
@param keyspace
@param tableName
"""
assertThat(commonspec.getCassandraClient().getTables(keyspace)).as("The table " + tableName + "exists on cassandra").doesNotContain(tableName);
} | java | @Then("^a Cassandra keyspace '(.+?)' does not contain a table '(.+?)'$")
public void assertTableDoesNotExistOnCassandraKeyspace(String keyspace, String tableName) {
assertThat(commonspec.getCassandraClient().getTables(keyspace)).as("The table " + tableName + "exists on cassandra").doesNotContain(tableName);
} | [
"@",
"Then",
"(",
"\"^a Cassandra keyspace '(.+?)' does not contain a table '(.+?)'$\"",
")",
"public",
"void",
"assertTableDoesNotExistOnCassandraKeyspace",
"(",
"String",
"keyspace",
",",
"String",
"tableName",
")",
"{",
"assertThat",
"(",
"commonspec",
".",
"getCassandraClient",
"(",
")",
".",
"getTables",
"(",
"keyspace",
")",
")",
".",
"as",
"(",
"\"The table \"",
"+",
"tableName",
"+",
"\"exists on cassandra\"",
")",
".",
"doesNotContain",
"(",
"tableName",
")",
";",
"}"
] | Checks a cassandra keyspace does not contain a table.
@param keyspace
@param tableName | [
"Checks",
"a",
"cassandra",
"keyspace",
"does",
"not",
"contain",
"a",
"table",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L668-L671 |
alibaba/jstorm | jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/MyScpClient.java | MyScpClient.put | public void put(String localFile, String remoteTargetDirectory) throws IOException {
"""
Copy a local file to a remote directory, uses mode 0600 when creating
the file on the remote side.
@param localFile Path and name of local file.
@param remoteTargetDirectory Remote target directory.
@throws IOException
"""
put(new String[]{localFile}, remoteTargetDirectory, "0600");
} | java | public void put(String localFile, String remoteTargetDirectory) throws IOException {
put(new String[]{localFile}, remoteTargetDirectory, "0600");
} | [
"public",
"void",
"put",
"(",
"String",
"localFile",
",",
"String",
"remoteTargetDirectory",
")",
"throws",
"IOException",
"{",
"put",
"(",
"new",
"String",
"[",
"]",
"{",
"localFile",
"}",
",",
"remoteTargetDirectory",
",",
"\"0600\"",
")",
";",
"}"
] | Copy a local file to a remote directory, uses mode 0600 when creating
the file on the remote side.
@param localFile Path and name of local file.
@param remoteTargetDirectory Remote target directory.
@throws IOException | [
"Copy",
"a",
"local",
"file",
"to",
"a",
"remote",
"directory",
"uses",
"mode",
"0600",
"when",
"creating",
"the",
"file",
"on",
"the",
"remote",
"side",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/MyScpClient.java#L303-L305 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.listSiteDiagnosticCategoriesAsync | public Observable<Page<DiagnosticCategoryInner>> listSiteDiagnosticCategoriesAsync(final String resourceGroupName, final String siteName) {
"""
Get Diagnostics Categories.
Get Diagnostics Categories.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DiagnosticCategoryInner> object
"""
return listSiteDiagnosticCategoriesWithServiceResponseAsync(resourceGroupName, siteName)
.map(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Page<DiagnosticCategoryInner>>() {
@Override
public Page<DiagnosticCategoryInner> call(ServiceResponse<Page<DiagnosticCategoryInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DiagnosticCategoryInner>> listSiteDiagnosticCategoriesAsync(final String resourceGroupName, final String siteName) {
return listSiteDiagnosticCategoriesWithServiceResponseAsync(resourceGroupName, siteName)
.map(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Page<DiagnosticCategoryInner>>() {
@Override
public Page<DiagnosticCategoryInner> call(ServiceResponse<Page<DiagnosticCategoryInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
"listSiteDiagnosticCategoriesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
")",
"{",
"return",
"listSiteDiagnosticCategoriesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"siteName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
",",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"DiagnosticCategoryInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get Diagnostics Categories.
Get Diagnostics Categories.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DiagnosticCategoryInner> object | [
"Get",
"Diagnostics",
"Categories",
".",
"Get",
"Diagnostics",
"Categories",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L212-L220 |
Subsets and Splits