repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
roboconf/roboconf-platform | miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/TextUtils.java | TextUtils.findRegionFromSelection | public static SelectionRange findRegionFromSelection( String fullText, int selectionOffset, int selectionLength ) {
// Find the whole lines that match the selection (start)
int newSselectionOffset = TextUtils.fixSelectionOffset( fullText, selectionOffset );
// Modifying the offset can make the length slide => update it
selectionLength += selectionOffset - newSselectionOffset;
selectionOffset = newSselectionOffset;
// Find the whole lines that match the selection (end)
selectionLength = TextUtils.fixSelectionLength( fullText, selectionOffset, selectionLength );
return new SelectionRange( selectionOffset, selectionLength );
} | java | public static SelectionRange findRegionFromSelection( String fullText, int selectionOffset, int selectionLength ) {
// Find the whole lines that match the selection (start)
int newSselectionOffset = TextUtils.fixSelectionOffset( fullText, selectionOffset );
// Modifying the offset can make the length slide => update it
selectionLength += selectionOffset - newSselectionOffset;
selectionOffset = newSselectionOffset;
// Find the whole lines that match the selection (end)
selectionLength = TextUtils.fixSelectionLength( fullText, selectionOffset, selectionLength );
return new SelectionRange( selectionOffset, selectionLength );
} | [
"public",
"static",
"SelectionRange",
"findRegionFromSelection",
"(",
"String",
"fullText",
",",
"int",
"selectionOffset",
",",
"int",
"selectionLength",
")",
"{",
"// Find the whole lines that match the selection (start)",
"int",
"newSselectionOffset",
"=",
"TextUtils",
".",... | Finds the region that includes both the given selection and entire lines.
<p>
Invalid values for the selection settings are fixed by this method.
</p>
@param fullText the full text
@param selectionOffset the selection's offset
@param selectionLength the selection's length
@return a non-null selection range | [
"Finds",
"the",
"region",
"that",
"includes",
"both",
"the",
"given",
"selection",
"and",
"entire",
"lines",
".",
"<p",
">",
"Invalid",
"values",
"for",
"the",
"selection",
"settings",
"are",
"fixed",
"by",
"this",
"method",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/TextUtils.java#L71-L84 |
craterdog/java-primitive-types | src/main/java/craterdog/primitives/Probability.java | Probability.and | static public Probability and(Probability probability1, Probability probability2) {
double p1 = probability1.value;
double p2 = probability2.value;
return new Probability(p1 * p2);
} | java | static public Probability and(Probability probability1, Probability probability2) {
double p1 = probability1.value;
double p2 = probability2.value;
return new Probability(p1 * p2);
} | [
"static",
"public",
"Probability",
"and",
"(",
"Probability",
"probability1",
",",
"Probability",
"probability2",
")",
"{",
"double",
"p1",
"=",
"probability1",
".",
"value",
";",
"double",
"p2",
"=",
"probability2",
".",
"value",
";",
"return",
"new",
"Probab... | This function returns the logical conjunction of the specified probabilities. The value
of the logical conjunction of two probabilities is P * Q.
@param probability1 The first probability.
@param probability2 The second probability.
@return The logical conjunction of the two probabilities. | [
"This",
"function",
"returns",
"the",
"logical",
"conjunction",
"of",
"the",
"specified",
"probabilities",
".",
"The",
"value",
"of",
"the",
"logical",
"conjunction",
"of",
"two",
"probabilities",
"is",
"P",
"*",
"Q",
"."
] | train | https://github.com/craterdog/java-primitive-types/blob/730f9bceacfac69f99b094464a7da5747c07a59e/src/main/java/craterdog/primitives/Probability.java#L148-L152 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.skipToChars | static public int skipToChars(byte[] data, int start, byte[] targets) {
int index = start;
int y = 0;
byte current;
for (; index < data.length; index++) {
current = data[index];
for (y = 0; y < targets.length; y++) {
if (current == targets[y]) {
return index;
}
}
}
return index;
} | java | static public int skipToChars(byte[] data, int start, byte[] targets) {
int index = start;
int y = 0;
byte current;
for (; index < data.length; index++) {
current = data[index];
for (y = 0; y < targets.length; y++) {
if (current == targets[y]) {
return index;
}
}
}
return index;
} | [
"static",
"public",
"int",
"skipToChars",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"byte",
"[",
"]",
"targets",
")",
"{",
"int",
"index",
"=",
"start",
";",
"int",
"y",
"=",
"0",
";",
"byte",
"current",
";",
"for",
"(",
";",
"inde... | Utility method to skip past data in an array until it runs out of space
or finds one of the the target characters.
@param data
@param start
@param targets
@return int (return index, equals data.length if not found) | [
"Utility",
"method",
"to",
"skip",
"past",
"data",
"in",
"an",
"array",
"until",
"it",
"runs",
"out",
"of",
"space",
"or",
"finds",
"one",
"of",
"the",
"the",
"target",
"characters",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1104-L1117 |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromAnglesXZ | public Quaternion fromAnglesXZ (float x, float z) {
float hx = x * 0.5f, hz = z * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz);
return set(cz*sx, sz*sx, sz*cx, cz*cx);
} | java | public Quaternion fromAnglesXZ (float x, float z) {
float hx = x * 0.5f, hz = z * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz);
return set(cz*sx, sz*sx, sz*cx, cz*cx);
} | [
"public",
"Quaternion",
"fromAnglesXZ",
"(",
"float",
"x",
",",
"float",
"z",
")",
"{",
"float",
"hx",
"=",
"x",
"*",
"0.5f",
",",
"hz",
"=",
"z",
"*",
"0.5f",
";",
"float",
"sx",
"=",
"FloatMath",
".",
"sin",
"(",
"hx",
")",
",",
"cx",
"=",
"F... | Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about z by the specified number of radians. | [
"Sets",
"this",
"quaternion",
"to",
"one",
"that",
"first",
"rotates",
"about",
"x",
"by",
"the",
"specified",
"number",
"of",
"radians",
"then",
"rotates",
"about",
"z",
"by",
"the",
"specified",
"number",
"of",
"radians",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L184-L189 |
Pkmmte/PkRSS | pkrss/src/main/java/com/pkmmte/pkrss/PkRSS.java | PkRSS.saveFavorite | public boolean saveFavorite(Article article, boolean favorite) {
long time = System.currentTimeMillis();
log("Adding article " + article.getId() + " to favorites...");
try {
if (favorite)
favoriteDatabase.add(article);
else
favoriteDatabase.delete(article);
}
catch (Exception e) {
log("Error " + (favorite ? "saving article to" : "deleting article from") + " favorites database.", Log.ERROR);
}
log("Saving article " + article.getId() + " to favorites took " + (System.currentTimeMillis() - time) + "ms");
return true;
} | java | public boolean saveFavorite(Article article, boolean favorite) {
long time = System.currentTimeMillis();
log("Adding article " + article.getId() + " to favorites...");
try {
if (favorite)
favoriteDatabase.add(article);
else
favoriteDatabase.delete(article);
}
catch (Exception e) {
log("Error " + (favorite ? "saving article to" : "deleting article from") + " favorites database.", Log.ERROR);
}
log("Saving article " + article.getId() + " to favorites took " + (System.currentTimeMillis() - time) + "ms");
return true;
} | [
"public",
"boolean",
"saveFavorite",
"(",
"Article",
"article",
",",
"boolean",
"favorite",
")",
"{",
"long",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"log",
"(",
"\"Adding article \"",
"+",
"article",
".",
"getId",
"(",
")",
"+",
"\... | Saves/Deletes an {@link Article} object to the favorites database.
@param article Article object to save.
@param favorite Whether to save or delete. {@code true} to save; {@code false} to delete.
@return {@code true} if successful, {@code false} if otherwise. | [
"Saves",
"/",
"Deletes",
"an",
"{"
] | train | https://github.com/Pkmmte/PkRSS/blob/0bc536d3bad1dade4538616f71c3a8f068eac89a/pkrss/src/main/java/com/pkmmte/pkrss/PkRSS.java#L351-L366 |
weld/core | impl/src/main/java/org/jboss/weld/util/collections/WeldCollections.java | WeldCollections.putIfAbsent | public static <K, V> V putIfAbsent(Map<K, V> map, K key, V value) {
V old = map.putIfAbsent(key, value);
if (old != null) {
return old;
}
return value;
} | java | public static <K, V> V putIfAbsent(Map<K, V> map, K key, V value) {
V old = map.putIfAbsent(key, value);
if (old != null) {
return old;
}
return value;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"V",
"putIfAbsent",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"V",
"old",
"=",
"map",
".",
"putIfAbsent",
"(",
"key",
",",
"value",
")",
";",
"if",
... | Utility method for working with maps. Unlike {@link Map#putIfAbsent(Object, Object)} this method always returns the value that ends up store in the map
which is either the old value (if any was present) or the new value (if it was stored in the map).
@param map the map
@param key the key
@param value the value
@return the value that ends up store in the map which is either the old value (if any was present) or the new value (if it was stored in the map) | [
"Utility",
"method",
"for",
"working",
"with",
"maps",
".",
"Unlike",
"{",
"@link",
"Map#putIfAbsent",
"(",
"Object",
"Object",
")",
"}",
"this",
"method",
"always",
"returns",
"the",
"value",
"that",
"ends",
"up",
"store",
"in",
"the",
"map",
"which",
"is... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/WeldCollections.java#L125-L131 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getReleaseInfo | public Release getReleaseInfo(String appName, String releaseName) {
return connection.execute(new ReleaseInfo(appName, releaseName), apiKey);
} | java | public Release getReleaseInfo(String appName, String releaseName) {
return connection.execute(new ReleaseInfo(appName, releaseName), apiKey);
} | [
"public",
"Release",
"getReleaseInfo",
"(",
"String",
"appName",
",",
"String",
"releaseName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"ReleaseInfo",
"(",
"appName",
",",
"releaseName",
")",
",",
"apiKey",
")",
";",
"}"
] | Information about a specific release.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param releaseName Release name. See {@link #listReleases} for a list of the app's releases.
@return the release object | [
"Information",
"about",
"a",
"specific",
"release",
"."
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L293-L295 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java | ElemDesc.isAttrFlagSet | public boolean isAttrFlagSet(String name, int flags)
{
return (null != m_attrs)
? ((m_attrs.getIgnoreCase(name) & flags) != 0)
: false;
} | java | public boolean isAttrFlagSet(String name, int flags)
{
return (null != m_attrs)
? ((m_attrs.getIgnoreCase(name) & flags) != 0)
: false;
} | [
"public",
"boolean",
"isAttrFlagSet",
"(",
"String",
"name",
",",
"int",
"flags",
")",
"{",
"return",
"(",
"null",
"!=",
"m_attrs",
")",
"?",
"(",
"(",
"m_attrs",
".",
"getIgnoreCase",
"(",
"name",
")",
"&",
"flags",
")",
"!=",
"0",
")",
":",
"false"... | Tell if any of the bits of interest are set for a named attribute type.
@param name non-null reference to attribute name, in any case.
@param flags flag mask.
@return true if any of the flags are set for the named attribute. | [
"Tell",
"if",
"any",
"of",
"the",
"bits",
"of",
"interest",
"are",
"set",
"for",
"a",
"named",
"attribute",
"type",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java#L173-L178 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.leftShift | public static StringBuffer leftShift(String self, Object value) {
return new StringBuffer(self).append(value);
} | java | public static StringBuffer leftShift(String self, Object value) {
return new StringBuffer(self).append(value);
} | [
"public",
"static",
"StringBuffer",
"leftShift",
"(",
"String",
"self",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"StringBuffer",
"(",
"self",
")",
".",
"append",
"(",
"value",
")",
";",
"}"
] | Overloads the left shift operator to provide an easy way to append multiple
objects as string representations to a String.
@param self a String
@param value an Object
@return a StringBuffer built from this string
@since 1.0 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"append",
"multiple",
"objects",
"as",
"string",
"representations",
"to",
"a",
"String",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1926-L1928 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/FieldReaderWriter.java | FieldReaderWriter.setValue | public void setValue(Object instance, Object newValue, ISMgr stateManager) throws IllegalAccessException {
if (typeDescriptor.isReloadable()) {
if (stateManager == null) {
// Look it up using reflection
stateManager = findInstanceStateManager(instance);
}
String declaringTypeName = typeDescriptor.getName();
Map<String, Object> typeLevelValues = stateManager.getMap().get(declaringTypeName);
if (typeLevelValues == null) {
// first time we've accessed this type for an instance field
typeLevelValues = new HashMap<String, Object>();
stateManager.getMap().put(declaringTypeName, typeLevelValues);
}
typeLevelValues.put(theField.getName(), newValue);
}
else { // the type is not reloadable, must use reflection to access the value
// TODO generate get/set in the topmost reloader for these kinds of field and use them?
if (typeDescriptor.isInterface()) {
// field resolution has left us with an interface field, those can't be set like this
throw new IncompatibleClassChangeError("Expected non-static field " + instance.getClass().getName()
+ "."
+ theField.getName());
}
else {
findAndSetFieldValueInHierarchy(instance, newValue);
}
}
} | java | public void setValue(Object instance, Object newValue, ISMgr stateManager) throws IllegalAccessException {
if (typeDescriptor.isReloadable()) {
if (stateManager == null) {
// Look it up using reflection
stateManager = findInstanceStateManager(instance);
}
String declaringTypeName = typeDescriptor.getName();
Map<String, Object> typeLevelValues = stateManager.getMap().get(declaringTypeName);
if (typeLevelValues == null) {
// first time we've accessed this type for an instance field
typeLevelValues = new HashMap<String, Object>();
stateManager.getMap().put(declaringTypeName, typeLevelValues);
}
typeLevelValues.put(theField.getName(), newValue);
}
else { // the type is not reloadable, must use reflection to access the value
// TODO generate get/set in the topmost reloader for these kinds of field and use them?
if (typeDescriptor.isInterface()) {
// field resolution has left us with an interface field, those can't be set like this
throw new IncompatibleClassChangeError("Expected non-static field " + instance.getClass().getName()
+ "."
+ theField.getName());
}
else {
findAndSetFieldValueInHierarchy(instance, newValue);
}
}
} | [
"public",
"void",
"setValue",
"(",
"Object",
"instance",
",",
"Object",
"newValue",
",",
"ISMgr",
"stateManager",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"typeDescriptor",
".",
"isReloadable",
"(",
")",
")",
"{",
"if",
"(",
"stateManager",
"==... | Set the value of an instance field on the specified instance to the specified value. If a state manager is passed
in things can be done in a more optimal way, otherwise the state manager has to be discovered from the instance.
@param instance the object instance upon which to set the field
@param newValue the new value for that field
@param stateManager the optional state manager for this instance, which will be looked up (expensive) if not
passed in
@throws IllegalAccessException if the field value cannot be set | [
"Set",
"the",
"value",
"of",
"an",
"instance",
"field",
"on",
"the",
"specified",
"instance",
"to",
"the",
"specified",
"value",
".",
"If",
"a",
"state",
"manager",
"is",
"passed",
"in",
"things",
"can",
"be",
"done",
"in",
"a",
"more",
"optimal",
"way",... | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/FieldReaderWriter.java#L63-L90 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.deleteAsync | public <T> CompletableFuture<T> deleteAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> delete(type, closure), getExecutor());
} | java | public <T> CompletableFuture<T> deleteAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> delete(type, closure), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"deleteAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",... | Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Class,Closure)` method), with additional
configuration provided by the configuration closure. The result will be cast to the specified `type`.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101'
}
CompletedFuture<Date> future = http.deleteAsync(Date){
request.uri.path = '/date'
response.parser('text/date') { ChainedHttpConfig config, FromServer fromServer ->
Date.parse('yyyy.MM.dd HH:mm', fromServer.inputStream.text)
}
}
Date date = future.get()
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param type the type of the resulting object
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} containing the result of the request | [
"Executes",
"an",
"asynchronous",
"DELETE",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"delete",
"(",
"Class",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configurat... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1247-L1249 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getFindBugsEnginePluginLocation | public static String getFindBugsEnginePluginLocation() {
// findbugs.home should be set to the directory the plugin is
// installed in.
URL u = plugin.getBundle().getEntry("/");
try {
URL bundleRoot = FileLocator.resolve(u);
String path = bundleRoot.getPath();
if (FindBugsBuilder.DEBUG) {
System.out.println("Pluginpath: " + path); //$NON-NLS-1$
}
if (path.endsWith("/eclipsePlugin/")) {
File f = new File(path);
f = f.getParentFile();
f = new File(f, "findbugs");
path = f.getPath() + "/";
}
return path;
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "IO Exception locating engine plugin");
}
return null;
} | java | public static String getFindBugsEnginePluginLocation() {
// findbugs.home should be set to the directory the plugin is
// installed in.
URL u = plugin.getBundle().getEntry("/");
try {
URL bundleRoot = FileLocator.resolve(u);
String path = bundleRoot.getPath();
if (FindBugsBuilder.DEBUG) {
System.out.println("Pluginpath: " + path); //$NON-NLS-1$
}
if (path.endsWith("/eclipsePlugin/")) {
File f = new File(path);
f = f.getParentFile();
f = new File(f, "findbugs");
path = f.getPath() + "/";
}
return path;
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "IO Exception locating engine plugin");
}
return null;
} | [
"public",
"static",
"String",
"getFindBugsEnginePluginLocation",
"(",
")",
"{",
"// findbugs.home should be set to the directory the plugin is",
"// installed in.",
"URL",
"u",
"=",
"plugin",
".",
"getBundle",
"(",
")",
".",
"getEntry",
"(",
"\"/\"",
")",
";",
"try",
... | Find the filesystem path of the FindBugs plugin directory.
@return the filesystem path of the FindBugs plugin directory, or null if
the FindBugs plugin directory cannot be found | [
"Find",
"the",
"filesystem",
"path",
"of",
"the",
"FindBugs",
"plugin",
"directory",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L508-L530 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.splitInCriteria | protected List splitInCriteria(Object attribute, Collection values, boolean negative, int inLimit)
{
List result = new ArrayList();
Collection inCollection = new ArrayList();
if (values == null || values.isEmpty())
{
// OQL creates empty Criteria for late binding
result.add(buildInCriteria(attribute, negative, values));
}
else
{
Iterator iter = values.iterator();
while (iter.hasNext())
{
inCollection.add(iter.next());
if (inCollection.size() == inLimit || !iter.hasNext())
{
result.add(buildInCriteria(attribute, negative, inCollection));
inCollection = new ArrayList();
}
}
}
return result;
} | java | protected List splitInCriteria(Object attribute, Collection values, boolean negative, int inLimit)
{
List result = new ArrayList();
Collection inCollection = new ArrayList();
if (values == null || values.isEmpty())
{
// OQL creates empty Criteria for late binding
result.add(buildInCriteria(attribute, negative, values));
}
else
{
Iterator iter = values.iterator();
while (iter.hasNext())
{
inCollection.add(iter.next());
if (inCollection.size() == inLimit || !iter.hasNext())
{
result.add(buildInCriteria(attribute, negative, inCollection));
inCollection = new ArrayList();
}
}
}
return result;
} | [
"protected",
"List",
"splitInCriteria",
"(",
"Object",
"attribute",
",",
"Collection",
"values",
",",
"boolean",
"negative",
",",
"int",
"inLimit",
")",
"{",
"List",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Collection",
"inCollection",
"=",
"new",
... | Answer a List of InCriteria based on values, each InCriteria
contains only inLimit values
@param attribute
@param values
@param negative
@param inLimit the maximum number of values for IN (-1 for no limit)
@return List of InCriteria | [
"Answer",
"a",
"List",
"of",
"InCriteria",
"based",
"on",
"values",
"each",
"InCriteria",
"contains",
"only",
"inLimit",
"values"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L186-L211 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.beginOrJoinTransaction | public static boolean beginOrJoinTransaction()
{
boolean newTransaction = false;
try {
newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
if (newTransaction) {
userTransaction.begin();
}
}
catch (Exception e) {
throw new RuntimeException("Unable to start transaction.", e);
}
return newTransaction;
} | java | public static boolean beginOrJoinTransaction()
{
boolean newTransaction = false;
try {
newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
if (newTransaction) {
userTransaction.begin();
}
}
catch (Exception e) {
throw new RuntimeException("Unable to start transaction.", e);
}
return newTransaction;
} | [
"public",
"static",
"boolean",
"beginOrJoinTransaction",
"(",
")",
"{",
"boolean",
"newTransaction",
"=",
"false",
";",
"try",
"{",
"newTransaction",
"=",
"userTransaction",
".",
"getStatus",
"(",
")",
"==",
"Status",
".",
"STATUS_NO_TRANSACTION",
";",
"if",
"("... | Start or join a transaction.
@return true if a new transaction was started (this means the caller "owns"
the commit()), false if a transaction was joined. | [
"Start",
"or",
"join",
"a",
"transaction",
"."
] | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L69-L83 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-uima/src/main/java/org/deeplearning4j/text/corpora/treeparser/TreeFactory.java | TreeFactory.toTree | public static Tree toTree(TreebankNode node, Pair<String, MultiDimensionalMap<Integer, Integer, String>> labels)
throws Exception {
List<String> tokens = tokens(node);
Tree ret = new Tree(tokens);
ret.setValue(node.getNodeValue());
ret.setLabel(node.getNodeType());
ret.setType(node.getNodeType());
ret.setBegin(node.getBegin());
ret.setEnd(node.getEnd());
ret.setParse(TreebankNodeUtil.toTreebankString(node));
if (node.getNodeTags() != null)
ret.setTags(tags(node));
else
ret.setTags(Arrays.asList(node.getNodeType()));
return ret;
} | java | public static Tree toTree(TreebankNode node, Pair<String, MultiDimensionalMap<Integer, Integer, String>> labels)
throws Exception {
List<String> tokens = tokens(node);
Tree ret = new Tree(tokens);
ret.setValue(node.getNodeValue());
ret.setLabel(node.getNodeType());
ret.setType(node.getNodeType());
ret.setBegin(node.getBegin());
ret.setEnd(node.getEnd());
ret.setParse(TreebankNodeUtil.toTreebankString(node));
if (node.getNodeTags() != null)
ret.setTags(tags(node));
else
ret.setTags(Arrays.asList(node.getNodeType()));
return ret;
} | [
"public",
"static",
"Tree",
"toTree",
"(",
"TreebankNode",
"node",
",",
"Pair",
"<",
"String",
",",
"MultiDimensionalMap",
"<",
"Integer",
",",
"Integer",
",",
"String",
">",
">",
"labels",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"toke... | Converts a treebank node to a tree
@param node the node to convert
@param labels the labels to assign for each span
@return the tree with the same tokens and type as
the given tree bank node
@throws Exception | [
"Converts",
"a",
"treebank",
"node",
"to",
"a",
"tree"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-uima/src/main/java/org/deeplearning4j/text/corpora/treeparser/TreeFactory.java#L90-L105 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.defineConstantField | public void defineConstantField(int modifier, String fieldName, int constant)
{
DeclaredType dt = (DeclaredType)asType();
VariableBuilder builder = new VariableBuilder(this, fieldName, dt.getTypeArguments(), typeParameterMap);
builder.addModifiers(modifier);
builder.addModifier(Modifier.STATIC);
builder.setType(Typ.IntA);
FieldInfo fieldInfo = new FieldInfo(this, builder.getVariableElement(), new ConstantValue(this, constant));
addFieldInfo(fieldInfo);
fieldInfo.readyToWrite();
} | java | public void defineConstantField(int modifier, String fieldName, int constant)
{
DeclaredType dt = (DeclaredType)asType();
VariableBuilder builder = new VariableBuilder(this, fieldName, dt.getTypeArguments(), typeParameterMap);
builder.addModifiers(modifier);
builder.addModifier(Modifier.STATIC);
builder.setType(Typ.IntA);
FieldInfo fieldInfo = new FieldInfo(this, builder.getVariableElement(), new ConstantValue(this, constant));
addFieldInfo(fieldInfo);
fieldInfo.readyToWrite();
} | [
"public",
"void",
"defineConstantField",
"(",
"int",
"modifier",
",",
"String",
"fieldName",
",",
"int",
"constant",
")",
"{",
"DeclaredType",
"dt",
"=",
"(",
"DeclaredType",
")",
"asType",
"(",
")",
";",
"VariableBuilder",
"builder",
"=",
"new",
"VariableBuil... | Define constant field and set the constant value.
@param modifier
@param fieldName
@param constant | [
"Define",
"constant",
"field",
"and",
"set",
"the",
"constant",
"value",
"."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L636-L646 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(File keyCertChainFile, File keyFile) {
return keyManager(keyCertChainFile, keyFile, null);
} | java | public SslContextBuilder keyManager(File keyCertChainFile, File keyFile) {
return keyManager(keyCertChainFile, keyFile, null);
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"File",
"keyCertChainFile",
",",
"File",
"keyFile",
")",
"{",
"return",
"keyManager",
"(",
"keyCertChainFile",
",",
"keyFile",
",",
"null",
")",
";",
"}"
] | Identifying certificate for this host. {@code keyCertChainFile} and {@code keyFile} may
be {@code null} for client contexts, which disables mutual authentication.
@param keyCertChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChainFile",
"}",
"and",
"{",
"@code",
"keyFile",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authentication",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L224-L226 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateTimeInstance | public final static DateFormat getDateTimeInstance(int dateStyle,
int timeStyle)
{
return get(dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT), null);
} | java | public final static DateFormat getDateTimeInstance(int dateStyle,
int timeStyle)
{
return get(dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT), null);
} | [
"public",
"final",
"static",
"DateFormat",
"getDateTimeInstance",
"(",
"int",
"dateStyle",
",",
"int",
"timeStyle",
")",
"{",
"return",
"get",
"(",
"dateStyle",
",",
"timeStyle",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"FORMAT",
")",
",",
"n... | Returns the date/time formatter with the given date and time
formatting styles for the default <code>FORMAT</code> locale.
@param dateStyle the given date formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style.
@param timeStyle the given time formatting style. For example,
SHORT for "h:mm a" in the US locale. Relative time styles are not currently
supported, and behave just like the corresponding non-relative style.
@return a date/time formatter.
@see Category#FORMAT | [
"Returns",
"the",
"date",
"/",
"time",
"formatter",
"with",
"the",
"given",
"date",
"and",
"time",
"formatting",
"styles",
"for",
"the",
"default",
"<code",
">",
"FORMAT<",
"/",
"code",
">",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1366-L1370 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.exportAsync | public Observable<ImportExportOperationResultInner> exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportOperationResultInner>, ImportExportOperationResultInner>() {
@Override
public ImportExportOperationResultInner call(ServiceResponse<ImportExportOperationResultInner> response) {
return response.body();
}
});
} | java | public Observable<ImportExportOperationResultInner> exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportOperationResultInner>, ImportExportOperationResultInner>() {
@Override
public ImportExportOperationResultInner call(ServiceResponse<ImportExportOperationResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImportExportOperationResultInner",
">",
"exportAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"ImportExportDatabaseDefinition",
"parameters",
")",
"{",
"return",
"exportWithServiceRe... | Exports a database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param parameters The database export request parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Exports",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L942-L949 |
prestodb/presto | presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StringStatisticsBuilder.java | StringStatisticsBuilder.addStringStatistics | private void addStringStatistics(long valueCount, StringStatistics value)
{
requireNonNull(value, "value is null");
checkArgument(valueCount > 0, "valueCount is 0");
checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null");
if (nonNullValueCount == 0) {
checkState(minimum == null && maximum == null);
minimum = value.getMin();
maximum = value.getMax();
}
else {
if (minimum != null && (value.getMin() == null || minimum.compareTo(value.getMin()) > 0)) {
minimum = value.getMin();
}
if (maximum != null && (value.getMax() == null || maximum.compareTo(value.getMax()) < 0)) {
maximum = value.getMax();
}
}
nonNullValueCount += valueCount;
sum = addExact(sum, value.getSum());
} | java | private void addStringStatistics(long valueCount, StringStatistics value)
{
requireNonNull(value, "value is null");
checkArgument(valueCount > 0, "valueCount is 0");
checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null");
if (nonNullValueCount == 0) {
checkState(minimum == null && maximum == null);
minimum = value.getMin();
maximum = value.getMax();
}
else {
if (minimum != null && (value.getMin() == null || minimum.compareTo(value.getMin()) > 0)) {
minimum = value.getMin();
}
if (maximum != null && (value.getMax() == null || maximum.compareTo(value.getMax()) < 0)) {
maximum = value.getMax();
}
}
nonNullValueCount += valueCount;
sum = addExact(sum, value.getSum());
} | [
"private",
"void",
"addStringStatistics",
"(",
"long",
"valueCount",
",",
"StringStatistics",
"value",
")",
"{",
"requireNonNull",
"(",
"value",
",",
"\"value is null\"",
")",
";",
"checkArgument",
"(",
"valueCount",
">",
"0",
",",
"\"valueCount is 0\"",
")",
";",... | This method can only be used in merging stats.
It assumes min or max could be nulls. | [
"This",
"method",
"can",
"only",
"be",
"used",
"in",
"merging",
"stats",
".",
"It",
"assumes",
"min",
"or",
"max",
"could",
"be",
"nulls",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StringStatisticsBuilder.java#L89-L111 |
netty/netty | handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java | AbstractTrafficShapingHandler.checkWriteSuspend | void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) {
if (queueSize > maxWriteSize || delay > maxWriteDelay) {
setUserDefinedWritability(ctx, false);
}
} | java | void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) {
if (queueSize > maxWriteSize || delay > maxWriteDelay) {
setUserDefinedWritability(ctx, false);
}
} | [
"void",
"checkWriteSuspend",
"(",
"ChannelHandlerContext",
"ctx",
",",
"long",
"delay",
",",
"long",
"queueSize",
")",
"{",
"if",
"(",
"queueSize",
">",
"maxWriteSize",
"||",
"delay",
">",
"maxWriteDelay",
")",
"{",
"setUserDefinedWritability",
"(",
"ctx",
",",
... | Check the writability according to delay and size for the channel.
Set if necessary setUserDefinedWritability status.
@param delay the computed delay
@param queueSize the current queueSize | [
"Check",
"the",
"writability",
"according",
"to",
"delay",
"and",
"size",
"for",
"the",
"channel",
".",
"Set",
"if",
"necessary",
"setUserDefinedWritability",
"status",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L597-L601 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.noNullValue | @Nullable
public static <T extends Iterable <?>> T noNullValue (final T aValue, final String sName)
{
if (isEnabled ())
return noNullValue (aValue, () -> sName);
return aValue;
} | java | @Nullable
public static <T extends Iterable <?>> T noNullValue (final T aValue, final String sName)
{
if (isEnabled ())
return noNullValue (aValue, () -> sName);
return aValue;
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
"extends",
"Iterable",
"<",
"?",
">",
">",
"T",
"noNullValue",
"(",
"final",
"T",
"aValue",
",",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"noNullValue",
"(",
... | Check that the passed iterable contains no <code>null</code> value. But the
whole iterable can be <code>null</code> or empty.
@param <T>
Type to be checked and returned
@param aValue
The collection to check. May be <code>null</code>.
@param sName
The name of the value (e.g. the parameter name)
@return The passed value. Maybe <code>null</code>.
@throws IllegalArgumentException
if the passed value is not empty and a <code>null</code> value is
contained | [
"Check",
"that",
"the",
"passed",
"iterable",
"contains",
"no",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
".",
"But",
"the",
"whole",
"iterable",
"can",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"or",
"empty",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L927-L933 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChangesHolder.java | ChangesHolder.writeValue | private static void writeValue(ObjectOutput out, Fieldable field) throws IOException
{
Object o = field.stringValue();
if (o != null)
{
// Use writeObject instead of writeUTF because the value could contain unsupported
// characters
out.writeObject(o);
return;
}
o = field.tokenStreamValue();
if (o != null)
{
out.writeObject(o);
return;
}
o = field.readerValue();
throw new RuntimeException("Unsupported value " + o);
} | java | private static void writeValue(ObjectOutput out, Fieldable field) throws IOException
{
Object o = field.stringValue();
if (o != null)
{
// Use writeObject instead of writeUTF because the value could contain unsupported
// characters
out.writeObject(o);
return;
}
o = field.tokenStreamValue();
if (o != null)
{
out.writeObject(o);
return;
}
o = field.readerValue();
throw new RuntimeException("Unsupported value " + o);
} | [
"private",
"static",
"void",
"writeValue",
"(",
"ObjectOutput",
"out",
",",
"Fieldable",
"field",
")",
"throws",
"IOException",
"{",
"Object",
"o",
"=",
"field",
".",
"stringValue",
"(",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"// Use writeObject... | Serialize the value into the given {@link ObjectOutput}
@param out the stream in which we serialize the value
@param field the field from which we extract the value
@throws IOException if the value could not be serialized | [
"Serialize",
"the",
"value",
"into",
"the",
"given",
"{"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChangesHolder.java#L322-L340 |
allengeorge/libraft | libraft-core/src/main/java/io/libraft/algorithm/RaftAlgorithm.java | RaftAlgorithm.becomeLeader | synchronized void becomeLeader(long expectedCurrentTerm) throws StorageException {
long currentTerm = store.getCurrentTerm();
checkArgument(currentTerm == expectedCurrentTerm, "currentTerm:%s expectedCurrentTerm:%s", currentTerm, expectedCurrentTerm);
String votedFor = store.getVotedFor(expectedCurrentTerm);
LogEntry lastLog = checkNotNull(log.getLast());
checkState(leader == null, "leader:%s", leader);
checkState(checkNotNull(votedFor).equals(self), "currentTerm:%s votedFor:%s", currentTerm, votedFor);
checkState(lastLog.getTerm() < currentTerm, "currentTerm:%s lastLog:%s", currentTerm, lastLog);
checkState(commands.isEmpty(), "commands:%s", commands);
checkState(role == Role.CANDIDATE, "invalid transition from %s -> %s", role, Role.LEADER);
logRoleChange(currentTerm, role, Role.LEADER);
stopElectionTimeout();
stopHeartbeatTimeout();
role = Role.LEADER;
setLeader(self);
nextToApplyLogIndex = -1;
votedServers.clear();
long lastLogIndex = lastLog.getIndex();
for (String member : cluster) {
// start off by initializing nextIndex to our belief of their prefix
// notice that it does _not_ include the NOOP entry that we're just about to add
serverData.put(member, new ServerDatum(lastLogIndex + 1, Phase.PREFIX_SEARCH));
}
// add a NOOP entry
// essentially, this allows me to start the synchronizing process early
// it may be that there are people out there with more entries than I,
// or fewer entries than I. by starting off early I can get everyone up
// to speed more quickly and get a more accurate picture of their prefixes
log.put(new LogEntry.NoopEntry(lastLogIndex + 1, currentTerm));
// send out the first heartbeat
heartbeat(currentTerm);
} | java | synchronized void becomeLeader(long expectedCurrentTerm) throws StorageException {
long currentTerm = store.getCurrentTerm();
checkArgument(currentTerm == expectedCurrentTerm, "currentTerm:%s expectedCurrentTerm:%s", currentTerm, expectedCurrentTerm);
String votedFor = store.getVotedFor(expectedCurrentTerm);
LogEntry lastLog = checkNotNull(log.getLast());
checkState(leader == null, "leader:%s", leader);
checkState(checkNotNull(votedFor).equals(self), "currentTerm:%s votedFor:%s", currentTerm, votedFor);
checkState(lastLog.getTerm() < currentTerm, "currentTerm:%s lastLog:%s", currentTerm, lastLog);
checkState(commands.isEmpty(), "commands:%s", commands);
checkState(role == Role.CANDIDATE, "invalid transition from %s -> %s", role, Role.LEADER);
logRoleChange(currentTerm, role, Role.LEADER);
stopElectionTimeout();
stopHeartbeatTimeout();
role = Role.LEADER;
setLeader(self);
nextToApplyLogIndex = -1;
votedServers.clear();
long lastLogIndex = lastLog.getIndex();
for (String member : cluster) {
// start off by initializing nextIndex to our belief of their prefix
// notice that it does _not_ include the NOOP entry that we're just about to add
serverData.put(member, new ServerDatum(lastLogIndex + 1, Phase.PREFIX_SEARCH));
}
// add a NOOP entry
// essentially, this allows me to start the synchronizing process early
// it may be that there are people out there with more entries than I,
// or fewer entries than I. by starting off early I can get everyone up
// to speed more quickly and get a more accurate picture of their prefixes
log.put(new LogEntry.NoopEntry(lastLogIndex + 1, currentTerm));
// send out the first heartbeat
heartbeat(currentTerm);
} | [
"synchronized",
"void",
"becomeLeader",
"(",
"long",
"expectedCurrentTerm",
")",
"throws",
"StorageException",
"{",
"long",
"currentTerm",
"=",
"store",
".",
"getCurrentTerm",
"(",
")",
";",
"checkArgument",
"(",
"currentTerm",
"==",
"expectedCurrentTerm",
",",
"\"c... | Transition this server from {@link Role#CANDIDATE} to {@link Role#LEADER}.
<p/>
<strong>This method is package-private for testing
reasons only!</strong> It should <strong>never</strong>
be called in a non-test context!
@param expectedCurrentTerm election term in which this {@code RaftAlgorithm} instance should
be leader. This method expects that {@link io.libraft.algorithm.Store#getCurrentTerm()}
will return {@code expectedCurrentTerm}. | [
"Transition",
"this",
"server",
"from",
"{",
"@link",
"Role#CANDIDATE",
"}",
"to",
"{",
"@link",
"Role#LEADER",
"}",
".",
"<p",
"/",
">",
"<strong",
">",
"This",
"method",
"is",
"package",
"-",
"private",
"for",
"testing",
"reasons",
"only!<",
"/",
"strong... | train | https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-core/src/main/java/io/libraft/algorithm/RaftAlgorithm.java#L1125-L1169 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java | UnifiedResponse.setContent | @Nonnull
public final UnifiedResponse setContent (@Nonnull final byte [] aContent)
{
ValueEnforcer.notNull (aContent, "Content");
return setContent (aContent, 0, aContent.length);
} | java | @Nonnull
public final UnifiedResponse setContent (@Nonnull final byte [] aContent)
{
ValueEnforcer.notNull (aContent, "Content");
return setContent (aContent, 0, aContent.length);
} | [
"@",
"Nonnull",
"public",
"final",
"UnifiedResponse",
"setContent",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aContent",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aContent",
",",
"\"Content\"",
")",
";",
"return",
"setContent",
"(",
"aContent",
... | Set the response content. To return an empty response pass in a new empty
array, but not <code>null</code>.
@param aContent
The content to be returned. Is <b>not</b> copied inside! May not be
<code>null</code> but maybe empty.
@return this | [
"Set",
"the",
"response",
"content",
".",
"To",
"return",
"an",
"empty",
"response",
"pass",
"in",
"a",
"new",
"empty",
"array",
"but",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L433-L438 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/stock/ProxyBuilder.java | ProxyBuilder.getInvocationHandler | public static InvocationHandler getInvocationHandler(Object instance) {
try {
Field field = instance.getClass().getDeclaredField(FIELD_NAME_HANDLER);
field.setAccessible(true);
return (InvocationHandler) field.get(instance);
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Not a valid proxy instance", e);
} catch (IllegalAccessException e) {
// Should not be thrown, we just set the field to accessible.
throw new AssertionError(e);
}
} | java | public static InvocationHandler getInvocationHandler(Object instance) {
try {
Field field = instance.getClass().getDeclaredField(FIELD_NAME_HANDLER);
field.setAccessible(true);
return (InvocationHandler) field.get(instance);
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Not a valid proxy instance", e);
} catch (IllegalAccessException e) {
// Should not be thrown, we just set the field to accessible.
throw new AssertionError(e);
}
} | [
"public",
"static",
"InvocationHandler",
"getInvocationHandler",
"(",
"Object",
"instance",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"instance",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"FIELD_NAME_HANDLER",
")",
";",
"field",
".",
"setAccess... | Returns the proxy's {@link InvocationHandler}.
@throws IllegalArgumentException if the object supplied is not a proxy created by this class. | [
"Returns",
"the",
"proxy",
"s",
"{",
"@link",
"InvocationHandler",
"}",
"."
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/stock/ProxyBuilder.java#L394-L405 |
grycap/coreutils | coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/Configurer.java | Configurer.loadConfig | public Config loadConfig(final @Nullable String confname, final String rootPath, final boolean reset) {
final Config config = loadConfig(confname, rootPath);
if (reset) COREUTILS_CONTEXT.eventBus().post(new ConfigurationChangedEvent(config));
return config;
} | java | public Config loadConfig(final @Nullable String confname, final String rootPath, final boolean reset) {
final Config config = loadConfig(confname, rootPath);
if (reset) COREUTILS_CONTEXT.eventBus().post(new ConfigurationChangedEvent(config));
return config;
} | [
"public",
"Config",
"loadConfig",
"(",
"final",
"@",
"Nullable",
"String",
"confname",
",",
"final",
"String",
"rootPath",
",",
"final",
"boolean",
"reset",
")",
"{",
"final",
"Config",
"config",
"=",
"loadConfig",
"(",
"confname",
",",
"rootPath",
")",
";",... | Loads and merges application configuration with default properties.
@param confname - optional configuration filename
@param rootPath - only load configuration properties underneath this path that this code
module owns and understands
@param reset - set to <tt>true</tt> will send a notification to all the components subscribed to the {@link ConfigurationChangedEvent}
@return Configuration loaded from the provided filename or from default properties. | [
"Loads",
"and",
"merges",
"application",
"configuration",
"with",
"default",
"properties",
"."
] | train | https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/Configurer.java#L77-L81 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java | TransitiveGroup.getTransitives | public Collection<GroupTransition> getTransitives(String groupIn, String groupOut)
{
final GroupTransition transition = new GroupTransition(groupIn, groupOut);
if (!transitives.containsKey(transition))
{
return Collections.emptyList();
}
return transitives.get(transition);
} | java | public Collection<GroupTransition> getTransitives(String groupIn, String groupOut)
{
final GroupTransition transition = new GroupTransition(groupIn, groupOut);
if (!transitives.containsKey(transition))
{
return Collections.emptyList();
}
return transitives.get(transition);
} | [
"public",
"Collection",
"<",
"GroupTransition",
">",
"getTransitives",
"(",
"String",
"groupIn",
",",
"String",
"groupOut",
")",
"{",
"final",
"GroupTransition",
"transition",
"=",
"new",
"GroupTransition",
"(",
"groupIn",
",",
"groupOut",
")",
";",
"if",
"(",
... | Get the transitive groups list to reach a group from another.
@param groupIn The first group.
@param groupOut The last group.
@return The transitive groups. | [
"Get",
"the",
"transitive",
"groups",
"list",
"to",
"reach",
"a",
"group",
"from",
"another",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java#L153-L161 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.logAndGetAmazonClientException | private String logAndGetAmazonClientException(AmazonClientException ace, String action) {
String errorMessage = "AmazonClientException: " + action + ".";
LOG.error(errorMessage, ace);
return errorMessage;
} | java | private String logAndGetAmazonClientException(AmazonClientException ace, String action) {
String errorMessage = "AmazonClientException: " + action + ".";
LOG.error(errorMessage, ace);
return errorMessage;
} | [
"private",
"String",
"logAndGetAmazonClientException",
"(",
"AmazonClientException",
"ace",
",",
"String",
"action",
")",
"{",
"String",
"errorMessage",
"=",
"\"AmazonClientException: \"",
"+",
"action",
"+",
"\".\"",
";",
"LOG",
".",
"error",
"(",
"errorMessage",
"... | Create generic error message for <code>AmazonClientException</code>. Message include
Action. | [
"Create",
"generic",
"error",
"message",
"for",
"<code",
">",
"AmazonClientException<",
"/",
"code",
">",
".",
"Message",
"include",
"Action",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L413-L417 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getChild | @Pure
public static <T extends Node> T getChild(Node parent, Class<T> type) {
assert parent != null : AssertMessages.notNullParameter(0);
assert type != null : AssertMessages.notNullParameter(1);
final NodeList children = parent.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (type.isInstance(child)) {
return type.cast(child);
}
}
return null;
} | java | @Pure
public static <T extends Node> T getChild(Node parent, Class<T> type) {
assert parent != null : AssertMessages.notNullParameter(0);
assert type != null : AssertMessages.notNullParameter(1);
final NodeList children = parent.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (type.isInstance(child)) {
return type.cast(child);
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"<",
"T",
"extends",
"Node",
">",
"T",
"getChild",
"(",
"Node",
"parent",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"assert",
"parent",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
... | Replies the first child node that has the specified type.
@param <T> is the type of the desired child
@param parent is the element from which the child must be extracted.
@param type is the type of the desired child
@return the child node or <code>null</code> if none. | [
"Replies",
"the",
"first",
"child",
"node",
"that",
"has",
"the",
"specified",
"type",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1305-L1318 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java | ServiceEndpointPolicyDefinitionsInner.getAsync | public Observable<ServiceEndpointPolicyDefinitionInner> getAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName) {
return getWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceEndpointPolicyDefinitionInner> getAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName) {
return getWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceEndpointPolicyDefinitionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"String",
"serviceEndpointPolicyDefinitionName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
... | Get the specified service endpoint policy definitions from service endpoint policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy name.
@param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceEndpointPolicyDefinitionInner object | [
"Get",
"the",
"specified",
"service",
"endpoint",
"policy",
"definitions",
"from",
"service",
"endpoint",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L297-L304 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java | AbstractFaxClientSpi.fireFaxEvent | protected void fireFaxEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus)
{
//create new fax event
FaxMonitorEvent event=new FaxMonitorEvent(id,faxJob,faxJobStatus);
//get listeners
FaxMonitorEventListener[] listeners=null;
synchronized(this.faxClientActionEventListeners)
{
listeners=this.faxMonitorEventListeners.toArray(new FaxMonitorEventListener[this.faxMonitorEventListeners.size()]);
}
int amount=listeners.length;
FaxMonitorEventListener listener=null;
for(int index=0;index<amount;index++)
{
//get next element
listener=listeners[index];
//fire event
if(listener!=null)
{
switch(id)
{
case FAX_JOB_STATUS_CHANGE:
listener.faxJobStatusChanged(event);
break;
default:
throw new FaxException("Unable to support fax event, for event ID: "+id);
}
}
}
} | java | protected void fireFaxEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus)
{
//create new fax event
FaxMonitorEvent event=new FaxMonitorEvent(id,faxJob,faxJobStatus);
//get listeners
FaxMonitorEventListener[] listeners=null;
synchronized(this.faxClientActionEventListeners)
{
listeners=this.faxMonitorEventListeners.toArray(new FaxMonitorEventListener[this.faxMonitorEventListeners.size()]);
}
int amount=listeners.length;
FaxMonitorEventListener listener=null;
for(int index=0;index<amount;index++)
{
//get next element
listener=listeners[index];
//fire event
if(listener!=null)
{
switch(id)
{
case FAX_JOB_STATUS_CHANGE:
listener.faxJobStatusChanged(event);
break;
default:
throw new FaxException("Unable to support fax event, for event ID: "+id);
}
}
}
} | [
"protected",
"void",
"fireFaxEvent",
"(",
"FaxMonitorEventID",
"id",
",",
"FaxJob",
"faxJob",
",",
"FaxJobStatus",
"faxJobStatus",
")",
"{",
"//create new fax event",
"FaxMonitorEvent",
"event",
"=",
"new",
"FaxMonitorEvent",
"(",
"id",
",",
"faxJob",
",",
"faxJobSt... | This function fires a new fax event.
@param id
The fax event ID
@param faxJob
The fax job
@param faxJobStatus
The fax job status | [
"This",
"function",
"fires",
"a",
"new",
"fax",
"event",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java#L585-L617 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java | RelationCollisionUtil.getOneToOneNamer | public Namer getOneToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) {
// configuration
Namer result = getOneToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer);
// fall back
if (result == null) {
result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer);
}
return result;
} | java | public Namer getOneToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) {
// configuration
Namer result = getOneToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer);
// fall back
if (result == null) {
result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer);
}
return result;
} | [
"public",
"Namer",
"getOneToOneNamer",
"(",
"Attribute",
"fromAttribute",
",",
"Namer",
"targetEntityNamer",
")",
"{",
"// configuration",
"Namer",
"result",
"=",
"getOneToOneNamerFromConf",
"(",
"fromAttribute",
".",
"getColumnConfig",
"(",
")",
",",
"targetEntityNamer... | Compute the namer for the Java field marked by @OneToOne
@param fromAttribute the fk column config
@param targetEntityNamer | [
"Compute",
"the",
"namer",
"for",
"the",
"Java",
"field",
"marked",
"by",
"@OneToOne"
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java#L141-L151 |
jtrfp/javamod | src/main/java/de/quippy/jflac/util/CRC8.java | CRC8.updateBlock | public static byte updateBlock(byte[] data, int len, byte crc) {
for (int i = 0; i < len; i++)
crc = CRC8_TABLE[crc ^ data[i]];
return crc;
} | java | public static byte updateBlock(byte[] data, int len, byte crc) {
for (int i = 0; i < len; i++)
crc = CRC8_TABLE[crc ^ data[i]];
return crc;
} | [
"public",
"static",
"byte",
"updateBlock",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"len",
",",
"byte",
"crc",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"crc",
"=",
"CRC8_TABLE",
"[",
"crc",
"^",
... | Update the CRC value with data from a byte array.
@param data The byte array
@param len The byte array length
@param crc The starting CRC value
@return The updated CRC value | [
"Update",
"the",
"CRC",
"value",
"with",
"data",
"from",
"a",
"byte",
"array",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/util/CRC8.java#L308-L312 |
blackducksoftware/hub-common-rest | src/main/java/com/synopsys/integration/blackduck/rest/ApiTokenRestConnection.java | ApiTokenRestConnection.authenticateWithBlackduck | @Override
public void authenticateWithBlackduck() throws IntegrationException {
final URL authenticationUrl;
try {
authenticationUrl = new URL(getBaseUrl(), "api/tokens/authenticate");
} catch (final MalformedURLException e) {
throw new IntegrationException("Error constructing the authentication URL: " + e.getMessage(), e);
}
if (StringUtils.isNotBlank(hubApiToken)) {
final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, getRequestHeaders());
requestBuilder.setCharset(Charsets.UTF_8);
requestBuilder.setUri(authenticationUrl.toString());
final HttpUriRequest request = requestBuilder.build();
logRequestHeaders(request);
try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) {
logResponseHeaders(closeableHttpResponse);
final Response response = new Response(closeableHttpResponse);
final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode();
final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase();
if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) {
final String httpResponseContent = response.getContentString();
throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage));
} else {
addCommonRequestHeader(AUTHORIZATION_HEADER, "Bearer " + readBearerToken(closeableHttpResponse));
// get the CSRF token
final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN);
if (csrfToken != null) {
addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue());
} else {
logger.error("No CSRF token found when authenticating");
}
}
} catch (final IOException e) {
throw new IntegrationException(e.getMessage(), e);
}
}
} | java | @Override
public void authenticateWithBlackduck() throws IntegrationException {
final URL authenticationUrl;
try {
authenticationUrl = new URL(getBaseUrl(), "api/tokens/authenticate");
} catch (final MalformedURLException e) {
throw new IntegrationException("Error constructing the authentication URL: " + e.getMessage(), e);
}
if (StringUtils.isNotBlank(hubApiToken)) {
final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, getRequestHeaders());
requestBuilder.setCharset(Charsets.UTF_8);
requestBuilder.setUri(authenticationUrl.toString());
final HttpUriRequest request = requestBuilder.build();
logRequestHeaders(request);
try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) {
logResponseHeaders(closeableHttpResponse);
final Response response = new Response(closeableHttpResponse);
final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode();
final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase();
if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) {
final String httpResponseContent = response.getContentString();
throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage));
} else {
addCommonRequestHeader(AUTHORIZATION_HEADER, "Bearer " + readBearerToken(closeableHttpResponse));
// get the CSRF token
final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN);
if (csrfToken != null) {
addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue());
} else {
logger.error("No CSRF token found when authenticating");
}
}
} catch (final IOException e) {
throw new IntegrationException(e.getMessage(), e);
}
}
} | [
"@",
"Override",
"public",
"void",
"authenticateWithBlackduck",
"(",
")",
"throws",
"IntegrationException",
"{",
"final",
"URL",
"authenticationUrl",
";",
"try",
"{",
"authenticationUrl",
"=",
"new",
"URL",
"(",
"getBaseUrl",
"(",
")",
",",
"\"api/tokens/authenticat... | Gets the cookie for the Authorized connection to the Hub server. Returns the response code from the connection. | [
"Gets",
"the",
"cookie",
"for",
"the",
"Authorized",
"connection",
"to",
"the",
"Hub",
"server",
".",
"Returns",
"the",
"response",
"code",
"from",
"the",
"connection",
"."
] | train | https://github.com/blackducksoftware/hub-common-rest/blob/7df7ec1f421dca0fb35d8679f6fcb494cee08a2a/src/main/java/com/synopsys/integration/blackduck/rest/ApiTokenRestConnection.java#L80-L118 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java | InstanceGroupClient.insertInstanceGroup | @BetaApi
public final Operation insertInstanceGroup(String zone, InstanceGroup instanceGroupResource) {
InsertInstanceGroupHttpRequest request =
InsertInstanceGroupHttpRequest.newBuilder()
.setZone(zone)
.setInstanceGroupResource(instanceGroupResource)
.build();
return insertInstanceGroup(request);
} | java | @BetaApi
public final Operation insertInstanceGroup(String zone, InstanceGroup instanceGroupResource) {
InsertInstanceGroupHttpRequest request =
InsertInstanceGroupHttpRequest.newBuilder()
.setZone(zone)
.setInstanceGroupResource(instanceGroupResource)
.build();
return insertInstanceGroup(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertInstanceGroup",
"(",
"String",
"zone",
",",
"InstanceGroup",
"instanceGroupResource",
")",
"{",
"InsertInstanceGroupHttpRequest",
"request",
"=",
"InsertInstanceGroupHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"... | Creates an instance group in the specified project using the parameters that are included in
the request.
<p>Sample code:
<pre><code>
try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
Operation response = instanceGroupClient.insertInstanceGroup(zone.toString(), instanceGroupResource);
}
</code></pre>
@param zone The name of the zone where you want to create the instance group.
@param instanceGroupResource InstanceGroups (== resource_for beta.instanceGroups ==) (==
resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (==
resource_for v1.regionInstanceGroups ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"an",
"instance",
"group",
"in",
"the",
"specified",
"project",
"using",
"the",
"parameters",
"that",
"are",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java#L678-L687 |
d-michail/jheaps | src/main/java/org/jheaps/array/BinaryArrayWeakHeap.java | BinaryArrayWeakHeap.joinWithComparator | protected boolean joinWithComparator(int i, int j) {
if (comparator.compare(array[j], array[i]) < 0) {
K tmp = array[i];
array[i] = array[j];
array[j] = tmp;
reverse.flip(j);
return false;
}
return true;
} | java | protected boolean joinWithComparator(int i, int j) {
if (comparator.compare(array[j], array[i]) < 0) {
K tmp = array[i];
array[i] = array[j];
array[j] = tmp;
reverse.flip(j);
return false;
}
return true;
} | [
"protected",
"boolean",
"joinWithComparator",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"comparator",
".",
"compare",
"(",
"array",
"[",
"j",
"]",
",",
"array",
"[",
"i",
"]",
")",
"<",
"0",
")",
"{",
"K",
"tmp",
"=",
"array",
"[",
... | Join two weak heaps into one.
@param i
root of the first weak heap
@param j
root of the second weak heap
@return true if already a weak heap, false if a flip was needed | [
"Join",
"two",
"weak",
"heaps",
"into",
"one",
"."
] | train | https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/array/BinaryArrayWeakHeap.java#L409-L418 |
Pkmmte/PkRSS | pkrss/src/main/java/com/pkmmte/pkrss/Article.java | Article.putExtra | public Article putExtra(String key, String value) {
this.extras.putString(key, value);
return this;
} | java | public Article putExtra(String key, String value) {
this.extras.putString(key, value);
return this;
} | [
"public",
"Article",
"putExtra",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"extras",
".",
"putString",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a given value into a Bundle associated with this Article instance.
@param key A String key.
@param value Value to insert. | [
"Inserts",
"a",
"given",
"value",
"into",
"a",
"Bundle",
"associated",
"with",
"this",
"Article",
"instance",
"."
] | train | https://github.com/Pkmmte/PkRSS/blob/0bc536d3bad1dade4538616f71c3a8f068eac89a/pkrss/src/main/java/com/pkmmte/pkrss/Article.java#L118-L121 |
micronaut-projects/micronaut-core | multitenancy/src/main/java/io/micronaut/multitenancy/writer/CookieTenantWriter.java | CookieTenantWriter.writeTenant | @Override
public void writeTenant(MutableHttpRequest<?> request, Serializable tenant) {
if (tenant instanceof String) {
Cookie cookie = Cookie.of(
cookieTenantWriterConfiguration.getCookiename(),
(String) tenant
);
cookie.configure(cookieTenantWriterConfiguration, request.isSecure());
if (cookieTenantWriterConfiguration.getCookieMaxAge().isPresent()) {
cookie.maxAge(cookieTenantWriterConfiguration.getCookieMaxAge().get());
} else {
cookie.maxAge(Integer.MAX_VALUE);
}
request.cookie(cookie);
}
} | java | @Override
public void writeTenant(MutableHttpRequest<?> request, Serializable tenant) {
if (tenant instanceof String) {
Cookie cookie = Cookie.of(
cookieTenantWriterConfiguration.getCookiename(),
(String) tenant
);
cookie.configure(cookieTenantWriterConfiguration, request.isSecure());
if (cookieTenantWriterConfiguration.getCookieMaxAge().isPresent()) {
cookie.maxAge(cookieTenantWriterConfiguration.getCookieMaxAge().get());
} else {
cookie.maxAge(Integer.MAX_VALUE);
}
request.cookie(cookie);
}
} | [
"@",
"Override",
"public",
"void",
"writeTenant",
"(",
"MutableHttpRequest",
"<",
"?",
">",
"request",
",",
"Serializable",
"tenant",
")",
"{",
"if",
"(",
"tenant",
"instanceof",
"String",
")",
"{",
"Cookie",
"cookie",
"=",
"Cookie",
".",
"of",
"(",
"cooki... | Writes the Tenant Id in a cookie of the request.
@param request The {@link MutableHttpRequest} instance
@param tenant Tenant Id | [
"Writes",
"the",
"Tenant",
"Id",
"in",
"a",
"cookie",
"of",
"the",
"request",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/multitenancy/src/main/java/io/micronaut/multitenancy/writer/CookieTenantWriter.java#L50-L66 |
aws/aws-sdk-java | aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/DescribeDimensionKeysRequest.java | DescribeDimensionKeysRequest.withFilter | public DescribeDimensionKeysRequest withFilter(java.util.Map<String, String> filter) {
setFilter(filter);
return this;
} | java | public DescribeDimensionKeysRequest withFilter(java.util.Map<String, String> filter) {
setFilter(filter);
return this;
} | [
"public",
"DescribeDimensionKeysRequest",
"withFilter",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"filter",
")",
"{",
"setFilter",
"(",
"filter",
")",
";",
"return",
"this",
";",
"}"
] | <p>
One or more filters to apply in the request. Restrictions:
</p>
<ul>
<li>
<p>
Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or <code>Partition</code>
parameters.
</p>
</li>
<li>
<p>
A single filter for any other dimension in this dimension group.
</p>
</li>
</ul>
@param filter
One or more filters to apply in the request. Restrictions:</p>
<ul>
<li>
<p>
Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or
<code>Partition</code> parameters.
</p>
</li>
<li>
<p>
A single filter for any other dimension in this dimension group.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"One",
"or",
"more",
"filters",
"to",
"apply",
"in",
"the",
"request",
".",
"Restrictions",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<p",
">",
"Any",
"number",
"of",
"filters",
"by",
"the",
"same",
"dimension",
"as",
"specified",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/DescribeDimensionKeysRequest.java#L1012-L1015 |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.handleChannelClosed | public void handleChannelClosed(final Channel closed, final IOException e) {
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
if (activeOperation.getChannel() == closed) {
// Only call cancel, to also interrupt still active threads
activeOperation.getResultHandler().cancel();
}
}
} | java | public void handleChannelClosed(final Channel closed, final IOException e) {
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
if (activeOperation.getChannel() == closed) {
// Only call cancel, to also interrupt still active threads
activeOperation.getResultHandler().cancel();
}
}
} | [
"public",
"void",
"handleChannelClosed",
"(",
"final",
"Channel",
"closed",
",",
"final",
"IOException",
"e",
")",
"{",
"for",
"(",
"final",
"ActiveOperationImpl",
"<",
"?",
",",
"?",
">",
"activeOperation",
":",
"activeRequests",
".",
"values",
"(",
")",
")... | Receive a notification that the channel was closed.
This is used for the {@link ManagementClientChannelStrategy.Establishing} since it might use multiple channels.
@param closed the closed resource
@param e the exception which occurred during close, if any | [
"Receive",
"a",
"notification",
"that",
"the",
"channel",
"was",
"closed",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L114-L121 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicMarkableReference.java | AtomicMarkableReference.attemptMark | public boolean attemptMark(V expectedReference, boolean newMark) {
Pair<V> current = pair;
return
expectedReference == current.reference &&
(newMark == current.mark ||
casPair(current, Pair.of(expectedReference, newMark)));
} | java | public boolean attemptMark(V expectedReference, boolean newMark) {
Pair<V> current = pair;
return
expectedReference == current.reference &&
(newMark == current.mark ||
casPair(current, Pair.of(expectedReference, newMark)));
} | [
"public",
"boolean",
"attemptMark",
"(",
"V",
"expectedReference",
",",
"boolean",
"newMark",
")",
"{",
"Pair",
"<",
"V",
">",
"current",
"=",
"pair",
";",
"return",
"expectedReference",
"==",
"current",
".",
"reference",
"&&",
"(",
"newMark",
"==",
"current... | Atomically sets the value of the mark to the given update value
if the current reference is {@code ==} to the expected
reference. Any given invocation of this operation may fail
(return {@code false}) spuriously, but repeated invocation
when the current value holds the expected value and no other
thread is also attempting to set the value will eventually
succeed.
@param expectedReference the expected value of the reference
@param newMark the new value for the mark
@return {@code true} if successful | [
"Atomically",
"sets",
"the",
"value",
"of",
"the",
"mark",
"to",
"the",
"given",
"update",
"value",
"if",
"the",
"current",
"reference",
"is",
"{",
"@code",
"==",
"}",
"to",
"the",
"expected",
"reference",
".",
"Any",
"given",
"invocation",
"of",
"this",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicMarkableReference.java#L183-L189 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.setOrtho | public Matrix4x3d setOrtho(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) {
m00 = 2.0 / (right - left);
m01 = 0.0;
m02 = 0.0;
m10 = 0.0;
m11 = 2.0 / (top - bottom);
m12 = 0.0;
m20 = 0.0;
m21 = 0.0;
m22 = (zZeroToOne ? 1.0 : 2.0) / (zNear - zFar);
m30 = (right + left) / (left - right);
m31 = (top + bottom) / (bottom - top);
m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar);
properties = 0;
return this;
} | java | public Matrix4x3d setOrtho(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) {
m00 = 2.0 / (right - left);
m01 = 0.0;
m02 = 0.0;
m10 = 0.0;
m11 = 2.0 / (top - bottom);
m12 = 0.0;
m20 = 0.0;
m21 = 0.0;
m22 = (zZeroToOne ? 1.0 : 2.0) / (zNear - zFar);
m30 = (right + left) / (left - right);
m31 = (top + bottom) / (bottom - top);
m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar);
properties = 0;
return this;
} | [
"public",
"Matrix4x3d",
"setOrtho",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"zNear",
",",
"double",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"m00",
"=",
"2.0",
"/",
"(",
"right",... | Set this matrix to be an orthographic projection transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the orthographic projection to an already existing transformation,
use {@link #ortho(double, double, double, double, double, double, boolean) ortho()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(double, double, double, double, double, double, boolean)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"In",
"order",
"to",
"apply",
"the",
"ortho... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L6916-L6931 |
apache/incubator-druid | extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java | ApproximateHistogram.toHistogram | public Histogram toHistogram(final float bucketSize, final float offset)
{
final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset;
final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset;
final float firstBreak = Math.max(minFloor, lowerLimitFloor);
final float maxCeil = (float) Math.ceil((max() - offset) / bucketSize) * bucketSize + offset;
final float upperLimitCeil = (float) Math.ceil((upperLimit - offset) / bucketSize) * bucketSize + offset;
final float lastBreak = Math.min(maxCeil, upperLimitCeil);
final float cutoff = 0.1f;
final ArrayList<Float> breaks = new ArrayList<Float>();
// to deal with left inclusivity when the min is the same as a break
final float bottomBreak = minFloor - bucketSize;
if (bottomBreak != firstBreak && (sum(firstBreak) - sum(bottomBreak) > cutoff)) {
breaks.add(bottomBreak);
}
float left = firstBreak;
boolean leftSet = false;
//the + bucketSize / 10 is because floating point addition is always slightly incorrect and so we need to account for that
while (left + bucketSize <= lastBreak + (bucketSize / 10)) {
final float right = left + bucketSize;
if (sum(right) - sum(left) > cutoff) {
if (!leftSet) {
breaks.add(left);
}
breaks.add(right);
leftSet = true;
} else {
leftSet = false;
}
left = right;
}
if (breaks.get(breaks.size() - 1) != maxCeil && (sum(maxCeil) - sum(breaks.get(breaks.size() - 1)) > cutoff)) {
breaks.add(maxCeil);
}
return toHistogram(Floats.toArray(breaks));
} | java | public Histogram toHistogram(final float bucketSize, final float offset)
{
final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset;
final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset;
final float firstBreak = Math.max(minFloor, lowerLimitFloor);
final float maxCeil = (float) Math.ceil((max() - offset) / bucketSize) * bucketSize + offset;
final float upperLimitCeil = (float) Math.ceil((upperLimit - offset) / bucketSize) * bucketSize + offset;
final float lastBreak = Math.min(maxCeil, upperLimitCeil);
final float cutoff = 0.1f;
final ArrayList<Float> breaks = new ArrayList<Float>();
// to deal with left inclusivity when the min is the same as a break
final float bottomBreak = minFloor - bucketSize;
if (bottomBreak != firstBreak && (sum(firstBreak) - sum(bottomBreak) > cutoff)) {
breaks.add(bottomBreak);
}
float left = firstBreak;
boolean leftSet = false;
//the + bucketSize / 10 is because floating point addition is always slightly incorrect and so we need to account for that
while (left + bucketSize <= lastBreak + (bucketSize / 10)) {
final float right = left + bucketSize;
if (sum(right) - sum(left) > cutoff) {
if (!leftSet) {
breaks.add(left);
}
breaks.add(right);
leftSet = true;
} else {
leftSet = false;
}
left = right;
}
if (breaks.get(breaks.size() - 1) != maxCeil && (sum(maxCeil) - sum(breaks.get(breaks.size() - 1)) > cutoff)) {
breaks.add(maxCeil);
}
return toHistogram(Floats.toArray(breaks));
} | [
"public",
"Histogram",
"toHistogram",
"(",
"final",
"float",
"bucketSize",
",",
"final",
"float",
"offset",
")",
"{",
"final",
"float",
"minFloor",
"=",
"(",
"float",
")",
"Math",
".",
"floor",
"(",
"(",
"min",
"(",
")",
"-",
"offset",
")",
"/",
"bucke... | Computes a visual representation given an initial breakpoint, offset, and a bucket size.
@param bucketSize the size of each bucket
@param offset the location of one breakpoint
@return visual representation of the histogram | [
"Computes",
"a",
"visual",
"representation",
"given",
"an",
"initial",
"breakpoint",
"offset",
"and",
"a",
"bucket",
"size",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1653-L1698 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.headAsync | public <T> CompletableFuture<T> headAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> head(type, closure), getExecutor());
} | java | public <T> CompletableFuture<T> headAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> head(type, closure), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"headAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",
... | Executes an asynchronous HEAD request on the configured URI (asynchronous alias to the `head(Class,Closure)` method), with additional
configuration provided by the configuration closure. The result will be cast to the specified `type`. A response to a HEAD request contains no
data; however, the `response.when()` methods may provide data based on response headers, which will be cast to the specified type.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101/date'
}
CompletableFuture future = http.headAsync(Date){
response.success { FromServer fromServer ->
Date.parse('yyyy.MM.dd HH:mm', fromServer.headers.find { it.key == 'stamp' }.value)
}
}
Date result = future.get()
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param type the type of the response content
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return a {@link CompletableFuture} which may be used to access the resulting content (if present) | [
"Executes",
"an",
"asynchronous",
"HEAD",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"head",
"(",
"Class",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration"... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L659-L661 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java | FoxHttpClientBuilder.registerFoxHttpInterceptor | public FoxHttpClientBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException {
foxHttpClient.register(interceptorType, foxHttpInterceptor);
return this;
} | java | public FoxHttpClientBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException {
foxHttpClient.register(interceptorType, foxHttpInterceptor);
return this;
} | [
"public",
"FoxHttpClientBuilder",
"registerFoxHttpInterceptor",
"(",
"FoxHttpInterceptorType",
"interceptorType",
",",
"FoxHttpInterceptor",
"foxHttpInterceptor",
")",
"throws",
"FoxHttpException",
"{",
"foxHttpClient",
".",
"register",
"(",
"interceptorType",
",",
"foxHttpInte... | Register an interceptor
@param interceptorType Type of the interceptor
@param foxHttpInterceptor Interceptor instance
@return FoxHttpClientBuilder (this)
@throws FoxHttpException Throws an exception if the interceptor does not match the type | [
"Register",
"an",
"interceptor"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L133-L136 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/AbstractDoubleList.java | AbstractDoubleList.addAllOfFromTo | public void addAllOfFromTo(AbstractDoubleList other, int from, int to) {
beforeInsertAllOfFromTo(size,other,from,to);
} | java | public void addAllOfFromTo(AbstractDoubleList other, int from, int to) {
beforeInsertAllOfFromTo(size,other,from,to);
} | [
"public",
"void",
"addAllOfFromTo",
"(",
"AbstractDoubleList",
"other",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"beforeInsertAllOfFromTo",
"(",
"size",
",",
"other",
",",
"from",
",",
"to",
")",
";",
"}"
] | Appends the part of the specified list between <code>from</code> (inclusive) and <code>to</code> (inclusive) to the receiver.
@param other the list to be added to the receiver.
@param from the index of the first element to be appended (inclusive).
@param to the index of the last element to be appended (inclusive).
@exception IndexOutOfBoundsException index is out of range (<tt>other.size()>0 && (from<0 || from>to || to>=other.size())</tt>). | [
"Appends",
"the",
"part",
"of",
"the",
"specified",
"list",
"between",
"<code",
">",
"from<",
"/",
"code",
">",
"(",
"inclusive",
")",
"and",
"<code",
">",
"to<",
"/",
"code",
">",
"(",
"inclusive",
")",
"to",
"the",
"receiver",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/AbstractDoubleList.java#L53-L55 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationSuggestOracle.java | CmsLocationSuggestOracle.respond | private static void respond(Request request, List<LocationSuggestion> suggestions, Callback callback) {
callback.onSuggestionsReady(request, new Response(suggestions));
} | java | private static void respond(Request request, List<LocationSuggestion> suggestions, Callback callback) {
callback.onSuggestionsReady(request, new Response(suggestions));
} | [
"private",
"static",
"void",
"respond",
"(",
"Request",
"request",
",",
"List",
"<",
"LocationSuggestion",
">",
"suggestions",
",",
"Callback",
"callback",
")",
"{",
"callback",
".",
"onSuggestionsReady",
"(",
"request",
",",
"new",
"Response",
"(",
"suggestions... | Executes the suggestions callback.<p>
@param request the suggestions request
@param suggestions the suggestions
@param callback the callback | [
"Executes",
"the",
"suggestions",
"callback",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationSuggestOracle.java#L121-L124 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_users_login_jobs_POST | public OvhSmsSendingReport serviceName_users_login_jobs_POST(String serviceName, String login, OvhCharsetEnum charset, OvhClassEnum _class, OvhCodingEnum coding, Long differedPeriod, String message, Boolean noStopClause, OvhPriorityEnum priority, String[] receivers, String receiversDocumentUrl, String receiversSlotId, String sender, Boolean senderForResponse, String tag, Long validityPeriod) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/jobs";
StringBuilder sb = path(qPath, serviceName, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "charset", charset);
addBody(o, "class", _class);
addBody(o, "coding", coding);
addBody(o, "differedPeriod", differedPeriod);
addBody(o, "message", message);
addBody(o, "noStopClause", noStopClause);
addBody(o, "priority", priority);
addBody(o, "receivers", receivers);
addBody(o, "receiversDocumentUrl", receiversDocumentUrl);
addBody(o, "receiversSlotId", receiversSlotId);
addBody(o, "sender", sender);
addBody(o, "senderForResponse", senderForResponse);
addBody(o, "tag", tag);
addBody(o, "validityPeriod", validityPeriod);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhSmsSendingReport.class);
} | java | public OvhSmsSendingReport serviceName_users_login_jobs_POST(String serviceName, String login, OvhCharsetEnum charset, OvhClassEnum _class, OvhCodingEnum coding, Long differedPeriod, String message, Boolean noStopClause, OvhPriorityEnum priority, String[] receivers, String receiversDocumentUrl, String receiversSlotId, String sender, Boolean senderForResponse, String tag, Long validityPeriod) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/jobs";
StringBuilder sb = path(qPath, serviceName, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "charset", charset);
addBody(o, "class", _class);
addBody(o, "coding", coding);
addBody(o, "differedPeriod", differedPeriod);
addBody(o, "message", message);
addBody(o, "noStopClause", noStopClause);
addBody(o, "priority", priority);
addBody(o, "receivers", receivers);
addBody(o, "receiversDocumentUrl", receiversDocumentUrl);
addBody(o, "receiversSlotId", receiversSlotId);
addBody(o, "sender", sender);
addBody(o, "senderForResponse", senderForResponse);
addBody(o, "tag", tag);
addBody(o, "validityPeriod", validityPeriod);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhSmsSendingReport.class);
} | [
"public",
"OvhSmsSendingReport",
"serviceName_users_login_jobs_POST",
"(",
"String",
"serviceName",
",",
"String",
"login",
",",
"OvhCharsetEnum",
"charset",
",",
"OvhClassEnum",
"_class",
",",
"OvhCodingEnum",
"coding",
",",
"Long",
"differedPeriod",
",",
"String",
"me... | Add one or several sending jobs
REST: POST /sms/{serviceName}/users/{login}/jobs
@param sender [required] The sender
@param _class [required] [default=phoneDisplay] The sms class
@param receiversSlotId [required] The receivers document slot id
@param priority [required] [default=high] The priority of the message
@param validityPeriod [required] [default=2880] The maximum time -in minute(s)- before the message is dropped
@param senderForResponse [required] Set the flag to send a special sms which can be reply by the receiver (smsResponse).
@param coding [required] [default=7bit] The sms coding
@param differedPeriod [required] [default=0] The time -in minute(s)- to wait before sending the message
@param tag [required] The identifier group tag
@param noStopClause [required] Do not display STOP clause in the message, this requires that this is not an advertising message
@param receiversDocumentUrl [required] The receivers document url link in csv format
@param message [required] The sms message
@param receivers [required] The receivers list
@param charset [required] [default=UTF-8] The sms coding
@param serviceName [required] The internal name of your SMS offer
@param login [required] The sms user login | [
"Add",
"one",
"or",
"several",
"sending",
"jobs"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L932-L952 |
icode/ameba | src/main/java/ameba/db/ebean/internal/ModelInterceptor.java | ModelInterceptor.applyUriQuery | public static FutureRowCount applyUriQuery(MultivaluedMap<String, String> queryParams,
SpiQuery query,
InjectionManager manager) {
return applyUriQuery(queryParams, query, manager, true);
} | java | public static FutureRowCount applyUriQuery(MultivaluedMap<String, String> queryParams,
SpiQuery query,
InjectionManager manager) {
return applyUriQuery(queryParams, query, manager, true);
} | [
"public",
"static",
"FutureRowCount",
"applyUriQuery",
"(",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"SpiQuery",
"query",
",",
"InjectionManager",
"manager",
")",
"{",
"return",
"applyUriQuery",
"(",
"queryParams",
",",
"query",
","... | <p>applyUriQuery.</p>
@param queryParams a {@link javax.ws.rs.core.MultivaluedMap} object.
@param query a {@link io.ebean.Query} object.
@param manager a {@link InjectionManager} object.
@return a {@link io.ebean.FutureRowCount} object. | [
"<p",
">",
"applyUriQuery",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L377-L381 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/StringUtils.java | StringUtils.padStart | public static String padStart(final String aString, final String aPadding, final int aRepeatCount) {
if (aRepeatCount != 0) {
final StringBuilder buffer = new StringBuilder();
for (int index = 0; index < aRepeatCount; index++) {
buffer.append(aPadding);
}
return buffer.append(aString).toString();
}
return aString;
} | java | public static String padStart(final String aString, final String aPadding, final int aRepeatCount) {
if (aRepeatCount != 0) {
final StringBuilder buffer = new StringBuilder();
for (int index = 0; index < aRepeatCount; index++) {
buffer.append(aPadding);
}
return buffer.append(aString).toString();
}
return aString;
} | [
"public",
"static",
"String",
"padStart",
"(",
"final",
"String",
"aString",
",",
"final",
"String",
"aPadding",
",",
"final",
"int",
"aRepeatCount",
")",
"{",
"if",
"(",
"aRepeatCount",
"!=",
"0",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
... | Pads the beginning of a supplied string with the repetition of a supplied value.
@param aString The string to pad
@param aPadding The string to be repeated as the padding
@param aRepeatCount How many times to repeat the padding
@return The front padded string | [
"Pads",
"the",
"beginning",
"of",
"a",
"supplied",
"string",
"with",
"the",
"repetition",
"of",
"a",
"supplied",
"value",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/StringUtils.java#L163-L175 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/common/TimeUtils.java | TimeUtils.checkedAdd | static long checkedAdd(long x, long y) {
BigInteger sum = BigInteger.valueOf(x).add(BigInteger.valueOf(y));
if (sum.compareTo(MAX_LONG_VALUE) > 0 || sum.compareTo(MIN_LONG_VALUE) < 0) {
throw new ArithmeticException("Long sum overflow: x=" + x + ", y=" + y);
}
return x + y;
} | java | static long checkedAdd(long x, long y) {
BigInteger sum = BigInteger.valueOf(x).add(BigInteger.valueOf(y));
if (sum.compareTo(MAX_LONG_VALUE) > 0 || sum.compareTo(MIN_LONG_VALUE) < 0) {
throw new ArithmeticException("Long sum overflow: x=" + x + ", y=" + y);
}
return x + y;
} | [
"static",
"long",
"checkedAdd",
"(",
"long",
"x",
",",
"long",
"y",
")",
"{",
"BigInteger",
"sum",
"=",
"BigInteger",
".",
"valueOf",
"(",
"x",
")",
".",
"add",
"(",
"BigInteger",
".",
"valueOf",
"(",
"y",
")",
")",
";",
"if",
"(",
"sum",
".",
"c... | Adds two longs and throws an {@link ArithmeticException} if the result overflows. This
functionality is provided by {@code Math.addExact(long, long)} in Java 8. | [
"Adds",
"two",
"longs",
"and",
"throws",
"an",
"{"
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/common/TimeUtils.java#L52-L58 |
btc-ag/redg | redg-runtime/src/main/java/com/btc/redg/runtime/AbstractRedG.java | AbstractRedG.findSingleEntity | public <T extends RedGEntity> T findSingleEntity(final Class<T> type, final Predicate<T> filter) {
return this.entities.stream()
.filter(obj -> Objects.equals(type, obj.getClass()))
.map(type::cast)
.filter(filter)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Could not find an entity that satisfies the filter!"));
} | java | public <T extends RedGEntity> T findSingleEntity(final Class<T> type, final Predicate<T> filter) {
return this.entities.stream()
.filter(obj -> Objects.equals(type, obj.getClass()))
.map(type::cast)
.filter(filter)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Could not find an entity that satisfies the filter!"));
} | [
"public",
"<",
"T",
"extends",
"RedGEntity",
">",
"T",
"findSingleEntity",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{",
"return",
"this",
".",
"entities",
".",
"stream",
"(",
")",
".",
"f... | Finds a single entity in the list of entities to insert into the database. If multiple entities match the {@link Predicate}, the entity that was added
first will be returned.
@param type The class of the entity
@param filter A predicate that gets called for every entity that has the requested type. Should return {@code true} only for the entity that should be
found
@param <T> The entity type
@return The found entity. If no entity is found an {@link IllegalArgumentException} gets thrown. | [
"Finds",
"a",
"single",
"entity",
"in",
"the",
"list",
"of",
"entities",
"to",
"insert",
"into",
"the",
"database",
".",
"If",
"multiple",
"entities",
"match",
"the",
"{",
"@link",
"Predicate",
"}",
"the",
"entity",
"that",
"was",
"added",
"first",
"will",... | train | https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-runtime/src/main/java/com/btc/redg/runtime/AbstractRedG.java#L202-L209 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java | HeadedSyntacticCategory.getReturnType | public HeadedSyntacticCategory getReturnType() {
SyntacticCategory returnSyntax = syntacticCategory.getReturn();
int[] returnSemantics = ArrayUtils.copyOf(semanticVariables, rootIndex);
int returnRoot = returnSyntax.getNumReturnSubcategories();
return new HeadedSyntacticCategory(returnSyntax, returnSemantics, returnRoot);
} | java | public HeadedSyntacticCategory getReturnType() {
SyntacticCategory returnSyntax = syntacticCategory.getReturn();
int[] returnSemantics = ArrayUtils.copyOf(semanticVariables, rootIndex);
int returnRoot = returnSyntax.getNumReturnSubcategories();
return new HeadedSyntacticCategory(returnSyntax, returnSemantics, returnRoot);
} | [
"public",
"HeadedSyntacticCategory",
"getReturnType",
"(",
")",
"{",
"SyntacticCategory",
"returnSyntax",
"=",
"syntacticCategory",
".",
"getReturn",
"(",
")",
";",
"int",
"[",
"]",
"returnSemantics",
"=",
"ArrayUtils",
".",
"copyOf",
"(",
"semanticVariables",
",",
... | Gets the syntactic type and semantic variable assignments to the
return type of this category.
@return | [
"Gets",
"the",
"syntactic",
"type",
"and",
"semantic",
"variable",
"assignments",
"to",
"the",
"return",
"type",
"of",
"this",
"category",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java#L277-L282 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/property/PropertyUtil.java | PropertyUtil.getValue | public static String getValue(String propertyName, String instanceName) {
return getPropertyService().getValue(propertyName, instanceName);
} | java | public static String getValue(String propertyName, String instanceName) {
return getPropertyService().getValue(propertyName, instanceName);
} | [
"public",
"static",
"String",
"getValue",
"(",
"String",
"propertyName",
",",
"String",
"instanceName",
")",
"{",
"return",
"getPropertyService",
"(",
")",
".",
"getValue",
"(",
"propertyName",
",",
"instanceName",
")",
";",
"}"
] | Returns a property value as a string.
@param propertyName Name of the property whose value is sought.
@param instanceName An optional instance name. Use null to indicate the default instance.
@return The property value, or null if not found.
@see IPropertyService#getValue | [
"Returns",
"a",
"property",
"value",
"as",
"a",
"string",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/property/PropertyUtil.java#L83-L85 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java | AtomicAllocator.getPointer | @Override
@Deprecated
public Pointer getPointer(DataBuffer buffer, AllocationShape shape, boolean isView, CudaContext context) {
return memoryHandler.getDevicePointer(buffer, context);
} | java | @Override
@Deprecated
public Pointer getPointer(DataBuffer buffer, AllocationShape shape, boolean isView, CudaContext context) {
return memoryHandler.getDevicePointer(buffer, context);
} | [
"@",
"Override",
"@",
"Deprecated",
"public",
"Pointer",
"getPointer",
"(",
"DataBuffer",
"buffer",
",",
"AllocationShape",
"shape",
",",
"boolean",
"isView",
",",
"CudaContext",
"context",
")",
"{",
"return",
"memoryHandler",
".",
"getDevicePointer",
"(",
"buffer... | This method returns actual device pointer valid for specified shape of current object
@param buffer
@param shape
@param isView | [
"This",
"method",
"returns",
"actual",
"device",
"pointer",
"valid",
"for",
"specified",
"shape",
"of",
"current",
"object"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java#L303-L307 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.updateCertificate | public AppServiceCertificateResourceInner updateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificatePatchResource keyVaultCertificate) {
return updateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().single().body();
} | java | public AppServiceCertificateResourceInner updateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificatePatchResource keyVaultCertificate) {
return updateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().single().body();
} | [
"public",
"AppServiceCertificateResourceInner",
"updateCertificate",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"String",
"name",
",",
"AppServiceCertificatePatchResource",
"keyVaultCertificate",
")",
"{",
"return",
"updateCertificateWithServi... | Creates or updates a certificate and associates with key vault secret.
Creates or updates a certificate and associates with key vault secret.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@param keyVaultCertificate Key vault certificate resource Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceCertificateResourceInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
".",
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1480-L1482 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java | BaseAdsServiceClientFactoryHelper.createServiceClient | @VisibleForTesting
C createServiceClient(Object soapClient, D adsServiceDescriptor, S adsSession) {
return adsServiceClientFactory.create(soapClient, adsServiceDescriptor, adsSession);
} | java | @VisibleForTesting
C createServiceClient(Object soapClient, D adsServiceDescriptor, S adsSession) {
return adsServiceClientFactory.create(soapClient, adsServiceDescriptor, adsSession);
} | [
"@",
"VisibleForTesting",
"C",
"createServiceClient",
"(",
"Object",
"soapClient",
",",
"D",
"adsServiceDescriptor",
",",
"S",
"adsSession",
")",
"{",
"return",
"adsServiceClientFactory",
".",
"create",
"(",
"soapClient",
",",
"adsServiceDescriptor",
",",
"adsSession"... | Creates the service client from the factory, descriptor, and SOAP client. | [
"Creates",
"the",
"service",
"client",
"from",
"the",
"factory",
"descriptor",
"and",
"SOAP",
"client",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java#L84-L87 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | MethodHandle.ofSpecial | public static MethodHandle ofSpecial(MethodDescription.InDefinedShape methodDescription, TypeDescription typeDescription) {
if (!methodDescription.isSpecializableFor(typeDescription)) {
throw new IllegalArgumentException("Cannot specialize " + methodDescription + " for " + typeDescription);
}
return new MethodHandle(HandleType.ofSpecial(methodDescription),
typeDescription,
methodDescription.getInternalName(),
methodDescription.getReturnType().asErasure(),
methodDescription.getParameters().asTypeList().asErasures());
} | java | public static MethodHandle ofSpecial(MethodDescription.InDefinedShape methodDescription, TypeDescription typeDescription) {
if (!methodDescription.isSpecializableFor(typeDescription)) {
throw new IllegalArgumentException("Cannot specialize " + methodDescription + " for " + typeDescription);
}
return new MethodHandle(HandleType.ofSpecial(methodDescription),
typeDescription,
methodDescription.getInternalName(),
methodDescription.getReturnType().asErasure(),
methodDescription.getParameters().asTypeList().asErasures());
} | [
"public",
"static",
"MethodHandle",
"ofSpecial",
"(",
"MethodDescription",
".",
"InDefinedShape",
"methodDescription",
",",
"TypeDescription",
"typeDescription",
")",
"{",
"if",
"(",
"!",
"methodDescription",
".",
"isSpecializableFor",
"(",
"typeDescription",
")",
")",
... | Creates a method handle representation of the given method for an explicit special method invocation of an otherwise virtual method.
@param methodDescription The method ro represent.
@param typeDescription The type on which the method is to be invoked on as a special method invocation.
@return A method handle representing the given method as special method invocation. | [
"Creates",
"a",
"method",
"handle",
"representation",
"of",
"the",
"given",
"method",
"for",
"an",
"explicit",
"special",
"method",
"invocation",
"of",
"an",
"otherwise",
"virtual",
"method",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L571-L580 |
wcm-io/wcm-io-handler | commons/src/main/java/io/wcm/handler/commons/dom/AbstractElement.java | AbstractElement.setAttribute | @Override
public final org.jdom2.Element setAttribute(String name, String value, Namespace ns) {
// remove attribute if value is set to null
if (value == null) {
super.removeAttribute(name, ns);
return this;
}
else {
return super.setAttribute(name, cleanUpString(value), ns);
}
} | java | @Override
public final org.jdom2.Element setAttribute(String name, String value, Namespace ns) {
// remove attribute if value is set to null
if (value == null) {
super.removeAttribute(name, ns);
return this;
}
else {
return super.setAttribute(name, cleanUpString(value), ns);
}
} | [
"@",
"Override",
"public",
"final",
"org",
".",
"jdom2",
".",
"Element",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Namespace",
"ns",
")",
"{",
"// remove attribute if value is set to null",
"if",
"(",
"value",
"==",
"null",
")",
"{",... | <p>
This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is
removed.
</p>
@param name name of the attribute to set
@param value value of the attribute to set
@param ns namespace of the attribute to set
@return this element modified
@throws org.jdom2.IllegalNameException if the given name is illegal as an attribute name, or if the namespace
is an unprefixed default namespace
@throws org.jdom2.IllegalDataException if the given attribute value is illegal character data (as determined
by {@link org.jdom2.Verifier#checkCharacterData}).
@throws org.jdom2.IllegalAddException if the attribute namespace prefix collides with another namespace
prefix on the element. | [
"<p",
">",
"This",
"sets",
"an",
"attribute",
"value",
"for",
"this",
"element",
".",
"Any",
"existing",
"attribute",
"with",
"the",
"same",
"name",
"and",
"namespace",
"URI",
"is",
"removed",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/AbstractElement.java#L244-L254 |
shrinkwrap/descriptors | metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataParser.java | MetadataParser.generateCode | public void generateCode(final MetadataParserPath path, final boolean verbose) throws TransformerException {
/** initialize the map which will overwrite global parameters as defined in metadata.xsl/ddJava.xsl */
final Map<String, String> xsltParameters = new HashMap<String, String>();
xsltParameters.put("gOutputFolder", getURIPath(path.getPathToImpl()));
xsltParameters.put("gOutputFolderApi", getURIPath(path.getPathToApi()));
xsltParameters.put("gOutputFolderTest", getURIPath(path.getPathToTest()));
xsltParameters.put("gOutputFolderService", getURIPath(path.getPathToServices()));
xsltParameters.put("gVerbose", Boolean.toString(verbose));
final InputStream is = MetadataParser.class.getResourceAsStream("/META-INF/ddJavaAll.xsl");
if (log.isLoggable(Level.FINE)) {
log.fine("Stream resource: " + is);
}
XsltTransformer.simpleTransform(pathToMetadata, is, new File("./tempddJava.xml"), xsltParameters);
} | java | public void generateCode(final MetadataParserPath path, final boolean verbose) throws TransformerException {
/** initialize the map which will overwrite global parameters as defined in metadata.xsl/ddJava.xsl */
final Map<String, String> xsltParameters = new HashMap<String, String>();
xsltParameters.put("gOutputFolder", getURIPath(path.getPathToImpl()));
xsltParameters.put("gOutputFolderApi", getURIPath(path.getPathToApi()));
xsltParameters.put("gOutputFolderTest", getURIPath(path.getPathToTest()));
xsltParameters.put("gOutputFolderService", getURIPath(path.getPathToServices()));
xsltParameters.put("gVerbose", Boolean.toString(verbose));
final InputStream is = MetadataParser.class.getResourceAsStream("/META-INF/ddJavaAll.xsl");
if (log.isLoggable(Level.FINE)) {
log.fine("Stream resource: " + is);
}
XsltTransformer.simpleTransform(pathToMetadata, is, new File("./tempddJava.xml"), xsltParameters);
} | [
"public",
"void",
"generateCode",
"(",
"final",
"MetadataParserPath",
"path",
",",
"final",
"boolean",
"verbose",
")",
"throws",
"TransformerException",
"{",
"/** initialize the map which will overwrite global parameters as defined in metadata.xsl/ddJava.xsl */",
"final",
"Map",
... | Generates source code by applying the <code>ddJavaAll.xsl</code> XSLT extracted from the resource stream.
@throws TransformerException | [
"Generates",
"source",
"code",
"by",
"applying",
"the",
"<code",
">",
"ddJavaAll",
".",
"xsl<",
"/",
"code",
">",
"XSLT",
"extracted",
"from",
"the",
"resource",
"stream",
"."
] | train | https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataParser.java#L175-L190 |
kite-sdk/kite | kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/com/googlecode/jcsv/fastreader/SimpleCSVTokenizer.java | SimpleCSVTokenizer.tokenizeLine | @Override
public boolean tokenizeLine(String line, BufferedReader reader, Record record) throws IOException {
char separator = separatorChar;
int len = line.length();
int start = 0;
int j = 0;
for (int i = 0; i < len; i++) {
if (line.charAt(i) == separator) {
put(line, start, i, j, record);
start = i+1;
j++;
}
}
put(line, start, len, j, record);
return true;
} | java | @Override
public boolean tokenizeLine(String line, BufferedReader reader, Record record) throws IOException {
char separator = separatorChar;
int len = line.length();
int start = 0;
int j = 0;
for (int i = 0; i < len; i++) {
if (line.charAt(i) == separator) {
put(line, start, i, j, record);
start = i+1;
j++;
}
}
put(line, start, len, j, record);
return true;
} | [
"@",
"Override",
"public",
"boolean",
"tokenizeLine",
"(",
"String",
"line",
",",
"BufferedReader",
"reader",
",",
"Record",
"record",
")",
"throws",
"IOException",
"{",
"char",
"separator",
"=",
"separatorChar",
";",
"int",
"len",
"=",
"line",
".",
"length",
... | Splits the given input line into parts, using the given delimiter. | [
"Splits",
"the",
"given",
"input",
"line",
"into",
"parts",
"using",
"the",
"given",
"delimiter",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/com/googlecode/jcsv/fastreader/SimpleCSVTokenizer.java#L44-L59 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.setScopedSessionAttr | public static void setScopedSessionAttr( String attrName, Object val, HttpServletRequest request )
{
request.getSession().setAttribute( getScopedSessionAttrName( attrName, request ), val );
} | java | public static void setScopedSessionAttr( String attrName, Object val, HttpServletRequest request )
{
request.getSession().setAttribute( getScopedSessionAttrName( attrName, request ), val );
} | [
"public",
"static",
"void",
"setScopedSessionAttr",
"(",
"String",
"attrName",
",",
"Object",
"val",
",",
"HttpServletRequest",
"request",
")",
"{",
"request",
".",
"getSession",
"(",
")",
".",
"setAttribute",
"(",
"getScopedSessionAttrName",
"(",
"attrName",
",",... | If the request is a ScopedRequest, this sets an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to {@link HttpSession#setAttribute}.
@exclude | [
"If",
"the",
"request",
"is",
"a",
"ScopedRequest",
"this",
"sets",
"an",
"attribute",
"whose",
"name",
"is",
"scoped",
"to",
"that",
"request",
"s",
"scope",
"-",
"ID",
";",
"otherwise",
"it",
"is",
"a",
"straight",
"passthrough",
"to",
"{",
"@link",
"H... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L330-L333 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java | BaseLdpHandler.checkCache | protected static void checkCache(final Request request, final Instant modified, final EntityTag etag) {
final ResponseBuilder builder = request.evaluatePreconditions(from(modified), etag);
if (nonNull(builder)) {
throw new WebApplicationException(builder.build());
}
} | java | protected static void checkCache(final Request request, final Instant modified, final EntityTag etag) {
final ResponseBuilder builder = request.evaluatePreconditions(from(modified), etag);
if (nonNull(builder)) {
throw new WebApplicationException(builder.build());
}
} | [
"protected",
"static",
"void",
"checkCache",
"(",
"final",
"Request",
"request",
",",
"final",
"Instant",
"modified",
",",
"final",
"EntityTag",
"etag",
")",
"{",
"final",
"ResponseBuilder",
"builder",
"=",
"request",
".",
"evaluatePreconditions",
"(",
"from",
"... | Check the request for a cache-related response
@param request the request
@param modified the modified time
@param etag the etag
@throws WebApplicationException either a 412 Precondition Failed or a 304 Not Modified, depending on the context. | [
"Check",
"the",
"request",
"for",
"a",
"cache",
"-",
"related",
"response"
] | train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java#L112-L117 |
NessComputing/components-ness-httpclient | client/src/main/java/com/nesscomputing/httpclient/HttpClientDefaultAuthProvider.java | HttpClientDefaultAuthProvider.forUser | public static final HttpClientAuthProvider forUser(final String login, final String password)
{
return new HttpClientDefaultAuthProvider(null, null, -1, null, login, password);
} | java | public static final HttpClientAuthProvider forUser(final String login, final String password)
{
return new HttpClientDefaultAuthProvider(null, null, -1, null, login, password);
} | [
"public",
"static",
"final",
"HttpClientAuthProvider",
"forUser",
"(",
"final",
"String",
"login",
",",
"final",
"String",
"password",
")",
"{",
"return",
"new",
"HttpClientDefaultAuthProvider",
"(",
"null",
",",
"null",
",",
"-",
"1",
",",
"null",
",",
"login... | Returns an {@link HttpClientAuthProvider} that will accept any remote host and presents
the login and password as authentication credential.
@param login Login to use.
@param password Password to use. | [
"Returns",
"an",
"{"
] | train | https://github.com/NessComputing/components-ness-httpclient/blob/8e97e8576e470449672c81fa7890c60f9986966d/client/src/main/java/com/nesscomputing/httpclient/HttpClientDefaultAuthProvider.java#L44-L47 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java | TraceNLS.getResourceBundle | public static ResourceBundle getResourceBundle(Class<?> caller, String bundleName, Locale locale) {
return TraceNLSResolver.getInstance().getResourceBundle(caller, bundleName, locale);
} | java | public static ResourceBundle getResourceBundle(Class<?> caller, String bundleName, Locale locale) {
return TraceNLSResolver.getInstance().getResourceBundle(caller, bundleName, locale);
} | [
"public",
"static",
"ResourceBundle",
"getResourceBundle",
"(",
"Class",
"<",
"?",
">",
"caller",
",",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"return",
"TraceNLSResolver",
".",
"getInstance",
"(",
")",
".",
"getResourceBundle",
"(",
"caller",... | Looks up the specified ResourceBundle
This method first uses the current classLoader to find the
ResourceBundle. If that fails, it uses the context classLoader.
@param caller
Class object calling this method
@param bundleName
the fully qualified name of the ResourceBundle. Must not be
null.
@param locale
the Locale object to use when looking up the ResourceBundle.
Must not be null.
@return ResourceBundle
@throws RuntimeExceptions
caused by MissingResourceException or NullPointerException
where resource bundle or classloader cannot be loaded | [
"Looks",
"up",
"the",
"specified",
"ResourceBundle"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L804-L806 |
twilliamson/mogwee-logging | src/main/java/com/mogwee/logging/Logger.java | Logger.warnf | public final void warnf(Throwable cause, String message, Object... args)
{
logf(Level.WARN, cause, message, args);
} | java | public final void warnf(Throwable cause, String message, Object... args)
{
logf(Level.WARN, cause, message, args);
} | [
"public",
"final",
"void",
"warnf",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"logf",
"(",
"Level",
".",
"WARN",
",",
"cause",
",",
"message",
",",
"args",
")",
";",
"}"
] | Logs a formatted message and stack trace if WARN logging is enabled.
@param cause an exception to print stack trace of
@param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a>
@param args arguments referenced by the format specifiers in the format string. | [
"Logs",
"a",
"formatted",
"message",
"and",
"stack",
"trace",
"if",
"WARN",
"logging",
"is",
"enabled",
"."
] | train | https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L202-L205 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/HeaderCell.java | HeaderCell.setAttribute | public void setAttribute(String name, String value, String facet) throws JspException {
if(facet == null || facet.equals(ATTRIBUTE_HEADER_NAME)) {
super.addStateAttribute(_cellState, name, value);
}
else {
String s = Bundle.getString("Tags_AttributeFacetNotSupported", new Object[]{facet});
throw new JspException(s);
}
} | java | public void setAttribute(String name, String value, String facet) throws JspException {
if(facet == null || facet.equals(ATTRIBUTE_HEADER_NAME)) {
super.addStateAttribute(_cellState, name, value);
}
else {
String s = Bundle.getString("Tags_AttributeFacetNotSupported", new Object[]{facet});
throw new JspException(s);
}
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"if",
"(",
"facet",
"==",
"null",
"||",
"facet",
".",
"equals",
"(",
"ATTRIBUTE_HEADER_NAME",
")",
")",
"{",
"super... | <p>
Implementation of the {@link org.apache.beehive.netui.tags.IAttributeConsumer} interface. This
allows users of the anchorCell tag to extend the attribute set that is rendered by the HTML
anchor. This method accepts the following facets:
<table>
<tr><td>Facet Name</td><td>Operation</td></tr>
<tr><td><code>header</code></td><td>Adds an attribute with the provided <code>name</code> and <code>value</code> to the
attributes rendered on the <th> tag.</td></tr>
</table>
The HeaderCell tag defaults to the setting attributes on the header when the facet name is unset.
</p>
@param name the name of the attribute
@param value the value of the attribute
@param facet the facet for the attribute
@throws JspException thrown when the facet is not recognized | [
"<p",
">",
"Implementation",
"of",
"the",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/HeaderCell.java#L706-L714 |
networknt/light-4j | http-url/src/main/java/com/networknt/url/QueryString.java | QueryString.addString | public final void addString(String key, String... values) {
if (values == null || Array.getLength(values) == 0) {
return;
}
List<String> list = parameters.get(key);
if (list == null) {
list = new ArrayList<>();
}
list.addAll(Arrays.asList(values));
parameters.put(key, list);
} | java | public final void addString(String key, String... values) {
if (values == null || Array.getLength(values) == 0) {
return;
}
List<String> list = parameters.get(key);
if (list == null) {
list = new ArrayList<>();
}
list.addAll(Arrays.asList(values));
parameters.put(key, list);
} | [
"public",
"final",
"void",
"addString",
"(",
"String",
"key",
",",
"String",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"Array",
".",
"getLength",
"(",
"values",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"List",
"<",
"S... | Adds one or multiple string values.
Adding a single <code>null</code> value has no effect.
When adding multiple values, <code>null</code> values are converted
to blank strings.
@param key the key of the value to set
@param values the values to set | [
"Adds",
"one",
"or",
"multiple",
"string",
"values",
".",
"Adding",
"a",
"single",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
"has",
"no",
"effect",
".",
"When",
"adding",
"multiple",
"values",
"<code",
">",
"null<",
"/",
"code",
">",
"values",
... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/QueryString.java#L201-L211 |
netty/netty | handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java | TrafficCounter.readTimeToWait | @Deprecated
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return readTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | java | @Deprecated
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return readTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | [
"@",
"Deprecated",
"public",
"long",
"readTimeToWait",
"(",
"final",
"long",
"size",
",",
"final",
"long",
"limitTraffic",
",",
"final",
"long",
"maxTime",
")",
"{",
"return",
"readTimeToWait",
"(",
"size",
",",
"limitTraffic",
",",
"maxTime",
",",
"milliSecon... | Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait
time.
@param size
the recv size
@param limitTraffic
the traffic limit in bytes per second.
@param maxTime
the max time in ms to wait in case of excess of traffic.
@return the current time to wait (in ms) if needed for Read operation. | [
"Returns",
"the",
"time",
"to",
"wait",
"(",
"if",
"any",
")",
"for",
"the",
"given",
"length",
"message",
"using",
"the",
"given",
"limitTraffic",
"and",
"the",
"max",
"wait",
"time",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L480-L483 |
phax/ph-web | ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java | CSP2SourceList.addHash | @Nonnull
public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo, @Nonnull final String sHashBase64Value)
{
ValueEnforcer.notNull (eMDAlgo, "MDAlgo");
ValueEnforcer.notEmpty (sHashBase64Value, "HashBase64Value");
String sAlgorithmName;
switch (eMDAlgo)
{
case SHA_256:
sAlgorithmName = "sha256";
break;
case SHA_384:
sAlgorithmName = "sha384";
break;
case SHA_512:
sAlgorithmName = "sha512";
break;
default:
throw new IllegalArgumentException ("Only SHA256, SHA384 and SHA512 are supported algorithms");
}
m_aList.add (HASH_PREFIX + sAlgorithmName + "-" + sHashBase64Value + HASH_SUFFIX);
return this;
} | java | @Nonnull
public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo, @Nonnull final String sHashBase64Value)
{
ValueEnforcer.notNull (eMDAlgo, "MDAlgo");
ValueEnforcer.notEmpty (sHashBase64Value, "HashBase64Value");
String sAlgorithmName;
switch (eMDAlgo)
{
case SHA_256:
sAlgorithmName = "sha256";
break;
case SHA_384:
sAlgorithmName = "sha384";
break;
case SHA_512:
sAlgorithmName = "sha512";
break;
default:
throw new IllegalArgumentException ("Only SHA256, SHA384 and SHA512 are supported algorithms");
}
m_aList.add (HASH_PREFIX + sAlgorithmName + "-" + sHashBase64Value + HASH_SUFFIX);
return this;
} | [
"@",
"Nonnull",
"public",
"CSP2SourceList",
"addHash",
"(",
"@",
"Nonnull",
"final",
"EMessageDigestAlgorithm",
"eMDAlgo",
",",
"@",
"Nonnull",
"final",
"String",
"sHashBase64Value",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eMDAlgo",
",",
"\"MDAlgo\"",
")"... | Add the provided Base64 encoded hash value. The {@value #HASH_PREFIX} and
{@link #HASH_SUFFIX} are added automatically.
@param eMDAlgo
The message digest algorithm used. May only
{@link EMessageDigestAlgorithm#SHA_256},
{@link EMessageDigestAlgorithm#SHA_384} or
{@link EMessageDigestAlgorithm#SHA_512}. May not be <code>null</code>.
@param sHashBase64Value
The Base64 encoded hash value
@return this for chaining | [
"Add",
"the",
"provided",
"Base64",
"encoded",
"hash",
"value",
".",
"The",
"{",
"@value",
"#HASH_PREFIX",
"}",
"and",
"{",
"@link",
"#HASH_SUFFIX",
"}",
"are",
"added",
"automatically",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java#L240-L264 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java | SubscriptionUsagesInner.getAsync | public Observable<SubscriptionUsageInner> getAsync(String locationName, String usageName) {
return getWithServiceResponseAsync(locationName, usageName).map(new Func1<ServiceResponse<SubscriptionUsageInner>, SubscriptionUsageInner>() {
@Override
public SubscriptionUsageInner call(ServiceResponse<SubscriptionUsageInner> response) {
return response.body();
}
});
} | java | public Observable<SubscriptionUsageInner> getAsync(String locationName, String usageName) {
return getWithServiceResponseAsync(locationName, usageName).map(new Func1<ServiceResponse<SubscriptionUsageInner>, SubscriptionUsageInner>() {
@Override
public SubscriptionUsageInner call(ServiceResponse<SubscriptionUsageInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SubscriptionUsageInner",
">",
"getAsync",
"(",
"String",
"locationName",
",",
"String",
"usageName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"locationName",
",",
"usageName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
... | Gets a subscription usage metric.
@param locationName The name of the region where the resource is located.
@param usageName Name of usage metric to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SubscriptionUsageInner object | [
"Gets",
"a",
"subscription",
"usage",
"metric",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java#L224-L231 |
phax/ph-commons | ph-cli/src/main/java/com/helger/cli/HelpFormatter.java | HelpFormatter.printWrapped | public void printWrapped (@Nonnull final PrintWriter aPW, final int nWidth, @Nonnull final String sText)
{
printWrapped (aPW, nWidth, 0, sText);
} | java | public void printWrapped (@Nonnull final PrintWriter aPW, final int nWidth, @Nonnull final String sText)
{
printWrapped (aPW, nWidth, 0, sText);
} | [
"public",
"void",
"printWrapped",
"(",
"@",
"Nonnull",
"final",
"PrintWriter",
"aPW",
",",
"final",
"int",
"nWidth",
",",
"@",
"Nonnull",
"final",
"String",
"sText",
")",
"{",
"printWrapped",
"(",
"aPW",
",",
"nWidth",
",",
"0",
",",
"sText",
")",
";",
... | Print the specified text to the specified PrintWriter.
@param aPW
The printWriter to write the help to
@param nWidth
The number of characters to display per line
@param sText
The text to be written to the PrintWriter | [
"Print",
"the",
"specified",
"text",
"to",
"the",
"specified",
"PrintWriter",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-cli/src/main/java/com/helger/cli/HelpFormatter.java#L800-L803 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/api/API.java | API.validateFormatForViewAction | private static void validateFormatForViewAction(Format format) throws ApiException {
switch (format) {
case JSON:
case JSONP:
case XML:
case HTML:
return;
default:
throw new ApiException(ApiException.Type.BAD_FORMAT, "The format OTHER should not be used with views and actions.");
}
} | java | private static void validateFormatForViewAction(Format format) throws ApiException {
switch (format) {
case JSON:
case JSONP:
case XML:
case HTML:
return;
default:
throw new ApiException(ApiException.Type.BAD_FORMAT, "The format OTHER should not be used with views and actions.");
}
} | [
"private",
"static",
"void",
"validateFormatForViewAction",
"(",
"Format",
"format",
")",
"throws",
"ApiException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"JSON",
":",
"case",
"JSONP",
":",
"case",
"XML",
":",
"case",
"HTML",
":",
"return",
";",
"... | Validates that the given format is supported for views and actions.
@param format the format to validate.
@throws ApiException if the format is not valid.
@see #convertViewActionApiResponse(Format, String, ApiResponse) | [
"Validates",
"that",
"the",
"given",
"format",
"is",
"supported",
"for",
"views",
"and",
"actions",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L609-L619 |
MenoData/Time4J | base/src/main/java/net/time4j/range/Months.java | Months.between | public static Months between(CalendarMonth m1, CalendarMonth m2) {
PlainDate d1 = m1.atDayOfMonth(1);
PlainDate d2 = m2.atDayOfMonth(1);
return Months.between(d1, d2);
} | java | public static Months between(CalendarMonth m1, CalendarMonth m2) {
PlainDate d1 = m1.atDayOfMonth(1);
PlainDate d2 = m2.atDayOfMonth(1);
return Months.between(d1, d2);
} | [
"public",
"static",
"Months",
"between",
"(",
"CalendarMonth",
"m1",
",",
"CalendarMonth",
"m2",
")",
"{",
"PlainDate",
"d1",
"=",
"m1",
".",
"atDayOfMonth",
"(",
"1",
")",
";",
"PlainDate",
"d2",
"=",
"m2",
".",
"atDayOfMonth",
"(",
"1",
")",
";",
"re... | /*[deutsch]
<p>Bestimmt die Monatsdifferenz zwischen den angegebenen Kalendermonaten. </p>
@param m1 first calendar month
@param m2 second calendar month
@return month difference | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Bestimmt",
"die",
"Monatsdifferenz",
"zwischen",
"den",
"angegebenen",
"Kalendermonaten",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Months.java#L139-L145 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/dialogs/JSpringPanel.java | JSpringPanel.constraintSouth | public void constraintSouth(JComponent target, JComponent top, JComponent bottom, int padV ) {
if( bottom == null ) {
layout.putConstraint(SpringLayout.SOUTH, target, -padV, SpringLayout.SOUTH, this);
} else {
Spring a = Spring.sum(Spring.constant(-padV),layout.getConstraint(SpringLayout.NORTH,bottom));
Spring b;
if( top == null )
b = Spring.sum(Spring.height(target),layout.getConstraint(SpringLayout.NORTH,this));
else
b = Spring.sum(Spring.height(target),layout.getConstraint(SpringLayout.SOUTH,top));
layout.getConstraints(target).setConstraint(SpringLayout.SOUTH, Spring.max(a,b));
}
} | java | public void constraintSouth(JComponent target, JComponent top, JComponent bottom, int padV ) {
if( bottom == null ) {
layout.putConstraint(SpringLayout.SOUTH, target, -padV, SpringLayout.SOUTH, this);
} else {
Spring a = Spring.sum(Spring.constant(-padV),layout.getConstraint(SpringLayout.NORTH,bottom));
Spring b;
if( top == null )
b = Spring.sum(Spring.height(target),layout.getConstraint(SpringLayout.NORTH,this));
else
b = Spring.sum(Spring.height(target),layout.getConstraint(SpringLayout.SOUTH,top));
layout.getConstraints(target).setConstraint(SpringLayout.SOUTH, Spring.max(a,b));
}
} | [
"public",
"void",
"constraintSouth",
"(",
"JComponent",
"target",
",",
"JComponent",
"top",
",",
"JComponent",
"bottom",
",",
"int",
"padV",
")",
"{",
"if",
"(",
"bottom",
"==",
"null",
")",
"{",
"layout",
".",
"putConstraint",
"(",
"SpringLayout",
".",
"S... | Constrain it to the top of it's bottom panel and prevent it from getting crushed below it's size | [
"Constrain",
"it",
"to",
"the",
"top",
"of",
"it",
"s",
"bottom",
"panel",
"and",
"prevent",
"it",
"from",
"getting",
"crushed",
"below",
"it",
"s",
"size"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/dialogs/JSpringPanel.java#L217-L230 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SpringUtils.java | SpringUtils.getSpringBean | public static Object getSpringBean(ApplicationContext appContext, String id) {
try {
Object bean = appContext.getBean(id);
return bean;
} catch (BeansException e) {
return null;
}
} | java | public static Object getSpringBean(ApplicationContext appContext, String id) {
try {
Object bean = appContext.getBean(id);
return bean;
} catch (BeansException e) {
return null;
}
} | [
"public",
"static",
"Object",
"getSpringBean",
"(",
"ApplicationContext",
"appContext",
",",
"String",
"id",
")",
"{",
"try",
"{",
"Object",
"bean",
"=",
"appContext",
".",
"getBean",
"(",
"id",
")",
";",
"return",
"bean",
";",
"}",
"catch",
"(",
"BeansExc... | Gets a bean by its id.
@param appContext
@param name
@return | [
"Gets",
"a",
"bean",
"by",
"its",
"id",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SpringUtils.java#L25-L32 |
facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.processHeartbeatEvent | private List<SimulatorEvent> processHeartbeatEvent(HeartbeatEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing heartbeat event " + event);
}
long now = event.getTimeStamp();
// Create the TaskTrackerStatus to report
progressTaskStatuses(now);
List<TaskStatus> taskStatuses = collectAndCloneTaskStatuses();
boolean askForNewTask = (usedMapSlots < maxMapSlots ||
usedReduceSlots < maxReduceSlots);
// 0 means failures == 0 here. Undocumented in TaskTracker, but does not
// seem to be used at all in org.apache.hadoop.mapred .
TaskTrackerStatus taskTrackerStatus =
new SimulatorTaskTrackerStatus(taskTrackerName, hostName, httpPort,
taskStatuses, 0,
maxMapSlots, maxReduceSlots, now);
// This is the right, and only, place to release bookkeping memory held
// by completed tasks: after collectAndCloneTaskStatuses() and before
// heartbeat().
// The status of TIPs to be purged is already cloned & copied to
// taskStatuses for reporting
// We shouldn't run the gc after heartbeat() since KillTaskAction might
// produce new completed tasks that we have not yet reported back and
// don't want to purge immediately.
garbageCollectCompletedTasks();
// Transmit the heartbeat
HeartbeatResponse response = null;
try {
response =
jobTracker.heartbeat(taskTrackerStatus, false, firstHeartbeat,
askForNewTask, heartbeatResponseId);
} catch (IOException ioe) {
throw new IllegalStateException("Internal error", ioe);
}
firstHeartbeat = false;
// The heartbeat got through successfully!
heartbeatResponseId = response.getResponseId();
// Process the heartbeat response
List<SimulatorEvent> events = handleHeartbeatResponse(response, now);
// Next heartbeat
events.add(new HeartbeatEvent(this, now + response.getHeartbeatInterval()));
return events;
} | java | private List<SimulatorEvent> processHeartbeatEvent(HeartbeatEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing heartbeat event " + event);
}
long now = event.getTimeStamp();
// Create the TaskTrackerStatus to report
progressTaskStatuses(now);
List<TaskStatus> taskStatuses = collectAndCloneTaskStatuses();
boolean askForNewTask = (usedMapSlots < maxMapSlots ||
usedReduceSlots < maxReduceSlots);
// 0 means failures == 0 here. Undocumented in TaskTracker, but does not
// seem to be used at all in org.apache.hadoop.mapred .
TaskTrackerStatus taskTrackerStatus =
new SimulatorTaskTrackerStatus(taskTrackerName, hostName, httpPort,
taskStatuses, 0,
maxMapSlots, maxReduceSlots, now);
// This is the right, and only, place to release bookkeping memory held
// by completed tasks: after collectAndCloneTaskStatuses() and before
// heartbeat().
// The status of TIPs to be purged is already cloned & copied to
// taskStatuses for reporting
// We shouldn't run the gc after heartbeat() since KillTaskAction might
// produce new completed tasks that we have not yet reported back and
// don't want to purge immediately.
garbageCollectCompletedTasks();
// Transmit the heartbeat
HeartbeatResponse response = null;
try {
response =
jobTracker.heartbeat(taskTrackerStatus, false, firstHeartbeat,
askForNewTask, heartbeatResponseId);
} catch (IOException ioe) {
throw new IllegalStateException("Internal error", ioe);
}
firstHeartbeat = false;
// The heartbeat got through successfully!
heartbeatResponseId = response.getResponseId();
// Process the heartbeat response
List<SimulatorEvent> events = handleHeartbeatResponse(response, now);
// Next heartbeat
events.add(new HeartbeatEvent(this, now + response.getHeartbeatInterval()));
return events;
} | [
"private",
"List",
"<",
"SimulatorEvent",
">",
"processHeartbeatEvent",
"(",
"HeartbeatEvent",
"event",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Processing heartbeat event \"",
"+",
"event",
")",
";",
... | Transmits a heartbeat event to the jobtracker and processes the response.
@param event HeartbeatEvent to process
@return list of new events generated in response | [
"Transmits",
"a",
"heartbeat",
"event",
"to",
"the",
"jobtracker",
"and",
"processes",
"the",
"response",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L589-L640 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java | BELUtilities.hasItems | public static <K, V> boolean hasItems(final Map<K, V> m) {
return m != null && !m.isEmpty();
} | java | public static <K, V> boolean hasItems(final Map<K, V> m) {
return m != null && !m.isEmpty();
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"boolean",
"hasItems",
"(",
"final",
"Map",
"<",
"K",
",",
"V",
">",
"m",
")",
"{",
"return",
"m",
"!=",
"null",
"&&",
"!",
"m",
".",
"isEmpty",
"(",
")",
";",
"}"
] | Returns {@code true} if the map is non-null and is non-empty,
{@code false} otherwise.
@param <K> Captured key type
@param <V> Captured value type
@param m Map of type {@code <K, V>}, may be null
@return boolean | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"map",
"is",
"non",
"-",
"null",
"and",
"is",
"non",
"-",
"empty",
"{",
"@code",
"false",
"}",
"otherwise",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L647-L649 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | StrTokenizer.addToken | private void addToken(final List<String> list, String tok) {
if (StringUtils.isEmpty(tok)) {
if (isIgnoreEmptyTokens()) {
return;
}
if (isEmptyTokenAsNull()) {
tok = null;
}
}
list.add(tok);
} | java | private void addToken(final List<String> list, String tok) {
if (StringUtils.isEmpty(tok)) {
if (isIgnoreEmptyTokens()) {
return;
}
if (isEmptyTokenAsNull()) {
tok = null;
}
}
list.add(tok);
} | [
"private",
"void",
"addToken",
"(",
"final",
"List",
"<",
"String",
">",
"list",
",",
"String",
"tok",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"tok",
")",
")",
"{",
"if",
"(",
"isIgnoreEmptyTokens",
"(",
")",
")",
"{",
"return",
";",... | Adds a token to a list, paying attention to the parameters we've set.
@param list the list to add to
@param tok the token to add | [
"Adds",
"a",
"token",
"to",
"a",
"list",
"paying",
"attention",
"to",
"the",
"parameters",
"we",
"ve",
"set",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java#L671-L681 |
jenkinsci/jenkins | core/src/main/java/hudson/util/spring/BeanBuilder.java | BeanBuilder.methodMissing | public Object methodMissing(String name, Object arg) {
Object[] args = (Object[])arg;
if(args.length == 0)
throw new MissingMethodException(name,getClass(),args);
if(args[0] instanceof Closure) {
// abstract bean definition
return invokeBeanDefiningMethod(name, args);
}
else if(args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map) {
return invokeBeanDefiningMethod(name, args);
}
else if (args.length > 1 && args[args.length -1] instanceof Closure) {
return invokeBeanDefiningMethod(name, args);
}
WebApplicationContext ctx = springConfig.getUnrefreshedApplicationContext();
MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx);
if(!mc.respondsTo(ctx, name, args).isEmpty()){
return mc.invokeMethod(ctx,name, args);
}
return this;
} | java | public Object methodMissing(String name, Object arg) {
Object[] args = (Object[])arg;
if(args.length == 0)
throw new MissingMethodException(name,getClass(),args);
if(args[0] instanceof Closure) {
// abstract bean definition
return invokeBeanDefiningMethod(name, args);
}
else if(args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map) {
return invokeBeanDefiningMethod(name, args);
}
else if (args.length > 1 && args[args.length -1] instanceof Closure) {
return invokeBeanDefiningMethod(name, args);
}
WebApplicationContext ctx = springConfig.getUnrefreshedApplicationContext();
MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx);
if(!mc.respondsTo(ctx, name, args).isEmpty()){
return mc.invokeMethod(ctx,name, args);
}
return this;
} | [
"public",
"Object",
"methodMissing",
"(",
"String",
"name",
",",
"Object",
"arg",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"(",
"Object",
"[",
"]",
")",
"arg",
";",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"throw",
"new",
"MissingMethodExc... | This method is invoked by Groovy when a method that's not defined in Java is invoked.
We use that as a syntax for bean definition. | [
"This",
"method",
"is",
"invoked",
"by",
"Groovy",
"when",
"a",
"method",
"that",
"s",
"not",
"defined",
"in",
"Java",
"is",
"invoked",
".",
"We",
"use",
"that",
"as",
"a",
"syntax",
"for",
"bean",
"definition",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/spring/BeanBuilder.java#L365-L387 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java | EntrySerializer.readHeader | Header readHeader(@NonNull ArrayView input) throws SerializationException {
byte version = input.get(VERSION_POSITION);
int keyLength = BitConverter.readInt(input, KEY_POSITION);
int valueLength = BitConverter.readInt(input, VALUE_POSITION);
long entryVersion = BitConverter.readLong(input, ENTRY_VERSION_POSITION);
validateHeader(keyLength, valueLength);
return new Header(version, keyLength, valueLength, entryVersion);
} | java | Header readHeader(@NonNull ArrayView input) throws SerializationException {
byte version = input.get(VERSION_POSITION);
int keyLength = BitConverter.readInt(input, KEY_POSITION);
int valueLength = BitConverter.readInt(input, VALUE_POSITION);
long entryVersion = BitConverter.readLong(input, ENTRY_VERSION_POSITION);
validateHeader(keyLength, valueLength);
return new Header(version, keyLength, valueLength, entryVersion);
} | [
"Header",
"readHeader",
"(",
"@",
"NonNull",
"ArrayView",
"input",
")",
"throws",
"SerializationException",
"{",
"byte",
"version",
"=",
"input",
".",
"get",
"(",
"VERSION_POSITION",
")",
";",
"int",
"keyLength",
"=",
"BitConverter",
".",
"readInt",
"(",
"inpu... | Reads the Entry's Header from the given {@link ArrayView}.
@param input The {@link ArrayView} to read from.
@return The Entry Header.
@throws SerializationException If an invalid header was detected. | [
"Reads",
"the",
"Entry",
"s",
"Header",
"from",
"the",
"given",
"{",
"@link",
"ArrayView",
"}",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java#L181-L188 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addDelegateStaticMethod | public static MethodNode addDelegateStaticMethod(ClassNode classNode, MethodNode delegateMethod) {
ClassExpression classExpression = new ClassExpression(delegateMethod.getDeclaringClass());
return addDelegateStaticMethod(classExpression, classNode, delegateMethod);
} | java | public static MethodNode addDelegateStaticMethod(ClassNode classNode, MethodNode delegateMethod) {
ClassExpression classExpression = new ClassExpression(delegateMethod.getDeclaringClass());
return addDelegateStaticMethod(classExpression, classNode, delegateMethod);
} | [
"public",
"static",
"MethodNode",
"addDelegateStaticMethod",
"(",
"ClassNode",
"classNode",
",",
"MethodNode",
"delegateMethod",
")",
"{",
"ClassExpression",
"classExpression",
"=",
"new",
"ClassExpression",
"(",
"delegateMethod",
".",
"getDeclaringClass",
"(",
")",
")"... | Adds a static method call to given class node that delegates to the given method
@param classNode The class node
@param delegateMethod The delegate method
@return The added method node or null if it couldn't be added | [
"Adds",
"a",
"static",
"method",
"call",
"to",
"given",
"class",
"node",
"that",
"delegates",
"to",
"the",
"given",
"method"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L369-L372 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java | ClassLoaderUtil.implementsInterfaceWithSameName | public static boolean implementsInterfaceWithSameName(Class<?> clazz, Class<?> iface) {
Class<?>[] interfaces = getAllInterfaces(clazz);
for (Class implementedInterface : interfaces) {
if (implementedInterface.getName().equals(iface.getName())) {
return true;
}
}
return false;
} | java | public static boolean implementsInterfaceWithSameName(Class<?> clazz, Class<?> iface) {
Class<?>[] interfaces = getAllInterfaces(clazz);
for (Class implementedInterface : interfaces) {
if (implementedInterface.getName().equals(iface.getName())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"implementsInterfaceWithSameName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"iface",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"getAllInterfaces",
"(",
"clazz",
")",
";",
"for"... | Check whether given class implements an interface with the same name.
It returns true even when the implemented interface is loaded by a different
classloader and hence the class is not assignable into it.
An interface is considered as implemented when either:
<ul>
<li>The class directly implements the interface</li>
<li>The class implements an interface which extends the original interface</li>
<li>One of superclasses directly implements the interface</li>
<li>One of superclasses implements an interface which extends the original interface</li>
</ul>
This is useful for logging purposes.
@param clazz class to check whether implements the interface
@param iface interface to be implemented
@return <code>true</code> when the class implements the inteface with the same name | [
"Check",
"whether",
"given",
"class",
"implements",
"an",
"interface",
"with",
"the",
"same",
"name",
".",
"It",
"returns",
"true",
"even",
"when",
"the",
"implemented",
"interface",
"is",
"loaded",
"by",
"a",
"different",
"classloader",
"and",
"hence",
"the",... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java#L356-L364 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java | AbstractRadial.setUserLedPosition | @Override
public void setUserLedPosition(final double X, final double Y) {
userLedPosition.setLocation(X, Y);
repaint(getInnerBounds());
} | java | @Override
public void setUserLedPosition(final double X, final double Y) {
userLedPosition.setLocation(X, Y);
repaint(getInnerBounds());
} | [
"@",
"Override",
"public",
"void",
"setUserLedPosition",
"(",
"final",
"double",
"X",
",",
"final",
"double",
"Y",
")",
"{",
"userLedPosition",
".",
"setLocation",
"(",
"X",
",",
"Y",
")",
";",
"repaint",
"(",
"getInnerBounds",
"(",
")",
")",
";",
"}"
] | Sets the position of the gauge user led to the given values
@param X
@param Y | [
"Sets",
"the",
"position",
"of",
"the",
"gauge",
"user",
"led",
"to",
"the",
"given",
"values"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L461-L465 |
alkacon/opencms-core | src/org/opencms/jsp/decorator/CmsHtmlDecorator.java | CmsHtmlDecorator.mustDecode | private boolean mustDecode(String word, List<String> wordList, int count) {
boolean decode = true;
String nextWord = null;
if (count < (wordList.size() - 1)) {
nextWord = wordList.get(count + 1);
}
// test if the current word contains a "&" and the following with a ";"
// if so, we must not decode the word
if ((nextWord != null) && (word.indexOf("&") > -1) && nextWord.startsWith(";")) {
return false;
} else {
// now scheck if the word matches one of the non decoder tokens
for (int i = 0; i < NON_TRANSLATORS.length; i++) {
if (word.startsWith(NON_TRANSLATORS[i])) {
decode = false;
break;
}
}
}
return decode;
} | java | private boolean mustDecode(String word, List<String> wordList, int count) {
boolean decode = true;
String nextWord = null;
if (count < (wordList.size() - 1)) {
nextWord = wordList.get(count + 1);
}
// test if the current word contains a "&" and the following with a ";"
// if so, we must not decode the word
if ((nextWord != null) && (word.indexOf("&") > -1) && nextWord.startsWith(";")) {
return false;
} else {
// now scheck if the word matches one of the non decoder tokens
for (int i = 0; i < NON_TRANSLATORS.length; i++) {
if (word.startsWith(NON_TRANSLATORS[i])) {
decode = false;
break;
}
}
}
return decode;
} | [
"private",
"boolean",
"mustDecode",
"(",
"String",
"word",
",",
"List",
"<",
"String",
">",
"wordList",
",",
"int",
"count",
")",
"{",
"boolean",
"decode",
"=",
"true",
";",
"String",
"nextWord",
"=",
"null",
";",
"if",
"(",
"count",
"<",
"(",
"wordLis... | Checks if a word must be decoded.<p>
The given word is compared to a negative list of words which must not be decoded.<p>
@param word the word to test
@param wordList the list of words which must not be decoded
@param count the count in the list
@return true if the word must be decoded, false otherweise | [
"Checks",
"if",
"a",
"word",
"must",
"be",
"decoded",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsHtmlDecorator.java#L483-L505 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.getByResourceGroup | public NetworkInterfaceInner getByResourceGroup(String resourceGroupName, String networkInterfaceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | java | public NetworkInterfaceInner getByResourceGroup(String resourceGroupName, String networkInterfaceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | [
"public",
"NetworkInterfaceInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkInterfaceName",
")",
".",
"toBlocking",
... | Gets information about the specified network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkInterfaceInner object if successful. | [
"Gets",
"information",
"about",
"the",
"specified",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L326-L328 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/CreateInputSecurityGroupRequest.java | CreateInputSecurityGroupRequest.withTags | public CreateInputSecurityGroupRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateInputSecurityGroupRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateInputSecurityGroupRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs.
@param tags
A collection of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/CreateInputSecurityGroupRequest.java#L63-L66 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/Conference.java | Conference.createConference | public static Conference createConference(final Map<String, Object> params) throws Exception {
return createConference(BandwidthClient.getInstance(), params);
} | java | public static Conference createConference(final Map<String, Object> params) throws Exception {
return createConference(BandwidthClient.getInstance(), params);
} | [
"public",
"static",
"Conference",
"createConference",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"Exception",
"{",
"return",
"createConference",
"(",
"BandwidthClient",
".",
"getInstance",
"(",
")",
",",
"params",
")",
";"... | Factory method to create a conference given a set of params
@param params the params
@return the conference
@throws IOException unexpected error. | [
"Factory",
"method",
"to",
"create",
"a",
"conference",
"given",
"a",
"set",
"of",
"params"
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Conference.java#L58-L61 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.toPackageName | protected static String toPackageName(String rootPackage, File packageName) {
final StringBuilder name = new StringBuilder();
File tmp = packageName;
while (tmp != null) {
final String elementName = tmp.getName();
if (!Strings.equal(FileSystem.CURRENT_DIRECTORY, elementName)
&& !Strings.equal(FileSystem.PARENT_DIRECTORY, elementName)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, elementName);
}
tmp = tmp.getParentFile();
}
if (!Strings.isEmpty(rootPackage)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, rootPackage);
}
return name.toString();
} | java | protected static String toPackageName(String rootPackage, File packageName) {
final StringBuilder name = new StringBuilder();
File tmp = packageName;
while (tmp != null) {
final String elementName = tmp.getName();
if (!Strings.equal(FileSystem.CURRENT_DIRECTORY, elementName)
&& !Strings.equal(FileSystem.PARENT_DIRECTORY, elementName)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, elementName);
}
tmp = tmp.getParentFile();
}
if (!Strings.isEmpty(rootPackage)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, rootPackage);
}
return name.toString();
} | [
"protected",
"static",
"String",
"toPackageName",
"(",
"String",
"rootPackage",
",",
"File",
"packageName",
")",
"{",
"final",
"StringBuilder",
"name",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"File",
"tmp",
"=",
"packageName",
";",
"while",
"(",
"tmp",
"... | Convert a file to a package name.
@param rootPackage an additional root package.
@param packageName the file.
@return the package name. | [
"Convert",
"a",
"file",
"to",
"a",
"package",
"name",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L491-L512 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.getResourceName | public static String getResourceName(RamlResource resource, boolean singularize) {
String url = resource.getRelativeUri();
if (StringUtils.hasText(url) && url.contains("/") && (url.lastIndexOf('/') < url.length())) {
return getResourceName(url.substring(url.lastIndexOf('/') + 1), singularize);
}
return null;
} | java | public static String getResourceName(RamlResource resource, boolean singularize) {
String url = resource.getRelativeUri();
if (StringUtils.hasText(url) && url.contains("/") && (url.lastIndexOf('/') < url.length())) {
return getResourceName(url.substring(url.lastIndexOf('/') + 1), singularize);
}
return null;
} | [
"public",
"static",
"String",
"getResourceName",
"(",
"RamlResource",
"resource",
",",
"boolean",
"singularize",
")",
"{",
"String",
"url",
"=",
"resource",
".",
"getRelativeUri",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"url",
")",
"&&"... | Attempts to infer the name of a resource from a resources's relative URL
@param resource
The raml resource being parsed
@param singularize
indicates if the resource name should be singularized or not
@return A name representing this resource or null if one cannot be
inferred | [
"Attempts",
"to",
"infer",
"the",
"name",
"of",
"a",
"resource",
"from",
"a",
"resources",
"s",
"relative",
"URL"
] | train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L242-L250 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/TempFileProvider.java | TempFileProvider.createTempDir | public TempDir createTempDir(String originalName) throws IOException {
if (!open.get()) {
throw VFSMessages.MESSAGES.tempFileProviderClosed();
}
final String name = createTempName(originalName + "-", "");
final File f = new File(providerRoot, name);
for (int i = 0; i < RETRIES; i++) {
if (f.mkdirs()) {
return new TempDir(this, f);
}
}
throw VFSMessages.MESSAGES.couldNotCreateDirectory(originalName,RETRIES);
} | java | public TempDir createTempDir(String originalName) throws IOException {
if (!open.get()) {
throw VFSMessages.MESSAGES.tempFileProviderClosed();
}
final String name = createTempName(originalName + "-", "");
final File f = new File(providerRoot, name);
for (int i = 0; i < RETRIES; i++) {
if (f.mkdirs()) {
return new TempDir(this, f);
}
}
throw VFSMessages.MESSAGES.couldNotCreateDirectory(originalName,RETRIES);
} | [
"public",
"TempDir",
"createTempDir",
"(",
"String",
"originalName",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"open",
".",
"get",
"(",
")",
")",
"{",
"throw",
"VFSMessages",
".",
"MESSAGES",
".",
"tempFileProviderClosed",
"(",
")",
";",
"}",
"fin... | Create a temp directory, into which temporary files may be placed.
@param originalName the original file name
@return the temp directory
@throws IOException for any error | [
"Create",
"a",
"temp",
"directory",
"into",
"which",
"temporary",
"files",
"may",
"be",
"placed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/TempFileProvider.java#L131-L143 |
GerdHolz/TOVAL | src/de/invation/code/toval/properties/AbstractTypedProperties.java | AbstractTypedProperties.getProperty | public Object getProperty(P property) throws PropertyException{
// System.out.println("Getting property value " + property.getPropertyCharacteristics().getName());
String propertyValueAsString = props.getProperty(property.getPropertyCharacteristics().getName());
// System.out.println("Property value as string:" + propertyValueAsString);
if(propertyValueAsString == null){
if(property.getPropertyCharacteristics().isMandatory())
throw new PropertyException(property, propertyValueAsString, "No entry for mandatory property");
return null;
}
return getPropertyValueFromString(property, propertyValueAsString);
} | java | public Object getProperty(P property) throws PropertyException{
// System.out.println("Getting property value " + property.getPropertyCharacteristics().getName());
String propertyValueAsString = props.getProperty(property.getPropertyCharacteristics().getName());
// System.out.println("Property value as string:" + propertyValueAsString);
if(propertyValueAsString == null){
if(property.getPropertyCharacteristics().isMandatory())
throw new PropertyException(property, propertyValueAsString, "No entry for mandatory property");
return null;
}
return getPropertyValueFromString(property, propertyValueAsString);
} | [
"public",
"Object",
"getProperty",
"(",
"P",
"property",
")",
"throws",
"PropertyException",
"{",
"//\t\tSystem.out.println(\"Getting property value \" + property.getPropertyCharacteristics().getName());\r",
"String",
"propertyValueAsString",
"=",
"props",
".",
"getProperty",
"(",
... | Extracts the value of the given property.<br>
@param property The property whose value is requested.
@return The property value or <code>null</code> in case there is no entry for the property.
@note Note, that for mandatory properties an exception will be thrown in case no corresponding entry can be found.
@throws PropertyException in case no entry for a mandatory property can be found.
@see #getPropertyValueFromString(Enum, String) | [
"Extracts",
"the",
"value",
"of",
"the",
"given",
"property",
".",
"<br",
">"
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/properties/AbstractTypedProperties.java#L124-L134 |
voldemort/voldemort | src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java | ClientConfigUtil.compareSingleClientConfigAvro | public static Boolean compareSingleClientConfigAvro(String configAvro1, String configAvro2) {
Properties props1 = readSingleClientConfigAvro(configAvro1);
Properties props2 = readSingleClientConfigAvro(configAvro2);
if(props1.equals(props2)) {
return true;
} else {
return false;
}
} | java | public static Boolean compareSingleClientConfigAvro(String configAvro1, String configAvro2) {
Properties props1 = readSingleClientConfigAvro(configAvro1);
Properties props2 = readSingleClientConfigAvro(configAvro2);
if(props1.equals(props2)) {
return true;
} else {
return false;
}
} | [
"public",
"static",
"Boolean",
"compareSingleClientConfigAvro",
"(",
"String",
"configAvro1",
",",
"String",
"configAvro2",
")",
"{",
"Properties",
"props1",
"=",
"readSingleClientConfigAvro",
"(",
"configAvro1",
")",
";",
"Properties",
"props2",
"=",
"readSingleClientC... | Compares two avro strings which contains single store configs
@param configAvro1
@param configAvro2
@return true if two config avro strings have same content | [
"Compares",
"two",
"avro",
"strings",
"which",
"contains",
"single",
"store",
"configs"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java#L145-L153 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/RemoveSarlNatureHandler.java | RemoveSarlNatureHandler.doConvert | protected void doConvert(IProject project, IProgressMonitor monitor) throws ExecutionException {
monitor.setTaskName(MessageFormat.format(Messages.RemoveSarlNatureHandler_2, project.getName()));
final SubMonitor mon = SubMonitor.convert(monitor, 2);
if (this.configurator.canUnconfigure(project, mon.newChild(1))) {
try {
this.configurator.unconfigure(project, mon.newChild(1));
} catch (CoreException exception) {
throw new ExecutionException(exception.getLocalizedMessage(), exception);
}
}
monitor.done();
} | java | protected void doConvert(IProject project, IProgressMonitor monitor) throws ExecutionException {
monitor.setTaskName(MessageFormat.format(Messages.RemoveSarlNatureHandler_2, project.getName()));
final SubMonitor mon = SubMonitor.convert(monitor, 2);
if (this.configurator.canUnconfigure(project, mon.newChild(1))) {
try {
this.configurator.unconfigure(project, mon.newChild(1));
} catch (CoreException exception) {
throw new ExecutionException(exception.getLocalizedMessage(), exception);
}
}
monitor.done();
} | [
"protected",
"void",
"doConvert",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"ExecutionException",
"{",
"monitor",
".",
"setTaskName",
"(",
"MessageFormat",
".",
"format",
"(",
"Messages",
".",
"RemoveSarlNatureHandler_2",
",",
"p... | Convert the given project.
@param project the project to convert..
@param monitor the progress monitor.
@throws ExecutionException if something going wrong. | [
"Convert",
"the",
"given",
"project",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/RemoveSarlNatureHandler.java#L116-L127 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java | FeatureOverlayQuery.buildMapClickTableData | private FeatureTableData buildMapClickTableData(LatLng latLng, double zoom, BoundingBox boundingBox, double tolerance, Projection projection) {
FeatureTableData tableData = null;
// Verify the features are indexed and we are getting information
if (isIndexed() && (maxFeaturesInfo || featuresInfo)) {
if (isOnAtCurrentZoom(zoom, latLng)) {
// Get the number of features in the tile location
long tileFeatureCount = tileFeatureCount(latLng, zoom);
// If more than a configured max features to draw
if (isMoreThanMaxFeatures(tileFeatureCount)) {
// Build the max features message
if (maxFeaturesInfo) {
tableData = new FeatureTableData(featureTiles.getFeatureDao().getTableName(), tileFeatureCount);
}
}
// Else, query for the features near the click
else if (featuresInfo) {
// Query for results and build the message
FeatureIndexResults results = queryFeatures(boundingBox, projection);
tableData = featureInfoBuilder.buildTableDataAndClose(results, tolerance, latLng, projection);
}
}
}
return tableData;
} | java | private FeatureTableData buildMapClickTableData(LatLng latLng, double zoom, BoundingBox boundingBox, double tolerance, Projection projection) {
FeatureTableData tableData = null;
// Verify the features are indexed and we are getting information
if (isIndexed() && (maxFeaturesInfo || featuresInfo)) {
if (isOnAtCurrentZoom(zoom, latLng)) {
// Get the number of features in the tile location
long tileFeatureCount = tileFeatureCount(latLng, zoom);
// If more than a configured max features to draw
if (isMoreThanMaxFeatures(tileFeatureCount)) {
// Build the max features message
if (maxFeaturesInfo) {
tableData = new FeatureTableData(featureTiles.getFeatureDao().getTableName(), tileFeatureCount);
}
}
// Else, query for the features near the click
else if (featuresInfo) {
// Query for results and build the message
FeatureIndexResults results = queryFeatures(boundingBox, projection);
tableData = featureInfoBuilder.buildTableDataAndClose(results, tolerance, latLng, projection);
}
}
}
return tableData;
} | [
"private",
"FeatureTableData",
"buildMapClickTableData",
"(",
"LatLng",
"latLng",
",",
"double",
"zoom",
",",
"BoundingBox",
"boundingBox",
",",
"double",
"tolerance",
",",
"Projection",
"projection",
")",
"{",
"FeatureTableData",
"tableData",
"=",
"null",
";",
"// ... | Perform a query based upon the map click location and build feature table data
@param latLng location
@param zoom current zoom level
@param boundingBox click bounding box
@param tolerance distance tolerance
@param projection desired geometry projection
@return table data on what was clicked, or null | [
"Perform",
"a",
"query",
"based",
"upon",
"the",
"map",
"click",
"location",
"and",
"build",
"feature",
"table",
"data"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L536-L568 |
anotheria/moskito | moskito-extensions/moskito-notification-providers/src/main/java/net/anotheria/moskito/extensions/notificationtemplate/MailTemplateProcessor.java | MailTemplateProcessor.processingAllowed | private boolean processingAllowed(final String prefix, final String variable, final TemplateReplacementContext context) {
return (PREFIX.equals(prefix) && !StringUtils.isEmpty(variable) && context instanceof MailTemplateReplacementContext);
} | java | private boolean processingAllowed(final String prefix, final String variable, final TemplateReplacementContext context) {
return (PREFIX.equals(prefix) && !StringUtils.isEmpty(variable) && context instanceof MailTemplateReplacementContext);
} | [
"private",
"boolean",
"processingAllowed",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"variable",
",",
"final",
"TemplateReplacementContext",
"context",
")",
"{",
"return",
"(",
"PREFIX",
".",
"equals",
"(",
"prefix",
")",
"&&",
"!",
"StringUtils"... | Checks whether processing is allowed.
@param prefix variable prefix
@param context {@link TemplateReplacementContext}
@return {@code boolean} flag | [
"Checks",
"whether",
"processing",
"is",
"allowed",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-notification-providers/src/main/java/net/anotheria/moskito/extensions/notificationtemplate/MailTemplateProcessor.java#L44-L46 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java | PatternsImpl.updatePatterns | public List<PatternRuleInfo> updatePatterns(UUID appId, String versionId, List<PatternRuleUpdateObject> patterns) {
return updatePatternsWithServiceResponseAsync(appId, versionId, patterns).toBlocking().single().body();
} | java | public List<PatternRuleInfo> updatePatterns(UUID appId, String versionId, List<PatternRuleUpdateObject> patterns) {
return updatePatternsWithServiceResponseAsync(appId, versionId, patterns).toBlocking().single().body();
} | [
"public",
"List",
"<",
"PatternRuleInfo",
">",
"updatePatterns",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"List",
"<",
"PatternRuleUpdateObject",
">",
"patterns",
")",
"{",
"return",
"updatePatternsWithServiceResponseAsync",
"(",
"appId",
",",
"version... | Updates patterns.
@param appId The application ID.
@param versionId The version ID.
@param patterns An array represents the patterns.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<PatternRuleInfo> object if successful. | [
"Updates",
"patterns",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L384-L386 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java | LocalTime.plusSeconds | public LocalTime plusSeconds(long secondstoAdd) {
if (secondstoAdd == 0) {
return this;
}
int sofd = hour * SECONDS_PER_HOUR +
minute * SECONDS_PER_MINUTE + second;
int newSofd = ((int) (secondstoAdd % SECONDS_PER_DAY) + sofd + SECONDS_PER_DAY) % SECONDS_PER_DAY;
if (sofd == newSofd) {
return this;
}
int newHour = newSofd / SECONDS_PER_HOUR;
int newMinute = (newSofd / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
int newSecond = newSofd % SECONDS_PER_MINUTE;
return create(newHour, newMinute, newSecond, nano);
} | java | public LocalTime plusSeconds(long secondstoAdd) {
if (secondstoAdd == 0) {
return this;
}
int sofd = hour * SECONDS_PER_HOUR +
minute * SECONDS_PER_MINUTE + second;
int newSofd = ((int) (secondstoAdd % SECONDS_PER_DAY) + sofd + SECONDS_PER_DAY) % SECONDS_PER_DAY;
if (sofd == newSofd) {
return this;
}
int newHour = newSofd / SECONDS_PER_HOUR;
int newMinute = (newSofd / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
int newSecond = newSofd % SECONDS_PER_MINUTE;
return create(newHour, newMinute, newSecond, nano);
} | [
"public",
"LocalTime",
"plusSeconds",
"(",
"long",
"secondstoAdd",
")",
"{",
"if",
"(",
"secondstoAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"int",
"sofd",
"=",
"hour",
"*",
"SECONDS_PER_HOUR",
"+",
"minute",
"*",
"SECONDS_PER_MINUTE",
"+",
"se... | Returns a copy of this {@code LocalTime} with the specified number of seconds added.
<p>
This adds the specified number of seconds to this time, returning a new time.
The calculation wraps around midnight.
<p>
This instance is immutable and unaffected by this method call.
@param secondstoAdd the seconds to add, may be negative
@return a {@code LocalTime} based on this time with the seconds added, not null | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"seconds",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"specified",
"number",
"of",
"seconds",
"to",
"this",
"time",
"returning",
"a",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L1110-L1124 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.isOneLabelBetterThanOther | private static boolean isOneLabelBetterThanOther(Normalizer2 nfkdNormalizer, String one, String other) {
// This is called with primary-equal strings, but never with one.equals(other).
String n1 = nfkdNormalizer.normalize(one);
String n2 = nfkdNormalizer.normalize(other);
int result = n1.codePointCount(0, n1.length()) - n2.codePointCount(0, n2.length());
if (result != 0) {
return result < 0;
}
result = binaryCmp.compare(n1, n2);
if (result != 0) {
return result < 0;
}
return binaryCmp.compare(one, other) < 0;
} | java | private static boolean isOneLabelBetterThanOther(Normalizer2 nfkdNormalizer, String one, String other) {
// This is called with primary-equal strings, but never with one.equals(other).
String n1 = nfkdNormalizer.normalize(one);
String n2 = nfkdNormalizer.normalize(other);
int result = n1.codePointCount(0, n1.length()) - n2.codePointCount(0, n2.length());
if (result != 0) {
return result < 0;
}
result = binaryCmp.compare(n1, n2);
if (result != 0) {
return result < 0;
}
return binaryCmp.compare(one, other) < 0;
} | [
"private",
"static",
"boolean",
"isOneLabelBetterThanOther",
"(",
"Normalizer2",
"nfkdNormalizer",
",",
"String",
"one",
",",
"String",
"other",
")",
"{",
"// This is called with primary-equal strings, but never with one.equals(other).",
"String",
"n1",
"=",
"nfkdNormalizer",
... | Returns true if one index character string is "better" than the other.
Shorter NFKD is better, and otherwise NFKD-binary-less-than is
better, and otherwise binary-less-than is better. | [
"Returns",
"true",
"if",
"one",
"index",
"character",
"string",
"is",
"better",
"than",
"the",
"other",
".",
"Shorter",
"NFKD",
"is",
"better",
"and",
"otherwise",
"NFKD",
"-",
"binary",
"-",
"less",
"-",
"than",
"is",
"better",
"and",
"otherwise",
"binary... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L799-L812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.