repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java | ClassBuilder.buildClassInfo | public void buildClassInfo(XMLNode node, Content classContentTree) {
Content classInfoTree = writer.getClassInfoTreeHeader();
buildChildren(node, classInfoTree);
classContentTree.addContent(writer.getClassInfo(classInfoTree));
} | java | public void buildClassInfo(XMLNode node, Content classContentTree) {
Content classInfoTree = writer.getClassInfoTreeHeader();
buildChildren(node, classInfoTree);
classContentTree.addContent(writer.getClassInfo(classInfoTree));
} | [
"public",
"void",
"buildClassInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"classContentTree",
")",
"{",
"Content",
"classInfoTree",
"=",
"writer",
".",
"getClassInfoTreeHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"classInfoTree",
")",
";",
"clas... | Build the class information tree documentation.
@param node the XML element that specifies which components to document
@param classContentTree the content tree to which the documentation will be added | [
"Build",
"the",
"class",
"information",
"tree",
"documentation",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L171-L175 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/wrapper/GenericMonitoringWrapper.java | GenericMonitoringWrapper.wrapObject | public static <E> E wrapObject(final Class<E> clazz, final Object target) {
return wrapObject(clazz, target, new InApplicationMonitorTimingReporter());
} | java | public static <E> E wrapObject(final Class<E> clazz, final Object target) {
return wrapObject(clazz, target, new InApplicationMonitorTimingReporter());
} | [
"public",
"static",
"<",
"E",
">",
"E",
"wrapObject",
"(",
"final",
"Class",
"<",
"E",
">",
"clazz",
",",
"final",
"Object",
"target",
")",
"{",
"return",
"wrapObject",
"(",
"clazz",
",",
"target",
",",
"new",
"InApplicationMonitorTimingReporter",
"(",
")"... | Wraps the given object and returns the reporting proxy. Uses the
{@link InApplicationMonitorTimingReporter} to report the timings.
@param <E>
the type of the public interface of the wrapped object
@param clazz
the class object to the interface
@param target
the object to wrap
@return the monitoring wrapper | [
"Wraps",
"the",
"given",
"object",
"and",
"returns",
"the",
"reporting",
"proxy",
".",
"Uses",
"the",
"{",
"@link",
"InApplicationMonitorTimingReporter",
"}",
"to",
"report",
"the",
"timings",
"."
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/wrapper/GenericMonitoringWrapper.java#L68-L70 |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.fileCopy | public final void fileCopy(URL in, File out) throws IOException {
assert in != null;
try (InputStream inStream = in.openStream()) {
try (OutputStream outStream = new FileOutputStream(out)) {
final byte[] buf = new byte[FILE_BUFFER];
int len;
while ((len = inStream.read(buf)) > 0) {
outStream.write(buf, 0, len);
}
}
} finally {
getBuildContext().refresh(out);
}
} | java | public final void fileCopy(URL in, File out) throws IOException {
assert in != null;
try (InputStream inStream = in.openStream()) {
try (OutputStream outStream = new FileOutputStream(out)) {
final byte[] buf = new byte[FILE_BUFFER];
int len;
while ((len = inStream.read(buf)) > 0) {
outStream.write(buf, 0, len);
}
}
} finally {
getBuildContext().refresh(out);
}
} | [
"public",
"final",
"void",
"fileCopy",
"(",
"URL",
"in",
",",
"File",
"out",
")",
"throws",
"IOException",
"{",
"assert",
"in",
"!=",
"null",
";",
"try",
"(",
"InputStream",
"inStream",
"=",
"in",
".",
"openStream",
"(",
")",
")",
"{",
"try",
"(",
"O... | Copy a file.
@param in input file.
@param out output file.
@throws IOException on error. | [
"Copy",
"a",
"file",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L356-L369 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java | HystrixPropertiesFactory.getCommandProperties | public static HystrixCommandProperties getCommandProperties(HystrixCommandKey key, HystrixCommandProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getCommandPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixCommandProperties properties = commandProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixCommandProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getCommandProperties(key, builder);
// cache and return
HystrixCommandProperties existing = commandProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getCommandProperties(key, builder);
}
} | java | public static HystrixCommandProperties getCommandProperties(HystrixCommandKey key, HystrixCommandProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getCommandPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixCommandProperties properties = commandProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixCommandProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getCommandProperties(key, builder);
// cache and return
HystrixCommandProperties existing = commandProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getCommandProperties(key, builder);
}
} | [
"public",
"static",
"HystrixCommandProperties",
"getCommandProperties",
"(",
"HystrixCommandKey",
"key",
",",
"HystrixCommandProperties",
".",
"Setter",
"builder",
")",
"{",
"HystrixPropertiesStrategy",
"hystrixPropertiesStrategy",
"=",
"HystrixPlugins",
".",
"getInstance",
"... | Get an instance of {@link HystrixCommandProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCommand} instance.
@param key
Pass-thru to {@link HystrixPropertiesStrategy#getCommandProperties} implementation.
@param builder
Pass-thru to {@link HystrixPropertiesStrategy#getCommandProperties} implementation.
@return {@link HystrixCommandProperties} instance | [
"Get",
"an",
"instance",
"of",
"{",
"@link",
"HystrixCommandProperties",
"}",
"with",
"the",
"given",
"factory",
"{",
"@link",
"HystrixPropertiesStrategy",
"}",
"implementation",
"for",
"each",
"{",
"@link",
"HystrixCommand",
"}",
"instance",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java#L61-L86 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.findMethod | public static Method findMethod(Class<?> clazz, String methodName) throws NoSuchMethodException
{
for(Method method : clazz.getDeclaredMethods()) {
if(method.getName().equals(methodName)) {
method.setAccessible(true);
return method;
}
}
Class<?> superclass = clazz.getSuperclass();
if(superclass != null) {
if(superclass.getPackage().equals(clazz.getPackage())) {
return findMethod(superclass, methodName);
}
}
throw new NoSuchMethodException(String.format("%s#%s", clazz.getName(), methodName));
} | java | public static Method findMethod(Class<?> clazz, String methodName) throws NoSuchMethodException
{
for(Method method : clazz.getDeclaredMethods()) {
if(method.getName().equals(methodName)) {
method.setAccessible(true);
return method;
}
}
Class<?> superclass = clazz.getSuperclass();
if(superclass != null) {
if(superclass.getPackage().equals(clazz.getPackage())) {
return findMethod(superclass, methodName);
}
}
throw new NoSuchMethodException(String.format("%s#%s", clazz.getName(), methodName));
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
")",
"throws",
"NoSuchMethodException",
"{",
"for",
"(",
"Method",
"method",
":",
"clazz",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"if",
"... | Find method with given name and unknown parameter types. Traverses all declared methods from given class and
returns the one with specified name; if none found throws {@link NoSuchMethodException}. If there are overloaded
methods returns one of them but there is no guarantee which one. Returned method has accessibility enabled.
<p>
Implementation note: this method is inherently costly since at worst case needs to traverse all class methods. It
is recommended to be used with external method cache.
@param clazz Java class to return method from,
@param methodName method name.
@return class reflective method.
@throws NoSuchMethodException if there is no method with requested name. | [
"Find",
"method",
"with",
"given",
"name",
"and",
"unknown",
"parameter",
"types",
".",
"Traverses",
"all",
"declared",
"methods",
"from",
"given",
"class",
"and",
"returns",
"the",
"one",
"with",
"specified",
"name",
";",
"if",
"none",
"found",
"throws",
"{... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L563-L580 |
w3c/epubcheck | src/main/java/org/idpf/epubcheck/util/css/CssParser.java | CssParser.hasRuleSet | private boolean hasRuleSet(CssAtRule atRule, CssTokenIterator iter)
{
int debugIndex;
if (debug)
{
checkArgument(iter.last.getChar() == '{');
debugIndex = iter.index();
}
List<CssToken> list = iter.list;
for (int i = iter.index() + 1; i < list.size(); i++)
{
CssToken tk = list.get(i);
if (MATCH_OPENBRACE.apply(tk))
{
return true;
}
else if (MATCH_SEMI_CLOSEBRACE.apply(tk))
{
return false;
}
}
if (debug)
{
checkState(iter.last.getChar() == '{');
checkState(iter.index() == debugIndex);
}
return false;
} | java | private boolean hasRuleSet(CssAtRule atRule, CssTokenIterator iter)
{
int debugIndex;
if (debug)
{
checkArgument(iter.last.getChar() == '{');
debugIndex = iter.index();
}
List<CssToken> list = iter.list;
for (int i = iter.index() + 1; i < list.size(); i++)
{
CssToken tk = list.get(i);
if (MATCH_OPENBRACE.apply(tk))
{
return true;
}
else if (MATCH_SEMI_CLOSEBRACE.apply(tk))
{
return false;
}
}
if (debug)
{
checkState(iter.last.getChar() == '{');
checkState(iter.index() == debugIndex);
}
return false;
} | [
"private",
"boolean",
"hasRuleSet",
"(",
"CssAtRule",
"atRule",
",",
"CssTokenIterator",
"iter",
")",
"{",
"int",
"debugIndex",
";",
"if",
"(",
"debug",
")",
"{",
"checkArgument",
"(",
"iter",
".",
"last",
".",
"getChar",
"(",
")",
"==",
"'",
"'",
")",
... | With iter.last at '{', discover the at-rule type. The
contents is a ruleset if '{' comes before ';' or '}'. | [
"With",
"iter",
".",
"last",
"at",
"{",
"discover",
"the",
"at",
"-",
"rule",
"type",
".",
"The",
"contents",
"is",
"a",
"ruleset",
"if",
"{",
"comes",
"before",
";",
"or",
"}",
"."
] | train | https://github.com/w3c/epubcheck/blob/4d5a24d9f2878a2a5497eb11c036cc18fe2c0a78/src/main/java/org/idpf/epubcheck/util/css/CssParser.java#L666-L693 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java | FutureStreamUtils.forEachWithError | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachWithError(
final Stream<T> stream, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError) {
return forEachEvent(stream, consumerElement, consumerError, () -> {
});
} | java | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachWithError(
final Stream<T> stream, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError) {
return forEachEvent(stream, consumerElement, consumerError, () -> {
});
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Tuple3",
"<",
"CompletableFuture",
"<",
"Subscription",
">",
",",
"Runnable",
",",
"CompletableFuture",
"<",
"Boolean",
">",
">",
"forEachWithError",
"(",
"final",
"Stream",
"<",
"T",
">",... | Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers,
<pre>
{@code
Subscription next = StreanUtils.forEach(Stream.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.map(Supplier::getValue),System.out::println, e->e.printStackTrace());
System.out.println("processed!");
//prints
1
2
RuntimeException Stack Trace on System.err
4
processed!
}
</pre>
@param stream - the Stream to consume data from
@param consumerElement To accept incoming elements from the Stream
@param consumerError To accept incoming processing errors from the Stream
@return A Tuple containing a Future with a Subscription to this publisher, a runnable to skip processing on a separate thread, and future that stores true / false depending on success | [
"Perform",
"a",
"forEach",
"operation",
"over",
"the",
"Stream",
"capturing",
"any",
"elements",
"and",
"errors",
"in",
"the",
"supplied",
"consumers",
"<pre",
">",
"{",
"@code",
"Subscription",
"next",
"=",
"StreanUtils",
".",
"forEach",
"(",
"Stream",
".",
... | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/FutureStreamUtils.java#L198-L203 |
arakelian/jackson-utils | src/main/java/com/arakelian/jackson/model/Coordinate.java | Coordinate.equals2D | public boolean equals2D(final Coordinate c, final double tolerance) {
if (!equalsWithTolerance(this.getX(), c.getX(), tolerance)) {
return false;
}
if (!equalsWithTolerance(this.getY(), c.getY(), tolerance)) {
return false;
}
return true;
} | java | public boolean equals2D(final Coordinate c, final double tolerance) {
if (!equalsWithTolerance(this.getX(), c.getX(), tolerance)) {
return false;
}
if (!equalsWithTolerance(this.getY(), c.getY(), tolerance)) {
return false;
}
return true;
} | [
"public",
"boolean",
"equals2D",
"(",
"final",
"Coordinate",
"c",
",",
"final",
"double",
"tolerance",
")",
"{",
"if",
"(",
"!",
"equalsWithTolerance",
"(",
"this",
".",
"getX",
"(",
")",
",",
"c",
".",
"getX",
"(",
")",
",",
"tolerance",
")",
")",
"... | Tests if another coordinate has the same values for the X and Y ordinates. The Z ordinate is
ignored.
@param c
a <code>Coordinate</code> with which to do the 2D comparison.
@param tolerance
margin of error
@return true if <code>other</code> is a <code>Coordinate</code> with the same values for X
and Y. | [
"Tests",
"if",
"another",
"coordinate",
"has",
"the",
"same",
"values",
"for",
"the",
"X",
"and",
"Y",
"ordinates",
".",
"The",
"Z",
"ordinate",
"is",
"ignored",
"."
] | train | https://github.com/arakelian/jackson-utils/blob/db0028fe15c55f9dd8272e327bf67f6004011711/src/main/java/com/arakelian/jackson/model/Coordinate.java#L271-L279 |
threerings/nenya | core/src/main/java/com/threerings/resource/FileResourceBundle.java | FileResourceBundle.getResourceFile | public File getResourceFile (String path)
throws IOException
{
if (resolveJarFile()) {
return null;
}
// if we have been unpacked, return our unpacked file
if (_cache != null) {
File cfile = new File(_cache, path);
if (cfile.exists()) {
return cfile;
} else {
return null;
}
}
// otherwise, we unpack resources as needed into a temp directory
String tpath = StringUtil.md5hex(_source.getPath() + "%" + path);
File tfile = new File(getCacheDir(), tpath);
if (tfile.exists() && (tfile.lastModified() > _sourceLastMod)) {
return tfile;
}
JarEntry entry = _jarSource.getJarEntry(path);
if (entry == null) {
// log.info("Couldn't locate path in jar", "path", path, "jar", _jarSource);
return null;
}
// copy the resource into the temporary file
BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(tfile));
InputStream jin = _jarSource.getInputStream(entry);
StreamUtil.copy(jin, fout);
jin.close();
fout.close();
return tfile;
} | java | public File getResourceFile (String path)
throws IOException
{
if (resolveJarFile()) {
return null;
}
// if we have been unpacked, return our unpacked file
if (_cache != null) {
File cfile = new File(_cache, path);
if (cfile.exists()) {
return cfile;
} else {
return null;
}
}
// otherwise, we unpack resources as needed into a temp directory
String tpath = StringUtil.md5hex(_source.getPath() + "%" + path);
File tfile = new File(getCacheDir(), tpath);
if (tfile.exists() && (tfile.lastModified() > _sourceLastMod)) {
return tfile;
}
JarEntry entry = _jarSource.getJarEntry(path);
if (entry == null) {
// log.info("Couldn't locate path in jar", "path", path, "jar", _jarSource);
return null;
}
// copy the resource into the temporary file
BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(tfile));
InputStream jin = _jarSource.getInputStream(entry);
StreamUtil.copy(jin, fout);
jin.close();
fout.close();
return tfile;
} | [
"public",
"File",
"getResourceFile",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"resolveJarFile",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// if we have been unpacked, return our unpacked file",
"if",
"(",
"_cache",
"!=",
"null",
... | Returns a file from which the specified resource can be loaded. This method will unpack the
resource into a temporary directory and return a reference to that file.
@param path the path to the resource in this jar file.
@return a file from which the resource can be loaded or null if no such resource exists. | [
"Returns",
"a",
"file",
"from",
"which",
"the",
"specified",
"resource",
"can",
"be",
"loaded",
".",
"This",
"method",
"will",
"unpack",
"the",
"resource",
"into",
"a",
"temporary",
"directory",
"and",
"return",
"a",
"reference",
"to",
"that",
"file",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L215-L253 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/gson/EntrySerializer.java | EntrySerializer.serialize | @Override
public JsonElement serialize(CMAEntry src, Type type, JsonSerializationContext context) {
JsonObject fields = new JsonObject();
for (Map.Entry<String, LinkedHashMap<String, Object>> field : src.getFields().entrySet()) {
LinkedHashMap<String, Object> value = field.getValue();
if (value == null) {
continue;
}
String fieldId = field.getKey();
JsonObject jsonField = serializeField(context, field.getValue());
if (jsonField != null) {
fields.add(fieldId, jsonField);
}
}
JsonObject result = new JsonObject();
result.add("fields", fields);
final CMASystem sys = src.getSystem();
if (sys != null) {
result.add("sys", context.serialize(sys));
}
return result;
} | java | @Override
public JsonElement serialize(CMAEntry src, Type type, JsonSerializationContext context) {
JsonObject fields = new JsonObject();
for (Map.Entry<String, LinkedHashMap<String, Object>> field : src.getFields().entrySet()) {
LinkedHashMap<String, Object> value = field.getValue();
if (value == null) {
continue;
}
String fieldId = field.getKey();
JsonObject jsonField = serializeField(context, field.getValue());
if (jsonField != null) {
fields.add(fieldId, jsonField);
}
}
JsonObject result = new JsonObject();
result.add("fields", fields);
final CMASystem sys = src.getSystem();
if (sys != null) {
result.add("sys", context.serialize(sys));
}
return result;
} | [
"@",
"Override",
"public",
"JsonElement",
"serialize",
"(",
"CMAEntry",
"src",
",",
"Type",
"type",
",",
"JsonSerializationContext",
"context",
")",
"{",
"JsonObject",
"fields",
"=",
"new",
"JsonObject",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
... | Make sure all fields are mapped in the locale - value way.
@param src the source to be edited.
@param type the type to be used.
@param context the json context to be changed.
@return a created json element. | [
"Make",
"sure",
"all",
"fields",
"are",
"mapped",
"in",
"the",
"locale",
"-",
"value",
"way",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/gson/EntrySerializer.java#L44-L67 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java | OverlapResolver.resolveOverlap | public double resolveOverlap(IAtomContainer ac, IRingSet sssr) {
Vector overlappingAtoms = new Vector();
Vector overlappingBonds = new Vector();
logger.debug("Start of resolveOverlap");
double overlapScore = getOverlapScore(ac, overlappingAtoms, overlappingBonds);
if (overlapScore > 0) {
overlapScore = displace(ac, overlappingAtoms, overlappingBonds);
}
logger.debug("overlapScore = " + overlapScore);
logger.debug("End of resolveOverlap");
return overlapScore;
} | java | public double resolveOverlap(IAtomContainer ac, IRingSet sssr) {
Vector overlappingAtoms = new Vector();
Vector overlappingBonds = new Vector();
logger.debug("Start of resolveOverlap");
double overlapScore = getOverlapScore(ac, overlappingAtoms, overlappingBonds);
if (overlapScore > 0) {
overlapScore = displace(ac, overlappingAtoms, overlappingBonds);
}
logger.debug("overlapScore = " + overlapScore);
logger.debug("End of resolveOverlap");
return overlapScore;
} | [
"public",
"double",
"resolveOverlap",
"(",
"IAtomContainer",
"ac",
",",
"IRingSet",
"sssr",
")",
"{",
"Vector",
"overlappingAtoms",
"=",
"new",
"Vector",
"(",
")",
";",
"Vector",
"overlappingBonds",
"=",
"new",
"Vector",
"(",
")",
";",
"logger",
".",
"debug"... | Main method to be called to resolve overlap situations.
@param ac The atomcontainer in which the atom or bond overlap exists
@param sssr A ring set for this atom container if one exists, otherwhise null | [
"Main",
"method",
"to",
"be",
"called",
"to",
"resolve",
"overlap",
"situations",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java#L69-L81 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.mdb/src/com/ibm/ws/ejbcontainer/mdb/internal/MDBRuntimeImpl.java | MDBRuntimeImpl.getRRSXAResource | @Override
public XAResource getRRSXAResource(String activationSpecId, Xid xid) throws XAResourceNotAvailableException {
RRSXAResourceFactory factory = rrsXAResFactorySvcRef.getService();
if (factory == null) {
return null;
} else {
return factory.getTwoPhaseXAResource(xid);
}
} | java | @Override
public XAResource getRRSXAResource(String activationSpecId, Xid xid) throws XAResourceNotAvailableException {
RRSXAResourceFactory factory = rrsXAResFactorySvcRef.getService();
if (factory == null) {
return null;
} else {
return factory.getTwoPhaseXAResource(xid);
}
} | [
"@",
"Override",
"public",
"XAResource",
"getRRSXAResource",
"(",
"String",
"activationSpecId",
",",
"Xid",
"xid",
")",
"throws",
"XAResourceNotAvailableException",
"{",
"RRSXAResourceFactory",
"factory",
"=",
"rrsXAResFactorySvcRef",
".",
"getService",
"(",
")",
";",
... | Method to get the XAResource corresponding to an ActivationSpec from the RRSXAResourceFactory
@param activationSpecId The id of the ActivationSpec
@param xid Transaction branch qualifier
@return the XAResource | [
"Method",
"to",
"get",
"the",
"XAResource",
"corresponding",
"to",
"an",
"ActivationSpec",
"from",
"the",
"RRSXAResourceFactory"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.mdb/src/com/ibm/ws/ejbcontainer/mdb/internal/MDBRuntimeImpl.java#L408-L417 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java | OGraphDatabase.getEdgesBetweenVertexes | public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels) {
return getEdgesBetweenVertexes(iVertex1, iVertex2, iLabels, null);
} | java | public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels) {
return getEdgesBetweenVertexes(iVertex1, iVertex2, iLabels, null);
} | [
"public",
"Set",
"<",
"ODocument",
">",
"getEdgesBetweenVertexes",
"(",
"final",
"ODocument",
"iVertex1",
",",
"final",
"ODocument",
"iVertex2",
",",
"final",
"String",
"[",
"]",
"iLabels",
")",
"{",
"return",
"getEdgesBetweenVertexes",
"(",
"iVertex1",
",",
"iV... | Returns all the edges between the vertexes iVertex1 and iVertex2 with label between the array of labels passed as iLabels.
@param iVertex1
First Vertex
@param iVertex2
Second Vertex
@param iLabels
Array of strings with the labels to get as filter
@return The Set with the common Edges between the two vertexes. If edges aren't found the set is empty | [
"Returns",
"all",
"the",
"edges",
"between",
"the",
"vertexes",
"iVertex1",
"and",
"iVertex2",
"with",
"label",
"between",
"the",
"array",
"of",
"labels",
"passed",
"as",
"iLabels",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L353-L355 |
grpc/grpc-java | api/src/main/java/io/grpc/ClientInterceptors.java | ClientInterceptors.interceptForward | public static Channel interceptForward(Channel channel,
List<? extends ClientInterceptor> interceptors) {
List<? extends ClientInterceptor> copy = new ArrayList<>(interceptors);
Collections.reverse(copy);
return intercept(channel, copy);
} | java | public static Channel interceptForward(Channel channel,
List<? extends ClientInterceptor> interceptors) {
List<? extends ClientInterceptor> copy = new ArrayList<>(interceptors);
Collections.reverse(copy);
return intercept(channel, copy);
} | [
"public",
"static",
"Channel",
"interceptForward",
"(",
"Channel",
"channel",
",",
"List",
"<",
"?",
"extends",
"ClientInterceptor",
">",
"interceptors",
")",
"{",
"List",
"<",
"?",
"extends",
"ClientInterceptor",
">",
"copy",
"=",
"new",
"ArrayList",
"<>",
"(... | Create a new {@link Channel} that will call {@code interceptors} before starting a call on the
given channel. The first interceptor will have its {@link ClientInterceptor#interceptCall}
called first.
@param channel the underlying channel to intercept.
@param interceptors a list of interceptors to bind to {@code channel}.
@return a new channel instance with the interceptors applied. | [
"Create",
"a",
"new",
"{",
"@link",
"Channel",
"}",
"that",
"will",
"call",
"{",
"@code",
"interceptors",
"}",
"before",
"starting",
"a",
"call",
"on",
"the",
"given",
"channel",
".",
"The",
"first",
"interceptor",
"will",
"have",
"its",
"{",
"@link",
"C... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ClientInterceptors.java#L57-L62 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/time/SntpClient.java | SntpClient.readTimeStamp | private long readTimeStamp(byte[] buffer, int offset) {
long seconds = read32(buffer, offset);
long fraction = read32(buffer, offset + 4);
return ((seconds - OFFSET_1900_TO_1970) * 1000) + ((fraction * 1000L) / 0x100000000L);
} | java | private long readTimeStamp(byte[] buffer, int offset) {
long seconds = read32(buffer, offset);
long fraction = read32(buffer, offset + 4);
return ((seconds - OFFSET_1900_TO_1970) * 1000) + ((fraction * 1000L) / 0x100000000L);
} | [
"private",
"long",
"readTimeStamp",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"long",
"seconds",
"=",
"read32",
"(",
"buffer",
",",
"offset",
")",
";",
"long",
"fraction",
"=",
"read32",
"(",
"buffer",
",",
"offset",
"+",
"4",
... | Reads the NTP time stamp at the given offset in the buffer and returns
it as a system time (milliseconds since January 1, 1970). | [
"Reads",
"the",
"NTP",
"time",
"stamp",
"at",
"the",
"given",
"offset",
"in",
"the",
"buffer",
"and",
"returns",
"it",
"as",
"a",
"system",
"time",
"(",
"milliseconds",
"since",
"January",
"1",
"1970",
")",
"."
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/time/SntpClient.java#L186-L190 |
BrunoEberhard/minimal-j | src/main/java/org/minimalj/repository/DataSourceFactory.java | DataSourceFactory.oracleDbDataSource | public static DataSource oracleDbDataSource(String url, String user, String password) {
try {
@SuppressWarnings("unchecked")
Class<? extends DataSource> dataSourceClass = (Class<? extends DataSource>) Class.forName("oracle.jdbc.pool.OracleDataSource");
DataSource dataSource = dataSourceClass.newInstance();
dataSourceClass.getMethod("setURL", String.class).invoke(dataSource, url);
dataSourceClass.getMethod("setUser", String.class).invoke(dataSource, user);
dataSourceClass.getMethod("setPassword", String.class).invoke(dataSource, password);
// OracleDataSource dataSource = new OracleDataSource();
// dataSource.setURL(url);
// dataSource.setUser(user);
// dataSource.setPassword(password);
return dataSource;
} catch (Exception e) {
throw new LoggingRuntimeException(e, logger, "Cannot connect to oracle db");
}
} | java | public static DataSource oracleDbDataSource(String url, String user, String password) {
try {
@SuppressWarnings("unchecked")
Class<? extends DataSource> dataSourceClass = (Class<? extends DataSource>) Class.forName("oracle.jdbc.pool.OracleDataSource");
DataSource dataSource = dataSourceClass.newInstance();
dataSourceClass.getMethod("setURL", String.class).invoke(dataSource, url);
dataSourceClass.getMethod("setUser", String.class).invoke(dataSource, user);
dataSourceClass.getMethod("setPassword", String.class).invoke(dataSource, password);
// OracleDataSource dataSource = new OracleDataSource();
// dataSource.setURL(url);
// dataSource.setUser(user);
// dataSource.setPassword(password);
return dataSource;
} catch (Exception e) {
throw new LoggingRuntimeException(e, logger, "Cannot connect to oracle db");
}
} | [
"public",
"static",
"DataSource",
"oracleDbDataSource",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"DataSource",
">",
"dataSour... | Don't forget to add the dependency to ojdbc like this in your pom.xml
<pre>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<scope>provided</scope>
</dependency>
</pre>
You need to register at the oracle maven repository to actually get the driver.
@param url for example "jdbc:oracle:thin:@localhost:1521:orcl"
@param user User
@param password Password
@return DataSource | [
"Don",
"t",
"forget",
"to",
"add",
"the",
"dependency",
"to",
"ojdbc",
"like",
"this",
"in",
"your",
"pom",
".",
"xml",
"<pre",
">",
"<",
";",
"dependency>",
";",
"<",
";",
"groupId>",
";",
"com",
".",
"oracle<",
";",
"/",
"groupId>",
";",
... | train | https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/repository/DataSourceFactory.java#L148-L165 |
graknlabs/grakn | server/src/graql/analytics/Utility.java | Utility.getResourceEdgeId | public static ConceptId getResourceEdgeId(TransactionOLTP graph, ConceptId conceptId1, ConceptId conceptId2) {
if (mayHaveResourceEdge(graph, conceptId1, conceptId2)) {
Optional<Concept> firstConcept = graph.stream(Graql.match(
var("x").id(conceptId1.getValue()),
var("y").id(conceptId2.getValue()),
var("z").rel(var("x")).rel(var("y")))
.get("z"))
.map(answer -> answer.get("z"))
.findFirst();
if (firstConcept.isPresent()) {
return firstConcept.get().id();
}
}
return null;
} | java | public static ConceptId getResourceEdgeId(TransactionOLTP graph, ConceptId conceptId1, ConceptId conceptId2) {
if (mayHaveResourceEdge(graph, conceptId1, conceptId2)) {
Optional<Concept> firstConcept = graph.stream(Graql.match(
var("x").id(conceptId1.getValue()),
var("y").id(conceptId2.getValue()),
var("z").rel(var("x")).rel(var("y")))
.get("z"))
.map(answer -> answer.get("z"))
.findFirst();
if (firstConcept.isPresent()) {
return firstConcept.get().id();
}
}
return null;
} | [
"public",
"static",
"ConceptId",
"getResourceEdgeId",
"(",
"TransactionOLTP",
"graph",
",",
"ConceptId",
"conceptId1",
",",
"ConceptId",
"conceptId2",
")",
"{",
"if",
"(",
"mayHaveResourceEdge",
"(",
"graph",
",",
"conceptId1",
",",
"conceptId2",
")",
")",
"{",
... | Get the resource edge id if there is one. Return null if not. | [
"Get",
"the",
"resource",
"edge",
"id",
"if",
"there",
"is",
"one",
".",
"Return",
"null",
"if",
"not",
"."
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/analytics/Utility.java#L125-L139 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java | UnderFileSystemBlockStore.closeReaderOrWriter | public void closeReaderOrWriter(long sessionId, long blockId) throws IOException {
BlockInfo blockInfo;
try (LockResource lr = new LockResource(mLock)) {
blockInfo = mBlocks.get(new Key(sessionId, blockId));
if (blockInfo == null) {
LOG.warn("Key (block ID: {}, session ID {}) is not found when cleaning up the UFS block.",
blockId, sessionId);
return;
}
}
blockInfo.closeReaderOrWriter();
} | java | public void closeReaderOrWriter(long sessionId, long blockId) throws IOException {
BlockInfo blockInfo;
try (LockResource lr = new LockResource(mLock)) {
blockInfo = mBlocks.get(new Key(sessionId, blockId));
if (blockInfo == null) {
LOG.warn("Key (block ID: {}, session ID {}) is not found when cleaning up the UFS block.",
blockId, sessionId);
return;
}
}
blockInfo.closeReaderOrWriter();
} | [
"public",
"void",
"closeReaderOrWriter",
"(",
"long",
"sessionId",
",",
"long",
"blockId",
")",
"throws",
"IOException",
"{",
"BlockInfo",
"blockInfo",
";",
"try",
"(",
"LockResource",
"lr",
"=",
"new",
"LockResource",
"(",
"mLock",
")",
")",
"{",
"blockInfo",... | Closes the block reader or writer and checks whether it is necessary to commit the block
to Local block store.
During UFS block read, this is triggered when the block is unlocked.
During UFS block write, this is triggered when the UFS block is committed.
@param sessionId the session ID
@param blockId the block ID | [
"Closes",
"the",
"block",
"reader",
"or",
"writer",
"and",
"checks",
"whether",
"it",
"is",
"necessary",
"to",
"commit",
"the",
"block",
"to",
"Local",
"block",
"store",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L145-L156 |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/astro/JulianDay.java | JulianDay.ofSimplifiedTime | public static JulianDay ofSimplifiedTime(Moment moment) {
return new JulianDay(getValue(moment, TimeScale.POSIX), TimeScale.POSIX);
} | java | public static JulianDay ofSimplifiedTime(Moment moment) {
return new JulianDay(getValue(moment, TimeScale.POSIX), TimeScale.POSIX);
} | [
"public",
"static",
"JulianDay",
"ofSimplifiedTime",
"(",
"Moment",
"moment",
")",
"{",
"return",
"new",
"JulianDay",
"(",
"getValue",
"(",
"moment",
",",
"TimeScale",
".",
"POSIX",
")",
",",
"TimeScale",
".",
"POSIX",
")",
";",
"}"
] | /*[deutsch]
<p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#POSIX}. </p>
<p>Die Umrechnung erfordert keine delta-T-Korrektur. </p>
@param moment corresponding moment
@return JulianDay
@throws IllegalArgumentException if the Julian day of moment is not in supported range
@since 3.34/4.29 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"einen",
"julianischen",
"Tag",
"auf",
"der",
"Zeitskala",
"{",
"@link",
"TimeScale#POSIX",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/JulianDay.java#L330-L334 |
jenkinsci/jenkins | core/src/main/java/jenkins/org/apache/commons/validator/routines/UrlValidator.java | UrlValidator.countToken | protected int countToken(String token, String target) {
int tokenIndex = 0;
int count = 0;
while (tokenIndex != -1) {
tokenIndex = target.indexOf(token, tokenIndex);
if (tokenIndex > -1) {
tokenIndex++;
count++;
}
}
return count;
} | java | protected int countToken(String token, String target) {
int tokenIndex = 0;
int count = 0;
while (tokenIndex != -1) {
tokenIndex = target.indexOf(token, tokenIndex);
if (tokenIndex > -1) {
tokenIndex++;
count++;
}
}
return count;
} | [
"protected",
"int",
"countToken",
"(",
"String",
"token",
",",
"String",
"target",
")",
"{",
"int",
"tokenIndex",
"=",
"0",
";",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"tokenIndex",
"!=",
"-",
"1",
")",
"{",
"tokenIndex",
"=",
"target",
".",
"i... | Returns the number of times the token appears in the target.
@param token Token value to be counted.
@param target Target value to count tokens in.
@return the number of tokens. | [
"Returns",
"the",
"number",
"of",
"times",
"the",
"token",
"appears",
"in",
"the",
"target",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/org/apache/commons/validator/routines/UrlValidator.java#L510-L521 |
stripe/stripe-java | src/main/java/com/stripe/model/Invoice.java | Invoice.voidInvoice | public Invoice voidInvoice(RequestOptions options) throws StripeException {
return voidInvoice((Map<String, Object>) null, options);
} | java | public Invoice voidInvoice(RequestOptions options) throws StripeException {
return voidInvoice((Map<String, Object>) null, options);
} | [
"public",
"Invoice",
"voidInvoice",
"(",
"RequestOptions",
"options",
")",
"throws",
"StripeException",
"{",
"return",
"voidInvoice",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"null",
",",
"options",
")",
";",
"}"
] | Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
href="#delete_invoice">deletion</a>, however it only applies to finalized invoices and
maintains a papertrail where the invoice can still be found. | [
"Mark",
"a",
"finalized",
"invoice",
"as",
"void",
".",
"This",
"cannot",
"be",
"undone",
".",
"Voiding",
"an",
"invoice",
"is",
"similar",
"to",
"<a",
"href",
"=",
"#delete_invoice",
">",
"deletion<",
"/",
"a",
">",
"however",
"it",
"only",
"applies",
"... | train | https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Invoice.java#L1179-L1181 |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.requestEntryUpdate | protected <T extends DSet.Entry> void requestEntryUpdate (String name, DSet<T> set, T entry)
{
requestEntryUpdate(name, set, entry, Transport.DEFAULT);
} | java | protected <T extends DSet.Entry> void requestEntryUpdate (String name, DSet<T> set, T entry)
{
requestEntryUpdate(name, set, entry, Transport.DEFAULT);
} | [
"protected",
"<",
"T",
"extends",
"DSet",
".",
"Entry",
">",
"void",
"requestEntryUpdate",
"(",
"String",
"name",
",",
"DSet",
"<",
"T",
">",
"set",
",",
"T",
"entry",
")",
"{",
"requestEntryUpdate",
"(",
"name",
",",
"set",
",",
"entry",
",",
"Transpo... | Calls by derived instances when a set updater method was called. | [
"Calls",
"by",
"derived",
"instances",
"when",
"a",
"set",
"updater",
"method",
"was",
"called",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L923-L926 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/CommonSteps.java | CommonSteps.saveValueInDataOutputProvider | @Conditioned
@Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\.|\\?]")
@And("I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\.|\\?]")
public void saveValueInDataOutputProvider(String page, String field, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
String value = "";
try {
value = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + field)))).getText();
if (value == null) {
value = "";
}
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack());
}
Context.getCurrentScenario().write(Messages.format("Value of %s is: %s\n", field, value));
for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) {
try {
Context.getDataOutputProvider().writeDataResult(targetColumn, line, value);
} catch (final TechnicalException e) {
new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0);
}
}
} | java | @Conditioned
@Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\.|\\?]")
@And("I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\.|\\?]")
public void saveValueInDataOutputProvider(String page, String field, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
String value = "";
try {
value = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + field)))).getText();
if (value == null) {
value = "";
}
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack());
}
Context.getCurrentScenario().write(Messages.format("Value of %s is: %s\n", field, value));
for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) {
try {
Context.getDataOutputProvider().writeDataResult(targetColumn, line, value);
} catch (final TechnicalException e) {
new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0);
}
}
} | [
"@",
"Conditioned",
"@",
"Et",
"(",
"\"Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\\\.|\\\\?]\")",
"\r",
"@",
"And",
"(",
"\"I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\\\.|\\\\?]\"",
")",
"public",
"voi... | Save field in data output provider if all 'expected' parameters equals 'actual' parameters in conditions.
The value is saved directly into the data output provider (Excel, CSV, ...).
@param page
The concerned page of field
@param field
Name of the field to save in data output provider.
@param targetColumn
Target column (in data output provider) to save retrieved value.
@param conditions
list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws FailureException
if the scenario encounters a functional error (with message and screenshot)
@throws TechnicalException
is thrown if the scenario encounters a technical error (format, configuration, data, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT} or {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE} | [
"Save",
"field",
"in",
"data",
"output",
"provider",
"if",
"all",
"expected",
"parameters",
"equals",
"actual",
"parameters",
"in",
"conditions",
".",
"The",
"value",
"is",
"saved",
"directly",
"into",
"the",
"data",
"output",
"provider",
"(",
"Excel",
"CSV",
... | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L321-L342 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | Sort.quickSelect | public static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int k )
{
quickSelect( arr, 0, arr.length - 1, k );
} | java | public static <T extends Comparable<? super T>>
void quickSelect( T[] arr, int k )
{
quickSelect( arr, 0, arr.length - 1, k );
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"quickSelect",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"k",
")",
"{",
"quickSelect",
"(",
"arr",
",",
"0",
",",
"arr",
".",
"length",
"-",
"1",
",",
... | quick select algorithm
@param arr an array of Comparable items
@param k the k-th small index | [
"quick",
"select",
"algorithm"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L306-L310 |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierEvaluator.java | DocumentClassifierEvaluator.processSample | public DocSample processSample(DocSample sample) {
if (sample.isClearAdaptiveDataSet()) {
this.docClassifier.clearFeatureData();
}
String[] document = sample.getTokens();
String cat = docClassifier.classify(document);
if (sample.getLabel().equals(cat)) {
accuracy.add(1);
}
else {
accuracy.add(0);
}
return new DocSample(cat, sample.getTokens(), sample.isClearAdaptiveDataSet());
} | java | public DocSample processSample(DocSample sample) {
if (sample.isClearAdaptiveDataSet()) {
this.docClassifier.clearFeatureData();
}
String[] document = sample.getTokens();
String cat = docClassifier.classify(document);
if (sample.getLabel().equals(cat)) {
accuracy.add(1);
}
else {
accuracy.add(0);
}
return new DocSample(cat, sample.getTokens(), sample.isClearAdaptiveDataSet());
} | [
"public",
"DocSample",
"processSample",
"(",
"DocSample",
"sample",
")",
"{",
"if",
"(",
"sample",
".",
"isClearAdaptiveDataSet",
"(",
")",
")",
"{",
"this",
".",
"docClassifier",
".",
"clearFeatureData",
"(",
")",
";",
"}",
"String",
"[",
"]",
"document",
... | Evaluates the given reference {@link DocSample} object.
This is done by categorizing the document from the provided
{@link DocSample}. The detected category is then used
to calculate and update the score.
@param sample the reference {@link DocSample}. | [
"Evaluates",
"the",
"given",
"reference",
"{",
"@link",
"DocSample",
"}",
"object",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierEvaluator.java#L58-L73 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java | PublicanPODocBookBuilder.buildTranslatedBook | @Override
public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester,
final DocBookBuildingOptions buildingOptions,
final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException {
buildingOptions.setResolveEntities(true);
// Translation builds ignore the publican.cfg condition parameter
if (contentSpec.getPublicanCfg() != null) {
contentSpec.setPublicanCfg(contentSpec.getPublicanCfg().replaceAll("condition:\\s*.*($|\\r\\n|\\n)", ""));
}
// For PO builds just do a normal build initially and then add the POT/PO files later
return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>());
} | java | @Override
public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester,
final DocBookBuildingOptions buildingOptions,
final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException {
buildingOptions.setResolveEntities(true);
// Translation builds ignore the publican.cfg condition parameter
if (contentSpec.getPublicanCfg() != null) {
contentSpec.setPublicanCfg(contentSpec.getPublicanCfg().replaceAll("condition:\\s*.*($|\\r\\n|\\n)", ""));
}
// For PO builds just do a normal build initially and then add the POT/PO files later
return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>());
} | [
"@",
"Override",
"public",
"HashMap",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"buildTranslatedBook",
"(",
"final",
"ContentSpec",
"contentSpec",
",",
"final",
"String",
"requester",
",",
"final",
"DocBookBuildingOptions",
"buildingOptions",
",",
"final",
"Zanat... | Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book.
@param contentSpec The content specification to build from.
@param requester The user who requested the build.
@param buildingOptions The options to be used when building.
@param zanataDetails The Zanata server details to be used when populating links
@return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive.
@throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables.
@throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be
converted to a DOM Document. | [
"Builds",
"a",
"DocBook",
"Formatted",
"Book",
"using",
"a",
"Content",
"Specification",
"to",
"define",
"the",
"structure",
"and",
"contents",
"of",
"the",
"book",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L106-L117 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/ReLookupTextMapFactory.java | ReLookupTextMapFactory.setLookupTable | public void setLookupTable(Map<String,Map<K,V>> lookupTable)
{
this.lookupTable = new TreeMap<String,Map<K,V>> (lookupTable);
} | java | public void setLookupTable(Map<String,Map<K,V>> lookupTable)
{
this.lookupTable = new TreeMap<String,Map<K,V>> (lookupTable);
} | [
"public",
"void",
"setLookupTable",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"K",
",",
"V",
">",
">",
"lookupTable",
")",
"{",
"this",
".",
"lookupTable",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"Map",
"<",
"K",
",",
"V",
">",
">",
"(",
"lo... | The key of the lookup table is a regular expression
@param lookupTable the lookupTable to set | [
"The",
"key",
"of",
"the",
"lookup",
"table",
"is",
"a",
"regular",
"expression"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/ReLookupTextMapFactory.java#L62-L65 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createListItem | public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers);
} | java | public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"ListItem",
"createListItem",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"ListIt... | Create a ListItem, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"ListItem",
"style",
"it",
"and",
"add",
"the",
"data"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L249-L251 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalConsumer.java | JournalConsumer.getObjectXML | public InputStream getObjectXML(Context context, String pid, String encoding)
throws ServerException {
return delegate.getObjectXML(context, pid, encoding);
} | java | public InputStream getObjectXML(Context context, String pid, String encoding)
throws ServerException {
return delegate.getObjectXML(context, pid, encoding);
} | [
"public",
"InputStream",
"getObjectXML",
"(",
"Context",
"context",
",",
"String",
"pid",
",",
"String",
"encoding",
")",
"throws",
"ServerException",
"{",
"return",
"delegate",
".",
"getObjectXML",
"(",
"context",
",",
"pid",
",",
"encoding",
")",
";",
"}"
] | Read-only method: pass the call to the {@link ManagementDelegate}. | [
"Read",
"-",
"only",
"method",
":",
"pass",
"the",
"call",
"to",
"the",
"{"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalConsumer.java#L336-L339 |
Waikato/moa | moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java | KDTree.centerInstances | public void centerInstances(Instances centers, int[] assignments, double pc)
throws Exception {
int[] centList = new int[centers.numInstances()];
for (int i = 0; i < centers.numInstances(); i++)
centList[i] = i;
determineAssignments(m_Root, centers, centList, assignments, pc);
} | java | public void centerInstances(Instances centers, int[] assignments, double pc)
throws Exception {
int[] centList = new int[centers.numInstances()];
for (int i = 0; i < centers.numInstances(); i++)
centList[i] = i;
determineAssignments(m_Root, centers, centList, assignments, pc);
} | [
"public",
"void",
"centerInstances",
"(",
"Instances",
"centers",
",",
"int",
"[",
"]",
"assignments",
",",
"double",
"pc",
")",
"throws",
"Exception",
"{",
"int",
"[",
"]",
"centList",
"=",
"new",
"int",
"[",
"centers",
".",
"numInstances",
"(",
")",
"]... | Assigns instances to centers using KDTree.
@param centers the current centers
@param assignments the centerindex for each instance
@param pc the threshold value for pruning.
@throws Exception If there is some problem
assigning instances to centers. | [
"Assigns",
"instances",
"to",
"centers",
"using",
"KDTree",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L701-L709 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.importData | public void importData(String resourceGroupName, String name, ImportRDBParameters parameters) {
importDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().body();
} | java | public void importData(String resourceGroupName, String name, ImportRDBParameters parameters) {
importDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().last().body();
} | [
"public",
"void",
"importData",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"ImportRDBParameters",
"parameters",
")",
"{",
"importDataWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"parameters",
")",
".",
"toBlocking",
"(",
... | Import data into Redis cache.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param parameters Parameters for Redis import operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Import",
"data",
"into",
"Redis",
"cache",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1337-L1339 |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/multipart/inmemory/MemoryFileItem.java | MemoryFileItem.getString | public String getString() {
byte[] rawdata = get();
String charset = getCharSet();
if (charset == null) {
charset = DEFAULT_CHARSET;
}
try {
return new String(rawdata, charset);
} catch (UnsupportedEncodingException e) {
return new String(rawdata);
}
} | java | public String getString() {
byte[] rawdata = get();
String charset = getCharSet();
if (charset == null) {
charset = DEFAULT_CHARSET;
}
try {
return new String(rawdata, charset);
} catch (UnsupportedEncodingException e) {
return new String(rawdata);
}
} | [
"public",
"String",
"getString",
"(",
")",
"{",
"byte",
"[",
"]",
"rawdata",
"=",
"get",
"(",
")",
";",
"String",
"charset",
"=",
"getCharSet",
"(",
")",
";",
"if",
"(",
"charset",
"==",
"null",
")",
"{",
"charset",
"=",
"DEFAULT_CHARSET",
";",
"}",
... | Returns the contents of the file as a String, using the default
character encoding. This method uses {@link #get()} to retrieve the
contents of the file.
@return the contents of the file, as a string | [
"Returns",
"the",
"contents",
"of",
"the",
"file",
"as",
"a",
"String",
"using",
"the",
"default",
"character",
"encoding",
".",
"This",
"method",
"uses",
"{",
"@link",
"#get",
"()",
"}",
"to",
"retrieve",
"the",
"contents",
"of",
"the",
"file",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/inmemory/MemoryFileItem.java#L203-L214 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/MithraPoolableConnectionFactory.java | MithraPoolableConnectionFactory.makeObject | @Override
public Connection makeObject(ObjectPoolWithThreadAffinity<Connection> pool) throws Exception
{
Connection conn = connectionFactory.createConnection();
return new PooledConnection(conn, pool, this.statementsToPool);
} | java | @Override
public Connection makeObject(ObjectPoolWithThreadAffinity<Connection> pool) throws Exception
{
Connection conn = connectionFactory.createConnection();
return new PooledConnection(conn, pool, this.statementsToPool);
} | [
"@",
"Override",
"public",
"Connection",
"makeObject",
"(",
"ObjectPoolWithThreadAffinity",
"<",
"Connection",
">",
"pool",
")",
"throws",
"Exception",
"{",
"Connection",
"conn",
"=",
"connectionFactory",
".",
"createConnection",
"(",
")",
";",
"return",
"new",
"P... | overriding to remove synchronized. We never mutate any state that affects this method | [
"overriding",
"to",
"remove",
"synchronized",
".",
"We",
"never",
"mutate",
"any",
"state",
"that",
"affects",
"this",
"method"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/MithraPoolableConnectionFactory.java#L41-L46 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisUtil.java | CmsCmisUtil.addPropertyId | public static void addPropertyId(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
String value) {
if (!checkAddProperty(typeManager, props, typeId, filter, id)) {
return;
}
PropertyIdImpl result = new PropertyIdImpl(id, value);
result.setQueryName(id);
props.addProperty(result);
} | java | public static void addPropertyId(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
String value) {
if (!checkAddProperty(typeManager, props, typeId, filter, id)) {
return;
}
PropertyIdImpl result = new PropertyIdImpl(id, value);
result.setQueryName(id);
props.addProperty(result);
} | [
"public",
"static",
"void",
"addPropertyId",
"(",
"CmsCmisTypeManager",
"typeManager",
",",
"PropertiesImpl",
"props",
",",
"String",
"typeId",
",",
"Set",
"<",
"String",
">",
"filter",
",",
"String",
"id",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
... | Helper method for adding an id-valued property.<p>
@param typeManager the type manager
@param props the properties to add to
@param typeId the type id
@param filter the property filter
@param id the property id
@param value the property value | [
"Helper",
"method",
"for",
"adding",
"an",
"id",
"-",
"valued",
"property",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L273-L288 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java | PipelineBuilder.addOrExpression | public void addOrExpression(final INodeReadTrx mTransaction) {
assert getPipeStack().size() >= 2;
final AbsAxis mOperand2 = getPipeStack().pop().getExpr();
final AbsAxis mOperand1 = getPipeStack().pop().getExpr();
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(new OrExpr(mTransaction, mOperand1, mOperand2));
} | java | public void addOrExpression(final INodeReadTrx mTransaction) {
assert getPipeStack().size() >= 2;
final AbsAxis mOperand2 = getPipeStack().pop().getExpr();
final AbsAxis mOperand1 = getPipeStack().pop().getExpr();
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(new OrExpr(mTransaction, mOperand1, mOperand2));
} | [
"public",
"void",
"addOrExpression",
"(",
"final",
"INodeReadTrx",
"mTransaction",
")",
"{",
"assert",
"getPipeStack",
"(",
")",
".",
"size",
"(",
")",
">=",
"2",
";",
"final",
"AbsAxis",
"mOperand2",
"=",
"getPipeStack",
"(",
")",
".",
"pop",
"(",
")",
... | Adds a or expression to the pipeline.
@param mTransaction
Transaction to operate with. | [
"Adds",
"a",
"or",
"expression",
"to",
"the",
"pipeline",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L437-L448 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/CollectionUtilities.java | CollectionUtilities.getSortOrder | public static <T extends Comparable<? super T>> Integer getSortOrder(final T first, final T second) {
if (first == null && second == null) return null;
if (first == null && second != null) return -1;
if (first != null && second == null) return 1;
return first.compareTo(second);
} | java | public static <T extends Comparable<? super T>> Integer getSortOrder(final T first, final T second) {
if (first == null && second == null) return null;
if (first == null && second != null) return -1;
if (first != null && second == null) return 1;
return first.compareTo(second);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"Integer",
"getSortOrder",
"(",
"final",
"T",
"first",
",",
"final",
"T",
"second",
")",
"{",
"if",
"(",
"first",
"==",
"null",
"&&",
"second",
"==",
"null",
")"... | Provides an easy way to compare two possibly null comparable objects
@param first The first object to compare
@param second The second object to compare
@return < 0 if the first object is less than the second object, 0 if they are equal, and > 0 otherwise | [
"Provides",
"an",
"easy",
"way",
"to",
"compare",
"two",
"possibly",
"null",
"comparable",
"objects"
] | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/CollectionUtilities.java#L163-L171 |
khmarbaise/sapm | src/main/java/com/soebes/subversion/sapm/AccessRule.java | AccessRule.getAccess | public AccessLevel getAccess(User user, String repository, String path) {
return getAccess(user.getName(), repository, path);
} | java | public AccessLevel getAccess(User user, String repository, String path) {
return getAccess(user.getName(), repository, path);
} | [
"public",
"AccessLevel",
"getAccess",
"(",
"User",
"user",
",",
"String",
"repository",
",",
"String",
"path",
")",
"{",
"return",
"getAccess",
"(",
"user",
".",
"getName",
"(",
")",
",",
"repository",
",",
"path",
")",
";",
"}"
] | Convenience method if you have a {@link User} object instead of user name as a string.
@param user The user for which you like to know the access level.
@param repository The repository which will be checked for.
@param path The path within the repository.
@return The AccessLevel which represents the permission for the given user in
the repository and the given path. | [
"Convenience",
"method",
"if",
"you",
"have",
"a",
"{"
] | train | https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/AccessRule.java#L190-L192 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/slider/SliderRenderer.java | SliderRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Slider slider = (Slider) component;
ResponseWriter rw = context.getResponseWriter();
encodeHTML(slider, context, rw);
Tooltip.activateTooltips(context, slider);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Slider slider = (Slider) component;
ResponseWriter rw = context.getResponseWriter();
encodeHTML(slider, context, rw);
Tooltip.activateTooltips(context, slider);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Slider",
"slider",
... | This methods generates the HTML code of the current b:slider.
@param context
the FacesContext.
@param component
the current b:slider.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"slider",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider/SliderRenderer.java#L81-L91 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/AttributesImplSerializer.java | AttributesImplSerializer.getIndex | public final int getIndex(String uri, String localName)
{
int index;
if (super.getLength() < MAX)
{
// if we haven't got too many attributes let the
// super class look it up
index = super.getIndex(uri,localName);
return index;
}
// we have too many attributes and the super class is slow
// so find it quickly using our Hashtable.
// Form the key of format "{uri}localName"
m_buff.setLength(0);
m_buff.append('{').append(uri).append('}').append(localName);
String key = m_buff.toString();
Integer i = (Integer)m_indexFromQName.get(key);
if (i == null)
index = -1;
else
index = i.intValue();
return index;
} | java | public final int getIndex(String uri, String localName)
{
int index;
if (super.getLength() < MAX)
{
// if we haven't got too many attributes let the
// super class look it up
index = super.getIndex(uri,localName);
return index;
}
// we have too many attributes and the super class is slow
// so find it quickly using our Hashtable.
// Form the key of format "{uri}localName"
m_buff.setLength(0);
m_buff.append('{').append(uri).append('}').append(localName);
String key = m_buff.toString();
Integer i = (Integer)m_indexFromQName.get(key);
if (i == null)
index = -1;
else
index = i.intValue();
return index;
} | [
"public",
"final",
"int",
"getIndex",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"int",
"index",
";",
"if",
"(",
"super",
".",
"getLength",
"(",
")",
"<",
"MAX",
")",
"{",
"// if we haven't got too many attributes let the",
"// super class look ... | This method gets the index of an attribute given its uri and locanName.
@param uri the URI of the attribute name.
@param localName the local namer (after the ':' ) of the attribute name.
@return the integer index of the attribute.
@see org.xml.sax.Attributes#getIndex(String) | [
"This",
"method",
"gets",
"the",
"index",
"of",
"an",
"attribute",
"given",
"its",
"uri",
"and",
"locanName",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/AttributesImplSerializer.java#L213-L236 |
akarnokd/akarnokd-xml | src/main/java/hu/akarnokd/xml/XNSerializables.java | XNSerializables.parseItem | public static <T extends XNSerializable> T parseItem(XNElement item, Supplier<T> creator) {
T result = creator.get();
result.load(item);
return result;
} | java | public static <T extends XNSerializable> T parseItem(XNElement item, Supplier<T> creator) {
T result = creator.get();
result.load(item);
return result;
} | [
"public",
"static",
"<",
"T",
"extends",
"XNSerializable",
">",
"T",
"parseItem",
"(",
"XNElement",
"item",
",",
"Supplier",
"<",
"T",
">",
"creator",
")",
"{",
"T",
"result",
"=",
"creator",
".",
"get",
"(",
")",
";",
"result",
".",
"load",
"(",
"it... | Create an XNSerializable object through the {@code creator} function
and load it from the {@code item}.
@param <T> the XNSerializable object
@param item the item to load from
@param creator the function to create Ts
@return the created and loaded object | [
"Create",
"an",
"XNSerializable",
"object",
"through",
"the",
"{"
] | train | https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNSerializables.java#L80-L84 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Database.java | Database.withParameters | public Database withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | java | public Database withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"Database",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
These key-value pairs define parameters and properties of the database.
</p>
@param parameters
These key-value pairs define parameters and properties of the database.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"These",
"key",
"-",
"value",
"pairs",
"define",
"parameters",
"and",
"properties",
"of",
"the",
"database",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Database.java#L218-L221 |
samskivert/samskivert | src/main/java/com/samskivert/swing/ScrollBox.java | ScrollBox.paintBox | protected void paintBox (Graphics g, Rectangle box)
{
// just draw the box in our foreground color
g.setColor(getForeground());
g.drawRect(box.x, box.y, box.width, box.height);
} | java | protected void paintBox (Graphics g, Rectangle box)
{
// just draw the box in our foreground color
g.setColor(getForeground());
g.drawRect(box.x, box.y, box.width, box.height);
} | [
"protected",
"void",
"paintBox",
"(",
"Graphics",
"g",
",",
"Rectangle",
"box",
")",
"{",
"// just draw the box in our foreground color",
"g",
".",
"setColor",
"(",
"getForeground",
"(",
")",
")",
";",
"g",
".",
"drawRect",
"(",
"box",
".",
"x",
",",
"box",
... | Paint the box that represents the visible area of the two-dimensional
scrolling area. | [
"Paint",
"the",
"box",
"that",
"represents",
"the",
"visible",
"area",
"of",
"the",
"two",
"-",
"dimensional",
"scrolling",
"area",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/ScrollBox.java#L100-L105 |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java | VForDefinition.initLoopVariable | private void initLoopVariable(String type, String name, TemplateParserContext context) {
this.loopVariableInfo =
context.addLocalVariable(context.getFullyQualifiedNameForClassName(type.trim()),
name.trim());
} | java | private void initLoopVariable(String type, String name, TemplateParserContext context) {
this.loopVariableInfo =
context.addLocalVariable(context.getFullyQualifiedNameForClassName(type.trim()),
name.trim());
} | [
"private",
"void",
"initLoopVariable",
"(",
"String",
"type",
",",
"String",
"name",
",",
"TemplateParserContext",
"context",
")",
"{",
"this",
".",
"loopVariableInfo",
"=",
"context",
".",
"addLocalVariable",
"(",
"context",
".",
"getFullyQualifiedNameForClassName",
... | Init the loop variable and add it to the parser context
@param type Java type of the variable, will look for qualified class name in the context
@param name Name of the variable
@param context Context of the template parser | [
"Init",
"the",
"loop",
"variable",
"and",
"add",
"it",
"to",
"the",
"parser",
"context"
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L157-L161 |
naver/android-utilset | UtilSet/src/com/navercorp/utilset/ui/PixelUtils.java | PixelUtils.getDpFromPixel | public static int getDpFromPixel(Context context, int pixel) {
float scale = context.getResources().getDisplayMetrics().density; // get display density
return (int)(pixel / scale);
} | java | public static int getDpFromPixel(Context context, int pixel) {
float scale = context.getResources().getDisplayMetrics().density; // get display density
return (int)(pixel / scale);
} | [
"public",
"static",
"int",
"getDpFromPixel",
"(",
"Context",
"context",
",",
"int",
"pixel",
")",
"{",
"float",
"scale",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
".",
"density",
";",
"// get display density",
"return",... | Converts Pixel to DP<br>
@param pixel Pixel
@return DP
@see <a href="http://developer.android.com/guide/practices/screens_support.html#dips-pels">http://developer.android.com/guide/practices/screens_support.html#dips-pels</a> | [
"Converts",
"Pixel",
"to",
"DP<br",
">"
] | train | https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/ui/PixelUtils.java#L24-L28 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/util/Reflection.java | Reflection.methodHandle | public static MethodHandle methodHandle(StandardErrorCode errorCode, Method method)
{
try {
return MethodHandles.lookup().unreflect(method);
}
catch (IllegalAccessException e) {
throw new PrestoException(errorCode, e);
}
} | java | public static MethodHandle methodHandle(StandardErrorCode errorCode, Method method)
{
try {
return MethodHandles.lookup().unreflect(method);
}
catch (IllegalAccessException e) {
throw new PrestoException(errorCode, e);
}
} | [
"public",
"static",
"MethodHandle",
"methodHandle",
"(",
"StandardErrorCode",
"errorCode",
",",
"Method",
"method",
")",
"{",
"try",
"{",
"return",
"MethodHandles",
".",
"lookup",
"(",
")",
".",
"unreflect",
"(",
"method",
")",
";",
"}",
"catch",
"(",
"Illeg... | Returns a MethodHandle corresponding to the specified method.
<p>
Warning: The way Oracle JVM implements producing MethodHandle for a method involves creating
JNI global weak references. G1 processes such references serially. As a result, calling this
method in a tight loop can create significant GC pressure and significantly increase
application pause time. | [
"Returns",
"a",
"MethodHandle",
"corresponding",
"to",
"the",
"specified",
"method",
".",
"<p",
">",
"Warning",
":",
"The",
"way",
"Oracle",
"JVM",
"implements",
"producing",
"MethodHandle",
"for",
"a",
"method",
"involves",
"creating",
"JNI",
"global",
"weak",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/Reflection.java#L77-L85 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/base/BaseConstraint.java | BaseConstraint.getValue | protected final String getValue(final String key, final FieldCase ca) throws IdNotFoundException {
ConstraintFactory f = generator.getConstraintFactory();
String value = f.getModel(key).initValues(ca);
if (value == null) {
return "";
}
return value;
} | java | protected final String getValue(final String key, final FieldCase ca) throws IdNotFoundException {
ConstraintFactory f = generator.getConstraintFactory();
String value = f.getModel(key).initValues(ca);
if (value == null) {
return "";
}
return value;
} | [
"protected",
"final",
"String",
"getValue",
"(",
"final",
"String",
"key",
",",
"final",
"FieldCase",
"ca",
")",
"throws",
"IdNotFoundException",
"{",
"ConstraintFactory",
"f",
"=",
"generator",
".",
"getConstraintFactory",
"(",
")",
";",
"String",
"value",
"=",... | Method searches the constraint for the given key, initializes it with the passed FieldCase
and returns this value.
@return return the value of the constrain for the passed key. If the value is {@code null}
return an empty string | [
"Method",
"searches",
"the",
"constraint",
"for",
"the",
"given",
"key",
"initializes",
"it",
"with",
"the",
"passed",
"FieldCase",
"and",
"returns",
"this",
"value",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/base/BaseConstraint.java#L222-L229 |
infinispan/infinispan | server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java | ServiceContainerHelper.findValue | public static <T> T findValue(ServiceRegistry registry, ServiceName name) {
ServiceController<T> service = findService(registry, name);
return ((service != null) && (service.getState() == State.UP)) ? service.getValue() : null;
} | java | public static <T> T findValue(ServiceRegistry registry, ServiceName name) {
ServiceController<T> service = findService(registry, name);
return ((service != null) && (service.getState() == State.UP)) ? service.getValue() : null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findValue",
"(",
"ServiceRegistry",
"registry",
",",
"ServiceName",
"name",
")",
"{",
"ServiceController",
"<",
"T",
">",
"service",
"=",
"findService",
"(",
"registry",
",",
"name",
")",
";",
"return",
"(",
"(",
... | Returns the value of the specified service, if the service exists and is started.
@param registry the service registry
@param name the service name
@return the service value, if the service exists and is started, null otherwise | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"service",
"if",
"the",
"service",
"exists",
"and",
"is",
"started",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java#L69-L72 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Animation.java | Animation.addFrame | public void addFrame(int duration, int x, int y){
if (duration == 0) {
Log.error("Invalid duration: "+duration);
throw new RuntimeException("Invalid duration: "+duration);
}
if (frames.isEmpty()) {
nextChange = (int) (duration / speed);
}
frames.add(new Frame(duration, x, y));
currentFrame = 0;
} | java | public void addFrame(int duration, int x, int y){
if (duration == 0) {
Log.error("Invalid duration: "+duration);
throw new RuntimeException("Invalid duration: "+duration);
}
if (frames.isEmpty()) {
nextChange = (int) (duration / speed);
}
frames.add(new Frame(duration, x, y));
currentFrame = 0;
} | [
"public",
"void",
"addFrame",
"(",
"int",
"duration",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"duration",
"==",
"0",
")",
"{",
"Log",
".",
"error",
"(",
"\"Invalid duration: \"",
"+",
"duration",
")",
";",
"throw",
"new",
"RuntimeExcepti... | Add animation frame to the animation.
@param duration The duration to display the frame for
@param x The x location of the frame on the <tt>SpriteSheet</tt>
@param y The y location of the frame on the <tt>spriteSheet</tt> | [
"Add",
"animation",
"frame",
"to",
"the",
"animation",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Animation.java#L185-L197 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phoneCanBeAssociable_GET | public ArrayList<OvhLinePhone> billingAccount_line_serviceName_phoneCanBeAssociable_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phoneCanBeAssociable";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhLinePhone> billingAccount_line_serviceName_phoneCanBeAssociable_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phoneCanBeAssociable";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhLinePhone",
">",
"billingAccount_line_serviceName_phoneCanBeAssociable_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line/{serviceNam... | List the phones with Sip slot available
REST: GET /telephony/{billingAccount}/line/{serviceName}/phoneCanBeAssociable
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@deprecated | [
"List",
"the",
"phones",
"with",
"Sip",
"slot",
"available"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1525-L1530 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java | MonitoringAspect.doProfilingClass | @Around(value = "execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)")
public Object doProfilingClass(ProceedingJoinPoint pjp, Monitor monitor) throws Throwable {
return doProfiling(pjp, monitor.producerId(), monitor.subsystem(), monitor.category());
} | java | @Around(value = "execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)")
public Object doProfilingClass(ProceedingJoinPoint pjp, Monitor monitor) throws Throwable {
return doProfiling(pjp, monitor.producerId(), monitor.subsystem(), monitor.category());
} | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)\"",
")",
"public",
"Object",
"doProfilingClass",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"Monitor",
"monitor",
")",
"throws",
"Throwable... | Common class profiling entry-point.
@param pjp
{@link ProceedingJoinPoint}
@param monitor
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()} | [
"Common",
"class",
"profiling",
"entry",
"-",
"point",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L52-L55 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/pbx/internal/core/CoherentManagerConnection.java | CoherentManagerConnection.sendAction | public static ManagerResponse sendAction(final ManagerAction action, final int timeout)
throws IllegalArgumentException, IllegalStateException, IOException, TimeoutException
{
if (logger.isDebugEnabled())
CoherentManagerConnection.logger.debug("Sending Action: " + action.toString()); //$NON-NLS-1$
CoherentManagerConnection.getInstance();
if ((CoherentManagerConnection.managerConnection != null)
&& (CoherentManagerConnection.managerConnection.getState() == ManagerConnectionState.CONNECTED))
{
final org.asteriskjava.manager.action.ManagerAction ajAction = action.getAJAction();
org.asteriskjava.manager.response.ManagerResponse response = CoherentManagerConnection.managerConnection
.sendAction(ajAction, timeout);
ManagerResponse convertedResponse = null;
// UserEventActions always return a null
if (response != null)
convertedResponse = CoherentEventFactory.build(response);
if ((convertedResponse != null) && (convertedResponse.getResponse().compareToIgnoreCase("Error") == 0))//$NON-NLS-1$
{
CoherentManagerConnection.logger.warn("Action '" + ajAction + "' failed, Response: " //$NON-NLS-1$ //$NON-NLS-2$
+ convertedResponse.getResponse() + " Message: " + convertedResponse.getMessage()); //$NON-NLS-1$
}
return convertedResponse;
}
throw new IllegalStateException("not connected."); //$NON-NLS-1$
} | java | public static ManagerResponse sendAction(final ManagerAction action, final int timeout)
throws IllegalArgumentException, IllegalStateException, IOException, TimeoutException
{
if (logger.isDebugEnabled())
CoherentManagerConnection.logger.debug("Sending Action: " + action.toString()); //$NON-NLS-1$
CoherentManagerConnection.getInstance();
if ((CoherentManagerConnection.managerConnection != null)
&& (CoherentManagerConnection.managerConnection.getState() == ManagerConnectionState.CONNECTED))
{
final org.asteriskjava.manager.action.ManagerAction ajAction = action.getAJAction();
org.asteriskjava.manager.response.ManagerResponse response = CoherentManagerConnection.managerConnection
.sendAction(ajAction, timeout);
ManagerResponse convertedResponse = null;
// UserEventActions always return a null
if (response != null)
convertedResponse = CoherentEventFactory.build(response);
if ((convertedResponse != null) && (convertedResponse.getResponse().compareToIgnoreCase("Error") == 0))//$NON-NLS-1$
{
CoherentManagerConnection.logger.warn("Action '" + ajAction + "' failed, Response: " //$NON-NLS-1$ //$NON-NLS-2$
+ convertedResponse.getResponse() + " Message: " + convertedResponse.getMessage()); //$NON-NLS-1$
}
return convertedResponse;
}
throw new IllegalStateException("not connected."); //$NON-NLS-1$
} | [
"public",
"static",
"ManagerResponse",
"sendAction",
"(",
"final",
"ManagerAction",
"action",
",",
"final",
"int",
"timeout",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalStateException",
",",
"IOException",
",",
"TimeoutException",
"{",
"if",
"(",
"logger"... | Sends an Asterisk action and waits for a ManagerRespose.
@param action
@param timeout timeout in milliseconds
@return
@throws IllegalArgumentException
@throws IllegalStateException
@throws IOException
@throws TimeoutException
@throws OperationNotSupportedException | [
"Sends",
"an",
"Asterisk",
"action",
"and",
"waits",
"for",
"a",
"ManagerRespose",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/pbx/internal/core/CoherentManagerConnection.java#L327-L356 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.signParams | public static String signParams(SymmetricCrypto crypto, Map<?, ?> params) {
return signParams(crypto, params, StrUtil.EMPTY, StrUtil.EMPTY, true);
} | java | public static String signParams(SymmetricCrypto crypto, Map<?, ?> params) {
return signParams(crypto, params, StrUtil.EMPTY, StrUtil.EMPTY, true);
} | [
"public",
"static",
"String",
"signParams",
"(",
"SymmetricCrypto",
"crypto",
",",
"Map",
"<",
"?",
",",
"?",
">",
"params",
")",
"{",
"return",
"signParams",
"(",
"crypto",
",",
"params",
",",
"StrUtil",
".",
"EMPTY",
",",
"StrUtil",
".",
"EMPTY",
",",
... | 对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br>
拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值
@param crypto 对称加密算法
@param params 参数
@return 签名
@since 4.0.1 | [
"对参数做签名<br",
">",
"参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br",
">",
"拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L831-L833 |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Util.java | Util.autoMap | static <T> ResultSetMapper<T> autoMap(final Class<T> cls) {
return new ResultSetMapper<T>() {
@Override
public T call(ResultSet rs) {
return autoMap(rs, cls);
}
};
} | java | static <T> ResultSetMapper<T> autoMap(final Class<T> cls) {
return new ResultSetMapper<T>() {
@Override
public T call(ResultSet rs) {
return autoMap(rs, cls);
}
};
} | [
"static",
"<",
"T",
">",
"ResultSetMapper",
"<",
"T",
">",
"autoMap",
"(",
"final",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"return",
"new",
"ResultSetMapper",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T",
"call",
"(",
"ResultSet",
... | Returns a function that converts the ResultSet column values into
parameters to the constructor (with number of parameters equals the
number of columns) of type <code>cls</code> then returns an instance of
type <code>cls</code>. See {@link Builder#autoMap(Class)}.
@param cls
@return | [
"Returns",
"a",
"function",
"that",
"converts",
"the",
"ResultSet",
"column",
"values",
"into",
"parameters",
"to",
"the",
"constructor",
"(",
"with",
"number",
"of",
"parameters",
"equals",
"the",
"number",
"of",
"columns",
")",
"of",
"type",
"<code",
">",
... | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Util.java#L256-L263 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.queueExists | public boolean queueExists(String queueName) throws JMSException {
try {
amazonSQSClient.getQueueUrl(prepareRequest(new GetQueueUrlRequest(queueName)));
return true;
} catch (QueueDoesNotExistException e) {
return false;
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | java | public boolean queueExists(String queueName) throws JMSException {
try {
amazonSQSClient.getQueueUrl(prepareRequest(new GetQueueUrlRequest(queueName)));
return true;
} catch (QueueDoesNotExistException e) {
return false;
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | [
"public",
"boolean",
"queueExists",
"(",
"String",
"queueName",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"amazonSQSClient",
".",
"getQueueUrl",
"(",
"prepareRequest",
"(",
"new",
"GetQueueUrlRequest",
"(",
"queueName",
")",
")",
")",
";",
"return",
"true"... | Check if the requested queue exists. This function calls
<code>GetQueueUrl</code> for the given queue name, returning true on
success, false if it gets <code>QueueDoesNotExistException</code>.
@param queueName
the queue to check
@return true if the queue exists, false if it doesn't.
@throws JMSException | [
"Check",
"if",
"the",
"requested",
"queue",
"exists",
".",
"This",
"function",
"calls",
"<code",
">",
"GetQueueUrl<",
"/",
"code",
">",
"for",
"the",
"given",
"queue",
"name",
"returning",
"true",
"on",
"success",
"false",
"if",
"it",
"gets",
"<code",
">",... | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L218-L227 |
kiswanij/jk-util | src/main/java/com/jk/util/JKObjectUtil.java | JKObjectUtil.isFieldExists | public static boolean isFieldExists(Class<?> clas, String fieldName) {
Field[] fields = clas.getDeclaredFields();
for (Field field : fields) {
if (field.getName().equals(fieldName)) {
return true;
}
}
if (clas.getSuperclass() != null) {
return isFieldExists(clas.getSuperclass(), fieldName);
}
return false;
} | java | public static boolean isFieldExists(Class<?> clas, String fieldName) {
Field[] fields = clas.getDeclaredFields();
for (Field field : fields) {
if (field.getName().equals(fieldName)) {
return true;
}
}
if (clas.getSuperclass() != null) {
return isFieldExists(clas.getSuperclass(), fieldName);
}
return false;
} | [
"public",
"static",
"boolean",
"isFieldExists",
"(",
"Class",
"<",
"?",
">",
"clas",
",",
"String",
"fieldName",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"clas",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":",
"fields",
"... | Checks if is field exists.
@param clas the clas
@param fieldName the field name
@return true, if is field exists | [
"Checks",
"if",
"is",
"field",
"exists",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L829-L840 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.ifIntegersEqual | public static InsnList ifIntegersEqual(InsnList lhs, InsnList rhs, InsnList action) {
Validate.notNull(lhs);
Validate.notNull(rhs);
Validate.notNull(action);
InsnList ret = new InsnList();
LabelNode notEqualLabelNode = new LabelNode();
ret.add(lhs);
ret.add(rhs);
ret.add(new JumpInsnNode(Opcodes.IF_ICMPNE, notEqualLabelNode));
ret.add(action);
ret.add(notEqualLabelNode);
return ret;
} | java | public static InsnList ifIntegersEqual(InsnList lhs, InsnList rhs, InsnList action) {
Validate.notNull(lhs);
Validate.notNull(rhs);
Validate.notNull(action);
InsnList ret = new InsnList();
LabelNode notEqualLabelNode = new LabelNode();
ret.add(lhs);
ret.add(rhs);
ret.add(new JumpInsnNode(Opcodes.IF_ICMPNE, notEqualLabelNode));
ret.add(action);
ret.add(notEqualLabelNode);
return ret;
} | [
"public",
"static",
"InsnList",
"ifIntegersEqual",
"(",
"InsnList",
"lhs",
",",
"InsnList",
"rhs",
",",
"InsnList",
"action",
")",
"{",
"Validate",
".",
"notNull",
"(",
"lhs",
")",
";",
"Validate",
".",
"notNull",
"(",
"rhs",
")",
";",
"Validate",
".",
"... | Compares two integers and performs some action if the integers are equal.
@param lhs left hand side instruction list -- must leave an int on the stack
@param rhs right hand side instruction list -- must leave an int on the stack
@param action action to perform if results of {@code lhs} and {@code rhs} are equal
@return instructions instruction list to perform some action if two ints are equal
@throws NullPointerException if any argument is {@code null} | [
"Compares",
"two",
"integers",
"and",
"performs",
"some",
"action",
"if",
"the",
"integers",
"are",
"equal",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L621-L638 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/ThemeUtil.java | ThemeUtil.applyThemeClass | public static void applyThemeClass(BaseUIComponent component, IThemeClass... themeClasses) {
StringBuilder sb = new StringBuilder();
for (IThemeClass themeClass : themeClasses) {
String cls = themeClass == null ? null : themeClass.getThemeClass();
if (cls != null) {
sb.append(sb.length() > 0 ? " " : "").append(themeClass.getThemeClass());
}
}
component.addClass(sb.toString());
} | java | public static void applyThemeClass(BaseUIComponent component, IThemeClass... themeClasses) {
StringBuilder sb = new StringBuilder();
for (IThemeClass themeClass : themeClasses) {
String cls = themeClass == null ? null : themeClass.getThemeClass();
if (cls != null) {
sb.append(sb.length() > 0 ? " " : "").append(themeClass.getThemeClass());
}
}
component.addClass(sb.toString());
} | [
"public",
"static",
"void",
"applyThemeClass",
"(",
"BaseUIComponent",
"component",
",",
"IThemeClass",
"...",
"themeClasses",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"IThemeClass",
"themeClass",
":",
"themeClasses"... | Applies one or more theme classes to a component.
@param component Component to receive the theme classes.
@param themeClasses A list of theme classes to apply. | [
"Applies",
"one",
"or",
"more",
"theme",
"classes",
"to",
"a",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/ThemeUtil.java#L46-L58 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleClassLoader.java | JBossModuleClassLoader.createFactory | protected static ModuleClassLoaderFactory createFactory(final ScriptArchive scriptArchive) {
return new ModuleClassLoaderFactory() {
public ModuleClassLoader create(final Configuration configuration) {
return AccessController.doPrivileged(
new PrivilegedAction<JBossModuleClassLoader>() {
public JBossModuleClassLoader run() {
return new JBossModuleClassLoader(configuration, scriptArchive);
}
});
}
};
} | java | protected static ModuleClassLoaderFactory createFactory(final ScriptArchive scriptArchive) {
return new ModuleClassLoaderFactory() {
public ModuleClassLoader create(final Configuration configuration) {
return AccessController.doPrivileged(
new PrivilegedAction<JBossModuleClassLoader>() {
public JBossModuleClassLoader run() {
return new JBossModuleClassLoader(configuration, scriptArchive);
}
});
}
};
} | [
"protected",
"static",
"ModuleClassLoaderFactory",
"createFactory",
"(",
"final",
"ScriptArchive",
"scriptArchive",
")",
"{",
"return",
"new",
"ModuleClassLoaderFactory",
"(",
")",
"{",
"public",
"ModuleClassLoader",
"create",
"(",
"final",
"Configuration",
"configuration... | Creates a ModuleClassLoaderFactory that produces a {@link JBossModuleClassLoader}.
This method is necessary to inject our custom {@link ModuleClassLoader} into
the {@link ModuleSpec} | [
"Creates",
"a",
"ModuleClassLoaderFactory",
"that",
"produces",
"a",
"{"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleClassLoader.java#L63-L74 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/compress/CompressionCodecFactory.java | CompressionCodecFactory.removeSuffix | public static String removeSuffix(String filename, String suffix) {
if (filename.endsWith(suffix)) {
return filename.substring(0, filename.length() - suffix.length());
}
return filename;
} | java | public static String removeSuffix(String filename, String suffix) {
if (filename.endsWith(suffix)) {
return filename.substring(0, filename.length() - suffix.length());
}
return filename;
} | [
"public",
"static",
"String",
"removeSuffix",
"(",
"String",
"filename",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"filename",
".",
"endsWith",
"(",
"suffix",
")",
")",
"{",
"return",
"filename",
".",
"substring",
"(",
"0",
",",
"filename",
".",
"len... | Removes a suffix from a filename, if it has it.
@param filename the filename to strip
@param suffix the suffix to remove
@return the shortened filename | [
"Removes",
"a",
"suffix",
"from",
"a",
"filename",
"if",
"it",
"has",
"it",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/compress/CompressionCodecFactory.java#L195-L200 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setBaselineFixedCost | public void setBaselineFixedCost(int baselineNumber, Number value)
{
set(selectField(TaskFieldLists.BASELINE_FIXED_COSTS, baselineNumber), value);
} | java | public void setBaselineFixedCost(int baselineNumber, Number value)
{
set(selectField(TaskFieldLists.BASELINE_FIXED_COSTS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineFixedCost",
"(",
"int",
"baselineNumber",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"BASELINE_FIXED_COSTS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4504-L4507 |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java | IOUtils.writeStream | public static boolean writeStream(File file, InputStream stream) throws IOException {
return writeStream(file, stream, false);
} | java | public static boolean writeStream(File file, InputStream stream) throws IOException {
return writeStream(file, stream, false);
} | [
"public",
"static",
"boolean",
"writeStream",
"(",
"File",
"file",
",",
"InputStream",
"stream",
")",
"throws",
"IOException",
"{",
"return",
"writeStream",
"(",
"file",
",",
"stream",
",",
"false",
")",
";",
"}"
] | write file
@param file
@param stream
@return
@see {@link #writeStream(File, InputStream, boolean)} | [
"write",
"file"
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1211-L1213 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/DefaultConvolutionInstance.java | DefaultConvolutionInstance.convn | @Override
public INDArray convn(INDArray input, INDArray kernel, Convolution.Type type, int[] axes) {
throw new UnsupportedOperationException();
} | java | @Override
public INDArray convn(INDArray input, INDArray kernel, Convolution.Type type, int[] axes) {
throw new UnsupportedOperationException();
} | [
"@",
"Override",
"public",
"INDArray",
"convn",
"(",
"INDArray",
"input",
",",
"INDArray",
"kernel",
",",
"Convolution",
".",
"Type",
"type",
",",
"int",
"[",
"]",
"axes",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}"
] | ND Convolution
@param input the input to op
@param kernel the kernel to op with
@param type the opType of convolution
@param axes the axes to do the convolution along
@return the convolution of the given input and kernel | [
"ND",
"Convolution"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/DefaultConvolutionInstance.java#L37-L40 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getRewrittenResourceURI | public static String getRewrittenResourceURI( ServletContext servletContext, HttpServletRequest request,
HttpServletResponse response, String path, Map params,
String fragment, boolean forXML )
throws URISyntaxException
{
return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.RESOURCE );
} | java | public static String getRewrittenResourceURI( ServletContext servletContext, HttpServletRequest request,
HttpServletResponse response, String path, Map params,
String fragment, boolean forXML )
throws URISyntaxException
{
return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.RESOURCE );
} | [
"public",
"static",
"String",
"getRewrittenResourceURI",
"(",
"ServletContext",
"servletContext",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"path",
",",
"Map",
"params",
",",
"String",
"fragment",
",",
"boolean",
"for... | Create a fully-rewritten URI given a path and parameters.
<p> Calls the rewriter service using a type of {@link URLType#RESOURCE}. </p>
@param servletContext the current ServletContext.
@param request the current HttpServletRequest.
@param response the current HttpServletResponse.
@param path the path to process into a fully-rewritten URI.
@param params the additional parameters to include in the URI query.
@param fragment the fragment (anchor or location) for this URI.
@param forXML flag indicating that the query of the uri should be written
using the "&amp;" entity, rather than the character, '&'.
@return a fully-rewritten URI for the given action.
@throws URISyntaxException if there's a problem converting the action URI (derived
from processing the given action name) into a MutableURI. | [
"Create",
"a",
"fully",
"-",
"rewritten",
"URI",
"given",
"a",
"path",
"and",
"parameters",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1546-L1552 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java | QuatSymmetryDetector.calcLocalSymmetries | public static List<QuatSymmetryResults> calcLocalSymmetries(
List<Subunit> subunits, QuatSymmetryParameters symmParams,
SubunitClustererParameters clusterParams) {
Stoichiometry composition = SubunitClusterer.cluster(subunits, clusterParams);
return calcLocalSymmetries(composition, symmParams);
} | java | public static List<QuatSymmetryResults> calcLocalSymmetries(
List<Subunit> subunits, QuatSymmetryParameters symmParams,
SubunitClustererParameters clusterParams) {
Stoichiometry composition = SubunitClusterer.cluster(subunits, clusterParams);
return calcLocalSymmetries(composition, symmParams);
} | [
"public",
"static",
"List",
"<",
"QuatSymmetryResults",
">",
"calcLocalSymmetries",
"(",
"List",
"<",
"Subunit",
">",
"subunits",
",",
"QuatSymmetryParameters",
"symmParams",
",",
"SubunitClustererParameters",
"clusterParams",
")",
"{",
"Stoichiometry",
"composition",
"... | Returns a List of LOCAL symmetry results. This means that a subset of the
{@link SubunitCluster} is left out of the symmetry calculation. Each
element of the List is one possible LOCAL symmetry result.
<p>
Determine local symmetry if global structure is: (1) asymmetric, C1; (2)
heteromeric (belongs to more than 1 subunit cluster); (3) more than 2
subunits (heteromers with just 2 chains cannot have local symmetry)
@param subunits
list of {@link Subunit}
@param symmParams
quaternary symmetry parameters
@param clusterParams
subunit clustering parameters
@return List of LOCAL quaternary structure symmetry results. Empty if
none. | [
"Returns",
"a",
"List",
"of",
"LOCAL",
"symmetry",
"results",
".",
"This",
"means",
"that",
"a",
"subset",
"of",
"the",
"{",
"@link",
"SubunitCluster",
"}",
"is",
"left",
"out",
"of",
"the",
"symmetry",
"calculation",
".",
"Each",
"element",
"of",
"the",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java#L175-L181 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.addPseudoDestination | public final void addPseudoDestination(SIBUuid12 destinationUuid, BaseDestinationHandler handler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addPseudoDestination", new Object[] { destinationUuid, handler });
destinationIndex.addPseudoUuid(handler, destinationUuid);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addPseudoDestination");
} | java | public final void addPseudoDestination(SIBUuid12 destinationUuid, BaseDestinationHandler handler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addPseudoDestination", new Object[] { destinationUuid, handler });
destinationIndex.addPseudoUuid(handler, destinationUuid);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addPseudoDestination");
} | [
"public",
"final",
"void",
"addPseudoDestination",
"(",
"SIBUuid12",
"destinationUuid",
",",
"BaseDestinationHandler",
"handler",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr"... | Link a pseudo destination ID to a real destination handler. This is used to link destination
IDs created for remote durable pub/sub to the appropriate Pub/Sub destination handler which
hosts a localization of some durable subscription.
@param destinationUuid The pseudo destination ID to link.
@param handler The pub/sub (well BaseDestinationHandler anyway) which the destination is linked to. | [
"Link",
"a",
"pseudo",
"destination",
"ID",
"to",
"a",
"real",
"destination",
"handler",
".",
"This",
"is",
"used",
"to",
"link",
"destination",
"IDs",
"created",
"for",
"remote",
"durable",
"pub",
"/",
"sub",
"to",
"the",
"appropriate",
"Pub",
"/",
"Sub",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1638-L1645 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateSubList | public OperationStatus updateSubList(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) {
return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).toBlocking().single().body();
} | java | public OperationStatus updateSubList(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) {
return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateSubList",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"clEntityId",
",",
"int",
"subListId",
",",
"WordListBaseUpdateObject",
"wordListBaseUpdateObject",
")",
"{",
"return",
"updateSubListWithServiceResponseAsync",
"(... | Updates one of the closed list's sublists.
@param appId The application ID.
@param versionId The version ID.
@param clEntityId The closed list entity extractor ID.
@param subListId The sublist ID.
@param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"one",
"of",
"the",
"closed",
"list",
"s",
"sublists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4968-L4970 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java | TypeQualifierDatabase.setReturnValue | public void setReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) {
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc);
if (map == null) {
map = new HashMap<>();
returnValueMap.put(methodDesc, map);
}
map.put(tqv, tqa);
if (DEBUG) {
System.out.println("tqdb: " + methodDesc + " for " + tqv + " ==> " + tqa);
}
} | java | public void setReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) {
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc);
if (map == null) {
map = new HashMap<>();
returnValueMap.put(methodDesc, map);
}
map.put(tqv, tqa);
if (DEBUG) {
System.out.println("tqdb: " + methodDesc + " for " + tqv + " ==> " + tqa);
}
} | [
"public",
"void",
"setReturnValue",
"(",
"MethodDescriptor",
"methodDesc",
",",
"TypeQualifierValue",
"<",
"?",
">",
"tqv",
",",
"TypeQualifierAnnotation",
"tqa",
")",
"{",
"Map",
"<",
"TypeQualifierValue",
"<",
"?",
">",
",",
"TypeQualifierAnnotation",
">",
"map"... | Set a TypeQualifierAnnotation on a method return value.
@param methodDesc
the method
@param tqv
the type qualifier
@param tqa
the type qualifier annotation | [
"Set",
"a",
"TypeQualifierAnnotation",
"on",
"a",
"method",
"return",
"value",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java#L65-L76 |
ecclesia/kipeto | kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java | RepositoryResolver.determinateLocalIP | private String determinateLocalIP() throws IOException {
Socket socket = null;
try {
URL url = new URL(defaultRepositoryUrl);
int port = url.getPort() > -1 ? url.getPort() : url.getDefaultPort();
log.debug("Determinating local IP-Adress by connect to {}:{}", defaultRepositoryUrl, port);
InetAddress address = Inet4Address.getByName(url.getHost());
socket = new Socket();
socket.connect(new InetSocketAddress(address, port), 3000);
InputStream stream = socket.getInputStream();
InetAddress localAddress = socket.getLocalAddress();
stream.close();
String localIp = localAddress.getHostAddress();
log.info("Local IP-Adress is {}", localIp);
return localIp;
} finally {
if (socket != null) {
socket.close();
}
}
} | java | private String determinateLocalIP() throws IOException {
Socket socket = null;
try {
URL url = new URL(defaultRepositoryUrl);
int port = url.getPort() > -1 ? url.getPort() : url.getDefaultPort();
log.debug("Determinating local IP-Adress by connect to {}:{}", defaultRepositoryUrl, port);
InetAddress address = Inet4Address.getByName(url.getHost());
socket = new Socket();
socket.connect(new InetSocketAddress(address, port), 3000);
InputStream stream = socket.getInputStream();
InetAddress localAddress = socket.getLocalAddress();
stream.close();
String localIp = localAddress.getHostAddress();
log.info("Local IP-Adress is {}", localIp);
return localIp;
} finally {
if (socket != null) {
socket.close();
}
}
} | [
"private",
"String",
"determinateLocalIP",
"(",
")",
"throws",
"IOException",
"{",
"Socket",
"socket",
"=",
"null",
";",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"defaultRepositoryUrl",
")",
";",
"int",
"port",
"=",
"url",
".",
"getPort",
"(",
"... | Ermittelt anhand der Default-Repository-URL die IP-Adresse der
Netzwerkkarte, die Verbindung zum Repository hat. | [
"Ermittelt",
"anhand",
"der",
"Default",
"-",
"Repository",
"-",
"URL",
"die",
"IP",
"-",
"Adresse",
"der",
"Netzwerkkarte",
"die",
"Verbindung",
"zum",
"Repository",
"hat",
"."
] | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java#L105-L131 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java | HttpOutboundServiceContextImpl.sendRequestHeaders | @Override
public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRequestHeaders(async)");
}
if (headersSent()) {
throw new MessageSentException("Headers already sent");
}
setPartialBody(true);
getLink().setAllowReconnect(true);
setForceAsync(bForce);
setAppWriteCallback(callback);
VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef());
// Note: if forcequeue is true, then we will not get a VC object as
// the lower layer will use the callback and return null
if (null != vc && shouldReadResponseImmediately()) {
// write worked already and we need to read the response headers now
vc = startResponseRead();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRequestHeaders(async): " + vc);
}
return vc;
} | java | @Override
public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRequestHeaders(async)");
}
if (headersSent()) {
throw new MessageSentException("Headers already sent");
}
setPartialBody(true);
getLink().setAllowReconnect(true);
setForceAsync(bForce);
setAppWriteCallback(callback);
VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef());
// Note: if forcequeue is true, then we will not get a VC object as
// the lower layer will use the callback and return null
if (null != vc && shouldReadResponseImmediately()) {
// write worked already and we need to read the response headers now
vc = startResponseRead();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRequestHeaders(async): " + vc);
}
return vc;
} | [
"@",
"Override",
"public",
"VirtualConnection",
"sendRequestHeaders",
"(",
"InterChannelCallback",
"callback",
",",
"boolean",
"bForce",
")",
"throws",
"MessageSentException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"... | Send the headers for the outgoing request asynchronously.
If the write can be done immediately, the VirtualConnection will be
returned and the callback will not be used. The caller is responsible
for handling that situation in their code. A null return code means
that the async write is in progress.
The boolean bForce parameter allows the caller to force the asynchronous
action even if it could be handled immediately. The return
code will always be null and the callback always used.
@param callback
@param bForce
@return VirtualConnection
@throws MessageSentException
-- if the headers have already been sent | [
"Send",
"the",
"headers",
"for",
"the",
"outgoing",
"request",
"asynchronously",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L923-L947 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.load | public <E> E load(Class<E> entityClass, DatastoreKey key) {
return fetch(entityClass, key.nativeKey());
} | java | public <E> E load(Class<E> entityClass, DatastoreKey key) {
return fetch(entityClass, key.nativeKey());
} | [
"public",
"<",
"E",
">",
"E",
"load",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"DatastoreKey",
"key",
")",
"{",
"return",
"fetch",
"(",
"entityClass",
",",
"key",
".",
"nativeKey",
"(",
")",
")",
";",
"}"
] | Retrieves and returns the entity with the given key.
@param entityClass
the expected result type
@param key
the entity key
@return the entity with the given key, or <code>null</code>, if no entity exists with the given
key.
@throws EntityManagerException
if any error occurs while accessing the Datastore. | [
"Retrieves",
"and",
"returns",
"the",
"entity",
"with",
"the",
"given",
"key",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L191-L193 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java | Sphere3d.set | @Override
public void set(Point3D center, double radius1) {
this.cxProperty.set(center.getX());
this.cyProperty.set(center.getY());
this.czProperty.set(center.getZ());
this.radiusProperty.set(Math.abs(radius1));
} | java | @Override
public void set(Point3D center, double radius1) {
this.cxProperty.set(center.getX());
this.cyProperty.set(center.getY());
this.czProperty.set(center.getZ());
this.radiusProperty.set(Math.abs(radius1));
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"Point3D",
"center",
",",
"double",
"radius1",
")",
"{",
"this",
".",
"cxProperty",
".",
"set",
"(",
"center",
".",
"getX",
"(",
")",
")",
";",
"this",
".",
"cyProperty",
".",
"set",
"(",
"center",
".",
... | Change the frame of the sphere.
@param center
@param radius1 | [
"Change",
"the",
"frame",
"of",
"the",
"sphere",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java#L132-L138 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsCreateModeSelectionDialog.java | CmsCreateModeSelectionDialog.showDialog | public static void showDialog(final CmsUUID referenceId, final AsyncCallback<String> createModeCallback) {
CmsRpcAction<CmsListInfoBean> action = new CmsRpcAction<CmsListInfoBean>() {
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getVfsService().getPageInfo(referenceId, this);
}
@Override
protected void onResponse(CmsListInfoBean result) {
stop(false);
Boolean isFolder = result.getIsFolder();
if ((isFolder != null) && isFolder.booleanValue()) {
createModeCallback.onSuccess(null);
} else {
(new CmsCreateModeSelectionDialog(result, createModeCallback)).center();
}
}
};
action.execute();
} | java | public static void showDialog(final CmsUUID referenceId, final AsyncCallback<String> createModeCallback) {
CmsRpcAction<CmsListInfoBean> action = new CmsRpcAction<CmsListInfoBean>() {
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getVfsService().getPageInfo(referenceId, this);
}
@Override
protected void onResponse(CmsListInfoBean result) {
stop(false);
Boolean isFolder = result.getIsFolder();
if ((isFolder != null) && isFolder.booleanValue()) {
createModeCallback.onSuccess(null);
} else {
(new CmsCreateModeSelectionDialog(result, createModeCallback)).center();
}
}
};
action.execute();
} | [
"public",
"static",
"void",
"showDialog",
"(",
"final",
"CmsUUID",
"referenceId",
",",
"final",
"AsyncCallback",
"<",
"String",
">",
"createModeCallback",
")",
"{",
"CmsRpcAction",
"<",
"CmsListInfoBean",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"CmsListInf... | Shows the dialog for the given collector list entry.<p>
@param referenceId the structure id of the collector list entry
@param createModeCallback the callback which should be called with the selected create mode | [
"Shows",
"the",
"dialog",
"for",
"the",
"given",
"collector",
"list",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsCreateModeSelectionDialog.java#L88-L115 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java | PolicyBasedAuthenticationManager.evaluateFinalAuthentication | protected void evaluateFinalAuthentication(final AuthenticationBuilder builder,
final AuthenticationTransaction transaction,
final Set<AuthenticationHandler> authenticationHandlers) throws AuthenticationException {
if (builder.getSuccesses().isEmpty()) {
publishEvent(new CasAuthenticationTransactionFailureEvent(this, builder.getFailures(), transaction.getCredentials()));
throw new AuthenticationException(builder.getFailures(), builder.getSuccesses());
}
val authentication = builder.build();
val failures = evaluateAuthenticationPolicies(authentication, transaction, authenticationHandlers);
if (!failures.getKey()) {
publishEvent(new CasAuthenticationPolicyFailureEvent(this, builder.getFailures(), transaction, authentication));
failures.getValue().forEach(e -> handleAuthenticationException(e, e.getClass().getSimpleName(), builder));
throw new AuthenticationException(builder.getFailures(), builder.getSuccesses());
}
} | java | protected void evaluateFinalAuthentication(final AuthenticationBuilder builder,
final AuthenticationTransaction transaction,
final Set<AuthenticationHandler> authenticationHandlers) throws AuthenticationException {
if (builder.getSuccesses().isEmpty()) {
publishEvent(new CasAuthenticationTransactionFailureEvent(this, builder.getFailures(), transaction.getCredentials()));
throw new AuthenticationException(builder.getFailures(), builder.getSuccesses());
}
val authentication = builder.build();
val failures = evaluateAuthenticationPolicies(authentication, transaction, authenticationHandlers);
if (!failures.getKey()) {
publishEvent(new CasAuthenticationPolicyFailureEvent(this, builder.getFailures(), transaction, authentication));
failures.getValue().forEach(e -> handleAuthenticationException(e, e.getClass().getSimpleName(), builder));
throw new AuthenticationException(builder.getFailures(), builder.getSuccesses());
}
} | [
"protected",
"void",
"evaluateFinalAuthentication",
"(",
"final",
"AuthenticationBuilder",
"builder",
",",
"final",
"AuthenticationTransaction",
"transaction",
",",
"final",
"Set",
"<",
"AuthenticationHandler",
">",
"authenticationHandlers",
")",
"throws",
"AuthenticationExce... | Evaluate produced authentication context.
We apply an implicit security policy of at least one successful authentication.
Then, we apply the configured security policy.
@param builder the builder
@param transaction the transaction
@param authenticationHandlers the authentication handlers
@throws AuthenticationException the authentication exception | [
"Evaluate",
"produced",
"authentication",
"context",
".",
"We",
"apply",
"an",
"implicit",
"security",
"policy",
"of",
"at",
"least",
"one",
"successful",
"authentication",
".",
"Then",
"we",
"apply",
"the",
"configured",
"security",
"policy",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java#L345-L360 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/struct/SimpleBloomFilter.java | SimpleBloomFilter.computeRequiredNumberOfBits | protected static int computeRequiredNumberOfBits(double approximateNumberOfElements, double acceptableFalsePositiveRate) {
double numberOfBits = Math.abs((approximateNumberOfElements * Math.log(acceptableFalsePositiveRate))
/ Math.pow(Math.log(2.0d), 2.0d));
return Double.valueOf(Math.ceil(numberOfBits)).intValue();
} | java | protected static int computeRequiredNumberOfBits(double approximateNumberOfElements, double acceptableFalsePositiveRate) {
double numberOfBits = Math.abs((approximateNumberOfElements * Math.log(acceptableFalsePositiveRate))
/ Math.pow(Math.log(2.0d), 2.0d));
return Double.valueOf(Math.ceil(numberOfBits)).intValue();
} | [
"protected",
"static",
"int",
"computeRequiredNumberOfBits",
"(",
"double",
"approximateNumberOfElements",
",",
"double",
"acceptableFalsePositiveRate",
")",
"{",
"double",
"numberOfBits",
"=",
"Math",
".",
"abs",
"(",
"(",
"approximateNumberOfElements",
"*",
"Math",
".... | Computes the required number of bits needed by the Bloom Filter as a factor of the approximate number of elements
to be added to the filter along with the desired, acceptable false positive rate (probability).
m = n * (log p) / (log 2) ^ 2
m is the required number of bits needed for the Bloom Filter.
n is the approximate number of elements to be added to the bloom filter
p is the acceptable false positive rate between 0.0 and 1.0 exclusive
@param approximateNumberOfElements integer value indicating the approximate, estimated number of elements
the user expects will be added to the Bloom Filter.
@param acceptableFalsePositiveRate a floating point value indicating the acceptable percentage of false positives
returned by the Bloom Filter.
@return the required number of bits needed by the Bloom Filter. | [
"Computes",
"the",
"required",
"number",
"of",
"bits",
"needed",
"by",
"the",
"Bloom",
"Filter",
"as",
"a",
"factor",
"of",
"the",
"approximate",
"number",
"of",
"elements",
"to",
"be",
"added",
"to",
"the",
"filter",
"along",
"with",
"the",
"desired",
"ac... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/struct/SimpleBloomFilter.java#L185-L191 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/FaxJobMonitorImpl.java | FaxJobMonitorImpl.monitorFaxJobImpl | @Override
public void monitorFaxJobImpl(FaxClientSpi faxClientSpi,FaxJob faxJob)
{
//get fax job status
FaxJobStatus faxJobStatus=faxClientSpi.getFaxJobStatus(faxJob);
if(faxJobStatus==null)
{
throw new FaxException("Unable to extract fax job status for fax job: "+faxJob.getID());
}
synchronized(this.LOCK)
{
Map<FaxJob,FaxJobStatus> faxJobMap=this.data.get(faxClientSpi);
if(faxJobMap==null)
{
faxJobMap=new HashMap<FaxJob,FaxJobStatus>(500);
this.data.put(faxClientSpi,faxJobMap);
}
//add new fax job
faxJobMap.put(faxJob,faxJobStatus);
if(!this.pollerTask.isRunning())
{
this.pollerTask.startTask();
}
}
} | java | @Override
public void monitorFaxJobImpl(FaxClientSpi faxClientSpi,FaxJob faxJob)
{
//get fax job status
FaxJobStatus faxJobStatus=faxClientSpi.getFaxJobStatus(faxJob);
if(faxJobStatus==null)
{
throw new FaxException("Unable to extract fax job status for fax job: "+faxJob.getID());
}
synchronized(this.LOCK)
{
Map<FaxJob,FaxJobStatus> faxJobMap=this.data.get(faxClientSpi);
if(faxJobMap==null)
{
faxJobMap=new HashMap<FaxJob,FaxJobStatus>(500);
this.data.put(faxClientSpi,faxJobMap);
}
//add new fax job
faxJobMap.put(faxJob,faxJobStatus);
if(!this.pollerTask.isRunning())
{
this.pollerTask.startTask();
}
}
} | [
"@",
"Override",
"public",
"void",
"monitorFaxJobImpl",
"(",
"FaxClientSpi",
"faxClientSpi",
",",
"FaxJob",
"faxJob",
")",
"{",
"//get fax job status",
"FaxJobStatus",
"faxJobStatus",
"=",
"faxClientSpi",
".",
"getFaxJobStatus",
"(",
"faxJob",
")",
";",
"if",
"(",
... | This function starts monitoring the requested fax job.
@param faxClientSpi
The fax client SPI
@param faxJob
The fax job to monitor | [
"This",
"function",
"starts",
"monitoring",
"the",
"requested",
"fax",
"job",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/FaxJobMonitorImpl.java#L101-L128 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/concurrency/WorkQueue.java | WorkQueue.startWorkers | private void startWorkers(final ExecutorService executorService, final int numTasks) {
for (int i = 0; i < numTasks; i++) {
workerFutures.add(executorService.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
runWorkLoop();
return null;
}
}));
}
} | java | private void startWorkers(final ExecutorService executorService, final int numTasks) {
for (int i = 0; i < numTasks; i++) {
workerFutures.add(executorService.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
runWorkLoop();
return null;
}
}));
}
} | [
"private",
"void",
"startWorkers",
"(",
"final",
"ExecutorService",
"executorService",
",",
"final",
"int",
"numTasks",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numTasks",
";",
"i",
"++",
")",
"{",
"workerFutures",
".",
"add",
"(",
"... | Start worker threads with a shared log.
@param executorService
the executor service
@param numTasks
the number of worker tasks to start | [
"Start",
"worker",
"threads",
"with",
"a",
"shared",
"log",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/concurrency/WorkQueue.java#L196-L206 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.sqldatabase | public static void sqldatabase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
zeroArgumentFunctionCall(buf, "current_database()", "database", parsedArgs);
} | java | public static void sqldatabase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
zeroArgumentFunctionCall(buf, "current_database()", "database", parsedArgs);
} | [
"public",
"static",
"void",
"sqldatabase",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"zeroArgumentFunctionCall",
"(",
"buf",
",",
"\"current_database()\"",
",",
"\"database\"... | database translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens | [
"database",
"translation"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L615-L617 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java | BackupLongTermRetentionPoliciesInner.beginCreateOrUpdateAsync | public Observable<BackupLongTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<BackupLongTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupLongTermRetentionPolicyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"BackupLongTermRetentionPolicyInner",
"parameters",
")",
"{",
"return",
"... | Creates or updates a database backup long term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database
@param parameters The required parameters to update a backup long term retention policy
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupLongTermRetentionPolicyInner object | [
"Creates",
"or",
"updates",
"a",
"database",
"backup",
"long",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java#L296-L303 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/SerializerIntrinsics.java | SerializerIntrinsics.mpsadbw | public final void mpsadbw(XMMRegister dst, XMMRegister src, Immediate imm8)
{
emitX86(INST_MPSADBW, dst, src, imm8);
} | java | public final void mpsadbw(XMMRegister dst, XMMRegister src, Immediate imm8)
{
emitX86(INST_MPSADBW, dst, src, imm8);
} | [
"public",
"final",
"void",
"mpsadbw",
"(",
"XMMRegister",
"dst",
",",
"XMMRegister",
"src",
",",
"Immediate",
"imm8",
")",
"{",
"emitX86",
"(",
"INST_MPSADBW",
",",
"dst",
",",
"src",
",",
"imm8",
")",
";",
"}"
] | Compute Multiple Packed Sums of Absolute Difference (SSE4.1). | [
"Compute",
"Multiple",
"Packed",
"Sums",
"of",
"Absolute",
"Difference",
"(",
"SSE4",
".",
"1",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L6061-L6064 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java | ExplicitMessageEncryptionElement.set | public static void set(Message message, ExplicitMessageEncryptionProtocol protocol) {
if (!hasProtocol(message, protocol.namespace)) {
message.addExtension(new ExplicitMessageEncryptionElement(protocol));
}
} | java | public static void set(Message message, ExplicitMessageEncryptionProtocol protocol) {
if (!hasProtocol(message, protocol.namespace)) {
message.addExtension(new ExplicitMessageEncryptionElement(protocol));
}
} | [
"public",
"static",
"void",
"set",
"(",
"Message",
"message",
",",
"ExplicitMessageEncryptionProtocol",
"protocol",
")",
"{",
"if",
"(",
"!",
"hasProtocol",
"(",
"message",
",",
"protocol",
".",
"namespace",
")",
")",
"{",
"message",
".",
"addExtension",
"(",
... | Add an EME element containing the specified {@code protocol} namespace to the message.
In case there is already an element with that protocol, we do nothing.
@param message message
@param protocol encryption protocol | [
"Add",
"an",
"EME",
"element",
"containing",
"the",
"specified",
"{",
"@code",
"protocol",
"}",
"namespace",
"to",
"the",
"message",
".",
"In",
"case",
"there",
"is",
"already",
"an",
"element",
"with",
"that",
"protocol",
"we",
"do",
"nothing",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java#L190-L194 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.setPath | 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) {
}
}
} | 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",
"=",
... | 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 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlMNStatement.java | SqlMNStatement.appendWhereClause | 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("=?");
}
} | 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",
";",
... | 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 |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.createResponse | 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);
} | 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",
"{",
"stat... | 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 |
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) {
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",... | 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 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.hasActions | @Override
public boolean hasActions(int position, SwipeDirection direction){
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 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.deleteResource | 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);
} | 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",
"(",
")",
")",
"{",
"/... | 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 |
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) {
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 |
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) {
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"... | 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 |
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) {
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",
... | 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",
... | 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 |
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) {
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$",
... | 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 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerListener.java | PaymentChannelServerListener.bindAndStart | public void bindAndStart(int port) throws Exception {
server = new NioServer(new StreamConnectionFactory() {
@Override
public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
}
}, new InetSocketAddress(port));
server.startAsync();
server.awaitRunning();
} | java | public void bindAndStart(int port) throws Exception {
server = new NioServer(new StreamConnectionFactory() {
@Override
public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
}
}, new InetSocketAddress(port));
server.startAsync();
server.awaitRunning();
} | [
"public",
"void",
"bindAndStart",
"(",
"int",
"port",
")",
"throws",
"Exception",
"{",
"server",
"=",
"new",
"NioServer",
"(",
"new",
"StreamConnectionFactory",
"(",
")",
"{",
"@",
"Override",
"public",
"ProtobufConnection",
"<",
"Protos",
".",
"TwoWayChannelMes... | Binds to the given port and starts accepting new client connections.
@throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) | [
"Binds",
"to",
"the",
"given",
"port",
"and",
"starts",
"accepting",
"new",
"client",
"connections",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerListener.java#L152-L161 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForResourceGroupAsync | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyEventsQueryResultsInner",
">",
"listQueryResultsForResourceGroupAsync",
"(",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"listQueryResultsForResourceGroupWithServiceResponseAsync",
"(",
"subscriptionId",
... | Queries policy events for the resources under the resource group.
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object | [
"Queries",
"policy",
"events",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L509-L516 |
alkacon/opencms-core | src/org/opencms/configuration/CmsVfsConfiguration.java | CmsVfsConfiguration.getFolderTranslator | public CmsResourceTranslator getFolderTranslator() {
String[] array = new String[0];
if (m_folderTranslationEnabled) {
array = new String[m_folderTranslations.size()];
for (int i = 0; i < m_folderTranslations.size(); i++) {
array[i] = m_folderTranslations.get(i);
}
}
return new CmsResourceTranslator(array, false);
} | java | public CmsResourceTranslator getFolderTranslator() {
String[] array = new String[0];
if (m_folderTranslationEnabled) {
array = new String[m_folderTranslations.size()];
for (int i = 0; i < m_folderTranslations.size(); i++) {
array[i] = m_folderTranslations.get(i);
}
}
return new CmsResourceTranslator(array, false);
} | [
"public",
"CmsResourceTranslator",
"getFolderTranslator",
"(",
")",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"0",
"]",
";",
"if",
"(",
"m_folderTranslationEnabled",
")",
"{",
"array",
"=",
"new",
"String",
"[",
"m_folderTranslations",
".",
... | Returns the folder resource translator that has been initialized
with the configured folder translation rules.<p>
@return the folder resource translator | [
"Returns",
"the",
"folder",
"resource",
"translator",
"that",
"has",
"been",
"initialized",
"with",
"the",
"configured",
"folder",
"translation",
"rules",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsVfsConfiguration.java#L826-L836 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.unfollowPlaylist | public UnfollowPlaylistRequest.Builder unfollowPlaylist(String owner_id, String playlist_id) {
return new UnfollowPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.owner_id(owner_id)
.playlist_id(playlist_id);
} | java | public UnfollowPlaylistRequest.Builder unfollowPlaylist(String owner_id, String playlist_id) {
return new UnfollowPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.owner_id(owner_id)
.playlist_id(playlist_id);
} | [
"public",
"UnfollowPlaylistRequest",
".",
"Builder",
"unfollowPlaylist",
"(",
"String",
"owner_id",
",",
"String",
"playlist_id",
")",
"{",
"return",
"new",
"UnfollowPlaylistRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManager",
"... | Remove the current user as a follower of a playlist.
@param owner_id The owners username.
@param playlist_id The playlist's ID.
@return An {@link UnfollowPlaylistRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a> | [
"Remove",
"the",
"current",
"user",
"as",
"a",
"follower",
"of",
"a",
"playlist",
"."
] | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L725-L730 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/FaultManager.java | FaultManager.addNode | public void addNode(String name, Set<ResourceType> resourceTypes) {
List<FaultStatsForType> faultStats = new ArrayList<FaultStatsForType>(
resourceTypes.size());
for (ResourceType type : resourceTypes) {
faultStats.add(new FaultStatsForType(type));
}
nodeToFaultStats.put(name, faultStats);
} | java | public void addNode(String name, Set<ResourceType> resourceTypes) {
List<FaultStatsForType> faultStats = new ArrayList<FaultStatsForType>(
resourceTypes.size());
for (ResourceType type : resourceTypes) {
faultStats.add(new FaultStatsForType(type));
}
nodeToFaultStats.put(name, faultStats);
} | [
"public",
"void",
"addNode",
"(",
"String",
"name",
",",
"Set",
"<",
"ResourceType",
">",
"resourceTypes",
")",
"{",
"List",
"<",
"FaultStatsForType",
">",
"faultStats",
"=",
"new",
"ArrayList",
"<",
"FaultStatsForType",
">",
"(",
"resourceTypes",
".",
"size",... | Notify the fault manager of a new node.
@param name The node name.
@param resourceTypes The types of resource on this node. | [
"Notify",
"the",
"fault",
"manager",
"of",
"a",
"new",
"node",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/FaultManager.java#L115-L122 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/eip/EipClient.java | EipClient.purchaseReservedEipInMonth | public void purchaseReservedEipInMonth(String eip, int reservationLength) {
Billing billing = new Billing();
billing.setReservation(new Billing.Reservation().withReservationLength(reservationLength));
this.purchaseReservedEip(new PurchaseReservedEipRequest().withEip(eip).withBilling(billing));
} | java | public void purchaseReservedEipInMonth(String eip, int reservationLength) {
Billing billing = new Billing();
billing.setReservation(new Billing.Reservation().withReservationLength(reservationLength));
this.purchaseReservedEip(new PurchaseReservedEipRequest().withEip(eip).withBilling(billing));
} | [
"public",
"void",
"purchaseReservedEipInMonth",
"(",
"String",
"eip",
",",
"int",
"reservationLength",
")",
"{",
"Billing",
"billing",
"=",
"new",
"Billing",
"(",
")",
";",
"billing",
".",
"setReservation",
"(",
"new",
"Billing",
".",
"Reservation",
"(",
")",
... | PurchaseReserved eip with specified duration in month
@param eip
@param reservationLength | [
"PurchaseReserved",
"eip",
"with",
"specified",
"duration",
"in",
"month"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/eip/EipClient.java#L153-L157 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java | NtlmPasswordAuthentication.getPreNTLMResponse | static public byte[] getPreNTLMResponse( String password, byte[] challenge ) {
byte[] p14 = new byte[14];
byte[] p21 = new byte[21];
byte[] p24 = new byte[24];
byte[] passwordBytes;
try {
passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING );
} catch( UnsupportedEncodingException uee ) {
throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee);
}
int passwordLength = passwordBytes.length;
// Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM
if( passwordLength > 14) {
passwordLength = 14;
}
System.arraycopy( passwordBytes, 0, p14, 0, passwordLength );
E( p14, S8, p21);
E( p21, challenge, p24);
return p24;
} | java | static public byte[] getPreNTLMResponse( String password, byte[] challenge ) {
byte[] p14 = new byte[14];
byte[] p21 = new byte[21];
byte[] p24 = new byte[24];
byte[] passwordBytes;
try {
passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING );
} catch( UnsupportedEncodingException uee ) {
throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee);
}
int passwordLength = passwordBytes.length;
// Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM
if( passwordLength > 14) {
passwordLength = 14;
}
System.arraycopy( passwordBytes, 0, p14, 0, passwordLength );
E( p14, S8, p21);
E( p21, challenge, p24);
return p24;
} | [
"static",
"public",
"byte",
"[",
"]",
"getPreNTLMResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
")",
"{",
"byte",
"[",
"]",
"p14",
"=",
"new",
"byte",
"[",
"14",
"]",
";",
"byte",
"[",
"]",
"p21",
"=",
"new",
"byte",
"[",... | Generate the ANSI DES hash for the password associated with these credentials. | [
"Generate",
"the",
"ANSI",
"DES",
"hash",
"for",
"the",
"password",
"associated",
"with",
"these",
"credentials",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L91-L111 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setWaveform | public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList());
} else {
cueList.set(null);
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | java | public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList());
} else {
cueList.set(null);
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | [
"public",
"void",
"setWaveform",
"(",
"WaveformDetail",
"waveform",
",",
"TrackMetadata",
"metadata",
",",
"BeatGrid",
"beatGrid",
")",
"{",
"this",
".",
"waveform",
".",
"set",
"(",
"waveform",
")",
";",
"if",
"(",
"metadata",
"!=",
"null",
")",
"{",
"cue... | Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param waveform the waveform detail to display
@param metadata information about the track whose waveform we are drawing, so we can draw cue and memory points
@param beatGrid the locations of the beats, so they can be drawn | [
"Change",
"the",
"waveform",
"preview",
"being",
"drawn",
".",
"This",
"will",
"be",
"quickly",
"overruled",
"if",
"a",
"player",
"is",
"being",
"monitored",
"but",
"can",
"be",
"used",
"in",
"other",
"contexts",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L341-L354 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/VpTree.java | VpTree.buildFromPoints | private Node buildFromPoints(int lower, int upper) {
if (upper == lower) {
return null;
}
final Node node = new Node();
node.index = lower;
if (upper - lower > 1) {
// choose an arbitrary vantage point and move it to the start
int i = random.nextInt(upper - lower - 1) + lower;
listSwap(items, lower, i);
listSwap(indexes, lower, i);
int median = (upper + lower + 1) / 2;
// partition around the median distance
// TODO: use the QuickSelect class?
nthElement(lower + 1, upper, median, items[lower]);
// what was the median?
node.threshold = distance(items[lower], items[median]);
node.index = lower;
node.left = buildFromPoints(lower + 1, median);
node.right = buildFromPoints(median, upper);
}
return node;
} | java | private Node buildFromPoints(int lower, int upper) {
if (upper == lower) {
return null;
}
final Node node = new Node();
node.index = lower;
if (upper - lower > 1) {
// choose an arbitrary vantage point and move it to the start
int i = random.nextInt(upper - lower - 1) + lower;
listSwap(items, lower, i);
listSwap(indexes, lower, i);
int median = (upper + lower + 1) / 2;
// partition around the median distance
// TODO: use the QuickSelect class?
nthElement(lower + 1, upper, median, items[lower]);
// what was the median?
node.threshold = distance(items[lower], items[median]);
node.index = lower;
node.left = buildFromPoints(lower + 1, median);
node.right = buildFromPoints(median, upper);
}
return node;
} | [
"private",
"Node",
"buildFromPoints",
"(",
"int",
"lower",
",",
"int",
"upper",
")",
"{",
"if",
"(",
"upper",
"==",
"lower",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Node",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"node",
".",
"index",
"="... | Builds the tree from a set of points by recursively partitioning
them according to a random pivot.
@param lower start of range
@param upper end of range (exclusive)
@return root of the tree or null if lower == upper | [
"Builds",
"the",
"tree",
"from",
"a",
"set",
"of",
"points",
"by",
"recursively",
"partitioning",
"them",
"according",
"to",
"a",
"random",
"pivot",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L93-L123 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkConditions | public Environment checkConditions(Tuple<Expr> conditions, boolean sign, Environment environment) {
for (Expr e : conditions) {
// Thread environment through from before
environment = checkCondition(e, sign, environment);
}
return environment;
} | java | public Environment checkConditions(Tuple<Expr> conditions, boolean sign, Environment environment) {
for (Expr e : conditions) {
// Thread environment through from before
environment = checkCondition(e, sign, environment);
}
return environment;
} | [
"public",
"Environment",
"checkConditions",
"(",
"Tuple",
"<",
"Expr",
">",
"conditions",
",",
"boolean",
"sign",
",",
"Environment",
"environment",
")",
"{",
"for",
"(",
"Expr",
"e",
":",
"conditions",
")",
"{",
"// Thread environment through from before",
"envir... | Type check a sequence of zero or more conditions, such as the requires clause
of a function or method. The environment from each condition is fed into the
following. This means that, in principle, type tests influence both
subsequent conditions and the remainder. The following illustrates:
<pre>
function f(int|null x) -> (int r)
requires x is int
requires x >= 0:
//
return x
</pre>
This type checks because of the initial type test <code>x is int</code>.
Observe that, if the order of <code>requires</code> clauses was reversed,
this would not type check. Finally, it is an interesting question as to why
the above ever make sense. In general, it's better to simply declare
<code>x</code> as type <code>int</code>. However, in some cases we may be
unable to do this (for example, to preserve binary compatibility with a
previous interface).
@param conditions
@param sign
@param environment
@return | [
"Type",
"check",
"a",
"sequence",
"of",
"zero",
"or",
"more",
"conditions",
"such",
"as",
"the",
"requires",
"clause",
"of",
"a",
"function",
"or",
"method",
".",
"The",
"environment",
"from",
"each",
"condition",
"is",
"fed",
"into",
"the",
"following",
"... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L808-L814 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.