repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
amzn/ion-java | src/com/amazon/ion/impl/bin/WriteBuffer.java | WriteBuffer.writeBytesSlow | private void writeBytesSlow(final byte[] bytes, int off, int len) {
"""
slow in the sense that we do all kind of block boundary checking
"""
while (len > 0)
{
final Block block = current;
final int amount = Math.min(len, block.remaining());
System.arraycopy(bytes, off, block.data, block.limit, amount);
block.limit += amount;
off += amount;
len -= amount;
if (block.remaining() == 0)
{
if (index == blocks.size() - 1)
{
allocateNewBlock();
}
index++;
current = blocks.get(index);
}
}
} | java | private void writeBytesSlow(final byte[] bytes, int off, int len)
{
while (len > 0)
{
final Block block = current;
final int amount = Math.min(len, block.remaining());
System.arraycopy(bytes, off, block.data, block.limit, amount);
block.limit += amount;
off += amount;
len -= amount;
if (block.remaining() == 0)
{
if (index == blocks.size() - 1)
{
allocateNewBlock();
}
index++;
current = blocks.get(index);
}
}
} | [
"private",
"void",
"writeBytesSlow",
"(",
"final",
"byte",
"[",
"]",
"bytes",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"while",
"(",
"len",
">",
"0",
")",
"{",
"final",
"Block",
"block",
"=",
"current",
";",
"final",
"int",
"amount",
"=",
"Math",
".",
"min",
"(",
"len",
",",
"block",
".",
"remaining",
"(",
")",
")",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"off",
",",
"block",
".",
"data",
",",
"block",
".",
"limit",
",",
"amount",
")",
";",
"block",
".",
"limit",
"+=",
"amount",
";",
"off",
"+=",
"amount",
";",
"len",
"-=",
"amount",
";",
"if",
"(",
"block",
".",
"remaining",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"index",
"==",
"blocks",
".",
"size",
"(",
")",
"-",
"1",
")",
"{",
"allocateNewBlock",
"(",
")",
";",
"}",
"index",
"++",
";",
"current",
"=",
"blocks",
".",
"get",
"(",
"index",
")",
";",
"}",
"}",
"}"
] | slow in the sense that we do all kind of block boundary checking | [
"slow",
"in",
"the",
"sense",
"that",
"we",
"do",
"all",
"kind",
"of",
"block",
"boundary",
"checking"
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/WriteBuffer.java#L136-L157 |
unic/neba | core/src/main/java/io/neba/core/resourcemodels/registration/ModelRegistry.java | ModelRegistry.resolveModelSources | private Collection<LookupResult> resolveModelSources(Resource resource, Class<?> compatibleType, boolean resolveMostSpecific) {
"""
Finds all {@link OsgiModelSource model sources} representing models for the given
{@link Resource}.
@param resource must not be <code>null</code>.
@param compatibleType can be <code>null</code>. If provided, only models
compatible to the given type are returned.
@param resolveMostSpecific whether to resolve only the most specific models.
@return never <code>null</code> but rather an empty collection.
"""
Collection<LookupResult> sources = new ArrayList<>(64);
for (final String resourceType : mappableTypeHierarchyOf(resource)) {
Collection<OsgiModelSource<?>> allSourcesForType = this.typeNameToModelSourcesMap.get(resourceType);
Collection<OsgiModelSource<?>> sourcesForCompatibleType = filter(allSourcesForType, compatibleType);
if (sourcesForCompatibleType != null && !sourcesForCompatibleType.isEmpty()) {
sources.addAll(sourcesForCompatibleType.stream().map(source -> new LookupResult(source, resourceType)).collect(Collectors.toList()));
if (resolveMostSpecific) {
break;
}
}
}
return unmodifiableCollection(sources);
} | java | private Collection<LookupResult> resolveModelSources(Resource resource, Class<?> compatibleType, boolean resolveMostSpecific) {
Collection<LookupResult> sources = new ArrayList<>(64);
for (final String resourceType : mappableTypeHierarchyOf(resource)) {
Collection<OsgiModelSource<?>> allSourcesForType = this.typeNameToModelSourcesMap.get(resourceType);
Collection<OsgiModelSource<?>> sourcesForCompatibleType = filter(allSourcesForType, compatibleType);
if (sourcesForCompatibleType != null && !sourcesForCompatibleType.isEmpty()) {
sources.addAll(sourcesForCompatibleType.stream().map(source -> new LookupResult(source, resourceType)).collect(Collectors.toList()));
if (resolveMostSpecific) {
break;
}
}
}
return unmodifiableCollection(sources);
} | [
"private",
"Collection",
"<",
"LookupResult",
">",
"resolveModelSources",
"(",
"Resource",
"resource",
",",
"Class",
"<",
"?",
">",
"compatibleType",
",",
"boolean",
"resolveMostSpecific",
")",
"{",
"Collection",
"<",
"LookupResult",
">",
"sources",
"=",
"new",
"ArrayList",
"<>",
"(",
"64",
")",
";",
"for",
"(",
"final",
"String",
"resourceType",
":",
"mappableTypeHierarchyOf",
"(",
"resource",
")",
")",
"{",
"Collection",
"<",
"OsgiModelSource",
"<",
"?",
">",
">",
"allSourcesForType",
"=",
"this",
".",
"typeNameToModelSourcesMap",
".",
"get",
"(",
"resourceType",
")",
";",
"Collection",
"<",
"OsgiModelSource",
"<",
"?",
">",
">",
"sourcesForCompatibleType",
"=",
"filter",
"(",
"allSourcesForType",
",",
"compatibleType",
")",
";",
"if",
"(",
"sourcesForCompatibleType",
"!=",
"null",
"&&",
"!",
"sourcesForCompatibleType",
".",
"isEmpty",
"(",
")",
")",
"{",
"sources",
".",
"addAll",
"(",
"sourcesForCompatibleType",
".",
"stream",
"(",
")",
".",
"map",
"(",
"source",
"->",
"new",
"LookupResult",
"(",
"source",
",",
"resourceType",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"if",
"(",
"resolveMostSpecific",
")",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"unmodifiableCollection",
"(",
"sources",
")",
";",
"}"
] | Finds all {@link OsgiModelSource model sources} representing models for the given
{@link Resource}.
@param resource must not be <code>null</code>.
@param compatibleType can be <code>null</code>. If provided, only models
compatible to the given type are returned.
@param resolveMostSpecific whether to resolve only the most specific models.
@return never <code>null</code> but rather an empty collection. | [
"Finds",
"all",
"{",
"@link",
"OsgiModelSource",
"model",
"sources",
"}",
"representing",
"models",
"for",
"the",
"given",
"{",
"@link",
"Resource",
"}",
"."
] | train | https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/registration/ModelRegistry.java#L404-L417 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java | ImplicitObjectUtil.loadPageFlow | public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
"""
Load Page Flow related implicit objects into the request. This method will set the
Page Flow itself and any available page inputs into the request.
@param request the request
@param pageFlow the current page flow
"""
if(pageFlow != null)
request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);
Map map = InternalUtils.getPageInputMap(request);
request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
} | java | public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
if(pageFlow != null)
request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);
Map map = InternalUtils.getPageInputMap(request);
request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
} | [
"public",
"static",
"void",
"loadPageFlow",
"(",
"ServletRequest",
"request",
",",
"PageFlowController",
"pageFlow",
")",
"{",
"if",
"(",
"pageFlow",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"PAGE_FLOW_IMPLICIT_OBJECT_KEY",
",",
"pageFlow",
")",
";",
"Map",
"map",
"=",
"InternalUtils",
".",
"getPageInputMap",
"(",
"request",
")",
";",
"request",
".",
"setAttribute",
"(",
"PAGE_INPUT_IMPLICIT_OBJECT_KEY",
",",
"map",
"!=",
"null",
"?",
"map",
":",
"Collections",
".",
"EMPTY_MAP",
")",
";",
"}"
] | Load Page Flow related implicit objects into the request. This method will set the
Page Flow itself and any available page inputs into the request.
@param request the request
@param pageFlow the current page flow | [
"Load",
"Page",
"Flow",
"related",
"implicit",
"objects",
"into",
"the",
"request",
".",
"This",
"method",
"will",
"set",
"the",
"Page",
"Flow",
"itself",
"and",
"any",
"available",
"page",
"inputs",
"into",
"the",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L105-L111 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/wiringpi/GpioInterrupt.java | GpioInterrupt.pinStateChangeCallback | @SuppressWarnings("unchecked")
private static void pinStateChangeCallback(int pin, boolean state) {
"""
<p>
This method is provided as the callback handler for the Pi4J native library to invoke when a
GPIO interrupt is detected. This method should not be called from any Java consumers. (Thus
is is marked as a private method.)
</p>
@param pin GPIO pin number (not header pin number; not wiringPi pin number)
@param state New GPIO pin state.
"""
Vector<GpioInterruptListener> listenersClone;
listenersClone = (Vector<GpioInterruptListener>) listeners.clone();
for (int i = 0; i < listenersClone.size(); i++) {
GpioInterruptListener listener = listenersClone.elementAt(i);
if(listener != null) {
GpioInterruptEvent event = new GpioInterruptEvent(listener, pin, state);
listener.pinStateChange(event);
}
}
//System.out.println("GPIO PIN [" + pin + "] = " + state);
} | java | @SuppressWarnings("unchecked")
private static void pinStateChangeCallback(int pin, boolean state) {
Vector<GpioInterruptListener> listenersClone;
listenersClone = (Vector<GpioInterruptListener>) listeners.clone();
for (int i = 0; i < listenersClone.size(); i++) {
GpioInterruptListener listener = listenersClone.elementAt(i);
if(listener != null) {
GpioInterruptEvent event = new GpioInterruptEvent(listener, pin, state);
listener.pinStateChange(event);
}
}
//System.out.println("GPIO PIN [" + pin + "] = " + state);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"pinStateChangeCallback",
"(",
"int",
"pin",
",",
"boolean",
"state",
")",
"{",
"Vector",
"<",
"GpioInterruptListener",
">",
"listenersClone",
";",
"listenersClone",
"=",
"(",
"Vector",
"<",
"GpioInterruptListener",
">",
")",
"listeners",
".",
"clone",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listenersClone",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"GpioInterruptListener",
"listener",
"=",
"listenersClone",
".",
"elementAt",
"(",
"i",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"GpioInterruptEvent",
"event",
"=",
"new",
"GpioInterruptEvent",
"(",
"listener",
",",
"pin",
",",
"state",
")",
";",
"listener",
".",
"pinStateChange",
"(",
"event",
")",
";",
"}",
"}",
"//System.out.println(\"GPIO PIN [\" + pin + \"] = \" + state);",
"}"
] | <p>
This method is provided as the callback handler for the Pi4J native library to invoke when a
GPIO interrupt is detected. This method should not be called from any Java consumers. (Thus
is is marked as a private method.)
</p>
@param pin GPIO pin number (not header pin number; not wiringPi pin number)
@param state New GPIO pin state. | [
"<p",
">",
"This",
"method",
"is",
"provided",
"as",
"the",
"callback",
"handler",
"for",
"the",
"Pi4J",
"native",
"library",
"to",
"invoke",
"when",
"a",
"GPIO",
"interrupt",
"is",
"detected",
".",
"This",
"method",
"should",
"not",
"be",
"called",
"from",
"any",
"Java",
"consumers",
".",
"(",
"Thus",
"is",
"is",
"marked",
"as",
"a",
"private",
"method",
".",
")",
"<",
"/",
"p",
">"
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/wiringpi/GpioInterrupt.java#L118-L133 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/PTSaxton2006.java | PTSaxton2006.calcAdjustedDensity | public static String calcAdjustedDensity(String slsnd, String slcly, String omPct, String df) {
"""
Equation 7 for calculating Adjusted density, g/cm-3
@param slsnd Sand weight percentage by layer ([0,100]%)
@param slcly Clay weight percentage by layer ([0,100]%)
@param omPct Organic matter weight percentage by layer ([0,100]%), (=
SLOC * 1.72)
@param df Density adjustment Factor (0.9–1.3)
"""
if (compare(df, "0.9", CompareMode.NOTLESS) && compare(df, "1.3", CompareMode.NOTGREATER)) {
String normalDensity = calcNormalDensity(slsnd, slcly, omPct);
String ret = product(normalDensity, df);
LOG.debug("Calculate result for Adjusted density, g/cm-3 is {}", ret);
return ret;
} else {
LOG.error("Density adjustment Factor is out of range (0.9 - 1.3) : {}", df);
return null;
}
} | java | public static String calcAdjustedDensity(String slsnd, String slcly, String omPct, String df) {
if (compare(df, "0.9", CompareMode.NOTLESS) && compare(df, "1.3", CompareMode.NOTGREATER)) {
String normalDensity = calcNormalDensity(slsnd, slcly, omPct);
String ret = product(normalDensity, df);
LOG.debug("Calculate result for Adjusted density, g/cm-3 is {}", ret);
return ret;
} else {
LOG.error("Density adjustment Factor is out of range (0.9 - 1.3) : {}", df);
return null;
}
} | [
"public",
"static",
"String",
"calcAdjustedDensity",
"(",
"String",
"slsnd",
",",
"String",
"slcly",
",",
"String",
"omPct",
",",
"String",
"df",
")",
"{",
"if",
"(",
"compare",
"(",
"df",
",",
"\"0.9\"",
",",
"CompareMode",
".",
"NOTLESS",
")",
"&&",
"compare",
"(",
"df",
",",
"\"1.3\"",
",",
"CompareMode",
".",
"NOTGREATER",
")",
")",
"{",
"String",
"normalDensity",
"=",
"calcNormalDensity",
"(",
"slsnd",
",",
"slcly",
",",
"omPct",
")",
";",
"String",
"ret",
"=",
"product",
"(",
"normalDensity",
",",
"df",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Calculate result for Adjusted density, g/cm-3 is {}\"",
",",
"ret",
")",
";",
"return",
"ret",
";",
"}",
"else",
"{",
"LOG",
".",
"error",
"(",
"\"Density adjustment Factor is out of range (0.9 - 1.3) : {}\"",
",",
"df",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Equation 7 for calculating Adjusted density, g/cm-3
@param slsnd Sand weight percentage by layer ([0,100]%)
@param slcly Clay weight percentage by layer ([0,100]%)
@param omPct Organic matter weight percentage by layer ([0,100]%), (=
SLOC * 1.72)
@param df Density adjustment Factor (0.9–1.3) | [
"Equation",
"7",
"for",
"calculating",
"Adjusted",
"density",
"g",
"/",
"cm",
"-",
"3"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L243-L254 |
apereo/cas | support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java | DelegatedClientAuthenticationAction.getCredentialsFromDelegatedClient | protected Credentials getCredentialsFromDelegatedClient(final J2EContext webContext, final BaseClient<Credentials, CommonProfile> client) {
"""
Gets credentials from delegated client.
@param webContext the web context
@param client the client
@return the credentials from delegated client
"""
val credentials = client.getCredentials(webContext);
LOGGER.debug("Retrieved credentials from client as [{}]", credentials);
if (credentials == null) {
throw new IllegalArgumentException("Unable to determine credentials from the context with client " + client.getName());
}
return credentials;
} | java | protected Credentials getCredentialsFromDelegatedClient(final J2EContext webContext, final BaseClient<Credentials, CommonProfile> client) {
val credentials = client.getCredentials(webContext);
LOGGER.debug("Retrieved credentials from client as [{}]", credentials);
if (credentials == null) {
throw new IllegalArgumentException("Unable to determine credentials from the context with client " + client.getName());
}
return credentials;
} | [
"protected",
"Credentials",
"getCredentialsFromDelegatedClient",
"(",
"final",
"J2EContext",
"webContext",
",",
"final",
"BaseClient",
"<",
"Credentials",
",",
"CommonProfile",
">",
"client",
")",
"{",
"val",
"credentials",
"=",
"client",
".",
"getCredentials",
"(",
"webContext",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Retrieved credentials from client as [{}]\"",
",",
"credentials",
")",
";",
"if",
"(",
"credentials",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to determine credentials from the context with client \"",
"+",
"client",
".",
"getName",
"(",
")",
")",
";",
"}",
"return",
"credentials",
";",
"}"
] | Gets credentials from delegated client.
@param webContext the web context
@param client the client
@return the credentials from delegated client | [
"Gets",
"credentials",
"from",
"delegated",
"client",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java#L269-L276 |
buschmais/jqa-maven-plugin | src/main/java/com/buschmais/jqassistant/scm/maven/AbstractProjectMojo.java | AbstractProjectMojo.isLastModuleInProject | private boolean isLastModuleInProject(Set<MavenProject> executedModules, List<MavenProject> projectModules) {
"""
Determines if the last module for a project is currently executed.
@param projectModules The modules of the project.
@return <code>true</code> if the current module is the last of the project.
"""
Set<MavenProject> remainingModules = new HashSet<>();
if (execution.getPlugin().getExecutions().isEmpty()) {
getLog().debug("No configured executions found, assuming CLI invocation.");
remainingModules.addAll(projectModules);
} else {
for (MavenProject projectModule : projectModules) {
if (ProjectResolver.containsBuildPlugin(projectModule, execution.getPlugin())) {
remainingModules.add(projectModule);
}
}
}
remainingModules.removeAll(executedModules);
remainingModules.remove(currentProject);
if (remainingModules.isEmpty()) {
getLog().debug(
"Did not find any subsequent module with a plugin configuration."
+ " Will consider this module as the last one."
);
return true;
} else {
getLog().debug(
"Found " + remainingModules.size()
+ " subsequent modules possibly executing this plugin."
+ " Will NOT consider this module as the last one."
);
return false;
}
} | java | private boolean isLastModuleInProject(Set<MavenProject> executedModules, List<MavenProject> projectModules) {
Set<MavenProject> remainingModules = new HashSet<>();
if (execution.getPlugin().getExecutions().isEmpty()) {
getLog().debug("No configured executions found, assuming CLI invocation.");
remainingModules.addAll(projectModules);
} else {
for (MavenProject projectModule : projectModules) {
if (ProjectResolver.containsBuildPlugin(projectModule, execution.getPlugin())) {
remainingModules.add(projectModule);
}
}
}
remainingModules.removeAll(executedModules);
remainingModules.remove(currentProject);
if (remainingModules.isEmpty()) {
getLog().debug(
"Did not find any subsequent module with a plugin configuration."
+ " Will consider this module as the last one."
);
return true;
} else {
getLog().debug(
"Found " + remainingModules.size()
+ " subsequent modules possibly executing this plugin."
+ " Will NOT consider this module as the last one."
);
return false;
}
} | [
"private",
"boolean",
"isLastModuleInProject",
"(",
"Set",
"<",
"MavenProject",
">",
"executedModules",
",",
"List",
"<",
"MavenProject",
">",
"projectModules",
")",
"{",
"Set",
"<",
"MavenProject",
">",
"remainingModules",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"execution",
".",
"getPlugin",
"(",
")",
".",
"getExecutions",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"No configured executions found, assuming CLI invocation.\"",
")",
";",
"remainingModules",
".",
"addAll",
"(",
"projectModules",
")",
";",
"}",
"else",
"{",
"for",
"(",
"MavenProject",
"projectModule",
":",
"projectModules",
")",
"{",
"if",
"(",
"ProjectResolver",
".",
"containsBuildPlugin",
"(",
"projectModule",
",",
"execution",
".",
"getPlugin",
"(",
")",
")",
")",
"{",
"remainingModules",
".",
"add",
"(",
"projectModule",
")",
";",
"}",
"}",
"}",
"remainingModules",
".",
"removeAll",
"(",
"executedModules",
")",
";",
"remainingModules",
".",
"remove",
"(",
"currentProject",
")",
";",
"if",
"(",
"remainingModules",
".",
"isEmpty",
"(",
")",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Did not find any subsequent module with a plugin configuration.\"",
"+",
"\" Will consider this module as the last one.\"",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Found \"",
"+",
"remainingModules",
".",
"size",
"(",
")",
"+",
"\" subsequent modules possibly executing this plugin.\"",
"+",
"\" Will NOT consider this module as the last one.\"",
")",
";",
"return",
"false",
";",
"}",
"}"
] | Determines if the last module for a project is currently executed.
@param projectModules The modules of the project.
@return <code>true</code> if the current module is the last of the project. | [
"Determines",
"if",
"the",
"last",
"module",
"for",
"a",
"project",
"is",
"currently",
"executed",
"."
] | train | https://github.com/buschmais/jqa-maven-plugin/blob/5c21a8058fc1b013333081907fbf00d3525e11c3/src/main/java/com/buschmais/jqassistant/scm/maven/AbstractProjectMojo.java#L45-L73 |
j-a-w-r/jawr | jawr-core/src/main/java/net/jawr/web/cache/CacheManagerFactory.java | CacheManagerFactory.resetCacheManager | public static synchronized JawrCacheManager resetCacheManager(JawrConfig config, String resourceType) {
"""
Resets the cache manager for a resource type
@param config
the jawr config
@param resourceType
the resource type
@return the cache manager for a resource type
"""
String cacheMgrAttributeName = CACHE_ATTR_PREFIX + resourceType.toUpperCase() + CACHE_ATTR_SUFFIX;
JawrCacheManager cacheManager = (JawrCacheManager) config.getContext().getAttribute(cacheMgrAttributeName);
if (cacheManager != null) {
cacheManager.clear();
config.getContext().removeAttribute(cacheMgrAttributeName);
}
return getCacheManager(config, resourceType);
} | java | public static synchronized JawrCacheManager resetCacheManager(JawrConfig config, String resourceType) {
String cacheMgrAttributeName = CACHE_ATTR_PREFIX + resourceType.toUpperCase() + CACHE_ATTR_SUFFIX;
JawrCacheManager cacheManager = (JawrCacheManager) config.getContext().getAttribute(cacheMgrAttributeName);
if (cacheManager != null) {
cacheManager.clear();
config.getContext().removeAttribute(cacheMgrAttributeName);
}
return getCacheManager(config, resourceType);
} | [
"public",
"static",
"synchronized",
"JawrCacheManager",
"resetCacheManager",
"(",
"JawrConfig",
"config",
",",
"String",
"resourceType",
")",
"{",
"String",
"cacheMgrAttributeName",
"=",
"CACHE_ATTR_PREFIX",
"+",
"resourceType",
".",
"toUpperCase",
"(",
")",
"+",
"CACHE_ATTR_SUFFIX",
";",
"JawrCacheManager",
"cacheManager",
"=",
"(",
"JawrCacheManager",
")",
"config",
".",
"getContext",
"(",
")",
".",
"getAttribute",
"(",
"cacheMgrAttributeName",
")",
";",
"if",
"(",
"cacheManager",
"!=",
"null",
")",
"{",
"cacheManager",
".",
"clear",
"(",
")",
";",
"config",
".",
"getContext",
"(",
")",
".",
"removeAttribute",
"(",
"cacheMgrAttributeName",
")",
";",
"}",
"return",
"getCacheManager",
"(",
"config",
",",
"resourceType",
")",
";",
"}"
] | Resets the cache manager for a resource type
@param config
the jawr config
@param resourceType
the resource type
@return the cache manager for a resource type | [
"Resets",
"the",
"cache",
"manager",
"for",
"a",
"resource",
"type"
] | train | https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/cache/CacheManagerFactory.java#L66-L76 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.installationTemplate_POST | public void installationTemplate_POST(String baseTemplateName, OvhTemplateOsLanguageEnum defaultLanguage, String name) throws IOException {
"""
Create a template
REST: POST /me/installationTemplate
@param baseTemplateName [required] OVH template name yours will be based on, choose one among the list given by compatibleTemplates function
@param defaultLanguage [required]
@param name [required] Your template name
"""
String qPath = "/me/installationTemplate";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "baseTemplateName", baseTemplateName);
addBody(o, "defaultLanguage", defaultLanguage);
addBody(o, "name", name);
exec(qPath, "POST", sb.toString(), o);
} | java | public void installationTemplate_POST(String baseTemplateName, OvhTemplateOsLanguageEnum defaultLanguage, String name) throws IOException {
String qPath = "/me/installationTemplate";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "baseTemplateName", baseTemplateName);
addBody(o, "defaultLanguage", defaultLanguage);
addBody(o, "name", name);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"installationTemplate_POST",
"(",
"String",
"baseTemplateName",
",",
"OvhTemplateOsLanguageEnum",
"defaultLanguage",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/installationTemplate\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"baseTemplateName\"",
",",
"baseTemplateName",
")",
";",
"addBody",
"(",
"o",
",",
"\"defaultLanguage\"",
",",
"defaultLanguage",
")",
";",
"addBody",
"(",
"o",
",",
"\"name\"",
",",
"name",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Create a template
REST: POST /me/installationTemplate
@param baseTemplateName [required] OVH template name yours will be based on, choose one among the list given by compatibleTemplates function
@param defaultLanguage [required]
@param name [required] Your template name | [
"Create",
"a",
"template"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3739-L3747 |
geomajas/geomajas-project-client-gwt | plugin/print/print-gwt/src/main/java/org/geomajas/plugin/printing/client/util/UrlBuilder.java | UrlBuilder.addParameter | public UrlBuilder addParameter(String name, String value) {
"""
Add a parameter.
@param name
name of param
@param value
value of param
@return this to allow concatenation
"""
if (value == null) {
value = "";
}
params.put(name, value);
return this;
} | java | public UrlBuilder addParameter(String name, String value) {
if (value == null) {
value = "";
}
params.put(name, value);
return this;
} | [
"public",
"UrlBuilder",
"addParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"\"\"",
";",
"}",
"params",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a parameter.
@param name
name of param
@param value
value of param
@return this to allow concatenation | [
"Add",
"a",
"parameter",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/print/print-gwt/src/main/java/org/geomajas/plugin/printing/client/util/UrlBuilder.java#L44-L50 |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.recreateDocumentFromDocAndReserved | static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception {
"""
Re-creates a document given the document and the reserved keys.
@param doc Main document
@param reserved Document that contains reserved keys. A reserve key starts with an underscore. In this document,
the reserved keys do not have the starting underscore.
@return
@throws Exception
"""
JSONObject result = JSONSupport.copyObject( doc );
// Re-insert attributes that start with '_'
if( null != reserved ) {
Iterator<?> it = reserved.keys();
while( it.hasNext() ){
Object keyObj = it.next();
if( keyObj instanceof String ){
String key = (String)keyObj;
Object value = reserved.opt(key);
result.put("_"+key, value);
}
}
}
return result;
} | java | static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception {
JSONObject result = JSONSupport.copyObject( doc );
// Re-insert attributes that start with '_'
if( null != reserved ) {
Iterator<?> it = reserved.keys();
while( it.hasNext() ){
Object keyObj = it.next();
if( keyObj instanceof String ){
String key = (String)keyObj;
Object value = reserved.opt(key);
result.put("_"+key, value);
}
}
}
return result;
} | [
"static",
"public",
"JSONObject",
"recreateDocumentFromDocAndReserved",
"(",
"JSONObject",
"doc",
",",
"JSONObject",
"reserved",
")",
"throws",
"Exception",
"{",
"JSONObject",
"result",
"=",
"JSONSupport",
".",
"copyObject",
"(",
"doc",
")",
";",
"// Re-insert attributes that start with '_'",
"if",
"(",
"null",
"!=",
"reserved",
")",
"{",
"Iterator",
"<",
"?",
">",
"it",
"=",
"reserved",
".",
"keys",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"keyObj",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"keyObj",
"instanceof",
"String",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"keyObj",
";",
"Object",
"value",
"=",
"reserved",
".",
"opt",
"(",
"key",
")",
";",
"result",
".",
"put",
"(",
"\"_\"",
"+",
"key",
",",
"value",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Re-creates a document given the document and the reserved keys.
@param doc Main document
@param reserved Document that contains reserved keys. A reserve key starts with an underscore. In this document,
the reserved keys do not have the starting underscore.
@return
@throws Exception | [
"Re",
"-",
"creates",
"a",
"document",
"given",
"the",
"document",
"and",
"the",
"reserved",
"keys",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L99-L116 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendUtf8Lines | public static <T> File appendUtf8Lines(Collection<T> list, File file) throws IORuntimeException {
"""
将列表写入文件,追加模式
@param <T> 集合元素类型
@param list 列表
@param file 文件
@return 目标文件
@throws IORuntimeException IO异常
@since 3.1.2
"""
return appendLines(list, file, CharsetUtil.CHARSET_UTF_8);
} | java | public static <T> File appendUtf8Lines(Collection<T> list, File file) throws IORuntimeException {
return appendLines(list, file, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"appendUtf8Lines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"File",
"file",
")",
"throws",
"IORuntimeException",
"{",
"return",
"appendLines",
"(",
"list",
",",
"file",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 将列表写入文件,追加模式
@param <T> 集合元素类型
@param list 列表
@param file 文件
@return 目标文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将列表写入文件,追加模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2939-L2941 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java | AuthenticateUserHelper.authenticateUser | public Subject authenticateUser(AuthenticationService authenticationService, String userName,
String jaasEntryName) throws AuthenticationException {
"""
Authenticate the given user and return an authenticated Subject.
@param authenticationService service to authenticate a user, must not be null
@param userName the user to authenticate, must not be null
@param jaasEntryName the optional JAAS configuration entry name. The system.DEFAULT JAAS entry name will be used if null or empty String is passed
@return the authenticated subject
@throws AuthenticationException if there was a problem authenticating the user, or if the userName or authenticationService is null
"""
return authenticateUser(authenticationService, userName, jaasEntryName, null);
} | java | public Subject authenticateUser(AuthenticationService authenticationService, String userName,
String jaasEntryName) throws AuthenticationException
{
return authenticateUser(authenticationService, userName, jaasEntryName, null);
} | [
"public",
"Subject",
"authenticateUser",
"(",
"AuthenticationService",
"authenticationService",
",",
"String",
"userName",
",",
"String",
"jaasEntryName",
")",
"throws",
"AuthenticationException",
"{",
"return",
"authenticateUser",
"(",
"authenticationService",
",",
"userName",
",",
"jaasEntryName",
",",
"null",
")",
";",
"}"
] | Authenticate the given user and return an authenticated Subject.
@param authenticationService service to authenticate a user, must not be null
@param userName the user to authenticate, must not be null
@param jaasEntryName the optional JAAS configuration entry name. The system.DEFAULT JAAS entry name will be used if null or empty String is passed
@return the authenticated subject
@throws AuthenticationException if there was a problem authenticating the user, or if the userName or authenticationService is null | [
"Authenticate",
"the",
"given",
"user",
"and",
"return",
"an",
"authenticated",
"Subject",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java#L37-L41 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java | CalendarUtil.addYears | public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) {
"""
Add Years to a Gregorian Calendar.
@param cal The XMLGregorianCalendar source
@param amount The amount of years. Can be a negative Integer to
substract.
@return A XMLGregorianCalendar with the new Date
"""
XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal);
// Add amount of months
to.add(addYears(amount));
return to;
} | java | public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) {
XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal);
// Add amount of months
to.add(addYears(amount));
return to;
} | [
"public",
"XMLGregorianCalendar",
"addYears",
"(",
"final",
"XMLGregorianCalendar",
"cal",
",",
"final",
"int",
"amount",
")",
"{",
"XMLGregorianCalendar",
"to",
"=",
"buildXMLGregorianCalendarDate",
"(",
"cal",
")",
";",
"// Add amount of months",
"to",
".",
"add",
"(",
"addYears",
"(",
"amount",
")",
")",
";",
"return",
"to",
";",
"}"
] | Add Years to a Gregorian Calendar.
@param cal The XMLGregorianCalendar source
@param amount The amount of years. Can be a negative Integer to
substract.
@return A XMLGregorianCalendar with the new Date | [
"Add",
"Years",
"to",
"a",
"Gregorian",
"Calendar",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L63-L68 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java | AbstractThrowEventBuilder.signalEventDefinition | public SignalEventDefinitionBuilder signalEventDefinition(String signalName) {
"""
Sets an event definition for the given Signal name. If a signal with this
name already exists it will be used, otherwise a new signal is created.
It returns a builder for the Signal Event Definition.
@param signalName the name of the signal
@return the signal event definition builder object
"""
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition);
} | java | public SignalEventDefinitionBuilder signalEventDefinition(String signalName) {
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition);
} | [
"public",
"SignalEventDefinitionBuilder",
"signalEventDefinition",
"(",
"String",
"signalName",
")",
"{",
"SignalEventDefinition",
"signalEventDefinition",
"=",
"createSignalEventDefinition",
"(",
"signalName",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"signalEventDefinition",
")",
";",
"return",
"new",
"SignalEventDefinitionBuilder",
"(",
"modelInstance",
",",
"signalEventDefinition",
")",
";",
"}"
] | Sets an event definition for the given Signal name. If a signal with this
name already exists it will be used, otherwise a new signal is created.
It returns a builder for the Signal Event Definition.
@param signalName the name of the signal
@return the signal event definition builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"given",
"Signal",
"name",
".",
"If",
"a",
"signal",
"with",
"this",
"name",
"already",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"signal",
"is",
"created",
".",
"It",
"returns",
"a",
"builder",
"for",
"the",
"Signal",
"Event",
"Definition",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java#L98-L103 |
oaqa/cse-framework | src/main/java/edu/cmu/lti/oaqa/framework/eval/TraceConsumer.java | TraceConsumer.process | @Override
public void process(CAS aCAS) throws AnalysisEngineProcessException {
"""
Reads the results from the retrieval phase from the DOCUMENT and the DOCUEMNT_GS views of the
JCAs, and generates and evaluates them using the evaluate method from the FMeasureConsumer
class.
"""
try {
JCas jcas = aCAS.getJCas();
ExperimentUUID experiment = ProcessingStepUtils.getCurrentExperiment(jcas);
AnnotationIndex<Annotation> steps = jcas.getAnnotationIndex(ProcessingStep.type);
String uuid = experiment.getUuid();
Trace trace = ProcessingStepUtils.getTrace(steps);
Key key = new Key(uuid, trace, experiment.getStageId());
experiments.add(new ExperimentKey(key.getExperiment(), key.getStage()));
for (TraceListener listener : listeners) {
listener.process(key, jcas);
}
} catch (Exception e) {
throw new AnalysisEngineProcessException(e);
}
} | java | @Override
public void process(CAS aCAS) throws AnalysisEngineProcessException {
try {
JCas jcas = aCAS.getJCas();
ExperimentUUID experiment = ProcessingStepUtils.getCurrentExperiment(jcas);
AnnotationIndex<Annotation> steps = jcas.getAnnotationIndex(ProcessingStep.type);
String uuid = experiment.getUuid();
Trace trace = ProcessingStepUtils.getTrace(steps);
Key key = new Key(uuid, trace, experiment.getStageId());
experiments.add(new ExperimentKey(key.getExperiment(), key.getStage()));
for (TraceListener listener : listeners) {
listener.process(key, jcas);
}
} catch (Exception e) {
throw new AnalysisEngineProcessException(e);
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"CAS",
"aCAS",
")",
"throws",
"AnalysisEngineProcessException",
"{",
"try",
"{",
"JCas",
"jcas",
"=",
"aCAS",
".",
"getJCas",
"(",
")",
";",
"ExperimentUUID",
"experiment",
"=",
"ProcessingStepUtils",
".",
"getCurrentExperiment",
"(",
"jcas",
")",
";",
"AnnotationIndex",
"<",
"Annotation",
">",
"steps",
"=",
"jcas",
".",
"getAnnotationIndex",
"(",
"ProcessingStep",
".",
"type",
")",
";",
"String",
"uuid",
"=",
"experiment",
".",
"getUuid",
"(",
")",
";",
"Trace",
"trace",
"=",
"ProcessingStepUtils",
".",
"getTrace",
"(",
"steps",
")",
";",
"Key",
"key",
"=",
"new",
"Key",
"(",
"uuid",
",",
"trace",
",",
"experiment",
".",
"getStageId",
"(",
")",
")",
";",
"experiments",
".",
"add",
"(",
"new",
"ExperimentKey",
"(",
"key",
".",
"getExperiment",
"(",
")",
",",
"key",
".",
"getStage",
"(",
")",
")",
")",
";",
"for",
"(",
"TraceListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"process",
"(",
"key",
",",
"jcas",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AnalysisEngineProcessException",
"(",
"e",
")",
";",
"}",
"}"
] | Reads the results from the retrieval phase from the DOCUMENT and the DOCUEMNT_GS views of the
JCAs, and generates and evaluates them using the evaluate method from the FMeasureConsumer
class. | [
"Reads",
"the",
"results",
"from",
"the",
"retrieval",
"phase",
"from",
"the",
"DOCUMENT",
"and",
"the",
"DOCUEMNT_GS",
"views",
"of",
"the",
"JCAs",
"and",
"generates",
"and",
"evaluates",
"them",
"using",
"the",
"evaluate",
"method",
"from",
"the",
"FMeasureConsumer",
"class",
"."
] | train | https://github.com/oaqa/cse-framework/blob/3a46b5828b3a33be4547345a0ac15e829c43c5ef/src/main/java/edu/cmu/lti/oaqa/framework/eval/TraceConsumer.java#L65-L81 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.getSuperTables | @Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
"""
Retrieves a description of the table hierarchies defined in a particular schema in this database.
"""
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"ResultSet",
"getSuperTables",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"tableNamePattern",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Retrieves a description of the table hierarchies defined in a particular schema in this database. | [
"Retrieves",
"a",
"description",
"of",
"the",
"table",
"hierarchies",
"defined",
"in",
"a",
"particular",
"schema",
"in",
"this",
"database",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L764-L769 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/model/GetObjectRequest.java | GetObjectRequest.setRange | public void setRange(long start, long end) {
"""
Sets the optional inclusive byte range within the desired object that will be downloaded by this request.
<p>
The first byte in an object has position 0; as an example, the first ten bytes of an object can be
downloaded by specifying a range of 0 to 9.
<p>
If no byte range is specified, this request downloads the entire object from Baidu Bos.
@param start The start of the inclusive byte range to download.
@param end The end of the inclusive byte range to download.
"""
checkArgument(start >= 0, "start should be non-negative.");
checkArgument(start <= end, "start should not be greater than end");
this.range = new long[]{start, end};
} | java | public void setRange(long start, long end) {
checkArgument(start >= 0, "start should be non-negative.");
checkArgument(start <= end, "start should not be greater than end");
this.range = new long[]{start, end};
} | [
"public",
"void",
"setRange",
"(",
"long",
"start",
",",
"long",
"end",
")",
"{",
"checkArgument",
"(",
"start",
">=",
"0",
",",
"\"start should be non-negative.\"",
")",
";",
"checkArgument",
"(",
"start",
"<=",
"end",
",",
"\"start should not be greater than end\"",
")",
";",
"this",
".",
"range",
"=",
"new",
"long",
"[",
"]",
"{",
"start",
",",
"end",
"}",
";",
"}"
] | Sets the optional inclusive byte range within the desired object that will be downloaded by this request.
<p>
The first byte in an object has position 0; as an example, the first ten bytes of an object can be
downloaded by specifying a range of 0 to 9.
<p>
If no byte range is specified, this request downloads the entire object from Baidu Bos.
@param start The start of the inclusive byte range to download.
@param end The end of the inclusive byte range to download. | [
"Sets",
"the",
"optional",
"inclusive",
"byte",
"range",
"within",
"the",
"desired",
"object",
"that",
"will",
"be",
"downloaded",
"by",
"this",
"request",
".",
"<p",
">",
"The",
"first",
"byte",
"in",
"an",
"object",
"has",
"position",
"0",
";",
"as",
"an",
"example",
"the",
"first",
"ten",
"bytes",
"of",
"an",
"object",
"can",
"be",
"downloaded",
"by",
"specifying",
"a",
"range",
"of",
"0",
"to",
"9",
".",
"<p",
">",
"If",
"no",
"byte",
"range",
"is",
"specified",
"this",
"request",
"downloads",
"the",
"entire",
"object",
"from",
"Baidu",
"Bos",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/model/GetObjectRequest.java#L110-L114 |
square/okhttp | okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java | Http2Stream.writeHeaders | public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders)
throws IOException {
"""
Sends a reply to an incoming stream.
@param outFinished true to eagerly finish the output stream to send data to the remote peer.
Corresponds to {@code FLAG_FIN}.
@param flushHeaders true to force flush the response headers. This should be true unless the
response body exists and will be written immediately.
"""
assert (!Thread.holdsLock(Http2Stream.this));
if (responseHeaders == null) {
throw new NullPointerException("headers == null");
}
synchronized (this) {
this.hasResponseHeaders = true;
if (outFinished) {
this.sink.finished = true;
}
}
// Only DATA frames are subject to flow-control. Transmit the HEADER frame if the connection
// flow-control window is fully depleted.
if (!flushHeaders) {
synchronized (connection) {
flushHeaders = connection.bytesLeftInWriteWindow == 0L;
}
}
connection.writeHeaders(id, outFinished, responseHeaders);
if (flushHeaders) {
connection.flush();
}
} | java | public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders)
throws IOException {
assert (!Thread.holdsLock(Http2Stream.this));
if (responseHeaders == null) {
throw new NullPointerException("headers == null");
}
synchronized (this) {
this.hasResponseHeaders = true;
if (outFinished) {
this.sink.finished = true;
}
}
// Only DATA frames are subject to flow-control. Transmit the HEADER frame if the connection
// flow-control window is fully depleted.
if (!flushHeaders) {
synchronized (connection) {
flushHeaders = connection.bytesLeftInWriteWindow == 0L;
}
}
connection.writeHeaders(id, outFinished, responseHeaders);
if (flushHeaders) {
connection.flush();
}
} | [
"public",
"void",
"writeHeaders",
"(",
"List",
"<",
"Header",
">",
"responseHeaders",
",",
"boolean",
"outFinished",
",",
"boolean",
"flushHeaders",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"!",
"Thread",
".",
"holdsLock",
"(",
"Http2Stream",
".",
"this",
")",
")",
";",
"if",
"(",
"responseHeaders",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"headers == null\"",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"hasResponseHeaders",
"=",
"true",
";",
"if",
"(",
"outFinished",
")",
"{",
"this",
".",
"sink",
".",
"finished",
"=",
"true",
";",
"}",
"}",
"// Only DATA frames are subject to flow-control. Transmit the HEADER frame if the connection",
"// flow-control window is fully depleted.",
"if",
"(",
"!",
"flushHeaders",
")",
"{",
"synchronized",
"(",
"connection",
")",
"{",
"flushHeaders",
"=",
"connection",
".",
"bytesLeftInWriteWindow",
"==",
"0L",
";",
"}",
"}",
"connection",
".",
"writeHeaders",
"(",
"id",
",",
"outFinished",
",",
"responseHeaders",
")",
";",
"if",
"(",
"flushHeaders",
")",
"{",
"connection",
".",
"flush",
"(",
")",
";",
"}",
"}"
] | Sends a reply to an incoming stream.
@param outFinished true to eagerly finish the output stream to send data to the remote peer.
Corresponds to {@code FLAG_FIN}.
@param flushHeaders true to force flush the response headers. This should be true unless the
response body exists and will be written immediately. | [
"Sends",
"a",
"reply",
"to",
"an",
"incoming",
"stream",
"."
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java#L192-L218 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/Depiction.java | Depiction.ensureSuffix | private static String ensureSuffix(String path, String suffix) {
"""
Ensures a suffix on a file output if the path doesn't
currently end with it. For example calling
{@code writeTo(SVG_FMT, "~/chemical")} would create a file
{@code ~/chemical.svg}.
@param path the file system path
@param suffix the format suffix
@return path with correct suffix
"""
if (path.endsWith(DOT + suffix))
return path;
return path + DOT + suffix;
} | java | private static String ensureSuffix(String path, String suffix) {
if (path.endsWith(DOT + suffix))
return path;
return path + DOT + suffix;
} | [
"private",
"static",
"String",
"ensureSuffix",
"(",
"String",
"path",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"path",
".",
"endsWith",
"(",
"DOT",
"+",
"suffix",
")",
")",
"return",
"path",
";",
"return",
"path",
"+",
"DOT",
"+",
"suffix",
";",
"}"
] | Ensures a suffix on a file output if the path doesn't
currently end with it. For example calling
{@code writeTo(SVG_FMT, "~/chemical")} would create a file
{@code ~/chemical.svg}.
@param path the file system path
@param suffix the format suffix
@return path with correct suffix | [
"Ensures",
"a",
"suffix",
"on",
"a",
"file",
"output",
"if",
"the",
"path",
"doesn",
"t",
"currently",
"end",
"with",
"it",
".",
"For",
"example",
"calling",
"{",
"@code",
"writeTo",
"(",
"SVG_FMT",
"~",
"/",
"chemical",
")",
"}",
"would",
"create",
"a",
"file",
"{",
"@code",
"~",
"/",
"chemical",
".",
"svg",
"}",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Depiction.java#L323-L327 |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java | MajorCompactionTask.isLive | private boolean isLive(long index, Segment segment, OffsetPredicate predicate) {
"""
Returns a boolean value indicating whether the given index is release.
"""
long offset = segment.offset(index);
return offset != -1 && predicate.test(offset);
} | java | private boolean isLive(long index, Segment segment, OffsetPredicate predicate) {
long offset = segment.offset(index);
return offset != -1 && predicate.test(offset);
} | [
"private",
"boolean",
"isLive",
"(",
"long",
"index",
",",
"Segment",
"segment",
",",
"OffsetPredicate",
"predicate",
")",
"{",
"long",
"offset",
"=",
"segment",
".",
"offset",
"(",
"index",
")",
";",
"return",
"offset",
"!=",
"-",
"1",
"&&",
"predicate",
".",
"test",
"(",
"offset",
")",
";",
"}"
] | Returns a boolean value indicating whether the given index is release. | [
"Returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"given",
"index",
"is",
"release",
"."
] | train | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L289-L292 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java | TransferListener.isNewSession | private boolean isNewSession(String xferId, String sessionId) {
"""
Return true if new session for transaction
@param xferId
@param sessionId
@return boolean
"""
List<String> currentSessions = transactionSessions.get(xferId);
if(currentSessions == null) {
List<String> sessions = new ArrayList<String>();
sessions.add(sessionId);
transactionSessions.put(xferId, sessions);
return true;
} else if (!currentSessions.contains(sessionId)) {
currentSessions.add(sessionId);
return true;
} else {
return false;
}
} | java | private boolean isNewSession(String xferId, String sessionId) {
List<String> currentSessions = transactionSessions.get(xferId);
if(currentSessions == null) {
List<String> sessions = new ArrayList<String>();
sessions.add(sessionId);
transactionSessions.put(xferId, sessions);
return true;
} else if (!currentSessions.contains(sessionId)) {
currentSessions.add(sessionId);
return true;
} else {
return false;
}
} | [
"private",
"boolean",
"isNewSession",
"(",
"String",
"xferId",
",",
"String",
"sessionId",
")",
"{",
"List",
"<",
"String",
">",
"currentSessions",
"=",
"transactionSessions",
".",
"get",
"(",
"xferId",
")",
";",
"if",
"(",
"currentSessions",
"==",
"null",
")",
"{",
"List",
"<",
"String",
">",
"sessions",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"sessions",
".",
"add",
"(",
"sessionId",
")",
";",
"transactionSessions",
".",
"put",
"(",
"xferId",
",",
"sessions",
")",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"!",
"currentSessions",
".",
"contains",
"(",
"sessionId",
")",
")",
"{",
"currentSessions",
".",
"add",
"(",
"sessionId",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Return true if new session for transaction
@param xferId
@param sessionId
@return boolean | [
"Return",
"true",
"if",
"new",
"session",
"for",
"transaction"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java#L312-L327 |
LearnLib/learnlib | commons/acex/src/main/java/de/learnlib/acex/analyzers/AcexAnalysisAlgorithms.java | AcexAnalysisAlgorithms.linearSearchFwd | public static <E> int linearSearchFwd(AbstractCounterexample<E> acex, int low, int high) {
"""
Scan linearly through the counterexample in ascending order.
@param acex
the abstract counterexample
@param low
the lower bound of the search range
@param high
the upper bound of the search range
@return an index <code>i</code> such that <code>acex.testEffect(i) != acex.testEffect(i+1)</code>
"""
assert !acex.testEffects(low, high);
E effPrev = acex.effect(low);
for (int i = low + 1; i <= high; i++) {
E eff = acex.effect(i);
if (!acex.checkEffects(effPrev, eff)) {
return i - 1;
}
effPrev = eff;
}
throw new IllegalArgumentException();
} | java | public static <E> int linearSearchFwd(AbstractCounterexample<E> acex, int low, int high) {
assert !acex.testEffects(low, high);
E effPrev = acex.effect(low);
for (int i = low + 1; i <= high; i++) {
E eff = acex.effect(i);
if (!acex.checkEffects(effPrev, eff)) {
return i - 1;
}
effPrev = eff;
}
throw new IllegalArgumentException();
} | [
"public",
"static",
"<",
"E",
">",
"int",
"linearSearchFwd",
"(",
"AbstractCounterexample",
"<",
"E",
">",
"acex",
",",
"int",
"low",
",",
"int",
"high",
")",
"{",
"assert",
"!",
"acex",
".",
"testEffects",
"(",
"low",
",",
"high",
")",
";",
"E",
"effPrev",
"=",
"acex",
".",
"effect",
"(",
"low",
")",
";",
"for",
"(",
"int",
"i",
"=",
"low",
"+",
"1",
";",
"i",
"<=",
"high",
";",
"i",
"++",
")",
"{",
"E",
"eff",
"=",
"acex",
".",
"effect",
"(",
"i",
")",
";",
"if",
"(",
"!",
"acex",
".",
"checkEffects",
"(",
"effPrev",
",",
"eff",
")",
")",
"{",
"return",
"i",
"-",
"1",
";",
"}",
"effPrev",
"=",
"eff",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}"
] | Scan linearly through the counterexample in ascending order.
@param acex
the abstract counterexample
@param low
the lower bound of the search range
@param high
the upper bound of the search range
@return an index <code>i</code> such that <code>acex.testEffect(i) != acex.testEffect(i+1)</code> | [
"Scan",
"linearly",
"through",
"the",
"counterexample",
"in",
"ascending",
"order",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/acex/src/main/java/de/learnlib/acex/analyzers/AcexAnalysisAlgorithms.java#L38-L50 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java | AlignmentTools.getSymmetryOrder | public static int getSymmetryOrder(Map<Integer, Integer> alignment,
final int maxSymmetry, final float minimumMetricChange) {
"""
Helper for {@link #getSymmetryOrder(Map, Map, int, float)} with a true
identity function (X->X).
<p>This method should only be used in cases where the two proteins
aligned have identical numbering, as for self-alignments. See
{@link #getSymmetryOrder(AFPChain, int, float)} for a way to guess
the sequential correspondence between two proteins.
@param alignment
@param maxSymmetry
@param minimumMetricChange
@return
"""
return getSymmetryOrder(alignment, new IdentityMap<Integer>(), maxSymmetry, minimumMetricChange);
} | java | public static int getSymmetryOrder(Map<Integer, Integer> alignment,
final int maxSymmetry, final float minimumMetricChange) {
return getSymmetryOrder(alignment, new IdentityMap<Integer>(), maxSymmetry, minimumMetricChange);
} | [
"public",
"static",
"int",
"getSymmetryOrder",
"(",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"alignment",
",",
"final",
"int",
"maxSymmetry",
",",
"final",
"float",
"minimumMetricChange",
")",
"{",
"return",
"getSymmetryOrder",
"(",
"alignment",
",",
"new",
"IdentityMap",
"<",
"Integer",
">",
"(",
")",
",",
"maxSymmetry",
",",
"minimumMetricChange",
")",
";",
"}"
] | Helper for {@link #getSymmetryOrder(Map, Map, int, float)} with a true
identity function (X->X).
<p>This method should only be used in cases where the two proteins
aligned have identical numbering, as for self-alignments. See
{@link #getSymmetryOrder(AFPChain, int, float)} for a way to guess
the sequential correspondence between two proteins.
@param alignment
@param maxSymmetry
@param minimumMetricChange
@return | [
"Helper",
"for",
"{",
"@link",
"#getSymmetryOrder",
"(",
"Map",
"Map",
"int",
"float",
")",
"}",
"with",
"a",
"true",
"identity",
"function",
"(",
"X",
"-",
">",
"X",
")",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java#L283-L286 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createNicePartialMockAndInvokeDefaultConstructor | public static <T> T createNicePartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
throws Exception {
"""
A utility method that may be used to nicely mock several methods in an
easy way (by just passing in the method names of the method you wish to
mock). The mock object created will support mocking of final methods and
invokes the default constructor (even if it's private).
@param <T> the type of the mock object
@param type the type of the mock object
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return the mock object.
"""
return createNiceMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
Whitebox.getMethods(type, methodNames));
} | java | public static <T> T createNicePartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
throws Exception {
return createNiceMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
Whitebox.getMethods(type, methodNames));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createNicePartialMockAndInvokeDefaultConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"throws",
"Exception",
"{",
"return",
"createNiceMock",
"(",
"type",
",",
"new",
"ConstructorArgs",
"(",
"Whitebox",
".",
"getConstructor",
"(",
"type",
")",
")",
",",
"Whitebox",
".",
"getMethods",
"(",
"type",
",",
"methodNames",
")",
")",
";",
"}"
] | A utility method that may be used to nicely mock several methods in an
easy way (by just passing in the method names of the method you wish to
mock). The mock object created will support mocking of final methods and
invokes the default constructor (even if it's private).
@param <T> the type of the mock object
@param type the type of the mock object
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return the mock object. | [
"A",
"utility",
"method",
"that",
"may",
"be",
"used",
"to",
"nicely",
"mock",
"several",
"methods",
"in",
"an",
"easy",
"way",
"(",
"by",
"just",
"passing",
"in",
"the",
"method",
"names",
"of",
"the",
"method",
"you",
"wish",
"to",
"mock",
")",
".",
"The",
"mock",
"object",
"created",
"will",
"support",
"mocking",
"of",
"final",
"methods",
"and",
"invokes",
"the",
"default",
"constructor",
"(",
"even",
"if",
"it",
"s",
"private",
")",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L859-L863 |
apache/incubator-druid | extensions-contrib/materialized-view-maintenance/src/main/java/org/apache/druid/indexing/materializedview/MaterializedViewSupervisor.java | MaterializedViewSupervisor.hasEnoughLag | private boolean hasEnoughLag(Interval target, Interval maxInterval) {
"""
check whether the start millis of target interval is more than minDataLagMs lagging behind maxInterval's
minDataLag is required to prevent repeatedly building data because of delay data.
@param target
@param maxInterval
@return true if the start millis of target interval is more than minDataLagMs lagging behind maxInterval's
"""
return minDataLagMs <= (maxInterval.getStartMillis() - target.getStartMillis());
} | java | private boolean hasEnoughLag(Interval target, Interval maxInterval)
{
return minDataLagMs <= (maxInterval.getStartMillis() - target.getStartMillis());
} | [
"private",
"boolean",
"hasEnoughLag",
"(",
"Interval",
"target",
",",
"Interval",
"maxInterval",
")",
"{",
"return",
"minDataLagMs",
"<=",
"(",
"maxInterval",
".",
"getStartMillis",
"(",
")",
"-",
"target",
".",
"getStartMillis",
"(",
")",
")",
";",
"}"
] | check whether the start millis of target interval is more than minDataLagMs lagging behind maxInterval's
minDataLag is required to prevent repeatedly building data because of delay data.
@param target
@param maxInterval
@return true if the start millis of target interval is more than minDataLagMs lagging behind maxInterval's | [
"check",
"whether",
"the",
"start",
"millis",
"of",
"target",
"interval",
"is",
"more",
"than",
"minDataLagMs",
"lagging",
"behind",
"maxInterval",
"s",
"minDataLag",
"is",
"required",
"to",
"prevent",
"repeatedly",
"building",
"data",
"because",
"of",
"delay",
"data",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-contrib/materialized-view-maintenance/src/main/java/org/apache/druid/indexing/materializedview/MaterializedViewSupervisor.java#L456-L459 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java | MathBindings.floorMod | public static IntegerBinding floorMod(final ObservableIntegerValue x, final ObservableIntegerValue y) {
"""
Binding for {@link java.lang.Math#floorMod(int, int)}
@param x the dividend
@param y the divisor
@return the floor modulus {@code x - (floorDiv(x, y) * y)}
@throws ArithmeticException if the divisor {@code y} is zero
"""
return createIntegerBinding(() -> Math.floorMod(x.get(), y.get()), x, y);
} | java | public static IntegerBinding floorMod(final ObservableIntegerValue x, final ObservableIntegerValue y) {
return createIntegerBinding(() -> Math.floorMod(x.get(), y.get()), x, y);
} | [
"public",
"static",
"IntegerBinding",
"floorMod",
"(",
"final",
"ObservableIntegerValue",
"x",
",",
"final",
"ObservableIntegerValue",
"y",
")",
"{",
"return",
"createIntegerBinding",
"(",
"(",
")",
"->",
"Math",
".",
"floorMod",
"(",
"x",
".",
"get",
"(",
")",
",",
"y",
".",
"get",
"(",
")",
")",
",",
"x",
",",
"y",
")",
";",
"}"
] | Binding for {@link java.lang.Math#floorMod(int, int)}
@param x the dividend
@param y the divisor
@return the floor modulus {@code x - (floorDiv(x, y) * y)}
@throws ArithmeticException if the divisor {@code y} is zero | [
"Binding",
"for",
"{",
"@link",
"java",
".",
"lang",
".",
"Math#floorMod",
"(",
"int",
"int",
")",
"}"
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L493-L495 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_changePassword_POST | public OvhTaskPop delegatedAccount_email_changePassword_POST(String email, String password) throws IOException {
"""
Change mailbox password (length : [9;30], no space at begin and end, no accent)
REST: POST /email/domain/delegatedAccount/{email}/changePassword
@param password [required] New password
@param email [required] Email
"""
String qPath = "/email/domain/delegatedAccount/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskPop.class);
} | java | public OvhTaskPop delegatedAccount_email_changePassword_POST(String email, String password) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskPop.class);
} | [
"public",
"OvhTaskPop",
"delegatedAccount_email_changePassword_POST",
"(",
"String",
"email",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/changePassword\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"email",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"password\"",
",",
"password",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTaskPop",
".",
"class",
")",
";",
"}"
] | Change mailbox password (length : [9;30], no space at begin and end, no accent)
REST: POST /email/domain/delegatedAccount/{email}/changePassword
@param password [required] New password
@param email [required] Email | [
"Change",
"mailbox",
"password",
"(",
"length",
":",
"[",
"9",
";",
"30",
"]",
"no",
"space",
"at",
"begin",
"and",
"end",
"no",
"accent",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L374-L381 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java | PageParametersExtensions.copy | public static PageParameters copy(final PageParameters source, final PageParameters destination) {
"""
Copies all given source {@link org.apache.wicket.request.mapper.parameter.PageParameters} to
the given destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@param source
The source {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@param destination
The destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@return The destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}
with the copied keys and values.
"""
Args.notNull(source, "source");
Args.notNull(destination, "destination");
final List<INamedParameters.NamedPair> namedPairs = source.getAllNamed();
for (final INamedParameters.NamedPair namedPair : namedPairs)
{
destination.add(namedPair.getKey(), namedPair.getValue());
}
return destination;
} | java | public static PageParameters copy(final PageParameters source, final PageParameters destination)
{
Args.notNull(source, "source");
Args.notNull(destination, "destination");
final List<INamedParameters.NamedPair> namedPairs = source.getAllNamed();
for (final INamedParameters.NamedPair namedPair : namedPairs)
{
destination.add(namedPair.getKey(), namedPair.getValue());
}
return destination;
} | [
"public",
"static",
"PageParameters",
"copy",
"(",
"final",
"PageParameters",
"source",
",",
"final",
"PageParameters",
"destination",
")",
"{",
"Args",
".",
"notNull",
"(",
"source",
",",
"\"source\"",
")",
";",
"Args",
".",
"notNull",
"(",
"destination",
",",
"\"destination\"",
")",
";",
"final",
"List",
"<",
"INamedParameters",
".",
"NamedPair",
">",
"namedPairs",
"=",
"source",
".",
"getAllNamed",
"(",
")",
";",
"for",
"(",
"final",
"INamedParameters",
".",
"NamedPair",
"namedPair",
":",
"namedPairs",
")",
"{",
"destination",
".",
"add",
"(",
"namedPair",
".",
"getKey",
"(",
")",
",",
"namedPair",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"destination",
";",
"}"
] | Copies all given source {@link org.apache.wicket.request.mapper.parameter.PageParameters} to
the given destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@param source
The source {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@param destination
The destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}.
@return The destination {@link org.apache.wicket.request.mapper.parameter.PageParameters}
with the copied keys and values. | [
"Copies",
"all",
"given",
"source",
"{",
"@link",
"org",
".",
"apache",
".",
"wicket",
".",
"request",
".",
"mapper",
".",
"parameter",
".",
"PageParameters",
"}",
"to",
"the",
"given",
"destination",
"{",
"@link",
"org",
".",
"apache",
".",
"wicket",
".",
"request",
".",
"mapper",
".",
"parameter",
".",
"PageParameters",
"}",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java#L106-L116 |
cvut/JCOP | src/main/java/cz/cvut/felk/cig/jcop/result/render/JFreeChartRender.java | JFreeChartRender.setDomainAxis | public JFreeChartRender setDomainAxis(double lowerBound, double upperBound) {
"""
Sets bounds for domain axis.
@param lowerBound lower domain bound
@param upperBound upper domain bound
@return itself (fluent interface)
"""
ValueAxis valueAxis = getPlot().getDomainAxis();
valueAxis.setUpperBound(upperBound);
valueAxis.setLowerBound(lowerBound);
return this;
} | java | public JFreeChartRender setDomainAxis(double lowerBound, double upperBound) {
ValueAxis valueAxis = getPlot().getDomainAxis();
valueAxis.setUpperBound(upperBound);
valueAxis.setLowerBound(lowerBound);
return this;
} | [
"public",
"JFreeChartRender",
"setDomainAxis",
"(",
"double",
"lowerBound",
",",
"double",
"upperBound",
")",
"{",
"ValueAxis",
"valueAxis",
"=",
"getPlot",
"(",
")",
".",
"getDomainAxis",
"(",
")",
";",
"valueAxis",
".",
"setUpperBound",
"(",
"upperBound",
")",
";",
"valueAxis",
".",
"setLowerBound",
"(",
"lowerBound",
")",
";",
"return",
"this",
";",
"}"
] | Sets bounds for domain axis.
@param lowerBound lower domain bound
@param upperBound upper domain bound
@return itself (fluent interface) | [
"Sets",
"bounds",
"for",
"domain",
"axis",
"."
] | train | https://github.com/cvut/JCOP/blob/2ec18315a9a452e5f4e3d07cccfde0310adc465a/src/main/java/cz/cvut/felk/cig/jcop/result/render/JFreeChartRender.java#L259-L264 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.getObjects | public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException {
"""
Get several objects from this index
@param objectIDs the array of unique identifier of objects to retrieve
@param attributesToRetrieve contains the list of attributes to retrieve.
"""
return this.getObjects(objectIDs, attributesToRetrieve, RequestOptions.empty);
} | java | public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException {
return this.getObjects(objectIDs, attributesToRetrieve, RequestOptions.empty);
} | [
"public",
"JSONObject",
"getObjects",
"(",
"List",
"<",
"String",
">",
"objectIDs",
",",
"List",
"<",
"String",
">",
"attributesToRetrieve",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"getObjects",
"(",
"objectIDs",
",",
"attributesToRetrieve",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Get several objects from this index
@param objectIDs the array of unique identifier of objects to retrieve
@param attributesToRetrieve contains the list of attributes to retrieve. | [
"Get",
"several",
"objects",
"from",
"this",
"index"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L301-L303 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getNextHopAsync | public Observable<NextHopResultInner> getNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) {
"""
Gets the next hop from the specified VM.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the source and destination endpoint.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return getNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() {
@Override
public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) {
return response.body();
}
});
} | java | public Observable<NextHopResultInner> getNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) {
return getNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() {
@Override
public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NextHopResultInner",
">",
"getNextHopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"NextHopParameters",
"parameters",
")",
"{",
"return",
"getNextHopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcherName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"NextHopResultInner",
">",
",",
"NextHopResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"NextHopResultInner",
"call",
"(",
"ServiceResponse",
"<",
"NextHopResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the next hop from the specified VM.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the source and destination endpoint.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Gets",
"the",
"next",
"hop",
"from",
"the",
"specified",
"VM",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1153-L1160 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java | MLLibUtil.fromLabeledPoint | public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
long batchSize) {
"""
Convert an rdd
of labeled point
based on the specified batch size
in to data set
@param data the data to convert
@param numPossibleLabels the number of possible labels
@param batchSize the batch size
@return the new rdd
"""
JavaRDD<DataSet> mappedData = data.map(new Function<LabeledPoint, DataSet>() {
@Override
public DataSet call(LabeledPoint lp) {
return fromLabeledPoint(lp, numPossibleLabels);
}
});
return mappedData.repartition((int) (mappedData.count() / batchSize));
} | java | public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
long batchSize) {
JavaRDD<DataSet> mappedData = data.map(new Function<LabeledPoint, DataSet>() {
@Override
public DataSet call(LabeledPoint lp) {
return fromLabeledPoint(lp, numPossibleLabels);
}
});
return mappedData.repartition((int) (mappedData.count() / batchSize));
} | [
"public",
"static",
"JavaRDD",
"<",
"DataSet",
">",
"fromLabeledPoint",
"(",
"JavaRDD",
"<",
"LabeledPoint",
">",
"data",
",",
"final",
"long",
"numPossibleLabels",
",",
"long",
"batchSize",
")",
"{",
"JavaRDD",
"<",
"DataSet",
">",
"mappedData",
"=",
"data",
".",
"map",
"(",
"new",
"Function",
"<",
"LabeledPoint",
",",
"DataSet",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DataSet",
"call",
"(",
"LabeledPoint",
"lp",
")",
"{",
"return",
"fromLabeledPoint",
"(",
"lp",
",",
"numPossibleLabels",
")",
";",
"}",
"}",
")",
";",
"return",
"mappedData",
".",
"repartition",
"(",
"(",
"int",
")",
"(",
"mappedData",
".",
"count",
"(",
")",
"/",
"batchSize",
")",
")",
";",
"}"
] | Convert an rdd
of labeled point
based on the specified batch size
in to data set
@param data the data to convert
@param numPossibleLabels the number of possible labels
@param batchSize the batch size
@return the new rdd | [
"Convert",
"an",
"rdd",
"of",
"labeled",
"point",
"based",
"on",
"the",
"specified",
"batch",
"size",
"in",
"to",
"data",
"set"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java#L211-L222 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java | TypesafeConfigUtils.getObject | @SuppressWarnings("unchecked")
public static <T> T getObject(Config config, String path, Class<T> clazz) {
"""
Get a configuration as Java object. Return {@code null} if missing or wrong type.
@param config
@param path
@param clazz
@return
"""
Object obj = getObject(config, path);
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} | java | @SuppressWarnings("unchecked")
public static <T> T getObject(Config config, String path, Class<T> clazz) {
Object obj = getObject(config, path);
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getObject",
"(",
"Config",
"config",
",",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Object",
"obj",
"=",
"getObject",
"(",
"config",
",",
"path",
")",
";",
"return",
"obj",
"!=",
"null",
"&&",
"clazz",
".",
"isAssignableFrom",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
"?",
"(",
"T",
")",
"obj",
":",
"null",
";",
"}"
] | Get a configuration as Java object. Return {@code null} if missing or wrong type.
@param config
@param path
@param clazz
@return | [
"Get",
"a",
"configuration",
"as",
"Java",
"object",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"missing",
"or",
"wrong",
"type",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L825-L829 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java | XPath10ParserImpl.postProcessOperands | private void postProcessOperands(OperatorImpl opImpl, String fullPath)
throws InvalidXPathSyntaxException {
"""
Traverse an Operator tree handling special character substitution.
@param opImpl
@throws InvalidXPathSyntaxException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(cclass,
"postProcessOperands",
"opImpl: " + opImpl + ", fullPath: " + fullPath);
// Check for Identifiers with ampersand strings
for(int i = 0; i< opImpl.operands.length; i++)
{
Selector sel = opImpl.operands[i];
postProcessSelectorTree(sel, fullPath);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "postProcessOperands");
} | java | private void postProcessOperands(OperatorImpl opImpl, String fullPath)
throws InvalidXPathSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(cclass,
"postProcessOperands",
"opImpl: " + opImpl + ", fullPath: " + fullPath);
// Check for Identifiers with ampersand strings
for(int i = 0; i< opImpl.operands.length; i++)
{
Selector sel = opImpl.operands[i];
postProcessSelectorTree(sel, fullPath);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "postProcessOperands");
} | [
"private",
"void",
"postProcessOperands",
"(",
"OperatorImpl",
"opImpl",
",",
"String",
"fullPath",
")",
"throws",
"InvalidXPathSyntaxException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"cclass",
",",
"\"postProcessOperands\"",
",",
"\"opImpl: \"",
"+",
"opImpl",
"+",
"\", fullPath: \"",
"+",
"fullPath",
")",
";",
"// Check for Identifiers with ampersand strings",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"opImpl",
".",
"operands",
".",
"length",
";",
"i",
"++",
")",
"{",
"Selector",
"sel",
"=",
"opImpl",
".",
"operands",
"[",
"i",
"]",
";",
"postProcessSelectorTree",
"(",
"sel",
",",
"fullPath",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"postProcessOperands\"",
")",
";",
"}"
] | Traverse an Operator tree handling special character substitution.
@param opImpl
@throws InvalidXPathSyntaxException | [
"Traverse",
"an",
"Operator",
"tree",
"handling",
"special",
"character",
"substitution",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L873-L888 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java | ReflectionUtils.asRandomizer | @SuppressWarnings("unchecked")
public static <T> Randomizer<T> asRandomizer(final Supplier<T> supplier) {
"""
Create a dynamic proxy that adapts the given {@link Supplier} to a {@link Randomizer}.
@param supplier to adapt
@param <T> target type
@return the proxy randomizer
"""
class RandomizerProxy implements InvocationHandler {
private final Supplier<?> target;
private RandomizerProxy(final Supplier<?> target) {
this.target = target;
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if ("getRandomValue".equals(method.getName())) {
Method getMethod = target.getClass().getMethod("get");
getMethod.setAccessible(true);
return getMethod.invoke(target);
}
return null;
}
}
return (Randomizer<T>) Proxy.newProxyInstance(
Randomizer.class.getClassLoader(),
new Class[]{Randomizer.class},
new RandomizerProxy(supplier));
} | java | @SuppressWarnings("unchecked")
public static <T> Randomizer<T> asRandomizer(final Supplier<T> supplier) {
class RandomizerProxy implements InvocationHandler {
private final Supplier<?> target;
private RandomizerProxy(final Supplier<?> target) {
this.target = target;
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if ("getRandomValue".equals(method.getName())) {
Method getMethod = target.getClass().getMethod("get");
getMethod.setAccessible(true);
return getMethod.invoke(target);
}
return null;
}
}
return (Randomizer<T>) Proxy.newProxyInstance(
Randomizer.class.getClassLoader(),
new Class[]{Randomizer.class},
new RandomizerProxy(supplier));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Randomizer",
"<",
"T",
">",
"asRandomizer",
"(",
"final",
"Supplier",
"<",
"T",
">",
"supplier",
")",
"{",
"class",
"RandomizerProxy",
"implements",
"InvocationHandler",
"{",
"private",
"final",
"Supplier",
"<",
"?",
">",
"target",
";",
"private",
"RandomizerProxy",
"(",
"final",
"Supplier",
"<",
"?",
">",
"target",
")",
"{",
"this",
".",
"target",
"=",
"target",
";",
"}",
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"final",
"Object",
"proxy",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"\"getRandomValue\"",
".",
"equals",
"(",
"method",
".",
"getName",
"(",
")",
")",
")",
"{",
"Method",
"getMethod",
"=",
"target",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"get\"",
")",
";",
"getMethod",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"getMethod",
".",
"invoke",
"(",
"target",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"return",
"(",
"Randomizer",
"<",
"T",
">",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"Randomizer",
".",
"class",
".",
"getClassLoader",
"(",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"Randomizer",
".",
"class",
"}",
",",
"new",
"RandomizerProxy",
"(",
"supplier",
")",
")",
";",
"}"
] | Create a dynamic proxy that adapts the given {@link Supplier} to a {@link Randomizer}.
@param supplier to adapt
@param <T> target type
@return the proxy randomizer | [
"Create",
"a",
"dynamic",
"proxy",
"that",
"adapts",
"the",
"given",
"{"
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L67-L93 |
duracloud/duracloud | snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/RequestRestoreSnapshotTaskRunner.java | RequestRestoreSnapshotTaskRunner.buildBridgeBody | protected String buildBridgeBody(String snapshotId,
String userEmail) {
"""
/*
Creates the body of the request that will be sent to the bridge app
"""
RequestRestoreBridgeParameters bridgeParams =
new RequestRestoreBridgeParameters(dcHost, dcPort, dcStoreId, snapshotId, userEmail);
return bridgeParams.serialize();
} | java | protected String buildBridgeBody(String snapshotId,
String userEmail) {
RequestRestoreBridgeParameters bridgeParams =
new RequestRestoreBridgeParameters(dcHost, dcPort, dcStoreId, snapshotId, userEmail);
return bridgeParams.serialize();
} | [
"protected",
"String",
"buildBridgeBody",
"(",
"String",
"snapshotId",
",",
"String",
"userEmail",
")",
"{",
"RequestRestoreBridgeParameters",
"bridgeParams",
"=",
"new",
"RequestRestoreBridgeParameters",
"(",
"dcHost",
",",
"dcPort",
",",
"dcStoreId",
",",
"snapshotId",
",",
"userEmail",
")",
";",
"return",
"bridgeParams",
".",
"serialize",
"(",
")",
";",
"}"
] | /*
Creates the body of the request that will be sent to the bridge app | [
"/",
"*",
"Creates",
"the",
"body",
"of",
"the",
"request",
"that",
"will",
"be",
"sent",
"to",
"the",
"bridge",
"app"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/RequestRestoreSnapshotTaskRunner.java#L112-L117 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java | ActivityUtils.getExtraObject | public static Object getExtraObject(Activity context, String key) {
"""
Used to get the parameter values passed into Activity via a Bundle.
@param context The current Context or Activity that this method is called from
@param key Extra key name.
@return param Parameter value
"""
Object param = null;
Bundle bundle = context.getIntent().getExtras();
if (bundle != null) {
param = bundle.get(key);
}
return param;
} | java | public static Object getExtraObject(Activity context, String key) {
Object param = null;
Bundle bundle = context.getIntent().getExtras();
if (bundle != null) {
param = bundle.get(key);
}
return param;
} | [
"public",
"static",
"Object",
"getExtraObject",
"(",
"Activity",
"context",
",",
"String",
"key",
")",
"{",
"Object",
"param",
"=",
"null",
";",
"Bundle",
"bundle",
"=",
"context",
".",
"getIntent",
"(",
")",
".",
"getExtras",
"(",
")",
";",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"param",
"=",
"bundle",
".",
"get",
"(",
"key",
")",
";",
"}",
"return",
"param",
";",
"}"
] | Used to get the parameter values passed into Activity via a Bundle.
@param context The current Context or Activity that this method is called from
@param key Extra key name.
@return param Parameter value | [
"Used",
"to",
"get",
"the",
"parameter",
"values",
"passed",
"into",
"Activity",
"via",
"a",
"Bundle",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java#L75-L82 |
lisicnu/droidUtil | src/main/java/com/github/lisicnu/libDroid/util/BitmapUtils.java | BitmapUtils.zoomBitmap | public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) {
"""
zoom bitmap, if parameters are invalid will return null. <br/>
<br/>
Note: <br/>
this method do not recycle any resource.
@param bitmap
@param width
@param height
@return
"""
if (bitmap == null || width <= 0 || height <= 0)
return null;
int w = bitmap.getWidth();
int h = bitmap.getHeight();
Matrix matrix = new Matrix();
float scaleWidth = ((float) width / w);
float scaleHeight = ((float) height / h);
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
} | java | public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) {
if (bitmap == null || width <= 0 || height <= 0)
return null;
int w = bitmap.getWidth();
int h = bitmap.getHeight();
Matrix matrix = new Matrix();
float scaleWidth = ((float) width / w);
float scaleHeight = ((float) height / h);
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
} | [
"public",
"static",
"Bitmap",
"zoomBitmap",
"(",
"Bitmap",
"bitmap",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"bitmap",
"==",
"null",
"||",
"width",
"<=",
"0",
"||",
"height",
"<=",
"0",
")",
"return",
"null",
";",
"int",
"w",
"=",
"bitmap",
".",
"getWidth",
"(",
")",
";",
"int",
"h",
"=",
"bitmap",
".",
"getHeight",
"(",
")",
";",
"Matrix",
"matrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"float",
"scaleWidth",
"=",
"(",
"(",
"float",
")",
"width",
"/",
"w",
")",
";",
"float",
"scaleHeight",
"=",
"(",
"(",
"float",
")",
"height",
"/",
"h",
")",
";",
"matrix",
".",
"postScale",
"(",
"scaleWidth",
",",
"scaleHeight",
")",
";",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"bitmap",
",",
"0",
",",
"0",
",",
"w",
",",
"h",
",",
"matrix",
",",
"true",
")",
";",
"}"
] | zoom bitmap, if parameters are invalid will return null. <br/>
<br/>
Note: <br/>
this method do not recycle any resource.
@param bitmap
@param width
@param height
@return | [
"zoom",
"bitmap",
"if",
"parameters",
"are",
"invalid",
"will",
"return",
"null",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"Note",
":",
"<br",
"/",
">",
"this",
"method",
"do",
"not",
"recycle",
"any",
"resource",
"."
] | train | https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/BitmapUtils.java#L198-L209 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java | XmlIO.save | public static void save(final AnnotationMappingInfo xmlInfo, final Writer writer) throws XmlOperateException {
"""
XMLをファイルに保存する。
@since 1.1
@param xmlInfo XML情報。
@param writer
@throws XmlOperateException XMLの書き込みに失敗した場合。
@throws IllegalArgumentException xmlInfo is null.
@throws IllegalArgumentException writer is null.
"""
ArgUtils.notNull(xmlInfo, "xmlInfo");
ArgUtils.notNull(writer, "writer");
try {
JAXB.marshal(xmlInfo, writer);
} catch (DataBindingException e) {
throw new XmlOperateException("fail save xml with JAXB.", e);
}
} | java | public static void save(final AnnotationMappingInfo xmlInfo, final Writer writer) throws XmlOperateException {
ArgUtils.notNull(xmlInfo, "xmlInfo");
ArgUtils.notNull(writer, "writer");
try {
JAXB.marshal(xmlInfo, writer);
} catch (DataBindingException e) {
throw new XmlOperateException("fail save xml with JAXB.", e);
}
} | [
"public",
"static",
"void",
"save",
"(",
"final",
"AnnotationMappingInfo",
"xmlInfo",
",",
"final",
"Writer",
"writer",
")",
"throws",
"XmlOperateException",
"{",
"ArgUtils",
".",
"notNull",
"(",
"xmlInfo",
",",
"\"xmlInfo\"",
")",
";",
"ArgUtils",
".",
"notNull",
"(",
"writer",
",",
"\"writer\"",
")",
";",
"try",
"{",
"JAXB",
".",
"marshal",
"(",
"xmlInfo",
",",
"writer",
")",
";",
"}",
"catch",
"(",
"DataBindingException",
"e",
")",
"{",
"throw",
"new",
"XmlOperateException",
"(",
"\"fail save xml with JAXB.\"",
",",
"e",
")",
";",
"}",
"}"
] | XMLをファイルに保存する。
@since 1.1
@param xmlInfo XML情報。
@param writer
@throws XmlOperateException XMLの書き込みに失敗した場合。
@throws IllegalArgumentException xmlInfo is null.
@throws IllegalArgumentException writer is null. | [
"XMLをファイルに保存する。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java#L131-L142 |
apiman/apiman | gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java | RedisBackingStore.withMap | private void withMap(Consumer<RMap<String, String>> consumer) {
"""
Pass an {@link RMap} to the consumer.
@param consumer the consumer of the {@link RMap}
"""
final RMap<String, String> map = client.getMap(prefix);
consumer.accept(map);
} | java | private void withMap(Consumer<RMap<String, String>> consumer) {
final RMap<String, String> map = client.getMap(prefix);
consumer.accept(map);
} | [
"private",
"void",
"withMap",
"(",
"Consumer",
"<",
"RMap",
"<",
"String",
",",
"String",
">",
">",
"consumer",
")",
"{",
"final",
"RMap",
"<",
"String",
",",
"String",
">",
"map",
"=",
"client",
".",
"getMap",
"(",
"prefix",
")",
";",
"consumer",
".",
"accept",
"(",
"map",
")",
";",
"}"
] | Pass an {@link RMap} to the consumer.
@param consumer the consumer of the {@link RMap} | [
"Pass",
"an",
"{",
"@link",
"RMap",
"}",
"to",
"the",
"consumer",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java#L60-L63 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_users_login_incoming_GET | public ArrayList<Long> serviceName_users_login_incoming_GET(String serviceName, String login, String sender, String tag) throws IOException {
"""
Sms received associated to the sms user
REST: GET /sms/{serviceName}/users/{login}/incoming
@param tag [required] Filter the value of tag property (=)
@param sender [required] Filter the value of sender property (=)
@param serviceName [required] The internal name of your SMS offer
@param login [required] The sms user login
"""
String qPath = "/sms/{serviceName}/users/{login}/incoming";
StringBuilder sb = path(qPath, serviceName, login);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_users_login_incoming_GET(String serviceName, String login, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/incoming";
StringBuilder sb = path(qPath, serviceName, login);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_users_login_incoming_GET",
"(",
"String",
"serviceName",
",",
"String",
"login",
",",
"String",
"sender",
",",
"String",
"tag",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/users/{login}/incoming\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"login",
")",
";",
"query",
"(",
"sb",
",",
"\"sender\"",
",",
"sender",
")",
";",
"query",
"(",
"sb",
",",
"\"tag\"",
",",
"tag",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t2",
")",
";",
"}"
] | Sms received associated to the sms user
REST: GET /sms/{serviceName}/users/{login}/incoming
@param tag [required] Filter the value of tag property (=)
@param sender [required] Filter the value of sender property (=)
@param serviceName [required] The internal name of your SMS offer
@param login [required] The sms user login | [
"Sms",
"received",
"associated",
"to",
"the",
"sms",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1021-L1028 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/Compound.java | Compound.in2in | public void in2in(String in, Object to, String to_in) {
"""
Maps a Compound Input field to a internal simple input field.
@param in Compound input field.
@param to internal Component
@param to_in Input field of the internal component
"""
controller.mapIn(in, to, to_in);
} | java | public void in2in(String in, Object to, String to_in) {
controller.mapIn(in, to, to_in);
} | [
"public",
"void",
"in2in",
"(",
"String",
"in",
",",
"Object",
"to",
",",
"String",
"to_in",
")",
"{",
"controller",
".",
"mapIn",
"(",
"in",
",",
"to",
",",
"to_in",
")",
";",
"}"
] | Maps a Compound Input field to a internal simple input field.
@param in Compound input field.
@param to internal Component
@param to_in Input field of the internal component | [
"Maps",
"a",
"Compound",
"Input",
"field",
"to",
"a",
"internal",
"simple",
"input",
"field",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L145-L147 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java | Downloader.checkMD5OfFile | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
"""
Check the MD5 of the specified file
@param targetMD5 Expected MD5
@param file File to check
@return True if MD5 matches, false otherwise
"""
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | java | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | [
"public",
"static",
"boolean",
"checkMD5OfFile",
"(",
"String",
"targetMD5",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"FileUtils",
".",
"openInputStream",
"(",
"file",
")",
";",
"String",
"trueMd5",
"=",
"DigestUtils",
".",
"md5Hex",
"(",
"in",
")",
";",
"IOUtils",
".",
"closeQuietly",
"(",
"in",
")",
";",
"return",
"(",
"targetMD5",
".",
"equals",
"(",
"trueMd5",
")",
")",
";",
"}"
] | Check the MD5 of the specified file
@param targetMD5 Expected MD5
@param file File to check
@return True if MD5 matches, false otherwise | [
"Check",
"the",
"MD5",
"of",
"the",
"specified",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java#L118-L123 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_backupStorage_GET | public ArrayList<String> dedicated_server_serviceName_backupStorage_GET(String serviceName, OvhBackupStorageCapacityEnum capacity) throws IOException {
"""
Get allowed durations for 'backupStorage' option
REST: GET /order/dedicated/server/{serviceName}/backupStorage
@param capacity [required] The capacity in gigabytes of your backup storage
@param serviceName [required] The internal name of your dedicated server
"""
String qPath = "/order/dedicated/server/{serviceName}/backupStorage";
StringBuilder sb = path(qPath, serviceName);
query(sb, "capacity", capacity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> dedicated_server_serviceName_backupStorage_GET(String serviceName, OvhBackupStorageCapacityEnum capacity) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/backupStorage";
StringBuilder sb = path(qPath, serviceName);
query(sb, "capacity", capacity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"dedicated_server_serviceName_backupStorage_GET",
"(",
"String",
"serviceName",
",",
"OvhBackupStorageCapacityEnum",
"capacity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/backupStorage\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"capacity\"",
",",
"capacity",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Get allowed durations for 'backupStorage' option
REST: GET /order/dedicated/server/{serviceName}/backupStorage
@param capacity [required] The capacity in gigabytes of your backup storage
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"allowed",
"durations",
"for",
"backupStorage",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2484-L2490 |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/ApiTokenClient.java | ApiTokenClient.createDataStore | public DataStore createDataStore(final File file, final String name, final int fromline, final DataStore.Separator separator, final DataStore.StringDelimiter delimiter) {
"""
Creates a new data store.
@param file CSV file that should be uploaded (N.B. max 50MB)
@param name name to use in the Load Impact web-console
@param fromline Payload from this line (1st line is 1). Set to value 2, if the CSV file starts with a headings line
@param separator field separator, one of {@link com.loadimpact.resource.DataStore.Separator}
@param delimiter surround delimiter for text-strings, one of {@link com.loadimpact.resource.DataStore.StringDelimiter}
@return {@link com.loadimpact.resource.DataStore}
"""
return invoke(DATA_STORES,
new RequestClosure<JsonObject>() {
@Override
public JsonObject call(Invocation.Builder request) {
MultiPart form = new FormDataMultiPart()
.field("name", name)
.field("fromline", Integer.toString(fromline))
.field("separator", separator.param())
.field("delimiter", delimiter.param())
.bodyPart(new FileDataBodyPart("file", file, new MediaType("text", "csv")));
return request.post(Entity.entity(form, form.getMediaType()), JsonObject.class);
}
},
new ResponseClosure<JsonObject, DataStore>() {
@Override
public DataStore call(JsonObject json) {
return new DataStore(json);
}
}
);
} | java | public DataStore createDataStore(final File file, final String name, final int fromline, final DataStore.Separator separator, final DataStore.StringDelimiter delimiter) {
return invoke(DATA_STORES,
new RequestClosure<JsonObject>() {
@Override
public JsonObject call(Invocation.Builder request) {
MultiPart form = new FormDataMultiPart()
.field("name", name)
.field("fromline", Integer.toString(fromline))
.field("separator", separator.param())
.field("delimiter", delimiter.param())
.bodyPart(new FileDataBodyPart("file", file, new MediaType("text", "csv")));
return request.post(Entity.entity(form, form.getMediaType()), JsonObject.class);
}
},
new ResponseClosure<JsonObject, DataStore>() {
@Override
public DataStore call(JsonObject json) {
return new DataStore(json);
}
}
);
} | [
"public",
"DataStore",
"createDataStore",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"name",
",",
"final",
"int",
"fromline",
",",
"final",
"DataStore",
".",
"Separator",
"separator",
",",
"final",
"DataStore",
".",
"StringDelimiter",
"delimiter",
")",
"{",
"return",
"invoke",
"(",
"DATA_STORES",
",",
"new",
"RequestClosure",
"<",
"JsonObject",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"JsonObject",
"call",
"(",
"Invocation",
".",
"Builder",
"request",
")",
"{",
"MultiPart",
"form",
"=",
"new",
"FormDataMultiPart",
"(",
")",
".",
"field",
"(",
"\"name\"",
",",
"name",
")",
".",
"field",
"(",
"\"fromline\"",
",",
"Integer",
".",
"toString",
"(",
"fromline",
")",
")",
".",
"field",
"(",
"\"separator\"",
",",
"separator",
".",
"param",
"(",
")",
")",
".",
"field",
"(",
"\"delimiter\"",
",",
"delimiter",
".",
"param",
"(",
")",
")",
".",
"bodyPart",
"(",
"new",
"FileDataBodyPart",
"(",
"\"file\"",
",",
"file",
",",
"new",
"MediaType",
"(",
"\"text\"",
",",
"\"csv\"",
")",
")",
")",
";",
"return",
"request",
".",
"post",
"(",
"Entity",
".",
"entity",
"(",
"form",
",",
"form",
".",
"getMediaType",
"(",
")",
")",
",",
"JsonObject",
".",
"class",
")",
";",
"}",
"}",
",",
"new",
"ResponseClosure",
"<",
"JsonObject",
",",
"DataStore",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DataStore",
"call",
"(",
"JsonObject",
"json",
")",
"{",
"return",
"new",
"DataStore",
"(",
"json",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a new data store.
@param file CSV file that should be uploaded (N.B. max 50MB)
@param name name to use in the Load Impact web-console
@param fromline Payload from this line (1st line is 1). Set to value 2, if the CSV file starts with a headings line
@param separator field separator, one of {@link com.loadimpact.resource.DataStore.Separator}
@param delimiter surround delimiter for text-strings, one of {@link com.loadimpact.resource.DataStore.StringDelimiter}
@return {@link com.loadimpact.resource.DataStore} | [
"Creates",
"a",
"new",
"data",
"store",
"."
] | train | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/ApiTokenClient.java#L788-L810 |
virgo47/javasimon | jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java | SimonConnectionConfiguration.getProperty | private static String getProperty(String driverId, String propertyName) {
"""
Gets value of the specified property.
@param driverId Driver Id
@param propertyName Property name
@return property value or {@code null}
"""
String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName);
if (propertyValue != null) {
propertyValue = propertyValue.trim();
if (propertyValue.isEmpty()) {
propertyValue = null;
}
}
return propertyValue;
} | java | private static String getProperty(String driverId, String propertyName) {
String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName);
if (propertyValue != null) {
propertyValue = propertyValue.trim();
if (propertyValue.isEmpty()) {
propertyValue = null;
}
}
return propertyValue;
} | [
"private",
"static",
"String",
"getProperty",
"(",
"String",
"driverId",
",",
"String",
"propertyName",
")",
"{",
"String",
"propertyValue",
"=",
"PROPERTIES",
".",
"getProperty",
"(",
"DEFAULT_PREFIX",
"+",
"\".\"",
"+",
"driverId",
"+",
"\".\"",
"+",
"propertyName",
")",
";",
"if",
"(",
"propertyValue",
"!=",
"null",
")",
"{",
"propertyValue",
"=",
"propertyValue",
".",
"trim",
"(",
")",
";",
"if",
"(",
"propertyValue",
".",
"isEmpty",
"(",
")",
")",
"{",
"propertyValue",
"=",
"null",
";",
"}",
"}",
"return",
"propertyValue",
";",
"}"
] | Gets value of the specified property.
@param driverId Driver Id
@param propertyName Property name
@return property value or {@code null} | [
"Gets",
"value",
"of",
"the",
"specified",
"property",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java#L156-L165 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java | OpenSSLPKCS12.P12toPEM | public static void P12toPEM(File p12, String p12Password, File toPEM, String pemPassword) throws IOException {
"""
@param p12
@param p12Password
@param toPEM
@param pemPassword
@throws IOException
if a catastrophic unexpected failure occurs during execution
@throws IllegalArgumentException
if the PKCS12 keystore doesn't exist
@throws IllegalStateException
if openssl exits with a failure condition
"""
if (!p12.exists())
throw new IllegalArgumentException("p12 file does not exist: " + p12.getPath());
Execed openssl = Exec.utilityAs(null,
OPENSSL,
"pkcs12",
"-in",
p12.getPath(),
"-out",
toPEM.getPath(),
"-passin",
"pass:" + p12Password,
"-nodes");
int returnCode = openssl.waitForExit();
if (returnCode != 0)
throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" +
openssl.getStandardOut());
} | java | public static void P12toPEM(File p12, String p12Password, File toPEM, String pemPassword) throws IOException
{
if (!p12.exists())
throw new IllegalArgumentException("p12 file does not exist: " + p12.getPath());
Execed openssl = Exec.utilityAs(null,
OPENSSL,
"pkcs12",
"-in",
p12.getPath(),
"-out",
toPEM.getPath(),
"-passin",
"pass:" + p12Password,
"-nodes");
int returnCode = openssl.waitForExit();
if (returnCode != 0)
throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" +
openssl.getStandardOut());
} | [
"public",
"static",
"void",
"P12toPEM",
"(",
"File",
"p12",
",",
"String",
"p12Password",
",",
"File",
"toPEM",
",",
"String",
"pemPassword",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"p12",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"p12 file does not exist: \"",
"+",
"p12",
".",
"getPath",
"(",
")",
")",
";",
"Execed",
"openssl",
"=",
"Exec",
".",
"utilityAs",
"(",
"null",
",",
"OPENSSL",
",",
"\"pkcs12\"",
",",
"\"-in\"",
",",
"p12",
".",
"getPath",
"(",
")",
",",
"\"-out\"",
",",
"toPEM",
".",
"getPath",
"(",
")",
",",
"\"-passin\"",
",",
"\"pass:\"",
"+",
"p12Password",
",",
"\"-nodes\"",
")",
";",
"int",
"returnCode",
"=",
"openssl",
".",
"waitForExit",
"(",
")",
";",
"if",
"(",
"returnCode",
"!=",
"0",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected openssl exit code \"",
"+",
"returnCode",
"+",
"\"; output:\\n\"",
"+",
"openssl",
".",
"getStandardOut",
"(",
")",
")",
";",
"}"
] | @param p12
@param p12Password
@param toPEM
@param pemPassword
@throws IOException
if a catastrophic unexpected failure occurs during execution
@throws IllegalArgumentException
if the PKCS12 keystore doesn't exist
@throws IllegalStateException
if openssl exits with a failure condition | [
"@param",
"p12",
"@param",
"p12Password",
"@param",
"toPEM",
"@param",
"pemPassword"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java#L75-L96 |
kobakei/Android-RateThisApp | ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java | RateThisApp.showRateDialogIfNeeded | public static boolean showRateDialogIfNeeded(final Context context, int themeId) {
"""
Show the rate dialog if the criteria is satisfied.
@param context Context
@param themeId Theme ID
@return true if shown, false otherwise.
"""
if (shouldShowRateDialog()) {
showRateDialog(context, themeId);
return true;
} else {
return false;
}
} | java | public static boolean showRateDialogIfNeeded(final Context context, int themeId) {
if (shouldShowRateDialog()) {
showRateDialog(context, themeId);
return true;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"showRateDialogIfNeeded",
"(",
"final",
"Context",
"context",
",",
"int",
"themeId",
")",
"{",
"if",
"(",
"shouldShowRateDialog",
"(",
")",
")",
"{",
"showRateDialog",
"(",
"context",
",",
"themeId",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Show the rate dialog if the criteria is satisfied.
@param context Context
@param themeId Theme ID
@return true if shown, false otherwise. | [
"Show",
"the",
"rate",
"dialog",
"if",
"the",
"criteria",
"is",
"satisfied",
"."
] | train | https://github.com/kobakei/Android-RateThisApp/blob/c3d007c8c02beb6ff196745c2310c259737f5c81/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java#L145-L152 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.isField | public void isField(String template, Properties attributes) throws XDocletException {
"""
The <code>isField</code> processes the template body if the current member is a field.
@param template a <code>String</code> value
@param attributes a <code>Properties</code> value
@exception XDocletException if an error occurs
@doc:tag type="content"
"""
if (getCurrentField() != null) {
generate(template);
}
} | java | public void isField(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
generate(template);
}
} | [
"public",
"void",
"isField",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"generate",
"(",
"template",
")",
";",
"}",
"}"
] | The <code>isField</code> processes the template body if the current member is a field.
@param template a <code>String</code> value
@param attributes a <code>Properties</code> value
@exception XDocletException if an error occurs
@doc:tag type="content" | [
"The",
"<code",
">",
"isField<",
"/",
"code",
">",
"processes",
"the",
"template",
"body",
"if",
"the",
"current",
"member",
"is",
"a",
"field",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L119-L124 |
drallgood/jpasskit | jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java | CertUtils.toX509Certificate | public static X509Certificate toX509Certificate(InputStream certificateInputStream) throws CertificateException {
"""
Load a DER Certificate from an already opened {@link InputStream}.
The caller is responsible for closing the stream after this method completes successfully or fails.
@param certificateInputStream {@link InputStream} containing the certificate.
@return {@link X509Certificate} loaded from {@code certificateInputStream}
@throws IllegalStateException
If {@link X509Certificate} loading failed.
@throws CertificateException
If {@link X509Certificate} is invalid or cannot be loaded.
"""
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", getProviderName());
Certificate certificate = certificateFactory.generateCertificate(certificateInputStream);
if (certificate instanceof X509Certificate) {
((X509Certificate) certificate).checkValidity();
return (X509Certificate) certificate;
}
throw new IllegalStateException("The key from the input stream could not be decrypted");
} catch (NoSuchProviderException ex) {
throw new IllegalStateException("The key from the input stream could not be decrypted", ex);
}
} | java | public static X509Certificate toX509Certificate(InputStream certificateInputStream) throws CertificateException {
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", getProviderName());
Certificate certificate = certificateFactory.generateCertificate(certificateInputStream);
if (certificate instanceof X509Certificate) {
((X509Certificate) certificate).checkValidity();
return (X509Certificate) certificate;
}
throw new IllegalStateException("The key from the input stream could not be decrypted");
} catch (NoSuchProviderException ex) {
throw new IllegalStateException("The key from the input stream could not be decrypted", ex);
}
} | [
"public",
"static",
"X509Certificate",
"toX509Certificate",
"(",
"InputStream",
"certificateInputStream",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"CertificateFactory",
"certificateFactory",
"=",
"CertificateFactory",
".",
"getInstance",
"(",
"\"X.509\"",
",",
"getProviderName",
"(",
")",
")",
";",
"Certificate",
"certificate",
"=",
"certificateFactory",
".",
"generateCertificate",
"(",
"certificateInputStream",
")",
";",
"if",
"(",
"certificate",
"instanceof",
"X509Certificate",
")",
"{",
"(",
"(",
"X509Certificate",
")",
"certificate",
")",
".",
"checkValidity",
"(",
")",
";",
"return",
"(",
"X509Certificate",
")",
"certificate",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"The key from the input stream could not be decrypted\"",
")",
";",
"}",
"catch",
"(",
"NoSuchProviderException",
"ex",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The key from the input stream could not be decrypted\"",
",",
"ex",
")",
";",
"}",
"}"
] | Load a DER Certificate from an already opened {@link InputStream}.
The caller is responsible for closing the stream after this method completes successfully or fails.
@param certificateInputStream {@link InputStream} containing the certificate.
@return {@link X509Certificate} loaded from {@code certificateInputStream}
@throws IllegalStateException
If {@link X509Certificate} loading failed.
@throws CertificateException
If {@link X509Certificate} is invalid or cannot be loaded. | [
"Load",
"a",
"DER",
"Certificate",
"from",
"an",
"already",
"opened",
"{",
"@link",
"InputStream",
"}",
".",
"The",
"caller",
"is",
"responsible",
"for",
"closing",
"the",
"stream",
"after",
"this",
"method",
"completes",
"successfully",
"or",
"fails",
"."
] | train | https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java#L117-L129 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CurrencyDisplayNames.java | CurrencyDisplayNames.getInstance | public static CurrencyDisplayNames getInstance(ULocale locale, boolean noSubstitute) {
"""
Return an instance of CurrencyDisplayNames that provides information
localized for display in the provided locale. If noSubstitute is false,
this behaves like {@link #getInstance(ULocale)}. Otherwise, 1) if there
is no supporting data for the locale at all, there is no fallback through
the default locale or root, and null is returned, and 2) if there is data
for the locale, but not data for the requested ISO code, null is returned
from those APIs instead of a substitute value.
@param locale the locale into which to localize the names
@param noSubstitute if true, do not return substitute values.
@return a CurrencyDisplayNames
"""
return CurrencyData.provider.getInstance(locale, !noSubstitute);
} | java | public static CurrencyDisplayNames getInstance(ULocale locale, boolean noSubstitute) {
return CurrencyData.provider.getInstance(locale, !noSubstitute);
} | [
"public",
"static",
"CurrencyDisplayNames",
"getInstance",
"(",
"ULocale",
"locale",
",",
"boolean",
"noSubstitute",
")",
"{",
"return",
"CurrencyData",
".",
"provider",
".",
"getInstance",
"(",
"locale",
",",
"!",
"noSubstitute",
")",
";",
"}"
] | Return an instance of CurrencyDisplayNames that provides information
localized for display in the provided locale. If noSubstitute is false,
this behaves like {@link #getInstance(ULocale)}. Otherwise, 1) if there
is no supporting data for the locale at all, there is no fallback through
the default locale or root, and null is returned, and 2) if there is data
for the locale, but not data for the requested ISO code, null is returned
from those APIs instead of a substitute value.
@param locale the locale into which to localize the names
@param noSubstitute if true, do not return substitute values.
@return a CurrencyDisplayNames | [
"Return",
"an",
"instance",
"of",
"CurrencyDisplayNames",
"that",
"provides",
"information",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"If",
"noSubstitute",
"is",
"false",
"this",
"behaves",
"like",
"{",
"@link",
"#getInstance",
"(",
"ULocale",
")",
"}",
".",
"Otherwise",
"1",
")",
"if",
"there",
"is",
"no",
"supporting",
"data",
"for",
"the",
"locale",
"at",
"all",
"there",
"is",
"no",
"fallback",
"through",
"the",
"default",
"locale",
"or",
"root",
"and",
"null",
"is",
"returned",
"and",
"2",
")",
"if",
"there",
"is",
"data",
"for",
"the",
"locale",
"but",
"not",
"data",
"for",
"the",
"requested",
"ISO",
"code",
"null",
"is",
"returned",
"from",
"those",
"APIs",
"instead",
"of",
"a",
"substitute",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CurrencyDisplayNames.java#L69-L71 |
Azure/azure-sdk-for-java | iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java | AppsInner.beginDelete | public void beginDelete(String resourceGroupName, String resourceName) {
"""
Delete an IoT Central application.
@param resourceGroupName The name of the resource group that contains the IoT Central application.
@param resourceName The ARM resource name of the IoT Central application.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String resourceName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Delete an IoT Central application.
@param resourceGroupName The name of the resource group that contains the IoT Central application.
@param resourceName The ARM resource name of the IoT Central application.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Delete",
"an",
"IoT",
"Central",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L629-L631 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java | OriginTrackedValue.of | public static OriginTrackedValue of(Object value, Origin origin) {
"""
Create an {@link OriginTrackedValue} containing the specified {@code value} and
{@code origin}. If the source value implements {@link CharSequence} then so will
the resulting {@link OriginTrackedValue}.
@param value the source value
@param origin the origin
@return an {@link OriginTrackedValue} or {@code null} if the source value was
{@code null}.
"""
if (value == null) {
return null;
}
if (value instanceof CharSequence) {
return new OriginTrackedCharSequence((CharSequence) value, origin);
}
return new OriginTrackedValue(value, origin);
} | java | public static OriginTrackedValue of(Object value, Origin origin) {
if (value == null) {
return null;
}
if (value instanceof CharSequence) {
return new OriginTrackedCharSequence((CharSequence) value, origin);
}
return new OriginTrackedValue(value, origin);
} | [
"public",
"static",
"OriginTrackedValue",
"of",
"(",
"Object",
"value",
",",
"Origin",
"origin",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"value",
"instanceof",
"CharSequence",
")",
"{",
"return",
"new",
"OriginTrackedCharSequence",
"(",
"(",
"CharSequence",
")",
"value",
",",
"origin",
")",
";",
"}",
"return",
"new",
"OriginTrackedValue",
"(",
"value",
",",
"origin",
")",
";",
"}"
] | Create an {@link OriginTrackedValue} containing the specified {@code value} and
{@code origin}. If the source value implements {@link CharSequence} then so will
the resulting {@link OriginTrackedValue}.
@param value the source value
@param origin the origin
@return an {@link OriginTrackedValue} or {@code null} if the source value was
{@code null}. | [
"Create",
"an",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java#L85-L93 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java | POIUtils.mergeCells | public static CellRangeAddress mergeCells(final Sheet sheet, int startCol, int startRow, int endCol, int endRow) {
"""
指定した範囲のセルを結合する。
@param sheet
@param startCol
@param startRow
@param endCol
@param endRow
@return 結合した範囲のアドレス情報
@throws IllegalArgumentException {@literal sheet == null}
"""
ArgUtils.notNull(sheet, "sheet");
// 結合先のセルの値を空に設定する
for(int r=startRow; r <= endRow; r++) {
for(int c=startCol; c <= endCol; c++) {
if(r == startRow && c == startCol) {
continue;
}
Cell cell = getCell(sheet, c, r);
cell.setCellType(CellType.BLANK);
}
}
final CellRangeAddress range = new CellRangeAddress(startRow, endRow, startCol, endCol);
sheet.addMergedRegion(range);
return range;
} | java | public static CellRangeAddress mergeCells(final Sheet sheet, int startCol, int startRow, int endCol, int endRow) {
ArgUtils.notNull(sheet, "sheet");
// 結合先のセルの値を空に設定する
for(int r=startRow; r <= endRow; r++) {
for(int c=startCol; c <= endCol; c++) {
if(r == startRow && c == startCol) {
continue;
}
Cell cell = getCell(sheet, c, r);
cell.setCellType(CellType.BLANK);
}
}
final CellRangeAddress range = new CellRangeAddress(startRow, endRow, startCol, endCol);
sheet.addMergedRegion(range);
return range;
} | [
"public",
"static",
"CellRangeAddress",
"mergeCells",
"(",
"final",
"Sheet",
"sheet",
",",
"int",
"startCol",
",",
"int",
"startRow",
",",
"int",
"endCol",
",",
"int",
"endRow",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"sheet",
",",
"\"sheet\"",
")",
";",
"// 結合先のセルの値を空に設定する\r",
"for",
"(",
"int",
"r",
"=",
"startRow",
";",
"r",
"<=",
"endRow",
";",
"r",
"++",
")",
"{",
"for",
"(",
"int",
"c",
"=",
"startCol",
";",
"c",
"<=",
"endCol",
";",
"c",
"++",
")",
"{",
"if",
"(",
"r",
"==",
"startRow",
"&&",
"c",
"==",
"startCol",
")",
"{",
"continue",
";",
"}",
"Cell",
"cell",
"=",
"getCell",
"(",
"sheet",
",",
"c",
",",
"r",
")",
";",
"cell",
".",
"setCellType",
"(",
"CellType",
".",
"BLANK",
")",
";",
"}",
"}",
"final",
"CellRangeAddress",
"range",
"=",
"new",
"CellRangeAddress",
"(",
"startRow",
",",
"endRow",
",",
"startCol",
",",
"endCol",
")",
";",
"sheet",
".",
"addMergedRegion",
"(",
"range",
")",
";",
"return",
"range",
";",
"}"
] | 指定した範囲のセルを結合する。
@param sheet
@param startCol
@param startRow
@param endCol
@param endRow
@return 結合した範囲のアドレス情報
@throws IllegalArgumentException {@literal sheet == null} | [
"指定した範囲のセルを結合する。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L335-L354 |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/AnnotationInfoImpl.java | AnnotationInfoImpl.addAnnotationValue | public AnnotationValueImpl addAnnotationValue(String name, String enumClassName, String enumName) {
"""
the enumeration class name and the enumeration literal value.
"""
AnnotationValueImpl annotationValue = new AnnotationValueImpl(enumClassName, enumName);
addAnnotationValue(name, annotationValue);
return annotationValue;
} | java | public AnnotationValueImpl addAnnotationValue(String name, String enumClassName, String enumName) {
AnnotationValueImpl annotationValue = new AnnotationValueImpl(enumClassName, enumName);
addAnnotationValue(name, annotationValue);
return annotationValue;
} | [
"public",
"AnnotationValueImpl",
"addAnnotationValue",
"(",
"String",
"name",
",",
"String",
"enumClassName",
",",
"String",
"enumName",
")",
"{",
"AnnotationValueImpl",
"annotationValue",
"=",
"new",
"AnnotationValueImpl",
"(",
"enumClassName",
",",
"enumName",
")",
";",
"addAnnotationValue",
"(",
"name",
",",
"annotationValue",
")",
";",
"return",
"annotationValue",
";",
"}"
] | the enumeration class name and the enumeration literal value. | [
"the",
"enumeration",
"class",
"name",
"and",
"the",
"enumeration",
"literal",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/AnnotationInfoImpl.java#L237-L243 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Double | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
"""
Print values from double array
@param values double value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error
@since 1.4.0
"""
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | java | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Double",
"(",
"final",
"double",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Double",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from double array
@param values double value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error
@since 1.4.0 | [
"Print",
"values",
"from",
"double",
"array"
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L991-L996 |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/Client.java | Client.initializeLogging | private void initializeLogging() {
"""
Sets up Log4J to write log messages to the console. Low-priority messages
are logged to stdout while high-priority messages go to stderr.
"""
// Since logging is static, make sure this is done only once even if
// multiple clients are created (e.g., during tests)
if (consoleAppender != null) {
return;
}
consoleAppender = new ConsoleAppender();
consoleAppender.setLayout(new PatternLayout(LOG_PATTERN));
consoleAppender.setThreshold(Level.INFO);
LevelRangeFilter filter = new LevelRangeFilter();
filter.setLevelMin(Level.TRACE);
filter.setLevelMax(Level.INFO);
consoleAppender.addFilter(filter);
consoleAppender.activateOptions();
org.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender);
errorAppender = new ConsoleAppender();
errorAppender.setLayout(new PatternLayout(LOG_PATTERN));
errorAppender.setThreshold(Level.WARN);
errorAppender.setTarget(ConsoleAppender.SYSTEM_ERR);
errorAppender.activateOptions();
org.apache.log4j.Logger.getRootLogger().addAppender(errorAppender);
} | java | private void initializeLogging() {
// Since logging is static, make sure this is done only once even if
// multiple clients are created (e.g., during tests)
if (consoleAppender != null) {
return;
}
consoleAppender = new ConsoleAppender();
consoleAppender.setLayout(new PatternLayout(LOG_PATTERN));
consoleAppender.setThreshold(Level.INFO);
LevelRangeFilter filter = new LevelRangeFilter();
filter.setLevelMin(Level.TRACE);
filter.setLevelMax(Level.INFO);
consoleAppender.addFilter(filter);
consoleAppender.activateOptions();
org.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender);
errorAppender = new ConsoleAppender();
errorAppender.setLayout(new PatternLayout(LOG_PATTERN));
errorAppender.setThreshold(Level.WARN);
errorAppender.setTarget(ConsoleAppender.SYSTEM_ERR);
errorAppender.activateOptions();
org.apache.log4j.Logger.getRootLogger().addAppender(errorAppender);
} | [
"private",
"void",
"initializeLogging",
"(",
")",
"{",
"// Since logging is static, make sure this is done only once even if",
"// multiple clients are created (e.g., during tests)",
"if",
"(",
"consoleAppender",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"consoleAppender",
"=",
"new",
"ConsoleAppender",
"(",
")",
";",
"consoleAppender",
".",
"setLayout",
"(",
"new",
"PatternLayout",
"(",
"LOG_PATTERN",
")",
")",
";",
"consoleAppender",
".",
"setThreshold",
"(",
"Level",
".",
"INFO",
")",
";",
"LevelRangeFilter",
"filter",
"=",
"new",
"LevelRangeFilter",
"(",
")",
";",
"filter",
".",
"setLevelMin",
"(",
"Level",
".",
"TRACE",
")",
";",
"filter",
".",
"setLevelMax",
"(",
"Level",
".",
"INFO",
")",
";",
"consoleAppender",
".",
"addFilter",
"(",
"filter",
")",
";",
"consoleAppender",
".",
"activateOptions",
"(",
")",
";",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
".",
"getRootLogger",
"(",
")",
".",
"addAppender",
"(",
"consoleAppender",
")",
";",
"errorAppender",
"=",
"new",
"ConsoleAppender",
"(",
")",
";",
"errorAppender",
".",
"setLayout",
"(",
"new",
"PatternLayout",
"(",
"LOG_PATTERN",
")",
")",
";",
"errorAppender",
".",
"setThreshold",
"(",
"Level",
".",
"WARN",
")",
";",
"errorAppender",
".",
"setTarget",
"(",
"ConsoleAppender",
".",
"SYSTEM_ERR",
")",
";",
"errorAppender",
".",
"activateOptions",
"(",
")",
";",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
".",
"getRootLogger",
"(",
")",
".",
"addAppender",
"(",
"errorAppender",
")",
";",
"}"
] | Sets up Log4J to write log messages to the console. Low-priority messages
are logged to stdout while high-priority messages go to stderr. | [
"Sets",
"up",
"Log4J",
"to",
"write",
"log",
"messages",
"to",
"the",
"console",
".",
"Low",
"-",
"priority",
"messages",
"are",
"logged",
"to",
"stdout",
"while",
"high",
"-",
"priority",
"messages",
"go",
"to",
"stderr",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/Client.java#L196-L219 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/CustomFieldDefinitionDeserializer.java | CustomFieldDefinitionDeserializer.getCustomFieldDefinitionType | private CustomFieldDefinition getCustomFieldDefinitionType(JsonNode jn) throws IOException {
"""
Method to get the CustomFieldDefinition implementation type object
@param jn the Json Node
@return CustomFieldDefinition implementation reference
@throws IOException
"""
if (jn.isArray()) {
JsonNode jn1 = jn.get(0);
String type = jn1.get(TYPE).textValue();
try {
return (CustomFieldDefinition) Class.forName("com.intuit.ipp.data." + type + "CustomFieldDefinition").newInstance();
} catch (Exception e) {
throw new IOException("Exception while deserializing CustomFieldDefinition", e);
}
}
return null;
} | java | private CustomFieldDefinition getCustomFieldDefinitionType(JsonNode jn) throws IOException {
if (jn.isArray()) {
JsonNode jn1 = jn.get(0);
String type = jn1.get(TYPE).textValue();
try {
return (CustomFieldDefinition) Class.forName("com.intuit.ipp.data." + type + "CustomFieldDefinition").newInstance();
} catch (Exception e) {
throw new IOException("Exception while deserializing CustomFieldDefinition", e);
}
}
return null;
} | [
"private",
"CustomFieldDefinition",
"getCustomFieldDefinitionType",
"(",
"JsonNode",
"jn",
")",
"throws",
"IOException",
"{",
"if",
"(",
"jn",
".",
"isArray",
"(",
")",
")",
"{",
"JsonNode",
"jn1",
"=",
"jn",
".",
"get",
"(",
"0",
")",
";",
"String",
"type",
"=",
"jn1",
".",
"get",
"(",
"TYPE",
")",
".",
"textValue",
"(",
")",
";",
"try",
"{",
"return",
"(",
"CustomFieldDefinition",
")",
"Class",
".",
"forName",
"(",
"\"com.intuit.ipp.data.\"",
"+",
"type",
"+",
"\"CustomFieldDefinition\"",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Exception while deserializing CustomFieldDefinition\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Method to get the CustomFieldDefinition implementation type object
@param jn the Json Node
@return CustomFieldDefinition implementation reference
@throws IOException | [
"Method",
"to",
"get",
"the",
"CustomFieldDefinition",
"implementation",
"type",
"object"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/CustomFieldDefinitionDeserializer.java#L113-L125 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java | CachedRemoteTable.set | public void set(Object data, int iOpenMode) throws DBException, RemoteException {
"""
Update the current record.
@param The data to update.
@exception Exception File exception.
"""
int iErrorCode = this.checkCurrentCacheIsPhysical(data);
if (iErrorCode != Constants.NORMAL_RETURN)
throw new DBException(iErrorCode); // Data probably changed from last time I read it.
m_tableRemote.set(data, iOpenMode);
if (m_objCurrentCacheRecord != null)
{
if (m_mapCache != null)
{
if ((cacheMode == CacheMode.CACHE_ON_WRITE) || (cacheMode == CacheMode.PASSIVE_CACHE))
m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), data);
else
m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), null);
}
else if (m_htCache != null)
{
m_htCache.remove(m_objCurrentCacheRecord); // Do not put the new record back, as you don't know the new key.
}
}
m_objCurrentPhysicalRecord = NONE;
m_objCurrentLockedRecord = NONE;
m_objCurrentCacheRecord = NONE;
} | java | public void set(Object data, int iOpenMode) throws DBException, RemoteException
{
int iErrorCode = this.checkCurrentCacheIsPhysical(data);
if (iErrorCode != Constants.NORMAL_RETURN)
throw new DBException(iErrorCode); // Data probably changed from last time I read it.
m_tableRemote.set(data, iOpenMode);
if (m_objCurrentCacheRecord != null)
{
if (m_mapCache != null)
{
if ((cacheMode == CacheMode.CACHE_ON_WRITE) || (cacheMode == CacheMode.PASSIVE_CACHE))
m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), data);
else
m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), null);
}
else if (m_htCache != null)
{
m_htCache.remove(m_objCurrentCacheRecord); // Do not put the new record back, as you don't know the new key.
}
}
m_objCurrentPhysicalRecord = NONE;
m_objCurrentLockedRecord = NONE;
m_objCurrentCacheRecord = NONE;
} | [
"public",
"void",
"set",
"(",
"Object",
"data",
",",
"int",
"iOpenMode",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"int",
"iErrorCode",
"=",
"this",
".",
"checkCurrentCacheIsPhysical",
"(",
"data",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"Constants",
".",
"NORMAL_RETURN",
")",
"throw",
"new",
"DBException",
"(",
"iErrorCode",
")",
";",
"// Data probably changed from last time I read it.",
"m_tableRemote",
".",
"set",
"(",
"data",
",",
"iOpenMode",
")",
";",
"if",
"(",
"m_objCurrentCacheRecord",
"!=",
"null",
")",
"{",
"if",
"(",
"m_mapCache",
"!=",
"null",
")",
"{",
"if",
"(",
"(",
"cacheMode",
"==",
"CacheMode",
".",
"CACHE_ON_WRITE",
")",
"||",
"(",
"cacheMode",
"==",
"CacheMode",
".",
"PASSIVE_CACHE",
")",
")",
"m_mapCache",
".",
"set",
"(",
"(",
"(",
"Integer",
")",
"m_objCurrentCacheRecord",
")",
".",
"intValue",
"(",
")",
",",
"data",
")",
";",
"else",
"m_mapCache",
".",
"set",
"(",
"(",
"(",
"Integer",
")",
"m_objCurrentCacheRecord",
")",
".",
"intValue",
"(",
")",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"m_htCache",
"!=",
"null",
")",
"{",
"m_htCache",
".",
"remove",
"(",
"m_objCurrentCacheRecord",
")",
";",
"// Do not put the new record back, as you don't know the new key.",
"}",
"}",
"m_objCurrentPhysicalRecord",
"=",
"NONE",
";",
"m_objCurrentLockedRecord",
"=",
"NONE",
";",
"m_objCurrentCacheRecord",
"=",
"NONE",
";",
"}"
] | Update the current record.
@param The data to update.
@exception Exception File exception. | [
"Update",
"the",
"current",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L236-L259 |
opentable/otj-jaxrs | client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java | JaxRsClientFactory.newClient | public Client newClient(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) {
"""
Create a new {@link Client} instance with the given name and groups.
You own the returned client and are responsible for managing its cleanup.
"""
return newBuilder(clientName, feature, moreFeatures).build();
} | java | public Client newClient(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) {
return newBuilder(clientName, feature, moreFeatures).build();
} | [
"public",
"Client",
"newClient",
"(",
"String",
"clientName",
",",
"JaxRsFeatureGroup",
"feature",
",",
"JaxRsFeatureGroup",
"...",
"moreFeatures",
")",
"{",
"return",
"newBuilder",
"(",
"clientName",
",",
"feature",
",",
"moreFeatures",
")",
".",
"build",
"(",
")",
";",
"}"
] | Create a new {@link Client} instance with the given name and groups.
You own the returned client and are responsible for managing its cleanup. | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L239-L241 |
bazaarvoice/ostrich | core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java | ServicePoolBuilder.withPartitionContextAnnotationsFrom | public ServicePoolBuilder<S> withPartitionContextAnnotationsFrom(Class<? extends S> annotatedServiceClass) {
"""
Uses {@link PartitionKey} annotations from the specified class to generate partition context in the built proxy.
<p>
NOTE: This is only useful if building a proxy with {@link #buildProxy(com.bazaarvoice.ostrich.RetryPolicy)}. If
partition context is necessary with a normal service pool, then can be provided directly by calling
{@link com.bazaarvoice.ostrich.ServicePool#execute(com.bazaarvoice.ostrich.PartitionContext,
com.bazaarvoice.ostrich.RetryPolicy, com.bazaarvoice.ostrich.ServiceCallback)}.
@param annotatedServiceClass A service class with {@link PartitionKey} annotations.
@return this
"""
checkNotNull(annotatedServiceClass);
_partitionContextSupplier = new AnnotationPartitionContextSupplier(_serviceType, annotatedServiceClass);
return this;
} | java | public ServicePoolBuilder<S> withPartitionContextAnnotationsFrom(Class<? extends S> annotatedServiceClass) {
checkNotNull(annotatedServiceClass);
_partitionContextSupplier = new AnnotationPartitionContextSupplier(_serviceType, annotatedServiceClass);
return this;
} | [
"public",
"ServicePoolBuilder",
"<",
"S",
">",
"withPartitionContextAnnotationsFrom",
"(",
"Class",
"<",
"?",
"extends",
"S",
">",
"annotatedServiceClass",
")",
"{",
"checkNotNull",
"(",
"annotatedServiceClass",
")",
";",
"_partitionContextSupplier",
"=",
"new",
"AnnotationPartitionContextSupplier",
"(",
"_serviceType",
",",
"annotatedServiceClass",
")",
";",
"return",
"this",
";",
"}"
] | Uses {@link PartitionKey} annotations from the specified class to generate partition context in the built proxy.
<p>
NOTE: This is only useful if building a proxy with {@link #buildProxy(com.bazaarvoice.ostrich.RetryPolicy)}. If
partition context is necessary with a normal service pool, then can be provided directly by calling
{@link com.bazaarvoice.ostrich.ServicePool#execute(com.bazaarvoice.ostrich.PartitionContext,
com.bazaarvoice.ostrich.RetryPolicy, com.bazaarvoice.ostrich.ServiceCallback)}.
@param annotatedServiceClass A service class with {@link PartitionKey} annotations.
@return this | [
"Uses",
"{",
"@link",
"PartitionKey",
"}",
"annotations",
"from",
"the",
"specified",
"class",
"to",
"generate",
"partition",
"context",
"in",
"the",
"built",
"proxy",
".",
"<p",
">",
"NOTE",
":",
"This",
"is",
"only",
"useful",
"if",
"building",
"a",
"proxy",
"with",
"{",
"@link",
"#buildProxy",
"(",
"com",
".",
"bazaarvoice",
".",
"ostrich",
".",
"RetryPolicy",
")",
"}",
".",
"If",
"partition",
"context",
"is",
"necessary",
"with",
"a",
"normal",
"service",
"pool",
"then",
"can",
"be",
"provided",
"directly",
"by",
"calling",
"{",
"@link",
"com",
".",
"bazaarvoice",
".",
"ostrich",
".",
"ServicePool#execute",
"(",
"com",
".",
"bazaarvoice",
".",
"ostrich",
".",
"PartitionContext",
"com",
".",
"bazaarvoice",
".",
"ostrich",
".",
"RetryPolicy",
"com",
".",
"bazaarvoice",
".",
"ostrich",
".",
"ServiceCallback",
")",
"}",
"."
] | train | https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java#L211-L215 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java | Constraints.inGroup | public PropertyConstraint inGroup(String propertyName, Object[] group) {
"""
Returns a 'in' group (or set) constraint appled to the provided property.
@param propertyName the property
@param group the group items
@return The InGroup constraint.
"""
return value(propertyName, new InGroup(group));
} | java | public PropertyConstraint inGroup(String propertyName, Object[] group) {
return value(propertyName, new InGroup(group));
} | [
"public",
"PropertyConstraint",
"inGroup",
"(",
"String",
"propertyName",
",",
"Object",
"[",
"]",
"group",
")",
"{",
"return",
"value",
"(",
"propertyName",
",",
"new",
"InGroup",
"(",
"group",
")",
")",
";",
"}"
] | Returns a 'in' group (or set) constraint appled to the provided property.
@param propertyName the property
@param group the group items
@return The InGroup constraint. | [
"Returns",
"a",
"in",
"group",
"(",
"or",
"set",
")",
"constraint",
"appled",
"to",
"the",
"provided",
"property",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L619-L621 |
alkacon/opencms-core | src/org/opencms/i18n/tools/CmsContainerPageCopier.java | CmsContainerPageCopier.copyPageOnly | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
"""
Copies the given container page to the provided root path.
@param originalPage the page to copy
@param targetPageRootPath the root path of the copy target.
@throws CmsException thrown if something goes wrong.
@throws NoCustomReplacementException if a custom replacement is not found for a type which requires it.
"""
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | java | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | [
"public",
"void",
"copyPageOnly",
"(",
"CmsResource",
"originalPage",
",",
"String",
"targetPageRootPath",
")",
"throws",
"CmsException",
",",
"NoCustomReplacementException",
"{",
"if",
"(",
"(",
"null",
"==",
"originalPage",
")",
"||",
"!",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"originalPage",
")",
".",
"getTypeName",
"(",
")",
".",
"equals",
"(",
"CmsResourceTypeXmlContainerPage",
".",
"getStaticTypeName",
"(",
")",
")",
")",
"{",
"throw",
"new",
"CmsException",
"(",
"new",
"CmsMessageContainer",
"(",
"Messages",
".",
"get",
"(",
")",
",",
"Messages",
".",
"ERR_PAGECOPY_INVALID_PAGE_0",
")",
")",
";",
"}",
"m_originalPage",
"=",
"originalPage",
";",
"CmsObject",
"rootCms",
"=",
"getRootCms",
"(",
")",
";",
"rootCms",
".",
"copyResource",
"(",
"originalPage",
".",
"getRootPath",
"(",
")",
",",
"targetPageRootPath",
")",
";",
"CmsResource",
"copiedPage",
"=",
"rootCms",
".",
"readResource",
"(",
"targetPageRootPath",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
")",
";",
"m_targetFolder",
"=",
"rootCms",
".",
"readResource",
"(",
"CmsResource",
".",
"getFolderPath",
"(",
"copiedPage",
".",
"getRootPath",
"(",
")",
")",
")",
";",
"replaceElements",
"(",
"copiedPage",
")",
";",
"attachLocaleGroups",
"(",
"copiedPage",
")",
";",
"tryUnlock",
"(",
"copiedPage",
")",
";",
"}"
] | Copies the given container page to the provided root path.
@param originalPage the page to copy
@param targetPageRootPath the root path of the copy target.
@throws CmsException thrown if something goes wrong.
@throws NoCustomReplacementException if a custom replacement is not found for a type which requires it. | [
"Copies",
"the",
"given",
"container",
"page",
"to",
"the",
"provided",
"root",
"path",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/tools/CmsContainerPageCopier.java#L223-L240 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setStart | public void setStart(int index, Date value) {
"""
Set a start value.
@param index start index (1-10)
@param value start value
"""
set(selectField(AssignmentFieldLists.CUSTOM_START, index), value);
} | java | public void setStart(int index, Date value)
{
set(selectField(AssignmentFieldLists.CUSTOM_START, index), value);
} | [
"public",
"void",
"setStart",
"(",
"int",
"index",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"CUSTOM_START",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set a start value.
@param index start index (1-10)
@param value start value | [
"Set",
"a",
"start",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1540-L1543 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.getPaneWork | private JPanel getPaneWork() {
"""
This method initializes paneWork, which is used for request/response/break/script console.
@return JPanel
"""
if (paneWork == null) {
paneWork = new JPanel();
paneWork.setLayout(new BorderLayout(0,0));
paneWork.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
paneWork.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
paneWork.add(getTabbedWork());
}
return paneWork;
} | java | private JPanel getPaneWork() {
if (paneWork == null) {
paneWork = new JPanel();
paneWork.setLayout(new BorderLayout(0,0));
paneWork.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
paneWork.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
paneWork.add(getTabbedWork());
}
return paneWork;
} | [
"private",
"JPanel",
"getPaneWork",
"(",
")",
"{",
"if",
"(",
"paneWork",
"==",
"null",
")",
"{",
"paneWork",
"=",
"new",
"JPanel",
"(",
")",
";",
"paneWork",
".",
"setLayout",
"(",
"new",
"BorderLayout",
"(",
"0",
",",
"0",
")",
")",
";",
"paneWork",
".",
"setBorder",
"(",
"BorderFactory",
".",
"createEmptyBorder",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"paneWork",
".",
"setCursor",
"(",
"new",
"Cursor",
"(",
"Cursor",
".",
"DEFAULT_CURSOR",
")",
")",
";",
"paneWork",
".",
"add",
"(",
"getTabbedWork",
"(",
")",
")",
";",
"}",
"return",
"paneWork",
";",
"}"
] | This method initializes paneWork, which is used for request/response/break/script console.
@return JPanel | [
"This",
"method",
"initializes",
"paneWork",
"which",
"is",
"used",
"for",
"request",
"/",
"response",
"/",
"break",
"/",
"script",
"console",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L653-L662 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmptyIfOtherHasValueValidator.java | EmptyIfOtherHasValueValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
"""
{@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext)
"""
if (pvalue == null) {
return true;
}
try {
final String fieldCheckValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCheckName);
final String fieldCompareValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCompareName);
if (StringUtils.isNotEmpty(fieldCheckValue)
&& StringUtils.equals(valueCompare, fieldCompareValue)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
try {
final String fieldCheckValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCheckName);
final String fieldCompareValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCompareName);
if (StringUtils.isNotEmpty(fieldCheckValue)
&& StringUtils.equals(valueCompare, fieldCompareValue)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"pvalue",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"final",
"String",
"fieldCheckValue",
"=",
"BeanPropertyReaderUtil",
".",
"getNullSaveStringProperty",
"(",
"pvalue",
",",
"fieldCheckName",
")",
";",
"final",
"String",
"fieldCompareValue",
"=",
"BeanPropertyReaderUtil",
".",
"getNullSaveStringProperty",
"(",
"pvalue",
",",
"fieldCompareName",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"fieldCheckValue",
")",
"&&",
"StringUtils",
".",
"equals",
"(",
"valueCompare",
",",
"fieldCompareValue",
")",
")",
"{",
"switchContext",
"(",
"pcontext",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"final",
"Exception",
"ignore",
")",
"{",
"switchContext",
"(",
"pcontext",
")",
";",
"return",
"false",
";",
"}",
"}"
] | {@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"object",
"is",
"valid",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmptyIfOtherHasValueValidator.java#L72-L92 |
hector-client/hector | core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java | AbstractColumnFamilyTemplate.deleteColumn | public void deleteColumn(K key, N columnName) {
"""
Immediately delete this column as a single mutation operation
@param key
@param columnName
"""
createMutator().addDeletion(key, columnFamily, columnName, topSerializer).execute();
} | java | public void deleteColumn(K key, N columnName) {
createMutator().addDeletion(key, columnFamily, columnName, topSerializer).execute();
} | [
"public",
"void",
"deleteColumn",
"(",
"K",
"key",
",",
"N",
"columnName",
")",
"{",
"createMutator",
"(",
")",
".",
"addDeletion",
"(",
"key",
",",
"columnFamily",
",",
"columnName",
",",
"topSerializer",
")",
".",
"execute",
"(",
")",
";",
"}"
] | Immediately delete this column as a single mutation operation
@param key
@param columnName | [
"Immediately",
"delete",
"this",
"column",
"as",
"a",
"single",
"mutation",
"operation"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java#L191-L193 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/TraceId.java | TraceId.copyBytesTo | public void copyBytesTo(byte[] dest, int destOffset) {
"""
Copies the byte array representations of the {@code TraceId} into the {@code dest} beginning at
the {@code destOffset} offset.
@param dest the destination buffer.
@param destOffset the starting offset in the destination buffer.
@throws NullPointerException if {@code dest} is null.
@throws IndexOutOfBoundsException if {@code destOffset+TraceId.SIZE} is greater than {@code
dest.length}.
@since 0.5
"""
BigendianEncoding.longToByteArray(idHi, dest, destOffset);
BigendianEncoding.longToByteArray(idLo, dest, destOffset + BigendianEncoding.LONG_BYTES);
} | java | public void copyBytesTo(byte[] dest, int destOffset) {
BigendianEncoding.longToByteArray(idHi, dest, destOffset);
BigendianEncoding.longToByteArray(idLo, dest, destOffset + BigendianEncoding.LONG_BYTES);
} | [
"public",
"void",
"copyBytesTo",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"destOffset",
")",
"{",
"BigendianEncoding",
".",
"longToByteArray",
"(",
"idHi",
",",
"dest",
",",
"destOffset",
")",
";",
"BigendianEncoding",
".",
"longToByteArray",
"(",
"idLo",
",",
"dest",
",",
"destOffset",
"+",
"BigendianEncoding",
".",
"LONG_BYTES",
")",
";",
"}"
] | Copies the byte array representations of the {@code TraceId} into the {@code dest} beginning at
the {@code destOffset} offset.
@param dest the destination buffer.
@param destOffset the starting offset in the destination buffer.
@throws NullPointerException if {@code dest} is null.
@throws IndexOutOfBoundsException if {@code destOffset+TraceId.SIZE} is greater than {@code
dest.length}.
@since 0.5 | [
"Copies",
"the",
"byte",
"array",
"representations",
"of",
"the",
"{",
"@code",
"TraceId",
"}",
"into",
"the",
"{",
"@code",
"dest",
"}",
"beginning",
"at",
"the",
"{",
"@code",
"destOffset",
"}",
"offset",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L174-L177 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F32.java | AddBrownPtoN_F32.compute | @Override
public void compute(float x, float y, Point2D_F32 out) {
"""
Adds radial distortion
@param x Undistorted x-coordinate pixel
@param y Undistorted y-coordinate pixel
@param out Distorted pixel coordinate.
"""
float sum = 0;
float radial[] = params.radial;
float t1 = params.t1, t2 = params.t2;
// out is undistorted normalized image coordinate
out.x = a11*x + a12*y + a13;
out.y = a22*y + a23;
float r2 = out.x * out.x + out.y * out.y;
float ri2 = r2;
for (int i = 0; i < radial.length; i++) {
sum += radial[i] * ri2;
ri2 *= r2;
}
float tx = 2 * t1 * out.x * out.y + t2 * (r2 + 2 * out.x * out.x);
float ty = t1 * (r2 + 2 * out.y * out.y) + 2 * t2 * out.x * out.y;
// now compute the distorted normalized image coordinate
out.x = out.x*(1 + sum) + tx;
out.y = out.y*(1 + sum) + ty;
} | java | @Override
public void compute(float x, float y, Point2D_F32 out) {
float sum = 0;
float radial[] = params.radial;
float t1 = params.t1, t2 = params.t2;
// out is undistorted normalized image coordinate
out.x = a11*x + a12*y + a13;
out.y = a22*y + a23;
float r2 = out.x * out.x + out.y * out.y;
float ri2 = r2;
for (int i = 0; i < radial.length; i++) {
sum += radial[i] * ri2;
ri2 *= r2;
}
float tx = 2 * t1 * out.x * out.y + t2 * (r2 + 2 * out.x * out.x);
float ty = t1 * (r2 + 2 * out.y * out.y) + 2 * t2 * out.x * out.y;
// now compute the distorted normalized image coordinate
out.x = out.x*(1 + sum) + tx;
out.y = out.y*(1 + sum) + ty;
} | [
"@",
"Override",
"public",
"void",
"compute",
"(",
"float",
"x",
",",
"float",
"y",
",",
"Point2D_F32",
"out",
")",
"{",
"float",
"sum",
"=",
"0",
";",
"float",
"radial",
"[",
"]",
"=",
"params",
".",
"radial",
";",
"float",
"t1",
"=",
"params",
".",
"t1",
",",
"t2",
"=",
"params",
".",
"t2",
";",
"// out is undistorted normalized image coordinate",
"out",
".",
"x",
"=",
"a11",
"*",
"x",
"+",
"a12",
"*",
"y",
"+",
"a13",
";",
"out",
".",
"y",
"=",
"a22",
"*",
"y",
"+",
"a23",
";",
"float",
"r2",
"=",
"out",
".",
"x",
"*",
"out",
".",
"x",
"+",
"out",
".",
"y",
"*",
"out",
".",
"y",
";",
"float",
"ri2",
"=",
"r2",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"radial",
".",
"length",
";",
"i",
"++",
")",
"{",
"sum",
"+=",
"radial",
"[",
"i",
"]",
"*",
"ri2",
";",
"ri2",
"*=",
"r2",
";",
"}",
"float",
"tx",
"=",
"2",
"*",
"t1",
"*",
"out",
".",
"x",
"*",
"out",
".",
"y",
"+",
"t2",
"*",
"(",
"r2",
"+",
"2",
"*",
"out",
".",
"x",
"*",
"out",
".",
"x",
")",
";",
"float",
"ty",
"=",
"t1",
"*",
"(",
"r2",
"+",
"2",
"*",
"out",
".",
"y",
"*",
"out",
".",
"y",
")",
"+",
"2",
"*",
"t2",
"*",
"out",
".",
"x",
"*",
"out",
".",
"y",
";",
"// now compute the distorted normalized image coordinate",
"out",
".",
"x",
"=",
"out",
".",
"x",
"*",
"(",
"1",
"+",
"sum",
")",
"+",
"tx",
";",
"out",
".",
"y",
"=",
"out",
".",
"y",
"*",
"(",
"1",
"+",
"sum",
")",
"+",
"ty",
";",
"}"
] | Adds radial distortion
@param x Undistorted x-coordinate pixel
@param y Undistorted y-coordinate pixel
@param out Distorted pixel coordinate. | [
"Adds",
"radial",
"distortion"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F32.java#L79-L104 |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java | InitializrService.executeInitializrMetadataRetrieval | private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) {
"""
Retrieves the meta-data of the service at the specified URL.
@param url the URL
@return the response
"""
HttpGet request = new HttpGet(url);
request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA));
return execute(request, url, "retrieve metadata");
} | java | private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) {
HttpGet request = new HttpGet(url);
request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA));
return execute(request, url, "retrieve metadata");
} | [
"private",
"CloseableHttpResponse",
"executeInitializrMetadataRetrieval",
"(",
"String",
"url",
")",
"{",
"HttpGet",
"request",
"=",
"new",
"HttpGet",
"(",
"url",
")",
";",
"request",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"HttpHeaders",
".",
"ACCEPT",
",",
"ACCEPT_META_DATA",
")",
")",
";",
"return",
"execute",
"(",
"request",
",",
"url",
",",
"\"retrieve metadata\"",
")",
";",
"}"
] | Retrieves the meta-data of the service at the specified URL.
@param url the URL
@return the response | [
"Retrieves",
"the",
"meta",
"-",
"data",
"of",
"the",
"service",
"at",
"the",
"specified",
"URL",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java#L185-L189 |
satoshi-kimura/samurai-dao | src/main/java/ognl/DefaultMemberAccess.java | DefaultMemberAccess.isAccessible | public boolean isAccessible(Map context, Object target, Member member, String propertyName) {
"""
Returns true if the given member is accessible or can be made accessible
by this object.
"""
int modifiers = member.getModifiers();
boolean result = Modifier.isPublic(modifiers);
if (!result) {
if (Modifier.isPrivate(modifiers)) {
result = getAllowPrivateAccess();
} else {
if (Modifier.isProtected(modifiers)) {
result = getAllowProtectedAccess();
} else {
result = getAllowPackageProtectedAccess();
}
}
}
return result;
} | java | public boolean isAccessible(Map context, Object target, Member member, String propertyName)
{
int modifiers = member.getModifiers();
boolean result = Modifier.isPublic(modifiers);
if (!result) {
if (Modifier.isPrivate(modifiers)) {
result = getAllowPrivateAccess();
} else {
if (Modifier.isProtected(modifiers)) {
result = getAllowProtectedAccess();
} else {
result = getAllowPackageProtectedAccess();
}
}
}
return result;
} | [
"public",
"boolean",
"isAccessible",
"(",
"Map",
"context",
",",
"Object",
"target",
",",
"Member",
"member",
",",
"String",
"propertyName",
")",
"{",
"int",
"modifiers",
"=",
"member",
".",
"getModifiers",
"(",
")",
";",
"boolean",
"result",
"=",
"Modifier",
".",
"isPublic",
"(",
"modifiers",
")",
";",
"if",
"(",
"!",
"result",
")",
"{",
"if",
"(",
"Modifier",
".",
"isPrivate",
"(",
"modifiers",
")",
")",
"{",
"result",
"=",
"getAllowPrivateAccess",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Modifier",
".",
"isProtected",
"(",
"modifiers",
")",
")",
"{",
"result",
"=",
"getAllowProtectedAccess",
"(",
")",
";",
"}",
"else",
"{",
"result",
"=",
"getAllowPackageProtectedAccess",
"(",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Returns true if the given member is accessible or can be made accessible
by this object. | [
"Returns",
"true",
"if",
"the",
"given",
"member",
"is",
"accessible",
"or",
"can",
"be",
"made",
"accessible",
"by",
"this",
"object",
"."
] | train | https://github.com/satoshi-kimura/samurai-dao/blob/321729d8928f8e83eede6cb08e4bd7f7a24e9b94/src/main/java/ognl/DefaultMemberAccess.java#L133-L150 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.createPreparedStatement | private void createPreparedStatement(final String name, final String query, final int timeout, final boolean recovering) throws NameAlreadyExistsException, DatabaseEngineException {
"""
Creates a prepared statement.
@param name The name of the prepared statement.
@param query The query.
@param timeout The timeout (in seconds) if applicable. Only applicable if > 0.
@param recovering True if calling from recovering, false otherwise.
@throws NameAlreadyExistsException If the name already exists.
@throws DatabaseEngineException If something goes wrong creating the statement.
"""
if (!recovering) {
if (stmts.containsKey(name)) {
throw new NameAlreadyExistsException(String.format("There's already a PreparedStatement with the name '%s'", name));
}
try {
getConnection();
} catch (final Exception e) {
throw new DatabaseEngineException("Could not create prepared statement", e);
}
}
PreparedStatement ps;
try {
ps = conn.prepareStatement(query);
if (timeout > 0) {
ps.setQueryTimeout(timeout);
}
stmts.put(name, new PreparedStatementCapsule(query, ps, timeout));
} catch (final SQLException e) {
throw new DatabaseEngineException("Could not create prepared statement", e);
}
} | java | private void createPreparedStatement(final String name, final String query, final int timeout, final boolean recovering) throws NameAlreadyExistsException, DatabaseEngineException {
if (!recovering) {
if (stmts.containsKey(name)) {
throw new NameAlreadyExistsException(String.format("There's already a PreparedStatement with the name '%s'", name));
}
try {
getConnection();
} catch (final Exception e) {
throw new DatabaseEngineException("Could not create prepared statement", e);
}
}
PreparedStatement ps;
try {
ps = conn.prepareStatement(query);
if (timeout > 0) {
ps.setQueryTimeout(timeout);
}
stmts.put(name, new PreparedStatementCapsule(query, ps, timeout));
} catch (final SQLException e) {
throw new DatabaseEngineException("Could not create prepared statement", e);
}
} | [
"private",
"void",
"createPreparedStatement",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"query",
",",
"final",
"int",
"timeout",
",",
"final",
"boolean",
"recovering",
")",
"throws",
"NameAlreadyExistsException",
",",
"DatabaseEngineException",
"{",
"if",
"(",
"!",
"recovering",
")",
"{",
"if",
"(",
"stmts",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"NameAlreadyExistsException",
"(",
"String",
".",
"format",
"(",
"\"There's already a PreparedStatement with the name '%s'\"",
",",
"name",
")",
")",
";",
"}",
"try",
"{",
"getConnection",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DatabaseEngineException",
"(",
"\"Could not create prepared statement\"",
",",
"e",
")",
";",
"}",
"}",
"PreparedStatement",
"ps",
";",
"try",
"{",
"ps",
"=",
"conn",
".",
"prepareStatement",
"(",
"query",
")",
";",
"if",
"(",
"timeout",
">",
"0",
")",
"{",
"ps",
".",
"setQueryTimeout",
"(",
"timeout",
")",
";",
"}",
"stmts",
".",
"put",
"(",
"name",
",",
"new",
"PreparedStatementCapsule",
"(",
"query",
",",
"ps",
",",
"timeout",
")",
")",
";",
"}",
"catch",
"(",
"final",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"DatabaseEngineException",
"(",
"\"Could not create prepared statement\"",
",",
"e",
")",
";",
"}",
"}"
] | Creates a prepared statement.
@param name The name of the prepared statement.
@param query The query.
@param timeout The timeout (in seconds) if applicable. Only applicable if > 0.
@param recovering True if calling from recovering, false otherwise.
@throws NameAlreadyExistsException If the name already exists.
@throws DatabaseEngineException If something goes wrong creating the statement. | [
"Creates",
"a",
"prepared",
"statement",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1837-L1860 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java | DefBase.setProperty | public void setProperty(String name, String value) {
"""
Sets a property.
@param name The property name
@param value The property value
"""
if ((value == null) || (value.length() == 0))
{
_properties.remove(name);
}
else
{
_properties.setProperty(name, value);
}
} | java | public void setProperty(String name, String value)
{
if ((value == null) || (value.length() == 0))
{
_properties.remove(name);
}
else
{
_properties.setProperty(name, value);
}
} | [
"public",
"void",
"setProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"value",
"==",
"null",
")",
"||",
"(",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"_properties",
".",
"remove",
"(",
"name",
")",
";",
"}",
"else",
"{",
"_properties",
".",
"setProperty",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
] | Sets a property.
@param name The property name
@param value The property value | [
"Sets",
"a",
"property",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java#L133-L143 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java | ServerUpdatePolicy.recordServerResult | public void recordServerResult(ServerIdentity server, ModelNode response) {
"""
Records the result of updating a server.
@param server the id of the server. Cannot be <code>null</code>
@param response the result of the updates
"""
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
boolean serverFailed = response.has(FAILURE_DESCRIPTION);
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s",
server, server);
synchronized (this) {
int previousFailed = failureCount;
if (serverFailed) {
failureCount++;
}
else {
successCount++;
}
if (previousFailed <= maxFailed) {
if (!serverFailed && (successCount + failureCount) == servers.size()) {
// All results are in; notify parent of success
parent.recordServerGroupResult(serverGroupName, false);
}
else if (serverFailed && failureCount > maxFailed) {
parent.recordServerGroupResult(serverGroupName, true);
}
}
}
} | java | public void recordServerResult(ServerIdentity server, ModelNode response) {
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
boolean serverFailed = response.has(FAILURE_DESCRIPTION);
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s",
server, server);
synchronized (this) {
int previousFailed = failureCount;
if (serverFailed) {
failureCount++;
}
else {
successCount++;
}
if (previousFailed <= maxFailed) {
if (!serverFailed && (successCount + failureCount) == servers.size()) {
// All results are in; notify parent of success
parent.recordServerGroupResult(serverGroupName, false);
}
else if (serverFailed && failureCount > maxFailed) {
parent.recordServerGroupResult(serverGroupName, true);
}
}
}
} | [
"public",
"void",
"recordServerResult",
"(",
"ServerIdentity",
"server",
",",
"ModelNode",
"response",
")",
"{",
"if",
"(",
"!",
"serverGroupName",
".",
"equals",
"(",
"server",
".",
"getServerGroupName",
"(",
")",
")",
"||",
"!",
"servers",
".",
"contains",
"(",
"server",
")",
")",
"{",
"throw",
"DomainControllerLogger",
".",
"HOST_CONTROLLER_LOGGER",
".",
"unknownServer",
"(",
"server",
")",
";",
"}",
"boolean",
"serverFailed",
"=",
"response",
".",
"has",
"(",
"FAILURE_DESCRIPTION",
")",
";",
"DomainControllerLogger",
".",
"HOST_CONTROLLER_LOGGER",
".",
"tracef",
"(",
"\"Recording server result for '%s': failed = %s\"",
",",
"server",
",",
"server",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"int",
"previousFailed",
"=",
"failureCount",
";",
"if",
"(",
"serverFailed",
")",
"{",
"failureCount",
"++",
";",
"}",
"else",
"{",
"successCount",
"++",
";",
"}",
"if",
"(",
"previousFailed",
"<=",
"maxFailed",
")",
"{",
"if",
"(",
"!",
"serverFailed",
"&&",
"(",
"successCount",
"+",
"failureCount",
")",
"==",
"servers",
".",
"size",
"(",
")",
")",
"{",
"// All results are in; notify parent of success",
"parent",
".",
"recordServerGroupResult",
"(",
"serverGroupName",
",",
"false",
")",
";",
"}",
"else",
"if",
"(",
"serverFailed",
"&&",
"failureCount",
">",
"maxFailed",
")",
"{",
"parent",
".",
"recordServerGroupResult",
"(",
"serverGroupName",
",",
"true",
")",
";",
"}",
"}",
"}",
"}"
] | Records the result of updating a server.
@param server the id of the server. Cannot be <code>null</code>
@param response the result of the updates | [
"Records",
"the",
"result",
"of",
"updating",
"a",
"server",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java#L130-L160 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java | BitfinexSymbols.orderBook | public static BitfinexOrderBookSymbol orderBook(final BitfinexCurrencyPair currencyPair,
final BitfinexOrderBookSymbol.Precision precision,
final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) {
"""
returns symbol for order book channel
@param currencyPair of order book channel
@param precision of order book
@param frequency of order book
@param pricePoints in initial snapshot
@return symbol
"""
if (precision == BitfinexOrderBookSymbol.Precision.R0) {
throw new IllegalArgumentException("Use BitfinexSymbols#rawOrderBook() factory method instead");
}
return new BitfinexOrderBookSymbol(currencyPair, precision, frequency, pricePoints);
} | java | public static BitfinexOrderBookSymbol orderBook(final BitfinexCurrencyPair currencyPair,
final BitfinexOrderBookSymbol.Precision precision,
final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) {
if (precision == BitfinexOrderBookSymbol.Precision.R0) {
throw new IllegalArgumentException("Use BitfinexSymbols#rawOrderBook() factory method instead");
}
return new BitfinexOrderBookSymbol(currencyPair, precision, frequency, pricePoints);
} | [
"public",
"static",
"BitfinexOrderBookSymbol",
"orderBook",
"(",
"final",
"BitfinexCurrencyPair",
"currencyPair",
",",
"final",
"BitfinexOrderBookSymbol",
".",
"Precision",
"precision",
",",
"final",
"BitfinexOrderBookSymbol",
".",
"Frequency",
"frequency",
",",
"final",
"int",
"pricePoints",
")",
"{",
"if",
"(",
"precision",
"==",
"BitfinexOrderBookSymbol",
".",
"Precision",
".",
"R0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Use BitfinexSymbols#rawOrderBook() factory method instead\"",
")",
";",
"}",
"return",
"new",
"BitfinexOrderBookSymbol",
"(",
"currencyPair",
",",
"precision",
",",
"frequency",
",",
"pricePoints",
")",
";",
"}"
] | returns symbol for order book channel
@param currencyPair of order book channel
@param precision of order book
@param frequency of order book
@param pricePoints in initial snapshot
@return symbol | [
"returns",
"symbol",
"for",
"order",
"book",
"channel"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L134-L143 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putCharSequenceArray | @TargetApi(8)
public Bundler putCharSequenceArray(String key, CharSequence[] value) {
"""
Inserts a CharSequence array value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence array object, or null
@return this
"""
bundle.putCharSequenceArray(key, value);
return this;
} | java | @TargetApi(8)
public Bundler putCharSequenceArray(String key, CharSequence[] value) {
bundle.putCharSequenceArray(key, value);
return this;
} | [
"@",
"TargetApi",
"(",
"8",
")",
"public",
"Bundler",
"putCharSequenceArray",
"(",
"String",
"key",
",",
"CharSequence",
"[",
"]",
"value",
")",
"{",
"bundle",
".",
"putCharSequenceArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence array value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence array object, or null
@return this | [
"Inserts",
"a",
"CharSequence",
"array",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L330-L334 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/animation/ObjectAnimator.java | ObjectAnimator.ofObject | public static ObjectAnimator ofObject(Object target, String propertyName,
TypeEvaluator evaluator, Object... values) {
"""
Constructs and returns an ObjectAnimator that animates between Object values. A single
value implies that that value is the one being animated to. Two values imply a starting
and ending values. More than two values imply a starting value, values to animate through
along the way, and an ending value (these values will be distributed evenly across
the duration of the animation).
@param target The object whose property is to be animated. This object should
have a public method on it called <code>setName()</code>, where <code>name</code> is
the value of the <code>propertyName</code> parameter.
@param propertyName The name of the property being animated.
@param evaluator A TypeEvaluator that will be called on each animation frame to
provide the necessary interpolation between the Object values to derive the animated
value.
@param values A set of values that the animation will animate between over time.
@return An ObjectAnimator object that is set up to animate between the given values.
"""
ObjectAnimator anim = new ObjectAnimator(target, propertyName);
anim.setObjectValues(values);
anim.setEvaluator(evaluator);
return anim;
} | java | public static ObjectAnimator ofObject(Object target, String propertyName,
TypeEvaluator evaluator, Object... values) {
ObjectAnimator anim = new ObjectAnimator(target, propertyName);
anim.setObjectValues(values);
anim.setEvaluator(evaluator);
return anim;
} | [
"public",
"static",
"ObjectAnimator",
"ofObject",
"(",
"Object",
"target",
",",
"String",
"propertyName",
",",
"TypeEvaluator",
"evaluator",
",",
"Object",
"...",
"values",
")",
"{",
"ObjectAnimator",
"anim",
"=",
"new",
"ObjectAnimator",
"(",
"target",
",",
"propertyName",
")",
";",
"anim",
".",
"setObjectValues",
"(",
"values",
")",
";",
"anim",
".",
"setEvaluator",
"(",
"evaluator",
")",
";",
"return",
"anim",
";",
"}"
] | Constructs and returns an ObjectAnimator that animates between Object values. A single
value implies that that value is the one being animated to. Two values imply a starting
and ending values. More than two values imply a starting value, values to animate through
along the way, and an ending value (these values will be distributed evenly across
the duration of the animation).
@param target The object whose property is to be animated. This object should
have a public method on it called <code>setName()</code>, where <code>name</code> is
the value of the <code>propertyName</code> parameter.
@param propertyName The name of the property being animated.
@param evaluator A TypeEvaluator that will be called on each animation frame to
provide the necessary interpolation between the Object values to derive the animated
value.
@param values A set of values that the animation will animate between over time.
@return An ObjectAnimator object that is set up to animate between the given values. | [
"Constructs",
"and",
"returns",
"an",
"ObjectAnimator",
"that",
"animates",
"between",
"Object",
"values",
".",
"A",
"single",
"value",
"implies",
"that",
"that",
"value",
"is",
"the",
"one",
"being",
"animated",
"to",
".",
"Two",
"values",
"imply",
"a",
"starting",
"and",
"ending",
"values",
".",
"More",
"than",
"two",
"values",
"imply",
"a",
"starting",
"value",
"values",
"to",
"animate",
"through",
"along",
"the",
"way",
"and",
"an",
"ending",
"value",
"(",
"these",
"values",
"will",
"be",
"distributed",
"evenly",
"across",
"the",
"duration",
"of",
"the",
"animation",
")",
"."
] | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/animation/ObjectAnimator.java#L272-L278 |
mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java | FastAdapterUIUtils.getSelectableBackground | public static StateListDrawable getSelectableBackground(Context ctx, @ColorInt int selected_color, boolean animate) {
"""
helper to get the system default selectable background inclusive an active state
@param ctx the context
@param selected_color the selected color
@param animate true if you want to fade over the states (only animates if API newer than Build.VERSION_CODES.HONEYCOMB)
@return the StateListDrawable
"""
StateListDrawable states = new StateListDrawable();
ColorDrawable clrActive = new ColorDrawable(selected_color);
states.addState(new int[]{android.R.attr.state_selected}, clrActive);
states.addState(new int[]{}, ContextCompat.getDrawable(ctx, getSelectableBackground(ctx)));
//if possible we enable animating across states
if (animate) {
int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime);
states.setEnterFadeDuration(duration);
states.setExitFadeDuration(duration);
}
return states;
} | java | public static StateListDrawable getSelectableBackground(Context ctx, @ColorInt int selected_color, boolean animate) {
StateListDrawable states = new StateListDrawable();
ColorDrawable clrActive = new ColorDrawable(selected_color);
states.addState(new int[]{android.R.attr.state_selected}, clrActive);
states.addState(new int[]{}, ContextCompat.getDrawable(ctx, getSelectableBackground(ctx)));
//if possible we enable animating across states
if (animate) {
int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime);
states.setEnterFadeDuration(duration);
states.setExitFadeDuration(duration);
}
return states;
} | [
"public",
"static",
"StateListDrawable",
"getSelectableBackground",
"(",
"Context",
"ctx",
",",
"@",
"ColorInt",
"int",
"selected_color",
",",
"boolean",
"animate",
")",
"{",
"StateListDrawable",
"states",
"=",
"new",
"StateListDrawable",
"(",
")",
";",
"ColorDrawable",
"clrActive",
"=",
"new",
"ColorDrawable",
"(",
"selected_color",
")",
";",
"states",
".",
"addState",
"(",
"new",
"int",
"[",
"]",
"{",
"android",
".",
"R",
".",
"attr",
".",
"state_selected",
"}",
",",
"clrActive",
")",
";",
"states",
".",
"addState",
"(",
"new",
"int",
"[",
"]",
"{",
"}",
",",
"ContextCompat",
".",
"getDrawable",
"(",
"ctx",
",",
"getSelectableBackground",
"(",
"ctx",
")",
")",
")",
";",
"//if possible we enable animating across states",
"if",
"(",
"animate",
")",
"{",
"int",
"duration",
"=",
"ctx",
".",
"getResources",
"(",
")",
".",
"getInteger",
"(",
"android",
".",
"R",
".",
"integer",
".",
"config_shortAnimTime",
")",
";",
"states",
".",
"setEnterFadeDuration",
"(",
"duration",
")",
";",
"states",
".",
"setExitFadeDuration",
"(",
"duration",
")",
";",
"}",
"return",
"states",
";",
"}"
] | helper to get the system default selectable background inclusive an active state
@param ctx the context
@param selected_color the selected color
@param animate true if you want to fade over the states (only animates if API newer than Build.VERSION_CODES.HONEYCOMB)
@return the StateListDrawable | [
"helper",
"to",
"get",
"the",
"system",
"default",
"selectable",
"background",
"inclusive",
"an",
"active",
"state"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java#L33-L49 |
GerdHolz/TOVAL | src/de/invation/code/toval/types/Multiset.java | Multiset.setMultiplicity | public void setMultiplicity(O object, int multiplicity) {
"""
Sets the multiplicity of the given object to the given number.<br>
In case the multiplicity is 0 or negative, the given object is
removed from the multiset.
@param object The object whose multiplicity is set.
@param multiplicity The multiplicity for the given object to set.
"""
if (!contains(object) && multiplicity < 1) {
return;
}
if (contains(object) && multiplicity < 1) {
remove(object);
return;
}
if (multiplicities.containsKey(object)) {
int oldMultiplicity = multiplicities.get(object);
decMultiplicityCount(oldMultiplicity);
}
incMultiplicityCount(multiplicity);
multiplicities.put(object, multiplicity);
} | java | public void setMultiplicity(O object, int multiplicity) {
if (!contains(object) && multiplicity < 1) {
return;
}
if (contains(object) && multiplicity < 1) {
remove(object);
return;
}
if (multiplicities.containsKey(object)) {
int oldMultiplicity = multiplicities.get(object);
decMultiplicityCount(oldMultiplicity);
}
incMultiplicityCount(multiplicity);
multiplicities.put(object, multiplicity);
} | [
"public",
"void",
"setMultiplicity",
"(",
"O",
"object",
",",
"int",
"multiplicity",
")",
"{",
"if",
"(",
"!",
"contains",
"(",
"object",
")",
"&&",
"multiplicity",
"<",
"1",
")",
"{",
"return",
";",
"}",
"if",
"(",
"contains",
"(",
"object",
")",
"&&",
"multiplicity",
"<",
"1",
")",
"{",
"remove",
"(",
"object",
")",
";",
"return",
";",
"}",
"if",
"(",
"multiplicities",
".",
"containsKey",
"(",
"object",
")",
")",
"{",
"int",
"oldMultiplicity",
"=",
"multiplicities",
".",
"get",
"(",
"object",
")",
";",
"decMultiplicityCount",
"(",
"oldMultiplicity",
")",
";",
"}",
"incMultiplicityCount",
"(",
"multiplicity",
")",
";",
"multiplicities",
".",
"put",
"(",
"object",
",",
"multiplicity",
")",
";",
"}"
] | Sets the multiplicity of the given object to the given number.<br>
In case the multiplicity is 0 or negative, the given object is
removed from the multiset.
@param object The object whose multiplicity is set.
@param multiplicity The multiplicity for the given object to set. | [
"Sets",
"the",
"multiplicity",
"of",
"the",
"given",
"object",
"to",
"the",
"given",
"number",
".",
"<br",
">",
"In",
"case",
"the",
"multiplicity",
"is",
"0",
"or",
"negative",
"the",
"given",
"object",
"is",
"removed",
"from",
"the",
"multiset",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/Multiset.java#L217-L231 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullRemoteServices.java | NullRemoteServices.batchUpdate | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents) {
"""
This allows the BatchUpdateDaemon to send its batch update events
to all CacheUnits.
@param invalidateIdEvents A Vector of invalidate by id.
@param invalidateTemplateEvents A Vector of invalidate by template.
@param pushEntryEvents A Vector of cache entries.
"""
notificationService.batchUpdate(invalidateIdEvents, invalidateTemplateEvents, pushEntryEvents, aliasEntryEvents, cacheUnit);
} | java | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents) {
notificationService.batchUpdate(invalidateIdEvents, invalidateTemplateEvents, pushEntryEvents, aliasEntryEvents, cacheUnit);
} | [
"public",
"void",
"batchUpdate",
"(",
"HashMap",
"invalidateIdEvents",
",",
"HashMap",
"invalidateTemplateEvents",
",",
"ArrayList",
"pushEntryEvents",
",",
"ArrayList",
"aliasEntryEvents",
")",
"{",
"notificationService",
".",
"batchUpdate",
"(",
"invalidateIdEvents",
",",
"invalidateTemplateEvents",
",",
"pushEntryEvents",
",",
"aliasEntryEvents",
",",
"cacheUnit",
")",
";",
"}"
] | This allows the BatchUpdateDaemon to send its batch update events
to all CacheUnits.
@param invalidateIdEvents A Vector of invalidate by id.
@param invalidateTemplateEvents A Vector of invalidate by template.
@param pushEntryEvents A Vector of cache entries. | [
"This",
"allows",
"the",
"BatchUpdateDaemon",
"to",
"send",
"its",
"batch",
"update",
"events",
"to",
"all",
"CacheUnits",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullRemoteServices.java#L104-L106 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getCoolDownSingularityRequests | public Collection<SingularityRequestParent> getCoolDownSingularityRequests() {
"""
Get all requests that has been set to a COOLDOWN state by singularity
@return
All {@link SingularityRequestParent} instances that their state is COOLDOWN
"""
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_COOLDOWN_FORMAT, getApiBase(host));
return getCollection(requestUri, "COOLDOWN requests", REQUESTS_COLLECTION);
} | java | public Collection<SingularityRequestParent> getCoolDownSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_COOLDOWN_FORMAT, getApiBase(host));
return getCollection(requestUri, "COOLDOWN requests", REQUESTS_COLLECTION);
} | [
"public",
"Collection",
"<",
"SingularityRequestParent",
">",
"getCoolDownSingularityRequests",
"(",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"REQUESTS_GET_COOLDOWN_FORMAT",
",",
"getApiBase",
"(",
"host",
")",
")",
";",
"return",
"getCollection",
"(",
"requestUri",
",",
"\"COOLDOWN requests\"",
",",
"REQUESTS_COLLECTION",
")",
";",
"}"
] | Get all requests that has been set to a COOLDOWN state by singularity
@return
All {@link SingularityRequestParent} instances that their state is COOLDOWN | [
"Get",
"all",
"requests",
"that",
"has",
"been",
"set",
"to",
"a",
"COOLDOWN",
"state",
"by",
"singularity"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L790-L794 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.addCodeToProvideSoyNamespace | private static void addCodeToProvideSoyNamespace(StringBuilder header, SoyFileNode soyFile) {
"""
Helper for visitSoyFileNode(SoyFileNode) to add code to provide Soy namespaces.
@param header
@param soyFile The node we're visiting.
"""
header.append("goog.provide('").append(soyFile.getNamespace()).append("');\n");
} | java | private static void addCodeToProvideSoyNamespace(StringBuilder header, SoyFileNode soyFile) {
header.append("goog.provide('").append(soyFile.getNamespace()).append("');\n");
} | [
"private",
"static",
"void",
"addCodeToProvideSoyNamespace",
"(",
"StringBuilder",
"header",
",",
"SoyFileNode",
"soyFile",
")",
"{",
"header",
".",
"append",
"(",
"\"goog.provide('\"",
")",
".",
"append",
"(",
"soyFile",
".",
"getNamespace",
"(",
")",
")",
".",
"append",
"(",
"\"');\\n\"",
")",
";",
"}"
] | Helper for visitSoyFileNode(SoyFileNode) to add code to provide Soy namespaces.
@param header
@param soyFile The node we're visiting. | [
"Helper",
"for",
"visitSoyFileNode",
"(",
"SoyFileNode",
")",
"to",
"add",
"code",
"to",
"provide",
"Soy",
"namespaces",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L508-L510 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java | VarOptItemsUnion.update | public void update(final Memory mem, final ArrayOfItemsSerDe<T> serDe) {
"""
Union the given Memory image of the sketch.
<p>This method can be repeatedly called.</p>
@param mem Memory image of sketch to be merged
@param serDe An instance of ArrayOfItemsSerDe
"""
if (mem != null) {
final VarOptItemsSketch<T> vis = VarOptItemsSketch.heapify(mem, serDe);
mergeInto(vis);
}
} | java | public void update(final Memory mem, final ArrayOfItemsSerDe<T> serDe) {
if (mem != null) {
final VarOptItemsSketch<T> vis = VarOptItemsSketch.heapify(mem, serDe);
mergeInto(vis);
}
} | [
"public",
"void",
"update",
"(",
"final",
"Memory",
"mem",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
"if",
"(",
"mem",
"!=",
"null",
")",
"{",
"final",
"VarOptItemsSketch",
"<",
"T",
">",
"vis",
"=",
"VarOptItemsSketch",
".",
"heapify",
"(",
"mem",
",",
"serDe",
")",
";",
"mergeInto",
"(",
"vis",
")",
";",
"}",
"}"
] | Union the given Memory image of the sketch.
<p>This method can be repeatedly called.</p>
@param mem Memory image of sketch to be merged
@param serDe An instance of ArrayOfItemsSerDe | [
"Union",
"the",
"given",
"Memory",
"image",
"of",
"the",
"sketch",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java#L205-L210 |
apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronClient.java | HeronClient.sendRequest | public void sendRequest(Message request, Message.Builder responseBuilder) {
"""
Convenience method of the above method with no timeout or context
"""
sendRequest(request, null, responseBuilder, Duration.ZERO);
} | java | public void sendRequest(Message request, Message.Builder responseBuilder) {
sendRequest(request, null, responseBuilder, Duration.ZERO);
} | [
"public",
"void",
"sendRequest",
"(",
"Message",
"request",
",",
"Message",
".",
"Builder",
"responseBuilder",
")",
"{",
"sendRequest",
"(",
"request",
",",
"null",
",",
"responseBuilder",
",",
"Duration",
".",
"ZERO",
")",
";",
"}"
] | Convenience method of the above method with no timeout or context | [
"Convenience",
"method",
"of",
"the",
"above",
"method",
"with",
"no",
"timeout",
"or",
"context"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronClient.java#L214-L216 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.makeMap | public static Map makeMap(Mapper mapper, Collection c, boolean includeNull) {
"""
Create a new Map by using the collection objects as keys, and the mapping result as values.
@param mapper a Mapper to map the values
@param c Collection of items
@param includeNull true to include null
@return a new Map with values mapped
"""
return makeMap(mapper, c.iterator(), includeNull);
} | java | public static Map makeMap(Mapper mapper, Collection c, boolean includeNull) {
return makeMap(mapper, c.iterator(), includeNull);
} | [
"public",
"static",
"Map",
"makeMap",
"(",
"Mapper",
"mapper",
",",
"Collection",
"c",
",",
"boolean",
"includeNull",
")",
"{",
"return",
"makeMap",
"(",
"mapper",
",",
"c",
".",
"iterator",
"(",
")",
",",
"includeNull",
")",
";",
"}"
] | Create a new Map by using the collection objects as keys, and the mapping result as values.
@param mapper a Mapper to map the values
@param c Collection of items
@param includeNull true to include null
@return a new Map with values mapped | [
"Create",
"a",
"new",
"Map",
"by",
"using",
"the",
"collection",
"objects",
"as",
"keys",
"and",
"the",
"mapping",
"result",
"as",
"values",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L535-L537 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java | Jdk8Methods.safeAdd | public static int safeAdd(int a, int b) {
"""
Safely adds two int values.
@param a the first value
@param b the second value
@return the result
@throws ArithmeticException if the result overflows an int
"""
int sum = a + b;
// check for a change of sign in the result when the inputs have the same sign
if ((a ^ sum) < 0 && (a ^ b) >= 0) {
throw new ArithmeticException("Addition overflows an int: " + a + " + " + b);
}
return sum;
} | java | public static int safeAdd(int a, int b) {
int sum = a + b;
// check for a change of sign in the result when the inputs have the same sign
if ((a ^ sum) < 0 && (a ^ b) >= 0) {
throw new ArithmeticException("Addition overflows an int: " + a + " + " + b);
}
return sum;
} | [
"public",
"static",
"int",
"safeAdd",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"int",
"sum",
"=",
"a",
"+",
"b",
";",
"// check for a change of sign in the result when the inputs have the same sign",
"if",
"(",
"(",
"a",
"^",
"sum",
")",
"<",
"0",
"&&",
"(",
"a",
"^",
"b",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"Addition overflows an int: \"",
"+",
"a",
"+",
"\" + \"",
"+",
"b",
")",
";",
"}",
"return",
"sum",
";",
"}"
] | Safely adds two int values.
@param a the first value
@param b the second value
@return the result
@throws ArithmeticException if the result overflows an int | [
"Safely",
"adds",
"two",
"int",
"values",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java#L145-L152 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeMarkers.java | GoogleMapShapeMarkers.addMarkerAsPolygon | public static void addMarkerAsPolygon(Marker marker, List<Marker> markers) {
"""
Polygon add a marker in the list of markers to where it is closest to the
the surrounding points
@param marker marker
@param markers list of markers
"""
LatLng position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 2) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distances[0] = SphericalUtil.computeDistanceBetween(position,
markers.get(0).getPosition());
for (int i = 1; i < markers.size(); i++) {
distances[i] = SphericalUtil.computeDistanceBetween(position,
markers.get(i).getPosition());
if (distances[i] < distances[insertLocation]) {
insertLocation = i;
}
}
int beforeLocation = insertLocation > 0 ? insertLocation - 1
: distances.length - 1;
int afterLocation = insertLocation < distances.length - 1 ? insertLocation + 1
: 0;
if (distances[beforeLocation] > distances[afterLocation]) {
insertLocation = afterLocation;
}
}
markers.add(insertLocation, marker);
} | java | public static void addMarkerAsPolygon(Marker marker, List<Marker> markers) {
LatLng position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 2) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distances[0] = SphericalUtil.computeDistanceBetween(position,
markers.get(0).getPosition());
for (int i = 1; i < markers.size(); i++) {
distances[i] = SphericalUtil.computeDistanceBetween(position,
markers.get(i).getPosition());
if (distances[i] < distances[insertLocation]) {
insertLocation = i;
}
}
int beforeLocation = insertLocation > 0 ? insertLocation - 1
: distances.length - 1;
int afterLocation = insertLocation < distances.length - 1 ? insertLocation + 1
: 0;
if (distances[beforeLocation] > distances[afterLocation]) {
insertLocation = afterLocation;
}
}
markers.add(insertLocation, marker);
} | [
"public",
"static",
"void",
"addMarkerAsPolygon",
"(",
"Marker",
"marker",
",",
"List",
"<",
"Marker",
">",
"markers",
")",
"{",
"LatLng",
"position",
"=",
"marker",
".",
"getPosition",
"(",
")",
";",
"int",
"insertLocation",
"=",
"markers",
".",
"size",
"(",
")",
";",
"if",
"(",
"markers",
".",
"size",
"(",
")",
">",
"2",
")",
"{",
"double",
"[",
"]",
"distances",
"=",
"new",
"double",
"[",
"markers",
".",
"size",
"(",
")",
"]",
";",
"insertLocation",
"=",
"0",
";",
"distances",
"[",
"0",
"]",
"=",
"SphericalUtil",
".",
"computeDistanceBetween",
"(",
"position",
",",
"markers",
".",
"get",
"(",
"0",
")",
".",
"getPosition",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"markers",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"distances",
"[",
"i",
"]",
"=",
"SphericalUtil",
".",
"computeDistanceBetween",
"(",
"position",
",",
"markers",
".",
"get",
"(",
"i",
")",
".",
"getPosition",
"(",
")",
")",
";",
"if",
"(",
"distances",
"[",
"i",
"]",
"<",
"distances",
"[",
"insertLocation",
"]",
")",
"{",
"insertLocation",
"=",
"i",
";",
"}",
"}",
"int",
"beforeLocation",
"=",
"insertLocation",
">",
"0",
"?",
"insertLocation",
"-",
"1",
":",
"distances",
".",
"length",
"-",
"1",
";",
"int",
"afterLocation",
"=",
"insertLocation",
"<",
"distances",
".",
"length",
"-",
"1",
"?",
"insertLocation",
"+",
"1",
":",
"0",
";",
"if",
"(",
"distances",
"[",
"beforeLocation",
"]",
">",
"distances",
"[",
"afterLocation",
"]",
")",
"{",
"insertLocation",
"=",
"afterLocation",
";",
"}",
"}",
"markers",
".",
"add",
"(",
"insertLocation",
",",
"marker",
")",
";",
"}"
] | Polygon add a marker in the list of markers to where it is closest to the
the surrounding points
@param marker marker
@param markers list of markers | [
"Polygon",
"add",
"a",
"marker",
"in",
"the",
"list",
"of",
"markers",
"to",
"where",
"it",
"is",
"closest",
"to",
"the",
"the",
"surrounding",
"points"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeMarkers.java#L217-L244 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagInclude.java | CmsJspTagInclude.addParameter | public void addParameter(String name, String value) {
"""
This methods adds parameters to the current request.<p>
Parameters added here will be treated like parameters from the
HttpRequest on included pages.<p>
Remember that the value for a parameter in a HttpRequest is a
String array, not just a simple String. If a parameter added here does
not already exist in the HttpRequest, it will be added. If a parameter
exists, another value will be added to the array of values. If the
value already exists for the parameter, nothing will be added, since a
value can appear only once per parameter.<p>
@param name the name to add
@param value the value to add
@see org.opencms.jsp.I_CmsJspTagParamParent#addParameter(String, String)
"""
// No null values allowed in parameters
if ((name == null) || (value == null)) {
return;
}
// Check if internal map exists, create new one if not
if (m_parameterMap == null) {
m_parameterMap = new HashMap<String, String[]>();
}
addParameter(m_parameterMap, name, value, false);
} | java | public void addParameter(String name, String value) {
// No null values allowed in parameters
if ((name == null) || (value == null)) {
return;
}
// Check if internal map exists, create new one if not
if (m_parameterMap == null) {
m_parameterMap = new HashMap<String, String[]>();
}
addParameter(m_parameterMap, name, value, false);
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"// No null values allowed in parameters",
"if",
"(",
"(",
"name",
"==",
"null",
")",
"||",
"(",
"value",
"==",
"null",
")",
")",
"{",
"return",
";",
"}",
"// Check if internal map exists, create new one if not",
"if",
"(",
"m_parameterMap",
"==",
"null",
")",
"{",
"m_parameterMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
"[",
"]",
">",
"(",
")",
";",
"}",
"addParameter",
"(",
"m_parameterMap",
",",
"name",
",",
"value",
",",
"false",
")",
";",
"}"
] | This methods adds parameters to the current request.<p>
Parameters added here will be treated like parameters from the
HttpRequest on included pages.<p>
Remember that the value for a parameter in a HttpRequest is a
String array, not just a simple String. If a parameter added here does
not already exist in the HttpRequest, it will be added. If a parameter
exists, another value will be added to the array of values. If the
value already exists for the parameter, nothing will be added, since a
value can appear only once per parameter.<p>
@param name the name to add
@param value the value to add
@see org.opencms.jsp.I_CmsJspTagParamParent#addParameter(String, String) | [
"This",
"methods",
"adds",
"parameters",
"to",
"the",
"current",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagInclude.java#L434-L447 |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java | CommonsMultipartFileParameter.saveAs | @Override
public File saveAs(File destFile, boolean overwrite) throws IOException {
"""
Save an uploaded file as a given destination file.
@param destFile the destination file
@param overwrite whether to overwrite if it already exists
@return a saved file
@throws IOException if an I/O error has occurred
"""
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
validateFile();
try {
destFile = determineDestinationFile(destFile, overwrite);
fileItem.write(destFile);
} catch (FileUploadException e) {
throw new IllegalStateException(e.getMessage());
} catch (Exception e) {
throw new IOException("Could not save as file " + destFile, e);
}
setSavedFile(destFile);
return destFile;
} | java | @Override
public File saveAs(File destFile, boolean overwrite) throws IOException {
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
validateFile();
try {
destFile = determineDestinationFile(destFile, overwrite);
fileItem.write(destFile);
} catch (FileUploadException e) {
throw new IllegalStateException(e.getMessage());
} catch (Exception e) {
throw new IOException("Could not save as file " + destFile, e);
}
setSavedFile(destFile);
return destFile;
} | [
"@",
"Override",
"public",
"File",
"saveAs",
"(",
"File",
"destFile",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"destFile",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"destFile can not be null\"",
")",
";",
"}",
"validateFile",
"(",
")",
";",
"try",
"{",
"destFile",
"=",
"determineDestinationFile",
"(",
"destFile",
",",
"overwrite",
")",
";",
"fileItem",
".",
"write",
"(",
"destFile",
")",
";",
"}",
"catch",
"(",
"FileUploadException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Could not save as file \"",
"+",
"destFile",
",",
"e",
")",
";",
"}",
"setSavedFile",
"(",
"destFile",
")",
";",
"return",
"destFile",
";",
"}"
] | Save an uploaded file as a given destination file.
@param destFile the destination file
@param overwrite whether to overwrite if it already exists
@return a saved file
@throws IOException if an I/O error has occurred | [
"Save",
"an",
"uploaded",
"file",
"as",
"a",
"given",
"destination",
"file",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java#L123-L142 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.nameContainsIgnoreCase | public static <T extends NamedElement> ElementMatcher.Junction<T> nameContainsIgnoreCase(String infix) {
"""
Matches a {@link NamedElement} for an infix of its name. The name's
capitalization is ignored.
@param infix The expected infix of the name.
@param <T> The type of the matched object.
@return An element matcher for a named element's name's infix.
"""
return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS_IGNORE_CASE));
} | java | public static <T extends NamedElement> ElementMatcher.Junction<T> nameContainsIgnoreCase(String infix) {
return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS_IGNORE_CASE));
} | [
"public",
"static",
"<",
"T",
"extends",
"NamedElement",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"nameContainsIgnoreCase",
"(",
"String",
"infix",
")",
"{",
"return",
"new",
"NameMatcher",
"<",
"T",
">",
"(",
"new",
"StringMatcher",
"(",
"infix",
",",
"StringMatcher",
".",
"Mode",
".",
"CONTAINS_IGNORE_CASE",
")",
")",
";",
"}"
] | Matches a {@link NamedElement} for an infix of its name. The name's
capitalization is ignored.
@param infix The expected infix of the name.
@param <T> The type of the matched object.
@return An element matcher for a named element's name's infix. | [
"Matches",
"a",
"{",
"@link",
"NamedElement",
"}",
"for",
"an",
"infix",
"of",
"its",
"name",
".",
"The",
"name",
"s",
"capitalization",
"is",
"ignored",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L735-L737 |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java | JarWriter.writeEntry | private void writeEntry(JarEntry entry, EntryWriter entryWriter) throws IOException {
"""
Perform the actual write of a {@link JarEntry}. All other {@code write} method
delegate to this one.
@param entry the entry to write
@param entryWriter the entry writer or {@code null} if there is no content
@throws IOException in case of I/O errors
"""
String parent = entry.getName();
if (parent.endsWith("/")) {
parent = parent.substring(0, parent.length() - 1);
}
if (parent.lastIndexOf("/") != -1) {
parent = parent.substring(0, parent.lastIndexOf("/") + 1);
if (parent.length() > 0) {
writeEntry(new JarEntry(parent), null);
}
}
if (this.writtenEntries.add(entry.getName())) {
this.jarOutput.putNextEntry(entry);
if (entryWriter != null) {
entryWriter.write(this.jarOutput);
}
this.jarOutput.closeEntry();
}
} | java | private void writeEntry(JarEntry entry, EntryWriter entryWriter) throws IOException {
String parent = entry.getName();
if (parent.endsWith("/")) {
parent = parent.substring(0, parent.length() - 1);
}
if (parent.lastIndexOf("/") != -1) {
parent = parent.substring(0, parent.lastIndexOf("/") + 1);
if (parent.length() > 0) {
writeEntry(new JarEntry(parent), null);
}
}
if (this.writtenEntries.add(entry.getName())) {
this.jarOutput.putNextEntry(entry);
if (entryWriter != null) {
entryWriter.write(this.jarOutput);
}
this.jarOutput.closeEntry();
}
} | [
"private",
"void",
"writeEntry",
"(",
"JarEntry",
"entry",
",",
"EntryWriter",
"entryWriter",
")",
"throws",
"IOException",
"{",
"String",
"parent",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"parent",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"parent",
"=",
"parent",
".",
"substring",
"(",
"0",
",",
"parent",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"if",
"(",
"parent",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"!=",
"-",
"1",
")",
"{",
"parent",
"=",
"parent",
".",
"substring",
"(",
"0",
",",
"parent",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
")",
";",
"if",
"(",
"parent",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"writeEntry",
"(",
"new",
"JarEntry",
"(",
"parent",
")",
",",
"null",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"writtenEntries",
".",
"add",
"(",
"entry",
".",
"getName",
"(",
")",
")",
")",
"{",
"this",
".",
"jarOutput",
".",
"putNextEntry",
"(",
"entry",
")",
";",
"if",
"(",
"entryWriter",
"!=",
"null",
")",
"{",
"entryWriter",
".",
"write",
"(",
"this",
".",
"jarOutput",
")",
";",
"}",
"this",
".",
"jarOutput",
".",
"closeEntry",
"(",
")",
";",
"}",
"}"
] | Perform the actual write of a {@link JarEntry}. All other {@code write} method
delegate to this one.
@param entry the entry to write
@param entryWriter the entry writer or {@code null} if there is no content
@throws IOException in case of I/O errors | [
"Perform",
"the",
"actual",
"write",
"of",
"a",
"{",
"@link",
"JarEntry",
"}",
".",
"All",
"other",
"{",
"@code",
"write",
"}",
"method",
"delegate",
"to",
"this",
"one",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java#L232-L251 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java | ArabicShaping.shiftArray | private static void shiftArray(char [] dest,int start, int e, char subChar) {
"""
/*
Name : shiftArray
Function: Shifts characters to replace space sub characters
"""
int w = e;
int r = e;
while (--r >= start) {
char ch = dest[r];
if (ch != subChar) {
--w;
if (w != r) {
dest[w] = ch;
}
}
}
} | java | private static void shiftArray(char [] dest,int start, int e, char subChar){
int w = e;
int r = e;
while (--r >= start) {
char ch = dest[r];
if (ch != subChar) {
--w;
if (w != r) {
dest[w] = ch;
}
}
}
} | [
"private",
"static",
"void",
"shiftArray",
"(",
"char",
"[",
"]",
"dest",
",",
"int",
"start",
",",
"int",
"e",
",",
"char",
"subChar",
")",
"{",
"int",
"w",
"=",
"e",
";",
"int",
"r",
"=",
"e",
";",
"while",
"(",
"--",
"r",
">=",
"start",
")",
"{",
"char",
"ch",
"=",
"dest",
"[",
"r",
"]",
";",
"if",
"(",
"ch",
"!=",
"subChar",
")",
"{",
"--",
"w",
";",
"if",
"(",
"w",
"!=",
"r",
")",
"{",
"dest",
"[",
"w",
"]",
"=",
"ch",
";",
"}",
"}",
"}",
"}"
] | /*
Name : shiftArray
Function: Shifts characters to replace space sub characters | [
"/",
"*",
"Name",
":",
"shiftArray",
"Function",
":",
"Shifts",
"characters",
"to",
"replace",
"space",
"sub",
"characters"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1165-L1177 |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/producers/action/ShowProducerAction.java | ShowProducerAction.populateCumulatedStats | private void populateCumulatedStats(final StatDecoratorBean decoratorBean, final List<StatLineAO> allStatLines) {
"""
Allows to set cumulated stat to decorator bean.
@param decoratorBean {@link StatDecoratorBean}
@param allStatLines list of {@link StatLineAO}, all stats present in producer
"""
if (allStatLines == null || allStatLines.isEmpty()) {
LOGGER.warn("Producer's stats are empty");
return;
}
final int cumulatedIndex = getCumulatedIndex(allStatLines);
if (cumulatedIndex == -1)
return;
final StatLineAO cumulatedStatLineAO = allStatLines.get(cumulatedIndex);
final StatBean cumulatedStat = new StatBean();
cumulatedStat.setName(cumulatedStatLineAO.getStatName());
cumulatedStat.setValues(cumulatedStatLineAO.getValues());
decoratorBean.setCumulatedStat(cumulatedStat);
} | java | private void populateCumulatedStats(final StatDecoratorBean decoratorBean, final List<StatLineAO> allStatLines) {
if (allStatLines == null || allStatLines.isEmpty()) {
LOGGER.warn("Producer's stats are empty");
return;
}
final int cumulatedIndex = getCumulatedIndex(allStatLines);
if (cumulatedIndex == -1)
return;
final StatLineAO cumulatedStatLineAO = allStatLines.get(cumulatedIndex);
final StatBean cumulatedStat = new StatBean();
cumulatedStat.setName(cumulatedStatLineAO.getStatName());
cumulatedStat.setValues(cumulatedStatLineAO.getValues());
decoratorBean.setCumulatedStat(cumulatedStat);
} | [
"private",
"void",
"populateCumulatedStats",
"(",
"final",
"StatDecoratorBean",
"decoratorBean",
",",
"final",
"List",
"<",
"StatLineAO",
">",
"allStatLines",
")",
"{",
"if",
"(",
"allStatLines",
"==",
"null",
"||",
"allStatLines",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Producer's stats are empty\"",
")",
";",
"return",
";",
"}",
"final",
"int",
"cumulatedIndex",
"=",
"getCumulatedIndex",
"(",
"allStatLines",
")",
";",
"if",
"(",
"cumulatedIndex",
"==",
"-",
"1",
")",
"return",
";",
"final",
"StatLineAO",
"cumulatedStatLineAO",
"=",
"allStatLines",
".",
"get",
"(",
"cumulatedIndex",
")",
";",
"final",
"StatBean",
"cumulatedStat",
"=",
"new",
"StatBean",
"(",
")",
";",
"cumulatedStat",
".",
"setName",
"(",
"cumulatedStatLineAO",
".",
"getStatName",
"(",
")",
")",
";",
"cumulatedStat",
".",
"setValues",
"(",
"cumulatedStatLineAO",
".",
"getValues",
"(",
")",
")",
";",
"decoratorBean",
".",
"setCumulatedStat",
"(",
"cumulatedStat",
")",
";",
"}"
] | Allows to set cumulated stat to decorator bean.
@param decoratorBean {@link StatDecoratorBean}
@param allStatLines list of {@link StatLineAO}, all stats present in producer | [
"Allows",
"to",
"set",
"cumulated",
"stat",
"to",
"decorator",
"bean",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/producers/action/ShowProducerAction.java#L231-L248 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putAuthenticationResult | public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) {
"""
Put authentication result.
@param authenticationResult the authentication result
@param context the context
"""
context.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT, authenticationResult);
} | java | public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) {
context.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT, authenticationResult);
} | [
"public",
"static",
"void",
"putAuthenticationResult",
"(",
"final",
"AuthenticationResult",
"authenticationResult",
",",
"final",
"RequestContext",
"context",
")",
"{",
"context",
".",
"getConversationScope",
"(",
")",
".",
"put",
"(",
"PARAMETER_AUTHENTICATION_RESULT",
",",
"authenticationResult",
")",
";",
"}"
] | Put authentication result.
@param authenticationResult the authentication result
@param context the context | [
"Put",
"authentication",
"result",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L533-L535 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImagesFromDataAsync | public Observable<ImageCreateSummary> createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) {
"""
Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart
multiple image files can be sent at once, with a maximum of 64 files.
@param projectId The project id
@param imageData the InputStream value
@param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object
"""
return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).map(new Func1<ServiceResponse<ImageCreateSummary>, ImageCreateSummary>() {
@Override
public ImageCreateSummary call(ServiceResponse<ImageCreateSummary> response) {
return response.body();
}
});
} | java | public Observable<ImageCreateSummary> createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) {
return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).map(new Func1<ServiceResponse<ImageCreateSummary>, ImageCreateSummary>() {
@Override
public ImageCreateSummary call(ServiceResponse<ImageCreateSummary> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageCreateSummary",
">",
"createImagesFromDataAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"CreateImagesFromDataOptionalParameter",
"createImagesFromDataOptionalParameter",
")",
"{",
"return",
"createImagesFromDataWithServiceResponseAsync",
"(",
"projectId",
",",
"imageData",
",",
"createImagesFromDataOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ImageCreateSummary",
">",
",",
"ImageCreateSummary",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ImageCreateSummary",
"call",
"(",
"ServiceResponse",
"<",
"ImageCreateSummary",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart
multiple image files can be sent at once, with a maximum of 64 files.
@param projectId The project id
@param imageData the InputStream value
@param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object | [
"Add",
"the",
"provided",
"images",
"to",
"the",
"set",
"of",
"training",
"images",
".",
"This",
"API",
"accepts",
"body",
"content",
"as",
"multipart",
"/",
"form",
"-",
"data",
"and",
"application",
"/",
"octet",
"-",
"stream",
".",
"When",
"using",
"multipart",
"multiple",
"image",
"files",
"can",
"be",
"sent",
"at",
"once",
"with",
"a",
"maximum",
"of",
"64",
"files",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4134-L4141 |
tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoCommand.java | TangoCommand.executeExtractList | public <T> List<T> executeExtractList(final Class<T> clazz, final Object... value) throws DevFailed {
"""
Execute a command with argin which is an array
@param <T>
@param clazz
@param value
@return
@throws DevFailed
"""
final Object result = command.executeExtract(value);
return extractList(TypeConversionUtil.castToArray(clazz, result));
} | java | public <T> List<T> executeExtractList(final Class<T> clazz, final Object... value) throws DevFailed {
final Object result = command.executeExtract(value);
return extractList(TypeConversionUtil.castToArray(clazz, result));
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"executeExtractList",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"...",
"value",
")",
"throws",
"DevFailed",
"{",
"final",
"Object",
"result",
"=",
"command",
".",
"executeExtract",
"(",
"value",
")",
";",
"return",
"extractList",
"(",
"TypeConversionUtil",
".",
"castToArray",
"(",
"clazz",
",",
"result",
")",
")",
";",
"}"
] | Execute a command with argin which is an array
@param <T>
@param clazz
@param value
@return
@throws DevFailed | [
"Execute",
"a",
"command",
"with",
"argin",
"which",
"is",
"an",
"array"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoCommand.java#L204-L207 |
maestrano/maestrano-java | src/main/java/com/maestrano/sso/Session.java | Session.loadFromHttpSession | public static Session loadFromHttpSession(Preset preset, HttpSession httpSession) {
"""
Retrieving Maestrano session from httpSession, returns an empty Session if there is no Session
@param marketplace
marketplace previously configured
@param HttpSession
httpSession
"""
String mnoSessEntry = (String) httpSession.getAttribute(MAESTRANO_SESSION_ID);
if (mnoSessEntry == null) {
return new Session(preset);
}
Map<String, String> sessionObj;
try {
Gson gson = new Gson();
String decryptedSession = new String(DatatypeConverter.parseBase64Binary(mnoSessEntry), "UTF-8");
Type type = new TypeToken<Map<String, String>>() {
}.getType();
sessionObj = gson.fromJson(decryptedSession, type);
} catch (Exception e) {
logger.error("could not deserialized maestrano session: " + mnoSessEntry, e);
throw new RuntimeException("could not deserialized maestrano session: " + mnoSessEntry, e);
}
// Assign attributes
String uid = sessionObj.get("uid");
String groupUid = sessionObj.get("group_uid");
String sessionToken = sessionObj.get("session");
Date recheck;
// Session Recheck
try {
recheck = MnoDateHelper.fromIso8601(sessionObj.get("session_recheck"));
} catch (Exception e) {
recheck = new Date((new Date()).getTime() - 1 * 60 * 1000);
}
return new Session(preset, uid, groupUid, recheck, sessionToken);
} | java | public static Session loadFromHttpSession(Preset preset, HttpSession httpSession) {
String mnoSessEntry = (String) httpSession.getAttribute(MAESTRANO_SESSION_ID);
if (mnoSessEntry == null) {
return new Session(preset);
}
Map<String, String> sessionObj;
try {
Gson gson = new Gson();
String decryptedSession = new String(DatatypeConverter.parseBase64Binary(mnoSessEntry), "UTF-8");
Type type = new TypeToken<Map<String, String>>() {
}.getType();
sessionObj = gson.fromJson(decryptedSession, type);
} catch (Exception e) {
logger.error("could not deserialized maestrano session: " + mnoSessEntry, e);
throw new RuntimeException("could not deserialized maestrano session: " + mnoSessEntry, e);
}
// Assign attributes
String uid = sessionObj.get("uid");
String groupUid = sessionObj.get("group_uid");
String sessionToken = sessionObj.get("session");
Date recheck;
// Session Recheck
try {
recheck = MnoDateHelper.fromIso8601(sessionObj.get("session_recheck"));
} catch (Exception e) {
recheck = new Date((new Date()).getTime() - 1 * 60 * 1000);
}
return new Session(preset, uid, groupUid, recheck, sessionToken);
} | [
"public",
"static",
"Session",
"loadFromHttpSession",
"(",
"Preset",
"preset",
",",
"HttpSession",
"httpSession",
")",
"{",
"String",
"mnoSessEntry",
"=",
"(",
"String",
")",
"httpSession",
".",
"getAttribute",
"(",
"MAESTRANO_SESSION_ID",
")",
";",
"if",
"(",
"mnoSessEntry",
"==",
"null",
")",
"{",
"return",
"new",
"Session",
"(",
"preset",
")",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"sessionObj",
";",
"try",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"String",
"decryptedSession",
"=",
"new",
"String",
"(",
"DatatypeConverter",
".",
"parseBase64Binary",
"(",
"mnoSessEntry",
")",
",",
"\"UTF-8\"",
")",
";",
"Type",
"type",
"=",
"new",
"TypeToken",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"}",
".",
"getType",
"(",
")",
";",
"sessionObj",
"=",
"gson",
".",
"fromJson",
"(",
"decryptedSession",
",",
"type",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"could not deserialized maestrano session: \"",
"+",
"mnoSessEntry",
",",
"e",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"\"could not deserialized maestrano session: \"",
"+",
"mnoSessEntry",
",",
"e",
")",
";",
"}",
"// Assign attributes",
"String",
"uid",
"=",
"sessionObj",
".",
"get",
"(",
"\"uid\"",
")",
";",
"String",
"groupUid",
"=",
"sessionObj",
".",
"get",
"(",
"\"group_uid\"",
")",
";",
"String",
"sessionToken",
"=",
"sessionObj",
".",
"get",
"(",
"\"session\"",
")",
";",
"Date",
"recheck",
";",
"// Session Recheck",
"try",
"{",
"recheck",
"=",
"MnoDateHelper",
".",
"fromIso8601",
"(",
"sessionObj",
".",
"get",
"(",
"\"session_recheck\"",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"recheck",
"=",
"new",
"Date",
"(",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"-",
"1",
"*",
"60",
"*",
"1000",
")",
";",
"}",
"return",
"new",
"Session",
"(",
"preset",
",",
"uid",
",",
"groupUid",
",",
"recheck",
",",
"sessionToken",
")",
";",
"}"
] | Retrieving Maestrano session from httpSession, returns an empty Session if there is no Session
@param marketplace
marketplace previously configured
@param HttpSession
httpSession | [
"Retrieving",
"Maestrano",
"session",
"from",
"httpSession",
"returns",
"an",
"empty",
"Session",
"if",
"there",
"is",
"no",
"Session"
] | train | https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/sso/Session.java#L82-L113 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java | OutputProperties.getQNameProperty | public static QName getQNameProperty(String key, Properties props) {
"""
Searches for the qname property with the specified key in the property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns
<code>null</code> if the property is not found.
@param key the property key.
@param props the list of properties to search in.
@return the value in this property list as a QName value, or false
if null or not "yes".
"""
String s = props.getProperty(key);
if (null != s)
return QName.getQNameFromString(s);
else
return null;
} | java | public static QName getQNameProperty(String key, Properties props)
{
String s = props.getProperty(key);
if (null != s)
return QName.getQNameFromString(s);
else
return null;
} | [
"public",
"static",
"QName",
"getQNameProperty",
"(",
"String",
"key",
",",
"Properties",
"props",
")",
"{",
"String",
"s",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"null",
"!=",
"s",
")",
"return",
"QName",
".",
"getQNameFromString",
"(",
"s",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Searches for the qname property with the specified key in the property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns
<code>null</code> if the property is not found.
@param key the property key.
@param props the list of properties to search in.
@return the value in this property list as a QName value, or false
if null or not "yes". | [
"Searches",
"for",
"the",
"qname",
"property",
"with",
"the",
"specified",
"key",
"in",
"the",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"recursively",
"are",
"then",
"checked",
".",
"The",
"method",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"the",
"property",
"is",
"not",
"found",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java#L385-L394 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java | GameService.observeGame | public Object observeGame(long id, String password) {
"""
Join a password-protected game as a spectator
@param id The game id
@param password The password of the game
@return unknown
"""
return client.sendRpcAndWait(SERVICE, "observeGame", id, password);
} | java | public Object observeGame(long id, String password) {
return client.sendRpcAndWait(SERVICE, "observeGame", id, password);
} | [
"public",
"Object",
"observeGame",
"(",
"long",
"id",
",",
"String",
"password",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"observeGame\"",
",",
"id",
",",
"password",
")",
";",
"}"
] | Join a password-protected game as a spectator
@param id The game id
@param password The password of the game
@return unknown | [
"Join",
"a",
"password",
"-",
"protected",
"game",
"as",
"a",
"spectator"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java#L78-L80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.