repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toDateAdvanced | public static DateTime toDateAdvanced(String str, TimeZone timezone) throws PageException {
DateTime dt = toDateAdvanced(str, timezone, null);
if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value");
return dt;
} | java | public static DateTime toDateAdvanced(String str, TimeZone timezone) throws PageException {
DateTime dt = toDateAdvanced(str, timezone, null);
if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value");
return dt;
} | [
"public",
"static",
"DateTime",
"toDateAdvanced",
"(",
"String",
"str",
",",
"TimeZone",
"timezone",
")",
"throws",
"PageException",
"{",
"DateTime",
"dt",
"=",
"toDateAdvanced",
"(",
"str",
",",
"timezone",
",",
"null",
")",
";",
"if",
"(",
"dt",
"==",
"n... | converts a Object to a DateTime Object (Advanced but slower)
@param str String to Convert
@param timezone
@return Date Time Object
@throws PageException | [
"converts",
"a",
"Object",
"to",
"a",
"DateTime",
"Object",
"(",
"Advanced",
"but",
"slower",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L104-L108 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/PathFinder.java | PathFinder.getRelativePathTo | public static File getRelativePathTo(File parent, final List<String> folders)
{
for (final String string : folders)
{
final File nextFolder = new File(parent, string);
parent = nextFolder;
}
return parent;
} | java | public static File getRelativePathTo(File parent, final List<String> folders)
{
for (final String string : folders)
{
final File nextFolder = new File(parent, string);
parent = nextFolder;
}
return parent;
} | [
"public",
"static",
"File",
"getRelativePathTo",
"(",
"File",
"parent",
",",
"final",
"List",
"<",
"String",
">",
"folders",
")",
"{",
"for",
"(",
"final",
"String",
"string",
":",
"folders",
")",
"{",
"final",
"File",
"nextFolder",
"=",
"new",
"File",
"... | Gets the file or directory from the given parent File object and the relative path given over
the list as String objects.
@param parent
The parent directory.
@param folders
The list with the directories and optional a filename.
@return the resulted file or directory from the given arguments. | [
"Gets",
"the",
"file",
"or",
"directory",
"from",
"the",
"given",
"parent",
"File",
"object",
"and",
"the",
"relative",
"path",
"given",
"over",
"the",
"list",
"as",
"String",
"objects",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L138-L146 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.biConsumer | public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION);
} | java | public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION);
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"BiConsumer",
"<",
"T",
",",
"U",
">",
"biConsumer",
"(",
"CheckedBiConsumer",
"<",
"T",
",",
"U",
">",
"consumer",
")",
"{",
"return",
"biConsumer",
"(",
"consumer",
",",
"THROWABLE_TO_RUNTIME_EXCEPTION",
")",
... | Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}.
<p>
Example:
<code><pre>
map.forEach(Unchecked.biConsumer((k, v) -> {
if (k == null || v == null)
throw new Exception("No nulls allowed in map");
}));
</pre></code> | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L210-L212 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_binding.java | appfwpolicylabel_binding.get | public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception{
appfwpolicylabel_binding obj = new appfwpolicylabel_binding();
obj.set_labelname(labelname);
appfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service);
return response;
} | java | public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception{
appfwpolicylabel_binding obj = new appfwpolicylabel_binding();
obj.set_labelname(labelname);
appfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appfwpolicylabel_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"appfwpolicylabel_binding",
"obj",
"=",
"new",
"appfwpolicylabel_binding",
"(",
")",
";",
"obj",
".",
"set_labelname",
... | Use this API to fetch appfwpolicylabel_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwpolicylabel_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_binding.java#L114-L119 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.writeNewString | private int writeNewString(String object, boolean unshared) throws IOException {
long count = ModifiedUtf8.countBytes(object, false);
byte[] buffer;
int offset = 0;
if (count <= 0xffff) {
buffer = new byte[1 + SizeOf.SHORT + (int) count];
buffer[offset++] = TC_STRING;
Memory.pokeShort(buffer, offset, (short) count, ByteOrder.BIG_ENDIAN);
offset += SizeOf.SHORT;
} else {
buffer = new byte[1 + SizeOf.LONG + (int) count];
buffer[offset++] = TC_LONGSTRING;
Memory.pokeLong(buffer, offset, count, ByteOrder.BIG_ENDIAN);
offset += SizeOf.LONG;
}
ModifiedUtf8.encode(buffer, offset, object);
output.write(buffer, 0, buffer.length);
int handle = nextHandle();
if (!unshared) {
objectsWritten.put(object, handle);
}
return handle;
} | java | private int writeNewString(String object, boolean unshared) throws IOException {
long count = ModifiedUtf8.countBytes(object, false);
byte[] buffer;
int offset = 0;
if (count <= 0xffff) {
buffer = new byte[1 + SizeOf.SHORT + (int) count];
buffer[offset++] = TC_STRING;
Memory.pokeShort(buffer, offset, (short) count, ByteOrder.BIG_ENDIAN);
offset += SizeOf.SHORT;
} else {
buffer = new byte[1 + SizeOf.LONG + (int) count];
buffer[offset++] = TC_LONGSTRING;
Memory.pokeLong(buffer, offset, count, ByteOrder.BIG_ENDIAN);
offset += SizeOf.LONG;
}
ModifiedUtf8.encode(buffer, offset, object);
output.write(buffer, 0, buffer.length);
int handle = nextHandle();
if (!unshared) {
objectsWritten.put(object, handle);
}
return handle;
} | [
"private",
"int",
"writeNewString",
"(",
"String",
"object",
",",
"boolean",
"unshared",
")",
"throws",
"IOException",
"{",
"long",
"count",
"=",
"ModifiedUtf8",
".",
"countBytes",
"(",
"object",
",",
"false",
")",
";",
"byte",
"[",
"]",
"buffer",
";",
"in... | Write String {@code object} into the receiver. It is assumed the
String has not been dumped yet. Returns the handle for this object (String) which is dumped here.
Strings are saved encoded with {@link DataInput modified UTF-8}.
@param object
the string to dump.
@return the handle assigned to the String being dumped
@throws IOException
If an IO exception happened when writing the String. | [
"Write",
"String",
"{",
"@code",
"object",
"}",
"into",
"the",
"receiver",
".",
"It",
"is",
"assumed",
"the",
"String",
"has",
"not",
"been",
"dumped",
"yet",
".",
"Returns",
"the",
"handle",
"for",
"this",
"object",
"(",
"String",
")",
"which",
"is",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L1411-L1435 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/StringUtil.java | StringUtil.wrapText | public static String wrapText(final String inString, final String newline, final int wrapColumn) {
if (inString == null) {
return null;
}
final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true);
final StringBuilder builder = new StringBuilder();
while (lineTokenizer.hasMoreTokens()) {
try {
String nextLine = lineTokenizer.nextToken();
if (nextLine.length() > wrapColumn) {
// This line is long enough to be wrapped.
nextLine = wrapLine(nextLine, newline, wrapColumn);
}
builder.append(nextLine);
} catch (final NoSuchElementException nsee) {
// thrown by nextToken(), but I don't know why it would
break;
}
}
return builder.toString();
} | java | public static String wrapText(final String inString, final String newline, final int wrapColumn) {
if (inString == null) {
return null;
}
final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true);
final StringBuilder builder = new StringBuilder();
while (lineTokenizer.hasMoreTokens()) {
try {
String nextLine = lineTokenizer.nextToken();
if (nextLine.length() > wrapColumn) {
// This line is long enough to be wrapped.
nextLine = wrapLine(nextLine, newline, wrapColumn);
}
builder.append(nextLine);
} catch (final NoSuchElementException nsee) {
// thrown by nextToken(), but I don't know why it would
break;
}
}
return builder.toString();
} | [
"public",
"static",
"String",
"wrapText",
"(",
"final",
"String",
"inString",
",",
"final",
"String",
"newline",
",",
"final",
"int",
"wrapColumn",
")",
"{",
"if",
"(",
"inString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"StringTokeniz... | Takes a block of text which might have long lines in it and wraps
the long lines based on the supplied wrapColumn parameter. It was
initially implemented for use by VelocityEmail. If there are tabs
in inString, you are going to get results that are a bit strange,
since tabs are a single character but are displayed as 4 or 8
spaces. Remove the tabs.
@param inString Text which is in need of word-wrapping.
@param newline The characters that define a newline.
@param wrapColumn The column to wrap the words at.
@return The text with all the long lines word-wrapped. | [
"Takes",
"a",
"block",
"of",
"text",
"which",
"might",
"have",
"long",
"lines",
"in",
"it",
"and",
"wraps",
"the",
"long",
"lines",
"based",
"on",
"the",
"supplied",
"wrapColumn",
"parameter",
".",
"It",
"was",
"initially",
"implemented",
"for",
"use",
"by... | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L183-L207 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java | ZooKeeper.getChildren | public List<String> getChildren(final String path, Watcher watcher,
Stat stat) throws KeeperException, InterruptedException {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
// the watch contains the un-chroot path
WatchRegistration wcb = null;
if (watcher != null) {
wcb = new ChildWatchRegistration(watcher, clientPath);
}
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.getChildren2);
GetChildren2Request request = new GetChildren2Request();
request.setPath(serverPath);
request.setWatch(watcher != null);
GetChildren2Response response = new GetChildren2Response();
ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
if (r.getErr() != 0) {
throw KeeperException.create(KeeperException.Code.get(r.getErr()),
clientPath);
}
if (stat != null) {
DataTree.copyStat(response.getStat(), stat);
}
return response.getChildren();
} | java | public List<String> getChildren(final String path, Watcher watcher,
Stat stat) throws KeeperException, InterruptedException {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
// the watch contains the un-chroot path
WatchRegistration wcb = null;
if (watcher != null) {
wcb = new ChildWatchRegistration(watcher, clientPath);
}
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.getChildren2);
GetChildren2Request request = new GetChildren2Request();
request.setPath(serverPath);
request.setWatch(watcher != null);
GetChildren2Response response = new GetChildren2Response();
ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
if (r.getErr() != 0) {
throw KeeperException.create(KeeperException.Code.get(r.getErr()),
clientPath);
}
if (stat != null) {
DataTree.copyStat(response.getStat(), stat);
}
return response.getChildren();
} | [
"public",
"List",
"<",
"String",
">",
"getChildren",
"(",
"final",
"String",
"path",
",",
"Watcher",
"watcher",
",",
"Stat",
"stat",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"verbotenThreadCheck",
"(",
")",
";",
"final",
"String",
"c... | For the given znode path return the stat and children list.
<p>
If the watch is non-null and the call is successful (no exception is
thrown), a watch will be left on the node with the given path. The watch
willbe triggered by a successful operation that deletes the node of the
given path or creates/delete a child under the node.
<p>
The list of children returned is not sorted and no guarantee is provided
as to its natural or lexical order.
<p>
A KeeperException with error code KeeperException.NoNode will be thrown
if no node with the given path exists.
@since 3.3.0
@param path
@param watcher
explicit watcher
@param stat
stat of the znode designated by path
@return an unordered array of children of the node with the given path
@throws InterruptedException
If the server transaction is interrupted.
@throws KeeperException
If the server signals an error with a non-zero error code.
@throws IllegalArgumentException
if an invalid path is specified | [
"For",
"the",
"given",
"znode",
"path",
"return",
"the",
"stat",
"and",
"children",
"list",
".",
"<p",
">",
"If",
"the",
"watch",
"is",
"non",
"-",
"null",
"and",
"the",
"call",
"is",
"successful",
"(",
"no",
"exception",
"is",
"thrown",
")",
"a",
"w... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1410-L1439 |
xebia-france/xebia-logfilter-extras | src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java | RequestLoggerFilter.doFilter | @Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
ServletRequest request = servletRequest;
ServletResponse response = servletResponse;
int id = 0;
// Generate the identifier if dumping is enabled for request and/or response
if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) {
id = counter.incrementAndGet();
}
// Dumping of the request is enabled so build the RequestWrapper and dump the request
if (LOG_REQUEST.isDebugEnabled()) {
request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB);
dumpRequest((HttpServletRequestLoggingWrapper) request, id);
}
if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.
response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB);
filterChain.doFilter(request, response);
dumpResponse((HttpServletResponseLoggingWrapper) response, id);
} else {
// Dumping of the response is not needed so we just handle the chain
filterChain.doFilter(request, response);
}
} | java | @Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
ServletRequest request = servletRequest;
ServletResponse response = servletResponse;
int id = 0;
// Generate the identifier if dumping is enabled for request and/or response
if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) {
id = counter.incrementAndGet();
}
// Dumping of the request is enabled so build the RequestWrapper and dump the request
if (LOG_REQUEST.isDebugEnabled()) {
request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB);
dumpRequest((HttpServletRequestLoggingWrapper) request, id);
}
if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.
response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB);
filterChain.doFilter(request, response);
dumpResponse((HttpServletResponseLoggingWrapper) response, id);
} else {
// Dumping of the response is not needed so we just handle the chain
filterChain.doFilter(request, response);
}
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"final",
"ServletRequest",
"servletRequest",
",",
"final",
"ServletResponse",
"servletResponse",
",",
"final",
"FilterChain",
"filterChain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"ServletRequest",... | This is where the work is done.
@param servletRequest
@param servletResponse
@param filterChain
@throws IOException
@throws ServletException | [
"This",
"is",
"where",
"the",
"work",
"is",
"done",
"."
] | train | https://github.com/xebia-france/xebia-logfilter-extras/blob/b1112329816d7f28fdba214425da8f15338a7157/src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java#L106-L131 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/OfflineCredentials.java | OfflineCredentials.generateCredential | public Credential generateCredential() throws OAuthException {
GoogleCredential credential = Strings.isNullOrEmpty(this.jsonKeyFilePath)
? generateCredentialFromClientSecrets()
: generateCredentialFromKeyFile();
try {
if (!oAuth2Helper.callRefreshToken(credential)) {
throw new OAuthException(
"Credential could not be refreshed. A newly generated refresh token or "
+ "secret key may be required.");
}
} catch (IOException e) {
throw new OAuthException("Credential could not be refreshed.", e);
}
return credential;
} | java | public Credential generateCredential() throws OAuthException {
GoogleCredential credential = Strings.isNullOrEmpty(this.jsonKeyFilePath)
? generateCredentialFromClientSecrets()
: generateCredentialFromKeyFile();
try {
if (!oAuth2Helper.callRefreshToken(credential)) {
throw new OAuthException(
"Credential could not be refreshed. A newly generated refresh token or "
+ "secret key may be required.");
}
} catch (IOException e) {
throw new OAuthException("Credential could not be refreshed.", e);
}
return credential;
} | [
"public",
"Credential",
"generateCredential",
"(",
")",
"throws",
"OAuthException",
"{",
"GoogleCredential",
"credential",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"this",
".",
"jsonKeyFilePath",
")",
"?",
"generateCredentialFromClientSecrets",
"(",
")",
":",
"gener... | Generates a new offline credential and immediately refreshes it.
@return a newly refreshed offline credential.
@throws OAuthException if the credential could not be refreshed. | [
"Generates",
"a",
"new",
"offline",
"credential",
"and",
"immediately",
"refreshes",
"it",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/OfflineCredentials.java#L229-L243 |
VoltDB/voltdb | src/frontend/org/voltdb/messaging/FastDeserializer.java | FastDeserializer.readString | public String readString() throws IOException {
final int len = readInt();
// check for null string
if (len == VoltType.NULL_STRING_LENGTH) {
return null;
}
if (len < VoltType.NULL_STRING_LENGTH) {
throw new IOException("String length is negative " + len);
}
if (len > buffer.remaining()) {
throw new IOException("String length is bigger than total buffer " + len);
}
// now assume not null
final byte[] strbytes = new byte[len];
readFully(strbytes);
return new String(strbytes, Constants.UTF8ENCODING);
} | java | public String readString() throws IOException {
final int len = readInt();
// check for null string
if (len == VoltType.NULL_STRING_LENGTH) {
return null;
}
if (len < VoltType.NULL_STRING_LENGTH) {
throw new IOException("String length is negative " + len);
}
if (len > buffer.remaining()) {
throw new IOException("String length is bigger than total buffer " + len);
}
// now assume not null
final byte[] strbytes = new byte[len];
readFully(strbytes);
return new String(strbytes, Constants.UTF8ENCODING);
} | [
"public",
"String",
"readString",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"len",
"=",
"readInt",
"(",
")",
";",
"// check for null string",
"if",
"(",
"len",
"==",
"VoltType",
".",
"NULL_STRING_LENGTH",
")",
"{",
"return",
"null",
";",
"}",
... | Read a string in the standard VoltDB way. That is, four
bytes of length info followed by the bytes of characters
encoded in UTF-8.
@return The String value read from the stream.
@throws IOException Rethrows any IOExceptions. | [
"Read",
"a",
"string",
"in",
"the",
"standard",
"VoltDB",
"way",
".",
"That",
"is",
"four",
"bytes",
"of",
"length",
"info",
"followed",
"by",
"the",
"bytes",
"of",
"characters",
"encoded",
"in",
"UTF",
"-",
"8",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastDeserializer.java#L182-L201 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.deleteAsync | public <T> CompletableFuture<T> deleteAsync(final Class<T> type, final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> delete(type, configuration), getExecutor());
} | java | public <T> CompletableFuture<T> deleteAsync(final Class<T> type, final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> delete(type, configuration), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"deleteAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Consumer",
"<",
"HttpConfig",
">",
"configuration",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"... | Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Class,Consumer)` method), with additional
configuration provided by the configuration function. The result will be cast to the specified `type`.
This method is generally used for Java-specific configuration.
[source,java]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
CompletableFuture<String> future = http.deleteAsync(String.class, config -> {
config.getRequest().getUri().setPath("/foo");
});
String result = future.get();
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param type the type of the resulting object
@param configuration the additional configuration function (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} containing the result of the request | [
"Executes",
"an",
"asynchronous",
"DELETE",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"delete",
"(",
"Class",
"Consumer",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configura... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1274-L1276 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.getInstance | public static PackageSummaryBuilder getInstance(Context context,
PackageDoc pkg, PackageSummaryWriter packageWriter) {
return new PackageSummaryBuilder(context, pkg, packageWriter);
} | java | public static PackageSummaryBuilder getInstance(Context context,
PackageDoc pkg, PackageSummaryWriter packageWriter) {
return new PackageSummaryBuilder(context, pkg, packageWriter);
} | [
"public",
"static",
"PackageSummaryBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"PackageDoc",
"pkg",
",",
"PackageSummaryWriter",
"packageWriter",
")",
"{",
"return",
"new",
"PackageSummaryBuilder",
"(",
"context",
",",
"pkg",
",",
"packageWriter",
")",
... | Construct a new PackageSummaryBuilder.
@param context the build context.
@param pkg the package being documented.
@param packageWriter the doclet specific writer that will output the
result.
@return an instance of a PackageSummaryBuilder. | [
"Construct",
"a",
"new",
"PackageSummaryBuilder",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L93-L96 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java | TemplateFaxJob2HTTPRequestConverter.formatHTTPResource | protected String formatHTTPResource(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
{
//get resource
String resourceTemplate=faxClientSpi.getHTTPResource(faxActionType);
//format resource
String resource=SpiUtil.formatTemplate(resourceTemplate,faxJob,SpiUtil.URL_ENCODER,false,false);
return resource;
} | java | protected String formatHTTPResource(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
{
//get resource
String resourceTemplate=faxClientSpi.getHTTPResource(faxActionType);
//format resource
String resource=SpiUtil.formatTemplate(resourceTemplate,faxJob,SpiUtil.URL_ENCODER,false,false);
return resource;
} | [
"protected",
"String",
"formatHTTPResource",
"(",
"HTTPFaxClientSpi",
"faxClientSpi",
",",
"FaxActionType",
"faxActionType",
",",
"FaxJob",
"faxJob",
")",
"{",
"//get resource",
"String",
"resourceTemplate",
"=",
"faxClientSpi",
".",
"getHTTPResource",
"(",
"faxActionType... | This function formats the HTTP resource.
@param faxClientSpi
The HTTP fax client SPI
@param faxActionType
The fax action type
@param faxJob
The fax job object
@return The formatted HTTP resource | [
"This",
"function",
"formats",
"the",
"HTTP",
"resource",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java#L308-L317 |
tvesalainen/util | security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java | SSLSocketChannel.open | public static SSLSocketChannel open(SocketChannel socketChannel, ByteBuffer consumed, boolean autoClose) throws IOException, NoSuchAlgorithmException
{
return open(socketChannel, SSLContext.getDefault(), consumed, autoClose);
} | java | public static SSLSocketChannel open(SocketChannel socketChannel, ByteBuffer consumed, boolean autoClose) throws IOException, NoSuchAlgorithmException
{
return open(socketChannel, SSLContext.getDefault(), consumed, autoClose);
} | [
"public",
"static",
"SSLSocketChannel",
"open",
"(",
"SocketChannel",
"socketChannel",
",",
"ByteBuffer",
"consumed",
",",
"boolean",
"autoClose",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"open",
"(",
"socketChannel",
",",
"SSLCont... | Creates SSLSocketChannel over connected SocketChannel using default
SSLContext. Connection is in server mode, but can be changed before read/write.
@param socketChannel
@param consumed If not null, ByteBuffer's remaining can contain bytes
that are consumed by SocketChannel, but are part of SSL connection. Bytes
are moved from this buffer. This buffers hasRemaining is false after call.
@param autoClose If true the SocketChannel is closed when SSLSocketChannel
is closed.
@return
@throws IOException
@throws java.security.NoSuchAlgorithmException | [
"Creates",
"SSLSocketChannel",
"over",
"connected",
"SocketChannel",
"using",
"default",
"SSLContext",
".",
"Connection",
"is",
"in",
"server",
"mode",
"but",
"can",
"be",
"changed",
"before",
"read",
"/",
"write",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java#L109-L112 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java | StreamingLocatorsInner.createAsync | public Observable<StreamingLocatorInner> createAsync(String resourceGroupName, String accountName, String streamingLocatorName, StreamingLocatorInner parameters) {
return createWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName, parameters).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() {
@Override
public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) {
return response.body();
}
});
} | java | public Observable<StreamingLocatorInner> createAsync(String resourceGroupName, String accountName, String streamingLocatorName, StreamingLocatorInner parameters) {
return createWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName, parameters).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() {
@Override
public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StreamingLocatorInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"streamingLocatorName",
",",
"StreamingLocatorInner",
"parameters",
")",
"{",
"return",
"createWithServiceResponseAsync... | Create a Streaming Locator.
Create a Streaming Locator in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingLocatorName The Streaming Locator name.
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingLocatorInner object | [
"Create",
"a",
"Streaming",
"Locator",
".",
"Create",
"a",
"Streaming",
"Locator",
"in",
"the",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L504-L511 |
ModeShape/modeshape | index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java | CompareNameQuery.createQueryForNodesWithNameLessThan | public static CompareNameQuery createQueryForNodesWithNameLessThan( Name constraintValue,
String localNameField,
ValueFactories factories,
Function<String, String> caseOperation ) {
return new CompareNameQuery(localNameField, constraintValue, factories.getNameFactory(),
(name1, name2) -> NAME_COMPARATOR.compare(name1, name2) < 0,
caseOperation);
} | java | public static CompareNameQuery createQueryForNodesWithNameLessThan( Name constraintValue,
String localNameField,
ValueFactories factories,
Function<String, String> caseOperation ) {
return new CompareNameQuery(localNameField, constraintValue, factories.getNameFactory(),
(name1, name2) -> NAME_COMPARATOR.compare(name1, name2) < 0,
caseOperation);
} | [
"public",
"static",
"CompareNameQuery",
"createQueryForNodesWithNameLessThan",
"(",
"Name",
"constraintValue",
",",
"String",
"localNameField",
",",
"ValueFactories",
"factories",
",",
"Function",
"<",
"String",
",",
"String",
">",
"caseOperation",
")",
"{",
"return",
... | Construct a {@link Query} implementation that scores documents such that the node represented by the document has a name
that is less than the supplied constraint name.
@param constraintValue the constraint value; may not be null
@param localNameField the name of the document field containing the local name value; may not be null
@param factories the value factories that can be used during the scoring; may not be null
@param caseOperation the operation that should be performed on the indexed values before the constraint value is being
evaluated; may be null which indicates that no case conversion should be done
@return the query; never null | [
"Construct",
"a",
"{",
"@link",
"Query",
"}",
"implementation",
"that",
"scores",
"documents",
"such",
"that",
"the",
"node",
"represented",
"by",
"the",
"document",
"has",
"a",
"name",
"that",
"is",
"less",
"than",
"the",
"supplied",
"constraint",
"name",
"... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareNameQuery.java#L142-L149 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/SearchIndex.java | SearchIndex.findByDnsName | public ManagedEntity findByDnsName(Datacenter datacenter, String dnsName, boolean vmOnly) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().findByDnsName(getMOR(), datacenter == null ? null : datacenter.getMOR(), dnsName, vmOnly);
return MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | java | public ManagedEntity findByDnsName(Datacenter datacenter, String dnsName, boolean vmOnly) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().findByDnsName(getMOR(), datacenter == null ? null : datacenter.getMOR(), dnsName, vmOnly);
return MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | [
"public",
"ManagedEntity",
"findByDnsName",
"(",
"Datacenter",
"datacenter",
",",
"String",
"dnsName",
",",
"boolean",
"vmOnly",
")",
"throws",
"RuntimeFault",
",",
"RemoteException",
"{",
"ManagedObjectReference",
"mor",
"=",
"getVimService",
"(",
")",
".",
"findBy... | Find a VM or Host by its DNS name
@param datacenter The datacenter within which it searches. If null is passed, all inventory is searched.
@param dnsName DNS name like "dev.eng.vmware.com"
@param vmOnly When set true only searches for VM; otherwise only for Host.
@return A ManagedEntity to either HostSystem or VirtualMachine having the DNS name.
@throws RemoteException
@throws RuntimeFault | [
"Find",
"a",
"VM",
"or",
"Host",
"by",
"its",
"DNS",
"name"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/SearchIndex.java#L90-L93 |
roboconf/roboconf-platform | miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java | CompletionUtils.basicProposal | public static RoboconfCompletionProposal basicProposal( String s, String lastWord ) {
return basicProposal( s, lastWord, false );
} | java | public static RoboconfCompletionProposal basicProposal( String s, String lastWord ) {
return basicProposal( s, lastWord, false );
} | [
"public",
"static",
"RoboconfCompletionProposal",
"basicProposal",
"(",
"String",
"s",
",",
"String",
"lastWord",
")",
"{",
"return",
"basicProposal",
"(",
"s",
",",
"lastWord",
",",
"false",
")",
";",
"}"
] | A convenience method to shorten the creation of a basic proposal.
<p>
Equivalent to <code>basicProposal( s, lastWord, false )</code>.
</p>
@param s
@param lastWord
@return a non-null proposal | [
"A",
"convenience",
"method",
"to",
"shorten",
"the",
"creation",
"of",
"a",
"basic",
"proposal",
".",
"<p",
">",
"Equivalent",
"to",
"<code",
">",
"basicProposal",
"(",
"s",
"lastWord",
"false",
")",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L161-L163 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.checkNameAvailabilityAsync | public Observable<CheckNameResultInner> checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) {
return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).map(new Func1<ServiceResponse<CheckNameResultInner>, CheckNameResultInner>() {
@Override
public CheckNameResultInner call(ServiceResponse<CheckNameResultInner> response) {
return response.body();
}
});
} | java | public Observable<CheckNameResultInner> checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) {
return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).map(new Func1<ServiceResponse<CheckNameResultInner>, CheckNameResultInner>() {
@Override
public CheckNameResultInner call(ServiceResponse<CheckNameResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CheckNameResultInner",
">",
"checkNameAvailabilityAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"name",
")",
"{",
"return",
"checkNameAvailabilityWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Checks that the database name is valid and is not already in use.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param name Database name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CheckNameResultInner object | [
"Checks",
"that",
"the",
"database",
"name",
"is",
"valid",
"and",
"is",
"not",
"already",
"in",
"use",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L152-L159 |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.byteToHexString | public static <T extends Appendable> T byteToHexString(T buf, int value) {
try {
buf.append(byteToHexString(value));
} catch (IOException e) {
PlatformDependent.throwException(e);
}
return buf;
} | java | public static <T extends Appendable> T byteToHexString(T buf, int value) {
try {
buf.append(byteToHexString(value));
} catch (IOException e) {
PlatformDependent.throwException(e);
}
return buf;
} | [
"public",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"byteToHexString",
"(",
"T",
"buf",
",",
"int",
"value",
")",
"{",
"try",
"{",
"buf",
".",
"append",
"(",
"byteToHexString",
"(",
"value",
")",
")",
";",
"}",
"catch",
"(",
"IOException",... | Converts the specified byte value into a hexadecimal integer and appends it to the specified buffer. | [
"Converts",
"the",
"specified",
"byte",
"value",
"into",
"a",
"hexadecimal",
"integer",
"and",
"appends",
"it",
"to",
"the",
"specified",
"buffer",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L148-L155 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java | ReceiveQueueSession.updateRemoteFilterProperties | public void updateRemoteFilterProperties(BaseMessageFilter messageFilter, Object[][] mxProperties, Map<String,Object> propFilter) throws RemoteException
{
Utility.getLogger().info("EJB updateRemoteFilter properties: " + mxProperties);
// Give the filter the remote environment
MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
messageFilter = ((BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getQueueName(), messageFilter.getQueueType()).getMessageReceiver()).getMessageFilter(messageFilter.getRemoteFilterID()); // Must look it up
if (messageFilter != null) // Always
{
if (mxProperties != null)
messageFilter.setFilterTree(mxProperties);
if (propFilter != null)
{
propFilter = messageFilter.handleUpdateFilterMap(propFilter); // Update this object's local filter.
messageFilter.setFilterMap(propFilter); // Update any remote copy of this.
}
}
} | java | public void updateRemoteFilterProperties(BaseMessageFilter messageFilter, Object[][] mxProperties, Map<String,Object> propFilter) throws RemoteException
{
Utility.getLogger().info("EJB updateRemoteFilter properties: " + mxProperties);
// Give the filter the remote environment
MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
messageFilter = ((BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getQueueName(), messageFilter.getQueueType()).getMessageReceiver()).getMessageFilter(messageFilter.getRemoteFilterID()); // Must look it up
if (messageFilter != null) // Always
{
if (mxProperties != null)
messageFilter.setFilterTree(mxProperties);
if (propFilter != null)
{
propFilter = messageFilter.handleUpdateFilterMap(propFilter); // Update this object's local filter.
messageFilter.setFilterMap(propFilter); // Update any remote copy of this.
}
}
} | [
"public",
"void",
"updateRemoteFilterProperties",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"Object",
"[",
"]",
"[",
"]",
"mxProperties",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"propFilter",
")",
"throws",
"RemoteException",
"{",
"Utility",
".",
"g... | Update this filter with this new information.
@param messageFilter The message filter I am updating.
@param properties New filter information (ie, bookmark=345). | [
"Update",
"this",
"filter",
"with",
"this",
"new",
"information",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java#L199-L215 |
alexvasilkov/AndroidCommons | library/src/main/java/com/alexvasilkov/android/commons/texts/Fonts.java | Fonts.apply | public static void apply(@NonNull TextView textView, @NonNull String fontPath) {
if (!textView.isInEditMode()) {
setTypeface(textView, getFontFromString
(textView.getContext().getAssets(), fontPath, true));
}
} | java | public static void apply(@NonNull TextView textView, @NonNull String fontPath) {
if (!textView.isInEditMode()) {
setTypeface(textView, getFontFromString
(textView.getContext().getAssets(), fontPath, true));
}
} | [
"public",
"static",
"void",
"apply",
"(",
"@",
"NonNull",
"TextView",
"textView",
",",
"@",
"NonNull",
"String",
"fontPath",
")",
"{",
"if",
"(",
"!",
"textView",
".",
"isInEditMode",
"(",
")",
")",
"{",
"setTypeface",
"(",
"textView",
",",
"getFontFromStr... | Applies font to provided TextView.<br/>
Note: this class will only accept fonts under <code>fonts/</code> directory
and fonts starting with <code>font:</code> prefix. | [
"Applies",
"font",
"to",
"provided",
"TextView",
".",
"<br",
"/",
">",
"Note",
":",
"this",
"class",
"will",
"only",
"accept",
"fonts",
"under",
"<code",
">",
"fonts",
"/",
"<",
"/",
"code",
">",
"directory",
"and",
"fonts",
"starting",
"with",
"<code",
... | train | https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/texts/Fonts.java#L102-L107 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java | ByteUtils.intToBytes | public static final void intToBytes( int i, byte[] data, int[] offset ) {
/**
* TODO: We use network-order within OceanStore, but temporarily
* supporting intel-order to work with some JNI code until JNI code is
* set to interoperate with network-order.
*/
if (data != null) {
for( int j = (offset[0] + SIZE_INT) - 1; j >= offset[0]; --j ) {
data[j] = (byte) i;
i >>= 8;
}
}
offset[0] += SIZE_INT;
} | java | public static final void intToBytes( int i, byte[] data, int[] offset ) {
/**
* TODO: We use network-order within OceanStore, but temporarily
* supporting intel-order to work with some JNI code until JNI code is
* set to interoperate with network-order.
*/
if (data != null) {
for( int j = (offset[0] + SIZE_INT) - 1; j >= offset[0]; --j ) {
data[j] = (byte) i;
i >>= 8;
}
}
offset[0] += SIZE_INT;
} | [
"public",
"static",
"final",
"void",
"intToBytes",
"(",
"int",
"i",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offset",
")",
"{",
"/**\n * TODO: We use network-order within OceanStore, but temporarily\n * supporting intel-order to work with some JNI... | Write the bytes representing <code>i</code> into the byte array
<code>data</code>, starting at index <code>offset [0]</code>, and
increment <code>offset [0]</code> by the number of bytes written; if
<code>data == null</code>, increment <code>offset [0]</code> by the
number of bytes that would have been written otherwise.
@param i the <code>int</code> to encode
@param data The byte array to store into, or <code>null</code>.
@param offset A single element array whose first element is the index in
data to begin writing at on function entry, and which on
function exit has been incremented by the number of bytes
written. | [
"Write",
"the",
"bytes",
"representing",
"<code",
">",
"i<",
"/",
"code",
">",
"into",
"the",
"byte",
"array",
"<code",
">",
"data<",
"/",
"code",
">",
"starting",
"at",
"index",
"<code",
">",
"offset",
"[",
"0",
"]",
"<",
"/",
"code",
">",
"and",
... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L79-L93 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.clearReferrerURLCookie | public void clearReferrerURLCookie(HttpServletRequest req, HttpServletResponse res, String cookieName) {
String url = CookieHelper.getCookieValue(req.getCookies(), cookieName);
if (url != null && url.length() > 0) {
invalidateReferrerURLCookie(req, res, cookieName);
}
} | java | public void clearReferrerURLCookie(HttpServletRequest req, HttpServletResponse res, String cookieName) {
String url = CookieHelper.getCookieValue(req.getCookies(), cookieName);
if (url != null && url.length() > 0) {
invalidateReferrerURLCookie(req, res, cookieName);
}
} | [
"public",
"void",
"clearReferrerURLCookie",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"cookieName",
")",
"{",
"String",
"url",
"=",
"CookieHelper",
".",
"getCookieValue",
"(",
"req",
".",
"getCookies",
"(",
")",
",",
"co... | Removes the referrer URL cookie from the HttpServletResponse if set in the
HttpServletRequest.
@param req
@param res | [
"Removes",
"the",
"referrer",
"URL",
"cookie",
"from",
"the",
"HttpServletResponse",
"if",
"set",
"in",
"the",
"HttpServletRequest",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L154-L160 |
actorapp/actor-platform | actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/kuznechik/KuznechikCipher.java | KuznechikCipher.encryptBlock | public void encryptBlock(byte[] data, int offset, byte[] dest, int destOffset) {
// w128_t x;
// x.q[0] = ((uint64_t *) blk)[0];
// x.q[1] = ((uint64_t *) blk)[1];
Kuz128 x = new Kuz128();
x.setQ(0, ByteStrings.bytesToLong(data, offset));
x.setQ(1, ByteStrings.bytesToLong(data, offset + 8));
for (int i = 0; i < 9; i++) {
// x.q[0] ^= key->k[i].q[0];
// x.q[1] ^= key->k[i].q[1];
x.setQ(0, x.getQ(0) ^ key.getK()[i].getQ(0));
x.setQ(1, x.getQ(1) ^ key.getK()[i].getQ(1));
for (int j = 0; j < 16; j++) {
// x.b[j] = kuz_pi[x.b[j]];
x.getB()[j] = KuznechikTables.kuz_pi[(x.getB()[j] & 0xFF)];
}
// kuz_l(&x);
KuznechikMath.kuz_l(x);
}
// ((uint64_t *) blk)[0] = x.q[0] ^ key->k[9].q[0];
// ((uint64_t *) blk)[1] = x.q[1] ^ key->k[9].q[1];
ByteStrings.write(dest, destOffset, ByteStrings.longToBytes(x.getQ(0) ^ key.getK()[9].getQ(0)), 0, 8);
ByteStrings.write(dest, destOffset + 8, ByteStrings.longToBytes(x.getQ(1) ^ key.getK()[9].getQ(1)), 0, 8);
} | java | public void encryptBlock(byte[] data, int offset, byte[] dest, int destOffset) {
// w128_t x;
// x.q[0] = ((uint64_t *) blk)[0];
// x.q[1] = ((uint64_t *) blk)[1];
Kuz128 x = new Kuz128();
x.setQ(0, ByteStrings.bytesToLong(data, offset));
x.setQ(1, ByteStrings.bytesToLong(data, offset + 8));
for (int i = 0; i < 9; i++) {
// x.q[0] ^= key->k[i].q[0];
// x.q[1] ^= key->k[i].q[1];
x.setQ(0, x.getQ(0) ^ key.getK()[i].getQ(0));
x.setQ(1, x.getQ(1) ^ key.getK()[i].getQ(1));
for (int j = 0; j < 16; j++) {
// x.b[j] = kuz_pi[x.b[j]];
x.getB()[j] = KuznechikTables.kuz_pi[(x.getB()[j] & 0xFF)];
}
// kuz_l(&x);
KuznechikMath.kuz_l(x);
}
// ((uint64_t *) blk)[0] = x.q[0] ^ key->k[9].q[0];
// ((uint64_t *) blk)[1] = x.q[1] ^ key->k[9].q[1];
ByteStrings.write(dest, destOffset, ByteStrings.longToBytes(x.getQ(0) ^ key.getK()[9].getQ(0)), 0, 8);
ByteStrings.write(dest, destOffset + 8, ByteStrings.longToBytes(x.getQ(1) ^ key.getK()[9].getQ(1)), 0, 8);
} | [
"public",
"void",
"encryptBlock",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"byte",
"[",
"]",
"dest",
",",
"int",
"destOffset",
")",
"{",
"// w128_t x;",
"// x.q[0] = ((uint64_t *) blk)[0];",
"// x.q[1] = ((uint64_t *) blk)[1];",
"Kuz128",
"x",
"="... | Encrypting Block with KuznechikImpl encryption
@param data 16-byte block for encryption
@param offset offset in block
@param dest destination array
@param destOffset destinaation offset | [
"Encrypting",
"Block",
"with",
"KuznechikImpl",
"encryption"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/kuznechik/KuznechikCipher.java#L31-L57 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java | RunningWorkers.doneTasklets | void doneTasklets(final String workerId, final List<Integer> taskletIds) {
lock.lock();
try {
if (!terminated && runningWorkers.containsKey(workerId)) { // Preemption can come before
final VortexWorkerManager worker = this.runningWorkers.get(workerId);
final List<Tasklet> tasklets = worker.taskletsDone(taskletIds);
this.schedulingPolicy.taskletsDone(worker, tasklets);
taskletsToCancel.removeAll(taskletIds); // cleanup to prevent memory leak.
// Notify (possibly) waiting scheduler
noWorkerOrResource.signal();
}
} finally {
lock.unlock();
}
} | java | void doneTasklets(final String workerId, final List<Integer> taskletIds) {
lock.lock();
try {
if (!terminated && runningWorkers.containsKey(workerId)) { // Preemption can come before
final VortexWorkerManager worker = this.runningWorkers.get(workerId);
final List<Tasklet> tasklets = worker.taskletsDone(taskletIds);
this.schedulingPolicy.taskletsDone(worker, tasklets);
taskletsToCancel.removeAll(taskletIds); // cleanup to prevent memory leak.
// Notify (possibly) waiting scheduler
noWorkerOrResource.signal();
}
} finally {
lock.unlock();
}
} | [
"void",
"doneTasklets",
"(",
"final",
"String",
"workerId",
",",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"terminated",
"&&",
"runningWorkers",
".",
"containsKey",
"(",
... | Concurrency: Called by multiple threads.
Parameter: Same arguments can come in multiple times.
(e.g. preemption message coming before tasklet completion message multiple times) | [
"Concurrency",
":",
"Called",
"by",
"multiple",
"threads",
".",
"Parameter",
":",
"Same",
"arguments",
"can",
"come",
"in",
"multiple",
"times",
".",
"(",
"e",
".",
"g",
".",
"preemption",
"message",
"coming",
"before",
"tasklet",
"completion",
"message",
"m... | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java#L211-L227 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/io/random/RandomAccessReader.java | RandomAccessReader.readContent | protected String readContent(int record) throws IOException, CDKException {
logger.debug("Current record ", record);
if ((record < 0) || (record >= records)) {
throw new CDKException("No such record " + record);
}
//fireFrameRead();
raFile.seek(index[record][0]);
int length = (int) index[record][1];
raFile.read(b, 0, length);
return new String(b, 0, length);
} | java | protected String readContent(int record) throws IOException, CDKException {
logger.debug("Current record ", record);
if ((record < 0) || (record >= records)) {
throw new CDKException("No such record " + record);
}
//fireFrameRead();
raFile.seek(index[record][0]);
int length = (int) index[record][1];
raFile.read(b, 0, length);
return new String(b, 0, length);
} | [
"protected",
"String",
"readContent",
"(",
"int",
"record",
")",
"throws",
"IOException",
",",
"CDKException",
"{",
"logger",
".",
"debug",
"(",
"\"Current record \"",
",",
"record",
")",
";",
"if",
"(",
"(",
"record",
"<",
"0",
")",
"||",
"(",
"record",
... | Reads the record text content into a String.
@param record The record number
@return A String representation of the record
@throws java.io.IOException if error occurs during reading
@throws org.openscience.cdk.exception.CDKException if the record number is invalid | [
"Reads",
"the",
"record",
"text",
"content",
"into",
"a",
"String",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/io/random/RandomAccessReader.java#L145-L157 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/implementation/PredictionsImpl.java | PredictionsImpl.resolveAsync | public Observable<LuisResult> resolveAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter) {
return resolveWithServiceResponseAsync(appId, query, resolveOptionalParameter).map(new Func1<ServiceResponse<LuisResult>, LuisResult>() {
@Override
public LuisResult call(ServiceResponse<LuisResult> response) {
return response.body();
}
});
} | java | public Observable<LuisResult> resolveAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter) {
return resolveWithServiceResponseAsync(appId, query, resolveOptionalParameter).map(new Func1<ServiceResponse<LuisResult>, LuisResult>() {
@Override
public LuisResult call(ServiceResponse<LuisResult> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LuisResult",
">",
"resolveAsync",
"(",
"String",
"appId",
",",
"String",
"query",
",",
"ResolveOptionalParameter",
"resolveOptionalParameter",
")",
"{",
"return",
"resolveWithServiceResponseAsync",
"(",
"appId",
",",
"query",
",",
"resolv... | Gets predictions for a given utterance, in the form of intents and entities. The current maximum query size is 500 characters.
@param appId The LUIS application ID (Guid).
@param query The utterance to predict.
@param resolveOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LuisResult object | [
"Gets",
"predictions",
"for",
"a",
"given",
"utterance",
"in",
"the",
"form",
"of",
"intents",
"and",
"entities",
".",
"The",
"current",
"maximum",
"query",
"size",
"is",
"500",
"characters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/implementation/PredictionsImpl.java#L104-L111 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/util/Hex.java | Hex.getProtectedConstructor | public static Constructor getProtectedConstructor(Class klass, Class... paramTypes) {
Constructor c;
try {
c = klass.getDeclaredConstructor(paramTypes);
c.setAccessible(true);
return c;
} catch (Exception e) {
return null;
}
} | java | public static Constructor getProtectedConstructor(Class klass, Class... paramTypes) {
Constructor c;
try {
c = klass.getDeclaredConstructor(paramTypes);
c.setAccessible(true);
return c;
} catch (Exception e) {
return null;
}
} | [
"public",
"static",
"Constructor",
"getProtectedConstructor",
"(",
"Class",
"klass",
",",
"Class",
"...",
"paramTypes",
")",
"{",
"Constructor",
"c",
";",
"try",
"{",
"c",
"=",
"klass",
".",
"getDeclaredConstructor",
"(",
"paramTypes",
")",
";",
"c",
".",
"s... | Used to get access to protected/private constructor of the specified class
@param klass - name of the class
@param paramTypes - types of the constructor parameters
@return Constructor if successful, null if the constructor cannot be
accessed | [
"Used",
"to",
"get",
"access",
"to",
"protected",
"/",
"private",
"constructor",
"of",
"the",
"specified",
"class"
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/util/Hex.java#L86-L95 |
lucee/Lucee | core/src/main/java/lucee/transformer/cfml/script/AbstrCFMLScriptTransformer.java | AbstrCFMLScriptTransformer.caseStatement | private final boolean caseStatement(Data data, Switch swit) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoWordAfter("case")) return false;
// int line=data.srcCode.getLine();
comments(data);
Expression expr = super.expression(data);
comments(data);
if (!data.srcCode.forwardIfCurrent(':')) throw new TemplateException(data.srcCode, "case body must start with [:]");
Body body = new BodyBase(data.factory);
switchBlock(data, body);
swit.addCase(expr, body);
return true;
} | java | private final boolean caseStatement(Data data, Switch swit) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoWordAfter("case")) return false;
// int line=data.srcCode.getLine();
comments(data);
Expression expr = super.expression(data);
comments(data);
if (!data.srcCode.forwardIfCurrent(':')) throw new TemplateException(data.srcCode, "case body must start with [:]");
Body body = new BodyBase(data.factory);
switchBlock(data, body);
swit.addCase(expr, body);
return true;
} | [
"private",
"final",
"boolean",
"caseStatement",
"(",
"Data",
"data",
",",
"Switch",
"swit",
")",
"throws",
"TemplateException",
"{",
"if",
"(",
"!",
"data",
".",
"srcCode",
".",
"forwardIfCurrentAndNoWordAfter",
"(",
"\"case\"",
")",
")",
"return",
"false",
";... | Liest ein Case Statement ein
@return case Statement
@throws TemplateException | [
"Liest",
"ein",
"Case",
"Statement",
"ein"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/script/AbstrCFMLScriptTransformer.java#L495-L509 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.isSameInstant | public static boolean isSameInstant(final Calendar cal1, final Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
return cal1.getTime().getTime() == cal2.getTime().getTime();
} | java | public static boolean isSameInstant(final Calendar cal1, final Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
return cal1.getTime().getTime() == cal2.getTime().getTime();
} | [
"public",
"static",
"boolean",
"isSameInstant",
"(",
"final",
"Calendar",
"cal1",
",",
"final",
"Calendar",
"cal2",
")",
"{",
"if",
"(",
"cal1",
"==",
"null",
"||",
"cal2",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The date ... | <p>Checks if two calendar objects represent the same instant in time.</p>
<p>This method compares the long millisecond time of the two objects.</p>
@param cal1 the first calendar, not altered, not null
@param cal2 the second calendar, not altered, not null
@return true if they represent the same millisecond instant
@throws IllegalArgumentException if either date is <code>null</code>
@since 2.1 | [
"<p",
">",
"Checks",
"if",
"two",
"calendar",
"objects",
"represent",
"the",
"same",
"instant",
"in",
"time",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L231-L236 |
Waikato/moa | moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java | KDTree.clipToInsideHrect | protected boolean clipToInsideHrect(KDTreeNode node, Instance x) {
boolean inside = true;
for (int i = 0; i < m_Instances.numAttributes(); i++) {
// TODO treat nominals differently!??
if (x.value(i) < node.m_NodeRanges[i][MIN]) {
x.setValue(i, node.m_NodeRanges[i][MIN]);
inside = false;
} else if (x.value(i) > node.m_NodeRanges[i][MAX]) {
x.setValue(i, node.m_NodeRanges[i][MAX]);
inside = false;
}
}
return inside;
} | java | protected boolean clipToInsideHrect(KDTreeNode node, Instance x) {
boolean inside = true;
for (int i = 0; i < m_Instances.numAttributes(); i++) {
// TODO treat nominals differently!??
if (x.value(i) < node.m_NodeRanges[i][MIN]) {
x.setValue(i, node.m_NodeRanges[i][MIN]);
inside = false;
} else if (x.value(i) > node.m_NodeRanges[i][MAX]) {
x.setValue(i, node.m_NodeRanges[i][MAX]);
inside = false;
}
}
return inside;
} | [
"protected",
"boolean",
"clipToInsideHrect",
"(",
"KDTreeNode",
"node",
",",
"Instance",
"x",
")",
"{",
"boolean",
"inside",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_Instances",
".",
"numAttributes",
"(",
")",
";",
"i",
"++... | Finds the closest point in the hyper rectangle to a given point. Change the
given point to this closest point by clipping of at all the dimensions to
be clipped of. If the point is inside the rectangle it stays unchanged. The
return value is true if the point was not changed, so the the return value
is true if the point was inside the rectangle.
@param node The current KDTreeNode in whose hyperrectangle the closest
point is to be found.
@param x a point
@return true if the input point stayed unchanged. | [
"Finds",
"the",
"closest",
"point",
"in",
"the",
"hyper",
"rectangle",
"to",
"a",
"given",
"point",
".",
"Change",
"the",
"given",
"point",
"to",
"this",
"closest",
"point",
"by",
"clipping",
"of",
"at",
"all",
"the",
"dimensions",
"to",
"be",
"clipped",
... | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L842-L856 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/OperationsApi.java | OperationsApi.getUsedSkillsAsync | public void getUsedSkillsAsync(AsyncCallback callback) throws ProvisioningApiException {
String aioId = UUID.randomUUID().toString();
asyncCallbacks.put(aioId, callback);
try {
ApiAsyncSuccessResponse resp = operationsApi.getUsedSkillsAsync(aioId);
if (!resp.getStatus().getCode().equals(1)) {
throw new ProvisioningApiException("Error getting used skills. Code: " + resp.getStatus().getCode());
}
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting used skills", e);
}
} | java | public void getUsedSkillsAsync(AsyncCallback callback) throws ProvisioningApiException {
String aioId = UUID.randomUUID().toString();
asyncCallbacks.put(aioId, callback);
try {
ApiAsyncSuccessResponse resp = operationsApi.getUsedSkillsAsync(aioId);
if (!resp.getStatus().getCode().equals(1)) {
throw new ProvisioningApiException("Error getting used skills. Code: " + resp.getStatus().getCode());
}
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting used skills", e);
}
} | [
"public",
"void",
"getUsedSkillsAsync",
"(",
"AsyncCallback",
"callback",
")",
"throws",
"ProvisioningApiException",
"{",
"String",
"aioId",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"asyncCallbacks",
".",
"put",
"(",
"aioId",
"... | Get used skills.
Get all [CfgSkill](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgSkill) that are linked to existing [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects.
@param callback The callback function called when the skills are returned asynchronously. Callback takes one parameter: Map<String, Object< results.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Get",
"used",
"skills",
".",
"Get",
"all",
"[",
"CfgSkill",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"genesys",
".",
"com",
"/",
"Documentation",
"/",
"PSDK",
"/",
"latest",
"/",
"ConfigLayerRef",
"/",
"CfgSkill",
")",
"that",
"are",
"linked",
"to",... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/OperationsApi.java#L31-L44 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java | WikiScannerUtil.extractSubstring | public static String extractSubstring(
String str,
String open,
String close,
char escape)
{
return extractSubstring(str, open, close, escape, true);
} | java | public static String extractSubstring(
String str,
String open,
String close,
char escape)
{
return extractSubstring(str, open, close, escape, true);
} | [
"public",
"static",
"String",
"extractSubstring",
"(",
"String",
"str",
",",
"String",
"open",
",",
"String",
"close",
",",
"char",
"escape",
")",
"{",
"return",
"extractSubstring",
"(",
"str",
",",
"open",
",",
"close",
",",
"escape",
",",
"true",
")",
... | Extracts and returns a substring of the given string starting from the
given open sequence and finishing by the specified close sequence. This
method unescapes all symbols prefixed by the given escape symbol.
@param str from this string the substring framed by the specified open
and close sequence will be returned
@param open the start substring sequence
@param close the closing substring sequence
@param escape the escape symbol
@return a substring of the given string starting from the given open
sequence and finishing by the specified close sequence | [
"Extracts",
"and",
"returns",
"a",
"substring",
"of",
"the",
"given",
"string",
"starting",
"from",
"the",
"given",
"open",
"sequence",
"and",
"finishing",
"by",
"the",
"specified",
"close",
"sequence",
".",
"This",
"method",
"unescapes",
"all",
"symbols",
"pr... | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java#L69-L76 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java | ConnectionContextFactory.createConsumerConnectionContext | public ConsumerConnectionContext createConsumerConnectionContext(Endpoint endpoint, String messageSelector)
throws JMSException {
ConsumerConnectionContext context = new ConsumerConnectionContext();
createOrReuseConnection(context, true);
createSession(context);
createDestination(context, endpoint);
createConsumer(context, messageSelector);
return context;
} | java | public ConsumerConnectionContext createConsumerConnectionContext(Endpoint endpoint, String messageSelector)
throws JMSException {
ConsumerConnectionContext context = new ConsumerConnectionContext();
createOrReuseConnection(context, true);
createSession(context);
createDestination(context, endpoint);
createConsumer(context, messageSelector);
return context;
} | [
"public",
"ConsumerConnectionContext",
"createConsumerConnectionContext",
"(",
"Endpoint",
"endpoint",
",",
"String",
"messageSelector",
")",
"throws",
"JMSException",
"{",
"ConsumerConnectionContext",
"context",
"=",
"new",
"ConsumerConnectionContext",
"(",
")",
";",
"crea... | Creates a new consumer connection context, reusing any existing connection that might have
already been created. The destination of the connection's session will be that of the given endpoint.
The consumer will filter messages based on the given message selector expression (which may be
null in which case the consumer will consume all messages).
@param endpoint where the consumer will listen for messages
@param messageSelector message consumer's message selector expression.
@return the new consumer connection context fully populated
@throws JMSException any error | [
"Creates",
"a",
"new",
"consumer",
"connection",
"context",
"reusing",
"any",
"existing",
"connection",
"that",
"might",
"have",
"already",
"been",
"created",
".",
"The",
"destination",
"of",
"the",
"connection",
"s",
"session",
"will",
"be",
"that",
"of",
"th... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L124-L132 |
tzaeschke/zoodb | src/org/zoodb/internal/server/index/FreeSpaceManager.java | FreeSpaceManager.initBackingIndexLoad | public void initBackingIndexLoad(IOResourceProvider file, int pageId, int pageCount) {
if (idx != null) {
throw new IllegalStateException();
}
//8 byte page, 1 byte flag
idx = new PagedUniqueLongLong(PAGE_TYPE.FREE_INDEX, file, pageId, 4, 8);
lastPage.set(pageCount-1);
iter = idx.iterator(1, Long.MAX_VALUE);//pageCount);
} | java | public void initBackingIndexLoad(IOResourceProvider file, int pageId, int pageCount) {
if (idx != null) {
throw new IllegalStateException();
}
//8 byte page, 1 byte flag
idx = new PagedUniqueLongLong(PAGE_TYPE.FREE_INDEX, file, pageId, 4, 8);
lastPage.set(pageCount-1);
iter = idx.iterator(1, Long.MAX_VALUE);//pageCount);
} | [
"public",
"void",
"initBackingIndexLoad",
"(",
"IOResourceProvider",
"file",
",",
"int",
"pageId",
",",
"int",
"pageCount",
")",
"{",
"if",
"(",
"idx",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"//8 byte page, 1 byte ... | Constructor for creating new index.
@param file The file
@param pageId The page ID of the root page
@param pageCount Current number of pages | [
"Constructor",
"for",
"creating",
"new",
"index",
"."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/FreeSpaceManager.java#L103-L111 |
aws/aws-sdk-java | aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/CreateGroupResult.java | CreateGroupResult.withTags | public CreateGroupResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateGroupResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateGroupResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags associated with the group.
</p>
@param tags
The tags associated with the group.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"associated",
"with",
"the",
"group",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/CreateGroupResult.java#L160-L163 |
rimerosolutions/ant-git-tasks | src/main/java/com/rimerosolutions/ant/git/GitTaskUtils.java | GitTaskUtils.validateRemoteRefUpdates | public static void validateRemoteRefUpdates(String errorPrefix, Collection<RemoteRefUpdate> refUpdates) {
for (RemoteRefUpdate refUpdate : refUpdates) {
RemoteRefUpdate.Status status = refUpdate.getStatus();
if (status == RemoteRefUpdate.Status.REJECTED_NODELETE ||
status == RemoteRefUpdate.Status.NON_EXISTING ||
status == RemoteRefUpdate.Status.NOT_ATTEMPTED ||
status == RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD ||
status == RemoteRefUpdate.Status.REJECTED_OTHER_REASON ||
status == RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) {
throw new BuildException(String.format("%s - Status '%s'", errorPrefix, status.name()));
}
}
} | java | public static void validateRemoteRefUpdates(String errorPrefix, Collection<RemoteRefUpdate> refUpdates) {
for (RemoteRefUpdate refUpdate : refUpdates) {
RemoteRefUpdate.Status status = refUpdate.getStatus();
if (status == RemoteRefUpdate.Status.REJECTED_NODELETE ||
status == RemoteRefUpdate.Status.NON_EXISTING ||
status == RemoteRefUpdate.Status.NOT_ATTEMPTED ||
status == RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD ||
status == RemoteRefUpdate.Status.REJECTED_OTHER_REASON ||
status == RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) {
throw new BuildException(String.format("%s - Status '%s'", errorPrefix, status.name()));
}
}
} | [
"public",
"static",
"void",
"validateRemoteRefUpdates",
"(",
"String",
"errorPrefix",
",",
"Collection",
"<",
"RemoteRefUpdate",
">",
"refUpdates",
")",
"{",
"for",
"(",
"RemoteRefUpdate",
"refUpdate",
":",
"refUpdates",
")",
"{",
"RemoteRefUpdate",
".",
"Status",
... | Check references updates for any errors
@param errorPrefix The error prefix for any error message
@param refUpdates A collection of remote references updates | [
"Check",
"references",
"updates",
"for",
"any",
"errors"
] | train | https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/GitTaskUtils.java#L111-L124 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.allocate | public void allocate(long size) throws IOException, ServerException {
Command cmd = new Command("ALLO", String.valueOf(size));
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | java | public void allocate(long size) throws IOException, ServerException {
Command cmd = new Command("ALLO", String.valueOf(size));
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | [
"public",
"void",
"allocate",
"(",
"long",
"size",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"Command",
"cmd",
"=",
"new",
"Command",
"(",
"\"ALLO\"",
",",
"String",
".",
"valueOf",
"(",
"size",
")",
")",
";",
"Reply",
"reply",
"=",
"nul... | Reserve sufficient storage to accommodate the new file to be
transferred.
@param size the amount of space to reserve
@exception ServerException if an error occured. | [
"Reserve",
"sufficient",
"storage",
"to",
"accommodate",
"the",
"new",
"file",
"to",
"be",
"transferred",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1544-L1554 |
mgormley/optimize | src/main/java/edu/jhu/hlt/util/stats/Multinomials.java | Multinomials.assertLogNormalized | public static void assertLogNormalized(double[] logProps, double delta) {
double logPropSum = Vectors.logSum(logProps);
assert(Utilities.equals(0.0, logPropSum, delta));
} | java | public static void assertLogNormalized(double[] logProps, double delta) {
double logPropSum = Vectors.logSum(logProps);
assert(Utilities.equals(0.0, logPropSum, delta));
} | [
"public",
"static",
"void",
"assertLogNormalized",
"(",
"double",
"[",
"]",
"logProps",
",",
"double",
"delta",
")",
"{",
"double",
"logPropSum",
"=",
"Vectors",
".",
"logSum",
"(",
"logProps",
")",
";",
"assert",
"(",
"Utilities",
".",
"equals",
"(",
"0.0... | Asserts that the parameters are log-normalized within some delta. | [
"Asserts",
"that",
"the",
"parameters",
"are",
"log",
"-",
"normalized",
"within",
"some",
"delta",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/util/stats/Multinomials.java#L59-L62 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/ProjectServlet.java | ProjectServlet.handleFetchUserProjects | private void handleFetchUserProjects(final HttpServletRequest req, final Session session,
final ProjectManager manager, final HashMap<String, Object> ret)
throws ServletException {
User user = null;
// if key "user" is specified, follow this logic
if (hasParam(req, "user")) {
final String userParam = getParam(req, "user");
if (userParam.isEmpty()) {
user = session.getUser();
} else {
user = new User(userParam);
}
} else {
// if key "user" is not specified, default to the session user
user = session.getUser();
}
final List<Project> projects = manager.getUserProjects(user);
final List<SimplifiedProject> simplifiedProjects = toSimplifiedProjects(projects);
ret.put("projects", simplifiedProjects);
} | java | private void handleFetchUserProjects(final HttpServletRequest req, final Session session,
final ProjectManager manager, final HashMap<String, Object> ret)
throws ServletException {
User user = null;
// if key "user" is specified, follow this logic
if (hasParam(req, "user")) {
final String userParam = getParam(req, "user");
if (userParam.isEmpty()) {
user = session.getUser();
} else {
user = new User(userParam);
}
} else {
// if key "user" is not specified, default to the session user
user = session.getUser();
}
final List<Project> projects = manager.getUserProjects(user);
final List<SimplifiedProject> simplifiedProjects = toSimplifiedProjects(projects);
ret.put("projects", simplifiedProjects);
} | [
"private",
"void",
"handleFetchUserProjects",
"(",
"final",
"HttpServletRequest",
"req",
",",
"final",
"Session",
"session",
",",
"final",
"ProjectManager",
"manager",
",",
"final",
"HashMap",
"<",
"String",
",",
"Object",
">",
"ret",
")",
"throws",
"ServletExcept... | We know the intention of API call is to return project ownership based on given user. <br> If
user provides an user name, the method honors it <br> If user provides an empty user name, the
user defaults to the session user<br> If user does not provide the user param, the user also
defaults to the session user<br> | [
"We",
"know",
"the",
"intention",
"of",
"API",
"call",
"is",
"to",
"return",
"project",
"ownership",
"based",
"on",
"given",
"user",
".",
"<br",
">",
"If",
"user",
"provides",
"an",
"user",
"name",
"the",
"method",
"honors",
"it",
"<br",
">",
"If",
"us... | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/ProjectServlet.java#L113-L134 |
apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonObject.java | JsonObject.getLong | public Long getLong(String name, boolean strict) throws JsonException {
JsonElement el = get(name);
Long res = null;
if (strict && !el.isNumber()) {
throw Util.typeMismatch(name, el, "long", true);
}
if (el.isNumber()) {
res = el.asLong();
}
if (el.isString()) {
res = Util.toLong(el.asString());
}
if (res == null)
throw Util.typeMismatch(name, el, "long", strict);
return res;
} | java | public Long getLong(String name, boolean strict) throws JsonException {
JsonElement el = get(name);
Long res = null;
if (strict && !el.isNumber()) {
throw Util.typeMismatch(name, el, "long", true);
}
if (el.isNumber()) {
res = el.asLong();
}
if (el.isString()) {
res = Util.toLong(el.asString());
}
if (res == null)
throw Util.typeMismatch(name, el, "long", strict);
return res;
} | [
"public",
"Long",
"getLong",
"(",
"String",
"name",
",",
"boolean",
"strict",
")",
"throws",
"JsonException",
"{",
"JsonElement",
"el",
"=",
"get",
"(",
"name",
")",
";",
"Long",
"res",
"=",
"null",
";",
"if",
"(",
"strict",
"&&",
"!",
"el",
".",
"is... | Returns the value mapped by {@code name} if it exists and is a long or
can be coerced to a long, or throws otherwise.
Note that Util represents numbers as doubles,
so this is <a href="#lossy">lossy</a>; use strings to transfer numbers via Util.
@throws JsonException if the mapping doesn't exist or cannot be coerced
to a long. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{",
"@code",
"name",
"}",
"if",
"it",
"exists",
"and",
"is",
"a",
"long",
"or",
"can",
"be",
"coerced",
"to",
"a",
"long",
"or",
"throws",
"otherwise",
".",
"Note",
"that",
"Util",
"represents",
"numbers",
"a... | train | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L520-L535 |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.executeSyncMethod | @CheckForNull
private Object executeSyncMethod(Method method, Object[] args) throws ApplicationException {
if (preparingForShutdown.get()) {
throw new JoynrIllegalStateException("Preparing for shutdown. Only stateless methods can be called.");
}
return executeMethodWithCaller(method, args, new ConnectorCaller() {
@Override
public Object call(Method method, Object[] args) throws ApplicationException {
return connector.executeSyncMethod(method, args);
}
});
} | java | @CheckForNull
private Object executeSyncMethod(Method method, Object[] args) throws ApplicationException {
if (preparingForShutdown.get()) {
throw new JoynrIllegalStateException("Preparing for shutdown. Only stateless methods can be called.");
}
return executeMethodWithCaller(method, args, new ConnectorCaller() {
@Override
public Object call(Method method, Object[] args) throws ApplicationException {
return connector.executeSyncMethod(method, args);
}
});
} | [
"@",
"CheckForNull",
"private",
"Object",
"executeSyncMethod",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"preparingForShutdown",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"JoynrIllega... | executeSyncMethod is called whenever a method of the synchronous interface which is provided by the proxy is
called. The ProxyInvocationHandler will check the arbitration status before the call is delegated to the
connector. If the arbitration is still in progress the synchronous call will block until the arbitration was
successful or the timeout elapsed.
@throws ApplicationException
@see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) | [
"executeSyncMethod",
"is",
"called",
"whenever",
"a",
"method",
"of",
"the",
"synchronous",
"interface",
"which",
"is",
"provided",
"by",
"the",
"proxy",
"is",
"called",
".",
"The",
"ProxyInvocationHandler",
"will",
"check",
"the",
"arbitration",
"status",
"before... | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L143-L154 |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.addCacheControlAndEtagToResult | public static void addCacheControlAndEtagToResult(Result result, String etag, ApplicationConfiguration configuration) {
String maxAge = configuration.getWithDefault(HTTP_CACHE_CONTROL_MAX_AGE,
HTTP_CACHE_CONTROL_DEFAULT);
if ("0".equals(maxAge)) {
result.with(HeaderNames.CACHE_CONTROL, "no-cache");
} else {
result.with(HeaderNames.CACHE_CONTROL, "max-age=" + maxAge);
}
// Use etag on demand:
boolean useEtag = configuration.getBooleanWithDefault(HTTP_USE_ETAG,
HTTP_USE_ETAG_DEFAULT);
if (useEtag) {
result.with(HeaderNames.ETAG, etag);
}
} | java | public static void addCacheControlAndEtagToResult(Result result, String etag, ApplicationConfiguration configuration) {
String maxAge = configuration.getWithDefault(HTTP_CACHE_CONTROL_MAX_AGE,
HTTP_CACHE_CONTROL_DEFAULT);
if ("0".equals(maxAge)) {
result.with(HeaderNames.CACHE_CONTROL, "no-cache");
} else {
result.with(HeaderNames.CACHE_CONTROL, "max-age=" + maxAge);
}
// Use etag on demand:
boolean useEtag = configuration.getBooleanWithDefault(HTTP_USE_ETAG,
HTTP_USE_ETAG_DEFAULT);
if (useEtag) {
result.with(HeaderNames.ETAG, etag);
}
} | [
"public",
"static",
"void",
"addCacheControlAndEtagToResult",
"(",
"Result",
"result",
",",
"String",
"etag",
",",
"ApplicationConfiguration",
"configuration",
")",
"{",
"String",
"maxAge",
"=",
"configuration",
".",
"getWithDefault",
"(",
"HTTP_CACHE_CONTROL_MAX_AGE",
... | Adds cache control and etag to the given result.
@param result the result
@param etag the etag
@param configuration the application configuration | [
"Adds",
"cache",
"control",
"and",
"etag",
"to",
"the",
"given",
"result",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L127-L144 |
cdk/cdk | tool/charges/src/main/java/org/openscience/cdk/charges/Electronegativity.java | Electronegativity.calculateSigmaElectronegativity | public double calculateSigmaElectronegativity(IAtomContainer ac, IAtom atom) {
return calculateSigmaElectronegativity(ac, atom, maxI, maxRS);
} | java | public double calculateSigmaElectronegativity(IAtomContainer ac, IAtom atom) {
return calculateSigmaElectronegativity(ac, atom, maxI, maxRS);
} | [
"public",
"double",
"calculateSigmaElectronegativity",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"return",
"calculateSigmaElectronegativity",
"(",
"ac",
",",
"atom",
",",
"maxI",
",",
"maxRS",
")",
";",
"}"
] | calculate the electronegativity of orbitals sigma.
@param ac IAtomContainer
@param atom atom for which effective atom electronegativity should be calculated
@return piElectronegativity | [
"calculate",
"the",
"electronegativity",
"of",
"orbitals",
"sigma",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/Electronegativity.java#L78-L81 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java | MemoryManager.addWriter | synchronized void addWriter(final Path path,
final long requestedAllocation,
final Callback callback,
final long initialAllocation) throws IOException {
WriterInfo oldVal = writerList.get(path);
// this should always be null, but we handle the case where the memory
// manager wasn't told that a writer wasn't still in use and the task
// starts writing to the same path.
if (oldVal == null) {
LOG.info("Registering writer for path " + path.toString());
oldVal = new WriterInfo(requestedAllocation, callback);
writerList.put(path, oldVal);
totalAllocation += requestedAllocation;
} else {
// handle a new writer that is writing to the same path
totalAllocation += requestedAllocation - oldVal.allocation;
oldVal.setAllocation(requestedAllocation);
oldVal.setCallback(callback);
}
updateScale(true);
// If we're not already in low memory mode, and the initial allocation already exceeds the
// allocation, enter low memory mode to try to avoid an OOM
if (!lowMemoryMode && requestedAllocation * currentScale <= initialAllocation) {
lowMemoryMode = true;
LOG.info("ORC: Switching to low memory mode");
for (WriterInfo writer : writerList.values()) {
writer.callback.enterLowMemoryMode();
}
}
} | java | synchronized void addWriter(final Path path,
final long requestedAllocation,
final Callback callback,
final long initialAllocation) throws IOException {
WriterInfo oldVal = writerList.get(path);
// this should always be null, but we handle the case where the memory
// manager wasn't told that a writer wasn't still in use and the task
// starts writing to the same path.
if (oldVal == null) {
LOG.info("Registering writer for path " + path.toString());
oldVal = new WriterInfo(requestedAllocation, callback);
writerList.put(path, oldVal);
totalAllocation += requestedAllocation;
} else {
// handle a new writer that is writing to the same path
totalAllocation += requestedAllocation - oldVal.allocation;
oldVal.setAllocation(requestedAllocation);
oldVal.setCallback(callback);
}
updateScale(true);
// If we're not already in low memory mode, and the initial allocation already exceeds the
// allocation, enter low memory mode to try to avoid an OOM
if (!lowMemoryMode && requestedAllocation * currentScale <= initialAllocation) {
lowMemoryMode = true;
LOG.info("ORC: Switching to low memory mode");
for (WriterInfo writer : writerList.values()) {
writer.callback.enterLowMemoryMode();
}
}
} | [
"synchronized",
"void",
"addWriter",
"(",
"final",
"Path",
"path",
",",
"final",
"long",
"requestedAllocation",
",",
"final",
"Callback",
"callback",
",",
"final",
"long",
"initialAllocation",
")",
"throws",
"IOException",
"{",
"WriterInfo",
"oldVal",
"=",
"writer... | Add a new writer's memory allocation to the pool. We use the path
as a unique key to ensure that we don't get duplicates.
@param path the file that is being written
@param requestedAllocation the requested buffer size
@param initialAllocation the current size of the buffer | [
"Add",
"a",
"new",
"writer",
"s",
"memory",
"allocation",
"to",
"the",
"pool",
".",
"We",
"use",
"the",
"path",
"as",
"a",
"unique",
"key",
"to",
"ensure",
"that",
"we",
"don",
"t",
"get",
"duplicates",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java#L148-L178 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/filter/ExistsFilter.java | ExistsFilter.build | static <S extends Storable> Filter<S> build(ChainedProperty<S> property,
Filter<?> subFilter,
boolean not)
{
if (property == null) {
throw new IllegalArgumentException();
}
StorableProperty<?> joinProperty = property.getLastProperty();
if (subFilter == null) {
subFilter = Filter.getOpenFilter(joinProperty.getJoinedType());
} else if (joinProperty.getJoinedType() != subFilter.getStorableType()) {
throw new IllegalArgumentException
("Filter not compatible with join property type: " +
property + " joins to a " + joinProperty.getJoinedType().getName() +
", but filter is for a " + subFilter.getStorableType().getName());
}
if (subFilter.isClosed()) {
// Exists filter reduces to a closed (or open) filter.
Filter<S> f = Filter.getClosedFilter(property.getPrimeProperty().getEnclosingType());
return not ? f.not() : f;
} else if (joinProperty.isQuery() || subFilter.isOpen()) {
return getCanonical(property, subFilter, not);
} else {
// Convert to normal join filter.
return subFilter.asJoinedFrom(property);
}
} | java | static <S extends Storable> Filter<S> build(ChainedProperty<S> property,
Filter<?> subFilter,
boolean not)
{
if (property == null) {
throw new IllegalArgumentException();
}
StorableProperty<?> joinProperty = property.getLastProperty();
if (subFilter == null) {
subFilter = Filter.getOpenFilter(joinProperty.getJoinedType());
} else if (joinProperty.getJoinedType() != subFilter.getStorableType()) {
throw new IllegalArgumentException
("Filter not compatible with join property type: " +
property + " joins to a " + joinProperty.getJoinedType().getName() +
", but filter is for a " + subFilter.getStorableType().getName());
}
if (subFilter.isClosed()) {
// Exists filter reduces to a closed (or open) filter.
Filter<S> f = Filter.getClosedFilter(property.getPrimeProperty().getEnclosingType());
return not ? f.not() : f;
} else if (joinProperty.isQuery() || subFilter.isOpen()) {
return getCanonical(property, subFilter, not);
} else {
// Convert to normal join filter.
return subFilter.asJoinedFrom(property);
}
} | [
"static",
"<",
"S",
"extends",
"Storable",
">",
"Filter",
"<",
"S",
">",
"build",
"(",
"ChainedProperty",
"<",
"S",
">",
"property",
",",
"Filter",
"<",
"?",
">",
"subFilter",
",",
"boolean",
"not",
")",
"{",
"if",
"(",
"property",
"==",
"null",
")",... | Returns a canonical instance, creating a new one if there isn't one
already in the cache. | [
"Returns",
"a",
"canonical",
"instance",
"creating",
"a",
"new",
"one",
"if",
"there",
"isn",
"t",
"one",
"already",
"in",
"the",
"cache",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/ExistsFilter.java#L42-L71 |
threerings/nenya | core/src/main/java/com/threerings/media/sprite/SpriteManager.java | SpriteManager.getIntersectingSprites | public void getIntersectingSprites (List<Sprite> list, Shape shape)
{
int size = _sprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = _sprites.get(ii);
if (sprite.intersects(shape)) {
list.add(sprite);
}
}
} | java | public void getIntersectingSprites (List<Sprite> list, Shape shape)
{
int size = _sprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = _sprites.get(ii);
if (sprite.intersects(shape)) {
list.add(sprite);
}
}
} | [
"public",
"void",
"getIntersectingSprites",
"(",
"List",
"<",
"Sprite",
">",
"list",
",",
"Shape",
"shape",
")",
"{",
"int",
"size",
"=",
"_sprites",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"size",
";",
"ii",
... | When an animated view processes its dirty rectangles, it may require an expansion of the
dirty region which may in turn require the invalidation of more sprites than were originally
invalid. In such cases, the animated view can call back to the sprite manager, asking it to
append the sprites that intersect a particular region to the given list.
@param list the list to fill with any intersecting sprites.
@param shape the shape in which we have interest. | [
"When",
"an",
"animated",
"view",
"processes",
"its",
"dirty",
"rectangles",
"it",
"may",
"require",
"an",
"expansion",
"of",
"the",
"dirty",
"region",
"which",
"may",
"in",
"turn",
"require",
"the",
"invalidation",
"of",
"more",
"sprites",
"than",
"were",
"... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/SpriteManager.java#L50-L59 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.collaborate | public BoxCollaboration.Info collaborate(BoxCollaborator collaborator, BoxCollaboration.Role role) {
JsonObject accessibleByField = new JsonObject();
accessibleByField.add("id", collaborator.getID());
if (collaborator instanceof BoxUser) {
accessibleByField.add("type", "user");
} else if (collaborator instanceof BoxGroup) {
accessibleByField.add("type", "group");
} else {
throw new IllegalArgumentException("The given collaborator is of an unknown type.");
}
return this.collaborate(accessibleByField, role, null, null);
} | java | public BoxCollaboration.Info collaborate(BoxCollaborator collaborator, BoxCollaboration.Role role) {
JsonObject accessibleByField = new JsonObject();
accessibleByField.add("id", collaborator.getID());
if (collaborator instanceof BoxUser) {
accessibleByField.add("type", "user");
} else if (collaborator instanceof BoxGroup) {
accessibleByField.add("type", "group");
} else {
throw new IllegalArgumentException("The given collaborator is of an unknown type.");
}
return this.collaborate(accessibleByField, role, null, null);
} | [
"public",
"BoxCollaboration",
".",
"Info",
"collaborate",
"(",
"BoxCollaborator",
"collaborator",
",",
"BoxCollaboration",
".",
"Role",
"role",
")",
"{",
"JsonObject",
"accessibleByField",
"=",
"new",
"JsonObject",
"(",
")",
";",
"accessibleByField",
".",
"add",
"... | Adds a collaborator to this folder.
@param collaborator the collaborator to add.
@param role the role of the collaborator.
@return info about the new collaboration. | [
"Adds",
"a",
"collaborator",
"to",
"this",
"folder",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L137-L150 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.beginRevokeAccess | public void beginRevokeAccess(String resourceGroupName, String snapshotName) {
beginRevokeAccessWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body();
} | java | public void beginRevokeAccess(String resourceGroupName, String snapshotName) {
beginRevokeAccessWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body();
} | [
"public",
"void",
"beginRevokeAccess",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
")",
"{",
"beginRevokeAccessWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"snapshotName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
... | Revokes access to a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@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 | [
"Revokes",
"access",
"to",
"a",
"snapshot",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L1189-L1191 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java | OpenShiftManagedClustersInner.updateTagsAsync | public Observable<OpenShiftManagedClusterInner> updateTagsAsync(String resourceGroupName, String resourceName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() {
@Override
public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) {
return response.body();
}
});
} | java | public Observable<OpenShiftManagedClusterInner> updateTagsAsync(String resourceGroupName, String resourceName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() {
@Override
public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OpenShiftManagedClusterInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"map"... | Updates tags on an OpenShift managed cluster.
Updates an OpenShift managed cluster with the specified tags.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the OpenShift managed cluster resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"tags",
"on",
"an",
"OpenShift",
"managed",
"cluster",
".",
"Updates",
"an",
"OpenShift",
"managed",
"cluster",
"with",
"the",
"specified",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L646-L653 |
kiegroup/jbpm | jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java | TaskDataImpl.setOutput | public void setOutput(long outputContentId, ContentData outputContentData) {
setOutputContentId(outputContentId);
setOutputAccessType(outputContentData.getAccessType());
setOutputType(outputContentData.getType());
} | java | public void setOutput(long outputContentId, ContentData outputContentData) {
setOutputContentId(outputContentId);
setOutputAccessType(outputContentData.getAccessType());
setOutputType(outputContentData.getType());
} | [
"public",
"void",
"setOutput",
"(",
"long",
"outputContentId",
",",
"ContentData",
"outputContentData",
")",
"{",
"setOutputContentId",
"(",
"outputContentId",
")",
";",
"setOutputAccessType",
"(",
"outputContentData",
".",
"getAccessType",
"(",
")",
")",
";",
"setO... | Sets the content data for this task data. It will set the <field>outputContentId</field> from the specified
outputContentId, <field>outputAccessType</field>, <field>outputType</field> from the specified
outputContentData.
@param outputContentId id of output content
@param outputContentData contentData | [
"Sets",
"the",
"content",
"data",
"for",
"this",
"task",
"data",
".",
"It",
"will",
"set",
"the",
"<field",
">",
"outputContentId<",
"/",
"field",
">",
"from",
"the",
"specified",
"outputContentId",
"<field",
">",
"outputAccessType<",
"/",
"field",
">",
"<fi... | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L568-L572 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addDoubleValue | public Datapoint addDoubleValue(long time, double value) {
initialValues();
checkType(TsdbConstants.TYPE_DOUBLE);
values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new DoubleNode(value)));
return this;
} | java | public Datapoint addDoubleValue(long time, double value) {
initialValues();
checkType(TsdbConstants.TYPE_DOUBLE);
values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new DoubleNode(value)));
return this;
} | [
"public",
"Datapoint",
"addDoubleValue",
"(",
"long",
"time",
",",
"double",
"value",
")",
"{",
"initialValues",
"(",
")",
";",
"checkType",
"(",
"TsdbConstants",
".",
"TYPE_DOUBLE",
")",
";",
"values",
".",
"add",
"(",
"Lists",
".",
"<",
"JsonNode",
">",
... | Add datapoint of double type value.
@param time datapoint's timestamp
@param value datapoint's value
@return Datapoint | [
"Add",
"datapoint",
"of",
"double",
"type",
"value",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L125-L131 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonInfo | public PersonInfo getPersonInfo(int personId, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.APPEND, appendToResponse);
// Switch combined credits for tv & movie.
String atr = (String) parameters.get(Param.APPEND);
if (StringUtils.isNotBlank(atr) && atr.contains("combined_credits")) {
atr = atr.replace("combined_credits", "tv_credits,movie_credits");
parameters.add(Param.APPEND, atr);
}
URL url = new ApiUrl(apiKey, MethodBase.PERSON).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, PersonInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex);
}
} | java | public PersonInfo getPersonInfo(int personId, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.APPEND, appendToResponse);
// Switch combined credits for tv & movie.
String atr = (String) parameters.get(Param.APPEND);
if (StringUtils.isNotBlank(atr) && atr.contains("combined_credits")) {
atr = atr.replace("combined_credits", "tv_credits,movie_credits");
parameters.add(Param.APPEND, atr);
}
URL url = new ApiUrl(apiKey, MethodBase.PERSON).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, PersonInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex);
}
} | [
"public",
"PersonInfo",
"getPersonInfo",
"(",
"int",
"personId",
",",
"String",
"...",
"appendToResponse",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
... | Get the general person information for a specific id.
@param personId
@param appendToResponse
@return
@throws MovieDbException | [
"Get",
"the",
"general",
"person",
"information",
"for",
"a",
"specific",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L77-L97 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TETxLifeCycleInfo.java | TETxLifeCycleInfo.traceCommon | public static void traceCommon(int opType, String txId, String desc)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(TxLifeCycle_State_Type_Str).append(DataDelimiter)
.append(TxLifeCycle_State_Type).append(DataDelimiter)
.append(opType).append(DataDelimiter)
.append(txId).append(DataDelimiter)
.append(desc);
Tr.debug(tc, sbuf.toString());
}
} | java | public static void traceCommon(int opType, String txId, String desc)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(TxLifeCycle_State_Type_Str).append(DataDelimiter)
.append(TxLifeCycle_State_Type).append(DataDelimiter)
.append(opType).append(DataDelimiter)
.append(txId).append(DataDelimiter)
.append(desc);
Tr.debug(tc, sbuf.toString());
}
} | [
"public",
"static",
"void",
"traceCommon",
"(",
"int",
"opType",
",",
"String",
"txId",
",",
"String",
"desc",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuffer... | This is called by the EJB container server code to write a
common record to the trace log, if enabled. | [
"This",
"is",
"called",
"by",
"the",
"EJB",
"container",
"server",
"code",
"to",
"write",
"a",
"common",
"record",
"to",
"the",
"trace",
"log",
"if",
"enabled",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TETxLifeCycleInfo.java#L76-L91 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.parseDateStrictly | @GwtIncompatible("incompatible method")
public static Date parseDateStrictly(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, locale, parsePatterns, false);
} | java | @GwtIncompatible("incompatible method")
public static Date parseDateStrictly(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, locale, parsePatterns, false);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"Date",
"parseDateStrictly",
"(",
"final",
"String",
"str",
",",
"final",
"Locale",
"locale",
",",
"final",
"String",
"...",
"parsePatterns",
")",
"throws",
"ParseException",
"{",
"re... | <p>Parses a string representing a date by trying a variety of different parsers,
using the default date format symbols for the given locale..</p>
<p>The parse will try each parse pattern in turn.
A parse is only deemed successful if it parses the whole of the input string.
If no parse patterns match, a ParseException is thrown.</p>
The parser parses strictly - it does not allow for dates such as "February 942, 1996".
@param str the date to parse, not null
@param locale the locale whose date format symbols should be used. If <code>null</code>,
the system locale is used (as per {@link #parseDateStrictly(String, String...)}).
@param parsePatterns the date format patterns to use, see SimpleDateFormat, not null
@return the parsed date
@throws IllegalArgumentException if the date string or pattern array is null
@throws ParseException if none of the date patterns were suitable
@since 3.2 | [
"<p",
">",
"Parses",
"a",
"string",
"representing",
"a",
"date",
"by",
"trying",
"a",
"variety",
"of",
"different",
"parsers",
"using",
"the",
"default",
"date",
"format",
"symbols",
"for",
"the",
"given",
"locale",
"..",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L348-L351 |
pwheel/spring-security-oauth2-client | src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationEntryPoint.java | OAuth2AuthenticationEntryPoint.constructAdditionalAuthParameters | protected StringBuilder constructAdditionalAuthParameters(Map<String, String> additionalParameters) {
StringBuilder result = new StringBuilder();
if (additionalParameters != null &&
!additionalParameters.isEmpty()) {
for (Map.Entry<String, String> entry : additionalParameters.entrySet()) {
result.append("&")
.append(entry.getKey())
.append("=")
.append(entry.getValue());
}
}
return result;
} | java | protected StringBuilder constructAdditionalAuthParameters(Map<String, String> additionalParameters) {
StringBuilder result = new StringBuilder();
if (additionalParameters != null &&
!additionalParameters.isEmpty()) {
for (Map.Entry<String, String> entry : additionalParameters.entrySet()) {
result.append("&")
.append(entry.getKey())
.append("=")
.append(entry.getValue());
}
}
return result;
} | [
"protected",
"StringBuilder",
"constructAdditionalAuthParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"additionalParameters",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"additionalParameters",
"!=",
"null"... | Provided so that subclasses can override the default behaviour. Note that the recommended method to add
additional parameters is via {@link OAuth2ServiceProperties#setAdditionalAuthParams(java.util.Map)}.
Subclasses should never return null, as this was result in "null" being appended to the redirect uri
(see {@link StringBuilder#append(StringBuffer)}. Even if there are no additional parameters, return a
StringBuilder.
@param additionalParameters A Map of additional parameters to set.
@return A {@link StringBuilder} containing the additional parameters, if there are any. Do not return null. | [
"Provided",
"so",
"that",
"subclasses",
"can",
"override",
"the",
"default",
"behaviour",
".",
"Note",
"that",
"the",
"recommended",
"method",
"to",
"add",
"additional",
"parameters",
"is",
"via",
"{",
"@link",
"OAuth2ServiceProperties#setAdditionalAuthParams",
"(",
... | train | https://github.com/pwheel/spring-security-oauth2-client/blob/c0258823493e268495c9752c5d752f74c6809c6b/src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationEntryPoint.java#L83-L97 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java | AvatarStorageSetup.checkImageStorage | private static String checkImageStorage(URI sharedImage, URI sharedEdits) {
if (sharedImage.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
// shared image is stored in file storage
return "";
} else if (sharedImage.getScheme().equals(
QuorumJournalManager.QJM_URI_SCHEME)
&& sharedImage.equals(sharedEdits)) {
// image is stored in qjm together with edits
return "";
}
return "Shared image uri: " + sharedImage + " must be either file storage"
+ " or be equal to shared edits storage " + sharedEdits + ". ";
} | java | private static String checkImageStorage(URI sharedImage, URI sharedEdits) {
if (sharedImage.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
// shared image is stored in file storage
return "";
} else if (sharedImage.getScheme().equals(
QuorumJournalManager.QJM_URI_SCHEME)
&& sharedImage.equals(sharedEdits)) {
// image is stored in qjm together with edits
return "";
}
return "Shared image uri: " + sharedImage + " must be either file storage"
+ " or be equal to shared edits storage " + sharedEdits + ". ";
} | [
"private",
"static",
"String",
"checkImageStorage",
"(",
"URI",
"sharedImage",
",",
"URI",
"sharedEdits",
")",
"{",
"if",
"(",
"sharedImage",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"NNStorage",
".",
"LOCAL_URI_SCHEME",
")",
")",
"{",
"// shared image ... | Shared image needs to be in file storage, or QJM providing that QJM also
stores edits. | [
"Shared",
"image",
"needs",
"to",
"be",
"in",
"file",
"storage",
"or",
"QJM",
"providing",
"that",
"QJM",
"also",
"stores",
"edits",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java#L123-L135 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.writeObjectToFileNoExceptions | public static File writeObjectToFileNoExceptions(Object o, String filename) {
File file = null;
ObjectOutputStream oos = null;
try {
file = new File(filename);
// file.createNewFile(); // cdm may 2005: does nothing needed
oos = new ObjectOutputStream(new BufferedOutputStream(
new GZIPOutputStream(new FileOutputStream(file))));
oos.writeObject(o);
oos.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeIgnoringExceptions(oos);
}
return file;
} | java | public static File writeObjectToFileNoExceptions(Object o, String filename) {
File file = null;
ObjectOutputStream oos = null;
try {
file = new File(filename);
// file.createNewFile(); // cdm may 2005: does nothing needed
oos = new ObjectOutputStream(new BufferedOutputStream(
new GZIPOutputStream(new FileOutputStream(file))));
oos.writeObject(o);
oos.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeIgnoringExceptions(oos);
}
return file;
} | [
"public",
"static",
"File",
"writeObjectToFileNoExceptions",
"(",
"Object",
"o",
",",
"String",
"filename",
")",
"{",
"File",
"file",
"=",
"null",
";",
"ObjectOutputStream",
"oos",
"=",
"null",
";",
"try",
"{",
"file",
"=",
"new",
"File",
"(",
"filename",
... | Write object to a file with the specified name.
@param o
object to be written to file
@param filename
name of the temp file
@return File containing the object, or null if an exception was caught | [
"Write",
"object",
"to",
"a",
"file",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L95-L111 |
Tourenathan-G5organisation/SiliCompressor | silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java | SiliCompressor.getCompressBitmap | public Bitmap getCompressBitmap(String imagePath, boolean deleteSourceImage) throws IOException {
File imageFile = new File(compressImage(imagePath, new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Silicompressor/images")));
Uri newImageUri = FileProvider.getUriForFile(mContext, FILE_PROVIDER_AUTHORITY, imageFile);
Bitmap bitmap = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), newImageUri);
if (deleteSourceImage) {
boolean isdeleted = deleteImageFile(imagePath);
Log.d(LOG_TAG, (isdeleted) ? "Source image file deleted" : "Error: Source image file not deleted.");
}
// Delete the file created during the image compression
deleteImageFile(imageFile.getAbsolutePath());
// Return the required bitmap
return bitmap;
} | java | public Bitmap getCompressBitmap(String imagePath, boolean deleteSourceImage) throws IOException {
File imageFile = new File(compressImage(imagePath, new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Silicompressor/images")));
Uri newImageUri = FileProvider.getUriForFile(mContext, FILE_PROVIDER_AUTHORITY, imageFile);
Bitmap bitmap = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), newImageUri);
if (deleteSourceImage) {
boolean isdeleted = deleteImageFile(imagePath);
Log.d(LOG_TAG, (isdeleted) ? "Source image file deleted" : "Error: Source image file not deleted.");
}
// Delete the file created during the image compression
deleteImageFile(imageFile.getAbsolutePath());
// Return the required bitmap
return bitmap;
} | [
"public",
"Bitmap",
"getCompressBitmap",
"(",
"String",
"imagePath",
",",
"boolean",
"deleteSourceImage",
")",
"throws",
"IOException",
"{",
"File",
"imageFile",
"=",
"new",
"File",
"(",
"compressImage",
"(",
"imagePath",
",",
"new",
"File",
"(",
"Environment",
... | Compress the image at with the specified path and return the bitmap data of the compressed image.
@param imagePath The path of the image file you wish to compress.
@param deleteSourceImage If True will delete the source file
@return Compress image bitmap
@throws IOException | [
"Compress",
"the",
"image",
"at",
"with",
"the",
"specified",
"path",
"and",
"return",
"the",
"bitmap",
"data",
"of",
"the",
"compressed",
"image",
"."
] | train | https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L161-L178 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/nvrtc/JNvrtc.java | JNvrtc.nvrtcCompileProgram | public static int nvrtcCompileProgram(nvrtcProgram prog,
int numOptions, String options[])
{
return checkResult(nvrtcCompileProgramNative(
prog, numOptions, options));
} | java | public static int nvrtcCompileProgram(nvrtcProgram prog,
int numOptions, String options[])
{
return checkResult(nvrtcCompileProgramNative(
prog, numOptions, options));
} | [
"public",
"static",
"int",
"nvrtcCompileProgram",
"(",
"nvrtcProgram",
"prog",
",",
"int",
"numOptions",
",",
"String",
"options",
"[",
"]",
")",
"{",
"return",
"checkResult",
"(",
"nvrtcCompileProgramNative",
"(",
"prog",
",",
"numOptions",
",",
"options",
")",... | Compiles the given program. See the
<a href="http://docs.nvidia.com/cuda/nvrtc/index.html#group__options"
target="_blank">Supported Compile Options (external site)</a>
@param prog CUDA Runtime Compilation program.
@param numOptions The number of options
@param options The options
@return An error code | [
"Compiles",
"the",
"given",
"program",
".",
"See",
"the",
"<a",
"href",
"=",
"http",
":",
"//",
"docs",
".",
"nvidia",
".",
"com",
"/",
"cuda",
"/",
"nvrtc",
"/",
"index",
".",
"html#group__options",
"target",
"=",
"_blank",
">",
"Supported",
"Compile",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/nvrtc/JNvrtc.java#L204-L209 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.getSubscriptionWorker | public SubscriptionWorker<ObjectNode> getSubscriptionWorker(String subscriptionName, String database) {
return getSubscriptionWorker(ObjectNode.class, subscriptionName, database);
} | java | public SubscriptionWorker<ObjectNode> getSubscriptionWorker(String subscriptionName, String database) {
return getSubscriptionWorker(ObjectNode.class, subscriptionName, database);
} | [
"public",
"SubscriptionWorker",
"<",
"ObjectNode",
">",
"getSubscriptionWorker",
"(",
"String",
"subscriptionName",
",",
"String",
"database",
")",
"{",
"return",
"getSubscriptionWorker",
"(",
"ObjectNode",
".",
"class",
",",
"subscriptionName",
",",
"database",
")",
... | It opens a subscription and starts pulling documents since a last processed document for that subscription.
The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client
needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers.
There can be only a single client that is connected to a subscription.
@param subscriptionName The name of subscription
@param database Target database
@return Subscription object that allows to add/remove subscription handlers. | [
"It",
"opens",
"a",
"subscription",
"and",
"starts",
"pulling",
"documents",
"since",
"a",
"last",
"processed",
"document",
"for",
"that",
"subscription",
".",
"The",
"connection",
"options",
"determine",
"client",
"and",
"server",
"cooperation",
"rules",
"like",
... | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L194-L196 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/api/ProjectServiceV1.java | ProjectServiceV1.patchProject | @Consumes("application/json-patch+json")
@Patch("/projects/{projectName}")
@RequiresAdministrator
public CompletableFuture<ProjectDto> patchProject(@Param("projectName") String projectName,
JsonNode node,
Author author) {
checkUnremoveArgument(node);
// Restore the project first then update its metadata as 'active'.
return execute(Command.unremoveProject(author, projectName))
.thenCompose(unused -> mds.restoreProject(author, projectName))
.handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(projectName))));
} | java | @Consumes("application/json-patch+json")
@Patch("/projects/{projectName}")
@RequiresAdministrator
public CompletableFuture<ProjectDto> patchProject(@Param("projectName") String projectName,
JsonNode node,
Author author) {
checkUnremoveArgument(node);
// Restore the project first then update its metadata as 'active'.
return execute(Command.unremoveProject(author, projectName))
.thenCompose(unused -> mds.restoreProject(author, projectName))
.handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(projectName))));
} | [
"@",
"Consumes",
"(",
"\"application/json-patch+json\"",
")",
"@",
"Patch",
"(",
"\"/projects/{projectName}\"",
")",
"@",
"RequiresAdministrator",
"public",
"CompletableFuture",
"<",
"ProjectDto",
">",
"patchProject",
"(",
"@",
"Param",
"(",
"\"projectName\"",
")",
"S... | PATCH /projects/{projectName}
<p>Patches a project with the JSON_PATCH. Currently, only unremove project operation is supported. | [
"PATCH",
"/",
"projects",
"/",
"{",
"projectName",
"}"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/ProjectServiceV1.java#L136-L147 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/ngmf/ui/TableListener.java | TableListener.parseString | private ArrayList<ArrayList<String>> parseString(String text) {
ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
StringTokenizer linetoken = new StringTokenizer(text, "\n");
StringTokenizer token;
String current;
while (linetoken.hasMoreTokens()) {
current = linetoken.nextToken();
if (current.contains(",")) {
token = new StringTokenizer(current, ",");
} else {
token = new StringTokenizer(current);
}
ArrayList<String> line = new ArrayList<String>();
while (token.hasMoreTokens()) {
line.add(token.nextToken());
}
result.add(line);
}
return result;
} | java | private ArrayList<ArrayList<String>> parseString(String text) {
ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
StringTokenizer linetoken = new StringTokenizer(text, "\n");
StringTokenizer token;
String current;
while (linetoken.hasMoreTokens()) {
current = linetoken.nextToken();
if (current.contains(",")) {
token = new StringTokenizer(current, ",");
} else {
token = new StringTokenizer(current);
}
ArrayList<String> line = new ArrayList<String>();
while (token.hasMoreTokens()) {
line.add(token.nextToken());
}
result.add(line);
}
return result;
} | [
"private",
"ArrayList",
"<",
"ArrayList",
"<",
"String",
">",
">",
"parseString",
"(",
"String",
"text",
")",
"{",
"ArrayList",
"<",
"ArrayList",
"<",
"String",
">>",
"result",
"=",
"new",
"ArrayList",
"<",
"ArrayList",
"<",
"String",
">",
">",
"(",
")",... | turns the clipboard into a list of tokens
each array list is a line, each string in the list is a token in the line
@param text
@return | [
"turns",
"the",
"clipboard",
"into",
"a",
"list",
"of",
"tokens",
"each",
"array",
"list",
"is",
"a",
"line",
"each",
"string",
"in",
"the",
"list",
"is",
"a",
"token",
"in",
"the",
"line"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/ui/TableListener.java#L41-L61 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java | IdemixUtils.modAdd | static BIG modAdd(BIG a, BIG b, BIG m) {
BIG c = a.plus(b);
c.mod(m);
return c;
} | java | static BIG modAdd(BIG a, BIG b, BIG m) {
BIG c = a.plus(b);
c.mod(m);
return c;
} | [
"static",
"BIG",
"modAdd",
"(",
"BIG",
"a",
",",
"BIG",
"b",
",",
"BIG",
"m",
")",
"{",
"BIG",
"c",
"=",
"a",
".",
"plus",
"(",
"b",
")",
";",
"c",
".",
"mod",
"(",
"m",
")",
";",
"return",
"c",
";",
"}"
] | Takes input BIGs a, b, m and returns a+b modulo m
@param a the first BIG to add
@param b the second BIG to add
@param m the modulus
@return Returns a+b (mod m) | [
"Takes",
"input",
"BIGs",
"a",
"b",
"m",
"and",
"returns",
"a",
"+",
"b",
"modulo",
"m"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java#L258-L262 |
google/gson | gson/src/main/java/com/google/gson/JsonParser.java | JsonParser.parseReader | public static JsonElement parseReader(JsonReader reader)
throws JsonIOException, JsonSyntaxException {
boolean lenient = reader.isLenient();
reader.setLenient(true);
try {
return Streams.parse(reader);
} catch (StackOverflowError e) {
throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e);
} catch (OutOfMemoryError e) {
throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e);
} finally {
reader.setLenient(lenient);
}
} | java | public static JsonElement parseReader(JsonReader reader)
throws JsonIOException, JsonSyntaxException {
boolean lenient = reader.isLenient();
reader.setLenient(true);
try {
return Streams.parse(reader);
} catch (StackOverflowError e) {
throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e);
} catch (OutOfMemoryError e) {
throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e);
} finally {
reader.setLenient(lenient);
}
} | [
"public",
"static",
"JsonElement",
"parseReader",
"(",
"JsonReader",
"reader",
")",
"throws",
"JsonIOException",
",",
"JsonSyntaxException",
"{",
"boolean",
"lenient",
"=",
"reader",
".",
"isLenient",
"(",
")",
";",
"reader",
".",
"setLenient",
"(",
"true",
")",... | Returns the next value from the JSON stream as a parse tree.
@throws JsonParseException if there is an IOException or if the specified
text is not valid JSON | [
"Returns",
"the",
"next",
"value",
"from",
"the",
"JSON",
"stream",
"as",
"a",
"parse",
"tree",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/JsonParser.java#L80-L93 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java | DataStreamUtils.collect | public static <OUT> Iterator<OUT> collect(DataStream<OUT> stream) throws IOException {
TypeSerializer<OUT> serializer = stream.getType().createSerializer(
stream.getExecutionEnvironment().getConfig());
SocketStreamIterator<OUT> iter = new SocketStreamIterator<OUT>(serializer);
//Find out what IP of us should be given to CollectSink, that it will be able to connect to
StreamExecutionEnvironment env = stream.getExecutionEnvironment();
InetAddress clientAddress;
if (env instanceof RemoteStreamEnvironment) {
String host = ((RemoteStreamEnvironment) env).getHost();
int port = ((RemoteStreamEnvironment) env).getPort();
try {
clientAddress = ConnectionUtils.findConnectingAddress(new InetSocketAddress(host, port), 2000, 400);
}
catch (Exception e) {
throw new IOException("Could not determine an suitable network address to " +
"receive back data from the streaming program.", e);
}
} else if (env instanceof LocalStreamEnvironment) {
clientAddress = InetAddress.getLoopbackAddress();
} else {
try {
clientAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw new IOException("Could not determine this machines own local address to " +
"receive back data from the streaming program.", e);
}
}
DataStreamSink<OUT> sink = stream.addSink(new CollectSink<OUT>(clientAddress, iter.getPort(), serializer));
sink.setParallelism(1); // It would not work if multiple instances would connect to the same port
(new CallExecute(env, iter)).start();
return iter;
} | java | public static <OUT> Iterator<OUT> collect(DataStream<OUT> stream) throws IOException {
TypeSerializer<OUT> serializer = stream.getType().createSerializer(
stream.getExecutionEnvironment().getConfig());
SocketStreamIterator<OUT> iter = new SocketStreamIterator<OUT>(serializer);
//Find out what IP of us should be given to CollectSink, that it will be able to connect to
StreamExecutionEnvironment env = stream.getExecutionEnvironment();
InetAddress clientAddress;
if (env instanceof RemoteStreamEnvironment) {
String host = ((RemoteStreamEnvironment) env).getHost();
int port = ((RemoteStreamEnvironment) env).getPort();
try {
clientAddress = ConnectionUtils.findConnectingAddress(new InetSocketAddress(host, port), 2000, 400);
}
catch (Exception e) {
throw new IOException("Could not determine an suitable network address to " +
"receive back data from the streaming program.", e);
}
} else if (env instanceof LocalStreamEnvironment) {
clientAddress = InetAddress.getLoopbackAddress();
} else {
try {
clientAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw new IOException("Could not determine this machines own local address to " +
"receive back data from the streaming program.", e);
}
}
DataStreamSink<OUT> sink = stream.addSink(new CollectSink<OUT>(clientAddress, iter.getPort(), serializer));
sink.setParallelism(1); // It would not work if multiple instances would connect to the same port
(new CallExecute(env, iter)).start();
return iter;
} | [
"public",
"static",
"<",
"OUT",
">",
"Iterator",
"<",
"OUT",
">",
"collect",
"(",
"DataStream",
"<",
"OUT",
">",
"stream",
")",
"throws",
"IOException",
"{",
"TypeSerializer",
"<",
"OUT",
">",
"serializer",
"=",
"stream",
".",
"getType",
"(",
")",
".",
... | Returns an iterator to iterate over the elements of the DataStream.
@return The iterator | [
"Returns",
"an",
"iterator",
"to",
"iterate",
"over",
"the",
"elements",
"of",
"the",
"DataStream",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java#L50-L88 |
javagl/ND | nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java | IntTuples.of | public static MutableIntTuple of(int x, int y, int z, int w)
{
return new DefaultIntTuple(new int[]{ x, y, z, w });
} | java | public static MutableIntTuple of(int x, int y, int z, int w)
{
return new DefaultIntTuple(new int[]{ x, y, z, w });
} | [
"public",
"static",
"MutableIntTuple",
"of",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"z",
",",
"int",
"w",
")",
"{",
"return",
"new",
"DefaultIntTuple",
"(",
"new",
"int",
"[",
"]",
"{",
"x",
",",
"y",
",",
"z",
",",
"w",
"}",
")",
";",
... | Creates a new {@link MutableIntTuple} with the given values.
@param x The x coordinate
@param y The y coordinate
@param z The z coordinate
@param w The w coordinate
@return The new tuple | [
"Creates",
"a",
"new",
"{",
"@link",
"MutableIntTuple",
"}",
"with",
"the",
"given",
"values",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java#L1510-L1513 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/InventoryIdUtil.java | InventoryIdUtil.parseResourceId | public static ResourceIdParts parseResourceId(String resourceId) {
if (resourceId == null) {
throw new IllegalArgumentException("Invalid resource ID - cannot be null");
}
String[] parts = resourceId.split("~", 3);
if (parts.length != 3) {
throw new IllegalArgumentException("Cannot parse invalid ID: " + resourceId);
}
return new ResourceIdParts(parts[0], parts[1], parts[2]);
} | java | public static ResourceIdParts parseResourceId(String resourceId) {
if (resourceId == null) {
throw new IllegalArgumentException("Invalid resource ID - cannot be null");
}
String[] parts = resourceId.split("~", 3);
if (parts.length != 3) {
throw new IllegalArgumentException("Cannot parse invalid ID: " + resourceId);
}
return new ResourceIdParts(parts[0], parts[1], parts[2]);
} | [
"public",
"static",
"ResourceIdParts",
"parseResourceId",
"(",
"String",
"resourceId",
")",
"{",
"if",
"(",
"resourceId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid resource ID - cannot be null\"",
")",
";",
"}",
"String",
"[... | Given a resource ID generated via {@link InventoryIdUtil#generateResourceId}
this returns the different parts that make up that resource ID.
@param resourceId the full resource ID to be parsed
@return the parts of the resource ID | [
"Given",
"a",
"resource",
"ID",
"generated",
"via",
"{",
"@link",
"InventoryIdUtil#generateResourceId",
"}",
"this",
"returns",
"the",
"different",
"parts",
"that",
"make",
"up",
"that",
"resource",
"ID",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/InventoryIdUtil.java#L59-L69 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java | PersistentContext.doWithoutTransaction | public <T> T doWithoutTransaction(final SpecificTxAction<T, C> action) {
checkNotx();
return template.doInTransaction(new TxConfig(OTransaction.TXTYPE.NOTX), action);
} | java | public <T> T doWithoutTransaction(final SpecificTxAction<T, C> action) {
checkNotx();
return template.doInTransaction(new TxConfig(OTransaction.TXTYPE.NOTX), action);
} | [
"public",
"<",
"T",
">",
"T",
"doWithoutTransaction",
"(",
"final",
"SpecificTxAction",
"<",
"T",
",",
"C",
">",
"action",
")",
"{",
"checkNotx",
"(",
")",
";",
"return",
"template",
".",
"doInTransaction",
"(",
"new",
"TxConfig",
"(",
"OTransaction",
".",... | Execute action without transaction.
<p>
NOTE: If normal transaction already started, error will be thrown to prevent confusion
(direct call to template will ignore notx config in case of ongoing transaction, so this call is safer)
@param action action to execute within transaction (new or ongoing)
@param <T> expected return type
@return value produced by action
@see ru.vyarus.guice.persist.orient.db.transaction.template.SpecificTxTemplate | [
"Execute",
"action",
"without",
"transaction",
".",
"<p",
">",
"NOTE",
":",
"If",
"normal",
"transaction",
"already",
"started",
"error",
"will",
"be",
"thrown",
"to",
"prevent",
"confusion",
"(",
"direct",
"call",
"to",
"template",
"will",
"ignore",
"notx",
... | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java#L161-L164 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java | LockSupport.parkUntil | public static void parkUntil(Object blocker, long deadline) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(true, deadline);
setBlocker(t, null);
} | java | public static void parkUntil(Object blocker, long deadline) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(true, deadline);
setBlocker(t, null);
} | [
"public",
"static",
"void",
"parkUntil",
"(",
"Object",
"blocker",
",",
"long",
"deadline",
")",
"{",
"Thread",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"setBlocker",
"(",
"t",
",",
"blocker",
")",
";",
"U",
".",
"park",
"(",
"true",
... | Disables the current thread for thread scheduling purposes, until
the specified deadline, unless the permit is available.
<p>If the permit is available then it is consumed and the call
returns immediately; otherwise the current thread becomes disabled
for thread scheduling purposes and lies dormant until one of four
things happens:
<ul>
<li>Some other thread invokes {@link #unpark unpark} with the
current thread as the target; or
<li>Some other thread {@linkplain Thread#interrupt interrupts} the
current thread; or
<li>The specified deadline passes; or
<li>The call spuriously (that is, for no reason) returns.
</ul>
<p>This method does <em>not</em> report which of these caused the
method to return. Callers should re-check the conditions which caused
the thread to park in the first place. Callers may also determine,
for example, the interrupt status of the thread, or the current time
upon return.
@param blocker the synchronization object responsible for this
thread parking
@param deadline the absolute time, in milliseconds from the Epoch,
to wait until
@since 1.6 | [
"Disables",
"the",
"current",
"thread",
"for",
"thread",
"scheduling",
"purposes",
"until",
"the",
"specified",
"deadline",
"unless",
"the",
"permit",
"is",
"available",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java#L271-L276 |
google/identity-toolkit-java-client | src/main/java/com/google/identitytoolkit/GitkitClient.java | GitkitClient.getOobResponse | public OobResponse getOobResponse(HttpServletRequest req, String gitkitToken)
throws GitkitServerException {
try {
String action = req.getParameter("action");
if ("resetPassword".equals(action)) {
String oobLink = buildOobLink(buildPasswordResetRequest(req), action);
return new OobResponse(
req.getParameter("email"),
null,
oobLink,
OobAction.RESET_PASSWORD);
} else if ("changeEmail".equals(action)) {
if (gitkitToken == null) {
return new OobResponse("login is required");
} else {
String oobLink = buildOobLink(buildChangeEmailRequest(req, gitkitToken), action);
return new OobResponse(
req.getParameter("oldEmail"),
req.getParameter("newEmail"),
oobLink,
OobAction.CHANGE_EMAIL);
}
} else {
return new OobResponse("unknown request");
}
} catch (GitkitClientException e) {
return new OobResponse(e.getMessage());
}
} | java | public OobResponse getOobResponse(HttpServletRequest req, String gitkitToken)
throws GitkitServerException {
try {
String action = req.getParameter("action");
if ("resetPassword".equals(action)) {
String oobLink = buildOobLink(buildPasswordResetRequest(req), action);
return new OobResponse(
req.getParameter("email"),
null,
oobLink,
OobAction.RESET_PASSWORD);
} else if ("changeEmail".equals(action)) {
if (gitkitToken == null) {
return new OobResponse("login is required");
} else {
String oobLink = buildOobLink(buildChangeEmailRequest(req, gitkitToken), action);
return new OobResponse(
req.getParameter("oldEmail"),
req.getParameter("newEmail"),
oobLink,
OobAction.CHANGE_EMAIL);
}
} else {
return new OobResponse("unknown request");
}
} catch (GitkitClientException e) {
return new OobResponse(e.getMessage());
}
} | [
"public",
"OobResponse",
"getOobResponse",
"(",
"HttpServletRequest",
"req",
",",
"String",
"gitkitToken",
")",
"throws",
"GitkitServerException",
"{",
"try",
"{",
"String",
"action",
"=",
"req",
".",
"getParameter",
"(",
"\"action\"",
")",
";",
"if",
"(",
"\"re... | Gets out-of-band response. Used by oob endpoint for ResetPassword and ChangeEmail operation.
The web site needs to send user an email containing the oobUrl in the response. The user needs
to click the oobUrl to finish the operation.
@param req http request for the oob endpoint
@param gitkitToken Gitkit token of authenticated user, required for ChangeEmail operation
@return the oob response.
@throws GitkitServerException | [
"Gets",
"out",
"-",
"of",
"-",
"band",
"response",
".",
"Used",
"by",
"oob",
"endpoint",
"for",
"ResetPassword",
"and",
"ChangeEmail",
"operation",
".",
"The",
"web",
"site",
"needs",
"to",
"send",
"user",
"an",
"email",
"containing",
"the",
"oobUrl",
"in"... | train | https://github.com/google/identity-toolkit-java-client/blob/61dda1aabbd541ad5e431e840fd266bfca5f8a4a/src/main/java/com/google/identitytoolkit/GitkitClient.java#L460-L488 |
alkacon/opencms-core | src/org/opencms/file/collectors/A_CmsResourceCollector.java | A_CmsResourceCollector.getCreateInFolder | protected String getCreateInFolder(CmsObject cms, String param) throws CmsException {
return getCreateInFolder(cms, new CmsCollectorData(param));
} | java | protected String getCreateInFolder(CmsObject cms, String param) throws CmsException {
return getCreateInFolder(cms, new CmsCollectorData(param));
} | [
"protected",
"String",
"getCreateInFolder",
"(",
"CmsObject",
"cms",
",",
"String",
"param",
")",
"throws",
"CmsException",
"{",
"return",
"getCreateInFolder",
"(",
"cms",
",",
"new",
"CmsCollectorData",
"(",
"param",
")",
")",
";",
"}"
] | Returns the link to create a new XML content item in the folder pointed to by the parameter.<p>
@param cms the current CmsObject
@param param the folder name to use
@return the link to create a new XML content item in the folder
@throws CmsException if something goes wrong | [
"Returns",
"the",
"link",
"to",
"create",
"a",
"new",
"XML",
"content",
"item",
"in",
"the",
"folder",
"pointed",
"to",
"by",
"the",
"parameter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/A_CmsResourceCollector.java#L398-L401 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java | Assertions.assertAmong | @SafeVarargs
@Nullable
public static <T> T assertAmong(@Nullable T obj, @MayContainNull @Nonnull final T... list) {
if (obj == null) {
for (final T i : assertNotNull(list)) {
if (i == null) {
return i;
}
}
} else {
final int objHash = obj.hashCode();
for (final T i : assertNotNull(list)) {
if (obj == i || (i != null && objHash == i.hashCode() && obj.equals(i))) {
return i;
}
}
}
final AssertionError error = new AssertionError("Object is not found among elements");
MetaErrorListeners.fireError("Asserion error", error);
throw error;
} | java | @SafeVarargs
@Nullable
public static <T> T assertAmong(@Nullable T obj, @MayContainNull @Nonnull final T... list) {
if (obj == null) {
for (final T i : assertNotNull(list)) {
if (i == null) {
return i;
}
}
} else {
final int objHash = obj.hashCode();
for (final T i : assertNotNull(list)) {
if (obj == i || (i != null && objHash == i.hashCode() && obj.equals(i))) {
return i;
}
}
}
final AssertionError error = new AssertionError("Object is not found among elements");
MetaErrorListeners.fireError("Asserion error", error);
throw error;
} | [
"@",
"SafeVarargs",
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"assertAmong",
"(",
"@",
"Nullable",
"T",
"obj",
",",
"@",
"MayContainNull",
"@",
"Nonnull",
"final",
"T",
"...",
"list",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",... | Check that object is presented among provided elements and replace the object by equal element from the list.
@param <T> type of object
@param obj object to be checked
@param list list of elements for checking
@return equal element provided in the list
@throws AssertionError if object is not found among defined ones
@since 1.0.2 | [
"Check",
"that",
"object",
"is",
"presented",
"among",
"provided",
"elements",
"and",
"replace",
"the",
"object",
"by",
"equal",
"element",
"from",
"the",
"list",
"."
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L259-L279 |
apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/roundrobin/RoundRobinPacking.java | RoundRobinPacking.getRoundRobinAllocation | private Map<Integer, List<InstanceId>> getRoundRobinAllocation(
int numContainer, Map<String, Integer> parallelismMap) {
Map<Integer, List<InstanceId>> allocation = new HashMap<>();
int totalInstance = TopologyUtils.getTotalInstance(parallelismMap);
if (numContainer < 1) {
throw new RuntimeException(String.format("Invlaid number of container: %d", numContainer));
} else if (numContainer > totalInstance) {
throw new RuntimeException(
String.format("More containers (%d) allocated than instances (%d).",
numContainer, totalInstance));
}
for (int i = 1; i <= numContainer; ++i) {
allocation.put(i, new ArrayList<>());
}
int index = 1;
int globalTaskIndex = 1;
// To ensure we spread out the big instances first
// Only sorting by RAM here because only RAM can be explicitly capped by JVM processes
List<String> sortedInstances = getSortedRAMComponents(parallelismMap.keySet()).stream()
.map(ResourceRequirement::getComponentName).collect(Collectors.toList());
for (String component : sortedInstances) {
int numInstance = parallelismMap.get(component);
for (int i = 0; i < numInstance; ++i) {
allocation.get(index).add(new InstanceId(component, globalTaskIndex, i));
index = (index == numContainer) ? 1 : index + 1;
globalTaskIndex++;
}
}
return allocation;
} | java | private Map<Integer, List<InstanceId>> getRoundRobinAllocation(
int numContainer, Map<String, Integer> parallelismMap) {
Map<Integer, List<InstanceId>> allocation = new HashMap<>();
int totalInstance = TopologyUtils.getTotalInstance(parallelismMap);
if (numContainer < 1) {
throw new RuntimeException(String.format("Invlaid number of container: %d", numContainer));
} else if (numContainer > totalInstance) {
throw new RuntimeException(
String.format("More containers (%d) allocated than instances (%d).",
numContainer, totalInstance));
}
for (int i = 1; i <= numContainer; ++i) {
allocation.put(i, new ArrayList<>());
}
int index = 1;
int globalTaskIndex = 1;
// To ensure we spread out the big instances first
// Only sorting by RAM here because only RAM can be explicitly capped by JVM processes
List<String> sortedInstances = getSortedRAMComponents(parallelismMap.keySet()).stream()
.map(ResourceRequirement::getComponentName).collect(Collectors.toList());
for (String component : sortedInstances) {
int numInstance = parallelismMap.get(component);
for (int i = 0; i < numInstance; ++i) {
allocation.get(index).add(new InstanceId(component, globalTaskIndex, i));
index = (index == numContainer) ? 1 : index + 1;
globalTaskIndex++;
}
}
return allocation;
} | [
"private",
"Map",
"<",
"Integer",
",",
"List",
"<",
"InstanceId",
">",
">",
"getRoundRobinAllocation",
"(",
"int",
"numContainer",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"parallelismMap",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Instanc... | Get the instances' allocation basing on round robin algorithm
@return containerId -> list of InstanceId belonging to this container | [
"Get",
"the",
"instances",
"allocation",
"basing",
"on",
"round",
"robin",
"algorithm"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/roundrobin/RoundRobinPacking.java#L363-L395 |
arquillian/arquillian-algeron | common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java | GitOperations.pushToRepository | public Iterable<PushResult> pushToRepository(Git git, String remote, String username, String password) {
try {
return git.push()
.setRemote(remote)
.setPushAll()
.setPushTags()
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password))
.call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | java | public Iterable<PushResult> pushToRepository(Git git, String remote, String username, String password) {
try {
return git.push()
.setRemote(remote)
.setPushAll()
.setPushTags()
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password))
.call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"Iterable",
"<",
"PushResult",
">",
"pushToRepository",
"(",
"Git",
"git",
",",
"String",
"remote",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"try",
"{",
"return",
"git",
".",
"push",
"(",
")",
".",
"setRemote",
"(",
"remo... | Push all changes and tags to given remote.
@param git
instance.
@param remote
to be used.
@param username
to login.
@param password
to login.
@return List of all results of given push. | [
"Push",
"all",
"changes",
"and",
"tags",
"to",
"given",
"remote",
"."
] | train | https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L306-L317 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.addSeconds | public static <T extends java.util.Date> T addSeconds(final T date, final int amount) {
return roll(date, amount, CalendarUnit.SECOND);
} | java | public static <T extends java.util.Date> T addSeconds(final T date, final int amount) {
return roll(date, amount, CalendarUnit.SECOND);
} | [
"public",
"static",
"<",
"T",
"extends",
"java",
".",
"util",
".",
"Date",
">",
"T",
"addSeconds",
"(",
"final",
"T",
"date",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"roll",
"(",
"date",
",",
"amount",
",",
"CalendarUnit",
".",
"SECOND",
"... | Adds a number of seconds to a date returning a new object.
The original {@code Date} is unchanged.
@param date the date, not null
@param amount the amount to add, may be negative
@return the new {@code Date} with the amount added
@throws IllegalArgumentException if the date is null | [
"Adds",
"a",
"number",
"of",
"seconds",
"to",
"a",
"date",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1035-L1037 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java | CPTaxCategoryPersistenceImpl.findByGroupId | @Override
public List<CPTaxCategory> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPTaxCategory> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPTaxCategory",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp tax categories where groupId = ?.
@param groupId the group ID
@return the matching cp tax categories | [
"Returns",
"all",
"the",
"cp",
"tax",
"categories",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java#L121-L124 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java | Bytes.putBigDecimal | public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
if (bytes == null) {
return offset;
}
byte[] valueBytes = val.unscaledValue().toByteArray();
byte[] result = new byte[valueBytes.length + SIZEOF_INT];
offset = putInt(result, offset, val.scale());
return putBytes(result, offset, valueBytes, 0, valueBytes.length);
} | java | public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
if (bytes == null) {
return offset;
}
byte[] valueBytes = val.unscaledValue().toByteArray();
byte[] result = new byte[valueBytes.length + SIZEOF_INT];
offset = putInt(result, offset, val.scale());
return putBytes(result, offset, valueBytes, 0, valueBytes.length);
} | [
"public",
"static",
"int",
"putBigDecimal",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"BigDecimal",
"val",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"return",
"offset",
";",
"}",
"byte",
"[",
"]",
"valueBytes",
"=",
"val"... | Put a BigDecimal value out to the specified byte array position.
@param bytes the byte array
@param offset position in the array
@param val BigDecimal to write out
@return incremented offset | [
"Put",
"a",
"BigDecimal",
"value",
"out",
"to",
"the",
"specified",
"byte",
"array",
"position",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L740-L749 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.defineOwnProperty | public void defineOwnProperty(Context cx, Object id, ScriptableObject desc) {
checkPropertyDefinition(desc);
defineOwnProperty(cx, id, desc, true);
} | java | public void defineOwnProperty(Context cx, Object id, ScriptableObject desc) {
checkPropertyDefinition(desc);
defineOwnProperty(cx, id, desc, true);
} | [
"public",
"void",
"defineOwnProperty",
"(",
"Context",
"cx",
",",
"Object",
"id",
",",
"ScriptableObject",
"desc",
")",
"{",
"checkPropertyDefinition",
"(",
"desc",
")",
";",
"defineOwnProperty",
"(",
"cx",
",",
"id",
",",
"desc",
",",
"true",
")",
";",
"}... | Defines a property on an object.
@param cx the current Context
@param id the name/index of the property
@param desc the new property descriptor, as described in 8.6.1 | [
"Defines",
"a",
"property",
"on",
"an",
"object",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L1898-L1901 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.createHiddenInput | private static InputElement createHiddenInput(String name, String value) {
InputElement input = Document.get().createHiddenInputElement();
input.setName(name);
input.setValue(value);
return input;
} | java | private static InputElement createHiddenInput(String name, String value) {
InputElement input = Document.get().createHiddenInputElement();
input.setName(name);
input.setValue(value);
return input;
} | [
"private",
"static",
"InputElement",
"createHiddenInput",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"InputElement",
"input",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createHiddenInputElement",
"(",
")",
";",
"input",
".",
"setName",
"(",
"... | Creates a hidden input field with the given name and value.<p>
@param name the field name
@param value the field value
@return the input element | [
"Creates",
"a",
"hidden",
"input",
"field",
"with",
"the",
"given",
"name",
"and",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L2112-L2118 |
fuinorg/objects4j | src/main/java/org/fuin/objects4j/ui/TextFieldInfo.java | TextFieldInfo.create | public static TextFieldInfo create(@NotNull final Field field, @NotNull final Locale locale) {
final TextField textField = field.getAnnotation(TextField.class);
if (textField == null) {
return null;
}
return new TextFieldInfo(field, textField.width());
} | java | public static TextFieldInfo create(@NotNull final Field field, @NotNull final Locale locale) {
final TextField textField = field.getAnnotation(TextField.class);
if (textField == null) {
return null;
}
return new TextFieldInfo(field, textField.width());
} | [
"public",
"static",
"TextFieldInfo",
"create",
"(",
"@",
"NotNull",
"final",
"Field",
"field",
",",
"@",
"NotNull",
"final",
"Locale",
"locale",
")",
"{",
"final",
"TextField",
"textField",
"=",
"field",
".",
"getAnnotation",
"(",
"TextField",
".",
"class",
... | Return the text field information for a given field.
@param field
Field to check for <code>@TextField</code> annotation.
@param locale
Locale to use.
@return Information or <code>null</code>. | [
"Return",
"the",
"text",
"field",
"information",
"for",
"a",
"given",
"field",
"."
] | train | https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/ui/TextFieldInfo.java#L107-L115 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.announceSupportAndPublish | public void announceSupportAndPublish()
throws NoSuchAlgorithmException, NoSuchProviderException, InterruptedException,
PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException, IOException,
InvalidAlgorithmParameterException, SmackException.NotLoggedInException, PGPException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
OpenPgpV4Fingerprint primaryFingerprint = getOurFingerprint();
if (primaryFingerprint == null) {
primaryFingerprint = generateAndImportKeyPair(getJidOrThrow());
}
// Create <pubkey/> element
PubkeyElement pubkeyElement;
try {
pubkeyElement = createPubkeyElement(getJidOrThrow(), primaryFingerprint, new Date());
} catch (MissingOpenPgpKeyException e) {
throw new AssertionError("Cannot publish our public key, since it is missing (MUST NOT happen!)");
}
// publish it
publishPublicKey(pepManager, pubkeyElement, primaryFingerprint);
// Subscribe to public key changes
PepManager.getInstanceFor(connection()).addPepListener(metadataListener);
ServiceDiscoveryManager.getInstanceFor(connection())
.addFeature(PEP_NODE_PUBLIC_KEYS_NOTIFY);
} | java | public void announceSupportAndPublish()
throws NoSuchAlgorithmException, NoSuchProviderException, InterruptedException,
PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException, IOException,
InvalidAlgorithmParameterException, SmackException.NotLoggedInException, PGPException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
OpenPgpV4Fingerprint primaryFingerprint = getOurFingerprint();
if (primaryFingerprint == null) {
primaryFingerprint = generateAndImportKeyPair(getJidOrThrow());
}
// Create <pubkey/> element
PubkeyElement pubkeyElement;
try {
pubkeyElement = createPubkeyElement(getJidOrThrow(), primaryFingerprint, new Date());
} catch (MissingOpenPgpKeyException e) {
throw new AssertionError("Cannot publish our public key, since it is missing (MUST NOT happen!)");
}
// publish it
publishPublicKey(pepManager, pubkeyElement, primaryFingerprint);
// Subscribe to public key changes
PepManager.getInstanceFor(connection()).addPepListener(metadataListener);
ServiceDiscoveryManager.getInstanceFor(connection())
.addFeature(PEP_NODE_PUBLIC_KEYS_NOTIFY);
} | [
"public",
"void",
"announceSupportAndPublish",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
",",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackExcept... | Generate a fresh OpenPGP key pair, given we don't have one already.
Publish the public key to the Public Key Node and update the Public Key Metadata Node with our keys fingerprint.
Lastly register a {@link PepListener} which listens for updates to Public Key Metadata Nodes.
@throws NoSuchAlgorithmException if we are missing an algorithm to generate a fresh key pair.
@throws NoSuchProviderException if we are missing a suitable {@link java.security.Provider}.
@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if one of the PubSub nodes is not a {@link LeafNode}.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws SmackException.NoResponseException if the server doesn't respond.
@throws IOException IO is dangerous.
@throws InvalidAlgorithmParameterException if illegal algorithm parameters are used for key generation.
@throws SmackException.NotLoggedInException if we are not logged in.
@throws PGPException if something goes wrong during key loading/generating | [
"Generate",
"a",
"fresh",
"OpenPGP",
"key",
"pair",
"given",
"we",
"don",
"t",
"have",
"one",
"already",
".",
"Publish",
"the",
"public",
"key",
"to",
"the",
"Public",
"Key",
"Node",
"and",
"update",
"the",
"Public",
"Key",
"Metadata",
"Node",
"with",
"o... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L255-L284 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_mitigationProfiles_ipMitigationProfile_DELETE | public void ip_mitigationProfiles_ipMitigationProfile_DELETE(String ip, String ipMitigationProfile) throws IOException {
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void ip_mitigationProfiles_ipMitigationProfile_DELETE(String ip, String ipMitigationProfile) throws IOException {
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"ip_mitigationProfiles_ipMitigationProfile_DELETE",
"(",
"String",
"ip",
",",
"String",
"ipMitigationProfile",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/mitigationProfiles/{ipMitigationProfile}\"",
";",
"StringBuilder",
"sb",
"="... | Delete mitigation profile
REST: DELETE /ip/{ip}/mitigationProfiles/{ipMitigationProfile}
@param ip [required]
@param ipMitigationProfile [required] | [
"Delete",
"mitigation",
"profile"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L928-L932 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isLessThan | public static IsLessThan isLessThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
return new IsLessThan(left, right);
} | java | public static IsLessThan isLessThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
return new IsLessThan(left, right);
} | [
"public",
"static",
"IsLessThan",
"isLessThan",
"(",
"ComparableExpression",
"<",
"Number",
">",
"left",
",",
"ComparableExpression",
"<",
"Number",
">",
"right",
")",
"{",
"return",
"new",
"IsLessThan",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Creates an IsLessThan expression from the given expressions.
@param left The left expression.
@param right The right expression.
@return A new is less than binary expression. | [
"Creates",
"an",
"IsLessThan",
"expression",
"from",
"the",
"given",
"expressions",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L323-L325 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLeadingCharCount | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | java | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getLeadingCharCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"c",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"final",
"int",
"nMax",
"=",... | Get the number of specified chars, the passed string starts with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0. | [
"Get",
"the",
"number",
"of",
"specified",
"chars",
"the",
"passed",
"string",
"starts",
"with",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L839-L850 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java | OGCGeometry.createFromEsriCursor | public static OGCGeometry createFromEsriCursor(GeometryCursor gc,
SpatialReference sr) {
return createFromEsriCursor(gc, sr, false);
} | java | public static OGCGeometry createFromEsriCursor(GeometryCursor gc,
SpatialReference sr) {
return createFromEsriCursor(gc, sr, false);
} | [
"public",
"static",
"OGCGeometry",
"createFromEsriCursor",
"(",
"GeometryCursor",
"gc",
",",
"SpatialReference",
"sr",
")",
"{",
"return",
"createFromEsriCursor",
"(",
"gc",
",",
"sr",
",",
"false",
")",
";",
"}"
] | Create an OGCGeometry instance from the GeometryCursor.
@param gc
@param sr
@return Geometry instance created from the geometry cursor. | [
"Create",
"an",
"OGCGeometry",
"instance",
"from",
"the",
"GeometryCursor",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java#L563-L566 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.getPath | private static String getPath(final List pathStack, final char separatorChar) {
final StringBuilder buffer = new StringBuilder();
final Iterator iter = pathStack.iterator();
if (iter.hasNext()) {
buffer.append(iter.next());
}
while (iter.hasNext()) {
buffer.append(separatorChar);
buffer.append(iter.next());
}
return buffer.toString();
} | java | private static String getPath(final List pathStack, final char separatorChar) {
final StringBuilder buffer = new StringBuilder();
final Iterator iter = pathStack.iterator();
if (iter.hasNext()) {
buffer.append(iter.next());
}
while (iter.hasNext()) {
buffer.append(separatorChar);
buffer.append(iter.next());
}
return buffer.toString();
} | [
"private",
"static",
"String",
"getPath",
"(",
"final",
"List",
"pathStack",
",",
"final",
"char",
"separatorChar",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Iterator",
"iter",
"=",
"pathStack",
".",
... | Gets path from a <code>List</code> of <code>String</code>s.
@param pathStack <code>List</code> of <code>String</code>s to be concated as a path.
@param separatorChar <code>char</code> to be used as separator between names in path
@return <code>String</code>, never <code>null</code> | [
"Gets",
"path",
"from",
"a",
"<code",
">",
"List<",
"/",
"code",
">",
"of",
"<code",
">",
"String<",
"/",
"code",
">",
"s",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2594-L2606 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.getPropertyValue | @SuppressWarnings("unchecked")
public static <T, Q> T getPropertyValue(Q bean, String propertyName, Class<T> propertyType) {
Assert.notNull(bean, "bean");
Assert.notNull(propertyName, "propertyName");
final PropertyAccessor propertyAccessor = PropertyAccessorFactory.forDirectFieldAccess(bean);
try {
Assert.isAssignable(propertyType, propertyAccessor.getPropertyType(propertyName));
} catch (InvalidPropertyException e) {
throw new IllegalStateException("Invalid property \"" + propertyName + "\"", e);
}
return (T) propertyAccessor.getPropertyValue(propertyName);
} | java | @SuppressWarnings("unchecked")
public static <T, Q> T getPropertyValue(Q bean, String propertyName, Class<T> propertyType) {
Assert.notNull(bean, "bean");
Assert.notNull(propertyName, "propertyName");
final PropertyAccessor propertyAccessor = PropertyAccessorFactory.forDirectFieldAccess(bean);
try {
Assert.isAssignable(propertyType, propertyAccessor.getPropertyType(propertyName));
} catch (InvalidPropertyException e) {
throw new IllegalStateException("Invalid property \"" + propertyName + "\"", e);
}
return (T) propertyAccessor.getPropertyValue(propertyName);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"Q",
">",
"T",
"getPropertyValue",
"(",
"Q",
"bean",
",",
"String",
"propertyName",
",",
"Class",
"<",
"T",
">",
"propertyType",
")",
"{",
"Assert",
".",
"notNull",
"(... | Gets the value of a given property into a given bean.
@param <T>
the property type.
@param <Q>
the bean type.
@param bean
the bean itself.
@param propertyName
the property name.
@param propertyType
the property type.
@return the property value.
@see PropertyAccessorFactory | [
"Gets",
"the",
"value",
"of",
"a",
"given",
"property",
"into",
"a",
"given",
"bean",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L88-L103 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.flip | public static void flip(Image image, ImageOutputStream out) throws IORuntimeException {
writeJpg(flip(image), out);
} | java | public static void flip(Image image, ImageOutputStream out) throws IORuntimeException {
writeJpg(flip(image), out);
} | [
"public",
"static",
"void",
"flip",
"(",
"Image",
"image",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"flip",
"(",
"image",
")",
",",
"out",
")",
";",
"}"
] | 水平翻转图像,写出格式为JPG
@param image 图像
@param out 输出
@throws IORuntimeException IO异常
@since 3.2.2 | [
"水平翻转图像,写出格式为JPG"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1106-L1108 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/ServiceConfigUtil.java | ServiceConfigUtil.getHealthCheckedServiceName | @Nullable
public static String getHealthCheckedServiceName(@Nullable Map<String, ?> serviceConfig) {
String healthCheckKey = "healthCheckConfig";
String serviceNameKey = "serviceName";
if (serviceConfig == null || !serviceConfig.containsKey(healthCheckKey)) {
return null;
}
/* schema as follows
{
"healthCheckConfig": {
// Service name to use in the health-checking request.
"serviceName": string
}
}
*/
Map<String, ?> healthCheck = getObject(serviceConfig, healthCheckKey);
if (!healthCheck.containsKey(serviceNameKey)) {
return null;
}
return getString(healthCheck, "serviceName");
} | java | @Nullable
public static String getHealthCheckedServiceName(@Nullable Map<String, ?> serviceConfig) {
String healthCheckKey = "healthCheckConfig";
String serviceNameKey = "serviceName";
if (serviceConfig == null || !serviceConfig.containsKey(healthCheckKey)) {
return null;
}
/* schema as follows
{
"healthCheckConfig": {
// Service name to use in the health-checking request.
"serviceName": string
}
}
*/
Map<String, ?> healthCheck = getObject(serviceConfig, healthCheckKey);
if (!healthCheck.containsKey(serviceNameKey)) {
return null;
}
return getString(healthCheck, "serviceName");
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getHealthCheckedServiceName",
"(",
"@",
"Nullable",
"Map",
"<",
"String",
",",
"?",
">",
"serviceConfig",
")",
"{",
"String",
"healthCheckKey",
"=",
"\"healthCheckConfig\"",
";",
"String",
"serviceNameKey",
"=",
"\"s... | Fetch the health-checked service name from service config. {@code null} if can't find one. | [
"Fetch",
"the",
"health",
"-",
"checked",
"service",
"name",
"from",
"service",
"config",
".",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L78-L99 |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.toMediaWiki | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
} | java | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
} | [
"public",
"void",
"toMediaWiki",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"String",
"url",
",",
"final",
"String",
"title",
")",
"throws",
"GitChangelogRepositoryException",
",",
"GitChangelogIntegrationException",
"{",
"... | Create MediaWiki page with changelog.
@throws GitChangelogRepositoryException
@throws GitChangelogIntegrationException | [
"Create",
"MediaWiki",
"page",
"with",
"changelog",
"."
] | train | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L144-L150 |
groovy/groovy-core | src/main/org/codehaus/groovy/control/ClassNodeResolver.java | ClassNodeResolver.isSourceNewer | private boolean isSourceNewer(URL source, ClassNode cls) {
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
return lastMod > getTimeStamp(cls);
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
}
} | java | private boolean isSourceNewer(URL source, ClassNode cls) {
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
return lastMod > getTimeStamp(cls);
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
}
} | [
"private",
"boolean",
"isSourceNewer",
"(",
"URL",
"source",
",",
"ClassNode",
"cls",
")",
"{",
"try",
"{",
"long",
"lastMod",
";",
"// Special handling for file:// protocol, as getLastModified() often reports",
"// incorrect results (-1)",
"if",
"(",
"source",
".",
"getP... | returns true if the source in URL is newer than the class
NOTE: copied from GroovyClassLoader | [
"returns",
"true",
"if",
"the",
"source",
"in",
"URL",
"is",
"newer",
"than",
"the",
"class",
"NOTE",
":",
"copied",
"from",
"GroovyClassLoader"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/ClassNodeResolver.java#L323-L344 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java | MessageSerializer.writeHeader | private static void writeHeader(final ByteBuf buf, final MessageType messageType) {
buf.writeInt(VERSION);
buf.writeInt(messageType.ordinal());
} | java | private static void writeHeader(final ByteBuf buf, final MessageType messageType) {
buf.writeInt(VERSION);
buf.writeInt(messageType.ordinal());
} | [
"private",
"static",
"void",
"writeHeader",
"(",
"final",
"ByteBuf",
"buf",
",",
"final",
"MessageType",
"messageType",
")",
"{",
"buf",
".",
"writeInt",
"(",
"VERSION",
")",
";",
"buf",
".",
"writeInt",
"(",
"messageType",
".",
"ordinal",
"(",
")",
")",
... | Helper for serializing the header.
@param buf The {@link ByteBuf} to serialize the header into.
@param messageType The {@link MessageType} of the message this header refers to. | [
"Helper",
"for",
"serializing",
"the",
"header",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L185-L188 |
samskivert/samskivert | src/main/java/com/samskivert/util/FileUtil.java | FileUtil.resuffix | public static String resuffix (File file, String ext, String newext)
{
String path = file.getPath();
if (path.endsWith(ext)) {
path = path.substring(0, path.length()-ext.length());
}
return path + newext;
} | java | public static String resuffix (File file, String ext, String newext)
{
String path = file.getPath();
if (path.endsWith(ext)) {
path = path.substring(0, path.length()-ext.length());
}
return path + newext;
} | [
"public",
"static",
"String",
"resuffix",
"(",
"File",
"file",
",",
"String",
"ext",
",",
"String",
"newext",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"ext",
")",
")",
"{",
"pa... | Replaces <code>ext</code> with the supplied new extention if the
supplied file path ends in <code>ext</code>. Otherwise the new
extension is appended to the whole existing file path. | [
"Replaces",
"<code",
">",
"ext<",
"/",
"code",
">",
"with",
"the",
"supplied",
"new",
"extention",
"if",
"the",
"supplied",
"file",
"path",
"ends",
"in",
"<code",
">",
"ext<",
"/",
"code",
">",
".",
"Otherwise",
"the",
"new",
"extension",
"is",
"appended... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/FileUtil.java#L63-L70 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.findAll | @Override
public List<CPDefinition> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPDefinition> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinition",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definitions.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@return the range of cp definitions | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definitions",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L6215-L6218 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java | Base64Util.decodeString | public static String decodeString(final String string) {
String decodedString = null;
try {
byte[] decodedBytes = decode(string);
decodedString = new String(decodedBytes, "UTF-8");
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
}
return decodedString;
} | java | public static String decodeString(final String string) {
String decodedString = null;
try {
byte[] decodedBytes = decode(string);
decodedString = new String(decodedBytes, "UTF-8");
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
}
return decodedString;
} | [
"public",
"static",
"String",
"decodeString",
"(",
"final",
"String",
"string",
")",
"{",
"String",
"decodedString",
"=",
"null",
";",
"try",
"{",
"byte",
"[",
"]",
"decodedBytes",
"=",
"decode",
"(",
"string",
")",
";",
"decodedString",
"=",
"new",
"Strin... | Decodes a string from Base64 format.
@param string a Base64 String to be decoded.
@return A String containing the decoded data.
@throws IllegalArgumentException if the input is not valid Base64 encoded data. | [
"Decodes",
"a",
"string",
"from",
"Base64",
"format",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java#L161-L172 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getPropertyType | public static Type getPropertyType(EntityDataModel entityDataModel, StructuralProperty property) {
return getAndCheckType(entityDataModel, getPropertyTypeName(property));
} | java | public static Type getPropertyType(EntityDataModel entityDataModel, StructuralProperty property) {
return getAndCheckType(entityDataModel, getPropertyTypeName(property));
} | [
"public",
"static",
"Type",
"getPropertyType",
"(",
"EntityDataModel",
"entityDataModel",
",",
"StructuralProperty",
"property",
")",
"{",
"return",
"getAndCheckType",
"(",
"entityDataModel",
",",
"getPropertyTypeName",
"(",
"property",
")",
")",
";",
"}"
] | Gets the OData type of the property; if the property is a collection, gets the OData type of the elements of the
collection.
@param entityDataModel The entity data model
@param property The property.
@return The OData type of the property; if the property is a collection, the OData type of the elements of the
collection. | [
"Gets",
"the",
"OData",
"type",
"of",
"the",
"property",
";",
"if",
"the",
"property",
"is",
"a",
"collection",
"gets",
"the",
"OData",
"type",
"of",
"the",
"elements",
"of",
"the",
"collection",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L300-L302 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getBicubicInterpolationValue | protected Double getBicubicInterpolationValue(Double[][] values,
CoverageDataSourcePixel sourcePixelX,
CoverageDataSourcePixel sourcePixelY) {
return getBicubicInterpolationValue(values, sourcePixelX.getOffset(),
sourcePixelY.getOffset());
} | java | protected Double getBicubicInterpolationValue(Double[][] values,
CoverageDataSourcePixel sourcePixelX,
CoverageDataSourcePixel sourcePixelY) {
return getBicubicInterpolationValue(values, sourcePixelX.getOffset(),
sourcePixelY.getOffset());
} | [
"protected",
"Double",
"getBicubicInterpolationValue",
"(",
"Double",
"[",
"]",
"[",
"]",
"values",
",",
"CoverageDataSourcePixel",
"sourcePixelX",
",",
"CoverageDataSourcePixel",
"sourcePixelY",
")",
"{",
"return",
"getBicubicInterpolationValue",
"(",
"values",
",",
"s... | Get the bicubic interpolation coverage data value from the 4 x 4 coverage
data values
@param values
coverage data values
@param sourcePixelX
source pixel x
@param sourcePixelY
source pixel y
@return bicubic coverage data value | [
"Get",
"the",
"bicubic",
"interpolation",
"coverage",
"data",
"value",
"from",
"the",
"4",
"x",
"4",
"coverage",
"data",
"values"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1191-L1196 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java | ServerDnsAliasesInner.listByServerAsync | public Observable<Page<ServerDnsAliasInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerDnsAliasInner>>, Page<ServerDnsAliasInner>>() {
@Override
public Page<ServerDnsAliasInner> call(ServiceResponse<Page<ServerDnsAliasInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ServerDnsAliasInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerDnsAliasInner>>, Page<ServerDnsAliasInner>>() {
@Override
public Page<ServerDnsAliasInner> call(ServiceResponse<Page<ServerDnsAliasInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ServerDnsAliasInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets a list of server DNS aliases for a server.
@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 that the alias is pointing to.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ServerDnsAliasInner> object | [
"Gets",
"a",
"list",
"of",
"server",
"DNS",
"aliases",
"for",
"a",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L585-L593 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.