repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
j-a-w-r/jawr-main-repo | jawr-grails/jawr-grails-plugin/src/java/net/jawr/web/resource/bundle/locale/GrailsLocaleUtils.java | GrailsLocaleUtils.toBundleName | public static String toBundleName(String bundleBaseName, Locale locale) {
String baseName = bundleBaseName;
if (!isPluginResoucePath(bundleBaseName)) {
baseName = bundleBaseName.replace('.', '/');
}
if (locale == null) {
return baseName;
}
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
if (language == "" && country == "" && variant == "") {
return baseName;
}
StringBuffer sb = new StringBuffer(baseName);
sb.append('_');
if (variant != "") {
sb.append(language).append('_').append(country).append('_')
.append(variant);
} else if (country != "") {
sb.append(language).append('_').append(country);
} else {
sb.append(language);
}
return sb.toString();
} | java | public static String toBundleName(String bundleBaseName, Locale locale) {
String baseName = bundleBaseName;
if (!isPluginResoucePath(bundleBaseName)) {
baseName = bundleBaseName.replace('.', '/');
}
if (locale == null) {
return baseName;
}
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
if (language == "" && country == "" && variant == "") {
return baseName;
}
StringBuffer sb = new StringBuffer(baseName);
sb.append('_');
if (variant != "") {
sb.append(language).append('_').append(country).append('_')
.append(variant);
} else if (country != "") {
sb.append(language).append('_').append(country);
} else {
sb.append(language);
}
return sb.toString();
} | [
"public",
"static",
"String",
"toBundleName",
"(",
"String",
"bundleBaseName",
",",
"Locale",
"locale",
")",
"{",
"String",
"baseName",
"=",
"bundleBaseName",
";",
"if",
"(",
"!",
"isPluginResoucePath",
"(",
"bundleBaseName",
")",
")",
"{",
"baseName",
"=",
"b... | Converts the given <code>baseName</code> and <code>locale</code> to the
bundle name. This method is called from the default implementation of the
{@link #newBundle(String, Locale, String, ClassLoader, boolean)
newBundle} and
{@link #needsReload(String, Locale, String, ClassLoader, ResourceBundle, long)
needsReload} methods.
<p>
This implementation returns the following value:
<pre>
baseName + "_" + language + "_" + country + "_" + variant
</pre>
where <code>language</code>, <code>country</code> and
<code>variant</code> are the language, country and variant values of
<code>locale</code>, respectively. Final component values that are empty
Strings are omitted along with the preceding '_'. If all of the values
are empty strings, then <code>baseName</code> is returned.
<p>
For example, if <code>baseName</code> is <code>"baseName"</code> and
<code>locale</code> is <code>Locale("ja", "", "XX")</code>,
then <code>"baseName_ja_ _XX"</code> is returned. If the given
locale is <code>Locale("en")</code>, then <code>"baseName_en"</code> is
returned.
<p>
Overriding this method allows applications to use different conventions
in the organization and packaging of localized resources.
@param baseName
the base name of the resource bundle, a fully qualified class
name
@param locale
the locale for which a resource bundle should be loaded
@return the bundle name for the resource bundle
@exception NullPointerException
if <code>baseName</code> or <code>locale</code> is
<code>null</code> | [
"Converts",
"the",
"given",
"<code",
">",
"baseName<",
"/",
"code",
">",
"and",
"<code",
">",
"locale<",
"/",
"code",
">",
"to",
"the",
"bundle",
"name",
".",
"This",
"method",
"is",
"called",
"from",
"the",
"default",
"implementation",
"of",
"the",
"{",... | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-grails/jawr-grails-plugin/src/java/net/jawr/web/resource/bundle/locale/GrailsLocaleUtils.java#L278-L307 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipSession.java | SipSession.sendReply | public SipTransaction sendReply(SipTransaction transaction, Response response) {
initErrorInfo();
if ((transaction == null) || (transaction.getServerTransaction() == null)) {
setErrorMessage("Cannot send reply, transaction information is null");
setReturnCode(INVALID_ARGUMENT);
return null;
}
// send the message
try {
SipStack.dumpMessage("Response before sending out through stack", response);
transaction.getServerTransaction().sendResponse(response);
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
}
return transaction;
} | java | public SipTransaction sendReply(SipTransaction transaction, Response response) {
initErrorInfo();
if ((transaction == null) || (transaction.getServerTransaction() == null)) {
setErrorMessage("Cannot send reply, transaction information is null");
setReturnCode(INVALID_ARGUMENT);
return null;
}
// send the message
try {
SipStack.dumpMessage("Response before sending out through stack", response);
transaction.getServerTransaction().sendResponse(response);
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
}
return transaction;
} | [
"public",
"SipTransaction",
"sendReply",
"(",
"SipTransaction",
"transaction",
",",
"Response",
"response",
")",
"{",
"initErrorInfo",
"(",
")",
";",
"if",
"(",
"(",
"transaction",
"==",
"null",
")",
"||",
"(",
"transaction",
".",
"getServerTransaction",
"(",
... | This method sends a stateful response to a previously received request. The returned
SipTransaction object must be used in any subsequent calls to sendReply() for the same received
request, if there are any.
@param transaction The SipTransaction object returned from a previous call to sendReply().
@param response The response to send, as is.
@return A SipTransaction object that must be passed in to any subsequent call to sendReply()
for the same received request, or null if an error was encountered while sending the
response. The calling program doesn't need to do anything with the returned
SipTransaction other than pass it in to a subsequent call to sendReply() for the same
received request. | [
"This",
"method",
"sends",
"a",
"stateful",
"response",
"to",
"a",
"previously",
"received",
"request",
".",
"The",
"returned",
"SipTransaction",
"object",
"must",
"be",
"used",
"in",
"any",
"subsequent",
"calls",
"to",
"sendReply",
"()",
"for",
"the",
"same",... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L1662-L1683 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/SwingUtil.java | SwingUtil.applyToHierarchy | public static void applyToHierarchy (Component comp, ComponentOp op)
{
applyToHierarchy(comp, Integer.MAX_VALUE, op);
} | java | public static void applyToHierarchy (Component comp, ComponentOp op)
{
applyToHierarchy(comp, Integer.MAX_VALUE, op);
} | [
"public",
"static",
"void",
"applyToHierarchy",
"(",
"Component",
"comp",
",",
"ComponentOp",
"op",
")",
"{",
"applyToHierarchy",
"(",
"comp",
",",
"Integer",
".",
"MAX_VALUE",
",",
"op",
")",
";",
"}"
] | Apply the specified ComponentOp to the supplied component and then all its descendants. | [
"Apply",
"the",
"specified",
"ComponentOp",
"to",
"the",
"supplied",
"component",
"and",
"then",
"all",
"its",
"descendants",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/SwingUtil.java#L276-L279 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/api/Utils.java | Utils.getTagValue | public static String getTagValue(Iterable<Tag> tags, String k) {
Preconditions.checkNotNull(tags, "tags");
Preconditions.checkNotNull(k, "key");
for (Tag t : tags) {
if (k.equals(t.key())) {
return t.value();
}
}
return null;
} | java | public static String getTagValue(Iterable<Tag> tags, String k) {
Preconditions.checkNotNull(tags, "tags");
Preconditions.checkNotNull(k, "key");
for (Tag t : tags) {
if (k.equals(t.key())) {
return t.value();
}
}
return null;
} | [
"public",
"static",
"String",
"getTagValue",
"(",
"Iterable",
"<",
"Tag",
">",
"tags",
",",
"String",
"k",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"tags",
",",
"\"tags\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"k",
",",
"\"key\"... | Returns the value associated with with a given key or null if no such key is present in the
set of tags.
@param tags
Set of tags to search.
@param k
Key to search for.
@return
Value for the key or null if the key is not present. | [
"Returns",
"the",
"value",
"associated",
"with",
"with",
"a",
"given",
"key",
"or",
"null",
"if",
"no",
"such",
"key",
"is",
"present",
"in",
"the",
"set",
"of",
"tags",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L113-L122 |
OpenTSDB/opentsdb | src/core/TSDB.java | TSDB.getUID | public byte[] getUID(final UniqueIdType type, final String name) {
try {
return getUIDAsync(type, name).join();
} catch (NoSuchUniqueName e) {
throw e;
} catch (IllegalArgumentException e) {
throw e;
} catch (Exception e) {
LOG.error("Unexpected exception", e);
throw new RuntimeException(e);
}
} | java | public byte[] getUID(final UniqueIdType type, final String name) {
try {
return getUIDAsync(type, name).join();
} catch (NoSuchUniqueName e) {
throw e;
} catch (IllegalArgumentException e) {
throw e;
} catch (Exception e) {
LOG.error("Unexpected exception", e);
throw new RuntimeException(e);
}
} | [
"public",
"byte",
"[",
"]",
"getUID",
"(",
"final",
"UniqueIdType",
"type",
",",
"final",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"getUIDAsync",
"(",
"type",
",",
"name",
")",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"NoSuchUniqueName",... | Attempts to find the UID matching a given name
@param type The type of UID
@param name The name to search for
@throws IllegalArgumentException if the type is not valid
@throws NoSuchUniqueName if the name was not found
@since 2.0 | [
"Attempts",
"to",
"find",
"the",
"UID",
"matching",
"a",
"given",
"name"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L667-L678 |
voldemort/voldemort | src/java/voldemort/utils/ReflectUtils.java | ReflectUtils.getMethod | public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) {
try {
return c.getMethod(name, argTypes);
} catch(NoSuchMethodException e) {
throw new IllegalArgumentException(e);
}
} | java | public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) {
try {
return c.getMethod(name, argTypes);
} catch(NoSuchMethodException e) {
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"Method",
"getMethod",
"(",
"Class",
"<",
"T",
">",
"c",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"argTypes",
")",
"{",
"try",
"{",
"return",
"c",
".",
"getMethod",
"(",
"name",
",",
"argTypes",
... | Get the named method from the class
@param c The class to get the method from
@param name The method name
@param argTypes The argument types
@return The method | [
"Get",
"the",
"named",
"method",
"from",
"the",
"class"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L160-L166 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java | DisksInner.beginCreateOrUpdate | public DiskInner beginCreateOrUpdate(String resourceGroupName, String diskName, DiskInner disk) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body();
} | java | public DiskInner beginCreateOrUpdate(String resourceGroupName, String diskName, DiskInner disk) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body();
} | [
"public",
"DiskInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
",",
"DiskInner",
"disk",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName",
",",
"disk",
")",
".",
... | Creates or updates a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param disk Disk object supplied in the body of the Put disk operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiskInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L221-L223 |
allure-framework/allure1 | allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java | AllureResultsUtils.writeAttachmentWithErrorMessage | public static Attachment writeAttachmentWithErrorMessage(Throwable throwable, String title) {
String message = throwable.getMessage();
try {
return writeAttachment(message.getBytes(CONFIG.getAttachmentsEncoding()), title);
} catch (Exception e) {
e.addSuppressed(throwable);
LOGGER.error(String.format("Can't write attachment \"%s\"", title), e);
}
return new Attachment();
} | java | public static Attachment writeAttachmentWithErrorMessage(Throwable throwable, String title) {
String message = throwable.getMessage();
try {
return writeAttachment(message.getBytes(CONFIG.getAttachmentsEncoding()), title);
} catch (Exception e) {
e.addSuppressed(throwable);
LOGGER.error(String.format("Can't write attachment \"%s\"", title), e);
}
return new Attachment();
} | [
"public",
"static",
"Attachment",
"writeAttachmentWithErrorMessage",
"(",
"Throwable",
"throwable",
",",
"String",
"title",
")",
"{",
"String",
"message",
"=",
"throwable",
".",
"getMessage",
"(",
")",
";",
"try",
"{",
"return",
"writeAttachment",
"(",
"message",
... | Write throwable as attachment.
@param throwable to write
@param title title of attachment
@return Created {@link ru.yandex.qatools.allure.model.Attachment} | [
"Write",
"throwable",
"as",
"attachment",
"."
] | train | https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java#L243-L252 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java | Buffer.readString | public String readString(final int numberOfBytes) {
position += numberOfBytes;
return new String(buf, position - numberOfBytes, numberOfBytes);
} | java | public String readString(final int numberOfBytes) {
position += numberOfBytes;
return new String(buf, position - numberOfBytes, numberOfBytes);
} | [
"public",
"String",
"readString",
"(",
"final",
"int",
"numberOfBytes",
")",
"{",
"position",
"+=",
"numberOfBytes",
";",
"return",
"new",
"String",
"(",
"buf",
",",
"position",
"-",
"numberOfBytes",
",",
"numberOfBytes",
")",
";",
"}"
] | Read String with defined length.
@param numberOfBytes raw data length.
@return String value | [
"Read",
"String",
"with",
"defined",
"length",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java#L134-L137 |
crnk-project/crnk-framework | crnk-setup/crnk-setup-rs/src/main/java/io/crnk/rs/JsonApiResponseFilter.java | JsonApiResponseFilter.filter | @Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
Object response = responseContext.getEntity();
if (response == null) {
if (feature.getBoot().isNullDataResponseEnabled()) {
Document document = new Document();
document.setData(Nullable.nullValue());
responseContext.setEntity(document);
responseContext.setStatus(Response.Status.OK.getStatusCode());
responseContext.getHeaders().put("Content-Type",
Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
}
return;
}
// only modify responses which contain a single or a list of Crnk resources
Optional<RegistryEntry> registryEntry = getRegistryEntry(response);
if (registryEntry.isPresent()) {
CrnkBoot boot = feature.getBoot();
DocumentMapper documentMapper = boot.getDocumentMapper();
HttpRequestContextProvider httpRequestContextProvider = boot.getModuleRegistry().getHttpRequestContextProvider();
try {
HttpRequestContext context = new HttpRequestContextBaseAdapter(new JaxrsRequestContext(requestContext,
feature));
httpRequestContextProvider.onRequestStarted(context);
JsonApiResponse jsonApiResponse = new JsonApiResponse();
jsonApiResponse.setEntity(response);
// use the Crnk document mapper to create a JSON API response
DocumentMappingConfig mappingConfig = new DocumentMappingConfig();
ResourceInformation resourceInformation = registryEntry.get().getResourceInformation();
Map<String, Set<String>> jsonApiParameters = context.getRequestParameters().entrySet()
.stream()
.filter(entry -> isJsonApiParameter(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
QuerySpecUrlMapper urlMapper = feature.getBoot().getUrlMapper();
QuerySpec querySpec = urlMapper.deserialize(resourceInformation, jsonApiParameters);
ResourceRegistry resourceRegistry = feature.getBoot().getResourceRegistry();
QueryAdapter queryAdapter = new QuerySpecAdapter(querySpec, resourceRegistry, context.getQueryContext());
responseContext.setEntity(documentMapper.toDocument(jsonApiResponse, queryAdapter, mappingConfig).get());
responseContext.getHeaders().put("Content-Type",
Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
} finally {
httpRequestContextProvider.onRequestFinished();
}
} else if (isJsonApiResponse(responseContext) && !doNotWrap(response)) {
Document document = new Document();
document.setData(Nullable.of(response));
responseContext.setEntity(document);
}
} | java | @Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
Object response = responseContext.getEntity();
if (response == null) {
if (feature.getBoot().isNullDataResponseEnabled()) {
Document document = new Document();
document.setData(Nullable.nullValue());
responseContext.setEntity(document);
responseContext.setStatus(Response.Status.OK.getStatusCode());
responseContext.getHeaders().put("Content-Type",
Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
}
return;
}
// only modify responses which contain a single or a list of Crnk resources
Optional<RegistryEntry> registryEntry = getRegistryEntry(response);
if (registryEntry.isPresent()) {
CrnkBoot boot = feature.getBoot();
DocumentMapper documentMapper = boot.getDocumentMapper();
HttpRequestContextProvider httpRequestContextProvider = boot.getModuleRegistry().getHttpRequestContextProvider();
try {
HttpRequestContext context = new HttpRequestContextBaseAdapter(new JaxrsRequestContext(requestContext,
feature));
httpRequestContextProvider.onRequestStarted(context);
JsonApiResponse jsonApiResponse = new JsonApiResponse();
jsonApiResponse.setEntity(response);
// use the Crnk document mapper to create a JSON API response
DocumentMappingConfig mappingConfig = new DocumentMappingConfig();
ResourceInformation resourceInformation = registryEntry.get().getResourceInformation();
Map<String, Set<String>> jsonApiParameters = context.getRequestParameters().entrySet()
.stream()
.filter(entry -> isJsonApiParameter(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
QuerySpecUrlMapper urlMapper = feature.getBoot().getUrlMapper();
QuerySpec querySpec = urlMapper.deserialize(resourceInformation, jsonApiParameters);
ResourceRegistry resourceRegistry = feature.getBoot().getResourceRegistry();
QueryAdapter queryAdapter = new QuerySpecAdapter(querySpec, resourceRegistry, context.getQueryContext());
responseContext.setEntity(documentMapper.toDocument(jsonApiResponse, queryAdapter, mappingConfig).get());
responseContext.getHeaders().put("Content-Type",
Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
} finally {
httpRequestContextProvider.onRequestFinished();
}
} else if (isJsonApiResponse(responseContext) && !doNotWrap(response)) {
Document document = new Document();
document.setData(Nullable.of(response));
responseContext.setEntity(document);
}
} | [
"@",
"Override",
"public",
"void",
"filter",
"(",
"ContainerRequestContext",
"requestContext",
",",
"ContainerResponseContext",
"responseContext",
")",
"{",
"Object",
"response",
"=",
"responseContext",
".",
"getEntity",
"(",
")",
";",
"if",
"(",
"response",
"==",
... | Creates JSON API responses for custom JAX-RS actions returning Crnk resources. | [
"Creates",
"JSON",
"API",
"responses",
"for",
"custom",
"JAX",
"-",
"RS",
"actions",
"returning",
"Crnk",
"resources",
"."
] | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-setup/crnk-setup-rs/src/main/java/io/crnk/rs/JsonApiResponseFilter.java#L54-L107 |
VueGWT/vue-gwt | core/src/main/java/com/axellience/vuegwt/core/client/observer/VueGWTObserverManager.java | VueGWTObserverManager.makeStaticallyInitializedPropertiesReactive | private void makeStaticallyInitializedPropertiesReactive(JsObject object, String className) {
Map<String, Object> cache = classesPropertyCaches.get(className);
if (cache == null) {
cache = initClassPropertiesCache(object, className);
}
JsPropertyMap<Object> javaObjectPropertyMap = ((JsPropertyMap<Object>) object);
cache.forEach((key, value) -> {
if (!object.hasOwnProperty(key)) {
javaObjectPropertyMap.set(key, value);
}
});
} | java | private void makeStaticallyInitializedPropertiesReactive(JsObject object, String className) {
Map<String, Object> cache = classesPropertyCaches.get(className);
if (cache == null) {
cache = initClassPropertiesCache(object, className);
}
JsPropertyMap<Object> javaObjectPropertyMap = ((JsPropertyMap<Object>) object);
cache.forEach((key, value) -> {
if (!object.hasOwnProperty(key)) {
javaObjectPropertyMap.set(key, value);
}
});
} | [
"private",
"void",
"makeStaticallyInitializedPropertiesReactive",
"(",
"JsObject",
"object",
",",
"String",
"className",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"cache",
"=",
"classesPropertyCaches",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",... | Due to GWT optimizations, properties on java object defined like this are not observable in
Vue.js when not running in dev mode: <br>
private String myText = "Default text"; private int myInt = 0; <br>
This is because GWT define the default value on the prototype and don't define it on the
object. Therefore Vue.js don't see those properties when initializing it's observer. To fix the
issue, we manually look for those properties and set them explicitly on the object.
@param object The Java object to observe
@param className The Java class name to observe | [
"Due",
"to",
"GWT",
"optimizations",
"properties",
"on",
"java",
"object",
"defined",
"like",
"this",
"are",
"not",
"observable",
"in",
"Vue",
".",
"js",
"when",
"not",
"running",
"in",
"dev",
"mode",
":",
"<br",
">",
"private",
"String",
"myText",
"=",
... | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/observer/VueGWTObserverManager.java#L167-L179 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseProtocolVersion | private void parseProtocolVersion(Map<?, ?> props) {
Object protocolVersionProperty = props.get(HttpConfigConstants.PROPNAME_PROTOCOL_VERSION);
if (null != protocolVersionProperty) {
String protocolVersion = ((String) protocolVersionProperty).toLowerCase();
if (HttpConfigConstants.PROTOCOL_VERSION_11.equals(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.FALSE;
} else if (HttpConfigConstants.PROTOCOL_VERSION_2.equals(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.TRUE;
}
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled()) && this.useH2ProtocolAttribute != null) {
Tr.event(tc, "HTTP Channel Config: versionProtocol has been set to " + protocolVersion);
}
}
} | java | private void parseProtocolVersion(Map<?, ?> props) {
Object protocolVersionProperty = props.get(HttpConfigConstants.PROPNAME_PROTOCOL_VERSION);
if (null != protocolVersionProperty) {
String protocolVersion = ((String) protocolVersionProperty).toLowerCase();
if (HttpConfigConstants.PROTOCOL_VERSION_11.equals(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.FALSE;
} else if (HttpConfigConstants.PROTOCOL_VERSION_2.equals(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.TRUE;
}
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled()) && this.useH2ProtocolAttribute != null) {
Tr.event(tc, "HTTP Channel Config: versionProtocol has been set to " + protocolVersion);
}
}
} | [
"private",
"void",
"parseProtocolVersion",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"props",
")",
"{",
"Object",
"protocolVersionProperty",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_PROTOCOL_VERSION",
")",
";",
"if",
"(",
"null",
"!=",
... | Check the configuration to see if there is a desired http protocol version
that has been provided for this HTTP Channel
@param props | [
"Check",
"the",
"configuration",
"to",
"see",
"if",
"there",
"is",
"a",
"desired",
"http",
"protocol",
"version",
"that",
"has",
"been",
"provided",
"for",
"this",
"HTTP",
"Channel"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1411-L1429 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java | AuditEvent.setMap | public void setMap(Map<String, Object> map) {
eventMap.clear();
eventMap.putAll(map);
} | java | public void setMap(Map<String, Object> map) {
eventMap.clear();
eventMap.putAll(map);
} | [
"public",
"void",
"setMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"eventMap",
".",
"clear",
"(",
")",
";",
"eventMap",
".",
"putAll",
"(",
"map",
")",
";",
"}"
] | Replace the entire event with the keys/values in the provided Map.
All existing keys/values will be lost.
@param map | [
"Replace",
"the",
"entire",
"event",
"with",
"the",
"keys",
"/",
"values",
"in",
"the",
"provided",
"Map",
".",
"All",
"existing",
"keys",
"/",
"values",
"will",
"be",
"lost",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L393-L396 |
phax/ph-css | ph-css/src/main/java/com/helger/css/writer/CSSWriter.java | CSSWriter.getCSSAsString | @Nonnull
public String getCSSAsString (@Nonnull final CascadingStyleSheet aCSS)
{
final NonBlockingStringWriter aSW = new NonBlockingStringWriter ();
try
{
writeCSS (aCSS, aSW);
}
catch (final IOException ex)
{
// Should never occur since NonBlockingStringWriter does not throw such an
// exception
throw new IllegalStateException ("Totally unexpected", ex);
}
return aSW.getAsString ();
} | java | @Nonnull
public String getCSSAsString (@Nonnull final CascadingStyleSheet aCSS)
{
final NonBlockingStringWriter aSW = new NonBlockingStringWriter ();
try
{
writeCSS (aCSS, aSW);
}
catch (final IOException ex)
{
// Should never occur since NonBlockingStringWriter does not throw such an
// exception
throw new IllegalStateException ("Totally unexpected", ex);
}
return aSW.getAsString ();
} | [
"@",
"Nonnull",
"public",
"String",
"getCSSAsString",
"(",
"@",
"Nonnull",
"final",
"CascadingStyleSheet",
"aCSS",
")",
"{",
"final",
"NonBlockingStringWriter",
"aSW",
"=",
"new",
"NonBlockingStringWriter",
"(",
")",
";",
"try",
"{",
"writeCSS",
"(",
"aCSS",
","... | Create the CSS without a specific charset.
@param aCSS
The CSS object to be converted to text. May not be <code>null</code>
.
@return The text representation of the CSS.
@see #writeCSS(CascadingStyleSheet, Writer) | [
"Create",
"the",
"CSS",
"without",
"a",
"specific",
"charset",
"."
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/writer/CSSWriter.java#L363-L378 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.readString | String readString(Node node, String propertyName) throws OrganizationServiceException
{
try
{
return node.getProperty(propertyName).getString();
}
catch (PathNotFoundException e)
{
return null;
}
catch (ValueFormatException e)
{
throw new OrganizationServiceException("Property " + propertyName + " contains wrong value format", e);
}
catch (RepositoryException e)
{
throw new OrganizationServiceException("Can not read property " + propertyName, e);
}
} | java | String readString(Node node, String propertyName) throws OrganizationServiceException
{
try
{
return node.getProperty(propertyName).getString();
}
catch (PathNotFoundException e)
{
return null;
}
catch (ValueFormatException e)
{
throw new OrganizationServiceException("Property " + propertyName + " contains wrong value format", e);
}
catch (RepositoryException e)
{
throw new OrganizationServiceException("Can not read property " + propertyName, e);
}
} | [
"String",
"readString",
"(",
"Node",
"node",
",",
"String",
"propertyName",
")",
"throws",
"OrganizationServiceException",
"{",
"try",
"{",
"return",
"node",
".",
"getProperty",
"(",
"propertyName",
")",
".",
"getString",
"(",
")",
";",
"}",
"catch",
"(",
"P... | Returns property value represented in {@link String}.
@param node
the parent node
@param propertyName
the property name to read from
@return the string value if property exists or null otherwise
@throws OrganizationServiceException
if unexpected exception is occurred during reading | [
"Returns",
"property",
"value",
"represented",
"in",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L95-L113 |
aws/aws-sdk-java | aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/GetRecoveryPointRestoreMetadataResult.java | GetRecoveryPointRestoreMetadataResult.withRestoreMetadata | public GetRecoveryPointRestoreMetadataResult withRestoreMetadata(java.util.Map<String, String> restoreMetadata) {
setRestoreMetadata(restoreMetadata);
return this;
} | java | public GetRecoveryPointRestoreMetadataResult withRestoreMetadata(java.util.Map<String, String> restoreMetadata) {
setRestoreMetadata(restoreMetadata);
return this;
} | [
"public",
"GetRecoveryPointRestoreMetadataResult",
"withRestoreMetadata",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"restoreMetadata",
")",
"{",
"setRestoreMetadata",
"(",
"restoreMetadata",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A set of metadata key-value pairs that lists the metadata key-value pairs that are required to restore the
recovery point.
</p>
@param restoreMetadata
A set of metadata key-value pairs that lists the metadata key-value pairs that are required to restore the
recovery point.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"set",
"of",
"metadata",
"key",
"-",
"value",
"pairs",
"that",
"lists",
"the",
"metadata",
"key",
"-",
"value",
"pairs",
"that",
"are",
"required",
"to",
"restore",
"the",
"recovery",
"point",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/GetRecoveryPointRestoreMetadataResult.java#L182-L185 |
ontop/ontop | core/optimization/src/main/java/it/unibz/inf/ontop/iq/optimizer/impl/BottomUpUnionAndBindingLiftOptimizer.java | BottomUpUnionAndBindingLiftOptimizer.liftTree | private IQTree liftTree(IQTree queryTree, VariableGenerator variableGenerator) {
if (queryTree instanceof UnaryIQTree)
return liftUnary((UnaryIQTree) queryTree, variableGenerator);
else if (queryTree instanceof NaryIQTree)
return liftNary((NaryIQTree) queryTree, variableGenerator);
else if (queryTree instanceof BinaryNonCommutativeIQTree)
return liftBinaryNonCommutative((BinaryNonCommutativeIQTree) queryTree, variableGenerator);
// Leaf node
else
return queryTree;
} | java | private IQTree liftTree(IQTree queryTree, VariableGenerator variableGenerator) {
if (queryTree instanceof UnaryIQTree)
return liftUnary((UnaryIQTree) queryTree, variableGenerator);
else if (queryTree instanceof NaryIQTree)
return liftNary((NaryIQTree) queryTree, variableGenerator);
else if (queryTree instanceof BinaryNonCommutativeIQTree)
return liftBinaryNonCommutative((BinaryNonCommutativeIQTree) queryTree, variableGenerator);
// Leaf node
else
return queryTree;
} | [
"private",
"IQTree",
"liftTree",
"(",
"IQTree",
"queryTree",
",",
"VariableGenerator",
"variableGenerator",
")",
"{",
"if",
"(",
"queryTree",
"instanceof",
"UnaryIQTree",
")",
"return",
"liftUnary",
"(",
"(",
"UnaryIQTree",
")",
"queryTree",
",",
"variableGenerator"... | Recursive (to reach the descendency but does not loop over itself) | [
"Recursive",
"(",
"to",
"reach",
"the",
"descendency",
"but",
"does",
"not",
"loop",
"over",
"itself",
")"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/optimization/src/main/java/it/unibz/inf/ontop/iq/optimizer/impl/BottomUpUnionAndBindingLiftOptimizer.java#L75-L85 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java | XMLEncodingDetector.scanSurrogates | private boolean scanSurrogates(XMLStringBuffer buf)
throws IOException, JspCoreException {
int high = scanChar();
int low = peekChar();
if (!XMLChar.isLowSurrogate(low)) {
throw new JspCoreException("jsp.error.xml.invalidCharInContent", new Object[] { Integer.toString(high, 16) });
//err.jspError("jsp.error.xml.invalidCharInContent", Integer.toString(high, 16));
//return false;
}
scanChar();
// convert surrogates to supplemental character
int c = XMLChar.supplemental((char)high, (char)low);
// supplemental character must be a valid XML character
if (!XMLChar.isValid(c)) {
throw new JspCoreException("jsp.error.xml.invalidCharInContent", new Object[] { Integer.toString(c, 16) });
//err.jspError("jsp.error.xml.invalidCharInContent", Integer.toString(c, 16));
//return false;
}
// fill in the buffer
buf.append((char)high);
buf.append((char)low);
return true;
} | java | private boolean scanSurrogates(XMLStringBuffer buf)
throws IOException, JspCoreException {
int high = scanChar();
int low = peekChar();
if (!XMLChar.isLowSurrogate(low)) {
throw new JspCoreException("jsp.error.xml.invalidCharInContent", new Object[] { Integer.toString(high, 16) });
//err.jspError("jsp.error.xml.invalidCharInContent", Integer.toString(high, 16));
//return false;
}
scanChar();
// convert surrogates to supplemental character
int c = XMLChar.supplemental((char)high, (char)low);
// supplemental character must be a valid XML character
if (!XMLChar.isValid(c)) {
throw new JspCoreException("jsp.error.xml.invalidCharInContent", new Object[] { Integer.toString(c, 16) });
//err.jspError("jsp.error.xml.invalidCharInContent", Integer.toString(c, 16));
//return false;
}
// fill in the buffer
buf.append((char)high);
buf.append((char)low);
return true;
} | [
"private",
"boolean",
"scanSurrogates",
"(",
"XMLStringBuffer",
"buf",
")",
"throws",
"IOException",
",",
"JspCoreException",
"{",
"int",
"high",
"=",
"scanChar",
"(",
")",
";",
"int",
"low",
"=",
"peekChar",
"(",
")",
";",
"if",
"(",
"!",
"XMLChar",
".",
... | Scans surrogates and append them to the specified buffer.
<p>
<strong>Note:</strong> This assumes the current char has already been
identified as a high surrogate.
@param buf The StringBuffer to append the read surrogates to.
@returns True if it succeeded. | [
"Scans",
"surrogates",
"and",
"append",
"them",
"to",
"the",
"specified",
"buffer",
".",
"<p",
">",
"<strong",
">",
"Note",
":",
"<",
"/",
"strong",
">",
"This",
"assumes",
"the",
"current",
"char",
"has",
"already",
"been",
"identified",
"as",
"a",
"hig... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/XMLEncodingDetector.java#L1594-L1622 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getNameParser | public NameParser getNameParser() throws WIMException {
if (iNameParser == null) {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
iNameParser = ctx.getNameParser("");
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
iNameParser = ctx.getNameParser("");
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)), e);
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return iNameParser;
} | java | public NameParser getNameParser() throws WIMException {
if (iNameParser == null) {
TimedDirContext ctx = iContextManager.getDirContext();
try {
try {
iNameParser = ctx.getNameParser("");
} catch (NamingException e) {
if (!ContextManager.isConnectionException(e)) {
throw e;
}
ctx = iContextManager.reCreateDirContext(ctx, e.toString());
iNameParser = ctx.getNameParser("");
}
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)), e);
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
iContextManager.releaseDirContext(ctx);
}
}
return iNameParser;
} | [
"public",
"NameParser",
"getNameParser",
"(",
")",
"throws",
"WIMException",
"{",
"if",
"(",
"iNameParser",
"==",
"null",
")",
"{",
"TimedDirContext",
"ctx",
"=",
"iContextManager",
".",
"getDirContext",
"(",
")",
";",
"try",
"{",
"try",
"{",
"iNameParser",
... | Retrieves the parser associated with the root context.
@return The {@link NameParser}.
@throws WIMException If the {@link NameParser} could not be queried from the LDAP server. | [
"Retrieves",
"the",
"parser",
"associated",
"with",
"the",
"root",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L270-L291 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.splitQuery | public void splitQuery(I invocation, String rawURI)
throws IOException
{
int p = rawURI.indexOf('?');
if (p > 0) {
invocation.setQueryString(rawURI.substring(p + 1));
rawURI = rawURI.substring(0, p);
}
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | java | public void splitQuery(I invocation, String rawURI)
throws IOException
{
int p = rawURI.indexOf('?');
if (p > 0) {
invocation.setQueryString(rawURI.substring(p + 1));
rawURI = rawURI.substring(0, p);
}
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | [
"public",
"void",
"splitQuery",
"(",
"I",
"invocation",
",",
"String",
"rawURI",
")",
"throws",
"IOException",
"{",
"int",
"p",
"=",
"rawURI",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"p",
">",
"0",
")",
"{",
"invocation",
".",
"setQuerySt... | Splits out the query string, and normalizes the URI, assuming nothing
needs unescaping. | [
"Splits",
"out",
"the",
"query",
"string",
"and",
"normalizes",
"the",
"URI",
"assuming",
"nothing",
"needs",
"unescaping",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L143-L158 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java | BaseProfile.generateRaXml | void generateRaXml(Definition def, String outputDir)
{
if (!def.isUseAnnotation())
{
try
{
outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
RaXmlGen raGen = getRaXmlGen(def);
raGen.generate(def, rafw);
rafw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
} | java | void generateRaXml(Definition def, String outputDir)
{
if (!def.isUseAnnotation())
{
try
{
outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
RaXmlGen raGen = getRaXmlGen(def);
raGen.generate(def, rafw);
rafw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
} | [
"void",
"generateRaXml",
"(",
"Definition",
"def",
",",
"String",
"outputDir",
")",
"{",
"if",
"(",
"!",
"def",
".",
"isUseAnnotation",
"(",
")",
")",
"{",
"try",
"{",
"outputDir",
"=",
"outputDir",
"+",
"File",
".",
"separatorChar",
"+",
"\"src\"",
"+",... | generate ra.xml
@param def Definition
@param outputDir output directory | [
"generate",
"ra",
".",
"xml"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L431-L449 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.fromCallable | public static <R> Observable<R> fromCallable(Callable<? extends R> callable) {
return fromCallable(callable, Schedulers.computation());
} | java | public static <R> Observable<R> fromCallable(Callable<? extends R> callable) {
return fromCallable(callable, Schedulers.computation());
} | [
"public",
"static",
"<",
"R",
">",
"Observable",
"<",
"R",
">",
"fromCallable",
"(",
"Callable",
"<",
"?",
"extends",
"R",
">",
"callable",
")",
"{",
"return",
"fromCallable",
"(",
"callable",
",",
"Schedulers",
".",
"computation",
"(",
")",
")",
";",
... | Return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.png" alt="">
<p>
The Callable is called on the default thread pool for computation.
@param <R> the return type
@param callable the callable to call on each subscription
@return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes
@see #start(rx.functions.Func0)
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-fromcallable">RxJava Wiki: fromCallable()</a> | [
"Return",
"an",
"Observable",
"that",
"calls",
"the",
"given",
"Callable",
"and",
"emits",
"its",
"result",
"or",
"Exception",
"when",
"an",
"Observer",
"subscribes",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
"."... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L2006-L2008 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipSession.java | SipSession.sendUnidirectionalRequest | public boolean sendUnidirectionalRequest(Request request, boolean viaProxy) {
initErrorInfo();
if (viaProxy == true) {
if (addProxy(request) == false) {
return false;
}
}
try {
parent.getSipProvider().sendRequest(request);
return true;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
} | java | public boolean sendUnidirectionalRequest(Request request, boolean viaProxy) {
initErrorInfo();
if (viaProxy == true) {
if (addProxy(request) == false) {
return false;
}
}
try {
parent.getSipProvider().sendRequest(request);
return true;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
} | [
"public",
"boolean",
"sendUnidirectionalRequest",
"(",
"Request",
"request",
",",
"boolean",
"viaProxy",
")",
"{",
"initErrorInfo",
"(",
")",
";",
"if",
"(",
"viaProxy",
"==",
"true",
")",
"{",
"if",
"(",
"addProxy",
"(",
"request",
")",
"==",
"false",
")"... | This sendUnidirectionalRequest() method sends out a request message with no response expected.
The Request object passed in must be a fully formed Request with all required content, ready to
be sent.
@param request The request to be sent out.
@param viaProxy If true, send the message to the proxy. In this case a Route header is added by
this method. Else send the message as is. In this case, for an INVITE request, a route
header must have been added by the caller for the request routing to complete.
@return true if the message was successfully sent, false otherwise. | [
"This",
"sendUnidirectionalRequest",
"()",
"method",
"sends",
"out",
"a",
"request",
"message",
"with",
"no",
"response",
"expected",
".",
"The",
"Request",
"object",
"passed",
"in",
"must",
"be",
"a",
"fully",
"formed",
"Request",
"with",
"all",
"required",
"... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L745-L763 |
protostuff/protostuff | protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java | DefaultProtoLoader.searchFromProtoPathAndClasspath | protected Proto searchFromProtoPathAndClasspath(String path, Proto importer)
throws Exception
{
// proto_path
File protoFile;
for (File dir : __protoLoadDirs)
{
if ((protoFile = new File(dir, path)).exists())
return loadFrom(protoFile, importer);
}
// classpath
Proto protoFromOtherResource = loadFromOtherResource(path, importer);
if (protoFromOtherResource == null)
{
throw new IllegalStateException("Imported proto " + path +
" not found. (" + importer.getSourcePath() + ")");
}
return protoFromOtherResource;
} | java | protected Proto searchFromProtoPathAndClasspath(String path, Proto importer)
throws Exception
{
// proto_path
File protoFile;
for (File dir : __protoLoadDirs)
{
if ((protoFile = new File(dir, path)).exists())
return loadFrom(protoFile, importer);
}
// classpath
Proto protoFromOtherResource = loadFromOtherResource(path, importer);
if (protoFromOtherResource == null)
{
throw new IllegalStateException("Imported proto " + path +
" not found. (" + importer.getSourcePath() + ")");
}
return protoFromOtherResource;
} | [
"protected",
"Proto",
"searchFromProtoPathAndClasspath",
"(",
"String",
"path",
",",
"Proto",
"importer",
")",
"throws",
"Exception",
"{",
"// proto_path\r",
"File",
"protoFile",
";",
"for",
"(",
"File",
"dir",
":",
"__protoLoadDirs",
")",
"{",
"if",
"(",
"(",
... | Search from proto_path and classpath (in that order).
<p>
<pre>
Enable via:
-Dproto_path=$path -Dproto_search_strategy=2
</pre> | [
"Search",
"from",
"proto_path",
"and",
"classpath",
"(",
"in",
"that",
"order",
")",
".",
"<p",
">"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L150-L170 |
geomajas/geomajas-project-client-gwt2 | impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java | VectorTileObject.createElementNS | public static Element createElementNS(String ns, String tag) {
if (ns.equals(Dom.NS_HTML)) {
return Dom.createElement(tag);
} else {
if (Dom.isIE()) {
return Dom.createElement(ns + ":" + tag);
} else {
return createNameSpaceElement(ns, tag);
}
}
} | java | public static Element createElementNS(String ns, String tag) {
if (ns.equals(Dom.NS_HTML)) {
return Dom.createElement(tag);
} else {
if (Dom.isIE()) {
return Dom.createElement(ns + ":" + tag);
} else {
return createNameSpaceElement(ns, tag);
}
}
} | [
"public",
"static",
"Element",
"createElementNS",
"(",
"String",
"ns",
",",
"String",
"tag",
")",
"{",
"if",
"(",
"ns",
".",
"equals",
"(",
"Dom",
".",
"NS_HTML",
")",
")",
"{",
"return",
"Dom",
".",
"createElement",
"(",
"tag",
")",
";",
"}",
"else"... | <p>
Creates a new DOM element in the given name-space. If the name-space is HTML, a normal element will be created.
</p>
<p>
There is an exception when using Internet Explorer! For Internet Explorer a new element will be created of type
"namespace:tag".
</p>
@param ns
The name-space to be used in the element creation.
@param tag
The tag-name to be used in the element creation.
@return Returns a newly created DOM element in the given name-space. | [
"<p",
">",
"Creates",
"a",
"new",
"DOM",
"element",
"in",
"the",
"given",
"name",
"-",
"space",
".",
"If",
"the",
"name",
"-",
"space",
"is",
"HTML",
"a",
"normal",
"element",
"will",
"be",
"created",
".",
"<",
"/",
"p",
">",
"<p",
">",
"There",
... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java#L134-L144 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.annotatedService | public ServerBuilder annotatedService(String pathPrefix, Object service,
Object... exceptionHandlersAndConverters) {
return annotatedService(pathPrefix, service, Function.identity(),
ImmutableList.copyOf(requireNonNull(exceptionHandlersAndConverters,
"exceptionHandlersAndConverters")));
} | java | public ServerBuilder annotatedService(String pathPrefix, Object service,
Object... exceptionHandlersAndConverters) {
return annotatedService(pathPrefix, service, Function.identity(),
ImmutableList.copyOf(requireNonNull(exceptionHandlersAndConverters,
"exceptionHandlersAndConverters")));
} | [
"public",
"ServerBuilder",
"annotatedService",
"(",
"String",
"pathPrefix",
",",
"Object",
"service",
",",
"Object",
"...",
"exceptionHandlersAndConverters",
")",
"{",
"return",
"annotatedService",
"(",
"pathPrefix",
",",
"service",
",",
"Function",
".",
"identity",
... | Binds the specified annotated service object under the specified path prefix.
@param exceptionHandlersAndConverters instances of {@link ExceptionHandlerFunction},
{@link RequestConverterFunction} and/or
{@link ResponseConverterFunction} | [
"Binds",
"the",
"specified",
"annotated",
"service",
"object",
"under",
"the",
"specified",
"path",
"prefix",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L1036-L1041 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java | BlockPlacementPolicyRaid.getParityFile | private NameWithINode getParityFile(Codec codec, String src)
throws IOException {
String parity;
if (codec.isDirRaid) {
String parent = getParentPath(src);
parity = codec.parityDirectory + parent;
} else {
parity = codec.parityDirectory + src;
}
byte[][] components = INodeDirectory.getPathComponents(parity);
INode parityInode = namesystem.dir.getINode(components);
if (parityInode == null)
return null;
return new NameWithINode(parity, parityInode);
} | java | private NameWithINode getParityFile(Codec codec, String src)
throws IOException {
String parity;
if (codec.isDirRaid) {
String parent = getParentPath(src);
parity = codec.parityDirectory + parent;
} else {
parity = codec.parityDirectory + src;
}
byte[][] components = INodeDirectory.getPathComponents(parity);
INode parityInode = namesystem.dir.getINode(components);
if (parityInode == null)
return null;
return new NameWithINode(parity, parityInode);
} | [
"private",
"NameWithINode",
"getParityFile",
"(",
"Codec",
"codec",
",",
"String",
"src",
")",
"throws",
"IOException",
"{",
"String",
"parity",
";",
"if",
"(",
"codec",
".",
"isDirRaid",
")",
"{",
"String",
"parent",
"=",
"getParentPath",
"(",
"src",
")",
... | Get path for the parity file. Returns null if it does not exists
@param codec the codec of the parity file.
@return the toUri path of the parity file | [
"Get",
"path",
"for",
"the",
"parity",
"file",
".",
"Returns",
"null",
"if",
"it",
"does",
"not",
"exists"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java#L800-L814 |
apache/incubator-gobblin | gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java | HiveAvroSerDeManager.addSchemaFromAvroFile | protected void addSchemaFromAvroFile(Schema schema, Path schemaFile, HiveRegistrationUnit hiveUnit)
throws IOException {
Preconditions.checkNotNull(schema);
String schemaStr = schema.toString();
if (schemaStr.length() <= this.schemaLiteralLengthLimit) {
hiveUnit.setSerDeProp(SCHEMA_LITERAL, schema.toString());
} else {
Path schemaTempFile = null;
if (useSchemaTempFile) {
schemaTempFile = new Path(schemaFile.getParent(), this.schemaTempFileName);
}
AvroUtils.writeSchemaToFile(schema, schemaFile, schemaTempFile, this.fs, true);
log.info("Using schema file " + schemaFile.toString());
hiveUnit.setSerDeProp(SCHEMA_URL, schemaFile.toString());
}
} | java | protected void addSchemaFromAvroFile(Schema schema, Path schemaFile, HiveRegistrationUnit hiveUnit)
throws IOException {
Preconditions.checkNotNull(schema);
String schemaStr = schema.toString();
if (schemaStr.length() <= this.schemaLiteralLengthLimit) {
hiveUnit.setSerDeProp(SCHEMA_LITERAL, schema.toString());
} else {
Path schemaTempFile = null;
if (useSchemaTempFile) {
schemaTempFile = new Path(schemaFile.getParent(), this.schemaTempFileName);
}
AvroUtils.writeSchemaToFile(schema, schemaFile, schemaTempFile, this.fs, true);
log.info("Using schema file " + schemaFile.toString());
hiveUnit.setSerDeProp(SCHEMA_URL, schemaFile.toString());
}
} | [
"protected",
"void",
"addSchemaFromAvroFile",
"(",
"Schema",
"schema",
",",
"Path",
"schemaFile",
",",
"HiveRegistrationUnit",
"hiveUnit",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"schema",
")",
";",
"String",
"schemaStr",
"=",
... | Add a {@link Schema} obtained from an Avro data file to the given {@link HiveRegistrationUnit}.
<p>
If the length of the schema is less than {@link #SCHEMA_LITERAL_LENGTH_LIMIT}, it will be added via
{@link #SCHEMA_LITERAL}. Otherwise, the schema will be written to {@link #SCHEMA_FILE_NAME} and added
via {@link #SCHEMA_URL}.
</p> | [
"Add",
"a",
"{",
"@link",
"Schema",
"}",
"obtained",
"from",
"an",
"Avro",
"data",
"file",
"to",
"the",
"given",
"{",
"@link",
"HiveRegistrationUnit",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java#L175-L193 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.openPropertyDialogForVaadin | public void openPropertyDialogForVaadin(final CmsUUID structureId, final CmsUUID rootId) {
CmsRpcAction<CmsLocaleComparePropertyData> action = new CmsRpcAction<CmsLocaleComparePropertyData>() {
@SuppressWarnings("synthetic-access")
@Override
public void execute() {
start(0, false);
m_service.loadPropertyDataForLocaleCompareView(structureId, rootId, this);
}
@Override
protected void onResponse(CmsLocaleComparePropertyData result) {
stop(false);
CmsSitemapController.editPropertiesForLocaleCompareMode(
result,
structureId,
result.getDefaultFileId(),
null);
}
};
action.execute();
} | java | public void openPropertyDialogForVaadin(final CmsUUID structureId, final CmsUUID rootId) {
CmsRpcAction<CmsLocaleComparePropertyData> action = new CmsRpcAction<CmsLocaleComparePropertyData>() {
@SuppressWarnings("synthetic-access")
@Override
public void execute() {
start(0, false);
m_service.loadPropertyDataForLocaleCompareView(structureId, rootId, this);
}
@Override
protected void onResponse(CmsLocaleComparePropertyData result) {
stop(false);
CmsSitemapController.editPropertiesForLocaleCompareMode(
result,
structureId,
result.getDefaultFileId(),
null);
}
};
action.execute();
} | [
"public",
"void",
"openPropertyDialogForVaadin",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"CmsUUID",
"rootId",
")",
"{",
"CmsRpcAction",
"<",
"CmsLocaleComparePropertyData",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"CmsLocaleComparePropertyData",
">"... | Opens the property dialog for the locale comparison mode.<p>
@param structureId the structure id of the sitemap entry to edit
@param rootId the structure id of the resource comparing to the tree root in sitemap compare mode | [
"Opens",
"the",
"property",
"dialog",
"for",
"the",
"locale",
"comparison",
"mode",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1711-L1736 |
jmeetsma/Iglu-Http | src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java | WebAppEntryPoint.handleException | public void handleException(ServletRequest request, ServletResponse response, Throwable cause) throws IOException, ServletException
{
List messageStack = new ArrayList();
messageStack.add("Request: " + request);
messageStack.add("Remote address: " + request.getRemoteAddr());
messageStack.add("Remote host: " + request.getRemoteHost());
//unwrap exception
while(/*cause instanceof ServletException && */cause.getCause() != null)
{
messageStack.add("Exception with message: " + cause.getMessage());
messageStack.add(cause.getStackTrace()[0].toString());
cause = cause.getCause();
}
//all servlets are responsible for handling all possible situations
//so an exception handled here is a critical one
if(cause instanceof ServletRequestAlreadyRedirectedException)
{
return;
}
//print error to screen
if(this.printUnhandledExceptions)
{
if(!response.isCommitted())
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName, cause));
ServletSupport.printException(response, "An exception occurred for which no exception page is defined.\n" +
"Make sure you do so if your application is in a production environment.\n" +
"(in section [" + exceptionPagesSectionId + "])" +
"\n\n" + CollectionSupport.format(messageStack, "\n"), cause);
}
else
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName + " can not be printed: response already committed", cause));
}
}
} | java | public void handleException(ServletRequest request, ServletResponse response, Throwable cause) throws IOException, ServletException
{
List messageStack = new ArrayList();
messageStack.add("Request: " + request);
messageStack.add("Remote address: " + request.getRemoteAddr());
messageStack.add("Remote host: " + request.getRemoteHost());
//unwrap exception
while(/*cause instanceof ServletException && */cause.getCause() != null)
{
messageStack.add("Exception with message: " + cause.getMessage());
messageStack.add(cause.getStackTrace()[0].toString());
cause = cause.getCause();
}
//all servlets are responsible for handling all possible situations
//so an exception handled here is a critical one
if(cause instanceof ServletRequestAlreadyRedirectedException)
{
return;
}
//print error to screen
if(this.printUnhandledExceptions)
{
if(!response.isCommitted())
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName, cause));
ServletSupport.printException(response, "An exception occurred for which no exception page is defined.\n" +
"Make sure you do so if your application is in a production environment.\n" +
"(in section [" + exceptionPagesSectionId + "])" +
"\n\n" + CollectionSupport.format(messageStack, "\n"), cause);
}
else
{
System.out.println(new LogEntry(Level.CRITICAL, "exception handled in http-filter " + filterName + " can not be printed: response already committed", cause));
}
}
} | [
"public",
"void",
"handleException",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"Throwable",
"cause",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"List",
"messageStack",
"=",
"new",
"ArrayList",
"(",
")",
";",
"messa... | Is invoked in case an exception or error occurred in a servlet that was not handled by
the implementating code
<p/>
An attempt is made to redirect the request to an URL defined in the configuration
at section "SERVLET_EXCEPTION_REDIRECTS", key "unhandled_error"
<p/>
Override this method to implement your own error / exception handling
@param request
@param response
@param cause | [
"Is",
"invoked",
"in",
"case",
"an",
"exception",
"or",
"error",
"occurred",
"in",
"a",
"servlet",
"that",
"was",
"not",
"handled",
"by",
"the",
"implementating",
"code",
"<p",
"/",
">",
"An",
"attempt",
"is",
"made",
"to",
"redirect",
"the",
"request",
... | train | https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java#L461-L499 |
icode/ameba | src/main/java/ameba/core/Requests.java | Requests.setRequestUri | public static void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException {
getRequest().setRequestUri(baseUri, requestUri);
} | java | public static void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException {
getRequest().setRequestUri(baseUri, requestUri);
} | [
"public",
"static",
"void",
"setRequestUri",
"(",
"URI",
"baseUri",
",",
"URI",
"requestUri",
")",
"throws",
"IllegalStateException",
"{",
"getRequest",
"(",
")",
".",
"setRequestUri",
"(",
"baseUri",
",",
"requestUri",
")",
";",
"}"
] | <p>setRequestUri.</p>
@param baseUri a {@link java.net.URI} object.
@param requestUri a {@link java.net.URI} object.
@throws java.lang.IllegalStateException if any. | [
"<p",
">",
"setRequestUri",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Requests.java#L798-L800 |
jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java | ColorPickerView.setColor | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat = hsv[1];
val = hsv[2];
if (callback && onColorChangedListener != null) {
onColorChangedListener.onColorChanged(Color.HSVToColor(this.alpha, new float[] { hue, sat, val }));
}
invalidate();
} | java | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat = hsv[1];
val = hsv[2];
if (callback && onColorChangedListener != null) {
onColorChangedListener.onColorChanged(Color.HSVToColor(this.alpha, new float[] { hue, sat, val }));
}
invalidate();
} | [
"public",
"void",
"setColor",
"(",
"int",
"color",
",",
"boolean",
"callback",
")",
"{",
"int",
"alpha",
"=",
"Color",
".",
"alpha",
"(",
"color",
")",
";",
"int",
"red",
"=",
"Color",
".",
"red",
"(",
"color",
")",
";",
"int",
"blue",
"=",
"Color"... | Set the color this view should show.
@param color The color that should be selected. #argb
@param callback If you want to get a callback to your OnColorChangedListener. | [
"Set",
"the",
"color",
"this",
"view",
"should",
"show",
"."
] | train | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java#L835-L856 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.colRowFromCoordinate | public static int[] colRowFromCoordinate( Coordinate coordinate, GridGeometry2D gridGeometry, Point point ) {
try {
DirectPosition pos = new DirectPosition2D(coordinate.x, coordinate.y);
GridCoordinates2D worldToGrid = gridGeometry.worldToGrid(pos);
if (point != null) {
point.x = worldToGrid.x;
point.y = worldToGrid.y;
}
return new int[]{worldToGrid.x, worldToGrid.y};
} catch (InvalidGridGeometryException e) {
e.printStackTrace();
} catch (TransformException e) {
e.printStackTrace();
}
point.x = Integer.MAX_VALUE;
point.y = Integer.MAX_VALUE;
return null;
} | java | public static int[] colRowFromCoordinate( Coordinate coordinate, GridGeometry2D gridGeometry, Point point ) {
try {
DirectPosition pos = new DirectPosition2D(coordinate.x, coordinate.y);
GridCoordinates2D worldToGrid = gridGeometry.worldToGrid(pos);
if (point != null) {
point.x = worldToGrid.x;
point.y = worldToGrid.y;
}
return new int[]{worldToGrid.x, worldToGrid.y};
} catch (InvalidGridGeometryException e) {
e.printStackTrace();
} catch (TransformException e) {
e.printStackTrace();
}
point.x = Integer.MAX_VALUE;
point.y = Integer.MAX_VALUE;
return null;
} | [
"public",
"static",
"int",
"[",
"]",
"colRowFromCoordinate",
"(",
"Coordinate",
"coordinate",
",",
"GridGeometry2D",
"gridGeometry",
",",
"Point",
"point",
")",
"{",
"try",
"{",
"DirectPosition",
"pos",
"=",
"new",
"DirectPosition2D",
"(",
"coordinate",
".",
"x"... | Utility method to get col and row of a coordinate from a {@link GridGeometry2D}.
@param coordinate the coordinate to transform.
@param gridGeometry the gridgeometry to use.
@param point if not <code>null</code>, the row col values are put inside the supplied point's x and y.
@return the array with [col, row] or <code>null</code> if something went wrong. | [
"Utility",
"method",
"to",
"get",
"col",
"and",
"row",
"of",
"a",
"coordinate",
"from",
"a",
"{",
"@link",
"GridGeometry2D",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1317-L1335 |
square/okhttp | mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java | MockResponse.addHeaderLenient | public MockResponse addHeaderLenient(String name, Object value) {
InternalKtKt.addHeaderLenient(headers, name, String.valueOf(value));
return this;
} | java | public MockResponse addHeaderLenient(String name, Object value) {
InternalKtKt.addHeaderLenient(headers, name, String.valueOf(value));
return this;
} | [
"public",
"MockResponse",
"addHeaderLenient",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"InternalKtKt",
".",
"addHeaderLenient",
"(",
"headers",
",",
"name",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
... | Adds a new header with the name and value. This may be used to add multiple headers with the
same name. Unlike {@link #addHeader(String, Object)} this does not validate the name and
value. | [
"Adds",
"a",
"new",
"header",
"with",
"the",
"name",
"and",
"value",
".",
"This",
"may",
"be",
"used",
"to",
"add",
"multiple",
"headers",
"with",
"the",
"same",
"name",
".",
"Unlike",
"{"
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java#L140-L143 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java | ReservoirLongsSketch.insertValueAtPosition | void insertValueAtPosition(final long value, final int pos) {
if ((pos < 0) || (pos >= getNumSamples())) {
throw new SketchesArgumentException("Insert position must be between 0 and " + getNumSamples()
+ ", inclusive. Received: " + pos);
}
data_[pos] = value;
} | java | void insertValueAtPosition(final long value, final int pos) {
if ((pos < 0) || (pos >= getNumSamples())) {
throw new SketchesArgumentException("Insert position must be between 0 and " + getNumSamples()
+ ", inclusive. Received: " + pos);
}
data_[pos] = value;
} | [
"void",
"insertValueAtPosition",
"(",
"final",
"long",
"value",
",",
"final",
"int",
"pos",
")",
"{",
"if",
"(",
"(",
"pos",
"<",
"0",
")",
"||",
"(",
"pos",
">=",
"getNumSamples",
"(",
")",
")",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"... | Useful during union operation to force-insert a value into the union gadget. Does <em>NOT</em>
increment count of items seen. Cannot insert beyond current number of samples; if reservoir is
not full, use update().
@param value The entry to store in the reservoir
@param pos The position at which to store the entry | [
"Useful",
"during",
"union",
"operation",
"to",
"force",
"-",
"insert",
"a",
"value",
"into",
"the",
"union",
"gadget",
".",
"Does",
"<em",
">",
"NOT<",
"/",
"em",
">",
"increment",
"count",
"of",
"items",
"seen",
".",
"Cannot",
"insert",
"beyond",
"curr... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java#L494-L501 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/bidiagonal/BidiagonalHelper_DDRB.java | BidiagonalHelper_DDRB.bidiagOuterBlocks | public static boolean bidiagOuterBlocks( final int blockLength ,
final DSubmatrixD1 A ,
final double gammasU[],
final double gammasV[])
{
// System.out.println("---------- Orig");
// A.original.print();
int width = Math.min(blockLength,A.col1-A.col0);
int height = Math.min(blockLength,A.row1-A.row0);
int min = Math.min(width,height);
for( int i = 0; i < min; i++ ) {
//--- Apply reflector to the column
// compute the householder vector
if (!computeHouseHolderCol(blockLength, A, gammasU, i))
return false;
// apply to rest of the columns in the column block
rank1UpdateMultR_Col(blockLength,A,i,gammasU[A.col0+i]);
// apply to the top row block
rank1UpdateMultR_TopRow(blockLength,A,i,gammasU[A.col0+i]);
System.out.println("After column stuff");
A.original.print();
//-- Apply reflector to the row
if(!computeHouseHolderRow(blockLength,A,gammasV,i))
return false;
// apply to rest of the rows in the row block
rank1UpdateMultL_Row(blockLength,A,i,i+1,gammasV[A.row0+i]);
System.out.println("After update row");
A.original.print();
// apply to the left column block
// TODO THIS WON'T WORK!!!!!!!!!!!!!
// Needs the whole matrix to have been updated by the left reflector to compute the correct solution
// rank1UpdateMultL_LeftCol(blockLength,A,i,i+1,gammasV[A.row0+i]);
System.out.println("After row stuff");
A.original.print();
}
return true;
} | java | public static boolean bidiagOuterBlocks( final int blockLength ,
final DSubmatrixD1 A ,
final double gammasU[],
final double gammasV[])
{
// System.out.println("---------- Orig");
// A.original.print();
int width = Math.min(blockLength,A.col1-A.col0);
int height = Math.min(blockLength,A.row1-A.row0);
int min = Math.min(width,height);
for( int i = 0; i < min; i++ ) {
//--- Apply reflector to the column
// compute the householder vector
if (!computeHouseHolderCol(blockLength, A, gammasU, i))
return false;
// apply to rest of the columns in the column block
rank1UpdateMultR_Col(blockLength,A,i,gammasU[A.col0+i]);
// apply to the top row block
rank1UpdateMultR_TopRow(blockLength,A,i,gammasU[A.col0+i]);
System.out.println("After column stuff");
A.original.print();
//-- Apply reflector to the row
if(!computeHouseHolderRow(blockLength,A,gammasV,i))
return false;
// apply to rest of the rows in the row block
rank1UpdateMultL_Row(blockLength,A,i,i+1,gammasV[A.row0+i]);
System.out.println("After update row");
A.original.print();
// apply to the left column block
// TODO THIS WON'T WORK!!!!!!!!!!!!!
// Needs the whole matrix to have been updated by the left reflector to compute the correct solution
// rank1UpdateMultL_LeftCol(blockLength,A,i,i+1,gammasV[A.row0+i]);
System.out.println("After row stuff");
A.original.print();
}
return true;
} | [
"public",
"static",
"boolean",
"bidiagOuterBlocks",
"(",
"final",
"int",
"blockLength",
",",
"final",
"DSubmatrixD1",
"A",
",",
"final",
"double",
"gammasU",
"[",
"]",
",",
"final",
"double",
"gammasV",
"[",
"]",
")",
"{",
"// System.out.println(\"---------... | Performs a standard bidiagonal decomposition just on the outer blocks of the provided matrix
@param blockLength
@param A
@param gammasU | [
"Performs",
"a",
"standard",
"bidiagonal",
"decomposition",
"just",
"on",
"the",
"outer",
"blocks",
"of",
"the",
"provided",
"matrix"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/bidiagonal/BidiagonalHelper_DDRB.java#L39-L88 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java | EventDispatcher.publishRemoved | public void publishRemoved(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ false);
} | java | public void publishRemoved(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ false);
} | [
"public",
"void",
"publishRemoved",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"publish",
"(",
"cache",
",",
"EventType",
".",
"REMOVED",
",",
"key",
",",
"/* oldValue */",
"null",
",",
"value",
",",... | Publishes a remove event for the entry to all of the interested listeners.
@param cache the cache where the entry was removed
@param key the entry's key
@param value the entry's value | [
"Publishes",
"a",
"remove",
"event",
"for",
"the",
"entry",
"to",
"all",
"of",
"the",
"interested",
"listeners",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L136-L138 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java | TextModerationsImpl.screenText | public Screen screenText(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
return screenTextWithServiceResponseAsync(textContentType, textContent, screenTextOptionalParameter).toBlocking().single().body();
} | java | public Screen screenText(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
return screenTextWithServiceResponseAsync(textContentType, textContent, screenTextOptionalParameter).toBlocking().single().body();
} | [
"public",
"Screen",
"screenText",
"(",
"String",
"textContentType",
",",
"byte",
"[",
"]",
"textContent",
",",
"ScreenTextOptionalParameter",
"screenTextOptionalParameter",
")",
"{",
"return",
"screenTextWithServiceResponseAsync",
"(",
"textContentType",
",",
"textContent",... | Detect profanity and match against custom and shared blacklists.
Detects profanity in more than 100 languages and match against custom and shared blacklists.
@param textContentType The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'
@param textContent Content to screen.
@param screenTextOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Screen object if successful. | [
"Detect",
"profanity",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
".",
"Detects",
"profanity",
"in",
"more",
"than",
"100",
"languages",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java#L84-L86 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/DoubleDynamicHistogram.java | DoubleDynamicHistogram.downsample | protected double downsample(double[] data, int start, int end, int size) {
double sum = 0;
for (int i = start; i < end; i++) {
sum += data[i];
}
return sum;
} | java | protected double downsample(double[] data, int start, int end, int size) {
double sum = 0;
for (int i = start; i < end; i++) {
sum += data[i];
}
return sum;
} | [
"protected",
"double",
"downsample",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
",",
"int",
"size",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"+... | Perform downsampling on a number of bins.
@param data Data array (needs cast!)
@param start Interval start
@param end Interval end (exclusive)
@param size Intended size - extra bins are assumed to be empty, should be a
power of two
@return New bin value | [
"Perform",
"downsampling",
"on",
"a",
"number",
"of",
"bins",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/DoubleDynamicHistogram.java#L242-L248 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisRelationHelper.java | CmsCmisRelationHelper.collectAcl | protected Acl collectAcl(CmsObject cms, CmsResource resource, boolean onlyBasic) {
AccessControlListImpl cmisAcl = new AccessControlListImpl();
List<Ace> cmisAces = new ArrayList<Ace>();
cmisAcl.setAces(cmisAces);
cmisAcl.setExact(Boolean.FALSE);
return cmisAcl;
} | java | protected Acl collectAcl(CmsObject cms, CmsResource resource, boolean onlyBasic) {
AccessControlListImpl cmisAcl = new AccessControlListImpl();
List<Ace> cmisAces = new ArrayList<Ace>();
cmisAcl.setAces(cmisAces);
cmisAcl.setExact(Boolean.FALSE);
return cmisAcl;
} | [
"protected",
"Acl",
"collectAcl",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"boolean",
"onlyBasic",
")",
"{",
"AccessControlListImpl",
"cmisAcl",
"=",
"new",
"AccessControlListImpl",
"(",
")",
";",
"List",
"<",
"Ace",
">",
"cmisAces",
"=",
... | Compiles the ACL for a relation.<p>
@param cms the CMS context
@param resource the resource for which to collect the ACLs
@param onlyBasic flag to only include basic ACEs
@return the ACL for the resource | [
"Compiles",
"the",
"ACL",
"for",
"a",
"relation",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisRelationHelper.java#L366-L373 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/algo/tabu/TabuSearch.java | TabuSearch.setCurrentSolution | @Override
public void setCurrentSolution(SolutionType solution){
// call super (also verifies search status)
super.setCurrentSolution(solution);
// update tabu memory (no move has been applied to obtain this solution, pass null)
tabuMemory.registerVisitedSolution(solution, null);
} | java | @Override
public void setCurrentSolution(SolutionType solution){
// call super (also verifies search status)
super.setCurrentSolution(solution);
// update tabu memory (no move has been applied to obtain this solution, pass null)
tabuMemory.registerVisitedSolution(solution, null);
} | [
"@",
"Override",
"public",
"void",
"setCurrentSolution",
"(",
"SolutionType",
"solution",
")",
"{",
"// call super (also verifies search status)",
"super",
".",
"setCurrentSolution",
"(",
"solution",
")",
";",
"// update tabu memory (no move has been applied to obtain this soluti... | Updates the tabu memory when a custom current/initial solution is set. Note that this method
may only be called when the search is idle.
@param solution manually specified current solution
@throws SearchException if the search is not idle
@throws NullPointerException if <code>solution</code> is <code>null</code> | [
"Updates",
"the",
"tabu",
"memory",
"when",
"a",
"custom",
"current",
"/",
"initial",
"solution",
"is",
"set",
".",
"Note",
"that",
"this",
"method",
"may",
"only",
"be",
"called",
"when",
"the",
"search",
"is",
"idle",
"."
] | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/tabu/TabuSearch.java#L154-L160 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java | JdbcControlImpl.invoke | public Object invoke(Method method, Object[] args) throws Throwable {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Enter: invoke()");
}
assert _connection.isClosed() == false : "invoke(): JDBC Connection has been closed!!!!";
return execPreparedStatement(method, args);
} | java | public Object invoke(Method method, Object[] args) throws Throwable {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Enter: invoke()");
}
assert _connection.isClosed() == false : "invoke(): JDBC Connection has been closed!!!!";
return execPreparedStatement(method, args);
} | [
"public",
"Object",
"invoke",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Enter: invoke()\"",
")",
";",
"}",
... | Called by the Controls runtime to handle calls to methods of an extensible control.
@param method The extended operation that was called.
@param args Parameters of the operation.
@return The value that should be returned by the operation.
@throws Throwable any exception declared on the extended operation may be
thrown. If a checked exception is thrown from the implementation that is not declared
on the original interface, it will be wrapped in a ControlException. | [
"Called",
"by",
"the",
"Controls",
"runtime",
"to",
"handle",
"calls",
"to",
"methods",
"of",
"an",
"extensible",
"control",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L217-L224 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java | BaseRecordMessageFilter.linkRemoteSession | public BaseMessageFilter linkRemoteSession(Object remoteSession)
{
if (remoteSession instanceof RemoteSession)
if (remoteSession instanceof RecordOwner) // Always
if (m_source == null)
{
String strTableName = (String)this.getProperties().get(TABLE_NAME);
Record record = (Record)((RecordOwner)remoteSession).getRecord(strTableName);
if (record != null)
{
record.addListener(new SyncRecordMessageFilterHandler(this, true));
m_source = record;
}
}
return super.linkRemoteSession(remoteSession);
} | java | public BaseMessageFilter linkRemoteSession(Object remoteSession)
{
if (remoteSession instanceof RemoteSession)
if (remoteSession instanceof RecordOwner) // Always
if (m_source == null)
{
String strTableName = (String)this.getProperties().get(TABLE_NAME);
Record record = (Record)((RecordOwner)remoteSession).getRecord(strTableName);
if (record != null)
{
record.addListener(new SyncRecordMessageFilterHandler(this, true));
m_source = record;
}
}
return super.linkRemoteSession(remoteSession);
} | [
"public",
"BaseMessageFilter",
"linkRemoteSession",
"(",
"Object",
"remoteSession",
")",
"{",
"if",
"(",
"remoteSession",
"instanceof",
"RemoteSession",
")",
"if",
"(",
"remoteSession",
"instanceof",
"RecordOwner",
")",
"// Always",
"if",
"(",
"m_source",
"==",
"nul... | Link this filter to this remote session.
This is ONLY used in the server (remote) version of a filter.
Override this to finish setting up the filter (such as behavior to adjust this filter).
In this case, the source cannot be passed to the remote session because it is the
record, so the record must be re-linked to this (remote) session. | [
"Link",
"this",
"filter",
"to",
"this",
"remote",
"session",
".",
"This",
"is",
"ONLY",
"used",
"in",
"the",
"server",
"(",
"remote",
")",
"version",
"of",
"a",
"filter",
".",
"Override",
"this",
"to",
"finish",
"setting",
"up",
"the",
"filter",
"(",
"... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java#L177-L192 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java | DocumentUrl.getDocumentUrl | public static MozuUrl getDocumentUrl(String documentId, String documentListName, Boolean includeInactive, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}?includeInactive={includeInactive}&responseFields={responseFields}");
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("includeInactive", includeInactive);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getDocumentUrl(String documentId, String documentListName, Boolean includeInactive, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}?includeInactive={includeInactive}&responseFields={responseFields}");
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("includeInactive", includeInactive);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getDocumentUrl",
"(",
"String",
"documentId",
",",
"String",
"documentListName",
",",
"Boolean",
"includeInactive",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content... | Get Resource Url for GetDocument
@param documentId Unique identifier for a document, used by content and document calls. Document IDs are associated with document types, document type lists, sites, and tenants.
@param documentListName Name of content documentListName to delete
@param includeInactive Include inactive content.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetDocument"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java#L66-L74 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/PropositionCopier.java | PropositionCopier.visit | @Override
public void visit(Constant constant) {
assert this.kh != null : "kh wasn't set";
Constant newConstant = new Constant(propId, this.uniqueIdProvider.getInstance());
newConstant.setSourceSystem(SourceSystem.DERIVED);
newConstant.setCreateDate(new Date());
this.kh.insertLogical(newConstant);
this.derivationsBuilder.propositionAsserted(constant, newConstant);
LOGGER.log(Level.FINER, "Asserted derived proposition {0}", newConstant);
} | java | @Override
public void visit(Constant constant) {
assert this.kh != null : "kh wasn't set";
Constant newConstant = new Constant(propId, this.uniqueIdProvider.getInstance());
newConstant.setSourceSystem(SourceSystem.DERIVED);
newConstant.setCreateDate(new Date());
this.kh.insertLogical(newConstant);
this.derivationsBuilder.propositionAsserted(constant, newConstant);
LOGGER.log(Level.FINER, "Asserted derived proposition {0}", newConstant);
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"Constant",
"constant",
")",
"{",
"assert",
"this",
".",
"kh",
"!=",
"null",
":",
"\"kh wasn't set\"",
";",
"Constant",
"newConstant",
"=",
"new",
"Constant",
"(",
"propId",
",",
"this",
".",
"uniqueIdProvider... | Creates a derived constant with the id specified in the
constructor and the same characteristics (e.g., data source type,
interval, value, etc.).
@param constant a {@link Constant}. Cannot be <code>null</code>. | [
"Creates",
"a",
"derived",
"constant",
"with",
"the",
"id",
"specified",
"in",
"the",
"constructor",
"and",
"the",
"same",
"characteristics",
"(",
"e",
".",
"g",
".",
"data",
"source",
"type",
"interval",
"value",
"etc",
".",
")",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/PropositionCopier.java#L177-L186 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseApplication.java | PhaseApplication.getCommandLineOptions | @Override
public List<Option> getCommandLineOptions() {
final List<Option> ret = new LinkedList<Option>();
String help;
help = TIME_HELP;
ret.add(new Option(SHORT_OPT_TIME, LONG_OPT_TIME, false, help));
help = WARNINGS_AS_ERRORS;
ret.add(new Option(null, LONG_OPT_PEDANTIC, false, help));
help = SYSTEM_CONFIG_PATH;
Option o = new Option(SHRT_OPT_SYSCFG, LONG_OPT_SYSCFG, true, help);
o.setArgName(ARG_SYSCFG);
ret.add(o);
return ret;
} | java | @Override
public List<Option> getCommandLineOptions() {
final List<Option> ret = new LinkedList<Option>();
String help;
help = TIME_HELP;
ret.add(new Option(SHORT_OPT_TIME, LONG_OPT_TIME, false, help));
help = WARNINGS_AS_ERRORS;
ret.add(new Option(null, LONG_OPT_PEDANTIC, false, help));
help = SYSTEM_CONFIG_PATH;
Option o = new Option(SHRT_OPT_SYSCFG, LONG_OPT_SYSCFG, true, help);
o.setArgName(ARG_SYSCFG);
ret.add(o);
return ret;
} | [
"@",
"Override",
"public",
"List",
"<",
"Option",
">",
"getCommandLineOptions",
"(",
")",
"{",
"final",
"List",
"<",
"Option",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"Option",
">",
"(",
")",
";",
"String",
"help",
";",
"help",
"=",
"TIME_HELP",
";"... | Returns a list of phase-agnostic command-line options.
@return List of options | [
"Returns",
"a",
"list",
"of",
"phase",
"-",
"agnostic",
"command",
"-",
"line",
"options",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseApplication.java#L162-L180 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ClearPasswordPlugin.java | ClearPasswordPlugin.process | public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException {
if (password == null || password.isEmpty()) {
out.writeEmptyPacket(sequence.incrementAndGet());
} else {
out.startPacket(sequence.incrementAndGet());
byte[] bytePwd;
if (passwordCharacterEncoding != null && !passwordCharacterEncoding.isEmpty()) {
bytePwd = password.getBytes(passwordCharacterEncoding);
} else {
bytePwd = password.getBytes();
}
out.write(bytePwd);
out.write(0);
out.flush();
}
Buffer buffer = in.getPacket(true);
sequence.set(in.getLastPacketSeq());
return buffer;
} | java | public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException {
if (password == null || password.isEmpty()) {
out.writeEmptyPacket(sequence.incrementAndGet());
} else {
out.startPacket(sequence.incrementAndGet());
byte[] bytePwd;
if (passwordCharacterEncoding != null && !passwordCharacterEncoding.isEmpty()) {
bytePwd = password.getBytes(passwordCharacterEncoding);
} else {
bytePwd = password.getBytes();
}
out.write(bytePwd);
out.write(0);
out.flush();
}
Buffer buffer = in.getPacket(true);
sequence.set(in.getLastPacketSeq());
return buffer;
} | [
"public",
"Buffer",
"process",
"(",
"PacketOutputStream",
"out",
",",
"PacketInputStream",
"in",
",",
"AtomicInteger",
"sequence",
")",
"throws",
"IOException",
"{",
"if",
"(",
"password",
"==",
"null",
"||",
"password",
".",
"isEmpty",
"(",
")",
")",
"{",
"... | Send password in clear text to server.
@param out out stream
@param in in stream
@param sequence packet sequence
@return response packet
@throws IOException if socket error | [
"Send",
"password",
"in",
"clear",
"text",
"to",
"server",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ClearPasswordPlugin.java#L87-L107 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java | HttpUtil.getCharset | public static Charset getCharset(CharSequence contentTypeValue) {
if (contentTypeValue != null) {
return getCharset(contentTypeValue, CharsetUtil.ISO_8859_1);
} else {
return CharsetUtil.ISO_8859_1;
}
} | java | public static Charset getCharset(CharSequence contentTypeValue) {
if (contentTypeValue != null) {
return getCharset(contentTypeValue, CharsetUtil.ISO_8859_1);
} else {
return CharsetUtil.ISO_8859_1;
}
} | [
"public",
"static",
"Charset",
"getCharset",
"(",
"CharSequence",
"contentTypeValue",
")",
"{",
"if",
"(",
"contentTypeValue",
"!=",
"null",
")",
"{",
"return",
"getCharset",
"(",
"contentTypeValue",
",",
"CharsetUtil",
".",
"ISO_8859_1",
")",
";",
"}",
"else",
... | Fetch charset from Content-Type header value.
@param contentTypeValue Content-Type header value to parse
@return the charset from message's Content-Type header or {@link CharsetUtil#ISO_8859_1}
if charset is not presented or unparsable | [
"Fetch",
"charset",
"from",
"Content",
"-",
"Type",
"header",
"value",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L355-L361 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java | DependencyCheckScanAgent.showSummary | public static void showSummary(String projectName, Dependency[] dependencies) {
final StringBuilder summary = new StringBuilder();
for (Dependency d : dependencies) {
final String ids = d.getVulnerabilities(true).stream()
.map(v -> v.getName())
.collect(Collectors.joining(", "));
if (ids.length() > 0) {
summary.append(d.getFileName()).append(" (");
summary.append(Stream.concat(d.getSoftwareIdentifiers().stream(), d.getVulnerableSoftwareIdentifiers().stream())
.map(i -> i.getValue())
.collect(Collectors.joining(", ")));
summary.append(") : ").append(ids).append(NEW_LINE);
}
}
if (summary.length() > 0) {
if (projectName == null || projectName.isEmpty()) {
LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n"
+ "See the dependency-check report for more details.\n\n",
summary.toString());
} else {
LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities in {}:\n\n{}\n\n"
+ "See the dependency-check report for more details.\n\n",
projectName,
summary.toString());
}
}
} | java | public static void showSummary(String projectName, Dependency[] dependencies) {
final StringBuilder summary = new StringBuilder();
for (Dependency d : dependencies) {
final String ids = d.getVulnerabilities(true).stream()
.map(v -> v.getName())
.collect(Collectors.joining(", "));
if (ids.length() > 0) {
summary.append(d.getFileName()).append(" (");
summary.append(Stream.concat(d.getSoftwareIdentifiers().stream(), d.getVulnerableSoftwareIdentifiers().stream())
.map(i -> i.getValue())
.collect(Collectors.joining(", ")));
summary.append(") : ").append(ids).append(NEW_LINE);
}
}
if (summary.length() > 0) {
if (projectName == null || projectName.isEmpty()) {
LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n"
+ "See the dependency-check report for more details.\n\n",
summary.toString());
} else {
LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities in {}:\n\n{}\n\n"
+ "See the dependency-check report for more details.\n\n",
projectName,
summary.toString());
}
}
} | [
"public",
"static",
"void",
"showSummary",
"(",
"String",
"projectName",
",",
"Dependency",
"[",
"]",
"dependencies",
")",
"{",
"final",
"StringBuilder",
"summary",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Dependency",
"d",
":",
"dependencies",... | Generates a warning message listing a summary of dependencies and their
associated CPE and CVE entries.
@param projectName the name of the project
@param dependencies a list of dependency objects | [
"Generates",
"a",
"warning",
"message",
"listing",
"a",
"summary",
"of",
"dependencies",
"and",
"their",
"associated",
"CPE",
"and",
"CVE",
"entries",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java#L1045-L1071 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Double | public JBBPDslBuilder Double(final String name) {
final Item item = new Item(BinType.DOUBLE, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Double(final String name) {
final Item item = new Item(BinType.DOUBLE, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Double",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"DOUBLE",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
... | Add named double field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"double",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1289-L1293 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java | StitchingFromMotion2D.configure | public void configure( int widthStitch, int heightStitch , IT worldToInit ) {
this.worldToInit = (IT)worldToCurr.createInstance();
if( worldToInit != null )
this.worldToInit.set(worldToInit);
this.widthStitch = widthStitch;
this.heightStitch = heightStitch;
} | java | public void configure( int widthStitch, int heightStitch , IT worldToInit ) {
this.worldToInit = (IT)worldToCurr.createInstance();
if( worldToInit != null )
this.worldToInit.set(worldToInit);
this.widthStitch = widthStitch;
this.heightStitch = heightStitch;
} | [
"public",
"void",
"configure",
"(",
"int",
"widthStitch",
",",
"int",
"heightStitch",
",",
"IT",
"worldToInit",
")",
"{",
"this",
".",
"worldToInit",
"=",
"(",
"IT",
")",
"worldToCurr",
".",
"createInstance",
"(",
")",
";",
"if",
"(",
"worldToInit",
"!=",
... | Specifies size of stitch image and the location of the initial coordinate system.
@param widthStitch Width of the image being stitched into
@param heightStitch Height of the image being stitched into
@param worldToInit (Option) Used to change the location of the initial frame in stitched image.
null means no transform. | [
"Specifies",
"size",
"of",
"stitch",
"image",
"and",
"the",
"location",
"of",
"the",
"initial",
"coordinate",
"system",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java#L120-L126 |
geomajas/geomajas-project-client-gwt | plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java | RibbonColumnRegistry.put | public static void put(String key, RibbonColumnCreator ribbonColumnCreator) {
if (null != key && null != ribbonColumnCreator) {
REGISTRY.put(key, ribbonColumnCreator);
}
} | java | public static void put(String key, RibbonColumnCreator ribbonColumnCreator) {
if (null != key && null != ribbonColumnCreator) {
REGISTRY.put(key, ribbonColumnCreator);
}
} | [
"public",
"static",
"void",
"put",
"(",
"String",
"key",
",",
"RibbonColumnCreator",
"ribbonColumnCreator",
")",
"{",
"if",
"(",
"null",
"!=",
"key",
"&&",
"null",
"!=",
"ribbonColumnCreator",
")",
"{",
"REGISTRY",
".",
"put",
"(",
"key",
",",
"ribbonColumnC... | Add another key to the registry. This will overwrite the previous value.
@param key
Unique key for the action within this registry.
@param ribbonColumnCreator
Implementation of the {@link RibbonColumnCreator} interface to link the correct type of ribbon column
widget to the key. | [
"Add",
"another",
"key",
"to",
"the",
"registry",
".",
"This",
"will",
"overwrite",
"the",
"previous",
"value",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java#L132-L136 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java | SessionDataManager.getItemData | public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
if (i == relPathEntries.length - 1)
{
item = getItemData(parent, relPathEntries[i], itemType);
}
else
{
item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
}
if (item == null)
{
break;
}
if (item.isNode())
{
parent = (NodeData)item;
}
else if (i < relPathEntries.length - 1)
{
throw new IllegalPathException("Path can not contains a property as the intermediate element");
}
}
return item;
} | java | public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
if (i == relPathEntries.length - 1)
{
item = getItemData(parent, relPathEntries[i], itemType);
}
else
{
item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
}
if (item == null)
{
break;
}
if (item.isNode())
{
parent = (NodeData)item;
}
else if (i < relPathEntries.length - 1)
{
throw new IllegalPathException("Path can not contains a property as the intermediate element");
}
}
return item;
} | [
"public",
"ItemData",
"getItemData",
"(",
"NodeData",
"parent",
",",
"QPathEntry",
"[",
"]",
"relPathEntries",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
"{",
"ItemData",
"item",
"=",
"parent",
";",
"for",
"(",
"int",
"i",
"=",
"0",
"... | Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.'
it return itself
@param parent
@param relPathEntries
- array of QPathEntry which represents the relation path to the searched item
@param itemType
- item type
@return existed item data or null if not found
@throws RepositoryException | [
"Return",
"item",
"data",
"by",
"parent",
"NodeDada",
"and",
"relPathEntries",
"If",
"relpath",
"is",
"JCRPath",
".",
"THIS_RELPATH",
"=",
".",
"it",
"return",
"itself"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L179-L209 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphGetEdges | public static int cuGraphGetEdges(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numEdges[])
{
return checkResult(cuGraphGetEdgesNative(hGraph, from, to, numEdges));
} | java | public static int cuGraphGetEdges(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numEdges[])
{
return checkResult(cuGraphGetEdgesNative(hGraph, from, to, numEdges));
} | [
"public",
"static",
"int",
"cuGraphGetEdges",
"(",
"CUgraph",
"hGraph",
",",
"CUgraphNode",
"from",
"[",
"]",
",",
"CUgraphNode",
"to",
"[",
"]",
",",
"long",
"numEdges",
"[",
"]",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphGetEdgesNative",
"(",
"hGraph... | Returns a graph's dependency edges.<br>
<br>
Returns a list of \p hGraph's dependency edges. Edges are returned via corresponding
indices in \p from and \p to; that is, the node in \p to[i] has a dependency on the
node in \p from[i]. \p from and \p to may both be NULL, in which
case this function only returns the number of edges in \p numEdges. Otherwise,
\p numEdges entries will be filled in. If \p numEdges is higher than the actual
number of edges, the remaining entries in \p from and \p to will be set to NULL, and
the number of edges actually returned will be written to \p numEdges.
@param hGraph - Graph to get the edges from
@param from - Location to return edge endpoints
@param to - Location to return edge endpoints
@param numEdges - See description
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuGraphGetNodes
JCudaDriver#cuGraphGetRootNodes
JCudaDriver#cuGraphAddDependencies
JCudaDriver#cuGraphRemoveDependencies
JCudaDriver#cuGraphNodeGetDependencies
JCudaDriver#cuGraphNodeGetDependentNodes | [
"Returns",
"a",
"graph",
"s",
"dependency",
"edges",
".",
"<br",
">",
"<br",
">",
"Returns",
"a",
"list",
"of",
"\\",
"p",
"hGraph",
"s",
"dependency",
"edges",
".",
"Edges",
"are",
"returned",
"via",
"corresponding",
"indices",
"in",
"\\",
"p",
"from",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12747-L12750 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java | StylesheetHandler.endElement | public void endElement(String uri, String localName, String rawName)
throws org.xml.sax.SAXException
{
m_elementID--;
if (!m_shouldProcess)
return;
if ((m_elementID + 1) == m_fragmentID)
m_shouldProcess = false;
flushCharacters();
popSpaceHandling();
XSLTElementProcessor p = getCurrentProcessor();
p.endElement(this, uri, localName, rawName);
this.popProcessor();
this.getNamespaceSupport().popContext();
} | java | public void endElement(String uri, String localName, String rawName)
throws org.xml.sax.SAXException
{
m_elementID--;
if (!m_shouldProcess)
return;
if ((m_elementID + 1) == m_fragmentID)
m_shouldProcess = false;
flushCharacters();
popSpaceHandling();
XSLTElementProcessor p = getCurrentProcessor();
p.endElement(this, uri, localName, rawName);
this.popProcessor();
this.getNamespaceSupport().popContext();
} | [
"public",
"void",
"endElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"rawName",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"m_elementID",
"--",
";",
"if",
"(",
"!",
"m_shouldProcess",
")",
"return",
... | Receive notification of the end of an element.
@param uri The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@see org.xml.sax.ContentHandler#endElement
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception. | [
"Receive",
"notification",
"of",
"the",
"end",
"of",
"an",
"element",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L647-L668 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(Reader reader, Writer writer) throws IORuntimeException {
return copy(reader, writer, DEFAULT_BUFFER_SIZE);
} | java | public static long copy(Reader reader, Writer writer) throws IORuntimeException {
return copy(reader, writer, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"long",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | 将Reader中的内容复制到Writer中 使用默认缓存大小
@param reader Reader
@param writer Writer
@return 拷贝的字节数
@throws IORuntimeException IO异常 | [
"将Reader中的内容复制到Writer中",
"使用默认缓存大小"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L73-L75 |
podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.updateProfileField | public <F> void updateProfileField(ProfileField<F, ?> field, F value) {
if (field.isSingle()) {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldSingleValue<F>(value),
MediaType.APPLICATION_JSON_TYPE).put();
} else {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldMultiValue<F>(value),
MediaType.APPLICATION_JSON_TYPE).put();
}
} | java | public <F> void updateProfileField(ProfileField<F, ?> field, F value) {
if (field.isSingle()) {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldSingleValue<F>(value),
MediaType.APPLICATION_JSON_TYPE).put();
} else {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldMultiValue<F>(value),
MediaType.APPLICATION_JSON_TYPE).put();
}
} | [
"public",
"<",
"F",
">",
"void",
"updateProfileField",
"(",
"ProfileField",
"<",
"F",
",",
"?",
">",
"field",
",",
"F",
"value",
")",
"{",
"if",
"(",
"field",
".",
"isSingle",
"(",
")",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
... | Updates a single field on the profile of the user
@param field
The field that should be updated
@param value
The new value of the field | [
"Updates",
"a",
"single",
"field",
"on",
"the",
"profile",
"of",
"the",
"user"
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L98-L110 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java | AbstractProperty.encodeFieldToUdt | public void encodeFieldToUdt(ENTITY entity, UDTValue udtValue) {
encodeFieldToUdt(entity, udtValue, Optional.empty());
} | java | public void encodeFieldToUdt(ENTITY entity, UDTValue udtValue) {
encodeFieldToUdt(entity, udtValue, Optional.empty());
} | [
"public",
"void",
"encodeFieldToUdt",
"(",
"ENTITY",
"entity",
",",
"UDTValue",
"udtValue",
")",
"{",
"encodeFieldToUdt",
"(",
"entity",
",",
"udtValue",
",",
"Optional",
".",
"empty",
"(",
")",
")",
";",
"}"
] | <ol>
<li>First extract all the values from the given entity</li>
<li>Then encode each of the extracted value into CQL-compatible value using Achilles codec system</li>
<li>Finally set the encoded value to the given UDTValue instance</li>
</ol>
@param entity
@param udtValue | [
"<ol",
">",
"<li",
">",
"First",
"extract",
"all",
"the",
"values",
"from",
"the",
"given",
"entity<",
"/",
"li",
">",
"<li",
">",
"Then",
"encode",
"each",
"of",
"the",
"extracted",
"value",
"into",
"CQL",
"-",
"compatible",
"value",
"using",
"Achilles"... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L210-L212 |
jMetal/jMetal | jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/util/MOEADUtils.java | MOEADUtils.quickSort | public static void quickSort(double[] array, int[] idx, int from, int to) {
if (from < to) {
double temp = array[to];
int tempIdx = idx[to];
int i = from - 1;
for (int j = from; j < to; j++) {
if (array[j] <= temp) {
i++;
double tempValue = array[j];
array[j] = array[i];
array[i] = tempValue;
int tempIndex = idx[j];
idx[j] = idx[i];
idx[i] = tempIndex;
}
}
array[to] = array[i + 1];
array[i + 1] = temp;
idx[to] = idx[i + 1];
idx[i + 1] = tempIdx;
quickSort(array, idx, from, i);
quickSort(array, idx, i + 1, to);
}
} | java | public static void quickSort(double[] array, int[] idx, int from, int to) {
if (from < to) {
double temp = array[to];
int tempIdx = idx[to];
int i = from - 1;
for (int j = from; j < to; j++) {
if (array[j] <= temp) {
i++;
double tempValue = array[j];
array[j] = array[i];
array[i] = tempValue;
int tempIndex = idx[j];
idx[j] = idx[i];
idx[i] = tempIndex;
}
}
array[to] = array[i + 1];
array[i + 1] = temp;
idx[to] = idx[i + 1];
idx[i + 1] = tempIdx;
quickSort(array, idx, from, i);
quickSort(array, idx, i + 1, to);
}
} | [
"public",
"static",
"void",
"quickSort",
"(",
"double",
"[",
"]",
"array",
",",
"int",
"[",
"]",
"idx",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"<",
"to",
")",
"{",
"double",
"temp",
"=",
"array",
"[",
"to",
"]",
";",... | Quick sort procedure (ascending order)
@param array
@param idx
@param from
@param to | [
"Quick",
"sort",
"procedure",
"(",
"ascending",
"order",
")"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/util/MOEADUtils.java#L26-L49 |
craftercms/core | src/main/java/org/craftercms/core/processors/impl/template/BeanFactoryModelFactory.java | BeanFactoryModelFactory.getModel | @Override
public Object getModel(Item item, Node node, String template) {
return beanFactory;
} | java | @Override
public Object getModel(Item item, Node node, String template) {
return beanFactory;
} | [
"@",
"Override",
"public",
"Object",
"getModel",
"(",
"Item",
"item",
",",
"Node",
"node",
",",
"String",
"template",
")",
"{",
"return",
"beanFactory",
";",
"}"
] | Returns always the {@link BeanFactory} of the current Spring application context as the model. | [
"Returns",
"always",
"the",
"{"
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/template/BeanFactoryModelFactory.java#L50-L53 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.rotateTo | public Quaternionf rotateTo(float fromDirX, float fromDirY, float fromDirZ, float toDirX, float toDirY, float toDirZ) {
return rotateTo(fromDirX, fromDirY, fromDirZ, toDirX, toDirY, toDirZ, this);
} | java | public Quaternionf rotateTo(float fromDirX, float fromDirY, float fromDirZ, float toDirX, float toDirY, float toDirZ) {
return rotateTo(fromDirX, fromDirY, fromDirZ, toDirX, toDirY, toDirZ, this);
} | [
"public",
"Quaternionf",
"rotateTo",
"(",
"float",
"fromDirX",
",",
"float",
"fromDirY",
",",
"float",
"fromDirZ",
",",
"float",
"toDirX",
",",
"float",
"toDirY",
",",
"float",
"toDirZ",
")",
"{",
"return",
"rotateTo",
"(",
"fromDirX",
",",
"fromDirY",
",",
... | Apply a rotation to <code>this</code> that rotates the <code>fromDir</code> vector to point along <code>toDir</code>.
<p>
Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
<p>
If <code>Q</code> is <code>this</code> quaternion and <code>R</code> the quaternion representing the
specified rotation, then the new quaternion will be <code>Q * R</code>. So when transforming a
vector <code>v</code> with the new quaternion by using <code>Q * R * v</code>, the
rotation added by this method will be applied first!
@see #rotateTo(float, float, float, float, float, float, Quaternionf)
@param fromDirX
the x-coordinate of the direction to rotate into the destination direction
@param fromDirY
the y-coordinate of the direction to rotate into the destination direction
@param fromDirZ
the z-coordinate of the direction to rotate into the destination direction
@param toDirX
the x-coordinate of the direction to rotate to
@param toDirY
the y-coordinate of the direction to rotate to
@param toDirZ
the z-coordinate of the direction to rotate to
@return this | [
"Apply",
"a",
"rotation",
"to",
"<code",
">",
"this<",
"/",
"code",
">",
"that",
"rotates",
"the",
"<code",
">",
"fromDir<",
"/",
"code",
">",
"vector",
"to",
"point",
"along",
"<code",
">",
"toDir<",
"/",
"code",
">",
".",
"<p",
">",
"Since",
"there... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L2324-L2326 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java | ControllerRoute.withBasicAuthentication | public ControllerRoute withBasicAuthentication(String username, String password, String secret) {
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(password, Required.SECRET.toString());
this.username = username;
this.password = password;
this.secret = secret;
return this;
} | java | public ControllerRoute withBasicAuthentication(String username, String password, String secret) {
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(password, Required.SECRET.toString());
this.username = username;
this.password = password;
this.secret = secret;
return this;
} | [
"public",
"ControllerRoute",
"withBasicAuthentication",
"(",
"String",
"username",
",",
"String",
"password",
",",
"String",
"secret",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"username",
",",
"Required",
".",
"USERNAME",
".",
"toString",
"(",
")",
")",
... | Sets Basic HTTP authentication to all method on the given controller class
@param username The username for basic authentication in clear text
@param password The password for basic authentication in clear text
@param secret The secret used for 2FA
@return controller route instance | [
"Sets",
"Basic",
"HTTP",
"authentication",
"to",
"all",
"method",
"on",
"the",
"given",
"controller",
"class"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java#L108-L118 |
stephanenicolas/afterburner | afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java | AfterBurner.beforeOverrideMethod | public void beforeOverrideMethod(CtClass targetClass, String targetMethodName, String body) throws CannotCompileException, AfterBurnerImpossibleException, NotFoundException {
InsertableMethod insertableMethod = new InsertableMethodBuilder(this, signatureExtractor).insertIntoClass(targetClass).beforeOverrideMethod(targetMethodName).withBody(body).createInsertableMethod();
addOrInsertMethod(insertableMethod);
} | java | public void beforeOverrideMethod(CtClass targetClass, String targetMethodName, String body) throws CannotCompileException, AfterBurnerImpossibleException, NotFoundException {
InsertableMethod insertableMethod = new InsertableMethodBuilder(this, signatureExtractor).insertIntoClass(targetClass).beforeOverrideMethod(targetMethodName).withBody(body).createInsertableMethod();
addOrInsertMethod(insertableMethod);
} | [
"public",
"void",
"beforeOverrideMethod",
"(",
"CtClass",
"targetClass",
",",
"String",
"targetMethodName",
",",
"String",
"body",
")",
"throws",
"CannotCompileException",
",",
"AfterBurnerImpossibleException",
",",
"NotFoundException",
"{",
"InsertableMethod",
"insertableM... | Add/Inserts java instructions into a given override method of a given class. Before the overriden method call.
@param targetClass the class to inject code into.
@param targetMethodName the method to inject code into. Body will be injected right before the call to super.<targetName>.
@param body the instructions of java to be injected.
@throws CannotCompileException if the source contained in insertableMethod can't be compiled.
@throws AfterBurnerImpossibleException if something else goes wrong, wraps other exceptions. | [
"Add",
"/",
"Inserts",
"java",
"instructions",
"into",
"a",
"given",
"override",
"method",
"of",
"a",
"given",
"class",
".",
"Before",
"the",
"overriden",
"method",
"call",
"."
] | train | https://github.com/stephanenicolas/afterburner/blob/b126d70e063895b036b6ac47e39e582439f58d12/afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java#L69-L72 |
mozilla/rhino | src/org/mozilla/javascript/IRFactory.java | IRFactory.createLoopNode | private Scope createLoopNode(Node loopLabel, int lineno) {
Scope result = createScopeNode(Token.LOOP, lineno);
if (loopLabel != null) {
((Jump)loopLabel).setLoop(result);
}
return result;
} | java | private Scope createLoopNode(Node loopLabel, int lineno) {
Scope result = createScopeNode(Token.LOOP, lineno);
if (loopLabel != null) {
((Jump)loopLabel).setLoop(result);
}
return result;
} | [
"private",
"Scope",
"createLoopNode",
"(",
"Node",
"loopLabel",
",",
"int",
"lineno",
")",
"{",
"Scope",
"result",
"=",
"createScopeNode",
"(",
"Token",
".",
"LOOP",
",",
"lineno",
")",
";",
"if",
"(",
"loopLabel",
"!=",
"null",
")",
"{",
"(",
"(",
"Ju... | Create loop node. The code generator will later call
createWhile|createDoWhile|createFor|createForIn
to finish loop generation. | [
"Create",
"loop",
"node",
".",
"The",
"code",
"generator",
"will",
"later",
"call",
"createWhile|createDoWhile|createFor|createForIn",
"to",
"finish",
"loop",
"generation",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/IRFactory.java#L1508-L1514 |
wellner/jcarafe | jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeXValidator.java | JarafeXValidator.generateReport | public void generateReport(int numFolds, java.io.File file) {
evaluator.xValidateAndGenerateReport(numFolds, file);
} | java | public void generateReport(int numFolds, java.io.File file) {
evaluator.xValidateAndGenerateReport(numFolds, file);
} | [
"public",
"void",
"generateReport",
"(",
"int",
"numFolds",
",",
"java",
".",
"io",
".",
"File",
"file",
")",
"{",
"evaluator",
".",
"xValidateAndGenerateReport",
"(",
"numFolds",
",",
"file",
")",
";",
"}"
] | /*
@param numFolds - Number of x-validation folds to use
@param file - output file for generated x-validation report | [
"/",
"*"
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeXValidator.java#L27-L29 |
googleads/googleads-java-lib | modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/HttpHandler.java | HttpHandler.createResponseMessage | private Message createResponseMessage(HttpResponse httpResponse) throws IOException, AxisFault {
int statusCode = httpResponse.getStatusCode();
String contentType = httpResponse.getContentType();
// The conditions below duplicate the logic in CommonsHTTPSender and HTTPSender.
boolean shouldParseResponse =
(statusCode > 199 && statusCode < 300)
|| (contentType != null
&& !contentType.equals("text/html")
&& statusCode > 499
&& statusCode < 600);
// Wrap the content input stream in a notifying stream so the stream event listener will be
// notified when it is closed.
InputStream responseInputStream =
new NotifyingInputStream(httpResponse.getContent(), inputStreamEventListener);
if (!shouldParseResponse) {
// The contents are not an XML response, so throw an AxisFault with
// the HTTP status code and message details.
String statusMessage = httpResponse.getStatusMessage();
AxisFault axisFault =
new AxisFault("HTTP", "(" + statusCode + ")" + statusMessage, null, null);
axisFault.addFaultDetail(
Constants.QNAME_FAULTDETAIL_HTTPERRORCODE, String.valueOf(statusCode));
try (InputStream stream = responseInputStream) {
byte[] contentBytes = ByteStreams.toByteArray(stream);
axisFault.setFaultDetailString(
Messages.getMessage(
"return01", String.valueOf(statusCode), new String(contentBytes, UTF_8)));
}
throw axisFault;
}
// Response is an XML response. Do not consume and close the stream in this case, since that
// will happen later when the response is deserialized by Axis (as confirmed by unit tests for
// this class).
Message responseMessage =
new Message(
responseInputStream, false, contentType, httpResponse.getHeaders().getLocation());
responseMessage.setMessageType(Message.RESPONSE);
return responseMessage;
} | java | private Message createResponseMessage(HttpResponse httpResponse) throws IOException, AxisFault {
int statusCode = httpResponse.getStatusCode();
String contentType = httpResponse.getContentType();
// The conditions below duplicate the logic in CommonsHTTPSender and HTTPSender.
boolean shouldParseResponse =
(statusCode > 199 && statusCode < 300)
|| (contentType != null
&& !contentType.equals("text/html")
&& statusCode > 499
&& statusCode < 600);
// Wrap the content input stream in a notifying stream so the stream event listener will be
// notified when it is closed.
InputStream responseInputStream =
new NotifyingInputStream(httpResponse.getContent(), inputStreamEventListener);
if (!shouldParseResponse) {
// The contents are not an XML response, so throw an AxisFault with
// the HTTP status code and message details.
String statusMessage = httpResponse.getStatusMessage();
AxisFault axisFault =
new AxisFault("HTTP", "(" + statusCode + ")" + statusMessage, null, null);
axisFault.addFaultDetail(
Constants.QNAME_FAULTDETAIL_HTTPERRORCODE, String.valueOf(statusCode));
try (InputStream stream = responseInputStream) {
byte[] contentBytes = ByteStreams.toByteArray(stream);
axisFault.setFaultDetailString(
Messages.getMessage(
"return01", String.valueOf(statusCode), new String(contentBytes, UTF_8)));
}
throw axisFault;
}
// Response is an XML response. Do not consume and close the stream in this case, since that
// will happen later when the response is deserialized by Axis (as confirmed by unit tests for
// this class).
Message responseMessage =
new Message(
responseInputStream, false, contentType, httpResponse.getHeaders().getLocation());
responseMessage.setMessageType(Message.RESPONSE);
return responseMessage;
} | [
"private",
"Message",
"createResponseMessage",
"(",
"HttpResponse",
"httpResponse",
")",
"throws",
"IOException",
",",
"AxisFault",
"{",
"int",
"statusCode",
"=",
"httpResponse",
".",
"getStatusCode",
"(",
")",
";",
"String",
"contentType",
"=",
"httpResponse",
".",... | Returns a new Axis Message based on the contents of the HTTP response.
@param httpResponse the HTTP response
@return an Axis Message for the HTTP response
@throws IOException if unable to retrieve the HTTP response's contents
@throws AxisFault if the HTTP response's status or contents indicate an unexpected error, such
as a 405. | [
"Returns",
"a",
"new",
"Axis",
"Message",
"based",
"on",
"the",
"contents",
"of",
"the",
"HTTP",
"response",
"."
] | 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/HttpHandler.java#L190-L228 |
Gant/Gant | src/main/groovy/org/codehaus/gant/ant/Gant.java | Gant.addAlmostAll | private void addAlmostAll(final Project newProject, final Project oldProject) {
final Hashtable<String,Object> properties = oldProject.getProperties();
final Enumeration<String> e = properties.keys();
while (e.hasMoreElements()) {
final String key = e.nextElement();
if (!(MagicNames.PROJECT_BASEDIR.equals(key) || MagicNames.ANT_FILE.equals(key))) {
if (newProject.getProperty(key) == null) { newProject.setNewProperty(key, (String)properties.get(key)); }
}
}
} | java | private void addAlmostAll(final Project newProject, final Project oldProject) {
final Hashtable<String,Object> properties = oldProject.getProperties();
final Enumeration<String> e = properties.keys();
while (e.hasMoreElements()) {
final String key = e.nextElement();
if (!(MagicNames.PROJECT_BASEDIR.equals(key) || MagicNames.ANT_FILE.equals(key))) {
if (newProject.getProperty(key) == null) { newProject.setNewProperty(key, (String)properties.get(key)); }
}
}
} | [
"private",
"void",
"addAlmostAll",
"(",
"final",
"Project",
"newProject",
",",
"final",
"Project",
"oldProject",
")",
"{",
"final",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"oldProject",
".",
"getProperties",
"(",
")",
";",
"final",
... | Russel Winder rehacked the code provided by Eric Van Dewoestine. | [
"Russel",
"Winder",
"rehacked",
"the",
"code",
"provided",
"by",
"Eric",
"Van",
"Dewoestine",
"."
] | train | https://github.com/Gant/Gant/blob/8f82b3cd8968d5595dc44e2beae9f7948172868b/src/main/groovy/org/codehaus/gant/ant/Gant.java#L204-L213 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java | Query.orderedBy | public Query orderedBy( List<Ordering> orderings ) {
return new Query(source, constraint, orderings, columns, getLimits(), distinct);
} | java | public Query orderedBy( List<Ordering> orderings ) {
return new Query(source, constraint, orderings, columns, getLimits(), distinct);
} | [
"public",
"Query",
"orderedBy",
"(",
"List",
"<",
"Ordering",
">",
"orderings",
")",
"{",
"return",
"new",
"Query",
"(",
"source",
",",
"constraint",
",",
"orderings",
",",
"columns",
",",
"getLimits",
"(",
")",
",",
"distinct",
")",
";",
"}"
] | Create a copy of this query, but one whose results should be ordered by the supplied orderings.
@param orderings the result ordering specification that should be used; never null
@return the copy of the query that uses the supplied ordering; never null | [
"Create",
"a",
"copy",
"of",
"this",
"query",
"but",
"one",
"whose",
"results",
"should",
"be",
"ordered",
"by",
"the",
"supplied",
"orderings",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java#L187-L189 |
square/okhttp | okhttp/src/main/java/okhttp3/internal/Util.java | Util.discard | public static boolean discard(Source source, int timeout, TimeUnit timeUnit) {
try {
return skipAll(source, timeout, timeUnit);
} catch (IOException e) {
return false;
}
} | java | public static boolean discard(Source source, int timeout, TimeUnit timeUnit) {
try {
return skipAll(source, timeout, timeUnit);
} catch (IOException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"discard",
"(",
"Source",
"source",
",",
"int",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"try",
"{",
"return",
"skipAll",
"(",
"source",
",",
"timeout",
",",
"timeUnit",
")",
";",
"}",
"catch",
"(",
"IOException",
... | Attempts to exhaust {@code source}, returning true if successful. This is useful when reading a
complete source is helpful, such as when doing so completes a cache body or frees a socket
connection for reuse. | [
"Attempts",
"to",
"exhaust",
"{"
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/Util.java#L161-L167 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_record_POST | public OvhDynHostRecord zone_zoneName_dynHost_record_POST(String zoneName, String ip, String subDomain) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/record";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "subDomain", subDomain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhDynHostRecord.class);
} | java | public OvhDynHostRecord zone_zoneName_dynHost_record_POST(String zoneName, String ip, String subDomain) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/record";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "subDomain", subDomain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhDynHostRecord.class);
} | [
"public",
"OvhDynHostRecord",
"zone_zoneName_dynHost_record_POST",
"(",
"String",
"zoneName",
",",
"String",
"ip",
",",
"String",
"subDomain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/record\"",
";",
"StringBuilder",
"s... | Create a new DynHost record (Don't forget to refresh the zone)
REST: POST /domain/zone/{zoneName}/dynHost/record
@param ip [required] Ip address of the DynHost record
@param subDomain [required] Subdomain of the DynHost record
@param zoneName [required] The internal name of your zone | [
"Create",
"a",
"new",
"DynHost",
"record",
"(",
"Don",
"t",
"forget",
"to",
"refresh",
"the",
"zone",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L380-L388 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.setDateExpired | public void setDateExpired(String resourcename, long dateExpired, boolean recursive) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
setDateExpired(resource, dateExpired, recursive);
} | java | public void setDateExpired(String resourcename, long dateExpired, boolean recursive) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
setDateExpired(resource, dateExpired, recursive);
} | [
"public",
"void",
"setDateExpired",
"(",
"String",
"resourcename",
",",
"long",
"dateExpired",
",",
"boolean",
"recursive",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourcename",
",",
"CmsResourceFilter",
".",
"IGNOR... | Changes the "expire" date of a resource.<p>
@param resourcename the name of the resource to change (full current site relative path)
@param dateExpired the new expire date of the changed resource
@param recursive if this operation is to be applied recursively to all resources in a folder
@throws CmsException if something goes wrong | [
"Changes",
"the",
"expire",
"date",
"of",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3767-L3771 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java | CloudStorageFileSystemProvider.listBuckets | Page<Bucket> listBuckets(Storage.BucketListOption... options) {
initStorage();
return storage.list(options);
} | java | Page<Bucket> listBuckets(Storage.BucketListOption... options) {
initStorage();
return storage.list(options);
} | [
"Page",
"<",
"Bucket",
">",
"listBuckets",
"(",
"Storage",
".",
"BucketListOption",
"...",
"options",
")",
"{",
"initStorage",
"(",
")",
";",
"return",
"storage",
".",
"list",
"(",
"options",
")",
";",
"}"
] | Lists the project's buckets. But use the one in CloudStorageFileSystem.
<p>Example of listing buckets, specifying the page size and a name prefix.
<pre>{@code
String prefix = "bucket_";
Page<Bucket> buckets = provider.listBuckets(BucketListOption.prefix(prefix));
Iterator<Bucket> bucketIterator = buckets.iterateAll();
while (bucketIterator.hasNext()) {
Bucket bucket = bucketIterator.next();
// do something with the bucket
}
}</pre>
@throws StorageException upon failure | [
"Lists",
"the",
"project",
"s",
"buckets",
".",
"But",
"use",
"the",
"one",
"in",
"CloudStorageFileSystem",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L1006-L1009 |
MTDdk/jawn | jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java | ConvertUtil.toDouble | public static Double toDouble(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number) value).doubleValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
return nf.parse(value.toString()).doubleValue();
} catch (ParseException e) {
throw new ConversionException("failed to convert: '" + value + "' to Double", e);
}
}
} | java | public static Double toDouble(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number) value).doubleValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
return nf.parse(value.toString()).doubleValue();
} catch (ParseException e) {
throw new ConversionException("failed to convert: '" + value + "' to Double", e);
}
}
} | [
"public",
"static",
"Double",
"toDouble",
"(",
"Object",
"value",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"return",
"... | Converts any value to <code>Double</code>.
@param value value to convert.
@return converted double.
@throws ConversionException if the conversion failed | [
"Converts",
"any",
"value",
"to",
"<code",
">",
"Double<",
"/",
"code",
">",
".",
"@param",
"value",
"value",
"to",
"convert",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java#L98-L111 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/config/DefaultSqlConfig.java | DefaultSqlConfig.getConfig | public static SqlConfig getConfig(final String url, final String user, final String password) {
return getConfig(url, user, password, null, false, false, null);
} | java | public static SqlConfig getConfig(final String url, final String user, final String password) {
return getConfig(url, user, password, null, false, false, null);
} | [
"public",
"static",
"SqlConfig",
"getConfig",
"(",
"final",
"String",
"url",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"{",
"return",
"getConfig",
"(",
"url",
",",
"user",
",",
"password",
",",
"null",
",",
"false",
",",
"f... | DB接続情報を指定してSqlConfigを取得する
@param url JDBC接続URL
@param user JDBC接続ユーザ
@param password JDBC接続パスワード
@return SqlConfigオブジェクト | [
"DB接続情報を指定してSqlConfigを取得する"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/config/DefaultSqlConfig.java#L109-L111 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java | CodepointHelper.inverseSetContains | public static boolean inverseSetContains (@Nonnull final int [] aCodepointSet, final int value)
{
int nStart = 0;
int nEnd = aCodepointSet.length;
while (nEnd - nStart > 8)
{
final int i = (nEnd + nStart) >>> 1;
nStart = aCodepointSet[i] <= value ? i : nStart;
nEnd = aCodepointSet[i] > value ? i : nEnd;
}
while (nStart < nEnd)
{
if (value < aCodepointSet[nStart])
break;
nStart++;
}
return ((nStart - 1) & 1) == 0;
} | java | public static boolean inverseSetContains (@Nonnull final int [] aCodepointSet, final int value)
{
int nStart = 0;
int nEnd = aCodepointSet.length;
while (nEnd - nStart > 8)
{
final int i = (nEnd + nStart) >>> 1;
nStart = aCodepointSet[i] <= value ? i : nStart;
nEnd = aCodepointSet[i] > value ? i : nEnd;
}
while (nStart < nEnd)
{
if (value < aCodepointSet[nStart])
break;
nStart++;
}
return ((nStart - 1) & 1) == 0;
} | [
"public",
"static",
"boolean",
"inverseSetContains",
"(",
"@",
"Nonnull",
"final",
"int",
"[",
"]",
"aCodepointSet",
",",
"final",
"int",
"value",
")",
"{",
"int",
"nStart",
"=",
"0",
";",
"int",
"nEnd",
"=",
"aCodepointSet",
".",
"length",
";",
"while",
... | Treats the specified int array as an Inversion Set and returns
<code>true</code> if the value is located within the set. This will only
work correctly if the values in the int array are monotonically increasing
@param aCodepointSet
Source set
@param value
Value to check
@return <code>true</code> if the value is located within the set | [
"Treats",
"the",
"specified",
"int",
"array",
"as",
"an",
"Inversion",
"Set",
"and",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"value",
"is",
"located",
"within",
"the",
"set",
".",
"This",
"will",
"only",
"work",
"correctly",
"if"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L464-L481 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.mkEuclideanNormAccumulator | public static MatrixAccumulator mkEuclideanNormAccumulator() {
return new MatrixAccumulator() {
private BigDecimal result = BigDecimal.valueOf(0.0);
@Override
public void update(int i, int j, double value) {
result = result.add(BigDecimal.valueOf(value * value));
}
@Override
public double accumulate() {
double value = result.setScale(Matrices.ROUND_FACTOR, RoundingMode.CEILING).doubleValue();
result = BigDecimal.valueOf(0.0);
return Math.sqrt(value);
}
};
} | java | public static MatrixAccumulator mkEuclideanNormAccumulator() {
return new MatrixAccumulator() {
private BigDecimal result = BigDecimal.valueOf(0.0);
@Override
public void update(int i, int j, double value) {
result = result.add(BigDecimal.valueOf(value * value));
}
@Override
public double accumulate() {
double value = result.setScale(Matrices.ROUND_FACTOR, RoundingMode.CEILING).doubleValue();
result = BigDecimal.valueOf(0.0);
return Math.sqrt(value);
}
};
} | [
"public",
"static",
"MatrixAccumulator",
"mkEuclideanNormAccumulator",
"(",
")",
"{",
"return",
"new",
"MatrixAccumulator",
"(",
")",
"{",
"private",
"BigDecimal",
"result",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"0.0",
")",
";",
"@",
"Override",
"public",
"voi... | Makes an Euclidean norm accumulator that allows to use
{@link org.la4j.Matrix#fold(org.la4j.matrix.functor.MatrixAccumulator)}
method for norm calculation.
@return an Euclidean norm accumulator | [
"Makes",
"an",
"Euclidean",
"norm",
"accumulator",
"that",
"allows",
"to",
"use",
"{",
"@link",
"org",
".",
"la4j",
".",
"Matrix#fold",
"(",
"org",
".",
"la4j",
".",
"matrix",
".",
"functor",
".",
"MatrixAccumulator",
")",
"}",
"method",
"for",
"norm",
"... | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L565-L581 |
nmorel/gwt-jackson | extensions/objectify/src/main/resources/com/github/nmorel/gwtjackson/objectify/super/com/google/appengine/api/datastore/AppIdNamespace.java | AppIdNamespace.parseEncodedAppIdNamespace | public static AppIdNamespace parseEncodedAppIdNamespace( String encodedAppIdNamespace ) {
if ( encodedAppIdNamespace == null ) {
throw new IllegalArgumentException( "appIdNamespaceString may not be null" );
}
int index = encodedAppIdNamespace.indexOf( NamespaceResources.NAMESPACE_SEPARATOR );
if ( index == -1 ) {
return new AppIdNamespace( encodedAppIdNamespace, "" );
}
String appId = encodedAppIdNamespace.substring( 0, index );
String namespace = encodedAppIdNamespace.substring( index + 1 );
if ( namespace.length() == 0 ) {
throw new IllegalArgumentException(
"encodedAppIdNamespace with empty namespace may not contain a '" +
NamespaceResources.NAMESPACE_SEPARATOR + "'" );
}
return new AppIdNamespace( appId, namespace );
} | java | public static AppIdNamespace parseEncodedAppIdNamespace( String encodedAppIdNamespace ) {
if ( encodedAppIdNamespace == null ) {
throw new IllegalArgumentException( "appIdNamespaceString may not be null" );
}
int index = encodedAppIdNamespace.indexOf( NamespaceResources.NAMESPACE_SEPARATOR );
if ( index == -1 ) {
return new AppIdNamespace( encodedAppIdNamespace, "" );
}
String appId = encodedAppIdNamespace.substring( 0, index );
String namespace = encodedAppIdNamespace.substring( index + 1 );
if ( namespace.length() == 0 ) {
throw new IllegalArgumentException(
"encodedAppIdNamespace with empty namespace may not contain a '" +
NamespaceResources.NAMESPACE_SEPARATOR + "'" );
}
return new AppIdNamespace( appId, namespace );
} | [
"public",
"static",
"AppIdNamespace",
"parseEncodedAppIdNamespace",
"(",
"String",
"encodedAppIdNamespace",
")",
"{",
"if",
"(",
"encodedAppIdNamespace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"appIdNamespaceString may not be null\"",
")"... | Converts an encoded appId/namespace to {@link AppIdNamespace}.
<p>
<p>Only one form of an appId/namespace pair will be allowed. i.e. "app!"
is an illegal form and must be encoded as "app".
<p>
<p>An appId/namespace pair may contain at most one "!" character.
@param encodedAppIdNamespace The encoded application Id/namespace string. | [
"Converts",
"an",
"encoded",
"appId",
"/",
"namespace",
"to",
"{",
"@link",
"AppIdNamespace",
"}",
".",
"<p",
">",
"<p",
">",
"Only",
"one",
"form",
"of",
"an",
"appId",
"/",
"namespace",
"pair",
"will",
"be",
"allowed",
".",
"i",
".",
"e",
".",
"app... | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/extensions/objectify/src/main/resources/com/github/nmorel/gwtjackson/objectify/super/com/google/appengine/api/datastore/AppIdNamespace.java#L48-L64 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java | ExceptionFactory.apiDefinitionNotFoundException | public static final ApiDefinitionNotFoundException apiDefinitionNotFoundException(String apiId, String version) {
return new ApiDefinitionNotFoundException(Messages.i18n.format("ApiDefinitionDoesNotExist", apiId, version)); //$NON-NLS-1$
} | java | public static final ApiDefinitionNotFoundException apiDefinitionNotFoundException(String apiId, String version) {
return new ApiDefinitionNotFoundException(Messages.i18n.format("ApiDefinitionDoesNotExist", apiId, version)); //$NON-NLS-1$
} | [
"public",
"static",
"final",
"ApiDefinitionNotFoundException",
"apiDefinitionNotFoundException",
"(",
"String",
"apiId",
",",
"String",
"version",
")",
"{",
"return",
"new",
"ApiDefinitionNotFoundException",
"(",
"Messages",
".",
"i18n",
".",
"format",
"(",
"\"ApiDefini... | Creates an exception from an API id and version.
@param apiId the API id
@param version the API version
@return the exception | [
"Creates",
"an",
"exception",
"from",
"an",
"API",
"id",
"and",
"version",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java#L239-L241 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEManager.java | CmsADEManager.isDetailPage | public boolean isDetailPage(CmsObject cms, CmsResource resource) {
return getCache(isOnline(cms)).isDetailPage(cms, resource);
} | java | public boolean isDetailPage(CmsObject cms, CmsResource resource) {
return getCache(isOnline(cms)).isDetailPage(cms, resource);
} | [
"public",
"boolean",
"isDetailPage",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"return",
"getCache",
"(",
"isOnline",
"(",
"cms",
")",
")",
".",
"isDetailPage",
"(",
"cms",
",",
"resource",
")",
";",
"}"
] | Checks whether the given resource is configured as a detail page.<p>
@param cms the current CMS context
@param resource the resource which should be tested
@return true if the resource is configured as a detail page | [
"Checks",
"whether",
"the",
"given",
"resource",
"is",
"configured",
"as",
"a",
"detail",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1104-L1107 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java | RemoteLockMapImpl.addReader | public boolean addReader(TransactionImpl tx, Object obj)
{
try
{
LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(),
tx.getGUID(),
System.currentTimeMillis(),
LockStrategyFactory.getIsolationLevel(obj),
LockEntry.LOCK_READ);
addReaderRemote(lock);
return true;
}
catch (Throwable t)
{
log.error("Cannot store LockEntry for object " + obj + " in transaction " + tx, t);
return false;
}
} | java | public boolean addReader(TransactionImpl tx, Object obj)
{
try
{
LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(),
tx.getGUID(),
System.currentTimeMillis(),
LockStrategyFactory.getIsolationLevel(obj),
LockEntry.LOCK_READ);
addReaderRemote(lock);
return true;
}
catch (Throwable t)
{
log.error("Cannot store LockEntry for object " + obj + " in transaction " + tx, t);
return false;
}
} | [
"public",
"boolean",
"addReader",
"(",
"TransactionImpl",
"tx",
",",
"Object",
"obj",
")",
"{",
"try",
"{",
"LockEntry",
"lock",
"=",
"new",
"LockEntry",
"(",
"new",
"Identity",
"(",
"obj",
",",
"getBroker",
"(",
")",
")",
".",
"toString",
"(",
")",
",... | Add a reader lock entry for transaction tx on object obj
to the persistent storage. | [
"Add",
"a",
"reader",
"lock",
"entry",
"for",
"transaction",
"tx",
"on",
"object",
"obj",
"to",
"the",
"persistent",
"storage",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L184-L201 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/BitmapOffset.java | BitmapOffset.factorizeFullness | private static String factorizeFullness(long bitmapCardinality, long numRows)
{
if (bitmapCardinality == 0) {
return "0";
} else if (bitmapCardinality == numRows) {
return "1";
} else {
double fullness = bitmapCardinality / (double) numRows;
int index = Arrays.binarySearch(BITMAP_FULLNESS_FACTORIZATION_STOPS, fullness);
if (index < 0) {
index = ~index;
}
return FACTORIZED_FULLNESS[index];
}
} | java | private static String factorizeFullness(long bitmapCardinality, long numRows)
{
if (bitmapCardinality == 0) {
return "0";
} else if (bitmapCardinality == numRows) {
return "1";
} else {
double fullness = bitmapCardinality / (double) numRows;
int index = Arrays.binarySearch(BITMAP_FULLNESS_FACTORIZATION_STOPS, fullness);
if (index < 0) {
index = ~index;
}
return FACTORIZED_FULLNESS[index];
}
} | [
"private",
"static",
"String",
"factorizeFullness",
"(",
"long",
"bitmapCardinality",
",",
"long",
"numRows",
")",
"{",
"if",
"(",
"bitmapCardinality",
"==",
"0",
")",
"{",
"return",
"\"0\"",
";",
"}",
"else",
"if",
"(",
"bitmapCardinality",
"==",
"numRows",
... | Processing of queries with BitmapOffsets, whose Bitmaps has different factorized fullness (bucket), reported from
this method, uses different copies of the same code, so JIT compiler analyzes and compiles the code for different
factorized fullness separately. The goal is to capture frequency of abstraction usage in compressed bitmap
algorithms, i. e.
- "Zero sequence" vs. "Literal" vs. "One sequence" in {@link org.apache.druid.extendedset.intset.ImmutableConciseSet}
- {@link org.roaringbitmap.ArrayContainer} vs {@link org.roaringbitmap.BitmapContainer} in Roaring
and then https://shipilev.net/blog/2015/black-magic-method-dispatch/ comes into play. The secondary goal is to
capture HotSpot's thresholds, which it uses to compile conditional blocks differently inside bitmap impls. See
https://bugs.openjdk.java.net/browse/JDK-6743900. The default BlockLayoutMinDiamondPercentage=20, i. e. if
probability of taking some branch is less than 20%, it is moved out of the hot path (to save some icache?).
On the other hand, we don't want to factor fullness into too small pieces, because
- too little queries may fall into those small buckets, and they are not compiled with Hotspot's C2 compiler
- if there are a lot of queries for each small factorized fullness and their copies of the code is compiled by
C2, this pollutes code cache and takes time to perform too many compilations, while some of them likely produce
identical code.
Ideally there should be as much buckets as possible as long as Hotspot's C2 output for each bucket is different. | [
"Processing",
"of",
"queries",
"with",
"BitmapOffsets",
"whose",
"Bitmaps",
"has",
"different",
"factorized",
"fullness",
"(",
"bucket",
")",
"reported",
"from",
"this",
"method",
"uses",
"different",
"copies",
"of",
"the",
"same",
"code",
"so",
"JIT",
"compiler... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/BitmapOffset.java#L110-L124 |
westnordost/osmapi | src/main/java/de/westnordost/osmapi/notes/NotesDao.java | NotesDao.getAll | public void getAll(BoundingBox bounds, Handler<Note> handler, int limit, int hideClosedNoteAfter)
{
getAll(bounds, null, handler, limit, hideClosedNoteAfter);
} | java | public void getAll(BoundingBox bounds, Handler<Note> handler, int limit, int hideClosedNoteAfter)
{
getAll(bounds, null, handler, limit, hideClosedNoteAfter);
} | [
"public",
"void",
"getAll",
"(",
"BoundingBox",
"bounds",
",",
"Handler",
"<",
"Note",
">",
"handler",
",",
"int",
"limit",
",",
"int",
"hideClosedNoteAfter",
")",
"{",
"getAll",
"(",
"bounds",
",",
"null",
",",
"handler",
",",
"limit",
",",
"hideClosedNot... | Retrieve all notes in the given area and feed them to the given handler.
@see #getAll(BoundingBox, String, Handler, int, int) | [
"Retrieve",
"all",
"notes",
"in",
"the",
"given",
"area",
"and",
"feed",
"them",
"to",
"the",
"given",
"handler",
"."
] | train | https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/notes/NotesDao.java#L172-L175 |
elki-project/elki | elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/HTMLUtil.java | HTMLUtil.writeXHTML | public static void writeXHTML(Document htmldoc, OutputStream out) throws IOException {
javax.xml.transform.Result result = new StreamResult(out);
// Use a transformer for pretty printing
Transformer xformer;
try {
xformer = TransformerFactory.newInstance().newTransformer();
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
// TODO: ensure the "meta" tag doesn't claim a different encoding!
xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
xformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, HTML_XHTML_TRANSITIONAL_DOCTYPE_PUBLIC);
xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, HTML_XHTML_TRANSITIONAL_DOCTYPE_SYSTEM);
xformer.transform(new DOMSource(htmldoc), result);
}
catch(TransformerException e1) {
throw new IOException(e1);
}
out.flush();
} | java | public static void writeXHTML(Document htmldoc, OutputStream out) throws IOException {
javax.xml.transform.Result result = new StreamResult(out);
// Use a transformer for pretty printing
Transformer xformer;
try {
xformer = TransformerFactory.newInstance().newTransformer();
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
// TODO: ensure the "meta" tag doesn't claim a different encoding!
xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
xformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, HTML_XHTML_TRANSITIONAL_DOCTYPE_PUBLIC);
xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, HTML_XHTML_TRANSITIONAL_DOCTYPE_SYSTEM);
xformer.transform(new DOMSource(htmldoc), result);
}
catch(TransformerException e1) {
throw new IOException(e1);
}
out.flush();
} | [
"public",
"static",
"void",
"writeXHTML",
"(",
"Document",
"htmldoc",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"javax",
".",
"xml",
".",
"transform",
".",
"Result",
"result",
"=",
"new",
"StreamResult",
"(",
"out",
")",
";",
"// Use a t... | Write an HTML document to an output stream.
@param htmldoc Document to output
@param out Stream to write to
@throws IOException thrown on IO errors | [
"Write",
"an",
"HTML",
"document",
"to",
"an",
"output",
"stream",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/HTMLUtil.java#L267-L284 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.findAll | @Override
public List<CommerceOrderItem> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceOrderItem> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderItem",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce order items.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce order items
@param end the upper bound of the range of commerce order items (not inclusive)
@return the range of commerce order items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"order",
"items",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L3683-L3686 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.equalsIgnoreOrder | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | java | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | [
"public",
"static",
"boolean",
"equalsIgnoreOrder",
"(",
"Collection",
"<",
"?",
">",
"c1",
",",
"Collection",
"<",
"?",
">",
"c2",
")",
"{",
"return",
"(",
"c1",
"==",
"null",
"&&",
"c2",
"==",
"null",
")",
"||",
"(",
"c1",
"!=",
"null",
"&&",
"c2... | Checks if two collections are equal ignoring the order of components. It's safe to pass collections that might be null.
@param c1 first collection.
@param c2 second collection.
@return True, if both lists are null or if they have exactly the same components. | [
"Checks",
"if",
"two",
"collections",
"are",
"equal",
"ignoring",
"the",
"order",
"of",
"components",
".",
"It",
"s",
"safe",
"to",
"pass",
"collections",
"that",
"might",
"be",
"null",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L728-L730 |
weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java | WeldContainer.startInitialization | static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) {
if (SINGLETON.isSet(id)) {
throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);
}
WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap);
SINGLETON.set(id, weldContainer);
RUNNING_CONTAINER_IDS.add(id);
return weldContainer;
} | java | static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) {
if (SINGLETON.isSet(id)) {
throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);
}
WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap);
SINGLETON.set(id, weldContainer);
RUNNING_CONTAINER_IDS.add(id);
return weldContainer;
} | [
"static",
"WeldContainer",
"startInitialization",
"(",
"String",
"id",
",",
"Deployment",
"deployment",
",",
"Bootstrap",
"bootstrap",
")",
"{",
"if",
"(",
"SINGLETON",
".",
"isSet",
"(",
"id",
")",
")",
"{",
"throw",
"WeldSELogger",
".",
"LOG",
".",
"weldCo... | Start the initialization.
@param id
@param manager
@param bootstrap
@return the initialized Weld container | [
"Start",
"the",
"initialization",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L161-L169 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_senders_POST | public String serviceName_senders_POST(String serviceName, String description, String reason, String sender) throws IOException {
String qPath = "/sms/{serviceName}/senders";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "reason", reason);
addBody(o, "sender", sender);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | java | public String serviceName_senders_POST(String serviceName, String description, String reason, String sender) throws IOException {
String qPath = "/sms/{serviceName}/senders";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "reason", reason);
addBody(o, "sender", sender);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | [
"public",
"String",
"serviceName_senders_POST",
"(",
"String",
"serviceName",
",",
"String",
"description",
",",
"String",
"reason",
",",
"String",
"sender",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/senders\"",
";",
"StringBuild... | Create the sms sender given
REST: POST /sms/{serviceName}/senders
@param description [required] Sender description
@param sender [required] The sender (alpha or phone number)
@param reason [required] Message seen by the moderator
@param serviceName [required] The internal name of your SMS offer | [
"Create",
"the",
"sms",
"sender",
"given"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L164-L173 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java | LinkUtil.getUrl | public static String getUrl(SlingHttpServletRequest request, String url, String extension) {
return getUrl(request, url, null, extension);
} | java | public static String getUrl(SlingHttpServletRequest request, String url, String extension) {
return getUrl(request, url, null, extension);
} | [
"public",
"static",
"String",
"getUrl",
"(",
"SlingHttpServletRequest",
"request",
",",
"String",
"url",
",",
"String",
"extension",
")",
"{",
"return",
"getUrl",
"(",
"request",
",",
"url",
",",
"null",
",",
"extension",
")",
";",
"}"
] | Builds a (mapped) link to a path (resource path) without selectors and with the given extension.
@param request the request context for path mapping (the result is always mapped)
@param url the URL to use (complete) or the path to an addressed resource (without any extension)
@param extension the extension (can be 'null'; should be 'html or '.html' by default)
@return the mapped url for the referenced resource | [
"Builds",
"a",
"(",
"mapped",
")",
"link",
"to",
"a",
"path",
"(",
"resource",
"path",
")",
"without",
"selectors",
"and",
"with",
"the",
"given",
"extension",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java#L88-L90 |
Impetus/Kundera | src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/query/CouchbaseQuery.java | CouchbaseQuery.addWhereCondition | public Statement addWhereCondition(AsPath asPath, String identifier, String colName, String val, String tableName)
{
com.couchbase.client.java.query.dsl.Expression exp;
switch (identifier)
{
case "<":
exp = x(colName).lt(x(val));
break;
case "<=":
exp = x(colName).lte(x(val));
break;
case ">":
exp = x(colName).gt(x(val));
break;
case ">=":
exp = x(colName).gte(x(val));
break;
case "=":
exp = x(colName).eq(x(val));
break;
default:
LOGGER.error("Operator " + identifier + " is not supported in the JPA query for Couchbase.");
throw new KunderaException("Operator " + identifier + " is not supported in the JPA query for Couchbase.");
}
return asPath.where(exp.and(x(CouchbaseConstants.KUNDERA_ENTITY).eq(x("'" + tableName) + "'")));
} | java | public Statement addWhereCondition(AsPath asPath, String identifier, String colName, String val, String tableName)
{
com.couchbase.client.java.query.dsl.Expression exp;
switch (identifier)
{
case "<":
exp = x(colName).lt(x(val));
break;
case "<=":
exp = x(colName).lte(x(val));
break;
case ">":
exp = x(colName).gt(x(val));
break;
case ">=":
exp = x(colName).gte(x(val));
break;
case "=":
exp = x(colName).eq(x(val));
break;
default:
LOGGER.error("Operator " + identifier + " is not supported in the JPA query for Couchbase.");
throw new KunderaException("Operator " + identifier + " is not supported in the JPA query for Couchbase.");
}
return asPath.where(exp.and(x(CouchbaseConstants.KUNDERA_ENTITY).eq(x("'" + tableName) + "'")));
} | [
"public",
"Statement",
"addWhereCondition",
"(",
"AsPath",
"asPath",
",",
"String",
"identifier",
",",
"String",
"colName",
",",
"String",
"val",
",",
"String",
"tableName",
")",
"{",
"com",
".",
"couchbase",
".",
"client",
".",
"java",
".",
"query",
".",
... | Adds the where condition.
@param asPath
the as path
@param identifier
the identifier
@param colName
the col name
@param val
the val
@param tableName
the table name
@return the statement | [
"Adds",
"the",
"where",
"condition",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/query/CouchbaseQuery.java#L157-L184 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DescribeReservationResult.java | DescribeReservationResult.withTags | public DescribeReservationResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public DescribeReservationResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"DescribeReservationResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs
@param tags
A collection of key-value pairs
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DescribeReservationResult.java#L688-L691 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static void generate(String content, int width, int height, String imageType, OutputStream out) {
final BufferedImage image = generate(content, width, height);
ImgUtil.write(image, imageType, out);
} | java | public static void generate(String content, int width, int height, String imageType, OutputStream out) {
final BufferedImage image = generate(content, width, height);
ImgUtil.write(image, imageType, out);
} | [
"public",
"static",
"void",
"generate",
"(",
"String",
"content",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"imageType",
",",
"OutputStream",
"out",
")",
"{",
"final",
"BufferedImage",
"image",
"=",
"generate",
"(",
"content",
",",
"width",
... | 生成二维码到输出流
@param content 文本内容
@param width 宽度
@param height 高度
@param imageType 图片类型(图片扩展名),见{@link ImgUtil}
@param out 目标流 | [
"生成二维码到输出流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L106-L109 |
lucee/Lucee | core/src/main/java/lucee/runtime/db/Executer.java | Executer.executeConstant | private Object executeConstant(SQL sql, Query qr, ZConstant constant, int row) throws PageException {
switch (constant.getType()) {
case ZConstant.COLUMNNAME: {
if (constant.getValue().equals(SQLPrettyfier.PLACEHOLDER_QUESTION)) {
int pos = sql.getPosition();
sql.setPosition(pos + 1);
if (sql.getItems().length <= pos) throw new DatabaseException("invalid syntax for SQL Statement", null, sql, null);
return sql.getItems()[pos].getValueForCF();
}
return qr.getAt(ListUtil.last(constant.getValue(), ".", true), row);
}
case ZConstant.NULL:
return null;
case ZConstant.NUMBER:
return Caster.toDouble(constant.getValue());
case ZConstant.STRING:
return constant.getValue();
case ZConstant.UNKNOWN:
default:
throw new DatabaseException("invalid constant value", null, sql, null);
}
} | java | private Object executeConstant(SQL sql, Query qr, ZConstant constant, int row) throws PageException {
switch (constant.getType()) {
case ZConstant.COLUMNNAME: {
if (constant.getValue().equals(SQLPrettyfier.PLACEHOLDER_QUESTION)) {
int pos = sql.getPosition();
sql.setPosition(pos + 1);
if (sql.getItems().length <= pos) throw new DatabaseException("invalid syntax for SQL Statement", null, sql, null);
return sql.getItems()[pos].getValueForCF();
}
return qr.getAt(ListUtil.last(constant.getValue(), ".", true), row);
}
case ZConstant.NULL:
return null;
case ZConstant.NUMBER:
return Caster.toDouble(constant.getValue());
case ZConstant.STRING:
return constant.getValue();
case ZConstant.UNKNOWN:
default:
throw new DatabaseException("invalid constant value", null, sql, null);
}
} | [
"private",
"Object",
"executeConstant",
"(",
"SQL",
"sql",
",",
"Query",
"qr",
",",
"ZConstant",
"constant",
",",
"int",
"row",
")",
"throws",
"PageException",
"{",
"switch",
"(",
"constant",
".",
"getType",
"(",
")",
")",
"{",
"case",
"ZConstant",
".",
... | Executes a constant value
@param sql
@param qr
@param constant
@param row
@return result
@throws PageException | [
"Executes",
"a",
"constant",
"value"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/db/Executer.java#L707-L728 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibLink.java | ClientlibLink.getUrl | public String getUrl(SlingHttpServletRequest request, RendererContext context) {
String uri;
switch (kind) {
case FILE: // we can only refer to that exact resource.
uri = path;
break;
case CLIENTLIB:
uri = ClientlibServlet.makePath(path, type, context.useMinifiedFiles(), hash);
break;
case CATEGORY:
uri = ClientlibCategoryServlet.makePath(path, type, context.useMinifiedFiles(), hash);
break;
case EXTERNALURI:
uri = path;
break;
default:
throw new UnsupportedOperationException("Bug - impossible.");
}
String url;
if (context.mapClientlibURLs()) {
url = LinkUtil.getUrl(request, uri);
} else {
url = LinkUtil.getUnmappedUrl(request, uri);
}
return url;
} | java | public String getUrl(SlingHttpServletRequest request, RendererContext context) {
String uri;
switch (kind) {
case FILE: // we can only refer to that exact resource.
uri = path;
break;
case CLIENTLIB:
uri = ClientlibServlet.makePath(path, type, context.useMinifiedFiles(), hash);
break;
case CATEGORY:
uri = ClientlibCategoryServlet.makePath(path, type, context.useMinifiedFiles(), hash);
break;
case EXTERNALURI:
uri = path;
break;
default:
throw new UnsupportedOperationException("Bug - impossible.");
}
String url;
if (context.mapClientlibURLs()) {
url = LinkUtil.getUrl(request, uri);
} else {
url = LinkUtil.getUnmappedUrl(request, uri);
}
return url;
} | [
"public",
"String",
"getUrl",
"(",
"SlingHttpServletRequest",
"request",
",",
"RendererContext",
"context",
")",
"{",
"String",
"uri",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"FILE",
":",
"// we can only refer to that exact resource.",
"uri",
"=",
"path",
";... | Determines the URL we render into the page. We don't want to access resources here, so at least for files we need
already to know the exact path with .min or not.
<p>
Cases: <ul> <li>Clientlib category: refers to the {@link com.composum.sling.clientlibs.servlet.ClientlibCategoryServlet},
parameterized by type and minified according to {@link RendererContext#useMinifiedFiles()}. </li> <li>Clientlib:
path to the client library plus minified and type.</li> <li>File:</li> </ul>
@param request the request
@param context the context
@return the url | [
"Determines",
"the",
"URL",
"we",
"render",
"into",
"the",
"page",
".",
"We",
"don",
"t",
"want",
"to",
"access",
"resources",
"here",
"so",
"at",
"least",
"for",
"files",
"we",
"need",
"already",
"to",
"know",
"the",
"exact",
"path",
"with",
".",
"min... | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibLink.java#L168-L193 |
apache/groovy | subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java | PositionConfigureUtils.configureAST | public static <T extends ASTNode> T configureAST(T astNode, GroovyParser.GroovyParserRuleContext ctx) {
Token start = ctx.getStart();
Token stop = ctx.getStop();
astNode.setLineNumber(start.getLine());
astNode.setColumnNumber(start.getCharPositionInLine() + 1);
configureEndPosition(astNode, stop);
return astNode;
} | java | public static <T extends ASTNode> T configureAST(T astNode, GroovyParser.GroovyParserRuleContext ctx) {
Token start = ctx.getStart();
Token stop = ctx.getStop();
astNode.setLineNumber(start.getLine());
astNode.setColumnNumber(start.getCharPositionInLine() + 1);
configureEndPosition(astNode, stop);
return astNode;
} | [
"public",
"static",
"<",
"T",
"extends",
"ASTNode",
">",
"T",
"configureAST",
"(",
"T",
"astNode",
",",
"GroovyParser",
".",
"GroovyParserRuleContext",
"ctx",
")",
"{",
"Token",
"start",
"=",
"ctx",
".",
"getStart",
"(",
")",
";",
"Token",
"stop",
"=",
"... | Sets location(lineNumber, colNumber, lastLineNumber, lastColumnNumber) for node using standard context information.
Note: this method is implemented to be closed over ASTNode. It returns same node as it received in arguments.
@param astNode Node to be modified.
@param ctx Context from which information is obtained.
@return Modified astNode. | [
"Sets",
"location",
"(",
"lineNumber",
"colNumber",
"lastLineNumber",
"lastColumnNumber",
")",
"for",
"node",
"using",
"standard",
"context",
"information",
".",
"Note",
":",
"this",
"method",
"is",
"implemented",
"to",
"be",
"closed",
"over",
"ASTNode",
".",
"I... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java#L42-L52 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForSubscriptionLevelPolicyAssignment | public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | java | public PolicyEventsQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyEventsQueryResultsInner",
"listQueryResultsForSubscriptionLevelPolicyAssignment",
"(",
"String",
"subscriptionId",
",",
"String",
"policyAssignmentName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForSubscriptionLevelPolicyAssignmentWithS... | Queries policy events for the subscription level policy assignment.
@param subscriptionId Microsoft Azure subscription ID.
@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 PolicyEventsQueryResultsInner object if successful. | [
"Queries",
"policy",
"events",
"for",
"the",
"subscription",
"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/PolicyEventsInner.java#L1369-L1371 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java | PersistentFieldBase.getFieldRecursive | private Field getFieldRecursive(Class c, String name) throws NoSuchFieldException
{
try
{
return c.getDeclaredField(name);
}
catch (NoSuchFieldException e)
{
// if field could not be found in the inheritance hierarchy, signal error
if ((c == Object.class) || (c.getSuperclass() == null) || c.isInterface())
{
throw e;
}
// if field could not be found in class c try in superclass
else
{
return getFieldRecursive(c.getSuperclass(), name);
}
}
} | java | private Field getFieldRecursive(Class c, String name) throws NoSuchFieldException
{
try
{
return c.getDeclaredField(name);
}
catch (NoSuchFieldException e)
{
// if field could not be found in the inheritance hierarchy, signal error
if ((c == Object.class) || (c.getSuperclass() == null) || c.isInterface())
{
throw e;
}
// if field could not be found in class c try in superclass
else
{
return getFieldRecursive(c.getSuperclass(), name);
}
}
} | [
"private",
"Field",
"getFieldRecursive",
"(",
"Class",
"c",
",",
"String",
"name",
")",
"throws",
"NoSuchFieldException",
"{",
"try",
"{",
"return",
"c",
".",
"getDeclaredField",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{"... | try to find a field in class c, recurse through class hierarchy if necessary
@throws NoSuchFieldException if no Field was found into the class hierarchy | [
"try",
"to",
"find",
"a",
"field",
"in",
"class",
"c",
"recurse",
"through",
"class",
"hierarchy",
"if",
"necessary"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java#L113-L132 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/MultipartPostRequest.java | MultipartPostRequest.setParameter | public void setParameter(final String name, final String filename, final InputStream is) throws IOException {
boundary();
writeName(name);
write("; filename=\"");
write(filename);
write('"');
newline();
write("Content-Type: ");
String type = URLConnection.guessContentTypeFromName(filename);
if (type == null) {
type = "application/octet-stream";
}
writeln(type);
newline();
pipe(is, os);
newline();
} | java | public void setParameter(final String name, final String filename, final InputStream is) throws IOException {
boundary();
writeName(name);
write("; filename=\"");
write(filename);
write('"');
newline();
write("Content-Type: ");
String type = URLConnection.guessContentTypeFromName(filename);
if (type == null) {
type = "application/octet-stream";
}
writeln(type);
newline();
pipe(is, os);
newline();
} | [
"public",
"void",
"setParameter",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"filename",
",",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"boundary",
"(",
")",
";",
"writeName",
"(",
"name",
")",
";",
"write",
"(",
"\"; fi... | Adds a file parameter to the request
@param name
parameter name
@param filename
the name of the file
@param is
input stream to read the contents of the file from | [
"Adds",
"a",
"file",
"parameter",
"to",
"the",
"request"
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/MultipartPostRequest.java#L115-L131 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/link/LinkUtils.java | LinkUtils.newExternalLink | public static ExternalLink newExternalLink(final String linkId, final String url,
final String labelId, final ResourceBundleKey resourceBundleKey, final Component component)
{
final ExternalLink externalLink = new ExternalLink(linkId, Model.of(url));
externalLink.add(new Label(labelId,
ResourceModelFactory.newResourceModel(resourceBundleKey, component)));
return externalLink;
} | java | public static ExternalLink newExternalLink(final String linkId, final String url,
final String labelId, final ResourceBundleKey resourceBundleKey, final Component component)
{
final ExternalLink externalLink = new ExternalLink(linkId, Model.of(url));
externalLink.add(new Label(labelId,
ResourceModelFactory.newResourceModel(resourceBundleKey, component)));
return externalLink;
} | [
"public",
"static",
"ExternalLink",
"newExternalLink",
"(",
"final",
"String",
"linkId",
",",
"final",
"String",
"url",
",",
"final",
"String",
"labelId",
",",
"final",
"ResourceBundleKey",
"resourceBundleKey",
",",
"final",
"Component",
"component",
")",
"{",
"fi... | Creates an external link from the given parameters.
@param linkId
the link id
@param url
the external url
@param labelId
the label id
@param resourceBundleKey
the resource model key
@param component
the component
@return the external link | [
"Creates",
"an",
"external",
"link",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/link/LinkUtils.java#L154-L161 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/uri/ContentUriChecker.java | ContentUriChecker.analyzePathInternal | private <L extends UriBaseListener> void analyzePathInternal(final String input, L listener) {
pathSegmentIndex = -1;
walker.walk(listener, preparePath(input).value0);
} | java | private <L extends UriBaseListener> void analyzePathInternal(final String input, L listener) {
pathSegmentIndex = -1;
walker.walk(listener, preparePath(input).value0);
} | [
"private",
"<",
"L",
"extends",
"UriBaseListener",
">",
"void",
"analyzePathInternal",
"(",
"final",
"String",
"input",
",",
"L",
"listener",
")",
"{",
"pathSegmentIndex",
"=",
"-",
"1",
";",
"walker",
".",
"walk",
"(",
"listener",
",",
"preparePath",
"(",
... | Analyze path internal.
@param <L> the generic type
@param input the input
@param listener the listener | [
"Analyze",
"path",
"internal",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/uri/ContentUriChecker.java#L122-L125 |
reactor/reactor-netty | src/main/java/reactor/netty/http/client/HttpClient.java | HttpClient.cookieCodec | public final HttpClient cookieCodec(ClientCookieEncoder encoder, ClientCookieDecoder decoder) {
return tcpConfiguration(tcp -> tcp.bootstrap(
b -> HttpClientConfiguration.cookieCodec(b, encoder, decoder)));
} | java | public final HttpClient cookieCodec(ClientCookieEncoder encoder, ClientCookieDecoder decoder) {
return tcpConfiguration(tcp -> tcp.bootstrap(
b -> HttpClientConfiguration.cookieCodec(b, encoder, decoder)));
} | [
"public",
"final",
"HttpClient",
"cookieCodec",
"(",
"ClientCookieEncoder",
"encoder",
",",
"ClientCookieDecoder",
"decoder",
")",
"{",
"return",
"tcpConfiguration",
"(",
"tcp",
"->",
"tcp",
".",
"bootstrap",
"(",
"b",
"->",
"HttpClientConfiguration",
".",
"cookieCo... | Configure the
{@link ClientCookieEncoder} and {@link ClientCookieDecoder}
@param encoder the preferred ClientCookieEncoder
@param decoder the preferred ClientCookieDecoder
@return a new {@link HttpClient} | [
"Configure",
"the",
"{",
"@link",
"ClientCookieEncoder",
"}",
"and",
"{",
"@link",
"ClientCookieDecoder",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L474-L477 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.