repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
204
| func_name
stringlengths 5
103
| whole_func_string
stringlengths 87
3.44k
| language
stringclasses 1
value | func_code_string
stringlengths 87
3.44k
| func_code_tokens
listlengths 21
714
| func_documentation_string
stringlengths 61
1.95k
| func_documentation_tokens
listlengths 1
482
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
309
|
---|---|---|---|---|---|---|---|---|---|---|
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.virtualNumbers_number_serviceInfos_PUT | public void virtualNumbers_number_serviceInfos_PUT(String number, OvhService body) throws IOException {
String qPath = "/sms/virtualNumbers/{number}/serviceInfos";
StringBuilder sb = path(qPath, number);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void virtualNumbers_number_serviceInfos_PUT(String number, OvhService body) throws IOException {
String qPath = "/sms/virtualNumbers/{number}/serviceInfos";
StringBuilder sb = path(qPath, number);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"virtualNumbers_number_serviceInfos_PUT",
"(",
"String",
"number",
",",
"OvhService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/virtualNumbers/{number}/serviceInfos\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"number",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /sms/virtualNumbers/{number}/serviceInfos
@param body [required] New object properties
@param number [required] Your virtual number | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1761-L1765 |
google/closure-templates | java/src/com/google/template/soy/shared/internal/SharedRuntime.java | SharedRuntime.compareString | public static boolean compareString(String string, SoyValue other) {
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString());
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | java | public static boolean compareString(String string, SoyValue other) {
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString());
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | [
"public",
"static",
"boolean",
"compareString",
"(",
"String",
"string",
",",
"SoyValue",
"other",
")",
"{",
"// This follows similarly to the Javascript specification, to ensure similar operation",
"// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3",
"if",
"(",
"other",
"instanceof",
"StringData",
"||",
"other",
"instanceof",
"SanitizedContent",
")",
"{",
"return",
"string",
".",
"equals",
"(",
"other",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"other",
"instanceof",
"NumberData",
")",
"{",
"try",
"{",
"// Parse the string as a number.",
"return",
"Double",
".",
"parseDouble",
"(",
"string",
")",
"==",
"other",
".",
"numberValue",
"(",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"// Didn't parse as a number.",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines if the operand's string form can be equality-compared with a string. | [
"Determines",
"if",
"the",
"operand",
"s",
"string",
"form",
"can",
"be",
"equality",
"-",
"compared",
"with",
"a",
"string",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/SharedRuntime.java#L122-L138 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java | JsonRpcHttpAsyncClient.readResponse | private <T> T readResponse(Type returnType, InputStream ips) throws Throwable {
JsonNode response = mapper.readTree(new NoCloseInputStream(ips));
logger.debug("JSON-PRC Response: {}", response);
if (!response.isObject()) {
throw new JsonRpcClientException(0, "Invalid JSON-RPC response", response);
}
ObjectNode jsonObject = ObjectNode.class.cast(response);
if (jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull()) {
throw exceptionResolver.resolveException(jsonObject);
}
if (jsonObject.has(RESULT) && !jsonObject.get(RESULT).isNull() && jsonObject.get(RESULT) != null) {
JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);
return mapper.readValue(returnJsonParser, returnJavaType);
}
return null;
} | java | private <T> T readResponse(Type returnType, InputStream ips) throws Throwable {
JsonNode response = mapper.readTree(new NoCloseInputStream(ips));
logger.debug("JSON-PRC Response: {}", response);
if (!response.isObject()) {
throw new JsonRpcClientException(0, "Invalid JSON-RPC response", response);
}
ObjectNode jsonObject = ObjectNode.class.cast(response);
if (jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull()) {
throw exceptionResolver.resolveException(jsonObject);
}
if (jsonObject.has(RESULT) && !jsonObject.get(RESULT).isNull() && jsonObject.get(RESULT) != null) {
JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);
return mapper.readValue(returnJsonParser, returnJavaType);
}
return null;
} | [
"private",
"<",
"T",
">",
"T",
"readResponse",
"(",
"Type",
"returnType",
",",
"InputStream",
"ips",
")",
"throws",
"Throwable",
"{",
"JsonNode",
"response",
"=",
"mapper",
".",
"readTree",
"(",
"new",
"NoCloseInputStream",
"(",
"ips",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"JSON-PRC Response: {}\"",
",",
"response",
")",
";",
"if",
"(",
"!",
"response",
".",
"isObject",
"(",
")",
")",
"{",
"throw",
"new",
"JsonRpcClientException",
"(",
"0",
",",
"\"Invalid JSON-RPC response\"",
",",
"response",
")",
";",
"}",
"ObjectNode",
"jsonObject",
"=",
"ObjectNode",
".",
"class",
".",
"cast",
"(",
"response",
")",
";",
"if",
"(",
"jsonObject",
".",
"has",
"(",
"ERROR",
")",
"&&",
"jsonObject",
".",
"get",
"(",
"ERROR",
")",
"!=",
"null",
"&&",
"!",
"jsonObject",
".",
"get",
"(",
"ERROR",
")",
".",
"isNull",
"(",
")",
")",
"{",
"throw",
"exceptionResolver",
".",
"resolveException",
"(",
"jsonObject",
")",
";",
"}",
"if",
"(",
"jsonObject",
".",
"has",
"(",
"RESULT",
")",
"&&",
"!",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
".",
"isNull",
"(",
")",
"&&",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
"!=",
"null",
")",
"{",
"JsonParser",
"returnJsonParser",
"=",
"mapper",
".",
"treeAsTokens",
"(",
"jsonObject",
".",
"get",
"(",
"RESULT",
")",
")",
";",
"JavaType",
"returnJavaType",
"=",
"mapper",
".",
"getTypeFactory",
"(",
")",
".",
"constructType",
"(",
"returnType",
")",
";",
"return",
"mapper",
".",
"readValue",
"(",
"returnJsonParser",
",",
"returnJavaType",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Reads a JSON-PRC response from the server. This blocks until a response
is received.
@param returnType the expected return type
@param ips the {@link InputStream} to read from
@return the object returned by the JSON-RPC response
@throws Throwable on error | [
"Reads",
"a",
"JSON",
"-",
"PRC",
"response",
"from",
"the",
"server",
".",
"This",
"blocks",
"until",
"a",
"response",
"is",
"received",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java#L380-L399 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java | CommonsAssert.assertEquals | public static <T> void assertEquals (@Nullable final T x, @Nullable final T y)
{
assertEquals ((String) null, x, y);
} | java | public static <T> void assertEquals (@Nullable final T x, @Nullable final T y)
{
assertEquals ((String) null, x, y);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertEquals",
"(",
"@",
"Nullable",
"final",
"T",
"x",
",",
"@",
"Nullable",
"final",
"T",
"y",
")",
"{",
"assertEquals",
"(",
"(",
"String",
")",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Like JUnit assertEquals but using {@link EqualsHelper}.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>. | [
"Like",
"JUnit",
"assertEquals",
"but",
"using",
"{",
"@link",
"EqualsHelper",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java#L170-L173 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java | FindElementAction.validateElementProperty | private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
if (StringUtils.hasText(controlValue)) {
String control = context.replaceDynamicContentInString(controlValue);
if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
} else {
Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
}
}
} | java | private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
if (StringUtils.hasText(controlValue)) {
String control = context.replaceDynamicContentInString(controlValue);
if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
} else {
Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
}
}
} | [
"private",
"void",
"validateElementProperty",
"(",
"String",
"propertyName",
",",
"String",
"controlValue",
",",
"String",
"resultValue",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"controlValue",
")",
")",
"{",
"String",
"control",
"=",
"context",
".",
"replaceDynamicContentInString",
"(",
"controlValue",
")",
";",
"if",
"(",
"ValidationMatcherUtils",
".",
"isValidationMatcherExpression",
"(",
"control",
")",
")",
"{",
"ValidationMatcherUtils",
".",
"resolveValidationMatcher",
"(",
"\"payload\"",
",",
"resultValue",
",",
"control",
",",
"context",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"control",
".",
"equals",
"(",
"resultValue",
")",
",",
"String",
".",
"format",
"(",
"\"Selenium web element validation failed, %s expected '%s', but was '%s'\"",
",",
"propertyName",
",",
"control",
",",
"resultValue",
")",
")",
";",
"}",
"}",
"}"
] | Validates web element property value with validation matcher support.
@param propertyName
@param controlValue
@param resultValue
@param context | [
"Validates",
"web",
"element",
"property",
"value",
"with",
"validation",
"matcher",
"support",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L114-L124 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updateEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateEntityRoleOptionalParameter updateEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateEntityRoleOptionalParameter != null ? updateEntityRoleOptionalParameter.name() : null;
return updateEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | java | public Observable<ServiceResponse<OperationStatus>> updateEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateEntityRoleOptionalParameter updateEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateEntityRoleOptionalParameter != null ? updateEntityRoleOptionalParameter.name() : null;
return updateEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updateEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdateEntityRoleOptionalParameter",
"updateEntityRoleOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"versionId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter versionId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"entityId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter entityId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"roleId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter roleId is required and cannot be null.\"",
")",
";",
"}",
"final",
"String",
"name",
"=",
"updateEntityRoleOptionalParameter",
"!=",
"null",
"?",
"updateEntityRoleOptionalParameter",
".",
"name",
"(",
")",
":",
"null",
";",
"return",
"updateEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
"roleId",
",",
"name",
")",
";",
"}"
] | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10893-L10912 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.buildListableBeanFactory | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | java | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | [
"private",
"static",
"DefaultListableBeanFactory",
"buildListableBeanFactory",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
")",
"{",
"//new empty context",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"new",
"DefaultListableBeanFactory",
"(",
")",
";",
"//Injection of the new beans in the context",
"for",
"(",
"String",
"key",
":",
"extraBeans",
".",
"keySet",
"(",
")",
")",
"{",
"parentBeanFactory",
".",
"registerSingleton",
"(",
"key",
",",
"extraBeans",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"return",
"parentBeanFactory",
";",
"}"
] | Builds a listable bean factory with the given beans.
@param extraBeans
@return new Created BeanFactory | [
"Builds",
"a",
"listable",
"bean",
"factory",
"with",
"the",
"given",
"beans",
"."
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L112-L121 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.split | public static <T> List<List<T>> split(final Collection<? extends T> c, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return split(c, 0, c.size(), size);
} | java | public static <T> List<List<T>> split(final Collection<? extends T> c, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return split(c, 0, c.size(), size);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"split",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"T",
">",
"c",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The parameter 'size' can not be zero or less than zero\"",
")",
";",
"}",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"c",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"return",
"split",
"(",
"c",
",",
"0",
",",
"c",
".",
"size",
"(",
")",
",",
"size",
")",
";",
"}"
] | Returns consecutive sub lists of a collection, each of the same size (the final list may be smaller).
or an empty List if the specified collection is null or empty. The order of elements in the original collection is kept
@param c
@param size
@return | [
"Returns",
"consecutive",
"sub",
"lists",
"of",
"a",
"collection",
"each",
"of",
"the",
"same",
"size",
"(",
"the",
"final",
"list",
"may",
"be",
"smaller",
")",
".",
"or",
"an",
"empty",
"List",
"if",
"the",
"specified",
"collection",
"is",
"null",
"or",
"empty",
".",
"The",
"order",
"of",
"elements",
"in",
"the",
"original",
"collection",
"is",
"kept"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18665-L18675 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java | CryptoPrimitives.certificationRequestToPEM | private String certificationRequestToPEM(PKCS10CertificationRequest csr) throws IOException {
PemObject pemCSR = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
StringWriter str = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(str);
pemWriter.writeObject(pemCSR);
pemWriter.close();
str.close();
return str.toString();
} | java | private String certificationRequestToPEM(PKCS10CertificationRequest csr) throws IOException {
PemObject pemCSR = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
StringWriter str = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(str);
pemWriter.writeObject(pemCSR);
pemWriter.close();
str.close();
return str.toString();
} | [
"private",
"String",
"certificationRequestToPEM",
"(",
"PKCS10CertificationRequest",
"csr",
")",
"throws",
"IOException",
"{",
"PemObject",
"pemCSR",
"=",
"new",
"PemObject",
"(",
"\"CERTIFICATE REQUEST\"",
",",
"csr",
".",
"getEncoded",
"(",
")",
")",
";",
"StringWriter",
"str",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JcaPEMWriter",
"pemWriter",
"=",
"new",
"JcaPEMWriter",
"(",
"str",
")",
";",
"pemWriter",
".",
"writeObject",
"(",
"pemCSR",
")",
";",
"pemWriter",
".",
"close",
"(",
")",
";",
"str",
".",
"close",
"(",
")",
";",
"return",
"str",
".",
"toString",
"(",
")",
";",
"}"
] | certificationRequestToPEM - Convert a PKCS10CertificationRequest to PEM
format.
@param csr The Certificate to convert
@return An equivalent PEM format certificate.
@throws IOException | [
"certificationRequestToPEM",
"-",
"Convert",
"a",
"PKCS10CertificationRequest",
"to",
"PEM",
"format",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java#L815-L824 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/KNNDistancesSampler.java | KNNDistancesSampler.run | public KNNDistanceOrderResult run(Database database, Relation<O> relation) {
final DistanceQuery<O> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
final KNNQuery<O> knnQuery = database.getKNNQuery(distanceQuery, k + 1);
final int size = (int) ((sample <= 1.) ? Math.ceil(relation.size() * sample) : sample);
DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), size, rnd);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling kNN distances", size, LOG) : null;
double[] knnDistances = new double[size];
int i = 0;
for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance(), i++) {
final KNNList neighbors = knnQuery.getKNNForDBID(iditer, k + 1);
knnDistances[i] = neighbors.getKNNDistance();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return new KNNDistanceOrderResult(knnDistances, k);
} | java | public KNNDistanceOrderResult run(Database database, Relation<O> relation) {
final DistanceQuery<O> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
final KNNQuery<O> knnQuery = database.getKNNQuery(distanceQuery, k + 1);
final int size = (int) ((sample <= 1.) ? Math.ceil(relation.size() * sample) : sample);
DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), size, rnd);
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling kNN distances", size, LOG) : null;
double[] knnDistances = new double[size];
int i = 0;
for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance(), i++) {
final KNNList neighbors = knnQuery.getKNNForDBID(iditer, k + 1);
knnDistances[i] = neighbors.getKNNDistance();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
return new KNNDistanceOrderResult(knnDistances, k);
} | [
"public",
"KNNDistanceOrderResult",
"run",
"(",
"Database",
"database",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"final",
"DistanceQuery",
"<",
"O",
">",
"distanceQuery",
"=",
"database",
".",
"getDistanceQuery",
"(",
"relation",
",",
"getDistanceFunction",
"(",
")",
")",
";",
"final",
"KNNQuery",
"<",
"O",
">",
"knnQuery",
"=",
"database",
".",
"getKNNQuery",
"(",
"distanceQuery",
",",
"k",
"+",
"1",
")",
";",
"final",
"int",
"size",
"=",
"(",
"int",
")",
"(",
"(",
"sample",
"<=",
"1.",
")",
"?",
"Math",
".",
"ceil",
"(",
"relation",
".",
"size",
"(",
")",
"*",
"sample",
")",
":",
"sample",
")",
";",
"DBIDs",
"sample",
"=",
"DBIDUtil",
".",
"randomSample",
"(",
"relation",
".",
"getDBIDs",
"(",
")",
",",
"size",
",",
"rnd",
")",
";",
"FiniteProgress",
"prog",
"=",
"LOG",
".",
"isVerbose",
"(",
")",
"?",
"new",
"FiniteProgress",
"(",
"\"Sampling kNN distances\"",
",",
"size",
",",
"LOG",
")",
":",
"null",
";",
"double",
"[",
"]",
"knnDistances",
"=",
"new",
"double",
"[",
"size",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"DBIDIter",
"iditer",
"=",
"sample",
".",
"iter",
"(",
")",
";",
"iditer",
".",
"valid",
"(",
")",
";",
"iditer",
".",
"advance",
"(",
")",
",",
"i",
"++",
")",
"{",
"final",
"KNNList",
"neighbors",
"=",
"knnQuery",
".",
"getKNNForDBID",
"(",
"iditer",
",",
"k",
"+",
"1",
")",
";",
"knnDistances",
"[",
"i",
"]",
"=",
"neighbors",
".",
"getKNNDistance",
"(",
")",
";",
"LOG",
".",
"incrementProcessed",
"(",
"prog",
")",
";",
"}",
"LOG",
".",
"ensureCompleted",
"(",
"prog",
")",
";",
"return",
"new",
"KNNDistanceOrderResult",
"(",
"knnDistances",
",",
"k",
")",
";",
"}"
] | Provides an order of the kNN-distances for all objects within the specified
database.
@param database Database
@param relation Relation
@return Result | [
"Provides",
"an",
"order",
"of",
"the",
"kNN",
"-",
"distances",
"for",
"all",
"objects",
"within",
"the",
"specified",
"database",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/KNNDistancesSampler.java#L137-L155 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.showCurrentDates | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | java | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | [
"public",
"void",
"showCurrentDates",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"dates",
")",
"{",
"m_overviewList",
".",
"setDatesWithCheckState",
"(",
"dates",
")",
";",
"m_overviewPopup",
".",
"center",
"(",
")",
";",
"}"
] | Shows the provided list of dates as current dates.
@param dates the current dates to show, accompanied with the information if they are exceptions or not. | [
"Shows",
"the",
"provided",
"list",
"of",
"dates",
"as",
"current",
"dates",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L339-L344 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java | WorkflowServiceImpl.rerunWorkflow | @Service
public String rerunWorkflow(String workflowId, RerunWorkflowRequest request) {
request.setReRunFromWorkflowId(workflowId);
return workflowExecutor.rerun(request);
} | java | @Service
public String rerunWorkflow(String workflowId, RerunWorkflowRequest request) {
request.setReRunFromWorkflowId(workflowId);
return workflowExecutor.rerun(request);
} | [
"@",
"Service",
"public",
"String",
"rerunWorkflow",
"(",
"String",
"workflowId",
",",
"RerunWorkflowRequest",
"request",
")",
"{",
"request",
".",
"setReRunFromWorkflowId",
"(",
"workflowId",
")",
";",
"return",
"workflowExecutor",
".",
"rerun",
"(",
"request",
")",
";",
"}"
] | Reruns the workflow from a specific task.
@param workflowId WorkflowId of the workflow you want to rerun.
@param request (@link RerunWorkflowRequest) for the workflow.
@return WorkflowId of the rerun workflow. | [
"Reruns",
"the",
"workflow",
"from",
"a",
"specific",
"task",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java#L279-L283 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimelineQueryReportPage.java | ThesisTimelineQueryReportPage.createStatistics | private QueryFieldDataStatistics createStatistics(List<Double> data, double min, double max, double step) {
Map<Double, String> dataNames = new HashMap<>();
for (double d = min; d <= max; d += step) {
String caption = step % 1 == 0 ? Long.toString(Math.round(d)) : Double.toString(d);
dataNames.put(d, caption);
}
return ReportUtils.getStatistics(data, dataNames);
} | java | private QueryFieldDataStatistics createStatistics(List<Double> data, double min, double max, double step) {
Map<Double, String> dataNames = new HashMap<>();
for (double d = min; d <= max; d += step) {
String caption = step % 1 == 0 ? Long.toString(Math.round(d)) : Double.toString(d);
dataNames.put(d, caption);
}
return ReportUtils.getStatistics(data, dataNames);
} | [
"private",
"QueryFieldDataStatistics",
"createStatistics",
"(",
"List",
"<",
"Double",
">",
"data",
",",
"double",
"min",
",",
"double",
"max",
",",
"double",
"step",
")",
"{",
"Map",
"<",
"Double",
",",
"String",
">",
"dataNames",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"double",
"d",
"=",
"min",
";",
"d",
"<=",
"max",
";",
"d",
"+=",
"step",
")",
"{",
"String",
"caption",
"=",
"step",
"%",
"1",
"==",
"0",
"?",
"Long",
".",
"toString",
"(",
"Math",
".",
"round",
"(",
"d",
")",
")",
":",
"Double",
".",
"toString",
"(",
"d",
")",
";",
"dataNames",
".",
"put",
"(",
"d",
",",
"caption",
")",
";",
"}",
"return",
"ReportUtils",
".",
"getStatistics",
"(",
"data",
",",
"dataNames",
")",
";",
"}"
] | Creates statistics object
@param data data
@param min min
@param max max
@param step step
@return statistics object | [
"Creates",
"statistics",
"object"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimelineQueryReportPage.java#L142-L151 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java | JsonModelCoder.encodeNullToBlank | public void encodeNullToBlank(Writer writer, T obj) throws IOException {
if (obj == null) {
writer.write("{}");
writer.flush();
return;
}
encodeNullToNull(writer, obj);
} | java | public void encodeNullToBlank(Writer writer, T obj) throws IOException {
if (obj == null) {
writer.write("{}");
writer.flush();
return;
}
encodeNullToNull(writer, obj);
} | [
"public",
"void",
"encodeNullToBlank",
"(",
"Writer",
"writer",
",",
"T",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"{}\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"return",
";",
"}",
"encodeNullToNull",
"(",
"writer",
",",
"obj",
")",
";",
"}"
] | Encodes the given value into the JSON format, and writes it using the given writer.<br>
Writes "{}" if null is given.
@param writer {@link Writer} to be used for writing value
@param obj Value to encoded
@throws IOException | [
"Encodes",
"the",
"given",
"value",
"into",
"the",
"JSON",
"format",
"and",
"writes",
"it",
"using",
"the",
"given",
"writer",
".",
"<br",
">",
"Writes",
"{}",
"if",
"null",
"is",
"given",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L411-L419 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamperImp.java | PdfStamperImp.setTransition | void setTransition(PdfTransition transition, int page) {
PdfDictionary pg = reader.getPageN(page);
if (transition == null)
pg.remove(PdfName.TRANS);
else
pg.put(PdfName.TRANS, transition.getTransitionDictionary());
markUsed(pg);
} | java | void setTransition(PdfTransition transition, int page) {
PdfDictionary pg = reader.getPageN(page);
if (transition == null)
pg.remove(PdfName.TRANS);
else
pg.put(PdfName.TRANS, transition.getTransitionDictionary());
markUsed(pg);
} | [
"void",
"setTransition",
"(",
"PdfTransition",
"transition",
",",
"int",
"page",
")",
"{",
"PdfDictionary",
"pg",
"=",
"reader",
".",
"getPageN",
"(",
"page",
")",
";",
"if",
"(",
"transition",
"==",
"null",
")",
"pg",
".",
"remove",
"(",
"PdfName",
".",
"TRANS",
")",
";",
"else",
"pg",
".",
"put",
"(",
"PdfName",
".",
"TRANS",
",",
"transition",
".",
"getTransitionDictionary",
"(",
")",
")",
";",
"markUsed",
"(",
"pg",
")",
";",
"}"
] | Sets the transition for the page
@param transition the transition object. A <code>null</code> removes the transition
@param page the page where the transition will be applied. The first page is 1 | [
"Sets",
"the",
"transition",
"for",
"the",
"page"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java#L1432-L1439 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newHandler | public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) {
return newHandler(alloc, startTls, delegatedTaskExecutor);
} | java | public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) {
return newHandler(alloc, startTls, delegatedTaskExecutor);
} | [
"public",
"SslHandler",
"newHandler",
"(",
"ByteBufAllocator",
"alloc",
",",
"Executor",
"delegatedTaskExecutor",
")",
"{",
"return",
"newHandler",
"(",
"alloc",
",",
"startTls",
",",
"delegatedTaskExecutor",
")",
";",
"}"
] | Creates a new {@link SslHandler}.
<p>If {@link SslProvider#OPENSSL_REFCNT} is used then the returned {@link SslHandler} will release the engine
that is wrapped. If the returned {@link SslHandler} is not inserted into a pipeline then you may leak native
memory!
<p><b>Beware</b>: the underlying generated {@link SSLEngine} won't have
<a href="https://wiki.openssl.org/index.php/Hostname_validation">hostname verification</a> enabled by default.
If you create {@link SslHandler} for the client side and want proper security, we advice that you configure
the {@link SSLEngine} (see {@link javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)}):
<pre>
SSLEngine sslEngine = sslHandler.engine();
SSLParameters sslParameters = sslEngine.getSSLParameters();
// only available since Java 7
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
sslEngine.setSSLParameters(sslParameters);
</pre>
<p>
The underlying {@link SSLEngine} may not follow the restrictions imposed by the
<a href="https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html">SSLEngine javadocs</a> which
limits wrap/unwrap to operate on a single SSL/TLS packet.
@param alloc If supported by the SSLEngine then the SSLEngine will use this to allocate ByteBuf objects.
@param delegatedTaskExecutor the {@link Executor} that will be used to execute tasks that are returned by
{@link SSLEngine#getDelegatedTask()}.
@return a new {@link SslHandler} | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L924-L926 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UShortArray | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UShortArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"USHORT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named fixed unsigned short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"unsigned",
"short",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1058-L1063 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java | EvaluationCalibration.getResidualPlot | public Histogram getResidualPlot(int labelClassIdx) {
String title = "Residual Plot - Predictions for Label Class " + labelClassIdx;
int[] counts = residualPlotByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | java | public Histogram getResidualPlot(int labelClassIdx) {
String title = "Residual Plot - Predictions for Label Class " + labelClassIdx;
int[] counts = residualPlotByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | [
"public",
"Histogram",
"getResidualPlot",
"(",
"int",
"labelClassIdx",
")",
"{",
"String",
"title",
"=",
"\"Residual Plot - Predictions for Label Class \"",
"+",
"labelClassIdx",
";",
"int",
"[",
"]",
"counts",
"=",
"residualPlotByLabelClass",
".",
"getColumn",
"(",
"labelClassIdx",
")",
".",
"dup",
"(",
")",
".",
"data",
"(",
")",
".",
"asInt",
"(",
")",
";",
"return",
"new",
"Histogram",
"(",
"title",
",",
"0.0",
",",
"1.0",
",",
"counts",
")",
";",
"}"
] | Get the residual plot, only for examples of the specified class.. The residual plot is defined as a histogram of<br>
|label_i - prob(class_i | input)| for all and examples; for this particular method, only predictions where
i == labelClassIdx are included.<br>
In general, small residuals indicate a superior classifier to large residuals.
@param labelClassIdx Index of the class to get the residual plot for
@return Residual plot (histogram) - all predictions/classes | [
"Get",
"the",
"residual",
"plot",
"only",
"for",
"examples",
"of",
"the",
"specified",
"class",
"..",
"The",
"residual",
"plot",
"is",
"defined",
"as",
"a",
"histogram",
"of<br",
">",
"|label_i",
"-",
"prob",
"(",
"class_i",
"|",
"input",
")",
"|",
"for",
"all",
"and",
"examples",
";",
"for",
"this",
"particular",
"method",
"only",
"predictions",
"where",
"i",
"==",
"labelClassIdx",
"are",
"included",
".",
"<br",
">",
"In",
"general",
"small",
"residuals",
"indicate",
"a",
"superior",
"classifier",
"to",
"large",
"residuals",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L443-L447 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.headerFragment | public T headerFragment(Object model) {
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(Marshaller.class))) {
return headerFragment(model, applicationContext.getBean(Marshaller.class));
} else if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(ObjectMapper.class))) {
return headerFragment(model, applicationContext.getBean(ObjectMapper.class));
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | java | public T headerFragment(Object model) {
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(Marshaller.class))) {
return headerFragment(model, applicationContext.getBean(Marshaller.class));
} else if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(ObjectMapper.class))) {
return headerFragment(model, applicationContext.getBean(ObjectMapper.class));
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | [
"public",
"T",
"headerFragment",
"(",
"Object",
"model",
")",
"{",
"Assert",
".",
"notNull",
"(",
"applicationContext",
",",
"\"Citrus application context is not initialized!\"",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"applicationContext",
".",
"getBeansOfType",
"(",
"Marshaller",
".",
"class",
")",
")",
")",
"{",
"return",
"headerFragment",
"(",
"model",
",",
"applicationContext",
".",
"getBean",
"(",
"Marshaller",
".",
"class",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"applicationContext",
".",
"getBeansOfType",
"(",
"ObjectMapper",
".",
"class",
")",
")",
")",
"{",
"return",
"headerFragment",
"(",
"model",
",",
"applicationContext",
".",
"getBean",
"(",
"ObjectMapper",
".",
"class",
")",
")",
";",
"}",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Unable to find default object mapper or marshaller in application context\"",
")",
";",
"}"
] | Expect this message header data as model object which is marshalled to a character sequence using the default object to xml mapper that
is available in Spring bean application context.
@param model
@return | [
"Expect",
"this",
"message",
"header",
"data",
"as",
"model",
"object",
"which",
"is",
"marshalled",
"to",
"a",
"character",
"sequence",
"using",
"the",
"default",
"object",
"to",
"xml",
"mapper",
"that",
"is",
"available",
"in",
"Spring",
"bean",
"application",
"context",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L340-L350 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getHierarchicalEntityRole | public EntityRole getHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId) {
return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).toBlocking().single().body();
} | java | public EntityRole getHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId) {
return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).toBlocking().single().body();
} | [
"public",
"EntityRole",
"getHierarchicalEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getHierarchicalEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"hEntityId",
",",
"roleId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EntityRole object if successful. | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13160-L13162 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Report.java | Report.addToTab | public Report addToTab(String tabName, String key, Object value) {
diagnostics.metaData.addToTab(tabName, key, value);
return this;
} | java | public Report addToTab(String tabName, String key, Object value) {
diagnostics.metaData.addToTab(tabName, key, value);
return this;
} | [
"public",
"Report",
"addToTab",
"(",
"String",
"tabName",
",",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"diagnostics",
".",
"metaData",
".",
"addToTab",
"(",
"tabName",
",",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a key value pair to a metadata tab.
@param tabName the name of the tab to add the key value pair to
@param key the key of the metadata to add
@param value the metadata value to add
@return the modified report | [
"Add",
"a",
"key",
"value",
"pair",
"to",
"a",
"metadata",
"tab",
"."
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Report.java#L190-L193 |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.epsilonClosure | public Set<NFAState<T>> epsilonClosure(Scope<DFAState<T>> scope)
{
Set<NFAState<T>> set = new HashSet<>();
set.add(this);
return epsilonClosure(scope, set);
} | java | public Set<NFAState<T>> epsilonClosure(Scope<DFAState<T>> scope)
{
Set<NFAState<T>> set = new HashSet<>();
set.add(this);
return epsilonClosure(scope, set);
} | [
"public",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"epsilonClosure",
"(",
"Scope",
"<",
"DFAState",
"<",
"T",
">",
">",
"scope",
")",
"{",
"Set",
"<",
"NFAState",
"<",
"T",
">>",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"set",
".",
"add",
"(",
"this",
")",
";",
"return",
"epsilonClosure",
"(",
"scope",
",",
"set",
")",
";",
"}"
] | Creates a dfa state from all nfa states that can be reached from this state
with epsilon move.
@param scope
@return | [
"Creates",
"a",
"dfa",
"state",
"from",
"all",
"nfa",
"states",
"that",
"can",
"be",
"reached",
"from",
"this",
"state",
"with",
"epsilon",
"move",
"."
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L431-L436 |
bbottema/outlook-message-parser | src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java | OutlookMessageParser.analyzeDocumentEntry | private OutlookFieldInformation analyzeDocumentEntry(final DocumentEntry de) {
final String name = de.getName();
// we are only interested in document entries
// with names starting with __substg1.
LOGGER.trace("Document entry: {}", name);
if (name.startsWith(PROPERTY_STREAM_PREFIX)) {
final String clazz;
final String type;
final int mapiType;
try {
final String val = name.substring(PROPERTY_STREAM_PREFIX.length()).toLowerCase();
// the first 4 digits of the remainder
// defines the field class (or field name)
// and the last 4 digits indicate the
// data type.
clazz = val.substring(0, 4);
type = val.substring(4);
LOGGER.trace(" Found document entry: class={}, type={}", clazz, type);
mapiType = Integer.parseInt(type, 16);
} catch (final RuntimeException re) {
LOGGER.error("Could not parse directory entry {}", name, re);
return new OutlookFieldInformation();
}
return new OutlookFieldInformation(clazz, mapiType);
} else {
LOGGER.trace("Ignoring entry with name {}", name);
}
// we are not interested in the field
// and return an empty OutlookFieldInformation object
return new OutlookFieldInformation();
} | java | private OutlookFieldInformation analyzeDocumentEntry(final DocumentEntry de) {
final String name = de.getName();
// we are only interested in document entries
// with names starting with __substg1.
LOGGER.trace("Document entry: {}", name);
if (name.startsWith(PROPERTY_STREAM_PREFIX)) {
final String clazz;
final String type;
final int mapiType;
try {
final String val = name.substring(PROPERTY_STREAM_PREFIX.length()).toLowerCase();
// the first 4 digits of the remainder
// defines the field class (or field name)
// and the last 4 digits indicate the
// data type.
clazz = val.substring(0, 4);
type = val.substring(4);
LOGGER.trace(" Found document entry: class={}, type={}", clazz, type);
mapiType = Integer.parseInt(type, 16);
} catch (final RuntimeException re) {
LOGGER.error("Could not parse directory entry {}", name, re);
return new OutlookFieldInformation();
}
return new OutlookFieldInformation(clazz, mapiType);
} else {
LOGGER.trace("Ignoring entry with name {}", name);
}
// we are not interested in the field
// and return an empty OutlookFieldInformation object
return new OutlookFieldInformation();
} | [
"private",
"OutlookFieldInformation",
"analyzeDocumentEntry",
"(",
"final",
"DocumentEntry",
"de",
")",
"{",
"final",
"String",
"name",
"=",
"de",
".",
"getName",
"(",
")",
";",
"// we are only interested in document entries",
"// with names starting with __substg1.",
"LOGGER",
".",
"trace",
"(",
"\"Document entry: {}\"",
",",
"name",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"PROPERTY_STREAM_PREFIX",
")",
")",
"{",
"final",
"String",
"clazz",
";",
"final",
"String",
"type",
";",
"final",
"int",
"mapiType",
";",
"try",
"{",
"final",
"String",
"val",
"=",
"name",
".",
"substring",
"(",
"PROPERTY_STREAM_PREFIX",
".",
"length",
"(",
")",
")",
".",
"toLowerCase",
"(",
")",
";",
"// the first 4 digits of the remainder",
"// defines the field class (or field name)",
"// and the last 4 digits indicate the",
"// data type.",
"clazz",
"=",
"val",
".",
"substring",
"(",
"0",
",",
"4",
")",
";",
"type",
"=",
"val",
".",
"substring",
"(",
"4",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\" Found document entry: class={}, type={}\"",
",",
"clazz",
",",
"type",
")",
";",
"mapiType",
"=",
"Integer",
".",
"parseInt",
"(",
"type",
",",
"16",
")",
";",
"}",
"catch",
"(",
"final",
"RuntimeException",
"re",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Could not parse directory entry {}\"",
",",
"name",
",",
"re",
")",
";",
"return",
"new",
"OutlookFieldInformation",
"(",
")",
";",
"}",
"return",
"new",
"OutlookFieldInformation",
"(",
"clazz",
",",
"mapiType",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Ignoring entry with name {}\"",
",",
"name",
")",
";",
"}",
"// we are not interested in the field",
"// and return an empty OutlookFieldInformation object",
"return",
"new",
"OutlookFieldInformation",
"(",
")",
";",
"}"
] | Analyzes the {@link DocumentEntry} and returns
a {@link OutlookFieldInformation} object containing the
class (the field name, so to say) and type of
the entry.
@param de The {@link DocumentEntry} that should be examined.
@return A {@link OutlookFieldInformation} object containing class and type of the document entry or, if the entry is not an interesting field, an empty
{@link OutlookFieldInformation} object containing {@link OutlookFieldInformation#UNKNOWN} class and type. | [
"Analyzes",
"the",
"{",
"@link",
"DocumentEntry",
"}",
"and",
"returns",
"a",
"{",
"@link",
"OutlookFieldInformation",
"}",
"object",
"containing",
"the",
"class",
"(",
"the",
"field",
"name",
"so",
"to",
"say",
")",
"and",
"type",
"of",
"the",
"entry",
"."
] | train | https://github.com/bbottema/outlook-message-parser/blob/ea7d59da33c8a62dfc2e0aa64d2f8f7c903ccb0e/src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java#L520-L550 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/ObjectUtils.java | ObjectUtils.isCompatibleWithThrowsClause | public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) {
if (!isCheckedException(ex)) {
return true;
}
if (declaredExceptions != null) {
for (Class<?> declaredException : declaredExceptions) {
if (declaredException.isInstance(ex)) {
return true;
}
}
}
return false;
} | java | public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) {
if (!isCheckedException(ex)) {
return true;
}
if (declaredExceptions != null) {
for (Class<?> declaredException : declaredExceptions) {
if (declaredException.isInstance(ex)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"isCompatibleWithThrowsClause",
"(",
"Throwable",
"ex",
",",
"Class",
"<",
"?",
">",
"...",
"declaredExceptions",
")",
"{",
"if",
"(",
"!",
"isCheckedException",
"(",
"ex",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"declaredExceptions",
"!=",
"null",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"declaredException",
":",
"declaredExceptions",
")",
"{",
"if",
"(",
"declaredException",
".",
"isInstance",
"(",
"ex",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Check whether the given exception is compatible with the specified
exception types, as declared in a throws clause.
@param ex the exception to check
@param declaredExceptions the exception types declared in the throws clause
@return whether the given exception is compatible | [
"Check",
"whether",
"the",
"given",
"exception",
"is",
"compatible",
"with",
"the",
"specified",
"exception",
"types",
"as",
"declared",
"in",
"a",
"throws",
"clause",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ObjectUtils.java#L48-L60 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/AABBUtils.java | AABBUtils.writeToNBT | public static void writeToNBT(NBTTagCompound tag, AxisAlignedBB aabb, String prefix)
{
if (tag == null || aabb == null)
return;
prefix = prefix == null ? "" : prefix + ".";
tag.setDouble(prefix + "minX", aabb.minX);
tag.setDouble(prefix + "minY", aabb.minY);
tag.setDouble(prefix + "minZ", aabb.minZ);
tag.setDouble(prefix + "maxX", aabb.maxX);
tag.setDouble(prefix + "maxY", aabb.maxY);
tag.setDouble(prefix + "maxZ", aabb.maxZ);
} | java | public static void writeToNBT(NBTTagCompound tag, AxisAlignedBB aabb, String prefix)
{
if (tag == null || aabb == null)
return;
prefix = prefix == null ? "" : prefix + ".";
tag.setDouble(prefix + "minX", aabb.minX);
tag.setDouble(prefix + "minY", aabb.minY);
tag.setDouble(prefix + "minZ", aabb.minZ);
tag.setDouble(prefix + "maxX", aabb.maxX);
tag.setDouble(prefix + "maxY", aabb.maxY);
tag.setDouble(prefix + "maxZ", aabb.maxZ);
} | [
"public",
"static",
"void",
"writeToNBT",
"(",
"NBTTagCompound",
"tag",
",",
"AxisAlignedBB",
"aabb",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
"||",
"aabb",
"==",
"null",
")",
"return",
";",
"prefix",
"=",
"prefix",
"==",
"null",
"?",
"\"\"",
":",
"prefix",
"+",
"\".\"",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"minX\"",
",",
"aabb",
".",
"minX",
")",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"minY\"",
",",
"aabb",
".",
"minY",
")",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"minZ\"",
",",
"aabb",
".",
"minZ",
")",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"maxX\"",
",",
"aabb",
".",
"maxX",
")",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"maxY\"",
",",
"aabb",
".",
"maxY",
")",
";",
"tag",
".",
"setDouble",
"(",
"prefix",
"+",
"\"maxZ\"",
",",
"aabb",
".",
"maxZ",
")",
";",
"}"
] | Writes a {@link AxisAlignedBB} to a {@link NBTTagCompound} with the specified prefix.
@param tag the tag
@param aabb the aabb
@param prefix the prefix | [
"Writes",
"a",
"{",
"@link",
"AxisAlignedBB",
"}",
"to",
"a",
"{",
"@link",
"NBTTagCompound",
"}",
"with",
"the",
"specified",
"prefix",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/AABBUtils.java#L266-L278 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.lastIndexOf | public static int lastIndexOf(String str, char searchChar, int startPos) {
if (isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar, startPos);
} | java | public static int lastIndexOf(String str, char searchChar, int startPos) {
if (isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar, startPos);
} | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"String",
"str",
",",
"char",
"searchChar",
",",
"int",
"startPos",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"str",
".",
"lastIndexOf",
"(",
"searchChar",
",",
"startPos",
")",
";",
"}"
] | <p>Finds the last index within a String from a start position,
handling <code>null</code>.
This method uses {@link String#lastIndexOf(int, int)}.</p>
<p>A <code>null</code> or empty ("") String will return <code>-1</code>.
A negative start position returns <code>-1</code>.
A start position greater than the string length searches the whole string.</p>
<pre>
GosuStringUtil.lastIndexOf(null, *, *) = -1
GosuStringUtil.lastIndexOf("", *, *) = -1
GosuStringUtil.lastIndexOf("aabaabaa", 'b', 8) = 5
GosuStringUtil.lastIndexOf("aabaabaa", 'b', 4) = 2
GosuStringUtil.lastIndexOf("aabaabaa", 'b', 0) = -1
GosuStringUtil.lastIndexOf("aabaabaa", 'b', 9) = 5
GosuStringUtil.lastIndexOf("aabaabaa", 'b', -1) = -1
GosuStringUtil.lastIndexOf("aabaabaa", 'a', 0) = 0
</pre>
@param str the String to check, may be null
@param searchChar the character to find
@param startPos the start position
@return the last index of the search character,
-1 if no match or <code>null</code> string input
@since 2.0 | [
"<p",
">",
"Finds",
"the",
"last",
"index",
"within",
"a",
"String",
"from",
"a",
"start",
"position",
"handling",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"This",
"method",
"uses",
"{",
"@link",
"String#lastIndexOf",
"(",
"int",
"int",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L886-L891 |
alkacon/opencms-core | src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java | CmsContentTypeVisitor.readDefaultValue | private String readDefaultValue(I_CmsXmlSchemaType schemaType, String path) {
return m_contentHandler.getDefault(getCmsObject(), m_file, schemaType, path, m_locale);
} | java | private String readDefaultValue(I_CmsXmlSchemaType schemaType, String path) {
return m_contentHandler.getDefault(getCmsObject(), m_file, schemaType, path, m_locale);
} | [
"private",
"String",
"readDefaultValue",
"(",
"I_CmsXmlSchemaType",
"schemaType",
",",
"String",
"path",
")",
"{",
"return",
"m_contentHandler",
".",
"getDefault",
"(",
"getCmsObject",
"(",
")",
",",
"m_file",
",",
"schemaType",
",",
"path",
",",
"m_locale",
")",
";",
"}"
] | Reads the default value for the given type.<p>
@param schemaType the schema type
@param path the element path
@return the default value | [
"Reads",
"the",
"default",
"value",
"for",
"the",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java#L746-L749 |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.findMatchingLength | private static int findMatchingLength(ByteBuf in, int minIndex, int inIndex, int maxIndex) {
int matched = 0;
while (inIndex <= maxIndex - 4 &&
in.getInt(inIndex) == in.getInt(minIndex + matched)) {
inIndex += 4;
matched += 4;
}
while (inIndex < maxIndex && in.getByte(minIndex + matched) == in.getByte(inIndex)) {
++inIndex;
++matched;
}
return matched;
} | java | private static int findMatchingLength(ByteBuf in, int minIndex, int inIndex, int maxIndex) {
int matched = 0;
while (inIndex <= maxIndex - 4 &&
in.getInt(inIndex) == in.getInt(minIndex + matched)) {
inIndex += 4;
matched += 4;
}
while (inIndex < maxIndex && in.getByte(minIndex + matched) == in.getByte(inIndex)) {
++inIndex;
++matched;
}
return matched;
} | [
"private",
"static",
"int",
"findMatchingLength",
"(",
"ByteBuf",
"in",
",",
"int",
"minIndex",
",",
"int",
"inIndex",
",",
"int",
"maxIndex",
")",
"{",
"int",
"matched",
"=",
"0",
";",
"while",
"(",
"inIndex",
"<=",
"maxIndex",
"-",
"4",
"&&",
"in",
".",
"getInt",
"(",
"inIndex",
")",
"==",
"in",
".",
"getInt",
"(",
"minIndex",
"+",
"matched",
")",
")",
"{",
"inIndex",
"+=",
"4",
";",
"matched",
"+=",
"4",
";",
"}",
"while",
"(",
"inIndex",
"<",
"maxIndex",
"&&",
"in",
".",
"getByte",
"(",
"minIndex",
"+",
"matched",
")",
"==",
"in",
".",
"getByte",
"(",
"inIndex",
")",
")",
"{",
"++",
"inIndex",
";",
"++",
"matched",
";",
"}",
"return",
"matched",
";",
"}"
] | Iterates over the supplied input buffer between the supplied minIndex and
maxIndex to find how long our matched copy overlaps with an already-written
literal value.
@param in The input buffer to scan over
@param minIndex The index in the input buffer to start scanning from
@param inIndex The index of the start of our copy
@param maxIndex The length of our input buffer
@return The number of bytes for which our candidate copy is a repeat of | [
"Iterates",
"over",
"the",
"supplied",
"input",
"buffer",
"between",
"the",
"supplied",
"minIndex",
"and",
"maxIndex",
"to",
"find",
"how",
"long",
"our",
"matched",
"copy",
"overlaps",
"with",
"an",
"already",
"-",
"written",
"literal",
"value",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L179-L194 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/server/VanillaDb.java | VanillaDb.newPlanner | public static Planner newPlanner() {
QueryPlanner qplanner;
UpdatePlanner uplanner;
try {
qplanner = (QueryPlanner) queryPlannerCls.newInstance();
uplanner = (UpdatePlanner) updatePlannerCls.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
return null;
}
return new Planner(qplanner, uplanner);
} | java | public static Planner newPlanner() {
QueryPlanner qplanner;
UpdatePlanner uplanner;
try {
qplanner = (QueryPlanner) queryPlannerCls.newInstance();
uplanner = (UpdatePlanner) updatePlannerCls.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
return null;
}
return new Planner(qplanner, uplanner);
} | [
"public",
"static",
"Planner",
"newPlanner",
"(",
")",
"{",
"QueryPlanner",
"qplanner",
";",
"UpdatePlanner",
"uplanner",
";",
"try",
"{",
"qplanner",
"=",
"(",
"QueryPlanner",
")",
"queryPlannerCls",
".",
"newInstance",
"(",
")",
";",
"uplanner",
"=",
"(",
"UpdatePlanner",
")",
"updatePlannerCls",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"return",
"new",
"Planner",
"(",
"qplanner",
",",
"uplanner",
")",
";",
"}"
] | Creates a planner for SQL commands. To change how the planner works,
modify this method.
@return the system's planner for SQL commands | [
"Creates",
"a",
"planner",
"for",
"SQL",
"commands",
".",
"To",
"change",
"how",
"the",
"planner",
"works",
"modify",
"this",
"method",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/server/VanillaDb.java#L283-L296 |
vladmihalcea/db-util | src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java | SQLStatementCountValidator.assertDeleteCount | public static void assertDeleteCount(long expectedDeleteCount) {
QueryCount queryCount = QueryCountHolder.getGrandTotal();
long recordedDeleteCount = queryCount.getDelete();
if (expectedDeleteCount != recordedDeleteCount) {
throw new SQLDeleteCountMismatchException(expectedDeleteCount, recordedDeleteCount);
}
} | java | public static void assertDeleteCount(long expectedDeleteCount) {
QueryCount queryCount = QueryCountHolder.getGrandTotal();
long recordedDeleteCount = queryCount.getDelete();
if (expectedDeleteCount != recordedDeleteCount) {
throw new SQLDeleteCountMismatchException(expectedDeleteCount, recordedDeleteCount);
}
} | [
"public",
"static",
"void",
"assertDeleteCount",
"(",
"long",
"expectedDeleteCount",
")",
"{",
"QueryCount",
"queryCount",
"=",
"QueryCountHolder",
".",
"getGrandTotal",
"(",
")",
";",
"long",
"recordedDeleteCount",
"=",
"queryCount",
".",
"getDelete",
"(",
")",
";",
"if",
"(",
"expectedDeleteCount",
"!=",
"recordedDeleteCount",
")",
"{",
"throw",
"new",
"SQLDeleteCountMismatchException",
"(",
"expectedDeleteCount",
",",
"recordedDeleteCount",
")",
";",
"}",
"}"
] | Assert delete statement count
@param expectedDeleteCount expected delete statement count | [
"Assert",
"delete",
"statement",
"count"
] | train | https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L132-L138 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/parser/impl/AbstractParser.java | AbstractParser.getTransactionCounter | protected int getTransactionCounter() throws CommunicationException {
int ret = UNKNOW;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Get Transaction Counter ATC");
}
byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.GET_DATA, 0x9F, 0x36, 0).toBytes());
if (ResponseUtils.isSucceed(data)) {
// Extract ATC
byte[] val = TlvUtil.getValue(data, EmvTags.APP_TRANSACTION_COUNTER);
if (val != null) {
ret = BytesUtils.byteArrayToInt(val);
}
}
return ret;
} | java | protected int getTransactionCounter() throws CommunicationException {
int ret = UNKNOW;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Get Transaction Counter ATC");
}
byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.GET_DATA, 0x9F, 0x36, 0).toBytes());
if (ResponseUtils.isSucceed(data)) {
// Extract ATC
byte[] val = TlvUtil.getValue(data, EmvTags.APP_TRANSACTION_COUNTER);
if (val != null) {
ret = BytesUtils.byteArrayToInt(val);
}
}
return ret;
} | [
"protected",
"int",
"getTransactionCounter",
"(",
")",
"throws",
"CommunicationException",
"{",
"int",
"ret",
"=",
"UNKNOW",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Get Transaction Counter ATC\"",
")",
";",
"}",
"byte",
"[",
"]",
"data",
"=",
"template",
".",
"get",
"(",
")",
".",
"getProvider",
"(",
")",
".",
"transceive",
"(",
"new",
"CommandApdu",
"(",
"CommandEnum",
".",
"GET_DATA",
",",
"0x9F",
",",
"0x36",
",",
"0",
")",
".",
"toBytes",
"(",
")",
")",
";",
"if",
"(",
"ResponseUtils",
".",
"isSucceed",
"(",
"data",
")",
")",
"{",
"// Extract ATC",
"byte",
"[",
"]",
"val",
"=",
"TlvUtil",
".",
"getValue",
"(",
"data",
",",
"EmvTags",
".",
"APP_TRANSACTION_COUNTER",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"ret",
"=",
"BytesUtils",
".",
"byteArrayToInt",
"(",
"val",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Method used to get Transaction counter
@return the number of card transaction
@throws CommunicationException communication error | [
"Method",
"used",
"to",
"get",
"Transaction",
"counter"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/AbstractParser.java#L169-L183 |
betfair/cougar | cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinAnnotationsStore.java | ZipkinAnnotationsStore.addAnnotation | @Nonnull
public ZipkinAnnotationsStore addAnnotation(@Nonnull String key, @Nonnull String value) {
return addBinaryAnnotation(key, value, defaultEndpoint);
} | java | @Nonnull
public ZipkinAnnotationsStore addAnnotation(@Nonnull String key, @Nonnull String value) {
return addBinaryAnnotation(key, value, defaultEndpoint);
} | [
"@",
"Nonnull",
"public",
"ZipkinAnnotationsStore",
"addAnnotation",
"(",
"@",
"Nonnull",
"String",
"key",
",",
"@",
"Nonnull",
"String",
"value",
")",
"{",
"return",
"addBinaryAnnotation",
"(",
"key",
",",
"value",
",",
"defaultEndpoint",
")",
";",
"}"
] | Adds a (binary) string annotation for an event.
@param key The key of the annotation
@param value The value of the annotation
@return this object | [
"Adds",
"a",
"(",
"binary",
")",
"string",
"annotation",
"for",
"an",
"event",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinAnnotationsStore.java#L82-L85 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertThrows | public static <T> void assertThrows(String message, Class<? extends Exception> exceptionClass, Callable<T> callable) {
T result;
try {
result = callable.call();
fail(message, "No exception was thrown (expected " + exceptionClass.getSimpleName() + " but '" + result + "' was returned instead)");
} catch (Exception e) {
if (!e.getClass().equals(exceptionClass)) {
fail(message, e.getClass().getSimpleName() + " was thrown instead of " + exceptionClass.getSimpleName());
}
}
pass(message);
} | java | public static <T> void assertThrows(String message, Class<? extends Exception> exceptionClass, Callable<T> callable) {
T result;
try {
result = callable.call();
fail(message, "No exception was thrown (expected " + exceptionClass.getSimpleName() + " but '" + result + "' was returned instead)");
} catch (Exception e) {
if (!e.getClass().equals(exceptionClass)) {
fail(message, e.getClass().getSimpleName() + " was thrown instead of " + exceptionClass.getSimpleName());
}
}
pass(message);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertThrows",
"(",
"String",
"message",
",",
"Class",
"<",
"?",
"extends",
"Exception",
">",
"exceptionClass",
",",
"Callable",
"<",
"T",
">",
"callable",
")",
"{",
"T",
"result",
";",
"try",
"{",
"result",
"=",
"callable",
".",
"call",
"(",
")",
";",
"fail",
"(",
"message",
",",
"\"No exception was thrown (expected \"",
"+",
"exceptionClass",
".",
"getSimpleName",
"(",
")",
"+",
"\" but '\"",
"+",
"result",
"+",
"\"' was returned instead)\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"exceptionClass",
")",
")",
"{",
"fail",
"(",
"message",
",",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" was thrown instead of \"",
"+",
"exceptionClass",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"}",
"pass",
"(",
"message",
")",
";",
"}"
] | Assert that a given callable throws an exception of a particular class.
<p>
The assertion passes if the callable throws exactly the same class of exception (not a subclass).
<p>
If the callable doesn't throw an exception at all, or if another class of exception is thrown, the assertion
fails.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param exceptionClass the expected exception class
@param callable a Callable to invoke
@param <T> return type of the callable | [
"Assert",
"that",
"a",
"given",
"callable",
"throws",
"an",
"exception",
"of",
"a",
"particular",
"class",
".",
"<p",
">",
"The",
"assertion",
"passes",
"if",
"the",
"callable",
"throws",
"exactly",
"the",
"same",
"class",
"of",
"exception",
"(",
"not",
"a",
"subclass",
")",
".",
"<p",
">",
"If",
"the",
"callable",
"doesn",
"t",
"throw",
"an",
"exception",
"at",
"all",
"or",
"if",
"another",
"class",
"of",
"exception",
"is",
"thrown",
"the",
"assertion",
"fails",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L376-L388 |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java | ProjectTreeController.addTasks | private void addTasks(MpxjTreeNode parentNode, ChildTaskContainer parent)
{
for (Task task : parent.getChildTasks())
{
final Task t = task;
MpxjTreeNode childNode = new MpxjTreeNode(task, TASK_EXCLUDED_METHODS)
{
@Override public String toString()
{
return t.getName();
}
};
parentNode.add(childNode);
addTasks(childNode, task);
}
} | java | private void addTasks(MpxjTreeNode parentNode, ChildTaskContainer parent)
{
for (Task task : parent.getChildTasks())
{
final Task t = task;
MpxjTreeNode childNode = new MpxjTreeNode(task, TASK_EXCLUDED_METHODS)
{
@Override public String toString()
{
return t.getName();
}
};
parentNode.add(childNode);
addTasks(childNode, task);
}
} | [
"private",
"void",
"addTasks",
"(",
"MpxjTreeNode",
"parentNode",
",",
"ChildTaskContainer",
"parent",
")",
"{",
"for",
"(",
"Task",
"task",
":",
"parent",
".",
"getChildTasks",
"(",
")",
")",
"{",
"final",
"Task",
"t",
"=",
"task",
";",
"MpxjTreeNode",
"childNode",
"=",
"new",
"MpxjTreeNode",
"(",
"task",
",",
"TASK_EXCLUDED_METHODS",
")",
"{",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"t",
".",
"getName",
"(",
")",
";",
"}",
"}",
";",
"parentNode",
".",
"add",
"(",
"childNode",
")",
";",
"addTasks",
"(",
"childNode",
",",
"task",
")",
";",
"}",
"}"
] | Add tasks to the tree.
@param parentNode parent tree node
@param parent parent task container | [
"Add",
"tasks",
"to",
"the",
"tree",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L198-L213 |
google/j2objc | jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java | KXmlParser.pushContentSource | private void pushContentSource(char[] newBuffer) {
nextContentSource = new ContentSource(nextContentSource, buffer, position, limit);
buffer = newBuffer;
position = 0;
limit = newBuffer.length;
} | java | private void pushContentSource(char[] newBuffer) {
nextContentSource = new ContentSource(nextContentSource, buffer, position, limit);
buffer = newBuffer;
position = 0;
limit = newBuffer.length;
} | [
"private",
"void",
"pushContentSource",
"(",
"char",
"[",
"]",
"newBuffer",
")",
"{",
"nextContentSource",
"=",
"new",
"ContentSource",
"(",
"nextContentSource",
",",
"buffer",
",",
"position",
",",
"limit",
")",
";",
"buffer",
"=",
"newBuffer",
";",
"position",
"=",
"0",
";",
"limit",
"=",
"newBuffer",
".",
"length",
";",
"}"
] | Prepends the characters of {@code newBuffer} to be read before the
current buffer. | [
"Prepends",
"the",
"characters",
"of",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java#L2162-L2167 |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getReqOneNodeVal | public static String getReqOneNodeVal(final Node el, final String name)
throws SAXException {
String str = getOneNodeVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing property value: " + name);
}
return str;
} | java | public static String getReqOneNodeVal(final Node el, final String name)
throws SAXException {
String str = getOneNodeVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing property value: " + name);
}
return str;
} | [
"public",
"static",
"String",
"getReqOneNodeVal",
"(",
"final",
"Node",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"String",
"str",
"=",
"getOneNodeVal",
"(",
"el",
",",
"name",
")",
";",
"if",
"(",
"(",
"str",
"==",
"null",
")",
"||",
"(",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"throw",
"new",
"SAXException",
"(",
"\"Missing property value: \"",
"+",
"name",
")",
";",
"}",
"return",
"str",
";",
"}"
] | Get the value of an element. We expect 1 child node otherwise we raise an
exception.
@param el Node whose value we want
@param name String name to make exception messages more readable
@return String node value
@throws SAXException | [
"Get",
"the",
"value",
"of",
"an",
"element",
".",
"We",
"expect",
"1",
"child",
"node",
"otherwise",
"we",
"raise",
"an",
"exception",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L189-L198 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java | GroupService.findLockableGroup | public static ILockableEntityGroup findLockableGroup(String key, String lockOwner)
throws GroupsException {
LOGGER.trace("Invoking findLockableGroup for key='{}', lockOwner='{}'", key, lockOwner);
return instance().ifindLockableGroup(key, lockOwner);
} | java | public static ILockableEntityGroup findLockableGroup(String key, String lockOwner)
throws GroupsException {
LOGGER.trace("Invoking findLockableGroup for key='{}', lockOwner='{}'", key, lockOwner);
return instance().ifindLockableGroup(key, lockOwner);
} | [
"public",
"static",
"ILockableEntityGroup",
"findLockableGroup",
"(",
"String",
"key",
",",
"String",
"lockOwner",
")",
"throws",
"GroupsException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Invoking findLockableGroup for key='{}', lockOwner='{}'\"",
",",
"key",
",",
"lockOwner",
")",
";",
"return",
"instance",
"(",
")",
".",
"ifindLockableGroup",
"(",
"key",
",",
"lockOwner",
")",
";",
"}"
] | Returns a pre-existing <code>ILockableEntityGroup</code> or null if the group is not found.
@param key String - the group key.
@param lockOwner String - the owner of the lock, typically the user.
@return org.apereo.portal.groups.ILockableEntityGroup | [
"Returns",
"a",
"pre",
"-",
"existing",
"<code",
">",
"ILockableEntityGroup<",
"/",
"code",
">",
"or",
"null",
"if",
"the",
"group",
"is",
"not",
"found",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java#L91-L95 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java | UTF8ByteArrayUtils.findNthByte | public static int findNthByte(byte [] utf, int start, int length, byte b, int n) {
int pos = -1;
int nextStart = start;
for (int i = 0; i < n; i++) {
pos = findByte(utf, nextStart, length, b);
if (pos < 0) {
return pos;
}
nextStart = pos + 1;
}
return pos;
} | java | public static int findNthByte(byte [] utf, int start, int length, byte b, int n) {
int pos = -1;
int nextStart = start;
for (int i = 0; i < n; i++) {
pos = findByte(utf, nextStart, length, b);
if (pos < 0) {
return pos;
}
nextStart = pos + 1;
}
return pos;
} | [
"public",
"static",
"int",
"findNthByte",
"(",
"byte",
"[",
"]",
"utf",
",",
"int",
"start",
",",
"int",
"length",
",",
"byte",
"b",
",",
"int",
"n",
")",
"{",
"int",
"pos",
"=",
"-",
"1",
";",
"int",
"nextStart",
"=",
"start",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"pos",
"=",
"findByte",
"(",
"utf",
",",
"nextStart",
",",
"length",
",",
"b",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"pos",
";",
"}",
"nextStart",
"=",
"pos",
"+",
"1",
";",
"}",
"return",
"pos",
";",
"}"
] | Find the nth occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param length the length of byte array
@param b the byte to find
@param n the desired occurrence of the given byte
@return position that nth occurrence of the given byte if exists; otherwise -1 | [
"Find",
"the",
"nth",
"occurrence",
"of",
"the",
"given",
"byte",
"b",
"in",
"a",
"UTF",
"-",
"8",
"encoded",
"string"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java#L73-L84 |
datasift/datasift-java | src/main/java/com/datasift/client/managedsource/sources/Yammer.java | Yammer.addOAutToken | public Yammer addOAutToken(String oAuthAccessToken, long expires, String name) {
if (oAuthAccessToken == null || oAuthAccessToken.isEmpty()) {
throw new IllegalArgumentException("A valid OAuth and refresh token is required");
}
AuthParams parameterSet = newAuthParams(name, expires);
parameterSet.set("value", oAuthAccessToken);
return this;
} | java | public Yammer addOAutToken(String oAuthAccessToken, long expires, String name) {
if (oAuthAccessToken == null || oAuthAccessToken.isEmpty()) {
throw new IllegalArgumentException("A valid OAuth and refresh token is required");
}
AuthParams parameterSet = newAuthParams(name, expires);
parameterSet.set("value", oAuthAccessToken);
return this;
} | [
"public",
"Yammer",
"addOAutToken",
"(",
"String",
"oAuthAccessToken",
",",
"long",
"expires",
",",
"String",
"name",
")",
"{",
"if",
"(",
"oAuthAccessToken",
"==",
"null",
"||",
"oAuthAccessToken",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A valid OAuth and refresh token is required\"",
")",
";",
"}",
"AuthParams",
"parameterSet",
"=",
"newAuthParams",
"(",
"name",
",",
"expires",
")",
";",
"parameterSet",
".",
"set",
"(",
"\"value\"",
",",
"oAuthAccessToken",
")",
";",
"return",
"this",
";",
"}"
] | /*
Adds an OAuth token to the managed source
@param oAuthAccessToken an oauth2 token
@param name a human friendly name for this auth token
@param expires identity resource expiry date/time as a UTC timestamp, i.e. when the token expires
@return this | [
"/",
"*",
"Adds",
"an",
"OAuth",
"token",
"to",
"the",
"managed",
"source"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/managedsource/sources/Yammer.java#L31-L38 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllClassDefinitions | public void forAllClassDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _model.getClasses(); it.hasNext(); )
{
_curClassDef = (ClassDescriptorDef)it.next();
generate(template);
}
_curClassDef = null;
LogHelper.debug(true, OjbTagsHandler.class, "forAllClassDefinitions", "Processed "+_model.getNumClasses()+" types");
} | java | public void forAllClassDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _model.getClasses(); it.hasNext(); )
{
_curClassDef = (ClassDescriptorDef)it.next();
generate(template);
}
_curClassDef = null;
LogHelper.debug(true, OjbTagsHandler.class, "forAllClassDefinitions", "Processed "+_model.getNumClasses()+" types");
} | [
"public",
"void",
"forAllClassDefinitions",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_model",
".",
"getClasses",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"_curClassDef",
"=",
"(",
"ClassDescriptorDef",
")",
"it",
".",
"next",
"(",
")",
";",
"generate",
"(",
"template",
")",
";",
"}",
"_curClassDef",
"=",
"null",
";",
"LogHelper",
".",
"debug",
"(",
"true",
",",
"OjbTagsHandler",
".",
"class",
",",
"\"forAllClassDefinitions\"",
",",
"\"Processed \"",
"+",
"_model",
".",
"getNumClasses",
"(",
")",
"+",
"\" types\"",
")",
";",
"}"
] | Processes the template for all class definitions.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"class",
"definitions",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L172-L182 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.toHashMap | public static Map<String, List<String>> toHashMap(final String aFilePath) throws FileNotFoundException {
return toHashMap(aFilePath, null, (String[]) null);
} | java | public static Map<String, List<String>> toHashMap(final String aFilePath) throws FileNotFoundException {
return toHashMap(aFilePath, null, (String[]) null);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"toHashMap",
"(",
"final",
"String",
"aFilePath",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"toHashMap",
"(",
"aFilePath",
",",
"null",
",",
"(",
"String",
"[",
"]",
")",
"null",
")",
";",
"}"
] | Returns a Map representation of the supplied directory's structure. The map contains the file name as the key
and its path as the value. If a file with a name occurs more than once, multiple path values are returned for
that file name key. The map that is returned is unmodifiable.
@param aFilePath The directory of which you'd like a file listing
@return An unmodifiable map representing the files in the file structure
@throws FileNotFoundException If the directory for the supplied file path does not exist | [
"Returns",
"a",
"Map",
"representation",
"of",
"the",
"supplied",
"directory",
"s",
"structure",
".",
"The",
"map",
"contains",
"the",
"file",
"name",
"as",
"the",
"key",
"and",
"its",
"path",
"as",
"the",
"value",
".",
"If",
"a",
"file",
"with",
"a",
"name",
"occurs",
"more",
"than",
"once",
"multiple",
"path",
"values",
"are",
"returned",
"for",
"that",
"file",
"name",
"key",
".",
"The",
"map",
"that",
"is",
"returned",
"is",
"unmodifiable",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L183-L185 |
amaembo/streamex | src/main/java/one/util/streamex/MoreCollectors.java | MoreCollectors.maxAll | public static <T> Collector<T, ?, List<T>> maxAll(Comparator<? super T> comparator) {
return maxAll(comparator, Collectors.toList());
} | java | public static <T> Collector<T, ?, List<T>> maxAll(Comparator<? super T> comparator) {
return maxAll(comparator, Collectors.toList());
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"List",
"<",
"T",
">",
">",
"maxAll",
"(",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"maxAll",
"(",
"comparator",
",",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] | Returns a {@code Collector} which finds all the elements which are equal
to each other and bigger than any other element according to the
specified {@link Comparator}. The found elements are collected to
{@link List}.
@param <T> the type of the input elements
@param comparator a {@code Comparator} to compare the elements
@return a {@code Collector} which finds all the maximal elements and
collects them to the {@code List}.
@see #maxAll(Comparator, Collector)
@see #maxAll() | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"which",
"finds",
"all",
"the",
"elements",
"which",
"are",
"equal",
"to",
"each",
"other",
"and",
"bigger",
"than",
"any",
"other",
"element",
"according",
"to",
"the",
"specified",
"{",
"@link",
"Comparator",
"}",
".",
"The",
"found",
"elements",
"are",
"collected",
"to",
"{",
"@link",
"List",
"}",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/MoreCollectors.java#L381-L383 |
integration-technology/amazon-mws-orders | src/main/java/com/amazonservices/mws/client/MwsUtl.java | MwsUtl.urlEncode | protected static String urlEncode(String value, boolean path) {
try {
value = URLEncoder.encode(value, DEFAULT_ENCODING);
} catch (Exception e) {
throw wrap(e);
}
value = replaceAll(value, plusPtn, "%20");
value = replaceAll(value, asteriskPtn, "%2A");
value = replaceAll(value, pct7EPtn, "~");
if (path) {
value = replaceAll(value, pct2FPtn, "/");
}
return value;
} | java | protected static String urlEncode(String value, boolean path) {
try {
value = URLEncoder.encode(value, DEFAULT_ENCODING);
} catch (Exception e) {
throw wrap(e);
}
value = replaceAll(value, plusPtn, "%20");
value = replaceAll(value, asteriskPtn, "%2A");
value = replaceAll(value, pct7EPtn, "~");
if (path) {
value = replaceAll(value, pct2FPtn, "/");
}
return value;
} | [
"protected",
"static",
"String",
"urlEncode",
"(",
"String",
"value",
",",
"boolean",
"path",
")",
"{",
"try",
"{",
"value",
"=",
"URLEncoder",
".",
"encode",
"(",
"value",
",",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"wrap",
"(",
"e",
")",
";",
"}",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"plusPtn",
",",
"\"%20\"",
")",
";",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"asteriskPtn",
",",
"\"%2A\"",
")",
";",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"pct7EPtn",
",",
"\"~\"",
")",
";",
"if",
"(",
"path",
")",
"{",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"pct2FPtn",
",",
"\"/\"",
")",
";",
"}",
"return",
"value",
";",
"}"
] | URL encode a value.
@param value
@param path
true if is a path and '/' should not be encoded.
@return The encoded string. | [
"URL",
"encode",
"a",
"value",
"."
] | train | https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L282-L295 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java | Feature.setDateAttribute | public void setDateAttribute(String name, Date value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof DateAttribute)) {
throw new IllegalStateException("Cannot set date value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((DateAttribute) attribute).setValue(value);
} | java | public void setDateAttribute(String name, Date value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof DateAttribute)) {
throw new IllegalStateException("Cannot set date value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((DateAttribute) attribute).setValue(value);
} | [
"public",
"void",
"setDateAttribute",
"(",
"String",
"name",
",",
"Date",
"value",
")",
"{",
"Attribute",
"attribute",
"=",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"attribute",
"instanceof",
"DateAttribute",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set date value on attribute with different type, \"",
"+",
"attribute",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" setting value \"",
"+",
"value",
")",
";",
"}",
"(",
"(",
"DateAttribute",
")",
"attribute",
")",
".",
"setValue",
"(",
"value",
")",
";",
"}"
] | Set attribute value of given type.
@param name attribute name
@param value attribute value | [
"Set",
"attribute",
"value",
"of",
"given",
"type",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L245-L252 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java | ST_RemoveRepeatedPoints.removeDuplicateCoordinates | public static MultiLineString removeDuplicateCoordinates(MultiLineString multiLineString, double tolerance) throws SQLException {
ArrayList<LineString> lines = new ArrayList<LineString>();
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
LineString line = (LineString) multiLineString.getGeometryN(i);
lines.add(removeDuplicateCoordinates(line, tolerance));
}
return FACTORY.createMultiLineString(GeometryFactory.toLineStringArray(lines));
} | java | public static MultiLineString removeDuplicateCoordinates(MultiLineString multiLineString, double tolerance) throws SQLException {
ArrayList<LineString> lines = new ArrayList<LineString>();
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
LineString line = (LineString) multiLineString.getGeometryN(i);
lines.add(removeDuplicateCoordinates(line, tolerance));
}
return FACTORY.createMultiLineString(GeometryFactory.toLineStringArray(lines));
} | [
"public",
"static",
"MultiLineString",
"removeDuplicateCoordinates",
"(",
"MultiLineString",
"multiLineString",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"ArrayList",
"<",
"LineString",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"LineString",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"multiLineString",
".",
"getNumGeometries",
"(",
")",
";",
"i",
"++",
")",
"{",
"LineString",
"line",
"=",
"(",
"LineString",
")",
"multiLineString",
".",
"getGeometryN",
"(",
"i",
")",
";",
"lines",
".",
"add",
"(",
"removeDuplicateCoordinates",
"(",
"line",
",",
"tolerance",
")",
")",
";",
"}",
"return",
"FACTORY",
".",
"createMultiLineString",
"(",
"GeometryFactory",
".",
"toLineStringArray",
"(",
"lines",
")",
")",
";",
"}"
] | Removes duplicated coordinates in a MultiLineString.
@param multiLineString
@param tolerance to delete the coordinates
@return | [
"Removes",
"duplicated",
"coordinates",
"in",
"a",
"MultiLineString",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java#L140-L147 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Assert.java | Assert.hasLength | public static void hasLength(String text, String message) {
if (!Strings.hasLength(text)) {
throw new IllegalArgumentException(message);
}
} | java | public static void hasLength(String text, String message) {
if (!Strings.hasLength(text)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"hasLength",
"(",
"String",
"text",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"hasLength",
"(",
"text",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] | Assert that the given String is not empty; that is,
it must not be <code>null</code> and not the empty String.
<pre class="code">Assert.hasLength(name, "Name must not be empty");</pre>
@param text the String to check
@param message the exception message to use if the assertion fails
@see Strings#hasLength | [
"Assert",
"that",
"the",
"given",
"String",
"is",
"not",
"empty",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"not",
"the",
"empty",
"String",
".",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
"hasLength",
"(",
"name",
"Name",
"must",
"not",
"be",
"empty",
")",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L104-L108 |
stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java | SpiceServiceListenerNotifier.notifyObserversOfRequestProcessed | public void notifyObserversOfRequestProcessed(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) {
RequestProcessingContext requestProcessingContext = new RequestProcessingContext();
requestProcessingContext.setExecutionThread(Thread.currentThread());
requestProcessingContext.setRequestListeners(requestListeners);
post(new RequestProcessedNotifier(request, spiceServiceListenerList, requestProcessingContext));
} | java | public void notifyObserversOfRequestProcessed(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) {
RequestProcessingContext requestProcessingContext = new RequestProcessingContext();
requestProcessingContext.setExecutionThread(Thread.currentThread());
requestProcessingContext.setRequestListeners(requestListeners);
post(new RequestProcessedNotifier(request, spiceServiceListenerList, requestProcessingContext));
} | [
"public",
"void",
"notifyObserversOfRequestProcessed",
"(",
"CachedSpiceRequest",
"<",
"?",
">",
"request",
",",
"Set",
"<",
"RequestListener",
"<",
"?",
">",
">",
"requestListeners",
")",
"{",
"RequestProcessingContext",
"requestProcessingContext",
"=",
"new",
"RequestProcessingContext",
"(",
")",
";",
"requestProcessingContext",
".",
"setExecutionThread",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"requestProcessingContext",
".",
"setRequestListeners",
"(",
"requestListeners",
")",
";",
"post",
"(",
"new",
"RequestProcessedNotifier",
"(",
"request",
",",
"spiceServiceListenerList",
",",
"requestProcessingContext",
")",
")",
";",
"}"
] | Notify interested observers of request completion.
@param request the request that has completed.
@param requestListeners the listeners to notify. | [
"Notify",
"interested",
"observers",
"of",
"request",
"completion",
"."
] | train | https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L134-L139 |
mkolisnyk/cucumber-reports | cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java | LazyAssert.assertArrayEquals | public static void assertArrayEquals(String message, double[] expecteds,
double[] actuals, double delta) throws ArrayComparisonFailure {
try {
new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
} catch (AssertionError e) {
throw new LazyAssertionError(message, e);
}
} | java | public static void assertArrayEquals(String message, double[] expecteds,
double[] actuals, double delta) throws ArrayComparisonFailure {
try {
new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
} catch (AssertionError e) {
throw new LazyAssertionError(message, e);
}
} | [
"public",
"static",
"void",
"assertArrayEquals",
"(",
"String",
"message",
",",
"double",
"[",
"]",
"expecteds",
",",
"double",
"[",
"]",
"actuals",
",",
"double",
"delta",
")",
"throws",
"ArrayComparisonFailure",
"{",
"try",
"{",
"new",
"InexactComparisonCriteria",
"(",
"delta",
")",
".",
"arrayEquals",
"(",
"message",
",",
"expecteds",
",",
"actuals",
")",
";",
"}",
"catch",
"(",
"AssertionError",
"e",
")",
"{",
"throw",
"new",
"LazyAssertionError",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Asserts that two double arrays are equal. If they are not, an
{@link LazyAssertionError} is thrown with the given message.
@param message the identifying message for the {@link LazyAssertionError} (<code>null</code>
okay)
@param expecteds double array with expected values.
@param actuals double array with actual values
@param delta the maximum delta between <code>expecteds[i]</code> and
<code>actuals[i]</code> for which both numbers are still
considered equal. | [
"Asserts",
"that",
"two",
"double",
"arrays",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"an",
"{",
"@link",
"LazyAssertionError",
"}",
"is",
"thrown",
"with",
"the",
"given",
"message",
"."
] | train | https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java#L473-L480 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_login_login_DELETE | public void zone_zoneName_dynHost_login_login_DELETE(String zoneName, String login) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}";
StringBuilder sb = path(qPath, zoneName, login);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void zone_zoneName_dynHost_login_login_DELETE(String zoneName, String login) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}";
StringBuilder sb = path(qPath, zoneName, login);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"zone_zoneName_dynHost_login_login_DELETE",
"(",
"String",
"zoneName",
",",
"String",
"login",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/login/{login}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"zoneName",
",",
"login",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Delete a DynHost login
REST: DELETE /domain/zone/{zoneName}/dynHost/login/{login}
@param zoneName [required] The internal name of your zone
@param login [required] Login | [
"Delete",
"a",
"DynHost",
"login"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L466-L470 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolderQuota_GET | public OvhPublicFolderQuota organizationName_service_exchangeService_publicFolderQuota_GET(String organizationName, String exchangeService) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota";
StringBuilder sb = path(qPath, organizationName, exchangeService);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPublicFolderQuota.class);
} | java | public OvhPublicFolderQuota organizationName_service_exchangeService_publicFolderQuota_GET(String organizationName, String exchangeService) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota";
StringBuilder sb = path(qPath, organizationName, exchangeService);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPublicFolderQuota.class);
} | [
"public",
"OvhPublicFolderQuota",
"organizationName_service_exchangeService_publicFolderQuota_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPublicFolderQuota",
".",
"class",
")",
";",
"}"
] | Get public folder quota usage in total available space
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Get",
"public",
"folder",
"quota",
"usage",
"in",
"total",
"available",
"space"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L364-L369 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java | IteratorExtensions.forEach | public static <T> void forEach(Iterator<T> iterator, Procedure1<? super T> procedure) {
if (procedure == null)
throw new NullPointerException("procedure");
while(iterator.hasNext()) {
procedure.apply(iterator.next());
}
} | java | public static <T> void forEach(Iterator<T> iterator, Procedure1<? super T> procedure) {
if (procedure == null)
throw new NullPointerException("procedure");
while(iterator.hasNext()) {
procedure.apply(iterator.next());
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forEach",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
",",
"Procedure1",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
"if",
"(",
"procedure",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"procedure\"",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"procedure",
".",
"apply",
"(",
"iterator",
".",
"next",
"(",
")",
")",
";",
"}",
"}"
] | Applies {@code procedure} for each element of the given iterator.
@param iterator
the iterator. May not be <code>null</code>.
@param procedure
the procedure. May not be <code>null</code>. | [
"Applies",
"{",
"@code",
"procedure",
"}",
"for",
"each",
"element",
"of",
"the",
"given",
"iterator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L422-L428 |
mongodb/stitch-android-sdk | core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchError.java | StitchError.handleRichError | private static String handleRichError(final Response response, final String body) {
if (!response.getHeaders().containsKey(Headers.CONTENT_TYPE)
|| !response.getHeaders().get(Headers.CONTENT_TYPE).equals(ContentTypes.APPLICATION_JSON)) {
return body;
}
final Document doc;
try {
doc = BsonUtils.parseValue(body, Document.class);
} catch (Exception e) {
return body;
}
if (!doc.containsKey(Fields.ERROR)) {
return body;
}
final String errorMsg = doc.getString(Fields.ERROR);
if (!doc.containsKey(Fields.ERROR_CODE)) {
return errorMsg;
}
final String errorCode = doc.getString(Fields.ERROR_CODE);
throw new StitchServiceException(errorMsg, StitchServiceErrorCode.fromCodeName(errorCode));
} | java | private static String handleRichError(final Response response, final String body) {
if (!response.getHeaders().containsKey(Headers.CONTENT_TYPE)
|| !response.getHeaders().get(Headers.CONTENT_TYPE).equals(ContentTypes.APPLICATION_JSON)) {
return body;
}
final Document doc;
try {
doc = BsonUtils.parseValue(body, Document.class);
} catch (Exception e) {
return body;
}
if (!doc.containsKey(Fields.ERROR)) {
return body;
}
final String errorMsg = doc.getString(Fields.ERROR);
if (!doc.containsKey(Fields.ERROR_CODE)) {
return errorMsg;
}
final String errorCode = doc.getString(Fields.ERROR_CODE);
throw new StitchServiceException(errorMsg, StitchServiceErrorCode.fromCodeName(errorCode));
} | [
"private",
"static",
"String",
"handleRichError",
"(",
"final",
"Response",
"response",
",",
"final",
"String",
"body",
")",
"{",
"if",
"(",
"!",
"response",
".",
"getHeaders",
"(",
")",
".",
"containsKey",
"(",
"Headers",
".",
"CONTENT_TYPE",
")",
"||",
"!",
"response",
".",
"getHeaders",
"(",
")",
".",
"get",
"(",
"Headers",
".",
"CONTENT_TYPE",
")",
".",
"equals",
"(",
"ContentTypes",
".",
"APPLICATION_JSON",
")",
")",
"{",
"return",
"body",
";",
"}",
"final",
"Document",
"doc",
";",
"try",
"{",
"doc",
"=",
"BsonUtils",
".",
"parseValue",
"(",
"body",
",",
"Document",
".",
"class",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"body",
";",
"}",
"if",
"(",
"!",
"doc",
".",
"containsKey",
"(",
"Fields",
".",
"ERROR",
")",
")",
"{",
"return",
"body",
";",
"}",
"final",
"String",
"errorMsg",
"=",
"doc",
".",
"getString",
"(",
"Fields",
".",
"ERROR",
")",
";",
"if",
"(",
"!",
"doc",
".",
"containsKey",
"(",
"Fields",
".",
"ERROR_CODE",
")",
")",
"{",
"return",
"errorMsg",
";",
"}",
"final",
"String",
"errorCode",
"=",
"doc",
".",
"getString",
"(",
"Fields",
".",
"ERROR_CODE",
")",
";",
"throw",
"new",
"StitchServiceException",
"(",
"errorMsg",
",",
"StitchServiceErrorCode",
".",
"fromCodeName",
"(",
"errorCode",
")",
")",
";",
"}"
] | Private helper method which decodes the Stitch error from the body of an HTTP `Response`
object. If the error is successfully decoded, this function will throw the error for the end
user to eventually consume. If the error cannot be decoded, this is likely not an error from
the Stitch server, and this function will return an error message that the calling function
should use as the message of a StitchServiceException with an unknown code. | [
"Private",
"helper",
"method",
"which",
"decodes",
"the",
"Stitch",
"error",
"from",
"the",
"body",
"of",
"an",
"HTTP",
"Response",
"object",
".",
"If",
"the",
"error",
"is",
"successfully",
"decoded",
"this",
"function",
"will",
"throw",
"the",
"error",
"for",
"the",
"end",
"user",
"to",
"eventually",
"consume",
".",
"If",
"the",
"error",
"cannot",
"be",
"decoded",
"this",
"is",
"likely",
"not",
"an",
"error",
"from",
"the",
"Stitch",
"server",
"and",
"this",
"function",
"will",
"return",
"an",
"error",
"message",
"that",
"the",
"calling",
"function",
"should",
"use",
"as",
"the",
"message",
"of",
"a",
"StitchServiceException",
"with",
"an",
"unknown",
"code",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchError.java#L72-L95 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.editMessageCaption | public Message editMessageCaption(Message oldMessage, String caption, InlineReplyMarkup inlineReplyMarkup) {
return this.editMessageCaption(oldMessage.getChat().getId(), oldMessage.getMessageId(), caption, inlineReplyMarkup);
} | java | public Message editMessageCaption(Message oldMessage, String caption, InlineReplyMarkup inlineReplyMarkup) {
return this.editMessageCaption(oldMessage.getChat().getId(), oldMessage.getMessageId(), caption, inlineReplyMarkup);
} | [
"public",
"Message",
"editMessageCaption",
"(",
"Message",
"oldMessage",
",",
"String",
"caption",
",",
"InlineReplyMarkup",
"inlineReplyMarkup",
")",
"{",
"return",
"this",
".",
"editMessageCaption",
"(",
"oldMessage",
".",
"getChat",
"(",
")",
".",
"getId",
"(",
")",
",",
"oldMessage",
".",
"getMessageId",
"(",
")",
",",
"caption",
",",
"inlineReplyMarkup",
")",
";",
"}"
] | This allows you to edit the caption of any captionable message you have sent previously
@param oldMessage The Message object that represents the message you want to edit
@param caption The new caption you want to display
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return A new Message object representing the edited message | [
"This",
"allows",
"you",
"to",
"edit",
"the",
"caption",
"of",
"any",
"captionable",
"message",
"you",
"have",
"sent",
"previously"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L759-L762 |
unbescape/unbescape | src/main/java/org/unbescape/html/HtmlEscape.java | HtmlEscape.escapeHtml4 | public static void escapeHtml4(final String text, final Writer writer)
throws IOException {
escapeHtml(text, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | java | public static void escapeHtml4(final String text, final Writer writer)
throws IOException {
escapeHtml(text, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeHtml4",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeHtml",
"(",
"text",
",",
"writer",
",",
"HtmlEscapeType",
".",
"HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL",
",",
"HtmlEscapeLevel",
".",
"LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT",
")",
";",
"}"
] | <p>
Perform an HTML 4 level 2 (result is ASCII) <strong>escape</strong> operation on a <tt>String</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The five markup-significant characters: <tt><</tt>, <tt>></tt>, <tt>&</tt>,
<tt>"</tt> and <tt>'</tt></li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by replacing those chars by the corresponding HTML 4 Named Character References
(e.g. <tt>'&acute;'</tt>) when such NCR exists for the replaced character, and replacing by a decimal
character reference (e.g. <tt>'&#8345;'</tt>) when there there is no NCR for the replaced character.
</p>
<p>
This method calls {@link #escapeHtml(String, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li>
<li><tt>level</tt>:
{@link org.unbescape.html.HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"HTML",
"4",
"level",
"2",
"(",
"result",
"is",
"ASCII",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<em",
">",
"Level",
"2<",
"/",
"em",
">",
"means",
"this",
"method",
"will",
"escape",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"The",
"five",
"markup",
"-",
"significant",
"characters",
":",
"<tt",
">",
"<",
";",
"<",
"/",
"tt",
">",
"<tt",
">",
">",
";",
"<",
"/",
"tt",
">",
"<tt",
">",
"&",
";",
"<",
"/",
"tt",
">",
"<tt",
">",
""",
";",
"<",
"/",
"tt",
">",
"and",
"<tt",
">",
"'",
";",
"<",
"/",
"tt",
">",
"<",
"/",
"li",
">",
"<li",
">",
"All",
"non",
"ASCII",
"characters",
".",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<p",
">",
"This",
"escape",
"will",
"be",
"performed",
"by",
"replacing",
"those",
"chars",
"by",
"the",
"corresponding",
"HTML",
"4",
"Named",
"Character",
"References",
"(",
"e",
".",
"g",
".",
"<tt",
">",
"&",
";",
"acute",
";",
"<",
"/",
"tt",
">",
")",
"when",
"such",
"NCR",
"exists",
"for",
"the",
"replaced",
"character",
"and",
"replacing",
"by",
"a",
"decimal",
"character",
"reference",
"(",
"e",
".",
"g",
".",
"<tt",
">",
"&",
";",
"#8345",
";",
"<",
"/",
"tt",
">",
")",
"when",
"there",
"there",
"is",
"no",
"NCR",
"for",
"the",
"replaced",
"character",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"calls",
"{",
"@link",
"#escapeHtml",
"(",
"String",
"Writer",
"HtmlEscapeType",
"HtmlEscapeLevel",
")",
"}",
"with",
"the",
"following",
"preconfigured",
"values",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<tt",
">",
"type<",
"/",
"tt",
">",
":",
"{",
"@link",
"org",
".",
"unbescape",
".",
"html",
".",
"HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"<tt",
">",
"level<",
"/",
"tt",
">",
":",
"{",
"@link",
"org",
".",
"unbescape",
".",
"html",
".",
"HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT",
"}",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<p",
">",
"This",
"method",
"is",
"<strong",
">",
"thread",
"-",
"safe<",
"/",
"strong",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L495-L499 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java | AbstractQueryProtocol.executeBatchRewrite | private void executeBatchRewrite(Results results,
final ClientPrepareResult prepareResult, List<ParameterHolder[]> parameterList,
boolean rewriteValues) throws SQLException {
cmdPrologue();
ParameterHolder[] parameters;
int currentIndex = 0;
int totalParameterList = parameterList.size();
try {
do {
currentIndex = ComQuery.sendRewriteCmd(writer, prepareResult.getQueryParts(), currentIndex,
prepareResult.getParamCount(), parameterList, rewriteValues);
getResult(results);
if (Thread.currentThread().isInterrupted()) {
throw new SQLException("Interrupted during batch", INTERRUPTED_EXCEPTION.getSqlState(),
-1);
}
} while (currentIndex < totalParameterList);
} catch (SQLException sqlEx) {
throw logQuery.exceptionWithQuery(sqlEx, prepareResult);
} catch (IOException e) {
throw handleIoException(e);
} finally {
results.setRewritten(rewriteValues);
}
} | java | private void executeBatchRewrite(Results results,
final ClientPrepareResult prepareResult, List<ParameterHolder[]> parameterList,
boolean rewriteValues) throws SQLException {
cmdPrologue();
ParameterHolder[] parameters;
int currentIndex = 0;
int totalParameterList = parameterList.size();
try {
do {
currentIndex = ComQuery.sendRewriteCmd(writer, prepareResult.getQueryParts(), currentIndex,
prepareResult.getParamCount(), parameterList, rewriteValues);
getResult(results);
if (Thread.currentThread().isInterrupted()) {
throw new SQLException("Interrupted during batch", INTERRUPTED_EXCEPTION.getSqlState(),
-1);
}
} while (currentIndex < totalParameterList);
} catch (SQLException sqlEx) {
throw logQuery.exceptionWithQuery(sqlEx, prepareResult);
} catch (IOException e) {
throw handleIoException(e);
} finally {
results.setRewritten(rewriteValues);
}
} | [
"private",
"void",
"executeBatchRewrite",
"(",
"Results",
"results",
",",
"final",
"ClientPrepareResult",
"prepareResult",
",",
"List",
"<",
"ParameterHolder",
"[",
"]",
">",
"parameterList",
",",
"boolean",
"rewriteValues",
")",
"throws",
"SQLException",
"{",
"cmdPrologue",
"(",
")",
";",
"ParameterHolder",
"[",
"]",
"parameters",
";",
"int",
"currentIndex",
"=",
"0",
";",
"int",
"totalParameterList",
"=",
"parameterList",
".",
"size",
"(",
")",
";",
"try",
"{",
"do",
"{",
"currentIndex",
"=",
"ComQuery",
".",
"sendRewriteCmd",
"(",
"writer",
",",
"prepareResult",
".",
"getQueryParts",
"(",
")",
",",
"currentIndex",
",",
"prepareResult",
".",
"getParamCount",
"(",
")",
",",
"parameterList",
",",
"rewriteValues",
")",
";",
"getResult",
"(",
"results",
")",
";",
"if",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"isInterrupted",
"(",
")",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"Interrupted during batch\"",
",",
"INTERRUPTED_EXCEPTION",
".",
"getSqlState",
"(",
")",
",",
"-",
"1",
")",
";",
"}",
"}",
"while",
"(",
"currentIndex",
"<",
"totalParameterList",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqlEx",
")",
"{",
"throw",
"logQuery",
".",
"exceptionWithQuery",
"(",
"sqlEx",
",",
"prepareResult",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"handleIoException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"results",
".",
"setRewritten",
"(",
"rewriteValues",
")",
";",
"}",
"}"
] | Specific execution for batch rewrite that has specific query for memory.
@param results result
@param prepareResult prepareResult
@param parameterList parameters
@param rewriteValues is rewritable flag
@throws SQLException exception | [
"Specific",
"execution",
"for",
"batch",
"rewrite",
"that",
"has",
"specific",
"query",
"for",
"memory",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractQueryProtocol.java#L892-L924 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormat.java | DateTimeFormat.createFormatterForStyle | private static DateTimeFormatter createFormatterForStyle(String style) {
if (style == null || style.length() != 2) {
throw new IllegalArgumentException("Invalid style specification: " + style);
}
int dateStyle = selectStyle(style.charAt(0));
int timeStyle = selectStyle(style.charAt(1));
if (dateStyle == NONE && timeStyle == NONE) {
throw new IllegalArgumentException("Style '--' is invalid");
}
return createFormatterForStyleIndex(dateStyle, timeStyle);
} | java | private static DateTimeFormatter createFormatterForStyle(String style) {
if (style == null || style.length() != 2) {
throw new IllegalArgumentException("Invalid style specification: " + style);
}
int dateStyle = selectStyle(style.charAt(0));
int timeStyle = selectStyle(style.charAt(1));
if (dateStyle == NONE && timeStyle == NONE) {
throw new IllegalArgumentException("Style '--' is invalid");
}
return createFormatterForStyleIndex(dateStyle, timeStyle);
} | [
"private",
"static",
"DateTimeFormatter",
"createFormatterForStyle",
"(",
"String",
"style",
")",
"{",
"if",
"(",
"style",
"==",
"null",
"||",
"style",
".",
"length",
"(",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid style specification: \"",
"+",
"style",
")",
";",
"}",
"int",
"dateStyle",
"=",
"selectStyle",
"(",
"style",
".",
"charAt",
"(",
"0",
")",
")",
";",
"int",
"timeStyle",
"=",
"selectStyle",
"(",
"style",
".",
"charAt",
"(",
"1",
")",
")",
";",
"if",
"(",
"dateStyle",
"==",
"NONE",
"&&",
"timeStyle",
"==",
"NONE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Style '--' is invalid\"",
")",
";",
"}",
"return",
"createFormatterForStyleIndex",
"(",
"dateStyle",
",",
"timeStyle",
")",
";",
"}"
] | Select a format from a two character style pattern. The first character
is the date style, and the second character is the time style. Specify a
character of 'S' for short style, 'M' for medium, 'L' for long, and 'F'
for full. A date or time may be omitted by specifying a style character '-'.
@param style two characters from the set {"S", "M", "L", "F", "-"}
@throws IllegalArgumentException if the style is invalid | [
"Select",
"a",
"format",
"from",
"a",
"two",
"character",
"style",
"pattern",
".",
"The",
"first",
"character",
"is",
"the",
"date",
"style",
"and",
"the",
"second",
"character",
"is",
"the",
"time",
"style",
".",
"Specify",
"a",
"character",
"of",
"S",
"for",
"short",
"style",
"M",
"for",
"medium",
"L",
"for",
"long",
"and",
"F",
"for",
"full",
".",
"A",
"date",
"or",
"time",
"may",
"be",
"omitted",
"by",
"specifying",
"a",
"style",
"character",
"-",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormat.java#L710-L720 |
foundation-runtime/service-directory | 1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java | LookupManagerImpl.removeInstanceChangeListener | @Override
public void removeInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) throws ServiceException {
ServiceInstanceUtils.validateManagerIsStarted(isStarted.get());
ServiceInstanceUtils.validateServiceName(serviceName);
if (listener == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"ServiceInstanceChangeListener");
}
getLookupService().removeServiceInstanceChangeListener(serviceName, listener);
} | java | @Override
public void removeInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) throws ServiceException {
ServiceInstanceUtils.validateManagerIsStarted(isStarted.get());
ServiceInstanceUtils.validateServiceName(serviceName);
if (listener == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"ServiceInstanceChangeListener");
}
getLookupService().removeServiceInstanceChangeListener(serviceName, listener);
} | [
"@",
"Override",
"public",
"void",
"removeInstanceChangeListener",
"(",
"String",
"serviceName",
",",
"ServiceInstanceChangeListener",
"listener",
")",
"throws",
"ServiceException",
"{",
"ServiceInstanceUtils",
".",
"validateManagerIsStarted",
"(",
"isStarted",
".",
"get",
"(",
")",
")",
";",
"ServiceInstanceUtils",
".",
"validateServiceName",
"(",
"serviceName",
")",
";",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"new",
"ServiceException",
"(",
"ErrorCode",
".",
"SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR",
",",
"ErrorCode",
".",
"SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR",
".",
"getMessageTemplate",
"(",
")",
",",
"\"ServiceInstanceChangeListener\"",
")",
";",
"}",
"getLookupService",
"(",
")",
".",
"removeServiceInstanceChangeListener",
"(",
"serviceName",
",",
"listener",
")",
";",
"}"
] | Remove a ServiceInstanceChangeListener from the Service.
Throws IllegalArgumentException if serviceName or listener is null.
@param serviceName
the service name
@param listener
the ServiceInstanceChangeListener for the service
@throws ServiceException | [
"Remove",
"a",
"ServiceInstanceChangeListener",
"from",
"the",
"Service",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java#L439-L450 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/ArrayUtils.java | ArrayUtils.arrayContainsRef | public static <T> boolean arrayContainsRef(T[] array, T value) {
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
} | java | public static <T> boolean arrayContainsRef(T[] array, T value) {
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"arrayContainsRef",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"value",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks if the given array contains the specified value.<br>
This method works with strict reference comparison.
@param <T>
Type of array elements and <code>value</code>
@param array
Array to examine
@param value
Value to search
@return <code>true</code> if <code>array</code> contains
<code>value</code>, <code>false</code> otherwise | [
"Checks",
"if",
"the",
"given",
"array",
"contains",
"the",
"specified",
"value",
".",
"<br",
">",
"This",
"method",
"works",
"with",
"strict",
"reference",
"comparison",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L234-L241 |
pmwmedia/tinylog | log4j1.2-api/src/main/java/org/apache/log4j/Logger.java | Logger.getLogger | public static Logger getLogger(final String name, final LoggerFactory factory) {
return LogManager.getLogger(name, factory);
} | java | public static Logger getLogger(final String name, final LoggerFactory factory) {
return LogManager.getLogger(name, factory);
} | [
"public",
"static",
"Logger",
"getLogger",
"(",
"final",
"String",
"name",
",",
"final",
"LoggerFactory",
"factory",
")",
"{",
"return",
"LogManager",
".",
"getLogger",
"(",
"name",
",",
"factory",
")",
";",
"}"
] | Like {@link #getLogger(String)} except that the type of logger instantiated depends on the type returned by the
{@link LoggerFactory#makeNewLoggerInstance} method of the {@code factory} parameter.
<p>
This method is intended to be used by sub-classes.
</p>
@param name
The name of the logger to retrieve.
@param factory
A {@link LoggerFactory} implementation that will actually create a new Instance.
@return Logger instance
@since 0.8.5 | [
"Like",
"{",
"@link",
"#getLogger",
"(",
"String",
")",
"}",
"except",
"that",
"the",
"type",
"of",
"logger",
"instantiated",
"depends",
"on",
"the",
"type",
"returned",
"by",
"the",
"{",
"@link",
"LoggerFactory#makeNewLoggerInstance",
"}",
"method",
"of",
"the",
"{",
"@code",
"factory",
"}",
"parameter",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/log4j1.2-api/src/main/java/org/apache/log4j/Logger.java#L114-L116 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.getAnnotatedChunk | public static Annotation getAnnotatedChunk(CoreMap annotation, int tokenStartIndex, int tokenEndIndex)
{
Integer annoTokenBegin = annotation.get(CoreAnnotations.TokenBeginAnnotation.class);
if (annoTokenBegin == null) { annoTokenBegin = 0; }
List<CoreLabel> tokens = annotation.get(CoreAnnotations.TokensAnnotation.class);
Annotation chunk = getAnnotatedChunk(tokens, tokenStartIndex, tokenEndIndex, annoTokenBegin);
String text = annotation.get(CoreAnnotations.TextAnnotation.class);
if (text != null) {
annotateChunkText(chunk, annotation);
} else {
annotateChunkText(chunk, CoreAnnotations.TextAnnotation.class);
}
return chunk;
} | java | public static Annotation getAnnotatedChunk(CoreMap annotation, int tokenStartIndex, int tokenEndIndex)
{
Integer annoTokenBegin = annotation.get(CoreAnnotations.TokenBeginAnnotation.class);
if (annoTokenBegin == null) { annoTokenBegin = 0; }
List<CoreLabel> tokens = annotation.get(CoreAnnotations.TokensAnnotation.class);
Annotation chunk = getAnnotatedChunk(tokens, tokenStartIndex, tokenEndIndex, annoTokenBegin);
String text = annotation.get(CoreAnnotations.TextAnnotation.class);
if (text != null) {
annotateChunkText(chunk, annotation);
} else {
annotateChunkText(chunk, CoreAnnotations.TextAnnotation.class);
}
return chunk;
} | [
"public",
"static",
"Annotation",
"getAnnotatedChunk",
"(",
"CoreMap",
"annotation",
",",
"int",
"tokenStartIndex",
",",
"int",
"tokenEndIndex",
")",
"{",
"Integer",
"annoTokenBegin",
"=",
"annotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokenBeginAnnotation",
".",
"class",
")",
";",
"if",
"(",
"annoTokenBegin",
"==",
"null",
")",
"{",
"annoTokenBegin",
"=",
"0",
";",
"}",
"List",
"<",
"CoreLabel",
">",
"tokens",
"=",
"annotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnotation",
".",
"class",
")",
";",
"Annotation",
"chunk",
"=",
"getAnnotatedChunk",
"(",
"tokens",
",",
"tokenStartIndex",
",",
"tokenEndIndex",
",",
"annoTokenBegin",
")",
";",
"String",
"text",
"=",
"annotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"annotateChunkText",
"(",
"chunk",
",",
"annotation",
")",
";",
"}",
"else",
"{",
"annotateChunkText",
"(",
"chunk",
",",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"}",
"return",
"chunk",
";",
"}"
] | Create a new chunk Annotation with basic chunk information
CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
TokensAnnotation - List of tokens in this chunk
TokenBeginAnnotation - Index of first token in chunk (index in original list of tokens)
tokenStartIndex + annotation's TokenBeginAnnotation
TokenEndAnnotation - Index of last token in chunk (index in original list of tokens)
tokenEndIndex + annotation's TokenBeginAnnotation
TextAnnotation - String extracted from the origAnnotation using character offset information for this chunk
@param annotation - Annotation from which to extract the text for this chunk
@param tokenStartIndex - Index (relative to current list of tokens) at which this chunk starts
@param tokenEndIndex - Index (relative to current list of tokens) at which this chunk ends (not inclusive)
@return Annotation representing new chunk | [
"Create",
"a",
"new",
"chunk",
"Annotation",
"with",
"basic",
"chunk",
"information",
"CharacterOffsetBeginAnnotation",
"-",
"set",
"to",
"CharacterOffsetBeginAnnotation",
"of",
"first",
"token",
"in",
"chunk",
"CharacterOffsetEndAnnotation",
"-",
"set",
"to",
"CharacterOffsetEndAnnotation",
"of",
"last",
"token",
"in",
"chunk",
"TokensAnnotation",
"-",
"List",
"of",
"tokens",
"in",
"this",
"chunk",
"TokenBeginAnnotation",
"-",
"Index",
"of",
"first",
"token",
"in",
"chunk",
"(",
"index",
"in",
"original",
"list",
"of",
"tokens",
")",
"tokenStartIndex",
"+",
"annotation",
"s",
"TokenBeginAnnotation",
"TokenEndAnnotation",
"-",
"Index",
"of",
"last",
"token",
"in",
"chunk",
"(",
"index",
"in",
"original",
"list",
"of",
"tokens",
")",
"tokenEndIndex",
"+",
"annotation",
"s",
"TokenBeginAnnotation",
"TextAnnotation",
"-",
"String",
"extracted",
"from",
"the",
"origAnnotation",
"using",
"character",
"offset",
"information",
"for",
"this",
"chunk"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L664-L677 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java | AbstractStyler.update | @Override
public void update(Observable o, Object arg) {
Parameter p = (Parameter) o;
if (!iTextSettingsApplied) {
iTextSettingsApplied = true;
StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(itextHelper, getSettings());
}
if (CONDITONS.equals(p.getKey()) && p.getValue() != null) {
needConditions = true;
}
} | java | @Override
public void update(Observable o, Object arg) {
Parameter p = (Parameter) o;
if (!iTextSettingsApplied) {
iTextSettingsApplied = true;
StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(itextHelper, getSettings());
}
if (CONDITONS.equals(p.getKey()) && p.getValue() != null) {
needConditions = true;
}
} | [
"@",
"Override",
"public",
"void",
"update",
"(",
"Observable",
"o",
",",
"Object",
"arg",
")",
"{",
"Parameter",
"p",
"=",
"(",
"Parameter",
")",
"o",
";",
"if",
"(",
"!",
"iTextSettingsApplied",
")",
"{",
"iTextSettingsApplied",
"=",
"true",
";",
"StylerFactoryHelper",
".",
"SETTINGS_ANNOTATION_PROCESSOR",
".",
"initSettings",
"(",
"itextHelper",
",",
"getSettings",
"(",
")",
")",
";",
"}",
"if",
"(",
"CONDITONS",
".",
"equals",
"(",
"p",
".",
"getKey",
"(",
")",
")",
"&&",
"p",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"needConditions",
"=",
"true",
";",
"}",
"}"
] | Will be called when a {@link Parameter} changes (when {@link Parameter#setDefault(java.io.Serializable) } or {@link Parameter#setValue(java.io.Serializable)
} is called). This method will always be called because the parameter {@link #STYLEAFTER} has a default value.
Here settings of {@link #itextHelper} will be initialized. When the parameter's key is {@link #CONDITONS} a flag
is set that conditions should be initialized, this will be done in {@link #setConditionFactory(com.vectorprint.report.itext.style.ConditionFactory)
}.
@param o
@param arg | [
"Will",
"be",
"called",
"when",
"a",
"{",
"@link",
"Parameter",
"}",
"changes",
"(",
"when",
"{",
"@link",
"Parameter#setDefault",
"(",
"java",
".",
"io",
".",
"Serializable",
")",
"}",
"or",
"{",
"@link",
"Parameter#setValue",
"(",
"java",
".",
"io",
".",
"Serializable",
")",
"}",
"is",
"called",
")",
".",
"This",
"method",
"will",
"always",
"be",
"called",
"because",
"the",
"parameter",
"{",
"@link",
"#STYLEAFTER",
"}",
"has",
"a",
"default",
"value",
".",
"Here",
"settings",
"of",
"{",
"@link",
"#itextHelper",
"}",
"will",
"be",
"initialized",
".",
"When",
"the",
"parameter",
"s",
"key",
"is",
"{",
"@link",
"#CONDITONS",
"}",
"a",
"flag",
"is",
"set",
"that",
"conditions",
"should",
"be",
"initialized",
"this",
"will",
"be",
"done",
"in",
"{",
"@link",
"#setConditionFactory",
"(",
"com",
".",
"vectorprint",
".",
"report",
".",
"itext",
".",
"style",
".",
"ConditionFactory",
")",
"}",
"."
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java#L240-L250 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.addChainConfig | public void addChainConfig(ChainConfig chainCfg, boolean recursive, String before) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addChainConfig(chainCfg, recursive, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | java | public void addChainConfig(ChainConfig chainCfg, boolean recursive, String before) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addChainConfig(chainCfg, recursive, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | [
"public",
"void",
"addChainConfig",
"(",
"ChainConfig",
"chainCfg",
",",
"boolean",
"recursive",
",",
"String",
"before",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"if",
"(",
"!",
"cfg",
".",
"exists",
"(",
")",
")",
"{",
"init",
"(",
")",
";",
"}",
"userDir",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"System",
".",
"setProperty",
"(",
"\"user.dir\"",
",",
"options",
".",
"getExecutionDirectory",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"try",
"{",
"ConfigurationManager",
"manager",
"=",
"new",
"ConfigurationManager",
"(",
"cfg",
",",
"false",
")",
";",
"ProjectConfigurationProvider",
"cfgProvider",
"=",
"manager",
".",
"getProjectConfigurationProvider",
"(",
")",
";",
"cfgProvider",
".",
"addChainConfig",
"(",
"chainCfg",
",",
"recursive",
",",
"before",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"exception",
"=",
"e",
";",
"}",
"finally",
"{",
"System",
".",
"setProperty",
"(",
"\"user.dir\"",
",",
"userDir",
")",
";",
"updateMsg",
"(",
"startTime",
",",
"exception",
")",
";",
"}",
"}"
] | Adds a new chain configuration into the configuration file
@param chainCfg
chain configuration to add
@param recursive
Adds the new chain into all the submodules
@param before
Decides which is the next chain to execute.
@throws Exception
in case that the walkmod configuration file can't be read. | [
"Adds",
"a",
"new",
"chain",
"configuration",
"into",
"the",
"configuration",
"file"
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L389-L409 |
Whiley/WhileyCompiler | src/main/java/wyil/type/util/TypeSubtractor.java | TypeSubtractor.apply | @Override
protected Type apply(Record lhs, Record rhs, LifetimeRelation lifetimes, LinkageStack stack) {
Tuple<Type.Field> lhsFields = lhs.getFields();
Tuple<Type.Field> rhsFields = rhs.getFields();
// Check the number of field matches
int matches = countFieldMatches(lhsFields,rhsFields);
if(matches < rhsFields.size()) {
// At least one field in rhs has no match in lhs. This is definitely a redundant
// subtraction.
return lhs;
} else if(matches < lhsFields.size() && !rhs.isOpen()) {
// At least one field in lhs has not match in rhs. If the rhs is open, this is
// fine as it will auto-fill. But, if its not open, then this is redundant.
return lhs;
}
// Extract all pivot fields (i.e. fields with non-void subtraction)
Type.Field[] pivots = determinePivotFields(lhsFields, rhsFields, lifetimes, stack);
// Check how many pivots we have actuallyfound
int count = countPivots(pivots);
// Act on number of pivots found
switch(count) {
case 0:
// no pivots found means everything was void.
return lhs.isOpen() == rhs.isOpen() ? Type.Void : lhs;
case 1:
// Exactly one pivot found. This is something we can work with!
for(int i=0;i!=pivots.length;++i) {
if(pivots[i] == null) {
pivots[i] = lhsFields.get(i);
}
}
return new Type.Record(lhs.isOpen(),new Tuple<>(pivots));
default:
// All other cases basically are redundant.
return lhs;
}
} | java | @Override
protected Type apply(Record lhs, Record rhs, LifetimeRelation lifetimes, LinkageStack stack) {
Tuple<Type.Field> lhsFields = lhs.getFields();
Tuple<Type.Field> rhsFields = rhs.getFields();
// Check the number of field matches
int matches = countFieldMatches(lhsFields,rhsFields);
if(matches < rhsFields.size()) {
// At least one field in rhs has no match in lhs. This is definitely a redundant
// subtraction.
return lhs;
} else if(matches < lhsFields.size() && !rhs.isOpen()) {
// At least one field in lhs has not match in rhs. If the rhs is open, this is
// fine as it will auto-fill. But, if its not open, then this is redundant.
return lhs;
}
// Extract all pivot fields (i.e. fields with non-void subtraction)
Type.Field[] pivots = determinePivotFields(lhsFields, rhsFields, lifetimes, stack);
// Check how many pivots we have actuallyfound
int count = countPivots(pivots);
// Act on number of pivots found
switch(count) {
case 0:
// no pivots found means everything was void.
return lhs.isOpen() == rhs.isOpen() ? Type.Void : lhs;
case 1:
// Exactly one pivot found. This is something we can work with!
for(int i=0;i!=pivots.length;++i) {
if(pivots[i] == null) {
pivots[i] = lhsFields.get(i);
}
}
return new Type.Record(lhs.isOpen(),new Tuple<>(pivots));
default:
// All other cases basically are redundant.
return lhs;
}
} | [
"@",
"Override",
"protected",
"Type",
"apply",
"(",
"Record",
"lhs",
",",
"Record",
"rhs",
",",
"LifetimeRelation",
"lifetimes",
",",
"LinkageStack",
"stack",
")",
"{",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"lhsFields",
"=",
"lhs",
".",
"getFields",
"(",
")",
";",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"rhsFields",
"=",
"rhs",
".",
"getFields",
"(",
")",
";",
"// Check the number of field matches",
"int",
"matches",
"=",
"countFieldMatches",
"(",
"lhsFields",
",",
"rhsFields",
")",
";",
"if",
"(",
"matches",
"<",
"rhsFields",
".",
"size",
"(",
")",
")",
"{",
"// At least one field in rhs has no match in lhs. This is definitely a redundant",
"// subtraction.",
"return",
"lhs",
";",
"}",
"else",
"if",
"(",
"matches",
"<",
"lhsFields",
".",
"size",
"(",
")",
"&&",
"!",
"rhs",
".",
"isOpen",
"(",
")",
")",
"{",
"// At least one field in lhs has not match in rhs. If the rhs is open, this is",
"// fine as it will auto-fill. But, if its not open, then this is redundant.",
"return",
"lhs",
";",
"}",
"// Extract all pivot fields (i.e. fields with non-void subtraction)",
"Type",
".",
"Field",
"[",
"]",
"pivots",
"=",
"determinePivotFields",
"(",
"lhsFields",
",",
"rhsFields",
",",
"lifetimes",
",",
"stack",
")",
";",
"// Check how many pivots we have actuallyfound",
"int",
"count",
"=",
"countPivots",
"(",
"pivots",
")",
";",
"// Act on number of pivots found",
"switch",
"(",
"count",
")",
"{",
"case",
"0",
":",
"// no pivots found means everything was void.",
"return",
"lhs",
".",
"isOpen",
"(",
")",
"==",
"rhs",
".",
"isOpen",
"(",
")",
"?",
"Type",
".",
"Void",
":",
"lhs",
";",
"case",
"1",
":",
"// Exactly one pivot found. This is something we can work with!",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"pivots",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"pivots",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"pivots",
"[",
"i",
"]",
"=",
"lhsFields",
".",
"get",
"(",
"i",
")",
";",
"}",
"}",
"return",
"new",
"Type",
".",
"Record",
"(",
"lhs",
".",
"isOpen",
"(",
")",
",",
"new",
"Tuple",
"<>",
"(",
"pivots",
")",
")",
";",
"default",
":",
"// All other cases basically are redundant.",
"return",
"lhs",
";",
"}",
"}"
] | <p>
Subtract one record from another. For example, subtracting
<code>{null f}</code> from <code>{int|null f}</code> leaves
<code>{int f}</code>. Unfortunately, there are relatively limited conditions
when a genuine subtraction can occur. For example, subtracting
<code>{null f, null g}</code> from <code>{int|null f, int|null g}</code>
leaves <code>{int|null f, int|null g}</code>! This may seem surprising but it
makes sense if we consider that without <code>{null f, null g}</code> the
type <code>{int|null f, int|null g}</code> still contains
<code>{int f, int|null g}</code> and <code>{int|null f, int g}</code>.
</p>
<p>
What are the conditions under which a subtraction can take place? When
subtracting <code>{S1 f1, ..., Sn fn}</code> from
<code>{T1 f1, ..., Tn fn}</code> we can have at most one "pivot". That is
some <code>i</code> where <code>Ti - Si != void</code>. For example,
subtracting <code>{int|null f, int g}</code> from
<code>{int|null f, int|null g}</code> the pivot is field <code>g</code>. The
final result is then (perhaps surprisingly)
<code>{int|null f, null g}</code>.
</p> | [
"<p",
">",
"Subtract",
"one",
"record",
"from",
"another",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"null",
"f",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"}",
"<",
"/",
"code",
">",
"leaves",
"<code",
">",
"{",
"int",
"f",
"}",
"<",
"/",
"code",
">",
".",
"Unfortunately",
"there",
"are",
"relatively",
"limited",
"conditions",
"when",
"a",
"genuine",
"subtraction",
"can",
"occur",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"leaves",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"!",
"This",
"may",
"seem",
"surprising",
"but",
"it",
"makes",
"sense",
"if",
"we",
"consider",
"that",
"without",
"<code",
">",
"{",
"null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
"the",
"type",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"still",
"contains",
"<code",
">",
"{",
"int",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"{",
"int|null",
"f",
"int",
"g",
"}",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"What",
"are",
"the",
"conditions",
"under",
"which",
"a",
"subtraction",
"can",
"take",
"place?",
"When",
"subtracting",
"<code",
">",
"{",
"S1",
"f1",
"...",
"Sn",
"fn",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"T1",
"f1",
"...",
"Tn",
"fn",
"}",
"<",
"/",
"code",
">",
"we",
"can",
"have",
"at",
"most",
"one",
"pivot",
".",
"That",
"is",
"some",
"<code",
">",
"i<",
"/",
"code",
">",
"where",
"<code",
">",
"Ti",
"-",
"Si",
"!",
"=",
"void<",
"/",
"code",
">",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"int|null",
"f",
"int",
"g",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"the",
"pivot",
"is",
"field",
"<code",
">",
"g<",
"/",
"code",
">",
".",
"The",
"final",
"result",
"is",
"then",
"(",
"perhaps",
"surprisingly",
")",
"<code",
">",
"{",
"int|null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/TypeSubtractor.java#L107-L143 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CouchbaseExecutor.java | CouchbaseExecutor.asyncExists | @SafeVarargs
public final ContinuableFuture<Boolean> asyncExists(final String query, final Object... parameters) {
return asyncExecutor.execute(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return exists(query, parameters);
}
});
} | java | @SafeVarargs
public final ContinuableFuture<Boolean> asyncExists(final String query, final Object... parameters) {
return asyncExecutor.execute(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return exists(query, parameters);
}
});
} | [
"@",
"SafeVarargs",
"public",
"final",
"ContinuableFuture",
"<",
"Boolean",
">",
"asyncExists",
"(",
"final",
"String",
"query",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"return",
"asyncExecutor",
".",
"execute",
"(",
"new",
"Callable",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"call",
"(",
")",
"throws",
"Exception",
"{",
"return",
"exists",
"(",
"query",
",",
"parameters",
")",
";",
"}",
"}",
")",
";",
"}"
] | Always remember to set "<code>LIMIT 1</code>" in the sql statement for better performance.
@param query
@param parameters
@return | [
"Always",
"remember",
"to",
"set",
"<code",
">",
"LIMIT",
"1<",
"/",
"code",
">",
"in",
"the",
"sql",
"statement",
"for",
"better",
"performance",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CouchbaseExecutor.java#L1201-L1209 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.booleanTemplate | @Deprecated
public static BooleanTemplate booleanTemplate(Template template, ImmutableList<?> args) {
return new BooleanTemplate(template, args);
} | java | @Deprecated
public static BooleanTemplate booleanTemplate(Template template, ImmutableList<?> args) {
return new BooleanTemplate(template, args);
} | [
"@",
"Deprecated",
"public",
"static",
"BooleanTemplate",
"booleanTemplate",
"(",
"Template",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"new",
"BooleanTemplate",
"(",
"template",
",",
"args",
")",
";",
"}"
] | Create a new Template expression
@deprecated Use {@link #booleanTemplate(Template, List)} instead.
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L1009-L1012 |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.setPaddingLeftRight | public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
}
}
return this;
} | java | public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
}
}
return this;
} | [
"public",
"AT_Row",
"setPaddingLeftRight",
"(",
"int",
"paddingLeft",
",",
"int",
"paddingRight",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingLeftRight",
"(",
"paddingLeft",
",",
"paddingRight",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Sets left and right padding for all cells in the row (only if both values are not smaller than 0).
@param paddingLeft new left padding, ignored if smaller than 0
@param paddingRight new right padding, ignored if smaller than 0
@return this to allow chaining | [
"Sets",
"left",
"and",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"(",
"only",
"if",
"both",
"values",
"are",
"not",
"smaller",
"than",
"0",
")",
"."
] | train | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L214-L221 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseCsrsv_analysisEx | public static int cusparseCsrsv_analysisEx(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
int csrSortedValAtype,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info,
int executiontype)
{
return checkResult(cusparseCsrsv_analysisExNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedValAtype, csrSortedRowPtrA, csrSortedColIndA, info, executiontype));
} | java | public static int cusparseCsrsv_analysisEx(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
int csrSortedValAtype,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info,
int executiontype)
{
return checkResult(cusparseCsrsv_analysisExNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedValAtype, csrSortedRowPtrA, csrSortedColIndA, info, executiontype));
} | [
"public",
"static",
"int",
"cusparseCsrsv_analysisEx",
"(",
"cusparseHandle",
"handle",
",",
"int",
"transA",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"int",
"csrSortedValAtype",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer",
"csrSortedColIndA",
",",
"cusparseSolveAnalysisInfo",
"info",
",",
"int",
"executiontype",
")",
"{",
"return",
"checkResult",
"(",
"cusparseCsrsv_analysisExNative",
"(",
"handle",
",",
"transA",
",",
"m",
",",
"nnz",
",",
"descrA",
",",
"csrSortedValA",
",",
"csrSortedValAtype",
",",
"csrSortedRowPtrA",
",",
"csrSortedColIndA",
",",
"info",
",",
"executiontype",
")",
")",
";",
"}"
] | Description: Solution of triangular linear system op(A) * x = alpha * f,
where A is a sparse matrix in CSR storage format, rhs f and solution x
are dense vectors. This routine implements algorithm 1 for the solve. | [
"Description",
":",
"Solution",
"of",
"triangular",
"linear",
"system",
"op",
"(",
"A",
")",
"*",
"x",
"=",
"alpha",
"*",
"f",
"where",
"A",
"is",
"a",
"sparse",
"matrix",
"in",
"CSR",
"storage",
"format",
"rhs",
"f",
"and",
"solution",
"x",
"are",
"dense",
"vectors",
".",
"This",
"routine",
"implements",
"algorithm",
"1",
"for",
"the",
"solve",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L2143-L2157 |
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.createOrUpdateAsync | public Observable<EnvironmentSettingInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | java | public Observable<EnvironmentSettingInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EnvironmentSettingInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"EnvironmentSettingInner",
"environmentSetting",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"environmentSettingName",
",",
"environmentSetting",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"EnvironmentSettingInner",
">",
",",
"EnvironmentSettingInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"EnvironmentSettingInner",
"call",
"(",
"ServiceResponse",
"<",
"EnvironmentSettingInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or replace an existing Environment Setting. This operation can take a while to complete.
@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 environmentSetting Represents settings of an environment, from which environment instances would be created
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"replace",
"an",
"existing",
"Environment",
"Setting",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | 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#L647-L654 |
googleads/googleads-java-lib | modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java | AxisHandler.setEndpointAddress | @Override
public void setEndpointAddress(Stub soapClient, String endpointAddress) {
soapClient._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | java | @Override
public void setEndpointAddress(Stub soapClient, String endpointAddress) {
soapClient._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | [
"@",
"Override",
"public",
"void",
"setEndpointAddress",
"(",
"Stub",
"soapClient",
",",
"String",
"endpointAddress",
")",
"{",
"soapClient",
".",
"_setProperty",
"(",
"Stub",
".",
"ENDPOINT_ADDRESS_PROPERTY",
",",
"endpointAddress",
")",
";",
"}"
] | Sets the endpoint address of the given SOAP client.
@param soapClient the SOAP client to set the endpoint address for
@param endpointAddress the target endpoint address | [
"Sets",
"the",
"endpoint",
"address",
"of",
"the",
"given",
"SOAP",
"client",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java#L68-L71 |
twilio/twilio-java | src/main/java/com/twilio/rest/video/v1/RecordingReader.java | RecordingReader.firstPage | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Recording> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.VIDEO.toString(),
"/v1/Recordings",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | java | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Recording> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.VIDEO.toString(),
"/v1/Recordings",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:linelength\"",
")",
"public",
"Page",
"<",
"Recording",
">",
"firstPage",
"(",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
"Domains",
".",
"VIDEO",
".",
"toString",
"(",
")",
",",
"\"/v1/Recordings\"",
",",
"client",
".",
"getRegion",
"(",
")",
")",
";",
"addQueryParams",
"(",
"request",
")",
";",
"return",
"pageForRequest",
"(",
"client",
",",
"request",
")",
";",
"}"
] | Make the request to the Twilio API to perform the read.
@param client TwilioRestClient with which to make the request
@return Recording ResourceSet | [
"Make",
"the",
"request",
"to",
"the",
"Twilio",
"API",
"to",
"perform",
"the",
"read",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/video/v1/RecordingReader.java#L136-L148 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java | CQLService.getPreparedQuery | public PreparedStatement getPreparedQuery(Query query, String storeName) {
String tableName = storeToCQLName(storeName);
return m_statementCache.getPreparedQuery(tableName, query);
} | java | public PreparedStatement getPreparedQuery(Query query, String storeName) {
String tableName = storeToCQLName(storeName);
return m_statementCache.getPreparedQuery(tableName, query);
} | [
"public",
"PreparedStatement",
"getPreparedQuery",
"(",
"Query",
"query",
",",
"String",
"storeName",
")",
"{",
"String",
"tableName",
"=",
"storeToCQLName",
"(",
"storeName",
")",
";",
"return",
"m_statementCache",
".",
"getPreparedQuery",
"(",
"tableName",
",",
"query",
")",
";",
"}"
] | Get the {@link PreparedStatement} for the given {@link CQLStatementCache.Query} to
the given table name. If needed, the query statement is compiled and cached.
@param query Query statement type.
@param storeName Store (ColumnFamily) name.
@return PreparedStatement for requested table/query. | [
"Get",
"the",
"{",
"@link",
"PreparedStatement",
"}",
"for",
"the",
"given",
"{",
"@link",
"CQLStatementCache",
".",
"Query",
"}",
"to",
"the",
"given",
"table",
"name",
".",
"If",
"needed",
"the",
"query",
"statement",
"is",
"compiled",
"and",
"cached",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java#L249-L252 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/memory/MemoryUtil.java | MemoryUtil.setBytes | public static void setBytes(long address, byte[] buffer, int bufferOffset, int count)
{
assert buffer != null;
assert !(bufferOffset < 0 || count < 0 || bufferOffset + count > buffer.length);
setBytes(buffer, bufferOffset, address, count);
} | java | public static void setBytes(long address, byte[] buffer, int bufferOffset, int count)
{
assert buffer != null;
assert !(bufferOffset < 0 || count < 0 || bufferOffset + count > buffer.length);
setBytes(buffer, bufferOffset, address, count);
} | [
"public",
"static",
"void",
"setBytes",
"(",
"long",
"address",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufferOffset",
",",
"int",
"count",
")",
"{",
"assert",
"buffer",
"!=",
"null",
";",
"assert",
"!",
"(",
"bufferOffset",
"<",
"0",
"||",
"count",
"<",
"0",
"||",
"bufferOffset",
"+",
"count",
">",
"buffer",
".",
"length",
")",
";",
"setBytes",
"(",
"buffer",
",",
"bufferOffset",
",",
"address",
",",
"count",
")",
";",
"}"
] | Transfers count bytes from buffer to Memory
@param address start offset in the memory
@param buffer the data buffer
@param bufferOffset start offset of the buffer
@param count number of bytes to transfer | [
"Transfers",
"count",
"bytes",
"from",
"buffer",
"to",
"Memory"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java#L257-L262 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/TopicPattern.java | TopicPattern.topicSkipBackward | static boolean topicSkipBackward(char[] chars, int[] cursor) {
if (cursor[0] == cursor[1])
return false;
while (cursor[0] < cursor[1] &&
chars[cursor[1]-1] != MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
cursor[1]--;
return true;
} | java | static boolean topicSkipBackward(char[] chars, int[] cursor) {
if (cursor[0] == cursor[1])
return false;
while (cursor[0] < cursor[1] &&
chars[cursor[1]-1] != MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
cursor[1]--;
return true;
} | [
"static",
"boolean",
"topicSkipBackward",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"[",
"]",
"cursor",
")",
"{",
"if",
"(",
"cursor",
"[",
"0",
"]",
"==",
"cursor",
"[",
"1",
"]",
")",
"return",
"false",
";",
"while",
"(",
"cursor",
"[",
"0",
"]",
"<",
"cursor",
"[",
"1",
"]",
"&&",
"chars",
"[",
"cursor",
"[",
"1",
"]",
"-",
"1",
"]",
"!=",
"MatchSpace",
".",
"SUBTOPIC_SEPARATOR_CHAR",
")",
"cursor",
"[",
"1",
"]",
"--",
";",
"return",
"true",
";",
"}"
] | Skip backward to the next separator character
@param chars the characters to be examined
@param cursor the int[2] { start, end } "cursor" describing the area to be examined
@return true if something was skipped, false if nothing could be skipped | [
"Skip",
"backward",
"to",
"the",
"next",
"separator",
"character"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/TopicPattern.java#L102-L109 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.listQueryResultsForResourceGroupLevelPolicyAssignment | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body();
} | java | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroupLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyStatesQueryResultsInner",
"listQueryResultsForResourceGroupLevelPolicyAssignment",
"(",
"PolicyStatesResource",
"policyStatesResource",
",",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
",",
"String",
"policyAssignmentName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync",
"(",
"policyStatesResource",
",",
"subscriptionId",
",",
"resourceGroupName",
",",
"policyAssignmentName",
",",
"queryOptions",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Queries policy states for the resource group level policy assignment.
@param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@param policyAssignmentName Policy assignment name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyStatesQueryResultsInner object if successful. | [
"Queries",
"policy",
"states",
"for",
"the",
"resource",
"group",
"level",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2980-L2982 |
fhussonnois/storm-trident-elasticsearch | src/main/java/com/github/fhuss/storm/elasticsearch/mapper/impl/DefaultTupleMapper.java | DefaultTupleMapper.newObjectDefaultTupleMapper | public static final DefaultTupleMapper newObjectDefaultTupleMapper( ) {
final ObjectMapper mapper = new ObjectMapper();
return new DefaultTupleMapper(new TupleMapper<String>() {
@Override
public String map(Tuple input) {
try {
return mapper.writeValueAsString(input.getValueByField(FIELD_SOURCE));
} catch (JsonProcessingException e) {
throw new MappingException("Error happen while processing json on object", e);
}
}
});
} | java | public static final DefaultTupleMapper newObjectDefaultTupleMapper( ) {
final ObjectMapper mapper = new ObjectMapper();
return new DefaultTupleMapper(new TupleMapper<String>() {
@Override
public String map(Tuple input) {
try {
return mapper.writeValueAsString(input.getValueByField(FIELD_SOURCE));
} catch (JsonProcessingException e) {
throw new MappingException("Error happen while processing json on object", e);
}
}
});
} | [
"public",
"static",
"final",
"DefaultTupleMapper",
"newObjectDefaultTupleMapper",
"(",
")",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"return",
"new",
"DefaultTupleMapper",
"(",
"new",
"TupleMapper",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"map",
"(",
"Tuple",
"input",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"writeValueAsString",
"(",
"input",
".",
"getValueByField",
"(",
"FIELD_SOURCE",
")",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{",
"throw",
"new",
"MappingException",
"(",
"\"Error happen while processing json on object\"",
",",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Returns a new {@link DefaultTupleMapper} that accept Object as source field value. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/fhussonnois/storm-trident-elasticsearch/blob/1788157efff223800a92f17f79deb02c905230f7/src/main/java/com/github/fhuss/storm/elasticsearch/mapper/impl/DefaultTupleMapper.java#L79-L91 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java | CPSubsystemConfig.setLockConfigs | public CPSubsystemConfig setLockConfigs(Map<String, FencedLockConfig> lockConfigs) {
this.lockConfigs.clear();
this.lockConfigs.putAll(lockConfigs);
for (Entry<String, FencedLockConfig> entry : this.lockConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public CPSubsystemConfig setLockConfigs(Map<String, FencedLockConfig> lockConfigs) {
this.lockConfigs.clear();
this.lockConfigs.putAll(lockConfigs);
for (Entry<String, FencedLockConfig> entry : this.lockConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"CPSubsystemConfig",
"setLockConfigs",
"(",
"Map",
"<",
"String",
",",
"FencedLockConfig",
">",
"lockConfigs",
")",
"{",
"this",
".",
"lockConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"lockConfigs",
".",
"putAll",
"(",
"lockConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"FencedLockConfig",
">",
"entry",
":",
"this",
".",
"lockConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the map of {@link FencedLock} configurations, mapped by config
name. Names could optionally contain a {@link CPGroup} name, such as
"myLock@group1".
@param lockConfigs the {@link FencedLock} config map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"FencedLock",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"Names",
"could",
"optionally",
"contain",
"a",
"{",
"@link",
"CPGroup",
"}",
"name",
"such",
"as",
"myLock@group1",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java#L544-L551 |
JOML-CI/JOML | src/org/joml/Vector2f.java | Vector2f.distanceSquared | public static float distanceSquared(float x1, float y1, float x2, float y2) {
float dx = x1 - x2;
float dy = y1 - y2;
return dx * dx + dy * dy;
} | java | public static float distanceSquared(float x1, float y1, float x2, float y2) {
float dx = x1 - x2;
float dy = y1 - y2;
return dx * dx + dy * dy;
} | [
"public",
"static",
"float",
"distanceSquared",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"dx",
"=",
"x1",
"-",
"x2",
";",
"float",
"dy",
"=",
"y1",
"-",
"y2",
";",
"return",
"dx",
"*",
"dx",
"+",
"dy",
"*",
"dy",
";",
"}"
] | Return the squared distance between <code>(x1, y1)</code> and <code>(x2, y2)</code>.
@param x1
the x component of the first vector
@param y1
the y component of the first vector
@param x2
the x component of the second vector
@param y2
the y component of the second vector
@return the euclidean distance squared | [
"Return",
"the",
"squared",
"distance",
"between",
"<code",
">",
"(",
"x1",
"y1",
")",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"(",
"x2",
"y2",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2f.java#L607-L611 |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadContextAccessor.java | ThreadContextAccessor.repushContextClassLoader | public Object repushContextClassLoader(Object origLoader, ClassLoader loader) {
if (origLoader == UNCHANGED) {
return pushContextClassLoader(loader);
}
setContextClassLoader(Thread.currentThread(), loader);
return origLoader;
} | java | public Object repushContextClassLoader(Object origLoader, ClassLoader loader) {
if (origLoader == UNCHANGED) {
return pushContextClassLoader(loader);
}
setContextClassLoader(Thread.currentThread(), loader);
return origLoader;
} | [
"public",
"Object",
"repushContextClassLoader",
"(",
"Object",
"origLoader",
",",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"origLoader",
"==",
"UNCHANGED",
")",
"{",
"return",
"pushContextClassLoader",
"(",
"loader",
")",
";",
"}",
"setContextClassLoader",
"(",
"Thread",
".",
"currentThread",
"(",
")",
",",
"loader",
")",
";",
"return",
"origLoader",
";",
"}"
] | Updates the context class loader of the current thread between calls to {@link #pushContextClassLoader} and {@link #popContextClassLoader}. If
the original class loader is {@link #UNCHANGED}, then this is equivalent
to {@link #pushContextClassLoader}). Otherwise, this is equivalent to {@link #setContextClassLoader}, and the passed class loader is returned.
The suggested pattern of use is:
<pre>
Object origCL = ThreadContextAccessor.UNCHANGED;
try {
for (SomeContext ctx : contexts) {
ClassLoader cl = ctx.getClassLoader();
origCL = svThreadContextAccessor.repushContextClassLoader(origCL, cl);
...
}
} finally {
svThreadContextAccessor.popContextClassLoader(origCL);
}
</pre>
@param origLoader the result of {@link #pushContextClassLoader} or {@link #repushContextClassLoader}
@param loader the new context class loader
@return the original context class loader, or {@link #UNCHANGED} | [
"Updates",
"the",
"context",
"class",
"loader",
"of",
"the",
"current",
"thread",
"between",
"calls",
"to",
"{",
"@link",
"#pushContextClassLoader",
"}",
"and",
"{",
"@link",
"#popContextClassLoader",
"}",
".",
"If",
"the",
"original",
"class",
"loader",
"is",
"{",
"@link",
"#UNCHANGED",
"}",
"then",
"this",
"is",
"equivalent",
"to",
"{",
"@link",
"#pushContextClassLoader",
"}",
")",
".",
"Otherwise",
"this",
"is",
"equivalent",
"to",
"{",
"@link",
"#setContextClassLoader",
"}",
"and",
"the",
"passed",
"class",
"loader",
"is",
"returned",
".",
"The",
"suggested",
"pattern",
"of",
"use",
"is",
":"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadContextAccessor.java#L179-L186 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.getObject | public Object getObject(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(columnIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(columnIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(columnIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(columnIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(columnIndex, sourceType);
if (o == null) {
return null;
}
try {
return ((JavaObjectData) o).getObject();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
default :
return getColumnInType(columnIndex, sourceType);
}
} | java | public Object getObject(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(columnIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(columnIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(columnIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(columnIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(columnIndex, sourceType);
if (o == null) {
return null;
}
try {
return ((JavaObjectData) o).getObject();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
default :
return getColumnInType(columnIndex, sourceType);
}
} | [
"public",
"Object",
"getObject",
"(",
"int",
"columnIndex",
")",
"throws",
"SQLException",
"{",
"checkColumn",
"(",
"columnIndex",
")",
";",
"Type",
"sourceType",
"=",
"resultMetaData",
".",
"columnTypes",
"[",
"columnIndex",
"-",
"1",
"]",
";",
"switch",
"(",
"sourceType",
".",
"typeCode",
")",
"{",
"case",
"Types",
".",
"SQL_DATE",
":",
"return",
"getDate",
"(",
"columnIndex",
")",
";",
"case",
"Types",
".",
"SQL_TIME",
":",
"case",
"Types",
".",
"SQL_TIME_WITH_TIME_ZONE",
":",
"return",
"getTime",
"(",
"columnIndex",
")",
";",
"case",
"Types",
".",
"SQL_TIMESTAMP",
":",
"case",
"Types",
".",
"SQL_TIMESTAMP_WITH_TIME_ZONE",
":",
"return",
"getTimestamp",
"(",
"columnIndex",
")",
";",
"case",
"Types",
".",
"SQL_BINARY",
":",
"case",
"Types",
".",
"SQL_VARBINARY",
":",
"return",
"getBytes",
"(",
"columnIndex",
")",
";",
"case",
"Types",
".",
"OTHER",
":",
"case",
"Types",
".",
"JAVA_OBJECT",
":",
"{",
"Object",
"o",
"=",
"getColumnInType",
"(",
"columnIndex",
",",
"sourceType",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"(",
"(",
"JavaObjectData",
")",
"o",
")",
".",
"getObject",
"(",
")",
";",
"}",
"catch",
"(",
"HsqlException",
"e",
")",
"{",
"throw",
"Util",
".",
"sqlException",
"(",
"e",
")",
";",
"}",
"}",
"default",
":",
"return",
"getColumnInType",
"(",
"columnIndex",
",",
"sourceType",
")",
";",
"}",
"}"
] | <!-- start generic documentation -->
<p>Gets the value of the designated column in the current row
of this <code>ResultSet</code> object as
an <code>Object</code> in the Java programming language.
<p>This method will return the value of the given column as a
Java object. The type of the Java object will be the default
Java object type corresponding to the column's SQL type,
following the mapping for built-in types specified in the JDBC
specification. If the value is an SQL <code>NULL</code>,
the driver returns a Java <code>null</code>.
<p>This method may also be used to read database-specific
abstract data types.
In the JDBC 2.0 API, the behavior of method
<code>getObject</code> is extended to materialize
data of SQL user-defined types.
<p>
If <code>Connection.getTypeMap</code> does not throw a
<code>SQLFeatureNotSupportedException</code>,
then when a column contains a structured or distinct value,
the behavior of this method is as
if it were a call to: <code>getObject(columnIndex,
this.getStatement().getConnection().getTypeMap())</code>.
If <code>Connection.getTypeMap</code> does throw a
<code>SQLFeatureNotSupportedException</code>,
then structured values are not supported, and distinct values
are mapped to the default Java class as determined by the
underlying SQL type of the DISTINCT type.
<!-- end generic documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@return a <code>java.lang.Object</code> holding the column value
@exception SQLException if a database access error occurs or this method is
called on a closed result set | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"<p",
">",
"Gets",
"the",
"value",
"of",
"the",
"designated",
"column",
"in",
"the",
"current",
"row",
"of",
"this",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"as",
"an",
"<code",
">",
"Object<",
"/",
"code",
">",
"in",
"the",
"Java",
"programming",
"language",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L1504-L1540 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java | LollipopDrawablesCompat.createFromXml | public static Drawable createFromXml(Resources r, XmlPullParser parser) throws XmlPullParserException, IOException {
return createFromXml(r, parser, null);
} | java | public static Drawable createFromXml(Resources r, XmlPullParser parser) throws XmlPullParserException, IOException {
return createFromXml(r, parser, null);
} | [
"public",
"static",
"Drawable",
"createFromXml",
"(",
"Resources",
"r",
",",
"XmlPullParser",
"parser",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"return",
"createFromXml",
"(",
"r",
",",
"parser",
",",
"null",
")",
";",
"}"
] | Create a drawable from an XML document. For more information on how to create resources in
XML, see
<a href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>. | [
"Create",
"a",
"drawable",
"from",
"an",
"XML",
"document",
".",
"For",
"more",
"information",
"on",
"how",
"to",
"create",
"resources",
"in",
"XML",
"see",
"<a",
"href",
"=",
"{"
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java#L99-L101 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java | HttpConversionUtil.toHttpRequest | public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders)
throws Http2Exception {
// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.
final CharSequence method = checkNotNull(http2Headers.method(),
"method header cannot be null in conversion to HTTP/1.x");
final CharSequence path = checkNotNull(http2Headers.path(),
"path header cannot be null in conversion to HTTP/1.x");
HttpRequest msg = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method.toString()),
path.toString(), validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true);
} catch (Http2Exception e) {
throw e;
} catch (Throwable t) {
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | java | public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders)
throws Http2Exception {
// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.
final CharSequence method = checkNotNull(http2Headers.method(),
"method header cannot be null in conversion to HTTP/1.x");
final CharSequence path = checkNotNull(http2Headers.path(),
"path header cannot be null in conversion to HTTP/1.x");
HttpRequest msg = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method.toString()),
path.toString(), validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg.headers(), msg.protocolVersion(), false, true);
} catch (Http2Exception e) {
throw e;
} catch (Throwable t) {
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | [
"public",
"static",
"HttpRequest",
"toHttpRequest",
"(",
"int",
"streamId",
",",
"Http2Headers",
"http2Headers",
",",
"boolean",
"validateHttpHeaders",
")",
"throws",
"Http2Exception",
"{",
"// HTTP/2 does not define a way to carry the version identifier that is included in the HTTP/1.1 request line.",
"final",
"CharSequence",
"method",
"=",
"checkNotNull",
"(",
"http2Headers",
".",
"method",
"(",
")",
",",
"\"method header cannot be null in conversion to HTTP/1.x\"",
")",
";",
"final",
"CharSequence",
"path",
"=",
"checkNotNull",
"(",
"http2Headers",
".",
"path",
"(",
")",
",",
"\"path header cannot be null in conversion to HTTP/1.x\"",
")",
";",
"HttpRequest",
"msg",
"=",
"new",
"DefaultHttpRequest",
"(",
"HttpVersion",
".",
"HTTP_1_1",
",",
"HttpMethod",
".",
"valueOf",
"(",
"method",
".",
"toString",
"(",
")",
")",
",",
"path",
".",
"toString",
"(",
")",
",",
"validateHttpHeaders",
")",
";",
"try",
"{",
"addHttp2ToHttpHeaders",
"(",
"streamId",
",",
"http2Headers",
",",
"msg",
".",
"headers",
"(",
")",
",",
"msg",
".",
"protocolVersion",
"(",
")",
",",
"false",
",",
"true",
")",
";",
"}",
"catch",
"(",
"Http2Exception",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"throw",
"streamError",
"(",
"streamId",
",",
"PROTOCOL_ERROR",
",",
"t",
",",
"\"HTTP/2 to HTTP/1.x headers conversion error\"",
")",
";",
"}",
"return",
"msg",
";",
"}"
] | Create a new object to contain the request data.
@param streamId The stream associated with the request
@param http2Headers The initial set of HTTP/2 headers to create the request with
@param validateHttpHeaders <ul>
<li>{@code true} to validate HTTP headers in the http-codec</li>
<li>{@code false} not to validate HTTP headers in the http-codec</li>
</ul>
@return A new request object which represents headers for a chunked request
@throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)} | [
"Create",
"a",
"new",
"object",
"to",
"contain",
"the",
"request",
"data",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L280-L297 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.setFloat | public static void setFloat(MemorySegment[] segments, int offset, float value) {
if (inFirstSegment(segments, offset, 4)) {
segments[0].putFloat(offset, value);
} else {
setFloatMultiSegments(segments, offset, value);
}
} | java | public static void setFloat(MemorySegment[] segments, int offset, float value) {
if (inFirstSegment(segments, offset, 4)) {
segments[0].putFloat(offset, value);
} else {
setFloatMultiSegments(segments, offset, value);
}
} | [
"public",
"static",
"void",
"setFloat",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"float",
"value",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"4",
")",
")",
"{",
"segments",
"[",
"0",
"]",
".",
"putFloat",
"(",
"offset",
",",
"value",
")",
";",
"}",
"else",
"{",
"setFloatMultiSegments",
"(",
"segments",
",",
"offset",
",",
"value",
")",
";",
"}",
"}"
] | set float from segments.
@param segments target segments.
@param offset value offset. | [
"set",
"float",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L878-L884 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.getByResourceGroupAsync | public Observable<RouteTableInner> getByResourceGroupAsync(String resourceGroupName, String routeTableName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeTableName, expand).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | java | public Observable<RouteTableInner> getByResourceGroupAsync(String resourceGroupName, String routeTableName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeTableName, expand).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RouteTableInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
",",
"expand",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"RouteTableInner",
">",
",",
"RouteTableInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RouteTableInner",
"call",
"(",
"ServiceResponse",
"<",
"RouteTableInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the specified route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RouteTableInner object | [
"Gets",
"the",
"specified",
"route",
"table",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L383-L390 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.generateSubclassPattern | public static String generateSubclassPattern(URI origin, URI destination) {
return new StringBuilder()
.append(sparqlWrapUri(destination)).append(" ")
.append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ")
.append(sparqlWrapUri(origin)).append(" .")
.toString();
} | java | public static String generateSubclassPattern(URI origin, URI destination) {
return new StringBuilder()
.append(sparqlWrapUri(destination)).append(" ")
.append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ")
.append(sparqlWrapUri(origin)).append(" .")
.toString();
} | [
"public",
"static",
"String",
"generateSubclassPattern",
"(",
"URI",
"origin",
",",
"URI",
"destination",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"sparqlWrapUri",
"(",
"destination",
")",
")",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"sparqlWrapUri",
"(",
"RDFS",
".",
"subClassOf",
".",
"getURI",
"(",
")",
")",
")",
".",
"append",
"(",
"\"+ \"",
")",
".",
"append",
"(",
"sparqlWrapUri",
"(",
"origin",
")",
")",
".",
"append",
"(",
"\" .\"",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Generate a pattern for checking if destination is a subclass of origin
@param origin
@param destination
@return | [
"Generate",
"a",
"pattern",
"for",
"checking",
"if",
"destination",
"is",
"a",
"subclass",
"of",
"origin"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L233-L239 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java | RuntimeModelIo.loadApplicationFlexibly | public static ApplicationLoadResult loadApplicationFlexibly( File projectDirectory ) {
File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC );
ApplicationLoadResult result;
if( descDirectory.exists()) {
result = loadApplication( projectDirectory );
} else {
ApplicationTemplateDescriptor appDescriptor = new ApplicationTemplateDescriptor();
appDescriptor.setName( Constants.GENERATED );
appDescriptor.setDslId( Constants.GENERATED );
appDescriptor.setVersion( Constants.GENERATED );
ApplicationLoadResult alr = new ApplicationLoadResult();
alr.applicationTemplate = new ApplicationTemplate( Constants.GENERATED ).dslId( Constants.GENERATED ).version( Constants.GENERATED );
File graphDirectory = new File( projectDirectory, Constants.PROJECT_DIR_GRAPH );
File[] graphFiles = graphDirectory.listFiles( new GraphFileFilter());
if( graphFiles != null && graphFiles.length > 0 )
appDescriptor.setGraphEntryPoint( graphFiles[ 0 ].getName());
result = loadApplication( projectDirectory, appDescriptor, alr );
}
return result;
} | java | public static ApplicationLoadResult loadApplicationFlexibly( File projectDirectory ) {
File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC );
ApplicationLoadResult result;
if( descDirectory.exists()) {
result = loadApplication( projectDirectory );
} else {
ApplicationTemplateDescriptor appDescriptor = new ApplicationTemplateDescriptor();
appDescriptor.setName( Constants.GENERATED );
appDescriptor.setDslId( Constants.GENERATED );
appDescriptor.setVersion( Constants.GENERATED );
ApplicationLoadResult alr = new ApplicationLoadResult();
alr.applicationTemplate = new ApplicationTemplate( Constants.GENERATED ).dslId( Constants.GENERATED ).version( Constants.GENERATED );
File graphDirectory = new File( projectDirectory, Constants.PROJECT_DIR_GRAPH );
File[] graphFiles = graphDirectory.listFiles( new GraphFileFilter());
if( graphFiles != null && graphFiles.length > 0 )
appDescriptor.setGraphEntryPoint( graphFiles[ 0 ].getName());
result = loadApplication( projectDirectory, appDescriptor, alr );
}
return result;
} | [
"public",
"static",
"ApplicationLoadResult",
"loadApplicationFlexibly",
"(",
"File",
"projectDirectory",
")",
"{",
"File",
"descDirectory",
"=",
"new",
"File",
"(",
"projectDirectory",
",",
"Constants",
".",
"PROJECT_DIR_DESC",
")",
";",
"ApplicationLoadResult",
"result",
";",
"if",
"(",
"descDirectory",
".",
"exists",
"(",
")",
")",
"{",
"result",
"=",
"loadApplication",
"(",
"projectDirectory",
")",
";",
"}",
"else",
"{",
"ApplicationTemplateDescriptor",
"appDescriptor",
"=",
"new",
"ApplicationTemplateDescriptor",
"(",
")",
";",
"appDescriptor",
".",
"setName",
"(",
"Constants",
".",
"GENERATED",
")",
";",
"appDescriptor",
".",
"setDslId",
"(",
"Constants",
".",
"GENERATED",
")",
";",
"appDescriptor",
".",
"setVersion",
"(",
"Constants",
".",
"GENERATED",
")",
";",
"ApplicationLoadResult",
"alr",
"=",
"new",
"ApplicationLoadResult",
"(",
")",
";",
"alr",
".",
"applicationTemplate",
"=",
"new",
"ApplicationTemplate",
"(",
"Constants",
".",
"GENERATED",
")",
".",
"dslId",
"(",
"Constants",
".",
"GENERATED",
")",
".",
"version",
"(",
"Constants",
".",
"GENERATED",
")",
";",
"File",
"graphDirectory",
"=",
"new",
"File",
"(",
"projectDirectory",
",",
"Constants",
".",
"PROJECT_DIR_GRAPH",
")",
";",
"File",
"[",
"]",
"graphFiles",
"=",
"graphDirectory",
".",
"listFiles",
"(",
"new",
"GraphFileFilter",
"(",
")",
")",
";",
"if",
"(",
"graphFiles",
"!=",
"null",
"&&",
"graphFiles",
".",
"length",
">",
"0",
")",
"appDescriptor",
".",
"setGraphEntryPoint",
"(",
"graphFiles",
"[",
"0",
"]",
".",
"getName",
"(",
")",
")",
";",
"result",
"=",
"loadApplication",
"(",
"projectDirectory",
",",
"appDescriptor",
",",
"alr",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Loads an application from a directory.
<p>
This method allows to load an application which does not have a descriptor.
If it has one, it will be read. Otherwise, a default one will be generated.
This is convenient for reusable recipes.
</p>
@param projectDirectory the project directory
@return a load result (never null) | [
"Loads",
"an",
"application",
"from",
"a",
"directory",
".",
"<p",
">",
"This",
"method",
"allows",
"to",
"load",
"an",
"application",
"which",
"does",
"not",
"have",
"a",
"descriptor",
".",
"If",
"it",
"has",
"one",
"it",
"will",
"be",
"read",
".",
"Otherwise",
"a",
"default",
"one",
"will",
"be",
"generated",
".",
"This",
"is",
"convenient",
"for",
"reusable",
"recipes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L153-L178 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmap | public static Bitmap loadBitmap(String fileName, int scale) throws ImageLoadException {
return loadBitmap(new FileSource(fileName), scale);
} | java | public static Bitmap loadBitmap(String fileName, int scale) throws ImageLoadException {
return loadBitmap(new FileSource(fileName), scale);
} | [
"public",
"static",
"Bitmap",
"loadBitmap",
"(",
"String",
"fileName",
",",
"int",
"scale",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmap",
"(",
"new",
"FileSource",
"(",
"fileName",
")",
",",
"scale",
")",
";",
"}"
] | Loading bitmap with scaling
@param fileName Image file name
@param scale divider of size, might be factor of two
@return loaded bitmap (always not null)
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"with",
"scaling"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L72-L74 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.patchJob | public void patchJob(String jobId, JobPatchParameter jobPatchParameter) throws BatchErrorException, IOException {
patchJob(jobId, jobPatchParameter, null);
} | java | public void patchJob(String jobId, JobPatchParameter jobPatchParameter) throws BatchErrorException, IOException {
patchJob(jobId, jobPatchParameter, null);
} | [
"public",
"void",
"patchJob",
"(",
"String",
"jobId",
",",
"JobPatchParameter",
"jobPatchParameter",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"patchJob",
"(",
"jobId",
",",
"jobPatchParameter",
",",
"null",
")",
";",
"}"
] | Updates the specified job.
This method only replaces the properties specified with non-null values.
@param jobId The ID of the job.
@param jobPatchParameter The set of changes to be made to a job.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"job",
".",
"This",
"method",
"only",
"replaces",
"the",
"properties",
"specified",
"with",
"non",
"-",
"null",
"values",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L574-L576 |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java | ProjectTreeController.saveFile | public void saveFile(File file, String type)
{
try
{
Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type);
if (fileClass == null)
{
throw new IllegalArgumentException("Cannot write files of type: " + type);
}
ProjectWriter writer = fileClass.newInstance();
writer.write(m_projectFile, file);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
} | java | public void saveFile(File file, String type)
{
try
{
Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type);
if (fileClass == null)
{
throw new IllegalArgumentException("Cannot write files of type: " + type);
}
ProjectWriter writer = fileClass.newInstance();
writer.write(m_projectFile, file);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
} | [
"public",
"void",
"saveFile",
"(",
"File",
"file",
",",
"String",
"type",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
"extends",
"ProjectWriter",
">",
"fileClass",
"=",
"WRITER_MAP",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"fileClass",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot write files of type: \"",
"+",
"type",
")",
";",
"}",
"ProjectWriter",
"writer",
"=",
"fileClass",
".",
"newInstance",
"(",
")",
";",
"writer",
".",
"write",
"(",
"m_projectFile",
",",
"file",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"}"
] | Save the current file as the given type.
@param file target file
@param type file type | [
"Save",
"the",
"current",
"file",
"as",
"the",
"given",
"type",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L514-L532 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/MetaClass.java | MetaClass.createInstance | @SuppressWarnings("unchecked")
public <E,F extends E> F createInstance(Class<E> type, Object... params) {
Object obj = createInstance(params);
if (type.isInstance(obj)) {
return (F) obj;
} else {
throw new ClassCreationException("Cannot cast " + classname
+ " into " + type.getName());
}
} | java | @SuppressWarnings("unchecked")
public <E,F extends E> F createInstance(Class<E> type, Object... params) {
Object obj = createInstance(params);
if (type.isInstance(obj)) {
return (F) obj;
} else {
throw new ClassCreationException("Cannot cast " + classname
+ " into " + type.getName());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
",",
"F",
"extends",
"E",
">",
"F",
"createInstance",
"(",
"Class",
"<",
"E",
">",
"type",
",",
"Object",
"...",
"params",
")",
"{",
"Object",
"obj",
"=",
"createInstance",
"(",
"params",
")",
";",
"if",
"(",
"type",
".",
"isInstance",
"(",
"obj",
")",
")",
"{",
"return",
"(",
"F",
")",
"obj",
";",
"}",
"else",
"{",
"throw",
"new",
"ClassCreationException",
"(",
"\"Cannot cast \"",
"+",
"classname",
"+",
"\" into \"",
"+",
"type",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] | Creates an instance of the class, forcing a cast to a certain type and
given an array of objects as constructor parameters NOTE: the resulting
instance will [unlike java] invoke the most narrow constructor rather
than the one which matches the signature passed to this function
@param <E>
The type of the object returned
@param type
The class of the object returned
@param params
The arguments to the constructor of the class
@return An instance of the class | [
"Creates",
"an",
"instance",
"of",
"the",
"class",
"forcing",
"a",
"cast",
"to",
"a",
"certain",
"type",
"and",
"given",
"an",
"array",
"of",
"objects",
"as",
"constructor",
"parameters",
"NOTE",
":",
"the",
"resulting",
"instance",
"will",
"[",
"unlike",
"java",
"]",
"invoke",
"the",
"most",
"narrow",
"constructor",
"rather",
"than",
"the",
"one",
"which",
"matches",
"the",
"signature",
"passed",
"to",
"this",
"function"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/MetaClass.java#L388-L397 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Single.java | Single.concatEager | @BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) {
return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
} | java | @BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) {
return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
} | [
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"static",
"<",
"T",
">",
"Flowable",
"<",
"T",
">",
"concatEager",
"(",
"Publisher",
"<",
"?",
"extends",
"SingleSource",
"<",
"?",
"extends",
"T",
">",
">",
"sources",
")",
"{",
"return",
"Flowable",
".",
"fromPublisher",
"(",
"sources",
")",
".",
"concatMapEager",
"(",
"SingleInternalHelper",
".",
"<",
"T",
">",
"toFlowable",
"(",
")",
")",
";",
"}"
] | Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values.
<p>
<img width="640" height="307" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatEager.p.png" alt="">
<p>
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
emitted source Publishers as they are observed. The operator buffers the values emitted by these
Publishers and then drains them in order, each one after the previous one completes.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>Backpressure is honored towards the downstream and the outer Publisher is
expected to support backpressure. Violating this assumption, the operator will
signal {@link io.reactivex.exceptions.MissingBackpressureException}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>This method does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <T> the value type
@param sources a sequence of Publishers that need to be eagerly concatenated
@return the new Publisher instance with the specified concatenation behavior | [
"Concatenates",
"a",
"Publisher",
"sequence",
"of",
"SingleSources",
"eagerly",
"into",
"a",
"single",
"stream",
"of",
"values",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"307",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"Single",
".",
"concatEager",
".",
"p",
".",
"png",
"alt",
"=",
">",
"<p",
">",
"Eager",
"concatenation",
"means",
"that",
"once",
"a",
"subscriber",
"subscribes",
"this",
"operator",
"subscribes",
"to",
"all",
"of",
"the",
"emitted",
"source",
"Publishers",
"as",
"they",
"are",
"observed",
".",
"The",
"operator",
"buffers",
"the",
"values",
"emitted",
"by",
"these",
"Publishers",
"and",
"then",
"drains",
"them",
"in",
"order",
"each",
"one",
"after",
"the",
"previous",
"one",
"completes",
".",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Backpressure",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"Backpressure",
"is",
"honored",
"towards",
"the",
"downstream",
"and",
"the",
"outer",
"Publisher",
"is",
"expected",
"to",
"support",
"backpressure",
".",
"Violating",
"this",
"assumption",
"the",
"operator",
"will",
"signal",
"{"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L434-L439 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/TaskMaster.java | TaskMaster.invokeMethodTask | public static void invokeMethodTask (String name, Object source, TaskObserver observer)
{
// create a method task instance to invoke the named method and
// then run that through the normal task invocation mechanism
invokeTask(name, new MethodTask(name, source), observer);
} | java | public static void invokeMethodTask (String name, Object source, TaskObserver observer)
{
// create a method task instance to invoke the named method and
// then run that through the normal task invocation mechanism
invokeTask(name, new MethodTask(name, source), observer);
} | [
"public",
"static",
"void",
"invokeMethodTask",
"(",
"String",
"name",
",",
"Object",
"source",
",",
"TaskObserver",
"observer",
")",
"{",
"// create a method task instance to invoke the named method and",
"// then run that through the normal task invocation mechanism",
"invokeTask",
"(",
"name",
",",
"new",
"MethodTask",
"(",
"name",
",",
"source",
")",
",",
"observer",
")",
";",
"}"
] | Invokes the method with the specified name on the supplied source
object as if it were a task. The observer is notified when the
method has completed and returned its result or if it fails. The
named method must have a signature the same as the
<code>invoke</code> method of the <code>Task</code> interface.
Aborting tasks run in this way is not supported. | [
"Invokes",
"the",
"method",
"with",
"the",
"specified",
"name",
"on",
"the",
"supplied",
"source",
"object",
"as",
"if",
"it",
"were",
"a",
"task",
".",
"The",
"observer",
"is",
"notified",
"when",
"the",
"method",
"has",
"completed",
"and",
"returned",
"its",
"result",
"or",
"if",
"it",
"fails",
".",
"The",
"named",
"method",
"must",
"have",
"a",
"signature",
"the",
"same",
"as",
"the",
"<code",
">",
"invoke<",
"/",
"code",
">",
"method",
"of",
"the",
"<code",
">",
"Task<",
"/",
"code",
">",
"interface",
".",
"Aborting",
"tasks",
"run",
"in",
"this",
"way",
"is",
"not",
"supported",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/TaskMaster.java#L52-L57 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateTimeZone.java | DateTimeZone.adjustOffset | public long adjustOffset(long instant, boolean earlierOrLater) {
// a bit messy, but will work in all non-pathological cases
// evaluate 3 hours before and after to work out if anything is happening
long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR;
long instantAfter = instant + 3 * DateTimeConstants.MILLIS_PER_HOUR;
long offsetBefore = getOffset(instantBefore);
long offsetAfter = getOffset(instantAfter);
if (offsetBefore <= offsetAfter) {
return instant; // not an overlap (less than is a gap, equal is normal case)
}
// work out range of instants that have duplicate local times
long diff = offsetBefore - offsetAfter;
long transition = nextTransition(instantBefore);
long overlapStart = transition - diff;
long overlapEnd = transition + diff;
if (instant < overlapStart || instant >= overlapEnd) {
return instant; // not an overlap
}
// calculate result
long afterStart = instant - overlapStart;
if (afterStart >= diff) {
// currently in later offset
return earlierOrLater ? instant : instant - diff;
} else {
// currently in earlier offset
return earlierOrLater ? instant + diff : instant;
}
} | java | public long adjustOffset(long instant, boolean earlierOrLater) {
// a bit messy, but will work in all non-pathological cases
// evaluate 3 hours before and after to work out if anything is happening
long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR;
long instantAfter = instant + 3 * DateTimeConstants.MILLIS_PER_HOUR;
long offsetBefore = getOffset(instantBefore);
long offsetAfter = getOffset(instantAfter);
if (offsetBefore <= offsetAfter) {
return instant; // not an overlap (less than is a gap, equal is normal case)
}
// work out range of instants that have duplicate local times
long diff = offsetBefore - offsetAfter;
long transition = nextTransition(instantBefore);
long overlapStart = transition - diff;
long overlapEnd = transition + diff;
if (instant < overlapStart || instant >= overlapEnd) {
return instant; // not an overlap
}
// calculate result
long afterStart = instant - overlapStart;
if (afterStart >= diff) {
// currently in later offset
return earlierOrLater ? instant : instant - diff;
} else {
// currently in earlier offset
return earlierOrLater ? instant + diff : instant;
}
} | [
"public",
"long",
"adjustOffset",
"(",
"long",
"instant",
",",
"boolean",
"earlierOrLater",
")",
"{",
"// a bit messy, but will work in all non-pathological cases",
"// evaluate 3 hours before and after to work out if anything is happening",
"long",
"instantBefore",
"=",
"instant",
"-",
"3",
"*",
"DateTimeConstants",
".",
"MILLIS_PER_HOUR",
";",
"long",
"instantAfter",
"=",
"instant",
"+",
"3",
"*",
"DateTimeConstants",
".",
"MILLIS_PER_HOUR",
";",
"long",
"offsetBefore",
"=",
"getOffset",
"(",
"instantBefore",
")",
";",
"long",
"offsetAfter",
"=",
"getOffset",
"(",
"instantAfter",
")",
";",
"if",
"(",
"offsetBefore",
"<=",
"offsetAfter",
")",
"{",
"return",
"instant",
";",
"// not an overlap (less than is a gap, equal is normal case)",
"}",
"// work out range of instants that have duplicate local times",
"long",
"diff",
"=",
"offsetBefore",
"-",
"offsetAfter",
";",
"long",
"transition",
"=",
"nextTransition",
"(",
"instantBefore",
")",
";",
"long",
"overlapStart",
"=",
"transition",
"-",
"diff",
";",
"long",
"overlapEnd",
"=",
"transition",
"+",
"diff",
";",
"if",
"(",
"instant",
"<",
"overlapStart",
"||",
"instant",
">=",
"overlapEnd",
")",
"{",
"return",
"instant",
";",
"// not an overlap",
"}",
"// calculate result",
"long",
"afterStart",
"=",
"instant",
"-",
"overlapStart",
";",
"if",
"(",
"afterStart",
">=",
"diff",
")",
"{",
"// currently in later offset",
"return",
"earlierOrLater",
"?",
"instant",
":",
"instant",
"-",
"diff",
";",
"}",
"else",
"{",
"// currently in earlier offset",
"return",
"earlierOrLater",
"?",
"instant",
"+",
"diff",
":",
"instant",
";",
"}",
"}"
] | Adjusts the offset to be the earlier or later one during an overlap.
@param instant the instant to adjust
@param earlierOrLater false for earlier, true for later
@return the adjusted instant millis | [
"Adjusts",
"the",
"offset",
"to",
"be",
"the",
"earlier",
"or",
"later",
"one",
"during",
"an",
"overlap",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeZone.java#L1195-L1225 |
amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.toCustomMap | public <M extends Map<K, V>> M toCustomMap(BinaryOperator<V> mergeFunction, Supplier<M> mapSupplier) {
Function<Entry<K, V>, K> keyMapper = Entry::getKey;
Function<Entry<K, V>, V> valueMapper = Entry::getValue;
return collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier));
} | java | public <M extends Map<K, V>> M toCustomMap(BinaryOperator<V> mergeFunction, Supplier<M> mapSupplier) {
Function<Entry<K, V>, K> keyMapper = Entry::getKey;
Function<Entry<K, V>, V> valueMapper = Entry::getValue;
return collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier));
} | [
"public",
"<",
"M",
"extends",
"Map",
"<",
"K",
",",
"V",
">",
">",
"M",
"toCustomMap",
"(",
"BinaryOperator",
"<",
"V",
">",
"mergeFunction",
",",
"Supplier",
"<",
"M",
">",
"mapSupplier",
")",
"{",
"Function",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
",",
"K",
">",
"keyMapper",
"=",
"Entry",
"::",
"getKey",
";",
"Function",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
",",
"V",
">",
"valueMapper",
"=",
"Entry",
"::",
"getValue",
";",
"return",
"collect",
"(",
"Collectors",
".",
"toMap",
"(",
"keyMapper",
",",
"valueMapper",
",",
"mergeFunction",
",",
"mapSupplier",
")",
")",
";",
"}"
] | Returns a {@link Map} containing the elements of this stream. The
{@code Map} is created by a provided supplier function.
<p>
If the mapped keys contains duplicates (according to
{@link Object#equals(Object)}), the value mapping function is applied to
each equal element, and the results are merged using the provided merging
function.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
@param <M> the type of the resulting map
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key.
@param mapSupplier a function which returns a new, empty {@code Map} into
which the results will be inserted
@return a {@code Map} containing the elements of this stream
@see Collectors#toMap(Function, Function)
@see Collectors#toConcurrentMap(Function, Function) | [
"Returns",
"a",
"{",
"@link",
"Map",
"}",
"containing",
"the",
"elements",
"of",
"this",
"stream",
".",
"The",
"{",
"@code",
"Map",
"}",
"is",
"created",
"by",
"a",
"provided",
"supplier",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L1270-L1274 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionUtils.java | ExtensionUtils.importProperty | public static <T> T importProperty(MutableExtension extension, String propertySuffix)
{
return extension.removeProperty(Extension.IKEYPREFIX + propertySuffix);
} | java | public static <T> T importProperty(MutableExtension extension, String propertySuffix)
{
return extension.removeProperty(Extension.IKEYPREFIX + propertySuffix);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"importProperty",
"(",
"MutableExtension",
"extension",
",",
"String",
"propertySuffix",
")",
"{",
"return",
"extension",
".",
"removeProperty",
"(",
"Extension",
".",
"IKEYPREFIX",
"+",
"propertySuffix",
")",
";",
"}"
] | Delete and return the value of the passed special property.
@param <T> type of the property value
@param extension the extension from which to extract custom property
@param propertySuffix the property suffix
@return the value
@ @since 8.3M1 | [
"Delete",
"and",
"return",
"the",
"value",
"of",
"the",
"passed",
"special",
"property",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionUtils.java#L162-L165 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java | FeatureShapes.getFeatureShape | public FeatureShape getFeatureShape(String database, String table, long featureId) {
Map<Long, FeatureShape> featureIds = getFeatureIds(database, table);
FeatureShape featureShape = getFeatureShape(featureIds, featureId);
return featureShape;
} | java | public FeatureShape getFeatureShape(String database, String table, long featureId) {
Map<Long, FeatureShape> featureIds = getFeatureIds(database, table);
FeatureShape featureShape = getFeatureShape(featureIds, featureId);
return featureShape;
} | [
"public",
"FeatureShape",
"getFeatureShape",
"(",
"String",
"database",
",",
"String",
"table",
",",
"long",
"featureId",
")",
"{",
"Map",
"<",
"Long",
",",
"FeatureShape",
">",
"featureIds",
"=",
"getFeatureIds",
"(",
"database",
",",
"table",
")",
";",
"FeatureShape",
"featureShape",
"=",
"getFeatureShape",
"(",
"featureIds",
",",
"featureId",
")",
";",
"return",
"featureShape",
";",
"}"
] | Get the feature shape for the database, table, and feature id
@param database GeoPackage database
@param table table name
@param featureId feature id
@return feature shape
@since 3.2.0 | [
"Get",
"the",
"feature",
"shape",
"for",
"the",
"database",
"table",
"and",
"feature",
"id"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L136-L140 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java | VirtualNetworksInner.updateTagsAsync | public Observable<VirtualNetworkInner> updateTagsAsync(String resourceGroupName, String virtualNetworkName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkName, tags).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() {
@Override
public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkInner> updateTagsAsync(String resourceGroupName, String virtualNetworkName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkName, tags).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() {
@Override
public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkName",
",",
"tags",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VirtualNetworkInner",
">",
",",
"VirtualNetworkInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VirtualNetworkInner",
"call",
"(",
"ServiceResponse",
"<",
"VirtualNetworkInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Updates a virtual network tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"virtual",
"network",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L720-L727 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/Age.java | Age.fromPanasonicString | @Nullable
public static Age fromPanasonicString(@NotNull String s)
{
if (s.length() != 19 || s.startsWith("9999:99:99"))
return null;
try {
int years = Integer.parseInt(s.substring(0, 4));
int months = Integer.parseInt(s.substring(5, 7));
int days = Integer.parseInt(s.substring(8, 10));
int hours = Integer.parseInt(s.substring(11, 13));
int minutes = Integer.parseInt(s.substring(14, 16));
int seconds = Integer.parseInt(s.substring(17, 19));
return new Age(years, months, days, hours, minutes, seconds);
}
catch (NumberFormatException ignored)
{
return null;
}
} | java | @Nullable
public static Age fromPanasonicString(@NotNull String s)
{
if (s.length() != 19 || s.startsWith("9999:99:99"))
return null;
try {
int years = Integer.parseInt(s.substring(0, 4));
int months = Integer.parseInt(s.substring(5, 7));
int days = Integer.parseInt(s.substring(8, 10));
int hours = Integer.parseInt(s.substring(11, 13));
int minutes = Integer.parseInt(s.substring(14, 16));
int seconds = Integer.parseInt(s.substring(17, 19));
return new Age(years, months, days, hours, minutes, seconds);
}
catch (NumberFormatException ignored)
{
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"Age",
"fromPanasonicString",
"(",
"@",
"NotNull",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
"!=",
"19",
"||",
"s",
".",
"startsWith",
"(",
"\"9999:99:99\"",
")",
")",
"return",
"null",
";",
"try",
"{",
"int",
"years",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"4",
")",
")",
";",
"int",
"months",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"5",
",",
"7",
")",
")",
";",
"int",
"days",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"8",
",",
"10",
")",
")",
";",
"int",
"hours",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"11",
",",
"13",
")",
")",
";",
"int",
"minutes",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"14",
",",
"16",
")",
")",
";",
"int",
"seconds",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"17",
",",
"19",
")",
")",
";",
"return",
"new",
"Age",
"(",
"years",
",",
"months",
",",
"days",
",",
"hours",
",",
"minutes",
",",
"seconds",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ignored",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Parses an age object from the string format used by Panasonic cameras:
<code>0031:07:15 00:00:00</code>
@param s The String in format <code>0031:07:15 00:00:00</code>.
@return The parsed Age object, or null if the value could not be parsed | [
"Parses",
"an",
"age",
"object",
"from",
"the",
"string",
"format",
"used",
"by",
"Panasonic",
"cameras",
":",
"<code",
">",
"0031",
":",
"07",
":",
"15",
"00",
":",
"00",
":",
"00<",
"/",
"code",
">"
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/Age.java#L50-L70 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java | MetadataFinder.getFullTrackList | List<Message> getFullTrackList(final CdjStatus.TrackSourceSlot slot, final Client client, final int sortOrder)
throws IOException, InterruptedException, TimeoutException {
// Send the metadata menu request
if (client.tryLockingForMenuOperations(MENU_TIMEOUT, TimeUnit.SECONDS)) {
try {
Message response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slot,
new NumberField(sortOrder));
final long count = response.getMenuResultsCount();
if (count == Message.NO_MENU_RESULTS_AVAILABLE || count == 0) {
return Collections.emptyList();
}
// Gather all the metadata menu items
return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot, CdjStatus.TrackType.REKORDBOX, response);
}
finally {
client.unlockForMenuOperations();
}
} else {
throw new TimeoutException("Unable to lock the player for menu operations");
}
} | java | List<Message> getFullTrackList(final CdjStatus.TrackSourceSlot slot, final Client client, final int sortOrder)
throws IOException, InterruptedException, TimeoutException {
// Send the metadata menu request
if (client.tryLockingForMenuOperations(MENU_TIMEOUT, TimeUnit.SECONDS)) {
try {
Message response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slot,
new NumberField(sortOrder));
final long count = response.getMenuResultsCount();
if (count == Message.NO_MENU_RESULTS_AVAILABLE || count == 0) {
return Collections.emptyList();
}
// Gather all the metadata menu items
return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot, CdjStatus.TrackType.REKORDBOX, response);
}
finally {
client.unlockForMenuOperations();
}
} else {
throw new TimeoutException("Unable to lock the player for menu operations");
}
} | [
"List",
"<",
"Message",
">",
"getFullTrackList",
"(",
"final",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"final",
"Client",
"client",
",",
"final",
"int",
"sortOrder",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"TimeoutException",
"{",
"// Send the metadata menu request",
"if",
"(",
"client",
".",
"tryLockingForMenuOperations",
"(",
"MENU_TIMEOUT",
",",
"TimeUnit",
".",
"SECONDS",
")",
")",
"{",
"try",
"{",
"Message",
"response",
"=",
"client",
".",
"menuRequest",
"(",
"Message",
".",
"KnownType",
".",
"TRACK_MENU_REQ",
",",
"Message",
".",
"MenuIdentifier",
".",
"MAIN_MENU",
",",
"slot",
",",
"new",
"NumberField",
"(",
"sortOrder",
")",
")",
";",
"final",
"long",
"count",
"=",
"response",
".",
"getMenuResultsCount",
"(",
")",
";",
"if",
"(",
"count",
"==",
"Message",
".",
"NO_MENU_RESULTS_AVAILABLE",
"||",
"count",
"==",
"0",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"// Gather all the metadata menu items",
"return",
"client",
".",
"renderMenuItems",
"(",
"Message",
".",
"MenuIdentifier",
".",
"MAIN_MENU",
",",
"slot",
",",
"CdjStatus",
".",
"TrackType",
".",
"REKORDBOX",
",",
"response",
")",
";",
"}",
"finally",
"{",
"client",
".",
"unlockForMenuOperations",
"(",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"TimeoutException",
"(",
"\"Unable to lock the player for menu operations\"",
")",
";",
"}",
"}"
] | Request the list of all tracks in the specified slot, given a dbserver connection to a player that has already
been set up.
@param slot identifies the media slot we are querying
@param client the dbserver client that is communicating with the appropriate player
@return the retrieved track list entry items
@throws IOException if there is a communication problem
@throws InterruptedException if the thread is interrupted while trying to lock the client for menu operations
@throws TimeoutException if we are unable to lock the client for menu operations | [
"Request",
"the",
"list",
"of",
"all",
"tracks",
"in",
"the",
"specified",
"slot",
"given",
"a",
"dbserver",
"connection",
"to",
"a",
"player",
"that",
"has",
"already",
"been",
"set",
"up",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L212-L233 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java | WebSiteManagementClientImpl.validateAsync | public Observable<ValidateResponseInner> validateAsync(String resourceGroupName, ValidateRequest validateRequest) {
return validateWithServiceResponseAsync(resourceGroupName, validateRequest).map(new Func1<ServiceResponse<ValidateResponseInner>, ValidateResponseInner>() {
@Override
public ValidateResponseInner call(ServiceResponse<ValidateResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ValidateResponseInner> validateAsync(String resourceGroupName, ValidateRequest validateRequest) {
return validateWithServiceResponseAsync(resourceGroupName, validateRequest).map(new Func1<ServiceResponse<ValidateResponseInner>, ValidateResponseInner>() {
@Override
public ValidateResponseInner call(ServiceResponse<ValidateResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ValidateResponseInner",
">",
"validateAsync",
"(",
"String",
"resourceGroupName",
",",
"ValidateRequest",
"validateRequest",
")",
"{",
"return",
"validateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"validateRequest",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ValidateResponseInner",
">",
",",
"ValidateResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ValidateResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"ValidateResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Validate if a resource can be created.
Validate if a resource can be created.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param validateRequest Request with the resources to validate.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ValidateResponseInner object | [
"Validate",
"if",
"a",
"resource",
"can",
"be",
"created",
".",
"Validate",
"if",
"a",
"resource",
"can",
"be",
"created",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2267-L2274 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.getDateLastVisitedBy | public long getDateLastVisitedBy(CmsRequestContext context, String poolName, CmsUser user, CmsResource resource)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
long result = 0;
try {
result = m_driverManager.getDateLastVisitedBy(dbc, poolName, user, resource);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_GET_DATE_LASTVISITED_2,
user.getName(),
context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} | java | public long getDateLastVisitedBy(CmsRequestContext context, String poolName, CmsUser user, CmsResource resource)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
long result = 0;
try {
result = m_driverManager.getDateLastVisitedBy(dbc, poolName, user, resource);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_GET_DATE_LASTVISITED_2,
user.getName(),
context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"long",
"getDateLastVisitedBy",
"(",
"CmsRequestContext",
"context",
",",
"String",
"poolName",
",",
"CmsUser",
"user",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"long",
"result",
"=",
"0",
";",
"try",
"{",
"result",
"=",
"m_driverManager",
".",
"getDateLastVisitedBy",
"(",
"dbc",
",",
"poolName",
",",
"user",
",",
"resource",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_GET_DATE_LASTVISITED_2",
",",
"user",
".",
"getName",
"(",
")",
",",
"context",
".",
"getSitePath",
"(",
"resource",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Returns the date when the resource was last visited by the user.<p>
@param context the request context
@param poolName the name of the database pool to use
@param user the user to check the date
@param resource the resource to check the date
@return the date when the resource was last visited by the user
@throws CmsException if something goes wrong | [
"Returns",
"the",
"date",
"when",
"the",
"resource",
"was",
"last",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L2136-L2155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.