repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java | AbstractTreeMap.subMap | public SortedMap subMap(Object startKey, Object endKey) {
"""
Answers a SortedMap of the specified portion of this TreeMap which
contains keys greater or equal to the start key but less than the end
key. The returned SortedMap is backed by this TreeMap so changes to one
are reflected by the other.
@param sta... | java | public SortedMap subMap(Object startKey, Object endKey) {
if (comparator == null) {
if (((Comparable) startKey).compareTo(endKey) <= 0)
return makeSubMap(startKey, endKey);
} else {
if (comparator.compare(startKey, endKey) <= 0)
return makeSubMap(s... | [
"public",
"SortedMap",
"subMap",
"(",
"Object",
"startKey",
",",
"Object",
"endKey",
")",
"{",
"if",
"(",
"comparator",
"==",
"null",
")",
"{",
"if",
"(",
"(",
"(",
"Comparable",
")",
"startKey",
")",
".",
"compareTo",
"(",
"endKey",
")",
"<=",
"0",
... | Answers a SortedMap of the specified portion of this TreeMap which
contains keys greater or equal to the start key but less than the end
key. The returned SortedMap is backed by this TreeMap so changes to one
are reflected by the other.
@param startKey the start key
@param endKey the end key
@return a submap where th... | [
"Answers",
"a",
"SortedMap",
"of",
"the",
"specified",
"portion",
"of",
"this",
"TreeMap",
"which",
"contains",
"keys",
"greater",
"or",
"equal",
"to",
"the",
"start",
"key",
"but",
"less",
"than",
"the",
"end",
"key",
".",
"The",
"returned",
"SortedMap",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1103-L1112 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.gte | public SDVariable gte(SDVariable x, SDVariable y) {
"""
Greater than or equal to operation: elementwise x >= y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with v... | java | public SDVariable gte(SDVariable x, SDVariable y) {
return gte(null, x, y);
} | [
"public",
"SDVariable",
"gte",
"(",
"SDVariable",
"x",
",",
"SDVariable",
"y",
")",
"{",
"return",
"gte",
"(",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Greater than or equal to operation: elementwise x >= y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@pa... | [
"Greater",
"than",
"or",
"equal",
"to",
"operation",
":",
"elementwise",
"x",
">",
"=",
"y<br",
">",
"If",
"x",
"and",
"y",
"arrays",
"have",
"equal",
"shape",
"the",
"output",
"shape",
"is",
"the",
"same",
"as",
"these",
"inputs",
".",
"<br",
">",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L710-L712 |
apereo/cas | support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java | CryptoUtils.getSecurityProperties | public static Properties getSecurityProperties(final String file, final String psw) {
"""
Gets security properties.
@param file the file
@param psw the psw
@return the security properties
"""
return getSecurityProperties(file, psw, null);
} | java | public static Properties getSecurityProperties(final String file, final String psw) {
return getSecurityProperties(file, psw, null);
} | [
"public",
"static",
"Properties",
"getSecurityProperties",
"(",
"final",
"String",
"file",
",",
"final",
"String",
"psw",
")",
"{",
"return",
"getSecurityProperties",
"(",
"file",
",",
"psw",
",",
"null",
")",
";",
"}"
] | Gets security properties.
@param file the file
@param psw the psw
@return the security properties | [
"Gets",
"security",
"properties",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java#L25-L27 |
JakeWharton/ProcessPhoenix | process-phoenix/src/main/java/com/jakewharton/processphoenix/ProcessPhoenix.java | ProcessPhoenix.triggerRebirth | public static void triggerRebirth(Context context, Intent... nextIntents) {
"""
Call to restart the application process using the specified intents.
<p>
Behavior of the current process after invoking this method is undefined.
"""
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFl... | java | public static void triggerRebirth(Context context, Intent... nextIntents) {
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK); // In case we are called with non-Activity context.
intent.putParcelableArrayListExtra(KEY_RESTART_INTENTS, new ArrayList<>(Arrays.a... | [
"public",
"static",
"void",
"triggerRebirth",
"(",
"Context",
"context",
",",
"Intent",
"...",
"nextIntents",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"ProcessPhoenix",
".",
"class",
")",
";",
"intent",
".",
"addFlags",
"(",
... | Call to restart the application process using the specified intents.
<p>
Behavior of the current process after invoking this method is undefined. | [
"Call",
"to",
"restart",
"the",
"application",
"process",
"using",
"the",
"specified",
"intents",
".",
"<p",
">",
"Behavior",
"of",
"the",
"current",
"process",
"after",
"invoking",
"this",
"method",
"is",
"undefined",
"."
] | train | https://github.com/JakeWharton/ProcessPhoenix/blob/c89c622f8883812e7112e676e88ff307add4bad1/process-phoenix/src/main/java/com/jakewharton/processphoenix/ProcessPhoenix.java#L56-L65 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java | GetMaintenanceWindowExecutionTaskResult.setTaskParameters | public void setTaskParameters(java.util.Collection<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> taskParameters) {
"""
<p>
The parameters passed to the task when it was run.
</p>
<note>
<p>
<code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it... | java | public void setTaskParameters(java.util.Collection<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> taskParameters) {
if (taskParameters == null) {
this.taskParameters = null;
return;
}
this.taskParameters = new com.amazonaws.internal.SdkInternalList... | [
"public",
"void",
"setTaskParameters",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"MaintenanceWindowTaskParameterValueExpression",
">",
">",
"taskParameters",
")",
"{",
"if",
"(",
"taskParameters",
"=="... | <p>
The parameters passed to the task when it was run.
</p>
<note>
<p>
<code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it runs, instead
use the <code>Parameters</code> option in the <code>TaskInvocationParameters</code> structure. For information
about how Systems Manager h... | [
"<p",
">",
"The",
"parameters",
"passed",
"to",
"the",
"task",
"when",
"it",
"was",
"run",
".",
"<",
"/",
"p",
">",
"<note",
">",
"<p",
">",
"<code",
">",
"TaskParameters<",
"/",
"code",
">",
"has",
"been",
"deprecated",
".",
"To",
"specify",
"parame... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java#L445-L452 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.addObject | public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException {
"""
Add an object in this index
@param obj the object to add
@param requestOptions Options to pass to this request
"""
return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString... | java | public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException {
return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString(), true, false, requestOptions);
} | [
"public",
"JSONObject",
"addObject",
"(",
"JSONObject",
"obj",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"client",
".",
"postRequest",
"(",
"\"/1/indexes/\"",
"+",
"encodedIndexName",
",",
"obj",
".",
"toString",
"(",... | Add an object in this index
@param obj the object to add
@param requestOptions Options to pass to this request | [
"Add",
"an",
"object",
"in",
"this",
"index"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L83-L85 |
RestComm/jss7 | isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java | ISUPMessageImpl.encodeOptionalParameters | protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
throws ParameterException {
"""
This method must be called ONLY in case there are optional params. This implies ISUPMessage.o_Parameters.size()>1 !!!
@param parameters
@param bos
@throws Para... | java | protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
throws ParameterException {
// NOTE: parameters MUST have as last endOfOptionalParametersParameter+1
// param
for (ISUPParameter p : parameters.values()) {
if (p =... | [
"protected",
"void",
"encodeOptionalParameters",
"(",
"Map",
"<",
"Integer",
",",
"ISUPParameter",
">",
"parameters",
",",
"ByteArrayOutputStream",
"bos",
")",
"throws",
"ParameterException",
"{",
"// NOTE: parameters MUST have as last endOfOptionalParametersParameter+1",
"// p... | This method must be called ONLY in case there are optional params. This implies ISUPMessage.o_Parameters.size()>1 !!!
@param parameters
@param bos
@throws ParameterException | [
"This",
"method",
"must",
"be",
"called",
"ONLY",
"in",
"case",
"there",
"are",
"optional",
"params",
".",
"This",
"implies",
"ISUPMessage",
".",
"o_Parameters",
".",
"size",
"()",
">",
"1",
"!!!"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java#L281-L310 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolipv6_stats.java | protocolipv6_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
"""
<pre>
converts nitro response into object and returns the object array in case of get request.
</pre>
"""
protocolipv6_stats[] resources = new protocolipv6_stats[1];
protocolipv6_response result = ... | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
protocolipv6_stats[] resources = new protocolipv6_stats[1];
protocolipv6_response result = (protocolipv6_response) service.get_payload_formatter().string_to_resource(protocolipv6_response.class, response);
if(r... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"protocolipv6_stats",
"[",
"]",
"resources",
"=",
"new",
"protocolipv6_stats",
"[",
"1",
"]",
";",
"protocoli... | <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolipv6_stats.java#L550-L569 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrIndex.java | CmsSolrIndex.hasPermissions | protected boolean hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter) {
"""
Check, if the current user has permissions on the document's resource.
@param cms the context
@param doc the solr document (from the search result)
@param filter the resource filter to use for checking permissio... | java | protected boolean hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter) {
return null != (filter == null ? getResource(cms, doc) : getResource(cms, doc, filter));
} | [
"protected",
"boolean",
"hasPermissions",
"(",
"CmsObject",
"cms",
",",
"CmsSolrDocument",
"doc",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"return",
"null",
"!=",
"(",
"filter",
"==",
"null",
"?",
"getResource",
"(",
"cms",
",",
"doc",
")",
":",
"getRes... | Check, if the current user has permissions on the document's resource.
@param cms the context
@param doc the solr document (from the search result)
@param filter the resource filter to use for checking permissions
@return <code>true</code> iff the resource mirrored by the search result can be read by the current user. | [
"Check",
"if",
"the",
"current",
"user",
"has",
"permissions",
"on",
"the",
"document",
"s",
"resource",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1491-L1494 |
mike706574/java-map-support | src/main/java/fun/mike/map/alpha/Get.java | Get.populatedStringOfType | public static <T> String populatedStringOfType(Map<String, T> map, String key, String type) {
"""
Validates that the value from {@code map} for the given {@code key} is
a populated string. Returns the value when valid; otherwise, throws an
{@code IllegalArgumentException}, referring to the value as being of
typ... | java | public static <T> String populatedStringOfType(Map<String, T> map, String key, String type) {
String value = requiredStringOfType(map, key, type);
if (value.trim().equals("")) {
String message = String.format("Value \"%s\" for key \"%s\" must be populated.",
... | [
"public",
"static",
"<",
"T",
">",
"String",
"populatedStringOfType",
"(",
"Map",
"<",
"String",
",",
"T",
">",
"map",
",",
"String",
"key",
",",
"String",
"type",
")",
"{",
"String",
"value",
"=",
"requiredStringOfType",
"(",
"map",
",",
"key",
",",
"... | Validates that the value from {@code map} for the given {@code key} is
a populated string. Returns the value when valid; otherwise, throws an
{@code IllegalArgumentException}, referring to the value as being of
type{@code} type in the error message.
@param map a map
@param key a key
@param type a type label
@param <T> ... | [
"Validates",
"that",
"the",
"value",
"from",
"{"
] | train | https://github.com/mike706574/java-map-support/blob/7cb09f34c24adfaca73ad25a3c3e05abec72eafe/src/main/java/fun/mike/map/alpha/Get.java#L105-L116 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/Box.java | Box.getAbsoluteContainingBlock | public Rectangle getAbsoluteContainingBlock() {
"""
Obtains the containing block absolute bounds.
@return the containing block absolute bounds.
"""
if (cbox instanceof Viewport) //initial containing block
{
Rectangle ab = cbox.getAbsoluteBounds(); //normally positioned at 0,0; othe... | java | public Rectangle getAbsoluteContainingBlock()
{
if (cbox instanceof Viewport) //initial containing block
{
Rectangle ab = cbox.getAbsoluteBounds(); //normally positioned at 0,0; other value for nested viewports (e.g. objects)
Rectangle visible = ((Viewport) cbox).getVisibleRe... | [
"public",
"Rectangle",
"getAbsoluteContainingBlock",
"(",
")",
"{",
"if",
"(",
"cbox",
"instanceof",
"Viewport",
")",
"//initial containing block",
"{",
"Rectangle",
"ab",
"=",
"cbox",
".",
"getAbsoluteBounds",
"(",
")",
";",
"//normally positioned at 0,0; other value f... | Obtains the containing block absolute bounds.
@return the containing block absolute bounds. | [
"Obtains",
"the",
"containing",
"block",
"absolute",
"bounds",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/Box.java#L538-L548 |
google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteBlockScopedFunctionDeclaration.java | Es6RewriteBlockScopedFunctionDeclaration.visitBlockScopedFunctionDeclaration | private void visitBlockScopedFunctionDeclaration(NodeTraversal t, Node n, Node parent) {
"""
Rewrite the function declaration from:
<pre>
function f() {}
FUNCTION
NAME x
PARAM_LIST
BLOCK
</pre>
to
<pre>
let f = function() {};
LET
NAME f
FUNCTION
NAME (w/ empty string)
PARAM_LIST
BLOCK
</pre>... | java | private void visitBlockScopedFunctionDeclaration(NodeTraversal t, Node n, Node parent) {
// Prepare a spot for the function.
Node oldNameNode = n.getFirstChild();
Node fnNameNode = oldNameNode.cloneNode();
Node let = IR.declaration(fnNameNode, Token.LET).srcref(n);
NodeUtil.addFeatureToScript(t.getC... | [
"private",
"void",
"visitBlockScopedFunctionDeclaration",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"// Prepare a spot for the function.",
"Node",
"oldNameNode",
"=",
"n",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"fnNameNode",... | Rewrite the function declaration from:
<pre>
function f() {}
FUNCTION
NAME x
PARAM_LIST
BLOCK
</pre>
to
<pre>
let f = function() {};
LET
NAME f
FUNCTION
NAME (w/ empty string)
PARAM_LIST
BLOCK
</pre>
This is similar to {@link Normalize.NormalizeStatements#rewriteFunctionDeclaration} but
rewrites to "let" instead of... | [
"Rewrite",
"the",
"function",
"declaration",
"from",
":"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteBlockScopedFunctionDeclaration.java#L92-L108 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.beginConvertToManagedDisks | public OperationStatusResponseInner beginConvertToManagedDisks(String resourceGroupName, String vmName) {
"""
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param... | java | public OperationStatusResponseInner beginConvertToManagedDisks(String resourceGroupName, String vmName) {
return beginConvertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body();
} | [
"public",
"OperationStatusResponseInner",
"beginConvertToManagedDisks",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
")",
"{",
"return",
"beginConvertToManagedDisksWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
")",
".",
"toBlocking",
"(",... | Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@th... | [
"Converts",
"virtual",
"machine",
"disks",
"from",
"blob",
"-",
"based",
"to",
"managed",
"disks",
".",
"Virtual",
"machine",
"must",
"be",
"stop",
"-",
"deallocated",
"before",
"invoking",
"this",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1203-L1205 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java | MetricsConnection.connection_invalidUser | public static MetricsConnection connection_invalidUser(LibertyServer server) {
"""
Creates a connection for private (authorized) docs endpoint using HTTPS
and an invalid user ID
@param server - server to connect to
@return
"""
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
... | java | public static MetricsConnection connection_invalidUser(LibertyServer server) {
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
.header("Authorization",
"Basic " + Base64Coder.base64Encode(INVALID_USER_USERNAME + ":" + INVALID_USER_PASSW... | [
"public",
"static",
"MetricsConnection",
"connection_invalidUser",
"(",
"LibertyServer",
"server",
")",
"{",
"return",
"new",
"MetricsConnection",
"(",
"server",
",",
"METRICS_ENDPOINT",
")",
".",
"secure",
"(",
"true",
")",
".",
"header",
"(",
"\"Authorization\"",
... | Creates a connection for private (authorized) docs endpoint using HTTPS
and an invalid user ID
@param server - server to connect to
@return | [
"Creates",
"a",
"connection",
"for",
"private",
"(",
"authorized",
")",
"docs",
"endpoint",
"using",
"HTTPS",
"and",
"an",
"invalid",
"user",
"ID"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java#L241-L245 |
lesaint/damapping | core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java | Preconditions.checkNotNull | @Nonnull
public static <T> T checkNotNull(@Nullable T obj) {
"""
Throws a NullPointerException with a generic message if the specified object is {@code null}, otherwise
returns it.
@param obj an object of any type or {@code null}
@param <T> any type
@return the argument
"""
return checkNotNull(ob... | java | @Nonnull
public static <T> T checkNotNull(@Nullable T obj) {
return checkNotNull(obj, NPE_DEFAULT_MSG);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"@",
"Nullable",
"T",
"obj",
")",
"{",
"return",
"checkNotNull",
"(",
"obj",
",",
"NPE_DEFAULT_MSG",
")",
";",
"}"
] | Throws a NullPointerException with a generic message if the specified object is {@code null}, otherwise
returns it.
@param obj an object of any type or {@code null}
@param <T> any type
@return the argument | [
"Throws",
"a",
"NullPointerException",
"with",
"a",
"generic",
"message",
"if",
"the",
"specified",
"object",
"is",
"{",
"@code",
"null",
"}",
"otherwise",
"returns",
"it",
"."
] | train | https://github.com/lesaint/damapping/blob/357afa5866939fd2a18c09213975ffef4836f328/core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java#L44-L47 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java | PredicateUtils.createCompareCondition | public static Optional<Condition> createCompareCondition(final PredicateCompareRightValue compareRightValue, final Column column) {
"""
Create condition of compare operator.
@param compareRightValue right value of compare operator
@param column column
@return condition
"""
return compareRightValue... | java | public static Optional<Condition> createCompareCondition(final PredicateCompareRightValue compareRightValue, final Column column) {
return compareRightValue.getExpression() instanceof SimpleExpressionSegment
? Optional.of(new Condition(column, ((SimpleExpressionSegment) compareRightValue.getExpr... | [
"public",
"static",
"Optional",
"<",
"Condition",
">",
"createCompareCondition",
"(",
"final",
"PredicateCompareRightValue",
"compareRightValue",
",",
"final",
"Column",
"column",
")",
"{",
"return",
"compareRightValue",
".",
"getExpression",
"(",
")",
"instanceof",
"... | Create condition of compare operator.
@param compareRightValue right value of compare operator
@param column column
@return condition | [
"Create",
"condition",
"of",
"compare",
"operator",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java#L100-L103 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java | AbstractExecutableMemberWriter.getTypeParameters | protected Content getTypeParameters(ExecutableElement member) {
"""
Get the type parameters for the executable member.
@param member the member for which to get the type parameters.
@return the type parameters.
"""
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);... | java | protected Content getTypeParameters(ExecutableElement member) {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);
return writer.getTypeParameterLinks(linkInfo);
} | [
"protected",
"Content",
"getTypeParameters",
"(",
"ExecutableElement",
"member",
")",
"{",
"LinkInfoImpl",
"linkInfo",
"=",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"MEMBER_TYPE_PARAMS",
",",
"member",
")",
";",
"return",
"writer",
".",
"getTypeParameterLinks... | Get the type parameters for the executable member.
@param member the member for which to get the type parameters.
@return the type parameters. | [
"Get",
"the",
"type",
"parameters",
"for",
"the",
"executable",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L91-L94 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.toEncodedString | @GwtIncompatible("incompatible method")
public static String toEncodedString(final byte[] bytes, final Charset charset) {
"""
Converts a <code>byte[]</code> to a String using the specified character encoding.
@param bytes
the byte array to read from
@param charset
the encoding to use, if null then use th... | java | @GwtIncompatible("incompatible method")
public static String toEncodedString(final byte[] bytes, final Charset charset) {
return new String(bytes, charset != null ? charset : Charset.defaultCharset());
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"String",
"toEncodedString",
"(",
"final",
"byte",
"[",
"]",
"bytes",
",",
"final",
"Charset",
"charset",
")",
"{",
"return",
"new",
"String",
"(",
"bytes",
",",
"charset",
"!=",
... | Converts a <code>byte[]</code> to a String using the specified character encoding.
@param bytes
the byte array to read from
@param charset
the encoding to use, if null then use the platform default
@return a new String
@throws NullPointerException
if {@code bytes} is null
@since 3.2
@since 3.3 No longer throws {@link ... | [
"Converts",
"a",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
"to",
"a",
"String",
"using",
"the",
"specified",
"character",
"encoding",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8991-L8994 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-context/src/main/java/org/xwiki/context/internal/ExecutionContextProperty.java | ExecutionContextProperty.checkValue | private void checkValue(Object value) {
"""
Check that the value is compatible with the configure constraints.
@param value The value.
@throws IllegalArgumentException if the value is null and this property has the nonNull attribute set, or if the
type is set for this value, but the value is not assignable to... | java | private void checkValue(Object value)
{
if (this.nonNull && value == null) {
throw new IllegalArgumentException(String.format("The property [%s] may not be null!", getKey()));
}
if (getType() != null && value != null && !getType().isAssignableFrom(value.getClass())) {
... | [
"private",
"void",
"checkValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"this",
".",
"nonNull",
"&&",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"The property [%s] may not be null!\"",
... | Check that the value is compatible with the configure constraints.
@param value The value.
@throws IllegalArgumentException if the value is null and this property has the nonNull attribute set, or if the
type is set for this value, but the value is not assignable to the set type. | [
"Check",
"that",
"the",
"value",
"is",
"compatible",
"with",
"the",
"configure",
"constraints",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-context/src/main/java/org/xwiki/context/internal/ExecutionContextProperty.java#L96-L106 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseUnsignedIntObj | @Nullable
public static Long parseUnsignedIntObj (@Nullable final String sStr, @Nullable final Long aDefault) {
"""
Parse the given {@link String} as unsigned {@link Integer} with radix
{@link #DEFAULT_RADIX}.
@param sStr
The string to parse. May be <code>null</code>.
@param aDefault
The default value to ... | java | @Nullable
public static Long parseUnsignedIntObj (@Nullable final String sStr, @Nullable final Long aDefault)
{
return parseUnsignedIntObj (sStr, DEFAULT_RADIX, aDefault);
} | [
"@",
"Nullable",
"public",
"static",
"Long",
"parseUnsignedIntObj",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"Long",
"aDefault",
")",
"{",
"return",
"parseUnsignedIntObj",
"(",
"sStr",
",",
"DEFAULT_RADIX",
",",
"aDefault",... | Parse the given {@link String} as unsigned {@link Integer} with radix
{@link #DEFAULT_RADIX}.
@param sStr
The string to parse. May be <code>null</code>.
@param aDefault
The default value to be returned if the passed string could not be
converted to a valid value. May be <code>null</code>.
@return <code>aDefault</code>... | [
"Parse",
"the",
"given",
"{",
"@link",
"String",
"}",
"as",
"unsigned",
"{",
"@link",
"Integer",
"}",
"with",
"radix",
"{",
"@link",
"#DEFAULT_RADIX",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L929-L933 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java | ContentPackage.addFile | public void addFile(String path, InputStream inputStream) throws IOException {
"""
Adds a binary file.
@param path Full content path and file name of file
@param inputStream Input stream with binary dta
@throws IOException I/O exception
"""
addFile(path, inputStream, null);
} | java | public void addFile(String path, InputStream inputStream) throws IOException {
addFile(path, inputStream, null);
} | [
"public",
"void",
"addFile",
"(",
"String",
"path",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"addFile",
"(",
"path",
",",
"inputStream",
",",
"null",
")",
";",
"}"
] | Adds a binary file.
@param path Full content path and file name of file
@param inputStream Input stream with binary dta
@throws IOException I/O exception | [
"Adds",
"a",
"binary",
"file",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L177-L179 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/Transition.java | Transition.excludeChildren | @NonNull
public Transition excludeChildren(int targetId, boolean exclude) {
"""
Whether to add the children of the given id to the list of targets to exclude
from this transition. The <code>exclude</code> parameter specifies whether
the children of the target should be added to or removed from the excluded l... | java | @NonNull
public Transition excludeChildren(int targetId, boolean exclude) {
if (targetId >= 0) {
mTargetIdChildExcludes = excludeObject(mTargetIdChildExcludes, targetId, exclude);
}
return this;
} | [
"@",
"NonNull",
"public",
"Transition",
"excludeChildren",
"(",
"int",
"targetId",
",",
"boolean",
"exclude",
")",
"{",
"if",
"(",
"targetId",
">=",
"0",
")",
"{",
"mTargetIdChildExcludes",
"=",
"excludeObject",
"(",
"mTargetIdChildExcludes",
",",
"targetId",
",... | Whether to add the children of the given id to the list of targets to exclude
from this transition. The <code>exclude</code> parameter specifies whether
the children of the target should be added to or removed from the excluded list.
Excluding children in this way provides a simple mechanism for excluding all
children ... | [
"Whether",
"to",
"add",
"the",
"children",
"of",
"the",
"given",
"id",
"to",
"the",
"list",
"of",
"targets",
"to",
"exclude",
"from",
"this",
"transition",
".",
"The",
"<code",
">",
"exclude<",
"/",
"code",
">",
"parameter",
"specifies",
"whether",
"the",
... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Transition.java#L1197-L1203 |
vincentk/joptimizer | src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java | SDPLogarithmicBarrier.calculatePhase1InitialFeasiblePoint | @Override
public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance) {
"""
Calculates the initial value for the s parameter in Phase I.
Return s so that F(x)-s.I is negative definite
@see "S.Boyd and L.Vandenberghe, Convex Optimization, 11.6.2"
@see "S.Boyd and L.Va... | java | @Override
public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){
RealMatrix F = this.buildS(originalNotFeasiblePoint).scalarMultiply(-1);
RealMatrix S = F.scalarMultiply(-1);
try{
new CholeskyDecomposition(S);
//already feasible
return -1;
}catc... | [
"@",
"Override",
"public",
"double",
"calculatePhase1InitialFeasiblePoint",
"(",
"double",
"[",
"]",
"originalNotFeasiblePoint",
",",
"double",
"tolerance",
")",
"{",
"RealMatrix",
"F",
"=",
"this",
".",
"buildS",
"(",
"originalNotFeasiblePoint",
")",
".",
"scalarMu... | Calculates the initial value for the s parameter in Phase I.
Return s so that F(x)-s.I is negative definite
@see "S.Boyd and L.Vandenberghe, Convex Optimization, 11.6.2"
@see "S.Boyd and L.Vandenberghe, Semidefinite programming, 6.1" | [
"Calculates",
"the",
"initial",
"value",
"for",
"the",
"s",
"parameter",
"in",
"Phase",
"I",
".",
"Return",
"s",
"so",
"that",
"F",
"(",
"x",
")",
"-",
"s",
".",
"I",
"is",
"negative",
"definite"
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java#L145-L160 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java | AbstractMemberWriter.getSummaryTableTree | public Content getSummaryTableTree(TypeElement tElement, List<Content> tableContents) {
"""
Get the summary table tree for the given class.
@param tElement the class for which the summary table is generated
@param tableContents list of contents to be displayed in the summary table
@return a content tree for t... | java | public Content getSummaryTableTree(TypeElement tElement, List<Content> tableContents) {
return writer.getSummaryTableTree(this, tElement, tableContents, showTabs());
} | [
"public",
"Content",
"getSummaryTableTree",
"(",
"TypeElement",
"tElement",
",",
"List",
"<",
"Content",
">",
"tableContents",
")",
"{",
"return",
"writer",
".",
"getSummaryTableTree",
"(",
"this",
",",
"tElement",
",",
"tableContents",
",",
"showTabs",
"(",
")"... | Get the summary table tree for the given class.
@param tElement the class for which the summary table is generated
@param tableContents list of contents to be displayed in the summary table
@return a content tree for the summary table | [
"Get",
"the",
"summary",
"table",
"tree",
"for",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L637-L639 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java | ClusterSampling.randomSampling | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
"""
Samples m clusters by using Cluster Sampling
@param clusterIdList
@param sampleM
@return
"""
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selec... | java | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selectedClusters = clusterIdList.keySet().toArray();
PHPMethods.<Object>shuffle(selectedClusters);
... | [
"public",
"static",
"TransposeDataCollection",
"randomSampling",
"(",
"TransposeDataList",
"clusterIdList",
",",
"int",
"sampleM",
")",
"{",
"TransposeDataCollection",
"sampledIds",
"=",
"new",
"TransposeDataCollection",
"(",
")",
";",
"Object",
"[",
"]",
"selectedClust... | Samples m clusters by using Cluster Sampling
@param clusterIdList
@param sampleM
@return | [
"Samples",
"m",
"clusters",
"by",
"using",
"Cluster",
"Sampling"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java#L59-L72 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/RepeatableReadStrategy.java | RepeatableReadStrategy.releaseLock | public boolean releaseLock(TransactionImpl tx, Object obj) {
"""
release a lock on Object obj for Transaction tx.
@param tx the transaction releasing the lock
@param obj the Object to be unlocked
@return true if successful, else false
"""
LockEntry writer = getWriter(obj);
if (writer != nu... | java | public boolean releaseLock(TransactionImpl tx, Object obj)
{
LockEntry writer = getWriter(obj);
if (writer != null && writer.isOwnedBy(tx))
{
removeWriter(writer);
return true;
}
if (hasReadLock(tx, obj))
{
removeReader(tx... | [
"public",
"boolean",
"releaseLock",
"(",
"TransactionImpl",
"tx",
",",
"Object",
"obj",
")",
"{",
"LockEntry",
"writer",
"=",
"getWriter",
"(",
"obj",
")",
";",
"if",
"(",
"writer",
"!=",
"null",
"&&",
"writer",
".",
"isOwnedBy",
"(",
"tx",
")",
")",
"... | release a lock on Object obj for Transaction tx.
@param tx the transaction releasing the lock
@param obj the Object to be unlocked
@return true if successful, else false | [
"release",
"a",
"lock",
"on",
"Object",
"obj",
"for",
"Transaction",
"tx",
".",
"@param",
"tx",
"the",
"transaction",
"releasing",
"the",
"lock",
"@param",
"obj",
"the",
"Object",
"to",
"be",
"unlocked",
"@return",
"true",
"if",
"successful",
"else",
"false"... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RepeatableReadStrategy.java#L144-L158 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbUtils.java | RocksDbUtils.getColumnFamilyList | public static String[] getColumnFamilyList(String path) throws RocksDBException {
"""
Gets all available column family names from a RocksDb data directory.
@param path
@return
@throws RocksDBException
"""
List<byte[]> cfList = RocksDB.listColumnFamilies(new Options(), path);
if (cfList == ... | java | public static String[] getColumnFamilyList(String path) throws RocksDBException {
List<byte[]> cfList = RocksDB.listColumnFamilies(new Options(), path);
if (cfList == null || cfList.size() == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> result = new ArrayList<>(c... | [
"public",
"static",
"String",
"[",
"]",
"getColumnFamilyList",
"(",
"String",
"path",
")",
"throws",
"RocksDBException",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"cfList",
"=",
"RocksDB",
".",
"listColumnFamilies",
"(",
"new",
"Options",
"(",
")",
",",
"pa... | Gets all available column family names from a RocksDb data directory.
@param path
@return
@throws RocksDBException | [
"Gets",
"all",
"available",
"column",
"family",
"names",
"from",
"a",
"RocksDb",
"data",
"directory",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbUtils.java#L181-L191 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glAttachShader | public static void glAttachShader(int programID, int shaderID) {
"""
<p>{@code glAttachShader} attaches the shader object specified by {@code shaderID} to the program object
specified by {@code programID}. This indicates that shader will be included in link operations that will be
performed on program.</p>
<p... | java | public static void glAttachShader(int programID, int shaderID)
{
checkContextCompatibility();
JavaScriptObject program = WebGLObjectMap.get().toProgram(programID);
JavaScriptObject shader = WebGLObjectMap.get().toShader(shaderID);
nglAttachShader(program, shader);
} | [
"public",
"static",
"void",
"glAttachShader",
"(",
"int",
"programID",
",",
"int",
"shaderID",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"JavaScriptObject",
"program",
"=",
"WebGLObjectMap",
".",
"get",
"(",
")",
".",
"toProgram",
"(",
"programID",
... | <p>{@code glAttachShader} attaches the shader object specified by {@code shaderID} to the program object
specified by {@code programID}. This indicates that shader will be included in link operations that will be
performed on program.</p>
<p>{@link #GL_INVALID_VALUE} is generated if either program or shader is not a v... | [
"<p",
">",
"{",
"@code",
"glAttachShader",
"}",
"attaches",
"the",
"shader",
"object",
"specified",
"by",
"{",
"@code",
"shaderID",
"}",
"to",
"the",
"program",
"object",
"specified",
"by",
"{",
"@code",
"programID",
"}",
".",
"This",
"indicates",
"that",
... | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L524-L532 |
glyptodon/guacamole-client | guacamole/src/main/java/org/apache/guacamole/extension/ExtensionClassLoader.java | ExtensionClassLoader.getInstance | public static ExtensionClassLoader getInstance(final File extension,
final ClassLoader parent) throws GuacamoleException {
"""
Returns an instance of ExtensionClassLoader configured to load classes
from the given extension .jar. If a necessary class cannot be found
within the .jar, the given parent C... | java | public static ExtensionClassLoader getInstance(final File extension,
final ClassLoader parent) throws GuacamoleException {
try {
// Attempt to create classloader which loads classes from the given
// .jar file
return AccessController.doPrivileged(new PrivilegedEx... | [
"public",
"static",
"ExtensionClassLoader",
"getInstance",
"(",
"final",
"File",
"extension",
",",
"final",
"ClassLoader",
"parent",
")",
"throws",
"GuacamoleException",
"{",
"try",
"{",
"// Attempt to create classloader which loads classes from the given",
"// .jar file",
"r... | Returns an instance of ExtensionClassLoader configured to load classes
from the given extension .jar. If a necessary class cannot be found
within the .jar, the given parent ClassLoader is used. Calling this
function multiple times will not affect previously-returned instances of
ExtensionClassLoader.
@param extension
... | [
"Returns",
"an",
"instance",
"of",
"ExtensionClassLoader",
"configured",
"to",
"load",
"classes",
"from",
"the",
"given",
"extension",
".",
"jar",
".",
"If",
"a",
"necessary",
"class",
"cannot",
"be",
"found",
"within",
"the",
".",
"jar",
"the",
"given",
"pa... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionClassLoader.java#L69-L89 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java | LocaleUtils.getAvailableLocaleSuffixesForBundle | public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, String fileSuffix,
ServletContext servletContext) {
"""
Returns the list of available locale suffixes for a message resource
bundle
@param messageBundlePath
the resource bundle path
@param fileSuffix
the file suffix
... | java | public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, String fileSuffix,
ServletContext servletContext) {
int idxNameSpace = messageBundlePath.indexOf("(");
int idxFilter = messageBundlePath.indexOf("[");
int idx = -1;
if (idxNameSpace != -1 && idxFilter != -1) {
idx = ... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAvailableLocaleSuffixesForBundle",
"(",
"String",
"messageBundlePath",
",",
"String",
"fileSuffix",
",",
"ServletContext",
"servletContext",
")",
"{",
"int",
"idxNameSpace",
"=",
"messageBundlePath",
".",
"indexOf",
... | Returns the list of available locale suffixes for a message resource
bundle
@param messageBundlePath
the resource bundle path
@param fileSuffix
the file suffix
@param servletContext
the servlet context
@return the list of available locale suffixes for a message resource
bundle | [
"Returns",
"the",
"list",
"of",
"available",
"locale",
"suffixes",
"for",
"a",
"message",
"resource",
"bundle"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L146-L167 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/tree/AccountItemTree.java | AccountItemTree.mergeWithProposedItems | public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
"""
Rebuild the new tree by merging current on-disk existing view with new proposed list.
@param proposedItems list of proposed item that should be merged with current existing view
"""
build();
for (SubscriptionIte... | java | public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
build();
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.flatten(true);
}
for (InvoiceItem item : proposedItems) {
final UUID subscriptionId = getSubscriptionId(it... | [
"public",
"void",
"mergeWithProposedItems",
"(",
"final",
"List",
"<",
"InvoiceItem",
">",
"proposedItems",
")",
"{",
"build",
"(",
")",
";",
"for",
"(",
"SubscriptionItemTree",
"tree",
":",
"subscriptionItemTree",
".",
"values",
"(",
")",
")",
"{",
"tree",
... | Rebuild the new tree by merging current on-disk existing view with new proposed list.
@param proposedItems list of proposed item that should be merged with current existing view | [
"Rebuild",
"the",
"new",
"tree",
"by",
"merging",
"current",
"on",
"-",
"disk",
"existing",
"view",
"with",
"new",
"proposed",
"list",
"."
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/AccountItemTree.java#L154-L174 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java | JoblogUtil.logRawMsgToJobLogAndTraceOnly | @Trivial
public static void logRawMsgToJobLogAndTraceOnly(Level level, String msg, Logger traceLogger) {
"""
logs the message to joblog and trace.
If Level > FINE, this method will reduce the level to FINE while logging to trace.log
to prevent the message to be logged in console.log and messages.log file
J... | java | @Trivial
public static void logRawMsgToJobLogAndTraceOnly(Level level, String msg, Logger traceLogger){
if(level.intValue() > Level.FINE.intValue()){
traceLogger.log(Level.FINE, msg);
logToJoblogIfNotTraceLoggable(Level.FINE, msg, traceLogger);
}
else{
traceLogger.log(level, msg);
logToJoblogIfNotTra... | [
"@",
"Trivial",
"public",
"static",
"void",
"logRawMsgToJobLogAndTraceOnly",
"(",
"Level",
"level",
",",
"String",
"msg",
",",
"Logger",
"traceLogger",
")",
"{",
"if",
"(",
"level",
".",
"intValue",
"(",
")",
">",
"Level",
".",
"FINE",
".",
"intValue",
"("... | logs the message to joblog and trace.
If Level > FINE, this method will reduce the level to FINE while logging to trace.log
to prevent the message to be logged in console.log and messages.log file
Joblog messages will be logged as per supplied logging level
Use this method when you don't want a very verbose stack in... | [
"logs",
"the",
"message",
"to",
"joblog",
"and",
"trace",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java#L72-L83 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java | Messages.getStringFromBundle | public static String getStringFromBundle(String resourceBundleName, String msgKey, Locale tmpLocale, String rawMessage) {
"""
Retrieve a string from the bundle
@param resourceBundleName
the package-qualified name of the ResourceBundle. Must NOT be
null
@param msgKey
the key to lookup in the bundle, if null ... | java | public static String getStringFromBundle(String resourceBundleName, String msgKey, Locale tmpLocale, String rawMessage) {
return getStringFromBundle(null, resourceBundleName, msgKey, tmpLocale, rawMessage);
} | [
"public",
"static",
"String",
"getStringFromBundle",
"(",
"String",
"resourceBundleName",
",",
"String",
"msgKey",
",",
"Locale",
"tmpLocale",
",",
"String",
"rawMessage",
")",
"{",
"return",
"getStringFromBundle",
"(",
"null",
",",
"resourceBundleName",
",",
"msgKe... | Retrieve a string from the bundle
@param resourceBundleName
the package-qualified name of the ResourceBundle. Must NOT be
null
@param msgKey
the key to lookup in the bundle, if null rawMessage will be
returned
@param tmpLocale
Locale to use for the bundle, can be null
@param rawMessage
The default message to use if th... | [
"Retrieve",
"a",
"string",
"from",
"the",
"bundle"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java#L80-L82 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java | MicroWriter.writeToWriter | @Nonnull
public static ESuccess writeToWriter (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final Writer aWriter) {
"""
Write a Micro Node to a {@link Writer} using the default
{@link XMLWriterSettings#DEFAULT_XML_SETTINGS}.
@param aNode
The node to be serialized. May be any kind of node (incl.
doc... | java | @Nonnull
public static ESuccess writeToWriter (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final Writer aWriter)
{
return writeToWriter (aNode, aWriter, XMLWriterSettings.DEFAULT_XML_SETTINGS);
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"writeToWriter",
"(",
"@",
"Nonnull",
"final",
"IMicroNode",
"aNode",
",",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"Writer",
"aWriter",
")",
"{",
"return",
"writeToWriter",
"(",
"aNode",
",",
"aWriter",
",",
... | Write a Micro Node to a {@link Writer} using the default
{@link XMLWriterSettings#DEFAULT_XML_SETTINGS}.
@param aNode
The node to be serialized. May be any kind of node (incl.
documents). May not be <code>null</code>.
@param aWriter
The writer to write to. May not be <code>null</code>. The writer is
closed anyway dire... | [
"Write",
"a",
"Micro",
"Node",
"to",
"a",
"{",
"@link",
"Writer",
"}",
"using",
"the",
"default",
"{",
"@link",
"XMLWriterSettings#DEFAULT_XML_SETTINGS",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L247-L251 |
knowm/Sundial | src/main/java/org/knowm/sundial/SundialJobScheduler.java | SundialJobScheduler.stopJob | public static void stopJob(String jobName, String key, String pValue)
throws SundialSchedulerException {
"""
Triggers a Job interrupt on all Jobs matching the given Job Name, key and (String) value.
Doesn't work if the value is not a String. The Job termination mechanism works by setting a
flag that the J... | java | public static void stopJob(String jobName, String key, String pValue)
throws SundialSchedulerException {
logger.debug("key= " + key);
logger.debug("value= " + pValue);
try {
List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs();
for (JobExecu... | [
"public",
"static",
"void",
"stopJob",
"(",
"String",
"jobName",
",",
"String",
"key",
",",
"String",
"pValue",
")",
"throws",
"SundialSchedulerException",
"{",
"logger",
".",
"debug",
"(",
"\"key= \"",
"+",
"key",
")",
";",
"logger",
".",
"debug",
"(",
"\... | Triggers a Job interrupt on all Jobs matching the given Job Name, key and (String) value.
Doesn't work if the value is not a String. The Job termination mechanism works by setting a
flag that the Job should be terminated, but it is up to the logic in the Job to decide at what
point termination should occur. Therefore, ... | [
"Triggers",
"a",
"Job",
"interrupt",
"on",
"all",
"Jobs",
"matching",
"the",
"given",
"Job",
"Name",
"key",
"and",
"(",
"String",
")",
"value",
".",
"Doesn",
"t",
"work",
"if",
"the",
"value",
"is",
"not",
"a",
"String",
".",
"The",
"Job",
"termination... | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L358-L384 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L4 | public static Point2d WSG84_L4(double lambda, double phi) {
"""
This function convert WSG84 GPS coordinate to France Lambert IV coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert IV coordinates.
"""
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
ret... | java | public static Point2d WSG84_L4(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_4_N,
LAMBERT_4_C,
LAMBERT_4_XS,
LAMBERT_4_YS);
} | [
"public",
"static",
"Point2d",
"WSG84_L4",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLambdaPhi",
".",
... | This function convert WSG84 GPS coordinate to France Lambert IV coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert IV coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"IV",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1115-L1123 |
dbracewell/hermes | hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java | WordNet.getSenses | public List<Sense> getSenses(String surfaceForm, Language language) {
"""
Gets senses.
@param surfaceForm the surface form
@param language the language
@return the senses
"""
return getSenses(surfaceForm, POS.ANY, language);
} | java | public List<Sense> getSenses(String surfaceForm, Language language) {
return getSenses(surfaceForm, POS.ANY, language);
} | [
"public",
"List",
"<",
"Sense",
">",
"getSenses",
"(",
"String",
"surfaceForm",
",",
"Language",
"language",
")",
"{",
"return",
"getSenses",
"(",
"surfaceForm",
",",
"POS",
".",
"ANY",
",",
"language",
")",
";",
"}"
] | Gets senses.
@param surfaceForm the surface form
@param language the language
@return the senses | [
"Gets",
"senses",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java#L492-L494 |
fedups/com.obdobion.argument | src/main/java/com/obdobion/argument/variables/VariableAssigner.java | VariableAssigner.findFieldInAnyParentOrMyself | static public Field findFieldInAnyParentOrMyself(
final ICmdLineArg<?> arg,
final Class<?> targetClass,
final String errMsg)
throws ParseException {
"""
<p>
findFieldInAnyParentOrMyself.
</p>
@param arg a {@link com.obdobion.argument.type.ICmdLineArg} ob... | java | static public Field findFieldInAnyParentOrMyself(
final ICmdLineArg<?> arg,
final Class<?> targetClass,
final String errMsg)
throws ParseException
{
Field field = null;
try
{
field = targetClass.getDeclaredField(arg.getVaria... | [
"static",
"public",
"Field",
"findFieldInAnyParentOrMyself",
"(",
"final",
"ICmdLineArg",
"<",
"?",
">",
"arg",
",",
"final",
"Class",
"<",
"?",
">",
"targetClass",
",",
"final",
"String",
"errMsg",
")",
"throws",
"ParseException",
"{",
"Field",
"field",
"=",
... | <p>
findFieldInAnyParentOrMyself.
</p>
@param arg a {@link com.obdobion.argument.type.ICmdLineArg} object.
@param targetClass a {@link java.lang.Class} object.
@param errMsg a {@link java.lang.String} object.
@return a {@link java.lang.reflect.Field} object.
@throws java.text.ParseException if any. | [
"<p",
">",
"findFieldInAnyParentOrMyself",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/fedups/com.obdobion.argument/blob/9679aebbeedaef4e592227842fa0e91410708a67/src/main/java/com/obdobion/argument/variables/VariableAssigner.java#L291-L314 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java | NonFunctionalField.visitClassContext | @Override
public void visitClassContext(ClassContext classContext) {
"""
checks to see if the class is Serializable, then looks for fields that are both final and transient
@param classContext
the context object of the currently parsed class
"""
try {
JavaClass cls = classContext.ge... | java | @Override
public void visitClassContext(ClassContext classContext) {
try {
JavaClass cls = classContext.getJavaClass();
if ((serializableClass != null) && (cls.implementationOf(serializableClass))) {
Field[] fields = cls.getFields();
setupVisitorForCla... | [
"@",
"Override",
"public",
"void",
"visitClassContext",
"(",
"ClassContext",
"classContext",
")",
"{",
"try",
"{",
"JavaClass",
"cls",
"=",
"classContext",
".",
"getJavaClass",
"(",
")",
";",
"if",
"(",
"(",
"serializableClass",
"!=",
"null",
")",
"&&",
"(",... | checks to see if the class is Serializable, then looks for fields that are both final and transient
@param classContext
the context object of the currently parsed class | [
"checks",
"to",
"see",
"if",
"the",
"class",
"is",
"Serializable",
"then",
"looks",
"for",
"fields",
"that",
"are",
"both",
"final",
"and",
"transient"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java#L65-L82 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getDeployLogs | public Collection<SingularityS3Log> getDeployLogs(String requestId, String deployId) {
"""
Retrieve the list of logs stored in S3 for a specific deploy if a singularity request
@param requestId
The request ID to search for
@param deployId
The deploy ID (within the specified request) to search for
@return
... | java | public Collection<SingularityS3Log> getDeployLogs(String requestId, String deployId) {
final Function<String, String> requestUri = (host) -> String.format(S3_LOG_GET_DEPLOY_LOGS, getApiBase(host), requestId, deployId);
final String type = String.format("S3 logs for deploy %s of request %s", deployId, requestId... | [
"public",
"Collection",
"<",
"SingularityS3Log",
">",
"getDeployLogs",
"(",
"String",
"requestId",
",",
"String",
"deployId",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"f... | Retrieve the list of logs stored in S3 for a specific deploy if a singularity request
@param requestId
The request ID to search for
@param deployId
The deploy ID (within the specified request) to search for
@return
A collection of {@link SingularityS3Log} | [
"Retrieve",
"the",
"list",
"of",
"logs",
"stored",
"in",
"S3",
"for",
"a",
"specific",
"deploy",
"if",
"a",
"singularity",
"request"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1374-L1380 |
apereo/cas | support/cas-server-support-consent-webflow/src/main/java/org/apereo/cas/web/flow/CheckConsentRequiredAction.java | CheckConsentRequiredAction.determineConsentEvent | protected String determineConsentEvent(final RequestContext requestContext) {
"""
Determine consent event string.
@param requestContext the request context
@return the string
"""
val webService = WebUtils.getService(requestContext);
val service = this.authenticationRequestServiceSelectionSt... | java | protected String determineConsentEvent(final RequestContext requestContext) {
val webService = WebUtils.getService(requestContext);
val service = this.authenticationRequestServiceSelectionStrategies.resolveService(webService);
if (service == null) {
return null;
}
va... | [
"protected",
"String",
"determineConsentEvent",
"(",
"final",
"RequestContext",
"requestContext",
")",
"{",
"val",
"webService",
"=",
"WebUtils",
".",
"getService",
"(",
"requestContext",
")",
";",
"val",
"service",
"=",
"this",
".",
"authenticationRequestServiceSelec... | Determine consent event string.
@param requestContext the request context
@return the string | [
"Determine",
"consent",
"event",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-consent-webflow/src/main/java/org/apereo/cas/web/flow/CheckConsentRequiredAction.java#L53-L68 |
facebookarchive/swift | swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java | ThriftCodecByteCodeGenerator.defineWriteBridgeMethod | private void defineWriteBridgeMethod() {
"""
Defines the generics bridge method with untyped args to the type specific write method.
"""
classDefinition.addMethod(
new MethodDefinition(a(PUBLIC, BRIDGE, SYNTHETIC), "write", null, arg("struct", Object.class), arg("protocol", TProtocol.cl... | java | private void defineWriteBridgeMethod()
{
classDefinition.addMethod(
new MethodDefinition(a(PUBLIC, BRIDGE, SYNTHETIC), "write", null, arg("struct", Object.class), arg("protocol", TProtocol.class))
.addException(Exception.class)
.loadThis()
... | [
"private",
"void",
"defineWriteBridgeMethod",
"(",
")",
"{",
"classDefinition",
".",
"addMethod",
"(",
"new",
"MethodDefinition",
"(",
"a",
"(",
"PUBLIC",
",",
"BRIDGE",
",",
"SYNTHETIC",
")",
",",
"\"write\"",
",",
"null",
",",
"arg",
"(",
"\"struct\"",
","... | Defines the generics bridge method with untyped args to the type specific write method. | [
"Defines",
"the",
"generics",
"bridge",
"method",
"with",
"untyped",
"args",
"to",
"the",
"type",
"specific",
"write",
"method",
"."
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java#L1020-L1037 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/action/ActionableHelper.java | ActionableHelper.deleteFilePath | public static void deleteFilePath(FilePath workspace, String path) throws IOException {
"""
Deletes a FilePath file.
@param workspace The build workspace.
@param path The path in the workspace.
@throws IOException In case of missing file.
"""
if (StringUtils.isNotBlank(path)) {
tr... | java | public static void deleteFilePath(FilePath workspace, String path) throws IOException {
if (StringUtils.isNotBlank(path)) {
try {
FilePath propertiesFile = new FilePath(workspace, path);
propertiesFile.delete();
} catch (Exception e) {
thro... | [
"public",
"static",
"void",
"deleteFilePath",
"(",
"FilePath",
"workspace",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"path",
")",
")",
"{",
"try",
"{",
"FilePath",
"propertiesFile",
"=",
"new... | Deletes a FilePath file.
@param workspace The build workspace.
@param path The path in the workspace.
@throws IOException In case of missing file. | [
"Deletes",
"a",
"FilePath",
"file",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L277-L286 |
qiniu/java-sdk | src/main/java/com/qiniu/streaming/StreamingManager.java | StreamingManager.disableTill | public void disableTill(String streamKey, long expireAtTimestamp) throws QiniuException {
"""
禁用流
@param streamKey 流名称
@param expireAtTimestamp 禁用截至时间戳,单位秒
"""
String path = encodeKey(streamKey) + "/disabled";
String body = String.format("{\"disabledTill\":%d}", expireAtTimestamp);
... | java | public void disableTill(String streamKey, long expireAtTimestamp) throws QiniuException {
String path = encodeKey(streamKey) + "/disabled";
String body = String.format("{\"disabledTill\":%d}", expireAtTimestamp);
post(path, body, null);
} | [
"public",
"void",
"disableTill",
"(",
"String",
"streamKey",
",",
"long",
"expireAtTimestamp",
")",
"throws",
"QiniuException",
"{",
"String",
"path",
"=",
"encodeKey",
"(",
"streamKey",
")",
"+",
"\"/disabled\"",
";",
"String",
"body",
"=",
"String",
".",
"fo... | 禁用流
@param streamKey 流名称
@param expireAtTimestamp 禁用截至时间戳,单位秒 | [
"禁用流"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/streaming/StreamingManager.java#L110-L114 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java | HttpRequestExecutor.buildFilePart | public static Part buildFilePart(final String name, final File file) throws IOException {
"""
Static factory method that creates a {@link Part} which contains
file form data.
@param name name Name of the POST file data to create part for.
@param file File of the POST data to create part for.
@return Created ... | java | public static Part buildFilePart(final String name, final File file) throws IOException {
//Files.probeContentType(file.toPath()) always returns null due to unfixed jdk bug
//using Tika to fetch file mime type instead
final String type = new Tika().detect(file);
final FileContent content = new FileContent(type,... | [
"public",
"static",
"Part",
"buildFilePart",
"(",
"final",
"String",
"name",
",",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"//Files.probeContentType(file.toPath()) always returns null due to unfixed jdk bug",
"//using Tika to fetch file mime type instead",
"fin... | Static factory method that creates a {@link Part} which contains
file form data.
@param name name Name of the POST file data to create part for.
@param file File of the POST data to create part for.
@return Created data part.
@throws IOException If any any error occurs during file type detection. | [
"Static",
"factory",
"method",
"that",
"creates",
"a",
"{",
"@link",
"Part",
"}",
"which",
"contains",
"file",
"form",
"data",
"."
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java#L143-L154 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.setRaw | private <T extends Model> T setRaw(String attributeName, Object value) {
"""
Sets raw value of an attribute, without applying conversions.
"""
if (manageTime && attributeName.equalsIgnoreCase("created_at")) {
throw new IllegalArgumentException("cannot set 'created_at'");
}
m... | java | private <T extends Model> T setRaw(String attributeName, Object value) {
if (manageTime && attributeName.equalsIgnoreCase("created_at")) {
throw new IllegalArgumentException("cannot set 'created_at'");
}
metaModelLocal.checkAttribute(attributeName);
if (willAttributeModifyMo... | [
"private",
"<",
"T",
"extends",
"Model",
">",
"T",
"setRaw",
"(",
"String",
"attributeName",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"manageTime",
"&&",
"attributeName",
".",
"equalsIgnoreCase",
"(",
"\"created_at\"",
")",
")",
"{",
"throw",
"new",
"I... | Sets raw value of an attribute, without applying conversions. | [
"Sets",
"raw",
"value",
"of",
"an",
"attribute",
"without",
"applying",
"conversions",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L374-L385 |
jenkinsci/jenkins | core/src/main/java/hudson/util/ProcessTree.java | OSProcess.hasMatchingEnvVars | public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) {
"""
Given the environment variable of a process and the "model environment variable" that Hudson
used for launching the build, returns true if there's a match (which means the process should
be considered a descendant of a build.)
"""
... | java | public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) {
if(modelEnvVar.isEmpty())
// sanity check so that we don't start rampage.
return false;
SortedMap<String,String> envs = getEnvironmentVariables();
for (Entry<String,String> e : ... | [
"public",
"final",
"boolean",
"hasMatchingEnvVars",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"modelEnvVar",
")",
"{",
"if",
"(",
"modelEnvVar",
".",
"isEmpty",
"(",
")",
")",
"// sanity check so that we don't start rampage.",
"return",
"false",
";",
"SortedM... | Given the environment variable of a process and the "model environment variable" that Hudson
used for launching the build, returns true if there's a match (which means the process should
be considered a descendant of a build.) | [
"Given",
"the",
"environment",
"variable",
"of",
"a",
"process",
"and",
"the",
"model",
"environment",
"variable",
"that",
"Hudson",
"used",
"for",
"launching",
"the",
"build",
"returns",
"true",
"if",
"there",
"s",
"a",
"match",
"(",
"which",
"means",
"the"... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ProcessTree.java#L317-L330 |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/Utils.java | Utils.cmdWithWorkingDir | public static List<String> cmdWithWorkingDir(String[] command, String workindDir, final long timeout)
throws IOException, InterruptedException {
"""
Executes command, and waits for the expected phrase in console printout.
@param command command line
@param workindDir working directory
@param timeo... | java | public static List<String> cmdWithWorkingDir(String[] command, String workindDir, final long timeout)
throws IOException, InterruptedException {
return cmd(command, null, null, timeout, workindDir);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"cmdWithWorkingDir",
"(",
"String",
"[",
"]",
"command",
",",
"String",
"workindDir",
",",
"final",
"long",
"timeout",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"cmd",
"(",
"comman... | Executes command, and waits for the expected phrase in console printout.
@param command command line
@param workindDir working directory
@param timeout in millisecond
@return console output as a list of strings
@throws IOException for command error
@throws InterruptedException when interrupted | [
"Executes",
"command",
"and",
"waits",
"for",
"the",
"expected",
"phrase",
"in",
"console",
"printout",
"."
] | train | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/Utils.java#L142-L145 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getHeaderIgnoreCase | public final static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
"""
忽略大小写获得请求header中的信息
@param request 请求对象{@link HttpServletRequest}
@param nameIgnoreCase 忽略大小写头信息的KEY
@return header值
"""
Enumeration<String> names = request.getHeaderNames();
String name = null;
... | java | public final static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
Enumeration<String> names = request.getHeaderNames();
String name = null;
while (names.hasMoreElements()) {
name = names.nextElement();
if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) {
r... | [
"public",
"final",
"static",
"String",
"getHeaderIgnoreCase",
"(",
"HttpServletRequest",
"request",
",",
"String",
"nameIgnoreCase",
")",
"{",
"Enumeration",
"<",
"String",
">",
"names",
"=",
"request",
".",
"getHeaderNames",
"(",
")",
";",
"String",
"name",
"="... | 忽略大小写获得请求header中的信息
@param request 请求对象{@link HttpServletRequest}
@param nameIgnoreCase 忽略大小写头信息的KEY
@return header值 | [
"忽略大小写获得请求header中的信息"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L277-L288 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java | IndexTaskUtils.datasourceAuthorizationCheck | public static Access datasourceAuthorizationCheck(
final HttpServletRequest req,
Action action,
String datasource,
AuthorizerMapper authorizerMapper
) {
"""
Authorizes action to be performed on a task's datasource
@return authorization result
"""
ResourceAction resourceAction =... | java | public static Access datasourceAuthorizationCheck(
final HttpServletRequest req,
Action action,
String datasource,
AuthorizerMapper authorizerMapper
)
{
ResourceAction resourceAction = new ResourceAction(
new Resource(datasource, ResourceType.DATASOURCE),
action
);
... | [
"public",
"static",
"Access",
"datasourceAuthorizationCheck",
"(",
"final",
"HttpServletRequest",
"req",
",",
"Action",
"action",
",",
"String",
"datasource",
",",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"ResourceAction",
"resourceAction",
"=",
"new",
"Resourc... | Authorizes action to be performed on a task's datasource
@return authorization result | [
"Authorizes",
"action",
"to",
"be",
"performed",
"on",
"a",
"task",
"s",
"datasource"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java#L62-L80 |
zafarkhaja/jsemver | src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java | ExpressionParser.parsePartialVersionRange | private CompositeExpression parsePartialVersionRange() {
"""
Parses the {@literal <partial-version-range>} non-terminal.
<pre>
{@literal
<partial-version-range> ::= <major> | <major> "." <minor>
}
</pre>
@return the expression AST
"""
int major = intOf(consumeNextToken(NUMERIC).lexeme);
... | java | private CompositeExpression parsePartialVersionRange() {
int major = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return gte(versionFor(major)).and(lt(versionFor(major + 1)));
}
consumeNextToken(DOT);
int minor = intOf(consumeNextToke... | [
"private",
"CompositeExpression",
"parsePartialVersionRange",
"(",
")",
"{",
"int",
"major",
"=",
"intOf",
"(",
"consumeNextToken",
"(",
"NUMERIC",
")",
".",
"lexeme",
")",
";",
"if",
"(",
"!",
"tokens",
".",
"positiveLookahead",
"(",
"DOT",
")",
")",
"{",
... | Parses the {@literal <partial-version-range>} non-terminal.
<pre>
{@literal
<partial-version-range> ::= <major> | <major> "." <minor>
}
</pre>
@return the expression AST | [
"Parses",
"the",
"{",
"@literal",
"<partial",
"-",
"version",
"-",
"range",
">",
"}",
"non",
"-",
"terminal",
"."
] | train | https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L389-L397 |
alkacon/opencms-core | src/org/opencms/jsp/parse/A_CmsConfiguredHtmlParser.java | A_CmsConfiguredHtmlParser.doParse | public String doParse(String html, String encoding, List<String> noAutoCloseTags)
throws ParserException, CmsException {
"""
Returns the result of subsequent parsing to the <cms:parse< tag implementation.<p>
@param encoding the encoding to use for parsing
@param html the html content to parse
@param... | java | public String doParse(String html, String encoding, List<String> noAutoCloseTags)
throws ParserException, CmsException {
m_visitor = createVisitorInstance();
m_visitor.setNoAutoCloseTags(noAutoCloseTags);
String result = "";
m_visitor.process(html, encoding);
result = m_visi... | [
"public",
"String",
"doParse",
"(",
"String",
"html",
",",
"String",
"encoding",
",",
"List",
"<",
"String",
">",
"noAutoCloseTags",
")",
"throws",
"ParserException",
",",
"CmsException",
"{",
"m_visitor",
"=",
"createVisitorInstance",
"(",
")",
";",
"m_visitor"... | Returns the result of subsequent parsing to the <cms:parse< tag implementation.<p>
@param encoding the encoding to use for parsing
@param html the html content to parse
@param noAutoCloseTags a list of upper case tag names for which parsing / visiting should not correct missing closing tags.
@return the result ... | [
"Returns",
"the",
"result",
"of",
"subsequent",
"parsing",
"to",
"the",
"<",
";",
"cms",
":",
"parse<",
";",
"tag",
"implementation",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/parse/A_CmsConfiguredHtmlParser.java#L99-L108 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java | ModelControllerLock.lockShared | boolean lockShared(final Integer permit, final long timeout, final TimeUnit unit) {
"""
Attempts shared acquisition with a max wait time.
@param permit - the permit Integer for this operation. May not be {@code null}.
@param timeout - the time value to wait for acquiring the lock
@param unit - See {@code TimeUn... | java | boolean lockShared(final Integer permit, final long timeout, final TimeUnit unit) {
boolean result = false;
try {
result = lockSharedInterruptibly(permit, timeout, unit);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return resul... | [
"boolean",
"lockShared",
"(",
"final",
"Integer",
"permit",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"try",
"{",
"result",
"=",
"lockSharedInterruptibly",
"(",
"permit",
",",
"timeou... | Attempts shared acquisition with a max wait time.
@param permit - the permit Integer for this operation. May not be {@code null}.
@param timeout - the time value to wait for acquiring the lock
@param unit - See {@code TimeUnit} for valid values
@return {@code boolean} true on success. | [
"Attempts",
"shared",
"acquisition",
"with",
"a",
"max",
"wait",
"time",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java#L90-L98 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/XMLParser.java | XMLParser.printHtmlData | public void printHtmlData(PrintWriter out, InputStream streamIn) {
"""
Output this screen using HTML.
Override this to print your XML.
"""
String str = null;
if (streamIn != null)
str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn));
if ((str == null... | java | public void printHtmlData(PrintWriter out, InputStream streamIn)
{
String str = null;
if (streamIn != null)
str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn));
if ((str == null) || (str.length() == 0))
str = this.getDefaultXML();
this... | [
"public",
"void",
"printHtmlData",
"(",
"PrintWriter",
"out",
",",
"InputStream",
"streamIn",
")",
"{",
"String",
"str",
"=",
"null",
";",
"if",
"(",
"streamIn",
"!=",
"null",
")",
"str",
"=",
"Utility",
".",
"transferURLStream",
"(",
"null",
",",
"null",
... | Output this screen using HTML.
Override this to print your XML. | [
"Output",
"this",
"screen",
"using",
"HTML",
".",
"Override",
"this",
"to",
"print",
"your",
"XML",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/XMLParser.java#L60-L68 |
strator-dev/greenpepper | greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java | GreenPepperServerServiceImpl.getAllRunners | public List<Runner> getAllRunners() throws GreenPepperServerException {
"""
<p>getAllRunners.</p>
@inheritDoc NO NEEDS TO SECURE THIS
@return a {@link java.util.List} object.
@throws com.greenpepper.server.GreenPepperServerException if any.
"""
try {
sessionService.startSession();
... | java | public List<Runner> getAllRunners() throws GreenPepperServerException {
try {
sessionService.startSession();
List<Runner> runners = sutDao.getAllRunners();
log.debug("Retrieved All Runner number: " + runners.size());
return runners;
} catch (Exception e... | [
"public",
"List",
"<",
"Runner",
">",
"getAllRunners",
"(",
")",
"throws",
"GreenPepperServerException",
"{",
"try",
"{",
"sessionService",
".",
"startSession",
"(",
")",
";",
"List",
"<",
"Runner",
">",
"runners",
"=",
"sutDao",
".",
"getAllRunners",
"(",
"... | <p>getAllRunners.</p>
@inheritDoc NO NEEDS TO SECURE THIS
@return a {@link java.util.List} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"getAllRunners",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java#L186-L200 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java | ShanksAgentBayesianReasoningCapability.getHypothesis | public static float getHypothesis(ProbabilisticNetwork bn, String nodeName,
String status) throws ShanksException {
"""
Get the value of a status in a node
@param bn
@param nodeName
@param status
@return a float with the probability
@throws UnknownNodeException
@throws UnknowkNodeStateException... | java | public static float getHypothesis(ProbabilisticNetwork bn, String nodeName,
String status) throws ShanksException {
ProbabilisticNode node = ShanksAgentBayesianReasoningCapability
.getNode(bn, nodeName);
int states = node.getStatesSize();
for (int i = 0; i < states; i... | [
"public",
"static",
"float",
"getHypothesis",
"(",
"ProbabilisticNetwork",
"bn",
",",
"String",
"nodeName",
",",
"String",
"status",
")",
"throws",
"ShanksException",
"{",
"ProbabilisticNode",
"node",
"=",
"ShanksAgentBayesianReasoningCapability",
".",
"getNode",
"(",
... | Get the value of a status in a node
@param bn
@param nodeName
@param status
@return a float with the probability
@throws UnknownNodeException
@throws UnknowkNodeStateException | [
"Get",
"the",
"value",
"of",
"a",
"status",
"in",
"a",
"node"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L378-L389 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java | PercentageColumn.getTextForExpression | public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
"""
Returns the formula for the percentage
@param group
@param type
@return
"""
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getG... | java | public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + "}.dou... | [
"public",
"String",
"getTextForExpression",
"(",
"DJGroup",
"group",
",",
"DJGroup",
"childGroup",
",",
"String",
"type",
")",
"{",
"return",
"\"new Double( $V{\"",
"+",
"getReportName",
"(",
")",
"+",
"\"_\"",
"+",
"getGroupVariableName",
"(",
"childGroup",
")",
... | Returns the formula for the percentage
@param group
@param type
@return | [
"Returns",
"the",
"formula",
"for",
"the",
"percentage"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java#L32-L34 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/paramavg/ParameterAveragingTrainingMaster.java | ParameterAveragingTrainingMaster.fromYaml | public static ParameterAveragingTrainingMaster fromYaml(String yamlStr) {
"""
Create a ParameterAveragingTrainingMaster instance by deserializing a YAML string that has been serialized with
{@link #toYaml()}
@param yamlStr ParameterAveragingTrainingMaster configuration serialized as YAML
"""
Object... | java | public static ParameterAveragingTrainingMaster fromYaml(String yamlStr) {
ObjectMapper om = getYamlMapper();
try {
return om.readValue(yamlStr, ParameterAveragingTrainingMaster.class);
} catch (IOException e) {
throw new RuntimeException("Could not parse YAML", e);
... | [
"public",
"static",
"ParameterAveragingTrainingMaster",
"fromYaml",
"(",
"String",
"yamlStr",
")",
"{",
"ObjectMapper",
"om",
"=",
"getYamlMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"readValue",
"(",
"yamlStr",
",",
"ParameterAveragingTrainingMaster",
... | Create a ParameterAveragingTrainingMaster instance by deserializing a YAML string that has been serialized with
{@link #toYaml()}
@param yamlStr ParameterAveragingTrainingMaster configuration serialized as YAML | [
"Create",
"a",
"ParameterAveragingTrainingMaster",
"instance",
"by",
"deserializing",
"a",
"YAML",
"string",
"that",
"has",
"been",
"serialized",
"with",
"{",
"@link",
"#toYaml",
"()",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/paramavg/ParameterAveragingTrainingMaster.java#L270-L277 |
atbashEE/atbash-config | geronimo-config/src/main/java/org/apache/geronimo/config/ConfigImpl.java | ConfigImpl.sortDescending | protected List<ConfigSource> sortDescending(List<ConfigSource> configSources) {
"""
ConfigSources are sorted with descending ordinal.
If 2 ConfigSources have the same ordinal, then they get sorted according to their name, alphabetically.
"""
Collections.sort(configSources, new Comparator<ConfigSource>... | java | protected List<ConfigSource> sortDescending(List<ConfigSource> configSources) {
Collections.sort(configSources, new Comparator<ConfigSource>() {
@Override
public int compare(ConfigSource configSource1, ConfigSource configSource2) {
// ConfigSource.getOrdinal is a default ... | [
"protected",
"List",
"<",
"ConfigSource",
">",
"sortDescending",
"(",
"List",
"<",
"ConfigSource",
">",
"configSources",
")",
"{",
"Collections",
".",
"sort",
"(",
"configSources",
",",
"new",
"Comparator",
"<",
"ConfigSource",
">",
"(",
")",
"{",
"@",
"Over... | ConfigSources are sorted with descending ordinal.
If 2 ConfigSources have the same ordinal, then they get sorted according to their name, alphabetically. | [
"ConfigSources",
"are",
"sorted",
"with",
"descending",
"ordinal",
".",
"If",
"2",
"ConfigSources",
"have",
"the",
"same",
"ordinal",
"then",
"they",
"get",
"sorted",
"according",
"to",
"their",
"name",
"alphabetically",
"."
] | train | https://github.com/atbashEE/atbash-config/blob/80c06c6e535957514ffb51380948ecd351d5068c/geronimo-config/src/main/java/org/apache/geronimo/config/ConfigImpl.java#L292-L317 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/reader/dem/MultiSourceElevationProvider.java | MultiSourceElevationProvider.setBaseURL | @Override
public ElevationProvider setBaseURL(String baseURL) {
"""
For the MultiSourceElevationProvider you have to specify the base URL separated by a ';'.
The first for cgiar, the second for gmted.
"""
String[] urls = baseURL.split(";");
if (urls.length != 2) {
throw new Ill... | java | @Override
public ElevationProvider setBaseURL(String baseURL) {
String[] urls = baseURL.split(";");
if (urls.length != 2) {
throw new IllegalArgumentException("The base url must consist of two urls separated by a ';'. The first for cgiar, the second for gmted");
}
srtmPro... | [
"@",
"Override",
"public",
"ElevationProvider",
"setBaseURL",
"(",
"String",
"baseURL",
")",
"{",
"String",
"[",
"]",
"urls",
"=",
"baseURL",
".",
"split",
"(",
"\";\"",
")",
";",
"if",
"(",
"urls",
".",
"length",
"!=",
"2",
")",
"{",
"throw",
"new",
... | For the MultiSourceElevationProvider you have to specify the base URL separated by a ';'.
The first for cgiar, the second for gmted. | [
"For",
"the",
"MultiSourceElevationProvider",
"you",
"have",
"to",
"specify",
"the",
"base",
"URL",
"separated",
"by",
"a",
";",
".",
"The",
"first",
"for",
"cgiar",
"the",
"second",
"for",
"gmted",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/reader/dem/MultiSourceElevationProvider.java#L61-L70 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT | public void billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT(String billingAccount, String serviceName, Long queueId, OvhOvhPabxHuntingQueue body) throws IOException {
"""
Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}
@param body [r... | java | public void billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT(String billingAccount, String serviceName, Long queueId, OvhOvhPabxHuntingQueue body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}";
StringBuilder sb = path(qPath, billingAccoun... | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"queueId",
",",
"OvhOvhPabxHuntingQueue",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/t... | Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param queueId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6717-L6721 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/KolmogorovSmirnovIndependentSamples.java | KolmogorovSmirnovIndependentSamples.calculateCriticalValue | protected static double calculateCriticalValue(boolean is_twoTailed, int n1, int n2, double aLevel) {
"""
Calculate Critical Value for a particular $n and $aLevel combination
@param is_twoTailed
@param n1
@param n2
@param aLevel
@return
"""
double a=aLevel;
if(is_twoTailed) {
... | java | protected static double calculateCriticalValue(boolean is_twoTailed, int n1, int n2, double aLevel) {
double a=aLevel;
if(is_twoTailed) {
a=aLevel/2.0;
}
double one_minus_a=1.0-a;
double Ka=1.36;//start by this value and go either up or down until you pass the desire... | [
"protected",
"static",
"double",
"calculateCriticalValue",
"(",
"boolean",
"is_twoTailed",
",",
"int",
"n1",
",",
"int",
"n2",
",",
"double",
"aLevel",
")",
"{",
"double",
"a",
"=",
"aLevel",
";",
"if",
"(",
"is_twoTailed",
")",
"{",
"a",
"=",
"aLevel",
... | Calculate Critical Value for a particular $n and $aLevel combination
@param is_twoTailed
@param n1
@param n2
@param aLevel
@return | [
"Calculate",
"Critical",
"Value",
"for",
"a",
"particular",
"$n",
"and",
"$aLevel",
"combination"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/KolmogorovSmirnovIndependentSamples.java#L138-L164 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.regenerateStorageAccountKeyAsync | public ServiceFuture<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName, final ServiceCallback<StorageBundle> serviceCallback) {
"""
Regenerates the specified key value for the given storage account. This operation requires the storage/regeneratekey permi... | java | public ServiceFuture<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName, final ServiceCallback<StorageBundle> serviceCallback) {
return ServiceFuture.fromResponse(regenerateStorageAccountKeyWithServiceResponseAsync(vaultBaseUrl, storageAccountName, key... | [
"public",
"ServiceFuture",
"<",
"StorageBundle",
">",
"regenerateStorageAccountKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"keyName",
",",
"final",
"ServiceCallback",
"<",
"StorageBundle",
">",
"serviceCallback",
")",
"{... | Regenerates the specified key value for the given storage account. This operation requires the storage/regeneratekey permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param keyName The storage account key name.
@para... | [
"Regenerates",
"the",
"specified",
"key",
"value",
"for",
"the",
"given",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"regeneratekey",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10308-L10310 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java | ParseUtil.matchNaN | private static boolean matchNaN(byte[] str, byte firstchar, int start, int end) {
"""
Match "NaN" in a number of different capitalizations.
@param str String to match
@param firstchar First character
@param start Interval begin
@param end Interval end
@return {@code true} when NaN was recognized.
"""
... | java | private static boolean matchNaN(byte[] str, byte firstchar, int start, int end) {
final int len = end - start;
if(len < 2 || len > 3 || (firstchar != 'N' && firstchar != 'n')) {
return false;
}
final byte c1 = str[start + 1];
if(c1 != 'a' && c1 != 'A') {
return false;
}
// Accept... | [
"private",
"static",
"boolean",
"matchNaN",
"(",
"byte",
"[",
"]",
"str",
",",
"byte",
"firstchar",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"final",
"int",
"len",
"=",
"end",
"-",
"start",
";",
"if",
"(",
"len",
"<",
"2",
"||",
"len",
"... | Match "NaN" in a number of different capitalizations.
@param str String to match
@param firstchar First character
@param start Interval begin
@param end Interval end
@return {@code true} when NaN was recognized. | [
"Match",
"NaN",
"in",
"a",
"number",
"of",
"different",
"capitalizations",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java#L543-L558 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java | CmsResultsTab.addContentItems | protected void addContentItems(List<CmsResultItemBean> list, boolean front, boolean showPath) {
"""
Adds list items for a list of search results.<p>
@param list the list of search results
@param front if true, list items will be added to the front of the list, else at the back
@param showPath <code>true</code... | java | protected void addContentItems(List<CmsResultItemBean> list, boolean front, boolean showPath) {
if (front) {
list = Lists.reverse(list);
}
for (CmsResultItemBean resultItem : list) {
addSingleResult(resultItem, front, showPath);
}
if (isTilingViewAllowed(... | [
"protected",
"void",
"addContentItems",
"(",
"List",
"<",
"CmsResultItemBean",
">",
"list",
",",
"boolean",
"front",
",",
"boolean",
"showPath",
")",
"{",
"if",
"(",
"front",
")",
"{",
"list",
"=",
"Lists",
".",
"reverse",
"(",
"list",
")",
";",
"}",
"... | Adds list items for a list of search results.<p>
@param list the list of search results
@param front if true, list items will be added to the front of the list, else at the back
@param showPath <code>true</code> to show the resource path in sub title | [
"Adds",
"list",
"items",
"for",
"a",
"list",
"of",
"search",
"results",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L517-L533 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/EncodingUtils.java | EncodingUtils.encodeHtml | @Deprecated
public static String encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException {
"""
@param value the string to be escaped.
@return if value is null then null otherwise value escaped
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space prop... | java | @Deprecated
public static String encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException {
if(value==null) return null;
StringBuilder result = new StringBuilder();
encodeHtml(value, make_br, make_nbsp, result);
return result.toString();
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"encodeHtml",
"(",
"Object",
"value",
",",
"boolean",
"make_br",
",",
"boolean",
"make_nbsp",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"StringBuilder",
"... | @param value the string to be escaped.
@return if value is null then null otherwise value escaped
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property.
@see TextInXhtmlEncoder | [
"@param",
"value",
"the",
"string",
"to",
"be",
"escaped",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/EncodingUtils.java#L261-L267 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java | BingAutoSuggestSearchImpl.autoSuggestWithServiceResponseAsync | public Observable<ServiceResponse<Suggestions>> autoSuggestWithServiceResponseAsync(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
"""
The AutoSuggest API lets you send a search query to Bing and get back a list of suggestions. This section provides technical details about the query par... | java | public Observable<ServiceResponse<Suggestions>> autoSuggestWithServiceResponseAsync(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String ac... | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Suggestions",
">",
">",
"autoSuggestWithServiceResponseAsync",
"(",
"String",
"query",
",",
"AutoSuggestOptionalParameter",
"autoSuggestOptionalParameter",
")",
"{",
"if",
"(",
"query",
"==",
"null",
")",
"{",
"thr... | The AutoSuggest API lets you send a search query to Bing and get back a list of suggestions. This section provides technical details about the query parameters and headers that you use to request suggestions and the JSON response objects that contain them.
@param query The user's search term.
@param autoSuggestOptiona... | [
"The",
"AutoSuggest",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"suggestions",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",
"parameters",
"and",
"heade... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java#L120-L137 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/BoardsApi.java | BoardsApi.createBoard | public Board createBoard(Object projectIdOrPath, String name) throws GitLabApiException {
"""
Creates a new Issue Board.
<p>NOTE: This is only available in GitLab EE</p>
<pre><code>GitLab Endpoint: POST /projects/:id/boards</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), Str... | java | public Board createBoard(Object projectIdOrPath, String name) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("name", name, true);
Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "boards");
re... | [
"public",
"Board",
"createBoard",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"name",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"name\"",
",",
"name",
",",
"true",
... | Creates a new Issue Board.
<p>NOTE: This is only available in GitLab EE</p>
<pre><code>GitLab Endpoint: POST /projects/:id/boards</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param name the name for the new board
@return the created Board instance
... | [
"Creates",
"a",
"new",
"Issue",
"Board",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/BoardsApi.java#L130-L134 |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.getPercent | static double getPercent( Expression expression, CssFormatter formatter ) {
"""
Get the expression value as percent (range 0 - 1).
@param expression
the expression
@param formatter
current formatter
@return the percent value
"""
double d = expression.doubleValue( formatter );
if( express... | java | static double getPercent( Expression expression, CssFormatter formatter ) {
double d = expression.doubleValue( formatter );
if( expression.getDataType( formatter ) == Expression.PERCENT ) {
d /= 100;
} else if( d > 1.0 && d == (int)d ) {
d /= 100;
}
return... | [
"static",
"double",
"getPercent",
"(",
"Expression",
"expression",
",",
"CssFormatter",
"formatter",
")",
"{",
"double",
"d",
"=",
"expression",
".",
"doubleValue",
"(",
"formatter",
")",
";",
"if",
"(",
"expression",
".",
"getDataType",
"(",
"formatter",
")",... | Get the expression value as percent (range 0 - 1).
@param expression
the expression
@param formatter
current formatter
@return the percent value | [
"Get",
"the",
"expression",
"value",
"as",
"percent",
"(",
"range",
"0",
"-",
"1",
")",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L632-L640 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java | ConnectionFactoryDBCPImpl.createConnectionFactory | protected org.apache.commons.dbcp.ConnectionFactory createConnectionFactory(JdbcConnectionDescriptor jcd) {
"""
Creates a DriverManager-based ConnectionFactory for creating the Connection
instances to feed into the object pool of the specified jcd-alias.
<p>
<b>NB!</b> If you override this method to specify you... | java | protected org.apache.commons.dbcp.ConnectionFactory createConnectionFactory(JdbcConnectionDescriptor jcd)
{
final ConPoolFactory result;
final Properties properties = getJdbcProperties(jcd);
result = new ConPoolFactory(jcd, properties);
return result;
} | [
"protected",
"org",
".",
"apache",
".",
"commons",
".",
"dbcp",
".",
"ConnectionFactory",
"createConnectionFactory",
"(",
"JdbcConnectionDescriptor",
"jcd",
")",
"{",
"final",
"ConPoolFactory",
"result",
";",
"final",
"Properties",
"properties",
"=",
"getJdbcPropertie... | Creates a DriverManager-based ConnectionFactory for creating the Connection
instances to feed into the object pool of the specified jcd-alias.
<p>
<b>NB!</b> If you override this method to specify your own ConnectionFactory
you <em>must</em> make sure that you follow OJB's lifecycle contract defined in the
{@link org.a... | [
"Creates",
"a",
"DriverManager",
"-",
"based",
"ConnectionFactory",
"for",
"creating",
"the",
"Connection",
"instances",
"to",
"feed",
"into",
"the",
"object",
"pool",
"of",
"the",
"specified",
"jcd",
"-",
"alias",
".",
"<p",
">",
"<b",
">",
"NB!<",
"/",
"... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java#L356-L362 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java | CmsSitemapHoverbar.installOn | public static void installOn(
CmsSitemapController controller,
CmsTreeItem treeItem,
CmsUUID entryId,
String sitePath,
boolean contextmenu) {
"""
Installs a hover bar for the given item widget.<p>
@param controller the controller
@param treeItem the item to hover
@param... | java | public static void installOn(
CmsSitemapController controller,
CmsTreeItem treeItem,
CmsUUID entryId,
String sitePath,
boolean contextmenu) {
CmsSitemapHoverbar hoverbar = new CmsSitemapHoverbar(controller, entryId, sitePath, contextmenu);
installHoverbar(hoverba... | [
"public",
"static",
"void",
"installOn",
"(",
"CmsSitemapController",
"controller",
",",
"CmsTreeItem",
"treeItem",
",",
"CmsUUID",
"entryId",
",",
"String",
"sitePath",
",",
"boolean",
"contextmenu",
")",
"{",
"CmsSitemapHoverbar",
"hoverbar",
"=",
"new",
"CmsSitem... | Installs a hover bar for the given item widget.<p>
@param controller the controller
@param treeItem the item to hover
@param entryId the entry id
@param sitePath the entry site path
@param contextmenu flag to control whether the context menu should be shown | [
"Installs",
"a",
"hover",
"bar",
"for",
"the",
"given",
"item",
"widget",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java#L213-L222 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/util/Util.java | Util.getContextUrlString | public static StringBuilder getContextUrlString(String baseUrl, String context) throws MalformedURLException {
"""
Given a base URL (like 'http://localhost:8080') this will append the given context string to it and will return
the URL with a forward-slash as its last character.
This returns a StringBuilder so ... | java | public static StringBuilder getContextUrlString(String baseUrl, String context) throws MalformedURLException {
StringBuilder urlStr = new StringBuilder(baseUrl);
ensureEndsWithSlash(urlStr);
if (context != null && context.length() > 0) {
if (context.startsWith("/")) {
... | [
"public",
"static",
"StringBuilder",
"getContextUrlString",
"(",
"String",
"baseUrl",
",",
"String",
"context",
")",
"throws",
"MalformedURLException",
"{",
"StringBuilder",
"urlStr",
"=",
"new",
"StringBuilder",
"(",
"baseUrl",
")",
";",
"ensureEndsWithSlash",
"(",
... | Given a base URL (like 'http://localhost:8080') this will append the given context string to it and will return
the URL with a forward-slash as its last character.
This returns a StringBuilder so the caller can continue building its desired URL by appending to it additional
context paths, query strings, and the like.
... | [
"Given",
"a",
"base",
"URL",
"(",
"like",
"http",
":",
"//",
"localhost",
":",
"8080",
")",
"this",
"will",
"append",
"the",
"given",
"context",
"string",
"to",
"it",
"and",
"will",
"return",
"the",
"URL",
"with",
"a",
"forward",
"-",
"slash",
"as",
... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/util/Util.java#L155-L167 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.findClass | @Override
@FFDCIgnore(ClassNotFoundException.class)
protected final Class<?> findClass(String name) throws ClassNotFoundException {
"""
@{inheritDoc
Search order:
1. This classloader.
2. The common library classloaders.
Note: the method is marked 'final' so that derived classes (such as ParentLastC... | java | @Override
@FFDCIgnore(ClassNotFoundException.class)
protected final Class<?> findClass(String name) throws ClassNotFoundException {
if (transformers.isEmpty()) {
Class<?> clazz = null;
Object token = ThreadIdentityManager.runAsServer();
try {
synchroni... | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"ClassNotFoundException",
".",
"class",
")",
"protected",
"final",
"Class",
"<",
"?",
">",
"findClass",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"transformers",
".",
"isEmpty",
"("... | @{inheritDoc
Search order:
1. This classloader.
2. The common library classloaders.
Note: the method is marked 'final' so that derived classes (such as ParentLastClassLoader)
don't override this method and lose the common library classloader support. | [
"@",
"{",
"inheritDoc"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L265-L305 |
KyoriPowered/text | api/src/main/java/net/kyori/text/TextComponent.java | TextComponent.of | public static TextComponent of(final @NonNull String content, final @Nullable TextColor color) {
"""
Creates a text component with content, and optional color.
@param content the plain text content
@param color the color
@return the text component
"""
return of(content, color, Collections.emptySet());... | java | public static TextComponent of(final @NonNull String content, final @Nullable TextColor color) {
return of(content, color, Collections.emptySet());
} | [
"public",
"static",
"TextComponent",
"of",
"(",
"final",
"@",
"NonNull",
"String",
"content",
",",
"final",
"@",
"Nullable",
"TextColor",
"color",
")",
"{",
"return",
"of",
"(",
"content",
",",
"color",
",",
"Collections",
".",
"emptySet",
"(",
")",
")",
... | Creates a text component with content, and optional color.
@param content the plain text content
@param color the color
@return the text component | [
"Creates",
"a",
"text",
"component",
"with",
"content",
"and",
"optional",
"color",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L151-L153 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/ApproxNeedlemanWunsch.java | ApproxNeedlemanWunsch.getAlignedChar | public int getAlignedChar(int iMinusOne,boolean preferHigherIndices) {
"""
Find a character in the first string, s, that can be aligned
with the i-th character in the second string, t.
"""
// internally to this package, strings are indexed 1...N, so
// we need to convert from the usual 0...N... | java | public int getAlignedChar(int iMinusOne,boolean preferHigherIndices)
{
// internally to this package, strings are indexed 1...N, so
// we need to convert from the usual 0...N-1 Java convention
int i = iMinusOne+1;
int bestJ = -1;
double bestScore = -Double.MAX_VALUE;
... | [
"public",
"int",
"getAlignedChar",
"(",
"int",
"iMinusOne",
",",
"boolean",
"preferHigherIndices",
")",
"{",
"// internally to this package, strings are indexed 1...N, so\r",
"// we need to convert from the usual 0...N-1 Java convention\r",
"int",
"i",
"=",
"iMinusOne",
"+",
"1",... | Find a character in the first string, s, that can be aligned
with the i-th character in the second string, t. | [
"Find",
"a",
"character",
"in",
"the",
"first",
"string",
"s",
"that",
"can",
"be",
"aligned",
"with",
"the",
"i",
"-",
"th",
"character",
"in",
"the",
"second",
"string",
"t",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/ApproxNeedlemanWunsch.java#L59-L76 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/CircuitBreaker.java | CircuitBreaker.withFailureThreshold | public synchronized CircuitBreaker<R> withFailureThreshold(int failures, int executions) {
"""
Sets the ratio of successive failures that must occur when in a closed state in order to open the circuit. For
example: 5, 10 would open the circuit if 5 out of the last 10 executions result in a failure. The circuit wi... | java | public synchronized CircuitBreaker<R> withFailureThreshold(int failures, int executions) {
Assert.isTrue(failures >= 1, "failures must be greater than or equal to 1");
Assert.isTrue(executions >= 1, "executions must be greater than or equal to 1");
Assert.isTrue(executions >= failures, "executions must be g... | [
"public",
"synchronized",
"CircuitBreaker",
"<",
"R",
">",
"withFailureThreshold",
"(",
"int",
"failures",
",",
"int",
"executions",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"failures",
">=",
"1",
",",
"\"failures must be greater than or equal to 1\"",
")",
";",
"A... | Sets the ratio of successive failures that must occur when in a closed state in order to open the circuit. For
example: 5, 10 would open the circuit if 5 out of the last 10 executions result in a failure. The circuit will not
be opened until at least the given number of {@code executions} have taken place.
@param fail... | [
"Sets",
"the",
"ratio",
"of",
"successive",
"failures",
"that",
"must",
"occur",
"when",
"in",
"a",
"closed",
"state",
"in",
"order",
"to",
"open",
"the",
"circuit",
".",
"For",
"example",
":",
"5",
"10",
"would",
"open",
"the",
"circuit",
"if",
"5",
"... | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/CircuitBreaker.java#L313-L320 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.reconcileSealOperation | private CompletableFuture<WriterFlushResult> reconcileSealOperation(SegmentProperties storageInfo, Duration timeout) {
"""
Attempts to reconcile a StreamSegmentSealOperation.
@param storageInfo The current state of the Segment in Storage.
@param timeout Timeout for the operation.
@return A CompletableFutu... | java | private CompletableFuture<WriterFlushResult> reconcileSealOperation(SegmentProperties storageInfo, Duration timeout) {
// All we need to do is verify that the Segment is actually sealed in Storage. An exception to this rule is when
// the segment has a length of 0, which means it may not have been creat... | [
"private",
"CompletableFuture",
"<",
"WriterFlushResult",
">",
"reconcileSealOperation",
"(",
"SegmentProperties",
"storageInfo",
",",
"Duration",
"timeout",
")",
"{",
"// All we need to do is verify that the Segment is actually sealed in Storage. An exception to this rule is when",
"/... | Attempts to reconcile a StreamSegmentSealOperation.
@param storageInfo The current state of the Segment in Storage.
@param timeout Timeout for the operation.
@return A CompletableFuture containing a FlushResult with the number of bytes reconciled, or failed with a ReconciliationFailureException,
if the operation c... | [
"Attempts",
"to",
"reconcile",
"a",
"StreamSegmentSealOperation",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1464-L1480 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.getPhi | public static final double getPhi(AminoAcid a, AminoAcid b)
throws StructureException {
"""
Calculate the phi angle.
@param a
an AminoAcid object
@param b
an AminoAcid object
@return a double
@throws StructureException
if aminoacids not connected or if any of the 4 needed atoms
missing
"""
if (... | java | public static final double getPhi(AminoAcid a, AminoAcid b)
throws StructureException {
if ( ! isConnected(a,b)){
throw new StructureException(
"can not calc Phi - AminoAcids are not connected!");
}
Atom a_C = a.getC();
Atom b_N = b.getN();
Atom b_CA = b.getCA();
Atom b_C = b.getC();
// C... | [
"public",
"static",
"final",
"double",
"getPhi",
"(",
"AminoAcid",
"a",
",",
"AminoAcid",
"b",
")",
"throws",
"StructureException",
"{",
"if",
"(",
"!",
"isConnected",
"(",
"a",
",",
"b",
")",
")",
"{",
"throw",
"new",
"StructureException",
"(",
"\"can not... | Calculate the phi angle.
@param a
an AminoAcid object
@param b
an AminoAcid object
@return a double
@throws StructureException
if aminoacids not connected or if any of the 4 needed atoms
missing | [
"Calculate",
"the",
"phi",
"angle",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L275-L294 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java | NetworkUtils.getLearningRate | public static Double getLearningRate(ComputationGraph net, String layerName) {
"""
Get the current learning rate, for the specified layer, from the network.
Note: If the layer has no learning rate (no parameters, or an updater without a learning rate) then null is returned
@param net Network
@param laye... | java | public static Double getLearningRate(ComputationGraph net, String layerName) {
Layer l = net.getLayer(layerName).conf().getLayer();
int iter = net.getConfiguration().getIterationCount();
int epoch = net.getConfiguration().getEpochCount();
if (l instanceof BaseLayer) {
BaseLay... | [
"public",
"static",
"Double",
"getLearningRate",
"(",
"ComputationGraph",
"net",
",",
"String",
"layerName",
")",
"{",
"Layer",
"l",
"=",
"net",
".",
"getLayer",
"(",
"layerName",
")",
".",
"conf",
"(",
")",
".",
"getLayer",
"(",
")",
";",
"int",
"iter",... | Get the current learning rate, for the specified layer, from the network.
Note: If the layer has no learning rate (no parameters, or an updater without a learning rate) then null is returned
@param net Network
@param layerName Layer name to get the learning rate for
@return Learning rate for the specified layer,... | [
"Get",
"the",
"current",
"learning",
"rate",
"for",
"the",
"specified",
"layer",
"from",
"the",
"network",
".",
"Note",
":",
"If",
"the",
"layer",
"has",
"no",
"learning",
"rate",
"(",
"no",
"parameters",
"or",
"an",
"updater",
"without",
"a",
"learning",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java#L325-L342 |
square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java | SpoonUtils.obtainRealDevice | static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
"""
Fetch or create a real device that corresponds to a device model.
"""
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevic... | java | static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice;
}
}
throw new IllegalArgumentException("Unknown device serial: " +... | [
"static",
"IDevice",
"obtainRealDevice",
"(",
"AndroidDebugBridge",
"adb",
",",
"String",
"serial",
")",
"{",
"// Get an existing real device.",
"for",
"(",
"IDevice",
"adbDevice",
":",
"adb",
".",
"getDevices",
"(",
")",
")",
"{",
"if",
"(",
"adbDevice",
".",
... | Fetch or create a real device that corresponds to a device model. | [
"Fetch",
"or",
"create",
"a",
"real",
"device",
"that",
"corresponds",
"to",
"a",
"device",
"model",
"."
] | train | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java#L51-L59 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java | CareWebUtil.associateCSH | public static void associateCSH(BaseUIComponent component, HelpContext context) {
"""
Associates help context with a component.
@param component The component.
@param context The help context.
"""
HelpUtil.associateCSH(component, context, getShell());
} | java | public static void associateCSH(BaseUIComponent component, HelpContext context) {
HelpUtil.associateCSH(component, context, getShell());
} | [
"public",
"static",
"void",
"associateCSH",
"(",
"BaseUIComponent",
"component",
",",
"HelpContext",
"context",
")",
"{",
"HelpUtil",
".",
"associateCSH",
"(",
"component",
",",
"context",
",",
"getShell",
"(",
")",
")",
";",
"}"
] | Associates help context with a component.
@param component The component.
@param context The help context. | [
"Associates",
"help",
"context",
"with",
"a",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java#L135-L137 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuantilesHelper.java | QuantilesHelper.chunkContainingPos | public static int chunkContainingPos(final long[] arr, final long pos) {
"""
This is written in terms of a plain array to facilitate testing.
@param arr the chunk containing the position
@param pos the position
@return the index of the chunk containing the position
"""
final int nominalLength = arr.leng... | java | public static int chunkContainingPos(final long[] arr, final long pos) {
final int nominalLength = arr.length - 1; /* remember, arr contains an "extra" position */
assert nominalLength > 0;
final long n = arr[nominalLength];
assert 0 <= pos;
assert pos < n;
final int l = 0;
final int r = nom... | [
"public",
"static",
"int",
"chunkContainingPos",
"(",
"final",
"long",
"[",
"]",
"arr",
",",
"final",
"long",
"pos",
")",
"{",
"final",
"int",
"nominalLength",
"=",
"arr",
".",
"length",
"-",
"1",
";",
"/* remember, arr contains an \"extra\" position */",
"asser... | This is written in terms of a plain array to facilitate testing.
@param arr the chunk containing the position
@param pos the position
@return the index of the chunk containing the position | [
"This",
"is",
"written",
"in",
"terms",
"of",
"a",
"plain",
"array",
"to",
"facilitate",
"testing",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuantilesHelper.java#L46-L60 |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.setJobManagerAddressInConfig | static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) {
"""
Writes the given job manager address to the associated configuration object.
@param address Address to write to the configuration
@param config The configuration to write to
"""
config.setString(JobManagerOpti... | java | static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) {
config.setString(JobManagerOptions.ADDRESS, address.getHostString());
config.setInteger(JobManagerOptions.PORT, address.getPort());
config.setString(RestOptions.ADDRESS, address.getHostString());
config.setInteger(RestOp... | [
"static",
"void",
"setJobManagerAddressInConfig",
"(",
"Configuration",
"config",
",",
"InetSocketAddress",
"address",
")",
"{",
"config",
".",
"setString",
"(",
"JobManagerOptions",
".",
"ADDRESS",
",",
"address",
".",
"getHostString",
"(",
")",
")",
";",
"config... | Writes the given job manager address to the associated configuration object.
@param address Address to write to the configuration
@param config The configuration to write to | [
"Writes",
"the",
"given",
"job",
"manager",
"address",
"to",
"the",
"associated",
"configuration",
"object",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L1103-L1108 |
Pi4J/pi4j | pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java | AdcGpioProviderBase.setEventThreshold | @Override
public void setEventThreshold(double threshold, GpioPinAnalogInput...pin) {
"""
Set the event threshold value for a given analog input pin.
The event threshold value determines how much change in the
analog input pin's conversion value must occur before the
framework issues an analog input pin c... | java | @Override
public void setEventThreshold(double threshold, GpioPinAnalogInput...pin){
for(GpioPin p : pin){
setEventThreshold(threshold, p.getPin());
}
} | [
"@",
"Override",
"public",
"void",
"setEventThreshold",
"(",
"double",
"threshold",
",",
"GpioPinAnalogInput",
"...",
"pin",
")",
"{",
"for",
"(",
"GpioPin",
"p",
":",
"pin",
")",
"{",
"setEventThreshold",
"(",
"threshold",
",",
"p",
".",
"getPin",
"(",
")... | Set the event threshold value for a given analog input pin.
The event threshold value determines how much change in the
analog input pin's conversion value must occur before the
framework issues an analog input pin change event. A threshold
is necessary to prevent a significant number of analog input
change events fr... | [
"Set",
"the",
"event",
"threshold",
"value",
"for",
"a",
"given",
"analog",
"input",
"pin",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L258-L263 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/CommonSteps.java | CommonSteps.doUntil | @Lorsque("Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:")
@Then("If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:")
public void doUntil(String actual, String expected, String key, String breakCondition, int tries, List<GherkinCondit... | java | @Lorsque("Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:")
@Then("If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:")
public void doUntil(String actual, String expected, String key, String breakCondition, int tries, List<GherkinCondit... | [
"@",
"Lorsque",
"(",
"\"Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:\")\r",
"",
"@",
"Then",
"(",
"\"If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:\"",
")",
"public",
"void",
"doUntil",
"(",
"String",
"act... | Does steps execution until a given condition is unverified.
@param actual
actual value for global condition.
@param expected
expected value for global condition.
@param key
key of 'expected' values ('actual' values)
@param breakCondition
'expected' values
@param tries
number of max tries (no infinity loop).
@param con... | [
"Does",
"steps",
"execution",
"until",
"a",
"given",
"condition",
"is",
"unverified",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L160-L174 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java | HttpFields.formatDate | public static String formatDate(StringBuffer buf, long date, boolean cookie) {
"""
Format HTTP date
"EEE, dd MMM yyyy HH:mm:ss 'GMT'" or
"EEE, dd-MMM-yy HH:mm:ss 'GMT'"for cookies
"""
HttpCal gc = new HttpCal();
gc.setTimeInMillis(date);
formatDate(buf,gc,cookie);
return buf.t... | java | public static String formatDate(StringBuffer buf, long date, boolean cookie)
{
HttpCal gc = new HttpCal();
gc.setTimeInMillis(date);
formatDate(buf,gc,cookie);
return buf.toString();
} | [
"public",
"static",
"String",
"formatDate",
"(",
"StringBuffer",
"buf",
",",
"long",
"date",
",",
"boolean",
"cookie",
")",
"{",
"HttpCal",
"gc",
"=",
"new",
"HttpCal",
"(",
")",
";",
"gc",
".",
"setTimeInMillis",
"(",
"date",
")",
";",
"formatDate",
"("... | Format HTTP date
"EEE, dd MMM yyyy HH:mm:ss 'GMT'" or
"EEE, dd-MMM-yy HH:mm:ss 'GMT'"for cookies | [
"Format",
"HTTP",
"date",
"EEE",
"dd",
"MMM",
"yyyy",
"HH",
":",
"mm",
":",
"ss",
"GMT",
"or",
"EEE",
"dd",
"-",
"MMM",
"-",
"yy",
"HH",
":",
"mm",
":",
"ss",
"GMT",
"for",
"cookies"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java#L343-L349 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.threadInfo | public static void threadInfo(final Map<String, Object> infos) {
"""
Collects system information as delivered from the {@link ThreadMXBean}.
@param infos a map where the infos are passed in.
"""
infos.put("thread.count", THREAD_BEAN.getThreadCount());
infos.put("thread.peakCount", THREAD_BEA... | java | public static void threadInfo(final Map<String, Object> infos) {
infos.put("thread.count", THREAD_BEAN.getThreadCount());
infos.put("thread.peakCount", THREAD_BEAN.getPeakThreadCount());
infos.put("thread.startedCount", THREAD_BEAN.getTotalStartedThreadCount());
} | [
"public",
"static",
"void",
"threadInfo",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
")",
"{",
"infos",
".",
"put",
"(",
"\"thread.count\"",
",",
"THREAD_BEAN",
".",
"getThreadCount",
"(",
")",
")",
";",
"infos",
".",
"put",
"(",
... | Collects system information as delivered from the {@link ThreadMXBean}.
@param infos a map where the infos are passed in. | [
"Collects",
"system",
"information",
"as",
"delivered",
"from",
"the",
"{",
"@link",
"ThreadMXBean",
"}",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L125-L129 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/PathMappingResult.java | PathMappingResult.of | public static PathMappingResult of(String path, @Nullable String query, Map<String, String> rawPathParams) {
"""
Creates a new instance with the specified {@code path}, {@code query} and the extracted path parameters.
"""
return of(path, query, rawPathParams, LOWEST_SCORE);
} | java | public static PathMappingResult of(String path, @Nullable String query, Map<String, String> rawPathParams) {
return of(path, query, rawPathParams, LOWEST_SCORE);
} | [
"public",
"static",
"PathMappingResult",
"of",
"(",
"String",
"path",
",",
"@",
"Nullable",
"String",
"query",
",",
"Map",
"<",
"String",
",",
"String",
">",
"rawPathParams",
")",
"{",
"return",
"of",
"(",
"path",
",",
"query",
",",
"rawPathParams",
",",
... | Creates a new instance with the specified {@code path}, {@code query} and the extracted path parameters. | [
"Creates",
"a",
"new",
"instance",
"with",
"the",
"specified",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/PathMappingResult.java#L66-L68 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.getDomainConfig | public GetDomainConfigResponse getDomainConfig(GetDomainConfigRequest request) {
"""
Get detailed information of a domain.
@param request The request containing all of the options related to the domain.
@return getDomainConfig of the getDomainConfig operation returned by the service.
"""
checkNotNu... | java | public GetDomainConfigResponse getDomainConfig(GetDomainConfigRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.GET, DOMAIN, request.getDomain(), "config");
return invokeHttpClient(intern... | [
"public",
"GetDomainConfigResponse",
"getDomainConfig",
"(",
"GetDomainConfigRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"reques... | Get detailed information of a domain.
@param request The request containing all of the options related to the domain.
@return getDomainConfig of the getDomainConfig operation returned by the service. | [
"Get",
"detailed",
"information",
"of",
"a",
"domain",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L291-L295 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/ArrayUtils.java | ArrayUtils.findOne | public static <T> T findOne(T[] array, Filter<T> filter) {
"""
Searches the array for the first element accepted by the {@link Filter}.
@param <T> Class type of the elements in the array.
@param array array to search.
@param filter {@link Filter} used to find the first element in the array accepted by the {@l... | java | public static <T> T findOne(T[] array, Filter<T> filter) {
Assert.notNull(filter, "Filter is required");
return stream(nullSafeArray(array)).filter(filter::accept).findFirst().orElse(null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findOne",
"(",
"T",
"[",
"]",
"array",
",",
"Filter",
"<",
"T",
">",
"filter",
")",
"{",
"Assert",
".",
"notNull",
"(",
"filter",
",",
"\"Filter is required\"",
")",
";",
"return",
"stream",
"(",
"nullSafeArray"... | Searches the array for the first element accepted by the {@link Filter}.
@param <T> Class type of the elements in the array.
@param array array to search.
@param filter {@link Filter} used to find the first element in the array accepted by the {@link Filter}.
@return the first element from the array accepted by the {@... | [
"Searches",
"the",
"array",
"for",
"the",
"first",
"element",
"accepted",
"by",
"the",
"{",
"@link",
"Filter",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L408-L413 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicy_binding.java | appflowpolicy_binding.get | public static appflowpolicy_binding get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch appflowpolicy_binding resource of given name .
"""
appflowpolicy_binding obj = new appflowpolicy_binding();
obj.set_name(name);
appflowpolicy_binding response = (appflowpolicy_binding)... | java | public static appflowpolicy_binding get(nitro_service service, String name) throws Exception{
appflowpolicy_binding obj = new appflowpolicy_binding();
obj.set_name(name);
appflowpolicy_binding response = (appflowpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appflowpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appflowpolicy_binding",
"obj",
"=",
"new",
"appflowpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
... | Use this API to fetch appflowpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appflowpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicy_binding.java#L136-L141 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/fs/Node.java | Node.copyDirectory | public List<Node> copyDirectory(Node destdir, Filter filter) throws DirectoryNotFoundException, CopyException {
"""
Throws an exception is this or dest is not a directory. Overwrites existing files in dest.
@return list of files and directories created
"""
return new Copy(this, filter).directory(destd... | java | public List<Node> copyDirectory(Node destdir, Filter filter) throws DirectoryNotFoundException, CopyException {
return new Copy(this, filter).directory(destdir);
} | [
"public",
"List",
"<",
"Node",
">",
"copyDirectory",
"(",
"Node",
"destdir",
",",
"Filter",
"filter",
")",
"throws",
"DirectoryNotFoundException",
",",
"CopyException",
"{",
"return",
"new",
"Copy",
"(",
"this",
",",
"filter",
")",
".",
"directory",
"(",
"de... | Throws an exception is this or dest is not a directory. Overwrites existing files in dest.
@return list of files and directories created | [
"Throws",
"an",
"exception",
"is",
"this",
"or",
"dest",
"is",
"not",
"a",
"directory",
".",
"Overwrites",
"existing",
"files",
"in",
"dest",
"."
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L776-L778 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/metric/JStormMetricsReporter.java | JStormMetricsReporter.updateMetricMeta | public void updateMetricMeta(Map<String, Long> nameIdMap) {
"""
Register metric meta callback. Called in SpoutExecutors/BoltExecutors within topology workers.
JStormMetricsReporter first sends a TOPOLOGY_MASTER_REGISTER_METRICS_STREAM_ID stream to TM to register metrics,
on success TM will return a TOPOLOGY_MA... | java | public void updateMetricMeta(Map<String, Long> nameIdMap) {
if (nameIdMap != null) {
for (String name : nameIdMap.keySet()) {
AsmMetric metric = JStormMetrics.find(name);
if (metric != null) {
long id = nameIdMap.get(name);
metr... | [
"public",
"void",
"updateMetricMeta",
"(",
"Map",
"<",
"String",
",",
"Long",
">",
"nameIdMap",
")",
"{",
"if",
"(",
"nameIdMap",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"name",
":",
"nameIdMap",
".",
"keySet",
"(",
")",
")",
"{",
"AsmMetric",
... | Register metric meta callback. Called in SpoutExecutors/BoltExecutors within topology workers.
JStormMetricsReporter first sends a TOPOLOGY_MASTER_REGISTER_METRICS_STREAM_ID stream to TM to register metrics,
on success TM will return a TOPOLOGY_MASTER_REGISTER_METRICS_RESP_STREAM_ID stream which contains
registered me... | [
"Register",
"metric",
"meta",
"callback",
".",
"Called",
"in",
"SpoutExecutors",
"/",
"BoltExecutors",
"within",
"topology",
"workers",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/metric/JStormMetricsReporter.java#L447-L459 |
aws/aws-sdk-java | aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectDescription.java | ProjectDescription.withTags | public ProjectDescription withTags(java.util.Map<String, String> tags) {
"""
<p>
The tags (metadata key/value pairs) associated with the project.
</p>
@param tags
The tags (metadata key/value pairs) associated with the project.
@return Returns a reference to this object so that method calls can be chained t... | java | public ProjectDescription withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"ProjectDescription",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags (metadata key/value pairs) associated with the project.
</p>
@param tags
The tags (metadata key/value pairs) associated with the project.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"(",
"metadata",
"key",
"/",
"value",
"pairs",
")",
"associated",
"with",
"the",
"project",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectDescription.java#L356-L359 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstruction | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, InstructionHandle handle) {
"""
Create from Method and InstructionHandle in a visited class.
@param classContext
ClassContext of visited class
@param method
Method in visited class
@param handle
InstructionH... | java | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, InstructionHandle handle) {
return fromVisitedInstruction(classContext, method, handle.getPosition());
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstruction",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
",",
"InstructionHandle",
"handle",
")",
"{",
"return",
"fromVisitedInstruction",
"(",
"classContext",
",",
"method",
",",
"handle",
".",
... | Create from Method and InstructionHandle in a visited class.
@param classContext
ClassContext of visited class
@param method
Method in visited class
@param handle
InstructionHandle in visited class
@return SourceLineAnnotation describing visited instruction | [
"Create",
"from",
"Method",
"and",
"InstructionHandle",
"in",
"a",
"visited",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L414-L416 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | MultiUserChat.changeAffiliationByAdmin | private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Tries to change the affiliation with an 'muc#admin' namespace
@param jid
@param affiliation
@param reason the reason for t... | java | private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.set);
// Set the new affiliation.
... | [
"private",
"void",
"changeAffiliationByAdmin",
"(",
"Jid",
"jid",
",",
"MUCAffiliation",
"affiliation",
",",
"String",
"reason",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"MUCAdmin",
... | Tries to change the affiliation with an 'muc#admin' namespace
@param jid
@param affiliation
@param reason the reason for the affiliation change (optional)
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Tries",
"to",
"change",
"the",
"affiliation",
"with",
"an",
"muc#admin",
"namespace"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1614-L1623 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/TagDescriptor.java | TagDescriptor.getBitFlagDescription | @Nullable
protected String getBitFlagDescription(final int tagType, @NotNull final Object... labels) {
"""
LSB first. Labels may be null, a String, or a String[2] with (low label,high label) values.
"""
Integer value = _directory.getInteger(tagType);
if (value == null)
return n... | java | @Nullable
protected String getBitFlagDescription(final int tagType, @NotNull final Object... labels)
{
Integer value = _directory.getInteger(tagType);
if (value == null)
return null;
List<String> parts = new ArrayList<String>();
int bitIndex = 0;
while (lab... | [
"@",
"Nullable",
"protected",
"String",
"getBitFlagDescription",
"(",
"final",
"int",
"tagType",
",",
"@",
"NotNull",
"final",
"Object",
"...",
"labels",
")",
"{",
"Integer",
"value",
"=",
"_directory",
".",
"getInteger",
"(",
"tagType",
")",
";",
"if",
"(",... | LSB first. Labels may be null, a String, or a String[2] with (low label,high label) values. | [
"LSB",
"first",
".",
"Labels",
"may",
"be",
"null",
"a",
"String",
"or",
"a",
"String",
"[",
"2",
"]",
"with",
"(",
"low",
"label",
"high",
"label",
")",
"values",
"."
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/TagDescriptor.java#L222-L250 |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optBoolean | public boolean optBoolean(int index) {
"""
Returns the boolean value stored at the given index or null if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is ... | java | public boolean optBoolean(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return false;
if(token.type==LazyNode.VALUE_NULL)return false;
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a... | [
"public",
"boolean",
"optBoolean",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",... | Returns the boolean value stored at the given index or null if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"boolean",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"null",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | train | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L514-L521 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/util/Reflection.java | Reflection.constructorMethodHandle | public static MethodHandle constructorMethodHandle(Class<?> clazz, Class<?>... parameterTypes) {
"""
Returns a MethodHandle corresponding to the specified constructor.
<p>
Warning: The way Oracle JVM implements producing MethodHandle for a constructor involves
creating JNI global weak references. G1 processes s... | java | public static MethodHandle constructorMethodHandle(Class<?> clazz, Class<?>... parameterTypes)
{
return constructorMethodHandle(GENERIC_INTERNAL_ERROR, clazz, parameterTypes);
} | [
"public",
"static",
"MethodHandle",
"constructorMethodHandle",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"return",
"constructorMethodHandle",
"(",
"GENERIC_INTERNAL_ERROR",
",",
"clazz",
",",
"parameterTy... | Returns a MethodHandle corresponding to the specified constructor.
<p>
Warning: The way Oracle JVM implements producing MethodHandle for a constructor involves
creating JNI global weak references. G1 processes such references serially. As a result,
calling this method in a tight loop can create significant GC pressure ... | [
"Returns",
"a",
"MethodHandle",
"corresponding",
"to",
"the",
"specified",
"constructor",
".",
"<p",
">",
"Warning",
":",
"The",
"way",
"Oracle",
"JVM",
"implements",
"producing",
"MethodHandle",
"for",
"a",
"constructor",
"involves",
"creating",
"JNI",
"global",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/Reflection.java#L108-L111 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java | ExtensionHttpSessions.addHttpSessionToken | public void addHttpSessionToken(String site, String token) {
"""
Adds a new session token for a particular site.
@param site the site. This parameter has to be formed as defined in the
{@link ExtensionHttpSessions} class documentation. However, if the protocol is
missing, a default protocol of 80 is used.
@p... | java | public void addHttpSessionToken(String site, String token) {
// Add a default port
if (!site.contains(":")) {
site = site + (":80");
}
HttpSessionTokensSet siteTokens = sessionTokens.get(site);
if (siteTokens == null) {
siteTokens = new HttpSessionTokensSet();
sessionTokens.put(site, siteTokens);
}... | [
"public",
"void",
"addHttpSessionToken",
"(",
"String",
"site",
",",
"String",
"token",
")",
"{",
"// Add a default port",
"if",
"(",
"!",
"site",
".",
"contains",
"(",
"\":\"",
")",
")",
"{",
"site",
"=",
"site",
"+",
"(",
"\":80\"",
")",
";",
"}",
"H... | Adds a new session token for a particular site.
@param site the site. This parameter has to be formed as defined in the
{@link ExtensionHttpSessions} class documentation. However, if the protocol is
missing, a default protocol of 80 is used.
@param token the token | [
"Adds",
"a",
"new",
"session",
"token",
"for",
"a",
"particular",
"site",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java#L380-L398 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.