repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.setPath | public void setPath(int pathId, String path) {
"""
Sets the actual path for this ID
@param pathId ID of path
@param path value of path
"""
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_ACTUAL_PATH + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, path);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | java | public void setPath(int pathId, String path) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_ACTUAL_PATH + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, path);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"setPath",
"(",
"int",
"pathId",
",",
"String",
"path",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
"statement",
"=",
"sqlConnection",
".",
"prepareStatement",
"(",
"\"UPDATE \"",
"+",
"Constants",
".",
"DB_TABLE_PATH",
"+",
"\" SET \"",
"+",
"Constants",
".",
"PATH_PROFILE_ACTUAL_PATH",
"+",
"\" = ? \"",
"+",
"\" WHERE \"",
"+",
"Constants",
".",
"GENERIC_ID",
"+",
"\" = ?\"",
")",
";",
"statement",
".",
"setString",
"(",
"1",
",",
"path",
")",
";",
"statement",
".",
"setInt",
"(",
"2",
",",
"pathId",
")",
";",
"statement",
".",
"executeUpdate",
"(",
")",
";",
"statement",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"if",
"(",
"statement",
"!=",
"null",
")",
"{",
"statement",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}",
"}"
] | Sets the actual path for this ID
@param pathId ID of path
@param path value of path | [
"Sets",
"the",
"actual",
"path",
"for",
"this",
"ID"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L1147-L1169 |
tommyettinger/RegExodus | src/main/java/regexodus/ds/CharArrayList.java | CharArrayList.addElements | public void addElements(final int index, final char a[], final int offset, final int length) {
"""
Adds elements to this type-specific list using optimized system calls.
@param index the index at which to add elements.
@param a the array containing the elements.
@param offset the offset of the first element to add.
@param length the number of elements to add.
"""
ensureIndex(index);
CharArrays.ensureOffsetLength(a, offset, length);
grow(size + length);
System.arraycopy(this.a, index, this.a, index + length, size - index);
System.arraycopy(a, offset, this.a, index, length);
size += length;
} | java | public void addElements(final int index, final char a[], final int offset, final int length) {
ensureIndex(index);
CharArrays.ensureOffsetLength(a, offset, length);
grow(size + length);
System.arraycopy(this.a, index, this.a, index + length, size - index);
System.arraycopy(a, offset, this.a, index, length);
size += length;
} | [
"public",
"void",
"addElements",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"a",
"[",
"]",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"ensureIndex",
"(",
"index",
")",
";",
"CharArrays",
".",
"ensureOffsetLength",
"(",
"a",
",",
"offset",
",",
"length",
")",
";",
"grow",
"(",
"size",
"+",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"a",
",",
"index",
",",
"this",
".",
"a",
",",
"index",
"+",
"length",
",",
"size",
"-",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"a",
",",
"offset",
",",
"this",
".",
"a",
",",
"index",
",",
"length",
")",
";",
"size",
"+=",
"length",
";",
"}"
] | Adds elements to this type-specific list using optimized system calls.
@param index the index at which to add elements.
@param a the array containing the elements.
@param offset the offset of the first element to add.
@param length the number of elements to add. | [
"Adds",
"elements",
"to",
"this",
"type",
"-",
"specific",
"list",
"using",
"optimized",
"system",
"calls",
"."
] | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L495-L502 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java | HtmlSerialFieldWriter.addMemberDescription | public void addMemberDescription(VariableElement field, Content contentTree) {
"""
Add the description text for this member.
@param field the field to document.
@param contentTree the tree to which the deprecated info will be added
"""
if (!utils.getFullBody(field).isEmpty()) {
writer.addInlineComment(field, contentTree);
}
List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL);
if (!tags.isEmpty()) {
writer.addInlineComment(field, tags.get(0), contentTree);
}
} | java | public void addMemberDescription(VariableElement field, Content contentTree) {
if (!utils.getFullBody(field).isEmpty()) {
writer.addInlineComment(field, contentTree);
}
List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL);
if (!tags.isEmpty()) {
writer.addInlineComment(field, tags.get(0), contentTree);
}
} | [
"public",
"void",
"addMemberDescription",
"(",
"VariableElement",
"field",
",",
"Content",
"contentTree",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"getFullBody",
"(",
"field",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"writer",
".",
"addInlineComment",
"(",
"field",
",",
"contentTree",
")",
";",
"}",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"tags",
"=",
"utils",
".",
"getBlockTags",
"(",
"field",
",",
"DocTree",
".",
"Kind",
".",
"SERIAL",
")",
";",
"if",
"(",
"!",
"tags",
".",
"isEmpty",
"(",
")",
")",
"{",
"writer",
".",
"addInlineComment",
"(",
"field",
",",
"tags",
".",
"get",
"(",
"0",
")",
",",
"contentTree",
")",
";",
"}",
"}"
] | Add the description text for this member.
@param field the field to document.
@param contentTree the tree to which the deprecated info will be added | [
"Add",
"the",
"description",
"text",
"for",
"this",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java#L161-L169 |
FINRAOS/DataGenerator | dg-example-hadoop/src/main/java/org/finra/datagenerator/samples/manager/JettyManager.java | JettyManager.makeReport | public String makeReport(String name, String report) {
"""
Handles reports by consumers
@param name the name of the reporting consumer
@param report the number of lines the consumer has written since last report
@return "exit" if maxScenarios has been reached, "ok" otherwise
"""
long increment = Long.valueOf(report);
long currentLineCount = globalLineCounter.addAndGet(increment);
if (currentLineCount >= maxScenarios) {
return "exit";
} else {
return "ok";
}
} | java | public String makeReport(String name, String report) {
long increment = Long.valueOf(report);
long currentLineCount = globalLineCounter.addAndGet(increment);
if (currentLineCount >= maxScenarios) {
return "exit";
} else {
return "ok";
}
} | [
"public",
"String",
"makeReport",
"(",
"String",
"name",
",",
"String",
"report",
")",
"{",
"long",
"increment",
"=",
"Long",
".",
"valueOf",
"(",
"report",
")",
";",
"long",
"currentLineCount",
"=",
"globalLineCounter",
".",
"addAndGet",
"(",
"increment",
")",
";",
"if",
"(",
"currentLineCount",
">=",
"maxScenarios",
")",
"{",
"return",
"\"exit\"",
";",
"}",
"else",
"{",
"return",
"\"ok\"",
";",
"}",
"}"
] | Handles reports by consumers
@param name the name of the reporting consumer
@param report the number of lines the consumer has written since last report
@return "exit" if maxScenarios has been reached, "ok" otherwise | [
"Handles",
"reports",
"by",
"consumers"
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-example-hadoop/src/main/java/org/finra/datagenerator/samples/manager/JettyManager.java#L101-L110 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Conversion.java | Conversion.byteArrayToUuid | @GwtIncompatible("incompatible method")
public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
"""
<p>
Converts bytes from an array into a UUID using the default (little endian, Lsb0) byte and
bit ordering.
</p>
@param src the byte array to convert
@param srcPos the position in {@code src} where to copy the result from
@return a UUID
@throws NullPointerException if {@code src} is {@code null}
@throws IllegalArgumentException if array does not contain at least 16 bytes beginning
with {@code srcPos}
"""
if (src.length - srcPos < 16) {
throw new IllegalArgumentException("Need at least 16 bytes for UUID");
}
return new UUID(byteArrayToLong(src, srcPos, 0, 0, 8), byteArrayToLong(src, srcPos + 8, 0, 0, 8));
} | java | @GwtIncompatible("incompatible method")
public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
if (src.length - srcPos < 16) {
throw new IllegalArgumentException("Need at least 16 bytes for UUID");
}
return new UUID(byteArrayToLong(src, srcPos, 0, 0, 8), byteArrayToLong(src, srcPos + 8, 0, 0, 8));
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"UUID",
"byteArrayToUuid",
"(",
"final",
"byte",
"[",
"]",
"src",
",",
"final",
"int",
"srcPos",
")",
"{",
"if",
"(",
"src",
".",
"length",
"-",
"srcPos",
"<",
"16",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Need at least 16 bytes for UUID\"",
")",
";",
"}",
"return",
"new",
"UUID",
"(",
"byteArrayToLong",
"(",
"src",
",",
"srcPos",
",",
"0",
",",
"0",
",",
"8",
")",
",",
"byteArrayToLong",
"(",
"src",
",",
"srcPos",
"+",
"8",
",",
"0",
",",
"0",
",",
"8",
")",
")",
";",
"}"
] | <p>
Converts bytes from an array into a UUID using the default (little endian, Lsb0) byte and
bit ordering.
</p>
@param src the byte array to convert
@param srcPos the position in {@code src} where to copy the result from
@return a UUID
@throws NullPointerException if {@code src} is {@code null}
@throws IllegalArgumentException if array does not contain at least 16 bytes beginning
with {@code srcPos} | [
"<p",
">",
"Converts",
"bytes",
"from",
"an",
"array",
"into",
"a",
"UUID",
"using",
"the",
"default",
"(",
"little",
"endian",
"Lsb0",
")",
"byte",
"and",
"bit",
"ordering",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Conversion.java#L1545-L1551 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java | ExplodedExporterDelegate.processArchiveAsset | private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset) {
"""
Processes a nested archive by delegating to the ExplodedArchiveExporter
@param parentDirectory
@param nestedArchiveAsset
"""
// Get the nested archive
Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
} | java | private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset) {
// Get the nested archive
Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
} | [
"private",
"void",
"processArchiveAsset",
"(",
"File",
"parentDirectory",
",",
"ArchiveAsset",
"nestedArchiveAsset",
")",
"{",
"// Get the nested archive",
"Archive",
"<",
"?",
">",
"nestedArchive",
"=",
"nestedArchiveAsset",
".",
"getArchive",
"(",
")",
";",
"nestedArchive",
".",
"as",
"(",
"ExplodedExporter",
".",
"class",
")",
".",
"exportExploded",
"(",
"parentDirectory",
")",
";",
"}"
] | Processes a nested archive by delegating to the ExplodedArchiveExporter
@param parentDirectory
@param nestedArchiveAsset | [
"Processes",
"a",
"nested",
"archive",
"by",
"delegating",
"to",
"the",
"ExplodedArchiveExporter"
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java#L165-L169 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/CmsWidgetSetEntryPoint.java | CmsWidgetSetEntryPoint.loadScriptDependencies | public static void loadScriptDependencies(final JsArrayString dependencies, final JavaScriptObject callback) {
"""
Loads JavaScript resources into the window context.<p>
@param dependencies the dependencies to load
@param callback the callback to execute once the resources are loaded
"""
if (dependencies.length() == 0) {
return;
}
final Set<String> absoluteUris = new HashSet<String>();
for (int i = 0; i < dependencies.length(); i++) {
absoluteUris.add(WidgetUtil.getAbsoluteUrl(dependencies.get(i)));
}
// Listener that loads the next when one is completed
ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
@Override
public void onError(ResourceLoadEvent event) {
CmsDebugLog.consoleLog(event.getResourceUrl() + " could not be loaded.");
// The show must go on
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
@Override
public void onLoad(ResourceLoadEvent event) {
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
};
ResourceLoader loader = ResourceLoader.get();
for (int i = 0; i < dependencies.length(); i++) {
String preloadUrl = dependencies.get(i);
loader.loadScript(preloadUrl, resourceLoadListener);
}
} | java | public static void loadScriptDependencies(final JsArrayString dependencies, final JavaScriptObject callback) {
if (dependencies.length() == 0) {
return;
}
final Set<String> absoluteUris = new HashSet<String>();
for (int i = 0; i < dependencies.length(); i++) {
absoluteUris.add(WidgetUtil.getAbsoluteUrl(dependencies.get(i)));
}
// Listener that loads the next when one is completed
ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
@Override
public void onError(ResourceLoadEvent event) {
CmsDebugLog.consoleLog(event.getResourceUrl() + " could not be loaded.");
// The show must go on
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
@Override
public void onLoad(ResourceLoadEvent event) {
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
};
ResourceLoader loader = ResourceLoader.get();
for (int i = 0; i < dependencies.length(); i++) {
String preloadUrl = dependencies.get(i);
loader.loadScript(preloadUrl, resourceLoadListener);
}
} | [
"public",
"static",
"void",
"loadScriptDependencies",
"(",
"final",
"JsArrayString",
"dependencies",
",",
"final",
"JavaScriptObject",
"callback",
")",
"{",
"if",
"(",
"dependencies",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"final",
"Set",
"<",
"String",
">",
"absoluteUris",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dependencies",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"absoluteUris",
".",
"add",
"(",
"WidgetUtil",
".",
"getAbsoluteUrl",
"(",
"dependencies",
".",
"get",
"(",
"i",
")",
")",
")",
";",
"}",
"// Listener that loads the next when one is completed",
"ResourceLoadListener",
"resourceLoadListener",
"=",
"new",
"ResourceLoadListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onError",
"(",
"ResourceLoadEvent",
"event",
")",
"{",
"CmsDebugLog",
".",
"consoleLog",
"(",
"event",
".",
"getResourceUrl",
"(",
")",
"+",
"\" could not be loaded.\"",
")",
";",
"// The show must go on",
"absoluteUris",
".",
"remove",
"(",
"event",
".",
"getResourceUrl",
"(",
")",
")",
";",
"if",
"(",
"absoluteUris",
".",
"isEmpty",
"(",
")",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"callNativeFunction",
"(",
"callback",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onLoad",
"(",
"ResourceLoadEvent",
"event",
")",
"{",
"absoluteUris",
".",
"remove",
"(",
"event",
".",
"getResourceUrl",
"(",
")",
")",
";",
"if",
"(",
"absoluteUris",
".",
"isEmpty",
"(",
")",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"callNativeFunction",
"(",
"callback",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}",
";",
"ResourceLoader",
"loader",
"=",
"ResourceLoader",
".",
"get",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dependencies",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"preloadUrl",
"=",
"dependencies",
".",
"get",
"(",
"i",
")",
";",
"loader",
".",
"loadScript",
"(",
"preloadUrl",
",",
"resourceLoadListener",
")",
";",
"}",
"}"
] | Loads JavaScript resources into the window context.<p>
@param dependencies the dependencies to load
@param callback the callback to execute once the resources are loaded | [
"Loads",
"JavaScript",
"resources",
"into",
"the",
"window",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsWidgetSetEntryPoint.java#L57-L109 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.encodeAll | public static String encodeAll(String url, Charset charset) throws UtilException {
"""
编码URL<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。
@param url URL
@param charset 编码
@return 编码后的URL
@exception UtilException UnsupportedEncodingException
"""
try {
return java.net.URLEncoder.encode(url, charset.toString());
} catch (UnsupportedEncodingException e) {
throw new UtilException(e);
}
} | java | public static String encodeAll(String url, Charset charset) throws UtilException {
try {
return java.net.URLEncoder.encode(url, charset.toString());
} catch (UnsupportedEncodingException e) {
throw new UtilException(e);
}
} | [
"public",
"static",
"String",
"encodeAll",
"(",
"String",
"url",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"try",
"{",
"return",
"java",
".",
"net",
".",
"URLEncoder",
".",
"encode",
"(",
"url",
",",
"charset",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"UtilException",
"(",
"e",
")",
";",
"}",
"}"
] | 编码URL<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。
@param url URL
@param charset 编码
@return 编码后的URL
@exception UtilException UnsupportedEncodingException | [
"编码URL<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L229-L235 |
Waikato/moa | moa/src/main/java/moa/clusterers/clustree/ClusKernel.java | ClusKernel.aggregate | protected void aggregate(ClusKernel other, long timeDifference, double negLambda) {
"""
Make this cluster older bei weighting it and add to this cluster the
given cluster. If we want to add somethin to the cluster, but don't
want to weight it, we should use the function <code>add(Cluster)</code>.
@param other The other cluster to be added to this one.
@param timeDifference The time elapsed between the last update of the
<code>Entry</code> to which this cluster belongs and the update that
caused the call to this function.
@param negLambda A parameter needed to weight the cluster.
@see #add(tree.Kernel)
"""
makeOlder(timeDifference, negLambda);
add(other);
} | java | protected void aggregate(ClusKernel other, long timeDifference, double negLambda) {
makeOlder(timeDifference, negLambda);
add(other);
} | [
"protected",
"void",
"aggregate",
"(",
"ClusKernel",
"other",
",",
"long",
"timeDifference",
",",
"double",
"negLambda",
")",
"{",
"makeOlder",
"(",
"timeDifference",
",",
"negLambda",
")",
";",
"add",
"(",
"other",
")",
";",
"}"
] | Make this cluster older bei weighting it and add to this cluster the
given cluster. If we want to add somethin to the cluster, but don't
want to weight it, we should use the function <code>add(Cluster)</code>.
@param other The other cluster to be added to this one.
@param timeDifference The time elapsed between the last update of the
<code>Entry</code> to which this cluster belongs and the update that
caused the call to this function.
@param negLambda A parameter needed to weight the cluster.
@see #add(tree.Kernel) | [
"Make",
"this",
"cluster",
"older",
"bei",
"weighting",
"it",
"and",
"add",
"to",
"this",
"cluster",
"the",
"given",
"cluster",
".",
"If",
"we",
"want",
"to",
"add",
"somethin",
"to",
"the",
"cluster",
"but",
"don",
"t",
"want",
"to",
"weight",
"it",
"we",
"should",
"use",
"the",
"function",
"<code",
">",
"add",
"(",
"Cluster",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusKernel.java#L101-L104 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/reflection/GobblinConstructorUtils.java | GobblinConstructorUtils.invokeConstructor | @SuppressWarnings("unchecked")
public static <T> T invokeConstructor(final Class<T> superType, final String clsName, Object... args) {
"""
Utility method to create an instance of <code>clsName</code> using the constructor matching the arguments, <code>args</code>
@param superType of <code>clsName</code>. The new instance is cast to superType
@param clsName complete cannonical name of the class to be instantiated
@param args constructor args to be used
@throws IllegalArgumentException if there was an issue creating the instance due to
{@link NoSuchMethodException}, {@link InvocationTargetException},{@link InstantiationException},
{@link ClassNotFoundException}
@return A new instance of <code>clsName</code>
"""
try {
return (T) ConstructorUtils.invokeConstructor(Class.forName(clsName), args);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException
| ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T invokeConstructor(final Class<T> superType, final String clsName, Object... args) {
try {
return (T) ConstructorUtils.invokeConstructor(Class.forName(clsName), args);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException
| ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"invokeConstructor",
"(",
"final",
"Class",
"<",
"T",
">",
"superType",
",",
"final",
"String",
"clsName",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"ConstructorUtils",
".",
"invokeConstructor",
"(",
"Class",
".",
"forName",
"(",
"clsName",
")",
",",
"args",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"|",
"IllegalAccessException",
"|",
"InvocationTargetException",
"|",
"InstantiationException",
"|",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}"
] | Utility method to create an instance of <code>clsName</code> using the constructor matching the arguments, <code>args</code>
@param superType of <code>clsName</code>. The new instance is cast to superType
@param clsName complete cannonical name of the class to be instantiated
@param args constructor args to be used
@throws IllegalArgumentException if there was an issue creating the instance due to
{@link NoSuchMethodException}, {@link InvocationTargetException},{@link InstantiationException},
{@link ClassNotFoundException}
@return A new instance of <code>clsName</code> | [
"Utility",
"method",
"to",
"create",
"an",
"instance",
"of",
"<code",
">",
"clsName<",
"/",
"code",
">",
"using",
"the",
"constructor",
"matching",
"the",
"arguments",
"<code",
">",
"args<",
"/",
"code",
">"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/reflection/GobblinConstructorUtils.java#L109-L118 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlMNStatement.java | SqlMNStatement.appendWhereClause | protected void appendWhereClause(StringBuffer stmt, Object[] columns) {
"""
Generate a sql where-clause matching the contraints defined by the array of fields
@param columns array containing all columns used in WHERE clause
"""
stmt.append(" WHERE ");
for (int i = 0; i < columns.length; i++)
{
if (i > 0)
{
stmt.append(" AND ");
}
stmt.append(columns[i]);
stmt.append("=?");
}
} | java | protected void appendWhereClause(StringBuffer stmt, Object[] columns)
{
stmt.append(" WHERE ");
for (int i = 0; i < columns.length; i++)
{
if (i > 0)
{
stmt.append(" AND ");
}
stmt.append(columns[i]);
stmt.append("=?");
}
} | [
"protected",
"void",
"appendWhereClause",
"(",
"StringBuffer",
"stmt",
",",
"Object",
"[",
"]",
"columns",
")",
"{",
"stmt",
".",
"append",
"(",
"\" WHERE \"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"stmt",
".",
"append",
"(",
"\" AND \"",
")",
";",
"}",
"stmt",
".",
"append",
"(",
"columns",
"[",
"i",
"]",
")",
";",
"stmt",
".",
"append",
"(",
"\"=?\"",
")",
";",
"}",
"}"
] | Generate a sql where-clause matching the contraints defined by the array of fields
@param columns array containing all columns used in WHERE clause | [
"Generate",
"a",
"sql",
"where",
"-",
"clause",
"matching",
"the",
"contraints",
"defined",
"by",
"the",
"array",
"of",
"fields"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlMNStatement.java#L87-L100 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderDataAger.java | SpiderDataAger.checkTable | private void checkTable() {
"""
Scan the given table for expired objects relative to the given date.
"""
// Documentation says that "0 xxx" means data-aging is disabled.
if (m_retentionAge.getValue() == 0) {
m_logger.info("Data aging disabled for table: {}", m_tableDef.getTableName());
return;
}
m_logger.info("Checking expired objects for: {}", m_tableDef.getTableName());
GregorianCalendar checkDate = new GregorianCalendar(Utils.UTC_TIMEZONE);
GregorianCalendar expireDate = m_retentionAge.getExpiredDate(checkDate);
int objsExpired = 0;
String fixedQuery = buildFixedQuery(expireDate);
String contToken = null;
StringBuilder uriParam = new StringBuilder();
do {
uriParam.setLength(0);
uriParam.append(fixedQuery);
if (!Utils.isEmpty(contToken)) {
uriParam.append("&g=");
uriParam.append(contToken);
}
ObjectQuery objQuery = new ObjectQuery(m_tableDef, uriParam.toString());
SearchResultList resultList =
SpiderService.instance().objectQuery(m_tableDef, objQuery);
List<String> objIDs = new ArrayList<>();
for (SearchResult result : resultList.results) {
objIDs.add(result.id());
}
if (deleteBatch(objIDs)) {
contToken = resultList.continuation_token;
} else {
contToken = null;
}
objsExpired += objIDs.size();
reportProgress("Expired " + objsExpired + " objects");
} while (!Utils.isEmpty(contToken));
m_logger.info("Deleted {} objects for {}", objsExpired, m_tableDef.getTableName());
} | java | private void checkTable() {
// Documentation says that "0 xxx" means data-aging is disabled.
if (m_retentionAge.getValue() == 0) {
m_logger.info("Data aging disabled for table: {}", m_tableDef.getTableName());
return;
}
m_logger.info("Checking expired objects for: {}", m_tableDef.getTableName());
GregorianCalendar checkDate = new GregorianCalendar(Utils.UTC_TIMEZONE);
GregorianCalendar expireDate = m_retentionAge.getExpiredDate(checkDate);
int objsExpired = 0;
String fixedQuery = buildFixedQuery(expireDate);
String contToken = null;
StringBuilder uriParam = new StringBuilder();
do {
uriParam.setLength(0);
uriParam.append(fixedQuery);
if (!Utils.isEmpty(contToken)) {
uriParam.append("&g=");
uriParam.append(contToken);
}
ObjectQuery objQuery = new ObjectQuery(m_tableDef, uriParam.toString());
SearchResultList resultList =
SpiderService.instance().objectQuery(m_tableDef, objQuery);
List<String> objIDs = new ArrayList<>();
for (SearchResult result : resultList.results) {
objIDs.add(result.id());
}
if (deleteBatch(objIDs)) {
contToken = resultList.continuation_token;
} else {
contToken = null;
}
objsExpired += objIDs.size();
reportProgress("Expired " + objsExpired + " objects");
} while (!Utils.isEmpty(contToken));
m_logger.info("Deleted {} objects for {}", objsExpired, m_tableDef.getTableName());
} | [
"private",
"void",
"checkTable",
"(",
")",
"{",
"// Documentation says that \"0 xxx\" means data-aging is disabled.",
"if",
"(",
"m_retentionAge",
".",
"getValue",
"(",
")",
"==",
"0",
")",
"{",
"m_logger",
".",
"info",
"(",
"\"Data aging disabled for table: {}\"",
",",
"m_tableDef",
".",
"getTableName",
"(",
")",
")",
";",
"return",
";",
"}",
"m_logger",
".",
"info",
"(",
"\"Checking expired objects for: {}\"",
",",
"m_tableDef",
".",
"getTableName",
"(",
")",
")",
";",
"GregorianCalendar",
"checkDate",
"=",
"new",
"GregorianCalendar",
"(",
"Utils",
".",
"UTC_TIMEZONE",
")",
";",
"GregorianCalendar",
"expireDate",
"=",
"m_retentionAge",
".",
"getExpiredDate",
"(",
"checkDate",
")",
";",
"int",
"objsExpired",
"=",
"0",
";",
"String",
"fixedQuery",
"=",
"buildFixedQuery",
"(",
"expireDate",
")",
";",
"String",
"contToken",
"=",
"null",
";",
"StringBuilder",
"uriParam",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"do",
"{",
"uriParam",
".",
"setLength",
"(",
"0",
")",
";",
"uriParam",
".",
"append",
"(",
"fixedQuery",
")",
";",
"if",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"contToken",
")",
")",
"{",
"uriParam",
".",
"append",
"(",
"\"&g=\"",
")",
";",
"uriParam",
".",
"append",
"(",
"contToken",
")",
";",
"}",
"ObjectQuery",
"objQuery",
"=",
"new",
"ObjectQuery",
"(",
"m_tableDef",
",",
"uriParam",
".",
"toString",
"(",
")",
")",
";",
"SearchResultList",
"resultList",
"=",
"SpiderService",
".",
"instance",
"(",
")",
".",
"objectQuery",
"(",
"m_tableDef",
",",
"objQuery",
")",
";",
"List",
"<",
"String",
">",
"objIDs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"SearchResult",
"result",
":",
"resultList",
".",
"results",
")",
"{",
"objIDs",
".",
"add",
"(",
"result",
".",
"id",
"(",
")",
")",
";",
"}",
"if",
"(",
"deleteBatch",
"(",
"objIDs",
")",
")",
"{",
"contToken",
"=",
"resultList",
".",
"continuation_token",
";",
"}",
"else",
"{",
"contToken",
"=",
"null",
";",
"}",
"objsExpired",
"+=",
"objIDs",
".",
"size",
"(",
")",
";",
"reportProgress",
"(",
"\"Expired \"",
"+",
"objsExpired",
"+",
"\" objects\"",
")",
";",
"}",
"while",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"contToken",
")",
")",
";",
"m_logger",
".",
"info",
"(",
"\"Deleted {} objects for {}\"",
",",
"objsExpired",
",",
"m_tableDef",
".",
"getTableName",
"(",
")",
")",
";",
"}"
] | Scan the given table for expired objects relative to the given date. | [
"Scan",
"the",
"given",
"table",
"for",
"expired",
"objects",
"relative",
"to",
"the",
"given",
"date",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderDataAger.java#L75-L114 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java | AccountsImpl.listPoolNodeCounts | public PagedList<PoolNodeCounts> listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) {
"""
Gets the number of nodes in each state, grouped by pool.
@param accountListPoolNodeCountsOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<PoolNodeCounts> object if successful.
"""
ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions).toBlocking().single();
return new PagedList<PoolNodeCounts>(response.body()) {
@Override
public Page<PoolNodeCounts> nextPage(String nextPageLink) {
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions();
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId());
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId());
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate());
}
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body();
}
};
} | java | public PagedList<PoolNodeCounts> listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) {
ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions).toBlocking().single();
return new PagedList<PoolNodeCounts>(response.body()) {
@Override
public Page<PoolNodeCounts> nextPage(String nextPageLink) {
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions();
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId());
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId());
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate());
}
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"PoolNodeCounts",
">",
"listPoolNodeCounts",
"(",
"final",
"AccountListPoolNodeCountsOptions",
"accountListPoolNodeCountsOptions",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"PoolNodeCounts",
">",
",",
"AccountListPoolNodeCountsHeaders",
">",
"response",
"=",
"listPoolNodeCountsSinglePageAsync",
"(",
"accountListPoolNodeCountsOptions",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
";",
"return",
"new",
"PagedList",
"<",
"PoolNodeCounts",
">",
"(",
"response",
".",
"body",
"(",
")",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"PoolNodeCounts",
">",
"nextPage",
"(",
"String",
"nextPageLink",
")",
"{",
"AccountListPoolNodeCountsNextOptions",
"accountListPoolNodeCountsNextOptions",
"=",
"null",
";",
"if",
"(",
"accountListPoolNodeCountsOptions",
"!=",
"null",
")",
"{",
"accountListPoolNodeCountsNextOptions",
"=",
"new",
"AccountListPoolNodeCountsNextOptions",
"(",
")",
";",
"accountListPoolNodeCountsNextOptions",
".",
"withClientRequestId",
"(",
"accountListPoolNodeCountsOptions",
".",
"clientRequestId",
"(",
")",
")",
";",
"accountListPoolNodeCountsNextOptions",
".",
"withReturnClientRequestId",
"(",
"accountListPoolNodeCountsOptions",
".",
"returnClientRequestId",
"(",
")",
")",
";",
"accountListPoolNodeCountsNextOptions",
".",
"withOcpDate",
"(",
"accountListPoolNodeCountsOptions",
".",
"ocpDate",
"(",
")",
")",
";",
"}",
"return",
"listPoolNodeCountsNextSinglePageAsync",
"(",
"nextPageLink",
",",
"accountListPoolNodeCountsNextOptions",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}",
"}",
";",
"}"
] | Gets the number of nodes in each state, grouped by pool.
@param accountListPoolNodeCountsOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<PoolNodeCounts> object if successful. | [
"Gets",
"the",
"number",
"of",
"nodes",
"in",
"each",
"state",
"grouped",
"by",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L483-L498 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.listByJobWithServiceResponseAsync | public Observable<ServiceResponse<Page<JobExecutionInner>>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) {
"""
Lists a job's executions.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object
"""
return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<JobExecutionInner>>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) {
return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName)
.concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
"listByJobWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"jobAgentName",
",",
"final",
"String",
"jobName",
")",
"{",
"return",
"listByJobSinglePageAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"jobAgentName",
",",
"jobName",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"JobExecutionInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listByJobNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists a job's executions.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobExecutionInner> object | [
"Lists",
"a",
"job",
"s",
"executions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L768-L780 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.putAndEncrypt | public JsonObject putAndEncrypt(String name, Map<String, ?> value, String providerName) {
"""
Attempt to convert a {@link Map} to a {@link JsonObject} value and store it,
as encrypted identified by the field name.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the JSON field.
@param value the value of the JSON field.
@param providerName Crypto provider name for encryption.
@return the {@link JsonObject}.
@see #from(Map)
"""
addValueEncryptionInfo(name, providerName, true);
return put(name, JsonObject.from(value));
} | java | public JsonObject putAndEncrypt(String name, Map<String, ?> value, String providerName) {
addValueEncryptionInfo(name, providerName, true);
return put(name, JsonObject.from(value));
} | [
"public",
"JsonObject",
"putAndEncrypt",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"?",
">",
"value",
",",
"String",
"providerName",
")",
"{",
"addValueEncryptionInfo",
"(",
"name",
",",
"providerName",
",",
"true",
")",
";",
"return",
"put",
"(",
"name",
",",
"JsonObject",
".",
"from",
"(",
"value",
")",
")",
";",
"}"
] | Attempt to convert a {@link Map} to a {@link JsonObject} value and store it,
as encrypted identified by the field name.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the JSON field.
@param value the value of the JSON field.
@param providerName Crypto provider name for encryption.
@return the {@link JsonObject}.
@see #from(Map) | [
"Attempt",
"to",
"convert",
"a",
"{",
"@link",
"Map",
"}",
"to",
"a",
"{",
"@link",
"JsonObject",
"}",
"value",
"and",
"store",
"it",
"as",
"encrypted",
"identified",
"by",
"the",
"field",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L742-L745 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/EventNotifier.java | EventNotifier.removeListener | synchronized public void removeListener(Object listener) {
"""
Remove an existing callback event listener for this EventNotifier
"""
if (!_listeners.contains(listener))
throw new IllegalStateException("Invalid listener, not currently registered");
_listeners.remove(listener);
} | java | synchronized public void removeListener(Object listener)
{
if (!_listeners.contains(listener))
throw new IllegalStateException("Invalid listener, not currently registered");
_listeners.remove(listener);
} | [
"synchronized",
"public",
"void",
"removeListener",
"(",
"Object",
"listener",
")",
"{",
"if",
"(",
"!",
"_listeners",
".",
"contains",
"(",
"listener",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Invalid listener, not currently registered\"",
")",
";",
"_listeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | Remove an existing callback event listener for this EventNotifier | [
"Remove",
"an",
"existing",
"callback",
"event",
"listener",
"for",
"this",
"EventNotifier"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/EventNotifier.java#L41-L47 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java | FormatSet.getBasicDateFormatter | public static DateFormat getBasicDateFormatter() {
"""
Return a DateFormat object that can be used to format timestamps in the
System.out, System.err and TraceOutput logs. It will use the default date
format.
""" // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | java | public static DateFormat getBasicDateFormatter() { // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | [
"public",
"static",
"DateFormat",
"getBasicDateFormatter",
"(",
")",
"{",
"// PK42263 - made static",
"// Retrieve a standard Java DateFormat object with desired format, using default locale",
"return",
"customizeDateFormat",
"(",
"DateFormat",
".",
"getDateTimeInstance",
"(",
"DateFormat",
".",
"SHORT",
",",
"DateFormat",
".",
"MEDIUM",
")",
",",
"false",
")",
";",
"}"
] | Return a DateFormat object that can be used to format timestamps in the
System.out, System.err and TraceOutput logs. It will use the default date
format. | [
"Return",
"a",
"DateFormat",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"timestamps",
"in",
"the",
"System",
".",
"out",
"System",
".",
"err",
"and",
"TraceOutput",
"logs",
".",
"It",
"will",
"use",
"the",
"default",
"date",
"format",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java#L112-L115 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detdesc/FactoryDetectDescribe.java | FactoryDetectDescribe.surfColorStable | public static <T extends ImageMultiBand<T>, II extends ImageGray<II>>
DetectDescribePoint<T,BrightFeature> surfColorStable( @Nullable ConfigFastHessian configDetector,
@Nullable ConfigSurfDescribe.Stability configDescribe,
@Nullable ConfigSlidingIntegral configOrientation,
ImageType<T> imageType ) {
"""
<p>
Color version of SURF stable feature. Features are detected in a gray scale image, but the descriptors are
computed using a color image. Each band in the page adds to the descriptor length. See
{@link DetectDescribeSurfPlanar} for details.
</p>
@see DescribePointSurfPlanar
@see FastHessianFeatureDetector
@see boofcv.alg.feature.describe.DescribePointSurfMod
@param configDetector Configuration for SURF detector. Null for default.
@param configDescribe Configuration for SURF descriptor. Null for default.
@param configOrientation Configuration for region orientation. Null for default.
@param imageType Specify type of color input image.
@return SURF detector and descriptor
"""
Class bandType = imageType.getImageClass();
Class<II> integralType = GIntegralImageOps.getIntegralType(bandType);
FastHessianFeatureDetector<II> detector = FactoryInterestPointAlgs.fastHessian(configDetector);
DescribePointSurfMod<II> describe = FactoryDescribePointAlgs.surfStability(configDescribe, integralType);
OrientationIntegral<II> orientation = FactoryOrientationAlgs.sliding_ii(configOrientation, integralType);
if( imageType.getFamily() == ImageType.Family.PLANAR) {
DescribePointSurfPlanar<II> describeMulti =
new DescribePointSurfPlanar<>(describe, imageType.getNumBands());
DetectDescribeSurfPlanar<II> detectDesc = createDescribeSurfPlanar(detector, orientation, describeMulti);
return new SurfPlanar_to_DetectDescribePoint( detectDesc,bandType,integralType );
} else {
throw new IllegalArgumentException("Image type not supported");
}
} | java | public static <T extends ImageMultiBand<T>, II extends ImageGray<II>>
DetectDescribePoint<T,BrightFeature> surfColorStable( @Nullable ConfigFastHessian configDetector,
@Nullable ConfigSurfDescribe.Stability configDescribe,
@Nullable ConfigSlidingIntegral configOrientation,
ImageType<T> imageType ) {
Class bandType = imageType.getImageClass();
Class<II> integralType = GIntegralImageOps.getIntegralType(bandType);
FastHessianFeatureDetector<II> detector = FactoryInterestPointAlgs.fastHessian(configDetector);
DescribePointSurfMod<II> describe = FactoryDescribePointAlgs.surfStability(configDescribe, integralType);
OrientationIntegral<II> orientation = FactoryOrientationAlgs.sliding_ii(configOrientation, integralType);
if( imageType.getFamily() == ImageType.Family.PLANAR) {
DescribePointSurfPlanar<II> describeMulti =
new DescribePointSurfPlanar<>(describe, imageType.getNumBands());
DetectDescribeSurfPlanar<II> detectDesc = createDescribeSurfPlanar(detector, orientation, describeMulti);
return new SurfPlanar_to_DetectDescribePoint( detectDesc,bandType,integralType );
} else {
throw new IllegalArgumentException("Image type not supported");
}
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageMultiBand",
"<",
"T",
">",
",",
"II",
"extends",
"ImageGray",
"<",
"II",
">",
">",
"DetectDescribePoint",
"<",
"T",
",",
"BrightFeature",
">",
"surfColorStable",
"(",
"@",
"Nullable",
"ConfigFastHessian",
"configDetector",
",",
"@",
"Nullable",
"ConfigSurfDescribe",
".",
"Stability",
"configDescribe",
",",
"@",
"Nullable",
"ConfigSlidingIntegral",
"configOrientation",
",",
"ImageType",
"<",
"T",
">",
"imageType",
")",
"{",
"Class",
"bandType",
"=",
"imageType",
".",
"getImageClass",
"(",
")",
";",
"Class",
"<",
"II",
">",
"integralType",
"=",
"GIntegralImageOps",
".",
"getIntegralType",
"(",
"bandType",
")",
";",
"FastHessianFeatureDetector",
"<",
"II",
">",
"detector",
"=",
"FactoryInterestPointAlgs",
".",
"fastHessian",
"(",
"configDetector",
")",
";",
"DescribePointSurfMod",
"<",
"II",
">",
"describe",
"=",
"FactoryDescribePointAlgs",
".",
"surfStability",
"(",
"configDescribe",
",",
"integralType",
")",
";",
"OrientationIntegral",
"<",
"II",
">",
"orientation",
"=",
"FactoryOrientationAlgs",
".",
"sliding_ii",
"(",
"configOrientation",
",",
"integralType",
")",
";",
"if",
"(",
"imageType",
".",
"getFamily",
"(",
")",
"==",
"ImageType",
".",
"Family",
".",
"PLANAR",
")",
"{",
"DescribePointSurfPlanar",
"<",
"II",
">",
"describeMulti",
"=",
"new",
"DescribePointSurfPlanar",
"<>",
"(",
"describe",
",",
"imageType",
".",
"getNumBands",
"(",
")",
")",
";",
"DetectDescribeSurfPlanar",
"<",
"II",
">",
"detectDesc",
"=",
"createDescribeSurfPlanar",
"(",
"detector",
",",
"orientation",
",",
"describeMulti",
")",
";",
"return",
"new",
"SurfPlanar_to_DetectDescribePoint",
"(",
"detectDesc",
",",
"bandType",
",",
"integralType",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image type not supported\"",
")",
";",
"}",
"}"
] | <p>
Color version of SURF stable feature. Features are detected in a gray scale image, but the descriptors are
computed using a color image. Each band in the page adds to the descriptor length. See
{@link DetectDescribeSurfPlanar} for details.
</p>
@see DescribePointSurfPlanar
@see FastHessianFeatureDetector
@see boofcv.alg.feature.describe.DescribePointSurfMod
@param configDetector Configuration for SURF detector. Null for default.
@param configDescribe Configuration for SURF descriptor. Null for default.
@param configOrientation Configuration for region orientation. Null for default.
@param imageType Specify type of color input image.
@return SURF detector and descriptor | [
"<p",
">",
"Color",
"version",
"of",
"SURF",
"stable",
"feature",
".",
"Features",
"are",
"detected",
"in",
"a",
"gray",
"scale",
"image",
"but",
"the",
"descriptors",
"are",
"computed",
"using",
"a",
"color",
"image",
".",
"Each",
"band",
"in",
"the",
"page",
"adds",
"to",
"the",
"descriptor",
"length",
".",
"See",
"{",
"@link",
"DetectDescribeSurfPlanar",
"}",
"for",
"details",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detdesc/FactoryDetectDescribe.java#L245-L268 |
mokies/ratelimitj | ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java | RequestLimitRule.withPrecision | public RequestLimitRule withPrecision(Duration precision) {
"""
Controls (approximate) sliding window precision. A lower duration increases precision and minimises the Thundering herd problem - https://en.wikipedia.org/wiki/Thundering_herd_problem
@param precision Defines the time precision that will be used to approximate the sliding window. The precision must be greater than 1 second.
@return a limit rule
"""
checkDuration(precision);
return new RequestLimitRule(this.durationSeconds, this.limit, (int) precision.getSeconds(), this.name, this.keys);
} | java | public RequestLimitRule withPrecision(Duration precision) {
checkDuration(precision);
return new RequestLimitRule(this.durationSeconds, this.limit, (int) precision.getSeconds(), this.name, this.keys);
} | [
"public",
"RequestLimitRule",
"withPrecision",
"(",
"Duration",
"precision",
")",
"{",
"checkDuration",
"(",
"precision",
")",
";",
"return",
"new",
"RequestLimitRule",
"(",
"this",
".",
"durationSeconds",
",",
"this",
".",
"limit",
",",
"(",
"int",
")",
"precision",
".",
"getSeconds",
"(",
")",
",",
"this",
".",
"name",
",",
"this",
".",
"keys",
")",
";",
"}"
] | Controls (approximate) sliding window precision. A lower duration increases precision and minimises the Thundering herd problem - https://en.wikipedia.org/wiki/Thundering_herd_problem
@param precision Defines the time precision that will be used to approximate the sliding window. The precision must be greater than 1 second.
@return a limit rule | [
"Controls",
"(",
"approximate",
")",
"sliding",
"window",
"precision",
".",
"A",
"lower",
"duration",
"increases",
"precision",
"and",
"minimises",
"the",
"Thundering",
"herd",
"problem",
"-",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Thundering_herd_problem"
] | train | https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L70-L73 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java | OtpOutputStream.write_ref | public void write_ref(final String node, final int[] ids, final int creation) {
"""
Write an Erlang ref to the stream.
@param node
the nodename.
@param ids
an array of arbitrary numbers. Only the low order 18 bits of
the first number will be used. At most three numbers
will be read from the array.
@param creation
another arbitrary number. Only the low order 2 bits will be used.
"""
int arity = ids.length;
if (arity > 3) {
arity = 3; // max 3 words in ref
}
write1(OtpExternal.newRefTag);
// how many id values
write2BE(arity);
write_atom(node);
write1(creation & 0x3); // 2 bits
// first int gets truncated to 18 bits
write4BE(ids[0] & 0x3ffff);
// remaining ones are left as is
for (int i = 1; i < arity; i++) {
write4BE(ids[i]);
}
} | java | public void write_ref(final String node, final int[] ids, final int creation) {
int arity = ids.length;
if (arity > 3) {
arity = 3; // max 3 words in ref
}
write1(OtpExternal.newRefTag);
// how many id values
write2BE(arity);
write_atom(node);
write1(creation & 0x3); // 2 bits
// first int gets truncated to 18 bits
write4BE(ids[0] & 0x3ffff);
// remaining ones are left as is
for (int i = 1; i < arity; i++) {
write4BE(ids[i]);
}
} | [
"public",
"void",
"write_ref",
"(",
"final",
"String",
"node",
",",
"final",
"int",
"[",
"]",
"ids",
",",
"final",
"int",
"creation",
")",
"{",
"int",
"arity",
"=",
"ids",
".",
"length",
";",
"if",
"(",
"arity",
">",
"3",
")",
"{",
"arity",
"=",
"3",
";",
"// max 3 words in ref",
"}",
"write1",
"(",
"OtpExternal",
".",
"newRefTag",
")",
";",
"// how many id values",
"write2BE",
"(",
"arity",
")",
";",
"write_atom",
"(",
"node",
")",
";",
"write1",
"(",
"creation",
"&",
"0x3",
")",
";",
"// 2 bits",
"// first int gets truncated to 18 bits",
"write4BE",
"(",
"ids",
"[",
"0",
"]",
"&",
"0x3ffff",
")",
";",
"// remaining ones are left as is",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"arity",
";",
"i",
"++",
")",
"{",
"write4BE",
"(",
"ids",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Write an Erlang ref to the stream.
@param node
the nodename.
@param ids
an array of arbitrary numbers. Only the low order 18 bits of
the first number will be used. At most three numbers
will be read from the array.
@param creation
another arbitrary number. Only the low order 2 bits will be used. | [
"Write",
"an",
"Erlang",
"ref",
"to",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java#L826-L848 |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.createResponse | protected Response createResponse(NlsRuntimeException error) {
"""
Create the {@link Response} for the given {@link NlsRuntimeException}.
@param error the generic {@link NlsRuntimeException}.
@return the corresponding {@link Response}.
"""
Status status;
if (error.isTechnical()) {
status = Status.INTERNAL_SERVER_ERROR;
} else {
status = Status.BAD_REQUEST;
}
return createResponse(status, error, null);
} | java | protected Response createResponse(NlsRuntimeException error) {
Status status;
if (error.isTechnical()) {
status = Status.INTERNAL_SERVER_ERROR;
} else {
status = Status.BAD_REQUEST;
}
return createResponse(status, error, null);
} | [
"protected",
"Response",
"createResponse",
"(",
"NlsRuntimeException",
"error",
")",
"{",
"Status",
"status",
";",
"if",
"(",
"error",
".",
"isTechnical",
"(",
")",
")",
"{",
"status",
"=",
"Status",
".",
"INTERNAL_SERVER_ERROR",
";",
"}",
"else",
"{",
"status",
"=",
"Status",
".",
"BAD_REQUEST",
";",
"}",
"return",
"createResponse",
"(",
"status",
",",
"error",
",",
"null",
")",
";",
"}"
] | Create the {@link Response} for the given {@link NlsRuntimeException}.
@param error the generic {@link NlsRuntimeException}.
@return the corresponding {@link Response}. | [
"Create",
"the",
"{",
"@link",
"Response",
"}",
"for",
"the",
"given",
"{",
"@link",
"NlsRuntimeException",
"}",
"."
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L387-L396 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java | TagRenderingBase.renderAttributes | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote) {
"""
Render all of the attributes defined in a map and return the string value. The attributes
are rendered with in a name="value" style supported by XML.
@param type an integer key indentifying the map
"""
HashMap map = null;
switch (type) {
case AbstractAttributeState.ATTR_GENERAL:
map = state.getGeneralAttributeMap();
break;
default:
String s = Bundle.getString("Tags_ParameterRenderError",
new Object[]{new Integer(type)});
logger.error(s);
throw new IllegalStateException(s);
}
renderGeneral(map, sb, doubleQuote);
} | java | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote)
{
HashMap map = null;
switch (type) {
case AbstractAttributeState.ATTR_GENERAL:
map = state.getGeneralAttributeMap();
break;
default:
String s = Bundle.getString("Tags_ParameterRenderError",
new Object[]{new Integer(type)});
logger.error(s);
throw new IllegalStateException(s);
}
renderGeneral(map, sb, doubleQuote);
} | [
"protected",
"void",
"renderAttributes",
"(",
"int",
"type",
",",
"AbstractRenderAppender",
"sb",
",",
"AbstractAttributeState",
"state",
",",
"boolean",
"doubleQuote",
")",
"{",
"HashMap",
"map",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"AbstractAttributeState",
".",
"ATTR_GENERAL",
":",
"map",
"=",
"state",
".",
"getGeneralAttributeMap",
"(",
")",
";",
"break",
";",
"default",
":",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_ParameterRenderError\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"type",
")",
"}",
")",
";",
"logger",
".",
"error",
"(",
"s",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"s",
")",
";",
"}",
"renderGeneral",
"(",
"map",
",",
"sb",
",",
"doubleQuote",
")",
";",
"}"
] | Render all of the attributes defined in a map and return the string value. The attributes
are rendered with in a name="value" style supported by XML.
@param type an integer key indentifying the map | [
"Render",
"all",
"of",
"the",
"attributes",
"defined",
"in",
"a",
"map",
"and",
"return",
"the",
"string",
"value",
".",
"The",
"attributes",
"are",
"rendered",
"with",
"in",
"a",
"name",
"=",
"value",
"style",
"supported",
"by",
"XML",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java#L224-L238 |
openengsb/openengsb | api/core/src/main/java/org/openengsb/core/api/model/ContextId.java | ContextId.fromMetaData | public static ContextId fromMetaData(Map<String, String> metaData) {
"""
parses a ContextId object from a Map-representation used in
{@link org.openengsb.core.api.persistence.ConfigPersistenceService}
"""
return new ContextId(metaData.get(META_KEY_ID));
} | java | public static ContextId fromMetaData(Map<String, String> metaData) {
return new ContextId(metaData.get(META_KEY_ID));
} | [
"public",
"static",
"ContextId",
"fromMetaData",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"metaData",
")",
"{",
"return",
"new",
"ContextId",
"(",
"metaData",
".",
"get",
"(",
"META_KEY_ID",
")",
")",
";",
"}"
] | parses a ContextId object from a Map-representation used in
{@link org.openengsb.core.api.persistence.ConfigPersistenceService} | [
"parses",
"a",
"ContextId",
"object",
"from",
"a",
"Map",
"-",
"representation",
"used",
"in",
"{"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/core/src/main/java/org/openengsb/core/api/model/ContextId.java#L65-L67 |
leancloud/java-sdk-all | realtime/src/main/java/cn/leancloud/im/v2/AVIMClient.java | AVIMClient.getConversation | public AVIMConversation getConversation(String conversationId, int convType) {
"""
get conversation by id and type
@param conversationId
@param convType
@return
"""
AVIMConversation result = null;
switch (convType) {
case Conversation.CONV_TYPE_SYSTEM:
result = getServiceConversation(conversationId);
break;
case Conversation.CONV_TYPE_TEMPORARY:
result = getTemporaryConversation(conversationId);
break;
case Conversation.CONV_TYPE_TRANSIENT:
result = getChatRoom(conversationId);
break;
default:
result = getConversation(conversationId);
break;
}
return result;
} | java | public AVIMConversation getConversation(String conversationId, int convType) {
AVIMConversation result = null;
switch (convType) {
case Conversation.CONV_TYPE_SYSTEM:
result = getServiceConversation(conversationId);
break;
case Conversation.CONV_TYPE_TEMPORARY:
result = getTemporaryConversation(conversationId);
break;
case Conversation.CONV_TYPE_TRANSIENT:
result = getChatRoom(conversationId);
break;
default:
result = getConversation(conversationId);
break;
}
return result;
} | [
"public",
"AVIMConversation",
"getConversation",
"(",
"String",
"conversationId",
",",
"int",
"convType",
")",
"{",
"AVIMConversation",
"result",
"=",
"null",
";",
"switch",
"(",
"convType",
")",
"{",
"case",
"Conversation",
".",
"CONV_TYPE_SYSTEM",
":",
"result",
"=",
"getServiceConversation",
"(",
"conversationId",
")",
";",
"break",
";",
"case",
"Conversation",
".",
"CONV_TYPE_TEMPORARY",
":",
"result",
"=",
"getTemporaryConversation",
"(",
"conversationId",
")",
";",
"break",
";",
"case",
"Conversation",
".",
"CONV_TYPE_TRANSIENT",
":",
"result",
"=",
"getChatRoom",
"(",
"conversationId",
")",
";",
"break",
";",
"default",
":",
"result",
"=",
"getConversation",
"(",
"conversationId",
")",
";",
"break",
";",
"}",
"return",
"result",
";",
"}"
] | get conversation by id and type
@param conversationId
@param convType
@return | [
"get",
"conversation",
"by",
"id",
"and",
"type"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMClient.java#L402-L419 |
threerings/nenya | core/src/main/java/com/threerings/openal/SoundManager.java | SoundManager.loadClip | public void loadClip (ClipProvider provider, String path, Observer observer) {
"""
Loads a clip buffer for the sound clip loaded via the specified provider with the
specified path. The loaded clip is placed in the cache.
"""
getClip(provider, path, observer);
} | java | public void loadClip (ClipProvider provider, String path, Observer observer)
{
getClip(provider, path, observer);
} | [
"public",
"void",
"loadClip",
"(",
"ClipProvider",
"provider",
",",
"String",
"path",
",",
"Observer",
"observer",
")",
"{",
"getClip",
"(",
"provider",
",",
"path",
",",
"observer",
")",
";",
"}"
] | Loads a clip buffer for the sound clip loaded via the specified provider with the
specified path. The loaded clip is placed in the cache. | [
"Loads",
"a",
"clip",
"buffer",
"for",
"the",
"sound",
"clip",
"loaded",
"via",
"the",
"specified",
"provider",
"with",
"the",
"specified",
"path",
".",
"The",
"loaded",
"clip",
"is",
"placed",
"in",
"the",
"cache",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/SoundManager.java#L191-L194 |
gosu-lang/gosu-lang | gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java | Gosuc.asFiles | private List<File> asFiles(File srcDir, String[] files, FileNameMapper m) {
"""
Converts an array of relative String filenames to a {@code List<File>}
@param srcDir The root directory of all files
@param files All files are relative to srcDir
@return a List of Files by joining srcDir to each file
"""
List<File> newFiles = new ArrayList<>();
for(String file : files) {
boolean hasMatchingExtension = m.mapFileName(file) != null; //use mapFileName as a check to validate if the source file extension is recognized by the mapper or not
if(hasMatchingExtension) {
newFiles.add(new File(srcDir, file));
}
}
return newFiles;
} | java | private List<File> asFiles(File srcDir, String[] files, FileNameMapper m) {
List<File> newFiles = new ArrayList<>();
for(String file : files) {
boolean hasMatchingExtension = m.mapFileName(file) != null; //use mapFileName as a check to validate if the source file extension is recognized by the mapper or not
if(hasMatchingExtension) {
newFiles.add(new File(srcDir, file));
}
}
return newFiles;
} | [
"private",
"List",
"<",
"File",
">",
"asFiles",
"(",
"File",
"srcDir",
",",
"String",
"[",
"]",
"files",
",",
"FileNameMapper",
"m",
")",
"{",
"List",
"<",
"File",
">",
"newFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"file",
":",
"files",
")",
"{",
"boolean",
"hasMatchingExtension",
"=",
"m",
".",
"mapFileName",
"(",
"file",
")",
"!=",
"null",
";",
"//use mapFileName as a check to validate if the source file extension is recognized by the mapper or not",
"if",
"(",
"hasMatchingExtension",
")",
"{",
"newFiles",
".",
"add",
"(",
"new",
"File",
"(",
"srcDir",
",",
"file",
")",
")",
";",
"}",
"}",
"return",
"newFiles",
";",
"}"
] | Converts an array of relative String filenames to a {@code List<File>}
@param srcDir The root directory of all files
@param files All files are relative to srcDir
@return a List of Files by joining srcDir to each file | [
"Converts",
"an",
"array",
"of",
"relative",
"String",
"filenames",
"to",
"a",
"{"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java#L242-L251 |
duracloud/duracloud | chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java | DuracloudContentWriter.writeChunk | private void writeChunk(String spaceId, ChunkInputStream chunk)
throws NotFoundException {
"""
/*
Writes chunk to DuraCloud if it does not already exist in DuraCloud with a
matching checksum. Retry failed transfers.
"""
// Write chunk as a temp file
String chunkId = chunk.getChunkId();
File chunkFile = IOUtil.writeStreamToFile(chunk);
try {
String chunkChecksum = getChunkChecksum(chunkFile);
// Write chunk if it is not already in storage (or jumpstart is enabled)
if (jumpStart || !chunkInStorage(spaceId, chunkId, chunkChecksum)) {
try {
createRetrier().execute(new Retriable() {
private int attempt = 0;
@Override
public Object retry() throws Exception {
attempt++;
try (InputStream chunkStream = new FileInputStream(chunkFile)) {
ChunkInputStream chunkFileStream =
new ChunkInputStream(chunkId,
chunkStream,
chunkFile.length(),
chunk.md5Preserved());
writeSingle(spaceId, chunkChecksum, chunkFileStream, attempt == getMaxRetries() + 1);
}
return "";
}
});
} catch (Exception e) {
String err = "Failed to store chunk with ID " + chunkId +
" in space " + spaceId + " after " + getMaxRetries() +
" attempts. Last error: " + e.getMessage();
throw new DuraCloudRuntimeException(err, e);
}
}
} finally {
if (null != chunkFile && chunkFile.exists()) {
FileUtils.deleteQuietly(chunkFile);
}
}
} | java | private void writeChunk(String spaceId, ChunkInputStream chunk)
throws NotFoundException {
// Write chunk as a temp file
String chunkId = chunk.getChunkId();
File chunkFile = IOUtil.writeStreamToFile(chunk);
try {
String chunkChecksum = getChunkChecksum(chunkFile);
// Write chunk if it is not already in storage (or jumpstart is enabled)
if (jumpStart || !chunkInStorage(spaceId, chunkId, chunkChecksum)) {
try {
createRetrier().execute(new Retriable() {
private int attempt = 0;
@Override
public Object retry() throws Exception {
attempt++;
try (InputStream chunkStream = new FileInputStream(chunkFile)) {
ChunkInputStream chunkFileStream =
new ChunkInputStream(chunkId,
chunkStream,
chunkFile.length(),
chunk.md5Preserved());
writeSingle(spaceId, chunkChecksum, chunkFileStream, attempt == getMaxRetries() + 1);
}
return "";
}
});
} catch (Exception e) {
String err = "Failed to store chunk with ID " + chunkId +
" in space " + spaceId + " after " + getMaxRetries() +
" attempts. Last error: " + e.getMessage();
throw new DuraCloudRuntimeException(err, e);
}
}
} finally {
if (null != chunkFile && chunkFile.exists()) {
FileUtils.deleteQuietly(chunkFile);
}
}
} | [
"private",
"void",
"writeChunk",
"(",
"String",
"spaceId",
",",
"ChunkInputStream",
"chunk",
")",
"throws",
"NotFoundException",
"{",
"// Write chunk as a temp file",
"String",
"chunkId",
"=",
"chunk",
".",
"getChunkId",
"(",
")",
";",
"File",
"chunkFile",
"=",
"IOUtil",
".",
"writeStreamToFile",
"(",
"chunk",
")",
";",
"try",
"{",
"String",
"chunkChecksum",
"=",
"getChunkChecksum",
"(",
"chunkFile",
")",
";",
"// Write chunk if it is not already in storage (or jumpstart is enabled)",
"if",
"(",
"jumpStart",
"||",
"!",
"chunkInStorage",
"(",
"spaceId",
",",
"chunkId",
",",
"chunkChecksum",
")",
")",
"{",
"try",
"{",
"createRetrier",
"(",
")",
".",
"execute",
"(",
"new",
"Retriable",
"(",
")",
"{",
"private",
"int",
"attempt",
"=",
"0",
";",
"@",
"Override",
"public",
"Object",
"retry",
"(",
")",
"throws",
"Exception",
"{",
"attempt",
"++",
";",
"try",
"(",
"InputStream",
"chunkStream",
"=",
"new",
"FileInputStream",
"(",
"chunkFile",
")",
")",
"{",
"ChunkInputStream",
"chunkFileStream",
"=",
"new",
"ChunkInputStream",
"(",
"chunkId",
",",
"chunkStream",
",",
"chunkFile",
".",
"length",
"(",
")",
",",
"chunk",
".",
"md5Preserved",
"(",
")",
")",
";",
"writeSingle",
"(",
"spaceId",
",",
"chunkChecksum",
",",
"chunkFileStream",
",",
"attempt",
"==",
"getMaxRetries",
"(",
")",
"+",
"1",
")",
";",
"}",
"return",
"\"\"",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"err",
"=",
"\"Failed to store chunk with ID \"",
"+",
"chunkId",
"+",
"\" in space \"",
"+",
"spaceId",
"+",
"\" after \"",
"+",
"getMaxRetries",
"(",
")",
"+",
"\" attempts. Last error: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"throw",
"new",
"DuraCloudRuntimeException",
"(",
"err",
",",
"e",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"null",
"!=",
"chunkFile",
"&&",
"chunkFile",
".",
"exists",
"(",
")",
")",
"{",
"FileUtils",
".",
"deleteQuietly",
"(",
"chunkFile",
")",
";",
"}",
"}",
"}"
] | /*
Writes chunk to DuraCloud if it does not already exist in DuraCloud with a
matching checksum. Retry failed transfers. | [
"/",
"*",
"Writes",
"chunk",
"to",
"DuraCloud",
"if",
"it",
"does",
"not",
"already",
"exist",
"in",
"DuraCloud",
"with",
"a",
"matching",
"checksum",
".",
"Retry",
"failed",
"transfers",
"."
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java#L198-L240 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/engine/MergedContextSource.java | MergedContextSource.init | public void init(ClassLoader loader,
ContextSource[] contextSources,
String[] prefixes, boolean profilingEnabled) throws Exception {
"""
Creates a unified context source for all those passed in. An Exception
may be thrown if the call to a source's getContextType() method throws
an exception.
"""
mSources = contextSources;
int len = contextSources.length;
ArrayList<Class<?>> contextList = new ArrayList<Class<?>>(len);
ArrayList<ClassLoader> delegateList = new ArrayList<ClassLoader>(len);
for (int j = 0; j < contextSources.length; j++) {
Class<?> type = contextSources[j].getContextType();
if (type != null) {
contextList.add(type);
ClassLoader scout = type.getClassLoader();
if (scout != null && !delegateList.contains(scout)) {
delegateList.add(scout);
}
}
}
mContextsInOrder = contextList.toArray(new Class[contextList.size()]);
ClassLoader[] delegateLoaders =
delegateList.toArray(new ClassLoader[delegateList.size()]);
mInjector = new ClassInjector
(new DelegateClassLoader(loader, delegateLoaders));
mProfilingEnabled = profilingEnabled;
int observerMode = profilingEnabled ? MergedClass.OBSERVER_ENABLED | MergedClass.OBSERVER_EXTERNAL : MergedClass.OBSERVER_ENABLED;
// temporarily include interface for UtilityContext for backwards
// compatibility with old code relying on it.
Class<?>[] interfaces = { UtilityContext.class };
mConstr = MergedClass.getConstructor2(mInjector,
mContextsInOrder,
prefixes,
interfaces,
observerMode);
} | java | public void init(ClassLoader loader,
ContextSource[] contextSources,
String[] prefixes, boolean profilingEnabled) throws Exception {
mSources = contextSources;
int len = contextSources.length;
ArrayList<Class<?>> contextList = new ArrayList<Class<?>>(len);
ArrayList<ClassLoader> delegateList = new ArrayList<ClassLoader>(len);
for (int j = 0; j < contextSources.length; j++) {
Class<?> type = contextSources[j].getContextType();
if (type != null) {
contextList.add(type);
ClassLoader scout = type.getClassLoader();
if (scout != null && !delegateList.contains(scout)) {
delegateList.add(scout);
}
}
}
mContextsInOrder = contextList.toArray(new Class[contextList.size()]);
ClassLoader[] delegateLoaders =
delegateList.toArray(new ClassLoader[delegateList.size()]);
mInjector = new ClassInjector
(new DelegateClassLoader(loader, delegateLoaders));
mProfilingEnabled = profilingEnabled;
int observerMode = profilingEnabled ? MergedClass.OBSERVER_ENABLED | MergedClass.OBSERVER_EXTERNAL : MergedClass.OBSERVER_ENABLED;
// temporarily include interface for UtilityContext for backwards
// compatibility with old code relying on it.
Class<?>[] interfaces = { UtilityContext.class };
mConstr = MergedClass.getConstructor2(mInjector,
mContextsInOrder,
prefixes,
interfaces,
observerMode);
} | [
"public",
"void",
"init",
"(",
"ClassLoader",
"loader",
",",
"ContextSource",
"[",
"]",
"contextSources",
",",
"String",
"[",
"]",
"prefixes",
",",
"boolean",
"profilingEnabled",
")",
"throws",
"Exception",
"{",
"mSources",
"=",
"contextSources",
";",
"int",
"len",
"=",
"contextSources",
".",
"length",
";",
"ArrayList",
"<",
"Class",
"<",
"?",
">",
">",
"contextList",
"=",
"new",
"ArrayList",
"<",
"Class",
"<",
"?",
">",
">",
"(",
"len",
")",
";",
"ArrayList",
"<",
"ClassLoader",
">",
"delegateList",
"=",
"new",
"ArrayList",
"<",
"ClassLoader",
">",
"(",
"len",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"contextSources",
".",
"length",
";",
"j",
"++",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"contextSources",
"[",
"j",
"]",
".",
"getContextType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"contextList",
".",
"add",
"(",
"type",
")",
";",
"ClassLoader",
"scout",
"=",
"type",
".",
"getClassLoader",
"(",
")",
";",
"if",
"(",
"scout",
"!=",
"null",
"&&",
"!",
"delegateList",
".",
"contains",
"(",
"scout",
")",
")",
"{",
"delegateList",
".",
"add",
"(",
"scout",
")",
";",
"}",
"}",
"}",
"mContextsInOrder",
"=",
"contextList",
".",
"toArray",
"(",
"new",
"Class",
"[",
"contextList",
".",
"size",
"(",
")",
"]",
")",
";",
"ClassLoader",
"[",
"]",
"delegateLoaders",
"=",
"delegateList",
".",
"toArray",
"(",
"new",
"ClassLoader",
"[",
"delegateList",
".",
"size",
"(",
")",
"]",
")",
";",
"mInjector",
"=",
"new",
"ClassInjector",
"(",
"new",
"DelegateClassLoader",
"(",
"loader",
",",
"delegateLoaders",
")",
")",
";",
"mProfilingEnabled",
"=",
"profilingEnabled",
";",
"int",
"observerMode",
"=",
"profilingEnabled",
"?",
"MergedClass",
".",
"OBSERVER_ENABLED",
"|",
"MergedClass",
".",
"OBSERVER_EXTERNAL",
":",
"MergedClass",
".",
"OBSERVER_ENABLED",
";",
"// temporarily include interface for UtilityContext for backwards",
"// compatibility with old code relying on it.",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"{",
"UtilityContext",
".",
"class",
"}",
";",
"mConstr",
"=",
"MergedClass",
".",
"getConstructor2",
"(",
"mInjector",
",",
"mContextsInOrder",
",",
"prefixes",
",",
"interfaces",
",",
"observerMode",
")",
";",
"}"
] | Creates a unified context source for all those passed in. An Exception
may be thrown if the call to a source's getContextType() method throws
an exception. | [
"Creates",
"a",
"unified",
"context",
"source",
"for",
"all",
"those",
"passed",
"in",
".",
"An",
"Exception",
"may",
"be",
"thrown",
"if",
"the",
"call",
"to",
"a",
"source",
"s",
"getContextType",
"()",
"method",
"throws",
"an",
"exception",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/engine/MergedContextSource.java#L54-L94 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java | ControlCreateDurableImpl.setDurableSelectorNamespaceMap | public void setDurableSelectorNamespaceMap(Map<String,String> namespaceMap) {
"""
Sets a map of prefixes to namespace URLs that are associated with the selector.
@param namespaceMap
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDurableSelectorNamespaceMap", namespaceMap);
if (namespaceMap == null) {
jmo.setChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP, ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET);
}
else {
List<String> names = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Set<Map.Entry<String,String>> es = namespaceMap.entrySet();
for (Map.Entry<String,String> entry : es) {
names.add(entry.getKey());
values.add(entry.getValue());
}
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME, names);
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDurableSelectorNamespaceMap");
} | java | public void setDurableSelectorNamespaceMap(Map<String,String> namespaceMap) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDurableSelectorNamespaceMap", namespaceMap);
if (namespaceMap == null) {
jmo.setChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP, ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET);
}
else {
List<String> names = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Set<Map.Entry<String,String>> es = namespaceMap.entrySet();
for (Map.Entry<String,String> entry : es) {
names.add(entry.getKey());
values.add(entry.getValue());
}
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME, names);
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDurableSelectorNamespaceMap");
} | [
"public",
"void",
"setDurableSelectorNamespaceMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMap",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setDurableSelectorNamespaceMap\"",
",",
"namespaceMap",
")",
";",
"if",
"(",
"namespaceMap",
"==",
"null",
")",
"{",
"jmo",
".",
"setChoiceField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP",
",",
"ControlAccess",
".",
"IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET",
")",
";",
"}",
"else",
"{",
"List",
"<",
"String",
">",
"names",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"es",
"=",
"namespaceMap",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"es",
")",
"{",
"names",
".",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"values",
".",
"add",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"jmo",
".",
"setField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME",
",",
"names",
")",
";",
"jmo",
".",
"setField",
"(",
"ControlAccess",
".",
"BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE",
",",
"values",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setDurableSelectorNamespaceMap\"",
")",
";",
"}"
] | Sets a map of prefixes to namespace URLs that are associated with the selector.
@param namespaceMap | [
"Sets",
"a",
"map",
"of",
"prefixes",
"to",
"namespace",
"URLs",
"that",
"are",
"associated",
"with",
"the",
"selector",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlCreateDurableImpl.java#L287-L304 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.stripException | public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) {
"""
Unpacks an specified exception and returns its cause. Otherwise the given
{@link Throwable} is returned.
@param throwableToStrip to strip
@param typeToStrip type to strip
@return Unpacked cause or given Throwable if not packed
"""
while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) {
throwableToStrip = throwableToStrip.getCause();
}
return throwableToStrip;
} | java | public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) {
while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) {
throwableToStrip = throwableToStrip.getCause();
}
return throwableToStrip;
} | [
"public",
"static",
"Throwable",
"stripException",
"(",
"Throwable",
"throwableToStrip",
",",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"typeToStrip",
")",
"{",
"while",
"(",
"typeToStrip",
".",
"isAssignableFrom",
"(",
"throwableToStrip",
".",
"getClass",
"(",
")",
")",
"&&",
"throwableToStrip",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"throwableToStrip",
"=",
"throwableToStrip",
".",
"getCause",
"(",
")",
";",
"}",
"return",
"throwableToStrip",
";",
"}"
] | Unpacks an specified exception and returns its cause. Otherwise the given
{@link Throwable} is returned.
@param throwableToStrip to strip
@param typeToStrip type to strip
@return Unpacked cause or given Throwable if not packed | [
"Unpacks",
"an",
"specified",
"exception",
"and",
"returns",
"its",
"cause",
".",
"Otherwise",
"the",
"given",
"{",
"@link",
"Throwable",
"}",
"is",
"returned",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L419-L425 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java | SRTServletRequestUtils.removePrivateAttribute | public static void removePrivateAttribute(HttpServletRequest req, String key) {
"""
Remove a private attribute from the request (if applicable).
If the request object is of an unexpected type, no operation occurs.
@param req
@param key
@see IPrivateRequestAttributes#removePrivateAttribute(String)
"""
HttpServletRequest sr = getWrappedServletRequestObject(req);
if (sr instanceof IPrivateRequestAttributes) {
((IPrivateRequestAttributes) sr).removePrivateAttribute(key);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req);
}
}
} | java | public static void removePrivateAttribute(HttpServletRequest req, String key) {
HttpServletRequest sr = getWrappedServletRequestObject(req);
if (sr instanceof IPrivateRequestAttributes) {
((IPrivateRequestAttributes) sr).removePrivateAttribute(key);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req);
}
}
} | [
"public",
"static",
"void",
"removePrivateAttribute",
"(",
"HttpServletRequest",
"req",
",",
"String",
"key",
")",
"{",
"HttpServletRequest",
"sr",
"=",
"getWrappedServletRequestObject",
"(",
"req",
")",
";",
"if",
"(",
"sr",
"instanceof",
"IPrivateRequestAttributes",
")",
"{",
"(",
"(",
"IPrivateRequestAttributes",
")",
"sr",
")",
".",
"removePrivateAttribute",
"(",
"key",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getPrivateAttribute called for non-IPrivateRequestAttributes object\"",
",",
"req",
")",
";",
"}",
"}",
"}"
] | Remove a private attribute from the request (if applicable).
If the request object is of an unexpected type, no operation occurs.
@param req
@param key
@see IPrivateRequestAttributes#removePrivateAttribute(String) | [
"Remove",
"a",
"private",
"attribute",
"from",
"the",
"request",
"(",
"if",
"applicable",
")",
".",
"If",
"the",
"request",
"object",
"is",
"of",
"an",
"unexpected",
"type",
"no",
"operation",
"occurs",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java#L76-L85 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllFieldDefinitions | public void forAllFieldDefinitions(String template, Properties attributes) throws XDocletException {
"""
Processes the template for all field definitions of the current class definition (including inherited ones if
required)
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block"
"""
for (Iterator it = _curClassDef.getFields(); it.hasNext(); )
{
_curFieldDef = (FieldDescriptorDef)it.next();
if (!isFeatureIgnored(LEVEL_FIELD) &&
!_curFieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
{
generate(template);
}
}
_curFieldDef = null;
} | java | public void forAllFieldDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getFields(); it.hasNext(); )
{
_curFieldDef = (FieldDescriptorDef)it.next();
if (!isFeatureIgnored(LEVEL_FIELD) &&
!_curFieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
{
generate(template);
}
}
_curFieldDef = null;
} | [
"public",
"void",
"forAllFieldDefinitions",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_curClassDef",
".",
"getFields",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"_curFieldDef",
"=",
"(",
"FieldDescriptorDef",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"isFeatureIgnored",
"(",
"LEVEL_FIELD",
")",
"&&",
"!",
"_curFieldDef",
".",
"getBooleanProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_IGNORE",
",",
"false",
")",
")",
"{",
"generate",
"(",
"template",
")",
";",
"}",
"}",
"_curFieldDef",
"=",
"null",
";",
"}"
] | Processes the template for all field definitions of the current class definition (including inherited ones if
required)
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"field",
"definitions",
"of",
"the",
"current",
"class",
"definition",
"(",
"including",
"inherited",
"ones",
"if",
"required",
")"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L791-L803 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.decodeRealNumberRangeLong | public static long decodeRealNumberRangeLong(String value, long offsetValue) {
"""
Decodes a long value from the string representation that was created by using
encodeRealNumberRange(..) function.
@param value
string representation of the long value
@param offsetValue
offset value that was used in the original encoding
@return original long value
"""
long offsetNumber = Long.parseLong(value, 10);
return (long) (offsetNumber - offsetValue);
} | java | public static long decodeRealNumberRangeLong(String value, long offsetValue) {
long offsetNumber = Long.parseLong(value, 10);
return (long) (offsetNumber - offsetValue);
} | [
"public",
"static",
"long",
"decodeRealNumberRangeLong",
"(",
"String",
"value",
",",
"long",
"offsetValue",
")",
"{",
"long",
"offsetNumber",
"=",
"Long",
".",
"parseLong",
"(",
"value",
",",
"10",
")",
";",
"return",
"(",
"long",
")",
"(",
"offsetNumber",
"-",
"offsetValue",
")",
";",
"}"
] | Decodes a long value from the string representation that was created by using
encodeRealNumberRange(..) function.
@param value
string representation of the long value
@param offsetValue
offset value that was used in the original encoding
@return original long value | [
"Decodes",
"a",
"long",
"value",
"from",
"the",
"string",
"representation",
"that",
"was",
"created",
"by",
"using",
"encodeRealNumberRange",
"(",
"..",
")",
"function",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L256-L259 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java | ImplicitObjectUtil.loadFacesBackingBean | public static void loadFacesBackingBean(ServletRequest request, FacesBackingBean facesBackingBean) {
"""
Load the JSF backing bean into the request.
@param request the request
@param facesBackingBean the JSF backing bean
"""
if(facesBackingBean != null)
request.setAttribute(BACKING_IMPLICIT_OBJECT_KEY, facesBackingBean);
} | java | public static void loadFacesBackingBean(ServletRequest request, FacesBackingBean facesBackingBean) {
if(facesBackingBean != null)
request.setAttribute(BACKING_IMPLICIT_OBJECT_KEY, facesBackingBean);
} | [
"public",
"static",
"void",
"loadFacesBackingBean",
"(",
"ServletRequest",
"request",
",",
"FacesBackingBean",
"facesBackingBean",
")",
"{",
"if",
"(",
"facesBackingBean",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"BACKING_IMPLICIT_OBJECT_KEY",
",",
"facesBackingBean",
")",
";",
"}"
] | Load the JSF backing bean into the request.
@param request the request
@param facesBackingBean the JSF backing bean | [
"Load",
"the",
"JSF",
"backing",
"bean",
"into",
"the",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L118-L121 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.getRenderValueForCell | public String getRenderValueForCell(final FacesContext context, final String rowKey, final int col) {
"""
Gets the render string for the value the given cell. Applys the available converters to convert the value.
@param context
@param rowKey
@param col
@return
"""
// if we have a submitted value still, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (submittedValues.containsKey(index)) {
return submittedValues.get(index);
}
final Object value = getValueForCell(context, rowKey, col);
if (value == null) {
return null;
}
final SheetColumn column = getColumns().get(col);
final Converter converter = ComponentUtils.getConverter(context, column);
if (converter == null) {
return value.toString();
}
else {
return converter.getAsString(context, this, value);
}
} | java | public String getRenderValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a submitted value still, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (submittedValues.containsKey(index)) {
return submittedValues.get(index);
}
final Object value = getValueForCell(context, rowKey, col);
if (value == null) {
return null;
}
final SheetColumn column = getColumns().get(col);
final Converter converter = ComponentUtils.getConverter(context, column);
if (converter == null) {
return value.toString();
}
else {
return converter.getAsString(context, this, value);
}
} | [
"public",
"String",
"getRenderValueForCell",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"String",
"rowKey",
",",
"final",
"int",
"col",
")",
"{",
"// if we have a submitted value still, use it",
"// note: can't check for null, as null may be the submitted value",
"final",
"SheetRowColIndex",
"index",
"=",
"new",
"SheetRowColIndex",
"(",
"rowKey",
",",
"col",
")",
";",
"if",
"(",
"submittedValues",
".",
"containsKey",
"(",
"index",
")",
")",
"{",
"return",
"submittedValues",
".",
"get",
"(",
"index",
")",
";",
"}",
"final",
"Object",
"value",
"=",
"getValueForCell",
"(",
"context",
",",
"rowKey",
",",
"col",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"SheetColumn",
"column",
"=",
"getColumns",
"(",
")",
".",
"get",
"(",
"col",
")",
";",
"final",
"Converter",
"converter",
"=",
"ComponentUtils",
".",
"getConverter",
"(",
"context",
",",
"column",
")",
";",
"if",
"(",
"converter",
"==",
"null",
")",
"{",
"return",
"value",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"converter",
".",
"getAsString",
"(",
"context",
",",
"this",
",",
"value",
")",
";",
"}",
"}"
] | Gets the render string for the value the given cell. Applys the available converters to convert the value.
@param context
@param rowKey
@param col
@return | [
"Gets",
"the",
"render",
"string",
"for",
"the",
"value",
"the",
"given",
"cell",
".",
"Applys",
"the",
"available",
"converters",
"to",
"convert",
"the",
"value",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L363-L385 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/seo/CmsSeoOptionsDialog.java | CmsSeoOptionsDialog.loadAliases | public static void loadAliases(final CmsUUID structureId, final AsyncCallback<List<CmsAliasBean>> callback) {
"""
Loads the aliases for a given page.<p>
@param structureId the structure id of the page
@param callback the callback for the loaded aliases
"""
final CmsRpcAction<List<CmsAliasBean>> action = new CmsRpcAction<List<CmsAliasBean>>() {
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().getAliasesForPage(structureId, this);
}
@Override
protected void onResponse(List<CmsAliasBean> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
} | java | public static void loadAliases(final CmsUUID structureId, final AsyncCallback<List<CmsAliasBean>> callback) {
final CmsRpcAction<List<CmsAliasBean>> action = new CmsRpcAction<List<CmsAliasBean>>() {
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().getAliasesForPage(structureId, this);
}
@Override
protected void onResponse(List<CmsAliasBean> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
} | [
"public",
"static",
"void",
"loadAliases",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"AsyncCallback",
"<",
"List",
"<",
"CmsAliasBean",
">",
">",
"callback",
")",
"{",
"final",
"CmsRpcAction",
"<",
"List",
"<",
"CmsAliasBean",
">",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"List",
"<",
"CmsAliasBean",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"start",
"(",
"200",
",",
"true",
")",
";",
"CmsCoreProvider",
".",
"getVfsService",
"(",
")",
".",
"getAliasesForPage",
"(",
"structureId",
",",
"this",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"onResponse",
"(",
"List",
"<",
"CmsAliasBean",
">",
"result",
")",
"{",
"stop",
"(",
"false",
")",
";",
"callback",
".",
"onSuccess",
"(",
"result",
")",
";",
"}",
"}",
";",
"action",
".",
"execute",
"(",
")",
";",
"}"
] | Loads the aliases for a given page.<p>
@param structureId the structure id of the page
@param callback the callback for the loaded aliases | [
"Loads",
"the",
"aliases",
"for",
"a",
"given",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsSeoOptionsDialog.java#L186-L205 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getStatsSummary | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
"""
Get player stats for the player
@param summoner The id of the summoner
@param season The season
@return The player's stats
@see <a href=https://developer.riotgames.com/api/methods#!/622/1938>Official API documentation</a>
"""
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | java | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | [
"public",
"Future",
"<",
"List",
"<",
"PlayerStats",
">",
">",
"getStatsSummary",
"(",
"long",
"summoner",
",",
"Season",
"season",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getStatsSummary",
"(",
"summoner",
",",
"season",
")",
")",
";",
"}"
] | Get player stats for the player
@param summoner The id of the summoner
@param season The season
@return The player's stats
@see <a href=https://developer.riotgames.com/api/methods#!/622/1938>Official API documentation</a> | [
"Get",
"player",
"stats",
"for",
"the",
"player"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1076-L1078 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/protocol/version07/Base64.java | Base64.encodeBytes | public static String encodeBytes(byte[] source, int options) throws java.io.IOException {
"""
Encodes a byte array into Base64 notation.
<p>
Example options:
<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p>
Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
<p>
As of v 2.3, if there is an error with the GZIP stream, the method will throw an java.io.IOException. <b>This is new to
v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.
</p>
@param source The data to convert
@param options Specified options
@return The Base64-encoded data as a String
@see Base64#GZIP
@see Base64#DO_BREAK_LINES
@throws java.io.IOException if there is an error
@throws NullPointerException if source array is null
@since 2.0
"""
return encodeBytes(source, 0, source.length, options);
} | java | public static String encodeBytes(byte[] source, int options) throws java.io.IOException {
return encodeBytes(source, 0, source.length, options);
} | [
"public",
"static",
"String",
"encodeBytes",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"options",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"return",
"encodeBytes",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
",",
"options",
")",
";",
"}"
] | Encodes a byte array into Base64 notation.
<p>
Example options:
<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p>
Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
<p>
As of v 2.3, if there is an error with the GZIP stream, the method will throw an java.io.IOException. <b>This is new to
v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.
</p>
@param source The data to convert
@param options Specified options
@return The Base64-encoded data as a String
@see Base64#GZIP
@see Base64#DO_BREAK_LINES
@throws java.io.IOException if there is an error
@throws NullPointerException if source array is null
@since 2.0 | [
"Encodes",
"a",
"byte",
"array",
"into",
"Base64",
"notation",
".",
"<p",
">",
"Example",
"options",
":"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/protocol/version07/Base64.java#L691-L693 |
scireum/server-sass | src/main/java/org/serversass/ast/FunctionCall.java | FunctionCall.appendNameAndParameters | protected static void appendNameAndParameters(StringBuilder sb, String name, List<Expression> parameters) {
"""
Appends the name and parameters to the given string builder.
@param sb the target to write the output to
@param name the name of the function
@param parameters the list of parameters
"""
sb.append(name);
sb.append("(");
boolean first = true;
for (Expression expr : parameters) {
if (!first) {
sb.append(", ");
}
first = false;
sb.append(expr);
}
sb.append(")");
} | java | protected static void appendNameAndParameters(StringBuilder sb, String name, List<Expression> parameters) {
sb.append(name);
sb.append("(");
boolean first = true;
for (Expression expr : parameters) {
if (!first) {
sb.append(", ");
}
first = false;
sb.append(expr);
}
sb.append(")");
} | [
"protected",
"static",
"void",
"appendNameAndParameters",
"(",
"StringBuilder",
"sb",
",",
"String",
"name",
",",
"List",
"<",
"Expression",
">",
"parameters",
")",
"{",
"sb",
".",
"append",
"(",
"name",
")",
";",
"sb",
".",
"append",
"(",
"\"(\"",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Expression",
"expr",
":",
"parameters",
")",
"{",
"if",
"(",
"!",
"first",
")",
"{",
"sb",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"first",
"=",
"false",
";",
"sb",
".",
"append",
"(",
"expr",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\")\"",
")",
";",
"}"
] | Appends the name and parameters to the given string builder.
@param sb the target to write the output to
@param name the name of the function
@param parameters the list of parameters | [
"Appends",
"the",
"name",
"and",
"parameters",
"to",
"the",
"given",
"string",
"builder",
"."
] | train | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/ast/FunctionCall.java#L48-L60 |
mcaserta/spring-crypto-utils | src/main/java/com/springcryptoutils/core/key/PrivateKeyRegistryByAliasImpl.java | PrivateKeyRegistryByAliasImpl.get | public PrivateKey get(KeyStoreChooser keyStoreChooser, PrivateKeyChooserByAlias privateKeyChooserByAlias) {
"""
Returns the selected private key or null if not found.
@param keyStoreChooser the keystore chooser
@param privateKeyChooserByAlias the private key chooser by alias
@return the selected private key or null if not found
"""
CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), privateKeyChooserByAlias.getAlias());
PrivateKey retrievedPrivateKey = cache.get(cacheKey);
if (retrievedPrivateKey != null) {
return retrievedPrivateKey;
}
KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser);
if (keyStore != null) {
PrivateKeyFactoryBean factory = new PrivateKeyFactoryBean();
factory.setKeystore(keyStore);
factory.setAlias(privateKeyChooserByAlias.getAlias());
factory.setPassword(privateKeyChooserByAlias.getPassword());
try {
factory.afterPropertiesSet();
PrivateKey privateKey = (PrivateKey) factory.getObject();
if (privateKey != null) {
cache.put(cacheKey, privateKey);
}
return privateKey;
} catch (Exception e) {
throw new PrivateKeyException("error initializing private key factory bean", e);
}
}
return null;
} | java | public PrivateKey get(KeyStoreChooser keyStoreChooser, PrivateKeyChooserByAlias privateKeyChooserByAlias) {
CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), privateKeyChooserByAlias.getAlias());
PrivateKey retrievedPrivateKey = cache.get(cacheKey);
if (retrievedPrivateKey != null) {
return retrievedPrivateKey;
}
KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser);
if (keyStore != null) {
PrivateKeyFactoryBean factory = new PrivateKeyFactoryBean();
factory.setKeystore(keyStore);
factory.setAlias(privateKeyChooserByAlias.getAlias());
factory.setPassword(privateKeyChooserByAlias.getPassword());
try {
factory.afterPropertiesSet();
PrivateKey privateKey = (PrivateKey) factory.getObject();
if (privateKey != null) {
cache.put(cacheKey, privateKey);
}
return privateKey;
} catch (Exception e) {
throw new PrivateKeyException("error initializing private key factory bean", e);
}
}
return null;
} | [
"public",
"PrivateKey",
"get",
"(",
"KeyStoreChooser",
"keyStoreChooser",
",",
"PrivateKeyChooserByAlias",
"privateKeyChooserByAlias",
")",
"{",
"CacheKey",
"cacheKey",
"=",
"new",
"CacheKey",
"(",
"keyStoreChooser",
".",
"getKeyStoreName",
"(",
")",
",",
"privateKeyChooserByAlias",
".",
"getAlias",
"(",
")",
")",
";",
"PrivateKey",
"retrievedPrivateKey",
"=",
"cache",
".",
"get",
"(",
"cacheKey",
")",
";",
"if",
"(",
"retrievedPrivateKey",
"!=",
"null",
")",
"{",
"return",
"retrievedPrivateKey",
";",
"}",
"KeyStore",
"keyStore",
"=",
"keyStoreRegistry",
".",
"get",
"(",
"keyStoreChooser",
")",
";",
"if",
"(",
"keyStore",
"!=",
"null",
")",
"{",
"PrivateKeyFactoryBean",
"factory",
"=",
"new",
"PrivateKeyFactoryBean",
"(",
")",
";",
"factory",
".",
"setKeystore",
"(",
"keyStore",
")",
";",
"factory",
".",
"setAlias",
"(",
"privateKeyChooserByAlias",
".",
"getAlias",
"(",
")",
")",
";",
"factory",
".",
"setPassword",
"(",
"privateKeyChooserByAlias",
".",
"getPassword",
"(",
")",
")",
";",
"try",
"{",
"factory",
".",
"afterPropertiesSet",
"(",
")",
";",
"PrivateKey",
"privateKey",
"=",
"(",
"PrivateKey",
")",
"factory",
".",
"getObject",
"(",
")",
";",
"if",
"(",
"privateKey",
"!=",
"null",
")",
"{",
"cache",
".",
"put",
"(",
"cacheKey",
",",
"privateKey",
")",
";",
"}",
"return",
"privateKey",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PrivateKeyException",
"(",
"\"error initializing private key factory bean\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns the selected private key or null if not found.
@param keyStoreChooser the keystore chooser
@param privateKeyChooserByAlias the private key chooser by alias
@return the selected private key or null if not found | [
"Returns",
"the",
"selected",
"private",
"key",
"or",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/mcaserta/spring-crypto-utils/blob/1dbf6211542fb1e3f9297941d691e7e89cc72c46/src/main/java/com/springcryptoutils/core/key/PrivateKeyRegistryByAliasImpl.java#L53-L82 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.hasActions | @Override
public boolean hasActions(int position, SwipeDirection direction) {
"""
SwipeActionTouchListener.ActionCallbacks callback
We just link it through to our own interface
@param position the position of the item that was swiped
@param direction the direction in which the swipe has happened
@return boolean indicating whether the item has actions
"""
return mSwipeActionListener != null && mSwipeActionListener.hasActions(position, direction);
} | java | @Override
public boolean hasActions(int position, SwipeDirection direction){
return mSwipeActionListener != null && mSwipeActionListener.hasActions(position, direction);
} | [
"@",
"Override",
"public",
"boolean",
"hasActions",
"(",
"int",
"position",
",",
"SwipeDirection",
"direction",
")",
"{",
"return",
"mSwipeActionListener",
"!=",
"null",
"&&",
"mSwipeActionListener",
".",
"hasActions",
"(",
"position",
",",
"direction",
")",
";",
"}"
] | SwipeActionTouchListener.ActionCallbacks callback
We just link it through to our own interface
@param position the position of the item that was swiped
@param direction the direction in which the swipe has happened
@return boolean indicating whether the item has actions | [
"SwipeActionTouchListener",
".",
"ActionCallbacks",
"callback",
"We",
"just",
"link",
"it",
"through",
"to",
"our",
"own",
"interface"
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L76-L79 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UBench.java | UBench.press | public UReport press(UMode mode, final long timeLimit, final TimeUnit timeUnit) {
"""
Benchmark all added tasks until they exceed the set time limit
@param mode
The UMode execution model to use for task execution
@param timeLimit
combined with the timeUnit, indicates how long to run tests
for. A value less than or equal to 0 turns off this check.
@param timeUnit
combined with the timeLimit, indicates how long to run tests
for.
@return the results of all completed tasks.
"""
return press(mode, 0, 0, 0.0, timeLimit, timeUnit);
} | java | public UReport press(UMode mode, final long timeLimit, final TimeUnit timeUnit) {
return press(mode, 0, 0, 0.0, timeLimit, timeUnit);
} | [
"public",
"UReport",
"press",
"(",
"UMode",
"mode",
",",
"final",
"long",
"timeLimit",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"press",
"(",
"mode",
",",
"0",
",",
"0",
",",
"0.0",
",",
"timeLimit",
",",
"timeUnit",
")",
";",
"}"
] | Benchmark all added tasks until they exceed the set time limit
@param mode
The UMode execution model to use for task execution
@param timeLimit
combined with the timeUnit, indicates how long to run tests
for. A value less than or equal to 0 turns off this check.
@param timeUnit
combined with the timeLimit, indicates how long to run tests
for.
@return the results of all completed tasks. | [
"Benchmark",
"all",
"added",
"tasks",
"until",
"they",
"exceed",
"the",
"set",
"time",
"limit"
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L351-L353 |
Azure/azure-sdk-for-java | iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java | AppsInner.beginUpdate | public AppInner beginUpdate(String resourceGroupName, String resourceName, AppPatch appPatch) {
"""
Update the metadata of an IoT Central application.
@param resourceGroupName The name of the resource group that contains the IoT Central application.
@param resourceName The ARM resource name of the IoT Central application.
@param appPatch The IoT Central application metadata and security metadata.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppInner object if successful.
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).toBlocking().single().body();
} | java | public AppInner beginUpdate(String resourceGroupName, String resourceName, AppPatch appPatch) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).toBlocking().single().body();
} | [
"public",
"AppInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"AppPatch",
"appPatch",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"appPatch",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Update the metadata of an IoT Central application.
@param resourceGroupName The name of the resource group that contains the IoT Central application.
@param resourceName The ARM resource name of the IoT Central application.
@param appPatch The IoT Central application metadata and security metadata.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppInner object if successful. | [
"Update",
"the",
"metadata",
"of",
"an",
"IoT",
"Central",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L468-L470 |
Headline/CleverBotAPI-Java | src/main/java/com/michaelwflaherty/cleverbotapi/CleverBotQuery.java | CleverBotQuery.sendRequest | public void sendRequest() throws IOException {
"""
Sends request to CleverBot servers. API key and phrase should be set prior to this call
@throws IOException exception upon query failure
"""
/* Create & Format URL */
URL url = new URL(CleverBotQuery.formatRequest(CleverBotQuery.URL_STRING, this.key, this.phrase, this.conversationID));
/* Open Connection */
URLConnection urlConnection = url.openConnection();
/* Read input */
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String inputLine = in.readLine();
/* Create JSON Object */
JsonObject jsonObject = new JsonParser().parse(inputLine).getAsJsonObject(); // convert to JSON
/* Get params */
this.setConversationID(jsonObject.get("cs").getAsString()); // update conversation ID
this.setResponse(jsonObject.get("output").getAsString()); // get output
this.setRandomNumber(Integer.parseInt(jsonObject.get("random_number").getAsString())); // get output
in.close(); // close!
} | java | public void sendRequest() throws IOException
{
/* Create & Format URL */
URL url = new URL(CleverBotQuery.formatRequest(CleverBotQuery.URL_STRING, this.key, this.phrase, this.conversationID));
/* Open Connection */
URLConnection urlConnection = url.openConnection();
/* Read input */
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String inputLine = in.readLine();
/* Create JSON Object */
JsonObject jsonObject = new JsonParser().parse(inputLine).getAsJsonObject(); // convert to JSON
/* Get params */
this.setConversationID(jsonObject.get("cs").getAsString()); // update conversation ID
this.setResponse(jsonObject.get("output").getAsString()); // get output
this.setRandomNumber(Integer.parseInt(jsonObject.get("random_number").getAsString())); // get output
in.close(); // close!
} | [
"public",
"void",
"sendRequest",
"(",
")",
"throws",
"IOException",
"{",
"/* Create & Format URL */",
"URL",
"url",
"=",
"new",
"URL",
"(",
"CleverBotQuery",
".",
"formatRequest",
"(",
"CleverBotQuery",
".",
"URL_STRING",
",",
"this",
".",
"key",
",",
"this",
".",
"phrase",
",",
"this",
".",
"conversationID",
")",
")",
";",
"/* Open Connection */",
"URLConnection",
"urlConnection",
"=",
"url",
".",
"openConnection",
"(",
")",
";",
"/* Read input */",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"urlConnection",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"String",
"inputLine",
"=",
"in",
".",
"readLine",
"(",
")",
";",
"/* Create JSON Object */",
"JsonObject",
"jsonObject",
"=",
"new",
"JsonParser",
"(",
")",
".",
"parse",
"(",
"inputLine",
")",
".",
"getAsJsonObject",
"(",
")",
";",
"// convert to JSON",
"/* Get params */",
"this",
".",
"setConversationID",
"(",
"jsonObject",
".",
"get",
"(",
"\"cs\"",
")",
".",
"getAsString",
"(",
")",
")",
";",
"// update conversation ID",
"this",
".",
"setResponse",
"(",
"jsonObject",
".",
"get",
"(",
"\"output\"",
")",
".",
"getAsString",
"(",
")",
")",
";",
"// get output",
"this",
".",
"setRandomNumber",
"(",
"Integer",
".",
"parseInt",
"(",
"jsonObject",
".",
"get",
"(",
"\"random_number\"",
")",
".",
"getAsString",
"(",
")",
")",
")",
";",
"// get output",
"in",
".",
"close",
"(",
")",
";",
"// close!",
"}"
] | Sends request to CleverBot servers. API key and phrase should be set prior to this call
@throws IOException exception upon query failure | [
"Sends",
"request",
"to",
"CleverBot",
"servers",
".",
"API",
"key",
"and",
"phrase",
"should",
"be",
"set",
"prior",
"to",
"this",
"call"
] | train | https://github.com/Headline/CleverBotAPI-Java/blob/fe6818362eec687cdfeb7ee8deb4d2ee19611676/src/main/java/com/michaelwflaherty/cleverbotapi/CleverBotQuery.java#L174-L194 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/FileIoUtil.java | FileIoUtil.readFileFrom | public static List<String> readFileFrom(String _fileName, Charset _charset, SearchOrder... _searchOrder) {
"""
Read a file from different sources depending on _searchOrder.
Will return the first successfully read file which can be loaded either from custom path, classpath or system path.
@param _fileName file to read
@param _charset charset used for reading
@param _searchOrder search order
@return List of String with file content or null if file could not be found
"""
InputStream stream = openInputStreamForFile(_fileName, _searchOrder);
if (stream != null) {
return readTextFileFromStream(stream, _charset, true);
}
return null;
} | java | public static List<String> readFileFrom(String _fileName, Charset _charset, SearchOrder... _searchOrder) {
InputStream stream = openInputStreamForFile(_fileName, _searchOrder);
if (stream != null) {
return readTextFileFromStream(stream, _charset, true);
}
return null;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readFileFrom",
"(",
"String",
"_fileName",
",",
"Charset",
"_charset",
",",
"SearchOrder",
"...",
"_searchOrder",
")",
"{",
"InputStream",
"stream",
"=",
"openInputStreamForFile",
"(",
"_fileName",
",",
"_searchOrder",
")",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"return",
"readTextFileFromStream",
"(",
"stream",
",",
"_charset",
",",
"true",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Read a file from different sources depending on _searchOrder.
Will return the first successfully read file which can be loaded either from custom path, classpath or system path.
@param _fileName file to read
@param _charset charset used for reading
@param _searchOrder search order
@return List of String with file content or null if file could not be found | [
"Read",
"a",
"file",
"from",
"different",
"sources",
"depending",
"on",
"_searchOrder",
".",
"Will",
"return",
"the",
"first",
"successfully",
"read",
"file",
"which",
"can",
"be",
"loaded",
"either",
"from",
"custom",
"path",
"classpath",
"or",
"system",
"path",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L476-L482 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/CapabilityRegistry.java | CapabilityRegistry.removePossibleCapability | @Override
public CapabilityRegistration<?> removePossibleCapability(Capability capability, PathAddress registrationPoint) {
"""
Remove a previously registered capability if all registration points for it have been removed.
@param capability the capability. Cannot be {@code null}
@param registrationPoint the specific registration point that is being removed
@return the capability that was removed, or {@code null} if no matching capability was registered or other
registration points for the capability still exist
"""
CapabilityId capabilityId = new CapabilityId(capability.getName(), CapabilityScope.GLOBAL);
CapabilityRegistration<?> removed = null;
writeLock.lock();
try {
CapabilityRegistration<?> candidate = possibleCapabilities.get(capabilityId);
if (candidate != null) {
RegistrationPoint rp = new RegistrationPoint(registrationPoint, null);
if (candidate.removeRegistrationPoint(rp)) {
if (candidate.getRegistrationPointCount() == 0) {
removed = possibleCapabilities.remove(capabilityId);
} else {
removed = candidate;
}
}
}
if (removed != null) {
modified = true;
}
return removed;
} finally {
writeLock.unlock();
}
} | java | @Override
public CapabilityRegistration<?> removePossibleCapability(Capability capability, PathAddress registrationPoint) {
CapabilityId capabilityId = new CapabilityId(capability.getName(), CapabilityScope.GLOBAL);
CapabilityRegistration<?> removed = null;
writeLock.lock();
try {
CapabilityRegistration<?> candidate = possibleCapabilities.get(capabilityId);
if (candidate != null) {
RegistrationPoint rp = new RegistrationPoint(registrationPoint, null);
if (candidate.removeRegistrationPoint(rp)) {
if (candidate.getRegistrationPointCount() == 0) {
removed = possibleCapabilities.remove(capabilityId);
} else {
removed = candidate;
}
}
}
if (removed != null) {
modified = true;
}
return removed;
} finally {
writeLock.unlock();
}
} | [
"@",
"Override",
"public",
"CapabilityRegistration",
"<",
"?",
">",
"removePossibleCapability",
"(",
"Capability",
"capability",
",",
"PathAddress",
"registrationPoint",
")",
"{",
"CapabilityId",
"capabilityId",
"=",
"new",
"CapabilityId",
"(",
"capability",
".",
"getName",
"(",
")",
",",
"CapabilityScope",
".",
"GLOBAL",
")",
";",
"CapabilityRegistration",
"<",
"?",
">",
"removed",
"=",
"null",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"CapabilityRegistration",
"<",
"?",
">",
"candidate",
"=",
"possibleCapabilities",
".",
"get",
"(",
"capabilityId",
")",
";",
"if",
"(",
"candidate",
"!=",
"null",
")",
"{",
"RegistrationPoint",
"rp",
"=",
"new",
"RegistrationPoint",
"(",
"registrationPoint",
",",
"null",
")",
";",
"if",
"(",
"candidate",
".",
"removeRegistrationPoint",
"(",
"rp",
")",
")",
"{",
"if",
"(",
"candidate",
".",
"getRegistrationPointCount",
"(",
")",
"==",
"0",
")",
"{",
"removed",
"=",
"possibleCapabilities",
".",
"remove",
"(",
"capabilityId",
")",
";",
"}",
"else",
"{",
"removed",
"=",
"candidate",
";",
"}",
"}",
"}",
"if",
"(",
"removed",
"!=",
"null",
")",
"{",
"modified",
"=",
"true",
";",
"}",
"return",
"removed",
";",
"}",
"finally",
"{",
"writeLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Remove a previously registered capability if all registration points for it have been removed.
@param capability the capability. Cannot be {@code null}
@param registrationPoint the specific registration point that is being removed
@return the capability that was removed, or {@code null} if no matching capability was registered or other
registration points for the capability still exist | [
"Remove",
"a",
"previously",
"registered",
"capability",
"if",
"all",
"registration",
"points",
"for",
"it",
"have",
"been",
"removed",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/CapabilityRegistry.java#L595-L620 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java | SightResourcesImpl.copySight | public Sight copySight(long sightId, ContainerDestination destination) throws SmartsheetException {
"""
Creates s copy of the specified Sight.
It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/copy
@param sightId the Id of the Sight
@param destination the destination to copy to
@return the newly created Sight resource.
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation
"""
return this.createResource("sights/" + sightId + "/copy", Sight.class, destination);
} | java | public Sight copySight(long sightId, ContainerDestination destination) throws SmartsheetException {
return this.createResource("sights/" + sightId + "/copy", Sight.class, destination);
} | [
"public",
"Sight",
"copySight",
"(",
"long",
"sightId",
",",
"ContainerDestination",
"destination",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"sights/\"",
"+",
"sightId",
"+",
"\"/copy\"",
",",
"Sight",
".",
"class",
",",
"destination",
")",
";",
"}"
] | Creates s copy of the specified Sight.
It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/copy
@param sightId the Id of the Sight
@param destination the destination to copy to
@return the newly created Sight resource.
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Creates",
"s",
"copy",
"of",
"the",
"specified",
"Sight",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java#L184-L186 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java | ProxyQueueConversationGroupImpl.createAsynchConsumerProxyQueue | public synchronized AsynchConsumerProxyQueue
createAsynchConsumerProxyQueue(OrderingContext oc)
throws SIResourceException, SIIncorrectCallException {
"""
Creates a new asynchronous consumer proxy queue for this group.
@throws SIResourceException
@throws SIResourceException
@throws SIIncorrectCallException
@throws SIIncorrectCallException
@throws SIErrorException
@throws SIConnectionUnavailableException
@throws SISessionUnavailableException
@throws SIConnectionDroppedException
@throws SISessionDroppedException
@see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createAsynchConsumerProxyQueue()
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createAsynchConsumerProxyQueue");
short id = nextId();
// begin D249096
AsynchConsumerProxyQueue proxyQueue = null;
if (oc == null)
{
proxyQueue =
new NonReadAheadSessionProxyQueueImpl(this, id, conversation);
}
else
{
proxyQueue =
new OrderedSessionProxyQueueImpl(this, id, conversation, oc);
}
// end D249096
idToProxyQueueMap.put(new ImmutableId(id), proxyQueue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createAsynchConsumerProxyQueue", proxyQueue);
return proxyQueue;
} | java | public synchronized AsynchConsumerProxyQueue
createAsynchConsumerProxyQueue(OrderingContext oc)
throws SIResourceException, SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createAsynchConsumerProxyQueue");
short id = nextId();
// begin D249096
AsynchConsumerProxyQueue proxyQueue = null;
if (oc == null)
{
proxyQueue =
new NonReadAheadSessionProxyQueueImpl(this, id, conversation);
}
else
{
proxyQueue =
new OrderedSessionProxyQueueImpl(this, id, conversation, oc);
}
// end D249096
idToProxyQueueMap.put(new ImmutableId(id), proxyQueue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createAsynchConsumerProxyQueue", proxyQueue);
return proxyQueue;
} | [
"public",
"synchronized",
"AsynchConsumerProxyQueue",
"createAsynchConsumerProxyQueue",
"(",
"OrderingContext",
"oc",
")",
"throws",
"SIResourceException",
",",
"SIIncorrectCallException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createAsynchConsumerProxyQueue\"",
")",
";",
"short",
"id",
"=",
"nextId",
"(",
")",
";",
"// begin D249096",
"AsynchConsumerProxyQueue",
"proxyQueue",
"=",
"null",
";",
"if",
"(",
"oc",
"==",
"null",
")",
"{",
"proxyQueue",
"=",
"new",
"NonReadAheadSessionProxyQueueImpl",
"(",
"this",
",",
"id",
",",
"conversation",
")",
";",
"}",
"else",
"{",
"proxyQueue",
"=",
"new",
"OrderedSessionProxyQueueImpl",
"(",
"this",
",",
"id",
",",
"conversation",
",",
"oc",
")",
";",
"}",
"// end D249096",
"idToProxyQueueMap",
".",
"put",
"(",
"new",
"ImmutableId",
"(",
"id",
")",
",",
"proxyQueue",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createAsynchConsumerProxyQueue\"",
",",
"proxyQueue",
")",
";",
"return",
"proxyQueue",
";",
"}"
] | Creates a new asynchronous consumer proxy queue for this group.
@throws SIResourceException
@throws SIResourceException
@throws SIIncorrectCallException
@throws SIIncorrectCallException
@throws SIErrorException
@throws SIConnectionUnavailableException
@throws SISessionUnavailableException
@throws SIConnectionDroppedException
@throws SISessionDroppedException
@see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createAsynchConsumerProxyQueue() | [
"Creates",
"a",
"new",
"asynchronous",
"consumer",
"proxy",
"queue",
"for",
"this",
"group",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L147-L173 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.listBySyncGroupAsync | public Observable<Page<SyncMemberInner>> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) {
"""
Lists sync members in the given sync group.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SyncMemberInner> object
"""
return listBySyncGroupWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName)
.map(new Func1<ServiceResponse<Page<SyncMemberInner>>, Page<SyncMemberInner>>() {
@Override
public Page<SyncMemberInner> call(ServiceResponse<Page<SyncMemberInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SyncMemberInner>> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) {
return listBySyncGroupWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName)
.map(new Func1<ServiceResponse<Page<SyncMemberInner>>, Page<SyncMemberInner>>() {
@Override
public Page<SyncMemberInner> call(ServiceResponse<Page<SyncMemberInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SyncMemberInner",
">",
">",
"listBySyncGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"databaseName",
",",
"final",
"String",
"syncGroupName",
")",
"{",
"return",
"listBySyncGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"syncGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SyncMemberInner",
">",
">",
",",
"Page",
"<",
"SyncMemberInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"SyncMemberInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"SyncMemberInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists sync members in the given sync group.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SyncMemberInner> object | [
"Lists",
"sync",
"members",
"in",
"the",
"given",
"sync",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L908-L916 |
calimero-project/calimero-core | src/tuwien/auto/calimero/xml/XmlOutputFactory.java | XmlOutputFactory.createXMLWriter | public XmlWriter createXMLWriter(final String systemId) throws KNXMLException {
"""
Creates a {@link XmlWriter} to write into the XML resource located by the specified identifier.
@param systemId location identifier of the XML resource
@return XML writer
@throws KNXMLException if creation of the writer failed or XML resource can't be resolved
"""
final XmlResolver res = new XmlResolver();
final OutputStream os = res.resolveOutput(systemId);
return create(os, true);
} | java | public XmlWriter createXMLWriter(final String systemId) throws KNXMLException
{
final XmlResolver res = new XmlResolver();
final OutputStream os = res.resolveOutput(systemId);
return create(os, true);
} | [
"public",
"XmlWriter",
"createXMLWriter",
"(",
"final",
"String",
"systemId",
")",
"throws",
"KNXMLException",
"{",
"final",
"XmlResolver",
"res",
"=",
"new",
"XmlResolver",
"(",
")",
";",
"final",
"OutputStream",
"os",
"=",
"res",
".",
"resolveOutput",
"(",
"systemId",
")",
";",
"return",
"create",
"(",
"os",
",",
"true",
")",
";",
"}"
] | Creates a {@link XmlWriter} to write into the XML resource located by the specified identifier.
@param systemId location identifier of the XML resource
@return XML writer
@throws KNXMLException if creation of the writer failed or XML resource can't be resolved | [
"Creates",
"a",
"{",
"@link",
"XmlWriter",
"}",
"to",
"write",
"into",
"the",
"XML",
"resource",
"located",
"by",
"the",
"specified",
"identifier",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/xml/XmlOutputFactory.java#L74-L79 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.deleteResource | protected void deleteResource(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode)
throws CmsException {
"""
Internal recursive method for deleting a resource.<p>
@param dbc the db context
@param resource the name of the resource to delete (full path)
@param siblingMode indicates how to handle siblings of the deleted resource
@throws CmsException if something goes wrong
"""
if (resource.isFolder()) {
// collect all resources in the folder (but exclude deleted ones)
List<CmsResource> resources = m_driverManager.readChildResources(
dbc,
resource,
CmsResourceFilter.IGNORE_EXPIRATION,
true,
true,
false);
Set<CmsUUID> deletedResources = new HashSet<CmsUUID>();
// now walk through all sub-resources in the folder
for (int i = 0; i < resources.size(); i++) {
CmsResource childResource = resources.get(i);
if ((siblingMode == CmsResource.DELETE_REMOVE_SIBLINGS)
&& deletedResources.contains(childResource.getResourceId())) {
// sibling mode is "delete all siblings" and another sibling of the current child resource has already
// been deleted- do nothing and continue with the next child resource.
continue;
}
if (childResource.isFolder()) {
// recurse into this method for subfolders
deleteResource(dbc, childResource, siblingMode);
} else {
// handle child resources
m_driverManager.deleteResource(dbc, childResource, siblingMode);
}
deletedResources.add(childResource.getResourceId());
}
deletedResources.clear();
}
// handle the resource itself
m_driverManager.deleteResource(dbc, resource, siblingMode);
} | java | protected void deleteResource(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode)
throws CmsException {
if (resource.isFolder()) {
// collect all resources in the folder (but exclude deleted ones)
List<CmsResource> resources = m_driverManager.readChildResources(
dbc,
resource,
CmsResourceFilter.IGNORE_EXPIRATION,
true,
true,
false);
Set<CmsUUID> deletedResources = new HashSet<CmsUUID>();
// now walk through all sub-resources in the folder
for (int i = 0; i < resources.size(); i++) {
CmsResource childResource = resources.get(i);
if ((siblingMode == CmsResource.DELETE_REMOVE_SIBLINGS)
&& deletedResources.contains(childResource.getResourceId())) {
// sibling mode is "delete all siblings" and another sibling of the current child resource has already
// been deleted- do nothing and continue with the next child resource.
continue;
}
if (childResource.isFolder()) {
// recurse into this method for subfolders
deleteResource(dbc, childResource, siblingMode);
} else {
// handle child resources
m_driverManager.deleteResource(dbc, childResource, siblingMode);
}
deletedResources.add(childResource.getResourceId());
}
deletedResources.clear();
}
// handle the resource itself
m_driverManager.deleteResource(dbc, resource, siblingMode);
} | [
"protected",
"void",
"deleteResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"CmsResource",
".",
"CmsResourceDeleteMode",
"siblingMode",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
")",
"{",
"// collect all resources in the folder (but exclude deleted ones)",
"List",
"<",
"CmsResource",
">",
"resources",
"=",
"m_driverManager",
".",
"readChildResources",
"(",
"dbc",
",",
"resource",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
",",
"true",
",",
"true",
",",
"false",
")",
";",
"Set",
"<",
"CmsUUID",
">",
"deletedResources",
"=",
"new",
"HashSet",
"<",
"CmsUUID",
">",
"(",
")",
";",
"// now walk through all sub-resources in the folder",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"CmsResource",
"childResource",
"=",
"resources",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"(",
"siblingMode",
"==",
"CmsResource",
".",
"DELETE_REMOVE_SIBLINGS",
")",
"&&",
"deletedResources",
".",
"contains",
"(",
"childResource",
".",
"getResourceId",
"(",
")",
")",
")",
"{",
"// sibling mode is \"delete all siblings\" and another sibling of the current child resource has already",
"// been deleted- do nothing and continue with the next child resource.",
"continue",
";",
"}",
"if",
"(",
"childResource",
".",
"isFolder",
"(",
")",
")",
"{",
"// recurse into this method for subfolders",
"deleteResource",
"(",
"dbc",
",",
"childResource",
",",
"siblingMode",
")",
";",
"}",
"else",
"{",
"// handle child resources",
"m_driverManager",
".",
"deleteResource",
"(",
"dbc",
",",
"childResource",
",",
"siblingMode",
")",
";",
"}",
"deletedResources",
".",
"add",
"(",
"childResource",
".",
"getResourceId",
"(",
")",
")",
";",
"}",
"deletedResources",
".",
"clear",
"(",
")",
";",
"}",
"// handle the resource itself",
"m_driverManager",
".",
"deleteResource",
"(",
"dbc",
",",
"resource",
",",
"siblingMode",
")",
";",
"}"
] | Internal recursive method for deleting a resource.<p>
@param dbc the db context
@param resource the name of the resource to delete (full path)
@param siblingMode indicates how to handle siblings of the deleted resource
@throws CmsException if something goes wrong | [
"Internal",
"recursive",
"method",
"for",
"deleting",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L7142-L7178 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/GlConverter.java | GlConverter.setString | public int setString(String strString, boolean bDisplayOption, int moveMode) // init this field override for other value {
"""
Convert and move string to this field.
Override this method to convert the String to the actual Physical Data Type.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code.
""" // By default, move the data as-is
String string = Constants.BLANK;
int fieldLength = strString.length();
for (int source = 0; source < (int)fieldLength; source++)
{
if ((strString.charAt(source) >= '0') && (strString.charAt(source) <= '9'))
string += strString.charAt(source);
}
fieldLength = string.length();
if ((fieldLength <= 4) && (fieldLength > 0))
string += "000";
return super.setString(string, bDisplayOption, moveMode); // Convert to internal rep and return
} | java | public int setString(String strString, boolean bDisplayOption, int moveMode) // init this field override for other value
{ // By default, move the data as-is
String string = Constants.BLANK;
int fieldLength = strString.length();
for (int source = 0; source < (int)fieldLength; source++)
{
if ((strString.charAt(source) >= '0') && (strString.charAt(source) <= '9'))
string += strString.charAt(source);
}
fieldLength = string.length();
if ((fieldLength <= 4) && (fieldLength > 0))
string += "000";
return super.setString(string, bDisplayOption, moveMode); // Convert to internal rep and return
} | [
"public",
"int",
"setString",
"(",
"String",
"strString",
",",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"// init this field override for other value",
"{",
"// By default, move the data as-is",
"String",
"string",
"=",
"Constants",
".",
"BLANK",
";",
"int",
"fieldLength",
"=",
"strString",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"source",
"=",
"0",
";",
"source",
"<",
"(",
"int",
")",
"fieldLength",
";",
"source",
"++",
")",
"{",
"if",
"(",
"(",
"strString",
".",
"charAt",
"(",
"source",
")",
">=",
"'",
"'",
")",
"&&",
"(",
"strString",
".",
"charAt",
"(",
"source",
")",
"<=",
"'",
"'",
")",
")",
"string",
"+=",
"strString",
".",
"charAt",
"(",
"source",
")",
";",
"}",
"fieldLength",
"=",
"string",
".",
"length",
"(",
")",
";",
"if",
"(",
"(",
"fieldLength",
"<=",
"4",
")",
"&&",
"(",
"fieldLength",
">",
"0",
")",
")",
"string",
"+=",
"\"000\"",
";",
"return",
"super",
".",
"setString",
"(",
"string",
",",
"bDisplayOption",
",",
"moveMode",
")",
";",
"// Convert to internal rep and return",
"}"
] | Convert and move string to this field.
Override this method to convert the String to the actual Physical Data Type.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code. | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Override",
"this",
"method",
"to",
"convert",
"the",
"String",
"to",
"the",
"actual",
"Physical",
"Data",
"Type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/GlConverter.java#L78-L91 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.data_setCookie | public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue)
throws FacebookException, IOException {
"""
Sets a cookie for a given user and application.
@param userId The user for whom this cookie needs to be set
@param cookieName Name of the cookie.
@param cookieValue Value of the cookie.
@return true if cookie was successfully set, false otherwise
@see <a href="http://wiki.developers.facebook.com/index.php/Data.getCookies">
Developers Wiki: Data.setCookie</a>
@see <a href="http://wiki.developers.facebook.com/index.php/Cookies">
Developers Wiki: Cookies</a>
"""
return data_setCookie(userId, cookieName, cookieValue, /*expiresTimestamp*/null, /*path*/ null);
} | java | public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue)
throws FacebookException, IOException {
return data_setCookie(userId, cookieName, cookieValue, /*expiresTimestamp*/null, /*path*/ null);
} | [
"public",
"boolean",
"data_setCookie",
"(",
"Integer",
"userId",
",",
"CharSequence",
"cookieName",
",",
"CharSequence",
"cookieValue",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"data_setCookie",
"(",
"userId",
",",
"cookieName",
",",
"cookieValue",
",",
"/*expiresTimestamp*/",
"null",
",",
"/*path*/",
"null",
")",
";",
"}"
] | Sets a cookie for a given user and application.
@param userId The user for whom this cookie needs to be set
@param cookieName Name of the cookie.
@param cookieValue Value of the cookie.
@return true if cookie was successfully set, false otherwise
@see <a href="http://wiki.developers.facebook.com/index.php/Data.getCookies">
Developers Wiki: Data.setCookie</a>
@see <a href="http://wiki.developers.facebook.com/index.php/Cookies">
Developers Wiki: Cookies</a> | [
"Sets",
"a",
"cookie",
"for",
"a",
"given",
"user",
"and",
"application",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2317-L2320 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.deserializeWriterDirPermissions | public static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId) {
"""
Deserializes a {@link FsPermission}s object that should be used when a {@link DataWriter} is creating directories.
"""
return new FsPermission(state.getPropAsShortWithRadix(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
FsPermission.getDefault().toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX));
} | java | public static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId) {
return new FsPermission(state.getPropAsShortWithRadix(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
FsPermission.getDefault().toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX));
} | [
"public",
"static",
"FsPermission",
"deserializeWriterDirPermissions",
"(",
"State",
"state",
",",
"int",
"numBranches",
",",
"int",
"branchId",
")",
"{",
"return",
"new",
"FsPermission",
"(",
"state",
".",
"getPropAsShortWithRadix",
"(",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"ConfigurationKeys",
".",
"WRITER_DIR_PERMISSIONS",
",",
"numBranches",
",",
"branchId",
")",
",",
"FsPermission",
".",
"getDefault",
"(",
")",
".",
"toShort",
"(",
")",
",",
"ConfigurationKeys",
".",
"PERMISSION_PARSING_RADIX",
")",
")",
";",
"}"
] | Deserializes a {@link FsPermission}s object that should be used when a {@link DataWriter} is creating directories. | [
"Deserializes",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L894-L898 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/RecordSetsInner.java | RecordSetsInner.listAsync | public Observable<Page<RecordSetInner>> listAsync(final String resourceGroupName, final String privateZoneName) {
"""
Lists all record sets in a Private DNS zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RecordSetInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, privateZoneName)
.map(new Func1<ServiceResponse<Page<RecordSetInner>>, Page<RecordSetInner>>() {
@Override
public Page<RecordSetInner> call(ServiceResponse<Page<RecordSetInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RecordSetInner>> listAsync(final String resourceGroupName, final String privateZoneName) {
return listWithServiceResponseAsync(resourceGroupName, privateZoneName)
.map(new Func1<ServiceResponse<Page<RecordSetInner>>, Page<RecordSetInner>>() {
@Override
public Page<RecordSetInner> call(ServiceResponse<Page<RecordSetInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RecordSetInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"privateZoneName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"privateZoneName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"RecordSetInner",
">",
">",
",",
"Page",
"<",
"RecordSetInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"RecordSetInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"RecordSetInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists all record sets in a Private DNS zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RecordSetInner> object | [
"Lists",
"all",
"record",
"sets",
"in",
"a",
"Private",
"DNS",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/RecordSetsInner.java#L1147-L1155 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java | TranscriptManager.getTranscripts | public Transcripts getTranscripts(EntityBareJid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Returns the transcripts of a given user. The answer will contain the complete history of
conversations that a user had.
@param userID the id of the user to get his conversations.
@param workgroupJID the JID of the workgroup that will process the request.
@return the transcripts of a given user.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID);
Transcripts response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | java | public Transcripts getTranscripts(EntityBareJid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID);
Transcripts response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | [
"public",
"Transcripts",
"getTranscripts",
"(",
"EntityBareJid",
"workgroupJID",
",",
"Jid",
"userID",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"Transcripts",
"request",
"=",
"new",
"Transcripts",
"(",
"userID",
")",
";",
"request",
".",
"setTo",
"(",
"workgroupJID",
")",
";",
"Transcripts",
"response",
"=",
"connection",
".",
"createStanzaCollectorAndSend",
"(",
"request",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"return",
"response",
";",
"}"
] | Returns the transcripts of a given user. The answer will contain the complete history of
conversations that a user had.
@param userID the id of the user to get his conversations.
@param workgroupJID the JID of the workgroup that will process the request.
@return the transcripts of a given user.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"the",
"transcripts",
"of",
"a",
"given",
"user",
".",
"The",
"answer",
"will",
"contain",
"the",
"complete",
"history",
"of",
"conversations",
"that",
"a",
"user",
"had",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java#L75-L80 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java | BasicEvaluationCtx.mapAttributes | private void mapAttributes(List<Attribute> input, Map<String, List<Attribute>> output) {
"""
Generic routine for resource, attribute and environment attributes
to build the lookup map for each. The Form is a Map that is indexed
by the String form of the attribute ids, and that contains Sets at
each entry with all attributes that have that id
"""
Iterator<Attribute> it = input.iterator();
while (it.hasNext()) {
Attribute attr = it.next();
String id = attr.getId().toString();
if (output.containsKey(id)) {
List<Attribute> list = output.get(id);
list.add(attr);
} else {
List list = new ArrayList<Attribute>();
list.add(attr);
output.put(id, list);
}
}
} | java | private void mapAttributes(List<Attribute> input, Map<String, List<Attribute>> output) {
Iterator<Attribute> it = input.iterator();
while (it.hasNext()) {
Attribute attr = it.next();
String id = attr.getId().toString();
if (output.containsKey(id)) {
List<Attribute> list = output.get(id);
list.add(attr);
} else {
List list = new ArrayList<Attribute>();
list.add(attr);
output.put(id, list);
}
}
} | [
"private",
"void",
"mapAttributes",
"(",
"List",
"<",
"Attribute",
">",
"input",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Attribute",
">",
">",
"output",
")",
"{",
"Iterator",
"<",
"Attribute",
">",
"it",
"=",
"input",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Attribute",
"attr",
"=",
"it",
".",
"next",
"(",
")",
";",
"String",
"id",
"=",
"attr",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"output",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"List",
"<",
"Attribute",
">",
"list",
"=",
"output",
".",
"get",
"(",
"id",
")",
";",
"list",
".",
"add",
"(",
"attr",
")",
";",
"}",
"else",
"{",
"List",
"list",
"=",
"new",
"ArrayList",
"<",
"Attribute",
">",
"(",
")",
";",
"list",
".",
"add",
"(",
"attr",
")",
";",
"output",
".",
"put",
"(",
"id",
",",
"list",
")",
";",
"}",
"}",
"}"
] | Generic routine for resource, attribute and environment attributes
to build the lookup map for each. The Form is a Map that is indexed
by the String form of the attribute ids, and that contains Sets at
each entry with all attributes that have that id | [
"Generic",
"routine",
"for",
"resource",
"attribute",
"and",
"environment",
"attributes",
"to",
"build",
"the",
"lookup",
"map",
"for",
"each",
".",
"The",
"Form",
"is",
"a",
"Map",
"that",
"is",
"indexed",
"by",
"the",
"String",
"form",
"of",
"the",
"attribute",
"ids",
"and",
"that",
"contains",
"Sets",
"at",
"each",
"entry",
"with",
"all",
"attributes",
"that",
"have",
"that",
"id"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java#L360-L375 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapRequestLineReader.java | ImapRequestLineReader.eol | public void eol() throws ProtocolException {
"""
Moves the request line reader to end of the line, checking that no non-space
character are found.
@throws ProtocolException If more non-space tokens are found in this line,
or the end-of-file is reached.
"""
char next = nextChar();
// Ignore trailing spaces.
while (next == ' ') {
consume();
next = nextChar();
}
// handle DOS and unix end-of-lines
if (next == '\r') {
consume();
next = nextChar();
}
// Check if we found extra characters.
if (next != '\n') {
throw new ProtocolException("Expected end-of-line, found more character(s): "+next);
}
dumpLine();
} | java | public void eol() throws ProtocolException {
char next = nextChar();
// Ignore trailing spaces.
while (next == ' ') {
consume();
next = nextChar();
}
// handle DOS and unix end-of-lines
if (next == '\r') {
consume();
next = nextChar();
}
// Check if we found extra characters.
if (next != '\n') {
throw new ProtocolException("Expected end-of-line, found more character(s): "+next);
}
dumpLine();
} | [
"public",
"void",
"eol",
"(",
")",
"throws",
"ProtocolException",
"{",
"char",
"next",
"=",
"nextChar",
"(",
")",
";",
"// Ignore trailing spaces.\r",
"while",
"(",
"next",
"==",
"'",
"'",
")",
"{",
"consume",
"(",
")",
";",
"next",
"=",
"nextChar",
"(",
")",
";",
"}",
"// handle DOS and unix end-of-lines\r",
"if",
"(",
"next",
"==",
"'",
"'",
")",
"{",
"consume",
"(",
")",
";",
"next",
"=",
"nextChar",
"(",
")",
";",
"}",
"// Check if we found extra characters.\r",
"if",
"(",
"next",
"!=",
"'",
"'",
")",
"{",
"throw",
"new",
"ProtocolException",
"(",
"\"Expected end-of-line, found more character(s): \"",
"+",
"next",
")",
";",
"}",
"dumpLine",
"(",
")",
";",
"}"
] | Moves the request line reader to end of the line, checking that no non-space
character are found.
@throws ProtocolException If more non-space tokens are found in this line,
or the end-of-file is reached. | [
"Moves",
"the",
"request",
"line",
"reader",
"to",
"end",
"of",
"the",
"line",
"checking",
"that",
"no",
"non",
"-",
"space",
"character",
"are",
"found",
"."
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapRequestLineReader.java#L104-L124 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.addBackground | public SwipeActionAdapter addBackground(SwipeDirection key, int resId) {
"""
Add a background image for a certain callback. The key for the background must be one of the
directions from the SwipeDirections class.
@param key the identifier of the callback for which this resource should be shown
@param resId the resource Id of the background to add
@return A reference to the current instance so that commands can be chained
"""
if(SwipeDirection.getAllDirections().contains(key)) mBackgroundResIds.put(key,resId);
return this;
} | java | public SwipeActionAdapter addBackground(SwipeDirection key, int resId){
if(SwipeDirection.getAllDirections().contains(key)) mBackgroundResIds.put(key,resId);
return this;
} | [
"public",
"SwipeActionAdapter",
"addBackground",
"(",
"SwipeDirection",
"key",
",",
"int",
"resId",
")",
"{",
"if",
"(",
"SwipeDirection",
".",
"getAllDirections",
"(",
")",
".",
"contains",
"(",
"key",
")",
")",
"mBackgroundResIds",
".",
"put",
"(",
"key",
",",
"resId",
")",
";",
"return",
"this",
";",
"}"
] | Add a background image for a certain callback. The key for the background must be one of the
directions from the SwipeDirections class.
@param key the identifier of the callback for which this resource should be shown
@param resId the resource Id of the background to add
@return A reference to the current instance so that commands can be chained | [
"Add",
"a",
"background",
"image",
"for",
"a",
"certain",
"callback",
".",
"The",
"key",
"for",
"the",
"background",
"must",
"be",
"one",
"of",
"the",
"directions",
"from",
"the",
"SwipeDirections",
"class",
"."
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L243-L246 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java | DailyCalendar.setTimeRange | public final void setTimeRange (final Calendar rangeStartingCalendar, final Calendar rangeEndingCalendar) {
"""
Sets the time range for the <CODE>DailyCalendar</CODE> to the times
represented in the specified <CODE>Calendar</CODE>s.
@param rangeStartingCalendar
a Calendar containing the start time for the
<CODE>DailyCalendar</CODE>
@param rangeEndingCalendar
a Calendar containing the end time for the
<CODE>DailyCalendar</CODE>
"""
setTimeRange (rangeStartingCalendar.get (Calendar.HOUR_OF_DAY),
rangeStartingCalendar.get (Calendar.MINUTE),
rangeStartingCalendar.get (Calendar.SECOND),
rangeStartingCalendar.get (Calendar.MILLISECOND),
rangeEndingCalendar.get (Calendar.HOUR_OF_DAY),
rangeEndingCalendar.get (Calendar.MINUTE),
rangeEndingCalendar.get (Calendar.SECOND),
rangeEndingCalendar.get (Calendar.MILLISECOND));
} | java | public final void setTimeRange (final Calendar rangeStartingCalendar, final Calendar rangeEndingCalendar)
{
setTimeRange (rangeStartingCalendar.get (Calendar.HOUR_OF_DAY),
rangeStartingCalendar.get (Calendar.MINUTE),
rangeStartingCalendar.get (Calendar.SECOND),
rangeStartingCalendar.get (Calendar.MILLISECOND),
rangeEndingCalendar.get (Calendar.HOUR_OF_DAY),
rangeEndingCalendar.get (Calendar.MINUTE),
rangeEndingCalendar.get (Calendar.SECOND),
rangeEndingCalendar.get (Calendar.MILLISECOND));
} | [
"public",
"final",
"void",
"setTimeRange",
"(",
"final",
"Calendar",
"rangeStartingCalendar",
",",
"final",
"Calendar",
"rangeEndingCalendar",
")",
"{",
"setTimeRange",
"(",
"rangeStartingCalendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
",",
"rangeStartingCalendar",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
",",
"rangeStartingCalendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
",",
"rangeStartingCalendar",
".",
"get",
"(",
"Calendar",
".",
"MILLISECOND",
")",
",",
"rangeEndingCalendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
",",
"rangeEndingCalendar",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
",",
"rangeEndingCalendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
",",
"rangeEndingCalendar",
".",
"get",
"(",
"Calendar",
".",
"MILLISECOND",
")",
")",
";",
"}"
] | Sets the time range for the <CODE>DailyCalendar</CODE> to the times
represented in the specified <CODE>Calendar</CODE>s.
@param rangeStartingCalendar
a Calendar containing the start time for the
<CODE>DailyCalendar</CODE>
@param rangeEndingCalendar
a Calendar containing the end time for the
<CODE>DailyCalendar</CODE> | [
"Sets",
"the",
"time",
"range",
"for",
"the",
"<CODE",
">",
"DailyCalendar<",
"/",
"CODE",
">",
"to",
"the",
"times",
"represented",
"in",
"the",
"specified",
"<CODE",
">",
"Calendar<",
"/",
"CODE",
">",
"s",
"."
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java#L887-L897 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java | RepositoryReaderImpl.getLogLists | @Override
public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after) {
"""
returns log records from the binary repository that are within the date range and which satisfy condition of the filter as specified by the parameters.
@param after pointer to the a repository location where the query should start. Only includes records after this point
@return the iterable instance of a list of log records within a process that are within the parameter range and satisfy the condition.
If no records exist after the location, an Iterable is returned with no entries
"""
return getLogLists(after, (Date) null, (LogRecordHeaderFilter) null);
} | java | @Override
public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after) {
return getLogLists(after, (Date) null, (LogRecordHeaderFilter) null);
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"ServerInstanceLogRecordList",
">",
"getLogLists",
"(",
"RepositoryPointer",
"after",
")",
"{",
"return",
"getLogLists",
"(",
"after",
",",
"(",
"Date",
")",
"null",
",",
"(",
"LogRecordHeaderFilter",
")",
"null",
")",
";",
"}"
] | returns log records from the binary repository that are within the date range and which satisfy condition of the filter as specified by the parameters.
@param after pointer to the a repository location where the query should start. Only includes records after this point
@return the iterable instance of a list of log records within a process that are within the parameter range and satisfy the condition.
If no records exist after the location, an Iterable is returned with no entries | [
"returns",
"log",
"records",
"from",
"the",
"binary",
"repository",
"that",
"are",
"within",
"the",
"date",
"range",
"and",
"which",
"satisfy",
"condition",
"of",
"the",
"filter",
"as",
"specified",
"by",
"the",
"parameters",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java#L370-L373 |
JodaOrg/joda-time | src/main/java/org/joda/time/base/BasePeriod.java | BasePeriod.checkAndUpdate | private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) {
"""
Checks whether a field type is supported, and if so adds the new value
to the relevant index in the specified array.
@param type the field type
@param values the array to update
@param newValue the new value to store if successful
"""
int index = indexOf(type);
if (index == -1) {
if (newValue != 0) {
throw new IllegalArgumentException(
"Period does not support field '" + type.getName() + "'");
}
} else {
values[index] = newValue;
}
} | java | private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) {
int index = indexOf(type);
if (index == -1) {
if (newValue != 0) {
throw new IllegalArgumentException(
"Period does not support field '" + type.getName() + "'");
}
} else {
values[index] = newValue;
}
} | [
"private",
"void",
"checkAndUpdate",
"(",
"DurationFieldType",
"type",
",",
"int",
"[",
"]",
"values",
",",
"int",
"newValue",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"type",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"newValue",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Period does not support field '\"",
"+",
"type",
".",
"getName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"}",
"else",
"{",
"values",
"[",
"index",
"]",
"=",
"newValue",
";",
"}",
"}"
] | Checks whether a field type is supported, and if so adds the new value
to the relevant index in the specified array.
@param type the field type
@param values the array to update
@param newValue the new value to store if successful | [
"Checks",
"whether",
"a",
"field",
"type",
"is",
"supported",
"and",
"if",
"so",
"adds",
"the",
"new",
"value",
"to",
"the",
"relevant",
"index",
"in",
"the",
"specified",
"array",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BasePeriod.java#L389-L399 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/utils/EventUtils.java | EventUtils.getAddressForUrl | public static String getAddressForUrl(String address, boolean resolveForIp) {
"""
Extract host name from the given endpoint URI.
@see <a href="http://tools.ietf.org/html/rfc3986#section-3">RFC 3986, Section 3</a>
@param address
endpoint URI or bare IP address.
@param resolveForIp
dummy.
@return
host name contained in the URI.
"""
if (address == null) {
return null;
}
// drop schema
int pos = address.indexOf("://");
if (pos > 0) {
address = address.substring(pos + 3);
}
// drop user authentication information
pos = address.indexOf('@');
if (pos > 0) {
address = address.substring(pos + 1);
}
// drop trailing parts: port number, query parameters, path, fragment
for (int i = 0; i < address.length(); ++i) {
char c = address.charAt(i);
if ((c == ':') || (c == '?') || (c == '/') || (c == '#')) {
return address.substring(0, i);
}
}
return address;
} | java | public static String getAddressForUrl(String address, boolean resolveForIp) {
if (address == null) {
return null;
}
// drop schema
int pos = address.indexOf("://");
if (pos > 0) {
address = address.substring(pos + 3);
}
// drop user authentication information
pos = address.indexOf('@');
if (pos > 0) {
address = address.substring(pos + 1);
}
// drop trailing parts: port number, query parameters, path, fragment
for (int i = 0; i < address.length(); ++i) {
char c = address.charAt(i);
if ((c == ':') || (c == '?') || (c == '/') || (c == '#')) {
return address.substring(0, i);
}
}
return address;
} | [
"public",
"static",
"String",
"getAddressForUrl",
"(",
"String",
"address",
",",
"boolean",
"resolveForIp",
")",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// drop schema",
"int",
"pos",
"=",
"address",
".",
"indexOf",
"(",
"\"://\"",
")",
";",
"if",
"(",
"pos",
">",
"0",
")",
"{",
"address",
"=",
"address",
".",
"substring",
"(",
"pos",
"+",
"3",
")",
";",
"}",
"// drop user authentication information",
"pos",
"=",
"address",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
">",
"0",
")",
"{",
"address",
"=",
"address",
".",
"substring",
"(",
"pos",
"+",
"1",
")",
";",
"}",
"// drop trailing parts: port number, query parameters, path, fragment",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"address",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
"address",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"(",
"c",
"==",
"'",
"'",
")",
"||",
"(",
"c",
"==",
"'",
"'",
")",
"||",
"(",
"c",
"==",
"'",
"'",
")",
"||",
"(",
"c",
"==",
"'",
"'",
")",
")",
"{",
"return",
"address",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"}",
"}",
"return",
"address",
";",
"}"
] | Extract host name from the given endpoint URI.
@see <a href="http://tools.ietf.org/html/rfc3986#section-3">RFC 3986, Section 3</a>
@param address
endpoint URI or bare IP address.
@param resolveForIp
dummy.
@return
host name contained in the URI. | [
"Extract",
"host",
"name",
"from",
"the",
"given",
"endpoint",
"URI",
".",
"@see",
"<a",
"href",
"=",
"http",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc3986#section",
"-",
"3",
">",
"RFC",
"3986",
"Section",
"3<",
"/",
"a",
">"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/utils/EventUtils.java#L34-L59 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java | ManagementResources.updateWardenSuspensionLevelsAndDurations | @PUT
@Path("/wardensuspensionlevelsanddurations")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Description("Updates warden infraction level counts and suspension durations.")
public Response updateWardenSuspensionLevelsAndDurations(@Context HttpServletRequest req, Map<Integer, Long> infractionCounts) {
"""
Updates warden suspension levels.
@param req The HTTP request.
@param infractionCounts Warden suspension levels.
@return Response object indicating whether the operation was successful or not.
@throws IllegalArgumentException WebApplicationException.
"""
if (infractionCounts == null || infractionCounts.isEmpty()) {
throw new IllegalArgumentException("Infraction counts cannot be null or empty.");
}
validatePrivilegedUser(req);
managementService.updateWardenSuspensionLevelsAndDurations(infractionCounts);
return Response.status(Status.OK).build();
} | java | @PUT
@Path("/wardensuspensionlevelsanddurations")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Description("Updates warden infraction level counts and suspension durations.")
public Response updateWardenSuspensionLevelsAndDurations(@Context HttpServletRequest req, Map<Integer, Long> infractionCounts) {
if (infractionCounts == null || infractionCounts.isEmpty()) {
throw new IllegalArgumentException("Infraction counts cannot be null or empty.");
}
validatePrivilegedUser(req);
managementService.updateWardenSuspensionLevelsAndDurations(infractionCounts);
return Response.status(Status.OK).build();
} | [
"@",
"PUT",
"@",
"Path",
"(",
"\"/wardensuspensionlevelsanddurations\"",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Description",
"(",
"\"Updates warden infraction level counts and suspension durations.\"",
")",
"public",
"Response",
"updateWardenSuspensionLevelsAndDurations",
"(",
"@",
"Context",
"HttpServletRequest",
"req",
",",
"Map",
"<",
"Integer",
",",
"Long",
">",
"infractionCounts",
")",
"{",
"if",
"(",
"infractionCounts",
"==",
"null",
"||",
"infractionCounts",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Infraction counts cannot be null or empty.\"",
")",
";",
"}",
"validatePrivilegedUser",
"(",
"req",
")",
";",
"managementService",
".",
"updateWardenSuspensionLevelsAndDurations",
"(",
"infractionCounts",
")",
";",
"return",
"Response",
".",
"status",
"(",
"Status",
".",
"OK",
")",
".",
"build",
"(",
")",
";",
"}"
] | Updates warden suspension levels.
@param req The HTTP request.
@param infractionCounts Warden suspension levels.
@return Response object indicating whether the operation was successful or not.
@throws IllegalArgumentException WebApplicationException. | [
"Updates",
"warden",
"suspension",
"levels",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java#L189-L201 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.readAttributeAsJson | public String readAttributeAsJson(String attributeName, String... groups)
throws UnsupportedKerasConfigurationException {
"""
Read JSON-formatted string attribute from group path.
@param attributeName Name of attribute
@param groups Array of zero or more ancestor groups from root to parent.
@return HDF5 attribute as JSON
@throws UnsupportedKerasConfigurationException Unsupported Keras config
"""
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0) {
Attribute a = this.file.openAttribute(attributeName);
String s = readAttributeAsJson(a);
a.deallocate();
return s;
}
Group[] groupArray = openGroups(groups);
Attribute a = groupArray[groups.length - 1].openAttribute(attributeName);
String s = readAttributeAsJson(a);
a.deallocate();
closeGroups(groupArray);
return s;
}
} | java | public String readAttributeAsJson(String attributeName, String... groups)
throws UnsupportedKerasConfigurationException {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0) {
Attribute a = this.file.openAttribute(attributeName);
String s = readAttributeAsJson(a);
a.deallocate();
return s;
}
Group[] groupArray = openGroups(groups);
Attribute a = groupArray[groups.length - 1].openAttribute(attributeName);
String s = readAttributeAsJson(a);
a.deallocate();
closeGroups(groupArray);
return s;
}
} | [
"public",
"String",
"readAttributeAsJson",
"(",
"String",
"attributeName",
",",
"String",
"...",
"groups",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"==",
"0",
")",
"{",
"Attribute",
"a",
"=",
"this",
".",
"file",
".",
"openAttribute",
"(",
"attributeName",
")",
";",
"String",
"s",
"=",
"readAttributeAsJson",
"(",
"a",
")",
";",
"a",
".",
"deallocate",
"(",
")",
";",
"return",
"s",
";",
"}",
"Group",
"[",
"]",
"groupArray",
"=",
"openGroups",
"(",
"groups",
")",
";",
"Attribute",
"a",
"=",
"groupArray",
"[",
"groups",
".",
"length",
"-",
"1",
"]",
".",
"openAttribute",
"(",
"attributeName",
")",
";",
"String",
"s",
"=",
"readAttributeAsJson",
"(",
"a",
")",
";",
"a",
".",
"deallocate",
"(",
")",
";",
"closeGroups",
"(",
"groupArray",
")",
";",
"return",
"s",
";",
"}",
"}"
] | Read JSON-formatted string attribute from group path.
@param attributeName Name of attribute
@param groups Array of zero or more ancestor groups from root to parent.
@return HDF5 attribute as JSON
@throws UnsupportedKerasConfigurationException Unsupported Keras config | [
"Read",
"JSON",
"-",
"formatted",
"string",
"attribute",
"from",
"group",
"path",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L126-L142 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optFloatArray | @Nullable
public static float[] optFloatArray(@Nullable Bundle bundle, @Nullable String key) {
"""
Returns a optional float array value. In other words, returns the value mapped by key if it exists and is a float array.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a float array value if exists, null otherwise.
@see android.os.Bundle#getFloatArray(String)
"""
return optFloatArray(bundle, key, new float[0]);
} | java | @Nullable
public static float[] optFloatArray(@Nullable Bundle bundle, @Nullable String key) {
return optFloatArray(bundle, key, new float[0]);
} | [
"@",
"Nullable",
"public",
"static",
"float",
"[",
"]",
"optFloatArray",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optFloatArray",
"(",
"bundle",
",",
"key",
",",
"new",
"float",
"[",
"0",
"]",
")",
";",
"}"
] | Returns a optional float array value. In other words, returns the value mapped by key if it exists and is a float array.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a float array value if exists, null otherwise.
@see android.os.Bundle#getFloatArray(String) | [
"Returns",
"a",
"optional",
"float",
"array",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"float",
"array",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L511-L514 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java | ShareSheetStyle.setCopyUrlStyle | public ShareSheetStyle setCopyUrlStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID, @StringRes int stringMessageID) {
"""
<p> Set the icon, label and success message for copy url option. Default label is "Copy link".</p>
@param drawableIconID Resource ID for the drawable to set as the icon for copy url option. Default icon is system menu_save icon
@param stringLabelID Resource ID for the string label the copy url option. Default label is "Copy link"
@param stringMessageID Resource ID for the string message to show toast message displayed on copying a url
@return A {@link ShareSheetStyle} instance.
"""
copyUrlIcon_ = getDrawable(context_, drawableIconID);
copyURlText_ = context_.getResources().getString(stringLabelID);
urlCopiedMessage_ = context_.getResources().getString(stringMessageID);
return this;
} | java | public ShareSheetStyle setCopyUrlStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID, @StringRes int stringMessageID) {
copyUrlIcon_ = getDrawable(context_, drawableIconID);
copyURlText_ = context_.getResources().getString(stringLabelID);
urlCopiedMessage_ = context_.getResources().getString(stringMessageID);
return this;
} | [
"public",
"ShareSheetStyle",
"setCopyUrlStyle",
"(",
"@",
"DrawableRes",
"int",
"drawableIconID",
",",
"@",
"StringRes",
"int",
"stringLabelID",
",",
"@",
"StringRes",
"int",
"stringMessageID",
")",
"{",
"copyUrlIcon_",
"=",
"getDrawable",
"(",
"context_",
",",
"drawableIconID",
")",
";",
"copyURlText_",
"=",
"context_",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"stringLabelID",
")",
";",
"urlCopiedMessage_",
"=",
"context_",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"stringMessageID",
")",
";",
"return",
"this",
";",
"}"
] | <p> Set the icon, label and success message for copy url option. Default label is "Copy link".</p>
@param drawableIconID Resource ID for the drawable to set as the icon for copy url option. Default icon is system menu_save icon
@param stringLabelID Resource ID for the string label the copy url option. Default label is "Copy link"
@param stringMessageID Resource ID for the string message to show toast message displayed on copying a url
@return A {@link ShareSheetStyle} instance. | [
"<p",
">",
"Set",
"the",
"icon",
"label",
"and",
"success",
"message",
"for",
"copy",
"url",
"option",
".",
"Default",
"label",
"is",
"Copy",
"link",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java#L135-L140 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.createVideoReviewsAsync | public Observable<List<String>> createVideoReviewsAsync(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) {
"""
The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param contentType The content type.
@param createVideoReviewsBody Body for create reviews API
@param createVideoReviewsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<String> object
"""
return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, createVideoReviewsOptionalParameter).map(new Func1<ServiceResponse<List<String>>, List<String>>() {
@Override
public List<String> call(ServiceResponse<List<String>> response) {
return response.body();
}
});
} | java | public Observable<List<String>> createVideoReviewsAsync(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) {
return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, createVideoReviewsOptionalParameter).map(new Func1<ServiceResponse<List<String>>, List<String>>() {
@Override
public List<String> call(ServiceResponse<List<String>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"String",
">",
">",
"createVideoReviewsAsync",
"(",
"String",
"teamName",
",",
"String",
"contentType",
",",
"List",
"<",
"CreateVideoReviewsBodyItem",
">",
"createVideoReviewsBody",
",",
"CreateVideoReviewsOptionalParameter",
"createVideoReviewsOptionalParameter",
")",
"{",
"return",
"createVideoReviewsWithServiceResponseAsync",
"(",
"teamName",
",",
"contentType",
",",
"createVideoReviewsBody",
",",
"createVideoReviewsOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"String",
">",
">",
",",
"List",
"<",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"String",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param contentType The content type.
@param createVideoReviewsBody Body for create reviews API
@param createVideoReviewsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<String> object | [
"The",
"reviews",
"created",
"would",
"show",
"up",
"for",
"Reviewers",
"on",
"your",
"team",
".",
"As",
"Reviewers",
"complete",
"reviewing",
"results",
"of",
"the",
"Review",
"would",
"be",
"POSTED",
"(",
"i",
".",
"e",
".",
"HTTP",
"POST",
")",
"on",
"the",
"specified",
"CallBackEndpoint",
".",
"<",
";",
"h3>",
";",
"CallBack",
"Schemas",
"<",
";",
"/",
"h3>",
";",
"<",
";",
"h4>",
";",
"Review",
"Completion",
"CallBack",
"Sample<",
";",
"/",
"h4>",
";",
"<",
";",
"p>",
";",
"{",
"<",
";",
"br",
"/",
">",
";",
"ReviewId",
":",
"<",
";",
"Review",
"Id>",
";",
"<",
";",
"br",
"/",
">",
";",
"ModifiedOn",
":",
"2016",
"-",
"10",
"-",
"11T22",
":",
"36",
":",
"32",
".",
"9934851Z",
"<",
";",
"br",
"/",
">",
";",
"ModifiedBy",
":",
"<",
";",
"Name",
"of",
"the",
"Reviewer>",
";",
"<",
";",
"br",
"/",
">",
";",
"CallBackType",
":",
"Review",
"<",
";",
"br",
"/",
">",
";",
"ContentId",
":",
"<",
";",
"The",
"ContentId",
"that",
"was",
"specified",
"input>",
";",
"<",
";",
"br",
"/",
">",
";",
"Metadata",
":",
"{",
"<",
";",
"br",
"/",
">",
";",
"adultscore",
":",
"0",
".",
"xxx",
"<",
";",
"br",
"/",
">",
";",
"a",
":",
"False",
"<",
";",
"br",
"/",
">",
";",
"racyscore",
":",
"0",
".",
"xxx",
"<",
";",
"br",
"/",
">",
";",
"r",
":",
"True",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"ReviewerResultTags",
":",
"{",
"<",
";",
"br",
"/",
">",
";",
"a",
":",
"False",
"<",
";",
"br",
"/",
">",
";",
"r",
":",
"True",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"}",
"<",
";",
"br",
"/",
">",
";",
"<",
";",
"/",
"p>",
";",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1979-L1986 |
google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.isDescendantOf | public static boolean isDescendantOf(SoyNode node, SoyNode ancestor) {
"""
Returns true if {@code node} is a descendant of {@code ancestor}.
"""
for (; node != null; node = node.getParent()) {
if (ancestor == node) {
return true;
}
}
return false;
} | java | public static boolean isDescendantOf(SoyNode node, SoyNode ancestor) {
for (; node != null; node = node.getParent()) {
if (ancestor == node) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isDescendantOf",
"(",
"SoyNode",
"node",
",",
"SoyNode",
"ancestor",
")",
"{",
"for",
"(",
";",
"node",
"!=",
"null",
";",
"node",
"=",
"node",
".",
"getParent",
"(",
")",
")",
"{",
"if",
"(",
"ancestor",
"==",
"node",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Returns true if {@code node} is a descendant of {@code ancestor}. | [
"Returns",
"true",
"if",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L349-L356 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/msvc/MsvcProjectWriter.java | MsvcProjectWriter.writeMessage | private void writeMessage(final Writer writer, final String projectName, final String targtype) throws IOException {
"""
Writes "This is not a makefile" warning.
@param writer
Writer writer
@param projectName
String project name
@param targtype
String target type
@throws IOException
if error writing project
"""
writer.write("!MESSAGE This is not a valid makefile. ");
writer.write("To build this project using NMAKE,\r\n");
writer.write("!MESSAGE use the Export Makefile command and run\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE NMAKE /f \"");
writer.write(projectName);
writer.write(".mak\".\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE You can specify a configuration when running NMAKE\r\n");
writer.write("!MESSAGE by defining the macro CFG on the command line. ");
writer.write("For example:\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE NMAKE /f \"");
writer.write(projectName);
writer.write(".mak\" CFG=\"");
writer.write(projectName);
writer.write(" - Win32 Debug\"\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE Possible choices for configuration are:\r\n");
writer.write("!MESSAGE \r\n");
final String pattern = "!MESSAGE \"{0} - Win32 {1}\" (based on \"{2}\")\r\n";
writer.write(MessageFormat.format(pattern, new Object[] {
projectName, "Release", targtype
}));
writer.write(MessageFormat.format(pattern, new Object[] {
projectName, "Debug", targtype
}));
writer.write("!MESSAGE \r\n");
writer.write("\r\n");
} | java | private void writeMessage(final Writer writer, final String projectName, final String targtype) throws IOException {
writer.write("!MESSAGE This is not a valid makefile. ");
writer.write("To build this project using NMAKE,\r\n");
writer.write("!MESSAGE use the Export Makefile command and run\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE NMAKE /f \"");
writer.write(projectName);
writer.write(".mak\".\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE You can specify a configuration when running NMAKE\r\n");
writer.write("!MESSAGE by defining the macro CFG on the command line. ");
writer.write("For example:\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE NMAKE /f \"");
writer.write(projectName);
writer.write(".mak\" CFG=\"");
writer.write(projectName);
writer.write(" - Win32 Debug\"\r\n");
writer.write("!MESSAGE \r\n");
writer.write("!MESSAGE Possible choices for configuration are:\r\n");
writer.write("!MESSAGE \r\n");
final String pattern = "!MESSAGE \"{0} - Win32 {1}\" (based on \"{2}\")\r\n";
writer.write(MessageFormat.format(pattern, new Object[] {
projectName, "Release", targtype
}));
writer.write(MessageFormat.format(pattern, new Object[] {
projectName, "Debug", targtype
}));
writer.write("!MESSAGE \r\n");
writer.write("\r\n");
} | [
"private",
"void",
"writeMessage",
"(",
"final",
"Writer",
"writer",
",",
"final",
"String",
"projectName",
",",
"final",
"String",
"targtype",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"\"!MESSAGE This is not a valid makefile. \"",
")",
";",
"writer",
".",
"write",
"(",
"\"To build this project using NMAKE,\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE use the Export Makefile command and run\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE NMAKE /f \\\"\"",
")",
";",
"writer",
".",
"write",
"(",
"projectName",
")",
";",
"writer",
".",
"write",
"(",
"\".mak\\\".\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE You can specify a configuration when running NMAKE\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE by defining the macro CFG on the command line. \"",
")",
";",
"writer",
".",
"write",
"(",
"\"For example:\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE NMAKE /f \\\"\"",
")",
";",
"writer",
".",
"write",
"(",
"projectName",
")",
";",
"writer",
".",
"write",
"(",
"\".mak\\\" CFG=\\\"\"",
")",
";",
"writer",
".",
"write",
"(",
"projectName",
")",
";",
"writer",
".",
"write",
"(",
"\" - Win32 Debug\\\"\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE Possible choices for configuration are:\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"final",
"String",
"pattern",
"=",
"\"!MESSAGE \\\"{0} - Win32 {1}\\\" (based on \\\"{2}\\\")\\r\\n\"",
";",
"writer",
".",
"write",
"(",
"MessageFormat",
".",
"format",
"(",
"pattern",
",",
"new",
"Object",
"[",
"]",
"{",
"projectName",
",",
"\"Release\"",
",",
"targtype",
"}",
")",
")",
";",
"writer",
".",
"write",
"(",
"MessageFormat",
".",
"format",
"(",
"pattern",
",",
"new",
"Object",
"[",
"]",
"{",
"projectName",
",",
"\"Debug\"",
",",
"targtype",
"}",
")",
")",
";",
"writer",
".",
"write",
"(",
"\"!MESSAGE \\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"}"
] | Writes "This is not a makefile" warning.
@param writer
Writer writer
@param projectName
String project name
@param targtype
String target type
@throws IOException
if error writing project | [
"Writes",
"This",
"is",
"not",
"a",
"makefile",
"warning",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/msvc/MsvcProjectWriter.java#L440-L471 |
apache/fluo-recipes | modules/core/src/main/java/org/apache/fluo/recipes/core/common/TransientRegistry.java | TransientRegistry.addTransientRange | public void addTransientRange(String id, RowRange range) {
"""
This method is expected to be called before Fluo is initialized to register transient ranges.
"""
String start = DatatypeConverter.printHexBinary(range.getStart().toArray());
String end = DatatypeConverter.printHexBinary(range.getEnd().toArray());
appConfig.setProperty(PREFIX + id, start + ":" + end);
} | java | public void addTransientRange(String id, RowRange range) {
String start = DatatypeConverter.printHexBinary(range.getStart().toArray());
String end = DatatypeConverter.printHexBinary(range.getEnd().toArray());
appConfig.setProperty(PREFIX + id, start + ":" + end);
} | [
"public",
"void",
"addTransientRange",
"(",
"String",
"id",
",",
"RowRange",
"range",
")",
"{",
"String",
"start",
"=",
"DatatypeConverter",
".",
"printHexBinary",
"(",
"range",
".",
"getStart",
"(",
")",
".",
"toArray",
"(",
")",
")",
";",
"String",
"end",
"=",
"DatatypeConverter",
".",
"printHexBinary",
"(",
"range",
".",
"getEnd",
"(",
")",
".",
"toArray",
"(",
")",
")",
";",
"appConfig",
".",
"setProperty",
"(",
"PREFIX",
"+",
"id",
",",
"start",
"+",
"\":\"",
"+",
"end",
")",
";",
"}"
] | This method is expected to be called before Fluo is initialized to register transient ranges. | [
"This",
"method",
"is",
"expected",
"to",
"be",
"called",
"before",
"Fluo",
"is",
"initialized",
"to",
"register",
"transient",
"ranges",
"."
] | train | https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/core/src/main/java/org/apache/fluo/recipes/core/common/TransientRegistry.java#L55-L60 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.initializeEmbedded | private static Object initializeEmbedded(EmbeddedMetadata embeddedMetadata, Object target) {
"""
Initializes the Embedded object represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field
@param target
the object in which the embedded field is declared/accessible from
@return the initialized object
@throws EntityManagerException
if any error occurs during initialization of the embedded object
"""
try {
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
Object embeddedObject = null;
if (constructorMetadata.isClassicConstructionStrategy()) {
embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
}
if (embeddedObject == null) {
embeddedObject = constructorMetadata.getConstructorMethodHandle().invoke();
}
return embeddedObject;
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | java | private static Object initializeEmbedded(EmbeddedMetadata embeddedMetadata, Object target) {
try {
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
Object embeddedObject = null;
if (constructorMetadata.isClassicConstructionStrategy()) {
embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
}
if (embeddedObject == null) {
embeddedObject = constructorMetadata.getConstructorMethodHandle().invoke();
}
return embeddedObject;
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | [
"private",
"static",
"Object",
"initializeEmbedded",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"ConstructorMetadata",
"constructorMetadata",
"=",
"embeddedMetadata",
".",
"getConstructorMetadata",
"(",
")",
";",
"Object",
"embeddedObject",
"=",
"null",
";",
"if",
"(",
"constructorMetadata",
".",
"isClassicConstructionStrategy",
"(",
")",
")",
"{",
"embeddedObject",
"=",
"embeddedMetadata",
".",
"getReadMethod",
"(",
")",
".",
"invoke",
"(",
"target",
")",
";",
"}",
"if",
"(",
"embeddedObject",
"==",
"null",
")",
"{",
"embeddedObject",
"=",
"constructorMetadata",
".",
"getConstructorMethodHandle",
"(",
")",
".",
"invoke",
"(",
")",
";",
"}",
"return",
"embeddedObject",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"throw",
"new",
"EntityManagerException",
"(",
"t",
")",
";",
"}",
"}"
] | Initializes the Embedded object represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field
@param target
the object in which the embedded field is declared/accessible from
@return the initialized object
@throws EntityManagerException
if any error occurs during initialization of the embedded object | [
"Initializes",
"the",
"Embedded",
"object",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L353-L367 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/CmdArgs.java | CmdArgs.addOption | public final <T> void addOption(String name, String description) {
"""
Add a mandatory string option
@param <T> Type of option
@param name Option name Option name without
@param description Option description
"""
addOption(String.class, name, description, null);
} | java | public final <T> void addOption(String name, String description)
{
addOption(String.class, name, description, null);
} | [
"public",
"final",
"<",
"T",
">",
"void",
"addOption",
"(",
"String",
"name",
",",
"String",
"description",
")",
"{",
"addOption",
"(",
"String",
".",
"class",
",",
"name",
",",
"description",
",",
"null",
")",
";",
"}"
] | Add a mandatory string option
@param <T> Type of option
@param name Option name Option name without
@param description Option description | [
"Add",
"a",
"mandatory",
"string",
"option"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L320-L323 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | ConcurrentUtils.putIfAbsent | public static <K, V> V putIfAbsent(final ConcurrentMap<K, V> map, final K key, final V value) {
"""
<p>
Puts a value in the specified {@code ConcurrentMap} if the key is not yet
present. This method works similar to the {@code putIfAbsent()} method of
the {@code ConcurrentMap} interface, but the value returned is different.
Basically, this method is equivalent to the following code fragment:
</p>
<pre>
if (!map.containsKey(key)) {
map.put(key, value);
return value;
} else {
return map.get(key);
}
</pre>
<p>
except that the action is performed atomically. So this method always
returns the value which is stored in the map.
</p>
<p>
This method is <b>null</b>-safe: It accepts a <b>null</b> map as input
without throwing an exception. In this case the return value is
<b>null</b>, too.
</p>
@param <K> the type of the keys of the map
@param <V> the type of the values of the map
@param map the map to be modified
@param key the key of the value to be added
@param value the value to be added
@return the value stored in the map after this operation
"""
if (map == null) {
return null;
}
final V result = map.putIfAbsent(key, value);
return result != null ? result : value;
} | java | public static <K, V> V putIfAbsent(final ConcurrentMap<K, V> map, final K key, final V value) {
if (map == null) {
return null;
}
final V result = map.putIfAbsent(key, value);
return result != null ? result : value;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"V",
"putIfAbsent",
"(",
"final",
"ConcurrentMap",
"<",
"K",
",",
"V",
">",
"map",
",",
"final",
"K",
"key",
",",
"final",
"V",
"value",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"V",
"result",
"=",
"map",
".",
"putIfAbsent",
"(",
"key",
",",
"value",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"result",
":",
"value",
";",
"}"
] | <p>
Puts a value in the specified {@code ConcurrentMap} if the key is not yet
present. This method works similar to the {@code putIfAbsent()} method of
the {@code ConcurrentMap} interface, but the value returned is different.
Basically, this method is equivalent to the following code fragment:
</p>
<pre>
if (!map.containsKey(key)) {
map.put(key, value);
return value;
} else {
return map.get(key);
}
</pre>
<p>
except that the action is performed atomically. So this method always
returns the value which is stored in the map.
</p>
<p>
This method is <b>null</b>-safe: It accepts a <b>null</b> map as input
without throwing an exception. In this case the return value is
<b>null</b>, too.
</p>
@param <K> the type of the keys of the map
@param <V> the type of the values of the map
@param map the map to be modified
@param key the key of the value to be added
@param value the value to be added
@return the value stored in the map after this operation | [
"<p",
">",
"Puts",
"a",
"value",
"in",
"the",
"specified",
"{",
"@code",
"ConcurrentMap",
"}",
"if",
"the",
"key",
"is",
"not",
"yet",
"present",
".",
"This",
"method",
"works",
"similar",
"to",
"the",
"{",
"@code",
"putIfAbsent",
"()",
"}",
"method",
"of",
"the",
"{",
"@code",
"ConcurrentMap",
"}",
"interface",
"but",
"the",
"value",
"returned",
"is",
"different",
".",
"Basically",
"this",
"method",
"is",
"equivalent",
"to",
"the",
"following",
"code",
"fragment",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java#L245-L252 |
ModeShape/modeshape | modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java | DocumentFactory.newDocument | public static EditableDocument newDocument( String name,
Object value ) {
"""
Create a new editable document, initialized with a single field, that can be used as a new document entry in a SchematicDb
or as nested documents for other documents.
@param name the name of the initial field in the resulting document; if null, the field will not be added to the returned
document
@param value the value of the initial field in the resulting document
@return the editable document; never null
"""
return new DocumentEditor(new BasicDocument(name, value), DEFAULT_FACTORY);
} | java | public static EditableDocument newDocument( String name,
Object value ) {
return new DocumentEditor(new BasicDocument(name, value), DEFAULT_FACTORY);
} | [
"public",
"static",
"EditableDocument",
"newDocument",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"DocumentEditor",
"(",
"new",
"BasicDocument",
"(",
"name",
",",
"value",
")",
",",
"DEFAULT_FACTORY",
")",
";",
"}"
] | Create a new editable document, initialized with a single field, that can be used as a new document entry in a SchematicDb
or as nested documents for other documents.
@param name the name of the initial field in the resulting document; if null, the field will not be added to the returned
document
@param value the value of the initial field in the resulting document
@return the editable document; never null | [
"Create",
"a",
"new",
"editable",
"document",
"initialized",
"with",
"a",
"single",
"field",
"that",
"can",
"be",
"used",
"as",
"a",
"new",
"document",
"entry",
"in",
"a",
"SchematicDb",
"or",
"as",
"nested",
"documents",
"for",
"other",
"documents",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java#L69-L72 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/HFClient.java | HFClient.newChannel | public Channel newChannel(String name, Orderer orderer, ChannelConfiguration channelConfiguration,
byte[]... channelConfigurationSignatures) throws TransactionException, InvalidArgumentException {
"""
Create a new channel
@param name The channel's name
@param orderer Orderer to create the channel with.
@param channelConfiguration Channel configuration data.
@param channelConfigurationSignatures byte arrays containing ConfigSignature's proto serialized.
See {@link Channel#getChannelConfigurationSignature} on how to create
@return a new channel.
@throws TransactionException
@throws InvalidArgumentException
"""
clientCheck();
if (Utils.isNullOrEmpty(name)) {
throw new InvalidArgumentException("Channel name can not be null or empty string.");
}
synchronized (channels) {
if (channels.containsKey(name)) {
throw new InvalidArgumentException(format("Channel by the name %s already exits", name));
}
logger.trace("Creating channel :" + name);
Channel newChannel = Channel.createNewInstance(name, this, orderer, channelConfiguration,
channelConfigurationSignatures);
channels.put(name, newChannel);
return newChannel;
}
} | java | public Channel newChannel(String name, Orderer orderer, ChannelConfiguration channelConfiguration,
byte[]... channelConfigurationSignatures) throws TransactionException, InvalidArgumentException {
clientCheck();
if (Utils.isNullOrEmpty(name)) {
throw new InvalidArgumentException("Channel name can not be null or empty string.");
}
synchronized (channels) {
if (channels.containsKey(name)) {
throw new InvalidArgumentException(format("Channel by the name %s already exits", name));
}
logger.trace("Creating channel :" + name);
Channel newChannel = Channel.createNewInstance(name, this, orderer, channelConfiguration,
channelConfigurationSignatures);
channels.put(name, newChannel);
return newChannel;
}
} | [
"public",
"Channel",
"newChannel",
"(",
"String",
"name",
",",
"Orderer",
"orderer",
",",
"ChannelConfiguration",
"channelConfiguration",
",",
"byte",
"[",
"]",
"...",
"channelConfigurationSignatures",
")",
"throws",
"TransactionException",
",",
"InvalidArgumentException",
"{",
"clientCheck",
"(",
")",
";",
"if",
"(",
"Utils",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Channel name can not be null or empty string.\"",
")",
";",
"}",
"synchronized",
"(",
"channels",
")",
"{",
"if",
"(",
"channels",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"format",
"(",
"\"Channel by the name %s already exits\"",
",",
"name",
")",
")",
";",
"}",
"logger",
".",
"trace",
"(",
"\"Creating channel :\"",
"+",
"name",
")",
";",
"Channel",
"newChannel",
"=",
"Channel",
".",
"createNewInstance",
"(",
"name",
",",
"this",
",",
"orderer",
",",
"channelConfiguration",
",",
"channelConfigurationSignatures",
")",
";",
"channels",
".",
"put",
"(",
"name",
",",
"newChannel",
")",
";",
"return",
"newChannel",
";",
"}",
"}"
] | Create a new channel
@param name The channel's name
@param orderer Orderer to create the channel with.
@param channelConfiguration Channel configuration data.
@param channelConfigurationSignatures byte arrays containing ConfigSignature's proto serialized.
See {@link Channel#getChannelConfigurationSignature} on how to create
@return a new channel.
@throws TransactionException
@throws InvalidArgumentException | [
"Create",
"a",
"new",
"channel"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L264-L288 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.rectangleGaussian | public static DMatrixRMaj rectangleGaussian(int numRow , int numCol , double mean , double stdev , Random rand ) {
"""
<p>
Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and
standard deviation
</p>
@param numRow Number of rows in the new matrix.
@param numCol Number of columns in the new matrix.
@param mean Mean value in the distribution
@param stdev Standard deviation in the distribution
@param rand Random number generator used to fill the matrix.
"""
DMatrixRMaj m = new DMatrixRMaj(numRow,numCol);
fillGaussian(m,mean,stdev,rand);
return m;
} | java | public static DMatrixRMaj rectangleGaussian(int numRow , int numCol , double mean , double stdev , Random rand )
{
DMatrixRMaj m = new DMatrixRMaj(numRow,numCol);
fillGaussian(m,mean,stdev,rand);
return m;
} | [
"public",
"static",
"DMatrixRMaj",
"rectangleGaussian",
"(",
"int",
"numRow",
",",
"int",
"numCol",
",",
"double",
"mean",
",",
"double",
"stdev",
",",
"Random",
"rand",
")",
"{",
"DMatrixRMaj",
"m",
"=",
"new",
"DMatrixRMaj",
"(",
"numRow",
",",
"numCol",
")",
";",
"fillGaussian",
"(",
"m",
",",
"mean",
",",
"stdev",
",",
"rand",
")",
";",
"return",
"m",
";",
"}"
] | <p>
Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and
standard deviation
</p>
@param numRow Number of rows in the new matrix.
@param numCol Number of columns in the new matrix.
@param mean Mean value in the distribution
@param stdev Standard deviation in the distribution
@param rand Random number generator used to fill the matrix. | [
"<p",
">",
"Sets",
"each",
"element",
"in",
"the",
"matrix",
"to",
"a",
"value",
"drawn",
"from",
"an",
"Gaussian",
"distribution",
"with",
"the",
"specified",
"mean",
"and",
"standard",
"deviation",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L404-L409 |
groovy/groovy-core | src/main/org/apache/commons/cli/GroovyInternalPosixParser.java | GroovyInternalPosixParser.processNonOptionToken | private void processNonOptionToken(String value, boolean stopAtNonOption) {
"""
Add the special token "<b>--</b>" and the current <code>value</code>
to the processed tokens list. Then add all the remaining
<code>argument</code> values to the processed tokens list.
@param value The current token
"""
if (stopAtNonOption && (currentOption == null || !currentOption.hasArg()))
{
eatTheRest = true;
tokens.add("--");
}
tokens.add(value);
currentOption = null;
} | java | private void processNonOptionToken(String value, boolean stopAtNonOption)
{
if (stopAtNonOption && (currentOption == null || !currentOption.hasArg()))
{
eatTheRest = true;
tokens.add("--");
}
tokens.add(value);
currentOption = null;
} | [
"private",
"void",
"processNonOptionToken",
"(",
"String",
"value",
",",
"boolean",
"stopAtNonOption",
")",
"{",
"if",
"(",
"stopAtNonOption",
"&&",
"(",
"currentOption",
"==",
"null",
"||",
"!",
"currentOption",
".",
"hasArg",
"(",
")",
")",
")",
"{",
"eatTheRest",
"=",
"true",
";",
"tokens",
".",
"add",
"(",
"\"--\"",
")",
";",
"}",
"tokens",
".",
"add",
"(",
"value",
")",
";",
"currentOption",
"=",
"null",
";",
"}"
] | Add the special token "<b>--</b>" and the current <code>value</code>
to the processed tokens list. Then add all the remaining
<code>argument</code> values to the processed tokens list.
@param value The current token | [
"Add",
"the",
"special",
"token",
"<b",
">",
"--",
"<",
"/",
"b",
">",
"and",
"the",
"current",
"<code",
">",
"value<",
"/",
"code",
">",
"to",
"the",
"processed",
"tokens",
"list",
".",
"Then",
"add",
"all",
"the",
"remaining",
"<code",
">",
"argument<",
"/",
"code",
">",
"values",
"to",
"the",
"processed",
"tokens",
"list",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/apache/commons/cli/GroovyInternalPosixParser.java#L183-L193 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.haversineFormulaDeg | public static double haversineFormulaDeg(double lat1, double lon1, double lat2, double lon2) {
"""
Compute the approximate great-circle distance of two points using the
Haversine formula
<p>
Complexity: 5 trigonometric functions, 1 sqrt.
<p>
Reference:
<p>
R. W. Sinnott,<br>
Virtues of the Haversine<br>
Sky and Telescope 68(2)
@param lat1 Latitude of first point in degree
@param lon1 Longitude of first point in degree
@param lat2 Latitude of second point in degree
@param lon2 Longitude of second point in degree
@return Distance on unit sphere
"""
return haversineFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2));
} | java | public static double haversineFormulaDeg(double lat1, double lon1, double lat2, double lon2) {
return haversineFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2));
} | [
"public",
"static",
"double",
"haversineFormulaDeg",
"(",
"double",
"lat1",
",",
"double",
"lon1",
",",
"double",
"lat2",
",",
"double",
"lon2",
")",
"{",
"return",
"haversineFormulaRad",
"(",
"deg2rad",
"(",
"lat1",
")",
",",
"deg2rad",
"(",
"lon1",
")",
",",
"deg2rad",
"(",
"lat2",
")",
",",
"deg2rad",
"(",
"lon2",
")",
")",
";",
"}"
] | Compute the approximate great-circle distance of two points using the
Haversine formula
<p>
Complexity: 5 trigonometric functions, 1 sqrt.
<p>
Reference:
<p>
R. W. Sinnott,<br>
Virtues of the Haversine<br>
Sky and Telescope 68(2)
@param lat1 Latitude of first point in degree
@param lon1 Longitude of first point in degree
@param lat2 Latitude of second point in degree
@param lon2 Longitude of second point in degree
@return Distance on unit sphere | [
"Compute",
"the",
"approximate",
"great",
"-",
"circle",
"distance",
"of",
"two",
"points",
"using",
"the",
"Haversine",
"formula",
"<p",
">",
"Complexity",
":",
"5",
"trigonometric",
"functions",
"1",
"sqrt",
".",
"<p",
">",
"Reference",
":",
"<p",
">",
"R",
".",
"W",
".",
"Sinnott",
"<br",
">",
"Virtues",
"of",
"the",
"Haversine<br",
">",
"Sky",
"and",
"Telescope",
"68",
"(",
"2",
")"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L152-L154 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java | ChannelUpgradeHandler.removeProtocol | public synchronized void removeProtocol(String productString, HttpUpgradeListener upgradeListener) {
"""
Remove a protocol from this handler.
@param productString the product string to match
@param upgradeListener The upgrade listener
"""
List<Holder> holders = handlers.get(productString);
if (holders == null) {
return;
}
Iterator<Holder> it = holders.iterator();
while (it.hasNext()) {
Holder holder = it.next();
if (holder.listener == upgradeListener) {
holders.remove(holder);
break;
}
}
if (holders.isEmpty()) {
handlers.remove(productString);
}
} | java | public synchronized void removeProtocol(String productString, HttpUpgradeListener upgradeListener) {
List<Holder> holders = handlers.get(productString);
if (holders == null) {
return;
}
Iterator<Holder> it = holders.iterator();
while (it.hasNext()) {
Holder holder = it.next();
if (holder.listener == upgradeListener) {
holders.remove(holder);
break;
}
}
if (holders.isEmpty()) {
handlers.remove(productString);
}
} | [
"public",
"synchronized",
"void",
"removeProtocol",
"(",
"String",
"productString",
",",
"HttpUpgradeListener",
"upgradeListener",
")",
"{",
"List",
"<",
"Holder",
">",
"holders",
"=",
"handlers",
".",
"get",
"(",
"productString",
")",
";",
"if",
"(",
"holders",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Iterator",
"<",
"Holder",
">",
"it",
"=",
"holders",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Holder",
"holder",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"holder",
".",
"listener",
"==",
"upgradeListener",
")",
"{",
"holders",
".",
"remove",
"(",
"holder",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"holders",
".",
"isEmpty",
"(",
")",
")",
"{",
"handlers",
".",
"remove",
"(",
"productString",
")",
";",
"}",
"}"
] | Remove a protocol from this handler.
@param productString the product string to match
@param upgradeListener The upgrade listener | [
"Remove",
"a",
"protocol",
"from",
"this",
"handler",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L151-L167 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.purgeDeletedCertificateAsync | public Observable<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName) {
"""
Permanently deletes the specified deleted certificate.
The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName) {
return purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"purgeDeletedCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
")",
"{",
"return",
"purgeDeletedCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Permanently deletes the specified deleted certificate.
The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Permanently",
"deletes",
"the",
"specified",
"deleted",
"certificate",
".",
"The",
"PurgeDeletedCertificate",
"operation",
"performs",
"an",
"irreversible",
"deletion",
"of",
"the",
"specified",
"certificate",
"without",
"possibility",
"for",
"recovery",
".",
"The",
"operation",
"is",
"not",
"available",
"if",
"the",
"recovery",
"level",
"does",
"not",
"specify",
"Purgeable",
".",
"This",
"operation",
"requires",
"the",
"certificate",
"/",
"purge",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8648-L8655 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniCard | public static MiniSat miniCard(final FormulaFactory f) {
"""
Returns a new MiniCard solver.
@param f the formula factory
@return the solver
"""
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | java | public static MiniSat miniCard(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | [
"public",
"static",
"MiniSat",
"miniCard",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINICARD",
",",
"new",
"MiniSatConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
",",
"null",
")",
";",
"}"
] | Returns a new MiniCard solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"MiniCard",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L171-L173 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/function/Actions.java | Actions.toFunc | public static <T1, T2, R> Func2<T1, T2, R> toFunc(final Action2<T1, T2> action, final R result) {
"""
Converts an {@link Action2} to a function that calls the action and returns a specified value.
@param action the {@link Action2} to convert
@param result the value to return from the function call
@return a {@link Func2} that calls {@code action} and returns {@code result}
"""
return new Func2<T1, T2, R>() {
@Override
public R call(T1 t1, T2 t2) {
action.call(t1, t2);
return result;
}
};
} | java | public static <T1, T2, R> Func2<T1, T2, R> toFunc(final Action2<T1, T2> action, final R result) {
return new Func2<T1, T2, R>() {
@Override
public R call(T1 t1, T2 t2) {
action.call(t1, t2);
return result;
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"Func2",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"toFunc",
"(",
"final",
"Action2",
"<",
"T1",
",",
"T2",
">",
"action",
",",
"final",
"R",
"result",
")",
"{",
"return",
"new",
"Func2",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"R",
"call",
"(",
"T1",
"t1",
",",
"T2",
"t2",
")",
"{",
"action",
".",
"call",
"(",
"t1",
",",
"t2",
")",
";",
"return",
"result",
";",
"}",
"}",
";",
"}"
] | Converts an {@link Action2} to a function that calls the action and returns a specified value.
@param action the {@link Action2} to convert
@param result the value to return from the function call
@return a {@link Func2} that calls {@code action} and returns {@code result} | [
"Converts",
"an",
"{",
"@link",
"Action2",
"}",
"to",
"a",
"function",
"that",
"calls",
"the",
"action",
"and",
"returns",
"a",
"specified",
"value",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L236-L244 |
calrissian/mango | mango-json/src/main/java/org/calrissian/mango/json/mappings/ObjectJsonNode.java | ObjectJsonNode.visit | @Override
public void visit(String[] keys, int level, Map<Integer, Integer> levelToIdx, ValueJsonNode valueJsonNode) {
"""
Sets state on current instance based on the flattened tree representation from the input.
This will also determine the next child, if necessary, and propagate the next level of
the tree (down to the child).
@param keys
@param level
@param levelToIdx
@param valueJsonNode
"""
if(level == keys.length-1)
children.put(keys[level], valueJsonNode);
else {
JsonTreeNode child = children.get(keys[level]);
// look toJson see if next item exists, otherwise, create it, add it toJson children, and visit it.
String nextKey = keys[level+1];
if(child == null) {
if (nextKey.equals("[]"))
child = new ArrayJsonNode();
else
child = new ObjectJsonNode();
children.put(keys[level], child);
}
child.visit(keys, level+1, levelToIdx, valueJsonNode);
}
} | java | @Override
public void visit(String[] keys, int level, Map<Integer, Integer> levelToIdx, ValueJsonNode valueJsonNode) {
if(level == keys.length-1)
children.put(keys[level], valueJsonNode);
else {
JsonTreeNode child = children.get(keys[level]);
// look toJson see if next item exists, otherwise, create it, add it toJson children, and visit it.
String nextKey = keys[level+1];
if(child == null) {
if (nextKey.equals("[]"))
child = new ArrayJsonNode();
else
child = new ObjectJsonNode();
children.put(keys[level], child);
}
child.visit(keys, level+1, levelToIdx, valueJsonNode);
}
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"String",
"[",
"]",
"keys",
",",
"int",
"level",
",",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"levelToIdx",
",",
"ValueJsonNode",
"valueJsonNode",
")",
"{",
"if",
"(",
"level",
"==",
"keys",
".",
"length",
"-",
"1",
")",
"children",
".",
"put",
"(",
"keys",
"[",
"level",
"]",
",",
"valueJsonNode",
")",
";",
"else",
"{",
"JsonTreeNode",
"child",
"=",
"children",
".",
"get",
"(",
"keys",
"[",
"level",
"]",
")",
";",
"// look toJson see if next item exists, otherwise, create it, add it toJson children, and visit it.",
"String",
"nextKey",
"=",
"keys",
"[",
"level",
"+",
"1",
"]",
";",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"if",
"(",
"nextKey",
".",
"equals",
"(",
"\"[]\"",
")",
")",
"child",
"=",
"new",
"ArrayJsonNode",
"(",
")",
";",
"else",
"child",
"=",
"new",
"ObjectJsonNode",
"(",
")",
";",
"children",
".",
"put",
"(",
"keys",
"[",
"level",
"]",
",",
"child",
")",
";",
"}",
"child",
".",
"visit",
"(",
"keys",
",",
"level",
"+",
"1",
",",
"levelToIdx",
",",
"valueJsonNode",
")",
";",
"}",
"}"
] | Sets state on current instance based on the flattened tree representation from the input.
This will also determine the next child, if necessary, and propagate the next level of
the tree (down to the child).
@param keys
@param level
@param levelToIdx
@param valueJsonNode | [
"Sets",
"state",
"on",
"current",
"instance",
"based",
"on",
"the",
"flattened",
"tree",
"representation",
"from",
"the",
"input",
".",
"This",
"will",
"also",
"determine",
"the",
"next",
"child",
"if",
"necessary",
"and",
"propagate",
"the",
"next",
"level",
"of",
"the",
"tree",
"(",
"down",
"to",
"the",
"child",
")",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/ObjectJsonNode.java#L40-L63 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/cors/AbstractCorsPolicyBuilder.java | AbstractCorsPolicyBuilder.preflightResponseHeader | public B preflightResponseHeader(CharSequence name, Iterable<?> values) {
"""
Specifies HTTP response headers that should be added to a CORS preflight response.
<p>An intermediary like a load balancer might require that a CORS preflight request
have certain headers set. This enables such headers to be added.
@param name the name of the HTTP header.
@param values the values for the HTTP header.
@return {@code this} to support method chaining.
"""
requireNonNull(name, "name");
requireNonNull(values, "values");
checkArgument(!Iterables.isEmpty(values), "values should not be empty.");
final ImmutableList.Builder builder = new Builder();
int i = 0;
for (Object value : values) {
if (value == null) {
throw new NullPointerException("value[" + i + ']');
}
builder.add(value);
i++;
}
preflightResponseHeaders.put(HttpHeaderNames.of(name), new ConstantValueSupplier(builder.build()));
return self();
} | java | public B preflightResponseHeader(CharSequence name, Iterable<?> values) {
requireNonNull(name, "name");
requireNonNull(values, "values");
checkArgument(!Iterables.isEmpty(values), "values should not be empty.");
final ImmutableList.Builder builder = new Builder();
int i = 0;
for (Object value : values) {
if (value == null) {
throw new NullPointerException("value[" + i + ']');
}
builder.add(value);
i++;
}
preflightResponseHeaders.put(HttpHeaderNames.of(name), new ConstantValueSupplier(builder.build()));
return self();
} | [
"public",
"B",
"preflightResponseHeader",
"(",
"CharSequence",
"name",
",",
"Iterable",
"<",
"?",
">",
"values",
")",
"{",
"requireNonNull",
"(",
"name",
",",
"\"name\"",
")",
";",
"requireNonNull",
"(",
"values",
",",
"\"values\"",
")",
";",
"checkArgument",
"(",
"!",
"Iterables",
".",
"isEmpty",
"(",
"values",
")",
",",
"\"values should not be empty.\"",
")",
";",
"final",
"ImmutableList",
".",
"Builder",
"builder",
"=",
"new",
"Builder",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Object",
"value",
":",
"values",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"value[\"",
"+",
"i",
"+",
"'",
"'",
")",
";",
"}",
"builder",
".",
"add",
"(",
"value",
")",
";",
"i",
"++",
";",
"}",
"preflightResponseHeaders",
".",
"put",
"(",
"HttpHeaderNames",
".",
"of",
"(",
"name",
")",
",",
"new",
"ConstantValueSupplier",
"(",
"builder",
".",
"build",
"(",
")",
")",
")",
";",
"return",
"self",
"(",
")",
";",
"}"
] | Specifies HTTP response headers that should be added to a CORS preflight response.
<p>An intermediary like a load balancer might require that a CORS preflight request
have certain headers set. This enables such headers to be added.
@param name the name of the HTTP header.
@param values the values for the HTTP header.
@return {@code this} to support method chaining. | [
"Specifies",
"HTTP",
"response",
"headers",
"that",
"should",
"be",
"added",
"to",
"a",
"CORS",
"preflight",
"response",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/AbstractCorsPolicyBuilder.java#L315-L330 |
d-michail/jheaps | src/main/java/org/jheaps/tree/FibonacciHeap.java | FibonacciHeap.link | private void link(Node<K, V> y, Node<K, V> x) {
"""
/*
Remove node y from the root list and make it a child of x. Degree of x
increases by 1 and y is unmarked if marked.
"""
// remove from root list
y.prev.next = y.next;
y.next.prev = y.prev;
// one less root
roots--;
// clear if marked
y.mark = false;
// hang as x's child
x.degree++;
y.parent = x;
Node<K, V> child = x.child;
if (child == null) {
x.child = y;
y.next = y;
y.prev = y;
} else {
y.prev = child;
y.next = child.next;
child.next = y;
y.next.prev = y;
}
} | java | private void link(Node<K, V> y, Node<K, V> x) {
// remove from root list
y.prev.next = y.next;
y.next.prev = y.prev;
// one less root
roots--;
// clear if marked
y.mark = false;
// hang as x's child
x.degree++;
y.parent = x;
Node<K, V> child = x.child;
if (child == null) {
x.child = y;
y.next = y;
y.prev = y;
} else {
y.prev = child;
y.next = child.next;
child.next = y;
y.next.prev = y;
}
} | [
"private",
"void",
"link",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"y",
",",
"Node",
"<",
"K",
",",
"V",
">",
"x",
")",
"{",
"// remove from root list",
"y",
".",
"prev",
".",
"next",
"=",
"y",
".",
"next",
";",
"y",
".",
"next",
".",
"prev",
"=",
"y",
".",
"prev",
";",
"// one less root",
"roots",
"--",
";",
"// clear if marked",
"y",
".",
"mark",
"=",
"false",
";",
"// hang as x's child",
"x",
".",
"degree",
"++",
";",
"y",
".",
"parent",
"=",
"x",
";",
"Node",
"<",
"K",
",",
"V",
">",
"child",
"=",
"x",
".",
"child",
";",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"x",
".",
"child",
"=",
"y",
";",
"y",
".",
"next",
"=",
"y",
";",
"y",
".",
"prev",
"=",
"y",
";",
"}",
"else",
"{",
"y",
".",
"prev",
"=",
"child",
";",
"y",
".",
"next",
"=",
"child",
".",
"next",
";",
"child",
".",
"next",
"=",
"y",
";",
"y",
".",
"next",
".",
"prev",
"=",
"y",
";",
"}",
"}"
] | /*
Remove node y from the root list and make it a child of x. Degree of x
increases by 1 and y is unmarked if marked. | [
"/",
"*",
"Remove",
"node",
"y",
"from",
"the",
"root",
"list",
"and",
"make",
"it",
"a",
"child",
"of",
"x",
".",
"Degree",
"of",
"x",
"increases",
"by",
"1",
"and",
"y",
"is",
"unmarked",
"if",
"marked",
"."
] | train | https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/FibonacciHeap.java#L630-L656 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java | ImageIOGreyScale.getImageReadersByFormatName | public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
"""
Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that
claim to be able to decode the named format.
@param formatName
a <code>String</code> containing the informal name of a format (<i>e.g.</i>, "jpeg" or
"tiff".
@return an <code>Iterator</code> containing <code>ImageReader</code>s.
@exception IllegalArgumentException
if <code>formatName</code> is <code>null</code>.
@see javax.imageio.spi.ImageReaderSpi#getFormatNames
"""
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | java | public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | [
"public",
"static",
"Iterator",
"<",
"ImageReader",
">",
"getImageReadersByFormatName",
"(",
"String",
"formatName",
")",
"{",
"if",
"(",
"formatName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"formatName == null!\"",
")",
";",
"}",
"Iterator",
"iter",
";",
"// Ensure category is present\r",
"try",
"{",
"iter",
"=",
"theRegistry",
".",
"getServiceProviders",
"(",
"ImageReaderSpi",
".",
"class",
",",
"new",
"ContainsFilter",
"(",
"readerFormatNamesMethod",
",",
"formatName",
")",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"new",
"HashSet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"}",
"return",
"new",
"ImageReaderIterator",
"(",
"iter",
")",
";",
"}"
] | Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that
claim to be able to decode the named format.
@param formatName
a <code>String</code> containing the informal name of a format (<i>e.g.</i>, "jpeg" or
"tiff".
@return an <code>Iterator</code> containing <code>ImageReader</code>s.
@exception IllegalArgumentException
if <code>formatName</code> is <code>null</code>.
@see javax.imageio.spi.ImageReaderSpi#getFormatNames | [
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"containing",
"all",
"currently",
"registered",
"<code",
">",
"ImageReader<",
"/",
"code",
">",
"s",
"that",
"claim",
"to",
"be",
"able",
"to",
"decode",
"the",
"named",
"format",
"."
] | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L624-L636 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.arsort | public static <T extends Comparable<T>> Integer[] arsort(T[] array) {
"""
Sorts an array in descending order and returns an array with indexes of
the original order.
@param <T>
@param array
@return
"""
return _asort(array, true);
} | java | public static <T extends Comparable<T>> Integer[] arsort(T[] array) {
return _asort(array, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Integer",
"[",
"]",
"arsort",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"_asort",
"(",
"array",
",",
"true",
")",
";",
"}"
] | Sorts an array in descending order and returns an array with indexes of
the original order.
@param <T>
@param array
@return | [
"Sorts",
"an",
"array",
"in",
"descending",
"order",
"and",
"returns",
"an",
"array",
"with",
"indexes",
"of",
"the",
"original",
"order",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L281-L283 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/PoiAPI.java | PoiAPI.getPoiList | public static PoiListResult getPoiList(String accessToken, int begin, int limit) {
"""
查询门店列表
@param accessToken 令牌
@param begin 开始位置,0 即为从第一条开始查询
@param limit 返回数据条数,最大允许50,默认为20
@return result
"""
return getPoiList(accessToken, String.format("{\"begin\":%d, \"limit\": %d}", begin, limit));
} | java | public static PoiListResult getPoiList(String accessToken, int begin, int limit) {
return getPoiList(accessToken, String.format("{\"begin\":%d, \"limit\": %d}", begin, limit));
} | [
"public",
"static",
"PoiListResult",
"getPoiList",
"(",
"String",
"accessToken",
",",
"int",
"begin",
",",
"int",
"limit",
")",
"{",
"return",
"getPoiList",
"(",
"accessToken",
",",
"String",
".",
"format",
"(",
"\"{\\\"begin\\\":%d, \\\"limit\\\": %d}\"",
",",
"begin",
",",
"limit",
")",
")",
";",
"}"
] | 查询门店列表
@param accessToken 令牌
@param begin 开始位置,0 即为从第一条开始查询
@param limit 返回数据条数,最大允许50,默认为20
@return result | [
"查询门店列表"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PoiAPI.java#L107-L109 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.sqlpower | public static void sqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
"""
power to pow translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens
"""
twoArgumentsFunctionCall(buf, "pow(", "power", parsedArgs);
} | java | public static void sqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
twoArgumentsFunctionCall(buf, "pow(", "power", parsedArgs);
} | [
"public",
"static",
"void",
"sqlpower",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"twoArgumentsFunctionCall",
"(",
"buf",
",",
"\"pow(\"",
",",
"\"power\"",
",",
"parsedArgs",
")",
";",
"}"
] | power to pow translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens | [
"power",
"to",
"pow",
"translation"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L120-L122 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java | SectionNumber.setFromString | public void setFromString(String sectionNumber, int level) {
"""
Change this version number from the given string representation.
<p>The string representation should be integer numbers, separated by dot characters.
@param sectionNumber the string representation of the version number.
@param level is the level at which the section number is visible (1 for the top level, 2 for subsections...)
"""
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast();
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i]));
}
} | java | public void setFromString(String sectionNumber, int level) {
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast();
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i]));
}
} | [
"public",
"void",
"setFromString",
"(",
"String",
"sectionNumber",
",",
"int",
"level",
")",
"{",
"assert",
"level",
">=",
"1",
";",
"final",
"String",
"[",
"]",
"numbers",
"=",
"sectionNumber",
".",
"split",
"(",
"\"[^0-9]+\"",
")",
";",
"//$NON-NLS-1$",
"final",
"int",
"len",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"this",
".",
"numbers",
".",
"size",
"(",
")",
"-",
"numbers",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"this",
".",
"numbers",
".",
"removeLast",
"(",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numbers",
".",
"length",
"&&",
"i",
"<",
"level",
";",
"++",
"i",
")",
"{",
"this",
".",
"numbers",
".",
"addLast",
"(",
"Integer",
".",
"valueOf",
"(",
"numbers",
"[",
"i",
"]",
")",
")",
";",
"}",
"}"
] | Change this version number from the given string representation.
<p>The string representation should be integer numbers, separated by dot characters.
@param sectionNumber the string representation of the version number.
@param level is the level at which the section number is visible (1 for the top level, 2 for subsections...) | [
"Change",
"this",
"version",
"number",
"from",
"the",
"given",
"string",
"representation",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java#L56-L66 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateCuboid | public static VertexData generateCuboid(Vector3f size) {
"""
Generates a solid cuboid mesh. This mesh includes the positions, normals, texture coords and tangents. The center is at the middle of the cuboid.
@param size The size of the cuboid to generate, on x, y and z
@return The vertex data
"""
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3);
destination.addAttribute(1, normalsAttribute);
final TFloatList normals = new TFloatArrayList();
final TIntList indices = destination.getIndices();
final VertexAttribute textureCoordsAttribute = new VertexAttribute("textureCoords", DataType.FLOAT, 2);
destination.addAttribute(2, textureCoordsAttribute);
final TFloatList texturesCoords = new TFloatArrayList();
// Generate the mesh
generateCuboid(positions, normals, texturesCoords, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
normalsAttribute.setData(normals);
textureCoordsAttribute.setData(texturesCoords);
return destination;
} | java | public static VertexData generateCuboid(Vector3f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3);
destination.addAttribute(1, normalsAttribute);
final TFloatList normals = new TFloatArrayList();
final TIntList indices = destination.getIndices();
final VertexAttribute textureCoordsAttribute = new VertexAttribute("textureCoords", DataType.FLOAT, 2);
destination.addAttribute(2, textureCoordsAttribute);
final TFloatList texturesCoords = new TFloatArrayList();
// Generate the mesh
generateCuboid(positions, normals, texturesCoords, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
normalsAttribute.setData(normals);
textureCoordsAttribute.setData(texturesCoords);
return destination;
} | [
"public",
"static",
"VertexData",
"generateCuboid",
"(",
"Vector3f",
"size",
")",
"{",
"final",
"VertexData",
"destination",
"=",
"new",
"VertexData",
"(",
")",
";",
"final",
"VertexAttribute",
"positionsAttribute",
"=",
"new",
"VertexAttribute",
"(",
"\"positions\"",
",",
"DataType",
".",
"FLOAT",
",",
"3",
")",
";",
"destination",
".",
"addAttribute",
"(",
"0",
",",
"positionsAttribute",
")",
";",
"final",
"TFloatList",
"positions",
"=",
"new",
"TFloatArrayList",
"(",
")",
";",
"final",
"VertexAttribute",
"normalsAttribute",
"=",
"new",
"VertexAttribute",
"(",
"\"normals\"",
",",
"DataType",
".",
"FLOAT",
",",
"3",
")",
";",
"destination",
".",
"addAttribute",
"(",
"1",
",",
"normalsAttribute",
")",
";",
"final",
"TFloatList",
"normals",
"=",
"new",
"TFloatArrayList",
"(",
")",
";",
"final",
"TIntList",
"indices",
"=",
"destination",
".",
"getIndices",
"(",
")",
";",
"final",
"VertexAttribute",
"textureCoordsAttribute",
"=",
"new",
"VertexAttribute",
"(",
"\"textureCoords\"",
",",
"DataType",
".",
"FLOAT",
",",
"2",
")",
";",
"destination",
".",
"addAttribute",
"(",
"2",
",",
"textureCoordsAttribute",
")",
";",
"final",
"TFloatList",
"texturesCoords",
"=",
"new",
"TFloatArrayList",
"(",
")",
";",
"// Generate the mesh",
"generateCuboid",
"(",
"positions",
",",
"normals",
",",
"texturesCoords",
",",
"indices",
",",
"size",
")",
";",
"// Put the mesh in the vertex data",
"positionsAttribute",
".",
"setData",
"(",
"positions",
")",
";",
"normalsAttribute",
".",
"setData",
"(",
"normals",
")",
";",
"textureCoordsAttribute",
".",
"setData",
"(",
"texturesCoords",
")",
";",
"return",
"destination",
";",
"}"
] | Generates a solid cuboid mesh. This mesh includes the positions, normals, texture coords and tangents. The center is at the middle of the cuboid.
@param size The size of the cuboid to generate, on x, y and z
@return The vertex data | [
"Generates",
"a",
"solid",
"cuboid",
"mesh",
".",
"This",
"mesh",
"includes",
"the",
"positions",
"normals",
"texture",
"coords",
"and",
"tangents",
".",
"The",
"center",
"is",
"at",
"the",
"middle",
"of",
"the",
"cuboid",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L660-L679 |
RuedigerMoeller/kontraktor | examples/misc/pub-sub/tcp-based/src/main/java/pubsub/point2point/MediatorActor.java | MediatorActor.tellSubscribers | public void tellSubscribers( Actor sender, String topic, Object message) {
"""
send a fire and forget message to all
@param sender
@param topic
@param message
"""
List<ReceiverActor> subscriber = topic2Subscriber.get(topic);
if ( subscriber != null ) {
subscriber.stream()
.filter(subs -> !subs.equals(sender)) // do not receive self sent
.forEach(subs -> subs.receiveTell(topic, message) );
}
} | java | public void tellSubscribers( Actor sender, String topic, Object message) {
List<ReceiverActor> subscriber = topic2Subscriber.get(topic);
if ( subscriber != null ) {
subscriber.stream()
.filter(subs -> !subs.equals(sender)) // do not receive self sent
.forEach(subs -> subs.receiveTell(topic, message) );
}
} | [
"public",
"void",
"tellSubscribers",
"(",
"Actor",
"sender",
",",
"String",
"topic",
",",
"Object",
"message",
")",
"{",
"List",
"<",
"ReceiverActor",
">",
"subscriber",
"=",
"topic2Subscriber",
".",
"get",
"(",
"topic",
")",
";",
"if",
"(",
"subscriber",
"!=",
"null",
")",
"{",
"subscriber",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"subs",
"->",
"!",
"subs",
".",
"equals",
"(",
"sender",
")",
")",
"// do not receive self sent",
".",
"forEach",
"(",
"subs",
"->",
"subs",
".",
"receiveTell",
"(",
"topic",
",",
"message",
")",
")",
";",
"}",
"}"
] | send a fire and forget message to all
@param sender
@param topic
@param message | [
"send",
"a",
"fire",
"and",
"forget",
"message",
"to",
"all"
] | train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/examples/misc/pub-sub/tcp-based/src/main/java/pubsub/point2point/MediatorActor.java#L63-L70 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/MessageFramer.java | MessageFramer.writeKnownLengthUncompressed | private int writeKnownLengthUncompressed(InputStream message, int messageLength)
throws IOException {
"""
Write an unserialized message with a known length, uncompressed.
"""
if (maxOutboundMessageSize >= 0 && messageLength > maxOutboundMessageSize) {
throw Status.RESOURCE_EXHAUSTED
.withDescription(
String.format("message too large %d > %d", messageLength , maxOutboundMessageSize))
.asRuntimeException();
}
ByteBuffer header = ByteBuffer.wrap(headerScratch);
header.put(UNCOMPRESSED);
header.putInt(messageLength);
// Allocate the initial buffer chunk based on frame header + payload length.
// Note that the allocator may allocate a buffer larger or smaller than this length
if (buffer == null) {
buffer = bufferAllocator.allocate(header.position() + messageLength);
}
writeRaw(headerScratch, 0, header.position());
return writeToOutputStream(message, outputStreamAdapter);
} | java | private int writeKnownLengthUncompressed(InputStream message, int messageLength)
throws IOException {
if (maxOutboundMessageSize >= 0 && messageLength > maxOutboundMessageSize) {
throw Status.RESOURCE_EXHAUSTED
.withDescription(
String.format("message too large %d > %d", messageLength , maxOutboundMessageSize))
.asRuntimeException();
}
ByteBuffer header = ByteBuffer.wrap(headerScratch);
header.put(UNCOMPRESSED);
header.putInt(messageLength);
// Allocate the initial buffer chunk based on frame header + payload length.
// Note that the allocator may allocate a buffer larger or smaller than this length
if (buffer == null) {
buffer = bufferAllocator.allocate(header.position() + messageLength);
}
writeRaw(headerScratch, 0, header.position());
return writeToOutputStream(message, outputStreamAdapter);
} | [
"private",
"int",
"writeKnownLengthUncompressed",
"(",
"InputStream",
"message",
",",
"int",
"messageLength",
")",
"throws",
"IOException",
"{",
"if",
"(",
"maxOutboundMessageSize",
">=",
"0",
"&&",
"messageLength",
">",
"maxOutboundMessageSize",
")",
"{",
"throw",
"Status",
".",
"RESOURCE_EXHAUSTED",
".",
"withDescription",
"(",
"String",
".",
"format",
"(",
"\"message too large %d > %d\"",
",",
"messageLength",
",",
"maxOutboundMessageSize",
")",
")",
".",
"asRuntimeException",
"(",
")",
";",
"}",
"ByteBuffer",
"header",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"headerScratch",
")",
";",
"header",
".",
"put",
"(",
"UNCOMPRESSED",
")",
";",
"header",
".",
"putInt",
"(",
"messageLength",
")",
";",
"// Allocate the initial buffer chunk based on frame header + payload length.",
"// Note that the allocator may allocate a buffer larger or smaller than this length",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"buffer",
"=",
"bufferAllocator",
".",
"allocate",
"(",
"header",
".",
"position",
"(",
")",
"+",
"messageLength",
")",
";",
"}",
"writeRaw",
"(",
"headerScratch",
",",
"0",
",",
"header",
".",
"position",
"(",
")",
")",
";",
"return",
"writeToOutputStream",
"(",
"message",
",",
"outputStreamAdapter",
")",
";",
"}"
] | Write an unserialized message with a known length, uncompressed. | [
"Write",
"an",
"unserialized",
"message",
"with",
"a",
"known",
"length",
"uncompressed",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/MessageFramer.java#L212-L230 |
wildfly/wildfly-maven-plugin | plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java | ServerOperations.createRemoveOperation | public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) {
"""
Creates a remove operation.
@param address the address for the operation
@param recursive {@code true} if the remove should be recursive, otherwise {@code false}
@return the operation
"""
final ModelNode op = createRemoveOperation(address);
op.get(RECURSIVE).set(recursive);
return op;
} | java | public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) {
final ModelNode op = createRemoveOperation(address);
op.get(RECURSIVE).set(recursive);
return op;
} | [
"public",
"static",
"ModelNode",
"createRemoveOperation",
"(",
"final",
"ModelNode",
"address",
",",
"final",
"boolean",
"recursive",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createRemoveOperation",
"(",
"address",
")",
";",
"op",
".",
"get",
"(",
"RECURSIVE",
")",
".",
"set",
"(",
"recursive",
")",
";",
"return",
"op",
";",
"}"
] | Creates a remove operation.
@param address the address for the operation
@param recursive {@code true} if the remove should be recursive, otherwise {@code false}
@return the operation | [
"Creates",
"a",
"remove",
"operation",
"."
] | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L101-L105 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/index/Index.java | Index.getSearch | public static ISearch getSearch()
throws EFapsException {
"""
Gets the directory.
@return the directory
@throws EFapsException on error
"""
ISearch ret = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXSEARCHCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXSEARCHCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
ret = (ISearch) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e);
}
} else {
ret = new ISearch()
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The query. */
private String query;
@Override
public void setQuery(final String _query)
{
this.query = _query;
}
@Override
public String getQuery()
{
return this.query;
}
};
}
return ret;
} | java | public static ISearch getSearch()
throws EFapsException
{
ISearch ret = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXSEARCHCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXSEARCHCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
ret = (ISearch) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e);
}
} else {
ret = new ISearch()
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The query. */
private String query;
@Override
public void setQuery(final String _query)
{
this.query = _query;
}
@Override
public String getQuery()
{
return this.query;
}
};
}
return ret;
} | [
"public",
"static",
"ISearch",
"getSearch",
"(",
")",
"throws",
"EFapsException",
"{",
"ISearch",
"ret",
"=",
"null",
";",
"if",
"(",
"EFapsSystemConfiguration",
".",
"get",
"(",
")",
".",
"containsAttributeValue",
"(",
"KernelSettings",
".",
"INDEXSEARCHCLASS",
")",
")",
"{",
"final",
"String",
"clazzname",
"=",
"EFapsSystemConfiguration",
".",
"get",
"(",
")",
".",
"getAttributeValue",
"(",
"KernelSettings",
".",
"INDEXSEARCHCLASS",
")",
";",
"try",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"clazzname",
",",
"false",
",",
"EFapsClassLoader",
".",
"getInstance",
"(",
")",
")",
";",
"ret",
"=",
"(",
"ISearch",
")",
"clazz",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoundException",
"|",
"InstantiationException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"EFapsException",
"(",
"Index",
".",
"class",
",",
"\"Could not instanciate IDirectoryProvider\"",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"ret",
"=",
"new",
"ISearch",
"(",
")",
"{",
"/** The Constant serialVersionUID. */",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"/** The query. */",
"private",
"String",
"query",
";",
"@",
"Override",
"public",
"void",
"setQuery",
"(",
"final",
"String",
"_query",
")",
"{",
"this",
".",
"query",
"=",
"_query",
";",
"}",
"@",
"Override",
"public",
"String",
"getQuery",
"(",
")",
"{",
"return",
"this",
".",
"query",
";",
"}",
"}",
";",
"}",
"return",
"ret",
";",
"}"
] | Gets the directory.
@return the directory
@throws EFapsException on error | [
"Gets",
"the",
"directory",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/Index.java#L177-L213 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java | AudioFactory.loadAudio | public static synchronized Audio loadAudio(Media media) {
"""
Load an audio file and prepare it to be played.
@param media The audio media (must not be <code>null</code>).
@return The loaded audio.
@throws LionEngineException If invalid audio.
"""
Check.notNull(media);
final String extension = UtilFile.getExtension(media.getPath());
return Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media);
} | java | public static synchronized Audio loadAudio(Media media)
{
Check.notNull(media);
final String extension = UtilFile.getExtension(media.getPath());
return Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media);
} | [
"public",
"static",
"synchronized",
"Audio",
"loadAudio",
"(",
"Media",
"media",
")",
"{",
"Check",
".",
"notNull",
"(",
"media",
")",
";",
"final",
"String",
"extension",
"=",
"UtilFile",
".",
"getExtension",
"(",
"media",
".",
"getPath",
"(",
")",
")",
";",
"return",
"Optional",
".",
"ofNullable",
"(",
"FACTORIES",
".",
"get",
"(",
"extension",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"LionEngineException",
"(",
"media",
",",
"ERROR_FORMAT",
")",
")",
".",
"loadAudio",
"(",
"media",
")",
";",
"}"
] | Load an audio file and prepare it to be played.
@param media The audio media (must not be <code>null</code>).
@return The loaded audio.
@throws LionEngineException If invalid audio. | [
"Load",
"an",
"audio",
"file",
"and",
"prepare",
"it",
"to",
"be",
"played",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java#L51-L59 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java | SmileCodec.toBytes | @Override
public byte[] toBytes(T instance)
throws IllegalArgumentException {
"""
Converts the specified instance to smile encoded bytes.
@param instance the instance to convert to smile encoded bytes
@return smile encoded bytes (UTF-8)
@throws IllegalArgumentException if the specified instance can not be converted to smile
"""
try {
return mapper.writeValueAsBytes(instance);
}
catch (IOException e) {
throw new IllegalArgumentException(format("%s could not be converted to SMILE", instance.getClass().getName()), e);
}
} | java | @Override
public byte[] toBytes(T instance)
throws IllegalArgumentException
{
try {
return mapper.writeValueAsBytes(instance);
}
catch (IOException e) {
throw new IllegalArgumentException(format("%s could not be converted to SMILE", instance.getClass().getName()), e);
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"toBytes",
"(",
"T",
"instance",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"mapper",
".",
"writeValueAsBytes",
"(",
"instance",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\"%s could not be converted to SMILE\"",
",",
"instance",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] | Converts the specified instance to smile encoded bytes.
@param instance the instance to convert to smile encoded bytes
@return smile encoded bytes (UTF-8)
@throws IllegalArgumentException if the specified instance can not be converted to smile | [
"Converts",
"the",
"specified",
"instance",
"to",
"smile",
"encoded",
"bytes",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java#L145-L155 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/model/trace/Node.java | Node.addInteractionCorrelationId | public Node addInteractionCorrelationId(String id) {
"""
This method adds an interaction scoped correlation id.
@param id The id
@return The node
"""
this.correlationIds.add(new CorrelationIdentifier(Scope.Interaction, id));
return this;
} | java | public Node addInteractionCorrelationId(String id) {
this.correlationIds.add(new CorrelationIdentifier(Scope.Interaction, id));
return this;
} | [
"public",
"Node",
"addInteractionCorrelationId",
"(",
"String",
"id",
")",
"{",
"this",
".",
"correlationIds",
".",
"add",
"(",
"new",
"CorrelationIdentifier",
"(",
"Scope",
".",
"Interaction",
",",
"id",
")",
")",
";",
"return",
"this",
";",
"}"
] | This method adds an interaction scoped correlation id.
@param id The id
@return The node | [
"This",
"method",
"adds",
"an",
"interaction",
"scoped",
"correlation",
"id",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/model/trace/Node.java#L255-L258 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/ParameterUtil.java | ParameterUtil.getIntParameter | public static int getIntParameter (
HttpServletRequest req, String name, int defval, String invalidDataMessage)
throws DataValidationException {
"""
Fetches the supplied parameter from the request and converts it to an integer. If the
parameter does not exist, <code>defval</code> is returned. If the parameter is not a
well-formed integer, a data validation exception is thrown with the supplied message.
"""
String value = getParameter(req, name, false);
if (StringUtil.isBlank(value)) {
return defval;
}
return parseIntParameter(value, invalidDataMessage);
} | java | public static int getIntParameter (
HttpServletRequest req, String name, int defval, String invalidDataMessage)
throws DataValidationException
{
String value = getParameter(req, name, false);
if (StringUtil.isBlank(value)) {
return defval;
}
return parseIntParameter(value, invalidDataMessage);
} | [
"public",
"static",
"int",
"getIntParameter",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
",",
"int",
"defval",
",",
"String",
"invalidDataMessage",
")",
"throws",
"DataValidationException",
"{",
"String",
"value",
"=",
"getParameter",
"(",
"req",
",",
"name",
",",
"false",
")",
";",
"if",
"(",
"StringUtil",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
"defval",
";",
"}",
"return",
"parseIntParameter",
"(",
"value",
",",
"invalidDataMessage",
")",
";",
"}"
] | Fetches the supplied parameter from the request and converts it to an integer. If the
parameter does not exist, <code>defval</code> is returned. If the parameter is not a
well-formed integer, a data validation exception is thrown with the supplied message. | [
"Fetches",
"the",
"supplied",
"parameter",
"from",
"the",
"request",
"and",
"converts",
"it",
"to",
"an",
"integer",
".",
"If",
"the",
"parameter",
"does",
"not",
"exist",
"<code",
">",
"defval<",
"/",
"code",
">",
"is",
"returned",
".",
"If",
"the",
"parameter",
"is",
"not",
"a",
"well",
"-",
"formed",
"integer",
"a",
"data",
"validation",
"exception",
"is",
"thrown",
"with",
"the",
"supplied",
"message",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L173-L182 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.