repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getAngleInTriangle | public static double getAngleInTriangle( double a, double b, double c ) {
double angle = Math.acos((a * a + b * b - c * c) / (2.0 * a * b));
return angle;
} | java | public static double getAngleInTriangle( double a, double b, double c ) {
double angle = Math.acos((a * a + b * b - c * c) / (2.0 * a * b));
return angle;
} | [
"public",
"static",
"double",
"getAngleInTriangle",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
")",
"{",
"double",
"angle",
"=",
"Math",
".",
"acos",
"(",
"(",
"a",
"*",
"a",
"+",
"b",
"*",
"b",
"-",
"c",
"*",
"c",
")",
"/",
"(... | Uses the cosine rule to find an angle in radiants of a triangle defined by the length of its sides.
<p>The calculated angle is the one between the two adjacent sides a and b.</p>
@param a adjacent side 1 length.
@param b adjacent side 2 length.
@param c opposite side length.
@return the angle in radiants. | [
"Uses",
"the",
"cosine",
"rule",
"to",
"find",
"an",
"angle",
"in",
"radiants",
"of",
"a",
"triangle",
"defined",
"by",
"the",
"length",
"of",
"its",
"sides",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L837-L840 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.serialInclude | public static boolean serialInclude(Utils utils, Element element) {
if (element == null) {
return false;
}
return utils.isClass(element)
? serialClassInclude(utils, (TypeElement)element)
: serialDocInclude(utils, element);
} | java | public static boolean serialInclude(Utils utils, Element element) {
if (element == null) {
return false;
}
return utils.isClass(element)
? serialClassInclude(utils, (TypeElement)element)
: serialDocInclude(utils, element);
} | [
"public",
"static",
"boolean",
"serialInclude",
"(",
"Utils",
"utils",
",",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"utils",
".",
"isClass",
"(",
"element",
")",
"?",
"serialCla... | Returns true if the given Element should be included
in the serialized form.
@param utils the utils object
@param element the Element object to check for serializability
@return true if the element should be included in the serial form | [
"Returns",
"true",
"if",
"the",
"given",
"Element",
"should",
"be",
"included",
"in",
"the",
"serialized",
"form",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L555-L562 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.createAsync | public Observable<ApplicationInsightsComponentAPIKeyInner> createAsync(String resourceGroupName, String resourceName, APIKeyRequest aPIKeyProperties) {
return createWithServiceResponseAsync(resourceGroupName, resourceName, aPIKeyProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentAPIKeyInner> createAsync(String resourceGroupName, String resourceName, APIKeyRequest aPIKeyProperties) {
return createWithServiceResponseAsync(resourceGroupName, resourceName, aPIKeyProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"APIKeyRequest",
"aPIKeyProperties",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupNa... | Create an API Key of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param aPIKeyProperties Properties that need to be specified to create an API key of a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentAPIKeyInner object | [
"Create",
"an",
"API",
"Key",
"of",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L207-L214 |
rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.usesField | public boolean usesField(String className, String fieldName) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int fieldNameIndex = findUtf8(fieldName);
if (fieldNameIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FIELD && readValue(offsets[i]) == classIndex) {
int nameAndTypeIndex = readValue(offsets[i] + 2);
if (readValue(offsets[nameAndTypeIndex]) == fieldNameIndex) return true;
}
}
return false;
} | java | public boolean usesField(String className, String fieldName) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int fieldNameIndex = findUtf8(fieldName);
if (fieldNameIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FIELD && readValue(offsets[i]) == classIndex) {
int nameAndTypeIndex = readValue(offsets[i] + 2);
if (readValue(offsets[nameAndTypeIndex]) == fieldNameIndex) return true;
}
}
return false;
} | [
"public",
"boolean",
"usesField",
"(",
"String",
"className",
",",
"String",
"fieldName",
")",
"{",
"int",
"classIndex",
"=",
"findClass",
"(",
"className",
")",
";",
"if",
"(",
"classIndex",
"==",
"NOT_FOUND",
")",
"return",
"false",
";",
"int",
"fieldNameI... | Checks if the constant pool contains a reference to a given field, either for writing or reading.
@param className must be provided JVM-style, such as {@code java/lang/String} | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"a",
"reference",
"to",
"a",
"given",
"field",
"either",
"for",
"writing",
"or",
"reading",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L164-L177 |
apptik/jus | benchmark/src/perf/java/com/android/volley/VolleyLog.java | VolleyLog.buildMessage | private static String buildMessage(String format, Object... args) {
String msg = (args == null) ? format : String.format(Locale.US, format, args);
StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();
String caller = "<unknown>";
// Walk up the stack looking for the first caller outside of VolleyLog.
// It will be at least two frames up, so start there.
for (int i = 2; i < trace.length; i++) {
Class<?> clazz = trace[i].getClass();
if (!clazz.equals(VolleyLog.class)) {
String callingClass = trace[i].getClassName();
callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1);
callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1);
caller = callingClass + "." + trace[i].getMethodName();
break;
}
}
return String.format(Locale.US, "[%d] %s: %s",
Thread.currentThread().getId(), caller, msg);
} | java | private static String buildMessage(String format, Object... args) {
String msg = (args == null) ? format : String.format(Locale.US, format, args);
StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();
String caller = "<unknown>";
// Walk up the stack looking for the first caller outside of VolleyLog.
// It will be at least two frames up, so start there.
for (int i = 2; i < trace.length; i++) {
Class<?> clazz = trace[i].getClass();
if (!clazz.equals(VolleyLog.class)) {
String callingClass = trace[i].getClassName();
callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1);
callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1);
caller = callingClass + "." + trace[i].getMethodName();
break;
}
}
return String.format(Locale.US, "[%d] %s: %s",
Thread.currentThread().getId(), caller, msg);
} | [
"private",
"static",
"String",
"buildMessage",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"msg",
"=",
"(",
"args",
"==",
"null",
")",
"?",
"format",
":",
"String",
".",
"format",
"(",
"Locale",
".",
"US",
",",
"format",
... | Formats the caller's provided message and prepends useful info like
calling thread ID and method name. | [
"Formats",
"the",
"caller",
"s",
"provided",
"message",
"and",
"prepends",
"useful",
"info",
"like",
"calling",
"thread",
"ID",
"and",
"method",
"name",
"."
] | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/VolleyLog.java#L80-L100 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.writeTokenLength | private static void writeTokenLength(ByteArrayOutputStream baos, int tokenLength) {
if (tokenLength < 128) {
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 8)) {
baos.write((byte) 0x081);
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 16)) {
baos.write((byte) 0x082);
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 24)) {
baos.write((byte) 0x083);
baos.write((byte) (tokenLength >> 16));
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
} else {
baos.write((byte) 0x084);
baos.write((byte) (tokenLength >> 24));
baos.write((byte) (tokenLength >> 16));
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
}
} | java | private static void writeTokenLength(ByteArrayOutputStream baos, int tokenLength) {
if (tokenLength < 128) {
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 8)) {
baos.write((byte) 0x081);
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 16)) {
baos.write((byte) 0x082);
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
} else if (tokenLength < (1 << 24)) {
baos.write((byte) 0x083);
baos.write((byte) (tokenLength >> 16));
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
} else {
baos.write((byte) 0x084);
baos.write((byte) (tokenLength >> 24));
baos.write((byte) (tokenLength >> 16));
baos.write((byte) (tokenLength >> 8));
baos.write((byte) tokenLength);
}
} | [
"private",
"static",
"void",
"writeTokenLength",
"(",
"ByteArrayOutputStream",
"baos",
",",
"int",
"tokenLength",
")",
"{",
"if",
"(",
"tokenLength",
"<",
"128",
")",
"{",
"baos",
".",
"write",
"(",
"(",
"byte",
")",
"tokenLength",
")",
";",
"}",
"else",
... | /*
Write the token length in the same way as in tWAS to ensure compatibility. | [
"/",
"*",
"Write",
"the",
"token",
"length",
"in",
"the",
"same",
"way",
"as",
"in",
"tWAS",
"to",
"ensure",
"compatibility",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L471-L493 |
agmip/agmip-common-functions | src/main/java/org/agmip/common/Functions.java | Functions.formatAgmipDateString | public synchronized static String formatAgmipDateString(String agmipDate, String format) {
try {
SimpleDateFormat fmt = new SimpleDateFormat(format);
Date d = dateFormatter.parse(agmipDate);
return fmt.format(d);
} catch (Exception ex) {
return null;
}
} | java | public synchronized static String formatAgmipDateString(String agmipDate, String format) {
try {
SimpleDateFormat fmt = new SimpleDateFormat(format);
Date d = dateFormatter.parse(agmipDate);
return fmt.format(d);
} catch (Exception ex) {
return null;
}
} | [
"public",
"synchronized",
"static",
"String",
"formatAgmipDateString",
"(",
"String",
"agmipDate",
",",
"String",
"format",
")",
"{",
"try",
"{",
"SimpleDateFormat",
"fmt",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
")",
";",
"Date",
"d",
"=",
"dateFormatter... | Convert from AgMIP standard date string (YYMMDD) to a custom date string
@param agmipDate AgMIP standard date string
@param format Destination format
@return a formatted date string or {@code null} | [
"Convert",
"from",
"AgMIP",
"standard",
"date",
"string",
"(",
"YYMMDD",
")",
"to",
"a",
"custom",
"date",
"string"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/common/Functions.java#L118-L126 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.withIndex | public static <E> Iterator<Tuple2<E, Integer>> withIndex(Iterator<E> self) {
return withIndex(self, 0);
} | java | public static <E> Iterator<Tuple2<E, Integer>> withIndex(Iterator<E> self) {
return withIndex(self, 0);
} | [
"public",
"static",
"<",
"E",
">",
"Iterator",
"<",
"Tuple2",
"<",
"E",
",",
"Integer",
">",
">",
"withIndex",
"(",
"Iterator",
"<",
"E",
">",
"self",
")",
"{",
"return",
"withIndex",
"(",
"self",
",",
"0",
")",
";",
"}"
] | Zips an iterator with indices in (value, index) order.
<p/>
Example usage:
<pre class="groovyTestCase">
assert [["a", 0], ["b", 1]] == ["a", "b"].iterator().withIndex().toList()
assert ["0: a", "1: b"] == ["a", "b"].iterator().withIndex().collect { str, idx {@code ->} "$idx: $str" }.toList()
</pre>
@param self an iterator
@return a zipped iterator with indices
@see #indexed(Iterator)
@since 2.4.0 | [
"Zips",
"an",
"iterator",
"with",
"indices",
"in",
"(",
"value",
"index",
")",
"order",
".",
"<p",
"/",
">",
"Example",
"usage",
":",
"<pre",
"class",
"=",
"groovyTestCase",
">",
"assert",
"[[",
"a",
"0",
"]",
"[",
"b",
"1",
"]]",
"==",
"[",
"a",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8819-L8821 |
google/closure-compiler | src/com/google/debugging/sourcemap/SourceMapGeneratorV3.java | SourceMapGeneratorV3.mergeMapSection | public void mergeMapSection(int line, int column, String mapSectionContents)
throws SourceMapParseException {
setStartingPosition(line, column);
SourceMapConsumerV3 section = new SourceMapConsumerV3();
section.parse(mapSectionContents);
section.visitMappings(new ConsumerEntryVisitor());
} | java | public void mergeMapSection(int line, int column, String mapSectionContents)
throws SourceMapParseException {
setStartingPosition(line, column);
SourceMapConsumerV3 section = new SourceMapConsumerV3();
section.parse(mapSectionContents);
section.visitMappings(new ConsumerEntryVisitor());
} | [
"public",
"void",
"mergeMapSection",
"(",
"int",
"line",
",",
"int",
"column",
",",
"String",
"mapSectionContents",
")",
"throws",
"SourceMapParseException",
"{",
"setStartingPosition",
"(",
"line",
",",
"column",
")",
";",
"SourceMapConsumerV3",
"section",
"=",
"... | Merges current mapping with {@code mapSectionContents} considering the
offset {@code (line, column)}. Any extension in the map section will be
ignored.
@param line The line offset
@param column The column offset
@param mapSectionContents The map section to be appended
@throws SourceMapParseException | [
"Merges",
"current",
"mapping",
"with",
"{",
"@code",
"mapSectionContents",
"}",
"considering",
"the",
"offset",
"{",
"@code",
"(",
"line",
"column",
")",
"}",
".",
"Any",
"extension",
"in",
"the",
"map",
"section",
"will",
"be",
"ignored",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/debugging/sourcemap/SourceMapGeneratorV3.java#L298-L304 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java | GoogleCloudStorageFileSystem.deleteInternal | private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete)
throws IOException {
// TODO(user): We might need to separate out children into separate batches from parents to
// avoid deleting a parent before somehow failing to delete a child.
// Delete children before their parents.
//
// Note: we modify the input list, which is ok for current usage.
// We should make a copy in case that changes in future.
itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed());
if (!itemsToDelete.isEmpty()) {
List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size());
for (FileInfo fileInfo : itemsToDelete) {
// TODO(b/110833109): populate generation ID in StorageResourceId when listing infos?
objectsToDelete.add(
new StorageResourceId(
fileInfo.getItemInfo().getBucketName(),
fileInfo.getItemInfo().getObjectName(),
fileInfo.getItemInfo().getContentGeneration()));
}
gcs.deleteObjects(objectsToDelete);
}
if (!bucketsToDelete.isEmpty()) {
List<String> bucketNames = new ArrayList<>(bucketsToDelete.size());
for (FileInfo bucketInfo : bucketsToDelete) {
StorageResourceId resourceId = bucketInfo.getItemInfo().getResourceId();
gcs.waitForBucketEmpty(resourceId.getBucketName());
bucketNames.add(resourceId.getBucketName());
}
if (options.enableBucketDelete()) {
gcs.deleteBuckets(bucketNames);
} else {
logger.atInfo().log(
"Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames);
}
}
} | java | private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete)
throws IOException {
// TODO(user): We might need to separate out children into separate batches from parents to
// avoid deleting a parent before somehow failing to delete a child.
// Delete children before their parents.
//
// Note: we modify the input list, which is ok for current usage.
// We should make a copy in case that changes in future.
itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed());
if (!itemsToDelete.isEmpty()) {
List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size());
for (FileInfo fileInfo : itemsToDelete) {
// TODO(b/110833109): populate generation ID in StorageResourceId when listing infos?
objectsToDelete.add(
new StorageResourceId(
fileInfo.getItemInfo().getBucketName(),
fileInfo.getItemInfo().getObjectName(),
fileInfo.getItemInfo().getContentGeneration()));
}
gcs.deleteObjects(objectsToDelete);
}
if (!bucketsToDelete.isEmpty()) {
List<String> bucketNames = new ArrayList<>(bucketsToDelete.size());
for (FileInfo bucketInfo : bucketsToDelete) {
StorageResourceId resourceId = bucketInfo.getItemInfo().getResourceId();
gcs.waitForBucketEmpty(resourceId.getBucketName());
bucketNames.add(resourceId.getBucketName());
}
if (options.enableBucketDelete()) {
gcs.deleteBuckets(bucketNames);
} else {
logger.atInfo().log(
"Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames);
}
}
} | [
"private",
"void",
"deleteInternal",
"(",
"List",
"<",
"FileInfo",
">",
"itemsToDelete",
",",
"List",
"<",
"FileInfo",
">",
"bucketsToDelete",
")",
"throws",
"IOException",
"{",
"// TODO(user): We might need to separate out children into separate batches from parents to",
"//... | Deletes all items in the given path list followed by all bucket items. | [
"Deletes",
"all",
"items",
"in",
"the",
"given",
"path",
"list",
"followed",
"by",
"all",
"bucket",
"items",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L416-L454 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java | TransTypes.retype | JCExpression retype(JCExpression tree, Type erasedType, Type target) {
// System.err.println("retype " + tree + " to " + erasedType);//DEBUG
if (!erasedType.isPrimitive()) {
if (target != null && target.isPrimitive()) {
target = erasure(tree.type);
}
tree.type = erasedType;
if (target != null) {
return coerce(tree, target);
}
}
return tree;
} | java | JCExpression retype(JCExpression tree, Type erasedType, Type target) {
// System.err.println("retype " + tree + " to " + erasedType);//DEBUG
if (!erasedType.isPrimitive()) {
if (target != null && target.isPrimitive()) {
target = erasure(tree.type);
}
tree.type = erasedType;
if (target != null) {
return coerce(tree, target);
}
}
return tree;
} | [
"JCExpression",
"retype",
"(",
"JCExpression",
"tree",
",",
"Type",
"erasedType",
",",
"Type",
"target",
")",
"{",
"// System.err.println(\"retype \" + tree + \" to \" + erasedType);//DEBUG",
"if",
"(",
"!",
"erasedType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"... | Given an erased reference type, assume this type as the tree's type.
Then, coerce to some given target type unless target type is null.
This operation is used in situations like the following:
<pre>{@code
class Cell<A> { A value; }
...
Cell<Integer> cell;
Integer x = cell.value;
}</pre>
Since the erasure of Cell.value is Object, but the type
of cell.value in the assignment is Integer, we need to
adjust the original type of cell.value to Object, and insert
a cast to Integer. That is, the last assignment becomes:
<pre>{@code
Integer x = (Integer)cell.value;
}</pre>
@param tree The expression tree whose type might need adjustment.
@param erasedType The expression's type after erasure.
@param target The target type, which is usually the erasure of the
expression's original type. | [
"Given",
"an",
"erased",
"reference",
"type",
"assume",
"this",
"type",
"as",
"the",
"tree",
"s",
"type",
".",
"Then",
"coerce",
"to",
"some",
"given",
"target",
"type",
"unless",
"target",
"type",
"is",
"null",
".",
"This",
"operation",
"is",
"used",
"i... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L175-L187 |
fedups/com.obdobion.algebrain | src/main/java/com/obdobion/algebrain/Function.java | Function.updateParameterCount | public void updateParameterCount(final EquPart[] equParts, final int myLocInArray)
{
setParameterCount(0);
for (int p = myLocInArray + 1; p < equParts.length; p++)
{
final EquPart part = equParts[p];
if (part.getLevel() <= getLevel())
break;
if ((part.getLevel() == (getLevel() + 1)) && part instanceof OpComma)
setParameterCount(getParameterCount() + 1);
}
if (getParameterCount() > 0)
setParameterCount(getParameterCount() + 1);
} | java | public void updateParameterCount(final EquPart[] equParts, final int myLocInArray)
{
setParameterCount(0);
for (int p = myLocInArray + 1; p < equParts.length; p++)
{
final EquPart part = equParts[p];
if (part.getLevel() <= getLevel())
break;
if ((part.getLevel() == (getLevel() + 1)) && part instanceof OpComma)
setParameterCount(getParameterCount() + 1);
}
if (getParameterCount() > 0)
setParameterCount(getParameterCount() + 1);
} | [
"public",
"void",
"updateParameterCount",
"(",
"final",
"EquPart",
"[",
"]",
"equParts",
",",
"final",
"int",
"myLocInArray",
")",
"{",
"setParameterCount",
"(",
"0",
")",
";",
"for",
"(",
"int",
"p",
"=",
"myLocInArray",
"+",
"1",
";",
"p",
"<",
"equPar... | <p>
updateParameterCount.
</p>
@param equParts an array of {@link com.obdobion.algebrain.EquPart}
objects.
@param myLocInArray a int. | [
"<p",
">",
"updateParameterCount",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/fedups/com.obdobion.algebrain/blob/d0adaa9fbbba907bdcf820961e9058b0d2b15a8a/src/main/java/com/obdobion/algebrain/Function.java#L80-L97 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java | ApiOvhVps.serviceName_tasks_GET | public ArrayList<Long> serviceName_tasks_GET(String serviceName, OvhTaskStateEnum state, OvhTaskTypeEnum type) throws IOException {
String qPath = "/vps/{serviceName}/tasks";
StringBuilder sb = path(qPath, serviceName);
query(sb, "state", state);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<Long> serviceName_tasks_GET(String serviceName, OvhTaskStateEnum state, OvhTaskTypeEnum type) throws IOException {
String qPath = "/vps/{serviceName}/tasks";
StringBuilder sb = path(qPath, serviceName);
query(sb, "state", state);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_tasks_GET",
"(",
"String",
"serviceName",
",",
"OvhTaskStateEnum",
"state",
",",
"OvhTaskTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vps/{serviceName}/tasks\"",
";",
"StringBui... | Tasks associated to this virtual server
REST: GET /vps/{serviceName}/tasks
@param type [required] Filter the value of type property (=)
@param state [required] Filter the value of state property (=)
@param serviceName [required] The internal name of your VPS offer | [
"Tasks",
"associated",
"to",
"this",
"virtual",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L388-L395 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/ContentCodingType.java | ContentCodingType.parseCodingType | public static ContentCodingType parseCodingType(String codingType) {
Assert.hasLength(codingType, "'codingType' must not be empty");
String[] parts = StringUtils.tokenizeToStringArray(codingType, ";");
String type = parts[0].trim();
Map<String, String> parameters = null;
if (parts.length > 1) {
parameters = new LinkedHashMap<String, String>(parts.length - 1);
for (int i = 1; i < parts.length; i++) {
String parameter = parts[i];
int eqIndex = parameter.indexOf('=');
if (eqIndex != -1) {
String attribute = parameter.substring(0, eqIndex);
String value = parameter.substring(eqIndex + 1, parameter.length());
parameters.put(attribute, value);
}
}
}
return new ContentCodingType(type, parameters);
} | java | public static ContentCodingType parseCodingType(String codingType) {
Assert.hasLength(codingType, "'codingType' must not be empty");
String[] parts = StringUtils.tokenizeToStringArray(codingType, ";");
String type = parts[0].trim();
Map<String, String> parameters = null;
if (parts.length > 1) {
parameters = new LinkedHashMap<String, String>(parts.length - 1);
for (int i = 1; i < parts.length; i++) {
String parameter = parts[i];
int eqIndex = parameter.indexOf('=');
if (eqIndex != -1) {
String attribute = parameter.substring(0, eqIndex);
String value = parameter.substring(eqIndex + 1, parameter.length());
parameters.put(attribute, value);
}
}
}
return new ContentCodingType(type, parameters);
} | [
"public",
"static",
"ContentCodingType",
"parseCodingType",
"(",
"String",
"codingType",
")",
"{",
"Assert",
".",
"hasLength",
"(",
"codingType",
",",
"\"'codingType' must not be empty\"",
")",
";",
"String",
"[",
"]",
"parts",
"=",
"StringUtils",
".",
"tokenizeToSt... | Parse the given String into a single {@code ContentCodingType}.
@param codingType the string to parse
@return the content coding type
@throws IllegalArgumentException if the string cannot be parsed | [
"Parse",
"the",
"given",
"String",
"into",
"a",
"single",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/ContentCodingType.java#L373-L393 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountUserRelPersistenceImpl.java | CommerceAccountUserRelPersistenceImpl.findByCommerceAccountId | @Override
public List<CommerceAccountUserRel> findByCommerceAccountId(
long commerceAccountId, int start, int end) {
return findByCommerceAccountId(commerceAccountId, start, end, null);
} | java | @Override
public List<CommerceAccountUserRel> findByCommerceAccountId(
long commerceAccountId, int start, int end) {
return findByCommerceAccountId(commerceAccountId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAccountUserRel",
">",
"findByCommerceAccountId",
"(",
"long",
"commerceAccountId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceAccountId",
"(",
"commerceAccountId",
",",
"start",
",",
... | Returns a range of all the commerce account user rels where commerceAccountId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountUserRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceAccountId the commerce account ID
@param start the lower bound of the range of commerce account user rels
@param end the upper bound of the range of commerce account user rels (not inclusive)
@return the range of matching commerce account user rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"account",
"user",
"rels",
"where",
"commerceAccountId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountUserRelPersistenceImpl.java#L142-L146 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java | LibertyCustomizeBindingOutInterceptor.buildQName | public static QName buildQName(String namespace, String localName)
{
String namespaceURI = namespace;
if (!isEmpty(namespace) && !namespace.trim().endsWith("/"))
{
namespaceURI += "/";
}
return new QName(namespaceURI, localName);
} | java | public static QName buildQName(String namespace, String localName)
{
String namespaceURI = namespace;
if (!isEmpty(namespace) && !namespace.trim().endsWith("/"))
{
namespaceURI += "/";
}
return new QName(namespaceURI, localName);
} | [
"public",
"static",
"QName",
"buildQName",
"(",
"String",
"namespace",
",",
"String",
"localName",
")",
"{",
"String",
"namespaceURI",
"=",
"namespace",
";",
"if",
"(",
"!",
"isEmpty",
"(",
"namespace",
")",
"&&",
"!",
"namespace",
".",
"trim",
"(",
")",
... | build the qname with the given, and make sure the namespace is ended with "/" if specified.
@param portNameSpace
@param portLocalName
@return | [
"build",
"the",
"qname",
"with",
"the",
"given",
"and",
"make",
"sure",
"the",
"namespace",
"is",
"ended",
"with",
"/",
"if",
"specified",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/LibertyCustomizeBindingOutInterceptor.java#L124-L133 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isCurrentTimeBetweenTowTimes | public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) {
JKTimeObject currntTime = getCurrntTime();
JKTimeObject fromTimeObject = new JKTimeObject();
JKTimeObject toTimeObject = new JKTimeObject();
if (currntTime.after(fromTimeObject.toTimeObject(fromDate, fromTime)) && currntTime.before(toTimeObject.toTimeObject(toDate, timeTo))) {
return true;
}
return false;
} | java | public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) {
JKTimeObject currntTime = getCurrntTime();
JKTimeObject fromTimeObject = new JKTimeObject();
JKTimeObject toTimeObject = new JKTimeObject();
if (currntTime.after(fromTimeObject.toTimeObject(fromDate, fromTime)) && currntTime.before(toTimeObject.toTimeObject(toDate, timeTo))) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isCurrentTimeBetweenTowTimes",
"(",
"Date",
"fromDate",
",",
"Date",
"fromTime",
",",
"Date",
"toDate",
",",
"Date",
"timeTo",
")",
"{",
"JKTimeObject",
"currntTime",
"=",
"getCurrntTime",
"(",
")",
";",
"JKTimeObject",
"fromTimeObj... | Checks if is current time between tow times.
@param fromDate the from date
@param fromTime the from time
@param toDate the to date
@param timeTo the time to
@return true, if is current time between tow times | [
"Checks",
"if",
"is",
"current",
"time",
"between",
"tow",
"times",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L394-L402 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java | GerritHandler.shutdown | public void shutdown(boolean join) {
ThreadPoolExecutor pool = executor;
executor = null;
pool.shutdown(); // Disable new tasks from being submitted
if (join) {
try {
// Wait a while for existing tasks to terminate
if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
pool.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
logger.error("Pool did not terminate");
}
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
} | java | public void shutdown(boolean join) {
ThreadPoolExecutor pool = executor;
executor = null;
pool.shutdown(); // Disable new tasks from being submitted
if (join) {
try {
// Wait a while for existing tasks to terminate
if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
pool.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
logger.error("Pool did not terminate");
}
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
} | [
"public",
"void",
"shutdown",
"(",
"boolean",
"join",
")",
"{",
"ThreadPoolExecutor",
"pool",
"=",
"executor",
";",
"executor",
"=",
"null",
";",
"pool",
".",
"shutdown",
"(",
")",
";",
"// Disable new tasks from being submitted",
"if",
"(",
"join",
")",
"{",
... | Closes the handler.
@param join if the method should wait for the thread to finish before returning. | [
"Closes",
"the",
"handler",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L547-L568 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java | MurmurHash3Adaptor.hashToLongs | public static long[] hashToLongs(final double datum, final long seed) {
final double d = (datum == 0.0) ? 0.0 : datum; //canonicalize -0.0, 0.0
final long[] data = { Double.doubleToLongBits(d) };//canonicalize all NaN forms
return hash(data, seed);
} | java | public static long[] hashToLongs(final double datum, final long seed) {
final double d = (datum == 0.0) ? 0.0 : datum; //canonicalize -0.0, 0.0
final long[] data = { Double.doubleToLongBits(d) };//canonicalize all NaN forms
return hash(data, seed);
} | [
"public",
"static",
"long",
"[",
"]",
"hashToLongs",
"(",
"final",
"double",
"datum",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"double",
"d",
"=",
"(",
"datum",
"==",
"0.0",
")",
"?",
"0.0",
":",
"datum",
";",
"//canonicalize -0.0, 0.0",
"final",... | Hash a double and long seed.
@param datum the input double.
@param seed A long valued seed.
@return The 128-bit hash as a long[2]. | [
"Hash",
"a",
"double",
"and",
"long",
"seed",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L208-L212 |
borball/weixin-sdk | weixin-mp/src/main/java/com/riversoft/weixin/mp/care/Sessions.java | Sessions.create | public void create(String care, String openId, String text) {
String url = WxEndpoint.get("url.care.session.create");
Map<String, String> request = new HashMap<>();
request.put("kf_account", care);
request.put("openid", openId);
if(!(text == null || "".equals(text))) {
request.put("text", text);
}
String json = JsonMapper.nonEmptyMapper().toJson(request);
logger.debug("create session: {}", json);
wxClient.post(url, json);
} | java | public void create(String care, String openId, String text) {
String url = WxEndpoint.get("url.care.session.create");
Map<String, String> request = new HashMap<>();
request.put("kf_account", care);
request.put("openid", openId);
if(!(text == null || "".equals(text))) {
request.put("text", text);
}
String json = JsonMapper.nonEmptyMapper().toJson(request);
logger.debug("create session: {}", json);
wxClient.post(url, json);
} | [
"public",
"void",
"create",
"(",
"String",
"care",
",",
"String",
"openId",
",",
"String",
"text",
")",
"{",
"String",
"url",
"=",
"WxEndpoint",
".",
"get",
"(",
"\"url.care.session.create\"",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"request",
... | 创建回话
@param care 客服账号
@param openId openid
@param text 消息 | [
"创建回话"
] | train | https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-mp/src/main/java/com/riversoft/weixin/mp/care/Sessions.java#L51-L63 |
fabric8io/fabric8-forge | addons/camel-tooling-util/src/main/java/io/fabric8/camel/tooling/util/RouteXml.java | RouteXml.marshal | public void marshal(File file, final List<RouteDefinition> routeDefinitionList) throws Exception {
marshal(file, new Model2Model() {
@Override
public XmlModel transform(XmlModel model) {
copyRoutesToElement(routeDefinitionList, model.getContextElement());
return model;
}
});
} | java | public void marshal(File file, final List<RouteDefinition> routeDefinitionList) throws Exception {
marshal(file, new Model2Model() {
@Override
public XmlModel transform(XmlModel model) {
copyRoutesToElement(routeDefinitionList, model.getContextElement());
return model;
}
});
} | [
"public",
"void",
"marshal",
"(",
"File",
"file",
",",
"final",
"List",
"<",
"RouteDefinition",
">",
"routeDefinitionList",
")",
"throws",
"Exception",
"{",
"marshal",
"(",
"file",
",",
"new",
"Model2Model",
"(",
")",
"{",
"@",
"Override",
"public",
"XmlMode... | Loads the given file then updates the route definitions from the given list then stores the file again | [
"Loads",
"the",
"given",
"file",
"then",
"updates",
"the",
"route",
"definitions",
"from",
"the",
"given",
"list",
"then",
"stores",
"the",
"file",
"again"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel-tooling-util/src/main/java/io/fabric8/camel/tooling/util/RouteXml.java#L318-L326 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/parser/properties/RtfProperty.java | RtfProperty.setProperty | private boolean setProperty(String propertyName, int propertyValueNew) {
if(propertyName == null) return false;
Object propertyValueOld = getProperty(propertyName);
if(propertyValueOld instanceof Integer) {
int valueOld = ((Integer)propertyValueOld).intValue();
if (valueOld==propertyValueNew) return true;
}
beforeChange(propertyName);
properties.put(propertyName, Integer.valueOf(propertyValueNew));
afterChange(propertyName);
setModified(propertyName, true);
return true;
} | java | private boolean setProperty(String propertyName, int propertyValueNew) {
if(propertyName == null) return false;
Object propertyValueOld = getProperty(propertyName);
if(propertyValueOld instanceof Integer) {
int valueOld = ((Integer)propertyValueOld).intValue();
if (valueOld==propertyValueNew) return true;
}
beforeChange(propertyName);
properties.put(propertyName, Integer.valueOf(propertyValueNew));
afterChange(propertyName);
setModified(propertyName, true);
return true;
} | [
"private",
"boolean",
"setProperty",
"(",
"String",
"propertyName",
",",
"int",
"propertyValueNew",
")",
"{",
"if",
"(",
"propertyName",
"==",
"null",
")",
"return",
"false",
";",
"Object",
"propertyValueOld",
"=",
"getProperty",
"(",
"propertyName",
")",
";",
... | Set the value of the property identified by the parameter.
@param propertyName The property name to set
@param propertyValueNew The object to set the property value to
@return <code>true</code> for handled or <code>false</code> if <code>propertyName</code> is <code>null</code> | [
"Set",
"the",
"value",
"of",
"the",
"property",
"identified",
"by",
"the",
"parameter",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/properties/RtfProperty.java#L329-L341 |
softindex/datakernel | core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java | ByteBuf.isContentEqual | @Contract(pure = true)
public boolean isContentEqual(@NotNull byte[] array, int offset, int length) {
return Utils.arraysEquals(this.array, head, readRemaining(), array, offset, length);
} | java | @Contract(pure = true)
public boolean isContentEqual(@NotNull byte[] array, int offset, int length) {
return Utils.arraysEquals(this.array, head, readRemaining(), array, offset, length);
} | [
"@",
"Contract",
"(",
"pure",
"=",
"true",
")",
"public",
"boolean",
"isContentEqual",
"(",
"@",
"NotNull",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"Utils",
".",
"arraysEquals",
"(",
"this",
".",
"arra... | Checks if provided array is equal to the readable bytes of the {@link #array}.
@param array byte array to be compared with the {@link #array}
@param offset offset value for the provided byte array
@param length amount of the bytes to be compared
@return {@code true} if the byte array is equal to the array, otherwise {@code false} | [
"Checks",
"if",
"provided",
"array",
"is",
"equal",
"to",
"the",
"readable",
"bytes",
"of",
"the",
"{",
"@link",
"#array",
"}",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L735-L738 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java | WsdlXsdSchema.inheritNamespaces | @SuppressWarnings("unchecked")
private void inheritNamespaces(SchemaImpl schema, Definition wsdl) {
Map<String, String> wsdlNamespaces = wsdl.getNamespaces();
for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) {
if (StringUtils.hasText(nsEntry.getKey())) {
if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue());
}
} else { // handle default namespace
if (!schema.getElement().hasAttribute("xmlns")) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue());
}
}
}
} | java | @SuppressWarnings("unchecked")
private void inheritNamespaces(SchemaImpl schema, Definition wsdl) {
Map<String, String> wsdlNamespaces = wsdl.getNamespaces();
for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) {
if (StringUtils.hasText(nsEntry.getKey())) {
if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue());
}
} else { // handle default namespace
if (!schema.getElement().hasAttribute("xmlns")) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue());
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"inheritNamespaces",
"(",
"SchemaImpl",
"schema",
",",
"Definition",
"wsdl",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"wsdlNamespaces",
"=",
"wsdl",
".",
"getNamespaces",
"(",
")... | Adds WSDL level namespaces to schema definition if necessary.
@param schema
@param wsdl | [
"Adds",
"WSDL",
"level",
"namespaces",
"to",
"schema",
"definition",
"if",
"necessary",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java#L161-L176 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java | Timestamp.ofTimeSecondsAndNanos | public static Timestamp ofTimeSecondsAndNanos(long seconds, int nanos) {
checkArgument(
Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos);
return new Timestamp(seconds, nanos);
} | java | public static Timestamp ofTimeSecondsAndNanos(long seconds, int nanos) {
checkArgument(
Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos);
return new Timestamp(seconds, nanos);
} | [
"public",
"static",
"Timestamp",
"ofTimeSecondsAndNanos",
"(",
"long",
"seconds",
",",
"int",
"nanos",
")",
"{",
"checkArgument",
"(",
"Timestamps",
".",
"isValid",
"(",
"seconds",
",",
"nanos",
")",
",",
"\"timestamp out of range: %s, %s\"",
",",
"seconds",
",",
... | Creates an instance representing the value of {@code seconds} and {@code nanos} since January
1, 1970, 00:00:00 UTC.
@param seconds seconds since January 1, 1970, 00:00:00 UTC. A negative value is the number of
seconds before January 1, 1970, 00:00:00 UTC.
@param nanos the fractional seconds component, in the range 0..999999999.
@throws IllegalArgumentException if the timestamp is outside the representable range | [
"Creates",
"an",
"instance",
"representing",
"the",
"value",
"of",
"{",
"@code",
"seconds",
"}",
"and",
"{",
"@code",
"nanos",
"}",
"since",
"January",
"1",
"1970",
"00",
":",
"00",
":",
"00",
"UTC",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java#L78-L82 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingPoliciesInner.java | StreamingPoliciesInner.getAsync | public Observable<StreamingPolicyInner> getAsync(String resourceGroupName, String accountName, String streamingPolicyName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingPolicyName).map(new Func1<ServiceResponse<StreamingPolicyInner>, StreamingPolicyInner>() {
@Override
public StreamingPolicyInner call(ServiceResponse<StreamingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<StreamingPolicyInner> getAsync(String resourceGroupName, String accountName, String streamingPolicyName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingPolicyName).map(new Func1<ServiceResponse<StreamingPolicyInner>, StreamingPolicyInner>() {
@Override
public StreamingPolicyInner call(ServiceResponse<StreamingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StreamingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"streamingPolicyName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
... | Get a Streaming Policy.
Get the details of a Streaming Policy in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingPolicyName The Streaming Policy name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingPolicyInner object | [
"Get",
"a",
"Streaming",
"Policy",
".",
"Get",
"the",
"details",
"of",
"a",
"Streaming",
"Policy",
"in",
"the",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingPoliciesInner.java#L394-L401 |
gosu-lang/gosu-lang | gosu-process/src/main/java/gw/util/process/ProcessRunner.java | ProcessRunner.withEnvironmentVariable | public ProcessRunner withEnvironmentVariable(String name, String value) {
_env.put(name, value);
return this;
} | java | public ProcessRunner withEnvironmentVariable(String name, String value) {
_env.put(name, value);
return this;
} | [
"public",
"ProcessRunner",
"withEnvironmentVariable",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"_env",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a name-value pair into this process' environment.
This can be called multiple times in a chain to set multiple
environment variables.
@param name the variable name
@param value the variable value
@return this object for chaining
@see ProcessBuilder
@see System#getenv() | [
"Adds",
"a",
"name",
"-",
"value",
"pair",
"into",
"this",
"process",
"environment",
".",
"This",
"can",
"be",
"called",
"multiple",
"times",
"in",
"a",
"chain",
"to",
"set",
"multiple",
"environment",
"variables",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-process/src/main/java/gw/util/process/ProcessRunner.java#L273-L276 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java | StatementExecutor.executeUpdate | public int executeUpdate() throws SQLException {
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | java | public int executeUpdate() throws SQLException {
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | [
"public",
"int",
"executeUpdate",
"(",
")",
"throws",
"SQLException",
"{",
"return",
"executeUpdate",
"(",
"new",
"Updater",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"executeUpdate",
"(",
"final",
"Statement",
"statement",
",",
"final",
"String",
"sql"... | Execute update.
@return effected records count
@throws SQLException SQL exception | [
"Execute",
"update",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L116-L124 |
ontop/ontop | core/optimization/src/main/java/it/unibz/inf/ontop/iq/executor/join/SelfJoinLikeExecutor.java | SelfJoinLikeExecutor.proposeForGroupingMap | protected PredicateLevelProposal proposeForGroupingMap(
ImmutableMultimap<ImmutableList<VariableOrGroundTerm>, ExtensionalDataNode> groupingMap)
throws AtomUnificationException {
ImmutableCollection<Collection<ExtensionalDataNode>> dataNodeGroups = groupingMap.asMap().values();
try {
/*
* Collection of unifying substitutions
*/
ImmutableSet<ImmutableSubstitution<VariableOrGroundTerm>> unifyingSubstitutions =
dataNodeGroups.stream()
.filter(g -> g.size() > 1)
.map(redundantNodes -> {
try {
return unifyRedundantNodes(redundantNodes);
} catch (AtomUnificationException e) {
throw new AtomUnificationRuntimeException(e);
}
})
.filter(s -> !s.isEmpty())
.collect(ImmutableCollectors.toSet());
/*
* All the nodes that have been at least once dominated (--> could thus be removed).
*
* Not parallellizable
*/
ImmutableSet<ExtensionalDataNode> removableNodes = ImmutableSet.copyOf(dataNodeGroups.stream()
.filter(sameRowDataNodes -> sameRowDataNodes.size() > 1)
.reduce(
new Dominance(),
Dominance::update,
(dom1, dom2) -> {
throw new IllegalStateException("Cannot be run in parallel");
})
.getRemovalNodes());
return new PredicateLevelProposal(unifyingSubstitutions, removableNodes);
/*
* Trick: rethrow the exception
*/
} catch (AtomUnificationRuntimeException e) {
throw e.checkedException;
}
} | java | protected PredicateLevelProposal proposeForGroupingMap(
ImmutableMultimap<ImmutableList<VariableOrGroundTerm>, ExtensionalDataNode> groupingMap)
throws AtomUnificationException {
ImmutableCollection<Collection<ExtensionalDataNode>> dataNodeGroups = groupingMap.asMap().values();
try {
/*
* Collection of unifying substitutions
*/
ImmutableSet<ImmutableSubstitution<VariableOrGroundTerm>> unifyingSubstitutions =
dataNodeGroups.stream()
.filter(g -> g.size() > 1)
.map(redundantNodes -> {
try {
return unifyRedundantNodes(redundantNodes);
} catch (AtomUnificationException e) {
throw new AtomUnificationRuntimeException(e);
}
})
.filter(s -> !s.isEmpty())
.collect(ImmutableCollectors.toSet());
/*
* All the nodes that have been at least once dominated (--> could thus be removed).
*
* Not parallellizable
*/
ImmutableSet<ExtensionalDataNode> removableNodes = ImmutableSet.copyOf(dataNodeGroups.stream()
.filter(sameRowDataNodes -> sameRowDataNodes.size() > 1)
.reduce(
new Dominance(),
Dominance::update,
(dom1, dom2) -> {
throw new IllegalStateException("Cannot be run in parallel");
})
.getRemovalNodes());
return new PredicateLevelProposal(unifyingSubstitutions, removableNodes);
/*
* Trick: rethrow the exception
*/
} catch (AtomUnificationRuntimeException e) {
throw e.checkedException;
}
} | [
"protected",
"PredicateLevelProposal",
"proposeForGroupingMap",
"(",
"ImmutableMultimap",
"<",
"ImmutableList",
"<",
"VariableOrGroundTerm",
">",
",",
"ExtensionalDataNode",
">",
"groupingMap",
")",
"throws",
"AtomUnificationException",
"{",
"ImmutableCollection",
"<",
"Colle... | groupingMap groups data nodes that are being joined on the unique constraints
creates proposal to unify redundant nodes | [
"groupingMap",
"groups",
"data",
"nodes",
"that",
"are",
"being",
"joined",
"on",
"the",
"unique",
"constraints"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/optimization/src/main/java/it/unibz/inf/ontop/iq/executor/join/SelfJoinLikeExecutor.java#L186-L231 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java | TmdbGenres.getGenreMovieList | public ResultList<Genre> getGenreMovieList(String language) throws MovieDbException {
return getGenreList(language, MethodSub.MOVIE_LIST);
} | java | public ResultList<Genre> getGenreMovieList(String language) throws MovieDbException {
return getGenreList(language, MethodSub.MOVIE_LIST);
} | [
"public",
"ResultList",
"<",
"Genre",
">",
"getGenreMovieList",
"(",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"return",
"getGenreList",
"(",
"language",
",",
"MethodSub",
".",
"MOVIE_LIST",
")",
";",
"}"
] | Get the list of movie genres.
@param language
@return
@throws MovieDbException | [
"Get",
"the",
"list",
"of",
"movie",
"genres",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java#L62-L64 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Euclidean | public static double Euclidean(double x1, double y1, double x2, double y2) {
double dx = Math.abs(x1 - x2);
double dy = Math.abs(y1 - y2);
return Math.sqrt(dx * dx + dy * dy);
} | java | public static double Euclidean(double x1, double y1, double x2, double y2) {
double dx = Math.abs(x1 - x2);
double dy = Math.abs(y1 - y2);
return Math.sqrt(dx * dx + dy * dy);
} | [
"public",
"static",
"double",
"Euclidean",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"double",
"dx",
"=",
"Math",
".",
"abs",
"(",
"x1",
"-",
"x2",
")",
";",
"double",
"dy",
"=",
"Math",
".",
"a... | Gets the Euclidean distance between two points.
@param x1 X1 axis coordinate.
@param y1 Y1 axis coordinate.
@param x2 X2 axis coordinate.
@param y2 Y2 axis coordinate.
@return The Euclidean distance between x and y. | [
"Gets",
"the",
"Euclidean",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L387-L392 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java | OrderItemUrl.splitItemUrl | public static MozuUrl splitItemUrl(String checkoutId, String itemId, Integer quantity, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}/split?quantity={quantity}&responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("itemId", itemId);
formatter.formatUrl("quantity", quantity);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl splitItemUrl(String checkoutId, String itemId, Integer quantity, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}/split?quantity={quantity}&responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("itemId", itemId);
formatter.formatUrl("quantity", quantity);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"splitItemUrl",
"(",
"String",
"checkoutId",
",",
"String",
"itemId",
",",
"Integer",
"quantity",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checko... | Get Resource Url for SplitItem
@param checkoutId The unique identifier of the checkout.
@param itemId The unique identifier of the item.
@param quantity The number of cart items in the shopper's active cart.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"SplitItem"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java#L24-L32 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/ECKey.java | ECKey.fromPrivateAndPrecalculatedPublic | public static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub) {
checkNotNull(priv);
checkNotNull(pub);
return new ECKey(new BigInteger(1, priv), CURVE.getCurve().decodePoint(pub));
} | java | public static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub) {
checkNotNull(priv);
checkNotNull(pub);
return new ECKey(new BigInteger(1, priv), CURVE.getCurve().decodePoint(pub));
} | [
"public",
"static",
"ECKey",
"fromPrivateAndPrecalculatedPublic",
"(",
"byte",
"[",
"]",
"priv",
",",
"byte",
"[",
"]",
"pub",
")",
"{",
"checkNotNull",
"(",
"priv",
")",
";",
"checkNotNull",
"(",
"pub",
")",
";",
"return",
"new",
"ECKey",
"(",
"new",
"B... | Creates an ECKey that simply trusts the caller to ensure that point is really the result of multiplying the
generator point by the private key. This is used to speed things up when you know you have the right values
already. The compression state of the point will be preserved. | [
"Creates",
"an",
"ECKey",
"that",
"simply",
"trusts",
"the",
"caller",
"to",
"ensure",
"that",
"point",
"is",
"really",
"the",
"result",
"of",
"multiplying",
"the",
"generator",
"point",
"by",
"the",
"private",
"key",
".",
"This",
"is",
"used",
"to",
"spee... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L292-L296 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/inf/CachingBpSchedule.java | CachingBpSchedule.isConstantMsg | public static boolean isConstantMsg(int edge, FactorGraph fg) {
BipartiteGraph<Var,Factor> bg = fg.getBipgraph();
int numNbs = bg.isT1T2(edge) ? bg.numNbsT1(bg.parentE(edge)) : bg.numNbsT2(bg.parentE(edge));
return numNbs == 1;
} | java | public static boolean isConstantMsg(int edge, FactorGraph fg) {
BipartiteGraph<Var,Factor> bg = fg.getBipgraph();
int numNbs = bg.isT1T2(edge) ? bg.numNbsT1(bg.parentE(edge)) : bg.numNbsT2(bg.parentE(edge));
return numNbs == 1;
} | [
"public",
"static",
"boolean",
"isConstantMsg",
"(",
"int",
"edge",
",",
"FactorGraph",
"fg",
")",
"{",
"BipartiteGraph",
"<",
"Var",
",",
"Factor",
">",
"bg",
"=",
"fg",
".",
"getBipgraph",
"(",
")",
";",
"int",
"numNbs",
"=",
"bg",
".",
"isT1T2",
"("... | Returns true iff the edge corresponds to a message which is constant (i.e. sent from a leaf
node). | [
"Returns",
"true",
"iff",
"the",
"edge",
"corresponds",
"to",
"a",
"message",
"which",
"is",
"constant",
"(",
"i",
".",
"e",
".",
"sent",
"from",
"a",
"leaf",
"node",
")",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/inf/CachingBpSchedule.java#L102-L106 |
OpenTSDB/opentsdb | src/tools/OpenTSDBMain.java | OpenTSDBMain.applyCommandLine | protected static void applyCommandLine(ConfigArgP cap, ArgP argp) {
// --config, --include-config, --help
if(argp.has("--help")) {
if(cap.hasNonOption("extended")) {
System.out.println(cap.getExtendedUsage("tsd extended usage:"));
} else {
System.out.println(cap.getDefaultUsage("tsd usage:"));
}
System.exit(0);
}
if(argp.has("--config")) {
loadConfigSource(cap, argp.get("--config").trim());
}
if(argp.has("--include")) {
String[] sources = argp.get("--include").split(",");
for(String s: sources) {
loadConfigSource(cap, s.trim());
}
}
} | java | protected static void applyCommandLine(ConfigArgP cap, ArgP argp) {
// --config, --include-config, --help
if(argp.has("--help")) {
if(cap.hasNonOption("extended")) {
System.out.println(cap.getExtendedUsage("tsd extended usage:"));
} else {
System.out.println(cap.getDefaultUsage("tsd usage:"));
}
System.exit(0);
}
if(argp.has("--config")) {
loadConfigSource(cap, argp.get("--config").trim());
}
if(argp.has("--include")) {
String[] sources = argp.get("--include").split(",");
for(String s: sources) {
loadConfigSource(cap, s.trim());
}
}
} | [
"protected",
"static",
"void",
"applyCommandLine",
"(",
"ConfigArgP",
"cap",
",",
"ArgP",
"argp",
")",
"{",
"// --config, --include-config, --help",
"if",
"(",
"argp",
".",
"has",
"(",
"\"--help\"",
")",
")",
"{",
"if",
"(",
"cap",
".",
"hasNonOption",
"(",
... | Applies and processes the pre-tsd command line
@param cap The main configuration wrapper
@param argp The preped command line argument handler | [
"Applies",
"and",
"processes",
"the",
"pre",
"-",
"tsd",
"command",
"line"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/OpenTSDBMain.java#L181-L200 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java | DateTimeFormatter.parseBest | public TemporalAccessor parseBest(CharSequence text, TemporalQuery<?>... queries) {
Objects.requireNonNull(text, "text");
Objects.requireNonNull(queries, "queries");
if (queries.length < 2) {
throw new IllegalArgumentException("At least two queries must be specified");
}
try {
TemporalAccessor resolved = parseResolved0(text, null);
for (TemporalQuery<?> query : queries) {
try {
return (TemporalAccessor) resolved.query(query);
} catch (RuntimeException ex) {
// continue
}
}
throw new DateTimeException("Unable to convert parsed text using any of the specified queries");
} catch (DateTimeParseException ex) {
throw ex;
} catch (RuntimeException ex) {
throw createError(text, ex);
}
} | java | public TemporalAccessor parseBest(CharSequence text, TemporalQuery<?>... queries) {
Objects.requireNonNull(text, "text");
Objects.requireNonNull(queries, "queries");
if (queries.length < 2) {
throw new IllegalArgumentException("At least two queries must be specified");
}
try {
TemporalAccessor resolved = parseResolved0(text, null);
for (TemporalQuery<?> query : queries) {
try {
return (TemporalAccessor) resolved.query(query);
} catch (RuntimeException ex) {
// continue
}
}
throw new DateTimeException("Unable to convert parsed text using any of the specified queries");
} catch (DateTimeParseException ex) {
throw ex;
} catch (RuntimeException ex) {
throw createError(text, ex);
}
} | [
"public",
"TemporalAccessor",
"parseBest",
"(",
"CharSequence",
"text",
",",
"TemporalQuery",
"<",
"?",
">",
"...",
"queries",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"\"text\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"queries",... | Fully parses the text producing an object of one of the specified types.
<p>
This parse method is convenient for use when the parser can handle optional elements.
For example, a pattern of 'uuuu-MM-dd HH.mm[ VV]' can be fully parsed to a {@code ZonedDateTime},
or partially parsed to a {@code LocalDateTime}.
The queries must be specified in order, starting from the best matching full-parse option
and ending with the worst matching minimal parse option.
The query is typically a method reference to a {@code from(TemporalAccessor)} method.
<p>
The result is associated with the first type that successfully parses.
Normally, applications will use {@code instanceof} to check the result.
For example:
<pre>
TemporalAccessor dt = parser.parseBest(str, ZonedDateTime::from, LocalDateTime::from);
if (dt instanceof ZonedDateTime) {
...
} else {
...
}
</pre>
If the parse completes without reading the entire length of the text,
or a problem occurs during parsing or merging, then an exception is thrown.
@param text the text to parse, not null
@param queries the queries defining the types to attempt to parse to,
must implement {@code TemporalAccessor}, not null
@return the parsed date-time, not null
@throws IllegalArgumentException if less than 2 types are specified
@throws DateTimeParseException if unable to parse the requested result | [
"Fully",
"parses",
"the",
"text",
"producing",
"an",
"object",
"of",
"one",
"of",
"the",
"specified",
"types",
".",
"<p",
">",
"This",
"parse",
"method",
"is",
"convenient",
"for",
"use",
"when",
"the",
"parser",
"can",
"handle",
"optional",
"elements",
".... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1890-L1911 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/asm/AsmInvokeDistributeFactory.java | AsmInvokeDistributeFactory.generateDefaultConstructor | private static void generateDefaultConstructor(ClassWriter cw, Class<?> parentClass,
String className) {
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, // public method
INIT, // method name
getDesc(void.class, parentClass), // descriptor
null, // signature (null means not generic)
null); // exceptions (array of strings)
mv.visitCode(); // Start the code for this method
// 调用父类构造器
mv.visitVarInsn(ALOAD, 0); // Load "this" onto the stack
mv.visitMethodInsn(INVOKESPECIAL, // Invoke an instance method (non-virtual)
convert(parentClass), // Class on which the method is defined
INIT, // Name of the method
getDesc(void.class), // Descriptor
false); // Is this class an interface?
// 设置字段值,相当于this.target = target;
mv.visitVarInsn(ALOAD, 0); // 加载this
mv.visitVarInsn(ALOAD, 1); // 加载参数
mv.visitFieldInsn(PUTFIELD, convert(className), TARGET_FIELD_NAME,
getByteCodeType(parentClass));
mv.visitMaxs(2, 1);
mv.visitInsn(RETURN); // End the constructor method
mv.visitEnd();
} | java | private static void generateDefaultConstructor(ClassWriter cw, Class<?> parentClass,
String className) {
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, // public method
INIT, // method name
getDesc(void.class, parentClass), // descriptor
null, // signature (null means not generic)
null); // exceptions (array of strings)
mv.visitCode(); // Start the code for this method
// 调用父类构造器
mv.visitVarInsn(ALOAD, 0); // Load "this" onto the stack
mv.visitMethodInsn(INVOKESPECIAL, // Invoke an instance method (non-virtual)
convert(parentClass), // Class on which the method is defined
INIT, // Name of the method
getDesc(void.class), // Descriptor
false); // Is this class an interface?
// 设置字段值,相当于this.target = target;
mv.visitVarInsn(ALOAD, 0); // 加载this
mv.visitVarInsn(ALOAD, 1); // 加载参数
mv.visitFieldInsn(PUTFIELD, convert(className), TARGET_FIELD_NAME,
getByteCodeType(parentClass));
mv.visitMaxs(2, 1);
mv.visitInsn(RETURN); // End the constructor method
mv.visitEnd();
} | [
"private",
"static",
"void",
"generateDefaultConstructor",
"(",
"ClassWriter",
"cw",
",",
"Class",
"<",
"?",
">",
"parentClass",
",",
"String",
"className",
")",
"{",
"MethodVisitor",
"mv",
"=",
"cw",
".",
"visitMethod",
"(",
"ACC_PUBLIC",
",",
"// public method... | 为类构建默认构造器(正常编译器会自动生成,但是此处要手动生成bytecode就只能手动生成无参构造器了
@param cw ClassWriter
@param parentClass 构建类的父类,会自动调用父类的构造器
@param className 生成的新类名 | [
"为类构建默认构造器(正常编译器会自动生成,但是此处要手动生成bytecode就只能手动生成无参构造器了"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/asm/AsmInvokeDistributeFactory.java#L285-L312 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.getEffectiveProperty | public String getEffectiveProperty(CmsClientSitemapEntry entry, String name) {
CmsClientProperty prop = getEffectivePropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | java | public String getEffectiveProperty(CmsClientSitemapEntry entry, String name) {
CmsClientProperty prop = getEffectivePropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | [
"public",
"String",
"getEffectiveProperty",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"name",
")",
"{",
"CmsClientProperty",
"prop",
"=",
"getEffectivePropertyObject",
"(",
"entry",
",",
"name",
")",
";",
"if",
"(",
"prop",
"==",
"null",
")",
"{",
... | Gets the effective value of a property value for a sitemap entry.<p>
@param entry the sitemap entry
@param name the name of the property
@return the effective value | [
"Gets",
"the",
"effective",
"value",
"of",
"a",
"property",
"value",
"for",
"a",
"sitemap",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1076-L1083 |
ecclesia/kipeto | kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java | FileRepositoryStrategy.createRepositoryDirectoryStructure | private void createRepositoryDirectoryStructure(File rootDir) {
this.objs = new File(rootDir, OBJECT_DIR);
if (!objs.exists()) {
if (!objs.mkdirs()) {
throw new RuntimeException("Could not create dir: " + objs.getAbsolutePath());
}
}
this.refs = new File(rootDir, REFERENCE_DIR);
if (!refs.exists()) {
if (!refs.mkdirs()) {
throw new RuntimeException("Could not create dir: " + refs.getAbsolutePath());
}
}
} | java | private void createRepositoryDirectoryStructure(File rootDir) {
this.objs = new File(rootDir, OBJECT_DIR);
if (!objs.exists()) {
if (!objs.mkdirs()) {
throw new RuntimeException("Could not create dir: " + objs.getAbsolutePath());
}
}
this.refs = new File(rootDir, REFERENCE_DIR);
if (!refs.exists()) {
if (!refs.mkdirs()) {
throw new RuntimeException("Could not create dir: " + refs.getAbsolutePath());
}
}
} | [
"private",
"void",
"createRepositoryDirectoryStructure",
"(",
"File",
"rootDir",
")",
"{",
"this",
".",
"objs",
"=",
"new",
"File",
"(",
"rootDir",
",",
"OBJECT_DIR",
")",
";",
"if",
"(",
"!",
"objs",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
... | Erzeugt die Verzeichnis-Struktur des Repositorys, falls die Verzeichinsse
noch nicht existieren.
@param rootDir
Wurzelverzeichnis zur Anlage der Verzeichnis-Struktur | [
"Erzeugt",
"die",
"Verzeichnis",
"-",
"Struktur",
"des",
"Repositorys",
"falls",
"die",
"Verzeichinsse",
"noch",
"nicht",
"existieren",
"."
] | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java#L263-L277 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java | IOUtil.inputStreamToString | public String inputStreamToString(InputStream is, String charset) throws IOException {
InputStreamReader isr = null;
if (null == charset) {
isr = new InputStreamReader(is);
} else {
isr = new InputStreamReader(is, charset);
}
StringWriter sw = new StringWriter();
int c = -1;
while ((c = isr.read()) != -1) {
sw.write(c);
}
isr.close();
return sw.getBuffer().toString();
} | java | public String inputStreamToString(InputStream is, String charset) throws IOException {
InputStreamReader isr = null;
if (null == charset) {
isr = new InputStreamReader(is);
} else {
isr = new InputStreamReader(is, charset);
}
StringWriter sw = new StringWriter();
int c = -1;
while ((c = isr.read()) != -1) {
sw.write(c);
}
isr.close();
return sw.getBuffer().toString();
} | [
"public",
"String",
"inputStreamToString",
"(",
"InputStream",
"is",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"InputStreamReader",
"isr",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"charset",
")",
"{",
"isr",
"=",
"new",
"InputStreamReader"... | Write to a string the bytes read from an input stream.
@param charset the charset used to read the input stream
@return the inputstream as a string | [
"Write",
"to",
"a",
"string",
"the",
"bytes",
"read",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L124-L138 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusternodegroup_binding.java | clusternodegroup_binding.get | public static clusternodegroup_binding get(nitro_service service, String name) throws Exception{
clusternodegroup_binding obj = new clusternodegroup_binding();
obj.set_name(name);
clusternodegroup_binding response = (clusternodegroup_binding) obj.get_resource(service);
return response;
} | java | public static clusternodegroup_binding get(nitro_service service, String name) throws Exception{
clusternodegroup_binding obj = new clusternodegroup_binding();
obj.set_name(name);
clusternodegroup_binding response = (clusternodegroup_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"clusternodegroup_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"clusternodegroup_binding",
"obj",
"=",
"new",
"clusternodegroup_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"... | Use this API to fetch clusternodegroup_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"clusternodegroup_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusternodegroup_binding.java#L169-L174 |
phax/ph-datetime | ph-holiday/src/main/java/com/helger/holiday/mgr/XMLHolidayManagerJapan.java | XMLHolidayManagerJapan.getHolidays | @Override
public HolidayMap getHolidays (final int nYear, @Nullable final String... aArgs)
{
final HolidayMap aHolidays = super.getHolidays (nYear, aArgs);
final HolidayMap aAdditionalHolidays = new HolidayMap ();
for (final Map.Entry <LocalDate, ISingleHoliday> aEntry : aHolidays.getMap ().entrySet ())
{
final LocalDate aTwoDaysLater = aEntry.getKey ().plusDays (2);
if (aHolidays.containsHolidayForDate (aTwoDaysLater))
{
final LocalDate aBridgingDate = aTwoDaysLater.minusDays (1);
aAdditionalHolidays.add (aBridgingDate,
new ResourceBundleHoliday (EHolidayType.OFFICIAL_HOLIDAY,
BRIDGING_HOLIDAY_PROPERTIES_KEY));
}
}
aHolidays.addAll (aAdditionalHolidays);
return aHolidays;
} | java | @Override
public HolidayMap getHolidays (final int nYear, @Nullable final String... aArgs)
{
final HolidayMap aHolidays = super.getHolidays (nYear, aArgs);
final HolidayMap aAdditionalHolidays = new HolidayMap ();
for (final Map.Entry <LocalDate, ISingleHoliday> aEntry : aHolidays.getMap ().entrySet ())
{
final LocalDate aTwoDaysLater = aEntry.getKey ().plusDays (2);
if (aHolidays.containsHolidayForDate (aTwoDaysLater))
{
final LocalDate aBridgingDate = aTwoDaysLater.minusDays (1);
aAdditionalHolidays.add (aBridgingDate,
new ResourceBundleHoliday (EHolidayType.OFFICIAL_HOLIDAY,
BRIDGING_HOLIDAY_PROPERTIES_KEY));
}
}
aHolidays.addAll (aAdditionalHolidays);
return aHolidays;
} | [
"@",
"Override",
"public",
"HolidayMap",
"getHolidays",
"(",
"final",
"int",
"nYear",
",",
"@",
"Nullable",
"final",
"String",
"...",
"aArgs",
")",
"{",
"final",
"HolidayMap",
"aHolidays",
"=",
"super",
".",
"getHolidays",
"(",
"nYear",
",",
"aArgs",
")",
... | Implements the rule which requests if two holidays have one non holiday
between each other than this day is also a holiday. | [
"Implements",
"the",
"rule",
"which",
"requests",
"if",
"two",
"holidays",
"have",
"one",
"non",
"holiday",
"between",
"each",
"other",
"than",
"this",
"day",
"is",
"also",
"a",
"holiday",
"."
] | train | https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/mgr/XMLHolidayManagerJapan.java#L51-L69 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.appSettings | public Map<String, Object> appSettings(String key) {
if (StringUtils.isBlank(key)) {
return appSettings();
}
return getEntity(invokeGet(Utils.formatMessage("_settings/{0}", key), null), Map.class);
} | java | public Map<String, Object> appSettings(String key) {
if (StringUtils.isBlank(key)) {
return appSettings();
}
return getEntity(invokeGet(Utils.formatMessage("_settings/{0}", key), null), Map.class);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"appSettings",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"key",
")",
")",
"{",
"return",
"appSettings",
"(",
")",
";",
"}",
"return",
"getEntity",
"(",
"invokeGet"... | Returns the value of a specific app setting (property).
@param key a key
@return a map containing one element {"value": "the_value"} or an empty map. | [
"Returns",
"the",
"value",
"of",
"a",
"specific",
"app",
"setting",
"(",
"property",
")",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1518-L1523 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optDouble | public static double optDouble(@Nullable Bundle bundle, @Nullable String key, double fallback) {
if (bundle == null) {
return 0.d;
}
return bundle.getDouble(key, fallback);
} | java | public static double optDouble(@Nullable Bundle bundle, @Nullable String key, double fallback) {
if (bundle == null) {
return 0.d;
}
return bundle.getDouble(key, fallback);
} | [
"public",
"static",
"double",
"optDouble",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
",",
"double",
"fallback",
")",
"{",
"if",
"(",
"bundle",
"==",
"null",
")",
"{",
"return",
"0.d",
";",
"}",
"return",
"bundle",
... | Returns a optional double value. In other words, returns the value mapped by key if it exists and is a double.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value.
@param bundle a bundle. If the bundle is null, this method will return a fallback value.
@param key a key for the value.
@param fallback fallback value.
@return a double value if exists, fallback value otherwise.
@see android.os.Bundle#getDouble(String, double) | [
"Returns",
"a",
"optional",
"double",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"double",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L438-L443 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/io/util/SequentialWriter.java | SequentialWriter.writeAtMost | private int writeAtMost(byte[] data, int offset, int length)
{
if (current >= bufferOffset + buffer.length)
reBuffer();
assert current < bufferOffset + buffer.length
: String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
int toCopy = Math.min(length, buffer.length - bufferCursor());
// copy bytes from external buffer
System.arraycopy(data, offset, buffer, bufferCursor(), toCopy);
assert current <= bufferOffset + buffer.length
: String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy);
current += toCopy;
return toCopy;
} | java | private int writeAtMost(byte[] data, int offset, int length)
{
if (current >= bufferOffset + buffer.length)
reBuffer();
assert current < bufferOffset + buffer.length
: String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
int toCopy = Math.min(length, buffer.length - bufferCursor());
// copy bytes from external buffer
System.arraycopy(data, offset, buffer, bufferCursor(), toCopy);
assert current <= bufferOffset + buffer.length
: String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy);
current += toCopy;
return toCopy;
} | [
"private",
"int",
"writeAtMost",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"current",
">=",
"bufferOffset",
"+",
"buffer",
".",
"length",
")",
"reBuffer",
"(",
")",
";",
"assert",
"current",
"<",
... | /*
Write at most "length" bytes from "data" starting at position "offset", and
return the number of bytes written. caller is responsible for setting
isDirty. | [
"/",
"*",
"Write",
"at",
"most",
"length",
"bytes",
"from",
"data",
"starting",
"at",
"position",
"offset",
"and",
"return",
"the",
"number",
"of",
"bytes",
"written",
".",
"caller",
"is",
"responsible",
"for",
"setting",
"isDirty",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/SequentialWriter.java#L215-L236 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ling/TaggedWordFactory.java | TaggedWordFactory.newLabel | public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new TaggedWord(null, labelStr);
}
return new TaggedWord(labelStr);
} | java | public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new TaggedWord(null, labelStr);
}
return new TaggedWord(labelStr);
} | [
"public",
"Label",
"newLabel",
"(",
"String",
"labelStr",
",",
"int",
"options",
")",
"{",
"if",
"(",
"options",
"==",
"TAG_LABEL",
")",
"{",
"return",
"new",
"TaggedWord",
"(",
"null",
",",
"labelStr",
")",
";",
"}",
"return",
"new",
"TaggedWord",
"(",
... | Make a new label with this <code>String</code> as a value component.
Any other fields of the label would normally be null.
@param labelStr The String that will be used for value
@param options what to make (use labelStr as word or tag)
@return The new TaggedWord (tag or word will be <code>null</code>) | [
"Make",
"a",
"new",
"label",
"with",
"this",
"<code",
">",
"String<",
"/",
"code",
">",
"as",
"a",
"value",
"component",
".",
"Any",
"other",
"fields",
"of",
"the",
"label",
"would",
"normally",
"be",
"null",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/TaggedWordFactory.java#L60-L65 |
tinosteinort/beanrepository | src/main/java/com/github/tinosteinort/beanrepository/BeanRepository.java | BeanRepository.getPrototypeBean | public <T, P1> T getPrototypeBean(final ConstructorWithBeansAnd1Parameter<T, P1> creator,
final P1 param1) {
final PrototypeProvider provider = new PrototypeProvider(name, beans -> creator.create(beans, param1));
return provider.getBean(this, dryRun);
} | java | public <T, P1> T getPrototypeBean(final ConstructorWithBeansAnd1Parameter<T, P1> creator,
final P1 param1) {
final PrototypeProvider provider = new PrototypeProvider(name, beans -> creator.create(beans, param1));
return provider.getBean(this, dryRun);
} | [
"public",
"<",
"T",
",",
"P1",
">",
"T",
"getPrototypeBean",
"(",
"final",
"ConstructorWithBeansAnd1Parameter",
"<",
"T",
",",
"P1",
">",
"creator",
",",
"final",
"P1",
"param1",
")",
"{",
"final",
"PrototypeProvider",
"provider",
"=",
"new",
"PrototypeProvide... | Returns a new {@code prototype} Bean, created by the given Function. It is possible to pass Parameter
to the Constructor of the Bean, and determine Dependencies with the {@link BeanAccessor}. The Method
{@link PostConstructible#onPostConstruct(BeanRepository)} is executed for every Call of this Method, if
the Interface is implemented.
@param creator The Code to create the new Object
@param param1 The 1st Parameter
@param <T> The Type of the Bean
@param <P1> The Type of the 1st Parameter
@see BeanAccessor
@see PostConstructible
@return a new created Object | [
"Returns",
"a",
"new",
"{",
"@code",
"prototype",
"}",
"Bean",
"created",
"by",
"the",
"given",
"Function",
".",
"It",
"is",
"possible",
"to",
"pass",
"Parameter",
"to",
"the",
"Constructor",
"of",
"the",
"Bean",
"and",
"determine",
"Dependencies",
"with",
... | train | https://github.com/tinosteinort/beanrepository/blob/4131d1e380ebc511392f3bda9d0966997bb34a62/src/main/java/com/github/tinosteinort/beanrepository/BeanRepository.java#L237-L241 |
olivergondza/dumpling | core/src/main/java/com/github/olivergondza/dumpling/factory/jmx/JmxLocalProcessConnector.java | JmxLocalProcessConnector.getServerConnection | @SuppressWarnings("unused")
private static MBeanServerConnection getServerConnection(int pid) {
try {
JMXServiceURL serviceURL = new JMXServiceURL(connectorAddress(pid));
return JMXConnectorFactory.connect(serviceURL).getMBeanServerConnection();
} catch (MalformedURLException ex) {
throw failed("JMX connection failed", ex);
} catch (IOException ex) {
throw failed("JMX connection failed", ex);
}
} | java | @SuppressWarnings("unused")
private static MBeanServerConnection getServerConnection(int pid) {
try {
JMXServiceURL serviceURL = new JMXServiceURL(connectorAddress(pid));
return JMXConnectorFactory.connect(serviceURL).getMBeanServerConnection();
} catch (MalformedURLException ex) {
throw failed("JMX connection failed", ex);
} catch (IOException ex) {
throw failed("JMX connection failed", ex);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"static",
"MBeanServerConnection",
"getServerConnection",
"(",
"int",
"pid",
")",
"{",
"try",
"{",
"JMXServiceURL",
"serviceURL",
"=",
"new",
"JMXServiceURL",
"(",
"connectorAddress",
"(",
"pid",
")",
")"... | This has to be called by reflection so it can as well be private to stress this is not an API | [
"This",
"has",
"to",
"be",
"called",
"by",
"reflection",
"so",
"it",
"can",
"as",
"well",
"be",
"private",
"to",
"stress",
"this",
"is",
"not",
"an",
"API"
] | train | https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/factory/jmx/JmxLocalProcessConnector.java#L61-L73 |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java | JsonLdApi.generateNodeMap | void generateNodeMap(Object element, Map<String, Object> nodeMap) throws JsonLdError {
generateNodeMap(element, nodeMap, JsonLdConsts.DEFAULT, null, null, null);
} | java | void generateNodeMap(Object element, Map<String, Object> nodeMap) throws JsonLdError {
generateNodeMap(element, nodeMap, JsonLdConsts.DEFAULT, null, null, null);
} | [
"void",
"generateNodeMap",
"(",
"Object",
"element",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"nodeMap",
")",
"throws",
"JsonLdError",
"{",
"generateNodeMap",
"(",
"element",
",",
"nodeMap",
",",
"JsonLdConsts",
".",
"DEFAULT",
",",
"null",
",",
"null"... | *
_____ _ _ _ _ _ _ _ _ | ___| | __ _| |_| |_ ___ _ __ / \ | | __ _ ___ _
__(_) |_| |__ _ __ ___ | |_ | |/ _` | __| __/ _ \ '_ \ / _ \ | |/ _` |/ _
\| '__| | __| '_ \| '_ ` _ \ | _| | | (_| | |_| || __/ | | | / ___ \| |
(_| | (_) | | | | |_| | | | | | | | | |_| |_|\__,_|\__|\__\___|_| |_| /_/
\_\_|\__, |\___/|_| |_|\__|_| |_|_| |_| |_| |___/ | [
"*",
"_____",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"|",
"___|",
"|",
"__",
"_|",
"|_|",
"|_",
"___",
"_",
"__",
"/",
"\\",
"|",
"|",
"__",
"_",
"___",
"_",
"__",
"(",
"_",
")",
"|_|",
"|__",
"_",
"__",
"___",
"|",
"|_",
"|",
"|",
"... | train | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java#L1038-L1040 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/Domain.java | Domain.get | public static Domain get(final BandwidthClient client, final String id) throws ParseException, Exception {
assert(client != null);
final String domainsUri = client.getUserResourceInstanceUri(BandwidthConstants.DOMAINS_URI_PATH, id);
final JSONObject jsonObject = toJSONObject(client.get(domainsUri, null));
return new Domain(client, jsonObject);
} | java | public static Domain get(final BandwidthClient client, final String id) throws ParseException, Exception {
assert(client != null);
final String domainsUri = client.getUserResourceInstanceUri(BandwidthConstants.DOMAINS_URI_PATH, id);
final JSONObject jsonObject = toJSONObject(client.get(domainsUri, null));
return new Domain(client, jsonObject);
} | [
"public",
"static",
"Domain",
"get",
"(",
"final",
"BandwidthClient",
"client",
",",
"final",
"String",
"id",
")",
"throws",
"ParseException",
",",
"Exception",
"{",
"assert",
"(",
"client",
"!=",
"null",
")",
";",
"final",
"String",
"domainsUri",
"=",
"clie... | Convenience method to return a Domain
@param client the client.
@param id the domain id.
@return the domain object.
@throws ParseException Error parsing data
@throws Exception error | [
"Convenience",
"method",
"to",
"return",
"a",
"Domain"
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Domain.java#L118-L123 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.generateCheckBox | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | java | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | [
"private",
"CmsCheckBox",
"generateCheckBox",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"new",
"CmsCheckBox",
"(",
")",
";",
"cb",
".",
"setText",
"(",
"m_dateFormat",
".",
"format",
"(",
"date",
")",
")",
";",
... | Generate a new check box with the provided date and check state.
@param date date for the check box.
@param checkState the initial check state.
@return the created check box | [
"Generate",
"a",
"new",
"check",
"box",
"with",
"the",
"provided",
"date",
"and",
"check",
"state",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L308-L316 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.listByDataBoxEdgeDeviceAsync | public Observable<Page<StorageAccountCredentialInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<StorageAccountCredentialInner>>, Page<StorageAccountCredentialInner>>() {
@Override
public Page<StorageAccountCredentialInner> call(ServiceResponse<Page<StorageAccountCredentialInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<StorageAccountCredentialInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<StorageAccountCredentialInner>>, Page<StorageAccountCredentialInner>>() {
@Override
public Page<StorageAccountCredentialInner> call(ServiceResponse<Page<StorageAccountCredentialInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"StorageAccountCredentialInner",
">",
">",
"listByDataBoxEdgeDeviceAsync",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByDataBoxEdgeDeviceWithServiceResponseAsync",
"("... | Gets all the storage account credentials in a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountCredentialInner> object | [
"Gets",
"all",
"the",
"storage",
"account",
"credentials",
"in",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L143-L151 |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/ScriptableMilestoneEvaluation.java | ScriptableMilestoneEvaluation.evaluate | @Override
public <M extends Enum<M>> ServiceMilestone.Recommendation evaluate(Class<M> type, String name, DataBinder binder, Reifier dict, Persistence persist) {
if (_script != null) {
try {
js.put("type", type);
js.put("name", name);
js.put("binder", binder);
js.put("dictionary", dict);
js.put("persistence", persist);
Object value = js.eval(_script);
return value != null ? Enum.valueOf(ServiceMilestone.Recommendation.class, value.toString().toUpperCase()) : ServiceMilestone.Recommendation.CONTINUE;
} catch (Throwable t) {
binder.put("_script_", _script);
throw new ServiceException(getScriptingExceptionMessage(t));
}
} else {
return ServiceMilestone.Recommendation.CONTINUE;
}
} | java | @Override
public <M extends Enum<M>> ServiceMilestone.Recommendation evaluate(Class<M> type, String name, DataBinder binder, Reifier dict, Persistence persist) {
if (_script != null) {
try {
js.put("type", type);
js.put("name", name);
js.put("binder", binder);
js.put("dictionary", dict);
js.put("persistence", persist);
Object value = js.eval(_script);
return value != null ? Enum.valueOf(ServiceMilestone.Recommendation.class, value.toString().toUpperCase()) : ServiceMilestone.Recommendation.CONTINUE;
} catch (Throwable t) {
binder.put("_script_", _script);
throw new ServiceException(getScriptingExceptionMessage(t));
}
} else {
return ServiceMilestone.Recommendation.CONTINUE;
}
} | [
"@",
"Override",
"public",
"<",
"M",
"extends",
"Enum",
"<",
"M",
">",
">",
"ServiceMilestone",
".",
"Recommendation",
"evaluate",
"(",
"Class",
"<",
"M",
">",
"type",
",",
"String",
"name",
",",
"DataBinder",
"binder",
",",
"Reifier",
"dict",
",",
"Pers... | Calls the evaluations in order, returning immediately if one returns ServiceMilestone.Recommendation.COMPLETE. | [
"Calls",
"the",
"evaluations",
"in",
"order",
"returning",
"immediately",
"if",
"one",
"returns",
"ServiceMilestone",
".",
"Recommendation",
".",
"COMPLETE",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/ScriptableMilestoneEvaluation.java#L42-L60 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/utils/Utils.java | Utils.getLastSpace | private static int getLastSpace(final CharSequence message, int width) {
final int length = message.length();
int stopPos = width;
int currPos = 0;
int lastSpace = -1;
boolean inEscape = false;
while (currPos < stopPos && currPos < length) {
final char c = message.charAt(currPos);
if (c == ESCAPE_CHAR) {
stopPos++;
inEscape = true;
} else if (inEscape) {
stopPos++;
if (Character.isLetter(c))
inEscape = false;
} else if (Character.isWhitespace(c)) {
lastSpace = currPos;
}
currPos++;
}
return lastSpace;
} | java | private static int getLastSpace(final CharSequence message, int width) {
final int length = message.length();
int stopPos = width;
int currPos = 0;
int lastSpace = -1;
boolean inEscape = false;
while (currPos < stopPos && currPos < length) {
final char c = message.charAt(currPos);
if (c == ESCAPE_CHAR) {
stopPos++;
inEscape = true;
} else if (inEscape) {
stopPos++;
if (Character.isLetter(c))
inEscape = false;
} else if (Character.isWhitespace(c)) {
lastSpace = currPos;
}
currPos++;
}
return lastSpace;
} | [
"private",
"static",
"int",
"getLastSpace",
"(",
"final",
"CharSequence",
"message",
",",
"int",
"width",
")",
"{",
"final",
"int",
"length",
"=",
"message",
".",
"length",
"(",
")",
";",
"int",
"stopPos",
"=",
"width",
";",
"int",
"currPos",
"=",
"0",
... | Returns the last whitespace location in string, before width characters.
@param message The message to break.
@param width The width of the line.
@return The last whitespace location. | [
"Returns",
"the",
"last",
"whitespace",
"location",
"in",
"string",
"before",
"width",
"characters",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/utils/Utils.java#L98-L119 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/GeomFactory2dfx.java | GeomFactory2dfx.newPoint | @SuppressWarnings("static-method")
public Point2dfx newPoint(DoubleProperty x, DoubleProperty y) {
return new Point2dfx(x, y);
} | java | @SuppressWarnings("static-method")
public Point2dfx newPoint(DoubleProperty x, DoubleProperty y) {
return new Point2dfx(x, y);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Point2dfx",
"newPoint",
"(",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
")",
"{",
"return",
"new",
"Point2dfx",
"(",
"x",
",",
"y",
")",
";",
"}"
] | Create a point with properties.
@param x the x property.
@param y the y property.
@return the vector. | [
"Create",
"a",
"point",
"with",
"properties",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/GeomFactory2dfx.java#L115-L118 |
op4j/op4j | src/main/java/org/op4j/functions/FnNumber.java | FnNumber.toBigDecimal | public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
return new ToBigDecimal(scale, roundingMode);
} | java | public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
return new ToBigDecimal(scale, roundingMode);
} | [
"public",
"static",
"final",
"Function",
"<",
"Number",
",",
"BigDecimal",
">",
"toBigDecimal",
"(",
"final",
"int",
"scale",
",",
"final",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"new",
"ToBigDecimal",
"(",
"scale",
",",
"roundingMode",
")",
";",
... | <p>
It converts the input into a {@link BigDecimal} using the given scale and {@link RoundingMode}
</p>
@param scale the scale to be used
@param roundingMode the {@link RoundingMode} to round the input with
@return the {@link BigDecimal} | [
"<p",
">",
"It",
"converts",
"the",
"input",
"into",
"a",
"{",
"@link",
"BigDecimal",
"}",
"using",
"the",
"given",
"scale",
"and",
"{",
"@link",
"RoundingMode",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L85-L87 |
datacleaner/AnalyzerBeans | env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java | SlaveServletHelper.handleRequest | public void handleRequest(final HttpServletRequest request, final HttpServletResponse response, final AnalysisListener ... analysisListeners) throws IOException {
final String jobId = request.getParameter(HttpClusterManager.HTTP_PARAM_SLAVE_JOB_ID);
final String action = request.getParameter(HttpClusterManager.HTTP_PARAM_ACTION);
if (HttpClusterManager.ACTION_CANCEL.equals(action)) {
logger.info("Handling 'cancel' request: {}", jobId);
cancelJob(jobId);
return;
}
if (HttpClusterManager.ACTION_RUN.equals(action)) {
logger.info("Handling 'run' request: {}", jobId);
final AnalysisJob job;
try {
job = readJob(request);
} catch (IOException e) {
logger.error("Failed to read job definition from HTTP request", e);
throw e;
}
final Serializable resultObject;
try {
final AnalysisResultFuture resultFuture = runJob(job, jobId, analysisListeners);
resultObject = serializeResult(resultFuture, jobId);
} catch (RuntimeException e) {
logger.error("Unexpected error occurred while running slave job", e);
throw e;
}
try {
sendResponse(response, resultObject);
} catch (IOException e) {
logger.error("Failed to send job result through HTTP response", e);
throw e;
}
return;
}
logger.warn("Unspecified action request: {}", jobId);
} | java | public void handleRequest(final HttpServletRequest request, final HttpServletResponse response, final AnalysisListener ... analysisListeners) throws IOException {
final String jobId = request.getParameter(HttpClusterManager.HTTP_PARAM_SLAVE_JOB_ID);
final String action = request.getParameter(HttpClusterManager.HTTP_PARAM_ACTION);
if (HttpClusterManager.ACTION_CANCEL.equals(action)) {
logger.info("Handling 'cancel' request: {}", jobId);
cancelJob(jobId);
return;
}
if (HttpClusterManager.ACTION_RUN.equals(action)) {
logger.info("Handling 'run' request: {}", jobId);
final AnalysisJob job;
try {
job = readJob(request);
} catch (IOException e) {
logger.error("Failed to read job definition from HTTP request", e);
throw e;
}
final Serializable resultObject;
try {
final AnalysisResultFuture resultFuture = runJob(job, jobId, analysisListeners);
resultObject = serializeResult(resultFuture, jobId);
} catch (RuntimeException e) {
logger.error("Unexpected error occurred while running slave job", e);
throw e;
}
try {
sendResponse(response, resultObject);
} catch (IOException e) {
logger.error("Failed to send job result through HTTP response", e);
throw e;
}
return;
}
logger.warn("Unspecified action request: {}", jobId);
} | [
"public",
"void",
"handleRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"AnalysisListener",
"...",
"analysisListeners",
")",
"throws",
"IOException",
"{",
"final",
"String",
"jobId",
"=",
"reques... | Completely handles a HTTP request and response. This method is
functionally equivalent of calling these methods in sequence:
{@link #readJob(HttpServletRequest)}
{@link #runJob(AnalysisJob, String, AnalysisListener...)
{@link #serializeResult(AnalysisResultFuture, String)}
{@link #sendResponse(HttpServletResponse, Serializable)}
@param request
@param response
@param analysisListeners
@throws IOException | [
"Completely",
"handles",
"a",
"HTTP",
"request",
"and",
"response",
".",
"This",
"method",
"is",
"functionally",
"equivalent",
"of",
"calling",
"these",
"methods",
"in",
"sequence",
":"
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java#L163-L204 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java | TopologyBuilder.setBolt | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
return setBolt(id, new backtype.storm.topology.WindowedBoltExecutor(bolt), parallelism_hint);
} | java | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
return setBolt(id, new backtype.storm.topology.WindowedBoltExecutor(bolt), parallelism_hint);
} | [
"public",
"BoltDeclarer",
"setBolt",
"(",
"String",
"id",
",",
"IWindowedBolt",
"bolt",
",",
"Number",
"parallelism_hint",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"setBolt",
"(",
"id",
",",
"new",
"backtype",
".",
"storm",
".",
"topology",
".",... | Define a new bolt in this topology. This defines a windowed bolt, intended
for windowing operations. The {@link IWindowedBolt#execute(TupleWindow)} method
is triggered for each window interval with the list of current events in the window.
@param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs.
@param bolt the windowed bolt
@param parallelism_hint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somwehere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelism_hint} is not positive | [
"Define",
"a",
"new",
"bolt",
"in",
"this",
"topology",
".",
"This",
"defines",
"a",
"windowed",
"bolt",
"intended",
"for",
"windowing",
"operations",
".",
"The",
"{",
"@link",
"IWindowedBolt#execute",
"(",
"TupleWindow",
")",
"}",
"method",
"is",
"triggered",... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java#L235-L237 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStream.java | InternalOutputStream.writeUncommitted | public void writeUncommitted(SIMPMessage m)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
long completedPrefix;
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
}
synchronized (this)
{
// write into stream
oststream.writeCombinedRange(tr);
completedPrefix = oststream.getCompletedPrefix();
sendSilence(starts, completedPrefix);
// SIB0105
// If this is the first uncommitted messages to be added to the stream, start off the
// blocked message health state timer. This will check back in the future to see if the
// message successfully sent.
if (blockedStreamAlarm == null)
{
blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
}
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeUncommitted");
} | java | public void writeUncommitted(SIMPMessage m)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
long completedPrefix;
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
}
synchronized (this)
{
// write into stream
oststream.writeCombinedRange(tr);
completedPrefix = oststream.getCompletedPrefix();
sendSilence(starts, completedPrefix);
// SIB0105
// If this is the first uncommitted messages to be added to the stream, start off the
// blocked message health state timer. This will check back in the future to see if the
// message successfully sent.
if (blockedStreamAlarm == null)
{
blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
}
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeUncommitted");
} | [
"public",
"void",
"writeUncommitted",
"(",
"SIMPMessage",
"m",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
"... | This method uses a Value message to write an Uncommitted tick
into the stream.
It is called at preCommit time.
@param m The value message to write to the stream | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"an",
"Uncommitted",
"tick",
"into",
"the",
"stream",
".",
"It",
"is",
"called",
"at",
"preCommit",
"time",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStream.java#L533-L581 |
code4everything/util | src/main/java/com/zhazhapan/util/RandomUtils.java | RandomUtils.getRandomTextIgnoreRange | public static String getRandomTextIgnoreRange(int floor, int ceil, int length, int[]... ranges) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; i++) {
builder.append((char) getRandomIntegerIgnoreRange(floor, ceil, ranges));
}
return builder.toString();
} | java | public static String getRandomTextIgnoreRange(int floor, int ceil, int length, int[]... ranges) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; i++) {
builder.append((char) getRandomIntegerIgnoreRange(floor, ceil, ranges));
}
return builder.toString();
} | [
"public",
"static",
"String",
"getRandomTextIgnoreRange",
"(",
"int",
"floor",
",",
"int",
"ceil",
",",
"int",
"length",
",",
"int",
"[",
"]",
"...",
"ranges",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
... | 获取自定义忽略多个区间的随机字符串
@param floor ascii下限
@param ceil ascii上限
@param length 长度
@param ranges 忽略区间(包含下限和上限长度为2的一维数组),可以有多个忽略区间
@return 字符串 | [
"获取自定义忽略多个区间的随机字符串"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/RandomUtils.java#L116-L122 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java | OpenAPIUtils.mapToString | public static String mapToString(Map<String, ?> map) {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for (String key : map.keySet()) {
if (map.get(key) != null) {
sb.append(key + ": " + map.get(key) + "\n ");
} else {
continue;
}
}
sb.append("}");
return sb.toString();
} | java | public static String mapToString(Map<String, ?> map) {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for (String key : map.keySet()) {
if (map.get(key) != null) {
sb.append(key + ": " + map.get(key) + "\n ");
} else {
continue;
}
}
sb.append("}");
return sb.toString();
} | [
"public",
"static",
"String",
"mapToString",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"{\\n\"",
")",
";",
"for",
"(",
"String",
"key",
":... | Print map to string
@param map - the map to be printed to String | [
"Print",
"map",
"to",
"string"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java#L170-L182 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java | AtomTetrahedralLigandPlacer3D.getDistanceValue | private double getDistanceValue(String id1, String id2) {
String dkey = "";
if (pSet.containsKey(("bond" + id1 + ";" + id2))) {
dkey = "bond" + id1 + ";" + id2;
} else if (pSet.containsKey(("bond" + id2 + ";" + id1))) {
dkey = "bond" + id2 + ";" + id1;
} else {
// logger.debug("DistanceKEYError:pSet has no key:" + id2 + " ; " + id1 + " take default bond length:" + DEFAULT_BOND_LENGTH_H);
return DEFAULT_BOND_LENGTH_H;
}
return ((Double) (((List) pSet.get(dkey)).get(0))).doubleValue();
} | java | private double getDistanceValue(String id1, String id2) {
String dkey = "";
if (pSet.containsKey(("bond" + id1 + ";" + id2))) {
dkey = "bond" + id1 + ";" + id2;
} else if (pSet.containsKey(("bond" + id2 + ";" + id1))) {
dkey = "bond" + id2 + ";" + id1;
} else {
// logger.debug("DistanceKEYError:pSet has no key:" + id2 + " ; " + id1 + " take default bond length:" + DEFAULT_BOND_LENGTH_H);
return DEFAULT_BOND_LENGTH_H;
}
return ((Double) (((List) pSet.get(dkey)).get(0))).doubleValue();
} | [
"private",
"double",
"getDistanceValue",
"(",
"String",
"id1",
",",
"String",
"id2",
")",
"{",
"String",
"dkey",
"=",
"\"\"",
";",
"if",
"(",
"pSet",
".",
"containsKey",
"(",
"(",
"\"bond\"",
"+",
"id1",
"+",
"\";\"",
"+",
"id2",
")",
")",
")",
"{",
... | Gets the distance between two atoms out of the parameter set.
@param id1 id of the parameter set for atom1 (atom1.getAtomTypeName())
@param id2 id of the parameter set for atom2
@return The distanceValue value
@exception Exception Description of the Exception | [
"Gets",
"the",
"distance",
"between",
"two",
"atoms",
"out",
"of",
"the",
"parameter",
"set",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java#L680-L691 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java | Director.installFeatureNoResolve | public void installFeatureNoResolve(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING"));
ArrayList<InstallAsset> singleFeatureInstall = new ArrayList<InstallAsset>();
InstallAsset esa = null;
try {
esa = new ESAAsset(new File(esaLocation), toExtension, false);
} catch (ZipException e) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()),
InstallException.BAD_ARGUMENT);
} catch (IOException e) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()),
InstallException.BAD_ARGUMENT);
}
singleFeatureInstall.add(esa);
this.installAssets = new ArrayList<List<InstallAsset>>(1);
this.installAssets.add(singleFeatureInstall);
} | java | public void installFeatureNoResolve(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING"));
ArrayList<InstallAsset> singleFeatureInstall = new ArrayList<InstallAsset>();
InstallAsset esa = null;
try {
esa = new ESAAsset(new File(esaLocation), toExtension, false);
} catch (ZipException e) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()),
InstallException.BAD_ARGUMENT);
} catch (IOException e) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()),
InstallException.BAD_ARGUMENT);
}
singleFeatureInstall.add(esa);
this.installAssets = new ArrayList<List<InstallAsset>>(1);
this.installAssets.add(singleFeatureInstall);
} | [
"public",
"void",
"installFeatureNoResolve",
"(",
"String",
"esaLocation",
",",
"String",
"toExtension",
",",
"boolean",
"acceptLicense",
")",
"throws",
"InstallException",
"{",
"fireProgressEvent",
"(",
"InstallProgressEvent",
".",
"CHECK",
",",
"1",
",",
"Messages",... | Installs the feature found in the given esa location without resolving dependencies
@param esaLocation location of esa
@param toExtension location of a product extension
@param acceptLicense if license is accepted
@throws InstallException | [
"Installs",
"the",
"feature",
"found",
"in",
"the",
"given",
"esa",
"location",
"without",
"resolving",
"dependencies"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L393-L409 |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java | SimulatorSettings.setKeyboardOptions | public void setKeyboardOptions() {
File folder = new File(contentAndSettingsFolder + "/Library/Preferences/");
File preferenceFile = new File(folder, "com.apple.Preferences.plist");
try {
JSONObject preferences = new JSONObject();
preferences.put("KeyboardAutocapitalization", false);
preferences.put("KeyboardAutocorrection", false);
preferences.put("KeyboardCapsLock", false);
preferences.put("KeyboardCheckSpelling", false);
writeOnDisk(preferences, preferenceFile);
} catch (Exception e) {
throw new WebDriverException("cannot set options in " + preferenceFile.getAbsolutePath(), e);
}
} | java | public void setKeyboardOptions() {
File folder = new File(contentAndSettingsFolder + "/Library/Preferences/");
File preferenceFile = new File(folder, "com.apple.Preferences.plist");
try {
JSONObject preferences = new JSONObject();
preferences.put("KeyboardAutocapitalization", false);
preferences.put("KeyboardAutocorrection", false);
preferences.put("KeyboardCapsLock", false);
preferences.put("KeyboardCheckSpelling", false);
writeOnDisk(preferences, preferenceFile);
} catch (Exception e) {
throw new WebDriverException("cannot set options in " + preferenceFile.getAbsolutePath(), e);
}
} | [
"public",
"void",
"setKeyboardOptions",
"(",
")",
"{",
"File",
"folder",
"=",
"new",
"File",
"(",
"contentAndSettingsFolder",
"+",
"\"/Library/Preferences/\"",
")",
";",
"File",
"preferenceFile",
"=",
"new",
"File",
"(",
"folder",
",",
"\"com.apple.Preferences.plist... | the default keyboard options aren't good for automation. For instance it automatically
capitalize the first letter of sentences etc. Getting rid of all that to have the keyboard
execute requests without changing them. | [
"the",
"default",
"keyboard",
"options",
"aren",
"t",
"good",
"for",
"automation",
".",
"For",
"instance",
"it",
"automatically",
"capitalize",
"the",
"first",
"letter",
"of",
"sentences",
"etc",
".",
"Getting",
"rid",
"of",
"all",
"that",
"to",
"have",
"the... | train | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java#L97-L111 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/BackendTransaction.java | BackendTransaction.mutateEdges | public void mutateEdges(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException {
edgeStore.mutateEntries(key, additions, deletions, storeTx);
} | java | public void mutateEdges(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException {
edgeStore.mutateEntries(key, additions, deletions, storeTx);
} | [
"public",
"void",
"mutateEdges",
"(",
"StaticBuffer",
"key",
",",
"List",
"<",
"Entry",
">",
"additions",
",",
"List",
"<",
"Entry",
">",
"deletions",
")",
"throws",
"BackendException",
"{",
"edgeStore",
".",
"mutateEntries",
"(",
"key",
",",
"additions",
",... | Applies the specified insertion and deletion mutations on the edge store to the provided key.
Both, the list of additions or deletions, may be empty or NULL if there is nothing to be added and/or deleted.
@param key Key
@param additions List of entries (column + value) to be added
@param deletions List of columns to be removed | [
"Applies",
"the",
"specified",
"insertion",
"and",
"deletion",
"mutations",
"on",
"the",
"edge",
"store",
"to",
"the",
"provided",
"key",
".",
"Both",
"the",
"list",
"of",
"additions",
"or",
"deletions",
"may",
"be",
"empty",
"or",
"NULL",
"if",
"there",
"... | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/BackendTransaction.java#L184-L186 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ThresholdsEvaluatorBuilder.java | ThresholdsEvaluatorBuilder.withLegacyThreshold | public final ThresholdsEvaluatorBuilder withLegacyThreshold(final String metric, final String okRange, final String warnRange,
final String critRange) throws BadThresholdException {
LegacyRange ok = null, warn = null, crit = null;
if (okRange != null) {
ok = new LegacyRange(okRange);
}
if (warnRange != null) {
warn = new LegacyRange(warnRange);
}
if (critRange != null) {
crit = new LegacyRange(critRange);
}
thresholds.addThreshold(new LegacyThreshold(metric, ok, warn, crit));
return this;
} | java | public final ThresholdsEvaluatorBuilder withLegacyThreshold(final String metric, final String okRange, final String warnRange,
final String critRange) throws BadThresholdException {
LegacyRange ok = null, warn = null, crit = null;
if (okRange != null) {
ok = new LegacyRange(okRange);
}
if (warnRange != null) {
warn = new LegacyRange(warnRange);
}
if (critRange != null) {
crit = new LegacyRange(critRange);
}
thresholds.addThreshold(new LegacyThreshold(metric, ok, warn, crit));
return this;
} | [
"public",
"final",
"ThresholdsEvaluatorBuilder",
"withLegacyThreshold",
"(",
"final",
"String",
"metric",
",",
"final",
"String",
"okRange",
",",
"final",
"String",
"warnRange",
",",
"final",
"String",
"critRange",
")",
"throws",
"BadThresholdException",
"{",
"LegacyR... | This method allows to specify thresholds using the old format.
@param metric
The metric for which this threshold must be configured
@param okRange
The ok range (can be null)
@param warnRange
The warning range (can be null)
@param critRange
The critical range (can be null).
@return this
@throws BadThresholdException If the threshold can't be
parsed. | [
"This",
"method",
"allows",
"to",
"specify",
"thresholds",
"using",
"the",
"old",
"format",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ThresholdsEvaluatorBuilder.java#L71-L87 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java | CmpUtil.lexCompare | public static <U extends Comparable<? super U>> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2) {
Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator();
while (it1.hasNext() && it2.hasNext()) {
int cmp = it1.next().compareTo(it2.next());
if (cmp != 0) {
return cmp;
}
}
if (it1.hasNext()) {
return 1;
} else if (it2.hasNext()) {
return -1;
}
return 0;
} | java | public static <U extends Comparable<? super U>> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2) {
Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator();
while (it1.hasNext() && it2.hasNext()) {
int cmp = it1.next().compareTo(it2.next());
if (cmp != 0) {
return cmp;
}
}
if (it1.hasNext()) {
return 1;
} else if (it2.hasNext()) {
return -1;
}
return 0;
} | [
"public",
"static",
"<",
"U",
"extends",
"Comparable",
"<",
"?",
"super",
"U",
">",
">",
"int",
"lexCompare",
"(",
"Iterable",
"<",
"?",
"extends",
"U",
">",
"o1",
",",
"Iterable",
"<",
"?",
"extends",
"U",
">",
"o2",
")",
"{",
"Iterator",
"<",
"?"... | Lexicographically compares two {@link Iterable}s, whose element types are comparable. | [
"Lexicographically",
"compares",
"two",
"{"
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java#L145-L161 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java | JNDIContentRepositoryBuilder.withContextProperty | public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) {
contextProperties.put(name, value);
return this;
} | java | public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) {
contextProperties.put(name, value);
return this;
} | [
"public",
"JNDIContentRepositoryBuilder",
"withContextProperty",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"contextProperties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new context property to the environment for the JNDI lookup context
@param name
the name of the environment variable
@param value
the value to assign to the variable
@return this test rule | [
"Adds",
"a",
"new",
"context",
"property",
"to",
"the",
"environment",
"for",
"the",
"JNDI",
"lookup",
"context"
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java#L131-L135 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnotBlend | public void setKnotBlend(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type);
rebuildGradient();
} | java | public void setKnotBlend(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type);
rebuildGradient();
} | [
"public",
"void",
"setKnotBlend",
"(",
"int",
"n",
",",
"int",
"type",
")",
"{",
"knotTypes",
"[",
"n",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"knotTypes",
"[",
"n",
"]",
"&",
"~",
"BLEND_MASK",
")",
"|",
"type",
")",
";",
"rebuildGradient",
"(",
... | Set a knot blend type.
@param n the knot index
@param type the knot blend type
@see #getKnotBlend | [
"Set",
"a",
"knot",
"blend",
"type",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L218-L221 |
vincentk/joptimizer | src/main/java/com/joptimizer/algebra/Matrix1NornRescaler.java | Matrix1NornRescaler.checkScaling | @Override
public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V){
int c = AOriginal.columns();
int r = AOriginal.rows();
final double[] maxValueHolder = new double[]{-Double.MAX_VALUE};
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij));
return pij;
}
};
DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V);
//view A row by row
boolean isOk = true;
for (int i = 0; isOk && i < r; i++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
//view A col by col
for (int j = 0; isOk && j < c; j++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
return isOk;
} | java | @Override
public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V){
int c = AOriginal.columns();
int r = AOriginal.rows();
final double[] maxValueHolder = new double[]{-Double.MAX_VALUE};
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij));
return pij;
}
};
DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V);
//view A row by row
boolean isOk = true;
for (int i = 0; isOk && i < r; i++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
//view A col by col
for (int j = 0; isOk && j < c; j++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
return isOk;
} | [
"@",
"Override",
"public",
"boolean",
"checkScaling",
"(",
"final",
"DoubleMatrix2D",
"AOriginal",
",",
"final",
"DoubleMatrix1D",
"U",
",",
"final",
"DoubleMatrix1D",
"V",
")",
"{",
"int",
"c",
"=",
"AOriginal",
".",
"columns",
"(",
")",
";",
"int",
"r",
... | Check if the scaling algorithm returned proper results.
Note that AOriginal cannot be only subdiagonal filled, because this check
is for both symm and bath notsymm matrices.
@param AOriginal the ORIGINAL (before scaling) matrix
@param U the return of the scaling algorithm
@param V the return of the scaling algorithm
@param base
@return | [
"Check",
"if",
"the",
"scaling",
"algorithm",
"returned",
"proper",
"results",
".",
"Note",
"that",
"AOriginal",
"cannot",
"be",
"only",
"subdiagonal",
"filled",
"because",
"this",
"check",
"is",
"for",
"both",
"symm",
"and",
"bath",
"notsymm",
"matrices",
"."... | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/algebra/Matrix1NornRescaler.java#L177-L210 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockTree.java | BlockTree.fillEntries | void fillEntries(TableKelp table,
TreeSet<TreeEntry> set,
int index)
{
byte []buffer = getBuffer();
int keyLength = table.getKeyLength();
int len = table.row().getTreeItemLength();
for (int ptr = index; ptr < BLOCK_SIZE; ptr += len) {
int code = buffer[ptr] & 0xff;
int min = ptr + 1;
int max = min + keyLength;
int valueOffset = max + keyLength;
byte []minKey = new byte[keyLength];
byte []maxKey = new byte[keyLength];
System.arraycopy(buffer, min, minKey, 0, keyLength);
System.arraycopy(buffer, max, maxKey, 0, keyLength);
int pid = BitsUtil.readInt(buffer, valueOffset);
TreeEntry entry = new TreeEntry(minKey, maxKey, code, pid);
set.add(entry);
}
} | java | void fillEntries(TableKelp table,
TreeSet<TreeEntry> set,
int index)
{
byte []buffer = getBuffer();
int keyLength = table.getKeyLength();
int len = table.row().getTreeItemLength();
for (int ptr = index; ptr < BLOCK_SIZE; ptr += len) {
int code = buffer[ptr] & 0xff;
int min = ptr + 1;
int max = min + keyLength;
int valueOffset = max + keyLength;
byte []minKey = new byte[keyLength];
byte []maxKey = new byte[keyLength];
System.arraycopy(buffer, min, minKey, 0, keyLength);
System.arraycopy(buffer, max, maxKey, 0, keyLength);
int pid = BitsUtil.readInt(buffer, valueOffset);
TreeEntry entry = new TreeEntry(minKey, maxKey, code, pid);
set.add(entry);
}
} | [
"void",
"fillEntries",
"(",
"TableKelp",
"table",
",",
"TreeSet",
"<",
"TreeEntry",
">",
"set",
",",
"int",
"index",
")",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"int",
"keyLength",
"=",
"table",
".",
"getKeyLength",
"(",
")",... | /*
void write(MaukaDatabase db, WriteStream os, int index)
throws IOException
{
byte []buffer = getBuffer();
int keyLength = db.getKeyLength();
int len = 2 * keyLength + 5;
for (int ptr = index; ptr < BLOCK_SIZE; ptr += len) {
int code = buffer[ptr] & 0xff;
if (code != INSERT) {
continue;
}
int pid = BitsUtil.readInt(buffer, ptr + len - 4);
if (pid == 0) {
throw new IllegalStateException();
}
os.write(buffer, ptr + 1, len - 1);
}
} | [
"/",
"*",
"void",
"write",
"(",
"MaukaDatabase",
"db",
"WriteStream",
"os",
"int",
"index",
")",
"throws",
"IOException",
"{",
"byte",
"[]",
"buffer",
"=",
"getBuffer",
"()",
";"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockTree.java#L355-L383 |
CloudSlang/score | worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java | ExecutionServiceImpl.handlePausedFlow | protected boolean handlePausedFlow(Execution execution) throws InterruptedException {
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = findPauseReason(execution.getExecutionId(), branchId);
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | java | protected boolean handlePausedFlow(Execution execution) throws InterruptedException {
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = findPauseReason(execution.getExecutionId(), branchId);
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | [
"protected",
"boolean",
"handlePausedFlow",
"(",
"Execution",
"execution",
")",
"throws",
"InterruptedException",
"{",
"String",
"branchId",
"=",
"execution",
".",
"getSystemContext",
"(",
")",
".",
"getBranchId",
"(",
")",
";",
"PauseReason",
"reason",
"=",
"find... | check if the execution should be Paused, and pause it if needed | [
"check",
"if",
"the",
"execution",
"should",
"be",
"Paused",
"and",
"pause",
"it",
"if",
"needed"
] | train | https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java#L270-L278 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/cfg/CompositeProcessEnginePlugin.java | CompositeProcessEnginePlugin.addProcessEnginePlugin | public CompositeProcessEnginePlugin addProcessEnginePlugin(ProcessEnginePlugin plugin, ProcessEnginePlugin... additionalPlugins) {
return this.addProcessEnginePlugins(toList(plugin, additionalPlugins));
} | java | public CompositeProcessEnginePlugin addProcessEnginePlugin(ProcessEnginePlugin plugin, ProcessEnginePlugin... additionalPlugins) {
return this.addProcessEnginePlugins(toList(plugin, additionalPlugins));
} | [
"public",
"CompositeProcessEnginePlugin",
"addProcessEnginePlugin",
"(",
"ProcessEnginePlugin",
"plugin",
",",
"ProcessEnginePlugin",
"...",
"additionalPlugins",
")",
"{",
"return",
"this",
".",
"addProcessEnginePlugins",
"(",
"toList",
"(",
"plugin",
",",
"additionalPlugin... | Add one (or more) plugins.
@param plugin first plugin
@param additionalPlugins additional vararg plugins
@return self for fluent usage | [
"Add",
"one",
"(",
"or",
"more",
")",
"plugins",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/CompositeProcessEnginePlugin.java#L72-L74 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java | BatchUpdateDaemon.pushCacheEntry | public synchronized void pushCacheEntry(CacheEntry cacheEntry, DCache cache) {
BatchUpdateList bul = getUpdateList(cache);
bul.pushCacheEntryEvents.add(cacheEntry);
} | java | public synchronized void pushCacheEntry(CacheEntry cacheEntry, DCache cache) {
BatchUpdateList bul = getUpdateList(cache);
bul.pushCacheEntryEvents.add(cacheEntry);
} | [
"public",
"synchronized",
"void",
"pushCacheEntry",
"(",
"CacheEntry",
"cacheEntry",
",",
"DCache",
"cache",
")",
"{",
"BatchUpdateList",
"bul",
"=",
"getUpdateList",
"(",
"cache",
")",
";",
"bul",
".",
"pushCacheEntryEvents",
".",
"add",
"(",
"cacheEntry",
")",... | This allows a cache entry to be added to the BatchUpdateDaemon.
The cache entry will be added to all caches.
@param cacheEntry The cache entry to be added. | [
"This",
"allows",
"a",
"cache",
"entry",
"to",
"be",
"added",
"to",
"the",
"BatchUpdateDaemon",
".",
"The",
"cache",
"entry",
"will",
"be",
"added",
"to",
"all",
"caches",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L191-L194 |
ontop/ontop | mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpression.java | RAExpression.naturalJoin | public static RAExpression naturalJoin(RAExpression re1, RAExpression re2, TermFactory termFactory) throws IllegalJoinException {
ImmutableSet<QuotedID> shared =
RAExpressionAttributes.getShared(re1.attributes, re2.attributes);
RAExpressionAttributes attributes =
RAExpressionAttributes.joinUsing(re1.attributes, re2.attributes, shared);
return new RAExpression(union(re1.dataAtoms, re2.dataAtoms),
union(re1.filterAtoms, re2.filterAtoms,
getJoinOnFilter(re1.attributes, re2.attributes, shared, termFactory)),
attributes, termFactory);
} | java | public static RAExpression naturalJoin(RAExpression re1, RAExpression re2, TermFactory termFactory) throws IllegalJoinException {
ImmutableSet<QuotedID> shared =
RAExpressionAttributes.getShared(re1.attributes, re2.attributes);
RAExpressionAttributes attributes =
RAExpressionAttributes.joinUsing(re1.attributes, re2.attributes, shared);
return new RAExpression(union(re1.dataAtoms, re2.dataAtoms),
union(re1.filterAtoms, re2.filterAtoms,
getJoinOnFilter(re1.attributes, re2.attributes, shared, termFactory)),
attributes, termFactory);
} | [
"public",
"static",
"RAExpression",
"naturalJoin",
"(",
"RAExpression",
"re1",
",",
"RAExpression",
"re2",
",",
"TermFactory",
"termFactory",
")",
"throws",
"IllegalJoinException",
"{",
"ImmutableSet",
"<",
"QuotedID",
">",
"shared",
"=",
"RAExpressionAttributes",
"."... | NATURAL JOIN
@param re1 a {@link RAExpression}
@param re2 a {@link RAExpression}
@return a {@link RAExpression}
@throws IllegalJoinException if the same alias occurs in both arguments
or one of the shared attributes is ambiguous | [
"NATURAL",
"JOIN"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpression.java#L105-L117 |
rollbar/rollbar-java | rollbar-android/src/main/java/com/rollbar/android/Rollbar.java | Rollbar.reportException | @Deprecated
public static void reportException(final Throwable throwable, final String level, final String description, final Map<String, String> params) {
ensureInit(new Runnable() {
@Override
public void run() {
notifier.log(throwable, params != null ? Collections.<String, Object>unmodifiableMap(params) : null, description, Level.lookupByName(level));
}
});
} | java | @Deprecated
public static void reportException(final Throwable throwable, final String level, final String description, final Map<String, String> params) {
ensureInit(new Runnable() {
@Override
public void run() {
notifier.log(throwable, params != null ? Collections.<String, Object>unmodifiableMap(params) : null, description, Level.lookupByName(level));
}
});
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"reportException",
"(",
"final",
"Throwable",
"throwable",
",",
"final",
"String",
"level",
",",
"final",
"String",
"description",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"ens... | report an exception to Rollbar, specifying the level, adding a custom description,
and including extra data.
@param throwable the exception that occurred.
@param level the severity level.
@param description the extra description.
@param params the extra custom data. | [
"report",
"an",
"exception",
"to",
"Rollbar",
"specifying",
"the",
"level",
"adding",
"a",
"custom",
"description",
"and",
"including",
"extra",
"data",
"."
] | train | https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L845-L853 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/ClassFile.java | ClassFile.referencesMethod | public boolean referencesMethod(ExecutableElement method)
{
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String fullyQualifiedname = declaringClass.getQualifiedName().toString();
String name = method.getSimpleName().toString();
assert name.indexOf('.') == -1;
String descriptor = Descriptor.getDesriptor(method);
return getRefIndex(Methodref.class, fullyQualifiedname, name, descriptor) != -1;
} | java | public boolean referencesMethod(ExecutableElement method)
{
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String fullyQualifiedname = declaringClass.getQualifiedName().toString();
String name = method.getSimpleName().toString();
assert name.indexOf('.') == -1;
String descriptor = Descriptor.getDesriptor(method);
return getRefIndex(Methodref.class, fullyQualifiedname, name, descriptor) != -1;
} | [
"public",
"boolean",
"referencesMethod",
"(",
"ExecutableElement",
"method",
")",
"{",
"TypeElement",
"declaringClass",
"=",
"(",
"TypeElement",
")",
"method",
".",
"getEnclosingElement",
"(",
")",
";",
"String",
"fullyQualifiedname",
"=",
"declaringClass",
".",
"ge... | Return true if class contains method ref to given method
@param method
@return | [
"Return",
"true",
"if",
"class",
"contains",
"method",
"ref",
"to",
"given",
"method"
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/ClassFile.java#L636-L644 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.commitTransaction | public void commitTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION, 1, streamTags(scope, streamName));
commitTransactionLatency.reportSuccessValue(latency.toMillis());
} | java | public void commitTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION, 1, streamTags(scope, streamName));
commitTransactionLatency.reportSuccessValue(latency.toMillis());
} | [
"public",
"void",
"commitTransaction",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"Duration",
"latency",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"COMMIT_TRANSACTION",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER... | This method increments the global and Stream-related counters of committed Transactions and reports the latency
of the operation.
@param scope Scope.
@param streamName Name of the Stream.
@param latency Latency of the commit Transaction operation. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"committed",
"Transactions",
"and",
"reports",
"the",
"latency",
"of",
"the",
"operation",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L71-L75 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/neighborhood/util/TwoDimensionalMesh.java | TwoDimensionalMesh.getNeighbors | public List<S> getNeighbors(List<S> solutionList, int solutionPosition) {
if (solutionList == null) {
throw new JMetalException("The solution list is null") ;
} else if (solutionList.size() == 0) {
throw new JMetalException("The solution list is empty") ;
} else if (solutionPosition < 0) {
throw new JMetalException("The solution position value is negative: " + solutionPosition) ;
} else if (solutionList.size() != rows * columns) {
throw new JMetalException("The solution list size " + solutionList.size() + " is not"
+ "equal to the grid size: " + rows + " * " + columns) ;
}
else if (solutionPosition >= solutionList.size()) {
throw new JMetalException("The solution position value " + solutionPosition +
" is equal or greater than the solution list size "
+ solutionList.size()) ;
}
return findNeighbors(solutionList, solutionPosition, neighborhood);
} | java | public List<S> getNeighbors(List<S> solutionList, int solutionPosition) {
if (solutionList == null) {
throw new JMetalException("The solution list is null") ;
} else if (solutionList.size() == 0) {
throw new JMetalException("The solution list is empty") ;
} else if (solutionPosition < 0) {
throw new JMetalException("The solution position value is negative: " + solutionPosition) ;
} else if (solutionList.size() != rows * columns) {
throw new JMetalException("The solution list size " + solutionList.size() + " is not"
+ "equal to the grid size: " + rows + " * " + columns) ;
}
else if (solutionPosition >= solutionList.size()) {
throw new JMetalException("The solution position value " + solutionPosition +
" is equal or greater than the solution list size "
+ solutionList.size()) ;
}
return findNeighbors(solutionList, solutionPosition, neighborhood);
} | [
"public",
"List",
"<",
"S",
">",
"getNeighbors",
"(",
"List",
"<",
"S",
">",
"solutionList",
",",
"int",
"solutionPosition",
")",
"{",
"if",
"(",
"solutionList",
"==",
"null",
")",
"{",
"throw",
"new",
"JMetalException",
"(",
"\"The solution list is null\"",
... | Returns the north,south, east, and west solutions of a given solution
@param solutionList the solution set from where the neighbors are taken
@param solutionPosition Represents the position of the solution | [
"Returns",
"the",
"north",
"south",
"east",
"and",
"west",
"solutions",
"of",
"a",
"given",
"solution",
"@param",
"solutionList",
"the",
"solution",
"set",
"from",
"where",
"the",
"neighbors",
"are",
"taken",
"@param",
"solutionPosition",
"Represents",
"the",
"p... | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/neighborhood/util/TwoDimensionalMesh.java#L119-L137 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_server.java | sms_server.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
sms_server_responses result = (sms_server_responses) service.get_payload_formatter().string_to_resource(sms_server_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sms_server_response_array);
}
sms_server[] result_sms_server = new sms_server[result.sms_server_response_array.length];
for(int i = 0; i < result.sms_server_response_array.length; i++)
{
result_sms_server[i] = result.sms_server_response_array[i].sms_server[0];
}
return result_sms_server;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
sms_server_responses result = (sms_server_responses) service.get_payload_formatter().string_to_resource(sms_server_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sms_server_response_array);
}
sms_server[] result_sms_server = new sms_server[result.sms_server_response_array.length];
for(int i = 0; i < result.sms_server_response_array.length; i++)
{
result_sms_server[i] = result.sms_server_response_array[i].sms_server[0];
}
return result_sms_server;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"sms_server_responses",
"result",
"=",
"(",
"sms_server_responses",
")",
"service",
".",
"get_payload_formatte... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_server.java#L683-L700 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java | RangeHashFunction.searchBucketIndex | protected int searchBucketIndex(byte[] key, int leftIndex, int rightIndex) {
if (KeyUtils.compareKey(key, maxRangeValues[rightIndex]) > 0) {
return 0;
}
int idx = Arrays.binarySearch(maxRangeValues, leftIndex, rightIndex, key, new ByteArrayComparator());
idx = idx < 0 ? -idx - 1 : idx;
if (idx > rightIndex) {
return -1;
} else {
return idx;
}
} | java | protected int searchBucketIndex(byte[] key, int leftIndex, int rightIndex) {
if (KeyUtils.compareKey(key, maxRangeValues[rightIndex]) > 0) {
return 0;
}
int idx = Arrays.binarySearch(maxRangeValues, leftIndex, rightIndex, key, new ByteArrayComparator());
idx = idx < 0 ? -idx - 1 : idx;
if (idx > rightIndex) {
return -1;
} else {
return idx;
}
} | [
"protected",
"int",
"searchBucketIndex",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"leftIndex",
",",
"int",
"rightIndex",
")",
"{",
"if",
"(",
"KeyUtils",
".",
"compareKey",
"(",
"key",
",",
"maxRangeValues",
"[",
"rightIndex",
"]",
")",
">",
"0",
")",
... | Searches for the given <code>key</code> in {@link #maxRangeValues} and returns the index of the corresponding
range. Remember: this may not be the bucketId | [
"Searches",
"for",
"the",
"given",
"<code",
">",
"key<",
"/",
"code",
">",
"in",
"{"
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L195-L206 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkTypeArgument | private static int checkTypeArgument(final String signature, int pos) {
// TypeArgument:
// * | ( ( + | - )? FieldTypeSignature )
char c = getChar(signature, pos);
if (c == '*') {
return pos + 1;
} else if (c == '+' || c == '-') {
pos++;
}
return checkFieldTypeSignature(signature, pos);
} | java | private static int checkTypeArgument(final String signature, int pos) {
// TypeArgument:
// * | ( ( + | - )? FieldTypeSignature )
char c = getChar(signature, pos);
if (c == '*') {
return pos + 1;
} else if (c == '+' || c == '-') {
pos++;
}
return checkFieldTypeSignature(signature, pos);
} | [
"private",
"static",
"int",
"checkTypeArgument",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// TypeArgument:",
"// * | ( ( + | - )? FieldTypeSignature )",
"char",
"c",
"=",
"getChar",
"(",
"signature",
",",
"pos",
")",
";",
"if",
"(",
"c"... | Checks a type argument in a class type signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"a",
"type",
"argument",
"in",
"a",
"class",
"type",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L898-L909 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java | ContentSpecBuilder.buildBook | public byte[] buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions,
final BuildType buildType) throws BuilderCreationException, BuildProcessingException {
return buildBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), buildType);
} | java | public byte[] buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions,
final BuildType buildType) throws BuilderCreationException, BuildProcessingException {
return buildBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), buildType);
} | [
"public",
"byte",
"[",
"]",
"buildBook",
"(",
"final",
"ContentSpec",
"contentSpec",
",",
"final",
"String",
"requester",
",",
"final",
"DocBookBuildingOptions",
"builderOptions",
",",
"final",
"BuildType",
"buildType",
")",
"throws",
"BuilderCreationException",
",",
... | Builds a book into a zip file for the passed Content Specification.
@param contentSpec The content specification that is to be built. It should have already been validated, if not errors may occur.
@param requester The user who requested the book to be built.
@param builderOptions The set of options what are to be when building the book.
@param buildType
@return A byte array that is the zip file
@throws BuildProcessingException Any unexpected errors that occur during building.
@throws BuilderCreationException Any error that occurs while trying to setup/create the builder | [
"Builds",
"a",
"book",
"into",
"a",
"zip",
"file",
"for",
"the",
"passed",
"Content",
"Specification",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java#L81-L84 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.checkRole | public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkRole(dbc, role);
} finally {
dbc.clear();
}
} | java | public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkRole(dbc, role);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"checkRole",
"(",
"CmsRequestContext",
"context",
",",
"CmsRole",
"role",
")",
"throws",
"CmsRoleViolationException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"try",
"{",
"checkRole",
"... | Checks if the user of the current context has permissions to impersonate the given role.<p>
If the organizational unit is <code>null</code>, this method will check if the
given user has the given role for at least one organizational unit.<p>
@param context the current request context
@param role the role to check
@throws CmsRoleViolationException if the user does not have the required role permissions | [
"Checks",
"if",
"the",
"user",
"of",
"the",
"current",
"context",
"has",
"permissions",
"to",
"impersonate",
"the",
"given",
"role",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L584-L592 |
jenkinsci/jenkins | core/src/main/java/hudson/util/ArgumentListBuilder.java | ArgumentListBuilder.addKeyValuePairsFromPropertyString | public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr) throws IOException {
return addKeyValuePairsFromPropertyString(prefix, properties, vr, null);
} | java | public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr) throws IOException {
return addKeyValuePairsFromPropertyString(prefix, properties, vr, null);
} | [
"public",
"ArgumentListBuilder",
"addKeyValuePairsFromPropertyString",
"(",
"String",
"prefix",
",",
"String",
"properties",
",",
"VariableResolver",
"<",
"String",
">",
"vr",
")",
"throws",
"IOException",
"{",
"return",
"addKeyValuePairsFromPropertyString",
"(",
"prefix"... | Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}.
@param prefix
The '-D' portion of the example. Defaults to -D if null.
@param properties
The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which
case this method becomes no-op.
@param vr
{@link VariableResolver} to resolve variables in properties string.
@since 1.262 | [
"Adds",
"key",
"value",
"pairs",
"as",
"-",
"Dkey",
"=",
"value",
"-",
"Dkey",
"=",
"value",
"...",
"by",
"parsing",
"a",
"given",
"string",
"using",
"{",
"@link",
"Properties",
"}",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ArgumentListBuilder.java#L208-L210 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier.java | streamidentifier.get | public static streamidentifier get(nitro_service service, String name) throws Exception{
streamidentifier obj = new streamidentifier();
obj.set_name(name);
streamidentifier response = (streamidentifier) obj.get_resource(service);
return response;
} | java | public static streamidentifier get(nitro_service service, String name) throws Exception{
streamidentifier obj = new streamidentifier();
obj.set_name(name);
streamidentifier response = (streamidentifier) obj.get_resource(service);
return response;
} | [
"public",
"static",
"streamidentifier",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"streamidentifier",
"obj",
"=",
"new",
"streamidentifier",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch streamidentifier resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"streamidentifier",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier.java#L376-L381 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/state/StateBasedGame.java | StateBasedGame.enterState | public void enterState(int id, Transition leave, Transition enter) {
if (leave == null) {
leave = new EmptyTransition();
}
if (enter == null) {
enter = new EmptyTransition();
}
leaveTransition = leave;
enterTransition = enter;
nextState = getState(id);
if (nextState == null) {
throw new RuntimeException("No game state registered with the ID: "+id);
}
leaveTransition.init(currentState, nextState);
} | java | public void enterState(int id, Transition leave, Transition enter) {
if (leave == null) {
leave = new EmptyTransition();
}
if (enter == null) {
enter = new EmptyTransition();
}
leaveTransition = leave;
enterTransition = enter;
nextState = getState(id);
if (nextState == null) {
throw new RuntimeException("No game state registered with the ID: "+id);
}
leaveTransition.init(currentState, nextState);
} | [
"public",
"void",
"enterState",
"(",
"int",
"id",
",",
"Transition",
"leave",
",",
"Transition",
"enter",
")",
"{",
"if",
"(",
"leave",
"==",
"null",
")",
"{",
"leave",
"=",
"new",
"EmptyTransition",
"(",
")",
";",
"}",
"if",
"(",
"enter",
"==",
"nul... | Enter a particular game state with the transitions provided
@param id The ID of the state to enter
@param leave The transition to use when leaving the current state
@param enter The transition to use when entering the new state | [
"Enter",
"a",
"particular",
"game",
"state",
"with",
"the",
"transitions",
"provided"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/state/StateBasedGame.java#L141-L157 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagContainer.java | CmsJspTagContainer.printElementErrorTag | private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception)
throws IOException {
if (m_editableRequest) {
String stacktrace = CmsException.getStackTraceAsString(exception);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) {
stacktrace = null;
} else {
// stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);
stacktrace = CmsEncoder.escapeXml(stacktrace);
}
StringBuffer errorBox = new StringBuffer(256);
errorBox.append(
"<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\"");
errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR);
errorBox.append("\">");
errorBox.append(
Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath));
errorBox.append("<br />");
errorBox.append(exception.getLocalizedMessage());
if (stacktrace != null) {
errorBox.append(
"<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">");
errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0));
String title = Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath);
errorBox.append("<span title=\"");
errorBox.append(CmsEncoder.escapeXml(title));
errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">");
errorBox.append(stacktrace);
errorBox.append("</span></span>");
}
errorBox.append("</div>");
pageContext.getOut().print(errorBox.toString());
}
} | java | private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception)
throws IOException {
if (m_editableRequest) {
String stacktrace = CmsException.getStackTraceAsString(exception);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) {
stacktrace = null;
} else {
// stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);
stacktrace = CmsEncoder.escapeXml(stacktrace);
}
StringBuffer errorBox = new StringBuffer(256);
errorBox.append(
"<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\"");
errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR);
errorBox.append("\">");
errorBox.append(
Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath));
errorBox.append("<br />");
errorBox.append(exception.getLocalizedMessage());
if (stacktrace != null) {
errorBox.append(
"<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">");
errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0));
String title = Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath);
errorBox.append("<span title=\"");
errorBox.append(CmsEncoder.escapeXml(title));
errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">");
errorBox.append(stacktrace);
errorBox.append("</span></span>");
}
errorBox.append("</div>");
pageContext.getOut().print(errorBox.toString());
}
} | [
"private",
"void",
"printElementErrorTag",
"(",
"String",
"elementSitePath",
",",
"String",
"formatterSitePath",
",",
"Exception",
"exception",
")",
"throws",
"IOException",
"{",
"if",
"(",
"m_editableRequest",
")",
"{",
"String",
"stacktrace",
"=",
"CmsException",
... | Prints an element error tag to the response out.<p>
@param elementSitePath the element site path
@param formatterSitePath the formatter site path
@param exception the exception causing the error
@throws IOException if something goes wrong writing to response out | [
"Prints",
"an",
"element",
"error",
"tag",
"to",
"the",
"response",
"out",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagContainer.java#L1304-L1344 |
virgo47/javasimon | console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java | CallTreeDetailPlugin.executeJson | @Override
public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) {
ObjectJS callTreeJS;
if (isCallTreeCallbackRegistered(context)) {
CallTree callTree = getData(simon);
if (callTree == null) {
callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringifierFactory);
} else {
callTreeJS = ObjectJS.create(callTree, jsonStringifierFactory);
callTreeJS.setAttribute("rootNode", jsonTreeNode(callTree.getRootNode(), jsonStringifierFactory));
}
} else {
callTreeJS = jsonMessage(NO_CALLBACK_MESSAGE, jsonStringifierFactory);
}
return callTreeJS;
} | java | @Override
public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) {
ObjectJS callTreeJS;
if (isCallTreeCallbackRegistered(context)) {
CallTree callTree = getData(simon);
if (callTree == null) {
callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringifierFactory);
} else {
callTreeJS = ObjectJS.create(callTree, jsonStringifierFactory);
callTreeJS.setAttribute("rootNode", jsonTreeNode(callTree.getRootNode(), jsonStringifierFactory));
}
} else {
callTreeJS = jsonMessage(NO_CALLBACK_MESSAGE, jsonStringifierFactory);
}
return callTreeJS;
} | [
"@",
"Override",
"public",
"ObjectJS",
"executeJson",
"(",
"ActionContext",
"context",
",",
"StringifierFactory",
"jsonStringifierFactory",
",",
"Simon",
"simon",
")",
"{",
"ObjectJS",
"callTreeJS",
";",
"if",
"(",
"isCallTreeCallbackRegistered",
"(",
"context",
")",
... | Generate a JSON call tree object or an error string if no call tree | [
"Generate",
"a",
"JSON",
"call",
"tree",
"object",
"or",
"an",
"error",
"string",
"if",
"no",
"call",
"tree"
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L145-L160 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/EngineConfiguration.java | EngineConfiguration.nullSafeIntegerComparison | private static int nullSafeIntegerComparison(Integer o1, Integer o2) {
return o1 != null ? o2 != null ? o1.compareTo(o2) : -1 : o2 != null ? 1 : 0;
} | java | private static int nullSafeIntegerComparison(Integer o1, Integer o2) {
return o1 != null ? o2 != null ? o1.compareTo(o2) : -1 : o2 != null ? 1 : 0;
} | [
"private",
"static",
"int",
"nullSafeIntegerComparison",
"(",
"Integer",
"o1",
",",
"Integer",
"o2",
")",
"{",
"return",
"o1",
"!=",
"null",
"?",
"o2",
"!=",
"null",
"?",
"o1",
".",
"compareTo",
"(",
"o2",
")",
":",
"-",
"1",
":",
"o2",
"!=",
"null",... | Compares {@code Integer} types, taking into account possible {@code null}
values. When {@code null}, then the return value will be such that the
other value will come first in a comparison. If both values are {@code null},
then they are effectively equal.
@param o1 The first value to compare.
@param o2 The second value to compare.
@return -1, 0, or 1 if the first value should come before, equal to, or
after the second. | [
"Compares",
"{",
"@code",
"Integer",
"}",
"types",
"taking",
"into",
"account",
"possible",
"{",
"@code",
"null",
"}",
"values",
".",
"When",
"{",
"@code",
"null",
"}",
"then",
"the",
"return",
"value",
"will",
"be",
"such",
"that",
"the",
"other",
"valu... | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/EngineConfiguration.java#L334-L336 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/ExecutableElementParamInfo.java | ExecutableElementParamInfo.addGenericTypes | void addGenericTypes(String paramName, Map<String, Object> generics) {
genericTypes.put(paramName, generics);
} | java | void addGenericTypes(String paramName, Map<String, Object> generics) {
genericTypes.put(paramName, generics);
} | [
"void",
"addGenericTypes",
"(",
"String",
"paramName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"generics",
")",
"{",
"genericTypes",
".",
"put",
"(",
"paramName",
",",
"generics",
")",
";",
"}"
] | Adds generics info for the given parameter name.
@param paramName The parameter name
@param generics The generics info | [
"Adds",
"generics",
"info",
"for",
"the",
"given",
"parameter",
"name",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ExecutableElementParamInfo.java#L72-L74 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java | LocaleUtils.getAvailableLocaleSuffixes | public static List<String> getAvailableLocaleSuffixes(String messageBundle, ServletContext servletContext) {
return getAvailableLocaleSuffixes(messageBundle, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext);
} | java | public static List<String> getAvailableLocaleSuffixes(String messageBundle, ServletContext servletContext) {
return getAvailableLocaleSuffixes(messageBundle, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getAvailableLocaleSuffixes",
"(",
"String",
"messageBundle",
",",
"ServletContext",
"servletContext",
")",
"{",
"return",
"getAvailableLocaleSuffixes",
"(",
"messageBundle",
",",
"MSG_RESOURCE_BUNDLE_SUFFIX",
",",
"servletC... | Returns the list of available locale suffixes for a message resource
bundle
@param messageBundle
the resource bundle path
@param servletContext
the servlet context
@return the list of available locale suffixes for a message resource
bundle | [
"Returns",
"the",
"list",
"of",
"available",
"locale",
"suffixes",
"for",
"a",
"message",
"resource",
"bundle"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L180-L183 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setReplicatedMapConfigs | public Config setReplicatedMapConfigs(Map<String, ReplicatedMapConfig> replicatedMapConfigs) {
this.replicatedMapConfigs.clear();
this.replicatedMapConfigs.putAll(replicatedMapConfigs);
for (final Entry<String, ReplicatedMapConfig> entry : this.replicatedMapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setReplicatedMapConfigs(Map<String, ReplicatedMapConfig> replicatedMapConfigs) {
this.replicatedMapConfigs.clear();
this.replicatedMapConfigs.putAll(replicatedMapConfigs);
for (final Entry<String, ReplicatedMapConfig> entry : this.replicatedMapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setReplicatedMapConfigs",
"(",
"Map",
"<",
"String",
",",
"ReplicatedMapConfig",
">",
"replicatedMapConfigs",
")",
"{",
"this",
".",
"replicatedMapConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"replicatedMapConfigs",
".",
"putAll",
"(",
... | Sets the map of {@link com.hazelcast.core.ReplicatedMap} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param replicatedMapConfigs the replicated map configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"core",
".",
"ReplicatedMap",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1197-L1204 |
jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java | FluentIterableWrapper.filter | @CheckReturnValue
public final <F extends E> FluentIterableWrapper<F> filter(Class<F> clazz) {
return from(Iterables.filter(iterable, clazz));
} | java | @CheckReturnValue
public final <F extends E> FluentIterableWrapper<F> filter(Class<F> clazz) {
return from(Iterables.filter(iterable, clazz));
} | [
"@",
"CheckReturnValue",
"public",
"final",
"<",
"F",
"extends",
"E",
">",
"FluentIterableWrapper",
"<",
"F",
">",
"filter",
"(",
"Class",
"<",
"F",
">",
"clazz",
")",
"{",
"return",
"from",
"(",
"Iterables",
".",
"filter",
"(",
"iterable",
",",
"clazz",... | Returns the elements from this fluent iterable that are instances of the supplied type. The
resulting fluent iterable's iterator does not support {@code remove()}.
@since 1.25.0 | [
"Returns",
"the",
"elements",
"from",
"this",
"fluent",
"iterable",
"that",
"are",
"instances",
"of",
"the",
"supplied",
"type",
".",
"The",
"resulting",
"fluent",
"iterable",
"s",
"iterator",
"does",
"not",
"support",
"{"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java#L87-L90 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java | TopologyBuilder.setBolt | public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) {
validateComponentName(id);
BoltDeclarer b = new BoltDeclarer(id, bolt, parallelismHint);
bolts.put(id, b);
return b;
} | java | public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) {
validateComponentName(id);
BoltDeclarer b = new BoltDeclarer(id, bolt, parallelismHint);
bolts.put(id, b);
return b;
} | [
"public",
"BoltDeclarer",
"setBolt",
"(",
"String",
"id",
",",
"IRichBolt",
"bolt",
",",
"Number",
"parallelismHint",
")",
"{",
"validateComponentName",
"(",
"id",
")",
";",
"BoltDeclarer",
"b",
"=",
"new",
"BoltDeclarer",
"(",
"id",
",",
"bolt",
",",
"paral... | Define a new bolt in this topology with the specified amount of parallelism.
@param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs.
@param bolt the bolt
@param parallelismHint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somewhere around the cluster.
@return use the returned object to declare the inputs to this component | [
"Define",
"a",
"new",
"bolt",
"in",
"this",
"topology",
"with",
"the",
"specified",
"amount",
"of",
"parallelism",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java#L128-L133 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.findOne | public static <E> E findOne(E[] array, Predicate<E> predicate) {
final Iterator<E> filtered = Filtering.filter(new ArrayIterator<E>(array), predicate);
return new OneElement<E>().apply(filtered);
} | java | public static <E> E findOne(E[] array, Predicate<E> predicate) {
final Iterator<E> filtered = Filtering.filter(new ArrayIterator<E>(array), predicate);
return new OneElement<E>().apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"findOne",
"(",
"E",
"[",
"]",
"array",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Iterator",
"<",
"E",
">",
"filtered",
"=",
"Filtering",
".",
"filter",
"(",
"new",
"ArrayIterator",
"<",... | Searches the only matching element returning it.
@param <E> the element type parameter
@param array the array to be searched
@param predicate the predicate to be applied to each element
@throws IllegalStateException if more than one element is found
@throws IllegalArgumentException if no element matches
@return the found element | [
"Searches",
"the",
"only",
"matching",
"element",
"returning",
"it",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L541-L544 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java | RaftNodeImpl.invalidateFuturesFrom | public void invalidateFuturesFrom(long entryIndex) {
int count = 0;
Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, SimpleCompletableFuture> entry = iterator.next();
long index = entry.getKey();
if (index >= entryIndex) {
entry.getValue().setResult(new LeaderDemotedException(localMember, state.leader()));
iterator.remove();
count++;
}
}
if (count > 0) {
logger.warning("Invalidated " + count + " futures from log index: " + entryIndex);
}
} | java | public void invalidateFuturesFrom(long entryIndex) {
int count = 0;
Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, SimpleCompletableFuture> entry = iterator.next();
long index = entry.getKey();
if (index >= entryIndex) {
entry.getValue().setResult(new LeaderDemotedException(localMember, state.leader()));
iterator.remove();
count++;
}
}
if (count > 0) {
logger.warning("Invalidated " + count + " futures from log index: " + entryIndex);
}
} | [
"public",
"void",
"invalidateFuturesFrom",
"(",
"long",
"entryIndex",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Iterator",
"<",
"Entry",
"<",
"Long",
",",
"SimpleCompletableFuture",
">",
">",
"iterator",
"=",
"futures",
".",
"entrySet",
"(",
")",
".",
"ite... | Invalidates futures registered with indexes {@code >= entryIndex}. Note that {@code entryIndex} is inclusive.
{@link LeaderDemotedException} is set a result to futures. | [
"Invalidates",
"futures",
"registered",
"with",
"indexes",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java#L685-L701 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java | RouteFilterRulesInner.listByRouteFilterWithServiceResponseAsync | public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> listByRouteFilterWithServiceResponseAsync(final String resourceGroupName, final String routeFilterName) {
return listByRouteFilterSinglePageAsync(resourceGroupName, routeFilterName)
.concatMap(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Observable<ServiceResponse<Page<RouteFilterRuleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> call(ServiceResponse<Page<RouteFilterRuleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByRouteFilterNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> listByRouteFilterWithServiceResponseAsync(final String resourceGroupName, final String routeFilterName) {
return listByRouteFilterSinglePageAsync(resourceGroupName, routeFilterName)
.concatMap(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Observable<ServiceResponse<Page<RouteFilterRuleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> call(ServiceResponse<Page<RouteFilterRuleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByRouteFilterNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"RouteFilterRuleInner",
">",
">",
">",
"listByRouteFilterWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"routeFilterName",
")",
"{",
"return",
"listByRoute... | Gets all RouteFilterRules in a route filter.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RouteFilterRuleInner> object | [
"Gets",
"all",
"RouteFilterRules",
"in",
"a",
"route",
"filter",
"."
] | 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/RouteFilterRulesInner.java#L790-L802 |
calimero-project/calimero-core | src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java | KNXNetworkLinkIP.newSecureRoutingLink | public static KNXNetworkLinkIP newSecureRoutingLink(final NetworkInterface netif, final InetAddress mcGroup, final byte[] groupKey,
final Duration latencyTolerance, final KNXMediumSettings settings) throws KNXException {
return new KNXNetworkLinkIP(ROUTING, SecureConnection.newRouting(netif, mcGroup, groupKey, latencyTolerance),
settings);
} | java | public static KNXNetworkLinkIP newSecureRoutingLink(final NetworkInterface netif, final InetAddress mcGroup, final byte[] groupKey,
final Duration latencyTolerance, final KNXMediumSettings settings) throws KNXException {
return new KNXNetworkLinkIP(ROUTING, SecureConnection.newRouting(netif, mcGroup, groupKey, latencyTolerance),
settings);
} | [
"public",
"static",
"KNXNetworkLinkIP",
"newSecureRoutingLink",
"(",
"final",
"NetworkInterface",
"netif",
",",
"final",
"InetAddress",
"mcGroup",
",",
"final",
"byte",
"[",
"]",
"groupKey",
",",
"final",
"Duration",
"latencyTolerance",
",",
"final",
"KNXMediumSetting... | Creates a new secure network link using the KNX IP Secure Routing protocol.
@param netif local network interface used to join the multicast group and for sending
@param mcGroup address of the multicast group to join, use {@link #DefaultMulticast} for the default KNX IP
multicast address
@param groupKey KNX IP Secure group key (backbone key), <code>groupKey.length == 16</code>
@param latencyTolerance time window for accepting secure multicasts, depending on max. end-to-end network latency
(typically 500 ms to 5000 ms), <code>0 < latencyTolerance.toMillis() ≤ 8000</code>
@param settings medium settings defining device and medium specifics needed for communication
@return the network link in open state
@throws KNXException on failure establishing link using the KNXnet/IP connection | [
"Creates",
"a",
"new",
"secure",
"network",
"link",
"using",
"the",
"KNX",
"IP",
"Secure",
"Routing",
"protocol",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L197-L201 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/SassRubyGenerator.java | SassRubyGenerator.buildScript | private String buildScript(String path, String content) {
StringBuilder script = new StringBuilder();
script.append("require 'rubygems'\n" + "require 'sass/plugin'\n" + "require 'sass/engine'\n");
content = SassRubyUtils.normalizeMultiByteString(content);
script.append(String.format(
"customImporter = Sass::Importers::JawrImporter.new(@jawrResolver) \n" + "name = \"%s\"\n"
+ "result = Sass::Engine.new(\"%s\", {:importer => customImporter, :filename => name, :syntax => :scss, :cache => false}).render",
path, content.replace("\"", "\\\"").replace("#", "\\#")));
return script.toString();
} | java | private String buildScript(String path, String content) {
StringBuilder script = new StringBuilder();
script.append("require 'rubygems'\n" + "require 'sass/plugin'\n" + "require 'sass/engine'\n");
content = SassRubyUtils.normalizeMultiByteString(content);
script.append(String.format(
"customImporter = Sass::Importers::JawrImporter.new(@jawrResolver) \n" + "name = \"%s\"\n"
+ "result = Sass::Engine.new(\"%s\", {:importer => customImporter, :filename => name, :syntax => :scss, :cache => false}).render",
path, content.replace("\"", "\\\"").replace("#", "\\#")));
return script.toString();
} | [
"private",
"String",
"buildScript",
"(",
"String",
"path",
",",
"String",
"content",
")",
"{",
"StringBuilder",
"script",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"script",
".",
"append",
"(",
"\"require 'rubygems'\\n\"",
"+",
"\"require 'sass/plugin'\\n\"",
"+... | Builds the ruby script to execute
@param path
the resource path
@param content
the resource content
@return the ruby script to execute | [
"Builds",
"the",
"ruby",
"script",
"to",
"execute"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/SassRubyGenerator.java#L221-L234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.