repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/util/intern/DOMHelper.java | DOMHelper.nodesAreEqual | public static boolean nodesAreEqual(final Node a, final Node b) {
if (a == b) {
return true;
}
if ((a == null) || (b == null)) {
return false;
}
if (!Arrays.equals(getNodeAttributes(a), getNodeAttributes(b))) {
return false;
}
if (!namedNodeMapsAreEqual(a.getAttributes(), b.getAttributes())) {
return false;
}
if (!nodeListsAreEqual(a.getChildNodes(), b.getChildNodes())) {
return false;
}
return true;
} | java | public static boolean nodesAreEqual(final Node a, final Node b) {
if (a == b) {
return true;
}
if ((a == null) || (b == null)) {
return false;
}
if (!Arrays.equals(getNodeAttributes(a), getNodeAttributes(b))) {
return false;
}
if (!namedNodeMapsAreEqual(a.getAttributes(), b.getAttributes())) {
return false;
}
if (!nodeListsAreEqual(a.getChildNodes(), b.getChildNodes())) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"nodesAreEqual",
"(",
"final",
"Node",
"a",
",",
"final",
"Node",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"b",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"(",
"a",
"==",
"null",
")",
"||",
"(",
"b",
"==",
"null... | Implementation independent version of the Node.isEqualNode() method. Matches the same
algorithm as the nodeHashCode method. <br>
Two nodes are equal if and only if the following conditions are satisfied:
<ul>
<li>The two nodes are of the same type.</li>
<li>The following string attributes are equal: <code>nodeName</code>, <code>localName</code>,
<code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code> . This is: they are
both <code>null</code>, or they have the same length and are character for character
identical.</li>
<li>The <code>attributes</code> <code>NamedNodeMaps</code> are equal. This is: they are both
<code>null</code>, or they have the same length and for each node that exists in one map
there is a node that exists in the other map and is equal, although not necessarily at the
same index.</li>
<li>The <code>childNodes</code> <code>NodeLists</code> are equal. This is: they are both
<code>null</code>, or they have the same length and contain equal nodes at the same index.
Note that normalization can affect equality; to avoid this, nodes should be normalized before
being compared.</li>
</ul>
<br>
For two <code>DocumentType</code> nodes to be equal, the following conditions must also be
satisfied:
<ul>
<li>The following string attributes are equal: <code>publicId</code>, <code>systemId</code>,
<code>internalSubset</code>.</li>
<li>The <code>entities</code> <code>NamedNodeMaps</code> are equal.</li>
<li>The <code>notations</code> <code>NamedNodeMaps</code> are equal.</li>
</ul>
@param a
@param b
@return true if and only if the nodes are equal in the manner explained above | [
"Implementation",
"independent",
"version",
"of",
"the",
"Node",
".",
"isEqualNode",
"()",
"method",
".",
"Matches",
"the",
"same",
"algorithm",
"as",
"the",
"nodeHashCode",
"method",
".",
"<br",
">",
"Two",
"nodes",
"are",
"equal",
"if",
"and",
"only",
"if"... | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/intern/DOMHelper.java#L202-L219 |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/component/util/MtasSolrResultMerge.java | MtasSolrResultMerge.mergeResponsesSortedSet | private void mergeResponsesSortedSet(SortedSet<Object> originalList, SortedSet<Object> shardList) {
for (Object item : shardList) {
originalList.add(item);
}
} | java | private void mergeResponsesSortedSet(SortedSet<Object> originalList, SortedSet<Object> shardList) {
for (Object item : shardList) {
originalList.add(item);
}
} | [
"private",
"void",
"mergeResponsesSortedSet",
"(",
"SortedSet",
"<",
"Object",
">",
"originalList",
",",
"SortedSet",
"<",
"Object",
">",
"shardList",
")",
"{",
"for",
"(",
"Object",
"item",
":",
"shardList",
")",
"{",
"originalList",
".",
"add",
"(",
"item"... | Merge responses sorted set.
@param originalList
the original list
@param shardList
the shard list | [
"Merge",
"responses",
"sorted",
"set",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrResultMerge.java#L239-L243 |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java | PublicationManagerImpl.restoreQueuedSubscription | private void restoreQueuedSubscription(String providerId, ProviderContainer providerContainer) {
Collection<PublicationInformation> queuedRequests = queuedSubscriptionRequests.get(providerId);
Iterator<PublicationInformation> queuedRequestsIterator = queuedRequests.iterator();
while (queuedRequestsIterator.hasNext()) {
PublicationInformation publicationInformation = queuedRequestsIterator.next();
queuedRequestsIterator.remove();
if (!isExpired(publicationInformation)) {
addSubscriptionRequest(publicationInformation.getProxyParticipantId(),
publicationInformation.getProviderParticipantId(),
publicationInformation.subscriptionRequest,
providerContainer);
}
}
} | java | private void restoreQueuedSubscription(String providerId, ProviderContainer providerContainer) {
Collection<PublicationInformation> queuedRequests = queuedSubscriptionRequests.get(providerId);
Iterator<PublicationInformation> queuedRequestsIterator = queuedRequests.iterator();
while (queuedRequestsIterator.hasNext()) {
PublicationInformation publicationInformation = queuedRequestsIterator.next();
queuedRequestsIterator.remove();
if (!isExpired(publicationInformation)) {
addSubscriptionRequest(publicationInformation.getProxyParticipantId(),
publicationInformation.getProviderParticipantId(),
publicationInformation.subscriptionRequest,
providerContainer);
}
}
} | [
"private",
"void",
"restoreQueuedSubscription",
"(",
"String",
"providerId",
",",
"ProviderContainer",
"providerContainer",
")",
"{",
"Collection",
"<",
"PublicationInformation",
">",
"queuedRequests",
"=",
"queuedSubscriptionRequests",
".",
"get",
"(",
"providerId",
")",... | Called every time a provider is registered to check whether there are already
subscriptionRequests waiting.
@param providerId provider id
@param providerContainer provider container | [
"Called",
"every",
"time",
"a",
"provider",
"is",
"registered",
"to",
"check",
"whether",
"there",
"are",
"already",
"subscriptionRequests",
"waiting",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java#L602-L615 |
auth0/jwks-rsa-java | src/main/java/com/auth0/jwk/Jwk.java | Jwk.getPublicKey | @SuppressWarnings("WeakerAccess")
public PublicKey getPublicKey() throws InvalidPublicKeyException {
if (!PUBLIC_KEY_ALGORITHM.equalsIgnoreCase(type)) {
throw new InvalidPublicKeyException("The key is not of type RSA", null);
}
try {
KeyFactory kf = KeyFactory.getInstance(PUBLIC_KEY_ALGORITHM);
BigInteger modulus = new BigInteger(1, Base64.decodeBase64(stringValue("n")));
BigInteger exponent = new BigInteger(1, Base64.decodeBase64(stringValue("e")));
return kf.generatePublic(new RSAPublicKeySpec(modulus, exponent));
} catch (InvalidKeySpecException e) {
throw new InvalidPublicKeyException("Invalid public key", e);
} catch (NoSuchAlgorithmException e) {
throw new InvalidPublicKeyException("Invalid algorithm to generate key", e);
}
} | java | @SuppressWarnings("WeakerAccess")
public PublicKey getPublicKey() throws InvalidPublicKeyException {
if (!PUBLIC_KEY_ALGORITHM.equalsIgnoreCase(type)) {
throw new InvalidPublicKeyException("The key is not of type RSA", null);
}
try {
KeyFactory kf = KeyFactory.getInstance(PUBLIC_KEY_ALGORITHM);
BigInteger modulus = new BigInteger(1, Base64.decodeBase64(stringValue("n")));
BigInteger exponent = new BigInteger(1, Base64.decodeBase64(stringValue("e")));
return kf.generatePublic(new RSAPublicKeySpec(modulus, exponent));
} catch (InvalidKeySpecException e) {
throw new InvalidPublicKeyException("Invalid public key", e);
} catch (NoSuchAlgorithmException e) {
throw new InvalidPublicKeyException("Invalid algorithm to generate key", e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"PublicKey",
"getPublicKey",
"(",
")",
"throws",
"InvalidPublicKeyException",
"{",
"if",
"(",
"!",
"PUBLIC_KEY_ALGORITHM",
".",
"equalsIgnoreCase",
"(",
"type",
")",
")",
"{",
"throw",
"new",
"Invali... | Returns a {@link PublicKey} if the {@code 'alg'} is {@code 'RSA'}
@return a public key
@throws InvalidPublicKeyException if the key cannot be built or the key type is not RSA | [
"Returns",
"a",
"{",
"@link",
"PublicKey",
"}",
"if",
"the",
"{",
"@code",
"alg",
"}",
"is",
"{",
"@code",
"RSA",
"}"
] | train | https://github.com/auth0/jwks-rsa-java/blob/9deba212be4278e50ae75a54b3bc6c96359b7e69/src/main/java/com/auth0/jwk/Jwk.java#L167-L182 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/cfg/JtaProcessEngineConfiguration.java | JtaProcessEngineConfiguration.initCommandExecutorDbSchemaOperations | @Override
protected void initCommandExecutorDbSchemaOperations() {
if(commandExecutorSchemaOperations == null) {
List<CommandInterceptor> commandInterceptorsDbSchemaOperations = new ArrayList<CommandInterceptor>();
commandInterceptorsDbSchemaOperations.add(new LogInterceptor());
commandInterceptorsDbSchemaOperations.add(new CommandContextInterceptor(dbSchemaOperationsCommandContextFactory, this));
commandInterceptorsDbSchemaOperations.add(actualCommandExecutor);
commandExecutorSchemaOperations = initInterceptorChain(commandInterceptorsDbSchemaOperations);
}
} | java | @Override
protected void initCommandExecutorDbSchemaOperations() {
if(commandExecutorSchemaOperations == null) {
List<CommandInterceptor> commandInterceptorsDbSchemaOperations = new ArrayList<CommandInterceptor>();
commandInterceptorsDbSchemaOperations.add(new LogInterceptor());
commandInterceptorsDbSchemaOperations.add(new CommandContextInterceptor(dbSchemaOperationsCommandContextFactory, this));
commandInterceptorsDbSchemaOperations.add(actualCommandExecutor);
commandExecutorSchemaOperations = initInterceptorChain(commandInterceptorsDbSchemaOperations);
}
} | [
"@",
"Override",
"protected",
"void",
"initCommandExecutorDbSchemaOperations",
"(",
")",
"{",
"if",
"(",
"commandExecutorSchemaOperations",
"==",
"null",
")",
"{",
"List",
"<",
"CommandInterceptor",
">",
"commandInterceptorsDbSchemaOperations",
"=",
"new",
"ArrayList",
... | provide custom command executor that uses NON-JTA transactions | [
"provide",
"custom",
"command",
"executor",
"that",
"uses",
"NON",
"-",
"JTA",
"transactions"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/JtaProcessEngineConfiguration.java#L87-L96 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java | MultimapJoiner.appendTo | public StringBuilder appendTo(StringBuilder builder, Iterable<? extends Entry<?, ? extends Collection<?>>> entries) {
try {
appendTo((Appendable) builder, entries);
} catch (IOException impossible) {
throw new AssertionError(impossible);
}
return builder;
} | java | public StringBuilder appendTo(StringBuilder builder, Iterable<? extends Entry<?, ? extends Collection<?>>> entries) {
try {
appendTo((Appendable) builder, entries);
} catch (IOException impossible) {
throw new AssertionError(impossible);
}
return builder;
} | [
"public",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"builder",
",",
"Iterable",
"<",
"?",
"extends",
"Entry",
"<",
"?",
",",
"?",
"extends",
"Collection",
"<",
"?",
">",
">",
">",
"entries",
")",
"{",
"try",
"{",
"appendTo",
"(",
"(",
"Appendabl... | Appends the string representation of each entry in {@code entries}, using the previously configured separator and
key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Iterable)}, except that it
does not throw {@link IOException}. | [
"Appends",
"the",
"string",
"representation",
"of",
"each",
"entry",
"in",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java#L112-L119 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/JobsInner.java | JobsInner.getAsync | public Observable<JobInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
public JobInner call(ServiceResponse<JobInner> response) {
return response.body();
}
});
} | java | public Observable<JobInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
public JobInner call(ServiceResponse<JobInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
")",
".",... | Gets the details of a specified job on a data box edge/gateway device.
@param deviceName The device name.
@param name The job name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobInner object | [
"Gets",
"the",
"details",
"of",
"a",
"specified",
"job",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/JobsInner.java#L98-L105 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.LINK | public static HtmlTree LINK(String rel, String type, String href, String title) {
HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
return htmltree;
} | java | public static HtmlTree LINK(String rel, String type, String href, String title) {
HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"LINK",
"(",
"String",
"rel",
",",
"String",
"type",
",",
"String",
"href",
",",
"String",
"title",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"LINK",
")",
";",
"htmltree",
".",
"addAttr... | Generates a LINK tag with the rel, type, href and title attributes.
@param rel relevance of the link
@param type type of link
@param href the path for the link
@param title title for the link
@return an HtmlTree object for the LINK tag | [
"Generates",
"a",
"LINK",
"tag",
"with",
"the",
"rel",
"type",
"href",
"and",
"title",
"attributes",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L521-L528 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java | ManagedInstanceKeysInner.beginCreateOrUpdate | public ManagedInstanceKeyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().single().body();
} | java | public ManagedInstanceKeyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().single().body();
} | [
"public",
"ManagedInstanceKeyInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"keyName",
",",
"ManagedInstanceKeyInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates a managed instance key.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param keyName The name of the managed instance key to be operated on (updated or created).
@param parameters The requested managed instance key resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ManagedInstanceKeyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"managed",
"instance",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java#L528-L530 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java | ItemsNodeInterval.buildForExistingItems | public void buildForExistingItems(final Collection<Item> output, final UUID targetInvoiceId) {
// We start by pruning useless entries to simplify the build phase.
pruneAndValidateTree();
build(output, targetInvoiceId, false);
} | java | public void buildForExistingItems(final Collection<Item> output, final UUID targetInvoiceId) {
// We start by pruning useless entries to simplify the build phase.
pruneAndValidateTree();
build(output, targetInvoiceId, false);
} | [
"public",
"void",
"buildForExistingItems",
"(",
"final",
"Collection",
"<",
"Item",
">",
"output",
",",
"final",
"UUID",
"targetInvoiceId",
")",
"{",
"// We start by pruning useless entries to simplify the build phase.",
"pruneAndValidateTree",
"(",
")",
";",
"build",
"("... | <p/>
There is no limit in the depth of the tree,
and the build strategy is to first consider the lowest child for a given period
and go up the tree adding missing interval if needed. For e.g, one of the possible scenario:
<pre>
D1 D2
|---------------------------------------------------| Plan P1
D1' D2'
|---------------|/////////////////////////////| Plan P2, REPAIR
In that case we will generate:
[D1,D1') on Plan P1; [D1', D2') on Plan P2, and [D2', D2) repair item
<pre/>
In the merge mode, the strategy is different, the tree is fairly shallow
and the goal is to generate the repair items; @see addProposedItem
@param output result list of built items
@param targetInvoiceId | [
"<p",
"/",
">",
"There",
"is",
"no",
"limit",
"in",
"the",
"depth",
"of",
"the",
"tree",
"and",
"the",
"build",
"strategy",
"is",
"to",
"first",
"consider",
"the",
"lowest",
"child",
"for",
"a",
"given",
"period",
"and",
"go",
"up",
"the",
"tree",
"a... | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java#L117-L122 |
apiman/apiman | gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java | HttpURLConnectionImpl.setProtocols | private void setProtocols(String protocolsString, boolean append) {
List<Protocol> protocolsList = new ArrayList<>();
if (append) {
protocolsList.addAll(client.getProtocols());
}
for (String protocol : protocolsString.split(",", -1)) {
try {
protocolsList.add(Protocol.get(protocol));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
client.setProtocols(protocolsList);
} | java | private void setProtocols(String protocolsString, boolean append) {
List<Protocol> protocolsList = new ArrayList<>();
if (append) {
protocolsList.addAll(client.getProtocols());
}
for (String protocol : protocolsString.split(",", -1)) {
try {
protocolsList.add(Protocol.get(protocol));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
client.setProtocols(protocolsList);
} | [
"private",
"void",
"setProtocols",
"(",
"String",
"protocolsString",
",",
"boolean",
"append",
")",
"{",
"List",
"<",
"Protocol",
">",
"protocolsList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"append",
")",
"{",
"protocolsList",
".",
"addA... | /*
Splits and validates a comma-separated string of protocols.
When append == false, we require that the transport list contains "http/1.1".
Throws {@link IllegalStateException} when one of the protocols isn't
defined in {@link Protocol OkHttp's protocol enumeration}. | [
"/",
"*",
"Splits",
"and",
"validates",
"a",
"comma",
"-",
"separated",
"string",
"of",
"protocols",
".",
"When",
"append",
"==",
"false",
"we",
"require",
"that",
"the",
"transport",
"list",
"contains",
"http",
"/",
"1",
".",
"1",
".",
"Throws",
"{"
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java#L567-L580 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.multCol | public static void multCol(Matrix A, int j, double c)
{
multCol(A, j, 0, A.rows(), c);
} | java | public static void multCol(Matrix A, int j, double c)
{
multCol(A, j, 0, A.rows(), c);
} | [
"public",
"static",
"void",
"multCol",
"(",
"Matrix",
"A",
",",
"int",
"j",
",",
"double",
"c",
")",
"{",
"multCol",
"(",
"A",
",",
"j",
",",
"0",
",",
"A",
".",
"rows",
"(",
")",
",",
"c",
")",
";",
"}"
] | Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]* c
@param A the matrix to perform he update on
@param j the row to update
@param c the constant to multiply each element by | [
"Updates",
"the",
"values",
"of",
"column",
"<tt",
">",
"j<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
":",
"j",
"]",
"=",
"A",
"[",
":",
"j",
"]",
"*",
"c"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L217-L220 |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/TempFileList.java | TempFileList.createTempFile | public TempFile createTempFile() throws IOException {
TempFile tempFile = new TempFile(prefix, suffix, directory);
synchronized(tempFiles) {
tempFiles.add(new WeakReference<>(tempFile));
}
return tempFile;
} | java | public TempFile createTempFile() throws IOException {
TempFile tempFile = new TempFile(prefix, suffix, directory);
synchronized(tempFiles) {
tempFiles.add(new WeakReference<>(tempFile));
}
return tempFile;
} | [
"public",
"TempFile",
"createTempFile",
"(",
")",
"throws",
"IOException",
"{",
"TempFile",
"tempFile",
"=",
"new",
"TempFile",
"(",
"prefix",
",",
"suffix",
",",
"directory",
")",
";",
"synchronized",
"(",
"tempFiles",
")",
"{",
"tempFiles",
".",
"add",
"("... | Creates a new temp file while adding it to the list of files that will
be explicitly deleted when this list is deleted. | [
"Creates",
"a",
"new",
"temp",
"file",
"while",
"adding",
"it",
"to",
"the",
"list",
"of",
"files",
"that",
"will",
"be",
"explicitly",
"deleted",
"when",
"this",
"list",
"is",
"deleted",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/TempFileList.java#L92-L98 |
alkacon/opencms-core | src/org/opencms/search/galleries/CmsGalleryNameMacroResolver.java | CmsGalleryNameMacroResolver.resolveStringTemplate | private String resolveStringTemplate(String stMacro) {
String template = m_stringTemplateSource.apply(stMacro.trim());
if (template == null) {
return "";
}
CmsJspContentAccessBean jspContentAccess = new CmsJspContentAccessBean(m_cms, m_contentLocale, m_content);
Map<String, Object> params = Maps.newHashMap();
params.put(
CmsStringTemplateRenderer.KEY_FUNCTIONS,
CmsCollectionsGenericWrapper.createLazyMap(new CmsObjectFunctionTransformer(m_cms)));
// We don't necessarily need the page title / navigation, so instead of passing the computed values to the template, we pass objects whose
// toString methods compute the values
params.put(PAGE_TITLE, new Object() {
@Override
public String toString() {
return getContainerPageProperty(CmsPropertyDefinition.PROPERTY_TITLE);
}
});
params.put(PAGE_NAV, new Object() {
@Override
public String toString() {
return getContainerPageProperty(CmsPropertyDefinition.PROPERTY_NAVTEXT);
}
});
String result = CmsStringTemplateRenderer.renderTemplate(m_cms, template, jspContentAccess, params);
return result;
} | java | private String resolveStringTemplate(String stMacro) {
String template = m_stringTemplateSource.apply(stMacro.trim());
if (template == null) {
return "";
}
CmsJspContentAccessBean jspContentAccess = new CmsJspContentAccessBean(m_cms, m_contentLocale, m_content);
Map<String, Object> params = Maps.newHashMap();
params.put(
CmsStringTemplateRenderer.KEY_FUNCTIONS,
CmsCollectionsGenericWrapper.createLazyMap(new CmsObjectFunctionTransformer(m_cms)));
// We don't necessarily need the page title / navigation, so instead of passing the computed values to the template, we pass objects whose
// toString methods compute the values
params.put(PAGE_TITLE, new Object() {
@Override
public String toString() {
return getContainerPageProperty(CmsPropertyDefinition.PROPERTY_TITLE);
}
});
params.put(PAGE_NAV, new Object() {
@Override
public String toString() {
return getContainerPageProperty(CmsPropertyDefinition.PROPERTY_NAVTEXT);
}
});
String result = CmsStringTemplateRenderer.renderTemplate(m_cms, template, jspContentAccess, params);
return result;
} | [
"private",
"String",
"resolveStringTemplate",
"(",
"String",
"stMacro",
")",
"{",
"String",
"template",
"=",
"m_stringTemplateSource",
".",
"apply",
"(",
"stMacro",
".",
"trim",
"(",
")",
")",
";",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"return",
"... | Evaluates the contents of a %(stringtemplate:...) macro by evaluating them as StringTemplate code.<p>
@param stMacro the contents of the macro after the stringtemplate: prefix
@return the StringTemplate evaluation result | [
"Evaluates",
"the",
"contents",
"of",
"a",
"%",
"(",
"stringtemplate",
":",
"...",
")",
"macro",
"by",
"evaluating",
"them",
"as",
"StringTemplate",
"code",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGalleryNameMacroResolver.java#L251-L285 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java | ProtoTruthMessageDifferencer.diffMessages | DiffResult diffMessages(Message actual, Message expected) {
checkNotNull(actual);
checkNotNull(expected);
checkArgument(
actual.getDescriptorForType() == expected.getDescriptorForType(),
"The actual [%s] and expected [%s] message descriptors do not match.",
actual.getDescriptorForType(),
expected.getDescriptorForType());
return diffMessages(actual, expected, rootConfig);
} | java | DiffResult diffMessages(Message actual, Message expected) {
checkNotNull(actual);
checkNotNull(expected);
checkArgument(
actual.getDescriptorForType() == expected.getDescriptorForType(),
"The actual [%s] and expected [%s] message descriptors do not match.",
actual.getDescriptorForType(),
expected.getDescriptorForType());
return diffMessages(actual, expected, rootConfig);
} | [
"DiffResult",
"diffMessages",
"(",
"Message",
"actual",
",",
"Message",
"expected",
")",
"{",
"checkNotNull",
"(",
"actual",
")",
";",
"checkNotNull",
"(",
"expected",
")",
";",
"checkArgument",
"(",
"actual",
".",
"getDescriptorForType",
"(",
")",
"==",
"expe... | Compare the two non-null messages, and return a detailed comparison report. | [
"Compare",
"the",
"two",
"non",
"-",
"null",
"messages",
"and",
"return",
"a",
"detailed",
"comparison",
"report",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java#L79-L89 |
samskivert/pythagoras | src/main/java/pythagoras/d/Frustum.java | Frustum.setToPerspective | public Frustum setToPerspective (double fovy, double aspect, double znear, double zfar) {
double top = znear * Math.tan(fovy / 2f), bottom = -top;
double right = top * aspect, left = -right;
return setToFrustum(left, right, bottom, top, znear, zfar);
} | java | public Frustum setToPerspective (double fovy, double aspect, double znear, double zfar) {
double top = znear * Math.tan(fovy / 2f), bottom = -top;
double right = top * aspect, left = -right;
return setToFrustum(left, right, bottom, top, znear, zfar);
} | [
"public",
"Frustum",
"setToPerspective",
"(",
"double",
"fovy",
",",
"double",
"aspect",
",",
"double",
"znear",
",",
"double",
"zfar",
")",
"{",
"double",
"top",
"=",
"znear",
"*",
"Math",
".",
"tan",
"(",
"fovy",
"/",
"2f",
")",
",",
"bottom",
"=",
... | Sets this frustum to one pointing in the Z- direction with the specified parameters
determining its size and shape (see the OpenGL documentation for
<code>gluPerspective</code>).
@param fovy the vertical field of view, in radians.
@param aspect the aspect ratio (width over height).
@param znear the distance to the near clip plane.
@param zfar the distance to the far clip plane.
@return a reference to this frustum, for chaining. | [
"Sets",
"this",
"frustum",
"to",
"one",
"pointing",
"in",
"the",
"Z",
"-",
"direction",
"with",
"the",
"specified",
"parameters",
"determining",
"its",
"size",
"and",
"shape",
"(",
"see",
"the",
"OpenGL",
"documentation",
"for",
"<code",
">",
"gluPerspective<"... | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Frustum.java#L54-L58 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_alert_alertId_GET | public OvhStreamAlertCondition serviceName_output_graylog_stream_streamId_alert_alertId_GET(String serviceName, String streamId, String alertId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert/{alertId}";
StringBuilder sb = path(qPath, serviceName, streamId, alertId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhStreamAlertCondition.class);
} | java | public OvhStreamAlertCondition serviceName_output_graylog_stream_streamId_alert_alertId_GET(String serviceName, String streamId, String alertId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert/{alertId}";
StringBuilder sb = path(qPath, serviceName, streamId, alertId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhStreamAlertCondition.class);
} | [
"public",
"OvhStreamAlertCondition",
"serviceName_output_graylog_stream_streamId_alert_alertId_GET",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
",",
"String",
"alertId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output... | Returns details of specified graylog stream alert
REST: GET /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert/{alertId}
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param alertId [required] Alert ID | [
"Returns",
"details",
"of",
"specified",
"graylog",
"stream",
"alert"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1402-L1407 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java | ConfigValidator.checkEvictionConfig | static void checkEvictionConfig(InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) {
if (inMemoryFormat == NATIVE) {
MaxSizePolicy maxSizePolicy = evictionConfig.getMaximumSizePolicy();
if (maxSizePolicy == MaxSizePolicy.ENTRY_COUNT) {
throw new IllegalArgumentException("Invalid max-size policy "
+ '(' + maxSizePolicy + ") for NATIVE in-memory format! Only "
+ MaxSizePolicy.USED_NATIVE_MEMORY_SIZE + ", "
+ MaxSizePolicy.USED_NATIVE_MEMORY_PERCENTAGE + ", "
+ MaxSizePolicy.FREE_NATIVE_MEMORY_SIZE + ", "
+ MaxSizePolicy.FREE_NATIVE_MEMORY_PERCENTAGE
+ " are supported.");
}
}
} | java | static void checkEvictionConfig(InMemoryFormat inMemoryFormat, EvictionConfig evictionConfig) {
if (inMemoryFormat == NATIVE) {
MaxSizePolicy maxSizePolicy = evictionConfig.getMaximumSizePolicy();
if (maxSizePolicy == MaxSizePolicy.ENTRY_COUNT) {
throw new IllegalArgumentException("Invalid max-size policy "
+ '(' + maxSizePolicy + ") for NATIVE in-memory format! Only "
+ MaxSizePolicy.USED_NATIVE_MEMORY_SIZE + ", "
+ MaxSizePolicy.USED_NATIVE_MEMORY_PERCENTAGE + ", "
+ MaxSizePolicy.FREE_NATIVE_MEMORY_SIZE + ", "
+ MaxSizePolicy.FREE_NATIVE_MEMORY_PERCENTAGE
+ " are supported.");
}
}
} | [
"static",
"void",
"checkEvictionConfig",
"(",
"InMemoryFormat",
"inMemoryFormat",
",",
"EvictionConfig",
"evictionConfig",
")",
"{",
"if",
"(",
"inMemoryFormat",
"==",
"NATIVE",
")",
"{",
"MaxSizePolicy",
"maxSizePolicy",
"=",
"evictionConfig",
".",
"getMaximumSizePolic... | Checks the merge policy configuration in the context of an {@link ICache}.
@param inMemoryFormat the {@link InMemoryFormat} of the cache
@param evictionConfig the {@link EvictionConfig} of the cache | [
"Checks",
"the",
"merge",
"policy",
"configuration",
"in",
"the",
"context",
"of",
"an",
"{",
"@link",
"ICache",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L358-L371 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/reflection/Reflector.java | Reflector.setElementAtIndex | @SuppressWarnings({ "rawtypes", "unchecked" })
public void setElementAtIndex(int index, Object value) throws ReflectorException {
if(object == null) {
logger.error("object is null: did you specify it using the 'inspect()' method?");
throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?");
}
if(object.getClass().isArray()) {
Array.set(object, translateArrayIndex(index, getArrayLength()), value);
} else if (object instanceof List<?>){
((List)object).set(index, value);
} else {
throw new ReflectorException("object is not an array or a list");
}
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public void setElementAtIndex(int index, Object value) throws ReflectorException {
if(object == null) {
logger.error("object is null: did you specify it using the 'inspect()' method?");
throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?");
}
if(object.getClass().isArray()) {
Array.set(object, translateArrayIndex(index, getArrayLength()), value);
} else if (object instanceof List<?>){
((List)object).set(index, value);
} else {
throw new ReflectorException("object is not an array or a list");
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"void",
"setElementAtIndex",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"throws",
"ReflectorException",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"log... | Sets the value of the n-th element in an array or a list.
@param index
the offset of the element to be set; this value can be positive
(and the offset is calculated from the start of the array or list), or
negative, in which case the offset is calculated according to the rule
that element -1 is the last, -2 is the one before the last, etc.
@throws ReflectorException
if the object is not a list or an array. | [
"Sets",
"the",
"value",
"of",
"the",
"n",
"-",
"th",
"element",
"in",
"an",
"array",
"or",
"a",
"list",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Reflector.java#L271-L286 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.isTrue | public static void isTrue(Boolean condition, Supplier<String> message) {
if (isNotTrue(condition)) {
throw new IllegalArgumentException(message.get());
}
} | java | public static void isTrue(Boolean condition, Supplier<String> message) {
if (isNotTrue(condition)) {
throw new IllegalArgumentException(message.get());
}
} | [
"public",
"static",
"void",
"isTrue",
"(",
"Boolean",
"condition",
",",
"Supplier",
"<",
"String",
">",
"message",
")",
"{",
"if",
"(",
"isNotTrue",
"(",
"condition",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
".",
"get",
"(... | Asserts that the condition is {@literal true}.
The assertion holds if and only if the value is equal to {@literal true}.
@param condition {@link Boolean} value being evaluated as a {@literal true} condition.
@param message {@link String} containing the message used in the {@link IllegalArgumentException} thrown
if the assertion fails.
@throws java.lang.IllegalArgumentException if the value is not {@literal true}.
@see java.lang.Boolean#TRUE | [
"Asserts",
"that",
"the",
"condition",
"is",
"{",
"@literal",
"true",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L819-L823 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.beginChangeVnetAsync | public Observable<Page<SiteInner>> beginChangeVnetAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return beginChangeVnetWithServiceResponseAsync(resourceGroupName, name, vnetInfo)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SiteInner>> beginChangeVnetAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return beginChangeVnetWithServiceResponseAsync(resourceGroupName, name, vnetInfo)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SiteInner",
">",
">",
"beginChangeVnetAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"VirtualNetworkProfile",
"vnetInfo",
")",
"{",
"return",
"beginChangeVnetWithServiceResp... | Move an App Service Environment to a different VNET.
Move an App Service Environment to a different VNET.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param vnetInfo Details for the new virtual network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
".",
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java#L1720-L1728 |
jamesdbloom/mockserver | mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java | MockServerClient.isRunning | public boolean isRunning(int attempts, long timeout, TimeUnit timeUnit) {
try {
HttpResponse httpResponse = sendRequest(request().withMethod("PUT").withPath(calculatePath("status")));
if (httpResponse.getStatusCode() == HttpStatusCode.OK_200.code()) {
return true;
} else if (attempts == 0) {
return false;
} else {
try {
timeUnit.sleep(timeout);
} catch (InterruptedException e) {
// ignore interrupted exception
}
return isRunning(attempts - 1, timeout, timeUnit);
}
} catch (SocketConnectionException sce) {
return false;
}
} | java | public boolean isRunning(int attempts, long timeout, TimeUnit timeUnit) {
try {
HttpResponse httpResponse = sendRequest(request().withMethod("PUT").withPath(calculatePath("status")));
if (httpResponse.getStatusCode() == HttpStatusCode.OK_200.code()) {
return true;
} else if (attempts == 0) {
return false;
} else {
try {
timeUnit.sleep(timeout);
} catch (InterruptedException e) {
// ignore interrupted exception
}
return isRunning(attempts - 1, timeout, timeUnit);
}
} catch (SocketConnectionException sce) {
return false;
}
} | [
"public",
"boolean",
"isRunning",
"(",
"int",
"attempts",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"try",
"{",
"HttpResponse",
"httpResponse",
"=",
"sendRequest",
"(",
"request",
"(",
")",
".",
"withMethod",
"(",
"\"PUT\"",
")",
".",
... | Returns whether server MockServer is running, by polling the MockServer a configurable amount of times | [
"Returns",
"whether",
"server",
"MockServer",
"is",
"running",
"by",
"polling",
"the",
"MockServer",
"a",
"configurable",
"amount",
"of",
"times"
] | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java#L198-L216 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.moveLeft | public void moveLeft(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.hbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.hbar.getBlockIncrement();
if (!isInvertedAxisX()) {
inc = -inc;
}
this.hbar.setValue(Utils.clamp(this.hbar.getMin(), this.hbar.getValue() + inc, this.hbar.getMax()));
} | java | public void moveLeft(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.hbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.hbar.getBlockIncrement();
if (!isInvertedAxisX()) {
inc = -inc;
}
this.hbar.setValue(Utils.clamp(this.hbar.getMin(), this.hbar.getValue() + inc, this.hbar.getMax()));
} | [
"public",
"void",
"moveLeft",
"(",
"boolean",
"isUnit",
",",
"boolean",
"isLarge",
",",
"boolean",
"isVeryLarge",
")",
"{",
"double",
"inc",
"=",
"isUnit",
"?",
"this",
".",
"hbar",
".",
"getUnitIncrement",
"(",
")",
":",
"(",
"isLarge",
"?",
"LARGE_MOVE_F... | Move the viewport left.
@param isUnit indicates if the move is a unit move. If {@code true}, this argument has precedence to the other arguments.
@param isLarge indicates if the move is a large move. If {@code true}, this argument has precedence
to the very large argument.
@param isVeryLarge indicates if the move is a very large move. | [
"Move",
"the",
"viewport",
"left",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L531-L539 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.changePermissions | public void changePermissions(SftpFile file, int permissions)
throws SftpStatusException, SshException {
SftpFileAttributes attrs = new SftpFileAttributes(this,
SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
attrs.setPermissions(new UnsignedInteger32(permissions));
setAttributes(file, attrs);
} | java | public void changePermissions(SftpFile file, int permissions)
throws SftpStatusException, SshException {
SftpFileAttributes attrs = new SftpFileAttributes(this,
SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
attrs.setPermissions(new UnsignedInteger32(permissions));
setAttributes(file, attrs);
} | [
"public",
"void",
"changePermissions",
"(",
"SftpFile",
"file",
",",
"int",
"permissions",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"SftpFileAttributes",
"attrs",
"=",
"new",
"SftpFileAttributes",
"(",
"this",
",",
"SftpFileAttributes",
".",
"... | Change the permissions of a file.
@param file
the file
@param permissions
an integer value containing a file permissions mask
@throws SshException
,SftpStatusException | [
"Change",
"the",
"permissions",
"of",
"a",
"file",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L408-L414 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiDeletionNeighbourhood.java | DisjointMultiDeletionNeighbourhood.getRandomMove | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for deletion (fixed IDs are discarded)
Set<Integer> delCandidates = getRemoveCandidates(solution);
// compute number of deletions
int curNumDel = numDeletions(delCandidates, solution);
// return null if no removals are possible
if(curNumDel == 0){
return null;
}
// pick random IDs to remove from selection
Set<Integer> del = SetUtilities.getRandomSubset(delCandidates, curNumDel, rnd);
// create and return move
return new GeneralSubsetMove(Collections.emptySet(), del);
} | java | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for deletion (fixed IDs are discarded)
Set<Integer> delCandidates = getRemoveCandidates(solution);
// compute number of deletions
int curNumDel = numDeletions(delCandidates, solution);
// return null if no removals are possible
if(curNumDel == 0){
return null;
}
// pick random IDs to remove from selection
Set<Integer> del = SetUtilities.getRandomSubset(delCandidates, curNumDel, rnd);
// create and return move
return new GeneralSubsetMove(Collections.emptySet(), del);
} | [
"@",
"Override",
"public",
"SubsetMove",
"getRandomMove",
"(",
"SubsetSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"// get set of candidate IDs for deletion (fixed IDs are discarded)",
"Set",
"<",
"Integer",
">",
"delCandidates",
"=",
"getRemoveCandidates",
"(",
... | Generates a move for the given subset solution that deselects a random subset of currently selected IDs.
Whenever possible, the requested number of deletions is performed. However, taking into account the current
number of selected items, the imposed minimum subset size (if set) and the fixed IDs (if any) may result in
fewer deletions (as many as possible). If no items can be removed, <code>null</code> is returned.
@param solution solution for which a random multi deletion move is generated
@param rnd source of randomness used to generate random move
@return random multi deletion move, <code>null</code> if no items can be removed | [
"Generates",
"a",
"move",
"for",
"the",
"given",
"subset",
"solution",
"that",
"deselects",
"a",
"random",
"subset",
"of",
"currently",
"selected",
"IDs",
".",
"Whenever",
"possible",
"the",
"requested",
"number",
"of",
"deletions",
"is",
"performed",
".",
"Ho... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiDeletionNeighbourhood.java#L147-L161 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcWrapper.java | WSJdbcWrapper.createClosedException | protected final SQLRecoverableException createClosedException(String ifc) {
String message = AdapterUtil.getNLSMessage("OBJECT_CLOSED", ifc);
return new SQLRecoverableException(message, "08003", 0);
} | java | protected final SQLRecoverableException createClosedException(String ifc) {
String message = AdapterUtil.getNLSMessage("OBJECT_CLOSED", ifc);
return new SQLRecoverableException(message, "08003", 0);
} | [
"protected",
"final",
"SQLRecoverableException",
"createClosedException",
"(",
"String",
"ifc",
")",
"{",
"String",
"message",
"=",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"OBJECT_CLOSED\"",
",",
"ifc",
")",
";",
"return",
"new",
"SQLRecoverableException",
"(",
... | Create an SQLRecoverableException if exception mapping is enabled, or
SQLRecoverableException if exception mapping is disabled.
@param ifc the simple interface name (such as Connection) of the closed wrapper.
@return an exception indicating the object is closed. | [
"Create",
"an",
"SQLRecoverableException",
"if",
"exception",
"mapping",
"is",
"enabled",
"or",
"SQLRecoverableException",
"if",
"exception",
"mapping",
"is",
"disabled",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcWrapper.java#L108-L111 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/bingspellcheck/src/main/java/com/microsoft/azure/cognitiveservices/language/spellcheck/implementation/BingSpellCheckOperationsImpl.java | BingSpellCheckOperationsImpl.spellCheckerWithServiceResponseAsync | public Observable<ServiceResponse<SpellCheck>> spellCheckerWithServiceResponseAsync(String text, SpellCheckerOptionalParameter spellCheckerOptionalParameter) {
if (text == null) {
throw new IllegalArgumentException("Parameter text is required and cannot be null.");
}
final String acceptLanguage = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.acceptLanguage() : null;
final String pragma = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.pragma() : null;
final String userAgent = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientId() : null;
final String clientIp = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientIp() : null;
final String location = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.location() : null;
final ActionType actionType = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.actionType() : null;
final String appName = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.appName() : null;
final String countryCode = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.countryCode() : null;
final String clientMachineName = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientMachineName() : null;
final String docId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.docId() : null;
final String market = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.market() : null;
final String sessionId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.sessionId() : null;
final String setLang = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.setLang() : null;
final String userId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.userId() : null;
final String mode = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.mode() : null;
final String preContextText = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.preContextText() : null;
final String postContextText = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.postContextText() : null;
return spellCheckerWithServiceResponseAsync(text, acceptLanguage, pragma, userAgent, clientId, clientIp, location, actionType, appName, countryCode, clientMachineName, docId, market, sessionId, setLang, userId, mode, preContextText, postContextText);
} | java | public Observable<ServiceResponse<SpellCheck>> spellCheckerWithServiceResponseAsync(String text, SpellCheckerOptionalParameter spellCheckerOptionalParameter) {
if (text == null) {
throw new IllegalArgumentException("Parameter text is required and cannot be null.");
}
final String acceptLanguage = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.acceptLanguage() : null;
final String pragma = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.pragma() : null;
final String userAgent = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientId() : null;
final String clientIp = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientIp() : null;
final String location = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.location() : null;
final ActionType actionType = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.actionType() : null;
final String appName = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.appName() : null;
final String countryCode = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.countryCode() : null;
final String clientMachineName = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.clientMachineName() : null;
final String docId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.docId() : null;
final String market = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.market() : null;
final String sessionId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.sessionId() : null;
final String setLang = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.setLang() : null;
final String userId = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.userId() : null;
final String mode = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.mode() : null;
final String preContextText = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.preContextText() : null;
final String postContextText = spellCheckerOptionalParameter != null ? spellCheckerOptionalParameter.postContextText() : null;
return spellCheckerWithServiceResponseAsync(text, acceptLanguage, pragma, userAgent, clientId, clientIp, location, actionType, appName, countryCode, clientMachineName, docId, market, sessionId, setLang, userId, mode, preContextText, postContextText);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"SpellCheck",
">",
">",
"spellCheckerWithServiceResponseAsync",
"(",
"String",
"text",
",",
"SpellCheckerOptionalParameter",
"spellCheckerOptionalParameter",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"thr... | The Bing Spell Check API lets you perform contextual grammar and spell checking. Bing has developed a web-based spell-checker that leverages machine learning and statistical machine translation to dynamically train a constantly evolving and highly contextual algorithm. The spell-checker is based on a massive corpus of web searches and documents.
@param text The text string to check for spelling and grammar errors. The combined length of the text string, preContextText string, and postContextText string may not exceed 10,000 characters. You may specify this parameter in the query string of a GET request or in the body of a POST request. Because of the query string length limit, you'll typically use a POST request unless you're checking only short strings.
@param spellCheckerOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SpellCheck object | [
"The",
"Bing",
"Spell",
"Check",
"API",
"lets",
"you",
"perform",
"contextual",
"grammar",
"and",
"spell",
"checking",
".",
"Bing",
"has",
"developed",
"a",
"web",
"-",
"based",
"spell",
"-",
"checker",
"that",
"leverages",
"machine",
"learning",
"and",
"sta... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/bingspellcheck/src/main/java/com/microsoft/azure/cognitiveservices/language/spellcheck/implementation/BingSpellCheckOperationsImpl.java#L117-L141 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java | ValidationContext.addBadValueError | public void addBadValueError(final String type, final JSONValue val) throws ValidationException
{
addError(StringFormatter.format(MessageConstants.MESSAGES.invalidValueForType(), type, val));
} | java | public void addBadValueError(final String type, final JSONValue val) throws ValidationException
{
addError(StringFormatter.format(MessageConstants.MESSAGES.invalidValueForType(), type, val));
} | [
"public",
"void",
"addBadValueError",
"(",
"final",
"String",
"type",
",",
"final",
"JSONValue",
"val",
")",
"throws",
"ValidationException",
"{",
"addError",
"(",
"StringFormatter",
".",
"format",
"(",
"MessageConstants",
".",
"MESSAGES",
".",
"invalidValueForType"... | Calls {@link #addError(String)} with a message that indicates
that a node has the wrong JSON type,
e.g. we're expecting a String but the value was a Number.
@param type expected Node or Shape type
@param val JSONValue that caused the error
@throws ValidationException | [
"Calls",
"{",
"@link",
"#addError",
"(",
"String",
")",
"}",
"with",
"a",
"message",
"that",
"indicates",
"that",
"a",
"node",
"has",
"the",
"wrong",
"JSON",
"type",
"e",
".",
"g",
".",
"we",
"re",
"expecting",
"a",
"String",
"but",
"the",
"value",
"... | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java#L141-L144 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java | VecmathUtil.getNearestVector | static Vector2d getNearestVector(final Vector2d reference, final List<Vector2d> vectors) {
if (vectors.isEmpty()) throw new IllegalArgumentException("No vectors provided");
// to find the closest vector we find use the dot product,
// for the general case (non-unit vectors) one can use the
// cosine similarity
Vector2d closest = vectors.get(0);
double maxProd = reference.dot(closest);
for (int i = 1; i < vectors.size(); i++) {
double newProd = reference.dot(vectors.get(i));
if (newProd > maxProd) {
maxProd = newProd;
closest = vectors.get(i);
}
}
return closest;
} | java | static Vector2d getNearestVector(final Vector2d reference, final List<Vector2d> vectors) {
if (vectors.isEmpty()) throw new IllegalArgumentException("No vectors provided");
// to find the closest vector we find use the dot product,
// for the general case (non-unit vectors) one can use the
// cosine similarity
Vector2d closest = vectors.get(0);
double maxProd = reference.dot(closest);
for (int i = 1; i < vectors.size(); i++) {
double newProd = reference.dot(vectors.get(i));
if (newProd > maxProd) {
maxProd = newProd;
closest = vectors.get(i);
}
}
return closest;
} | [
"static",
"Vector2d",
"getNearestVector",
"(",
"final",
"Vector2d",
"reference",
",",
"final",
"List",
"<",
"Vector2d",
">",
"vectors",
")",
"{",
"if",
"(",
"vectors",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No vector... | Given a list of unit vectors, find the vector which is nearest to a
provided reference.
@param reference a target vector
@param vectors list of vectors
@return the nearest vector
@throws java.lang.IllegalArgumentException no vectors provided | [
"Given",
"a",
"list",
"of",
"unit",
"vectors",
"find",
"the",
"vector",
"which",
"is",
"nearest",
"to",
"a",
"provided",
"reference",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java#L248-L267 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.interpolateTimeSinceUpdate | private long interpolateTimeSinceUpdate(TrackPositionUpdate update, long currentTimestamp) {
if (!update.playing) {
return update.milliseconds;
}
long elapsedMillis = (currentTimestamp - update.timestamp) / 1000000;
long moved = Math.round(update.pitch * elapsedMillis);
if (update.reverse) {
return update.milliseconds - moved;
}
return update.milliseconds + moved;
} | java | private long interpolateTimeSinceUpdate(TrackPositionUpdate update, long currentTimestamp) {
if (!update.playing) {
return update.milliseconds;
}
long elapsedMillis = (currentTimestamp - update.timestamp) / 1000000;
long moved = Math.round(update.pitch * elapsedMillis);
if (update.reverse) {
return update.milliseconds - moved;
}
return update.milliseconds + moved;
} | [
"private",
"long",
"interpolateTimeSinceUpdate",
"(",
"TrackPositionUpdate",
"update",
",",
"long",
"currentTimestamp",
")",
"{",
"if",
"(",
"!",
"update",
".",
"playing",
")",
"{",
"return",
"update",
".",
"milliseconds",
";",
"}",
"long",
"elapsedMillis",
"=",... | Figure out, based on how much time has elapsed since we received an update, and the playback position,
speed, and direction at the time of that update, where the player will be now.
@param update the most recent update received from a player
@param currentTimestamp the nanosecond timestamp representing when we want to interpolate the track's position
@return the playback position we believe that player has reached now | [
"Figure",
"out",
"based",
"on",
"how",
"much",
"time",
"has",
"elapsed",
"since",
"we",
"received",
"an",
"update",
"and",
"the",
"playback",
"position",
"speed",
"and",
"direction",
"at",
"the",
"time",
"of",
"that",
"update",
"where",
"the",
"player",
"w... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L151-L161 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.createOrUpdateAsync | public Observable<VirtualNetworkGatewayConnectionInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnectionInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() {
@Override
public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkGatewayConnectionInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnectionInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() {
@Override
public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkGatewayConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"VirtualNetworkGatewayConnectionInner",
"parameters",
")",
"{",
"return",
"createOrUpdat... | Creates or updates a virtual network gateway connection in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
@param parameters Parameters supplied to the create or update virtual network gateway connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L166-L173 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/FrameScreen.java | FrameScreen.getNextLocation | public ScreenLocation getNextLocation(short position, short setNewAnchor)
{
if (position == ScreenConstants.FIRST_LOCATION)
position = ScreenConstants.FIRST_FRAME_LOCATION;
if (position == ScreenConstants.NEXT_LOGICAL)
position = ScreenConstants.BELOW_LAST_CONTROL; // Stack all screens (should only be applet)
if (position == ScreenConstants.ADD_SCREEN_VIEW_BUFFER)
position = ScreenConstants.ADD_VIEW_BUFFER; // No buffer around frame!
return super.getNextLocation(position, setNewAnchor);
} | java | public ScreenLocation getNextLocation(short position, short setNewAnchor)
{
if (position == ScreenConstants.FIRST_LOCATION)
position = ScreenConstants.FIRST_FRAME_LOCATION;
if (position == ScreenConstants.NEXT_LOGICAL)
position = ScreenConstants.BELOW_LAST_CONTROL; // Stack all screens (should only be applet)
if (position == ScreenConstants.ADD_SCREEN_VIEW_BUFFER)
position = ScreenConstants.ADD_VIEW_BUFFER; // No buffer around frame!
return super.getNextLocation(position, setNewAnchor);
} | [
"public",
"ScreenLocation",
"getNextLocation",
"(",
"short",
"position",
",",
"short",
"setNewAnchor",
")",
"{",
"if",
"(",
"position",
"==",
"ScreenConstants",
".",
"FIRST_LOCATION",
")",
"position",
"=",
"ScreenConstants",
".",
"FIRST_FRAME_LOCATION",
";",
"if",
... | Code this position and Anchor to add it to the LayoutManager.
@param position The location constant (see ScreenConstants).
@param setNewAnchor The anchor constant.
@return The new screen location object. | [
"Code",
"this",
"position",
"and",
"Anchor",
"to",
"add",
"it",
"to",
"the",
"LayoutManager",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/FrameScreen.java#L126-L135 |
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/basicoperations/AddKeywords.java | AddKeywords.runExample | public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, long adGroupId)
throws RemoteException, UnsupportedEncodingException {
// Get the AdGroupCriterionService.
AdGroupCriterionServiceInterface adGroupCriterionService =
adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
// Create keywords.
Keyword keyword1 = new Keyword();
keyword1.setText("mars cruise");
keyword1.setMatchType(KeywordMatchType.BROAD);
Keyword keyword2 = new Keyword();
keyword2.setText("space hotel");
keyword2.setMatchType(KeywordMatchType.EXACT);
// Create biddable ad group criterion.
BiddableAdGroupCriterion keywordBiddableAdGroupCriterion1 = new BiddableAdGroupCriterion();
keywordBiddableAdGroupCriterion1.setAdGroupId(adGroupId);
keywordBiddableAdGroupCriterion1.setCriterion(keyword1);
// You can optionally provide these field(s).
keywordBiddableAdGroupCriterion1.setUserStatus(UserStatus.PAUSED);
String encodedFinalUrl = String.format("http://example.com/mars/cruise/?kw=%s",
URLEncoder.encode(keyword1.getText(), UTF_8.name()));
keywordBiddableAdGroupCriterion1.setFinalUrls(new UrlList(new String[] {encodedFinalUrl}));
BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
CpcBid bid = new CpcBid();
bid.setBid(new Money(null, 10000000L));
biddingStrategyConfiguration.setBids(new Bids[] {bid});
keywordBiddableAdGroupCriterion1.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
NegativeAdGroupCriterion keywordNegativeAdGroupCriterion2 = new NegativeAdGroupCriterion();
keywordNegativeAdGroupCriterion2.setAdGroupId(adGroupId);
keywordNegativeAdGroupCriterion2.setCriterion(keyword2);
// Create operations.
AdGroupCriterionOperation keywordAdGroupCriterionOperation1 = new AdGroupCriterionOperation();
keywordAdGroupCriterionOperation1.setOperand(keywordBiddableAdGroupCriterion1);
keywordAdGroupCriterionOperation1.setOperator(Operator.ADD);
AdGroupCriterionOperation keywordAdGroupCriterionOperation2 = new AdGroupCriterionOperation();
keywordAdGroupCriterionOperation2.setOperand(keywordNegativeAdGroupCriterion2);
keywordAdGroupCriterionOperation2.setOperator(Operator.ADD);
AdGroupCriterionOperation[] operations =
new AdGroupCriterionOperation[] {keywordAdGroupCriterionOperation1,
keywordAdGroupCriterionOperation2};
// Add keywords.
AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations);
// Display results.
for (AdGroupCriterion adGroupCriterionResult : result.getValue()) {
System.out.printf("Keyword ad group criterion with ad group ID %d, criterion ID %d, "
+ "text '%s', and match type '%s' was added.%n", adGroupCriterionResult.getAdGroupId(),
adGroupCriterionResult.getCriterion().getId(),
((Keyword) adGroupCriterionResult.getCriterion()).getText(),
((Keyword) adGroupCriterionResult.getCriterion()).getMatchType());
}
} | java | public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, long adGroupId)
throws RemoteException, UnsupportedEncodingException {
// Get the AdGroupCriterionService.
AdGroupCriterionServiceInterface adGroupCriterionService =
adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
// Create keywords.
Keyword keyword1 = new Keyword();
keyword1.setText("mars cruise");
keyword1.setMatchType(KeywordMatchType.BROAD);
Keyword keyword2 = new Keyword();
keyword2.setText("space hotel");
keyword2.setMatchType(KeywordMatchType.EXACT);
// Create biddable ad group criterion.
BiddableAdGroupCriterion keywordBiddableAdGroupCriterion1 = new BiddableAdGroupCriterion();
keywordBiddableAdGroupCriterion1.setAdGroupId(adGroupId);
keywordBiddableAdGroupCriterion1.setCriterion(keyword1);
// You can optionally provide these field(s).
keywordBiddableAdGroupCriterion1.setUserStatus(UserStatus.PAUSED);
String encodedFinalUrl = String.format("http://example.com/mars/cruise/?kw=%s",
URLEncoder.encode(keyword1.getText(), UTF_8.name()));
keywordBiddableAdGroupCriterion1.setFinalUrls(new UrlList(new String[] {encodedFinalUrl}));
BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
CpcBid bid = new CpcBid();
bid.setBid(new Money(null, 10000000L));
biddingStrategyConfiguration.setBids(new Bids[] {bid});
keywordBiddableAdGroupCriterion1.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
NegativeAdGroupCriterion keywordNegativeAdGroupCriterion2 = new NegativeAdGroupCriterion();
keywordNegativeAdGroupCriterion2.setAdGroupId(adGroupId);
keywordNegativeAdGroupCriterion2.setCriterion(keyword2);
// Create operations.
AdGroupCriterionOperation keywordAdGroupCriterionOperation1 = new AdGroupCriterionOperation();
keywordAdGroupCriterionOperation1.setOperand(keywordBiddableAdGroupCriterion1);
keywordAdGroupCriterionOperation1.setOperator(Operator.ADD);
AdGroupCriterionOperation keywordAdGroupCriterionOperation2 = new AdGroupCriterionOperation();
keywordAdGroupCriterionOperation2.setOperand(keywordNegativeAdGroupCriterion2);
keywordAdGroupCriterionOperation2.setOperator(Operator.ADD);
AdGroupCriterionOperation[] operations =
new AdGroupCriterionOperation[] {keywordAdGroupCriterionOperation1,
keywordAdGroupCriterionOperation2};
// Add keywords.
AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations);
// Display results.
for (AdGroupCriterion adGroupCriterionResult : result.getValue()) {
System.out.printf("Keyword ad group criterion with ad group ID %d, criterion ID %d, "
+ "text '%s', and match type '%s' was added.%n", adGroupCriterionResult.getAdGroupId(),
adGroupCriterionResult.getCriterion().getId(),
((Keyword) adGroupCriterionResult.getCriterion()).getText(),
((Keyword) adGroupCriterionResult.getCriterion()).getMatchType());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdWordsServicesInterface",
"adWordsServices",
",",
"AdWordsSession",
"session",
",",
"long",
"adGroupId",
")",
"throws",
"RemoteException",
",",
"UnsupportedEncodingException",
"{",
"// Get the AdGroupCriterionService.",
"AdGrou... | Runs the example.
@param adWordsServices the services factory.
@param session the session.
@param adGroupId the ID of the ad group where the keywords will be created.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.
@throws UnsupportedEncodingException if encoding the final URL failed. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/basicoperations/AddKeywords.java#L142-L202 |
igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java | RosterUtil.preApproveSubscriptionIfRequiredAndPossible | public static void preApproveSubscriptionIfRequiredAndPossible(Roster roster, BareJid jid)
throws NotLoggedInException, NotConnectedException, InterruptedException {
if (!roster.isSubscriptionPreApprovalSupported()) {
return;
}
RosterEntry entry = roster.getEntry(jid);
if (entry == null || (!entry.canSeeMyPresence() && !entry.isApproved())) {
try {
roster.preApprove(jid);
} catch (FeatureNotSupportedException e) {
// Should never happen since we checked for the feature above.
throw new AssertionError(e);
}
}
} | java | public static void preApproveSubscriptionIfRequiredAndPossible(Roster roster, BareJid jid)
throws NotLoggedInException, NotConnectedException, InterruptedException {
if (!roster.isSubscriptionPreApprovalSupported()) {
return;
}
RosterEntry entry = roster.getEntry(jid);
if (entry == null || (!entry.canSeeMyPresence() && !entry.isApproved())) {
try {
roster.preApprove(jid);
} catch (FeatureNotSupportedException e) {
// Should never happen since we checked for the feature above.
throw new AssertionError(e);
}
}
} | [
"public",
"static",
"void",
"preApproveSubscriptionIfRequiredAndPossible",
"(",
"Roster",
"roster",
",",
"BareJid",
"jid",
")",
"throws",
"NotLoggedInException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"roster",
".",
"isSubscripti... | Pre-approve the subscription if it is required and possible.
@param roster The roster which should be used for the pre-approval.
@param jid The XMPP address which should be pre-approved.
@throws NotLoggedInException
@throws NotConnectedException
@throws InterruptedException
@since 4.2.2 | [
"Pre",
"-",
"approve",
"the",
"subscription",
"if",
"it",
"is",
"required",
"and",
"possible",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java#L100-L115 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AbstractHDBSCAN.java | AbstractHDBSCAN.computeCoreDists | protected WritableDoubleDataStore computeCoreDists(DBIDs ids, KNNQuery<O> knnQ, int minPts) {
final Logging LOG = getLogger();
final WritableDoubleDataStore coredists = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_DB);
FiniteProgress cprog = LOG.isVerbose() ? new FiniteProgress("Computing core sizes", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
coredists.put(iter, knnQ.getKNNForDBID(iter, minPts).getKNNDistance());
LOG.incrementProcessed(cprog);
}
LOG.ensureCompleted(cprog);
return coredists;
} | java | protected WritableDoubleDataStore computeCoreDists(DBIDs ids, KNNQuery<O> knnQ, int minPts) {
final Logging LOG = getLogger();
final WritableDoubleDataStore coredists = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_DB);
FiniteProgress cprog = LOG.isVerbose() ? new FiniteProgress("Computing core sizes", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
coredists.put(iter, knnQ.getKNNForDBID(iter, minPts).getKNNDistance());
LOG.incrementProcessed(cprog);
}
LOG.ensureCompleted(cprog);
return coredists;
} | [
"protected",
"WritableDoubleDataStore",
"computeCoreDists",
"(",
"DBIDs",
"ids",
",",
"KNNQuery",
"<",
"O",
">",
"knnQ",
",",
"int",
"minPts",
")",
"{",
"final",
"Logging",
"LOG",
"=",
"getLogger",
"(",
")",
";",
"final",
"WritableDoubleDataStore",
"coredists",
... | Compute the core distances for all objects.
@param ids Objects
@param knnQ kNN query
@param minPts Minimum neighborhood size
@return Data store with core distances | [
"Compute",
"the",
"core",
"distances",
"for",
"all",
"objects",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AbstractHDBSCAN.java#L91-L101 |
zeromq/jeromq | src/main/java/zmq/io/Msgs.java | Msgs.startsWith | public static boolean startsWith(Msg msg, String data, boolean includeLength)
{
final int length = data.length();
assert (length < 256);
int start = includeLength ? 1 : 0;
if (msg.size() < length + start) {
return false;
}
boolean comparison = includeLength ? length == (msg.get(0) & 0xff) : true;
if (comparison) {
for (int idx = start; idx < length; ++idx) {
comparison = (msg.get(idx) == data.charAt(idx - start));
if (!comparison) {
break;
}
}
}
return comparison;
} | java | public static boolean startsWith(Msg msg, String data, boolean includeLength)
{
final int length = data.length();
assert (length < 256);
int start = includeLength ? 1 : 0;
if (msg.size() < length + start) {
return false;
}
boolean comparison = includeLength ? length == (msg.get(0) & 0xff) : true;
if (comparison) {
for (int idx = start; idx < length; ++idx) {
comparison = (msg.get(idx) == data.charAt(idx - start));
if (!comparison) {
break;
}
}
}
return comparison;
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"Msg",
"msg",
",",
"String",
"data",
",",
"boolean",
"includeLength",
")",
"{",
"final",
"int",
"length",
"=",
"data",
".",
"length",
"(",
")",
";",
"assert",
"(",
"length",
"<",
"256",
")",
";",
"int",... | Checks if the message starts with the given string.
@param msg the message to check.
@param data the string to check the message with. Shall be shorter than 256 characters.
@param includeLength true if the string in the message is prefixed with the length, false if not.
@return true if the message starts with the given string, otherwise false. | [
"Checks",
"if",
"the",
"message",
"starts",
"with",
"the",
"given",
"string",
"."
] | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/zmq/io/Msgs.java#L20-L39 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckMissingAndExtraRequires.java | CheckMissingAndExtraRequires.maybeAddUsage | private void maybeAddUsage(NodeTraversal t, Node n, final JSTypeExpression expr) {
// Just look at the root node, don't traverse.
Predicate<Node> pred =
new Predicate<Node>() {
@Override
public boolean apply(Node n) {
return n == expr.getRoot();
}
};
maybeAddUsage(t, n, expr.getRoot(), true, pred);
} | java | private void maybeAddUsage(NodeTraversal t, Node n, final JSTypeExpression expr) {
// Just look at the root node, don't traverse.
Predicate<Node> pred =
new Predicate<Node>() {
@Override
public boolean apply(Node n) {
return n == expr.getRoot();
}
};
maybeAddUsage(t, n, expr.getRoot(), true, pred);
} | [
"private",
"void",
"maybeAddUsage",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
",",
"final",
"JSTypeExpression",
"expr",
")",
"{",
"// Just look at the root node, don't traverse.",
"Predicate",
"<",
"Node",
">",
"pred",
"=",
"new",
"Predicate",
"<",
"Node",
">",... | Adds a usage for the given type expression (unless it references a variable that is defined in
the externs, in which case no goog.require() is needed). When a usage is added, it means that
there should be a goog.require for that type. | [
"Adds",
"a",
"usage",
"for",
"the",
"given",
"type",
"expression",
"(",
"unless",
"it",
"references",
"a",
"variable",
"that",
"is",
"defined",
"in",
"the",
"externs",
"in",
"which",
"case",
"no",
"goog",
".",
"require",
"()",
"is",
"needed",
")",
".",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckMissingAndExtraRequires.java#L717-L727 |
samskivert/samskivert | src/main/java/com/samskivert/util/ComparableArrayList.java | ComparableArrayList.rsort | public void rsort ()
{
sort(new Comparator<T>() {
public int compare (T o1, T o2) {
return _comp.compare(o2, o1);
}
});
} | java | public void rsort ()
{
sort(new Comparator<T>() {
public int compare (T o1, T o2) {
return _comp.compare(o2, o1);
}
});
} | [
"public",
"void",
"rsort",
"(",
")",
"{",
"sort",
"(",
"new",
"Comparator",
"<",
"T",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"T",
"o1",
",",
"T",
"o2",
")",
"{",
"return",
"_comp",
".",
"compare",
"(",
"o2",
",",
"o1",
")",
";",
... | Sorts the elements in this list using the quick sort algorithm
according to their reverse natural ordering. The elements must
implement {@link Comparable} and all be mutually comparable. | [
"Sorts",
"the",
"elements",
"in",
"this",
"list",
"using",
"the",
"quick",
"sort",
"algorithm",
"according",
"to",
"their",
"reverse",
"natural",
"ordering",
".",
"The",
"elements",
"must",
"implement",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ComparableArrayList.java#L40-L47 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static CharSequence getAt(CharSequence text, int index) {
index = normaliseIndex(index, text.length());
return text.subSequence(index, index + 1);
} | java | public static CharSequence getAt(CharSequence text, int index) {
index = normaliseIndex(index, text.length());
return text.subSequence(index, index + 1);
} | [
"public",
"static",
"CharSequence",
"getAt",
"(",
"CharSequence",
"text",
",",
"int",
"index",
")",
"{",
"index",
"=",
"normaliseIndex",
"(",
"index",
",",
"text",
".",
"length",
"(",
")",
")",
";",
"return",
"text",
".",
"subSequence",
"(",
"index",
","... | Support the subscript operator for CharSequence.
@param text a CharSequence
@param index the index of the Character to get
@return the Character at the given index
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"for",
"CharSequence",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1240-L1243 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java | HibernateClient.onExecuteUpdate | public int onExecuteUpdate(String query, Map<Parameter, Object> parameterMap, int firstResult, int maxResult)
{
s = getStatelessSession();
Query q = s.createQuery(query);
q.setFirstResult(firstResult);
q.setMaxResults(maxResult);
setParameters(parameterMap, q);
Transaction tx = onBegin();
int i = q.executeUpdate();
onCommit(tx);
// tx.commit();
return i;
} | java | public int onExecuteUpdate(String query, Map<Parameter, Object> parameterMap, int firstResult, int maxResult)
{
s = getStatelessSession();
Query q = s.createQuery(query);
q.setFirstResult(firstResult);
q.setMaxResults(maxResult);
setParameters(parameterMap, q);
Transaction tx = onBegin();
int i = q.executeUpdate();
onCommit(tx);
// tx.commit();
return i;
} | [
"public",
"int",
"onExecuteUpdate",
"(",
"String",
"query",
",",
"Map",
"<",
"Parameter",
",",
"Object",
">",
"parameterMap",
",",
"int",
"firstResult",
",",
"int",
"maxResult",
")",
"{",
"s",
"=",
"getStatelessSession",
"(",
")",
";",
"Query",
"q",
"=",
... | Find.
@param query
the native fquery
@param parameterMap
the parameter map
@param maxResult
@param firstResult
@return the list | [
"Find",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L645-L664 |
Talend/tesb-rt-se | examples/tesb/rent-a-car/app-reservation/src/main/java/org/talend/esb/client/app/CarRentalClientGui.java | CarRentalClientGui.createAndShowGUI | private static void createAndShowGUI(CarSearchModel searchModel, CarReserveModel reserveModel) {
//Create and set up the window.
JFrame appFrame = new JFrame(Messages.CarRentalClient_Title);
appFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
// Display the window centered on the screen
Dimension d = appFrame.getToolkit().getScreenSize();
appFrame.setLocation((d.width / 2) - (appFrame.getWidth() / 2), (appFrame.getHeight() / 2));
CarRentalClientGui gui = new CarRentalClientGui(searchModel, reserveModel);
gui.appFrame = appFrame;
appFrame.setContentPane(gui);
appFrame.pack();
appFrame.setVisible(true);
appFrame.toFront();
} | java | private static void createAndShowGUI(CarSearchModel searchModel, CarReserveModel reserveModel) {
//Create and set up the window.
JFrame appFrame = new JFrame(Messages.CarRentalClient_Title);
appFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
// Display the window centered on the screen
Dimension d = appFrame.getToolkit().getScreenSize();
appFrame.setLocation((d.width / 2) - (appFrame.getWidth() / 2), (appFrame.getHeight() / 2));
CarRentalClientGui gui = new CarRentalClientGui(searchModel, reserveModel);
gui.appFrame = appFrame;
appFrame.setContentPane(gui);
appFrame.pack();
appFrame.setVisible(true);
appFrame.toFront();
} | [
"private",
"static",
"void",
"createAndShowGUI",
"(",
"CarSearchModel",
"searchModel",
",",
"CarReserveModel",
"reserveModel",
")",
"{",
"//Create and set up the window.",
"JFrame",
"appFrame",
"=",
"new",
"JFrame",
"(",
"Messages",
".",
"CarRentalClient_Title",
")",
";... | Create the GUI and show it. For thread safety,
this method should be invoked from the
event-dispatching thread. | [
"Create",
"the",
"GUI",
"and",
"show",
"it",
".",
"For",
"thread",
"safety",
"this",
"method",
"should",
"be",
"invoked",
"from",
"the",
"event",
"-",
"dispatching",
"thread",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/examples/tesb/rent-a-car/app-reservation/src/main/java/org/talend/esb/client/app/CarRentalClientGui.java#L455-L471 |
jbundle/jbundle | thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java | TaskScheduler.startPageWorker | public static SyncWorker startPageWorker(SyncPage syncPage, SyncNotify syncNotify, Runnable swingPageLoader, Map<String,Object> map, boolean bManageCursor)
{
SyncWorker syncWorker = (SyncWorker)ClassServiceUtility.getClassService().makeObjectFromClassName(JAVA_WORKER);
if (syncWorker == null)
syncWorker = (SyncWorker)ClassServiceUtility.getClassService().makeObjectFromClassName(ANDROID_WORKER);
if (syncWorker != null)
{
syncWorker.init(syncPage, syncNotify, swingPageLoader, map, bManageCursor);
syncWorker.start();
}
else
Util.getLogger().severe("SyncWorker does not exist!");
return syncWorker;
} | java | public static SyncWorker startPageWorker(SyncPage syncPage, SyncNotify syncNotify, Runnable swingPageLoader, Map<String,Object> map, boolean bManageCursor)
{
SyncWorker syncWorker = (SyncWorker)ClassServiceUtility.getClassService().makeObjectFromClassName(JAVA_WORKER);
if (syncWorker == null)
syncWorker = (SyncWorker)ClassServiceUtility.getClassService().makeObjectFromClassName(ANDROID_WORKER);
if (syncWorker != null)
{
syncWorker.init(syncPage, syncNotify, swingPageLoader, map, bManageCursor);
syncWorker.start();
}
else
Util.getLogger().severe("SyncWorker does not exist!");
return syncWorker;
} | [
"public",
"static",
"SyncWorker",
"startPageWorker",
"(",
"SyncPage",
"syncPage",
",",
"SyncNotify",
"syncNotify",
",",
"Runnable",
"swingPageLoader",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"boolean",
"bManageCursor",
")",
"{",
"SyncWorker",
... | Start a task that calls the syncNotify 'done' method when the screen is done displaying.
This class is a platform-neutral implementation of SwinSyncPageWorker that
guarantees a page has displayed before doing a compute-intensive task. | [
"Start",
"a",
"task",
"that",
"calls",
"the",
"syncNotify",
"done",
"method",
"when",
"the",
"screen",
"is",
"done",
"displaying",
".",
"This",
"class",
"is",
"a",
"platform",
"-",
"neutral",
"implementation",
"of",
"SwinSyncPageWorker",
"that",
"guarantees",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java#L279-L292 |
thorntail/wildfly-config-api | generator/src/main/java/org/wildfly/swarm/config/generator/model/ResourceDescription.java | ResourceDescription.getChildDescription | public ResourceDescription getChildDescription(String type, String name) {
if (hasChildrenDefined()) {
List<Property> children = get("children").asPropertyList();
for (Property child : children) {
if (type.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) {
List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList();
for (Property modelDescription : modelDescriptions) {
if (name.equals(modelDescription.getName())) {
return new ResourceDescription(modelDescription.getValue());
}
}
}
}
}
return EMPTY;
} | java | public ResourceDescription getChildDescription(String type, String name) {
if (hasChildrenDefined()) {
List<Property> children = get("children").asPropertyList();
for (Property child : children) {
if (type.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) {
List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList();
for (Property modelDescription : modelDescriptions) {
if (name.equals(modelDescription.getName())) {
return new ResourceDescription(modelDescription.getValue());
}
}
}
}
}
return EMPTY;
} | [
"public",
"ResourceDescription",
"getChildDescription",
"(",
"String",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"hasChildrenDefined",
"(",
")",
")",
"{",
"List",
"<",
"Property",
">",
"children",
"=",
"get",
"(",
"\"children\"",
")",
".",
"asPrope... | Looks for the description of a specific child resource.
@param type The type of the child resource
@param name The name of the instance
@return the description of the specific child resource or {@link #EMPTY} if no such resource exists. | [
"Looks",
"for",
"the",
"description",
"of",
"a",
"specific",
"child",
"resource",
"."
] | train | https://github.com/thorntail/wildfly-config-api/blob/ddb3f3bcb7b85b22c6371415546f567bc44493db/generator/src/main/java/org/wildfly/swarm/config/generator/model/ResourceDescription.java#L137-L152 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java | CheckArg.isNonNegative | public static void isNonNegative( int argument,
String name ) {
if (argument < 0) {
throw new IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
}
} | java | public static void isNonNegative( int argument,
String name ) {
if (argument < 0) {
throw new IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
}
} | [
"public",
"static",
"void",
"isNonNegative",
"(",
"int",
"argument",
",",
"String",
"name",
")",
"{",
"if",
"(",
"argument",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"CommonI18n",
".",
"argumentMayNotBeNegative",
".",
"text",
"(",
... | Check that the argument is non-negative (>=0).
@param argument The argument
@param name The name of the argument
@throws IllegalArgumentException If argument is negative (<0) | [
"Check",
"that",
"the",
"argument",
"is",
"non",
"-",
"negative",
"(",
">",
"=",
"0",
")",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L154-L159 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/publickey/SshPublicKeyFileFactory.java | SshPublicKeyFileFactory.convertFile | public static void convertFile(File keyFile, int toFormat, File toFile)
throws IOException {
SshPublicKeyFile pub = parse(new FileInputStream(keyFile));
createFile(pub.toPublicKey(), pub.getComment(), toFormat, toFile);
} | java | public static void convertFile(File keyFile, int toFormat, File toFile)
throws IOException {
SshPublicKeyFile pub = parse(new FileInputStream(keyFile));
createFile(pub.toPublicKey(), pub.getComment(), toFormat, toFile);
} | [
"public",
"static",
"void",
"convertFile",
"(",
"File",
"keyFile",
",",
"int",
"toFormat",
",",
"File",
"toFile",
")",
"throws",
"IOException",
"{",
"SshPublicKeyFile",
"pub",
"=",
"parse",
"(",
"new",
"FileInputStream",
"(",
"keyFile",
")",
")",
";",
"creat... | Take a file in any of the supported public key formats and convert to the
requested format.
@param keyFile
@param toFormat
@param toFile
@throws IOException | [
"Take",
"a",
"file",
"in",
"any",
"of",
"the",
"supported",
"public",
"key",
"formats",
"and",
"convert",
"to",
"the",
"requested",
"format",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/SshPublicKeyFileFactory.java#L247-L252 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java | SimpleHadoopFilesystemConfigStoreFactory.createFileSystemURI | private URI createFileSystemURI(URI configKey) throws URISyntaxException, IOException {
// Validate the scheme
String configKeyScheme = configKey.getScheme();
if (!configKeyScheme.startsWith(getSchemePrefix())) {
throw new IllegalArgumentException(
String.format("Scheme for configKey \"%s\" must begin with \"%s\"!", configKey, getSchemePrefix()));
}
if (Strings.isNullOrEmpty(configKey.getAuthority())) {
return new URI(getPhysicalScheme(), getDefaultStoreFsLazy().getUri().getAuthority(), "", "", "");
}
String uriPhysicalScheme = configKeyScheme.substring(getSchemePrefix().length(), configKeyScheme.length());
return new URI(uriPhysicalScheme, configKey.getAuthority(), "", "", "");
} | java | private URI createFileSystemURI(URI configKey) throws URISyntaxException, IOException {
// Validate the scheme
String configKeyScheme = configKey.getScheme();
if (!configKeyScheme.startsWith(getSchemePrefix())) {
throw new IllegalArgumentException(
String.format("Scheme for configKey \"%s\" must begin with \"%s\"!", configKey, getSchemePrefix()));
}
if (Strings.isNullOrEmpty(configKey.getAuthority())) {
return new URI(getPhysicalScheme(), getDefaultStoreFsLazy().getUri().getAuthority(), "", "", "");
}
String uriPhysicalScheme = configKeyScheme.substring(getSchemePrefix().length(), configKeyScheme.length());
return new URI(uriPhysicalScheme, configKey.getAuthority(), "", "", "");
} | [
"private",
"URI",
"createFileSystemURI",
"(",
"URI",
"configKey",
")",
"throws",
"URISyntaxException",
",",
"IOException",
"{",
"// Validate the scheme",
"String",
"configKeyScheme",
"=",
"configKey",
".",
"getScheme",
"(",
")",
";",
"if",
"(",
"!",
"configKeyScheme... | Creates a Hadoop FS {@link URI} given a user-specified configKey. If the given configKey does not have an authority,
a default one is used instead, provided by the default root path. | [
"Creates",
"a",
"Hadoop",
"FS",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java#L208-L221 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_elasticsearch_alias_aliasId_index_POST | public OvhOperation serviceName_output_elasticsearch_alias_aliasId_index_POST(String serviceName, String aliasId, String indexId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}/index";
StringBuilder sb = path(qPath, serviceName, aliasId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "indexId", indexId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation serviceName_output_elasticsearch_alias_aliasId_index_POST(String serviceName, String aliasId, String indexId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}/index";
StringBuilder sb = path(qPath, serviceName, aliasId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "indexId", indexId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"serviceName_output_elasticsearch_alias_aliasId_index_POST",
"(",
"String",
"serviceName",
",",
"String",
"aliasId",
",",
"String",
"indexId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output/elasticsearch/... | Attach a elasticsearch index to specified elasticsearch alias
REST: POST /dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}/index
@param serviceName [required] Service name
@param aliasId [required] Alias ID
@param indexId [required] Index ID | [
"Attach",
"a",
"elasticsearch",
"index",
"to",
"specified",
"elasticsearch",
"alias"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1597-L1604 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.listConversationMessages | public ConversationMessageList listConversationMessages(
final String conversationId
) throws UnauthorizedException, GeneralException {
final int offset = 0;
final int limit = 10;
return listConversationMessages(conversationId, offset, limit);
} | java | public ConversationMessageList listConversationMessages(
final String conversationId
) throws UnauthorizedException, GeneralException {
final int offset = 0;
final int limit = 10;
return listConversationMessages(conversationId, offset, limit);
} | [
"public",
"ConversationMessageList",
"listConversationMessages",
"(",
"final",
"String",
"conversationId",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"final",
"int",
"offset",
"=",
"0",
";",
"final",
"int",
"limit",
"=",
"10",
";",
"return... | Gets a ConversationMessage listing with default pagination options.
@param conversationId Conversation to get messages for.
@return List of messages. | [
"Gets",
"a",
"ConversationMessage",
"listing",
"with",
"default",
"pagination",
"options",
"."
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L799-L806 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java | CertificatesInner.getByResourceGroup | public CertificateInner getByResourceGroup(String resourceGroupName, String name) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public CertificateInner getByResourceGroup(String resourceGroupName, String name) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"CertificateInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"("... | Get a certificate.
Get a certificate.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the certificate.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateInner object if successful. | [
"Get",
"a",
"certificate",
".",
"Get",
"a",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java#L346-L348 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxTrash.java | BoxTrash.restoreFolder | public BoxFolder.Info restoreFolder(String folderID, String newName, String newParentID) {
JsonObject requestJSON = new JsonObject();
if (newName != null) {
requestJSON.add("name", newName);
}
if (newParentID != null) {
JsonObject parent = new JsonObject();
parent.add("id", newParentID);
requestJSON.add("parent", parent);
}
URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID);
BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString());
return restoredFolder.new Info(responseJSON);
} | java | public BoxFolder.Info restoreFolder(String folderID, String newName, String newParentID) {
JsonObject requestJSON = new JsonObject();
if (newName != null) {
requestJSON.add("name", newName);
}
if (newParentID != null) {
JsonObject parent = new JsonObject();
parent.add("id", newParentID);
requestJSON.add("parent", parent);
}
URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID);
BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString());
return restoredFolder.new Info(responseJSON);
} | [
"public",
"BoxFolder",
".",
"Info",
"restoreFolder",
"(",
"String",
"folderID",
",",
"String",
"newName",
",",
"String",
"newParentID",
")",
"{",
"JsonObject",
"requestJSON",
"=",
"new",
"JsonObject",
"(",
")",
";",
"if",
"(",
"newName",
"!=",
"null",
")",
... | Restores a trashed folder to a new location with a new name.
@param folderID the ID of the trashed folder.
@param newName an optional new name to give the folder. This can be null to use the folder's original name.
@param newParentID an optional new parent ID for the folder. This can be null to use the folder's original
parent.
@return info about the restored folder. | [
"Restores",
"a",
"trashed",
"folder",
"to",
"a",
"new",
"location",
"with",
"a",
"new",
"name",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L118-L139 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java | SeaGlassStyle.contains | private boolean contains(String[] names, String name) {
assert name != null;
for (int i = 0; i < names.length; i++) {
if (name.equals(names[i])) {
return true;
}
}
return false;
} | java | private boolean contains(String[] names, String name) {
assert name != null;
for (int i = 0; i < names.length; i++) {
if (name.equals(names[i])) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"contains",
"(",
"String",
"[",
"]",
"names",
",",
"String",
"name",
")",
"{",
"assert",
"name",
"!=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"... | Simple utility method that searchs the given array of Strings for the
given string. This method is only called from getExtendedState if the
developer has specified a specific state for the component to be in (ie,
has "wedged" the component in that state) by specifying they client
property "SeaGlass.State".
@param names a non-null array of strings
@param name the name to look for in the array
@return true or false based on whether the given name is in the array | [
"Simple",
"utility",
"method",
"that",
"searchs",
"the",
"given",
"array",
"of",
"Strings",
"for",
"the",
"given",
"string",
".",
"This",
"method",
"is",
"only",
"called",
"from",
"getExtendedState",
"if",
"the",
"developer",
"has",
"specified",
"a",
"specific... | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L1199-L1210 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java | NonSymmetricEquals.sawOpcode | @Override
public void sawOpcode(int seen) {
try {
stack.precomputation(this);
if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
if (item.getRegisterNumber() == 1) {
String thisCls = getClassName();
String equalsCls = getClassConstantOperand();
if (!thisCls.equals(equalsCls)) {
JavaClass thisJavaClass = getClassContext().getJavaClass();
JavaClass equalsJavaClass = Repository.lookupClass(equalsCls);
boolean inheritance = thisJavaClass.instanceOf(equalsJavaClass) || equalsJavaClass.instanceOf(thisJavaClass);
BugInstance bug = new BugInstance(this, BugType.NSE_NON_SYMMETRIC_EQUALS.name(), inheritance ? LOW_PRIORITY : NORMAL_PRIORITY)
.addClass(this).addMethod(this).addSourceLine(this).addString(equalsCls);
Map<String, BugInstance> bugs = possibleBugs.get(thisCls);
if (bugs == null) {
bugs = new HashMap<>();
possibleBugs.put(thisCls, bugs);
}
bugs.put(equalsCls, bug);
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack.sawOpcode(this, seen);
}
} | java | @Override
public void sawOpcode(int seen) {
try {
stack.precomputation(this);
if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
if (item.getRegisterNumber() == 1) {
String thisCls = getClassName();
String equalsCls = getClassConstantOperand();
if (!thisCls.equals(equalsCls)) {
JavaClass thisJavaClass = getClassContext().getJavaClass();
JavaClass equalsJavaClass = Repository.lookupClass(equalsCls);
boolean inheritance = thisJavaClass.instanceOf(equalsJavaClass) || equalsJavaClass.instanceOf(thisJavaClass);
BugInstance bug = new BugInstance(this, BugType.NSE_NON_SYMMETRIC_EQUALS.name(), inheritance ? LOW_PRIORITY : NORMAL_PRIORITY)
.addClass(this).addMethod(this).addSourceLine(this).addString(equalsCls);
Map<String, BugInstance> bugs = possibleBugs.get(thisCls);
if (bugs == null) {
bugs = new HashMap<>();
possibleBugs.put(thisCls, bugs);
}
bugs.put(equalsCls, bug);
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack.sawOpcode(this, seen);
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"try",
"{",
"stack",
".",
"precomputation",
"(",
"this",
")",
";",
"if",
"(",
"(",
"seen",
"==",
"Const",
".",
"CHECKCAST",
")",
"&&",
"(",
"stack",
".",
"getStackDepth",
"... | implements the visitor to look for checkcasts of the parameter to other types, and enter instances in a map for further processing in doReport.
@param seen
the opcode of the currently parsed instruction | [
"implements",
"the",
"visitor",
"to",
"look",
"for",
"checkcasts",
"of",
"the",
"parameter",
"to",
"other",
"types",
"and",
"enter",
"instances",
"in",
"a",
"map",
"for",
"further",
"processing",
"in",
"doReport",
"."
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L113-L144 |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.getMultiInstanceEncapMessage | public SerialMessage getMultiInstanceEncapMessage(SerialMessage serialMessage, int instance) {
logger.debug("Creating new message for application command MULTI_INSTANCE_ENCAP for node {} and instance {}", this.getNode().getNodeId(), instance);
byte[] payload = serialMessage.getMessagePayload();
byte[] newPayload = new byte[payload.length + 3];
System.arraycopy(payload, 0, newPayload, 0, 2);
System.arraycopy(payload, 0, newPayload, 3, payload.length);
newPayload[1] += 3;
newPayload[2] = (byte) this.getCommandClass().getKey();
newPayload[3] = MULTI_INSTANCE_ENCAP;
newPayload[4] = (byte)(instance);
serialMessage.setMessagePayload(newPayload);
return serialMessage;
} | java | public SerialMessage getMultiInstanceEncapMessage(SerialMessage serialMessage, int instance) {
logger.debug("Creating new message for application command MULTI_INSTANCE_ENCAP for node {} and instance {}", this.getNode().getNodeId(), instance);
byte[] payload = serialMessage.getMessagePayload();
byte[] newPayload = new byte[payload.length + 3];
System.arraycopy(payload, 0, newPayload, 0, 2);
System.arraycopy(payload, 0, newPayload, 3, payload.length);
newPayload[1] += 3;
newPayload[2] = (byte) this.getCommandClass().getKey();
newPayload[3] = MULTI_INSTANCE_ENCAP;
newPayload[4] = (byte)(instance);
serialMessage.setMessagePayload(newPayload);
return serialMessage;
} | [
"public",
"SerialMessage",
"getMultiInstanceEncapMessage",
"(",
"SerialMessage",
"serialMessage",
",",
"int",
"instance",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command MULTI_INSTANCE_ENCAP for node {} and instance {}\"",
",",
"this",
".",
... | Gets a SerialMessage with the MULTI INSTANCE ENCAP command.
Encapsulates a message for a specific instance.
@param serialMessage the serial message to encapsulate
@param instance the number of the instance to encapsulate the message for.
@return the encapsulated serial message. | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"MULTI",
"INSTANCE",
"ENCAP",
"command",
".",
"Encapsulates",
"a",
"message",
"for",
"a",
"specific",
"instance",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L457-L471 |
lucee/Lucee | core/src/main/java/lucee/runtime/text/xml/XMLCaster.java | XMLCaster.toElement | public static Element toElement(Document doc, Object o) throws PageException {
if (o instanceof Element) return (Element) o;
else if (o instanceof Node) throw new ExpressionException("Object " + Caster.toClassName(o) + " must be a XML Element");
return doc.createElement(Caster.toString(o));
} | java | public static Element toElement(Document doc, Object o) throws PageException {
if (o instanceof Element) return (Element) o;
else if (o instanceof Node) throw new ExpressionException("Object " + Caster.toClassName(o) + " must be a XML Element");
return doc.createElement(Caster.toString(o));
} | [
"public",
"static",
"Element",
"toElement",
"(",
"Document",
"doc",
",",
"Object",
"o",
")",
"throws",
"PageException",
"{",
"if",
"(",
"o",
"instanceof",
"Element",
")",
"return",
"(",
"Element",
")",
"o",
";",
"else",
"if",
"(",
"o",
"instanceof",
"Nod... | casts a value to a XML Element
@param doc XML Document
@param o Object to cast
@return XML Element Object
@throws PageException | [
"casts",
"a",
"value",
"to",
"a",
"XML",
"Element"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L274-L278 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java | DoubleArrayList.set | public void set(int index, double element) {
// overridden for performance only.
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
elements[index] = element;
} | java | public void set(int index, double element) {
// overridden for performance only.
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
elements[index] = element;
} | [
"public",
"void",
"set",
"(",
"int",
"index",
",",
"double",
"element",
")",
"{",
"// overridden for performance only.\r",
"if",
"(",
"index",
">=",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"in... | Replaces the element at the specified position in the receiver with the specified element.
@param index index of element to replace.
@param element element to be stored at the specified position.
@exception IndexOutOfBoundsException index is out of range (index
< 0 || index >= size()). | [
"Replaces",
"the",
"element",
"at",
"the",
"specified",
"position",
"in",
"the",
"receiver",
"with",
"the",
"specified",
"element",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java#L434-L439 |
netty/netty | example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/HelloWorldHttp2Handler.java | HelloWorldHttp2Handler.onHeadersRead | private static void onHeadersRead(ChannelHandlerContext ctx, Http2HeadersFrame headers)
throws Exception {
if (headers.isEndStream()) {
ByteBuf content = ctx.alloc().buffer();
content.writeBytes(RESPONSE_BYTES.duplicate());
ByteBufUtil.writeAscii(content, " - via HTTP/2");
sendResponse(ctx, content);
}
} | java | private static void onHeadersRead(ChannelHandlerContext ctx, Http2HeadersFrame headers)
throws Exception {
if (headers.isEndStream()) {
ByteBuf content = ctx.alloc().buffer();
content.writeBytes(RESPONSE_BYTES.duplicate());
ByteBufUtil.writeAscii(content, " - via HTTP/2");
sendResponse(ctx, content);
}
} | [
"private",
"static",
"void",
"onHeadersRead",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Http2HeadersFrame",
"headers",
")",
"throws",
"Exception",
"{",
"if",
"(",
"headers",
".",
"isEndStream",
"(",
")",
")",
"{",
"ByteBuf",
"content",
"=",
"ctx",
".",
"alloc... | If receive a frame with end-of-stream set, send a pre-canned response. | [
"If",
"receive",
"a",
"frame",
"with",
"end",
"-",
"of",
"-",
"stream",
"set",
"send",
"a",
"pre",
"-",
"canned",
"response",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/HelloWorldHttp2Handler.java#L83-L91 |
OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.getName | public String getName(final byte[] id) throws NoSuchUniqueId, HBaseException {
try {
return getNameAsync(id).joinUninterruptibly();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Should never be here", e);
}
} | java | public String getName(final byte[] id) throws NoSuchUniqueId, HBaseException {
try {
return getNameAsync(id).joinUninterruptibly();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Should never be here", e);
}
} | [
"public",
"String",
"getName",
"(",
"final",
"byte",
"[",
"]",
"id",
")",
"throws",
"NoSuchUniqueId",
",",
"HBaseException",
"{",
"try",
"{",
"return",
"getNameAsync",
"(",
"id",
")",
".",
"joinUninterruptibly",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeEx... | Finds the name associated with a given ID.
<p>
<strong>This method is blocking.</strong> Its use within OpenTSDB itself
is discouraged, please use {@link #getNameAsync} instead.
@param id The ID associated with that name.
@see #getId(String)
@see #getOrCreateId(String)
@throws NoSuchUniqueId if the given ID is not assigned.
@throws HBaseException if there is a problem communicating with HBase.
@throws IllegalArgumentException if the ID given in argument is encoded
on the wrong number of bytes. | [
"Finds",
"the",
"name",
"associated",
"with",
"a",
"given",
"ID",
".",
"<p",
">",
"<strong",
">",
"This",
"method",
"is",
"blocking",
".",
"<",
"/",
"strong",
">",
"Its",
"use",
"within",
"OpenTSDB",
"itself",
"is",
"discouraged",
"please",
"use",
"{"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L340-L348 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java | OAuth20DefaultTokenGenerator.generateAccessTokenOAuthDeviceCodeResponseType | protected OAuth20TokenGeneratedResult generateAccessTokenOAuthDeviceCodeResponseType(final AccessTokenRequestDataHolder holder) {
val deviceCode = holder.getDeviceCode();
if (StringUtils.isNotBlank(deviceCode)) {
val deviceCodeTicket = getDeviceTokenFromTicketRegistry(deviceCode);
val deviceUserCode = getDeviceUserCodeFromRegistry(deviceCodeTicket);
if (deviceUserCode.isUserCodeApproved()) {
LOGGER.debug("Provided user code [{}] linked to device code [{}] is approved", deviceCodeTicket.getId(), deviceCode);
this.ticketRegistry.deleteTicket(deviceCode);
val deviceResult = AccessTokenRequestDataHolder.builder()
.service(holder.getService())
.authentication(holder.getAuthentication())
.registeredService(holder.getRegisteredService())
.ticketGrantingTicket(holder.getTicketGrantingTicket())
.grantType(holder.getGrantType())
.scopes(new LinkedHashSet<>())
.responseType(holder.getResponseType())
.generateRefreshToken(holder.getRegisteredService() != null && holder.isGenerateRefreshToken())
.build();
val ticketPair = generateAccessTokenOAuthGrantTypes(deviceResult);
return generateAccessTokenResult(deviceResult, ticketPair);
}
if (deviceCodeTicket.getLastTimeUsed() != null) {
val interval = Beans.newDuration(casProperties.getAuthn().getOauth().getDeviceToken().getRefreshInterval()).getSeconds();
val shouldSlowDown = deviceCodeTicket.getLastTimeUsed().plusSeconds(interval).isAfter(ZonedDateTime.now(ZoneOffset.UTC));
if (shouldSlowDown) {
LOGGER.error("Request for user code approval is greater than the configured refresh interval of [{}] second(s)", interval);
throw new ThrottledOAuth20DeviceUserCodeApprovalException(deviceCodeTicket.getId());
}
}
deviceCodeTicket.update();
this.ticketRegistry.updateTicket(deviceCodeTicket);
LOGGER.error("Provided user code [{}] linked to device code [{}] is NOT approved yet", deviceCodeTicket.getId(), deviceCode);
throw new UnapprovedOAuth20DeviceUserCodeException(deviceCodeTicket.getId());
}
val deviceTokens = createDeviceTokensInTicketRegistry(holder);
return OAuth20TokenGeneratedResult.builder()
.responseType(holder.getResponseType())
.registeredService(holder.getRegisteredService())
.deviceCode(deviceTokens.getLeft().getId())
.userCode(deviceTokens.getValue().getId())
.build();
} | java | protected OAuth20TokenGeneratedResult generateAccessTokenOAuthDeviceCodeResponseType(final AccessTokenRequestDataHolder holder) {
val deviceCode = holder.getDeviceCode();
if (StringUtils.isNotBlank(deviceCode)) {
val deviceCodeTicket = getDeviceTokenFromTicketRegistry(deviceCode);
val deviceUserCode = getDeviceUserCodeFromRegistry(deviceCodeTicket);
if (deviceUserCode.isUserCodeApproved()) {
LOGGER.debug("Provided user code [{}] linked to device code [{}] is approved", deviceCodeTicket.getId(), deviceCode);
this.ticketRegistry.deleteTicket(deviceCode);
val deviceResult = AccessTokenRequestDataHolder.builder()
.service(holder.getService())
.authentication(holder.getAuthentication())
.registeredService(holder.getRegisteredService())
.ticketGrantingTicket(holder.getTicketGrantingTicket())
.grantType(holder.getGrantType())
.scopes(new LinkedHashSet<>())
.responseType(holder.getResponseType())
.generateRefreshToken(holder.getRegisteredService() != null && holder.isGenerateRefreshToken())
.build();
val ticketPair = generateAccessTokenOAuthGrantTypes(deviceResult);
return generateAccessTokenResult(deviceResult, ticketPair);
}
if (deviceCodeTicket.getLastTimeUsed() != null) {
val interval = Beans.newDuration(casProperties.getAuthn().getOauth().getDeviceToken().getRefreshInterval()).getSeconds();
val shouldSlowDown = deviceCodeTicket.getLastTimeUsed().plusSeconds(interval).isAfter(ZonedDateTime.now(ZoneOffset.UTC));
if (shouldSlowDown) {
LOGGER.error("Request for user code approval is greater than the configured refresh interval of [{}] second(s)", interval);
throw new ThrottledOAuth20DeviceUserCodeApprovalException(deviceCodeTicket.getId());
}
}
deviceCodeTicket.update();
this.ticketRegistry.updateTicket(deviceCodeTicket);
LOGGER.error("Provided user code [{}] linked to device code [{}] is NOT approved yet", deviceCodeTicket.getId(), deviceCode);
throw new UnapprovedOAuth20DeviceUserCodeException(deviceCodeTicket.getId());
}
val deviceTokens = createDeviceTokensInTicketRegistry(holder);
return OAuth20TokenGeneratedResult.builder()
.responseType(holder.getResponseType())
.registeredService(holder.getRegisteredService())
.deviceCode(deviceTokens.getLeft().getId())
.userCode(deviceTokens.getValue().getId())
.build();
} | [
"protected",
"OAuth20TokenGeneratedResult",
"generateAccessTokenOAuthDeviceCodeResponseType",
"(",
"final",
"AccessTokenRequestDataHolder",
"holder",
")",
"{",
"val",
"deviceCode",
"=",
"holder",
".",
"getDeviceCode",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBl... | Generate access token OAuth device code response type OAuth token generated result.
@param holder the holder
@return the OAuth token generated result | [
"Generate",
"access",
"token",
"OAuth",
"device",
"code",
"response",
"type",
"OAuth",
"token",
"generated",
"result",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java#L86-L133 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.bindBundleToSceneObject | public void bindBundleToSceneObject(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject)
throws IOException, GVRScriptException
{
bindHelper(scriptBundle, rootSceneObject, BIND_MASK_SCENE_OBJECTS);
} | java | public void bindBundleToSceneObject(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject)
throws IOException, GVRScriptException
{
bindHelper(scriptBundle, rootSceneObject, BIND_MASK_SCENE_OBJECTS);
} | [
"public",
"void",
"bindBundleToSceneObject",
"(",
"GVRScriptBundle",
"scriptBundle",
",",
"GVRSceneObject",
"rootSceneObject",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"bindHelper",
"(",
"scriptBundle",
",",
"rootSceneObject",
",",
"BIND_MASK_SCENE_OBJE... | Binds a script bundle to scene graph rooted at a scene object.
@param scriptBundle
The {@code GVRScriptBundle} object containing script binding information.
@param rootSceneObject
The root of the scene object tree to which the scripts are bound.
@throws IOException if script bundle file cannot be read.
@throws GVRScriptException if a script processing error occurs. | [
"Binds",
"a",
"script",
"bundle",
"to",
"scene",
"graph",
"rooted",
"at",
"a",
"scene",
"object",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L328-L332 |
d-sauer/JCalcAPI | src/main/java/org/jdice/calc/Num.java | Num.toBigDecimal | public BigDecimal toBigDecimal(int scale, Rounding roundingMode) {
return toBigDecimal(scale, roundingMode, getProperties().hasStripTrailingZeros());
} | java | public BigDecimal toBigDecimal(int scale, Rounding roundingMode) {
return toBigDecimal(scale, roundingMode, getProperties().hasStripTrailingZeros());
} | [
"public",
"BigDecimal",
"toBigDecimal",
"(",
"int",
"scale",
",",
"Rounding",
"roundingMode",
")",
"{",
"return",
"toBigDecimal",
"(",
"scale",
",",
"roundingMode",
",",
"getProperties",
"(",
")",
".",
"hasStripTrailingZeros",
"(",
")",
")",
";",
"}"
] | Return BigDecimal in defined scale with specified rounding mode. Use strip trailing zeros from properties
@param scale
@param roundingMode
@return BigDecimal | [
"Return",
"BigDecimal",
"in",
"defined",
"scale",
"with",
"specified",
"rounding",
"mode",
".",
"Use",
"strip",
"trailing",
"zeros",
"from",
"properties"
] | train | https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Num.java#L406-L408 |
paymill/paymill-java | src/main/java/com/paymill/services/TransactionService.java | TransactionService.createWithPaymentAndClient | public Transaction createWithPaymentAndClient( String paymentId, String clientId, Integer amount, String currency ) {
return this.createWithPaymentAndClient( paymentId, clientId, amount, currency, null );
} | java | public Transaction createWithPaymentAndClient( String paymentId, String clientId, Integer amount, String currency ) {
return this.createWithPaymentAndClient( paymentId, clientId, amount, currency, null );
} | [
"public",
"Transaction",
"createWithPaymentAndClient",
"(",
"String",
"paymentId",
",",
"String",
"clientId",
",",
"Integer",
"amount",
",",
"String",
"currency",
")",
"{",
"return",
"this",
".",
"createWithPaymentAndClient",
"(",
"paymentId",
",",
"clientId",
",",
... | Executes a {@link Transaction} with {@link Payment} for the given amount in the given currency.
@param paymentId
The Id of a PAYMILL {@link Payment} representing credit card or direct debit.
@param clientId
The Id of a PAYMILL {@link Client} which have to be charged.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@return {@link Transaction} object indicating whether a the call was successful or not. | [
"Executes",
"a",
"{"
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L274-L276 |
JetBrains/xodus | openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java | EnvironmentConfig.setGcMinUtilization | public EnvironmentConfig setGcMinUtilization(int percent) throws InvalidSettingException {
if (percent < 1 || percent > 90) {
throw new InvalidSettingException("Invalid minimum log files utilization: " + percent);
}
return setSetting(GC_MIN_UTILIZATION, percent);
} | java | public EnvironmentConfig setGcMinUtilization(int percent) throws InvalidSettingException {
if (percent < 1 || percent > 90) {
throw new InvalidSettingException("Invalid minimum log files utilization: " + percent);
}
return setSetting(GC_MIN_UTILIZATION, percent);
} | [
"public",
"EnvironmentConfig",
"setGcMinUtilization",
"(",
"int",
"percent",
")",
"throws",
"InvalidSettingException",
"{",
"if",
"(",
"percent",
"<",
"1",
"||",
"percent",
">",
"90",
")",
"{",
"throw",
"new",
"InvalidSettingException",
"(",
"\"Invalid minimum log f... | Sets percent of minimum database utilization. Default value is {@code 50}. That means that 50 percent
of free space in raw data in {@code Log} files (.xd files) is allowed. If database utilization is less than
defined (free space percent is more than {@code 50}), the database garbage collector is triggered.
<p>Mutable at runtime: yes
@param percent percent of minimum database utilization
@return this {@code EnvironmentConfig} instance
@throws InvalidSettingException {@code percent} is not in the range [1..90] | [
"Sets",
"percent",
"of",
"minimum",
"database",
"utilization",
".",
"Default",
"value",
"is",
"{",
"@code",
"50",
"}",
".",
"That",
"means",
"that",
"50",
"percent",
"of",
"free",
"space",
"in",
"raw",
"data",
"in",
"{",
"@code",
"Log",
"}",
"files",
"... | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L1851-L1856 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.writeFully | private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
if (ch instanceof SelectableChannel) {
SelectableChannel sc = (SelectableChannel)ch;
synchronized (sc.blockingLock()) {
if (!sc.isBlocking())
throw new IllegalBlockingModeException();
writeFullyImpl(ch, bb);
}
} else {
writeFullyImpl(ch, bb);
}
} | java | private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
if (ch instanceof SelectableChannel) {
SelectableChannel sc = (SelectableChannel)ch;
synchronized (sc.blockingLock()) {
if (!sc.isBlocking())
throw new IllegalBlockingModeException();
writeFullyImpl(ch, bb);
}
} else {
writeFullyImpl(ch, bb);
}
} | [
"private",
"static",
"void",
"writeFully",
"(",
"WritableByteChannel",
"ch",
",",
"ByteBuffer",
"bb",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ch",
"instanceof",
"SelectableChannel",
")",
"{",
"SelectableChannel",
"sc",
"=",
"(",
"SelectableChannel",
")",
... | Write all remaining bytes in buffer to the given channel.
@throws IllegalBlockingException
If the channel is selectable and configured non-blocking. | [
"Write",
"all",
"remaining",
"bytes",
"in",
"buffer",
"to",
"the",
"given",
"channel",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L91-L104 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java | DocTreeScanner.visitStartElement | @Override
public R visitStartElement(StartElementTree node, P p) {
return scan(node.getAttributes(), p);
} | java | @Override
public R visitStartElement(StartElementTree node, P p) {
return scan(node.getAttributes(), p);
} | [
"@",
"Override",
"public",
"R",
"visitStartElement",
"(",
"StartElementTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"scan",
"(",
"node",
".",
"getAttributes",
"(",
")",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L435-L438 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java | ThreeViewEstimateMetricScene.flipAround | private static void flipAround(SceneStructureMetric structure, SceneObservations observations) {
// The first view will be identity
for (int i = 1; i < structure.views.length; i++) {
Se3_F64 w2v = structure.views[i].worldToView;
w2v.set(w2v.invert(null));
}
triangulatePoints(structure,observations);
} | java | private static void flipAround(SceneStructureMetric structure, SceneObservations observations) {
// The first view will be identity
for (int i = 1; i < structure.views.length; i++) {
Se3_F64 w2v = structure.views[i].worldToView;
w2v.set(w2v.invert(null));
}
triangulatePoints(structure,observations);
} | [
"private",
"static",
"void",
"flipAround",
"(",
"SceneStructureMetric",
"structure",
",",
"SceneObservations",
"observations",
")",
"{",
"// The first view will be identity",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"structure",
".",
"views",
".",
"length"... | Flip the camera pose around. This seems to help it converge to a valid solution if it got it backwards
even if it's not technically something which can be inverted this way | [
"Flip",
"the",
"camera",
"pose",
"around",
".",
"This",
"seems",
"to",
"help",
"it",
"converge",
"to",
"a",
"valid",
"solution",
"if",
"it",
"got",
"it",
"backwards",
"even",
"if",
"it",
"s",
"not",
"technically",
"something",
"which",
"can",
"be",
"inve... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java#L483-L490 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToFloat | public static float convertToFloat (@Nullable final Object aSrcValue, final float fDefault)
{
final Float aValue = convert (aSrcValue, Float.class, null);
return aValue == null ? fDefault : aValue.floatValue ();
} | java | public static float convertToFloat (@Nullable final Object aSrcValue, final float fDefault)
{
final Float aValue = convert (aSrcValue, Float.class, null);
return aValue == null ? fDefault : aValue.floatValue ();
} | [
"public",
"static",
"float",
"convertToFloat",
"(",
"@",
"Nullable",
"final",
"Object",
"aSrcValue",
",",
"final",
"float",
"fDefault",
")",
"{",
"final",
"Float",
"aValue",
"=",
"convert",
"(",
"aSrcValue",
",",
"Float",
".",
"class",
",",
"null",
")",
";... | Convert the passed source value to float
@param aSrcValue
The source value. May be <code>null</code>.
@param fDefault
The default value to be returned if an error occurs during type
conversion.
@return The converted value.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"float"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L295-L299 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.getValueFromStaticMapping | public static String getValueFromStaticMapping(String mapping, String key) {
Map<String, String> m = Splitter.on(";")
.omitEmptyStrings()
.trimResults()
.withKeyValueSeparator("=")
.split(mapping);
return m.get(key);
} | java | public static String getValueFromStaticMapping(String mapping, String key) {
Map<String, String> m = Splitter.on(";")
.omitEmptyStrings()
.trimResults()
.withKeyValueSeparator("=")
.split(mapping);
return m.get(key);
} | [
"public",
"static",
"String",
"getValueFromStaticMapping",
"(",
"String",
"mapping",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"m",
"=",
"Splitter",
".",
"on",
"(",
"\";\"",
")",
".",
"omitEmptyStrings",
"(",
")",
".",
"tr... | Gets the value with a given key from a static key/value mapping in string format. E.g. with
mapping "id1=user1;id2=user2", it returns "user1" with key "id1". It returns null if the given
key does not exist in the mapping.
@param mapping the "key=value" mapping in string format separated by ";"
@param key the key to query
@return the mapped value if the key exists, otherwise returns "" | [
"Gets",
"the",
"value",
"with",
"a",
"given",
"key",
"from",
"a",
"static",
"key",
"/",
"value",
"mapping",
"in",
"string",
"format",
".",
"E",
".",
"g",
".",
"with",
"mapping",
"id1",
"=",
"user1",
";",
"id2",
"=",
"user2",
"it",
"returns",
"user1",... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L395-L402 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.patchJob | public void patchJob(String jobId, JobPatchParameter jobPatchParameter, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobPatchOptions options = new JobPatchOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().patch(jobId, jobPatchParameter, options);
} | java | public void patchJob(String jobId, JobPatchParameter jobPatchParameter, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobPatchOptions options = new JobPatchOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().patch(jobId, jobPatchParameter, options);
} | [
"public",
"void",
"patchJob",
"(",
"String",
"jobId",
",",
"JobPatchParameter",
"jobPatchParameter",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobPatchOptions",
"options",
"="... | Updates the specified job.
This method only replaces the properties specified with non-null values.
@param jobId The ID of the job.
@param jobPatchParameter The parameter to update the job.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"job",
".",
"This",
"method",
"only",
"replaces",
"the",
"properties",
"specified",
"with",
"non",
"-",
"null",
"values",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L588-L594 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java | TypeAnnotationPosition.methodParameter | public static TypeAnnotationPosition
methodParameter(final List<TypePathEntry> location,
final int parameter_index) {
return methodParameter(location, null, parameter_index, -1);
} | java | public static TypeAnnotationPosition
methodParameter(final List<TypePathEntry> location,
final int parameter_index) {
return methodParameter(location, null, parameter_index, -1);
} | [
"public",
"static",
"TypeAnnotationPosition",
"methodParameter",
"(",
"final",
"List",
"<",
"TypePathEntry",
">",
"location",
",",
"final",
"int",
"parameter_index",
")",
"{",
"return",
"methodParameter",
"(",
"location",
",",
"null",
",",
"parameter_index",
",",
... | Create a {@code TypeAnnotationPosition} for a method formal parameter.
@param location The type path.
@param parameter_index The index of the parameter. | [
"Create",
"a",
"{",
"@code",
"TypeAnnotationPosition",
"}",
"for",
"a",
"method",
"formal",
"parameter",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L512-L516 |
ragnor/simple-spring-memcached | simple-spring-memcached/src/main/java/com/google/code/ssm/json/ClassAliasIdResolver.java | ClassAliasIdResolver.addClassToId | public void addClassToId(final Class<?> clazz, final String id) {
Assert.notNull(clazz, "Class cannot be null");
Assert.hasText(id, "Alias (id) cannot be null or contain only whitespaces");
if (classToId.containsKey(clazz)) {
throw new IllegalArgumentException("Class " + clazz + " has already defined alias (id) " + classToId.get(clazz)
+ " cannot set another alias " + id);
}
if (idToClass.containsKey(id)) {
throw new IllegalArgumentException("Alias (id) " + id + " is used by another class " + idToClass.get(id)
+ " and cannot be used by " + clazz);
}
classToId.put(clazz, id);
idToClass.put(id, clazz);
} | java | public void addClassToId(final Class<?> clazz, final String id) {
Assert.notNull(clazz, "Class cannot be null");
Assert.hasText(id, "Alias (id) cannot be null or contain only whitespaces");
if (classToId.containsKey(clazz)) {
throw new IllegalArgumentException("Class " + clazz + " has already defined alias (id) " + classToId.get(clazz)
+ " cannot set another alias " + id);
}
if (idToClass.containsKey(id)) {
throw new IllegalArgumentException("Alias (id) " + id + " is used by another class " + idToClass.get(id)
+ " and cannot be used by " + clazz);
}
classToId.put(clazz, id);
idToClass.put(id, clazz);
} | [
"public",
"void",
"addClassToId",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"id",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class cannot be null\"",
")",
";",
"Assert",
".",
"hasText",
"(",
"id",
",",
"\"Alias... | Adds single mapping: class <-> alias (id).
@param clazz
@param id | [
"Adds",
"single",
"mapping",
":",
"class",
"<",
"-",
">",
"alias",
"(",
"id",
")",
"."
] | train | https://github.com/ragnor/simple-spring-memcached/blob/83db68aa1af219397e132426e377d45f397d31e7/simple-spring-memcached/src/main/java/com/google/code/ssm/json/ClassAliasIdResolver.java#L92-L108 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.beginCreateOrUpdateAsync | public Observable<ExpressRoutePortInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRoutePortInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRoutePortInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
",",
"ExpressRoutePortInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRoutePortInner object | [
"Creates",
"or",
"updates",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L464-L471 |
samskivert/samskivert | src/main/java/com/samskivert/util/StringUtil.java | StringUtil.fill | public static String fill (char c, int count)
{
char[] sameChars = new char[count];
Arrays.fill(sameChars, c);
return new String(sameChars);
} | java | public static String fill (char c, int count)
{
char[] sameChars = new char[count];
Arrays.fill(sameChars, c);
return new String(sameChars);
} | [
"public",
"static",
"String",
"fill",
"(",
"char",
"c",
",",
"int",
"count",
")",
"{",
"char",
"[",
"]",
"sameChars",
"=",
"new",
"char",
"[",
"count",
"]",
";",
"Arrays",
".",
"fill",
"(",
"sameChars",
",",
"c",
")",
";",
"return",
"new",
"String"... | Returns a string containing the specified character repeated the specified number of times. | [
"Returns",
"a",
"string",
"containing",
"the",
"specified",
"character",
"repeated",
"the",
"specified",
"number",
"of",
"times",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L303-L308 |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/util/ChannelUrlUtil.java | ChannelUrlUtil.createChannelLocation | public static URI createChannelLocation(ControlledBounceProxyInformation bpInfo, String ccid, URI location) {
return URI.create(location.toString() + ";jsessionid=." + bpInfo.getInstanceId());
} | java | public static URI createChannelLocation(ControlledBounceProxyInformation bpInfo, String ccid, URI location) {
return URI.create(location.toString() + ";jsessionid=." + bpInfo.getInstanceId());
} | [
"public",
"static",
"URI",
"createChannelLocation",
"(",
"ControlledBounceProxyInformation",
"bpInfo",
",",
"String",
"ccid",
",",
"URI",
"location",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"location",
".",
"toString",
"(",
")",
"+",
"\";jsessionid=.\"",
... | Creates the channel location that is returned to the cluster controller.
This includes tweaking of the URL for example to contain a session ID.
@param bpInfo
information of the bounce proxy
@param ccid
channel identifier
@param location
the channel URL as returned by the bounce proxy instance that
created the channel
@return channel url that can be used by cluster controllers to do
messaging on the created channel | [
"Creates",
"the",
"channel",
"location",
"that",
"is",
"returned",
"to",
"the",
"cluster",
"controller",
".",
"This",
"includes",
"tweaking",
"of",
"the",
"URL",
"for",
"example",
"to",
"contain",
"a",
"session",
"ID",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/util/ChannelUrlUtil.java#L48-L51 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phone_functionKey_keyNum_availableFunction_GET | public ArrayList<String> billingAccount_line_serviceName_phone_functionKey_keyNum_availableFunction_GET(String billingAccount, String serviceName, Long keyNum) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum}/availableFunction";
StringBuilder sb = path(qPath, billingAccount, serviceName, keyNum);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<String> billingAccount_line_serviceName_phone_functionKey_keyNum_availableFunction_GET(String billingAccount, String serviceName, Long keyNum) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum}/availableFunction";
StringBuilder sb = path(qPath, billingAccount, serviceName, keyNum);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"billingAccount_line_serviceName_phone_functionKey_keyNum_availableFunction_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"keyNum",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\... | List the available functions for the key
REST: GET /telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum}/availableFunction
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param keyNum [required] The number of the function key | [
"List",
"the",
"available",
"functions",
"for",
"the",
"key"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1133-L1138 |
hsiafan/requests | src/main/java/net/dongliu/requests/RawResponse.java | RawResponse.toResponse | public <T> Response<T> toResponse(ResponseHandler<T> handler) {
ResponseInfo responseInfo = new ResponseInfo(this.url, this.statusCode, this.headers, body());
try {
T result = handler.handle(responseInfo);
return new Response<>(this.url, this.statusCode, this.cookies, this.headers, result);
} catch (IOException e) {
throw new RequestsException(e);
} finally {
close();
}
} | java | public <T> Response<T> toResponse(ResponseHandler<T> handler) {
ResponseInfo responseInfo = new ResponseInfo(this.url, this.statusCode, this.headers, body());
try {
T result = handler.handle(responseInfo);
return new Response<>(this.url, this.statusCode, this.cookies, this.headers, result);
} catch (IOException e) {
throw new RequestsException(e);
} finally {
close();
}
} | [
"public",
"<",
"T",
">",
"Response",
"<",
"T",
">",
"toResponse",
"(",
"ResponseHandler",
"<",
"T",
">",
"handler",
")",
"{",
"ResponseInfo",
"responseInfo",
"=",
"new",
"ResponseInfo",
"(",
"this",
".",
"url",
",",
"this",
".",
"statusCode",
",",
"this"... | Handle response body with handler, return a new response with content as handler result.
The response is closed whether this call succeed or failed with exception. | [
"Handle",
"response",
"body",
"with",
"handler",
"return",
"a",
"new",
"response",
"with",
"content",
"as",
"handler",
"result",
".",
"The",
"response",
"is",
"closed",
"whether",
"this",
"call",
"succeed",
"or",
"failed",
"with",
"exception",
"."
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L153-L163 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optBoolean | public boolean optBoolean(String name, boolean fallback) {
Object object = opt(name);
Boolean result = JSON.toBoolean(object);
return result != null ? result : fallback;
} | java | public boolean optBoolean(String name, boolean fallback) {
Object object = opt(name);
Boolean result = JSON.toBoolean(object);
return result != null ? result : fallback;
} | [
"public",
"boolean",
"optBoolean",
"(",
"String",
"name",
",",
"boolean",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Boolean",
"result",
"=",
"JSON",
".",
"toBoolean",
"(",
"object",
")",
";",
"return",
"result",
"!=",
... | Returns the value mapped by {@code name} if it exists and is a boolean or can be
coerced to a boolean. Returns {@code fallback} otherwise.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L424-L428 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEManager.java | CmsADEManager.saveRecentList | public void saveRecentList(CmsObject cms, List<CmsContainerElementBean> recentList) throws CmsException {
saveElementList(cms, recentList, ADDINFO_ADE_RECENT_LIST);
} | java | public void saveRecentList(CmsObject cms, List<CmsContainerElementBean> recentList) throws CmsException {
saveElementList(cms, recentList, ADDINFO_ADE_RECENT_LIST);
} | [
"public",
"void",
"saveRecentList",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsContainerElementBean",
">",
"recentList",
")",
"throws",
"CmsException",
"{",
"saveElementList",
"(",
"cms",
",",
"recentList",
",",
"ADDINFO_ADE_RECENT_LIST",
")",
";",
"}"
] | Saves the favorite list, user based.<p>
@param cms the cms context
@param recentList the element list
@throws CmsException if something goes wrong | [
"Saves",
"the",
"favorite",
"list",
"user",
"based",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1258-L1261 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/api/BooleanColumn.java | BooleanColumn.set | public BooleanColumn set(Selection rowSelection, boolean newValue) {
for (int row : rowSelection) {
set(row, newValue);
}
return this;
} | java | public BooleanColumn set(Selection rowSelection, boolean newValue) {
for (int row : rowSelection) {
set(row, newValue);
}
return this;
} | [
"public",
"BooleanColumn",
"set",
"(",
"Selection",
"rowSelection",
",",
"boolean",
"newValue",
")",
"{",
"for",
"(",
"int",
"row",
":",
"rowSelection",
")",
"{",
"set",
"(",
"row",
",",
"newValue",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria | [
"Conditionally",
"update",
"this",
"column",
"replacing",
"current",
"values",
"with",
"newValue",
"for",
"all",
"rows",
"where",
"the",
"current",
"value",
"matches",
"the",
"selection",
"criteria"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/BooleanColumn.java#L558-L563 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.beginImportDataAsync | public Observable<Void> beginImportDataAsync(String resourceGroupName, String name, ImportRDBParameters parameters) {
return beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginImportDataAsync(String resourceGroupName, String name, ImportRDBParameters parameters) {
return beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginImportDataAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"ImportRDBParameters",
"parameters",
")",
"{",
"return",
"beginImportDataWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
"... | Import data into Redis cache.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param parameters Parameters for Redis import operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Import",
"data",
"into",
"Redis",
"cache",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1440-L1447 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateElementBuilder.java | ListTemplateElementBuilder.addUrlButton | public ListTemplateElementBuilder addUrlButton(String title, String url) {
Button button = ButtonFactory.createUrlButton(title, url);
this.element.addButton(button);
return this;
} | java | public ListTemplateElementBuilder addUrlButton(String title, String url) {
Button button = ButtonFactory.createUrlButton(title, url);
this.element.addButton(button);
return this;
} | [
"public",
"ListTemplateElementBuilder",
"addUrlButton",
"(",
"String",
"title",
",",
"String",
"url",
")",
"{",
"Button",
"button",
"=",
"ButtonFactory",
".",
"createUrlButton",
"(",
"title",
",",
"url",
")",
";",
"this",
".",
"element",
".",
"addButton",
"(",... | Adds a button which redirects to an URL when clicked to the current
{@link ListTemplateElement}. There can be at most 3 buttons per element.
@param title
the button label.
@param url
the URL to whom redirect when clicked.
@return this builder. | [
"Adds",
"a",
"button",
"which",
"redirects",
"to",
"an",
"URL",
"when",
"clicked",
"to",
"the",
"current",
"{",
"@link",
"ListTemplateElement",
"}",
".",
"There",
"can",
"be",
"at",
"most",
"3",
"buttons",
"per",
"element",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateElementBuilder.java#L111-L115 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.dumpCursor | public static void dumpCursor(Cursor cursor, StringBuilder sb) {
sb.append(">>>>> Dumping cursor " + cursor + "\n");
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cursor, sb);
}
cursor.moveToPosition(startPos);
}
sb.append("<<<<<\n");
} | java | public static void dumpCursor(Cursor cursor, StringBuilder sb) {
sb.append(">>>>> Dumping cursor " + cursor + "\n");
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cursor, sb);
}
cursor.moveToPosition(startPos);
}
sb.append("<<<<<\n");
} | [
"public",
"static",
"void",
"dumpCursor",
"(",
"Cursor",
"cursor",
",",
"StringBuilder",
"sb",
")",
"{",
"sb",
".",
"append",
"(",
"\">>>>> Dumping cursor \"",
"+",
"cursor",
"+",
"\"\\n\"",
")",
";",
"if",
"(",
"cursor",
"!=",
"null",
")",
"{",
"int",
"... | Prints the contents of a Cursor to a StringBuilder. The position
is restored after printing.
@param cursor the cursor to print
@param sb the StringBuilder to print to | [
"Prints",
"the",
"contents",
"of",
"a",
"Cursor",
"to",
"a",
"StringBuilder",
".",
"The",
"position",
"is",
"restored",
"after",
"printing",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L505-L517 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java | StreamingLocatorsInner.listPathsAsync | public Observable<ListPathsResponseInner> listPathsAsync(String resourceGroupName, String accountName, String streamingLocatorName) {
return listPathsWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListPathsResponseInner>, ListPathsResponseInner>() {
@Override
public ListPathsResponseInner call(ServiceResponse<ListPathsResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ListPathsResponseInner> listPathsAsync(String resourceGroupName, String accountName, String streamingLocatorName) {
return listPathsWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListPathsResponseInner>, ListPathsResponseInner>() {
@Override
public ListPathsResponseInner call(ServiceResponse<ListPathsResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListPathsResponseInner",
">",
"listPathsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"streamingLocatorName",
")",
"{",
"return",
"listPathsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"... | List Paths.
List Paths supported by this Streaming Locator.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingLocatorName The Streaming Locator name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListPathsResponseInner object | [
"List",
"Paths",
".",
"List",
"Paths",
"supported",
"by",
"this",
"Streaming",
"Locator",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L800-L807 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.createCaptureQueryRequet | public static WaybackRequest createCaptureQueryRequet(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setCaptureQueryRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | java | public static WaybackRequest createCaptureQueryRequet(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setCaptureQueryRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | [
"public",
"static",
"WaybackRequest",
"createCaptureQueryRequet",
"(",
"String",
"url",
",",
"String",
"replay",
",",
"String",
"start",
",",
"String",
"end",
")",
"{",
"WaybackRequest",
"r",
"=",
"new",
"WaybackRequest",
"(",
")",
";",
"r",
".",
"setCaptureQu... | create WaybackRequest for Capture-Query request.
@param url target URL
@param replay highlight date
@param start start timestamp (14-digit)
@param end end timestamp (14-digit)
@return WaybackRequest | [
"create",
"WaybackRequest",
"for",
"Capture",
"-",
"Query",
"request",
"."
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L486-L494 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java | WordVectorSerializer.writeWordVectors | public static <T extends SequenceElement> void writeWordVectors(WeightLookupTable<T> lookupTable, String path)
throws IOException {
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path))) {
writeWordVectors(lookupTable, bos);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static <T extends SequenceElement> void writeWordVectors(WeightLookupTable<T> lookupTable, String path)
throws IOException {
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path))) {
writeWordVectors(lookupTable, bos);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"SequenceElement",
">",
"void",
"writeWordVectors",
"(",
"WeightLookupTable",
"<",
"T",
">",
"lookupTable",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedOutputStream",
"bos",
"=",
"new",
... | This method writes word vectors to the given path.
Please note: this method doesn't load whole vocab/lookupTable into memory, so it's able to process large vocabularies served over network.
@param lookupTable
@param path
@param <T> | [
"This",
"method",
"writes",
"word",
"vectors",
"to",
"the",
"given",
"path",
".",
"Please",
"note",
":",
"this",
"method",
"doesn",
"t",
"load",
"whole",
"vocab",
"/",
"lookupTable",
"into",
"memory",
"so",
"it",
"s",
"able",
"to",
"process",
"large",
"v... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L304-L311 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java | snmp_alarm_config.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
snmp_alarm_config_responses result = (snmp_alarm_config_responses) service.get_payload_formatter().string_to_resource(snmp_alarm_config_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_alarm_config_response_array);
}
snmp_alarm_config[] result_snmp_alarm_config = new snmp_alarm_config[result.snmp_alarm_config_response_array.length];
for(int i = 0; i < result.snmp_alarm_config_response_array.length; i++)
{
result_snmp_alarm_config[i] = result.snmp_alarm_config_response_array[i].snmp_alarm_config[0];
}
return result_snmp_alarm_config;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
snmp_alarm_config_responses result = (snmp_alarm_config_responses) service.get_payload_formatter().string_to_resource(snmp_alarm_config_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_alarm_config_response_array);
}
snmp_alarm_config[] result_snmp_alarm_config = new snmp_alarm_config[result.snmp_alarm_config_response_array.length];
for(int i = 0; i < result.snmp_alarm_config_response_array.length; i++)
{
result_snmp_alarm_config[i] = result.snmp_alarm_config_response_array[i].snmp_alarm_config[0];
}
return result_snmp_alarm_config;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"snmp_alarm_config_responses",
"result",
"=",
"(",
"snmp_alarm_config_responses",
")",
"service",
".",
"get_pa... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java#L283-L300 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java | FileWriter.append | public File append(byte[] data, int off, int len) throws IORuntimeException {
return write(data, off, len, true);
} | java | public File append(byte[] data, int off, int len) throws IORuntimeException {
return write(data, off, len, true);
} | [
"public",
"File",
"append",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IORuntimeException",
"{",
"return",
"write",
"(",
"data",
",",
"off",
",",
"len",
",",
"true",
")",
";",
"}"
] | 追加数据到文件
@param data 数据
@param off 数据开始位置
@param len 数据长度
@return 目标文件
@throws IORuntimeException IO异常 | [
"追加数据到文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L273-L275 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.listConnectionStringsAsync | public Observable<DatabaseAccountListConnectionStringsResultInner> listConnectionStringsAsync(String resourceGroupName, String accountName) {
return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListConnectionStringsResultInner>, DatabaseAccountListConnectionStringsResultInner>() {
@Override
public DatabaseAccountListConnectionStringsResultInner call(ServiceResponse<DatabaseAccountListConnectionStringsResultInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountListConnectionStringsResultInner> listConnectionStringsAsync(String resourceGroupName, String accountName) {
return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListConnectionStringsResultInner>, DatabaseAccountListConnectionStringsResultInner>() {
@Override
public DatabaseAccountListConnectionStringsResultInner call(ServiceResponse<DatabaseAccountListConnectionStringsResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountListConnectionStringsResultInner",
">",
"listConnectionStringsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"listConnectionStringsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Lists the connection strings for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountListConnectionStringsResultInner object | [
"Lists",
"the",
"connection",
"strings",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1223-L1230 |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java | TypedCode.relatedTo | public StringBuilder relatedTo(HttpCode<TRANS, ?> code, StringBuilder sb) {
boolean first = true;
for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if(code==null || pair.y.x == code) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb.append(pair.x);
for(Pair<String,Object> prop : pair.y.y) {
// Don't print "Q". it's there for internal use, but it is only meaningful for "Accepts"
if(!prop.x.equals(Q) || !prop.y.equals(1f) ) {
sb.append(';');
sb.append(prop.x);
sb.append('=');
sb.append(prop.y);
}
}
}
}
return sb;
} | java | public StringBuilder relatedTo(HttpCode<TRANS, ?> code, StringBuilder sb) {
boolean first = true;
for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if(code==null || pair.y.x == code) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb.append(pair.x);
for(Pair<String,Object> prop : pair.y.y) {
// Don't print "Q". it's there for internal use, but it is only meaningful for "Accepts"
if(!prop.x.equals(Q) || !prop.y.equals(1f) ) {
sb.append(';');
sb.append(prop.x);
sb.append('=');
sb.append(prop.y);
}
}
}
}
return sb;
} | [
"public",
"StringBuilder",
"relatedTo",
"(",
"HttpCode",
"<",
"TRANS",
",",
"?",
">",
"code",
",",
"StringBuilder",
"sb",
")",
"{",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Pair",
"<",
"String",
",",
"Pair",
"<",
"HttpCode",
"<",
"TRANS",
","... | Print on String Builder content related to specific Code
This is for Reporting and Debugging purposes, so the content is not cached.
If code is "null", then all content is matched
@param code
@return | [
"Print",
"on",
"String",
"Builder",
"content",
"related",
"to",
"specific",
"Code"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java#L171-L193 |
apereo/cas | support/cas-server-support-digest-authentication/src/main/java/org/apereo/cas/digest/util/DigestAuthenticationUtils.java | DigestAuthenticationUtils.createOpaque | public static String createOpaque(final String domain, final String nonce) {
return DigestUtils.md5Hex(domain + nonce);
} | java | public static String createOpaque(final String domain, final String nonce) {
return DigestUtils.md5Hex(domain + nonce);
} | [
"public",
"static",
"String",
"createOpaque",
"(",
"final",
"String",
"domain",
",",
"final",
"String",
"nonce",
")",
"{",
"return",
"DigestUtils",
".",
"md5Hex",
"(",
"domain",
"+",
"nonce",
")",
";",
"}"
] | Create opaque.
@param domain the domain
@param nonce the nonce
@return the opaque | [
"Create",
"opaque",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-digest-authentication/src/main/java/org/apereo/cas/digest/util/DigestAuthenticationUtils.java#L51-L53 |
mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.setOpacity | public void setOpacity(@FloatRange(from = 0.0f, to = 1.0f) float opacity) {
this.opacity = opacity;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(fillExtrusionOpacity(opacity));
} | java | public void setOpacity(@FloatRange(from = 0.0f, to = 1.0f) float opacity) {
this.opacity = opacity;
if (!style.isFullyLoaded()) {
// We are in progress of loading a new style
return;
}
fillExtrusionLayer.setProperties(fillExtrusionOpacity(opacity));
} | [
"public",
"void",
"setOpacity",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"0.0f",
",",
"to",
"=",
"1.0f",
")",
"float",
"opacity",
")",
"{",
"this",
".",
"opacity",
"=",
"opacity",
";",
"if",
"(",
"!",
"style",
".",
"isFullyLoaded",
"(",
")",
")",
... | Change the building opacity. Calls into changing the fill extrusion fill opacity.
@param opacity {@code float} value between 0 (invisible) and 1 (solid)
@since 0.1.0 | [
"Change",
"the",
"building",
"opacity",
".",
"Calls",
"into",
"changing",
"the",
"fill",
"extrusion",
"fill",
"opacity",
"."
] | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L162-L170 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java | MultiPartFaxJob2HTTPRequestConverter.addContentPart | protected final void addContentPart(List<ContentPart<?>> contentList,String key,String value)
{
if((key!=null)&&(value!=null)&&(value.length()>0))
{
if(this.shouldAddContentPart(key))
{
contentList.add(new ContentPart<String>(key,value,ContentPartType.STRING));
}
}
} | java | protected final void addContentPart(List<ContentPart<?>> contentList,String key,String value)
{
if((key!=null)&&(value!=null)&&(value.length()>0))
{
if(this.shouldAddContentPart(key))
{
contentList.add(new ContentPart<String>(key,value,ContentPartType.STRING));
}
}
} | [
"protected",
"final",
"void",
"addContentPart",
"(",
"List",
"<",
"ContentPart",
"<",
"?",
">",
">",
"contentList",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"key",
"!=",
"null",
")",
"&&",
"(",
"value",
"!=",
"null",
")... | This function adds a string content part
@param contentList
The content list with all the created parts
@param key
The parameter key
@param value
The parameter value | [
"This",
"function",
"adds",
"a",
"string",
"content",
"part"
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java#L492-L501 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.getSessionSourceInfo | public GetSessionSourceInfoResponse getSessionSourceInfo(String sessionId) {
checkStringNotEmpty(sessionId, "The parameter sessionId should NOT be null or empty string.");
GetSessionSourceInfoRequest request = new GetSessionSourceInfoRequest();
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION, sessionId);
internalRequest.addParameter(SOURCE_INFO, null);
return invokeHttpClient(internalRequest, GetSessionSourceInfoResponse.class);
} | java | public GetSessionSourceInfoResponse getSessionSourceInfo(String sessionId) {
checkStringNotEmpty(sessionId, "The parameter sessionId should NOT be null or empty string.");
GetSessionSourceInfoRequest request = new GetSessionSourceInfoRequest();
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION, sessionId);
internalRequest.addParameter(SOURCE_INFO, null);
return invokeHttpClient(internalRequest, GetSessionSourceInfoResponse.class);
} | [
"public",
"GetSessionSourceInfoResponse",
"getSessionSourceInfo",
"(",
"String",
"sessionId",
")",
"{",
"checkStringNotEmpty",
"(",
"sessionId",
",",
"\"The parameter sessionId should NOT be null or empty string.\"",
")",
";",
"GetSessionSourceInfoRequest",
"request",
"=",
"new",... | Get your live session source info by live session id.
@param sessionId Live session id.
@return Your live session source info | [
"Get",
"your",
"live",
"session",
"source",
"info",
"by",
"live",
"session",
"id",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1076-L1082 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsTool.java | CmsTool.addToolGroup | public void addToolGroup(CmsToolGroup group, float position) {
m_container.addIdentifiableObject(group.getName(), group, position);
} | java | public void addToolGroup(CmsToolGroup group, float position) {
m_container.addIdentifiableObject(group.getName(), group, position);
} | [
"public",
"void",
"addToolGroup",
"(",
"CmsToolGroup",
"group",
",",
"float",
"position",
")",
"{",
"m_container",
".",
"addIdentifiableObject",
"(",
"group",
".",
"getName",
"(",
")",
",",
"group",
",",
"position",
")",
";",
"}"
] | Adds a group at the given position.<p>
@param group the group
@param position the position
@see org.opencms.workplace.tools.CmsIdentifiableObjectContainer#addIdentifiableObject(String, Object, float) | [
"Adds",
"a",
"group",
"at",
"the",
"given",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsTool.java#L92-L95 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstruction | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, Location loc) {
return fromVisitedInstruction(classContext, method, loc.getHandle());
} | java | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, Location loc) {
return fromVisitedInstruction(classContext, method, loc.getHandle());
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstruction",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
",",
"Location",
"loc",
")",
"{",
"return",
"fromVisitedInstruction",
"(",
"classContext",
",",
"method",
",",
"loc",
".",
"getHandle",
... | Create from Method and Location in a visited class.
@param classContext
ClassContext of visited class
@param method
Method in visited class
@param loc
Location in visited class
@return SourceLineAnnotation describing visited Location | [
"Create",
"from",
"Method",
"and",
"Location",
"in",
"a",
"visited",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L399-L401 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.getDeleteResponse | public static Response getDeleteResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "delete")) {
if (app != null && content != null && content.getId() != null && content.getAppid() != null) {
if (checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
content.setAppid(isNotAnApp(content.getType()) ? app.getAppIdentifier() : app.getAppid());
content.delete();
return Response.ok().build();
}
return getStatusResponse(Response.Status.BAD_REQUEST);
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} | java | public static Response getDeleteResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "delete")) {
if (app != null && content != null && content.getId() != null && content.getAppid() != null) {
if (checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
content.setAppid(isNotAnApp(content.getType()) ? app.getAppIdentifier() : app.getAppid());
content.delete();
return Response.ok().build();
}
return getStatusResponse(Response.Status.BAD_REQUEST);
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} | [
"public",
"static",
"Response",
"getDeleteResponse",
"(",
"App",
"app",
",",
"ParaObject",
"content",
")",
"{",
"try",
"(",
"final",
"Metrics",
".",
"Context",
"context",
"=",
"Metrics",
".",
"time",
"(",
"app",
"==",
"null",
"?",
"null",
":",
"app",
"."... | Delete response as JSON.
@param content the object to delete
@param app the current App object
@return a status code 200 or 400 | [
"Delete",
"response",
"as",
"JSON",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L459-L472 |
craterdog/java-general-utilities | src/main/java/craterdog/utils/ByteUtils.java | ByteUtils.bytesToShort | static public short bytesToShort(byte[] buffer, int index) {
int length = 2;
short integer = 0;
for (int i = 0; i < length; i++) {
integer |= ((buffer[index + length - i - 1] & 0xFF) << (i * 8));
}
return integer;
} | java | static public short bytesToShort(byte[] buffer, int index) {
int length = 2;
short integer = 0;
for (int i = 0; i < length; i++) {
integer |= ((buffer[index + length - i - 1] & 0xFF) << (i * 8));
}
return integer;
} | [
"static",
"public",
"short",
"bytesToShort",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"int",
"length",
"=",
"2",
";",
"short",
"integer",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
... | This function converts the bytes in a byte array at the specified index to its
corresponding short value.
@param buffer The byte array containing the short.
@param index The index for the first byte in the byte array.
@return The corresponding short value. | [
"This",
"function",
"converts",
"the",
"bytes",
"in",
"a",
"byte",
"array",
"at",
"the",
"specified",
"index",
"to",
"its",
"corresponding",
"short",
"value",
"."
] | train | https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L156-L163 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.maxRows | public static DMatrixRMaj maxRows(DMatrixRMaj input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,1);
} else {
output.reshape(input.numRows,1);
}
for( int row = 0; row < input.numRows; row++ ) {
double max = -Double.MAX_VALUE;
int end = (row+1)*input.numCols;
for( int index = row*input.numCols; index < end; index++ ) {
double v = input.data[index];
if( v > max )
max = v;
}
output.set(row,max);
}
return output;
} | java | public static DMatrixRMaj maxRows(DMatrixRMaj input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,1);
} else {
output.reshape(input.numRows,1);
}
for( int row = 0; row < input.numRows; row++ ) {
double max = -Double.MAX_VALUE;
int end = (row+1)*input.numCols;
for( int index = row*input.numCols; index < end; index++ ) {
double v = input.data[index];
if( v > max )
max = v;
}
output.set(row,max);
}
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"maxRows",
"(",
"DMatrixRMaj",
"input",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"input",
".",
"numRows",
",",
"1",
")",
";",
"}",
... | <p>
Finds the element with the maximum value along each row in the input matrix and returns the results in a vector:<br>
<br>
b<sub>j</sub> = max(i=1:n ; a<sub>ji</sub>)
</p>
@param input Input matrix
@param output Optional storage for output. Reshaped into a column. Modified.
@return Vector containing the sum of each row in the input. | [
"<p",
">",
"Finds",
"the",
"element",
"with",
"the",
"maximum",
"value",
"along",
"each",
"row",
"in",
"the",
"input",
"matrix",
"and",
"returns",
"the",
"results",
"in",
"a",
"vector",
":",
"<br",
">",
"<br",
">",
"b<sub",
">",
"j<",
"/",
"sub",
">"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1926-L1946 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java | HBaseDataHandler.writeHbaseRowInATable | private void writeHbaseRowInATable(String tableName, HBaseRow hbaseRow) throws IOException
{
Table hTable = gethTable(tableName);
((HBaseWriter) hbaseWriter).writeRow(hTable, hbaseRow);
hTable.close();
} | java | private void writeHbaseRowInATable(String tableName, HBaseRow hbaseRow) throws IOException
{
Table hTable = gethTable(tableName);
((HBaseWriter) hbaseWriter).writeRow(hTable, hbaseRow);
hTable.close();
} | [
"private",
"void",
"writeHbaseRowInATable",
"(",
"String",
"tableName",
",",
"HBaseRow",
"hbaseRow",
")",
"throws",
"IOException",
"{",
"Table",
"hTable",
"=",
"gethTable",
"(",
"tableName",
")",
";",
"(",
"(",
"HBaseWriter",
")",
"hbaseWriter",
")",
".",
"wri... | Write hbase row in a table.
@param tableName
the table name
@param hbaseRow
the hbase row
@throws IOException
Signals that an I/O exception has occurred. | [
"Write",
"hbase",
"row",
"in",
"a",
"table",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java#L316-L321 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/TransactionImpl.java | TransactionImpl.afterLoading | public void afterLoading(CollectionProxyDefaultImpl colProxy)
{
if (log.isDebugEnabled()) log.debug("loading a proxied collection a collection: " + colProxy);
Collection data = colProxy.getData();
for (Iterator iterator = data.iterator(); iterator.hasNext();)
{
Object o = iterator.next();
if(!isOpen())
{
log.error("Collection proxy materialization outside of a running tx, obj=" + o);
try{throw new Exception("Collection proxy materialization outside of a running tx, obj=" + o);}
catch(Exception e)
{e.printStackTrace();}
}
else
{
Identity oid = getBroker().serviceIdentity().buildIdentity(o);
ClassDescriptor cld = getBroker().getClassDescriptor(ProxyHelper.getRealClass(o));
RuntimeObject rt = new RuntimeObject(o, oid, cld, false, ProxyHelper.isProxy(o));
lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList());
}
}
unregisterFromCollectionProxy(colProxy);
} | java | public void afterLoading(CollectionProxyDefaultImpl colProxy)
{
if (log.isDebugEnabled()) log.debug("loading a proxied collection a collection: " + colProxy);
Collection data = colProxy.getData();
for (Iterator iterator = data.iterator(); iterator.hasNext();)
{
Object o = iterator.next();
if(!isOpen())
{
log.error("Collection proxy materialization outside of a running tx, obj=" + o);
try{throw new Exception("Collection proxy materialization outside of a running tx, obj=" + o);}
catch(Exception e)
{e.printStackTrace();}
}
else
{
Identity oid = getBroker().serviceIdentity().buildIdentity(o);
ClassDescriptor cld = getBroker().getClassDescriptor(ProxyHelper.getRealClass(o));
RuntimeObject rt = new RuntimeObject(o, oid, cld, false, ProxyHelper.isProxy(o));
lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList());
}
}
unregisterFromCollectionProxy(colProxy);
} | [
"public",
"void",
"afterLoading",
"(",
"CollectionProxyDefaultImpl",
"colProxy",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"loading a proxied collection a collection: \"",
"+",
"colProxy",
")",
";",
"Collection",
... | Remove colProxy from list of pending collections and
register its contents with the transaction. | [
"Remove",
"colProxy",
"from",
"list",
"of",
"pending",
"collections",
"and",
"register",
"its",
"contents",
"with",
"the",
"transaction",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L1259-L1282 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java | IndexElasticsearchUpdater.createIndexWithSettingsInElasticsearch | private static void createIndexWithSettingsInElasticsearch(RestClient client, String index, String settings) throws Exception {
logger.trace("createIndex([{}])", index);
assert client != null;
assert index != null;
Request request = new Request("PUT", "/" + index);
// If there are settings for this index, we use it. If not, using Elasticsearch defaults.
if (settings != null) {
logger.trace("Found settings for index [{}]: [{}]", index, settings);
request.setJsonEntity(settings);
}
Response response = client.performRequest(request);
if (response.getStatusLine().getStatusCode() != 200) {
logger.warn("Could not create index [{}]", index);
throw new Exception("Could not create index ["+index+"].");
}
logger.trace("/createIndex([{}])", index);
} | java | private static void createIndexWithSettingsInElasticsearch(RestClient client, String index, String settings) throws Exception {
logger.trace("createIndex([{}])", index);
assert client != null;
assert index != null;
Request request = new Request("PUT", "/" + index);
// If there are settings for this index, we use it. If not, using Elasticsearch defaults.
if (settings != null) {
logger.trace("Found settings for index [{}]: [{}]", index, settings);
request.setJsonEntity(settings);
}
Response response = client.performRequest(request);
if (response.getStatusLine().getStatusCode() != 200) {
logger.warn("Could not create index [{}]", index);
throw new Exception("Could not create index ["+index+"].");
}
logger.trace("/createIndex([{}])", index);
} | [
"private",
"static",
"void",
"createIndexWithSettingsInElasticsearch",
"(",
"RestClient",
"client",
",",
"String",
"index",
",",
"String",
"settings",
")",
"throws",
"Exception",
"{",
"logger",
".",
"trace",
"(",
"\"createIndex([{}])\"",
",",
"index",
")",
";",
"a... | Create a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@param settings Settings if any, null if no specific settings
@throws Exception if the elasticsearch API call is failing | [
"Create",
"a",
"new",
"index",
"in",
"Elasticsearch"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L276-L297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.