repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonEquals | public static void assertJsonEquals(Object expected, Object actual, Configuration configuration) {
assertJsonPartEquals(expected, actual, ROOT, configuration);
} | java | public static void assertJsonEquals(Object expected, Object actual, Configuration configuration) {
assertJsonPartEquals(expected, actual, ROOT, configuration);
} | [
"public",
"static",
"void",
"assertJsonEquals",
"(",
"Object",
"expected",
",",
"Object",
"actual",
",",
"Configuration",
"configuration",
")",
"{",
"assertJsonPartEquals",
"(",
"expected",
",",
"actual",
",",
"ROOT",
",",
"configuration",
")",
";",
"}"
] | Compares to JSON documents. Throws {@link AssertionError} if they are different. | [
"Compares",
"to",
"JSON",
"documents",
".",
"Throws",
"{"
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L66-L68 |
SeleniumJT/seleniumjt-core | src/main/java/com/jt/selenium/SeleniumJT.java | SeleniumJT.fireEvent | @LogExecTime
public void fireEvent(String locator, String eventName)
{
jtCore.fireEvent(locator, eventName);
} | java | @LogExecTime
public void fireEvent(String locator, String eventName)
{
jtCore.fireEvent(locator, eventName);
} | [
"@",
"LogExecTime",
"public",
"void",
"fireEvent",
"(",
"String",
"locator",
",",
"String",
"eventName",
")",
"{",
"jtCore",
".",
"fireEvent",
"(",
"locator",
",",
"eventName",
")",
";",
"}"
] | This requires a jquery locator or an ID. The leading hash (#) should not be provided to this method if it is just an ID | [
"This",
"requires",
"a",
"jquery",
"locator",
"or",
"an",
"ID",
".",
"The",
"leading",
"hash",
"(",
"#",
")",
"should",
"not",
"be",
"provided",
"to",
"this",
"method",
"if",
"it",
"is",
"just",
"an",
"ID"
] | train | https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/SeleniumJT.java#L741-L745 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ProactiveDetectionConfigurationsInner.java | ProactiveDetectionConfigurationsInner.getAsync | public Observable<ApplicationInsightsComponentProactiveDetectionConfigurationInner> getAsync(String resourceGroupName, String resourceName, String configurationId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, configurationId).map(new Func1<ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner>, ApplicationInsightsComponentProactiveDetectionConfigurationInner>() {
@Override
public ApplicationInsightsComponentProactiveDetectionConfigurationInner call(ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentProactiveDetectionConfigurationInner> getAsync(String resourceGroupName, String resourceName, String configurationId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, configurationId).map(new Func1<ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner>, ApplicationInsightsComponentProactiveDetectionConfigurationInner>() {
@Override
public ApplicationInsightsComponentProactiveDetectionConfigurationInner call(ServiceResponse<ApplicationInsightsComponentProactiveDetectionConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentProactiveDetectionConfigurationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"configurationId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"reso... | Get the ProactiveDetection configuration for this configuration id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param configurationId The ProactiveDetection configuration ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentProactiveDetectionConfigurationInner object | [
"Get",
"the",
"ProactiveDetection",
"configuration",
"for",
"this",
"configuration",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ProactiveDetectionConfigurationsInner.java#L196-L203 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.createVerificationContext | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KSIException("Failed to createSignature verification context. KSI extending service must be present.");
}
if (publicationsFile == null) {
throw new KSIException("Failed to createSignature verification context. PublicationsFile must be present.");
}
return new KSIVerificationContext(publicationsFile, signature, userPublication, extendingAllowed, extendingService, documentHash, inputHashLevel);
} | java | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KSIException("Failed to createSignature verification context. KSI extending service must be present.");
}
if (publicationsFile == null) {
throw new KSIException("Failed to createSignature verification context. PublicationsFile must be present.");
}
return new KSIVerificationContext(publicationsFile, signature, userPublication, extendingAllowed, extendingService, documentHash, inputHashLevel);
} | [
"@",
"Deprecated",
"public",
"final",
"VerificationContext",
"createVerificationContext",
"(",
")",
"throws",
"KSIException",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. Signa... | Builds the verification context.
@return instance of verification context
@throws KSIException when error occurs (e.g mandatory parameters aren't present) | [
"Builds",
"the",
"verification",
"context",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L149-L161 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java | RichClientFramework.isEqual | private boolean isEqual(Object o1, Object o2)
{
// Both null - they are equal
if (o1 == null && o2 == null)
{
return true;
}
// One is null and the other isn't - they are not equal
if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
{
return false;
}
// Otherwise fight it out amongst themselves
return o1.equals(o2);
} | java | private boolean isEqual(Object o1, Object o2)
{
// Both null - they are equal
if (o1 == null && o2 == null)
{
return true;
}
// One is null and the other isn't - they are not equal
if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
{
return false;
}
// Otherwise fight it out amongst themselves
return o1.equals(o2);
} | [
"private",
"boolean",
"isEqual",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"// Both null - they are equal",
"if",
"(",
"o1",
"==",
"null",
"&&",
"o2",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"// One is null and the other isn't - they are no... | Compares two objects. Returns false if one is null but the other isn't, returns true if both
are null, otherwise returns the result of their equals() method.
@param o1
@param o2
@return Returns true if o1 and o2 are equal. | [
"Compares",
"two",
"objects",
".",
"Returns",
"false",
"if",
"one",
"is",
"null",
"but",
"the",
"other",
"isn",
"t",
"returns",
"true",
"if",
"both",
"are",
"null",
"otherwise",
"returns",
"the",
"result",
"of",
"their",
"equals",
"()",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java#L638-L653 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/ObjectIdentifier.java | ObjectIdentifier.verifyNonEmpty | protected static String verifyNonEmpty(String value, String argName) {
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
value = null;
}
}
if (value == null) {
throw new IllegalArgumentException(argName);
}
return value;
} | java | protected static String verifyNonEmpty(String value, String argName) {
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
value = null;
}
}
if (value == null) {
throw new IllegalArgumentException(argName);
}
return value;
} | [
"protected",
"static",
"String",
"verifyNonEmpty",
"(",
"String",
"value",
",",
"String",
"argName",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"if",
"(",
"value",
".",
"isEmpty",
"(",
")"... | Verifies a value is null or empty. Returns the value if non-empty and throws exception if empty.
@param value the value to verify.
@param argName the name of the value.
@return Returns the value if non-empty. | [
"Verifies",
"a",
"value",
"is",
"null",
"or",
"empty",
".",
"Returns",
"the",
"value",
"if",
"non",
"-",
"empty",
"and",
"throws",
"exception",
"if",
"empty",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/ObjectIdentifier.java#L52-L63 |
needle4j/needle4j | src/main/java/org/needle4j/common/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(final boolean condition, final String message, final Object... parameters) {
if (!condition) {
throw new IllegalArgumentException(format(message, parameters));
}
} | java | public static void checkArgument(final boolean condition, final String message, final Object... parameters) {
if (!condition) {
throw new IllegalArgumentException(format(message, parameters));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"final",
"boolean",
"condition",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",... | Throws an {@link IllegalArgumentException} with formatted message if
condition is not met.
@param condition
a boolean condition that must be <code>true</code> to pass
@param message
text to use as exception message
@param parameters
optional parameters used in
{@link String#format(String, Object...)} | [
"Throws",
"an",
"{",
"@link",
"IllegalArgumentException",
"}",
"with",
"formatted",
"message",
"if",
"condition",
"is",
"not",
"met",
"."
] | train | https://github.com/needle4j/needle4j/blob/55fbcdeed72be5cf26e4404b0fe40282792b51f2/src/main/java/org/needle4j/common/Preconditions.java#L47-L51 |
authorjapps/zerocode | core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java | BasicHttpClient.createDefaultRequestBuilder | public RequestBuilder createDefaultRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) {
RequestBuilder requestBuilder = RequestBuilder
.create(methodName)
.setUri(httpUrl);
if (reqBodyAsString != null) {
HttpEntity httpEntity = EntityBuilder.create()
.setContentType(APPLICATION_JSON)
.setText(reqBodyAsString)
.build();
requestBuilder.setEntity(httpEntity);
}
return requestBuilder;
} | java | public RequestBuilder createDefaultRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) {
RequestBuilder requestBuilder = RequestBuilder
.create(methodName)
.setUri(httpUrl);
if (reqBodyAsString != null) {
HttpEntity httpEntity = EntityBuilder.create()
.setContentType(APPLICATION_JSON)
.setText(reqBodyAsString)
.build();
requestBuilder.setEntity(httpEntity);
}
return requestBuilder;
} | [
"public",
"RequestBuilder",
"createDefaultRequestBuilder",
"(",
"String",
"httpUrl",
",",
"String",
"methodName",
",",
"String",
"reqBodyAsString",
")",
"{",
"RequestBuilder",
"requestBuilder",
"=",
"RequestBuilder",
".",
"create",
"(",
"methodName",
")",
".",
"setUri... | This is the usual http request builder most widely used using Apache Http Client. In case you want to build
or prepare the requests differently, you can override this method.
Please see the following request builder to handle file uploads.
- BasicHttpClient#createFileUploadRequestBuilder(java.lang.String, java.lang.String, java.lang.String)
You can override this method via @UseHttpClient(YourCustomHttpClient.class)
@param httpUrl
@param methodName
@param reqBodyAsString
@return | [
"This",
"is",
"the",
"usual",
"http",
"request",
"builder",
"most",
"widely",
"used",
"using",
"Apache",
"Http",
"Client",
".",
"In",
"case",
"you",
"want",
"to",
"build",
"or",
"prepare",
"the",
"requests",
"differently",
"you",
"can",
"override",
"this",
... | train | https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L279-L292 |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java | RScriptExporter.writeScriptHeader | protected void writeScriptHeader(Writer writer, Engine engine) throws IOException {
writer.append("#Code automatically generated with " + FuzzyLite.LIBRARY + ".\n\n");
writer.append("library(ggplot2);\n");
writer.append("\n");
writer.append("engine.name = \"" + engine.getName() + "\"\n");
if (!Op.isEmpty(engine.getDescription())) {
writer.append(String.format(
"engine.description = \"%s\"\n", engine.getDescription()));
}
writer.append("engine.fll = \"" + new FllExporter().toString(engine) + "\"\n\n");
} | java | protected void writeScriptHeader(Writer writer, Engine engine) throws IOException {
writer.append("#Code automatically generated with " + FuzzyLite.LIBRARY + ".\n\n");
writer.append("library(ggplot2);\n");
writer.append("\n");
writer.append("engine.name = \"" + engine.getName() + "\"\n");
if (!Op.isEmpty(engine.getDescription())) {
writer.append(String.format(
"engine.description = \"%s\"\n", engine.getDescription()));
}
writer.append("engine.fll = \"" + new FllExporter().toString(engine) + "\"\n\n");
} | [
"protected",
"void",
"writeScriptHeader",
"(",
"Writer",
"writer",
",",
"Engine",
"engine",
")",
"throws",
"IOException",
"{",
"writer",
".",
"append",
"(",
"\"#Code automatically generated with \"",
"+",
"FuzzyLite",
".",
"LIBRARY",
"+",
"\".\\n\\n\"",
")",
";",
... | Writes the header of the R script (e.g., import libraries)
@param writer is the output where the header will be written to
@param engine is the engine to export
@throws IOException if any error occurs upon writing on the writer | [
"Writes",
"the",
"header",
"of",
"the",
"R",
"script",
"(",
"e",
".",
"g",
".",
"import",
"libraries",
")"
] | train | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java#L375-L385 |
lightblueseas/email-tails | src/main/java/de/alpharogroup/email/messages/EmailWithAttachments.java | EmailWithAttachments.addAttachment | public void addAttachment(final byte[] content, final String filename, final String mimetype)
throws MessagingException
{
final DataSource dataSource = new ByteArrayDataSource(content, mimetype);
final DataHandler dataHandler = new DataHandler(dataSource);
addAttachment(dataHandler, filename);
} | java | public void addAttachment(final byte[] content, final String filename, final String mimetype)
throws MessagingException
{
final DataSource dataSource = new ByteArrayDataSource(content, mimetype);
final DataHandler dataHandler = new DataHandler(dataSource);
addAttachment(dataHandler, filename);
} | [
"public",
"void",
"addAttachment",
"(",
"final",
"byte",
"[",
"]",
"content",
",",
"final",
"String",
"filename",
",",
"final",
"String",
"mimetype",
")",
"throws",
"MessagingException",
"{",
"final",
"DataSource",
"dataSource",
"=",
"new",
"ByteArrayDataSource",
... | Adds the attachment.
@param content
The bytearray with the content.
@param filename
The new Filename for the attachment.
@param mimetype
The mimetype.
@throws MessagingException
is thrown if the underlying implementation does not support modification of
existing values | [
"Adds",
"the",
"attachment",
"."
] | train | https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/messages/EmailWithAttachments.java#L97-L103 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.batchNorm | public SDVariable batchNorm(String name, SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
return batchNorm(name, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | java | public SDVariable batchNorm(String name, SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
return batchNorm(name, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | [
"public",
"SDVariable",
"batchNorm",
"(",
"String",
"name",
",",
"SDVariable",
"input",
",",
"SDVariable",
"mean",
",",
"SDVariable",
"variance",
",",
"SDVariable",
"gamma",
",",
"SDVariable",
"beta",
",",
"double",
"epsilon",
",",
"int",
"...",
"axis",
")",
... | Neural network batch normalization operation.<br>
For details, see <a href="http://arxiv.org/abs/1502.03167">http://arxiv.org/abs/1502.03167</a>
@param name Name of the output variable
@param input Input variable.
@param mean Mean value. For 1d axis, this should match input.size(axis)
@param variance Variance value. For 1d axis, this should match input.size(axis)
@param gamma Gamma value. For 1d axis, this should match input.size(axis)
@param beta Beta value. For 1d axis, this should match input.size(axis)
@param epsilon Epsilon constant for numerical stability (to avoid division by 0)
@param axis For 2d CNN activations: 1 for NCHW format activations, or 3 for NHWC format activations.<br>
For 3d CNN activations: 1 for NCDHW format, 4 for NDHWC<br>
For 1d/RNN activations: 1 for NCW format, 2 for NWC
@return Output variable for batch normalization | [
"Neural",
"network",
"batch",
"normalization",
"operation",
".",
"<br",
">",
"For",
"details",
"see",
"<a",
"href",
"=",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1502",
".",
"03167",
">",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L69-L73 |
stripe/stripe-java | src/main/java/com/stripe/model/Invoice.java | Invoice.sendInvoice | public Invoice sendInvoice() throws StripeException {
return sendInvoice((Map<String, Object>) null, (RequestOptions) null);
} | java | public Invoice sendInvoice() throws StripeException {
return sendInvoice((Map<String, Object>) null, (RequestOptions) null);
} | [
"public",
"Invoice",
"sendInvoice",
"(",
")",
"throws",
"StripeException",
"{",
"return",
"sendInvoice",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"null",
",",
"(",
"RequestOptions",
")",
"null",
")",
";",
"}"
] | Stripe will automatically send invoices to customers according to your <a
href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
However, if you’d like to manually send an invoice to your customer out of the normal schedule,
you can do so. When sending invoices that have already been paid, there will be no reference to
the payment in the email.
<p>Requests made in test-mode result in no emails being sent, despite sending an <code>
invoice.sent</code> event. | [
"Stripe",
"will",
"automatically",
"send",
"invoices",
"to",
"customers",
"according",
"to",
"your",
"<a",
"href",
"=",
"https",
":",
"//",
"dashboard",
".",
"stripe",
".",
"com",
"/",
"account",
"/",
"billing",
"/",
"automatic",
">",
"subscriptions",
"setti... | train | https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Invoice.java#L1017-L1019 |
lastaflute/lastaflute | src/main/java/org/lastaflute/core/magic/ThreadCacheContext.java | ThreadCacheContext.setObject | public static void setObject(String key, Object value) {
if (!exists()) {
throwThreadCacheNotInitializedException(key);
}
threadLocal.get().put(key, value);
} | java | public static void setObject(String key, Object value) {
if (!exists()) {
throwThreadCacheNotInitializedException(key);
}
threadLocal.get().put(key, value);
} | [
"public",
"static",
"void",
"setObject",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"throwThreadCacheNotInitializedException",
"(",
"key",
")",
";",
"}",
"threadLocal",
".",
"get",
"(",
")",
".",... | Set the value of the object.
@param key The key of the object. (NotNull)
@param value The value of the object. (NullAllowed) | [
"Set",
"the",
"value",
"of",
"the",
"object",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/core/magic/ThreadCacheContext.java#L146-L151 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsNone | public static boolean containsNone (@Nullable final String sStr, @Nullable final ICharPredicate aFilter)
{
final int nLen = getLength (sStr);
if (aFilter == null)
return nLen == 0;
if (nLen > 0)
for (final char c : sStr.toCharArray ())
if (aFilter.test (c))
return false;
return true;
} | java | public static boolean containsNone (@Nullable final String sStr, @Nullable final ICharPredicate aFilter)
{
final int nLen = getLength (sStr);
if (aFilter == null)
return nLen == 0;
if (nLen > 0)
for (final char c : sStr.toCharArray ())
if (aFilter.test (c))
return false;
return true;
} | [
"public",
"static",
"boolean",
"containsNone",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"ICharPredicate",
"aFilter",
")",
"{",
"final",
"int",
"nLen",
"=",
"getLength",
"(",
"sStr",
")",
";",
"if",
"(",
"aFilter",
"==... | Check if the passed {@link String} contains no character matching the
provided filter.
@param sStr
String to check. May be <code>null</code>.
@param aFilter
The filter to use. May be <code>null</code>.
@return <code>true</code> if the filter is <code>null</code> and the string
is empty. <code>true</code> if the filter is not <code>null</code>
and no character of the string matches the filter. <code>false</code>
otherwise.
@since 9.1.7 | [
"Check",
"if",
"the",
"passed",
"{",
"@link",
"String",
"}",
"contains",
"no",
"character",
"matching",
"the",
"provided",
"filter",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L284-L295 |
j256/ormlite-core | src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java | DatabaseFieldConfig.fromField | public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field)
throws SQLException {
// first we lookup the @DatabaseField annotation
DatabaseField databaseField = field.getAnnotation(DatabaseField.class);
if (databaseField != null) {
if (databaseField.persisted()) {
return fromDatabaseField(databaseType, tableName, field, databaseField);
} else {
return null;
}
}
// lastly we check for @ForeignCollectionField
ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class);
if (foreignCollection != null) {
return fromForeignCollection(databaseType, field, foreignCollection);
}
/*
* NOTE: to remove javax.persistence usage, comment the following lines out
*/
if (javaxPersistenceConfigurer == null) {
return null;
} else {
// this can be null
return javaxPersistenceConfigurer.createFieldConfig(databaseType, field);
}
} | java | public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field)
throws SQLException {
// first we lookup the @DatabaseField annotation
DatabaseField databaseField = field.getAnnotation(DatabaseField.class);
if (databaseField != null) {
if (databaseField.persisted()) {
return fromDatabaseField(databaseType, tableName, field, databaseField);
} else {
return null;
}
}
// lastly we check for @ForeignCollectionField
ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class);
if (foreignCollection != null) {
return fromForeignCollection(databaseType, field, foreignCollection);
}
/*
* NOTE: to remove javax.persistence usage, comment the following lines out
*/
if (javaxPersistenceConfigurer == null) {
return null;
} else {
// this can be null
return javaxPersistenceConfigurer.createFieldConfig(databaseType, field);
}
} | [
"public",
"static",
"DatabaseFieldConfig",
"fromField",
"(",
"DatabaseType",
"databaseType",
",",
"String",
"tableName",
",",
"Field",
"field",
")",
"throws",
"SQLException",
"{",
"// first we lookup the @DatabaseField annotation",
"DatabaseField",
"databaseField",
"=",
"fi... | Create and return a config converted from a {@link Field} that may have one of the following annotations:
{@link DatabaseField}, {@link ForeignCollectionField}, or javax.persistence... | [
"Create",
"and",
"return",
"a",
"config",
"converted",
"from",
"a",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L511-L539 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getGetter | public static MethodInstance getGetter(Class clazz, String prop) throws PageException, NoSuchMethodException {
String getterName = "get" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(getterName), ArrayUtil.OBJECT_EMPTY);
if (mi == null) {
String isName = "is" + StringUtil.ucFirst(prop);
mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(isName), ArrayUtil.OBJECT_EMPTY);
if (mi != null) {
Method m = mi.getMethod();
Class rtn = m.getReturnType();
if (rtn != Boolean.class && rtn != boolean.class) mi = null;
}
}
if (mi == null) throw new ExpressionException("No matching property [" + prop + "] found in [" + Caster.toTypeName(clazz) + "]");
Method m = mi.getMethod();
if (m.getReturnType() == void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] for Property [" + getterName + "] must have return type not void");
return mi;
} | java | public static MethodInstance getGetter(Class clazz, String prop) throws PageException, NoSuchMethodException {
String getterName = "get" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(getterName), ArrayUtil.OBJECT_EMPTY);
if (mi == null) {
String isName = "is" + StringUtil.ucFirst(prop);
mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(isName), ArrayUtil.OBJECT_EMPTY);
if (mi != null) {
Method m = mi.getMethod();
Class rtn = m.getReturnType();
if (rtn != Boolean.class && rtn != boolean.class) mi = null;
}
}
if (mi == null) throw new ExpressionException("No matching property [" + prop + "] found in [" + Caster.toTypeName(clazz) + "]");
Method m = mi.getMethod();
if (m.getReturnType() == void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] for Property [" + getterName + "] must have return type not void");
return mi;
} | [
"public",
"static",
"MethodInstance",
"getGetter",
"(",
"Class",
"clazz",
",",
"String",
"prop",
")",
"throws",
"PageException",
",",
"NoSuchMethodException",
"{",
"String",
"getterName",
"=",
"\"get\"",
"+",
"StringUtil",
".",
"ucFirst",
"(",
"prop",
")",
";",
... | to get a Getter Method of a Object
@param clazz Class to invoke method from
@param prop Name of the Method without get
@return return Value of the getter Method
@throws NoSuchMethodException
@throws PageException | [
"to",
"get",
"a",
"Getter",
"Method",
"of",
"a",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L946-L967 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.createUnknown | public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile) {
return createUnknown(className, sourceFile, -1, -1);
} | java | public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile) {
return createUnknown(className, sourceFile, -1, -1);
} | [
"public",
"static",
"SourceLineAnnotation",
"createUnknown",
"(",
"@",
"DottedClassName",
"String",
"className",
",",
"String",
"sourceFile",
")",
"{",
"return",
"createUnknown",
"(",
"className",
",",
"sourceFile",
",",
"-",
"1",
",",
"-",
"1",
")",
";",
"}"
... | Factory method to create an unknown source line annotation.
@param className
the class name
@param sourceFile
the source file name
@return the SourceLineAnnotation | [
"Factory",
"method",
"to",
"create",
"an",
"unknown",
"source",
"line",
"annotation",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L167-L169 |
icode/ameba-utils | src/main/java/ameba/util/bean/BeanMap.java | BeanMap.put | @Override
public Object put(String name, Object value) throws IllegalArgumentException, ClassCastException {
if (bean != null) {
Object oldValue = get(name);
BeanInvoker invoker = getWriteInvoker(name);
if (invoker == null) {
return null;
}
try {
if (value instanceof BeanMap) {
value = ((BeanMap) value).bean;
}
invoker.invoke(value);
Object newValue = get(name);
firePropertyChange(name, oldValue, newValue);
} catch (Throwable e) {
throw new IllegalArgumentException(e.getMessage());
}
return oldValue;
}
return null;
} | java | @Override
public Object put(String name, Object value) throws IllegalArgumentException, ClassCastException {
if (bean != null) {
Object oldValue = get(name);
BeanInvoker invoker = getWriteInvoker(name);
if (invoker == null) {
return null;
}
try {
if (value instanceof BeanMap) {
value = ((BeanMap) value).bean;
}
invoker.invoke(value);
Object newValue = get(name);
firePropertyChange(name, oldValue, newValue);
} catch (Throwable e) {
throw new IllegalArgumentException(e.getMessage());
}
return oldValue;
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"put",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"IllegalArgumentException",
",",
"ClassCastException",
"{",
"if",
"(",
"bean",
"!=",
"null",
")",
"{",
"Object",
"oldValue",
"=",
"get",
"(",
"name",
... | {@inheritDoc}
Sets the bean property with the given name to the given value. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/bean/BeanMap.java#L255-L278 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/Jar.java | Jar.createDepend | public static PersistentDependency createDepend(PathImpl backing, long digest)
{
Jar jar = create(backing);
return new JarDigestDepend(jar.getJarDepend(), digest);
} | java | public static PersistentDependency createDepend(PathImpl backing, long digest)
{
Jar jar = create(backing);
return new JarDigestDepend(jar.getJarDepend(), digest);
} | [
"public",
"static",
"PersistentDependency",
"createDepend",
"(",
"PathImpl",
"backing",
",",
"long",
"digest",
")",
"{",
"Jar",
"jar",
"=",
"create",
"(",
"backing",
")",
";",
"return",
"new",
"JarDigestDepend",
"(",
"jar",
".",
"getJarDepend",
"(",
")",
","... | Return a Jar for the path. If the backing already exists, return
the old jar. | [
"Return",
"a",
"Jar",
"for",
"the",
"path",
".",
"If",
"the",
"backing",
"already",
"exists",
"return",
"the",
"old",
"jar",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/Jar.java#L168-L173 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.beginCreateOrUpdate | public StorageAccountCredentialInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().single().body();
} | java | public StorageAccountCredentialInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().single().body();
} | [
"public",
"StorageAccountCredentialInner",
"beginCreateOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"StorageAccountCredentialInner",
"storageAccountCredential",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseA... | Creates or updates the storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@param storageAccountCredential The storage account credential.
@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 StorageAccountCredentialInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"storage",
"account",
"credential",
"."
] | 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/StorageAccountCredentialsInner.java#L406-L408 |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.socket_text_stream | public PythonDataStream socket_text_stream(String host, int port) {
return new PythonDataStream<>(env.socketTextStream(host, port).map(new AdapterMap<String>()));
} | java | public PythonDataStream socket_text_stream(String host, int port) {
return new PythonDataStream<>(env.socketTextStream(host, port).map(new AdapterMap<String>()));
} | [
"public",
"PythonDataStream",
"socket_text_stream",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"socketTextStream",
"(",
"host",
",",
"port",
")",
".",
"map",
"(",
"new",
"AdapterMap",
"<",... | A thin wrapper layer over {@link StreamExecutionEnvironment#socketTextStream(java.lang.String, int)}.
@param host The host name which a server socket binds
@param port The port number which a server socket binds. A port number of 0 means that the port number is automatically
allocated.
@return A python data stream containing the strings received from the socket | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#socketTextStream",
"(",
"java",
".",
"lang",
".",
"String",
"int",
")",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L200-L202 |
cvut/JCOP | src/main/java/cz/cvut/felk/cig/jcop/problem/sat/SAT.java | SAT.initCommons | protected void initCommons() {
this.setTrueOperations = new ArrayList<SetTrueOperation>(this.dimension);
this.setFalseOperations = new ArrayList<SetFalseOperation>(this.dimension);
SetTrueOperation setTrueOperation;
SetFalseOperation setFalseOperation;
for (int i = 0; i < this.dimension; ++i) {
setTrueOperation = new SetTrueOperation(this.variables.get(i));
setFalseOperation = new SetFalseOperation(this.variables.get(i));
setTrueOperation.setReverse(setFalseOperation);
setFalseOperation.setReverse(setTrueOperation);
this.setTrueOperations.add(setTrueOperation);
this.setFalseOperations.add(setFalseOperation);
}
// create starting configuration
List<Integer> tmp = new ArrayList<Integer>(this.dimension);
for (int i = 0; i < this.dimension; ++i) tmp.add(0);
this.startingConfiguration = new Configuration(tmp, "Empty SAT created");
} | java | protected void initCommons() {
this.setTrueOperations = new ArrayList<SetTrueOperation>(this.dimension);
this.setFalseOperations = new ArrayList<SetFalseOperation>(this.dimension);
SetTrueOperation setTrueOperation;
SetFalseOperation setFalseOperation;
for (int i = 0; i < this.dimension; ++i) {
setTrueOperation = new SetTrueOperation(this.variables.get(i));
setFalseOperation = new SetFalseOperation(this.variables.get(i));
setTrueOperation.setReverse(setFalseOperation);
setFalseOperation.setReverse(setTrueOperation);
this.setTrueOperations.add(setTrueOperation);
this.setFalseOperations.add(setFalseOperation);
}
// create starting configuration
List<Integer> tmp = new ArrayList<Integer>(this.dimension);
for (int i = 0; i < this.dimension; ++i) tmp.add(0);
this.startingConfiguration = new Configuration(tmp, "Empty SAT created");
} | [
"protected",
"void",
"initCommons",
"(",
")",
"{",
"this",
".",
"setTrueOperations",
"=",
"new",
"ArrayList",
"<",
"SetTrueOperation",
">",
"(",
"this",
".",
"dimension",
")",
";",
"this",
".",
"setFalseOperations",
"=",
"new",
"ArrayList",
"<",
"SetFalseOpera... | Initializes common attributes such as operations and default fitness.
<p/>
Requires {@link #formula}/{@link #variables} to be already fully loaded. | [
"Initializes",
"common",
"attributes",
"such",
"as",
"operations",
"and",
"default",
"fitness",
".",
"<p",
"/",
">",
"Requires",
"{"
] | train | https://github.com/cvut/JCOP/blob/2ec18315a9a452e5f4e3d07cccfde0310adc465a/src/main/java/cz/cvut/felk/cig/jcop/problem/sat/SAT.java#L180-L197 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/PersistentPageFile.java | PersistentPageFile.readPage | @Override
public P readPage(int pageID) {
try {
countRead();
long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
byte[] buffer = new byte[pageSize];
file.seek(offset);
file.read(buffer);
return byteArrayToPage(buffer);
}
catch(IOException e) {
throw new RuntimeException("IOException occurred during reading of page " + pageID + "\n", e);
}
} | java | @Override
public P readPage(int pageID) {
try {
countRead();
long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
byte[] buffer = new byte[pageSize];
file.seek(offset);
file.read(buffer);
return byteArrayToPage(buffer);
}
catch(IOException e) {
throw new RuntimeException("IOException occurred during reading of page " + pageID + "\n", e);
}
} | [
"@",
"Override",
"public",
"P",
"readPage",
"(",
"int",
"pageID",
")",
"{",
"try",
"{",
"countRead",
"(",
")",
";",
"long",
"offset",
"=",
"(",
"(",
"long",
")",
"(",
"header",
".",
"getReservedPages",
"(",
")",
"+",
"pageID",
")",
")",
"*",
"(",
... | Reads the page with the given id from this file.
@param pageID the id of the page to be returned
@return the page with the given pageId | [
"Reads",
"the",
"page",
"with",
"the",
"given",
"id",
"from",
"this",
"file",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/PersistentPageFile.java#L112-L125 |
weld/core | impl/src/main/java/org/jboss/weld/resolution/AbstractAssignabilityRules.java | AbstractAssignabilityRules.boundsMatch | protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) {
// getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes
// assignability rules do not reflect our needs
upperBounds = getUppermostBounds(upperBounds);
stricterUpperBounds = getUppermostBounds(stricterUpperBounds);
for (Type upperBound : upperBounds) {
if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) {
return false;
}
}
return true;
} | java | protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) {
// getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes
// assignability rules do not reflect our needs
upperBounds = getUppermostBounds(upperBounds);
stricterUpperBounds = getUppermostBounds(stricterUpperBounds);
for (Type upperBound : upperBounds) {
if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"boundsMatch",
"(",
"Type",
"[",
"]",
"upperBounds",
",",
"Type",
"[",
"]",
"stricterUpperBounds",
")",
"{",
"// getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes",
"// assignability rules do no... | Returns <tt>true</tt> iff for each upper bound T, there is at least one bound from <tt>stricterUpperBounds</tt>
assignable to T. This reflects that <tt>stricterUpperBounds</tt> are at least as strict as <tt>upperBounds</tt> are.
<p>
Arguments passed to this method must be legal java bounds, i.e. bounds returned by {@link TypeVariable#getBounds()},
{@link WildcardType#getUpperBounds()} or {@link WildcardType#getLowerBounds()}. | [
"Returns",
"<tt",
">",
"true<",
"/",
"tt",
">",
"iff",
"for",
"each",
"upper",
"bound",
"T",
"there",
"is",
"at",
"least",
"one",
"bound",
"from",
"<tt",
">",
"stricterUpperBounds<",
"/",
"tt",
">",
"assignable",
"to",
"T",
".",
"This",
"reflects",
"th... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/AbstractAssignabilityRules.java#L79-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/CommonFunction.java | CommonFunction.getNLSMessage | public static final String getNLSMessage(String key, Object... args) {
return NLS.getFormattedMessage(key, args, key);
} | java | public static final String getNLSMessage(String key, Object... args) {
return NLS.getFormattedMessage(key, args, key);
} | [
"public",
"static",
"final",
"String",
"getNLSMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"NLS",
".",
"getFormattedMessage",
"(",
"key",
",",
"args",
",",
"key",
")",
";",
"}"
] | Retrieve a translated message from the J2C messages file.
If the message cannot be found, the key is returned.
@param key a valid message key from the J2C messages file.
@param args a list of parameters to include in the translatable message.
@return a translated message. | [
"Retrieve",
"a",
"translated",
"message",
"from",
"the",
"J2C",
"messages",
"file",
".",
"If",
"the",
"message",
"cannot",
"be",
"found",
"the",
"key",
"is",
"returned",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/CommonFunction.java#L131-L133 |
sporniket/core | sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/WindowLocation.java | WindowLocation.snapWindowTo | public static void snapWindowTo(Window win, int location)
{
Dimension _screen = Toolkit.getDefaultToolkit().getScreenSize();
Dimension _window = win.getSize();
int _wx = 0;
int _wy = 0;
switch (location)
{
case TOP_LEFT:
break;
case TOP_CENTER:
_wx = (_screen.width - _window.width) / 2;
break;
case TOP_RIGHT:
_wx = _screen.width - _window.width;
break;
case MIDDLE_LEFT:
_wy = (_screen.height - _window.height) / 2;
break;
case MIDDLE_CENTER:
_wx = (_screen.width - _window.width) / 2;
_wy = (_screen.height - _window.height) / 2;
break;
case MIDDLE_RIGHT:
_wx = _screen.width - _window.width;
_wy = (_screen.height - _window.height) / 2;
break;
case BOTTOM_LEFT:
_wy = _screen.height - _window.height;
break;
case BOTTOM_CENTER:
_wx = (_screen.width - _window.width) / 2;
_wy = _screen.height - _window.height;
break;
case BOTTOM_RIGHT:
_wx = _screen.width - _window.width;
_wy = _screen.height - _window.height;
break;
}
win.setLocation(new Point(_wx, _wy));
} | java | public static void snapWindowTo(Window win, int location)
{
Dimension _screen = Toolkit.getDefaultToolkit().getScreenSize();
Dimension _window = win.getSize();
int _wx = 0;
int _wy = 0;
switch (location)
{
case TOP_LEFT:
break;
case TOP_CENTER:
_wx = (_screen.width - _window.width) / 2;
break;
case TOP_RIGHT:
_wx = _screen.width - _window.width;
break;
case MIDDLE_LEFT:
_wy = (_screen.height - _window.height) / 2;
break;
case MIDDLE_CENTER:
_wx = (_screen.width - _window.width) / 2;
_wy = (_screen.height - _window.height) / 2;
break;
case MIDDLE_RIGHT:
_wx = _screen.width - _window.width;
_wy = (_screen.height - _window.height) / 2;
break;
case BOTTOM_LEFT:
_wy = _screen.height - _window.height;
break;
case BOTTOM_CENTER:
_wx = (_screen.width - _window.width) / 2;
_wy = _screen.height - _window.height;
break;
case BOTTOM_RIGHT:
_wx = _screen.width - _window.width;
_wy = _screen.height - _window.height;
break;
}
win.setLocation(new Point(_wx, _wy));
} | [
"public",
"static",
"void",
"snapWindowTo",
"(",
"Window",
"win",
",",
"int",
"location",
")",
"{",
"Dimension",
"_screen",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenSize",
"(",
")",
";",
"Dimension",
"_window",
"=",
"win",
".",
"g... | Snap the Window Position to a special location.
@param win
The Window to move
@param location
A value among the allowed predefined positions | [
"Snap",
"the",
"Window",
"Position",
"to",
"a",
"special",
"location",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/WindowLocation.java#L76-L116 |
whitesource/agents | wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java | RequestFactory.newDependencyDataRequest | @Deprecated
public GetDependencyDataRequest newDependencyDataRequest(String orgToken, Collection<AgentProjectInfo> projects, String userKey) {
return newDependencyDataRequest(orgToken, null, null, projects, userKey);
} | java | @Deprecated
public GetDependencyDataRequest newDependencyDataRequest(String orgToken, Collection<AgentProjectInfo> projects, String userKey) {
return newDependencyDataRequest(orgToken, null, null, projects, userKey);
} | [
"@",
"Deprecated",
"public",
"GetDependencyDataRequest",
"newDependencyDataRequest",
"(",
"String",
"orgToken",
",",
"Collection",
"<",
"AgentProjectInfo",
">",
"projects",
",",
"String",
"userKey",
")",
"{",
"return",
"newDependencyDataRequest",
"(",
"orgToken",
",",
... | Create new Dependency Data request.
@param orgToken WhiteSource organization token.
@param projects Projects status statement to check.
@param userKey user key uniquely identifying the account at white source.
@return Newly created request to get Dependency Additional Data (Licenses, Description, homepageUrl and Vulnerabilities). | [
"Create",
"new",
"Dependency",
"Data",
"request",
"."
] | train | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java#L483-L486 |
OpenBEL/openbel-framework | org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java | BasicPathFinder.runDepthFirstScan | private void runDepthFirstScan(final Kam kam,
final KamNode cnode,
final KamNode source,
int depth,
final SetStack<KamNode> nodeStack,
final SetStack<KamEdge> edgeStack,
final List<SimplePath> pathResults) {
depth += 1;
final Set<KamEdge> edges = kam.getAdjacentEdges(cnode, BOTH);
for (final KamEdge edge : edges) {
if (pushEdge(edge, nodeStack, edgeStack)) {
if (depth == maxSearchDepth) {
final SimplePath newPath =
new SimplePath(kam, source, nodeStack.peek(),
edgeStack.toStack());
pathResults.add(newPath);
} else {
// continue depth first scan
runDepthFirstScan(kam, nodeStack.peek(), source, depth,
nodeStack,
edgeStack, pathResults);
}
edgeStack.pop();
nodeStack.pop();
} else if (endOfBranch(edgeStack, edge, edges.size())) {
final SimplePath newPath =
new SimplePath(kam, source, nodeStack.peek(),
edgeStack.toStack());
pathResults.add(newPath);
}
}
} | java | private void runDepthFirstScan(final Kam kam,
final KamNode cnode,
final KamNode source,
int depth,
final SetStack<KamNode> nodeStack,
final SetStack<KamEdge> edgeStack,
final List<SimplePath> pathResults) {
depth += 1;
final Set<KamEdge> edges = kam.getAdjacentEdges(cnode, BOTH);
for (final KamEdge edge : edges) {
if (pushEdge(edge, nodeStack, edgeStack)) {
if (depth == maxSearchDepth) {
final SimplePath newPath =
new SimplePath(kam, source, nodeStack.peek(),
edgeStack.toStack());
pathResults.add(newPath);
} else {
// continue depth first scan
runDepthFirstScan(kam, nodeStack.peek(), source, depth,
nodeStack,
edgeStack, pathResults);
}
edgeStack.pop();
nodeStack.pop();
} else if (endOfBranch(edgeStack, edge, edges.size())) {
final SimplePath newPath =
new SimplePath(kam, source, nodeStack.peek(),
edgeStack.toStack());
pathResults.add(newPath);
}
}
} | [
"private",
"void",
"runDepthFirstScan",
"(",
"final",
"Kam",
"kam",
",",
"final",
"KamNode",
"cnode",
",",
"final",
"KamNode",
"source",
",",
"int",
"depth",
",",
"final",
"SetStack",
"<",
"KamNode",
">",
"nodeStack",
",",
"final",
"SetStack",
"<",
"KamEdge"... | Runs a recursive depth-first scan from a {@link KamNode} source until a
max search depth ({@link BasicPathFinder#maxSearchDepth}) is reached.
When the max search depth is reached a {@link SimplePath} is added,
containing the {@link Stack} of {@link KamEdge}, and the algorithm continues.
@param kam {@link Kam}, the kam to traverse
@param cnode {@link KamNode}, the current node to evaluate
@param source {@link KamNode}, the node to search from
@param depth <tt>int</tt>, the current depth of this scan recursion
@param nodeStack {@link Stack} of {@link KamNode}, the nodes on the
current scan from the <tt>source</tt>
@param edgeStack {@link Stack} of {@link KamEdge}, the edges on the
current scan from the <tt>source</tt>
@param pathResults the resulting paths scanned from source | [
"Runs",
"a",
"recursive",
"depth",
"-",
"first",
"scan",
"from",
"a",
"{",
"@link",
"KamNode",
"}",
"source",
"until",
"a",
"max",
"search",
"depth",
"(",
"{",
"@link",
"BasicPathFinder#maxSearchDepth",
"}",
")",
"is",
"reached",
".",
"When",
"the",
"max",... | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java#L374-L409 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/text/CharTrieIndex.java | CharTrieIndex.addDocument | public int addDocument(String document) {
if (root().getNumberOfChildren() >= 0) {
throw new IllegalStateException("Tree sorting has begun");
}
final int index;
synchronized (this) {
index = documents.size();
documents.add(document);
}
cursors.addAll(
IntStream.range(0, document.length() + 1).mapToObj(i -> new CursorData(index, i)).collect(Collectors.toList()));
nodes.update(0, node -> node.setCursorCount(cursors.length()));
return index;
} | java | public int addDocument(String document) {
if (root().getNumberOfChildren() >= 0) {
throw new IllegalStateException("Tree sorting has begun");
}
final int index;
synchronized (this) {
index = documents.size();
documents.add(document);
}
cursors.addAll(
IntStream.range(0, document.length() + 1).mapToObj(i -> new CursorData(index, i)).collect(Collectors.toList()));
nodes.update(0, node -> node.setCursorCount(cursors.length()));
return index;
} | [
"public",
"int",
"addDocument",
"(",
"String",
"document",
")",
"{",
"if",
"(",
"root",
"(",
")",
".",
"getNumberOfChildren",
"(",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Tree sorting has begun\"",
")",
";",
"}",
"final",
... | Adds a document to be indexed. This can only be performed before splitting.
@param document the document
@return this int | [
"Adds",
"a",
"document",
"to",
"be",
"indexed",
".",
"This",
"can",
"only",
"be",
"performed",
"before",
"splitting",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/CharTrieIndex.java#L220-L233 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java | IntersectionImpl.wrapInstance | static IntersectionImpl wrapInstance(final WritableMemory srcMem, final long seed) {
final IntersectionImpl impl = new IntersectionImpl(srcMem, seed, false);
return (IntersectionImpl) internalWrapInstance(srcMem, impl);
} | java | static IntersectionImpl wrapInstance(final WritableMemory srcMem, final long seed) {
final IntersectionImpl impl = new IntersectionImpl(srcMem, seed, false);
return (IntersectionImpl) internalWrapInstance(srcMem, impl);
} | [
"static",
"IntersectionImpl",
"wrapInstance",
"(",
"final",
"WritableMemory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"IntersectionImpl",
"impl",
"=",
"new",
"IntersectionImpl",
"(",
"srcMem",
",",
"seed",
",",
"false",
")",
";",
"return",
"... | Wrap an Intersection target around the given source Memory containing intersection data.
@param srcMem The source Memory image.
<a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
@return a IntersectionImpl that wraps a source Memory that contains an Intersection image | [
"Wrap",
"an",
"Intersection",
"target",
"around",
"the",
"given",
"source",
"Memory",
"containing",
"intersection",
"data",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java#L164-L167 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java | ConfigurationsInner.list | public ClusterConfigurationsInner list(String resourceGroupName, String clusterName) {
return listWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public ClusterConfigurationsInner list(String resourceGroupName, String clusterName) {
return listWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"ClusterConfigurationsInner",
"list",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
... | Gets all configuration information for an HDI cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ClusterConfigurationsInner object if successful. | [
"Gets",
"all",
"configuration",
"information",
"for",
"an",
"HDI",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java#L86-L88 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java | DBSCAN.processNeighbors | private void processNeighbors(DoubleDBIDListIter neighbor, ModifiableDBIDs currentCluster, ArrayModifiableDBIDs seeds) {
final boolean ismetric = getDistanceFunction().isMetric();
for(; neighbor.valid(); neighbor.advance()) {
if(processedIDs.add(neighbor)) {
if(!ismetric || neighbor.doubleValue() > 0.) {
seeds.add(neighbor);
}
}
else if(!noise.remove(neighbor)) {
continue;
}
currentCluster.add(neighbor);
}
} | java | private void processNeighbors(DoubleDBIDListIter neighbor, ModifiableDBIDs currentCluster, ArrayModifiableDBIDs seeds) {
final boolean ismetric = getDistanceFunction().isMetric();
for(; neighbor.valid(); neighbor.advance()) {
if(processedIDs.add(neighbor)) {
if(!ismetric || neighbor.doubleValue() > 0.) {
seeds.add(neighbor);
}
}
else if(!noise.remove(neighbor)) {
continue;
}
currentCluster.add(neighbor);
}
} | [
"private",
"void",
"processNeighbors",
"(",
"DoubleDBIDListIter",
"neighbor",
",",
"ModifiableDBIDs",
"currentCluster",
",",
"ArrayModifiableDBIDs",
"seeds",
")",
"{",
"final",
"boolean",
"ismetric",
"=",
"getDistanceFunction",
"(",
")",
".",
"isMetric",
"(",
")",
"... | Process a single core point.
@param neighbor Iterator over neighbors
@param currentCluster Current cluster
@param seeds Seed set | [
"Process",
"a",
"single",
"core",
"point",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java#L260-L273 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java | EmbedBuilder.addInlineField | public EmbedBuilder addInlineField(String name, String value) {
delegate.addField(name, value, true);
return this;
} | java | public EmbedBuilder addInlineField(String name, String value) {
delegate.addField(name, value, true);
return this;
} | [
"public",
"EmbedBuilder",
"addInlineField",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"delegate",
".",
"addField",
"(",
"name",
",",
"value",
",",
"true",
")",
";",
"return",
"this",
";",
"}"
] | Adds an inline field to the embed.
@param name The name of the field.
@param value The value of the field.
@return The current instance in order to chain call methods. | [
"Adds",
"an",
"inline",
"field",
"to",
"the",
"embed",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L599-L602 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/DateParser.java | DateParser.parseUsingMask | private static Date parseUsingMask(final String[] masks, String sDate, final Locale locale) {
if (sDate != null) {
sDate = sDate.trim();
}
ParsePosition pp = null;
Date d = null;
for (int i = 0; d == null && i < masks.length; i++) {
final DateFormat df = new SimpleDateFormat(masks[i], locale);
// df.setLenient(false);
df.setLenient(true);
try {
pp = new ParsePosition(0);
d = df.parse(sDate, pp);
if (pp.getIndex() != sDate.length()) {
d = null;
}
} catch (final Exception ex1) {
}
}
return d;
} | java | private static Date parseUsingMask(final String[] masks, String sDate, final Locale locale) {
if (sDate != null) {
sDate = sDate.trim();
}
ParsePosition pp = null;
Date d = null;
for (int i = 0; d == null && i < masks.length; i++) {
final DateFormat df = new SimpleDateFormat(masks[i], locale);
// df.setLenient(false);
df.setLenient(true);
try {
pp = new ParsePosition(0);
d = df.parse(sDate, pp);
if (pp.getIndex() != sDate.length()) {
d = null;
}
} catch (final Exception ex1) {
}
}
return d;
} | [
"private",
"static",
"Date",
"parseUsingMask",
"(",
"final",
"String",
"[",
"]",
"masks",
",",
"String",
"sDate",
",",
"final",
"Locale",
"locale",
")",
"{",
"if",
"(",
"sDate",
"!=",
"null",
")",
"{",
"sDate",
"=",
"sDate",
".",
"trim",
"(",
")",
";... | Parses a Date out of a string using an array of masks.
<p/>
It uses the masks in order until one of them succedes or all fail.
<p/>
@param masks array of masks to use for parsing the string
@param sDate string to parse for a date.
@return the Date represented by the given string using one of the given masks. It returns
<b>null</b> if it was not possible to parse the the string with any of the masks. | [
"Parses",
"a",
"Date",
"out",
"of",
"a",
"string",
"using",
"an",
"array",
"of",
"masks",
".",
"<p",
"/",
">",
"It",
"uses",
"the",
"masks",
"in",
"order",
"until",
"one",
"of",
"them",
"succedes",
"or",
"all",
"fail",
".",
"<p",
"/",
">"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DateParser.java#L100-L120 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.initiateConference | public void initiateConference(String connId, String destination) throws WorkspaceApiException {
this.initiateConference(connId, destination, null, null, null, null, null);
} | java | public void initiateConference(String connId, String destination) throws WorkspaceApiException {
this.initiateConference(connId, destination, null, null, null, null, null);
} | [
"public",
"void",
"initiateConference",
"(",
"String",
"connId",
",",
"String",
"destination",
")",
"throws",
"WorkspaceApiException",
"{",
"this",
".",
"initiateConference",
"(",
"connId",
",",
"destination",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
... | Initiate a two-step conference to the specified destination. This places the existing call on
hold and creates a new call in the dialing state (step 1). After initiating the conference you can use
`completeConference()` to complete the conference and bring all parties into the same call (step 2).
@param connId The connection ID of the call to start the conference from. This call will be placed on hold.
@param destination The number to be dialed. | [
"Initiate",
"a",
"two",
"-",
"step",
"conference",
"to",
"the",
"specified",
"destination",
".",
"This",
"places",
"the",
"existing",
"call",
"on",
"hold",
"and",
"creates",
"a",
"new",
"call",
"in",
"the",
"dialing",
"state",
"(",
"step",
"1",
")",
".",... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L663-L665 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.orthoSymmetricLH | public Matrix4d orthoSymmetricLH(double width, double height, double zNear, double zFar, Matrix4d dest) {
return orthoSymmetricLH(width, height, zNear, zFar, false, dest);
} | java | public Matrix4d orthoSymmetricLH(double width, double height, double zNear, double zFar, Matrix4d dest) {
return orthoSymmetricLH(width, height, zNear, zFar, false, dest);
} | [
"public",
"Matrix4d",
"orthoSymmetricLH",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
",",
"Matrix4d",
"dest",
")",
"{",
"return",
"orthoSymmetricLH",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",... | Apply a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>.
<p>
This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, Matrix4d) orthoLH()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to a symmetric orthographic projection without post-multiplying it,
use {@link #setOrthoSymmetricLH(double, double, double, double) setOrthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoSymmetricLH(double, double, double, double)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10325-L10327 |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/RelativeTimeFormatter.java | RelativeTimeFormatter.format | public String format(Calendar calendar, Calendar smscCalendar) {
if (calendar == null || smscCalendar == null) {
return null;
}
long diffTimeInMillis = calendar.getTimeInMillis() - smscCalendar.getTimeInMillis();
if (diffTimeInMillis < 0) {
throw new IllegalArgumentException("The requested relative time has already past.");
}
// calculate period from epoch, this is not as accurate as Joda-Time Period class or Java 8 Period
Calendar offsetEpoch = Calendar.getInstance(utcTimeZone);
offsetEpoch.setTimeInMillis(diffTimeInMillis);
int years = offsetEpoch.get(Calendar.YEAR) - 1970;
int months = offsetEpoch.get(Calendar.MONTH);
int days = offsetEpoch.get(Calendar.DAY_OF_MONTH) - 1;
int hours = offsetEpoch.get(Calendar.HOUR_OF_DAY);
int minutes = offsetEpoch.get(Calendar.MINUTE);
int seconds = offsetEpoch.get(Calendar.SECOND);
if (years >= 100) {
throw new IllegalArgumentException("The requested relative time is more then a century (" + years + " years).");
}
return format(years, months, days, hours, minutes, seconds);
} | java | public String format(Calendar calendar, Calendar smscCalendar) {
if (calendar == null || smscCalendar == null) {
return null;
}
long diffTimeInMillis = calendar.getTimeInMillis() - smscCalendar.getTimeInMillis();
if (diffTimeInMillis < 0) {
throw new IllegalArgumentException("The requested relative time has already past.");
}
// calculate period from epoch, this is not as accurate as Joda-Time Period class or Java 8 Period
Calendar offsetEpoch = Calendar.getInstance(utcTimeZone);
offsetEpoch.setTimeInMillis(diffTimeInMillis);
int years = offsetEpoch.get(Calendar.YEAR) - 1970;
int months = offsetEpoch.get(Calendar.MONTH);
int days = offsetEpoch.get(Calendar.DAY_OF_MONTH) - 1;
int hours = offsetEpoch.get(Calendar.HOUR_OF_DAY);
int minutes = offsetEpoch.get(Calendar.MINUTE);
int seconds = offsetEpoch.get(Calendar.SECOND);
if (years >= 100) {
throw new IllegalArgumentException("The requested relative time is more then a century (" + years + " years).");
}
return format(years, months, days, hours, minutes, seconds);
} | [
"public",
"String",
"format",
"(",
"Calendar",
"calendar",
",",
"Calendar",
"smscCalendar",
")",
"{",
"if",
"(",
"calendar",
"==",
"null",
"||",
"smscCalendar",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"long",
"diffTimeInMillis",
"=",
"calendar",
... | Return the relative time from the calendar datetime against the SMSC datetime.
@param calendar the date.
@param smscCalendar the SMSC date.
@return The relative time between the calendar date and the SMSC calendar date. | [
"Return",
"the",
"relative",
"time",
"from",
"the",
"calendar",
"datetime",
"against",
"the",
"SMSC",
"datetime",
"."
] | train | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/RelativeTimeFormatter.java#L64-L89 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-util/src/main/java/org/deeplearning4j/util/Dl4jReflection.java | Dl4jReflection.getFieldsAsProperties | public static Properties getFieldsAsProperties(Object obj, Class<?>[] clazzes) throws Exception {
Properties props = new Properties();
for (Field field : obj.getClass().getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()))
continue;
field.setAccessible(true);
Class<?> type = field.getType();
if (clazzes == null || contains(type, clazzes)) {
Object val = field.get(obj);
if (val != null)
props.put(field.getName(), val.toString());
}
}
return props;
} | java | public static Properties getFieldsAsProperties(Object obj, Class<?>[] clazzes) throws Exception {
Properties props = new Properties();
for (Field field : obj.getClass().getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()))
continue;
field.setAccessible(true);
Class<?> type = field.getType();
if (clazzes == null || contains(type, clazzes)) {
Object val = field.get(obj);
if (val != null)
props.put(field.getName(), val.toString());
}
}
return props;
} | [
"public",
"static",
"Properties",
"getFieldsAsProperties",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"clazzes",
")",
"throws",
"Exception",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"Field",
"field"... | Get fields as properties
@param obj the object to get fields for
@param clazzes the classes to use for reflection and properties.
T
@return the fields as properties | [
"Get",
"fields",
"as",
"properties"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-util/src/main/java/org/deeplearning4j/util/Dl4jReflection.java#L106-L122 |
joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java | FastTrackData.matchChildBlock | private final boolean matchChildBlock(int bufferIndex)
{
//
// Match the pattern we see at the start of the child block
//
int index = 0;
for (byte b : CHILD_BLOCK_PATTERN)
{
if (b != m_buffer[bufferIndex + index])
{
return false;
}
++index;
}
//
// The first step will produce false positives. To handle this, we should find
// the name of the block next, and check to ensure that the length
// of the name makes sense.
//
int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index);
// System.out.println("Name length: " + nameLength);
//
// if (nameLength > 0 && nameLength < 100)
// {
// String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE);
// System.out.println("Name: " + name);
// }
return nameLength > 0 && nameLength < 100;
} | java | private final boolean matchChildBlock(int bufferIndex)
{
//
// Match the pattern we see at the start of the child block
//
int index = 0;
for (byte b : CHILD_BLOCK_PATTERN)
{
if (b != m_buffer[bufferIndex + index])
{
return false;
}
++index;
}
//
// The first step will produce false positives. To handle this, we should find
// the name of the block next, and check to ensure that the length
// of the name makes sense.
//
int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index);
// System.out.println("Name length: " + nameLength);
//
// if (nameLength > 0 && nameLength < 100)
// {
// String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE);
// System.out.println("Name: " + name);
// }
return nameLength > 0 && nameLength < 100;
} | [
"private",
"final",
"boolean",
"matchChildBlock",
"(",
"int",
"bufferIndex",
")",
"{",
"//",
"// Match the pattern we see at the start of the child block",
"//",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"byte",
"b",
":",
"CHILD_BLOCK_PATTERN",
")",
"{",
"if",
"(... | Locate a child block by byte pattern and validate by
checking the length of the string we are expecting
to follow the pattern.
@param bufferIndex start index
@return true if a child block starts at this point | [
"Locate",
"a",
"child",
"block",
"by",
"byte",
"pattern",
"and",
"validate",
"by",
"checking",
"the",
"length",
"of",
"the",
"string",
"we",
"are",
"expecting",
"to",
"follow",
"the",
"pattern",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L307-L338 |
VoltDB/voltdb | src/frontend/org/voltdb/SnapshotDaemon.java | SnapshotDaemon.createAndWatchRequestNode | public void createAndWatchRequestNode(final long clientHandle,
final Connection c,
SnapshotInitiationInfo snapInfo,
boolean notifyChanges) throws ForwardClientException {
boolean requestExists = false;
final String requestId = createRequestNode(snapInfo);
if (requestId == null) {
requestExists = true;
} else {
if (!snapInfo.isTruncationRequest()) {
try {
registerUserSnapshotResponseWatch(requestId, clientHandle, c, notifyChanges);
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to register ZK watch on snapshot response", true, e);
}
}
else {
// need to construct a success response of some sort here to indicate the truncation attempt
// was successfully attempted
VoltTable result = SnapshotUtil.constructNodeResultsTable();
result.addRow(-1,
CoreUtils.getHostnameOrAddress(),
"",
"SUCCESS",
"SNAPSHOT REQUEST QUEUED");
final ClientResponseImpl resp =
new ClientResponseImpl(ClientResponseImpl.SUCCESS,
new VoltTable[] {result},
"User-requested truncation snapshot successfully queued for execution.",
clientHandle);
ByteBuffer buf = ByteBuffer.allocate(resp.getSerializedSize() + 4);
buf.putInt(buf.capacity() - 4);
resp.flattenToBuffer(buf).flip();
c.writeStream().enqueue(buf);
}
}
if (requestExists) {
VoltTable result = SnapshotUtil.constructNodeResultsTable();
result.addRow(-1,
CoreUtils.getHostnameOrAddress(),
"",
"FAILURE",
"SNAPSHOT IN PROGRESS");
throw new ForwardClientException("A request to perform a user snapshot already exists", result);
}
} | java | public void createAndWatchRequestNode(final long clientHandle,
final Connection c,
SnapshotInitiationInfo snapInfo,
boolean notifyChanges) throws ForwardClientException {
boolean requestExists = false;
final String requestId = createRequestNode(snapInfo);
if (requestId == null) {
requestExists = true;
} else {
if (!snapInfo.isTruncationRequest()) {
try {
registerUserSnapshotResponseWatch(requestId, clientHandle, c, notifyChanges);
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to register ZK watch on snapshot response", true, e);
}
}
else {
// need to construct a success response of some sort here to indicate the truncation attempt
// was successfully attempted
VoltTable result = SnapshotUtil.constructNodeResultsTable();
result.addRow(-1,
CoreUtils.getHostnameOrAddress(),
"",
"SUCCESS",
"SNAPSHOT REQUEST QUEUED");
final ClientResponseImpl resp =
new ClientResponseImpl(ClientResponseImpl.SUCCESS,
new VoltTable[] {result},
"User-requested truncation snapshot successfully queued for execution.",
clientHandle);
ByteBuffer buf = ByteBuffer.allocate(resp.getSerializedSize() + 4);
buf.putInt(buf.capacity() - 4);
resp.flattenToBuffer(buf).flip();
c.writeStream().enqueue(buf);
}
}
if (requestExists) {
VoltTable result = SnapshotUtil.constructNodeResultsTable();
result.addRow(-1,
CoreUtils.getHostnameOrAddress(),
"",
"FAILURE",
"SNAPSHOT IN PROGRESS");
throw new ForwardClientException("A request to perform a user snapshot already exists", result);
}
} | [
"public",
"void",
"createAndWatchRequestNode",
"(",
"final",
"long",
"clientHandle",
",",
"final",
"Connection",
"c",
",",
"SnapshotInitiationInfo",
"snapInfo",
",",
"boolean",
"notifyChanges",
")",
"throws",
"ForwardClientException",
"{",
"boolean",
"requestExists",
"=... | Try to create the ZK request node and watch it if created successfully. | [
"Try",
"to",
"create",
"the",
"ZK",
"request",
"node",
"and",
"watch",
"it",
"if",
"created",
"successfully",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/SnapshotDaemon.java#L1704-L1750 |
aerogear/aerogear-unifiedpush-server | jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java | InstallationRegistrationEndpoint.crossOriginForInstallations | @OPTIONS
public Response crossOriginForInstallations(@Context HttpHeaders headers) {
return appendPreflightResponseHeaders(headers, Response.ok()).build();
} | java | @OPTIONS
public Response crossOriginForInstallations(@Context HttpHeaders headers) {
return appendPreflightResponseHeaders(headers, Response.ok()).build();
} | [
"@",
"OPTIONS",
"public",
"Response",
"crossOriginForInstallations",
"(",
"@",
"Context",
"HttpHeaders",
"headers",
")",
"{",
"return",
"appendPreflightResponseHeaders",
"(",
"headers",
",",
"Response",
".",
"ok",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"}... | Cross Origin for Installations
@param headers "Origin" header
@return "Access-Control-Allow-Origin" header for your response
@responseheader Access-Control-Allow-Origin With host in your "Origin" header
@responseheader Access-Control-Allow-Methods POST, DELETE
@responseheader Access-Control-Allow-Headers accept, origin, content-type, authorization
@responseheader Access-Control-Allow-Credentials true
@responseheader Access-Control-Max-Age 604800
@statuscode 200 Successful response for your request | [
"Cross",
"Origin",
"for",
"Installations"
] | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java#L105-L109 |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.mergeEnvPathList | static void mergeEnvPathList(Map<String, String> userEnv, String envKey, String pathList) {
if (!isEmpty(pathList)) {
String current = firstNonEmpty(userEnv.get(envKey), System.getenv(envKey));
userEnv.put(envKey, join(File.pathSeparator, current, pathList));
}
} | java | static void mergeEnvPathList(Map<String, String> userEnv, String envKey, String pathList) {
if (!isEmpty(pathList)) {
String current = firstNonEmpty(userEnv.get(envKey), System.getenv(envKey));
userEnv.put(envKey, join(File.pathSeparator, current, pathList));
}
} | [
"static",
"void",
"mergeEnvPathList",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"userEnv",
",",
"String",
"envKey",
",",
"String",
"pathList",
")",
"{",
"if",
"(",
"!",
"isEmpty",
"(",
"pathList",
")",
")",
"{",
"String",
"current",
"=",
"firstNonEm... | Updates the user environment, appending the given pathList to the existing value of the given
environment variable (or setting it if it hasn't yet been set). | [
"Updates",
"the",
"user",
"environment",
"appending",
"the",
"given",
"pathList",
"to",
"the",
"existing",
"value",
"of",
"the",
"given",
"environment",
"variable",
"(",
"or",
"setting",
"it",
"if",
"it",
"hasn",
"t",
"yet",
"been",
"set",
")",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L114-L119 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.drawCueList | private void drawCueList(Graphics g, Rectangle clipRect, CueList cueList, int axis, int maxHeight) {
for (CueList.Entry entry : cueList.entries) {
final int x = millisecondsToX(entry.cueTime);
if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) {
g.setColor(cueColor(entry));
for (int i = 0; i < 4; i++) {
g.drawLine(x - 3 + i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i,
x + 3 - i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i);
}
}
}
} | java | private void drawCueList(Graphics g, Rectangle clipRect, CueList cueList, int axis, int maxHeight) {
for (CueList.Entry entry : cueList.entries) {
final int x = millisecondsToX(entry.cueTime);
if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) {
g.setColor(cueColor(entry));
for (int i = 0; i < 4; i++) {
g.drawLine(x - 3 + i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i,
x + 3 - i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i);
}
}
}
} | [
"private",
"void",
"drawCueList",
"(",
"Graphics",
"g",
",",
"Rectangle",
"clipRect",
",",
"CueList",
"cueList",
",",
"int",
"axis",
",",
"int",
"maxHeight",
")",
"{",
"for",
"(",
"CueList",
".",
"Entry",
"entry",
":",
"cueList",
".",
"entries",
")",
"{"... | Draw the visible memory cue points or hot cues.
@param g the graphics object in which we are being rendered
@param clipRect the region that is being currently rendered
@param cueList the cues to be drawn
@param axis the base on which the waveform is being drawn
@param maxHeight the highest waveform segment | [
"Draw",
"the",
"visible",
"memory",
"cue",
"points",
"or",
"hot",
"cues",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L798-L809 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java | Helpers.withKey | public static String withKey(String key, Selector selector) {
return String.format("\"%s\": %s", key, enclose(selector));
} | java | public static String withKey(String key, Selector selector) {
return String.format("\"%s\": %s", key, enclose(selector));
} | [
"public",
"static",
"String",
"withKey",
"(",
"String",
"key",
",",
"Selector",
"selector",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"\\\"%s\\\": %s\"",
",",
"key",
",",
"enclose",
"(",
"selector",
")",
")",
";",
"}"
] | <P>
Returns the string form of the specified key mapping to a JSON object enclosing the selector.
</P>
<pre>
{@code
Selector selector = eq("year", 2017);
System.out.println(selector.toString());
// Output: "year": {"$eq" : 2017}
System.out.println(SelectorUtils.withKey("selector", selector));
// Output: "selector": {"year": {"$eq": 2017}}
}
</pre>
@param key key to use for the selector (usually "selector" or "partial_filter_selector")
@param selector the selector
@return the string form of the selector enclosed in a JSON object, keyed by key | [
"<P",
">",
"Returns",
"the",
"string",
"form",
"of",
"the",
"specified",
"key",
"mapping",
"to",
"a",
"JSON",
"object",
"enclosing",
"the",
"selector",
".",
"<",
"/",
"P",
">",
"<pre",
">",
"{",
"@code",
"Selector",
"selector",
"=",
"eq",
"(",
"year",
... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java#L144-L146 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java | ReidSolomonCodes.findErrorLocatorPolynomial | void findErrorLocatorPolynomial( int messageLength , GrowQueue_I32 errorLocations , GrowQueue_I8 errorLocator ) {
tmp1.resize(2);
tmp1.data[1] = 1;
errorLocator.resize(1);
errorLocator.data[0] = 1;
for (int i = 0; i < errorLocations.size; i++) {
// Convert from positions in the message to coefficient degrees
int where = messageLength - errorLocations.get(i) - 1;
// tmp1 = [2**w,1]
tmp1.data[0] = (byte)math.power(2,where);
// tmp1.data[1] = 1;
tmp0.setTo(errorLocator);
math.polyMult(tmp0,tmp1,errorLocator);
}
} | java | void findErrorLocatorPolynomial( int messageLength , GrowQueue_I32 errorLocations , GrowQueue_I8 errorLocator ) {
tmp1.resize(2);
tmp1.data[1] = 1;
errorLocator.resize(1);
errorLocator.data[0] = 1;
for (int i = 0; i < errorLocations.size; i++) {
// Convert from positions in the message to coefficient degrees
int where = messageLength - errorLocations.get(i) - 1;
// tmp1 = [2**w,1]
tmp1.data[0] = (byte)math.power(2,where);
// tmp1.data[1] = 1;
tmp0.setTo(errorLocator);
math.polyMult(tmp0,tmp1,errorLocator);
}
} | [
"void",
"findErrorLocatorPolynomial",
"(",
"int",
"messageLength",
",",
"GrowQueue_I32",
"errorLocations",
",",
"GrowQueue_I8",
"errorLocator",
")",
"{",
"tmp1",
".",
"resize",
"(",
"2",
")",
";",
"tmp1",
".",
"data",
"[",
"1",
"]",
"=",
"1",
";",
"errorLoca... | Compute the error locator polynomial when given the error locations in the message.
@param messageLength (Input) Length of the message
@param errorLocations (Input) List of error locations in the byte
@param errorLocator (Output) Error locator polynomial. Coefficients are large to small. | [
"Compute",
"the",
"error",
"locator",
"polynomial",
"when",
"given",
"the",
"error",
"locations",
"in",
"the",
"message",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java#L186-L202 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java | AbstractParser.getString | protected String getString(final String key, final JSONObject jsonObject) {
String value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getString(key);
}
catch(JSONException e) {
LOGGER.error("Could not get String from JSONObject for key: " + key, e);
}
}
return value;
} | java | protected String getString(final String key, final JSONObject jsonObject) {
String value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getString(key);
}
catch(JSONException e) {
LOGGER.error("Could not get String from JSONObject for key: " + key, e);
}
}
return value;
} | [
"protected",
"String",
"getString",
"(",
"final",
"String",
"key",
",",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"String",
"value",
"=",
"null",
";",
"if",
"(",
"hasKey",
"(",
"key",
",",
"jsonObject",
")",
")",
"{",
"try",
"{",
"value",
"=",
"js... | Check to make sure the JSONObject has the specified key and if so return
the value as a string. If no key is found "" is returned.
@param key name of the field to fetch from the json object
@param jsonObject object from which to fetch the value
@return string value corresponding to the key or null if key not found | [
"Check",
"to",
"make",
"sure",
"the",
"JSONObject",
"has",
"the",
"specified",
"key",
"and",
"if",
"so",
"return",
"the",
"value",
"as",
"a",
"string",
".",
"If",
"no",
"key",
"is",
"found",
"is",
"returned",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L208-L219 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/ClassLoaderUtil.java | ClassLoaderUtil.addURL | public static void addURL(URL u) throws IOException {
if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) {
return;
}
URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
URL[] urls = sysLoader.getURLs();
for (int i = 0; i < urls.length; i++) {
if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) {
if (log.isDebugEnabled()) {
log.debug("URL " + u + " is already in the CLASSPATH");
}
return;
}
}
Class<URLClassLoader> sysclass = URLClassLoader.class;
try {
Method method = sysclass.getDeclaredMethod("addURL", parameters);
method.setAccessible(true);
method.invoke(sysLoader, new Object[]{u});
} catch (Throwable t) {
t.printStackTrace();
throw new IOException("Error, could not add URL to system classloader");
}
} | java | public static void addURL(URL u) throws IOException {
if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) {
return;
}
URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
URL[] urls = sysLoader.getURLs();
for (int i = 0; i < urls.length; i++) {
if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) {
if (log.isDebugEnabled()) {
log.debug("URL " + u + " is already in the CLASSPATH");
}
return;
}
}
Class<URLClassLoader> sysclass = URLClassLoader.class;
try {
Method method = sysclass.getDeclaredMethod("addURL", parameters);
method.setAccessible(true);
method.invoke(sysLoader, new Object[]{u});
} catch (Throwable t) {
t.printStackTrace();
throw new IOException("Error, could not add URL to system classloader");
}
} | [
"public",
"static",
"void",
"addURL",
"(",
"URL",
"u",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
"instanceof",
"URLClassLoader",
")",
")",
"{",
"return",
";",
"}",
"URLClassLoader",
"sysLoad... | Add URL to CLASSPATH
@param u URL
@throws IOException IOException | [
"Add",
"URL",
"to",
"CLASSPATH"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ClassLoaderUtil.java#L51-L75 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java | ViewRetryHandler.shouldRetry | private static boolean shouldRetry(final int status, final String content) {
switch (status) {
case 200:
return false;
case 404:
return analyse404Response(content);
case 500:
return analyse500Response(content);
case 300:
case 301:
case 302:
case 303:
case 307:
case 401:
case 408:
case 409:
case 412:
case 416:
case 417:
case 501:
case 502:
case 503:
case 504:
return true;
default:
LOGGER.info("Received a View HTTP response code ({}) I did not expect, not retrying.", status);
return false;
}
} | java | private static boolean shouldRetry(final int status, final String content) {
switch (status) {
case 200:
return false;
case 404:
return analyse404Response(content);
case 500:
return analyse500Response(content);
case 300:
case 301:
case 302:
case 303:
case 307:
case 401:
case 408:
case 409:
case 412:
case 416:
case 417:
case 501:
case 502:
case 503:
case 504:
return true;
default:
LOGGER.info("Received a View HTTP response code ({}) I did not expect, not retrying.", status);
return false;
}
} | [
"private",
"static",
"boolean",
"shouldRetry",
"(",
"final",
"int",
"status",
",",
"final",
"String",
"content",
")",
"{",
"switch",
"(",
"status",
")",
"{",
"case",
"200",
":",
"return",
"false",
";",
"case",
"404",
":",
"return",
"analyse404Response",
"(... | Analyses status codes and checks if a retry needs to happen.
Some status codes are ambiguous, so their contents are inspected further.
@param status the status code.
@param content the error body from the response.
@return true if retry is needed, false otherwise. | [
"Analyses",
"status",
"codes",
"and",
"checks",
"if",
"a",
"retry",
"needs",
"to",
"happen",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L118-L146 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java | EvolutionResult.toUniquePopulation | public static <G extends Gene<?, G>, C extends Comparable<? super C>>
UnaryOperator<EvolutionResult<G, C>>
toUniquePopulation(final Factory<Genotype<G>> factory) {
return toUniquePopulation(factory, 100);
} | java | public static <G extends Gene<?, G>, C extends Comparable<? super C>>
UnaryOperator<EvolutionResult<G, C>>
toUniquePopulation(final Factory<Genotype<G>> factory) {
return toUniquePopulation(factory, 100);
} | [
"public",
"static",
"<",
"G",
"extends",
"Gene",
"<",
"?",
",",
"G",
">",
",",
"C",
"extends",
"Comparable",
"<",
"?",
"super",
"C",
">",
">",
"UnaryOperator",
"<",
"EvolutionResult",
"<",
"G",
",",
"C",
">",
">",
"toUniquePopulation",
"(",
"final",
... | Return a mapping function, which removes duplicate individuals from the
population and replaces it with newly created one by the given genotype
{@code factory}.
<pre>{@code
final Problem<Double, DoubleGene, Integer> problem = ...;
final Engine<DoubleGene, Integer> engine = Engine.builder(problem)
.mapping(EvolutionResult.toUniquePopulation(problem.codec().encoding()))
.build();
final Genotype<DoubleGene> best = engine.stream()
.limit(100);
.collect(EvolutionResult.toBestGenotype());
}</pre>
@since 4.0
@see Engine.Builder#mapping(Function)
@param factory the genotype factory which create new individuals
@param <G> the gene type
@param <C> the fitness function result type
@return a mapping function, which removes duplicate individuals from the
population
@throws NullPointerException if the given genotype {@code factory} is
{@code null} | [
"Return",
"a",
"mapping",
"function",
"which",
"removes",
"duplicate",
"individuals",
"from",
"the",
"population",
"and",
"replaces",
"it",
"with",
"newly",
"created",
"one",
"by",
"the",
"given",
"genotype",
"{",
"@code",
"factory",
"}",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java#L611-L615 |
dialogflow/dialogflow-android-client | ailib/src/main/java/ai/api/android/AIService.java | AIService.getService | public static AIService getService(final Context context, final AIConfiguration config) {
if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Google) {
return new GoogleRecognitionServiceImpl(context, config);
}
if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.System) {
return new GoogleRecognitionServiceImpl(context, config);
}
else if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Speaktoit) {
return new SpeaktoitRecognitionServiceImpl(context, config);
} else {
throw new UnsupportedOperationException("This engine still not supported");
}
} | java | public static AIService getService(final Context context, final AIConfiguration config) {
if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Google) {
return new GoogleRecognitionServiceImpl(context, config);
}
if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.System) {
return new GoogleRecognitionServiceImpl(context, config);
}
else if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Speaktoit) {
return new SpeaktoitRecognitionServiceImpl(context, config);
} else {
throw new UnsupportedOperationException("This engine still not supported");
}
} | [
"public",
"static",
"AIService",
"getService",
"(",
"final",
"Context",
"context",
",",
"final",
"AIConfiguration",
"config",
")",
"{",
"if",
"(",
"config",
".",
"getRecognitionEngine",
"(",
")",
"==",
"AIConfiguration",
".",
"RecognitionEngine",
".",
"Google",
... | Use this method to get ready to work instance
@param context
@param config
@return instance of AIService implementation | [
"Use",
"this",
"method",
"to",
"get",
"ready",
"to",
"work",
"instance"
] | train | https://github.com/dialogflow/dialogflow-android-client/blob/331f3ae8f2e404e245cc6024fdf44ec99feba7ee/ailib/src/main/java/ai/api/android/AIService.java#L58-L70 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.performSetupExchange | private void performSetupExchange() throws IOException {
Message setupRequest = new Message(0xfffffffeL, Message.KnownType.SETUP_REQ, new NumberField(posingAsPlayer, 4));
sendMessage(setupRequest);
Message response = Message.read(is);
if (response.knownType != Message.KnownType.MENU_AVAILABLE) {
throw new IOException("Did not receive message type 0x4000 in response to setup message, got: " + response);
}
if (response.arguments.size() != 2) {
throw new IOException("Did not receive two arguments in response to setup message, got: " + response);
}
final Field player = response.arguments.get(1);
if (!(player instanceof NumberField)) {
throw new IOException("Second argument in response to setup message was not a number: " + response);
}
if (((NumberField)player).getValue() != targetPlayer) {
throw new IOException("Expected to connect to player " + targetPlayer +
", but welcome response identified itself as player " + ((NumberField)player).getValue());
}
} | java | private void performSetupExchange() throws IOException {
Message setupRequest = new Message(0xfffffffeL, Message.KnownType.SETUP_REQ, new NumberField(posingAsPlayer, 4));
sendMessage(setupRequest);
Message response = Message.read(is);
if (response.knownType != Message.KnownType.MENU_AVAILABLE) {
throw new IOException("Did not receive message type 0x4000 in response to setup message, got: " + response);
}
if (response.arguments.size() != 2) {
throw new IOException("Did not receive two arguments in response to setup message, got: " + response);
}
final Field player = response.arguments.get(1);
if (!(player instanceof NumberField)) {
throw new IOException("Second argument in response to setup message was not a number: " + response);
}
if (((NumberField)player).getValue() != targetPlayer) {
throw new IOException("Expected to connect to player " + targetPlayer +
", but welcome response identified itself as player " + ((NumberField)player).getValue());
}
} | [
"private",
"void",
"performSetupExchange",
"(",
")",
"throws",
"IOException",
"{",
"Message",
"setupRequest",
"=",
"new",
"Message",
"(",
"0xfffffffe",
"L",
",",
"Message",
".",
"KnownType",
".",
"SETUP_REQ",
",",
"new",
"NumberField",
"(",
"posingAsPlayer",
","... | Exchanges the initial fully-formed messages which establishes the transaction context for queries to
the dbserver.
@throws IOException if there is a problem during the exchange | [
"Exchanges",
"the",
"initial",
"fully",
"-",
"formed",
"messages",
"which",
"establishes",
"the",
"transaction",
"context",
"for",
"queries",
"to",
"the",
"dbserver",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L117-L135 |
milaboratory/milib | src/main/java/com/milaboratory/core/mutations/MutationsUtil.java | MutationsUtil.shiftIndelsAtHomopolymers | public static void shiftIndelsAtHomopolymers(Sequence seq1, int seq1From, int[] mutations) {
int prevPos = seq1From;
for (int i = 0; i < mutations.length; i++) {
int code = mutations[i];
if (!isSubstitution(code)) {
int pos = getPosition(code), offset = 0;
if (pos < seq1From)
throw new IllegalArgumentException();
int nt = isDeletion(code) ? getFrom(code) : getTo(code);
while (pos > prevPos && seq1.codeAt(pos - 1) == nt) {
pos--;
offset--;
}
mutations[i] = move(code, offset);
prevPos = getPosition(mutations[i]);
if (isDeletion(mutations[i]))
prevPos++;
} else {
prevPos = getPosition(mutations[i]) + 1;
}
}
} | java | public static void shiftIndelsAtHomopolymers(Sequence seq1, int seq1From, int[] mutations) {
int prevPos = seq1From;
for (int i = 0; i < mutations.length; i++) {
int code = mutations[i];
if (!isSubstitution(code)) {
int pos = getPosition(code), offset = 0;
if (pos < seq1From)
throw new IllegalArgumentException();
int nt = isDeletion(code) ? getFrom(code) : getTo(code);
while (pos > prevPos && seq1.codeAt(pos - 1) == nt) {
pos--;
offset--;
}
mutations[i] = move(code, offset);
prevPos = getPosition(mutations[i]);
if (isDeletion(mutations[i]))
prevPos++;
} else {
prevPos = getPosition(mutations[i]) + 1;
}
}
} | [
"public",
"static",
"void",
"shiftIndelsAtHomopolymers",
"(",
"Sequence",
"seq1",
",",
"int",
"seq1From",
",",
"int",
"[",
"]",
"mutations",
")",
"{",
"int",
"prevPos",
"=",
"seq1From",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mutations",
... | This one shifts indels to the left at homopolymer regions Applicable to KAligner data, which normally put indels
randomly along such regions Required for filterMutations algorithm to work correctly Works inplace
@param seq1 reference sequence for the mutations
@param seq1From seq1 from
@param mutations array of mutations | [
"This",
"one",
"shifts",
"indels",
"to",
"the",
"left",
"at",
"homopolymer",
"regions",
"Applicable",
"to",
"KAligner",
"data",
"which",
"normally",
"put",
"indels",
"randomly",
"along",
"such",
"regions",
"Required",
"for",
"filterMutations",
"algorithm",
"to",
... | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/mutations/MutationsUtil.java#L136-L158 |
pmlopes/yoke | framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeResponse.java | YokeResponse.getHeader | public <R> R getHeader(String name, R defaultValue) {
if (headers().contains(name)) {
return getHeader(name);
} else {
return defaultValue;
}
} | java | public <R> R getHeader(String name, R defaultValue) {
if (headers().contains(name)) {
return getHeader(name);
} else {
return defaultValue;
}
} | [
"public",
"<",
"R",
">",
"R",
"getHeader",
"(",
"String",
"name",
",",
"R",
"defaultValue",
")",
"{",
"if",
"(",
"headers",
"(",
")",
".",
"contains",
"(",
"name",
")",
")",
"{",
"return",
"getHeader",
"(",
"name",
")",
";",
"}",
"else",
"{",
"re... | Allow getting headers in a generified way and return defaultValue if the key does not exist.
@param name The key to get
@param defaultValue value returned when the key does not exist
@param <R> The type of the return
@return The found object | [
"Allow",
"getting",
"headers",
"in",
"a",
"generified",
"way",
"and",
"return",
"defaultValue",
"if",
"the",
"key",
"does",
"not",
"exist",
"."
] | train | https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeResponse.java#L154-L160 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/outputs/SizeSegmentedGoogleCloudStorageFileOutput.java | SizeSegmentedGoogleCloudStorageFileOutput.finish | @Override
public GoogleCloudStorageFileSet finish(Collection<? extends OutputWriter<ByteBuffer>> writers)
throws IOException {
List<String> fileNames = new ArrayList<>();
for (OutputWriter<ByteBuffer> writer : writers) {
SizeSegmentingGoogleCloudStorageFileWriter segWriter =
(SizeSegmentingGoogleCloudStorageFileWriter) writer;
for (GoogleCloudStorageFileOutputWriter delegatedWriter : segWriter.getDelegatedWriters()) {
fileNames.add(delegatedWriter.getFile().getObjectName());
}
}
return new GoogleCloudStorageFileSet(bucket, fileNames);
} | java | @Override
public GoogleCloudStorageFileSet finish(Collection<? extends OutputWriter<ByteBuffer>> writers)
throws IOException {
List<String> fileNames = new ArrayList<>();
for (OutputWriter<ByteBuffer> writer : writers) {
SizeSegmentingGoogleCloudStorageFileWriter segWriter =
(SizeSegmentingGoogleCloudStorageFileWriter) writer;
for (GoogleCloudStorageFileOutputWriter delegatedWriter : segWriter.getDelegatedWriters()) {
fileNames.add(delegatedWriter.getFile().getObjectName());
}
}
return new GoogleCloudStorageFileSet(bucket, fileNames);
} | [
"@",
"Override",
"public",
"GoogleCloudStorageFileSet",
"finish",
"(",
"Collection",
"<",
"?",
"extends",
"OutputWriter",
"<",
"ByteBuffer",
">",
">",
"writers",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"fileNames",
"=",
"new",
"ArrayList",... | Returns a list of all the filenames written by the output writers
@throws IOException | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"filenames",
"written",
"by",
"the",
"output",
"writers"
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/outputs/SizeSegmentedGoogleCloudStorageFileOutput.java#L116-L128 |
spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java | GroovyRuntimeUtil.setProperty | public static void setProperty(Object target, String property, Object value) {
try {
InvokerHelper.setProperty(target, property, value);
} catch (InvokerInvocationException e) {
ExceptionUtil.sneakyThrow(e.getCause());
}
} | java | public static void setProperty(Object target, String property, Object value) {
try {
InvokerHelper.setProperty(target, property, value);
} catch (InvokerInvocationException e) {
ExceptionUtil.sneakyThrow(e.getCause());
}
} | [
"public",
"static",
"void",
"setProperty",
"(",
"Object",
"target",
",",
"String",
"property",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"InvokerHelper",
".",
"setProperty",
"(",
"target",
",",
"property",
",",
"value",
")",
";",
"}",
"catch",
"(",
"... | Note: This method may throw checked exceptions although it doesn't say so. | [
"Note",
":",
"This",
"method",
"may",
"throw",
"checked",
"exceptions",
"although",
"it",
"doesn",
"t",
"say",
"so",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L146-L152 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.preInvoke | public EnterpriseBean preInvoke(EJSWrapperBase wrapper,
int methodId,
EJSDeployedSupport s,
String methodSignature) throws RemoteException {
EJBMethodInfoImpl methodInfo = mapMethodInfo(s, wrapper, methodId,
methodSignature); //130230 d140003.20 d139562.14.EJBC
return preInvokePmInternal(wrapper, methodId, s, methodInfo); //LIDB2617.11 //181971
} | java | public EnterpriseBean preInvoke(EJSWrapperBase wrapper,
int methodId,
EJSDeployedSupport s,
String methodSignature) throws RemoteException {
EJBMethodInfoImpl methodInfo = mapMethodInfo(s, wrapper, methodId,
methodSignature); //130230 d140003.20 d139562.14.EJBC
return preInvokePmInternal(wrapper, methodId, s, methodInfo); //LIDB2617.11 //181971
} | [
"public",
"EnterpriseBean",
"preInvoke",
"(",
"EJSWrapperBase",
"wrapper",
",",
"int",
"methodId",
",",
"EJSDeployedSupport",
"s",
",",
"String",
"methodSignature",
")",
"throws",
"RemoteException",
"{",
"EJBMethodInfoImpl",
"methodInfo",
"=",
"mapMethodInfo",
"(",
"s... | This method is called by the generated code to support PMgr home finder methods.
When this method is called, the methodId should be in the negative range to
indicate this is a special method with the method signature passed in. This
method signature is then used to create the EJSMethodInfo in mapMethodInfo call.
The method signature is in the form defined in BeanMetaData.java.
methodName ":" [ parameterType [ "," parameterType]* ]+
E.g. "findEJBRelationshipRole_Local:java.lang.Object"
"noParameterMethod:"
":" | [
"This",
"method",
"is",
"called",
"by",
"the",
"generated",
"code",
"to",
"support",
"PMgr",
"home",
"finder",
"methods",
".",
"When",
"this",
"method",
"is",
"called",
"the",
"methodId",
"should",
"be",
"in",
"the",
"negative",
"range",
"to",
"indicate",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L2697-L2705 |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/UnionFind.java | UnionFind.areUnified | public boolean areUnified(E e1, E e2) {
return find(e1).equals(find(e2));
} | java | public boolean areUnified(E e1, E e2) {
return find(e1).equals(find(e2));
} | [
"public",
"boolean",
"areUnified",
"(",
"E",
"e1",
",",
"E",
"e2",
")",
"{",
"return",
"find",
"(",
"e1",
")",
".",
"equals",
"(",
"find",
"(",
"e2",
")",
")",
";",
"}"
] | Checks whether the elements <code>e1</code> and
<code>e2</code> are unified in this union-find structure. | [
"Checks",
"whether",
"the",
"elements",
"<code",
">",
"e1<",
"/",
"code",
">",
"and",
"<code",
">",
"e2<",
"/",
"code",
">",
"are",
"unified",
"in",
"this",
"union",
"-",
"find",
"structure",
"."
] | train | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/UnionFind.java#L68-L70 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.setOrder | @Deprecated
public static void setOrder(IntBuffer buffer, char order) {
int length = Shape.shapeInfoLength(Shape.rank(buffer));
buffer.put(length - 1, (int) order);
throw new RuntimeException("setOrder called");
} | java | @Deprecated
public static void setOrder(IntBuffer buffer, char order) {
int length = Shape.shapeInfoLength(Shape.rank(buffer));
buffer.put(length - 1, (int) order);
throw new RuntimeException("setOrder called");
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setOrder",
"(",
"IntBuffer",
"buffer",
",",
"char",
"order",
")",
"{",
"int",
"length",
"=",
"Shape",
".",
"shapeInfoLength",
"(",
"Shape",
".",
"rank",
"(",
"buffer",
")",
")",
";",
"buffer",
".",
"put",
... | Returns the order given the shape information
@param buffer the buffer
@return | [
"Returns",
"the",
"order",
"given",
"the",
"shape",
"information"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3153-L3158 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java | HtmlBuilder.openTagStyleHtmlContent | public static String openTagStyleHtmlContent(String tag, String style, String... content) {
return openTagHtmlContent(tag, null, style, content);
} | java | public static String openTagStyleHtmlContent(String tag, String style, String... content) {
return openTagHtmlContent(tag, null, style, content);
} | [
"public",
"static",
"String",
"openTagStyleHtmlContent",
"(",
"String",
"tag",
",",
"String",
"style",
",",
"String",
"...",
"content",
")",
"{",
"return",
"openTagHtmlContent",
"(",
"tag",
",",
"null",
",",
"style",
",",
"content",
")",
";",
"}"
] | Build a String containing a HTML opening tag with given CSS style attribute(s) and
concatenates the given HTML content.
@param tag String name of HTML tag
@param style style for tag (plain CSS)
@param content content string
@return HTML tag element as string | [
"Build",
"a",
"String",
"containing",
"a",
"HTML",
"opening",
"tag",
"with",
"given",
"CSS",
"style",
"attribute",
"(",
"s",
")",
"and",
"concatenates",
"the",
"given",
"HTML",
"content",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L338-L340 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/trustmanager/DateValidityChecker.java | DateValidityChecker.invoke | public void invoke(X509Certificate cert, GSIConstants.CertificateType certType) throws CertPathValidatorException {
try {
cert.checkValidity();
} catch (CertificateExpiredException e) {
throw new CertPathValidatorException(
"Certificate " + cert.getSubjectDN() + " expired", e);
} catch (CertificateNotYetValidException e) {
throw new CertPathValidatorException(
"Certificate " + cert.getSubjectDN() + " not yet valid.", e);
}
} | java | public void invoke(X509Certificate cert, GSIConstants.CertificateType certType) throws CertPathValidatorException {
try {
cert.checkValidity();
} catch (CertificateExpiredException e) {
throw new CertPathValidatorException(
"Certificate " + cert.getSubjectDN() + " expired", e);
} catch (CertificateNotYetValidException e) {
throw new CertPathValidatorException(
"Certificate " + cert.getSubjectDN() + " not yet valid.", e);
}
} | [
"public",
"void",
"invoke",
"(",
"X509Certificate",
"cert",
",",
"GSIConstants",
".",
"CertificateType",
"certType",
")",
"throws",
"CertPathValidatorException",
"{",
"try",
"{",
"cert",
".",
"checkValidity",
"(",
")",
";",
"}",
"catch",
"(",
"CertificateExpiredEx... | Method that checks the time validity. Uses the standard Certificate.checkValidity method.
@throws CertPathValidatorException If certificate has expired or is not yet valid. | [
"Method",
"that",
"checks",
"the",
"time",
"validity",
".",
"Uses",
"the",
"standard",
"Certificate",
".",
"checkValidity",
"method",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/trustmanager/DateValidityChecker.java#L39-L49 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java | StochasticSTLinearL1.setMaxScaled | public void setMaxScaled(double maxFeature)
{
if(Double.isNaN(maxFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(maxFeature > 1)
throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature);
else if(maxFeature <= minScaled)
throw new ArithmeticException("Maximum feature value must be learger than the minimum");
this.maxScaled = maxFeature;
} | java | public void setMaxScaled(double maxFeature)
{
if(Double.isNaN(maxFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(maxFeature > 1)
throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature);
else if(maxFeature <= minScaled)
throw new ArithmeticException("Maximum feature value must be learger than the minimum");
this.maxScaled = maxFeature;
} | [
"public",
"void",
"setMaxScaled",
"(",
"double",
"maxFeature",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"maxFeature",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"NaN is not a valid feature value\"",
")",
";",
"else",
"if",
"(",
"maxFeature"... | Sets the maximum value of any feature after scaling is applied. This
value can be no greater than 1.
@param maxFeature the maximum feature value after scaling | [
"Sets",
"the",
"maximum",
"value",
"of",
"any",
"feature",
"after",
"scaling",
"is",
"applied",
".",
"This",
"value",
"can",
"be",
"no",
"greater",
"than",
"1",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java#L233-L242 |
Netflix/concurrency-limits | concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java | ServletLimiterBuilder.partitionByPathInfo | public ServletLimiterBuilder partitionByPathInfo(Function<String, String> pathToGroup) {
return partitionResolver(request -> Optional.ofNullable(request.getPathInfo()).map(pathToGroup).orElse(null));
} | java | public ServletLimiterBuilder partitionByPathInfo(Function<String, String> pathToGroup) {
return partitionResolver(request -> Optional.ofNullable(request.getPathInfo()).map(pathToGroup).orElse(null));
} | [
"public",
"ServletLimiterBuilder",
"partitionByPathInfo",
"(",
"Function",
"<",
"String",
",",
"String",
">",
"pathToGroup",
")",
"{",
"return",
"partitionResolver",
"(",
"request",
"->",
"Optional",
".",
"ofNullable",
"(",
"request",
".",
"getPathInfo",
"(",
")",... | Partition the limit by the full path. Percentages of the limit are partitioned to named
groups. Group membership is derived from the provided mapping function.
@param pathToGroup Mapping function from full path to a named group.
@return Chainable builder | [
"Partition",
"the",
"limit",
"by",
"the",
"full",
"path",
".",
"Percentages",
"of",
"the",
"limit",
"are",
"partitioned",
"to",
"named",
"groups",
".",
"Group",
"membership",
"is",
"derived",
"from",
"the",
"provided",
"mapping",
"function",
"."
] | train | https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L72-L74 |
open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java | OpenpayFeesOperations.getSummary | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | java | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | [
"public",
"OpenpayFeesSummary",
"getSummary",
"(",
"final",
"int",
"year",
",",
"final",
"int",
"month",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"FEES_PATH",
",",
"this... | Retrieve the summary of the charged fees in the given month. The amounts retrieved in the current month may
change on a daily basis.
@param year Year of the date to retrieve
@param month Month to retrieve
@return The summary of the fees charged by Openpay.
@throws OpenpayServiceException If the service returns an error
@throws ServiceUnavailableException If the service is not available | [
"Retrieve",
"the",
"summary",
"of",
"the",
"charged",
"fees",
"in",
"the",
"given",
"month",
".",
"The",
"amounts",
"retrieved",
"in",
"the",
"current",
"month",
"may",
"change",
"on",
"a",
"daily",
"basis",
"."
] | train | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java#L58-L65 |
mediathekview/MServer | src/main/java/mServer/crawler/sender/hr/HrSendungenListDeserializer.java | HrSendungenListDeserializer.prepareUrl | private String prepareUrl(String theme, String url) {
// Sonderseite für Hessenschau verwenden
if (theme.contains("hessenschau")) {
return "http://www.hessenschau.de/tv-sendung/sendungsarchiv/index.html";
}
// bei allen anderen, probieren, ob eine URL mit "sendungen" vor index.html existiert
String preparedUrl = url.replaceAll("index.html", "sendungen/index.html");
if (MediathekReader.urlExists(preparedUrl)) {
return preparedUrl;
}
return url;
} | java | private String prepareUrl(String theme, String url) {
// Sonderseite für Hessenschau verwenden
if (theme.contains("hessenschau")) {
return "http://www.hessenschau.de/tv-sendung/sendungsarchiv/index.html";
}
// bei allen anderen, probieren, ob eine URL mit "sendungen" vor index.html existiert
String preparedUrl = url.replaceAll("index.html", "sendungen/index.html");
if (MediathekReader.urlExists(preparedUrl)) {
return preparedUrl;
}
return url;
} | [
"private",
"String",
"prepareUrl",
"(",
"String",
"theme",
",",
"String",
"url",
")",
"{",
"// Sonderseite für Hessenschau verwenden",
"if",
"(",
"theme",
".",
"contains",
"(",
"\"hessenschau\"",
")",
")",
"{",
"return",
"\"http://www.hessenschau.de/tv-sendung/sendungsa... | URL anpassen, so dass diese direkt die Übersicht der Folgen beinhaltet,
sofern diese Seite existiert!
Damit wird das unnötige Einlesen einer Zwischenseite gespart.
@param theme Thema der Sendung
@param url URL zu Startseite der Sendung
@return URL zu der Folgenübersicht der Sendung | [
"URL",
"anpassen",
"so",
"dass",
"diese",
"direkt",
"die",
"Übersicht",
"der",
"Folgen",
"beinhaltet",
"sofern",
"diese",
"Seite",
"existiert!",
"Damit",
"wird",
"das",
"unnötige",
"Einlesen",
"einer",
"Zwischenseite",
"gespart",
"."
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/hr/HrSendungenListDeserializer.java#L53-L66 |
domaframework/doma-gen | src/main/java/org/seasar/doma/extension/gen/SqlDescFactory.java | SqlDescFactory.createSqlDesc | protected SqlDesc createSqlDesc(EntityDesc entityDesc, String fileName, String templateName) {
SqlDesc sqlFileDesc = new SqlDesc();
sqlFileDesc.setFileName(fileName);
sqlFileDesc.setTemplateName(templateName);
sqlFileDesc.setEntityDesc(entityDesc);
sqlFileDesc.setDialect(dialect);
return sqlFileDesc;
} | java | protected SqlDesc createSqlDesc(EntityDesc entityDesc, String fileName, String templateName) {
SqlDesc sqlFileDesc = new SqlDesc();
sqlFileDesc.setFileName(fileName);
sqlFileDesc.setTemplateName(templateName);
sqlFileDesc.setEntityDesc(entityDesc);
sqlFileDesc.setDialect(dialect);
return sqlFileDesc;
} | [
"protected",
"SqlDesc",
"createSqlDesc",
"(",
"EntityDesc",
"entityDesc",
",",
"String",
"fileName",
",",
"String",
"templateName",
")",
"{",
"SqlDesc",
"sqlFileDesc",
"=",
"new",
"SqlDesc",
"(",
")",
";",
"sqlFileDesc",
".",
"setFileName",
"(",
"fileName",
")",... | SQL記述を返します。
@param entityDesc エンティティ記述
@param fileName ファイル名
@param templateName テンプレート名
@return SQL記述 | [
"SQL記述を返します。"
] | train | https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/SqlDescFactory.java#L104-L111 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.elementOpt | public JSONObject elementOpt( String key, Object value ) {
return elementOpt( key, value, new JsonConfig() );
} | java | public JSONObject elementOpt( String key, Object value ) {
return elementOpt( key, value, new JsonConfig() );
} | [
"public",
"JSONObject",
"elementOpt",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"elementOpt",
"(",
"key",
",",
"value",
",",
"new",
"JsonConfig",
"(",
")",
")",
";",
"}"
] | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null.
@param key A key string.
@param value An object which is the value. It should be of one of these
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
String, or the JSONNull object.
@return this.
@throws JSONException If the value is a non-finite number. | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1731-L1733 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java | CommerceNotificationQueueEntryPersistenceImpl.findByLtS | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate) {
return findByLtS(sentDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate) {
return findByLtS(sentDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationQueueEntry",
">",
"findByLtS",
"(",
"Date",
"sentDate",
")",
"{",
"return",
"findByLtS",
"(",
"sentDate",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
... | Returns all the commerce notification queue entries where sentDate < ?.
@param sentDate the sent date
@return the matching commerce notification queue entries | [
"Returns",
"all",
"the",
"commerce",
"notification",
"queue",
"entries",
"where",
"sentDate",
"<",
";",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L1686-L1689 |
dasein-cloud/dasein-cloud-aws | src/main/java/org/dasein/cloud/aws/platform/RDS.java | RDS.authorizeClassicDbSecurityGroup | private void authorizeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException {
Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), AUTHORIZE_DB_SECURITY_GROUP_INGRESS);
parameters.put("DBSecurityGroupName", groupName);
parameters.put("CIDRIP", sourceCidr);
EC2Method method = new EC2Method(SERVICE_ID, getProvider(), parameters);
try {
method.invoke();
}
catch( EC2Exception e ) {
String code = e.getCode();
if( code != null && code.equals("AuthorizationAlreadyExists") ) {
return;
}
throw new CloudException(e);
}
} | java | private void authorizeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException {
Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), AUTHORIZE_DB_SECURITY_GROUP_INGRESS);
parameters.put("DBSecurityGroupName", groupName);
parameters.put("CIDRIP", sourceCidr);
EC2Method method = new EC2Method(SERVICE_ID, getProvider(), parameters);
try {
method.invoke();
}
catch( EC2Exception e ) {
String code = e.getCode();
if( code != null && code.equals("AuthorizationAlreadyExists") ) {
return;
}
throw new CloudException(e);
}
} | [
"private",
"void",
"authorizeClassicDbSecurityGroup",
"(",
"String",
"groupName",
",",
"String",
"sourceCidr",
")",
"throws",
"CloudException",
",",
"InternalException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
"=",
"getProvider",
"(",
")",
"."... | Use this to authorize with security groups in EC2-Classic
@param groupName
@param sourceCidr
@throws CloudException
@throws InternalException | [
"Use",
"this",
"to",
"authorize",
"with",
"security",
"groups",
"in",
"EC2",
"-",
"Classic"
] | train | https://github.com/dasein-cloud/dasein-cloud-aws/blob/05098574197a1f573f77447cadc39a76bf00b99d/src/main/java/org/dasein/cloud/aws/platform/RDS.java#L121-L136 |
patrickfav/bcrypt | modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java | BCryptOpenBSDProtocol.streamToWord | private static int streamToWord(byte[] data, int[] offp) {
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | java | private static int streamToWord(byte[] data, int[] offp) {
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | [
"private",
"static",
"int",
"streamToWord",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offp",
")",
"{",
"int",
"i",
";",
"int",
"word",
"=",
"0",
";",
"int",
"off",
"=",
"offp",
"[",
"0",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
... | Cyclically extract a word of key material
@param data the string to extract the data from
@param offp a "pointer" (as a one-entry array) to the
current offset into data
@return the next word of material from data | [
"Cyclically",
"extract",
"a",
"word",
"of",
"key",
"material"
] | train | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java#L403-L415 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java | SharedPreferencesHelper.loadPreferenceAsBoolean | public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false);
}
logLoad(key, value);
return value;
} | java | public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false);
}
logLoad(key, value);
return value;
} | [
"public",
"Boolean",
"loadPreferenceAsBoolean",
"(",
"String",
"key",
",",
"Boolean",
"defaultValue",
")",
"{",
"Boolean",
"value",
"=",
"defaultValue",
";",
"if",
"(",
"hasPreference",
"(",
"key",
")",
")",
"{",
"value",
"=",
"getSharedPreferences",
"(",
")",... | Retrieve a boolean value from the preferences.
@param key The name of the preference to retrieve
@param defaultValue Value to return if this preference does not exist
@return the preference value if it exists, or defaultValue. | [
"Retrieve",
"a",
"boolean",
"value",
"from",
"the",
"preferences",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java#L202-L209 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/FileWriterServices.java | FileWriterServices.copyResourceToDir | public void copyResourceToDir(String path, String filename, String dir) {
String fullpath = path + ProcessorConstants.SEPARATORCHAR + filename;
messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " javascript copy js : " + fullpath + " to : "+dir);
try (Writer writer = getFileObjectWriter(dir, "org.ocelotds."+filename)) {
bodyWriter.write(writer, OcelotProcessor.class.getResourceAsStream(fullpath));
} catch (IOException ex) {
messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + filename);
}
} | java | public void copyResourceToDir(String path, String filename, String dir) {
String fullpath = path + ProcessorConstants.SEPARATORCHAR + filename;
messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " javascript copy js : " + fullpath + " to : "+dir);
try (Writer writer = getFileObjectWriter(dir, "org.ocelotds."+filename)) {
bodyWriter.write(writer, OcelotProcessor.class.getResourceAsStream(fullpath));
} catch (IOException ex) {
messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + filename);
}
} | [
"public",
"void",
"copyResourceToDir",
"(",
"String",
"path",
",",
"String",
"filename",
",",
"String",
"dir",
")",
"{",
"String",
"fullpath",
"=",
"path",
"+",
"ProcessorConstants",
".",
"SEPARATORCHAR",
"+",
"filename",
";",
"messager",
".",
"printMessage",
... | copy path/filename in dir
@param path
@param filename
@param dir | [
"copy",
"path",
"/",
"filename",
"in",
"dir"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/FileWriterServices.java#L56-L64 |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java | RowsLogBuffer.nextOneRow | public final boolean nextOneRow(BitSet columns, boolean after) {
final boolean hasOneRow = buffer.hasRemaining();
if (hasOneRow) {
int column = 0;
for (int i = 0; i < columnLen; i++)
if (columns.get(i)) {
column++;
}
if (after && partial) {
partialBits.clear();
long valueOptions = buffer.getPackedLong();
int PARTIAL_JSON_UPDATES = 1;
if ((valueOptions & PARTIAL_JSON_UPDATES) != 0) {
partialBits.set(1);
buffer.forward((jsonColumnCount + 7) / 8);
}
}
nullBitIndex = 0;
nullBits.clear();
buffer.fillBitmap(nullBits, column);
}
return hasOneRow;
} | java | public final boolean nextOneRow(BitSet columns, boolean after) {
final boolean hasOneRow = buffer.hasRemaining();
if (hasOneRow) {
int column = 0;
for (int i = 0; i < columnLen; i++)
if (columns.get(i)) {
column++;
}
if (after && partial) {
partialBits.clear();
long valueOptions = buffer.getPackedLong();
int PARTIAL_JSON_UPDATES = 1;
if ((valueOptions & PARTIAL_JSON_UPDATES) != 0) {
partialBits.set(1);
buffer.forward((jsonColumnCount + 7) / 8);
}
}
nullBitIndex = 0;
nullBits.clear();
buffer.fillBitmap(nullBits, column);
}
return hasOneRow;
} | [
"public",
"final",
"boolean",
"nextOneRow",
"(",
"BitSet",
"columns",
",",
"boolean",
"after",
")",
"{",
"final",
"boolean",
"hasOneRow",
"=",
"buffer",
".",
"hasRemaining",
"(",
")",
";",
"if",
"(",
"hasOneRow",
")",
"{",
"int",
"column",
"=",
"0",
";",... | Extracting next row from packed buffer.
@see mysql-5.1.60/sql/log_event.cc -
Rows_log_event::print_verbose_one_row | [
"Extracting",
"next",
"row",
"from",
"packed",
"buffer",
"."
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java#L70-L96 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/AbstractClientOptionsBuilder.java | AbstractClientOptionsBuilder.rpcDecorator | public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse>
B rpcDecorator(Function<T, R> decorator) {
decoration.addRpc(decorator);
return self();
} | java | public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse>
B rpcDecorator(Function<T, R> decorator) {
decoration.addRpc(decorator);
return self();
} | [
"public",
"<",
"T",
"extends",
"Client",
"<",
"I",
",",
"O",
">",
",",
"R",
"extends",
"Client",
"<",
"I",
",",
"O",
">",
",",
"I",
"extends",
"RpcRequest",
",",
"O",
"extends",
"RpcResponse",
">",
"B",
"rpcDecorator",
"(",
"Function",
"<",
"T",
",... | Adds the specified RPC-level {@code decorator}.
@param decorator the {@link Function} that transforms a {@link Client} to another
@param <T> the type of the {@link Client} being decorated
@param <R> the type of the {@link Client} produced by the {@code decorator}
@param <I> the {@link Request} type of the {@link Client} being decorated
@param <O> the {@link Response} type of the {@link Client} being decorated | [
"Adds",
"the",
"specified",
"RPC",
"-",
"level",
"{",
"@code",
"decorator",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/AbstractClientOptionsBuilder.java#L311-L315 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIterator.java | WalkingIterator.fixupVariables | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
m_predicateIndex = -1;
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.fixupVariables(vars, globalsSize);
walker = walker.getNextWalker();
}
} | java | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
m_predicateIndex = -1;
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.fixupVariables(vars, globalsSize);
walker = walker.getNextWalker();
}
} | [
"public",
"void",
"fixupVariables",
"(",
"java",
".",
"util",
".",
"Vector",
"vars",
",",
"int",
"globalsSize",
")",
"{",
"m_predicateIndex",
"=",
"-",
"1",
";",
"AxesWalker",
"walker",
"=",
"m_firstWalker",
";",
"while",
"(",
"null",
"!=",
"walker",
")",
... | This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame). | [
"This",
"function",
"is",
"used",
"to",
"fixup",
"variables",
"from",
"QNames",
"to",
"stack",
"frame",
"indexes",
"at",
"stylesheet",
"build",
"time",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIterator.java#L286-L297 |
dwdyer/uncommons-maths | demo/src/java/main/org/uncommons/swing/SwingBackgroundTask.java | SwingBackgroundTask.execute | public void execute()
{
Runnable task = new Runnable()
{
public void run()
{
final V result = performTask();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
postProcessing(result);
latch.countDown();
}
});
}
};
new Thread(task, "SwingBackgroundTask-" + id).start();
} | java | public void execute()
{
Runnable task = new Runnable()
{
public void run()
{
final V result = performTask();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
postProcessing(result);
latch.countDown();
}
});
}
};
new Thread(task, "SwingBackgroundTask-" + id).start();
} | [
"public",
"void",
"execute",
"(",
")",
"{",
"Runnable",
"task",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"final",
"V",
"result",
"=",
"performTask",
"(",
")",
";",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
... | Asynchronous call that begins execution of the task
and returns immediately. | [
"Asynchronous",
"call",
"that",
"begins",
"execution",
"of",
"the",
"task",
"and",
"returns",
"immediately",
"."
] | train | https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/demo/src/java/main/org/uncommons/swing/SwingBackgroundTask.java#L49-L67 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java | EnvironmentSettingsInner.getAsync | public Observable<EnvironmentSettingInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String expand) {
return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, expand).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | java | public Observable<EnvironmentSettingInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String expand) {
return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, expand).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EnvironmentSettingInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"String",
"expand",
")",
"{",
"return",
"getWithServic... | Get environment setting.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param expand Specify the $expand query. Example: 'properties($select=publishingState)'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EnvironmentSettingInner object | [
"Get",
"environment",
"setting",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L543-L550 |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java | OffHeapColumnVector.allocateColumns | public static OffHeapColumnVector[] allocateColumns(int capacity, StructField[] fields) {
OffHeapColumnVector[] vectors = new OffHeapColumnVector[fields.length];
for (int i = 0; i < fields.length; i++) {
vectors[i] = new OffHeapColumnVector(capacity, fields[i].dataType());
}
return vectors;
} | java | public static OffHeapColumnVector[] allocateColumns(int capacity, StructField[] fields) {
OffHeapColumnVector[] vectors = new OffHeapColumnVector[fields.length];
for (int i = 0; i < fields.length; i++) {
vectors[i] = new OffHeapColumnVector(capacity, fields[i].dataType());
}
return vectors;
} | [
"public",
"static",
"OffHeapColumnVector",
"[",
"]",
"allocateColumns",
"(",
"int",
"capacity",
",",
"StructField",
"[",
"]",
"fields",
")",
"{",
"OffHeapColumnVector",
"[",
"]",
"vectors",
"=",
"new",
"OffHeapColumnVector",
"[",
"fields",
".",
"length",
"]",
... | Allocates columns to store elements of each field off heap.
Capacity is the initial capacity of the vector and it will grow as necessary. Capacity is
in number of elements, not number of bytes. | [
"Allocates",
"columns",
"to",
"store",
"elements",
"of",
"each",
"field",
"off",
"heap",
".",
"Capacity",
"is",
"the",
"initial",
"capacity",
"of",
"the",
"vector",
"and",
"it",
"will",
"grow",
"as",
"necessary",
".",
"Capacity",
"is",
"in",
"number",
"of"... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java#L50-L56 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java | LinkedWorkspaceStorageCacheImpl.removeSiblings | protected void removeSiblings(final NodeData node)
{
if (node.getIdentifier().equals(Constants.ROOT_UUID))
{
return;
}
// remove child nodes of the item parent recursive
writeLock.lock();
try
{
// remove on-parent child nodes list
nodesCache.remove(node.getParentIdentifier());
// go through the C and remove every descendant of the node parent
final QPath path = node.getQPath().makeParentPath();
final List<CacheId> toRemove = new ArrayList<CacheId>();
// find and remove by path
for (Iterator<Map.Entry<CacheKey, CacheValue>> citer = cache.entrySet().iterator(); citer.hasNext();)
{
Map.Entry<CacheKey, CacheValue> ce = citer.next();
CacheKey key = ce.getKey();
CacheValue v = ce.getValue();
if (v != null)
{
if (key.isDescendantOf(path))
{
// will remove by id too
toRemove.add(new CacheId(v.getItem().getIdentifier()));
citer.remove(); // remove
nodesCache.remove(v.getItem().getIdentifier());
propertiesCache.remove(v.getItem().getIdentifier());
}
}
else
{
citer.remove(); // remove empty C record
}
}
for (CacheId id : toRemove)
{
cache.remove(id);
}
toRemove.clear();
}
finally
{
writeLock.unlock();
}
} | java | protected void removeSiblings(final NodeData node)
{
if (node.getIdentifier().equals(Constants.ROOT_UUID))
{
return;
}
// remove child nodes of the item parent recursive
writeLock.lock();
try
{
// remove on-parent child nodes list
nodesCache.remove(node.getParentIdentifier());
// go through the C and remove every descendant of the node parent
final QPath path = node.getQPath().makeParentPath();
final List<CacheId> toRemove = new ArrayList<CacheId>();
// find and remove by path
for (Iterator<Map.Entry<CacheKey, CacheValue>> citer = cache.entrySet().iterator(); citer.hasNext();)
{
Map.Entry<CacheKey, CacheValue> ce = citer.next();
CacheKey key = ce.getKey();
CacheValue v = ce.getValue();
if (v != null)
{
if (key.isDescendantOf(path))
{
// will remove by id too
toRemove.add(new CacheId(v.getItem().getIdentifier()));
citer.remove(); // remove
nodesCache.remove(v.getItem().getIdentifier());
propertiesCache.remove(v.getItem().getIdentifier());
}
}
else
{
citer.remove(); // remove empty C record
}
}
for (CacheId id : toRemove)
{
cache.remove(id);
}
toRemove.clear();
}
finally
{
writeLock.unlock();
}
} | [
"protected",
"void",
"removeSiblings",
"(",
"final",
"NodeData",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getIdentifier",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"ROOT_UUID",
")",
")",
"{",
"return",
";",
"}",
"// remove child nodes of the item paren... | Remove sibling's subtrees from cache C, CN, CP.<br> For update (order-before) usecase.<br>
The work does remove of all descendants of the item parent. I.e. the node and its siblings (for
SNS case).<br> | [
"Remove",
"sibling",
"s",
"subtrees",
"from",
"cache",
"C",
"CN",
"CP",
".",
"<br",
">",
"For",
"update",
"(",
"order",
"-",
"before",
")",
"usecase",
".",
"<br",
">",
"The",
"work",
"does",
"remove",
"of",
"all",
"descendants",
"of",
"the",
"item",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L1810-L1865 |
alkacon/opencms-core | src/org/opencms/xml/page/CmsXmlPage.java | CmsXmlPage.setEnabled | public void setEnabled(String name, Locale locale, boolean isEnabled) {
CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale);
Element element = value.getElement();
Attribute enabled = element.attribute(ATTRIBUTE_ENABLED);
if (enabled == null) {
if (!isEnabled) {
element.addAttribute(ATTRIBUTE_ENABLED, Boolean.toString(isEnabled));
}
} else if (isEnabled) {
element.remove(enabled);
} else {
enabled.setValue(Boolean.toString(isEnabled));
}
} | java | public void setEnabled(String name, Locale locale, boolean isEnabled) {
CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale);
Element element = value.getElement();
Attribute enabled = element.attribute(ATTRIBUTE_ENABLED);
if (enabled == null) {
if (!isEnabled) {
element.addAttribute(ATTRIBUTE_ENABLED, Boolean.toString(isEnabled));
}
} else if (isEnabled) {
element.remove(enabled);
} else {
enabled.setValue(Boolean.toString(isEnabled));
}
} | [
"public",
"void",
"setEnabled",
"(",
"String",
"name",
",",
"Locale",
"locale",
",",
"boolean",
"isEnabled",
")",
"{",
"CmsXmlHtmlValue",
"value",
"=",
"(",
"CmsXmlHtmlValue",
")",
"getValue",
"(",
"name",
",",
"locale",
")",
";",
"Element",
"element",
"=",
... | Sets the enabled flag of an already existing element.<p>
Note: if isEnabled is set to true, the attribute is removed
since true is the default
@param name name name of the element
@param locale locale of the element
@param isEnabled enabled flag for the element | [
"Sets",
"the",
"enabled",
"flag",
"of",
"an",
"already",
"existing",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L408-L423 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java | ClassPathBuilder.parseClassName | private void parseClassName(ICodeBaseEntry entry) {
DataInputStream in = null;
try {
InputStream resourceIn = entry.openResource();
if (resourceIn == null) {
throw new NullPointerException("Got null resource");
}
in = new DataInputStream(resourceIn);
ClassParserInterface parser = new ClassParser(in, null, entry);
ClassNameAndSuperclassInfo.Builder builder = new ClassNameAndSuperclassInfo.Builder();
parser.parse(builder);
String trueResourceName = builder.build().getClassDescriptor().toResourceName();
if (!trueResourceName.equals(entry.getResourceName())) {
entry.overrideResourceName(trueResourceName);
}
} catch (IOException e) {
errorLogger.logError("Invalid class resource " + entry.getResourceName() + " in " + entry, e);
} catch (InvalidClassFileFormatException e) {
errorLogger.logError("Invalid class resource " + entry.getResourceName() + " in " + entry, e);
} finally {
IO.close(in);
}
} | java | private void parseClassName(ICodeBaseEntry entry) {
DataInputStream in = null;
try {
InputStream resourceIn = entry.openResource();
if (resourceIn == null) {
throw new NullPointerException("Got null resource");
}
in = new DataInputStream(resourceIn);
ClassParserInterface parser = new ClassParser(in, null, entry);
ClassNameAndSuperclassInfo.Builder builder = new ClassNameAndSuperclassInfo.Builder();
parser.parse(builder);
String trueResourceName = builder.build().getClassDescriptor().toResourceName();
if (!trueResourceName.equals(entry.getResourceName())) {
entry.overrideResourceName(trueResourceName);
}
} catch (IOException e) {
errorLogger.logError("Invalid class resource " + entry.getResourceName() + " in " + entry, e);
} catch (InvalidClassFileFormatException e) {
errorLogger.logError("Invalid class resource " + entry.getResourceName() + " in " + entry, e);
} finally {
IO.close(in);
}
} | [
"private",
"void",
"parseClassName",
"(",
"ICodeBaseEntry",
"entry",
")",
"{",
"DataInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"InputStream",
"resourceIn",
"=",
"entry",
".",
"openResource",
"(",
")",
";",
"if",
"(",
"resourceIn",
"==",
"null",
")",
... | Attempt to parse data of given resource in order to divine the real name
of the class contained in the resource.
@param entry
the resource | [
"Attempt",
"to",
"parse",
"data",
"of",
"given",
"resource",
"in",
"order",
"to",
"divine",
"the",
"real",
"name",
"of",
"the",
"class",
"contained",
"in",
"the",
"resource",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L723-L746 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java | ConvertNV21.nv21ToInterleaved | public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedU8 output ) {
if( output == null ) {
output = new InterleavedU8(width,height,3);
} else {
output.reshape(width, height, 3);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output);
} else {
ImplConvertNV21.nv21ToInterleaved_U8(data, output);
}
return output;
} | java | public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedU8 output ) {
if( output == null ) {
output = new InterleavedU8(width,height,3);
} else {
output.reshape(width, height, 3);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output);
} else {
ImplConvertNV21.nv21ToInterleaved_U8(data, output);
}
return output;
} | [
"public",
"static",
"InterleavedU8",
"nv21ToInterleaved",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
",",
"InterleavedU8",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"InterleavedU8"... | Converts an NV21 image into a {@link InterleavedU8} RGB image.
@param data Input: NV21 image data
@param width Input: NV21 image width
@param height Input: NV21 image height
@param output Output: Optional storage for output image. Can be null. | [
"Converts",
"an",
"NV21",
"image",
"into",
"a",
"{",
"@link",
"InterleavedU8",
"}",
"RGB",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java#L231-L245 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/command/impl/AddBuddyImpl.java | AddBuddyImpl.checkBuddyManagerIsActive | private void checkBuddyManagerIsActive(BuddyListManager buddyListManager, User sfsOwner) {
if (!buddyListManager.isActive()) {
throw new IllegalStateException(
String.format("BuddyList operation failure. BuddyListManager is not active. Zone: %s, Sender: %s", new Object[] { sfsOwner.getZone(), sfsOwner }));
}
} | java | private void checkBuddyManagerIsActive(BuddyListManager buddyListManager, User sfsOwner) {
if (!buddyListManager.isActive()) {
throw new IllegalStateException(
String.format("BuddyList operation failure. BuddyListManager is not active. Zone: %s, Sender: %s", new Object[] { sfsOwner.getZone(), sfsOwner }));
}
} | [
"private",
"void",
"checkBuddyManagerIsActive",
"(",
"BuddyListManager",
"buddyListManager",
",",
"User",
"sfsOwner",
")",
"{",
"if",
"(",
"!",
"buddyListManager",
".",
"isActive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
... | Check whether buddy manager is active
@param buddyListManager manager object
@param sfsOwner buddy's owner | [
"Check",
"whether",
"buddy",
"manager",
"is",
"active"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/command/impl/AddBuddyImpl.java#L174-L179 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java | ConceptParser.isValidConcept | private boolean isValidConcept(final String concept, final Double score) {
return !StringUtils.isBlank(concept)
|| score != null;
} | java | private boolean isValidConcept(final String concept, final Double score) {
return !StringUtils.isBlank(concept)
|| score != null;
} | [
"private",
"boolean",
"isValidConcept",
"(",
"final",
"String",
"concept",
",",
"final",
"Double",
"score",
")",
"{",
"return",
"!",
"StringUtils",
".",
"isBlank",
"(",
"concept",
")",
"||",
"score",
"!=",
"null",
";",
"}"
] | Return true if at least one of the values is not null/empty.
@param concept the sentiment concept
@param score the sentiment score
@return true if at least one of the values is not null/empty | [
"Return",
"true",
"if",
"at",
"least",
"one",
"of",
"the",
"values",
"is",
"not",
"null",
"/",
"empty",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java#L96-L99 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java | CmsPropertyCustom.dialogButtonsOkCancelAdvanced | @Override
public String dialogButtonsOkCancelAdvanced(
String okAttributes,
String cancelAttributes,
String advancedAttributes) {
if (isEditable()) {
int okButton = BUTTON_OK;
if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) {
// in wizard mode, display finish button instead of ok button
okButton = BUTTON_FINISH;
}
// hide "advanced" button
if (isHideButtonAdvanced()) {
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL},
new String[] {okAttributes, cancelAttributes});
}
// show "advanced" button
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL, BUTTON_ADVANCED},
new String[] {okAttributes, cancelAttributes, advancedAttributes});
} else {
// hide "advanced" button
if (isHideButtonAdvanced()) {
return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {cancelAttributes});
}
// show "advanced" button
return dialogButtons(
new int[] {BUTTON_CLOSE, BUTTON_ADVANCED},
new String[] {cancelAttributes, advancedAttributes});
}
} | java | @Override
public String dialogButtonsOkCancelAdvanced(
String okAttributes,
String cancelAttributes,
String advancedAttributes) {
if (isEditable()) {
int okButton = BUTTON_OK;
if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) {
// in wizard mode, display finish button instead of ok button
okButton = BUTTON_FINISH;
}
// hide "advanced" button
if (isHideButtonAdvanced()) {
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL},
new String[] {okAttributes, cancelAttributes});
}
// show "advanced" button
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL, BUTTON_ADVANCED},
new String[] {okAttributes, cancelAttributes, advancedAttributes});
} else {
// hide "advanced" button
if (isHideButtonAdvanced()) {
return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {cancelAttributes});
}
// show "advanced" button
return dialogButtons(
new int[] {BUTTON_CLOSE, BUTTON_ADVANCED},
new String[] {cancelAttributes, advancedAttributes});
}
} | [
"@",
"Override",
"public",
"String",
"dialogButtonsOkCancelAdvanced",
"(",
"String",
"okAttributes",
",",
"String",
"cancelAttributes",
",",
"String",
"advancedAttributes",
")",
"{",
"if",
"(",
"isEditable",
"(",
")",
")",
"{",
"int",
"okButton",
"=",
"BUTTON_OK",... | Builds a button row with an "ok", a "cancel" and an "advanced" button.<p>
@param okAttributes additional attributes for the "ok" button
@param cancelAttributes additional attributes for the "cancel" button
@param advancedAttributes additional attributes for the "advanced" button
@return the button row | [
"Builds",
"a",
"button",
"row",
"with",
"an",
"ok",
"a",
"cancel",
"and",
"an",
"advanced",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java#L233-L265 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/AdviceActivity.java | AdviceActivity.putAdviceResult | protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) {
if (aspectAdviceResult == null) {
aspectAdviceResult = new AspectAdviceResult();
}
aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult);
} | java | protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) {
if (aspectAdviceResult == null) {
aspectAdviceResult = new AspectAdviceResult();
}
aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult);
} | [
"protected",
"void",
"putAdviceResult",
"(",
"AspectAdviceRule",
"aspectAdviceRule",
",",
"Object",
"adviceActionResult",
")",
"{",
"if",
"(",
"aspectAdviceResult",
"==",
"null",
")",
"{",
"aspectAdviceResult",
"=",
"new",
"AspectAdviceResult",
"(",
")",
";",
"}",
... | Puts the result of the advice.
@param aspectAdviceRule the aspect advice rule
@param adviceActionResult the advice action result | [
"Puts",
"the",
"result",
"of",
"the",
"advice",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/AdviceActivity.java#L522-L527 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java | SheetRowResourcesImpl.getRow | public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException {
String path = "sheets/" + sheetId + "/rows/" + rowId;
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes));
path += QueryUtil.generateUrl(null, parameters);
return this.getResource(path, Row.class);
} | java | public Row getRow(long sheetId, long rowId, EnumSet<RowInclusion> includes, EnumSet<ObjectExclusion> excludes) throws SmartsheetException {
String path = "sheets/" + sheetId + "/rows/" + rowId;
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes));
path += QueryUtil.generateUrl(null, parameters);
return this.getResource(path, Row.class);
} | [
"public",
"Row",
"getRow",
"(",
"long",
"sheetId",
",",
"long",
"rowId",
",",
"EnumSet",
"<",
"RowInclusion",
">",
"includes",
",",
"EnumSet",
"<",
"ObjectExclusion",
">",
"excludes",
")",
"throws",
"SmartsheetException",
"{",
"String",
"path",
"=",
"\"sheets/... | Get a row.
It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId}
Exceptions:
- InvalidRequestException : if there is any problem with the REST API request
- AuthorizationException : if there is any problem with the REST API authorization(access token)
- ResourceNotFoundException : if the resource can not be found
- ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
- SmartsheetRestException : if there is any other REST API related error occurred during the operation
- SmartsheetException : if there is any other error occurred during the operation
@param sheetId the id of the sheet
@param rowId the id of the row
@param includes optional objects to include
@param excludes optional objects to exclude
@return the row (note that if there is no such resource, this method will throw ResourceNotFoundException rather
than returning null).
@throws SmartsheetException the smartsheet exception | [
"Get",
"a",
"row",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L116-L126 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxGroup.java | BoxGroup.getMemberships | public Collection<BoxGroupMembership.Info> getMemberships() {
final BoxAPIConnection api = this.getAPI();
final String groupID = this.getID();
Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() {
public Iterator<BoxGroupMembership.Info> iterator() {
URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID);
return new BoxGroupMembershipIterator(api, url);
}
};
// We need to iterate all results because this method must return a Collection. This logic should be removed in
// the next major version, and instead return the Iterable directly.
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>();
for (BoxGroupMembership.Info membership : iter) {
memberships.add(membership);
}
return memberships;
} | java | public Collection<BoxGroupMembership.Info> getMemberships() {
final BoxAPIConnection api = this.getAPI();
final String groupID = this.getID();
Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() {
public Iterator<BoxGroupMembership.Info> iterator() {
URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID);
return new BoxGroupMembershipIterator(api, url);
}
};
// We need to iterate all results because this method must return a Collection. This logic should be removed in
// the next major version, and instead return the Iterable directly.
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>();
for (BoxGroupMembership.Info membership : iter) {
memberships.add(membership);
}
return memberships;
} | [
"public",
"Collection",
"<",
"BoxGroupMembership",
".",
"Info",
">",
"getMemberships",
"(",
")",
"{",
"final",
"BoxAPIConnection",
"api",
"=",
"this",
".",
"getAPI",
"(",
")",
";",
"final",
"String",
"groupID",
"=",
"this",
".",
"getID",
"(",
")",
";",
"... | Gets information about all of the group memberships for this group.
Does not support paging.
@return a collection of information about the group memberships for this group. | [
"Gets",
"information",
"about",
"all",
"of",
"the",
"group",
"memberships",
"for",
"this",
"group",
".",
"Does",
"not",
"support",
"paging",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxGroup.java#L200-L218 |
Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java | SagaKeyReaderExtractor.tryGetKeyReader | private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) {
KeyReader reader;
try {
Optional<KeyReader> cachedReader = knownReaders.get(
SagaMessageKey.forMessage(sagaClazz, message),
() -> {
KeyReader foundReader = findReader(sagaClazz, message);
return Optional.fromNullable(foundReader);
});
reader = cachedReader.orNull();
} catch (Exception ex) {
LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex);
reader = null;
}
return reader;
} | java | private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) {
KeyReader reader;
try {
Optional<KeyReader> cachedReader = knownReaders.get(
SagaMessageKey.forMessage(sagaClazz, message),
() -> {
KeyReader foundReader = findReader(sagaClazz, message);
return Optional.fromNullable(foundReader);
});
reader = cachedReader.orNull();
} catch (Exception ex) {
LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex);
reader = null;
}
return reader;
} | [
"private",
"KeyReader",
"tryGetKeyReader",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaClazz",
",",
"final",
"Object",
"message",
")",
"{",
"KeyReader",
"reader",
";",
"try",
"{",
"Optional",
"<",
"KeyReader",
">",
"cachedReader",
"=",
"kno... | Does not throw an exception when accessing the loading cache for key readers. | [
"Does",
"not",
"throw",
"an",
"exception",
"when",
"accessing",
"the",
"loading",
"cache",
"for",
"key",
"readers",
"."
] | train | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java#L71-L88 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java | GoogleCloudStorageFileSystem.copyInternal | private void copyInternal(Map<FileInfo, URI> srcToDstItemNames) throws IOException {
if (srcToDstItemNames.isEmpty()) {
return;
}
String srcBucketName = null;
String dstBucketName = null;
List<String> srcObjectNames = new ArrayList<>(srcToDstItemNames.size());
List<String> dstObjectNames = new ArrayList<>(srcToDstItemNames.size());
// Prepare list of items to copy.
for (Map.Entry<FileInfo, URI> srcToDstItemName : srcToDstItemNames.entrySet()) {
StorageResourceId srcResourceId = srcToDstItemName.getKey().getItemInfo().getResourceId();
srcBucketName = srcResourceId.getBucketName();
String srcObjectName = srcResourceId.getObjectName();
srcObjectNames.add(srcObjectName);
StorageResourceId dstResourceId =
pathCodec.validatePathAndGetId(srcToDstItemName.getValue(), true);
dstBucketName = dstResourceId.getBucketName();
String dstObjectName = dstResourceId.getObjectName();
dstObjectNames.add(dstObjectName);
}
// Perform copy.
gcs.copy(srcBucketName, srcObjectNames, dstBucketName, dstObjectNames);
} | java | private void copyInternal(Map<FileInfo, URI> srcToDstItemNames) throws IOException {
if (srcToDstItemNames.isEmpty()) {
return;
}
String srcBucketName = null;
String dstBucketName = null;
List<String> srcObjectNames = new ArrayList<>(srcToDstItemNames.size());
List<String> dstObjectNames = new ArrayList<>(srcToDstItemNames.size());
// Prepare list of items to copy.
for (Map.Entry<FileInfo, URI> srcToDstItemName : srcToDstItemNames.entrySet()) {
StorageResourceId srcResourceId = srcToDstItemName.getKey().getItemInfo().getResourceId();
srcBucketName = srcResourceId.getBucketName();
String srcObjectName = srcResourceId.getObjectName();
srcObjectNames.add(srcObjectName);
StorageResourceId dstResourceId =
pathCodec.validatePathAndGetId(srcToDstItemName.getValue(), true);
dstBucketName = dstResourceId.getBucketName();
String dstObjectName = dstResourceId.getObjectName();
dstObjectNames.add(dstObjectName);
}
// Perform copy.
gcs.copy(srcBucketName, srcObjectNames, dstBucketName, dstObjectNames);
} | [
"private",
"void",
"copyInternal",
"(",
"Map",
"<",
"FileInfo",
",",
"URI",
">",
"srcToDstItemNames",
")",
"throws",
"IOException",
"{",
"if",
"(",
"srcToDstItemNames",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"srcBucketName",
"=",
... | Copies items in given map that maps source items to destination items. | [
"Copies",
"items",
"in",
"given",
"map",
"that",
"maps",
"source",
"items",
"to",
"destination",
"items",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L836-L862 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/sch/util/ScheduleUtils.java | ScheduleUtils.buildTriggers | public static IntDiGraph buildTriggers(IntDiGraph g, Schedule s) {
// return trigger DAG
IntDiGraph d = new IntDiGraph();
// map from node to triggering indexes
DefaultDict<Integer, List<Integer>> currentTriggers = new DefaultDict<>(i -> new LinkedList<Integer>());
for (Indexed<Integer> s_j : enumerate(s)) {
// add in arcs from triggers
for (int i : currentTriggers.get(s_j.get())) {
d.addEdge(i, s_j.index());
}
// remove s_j from the agenda
currentTriggers.remove(s_j.get());
// record that j is triggering consequents
for (int s_k : g.getSuccessors(s_j.get())) {
currentTriggers.get(s_k).add(s_j.index());
}
}
// add a link to the unpopped version of each node still on the agenda
// the integer will be the length of the trajectory plus an index into
// the set of nodes
for (Entry<Integer, List<Integer>> item : currentTriggers.entrySet()) {
int s_k = item.getKey();
List<Integer> triggers = item.getValue();
for (int j : triggers) {
d.addEdge(j, s.size() + g.index(s_k));
}
}
return d;
} | java | public static IntDiGraph buildTriggers(IntDiGraph g, Schedule s) {
// return trigger DAG
IntDiGraph d = new IntDiGraph();
// map from node to triggering indexes
DefaultDict<Integer, List<Integer>> currentTriggers = new DefaultDict<>(i -> new LinkedList<Integer>());
for (Indexed<Integer> s_j : enumerate(s)) {
// add in arcs from triggers
for (int i : currentTriggers.get(s_j.get())) {
d.addEdge(i, s_j.index());
}
// remove s_j from the agenda
currentTriggers.remove(s_j.get());
// record that j is triggering consequents
for (int s_k : g.getSuccessors(s_j.get())) {
currentTriggers.get(s_k).add(s_j.index());
}
}
// add a link to the unpopped version of each node still on the agenda
// the integer will be the length of the trajectory plus an index into
// the set of nodes
for (Entry<Integer, List<Integer>> item : currentTriggers.entrySet()) {
int s_k = item.getKey();
List<Integer> triggers = item.getValue();
for (int j : triggers) {
d.addEdge(j, s.size() + g.index(s_k));
}
}
return d;
} | [
"public",
"static",
"IntDiGraph",
"buildTriggers",
"(",
"IntDiGraph",
"g",
",",
"Schedule",
"s",
")",
"{",
"// return trigger DAG",
"IntDiGraph",
"d",
"=",
"new",
"IntDiGraph",
"(",
")",
";",
"// map from node to triggering indexes",
"DefaultDict",
"<",
"Integer",
"... | return a DAG, G' = V', E' such that vertecies correspond to indexes in
the schedule and there is an edge (i,j) \in E' if s_i triggered s_j | [
"return",
"a",
"DAG",
"G",
"=",
"V",
"E",
"such",
"that",
"vertecies",
"correspond",
"to",
"indexes",
"in",
"the",
"schedule",
"and",
"there",
"is",
"an",
"edge",
"(",
"i",
"j",
")",
"\\",
"in",
"E",
"if",
"s_i",
"triggered",
"s_j"
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/sch/util/ScheduleUtils.java#L33-L62 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/PathFinder.java | PathFinder.getRelativePathTo | public static File getRelativePathTo(final File parent, final String separator,
final String folders, final String filename)
{
final List<String> list = new ArrayList<>(Arrays.asList(folders.split(separator)));
if (filename != null && !filename.isEmpty())
{
list.add(filename);
}
return getRelativePathTo(parent, list);
} | java | public static File getRelativePathTo(final File parent, final String separator,
final String folders, final String filename)
{
final List<String> list = new ArrayList<>(Arrays.asList(folders.split(separator)));
if (filename != null && !filename.isEmpty())
{
list.add(filename);
}
return getRelativePathTo(parent, list);
} | [
"public",
"static",
"File",
"getRelativePathTo",
"(",
"final",
"File",
"parent",
",",
"final",
"String",
"separator",
",",
"final",
"String",
"folders",
",",
"final",
"String",
"filename",
")",
"{",
"final",
"List",
"<",
"String",
">",
"list",
"=",
"new",
... | Gets the file or directory from the given parent File object and the relative path given over
the list as String objects.
@param parent
The parent directory.
@param separator
The separator for separate the String folders.
@param folders
The relative path as a String object separated with the defined separator.
@param filename
The filename.
@return the resulted file or directory from the given arguments. | [
"Gets",
"the",
"file",
"or",
"directory",
"from",
"the",
"given",
"parent",
"File",
"object",
"and",
"the",
"relative",
"path",
"given",
"over",
"the",
"list",
"as",
"String",
"objects",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L162-L171 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/session/SessionFile.java | SessionFile.getInstance | public static Session getInstance(String name, PageContext pc, Log log) {
Resource res = _loadResource(pc.getConfig(), SCOPE_SESSION, name, pc.getCFID());
Struct data = _loadData(pc, res, log);
return new SessionFile(pc, res, data);
} | java | public static Session getInstance(String name, PageContext pc, Log log) {
Resource res = _loadResource(pc.getConfig(), SCOPE_SESSION, name, pc.getCFID());
Struct data = _loadData(pc, res, log);
return new SessionFile(pc, res, data);
} | [
"public",
"static",
"Session",
"getInstance",
"(",
"String",
"name",
",",
"PageContext",
"pc",
",",
"Log",
"log",
")",
"{",
"Resource",
"res",
"=",
"_loadResource",
"(",
"pc",
".",
"getConfig",
"(",
")",
",",
"SCOPE_SESSION",
",",
"name",
",",
"pc",
".",... | load new instance of the class
@param name
@param pc
@param checkExpires
@return | [
"load",
"new",
"instance",
"of",
"the",
"class"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/session/SessionFile.java#L61-L66 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkTypeArguments | private static int checkTypeArguments(final String signature, int pos) {
// TypeArguments:
// < TypeArgument+ >
pos = checkChar('<', signature, pos);
pos = checkTypeArgument(signature, pos);
while (getChar(signature, pos) != '>') {
pos = checkTypeArgument(signature, pos);
}
return pos + 1;
} | java | private static int checkTypeArguments(final String signature, int pos) {
// TypeArguments:
// < TypeArgument+ >
pos = checkChar('<', signature, pos);
pos = checkTypeArgument(signature, pos);
while (getChar(signature, pos) != '>') {
pos = checkTypeArgument(signature, pos);
}
return pos + 1;
} | [
"private",
"static",
"int",
"checkTypeArguments",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// TypeArguments:",
"// < TypeArgument+ >",
"pos",
"=",
"checkChar",
"(",
"'",
"'",
",",
"signature",
",",
"pos",
")",
";",
"pos",
"=",
"chec... | Checks the type arguments in a class type signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"the",
"type",
"arguments",
"in",
"a",
"class",
"type",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L877-L887 |
amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.foldLeft | public <U> U foldLeft(U seed, BiFunction<U, ? super T, U> accumulator) {
Box<U> result = new Box<>(seed);
forEachOrdered(t -> result.a = accumulator.apply(result.a, t));
return result.a;
} | java | public <U> U foldLeft(U seed, BiFunction<U, ? super T, U> accumulator) {
Box<U> result = new Box<>(seed);
forEachOrdered(t -> result.a = accumulator.apply(result.a, t));
return result.a;
} | [
"public",
"<",
"U",
">",
"U",
"foldLeft",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"U",
",",
"?",
"super",
"T",
",",
"U",
">",
"accumulator",
")",
"{",
"Box",
"<",
"U",
">",
"result",
"=",
"new",
"Box",
"<>",
"(",
"seed",
")",
";",
"forEachOrd... | Folds the elements of this stream using the provided seed object and
accumulation function, going left to right. This is equivalent to:
<pre>
{@code
U result = seed;
for (T element : this stream)
result = accumulator.apply(result, element)
return result;
}
</pre>
<p>
This is a terminal operation.
<p>
This method cannot take all the advantages of parallel streams as it must
process elements strictly left to right. If your accumulator function is
associative and you can provide a combiner function, consider using
{@link #reduce(Object, BiFunction, BinaryOperator)} method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param <U> The type of the result
@param seed the starting value
@param accumulator a <a
href="package-summary.html#NonInterference">non-interfering </a>,
<a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #foldRight(Object, BiFunction)
@see #reduce(Object, BinaryOperator)
@see #reduce(Object, BiFunction, BinaryOperator)
@since 0.2.0 | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"left",
"to",
"right",
".",
"This",
"is",
"equivalent",
"to",
":"
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1352-L1356 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_features_backupCloud_POST | public OvhBackupCloud serviceName_features_backupCloud_POST(String serviceName, String cloudProjectId, String projectDescription) throws IOException {
String qPath = "/dedicated/server/{serviceName}/features/backupCloud";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cloudProjectId", cloudProjectId);
addBody(o, "projectDescription", projectDescription);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackupCloud.class);
} | java | public OvhBackupCloud serviceName_features_backupCloud_POST(String serviceName, String cloudProjectId, String projectDescription) throws IOException {
String qPath = "/dedicated/server/{serviceName}/features/backupCloud";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cloudProjectId", cloudProjectId);
addBody(o, "projectDescription", projectDescription);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackupCloud.class);
} | [
"public",
"OvhBackupCloud",
"serviceName_features_backupCloud_POST",
"(",
"String",
"serviceName",
",",
"String",
"cloudProjectId",
",",
"String",
"projectDescription",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/features/backup... | Create a new storage backup space associated to server
REST: POST /dedicated/server/{serviceName}/features/backupCloud
@param projectDescription [required] Project description of the project to be created (ignored when an existing project is already specified)
@param cloudProjectId [required] cloud project id
@param serviceName [required] The internal name of your dedicated server
API beta | [
"Create",
"a",
"new",
"storage",
"backup",
"space",
"associated",
"to",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L778-L786 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java | PmiRegistry.getStats | private static StatsImpl getStats(ModuleItem moduleItem, boolean recursive) {
// Note: cannot retrieve single data for JMX interface
//int[] dataIds = msd.getDataIds();
if (moduleItem == null) { // not found
return null;
}
return moduleItem.getStats(recursive);
/*
* else if(moduleItem.getInstance() == null)
* { // root module item
* return getServer(recursive);
* }
* else
* {
* return moduleItem.getStats(recursive);
* }
*/
} | java | private static StatsImpl getStats(ModuleItem moduleItem, boolean recursive) {
// Note: cannot retrieve single data for JMX interface
//int[] dataIds = msd.getDataIds();
if (moduleItem == null) { // not found
return null;
}
return moduleItem.getStats(recursive);
/*
* else if(moduleItem.getInstance() == null)
* { // root module item
* return getServer(recursive);
* }
* else
* {
* return moduleItem.getStats(recursive);
* }
*/
} | [
"private",
"static",
"StatsImpl",
"getStats",
"(",
"ModuleItem",
"moduleItem",
",",
"boolean",
"recursive",
")",
"{",
"// Note: cannot retrieve single data for JMX interface",
"//int[] dataIds = msd.getDataIds();",
"if",
"(",
"moduleItem",
"==",
"null",
")",
"{",
"// not fo... | /*
// Return a StatsImpl for server data
// Take a boolean parameter for two modes: recursive and non-recursive
private static StatsImpl getServer(boolean recursive)
{
// Note: there is no data under directly under server module tree root,
// so return null if not recursive
if(!recursive) return null;
ModuleItem[] modItems = moduleRoot.children();
if(modItems == null)
{
return new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, null);
}
ArrayList modMembers = new ArrayList(modItems.length);
for(int i=0; i<modItems.length; i++)
{
modMembers.add(modItems[i].getStats(recursive));
}
StatsImpl sCol = new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, modMembers);
return sCol;
} | [
"/",
"*",
"//",
"Return",
"a",
"StatsImpl",
"for",
"server",
"data",
"//",
"Take",
"a",
"boolean",
"parameter",
"for",
"two",
"modes",
":",
"recursive",
"and",
"non",
"-",
"recursive",
"private",
"static",
"StatsImpl",
"getServer",
"(",
"boolean",
"recursive... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java#L559-L578 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/util/StringUtils.java | StringUtils.prependUri | public static String prependUri(String baseUri, String uri) {
if (!uri.startsWith("/")) {
uri = "/" + uri;
}
if (uri.length() == 1 && uri.charAt(0) == '/') {
uri = "";
}
uri = baseUri + uri;
return uri.replaceAll("[\\/]{2,}", "/");
} | java | public static String prependUri(String baseUri, String uri) {
if (!uri.startsWith("/")) {
uri = "/" + uri;
}
if (uri.length() == 1 && uri.charAt(0) == '/') {
uri = "";
}
uri = baseUri + uri;
return uri.replaceAll("[\\/]{2,}", "/");
} | [
"public",
"static",
"String",
"prependUri",
"(",
"String",
"baseUri",
",",
"String",
"uri",
")",
"{",
"if",
"(",
"!",
"uri",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"uri",
"=",
"\"/\"",
"+",
"uri",
";",
"}",
"if",
"(",
"uri",
".",
"length",... | Prepends a partial uri and normalizes / characters.
For example, if the base uri is "/foo/" and the uri
is "/bar/", the output will be "/foo/bar/". Similarly
if the base uri is "/foo" and the uri is "bar", the
output will be "/foo/bar"
@param baseUri The uri to prepend. Eg. /foo
@param uri The uri to combine with the baseUri. Eg. /bar
@return A combined uri string | [
"Prepends",
"a",
"partial",
"uri",
"and",
"normalizes",
"/",
"characters",
".",
"For",
"example",
"if",
"the",
"base",
"uri",
"is",
"/",
"foo",
"/",
"and",
"the",
"uri",
"is",
"/",
"bar",
"/",
"the",
"output",
"will",
"be",
"/",
"foo",
"/",
"bar",
... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/StringUtils.java#L255-L264 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.moveResources | public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) {
moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body();
} | java | public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) {
moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body();
} | [
"public",
"void",
"moveResources",
"(",
"String",
"sourceResourceGroupName",
",",
"ResourcesMoveInfo",
"parameters",
")",
"{",
"moveResourcesWithServiceResponseAsync",
"(",
"sourceResourceGroupName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",... | Moves resources from one resource group to another resource group.
The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.
@param sourceResourceGroupName The name of the resource group containing the resources to move.
@param parameters Parameters for moving resources.
@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 | [
"Moves",
"resources",
"from",
"one",
"resource",
"group",
"to",
"another",
"resource",
"group",
".",
"The",
"resources",
"to",
"move",
"must",
"be",
"in",
"the",
"same",
"source",
"resource",
"group",
".",
"The",
"target",
"resource",
"group",
"may",
"be",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L418-L420 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/DefaultQueryParser.java | DefaultQueryParser.doConstructSolrQuery | @Override
public final SolrQuery doConstructSolrQuery(SolrDataQuery query, @Nullable Class<?> domainType) {
Assert.notNull(query, "Cannot construct solrQuery from null value.");
Assert.notNull(query.getCriteria(), "Query has to have a criteria.");
SolrQuery solrQuery = new SolrQuery();
solrQuery.setParam(CommonParams.Q, getQueryString(query, domainType));
if (query instanceof Query) {
processQueryOptions(solrQuery, (Query) query, domainType);
}
if (query instanceof FacetQuery) {
processFacetOptions(solrQuery, (FacetQuery) query, domainType);
}
if (query instanceof HighlightQuery) {
processHighlightOptions(solrQuery, (HighlightQuery) query, domainType);
}
return solrQuery;
} | java | @Override
public final SolrQuery doConstructSolrQuery(SolrDataQuery query, @Nullable Class<?> domainType) {
Assert.notNull(query, "Cannot construct solrQuery from null value.");
Assert.notNull(query.getCriteria(), "Query has to have a criteria.");
SolrQuery solrQuery = new SolrQuery();
solrQuery.setParam(CommonParams.Q, getQueryString(query, domainType));
if (query instanceof Query) {
processQueryOptions(solrQuery, (Query) query, domainType);
}
if (query instanceof FacetQuery) {
processFacetOptions(solrQuery, (FacetQuery) query, domainType);
}
if (query instanceof HighlightQuery) {
processHighlightOptions(solrQuery, (HighlightQuery) query, domainType);
}
return solrQuery;
} | [
"@",
"Override",
"public",
"final",
"SolrQuery",
"doConstructSolrQuery",
"(",
"SolrDataQuery",
"query",
",",
"@",
"Nullable",
"Class",
"<",
"?",
">",
"domainType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"query",
",",
"\"Cannot construct solrQuery from null value.\... | Convert given Query into a SolrQuery executable via {@link org.apache.solr.client.solrj.SolrClient}
@param query the source query to turn into a {@link SolrQuery}.
@param domainType can be {@literal null}.
@return | [
"Convert",
"given",
"Query",
"into",
"a",
"SolrQuery",
"executable",
"via",
"{",
"@link",
"org",
".",
"apache",
".",
"solr",
".",
"client",
".",
"solrj",
".",
"SolrClient",
"}"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/DefaultQueryParser.java#L89-L111 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.extractFromHeader | public T extractFromHeader(String headerName, String variable) {
if (headerExtractor == null) {
headerExtractor = new MessageHeaderVariableExtractor();
getAction().getVariableExtractors().add(headerExtractor);
}
headerExtractor.getHeaderMappings().put(headerName, variable);
return self;
} | java | public T extractFromHeader(String headerName, String variable) {
if (headerExtractor == null) {
headerExtractor = new MessageHeaderVariableExtractor();
getAction().getVariableExtractors().add(headerExtractor);
}
headerExtractor.getHeaderMappings().put(headerName, variable);
return self;
} | [
"public",
"T",
"extractFromHeader",
"(",
"String",
"headerName",
",",
"String",
"variable",
")",
"{",
"if",
"(",
"headerExtractor",
"==",
"null",
")",
"{",
"headerExtractor",
"=",
"new",
"MessageHeaderVariableExtractor",
"(",
")",
";",
"getAction",
"(",
")",
"... | Extract message header entry as variable.
@param headerName
@param variable
@return | [
"Extract",
"message",
"header",
"entry",
"as",
"variable",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L778-L787 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.