repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
baratine/baratine | framework/src/main/java/com/caucho/v5/javac/LineMap.java | LineMap.convertError | private void convertError(CharBuffer buf, int line)
{
String srcFilename = null;
int destLine = 0;
int srcLine = 0;
int srcTailLine = Integer.MAX_VALUE;
for (int i = 0; i < _lines.size(); i++) {
Line map = (Line) _lines.get(i);
if (map._dstLine <= line && line <= map.getLastDestinationLine()) {
srcFilename = map._srcFilename;
destLine = map._dstLine;
srcLine = map.getSourceLine(line);
break;
}
}
if (srcFilename != null) {
}
else if (_lines.size() > 0)
srcFilename = ((Line) _lines.get(0))._srcFilename;
else
srcFilename = "";
buf.append(srcFilename);
if (line >= 0) {
buf.append(":");
buf.append(srcLine + (line - destLine));
}
} | java | private void convertError(CharBuffer buf, int line)
{
String srcFilename = null;
int destLine = 0;
int srcLine = 0;
int srcTailLine = Integer.MAX_VALUE;
for (int i = 0; i < _lines.size(); i++) {
Line map = (Line) _lines.get(i);
if (map._dstLine <= line && line <= map.getLastDestinationLine()) {
srcFilename = map._srcFilename;
destLine = map._dstLine;
srcLine = map.getSourceLine(line);
break;
}
}
if (srcFilename != null) {
}
else if (_lines.size() > 0)
srcFilename = ((Line) _lines.get(0))._srcFilename;
else
srcFilename = "";
buf.append(srcFilename);
if (line >= 0) {
buf.append(":");
buf.append(srcLine + (line - destLine));
}
} | [
"private",
"void",
"convertError",
"(",
"CharBuffer",
"buf",
",",
"int",
"line",
")",
"{",
"String",
"srcFilename",
"=",
"null",
";",
"int",
"destLine",
"=",
"0",
";",
"int",
"srcLine",
"=",
"0",
";",
"int",
"srcTailLine",
"=",
"Integer",
".",
"MAX_VALUE... | Maps a destination line to an error location.
@param buf CharBuffer to write the error location
@param line generated source line to convert. | [
"Maps",
"a",
"destination",
"line",
"to",
"an",
"error",
"location",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/javac/LineMap.java#L384-L414 |
google/closure-compiler | src/com/google/javascript/rhino/Node.java | Node.matchesQualifiedName | private boolean matchesQualifiedName(String qname, int endIndex) {
int start = qname.lastIndexOf('.', endIndex - 1) + 1;
switch (this.getToken()) {
case NAME:
String name = getString();
return start == 0 && !name.isEmpty() && name.length() == endIndex && qname.startsWith(name);
case THIS:
return start == 0 && 4 == endIndex && qname.startsWith("this");
case SUPER:
return start == 0 && 5 == endIndex && qname.startsWith("super");
case GETPROP:
String prop = getLastChild().getString();
return start > 1
&& prop.length() == endIndex - start
&& prop.regionMatches(0, qname, start, endIndex - start)
&& getFirstChild().matchesQualifiedName(qname, start - 1);
case MEMBER_FUNCTION_DEF:
// These are explicitly *not* qualified name components.
default:
return false;
}
} | java | private boolean matchesQualifiedName(String qname, int endIndex) {
int start = qname.lastIndexOf('.', endIndex - 1) + 1;
switch (this.getToken()) {
case NAME:
String name = getString();
return start == 0 && !name.isEmpty() && name.length() == endIndex && qname.startsWith(name);
case THIS:
return start == 0 && 4 == endIndex && qname.startsWith("this");
case SUPER:
return start == 0 && 5 == endIndex && qname.startsWith("super");
case GETPROP:
String prop = getLastChild().getString();
return start > 1
&& prop.length() == endIndex - start
&& prop.regionMatches(0, qname, start, endIndex - start)
&& getFirstChild().matchesQualifiedName(qname, start - 1);
case MEMBER_FUNCTION_DEF:
// These are explicitly *not* qualified name components.
default:
return false;
}
} | [
"private",
"boolean",
"matchesQualifiedName",
"(",
"String",
"qname",
",",
"int",
"endIndex",
")",
"{",
"int",
"start",
"=",
"qname",
".",
"lastIndexOf",
"(",
"'",
"'",
",",
"endIndex",
"-",
"1",
")",
"+",
"1",
";",
"switch",
"(",
"this",
".",
"getToke... | Returns whether a node matches a simple or a qualified name, such as
<code>x</code> or <code>a.b.c</code> or <code>this.a</code>. | [
"Returns",
"whether",
"a",
"node",
"matches",
"a",
"simple",
"or",
"a",
"qualified",
"name",
"such",
"as",
"<code",
">",
"x<",
"/",
"code",
">",
"or",
"<code",
">",
"a",
".",
"b",
".",
"c<",
"/",
"code",
">",
"or",
"<code",
">",
"this",
".",
"a<"... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/Node.java#L2145-L2168 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java | IOManager.createBlockChannelReader | public BlockChannelReader createBlockChannelReader(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
throws IOException
{
if (this.isClosed) {
throw new IllegalStateException("I/O-Manger is closed.");
}
return new BlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue, 1);
} | java | public BlockChannelReader createBlockChannelReader(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
throws IOException
{
if (this.isClosed) {
throw new IllegalStateException("I/O-Manger is closed.");
}
return new BlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue, 1);
} | [
"public",
"BlockChannelReader",
"createBlockChannelReader",
"(",
"Channel",
".",
"ID",
"channelID",
",",
"LinkedBlockingQueue",
"<",
"MemorySegment",
">",
"returnQueue",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"isClosed",
")",
"{",
"throw",
"new... | Creates a block channel reader that reads blocks from the given channel. The reader reads asynchronously,
such that a read request is accepted, carried out at some (close) point in time, and the full segment
is pushed to the given queue.
@param channelID The descriptor for the channel to write to.
@param returnQueue The queue to put the full buffers into.
@return A block channel reader that reads from the given channel.
@throws IOException Thrown, if the channel for the reader could not be opened. | [
"Creates",
"a",
"block",
"channel",
"reader",
"that",
"reads",
"blocks",
"from",
"the",
"given",
"channel",
".",
"The",
"reader",
"reads",
"asynchronously",
"such",
"that",
"a",
"read",
"request",
"is",
"accepted",
"carried",
"out",
"at",
"some",
"(",
"close... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java#L339-L348 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TrConfigurator.java | TrConfigurator.setTraceSpec | synchronized static TraceSpecification setTraceSpec(String spec) {
// If logger is used & configured by logger properties,
// we're done as far as trace string processing is concerned
if (WsLogManager.isConfiguredByLoggingProperties()) {
return null;
}
// If the specified string is null, or it is equal to a string,
// or the sensitive flag has not been toggled,
// we've already parsed, skip it.
if ((spec == null || spec.equals(traceString)) && Tr.activeTraceSpec.isSensitiveTraceSuppressed() == suppressSensitiveTrace) {
return null;
}
traceString = spec;
// Parse the trace specification string, this will gather
// exceptions that occur for different elements of the string
TraceSpecification newTs = new TraceSpecification(spec, safeLevelsIndex, suppressSensitiveTrace);
TraceSpecificationException tex = newTs.getExceptions();
if (tex != null) {
do {
tex.warning(loggingConfig.get() != null);
tex = tex.getPreviousException();
} while (tex != null);
}
Tr.setTraceSpec(newTs);
// Return the new/updated TraceSpecification to the caller. The caller can
// then determine whether or not all elements of the TraceSpecification
// were known to the system or not.
return newTs;
} | java | synchronized static TraceSpecification setTraceSpec(String spec) {
// If logger is used & configured by logger properties,
// we're done as far as trace string processing is concerned
if (WsLogManager.isConfiguredByLoggingProperties()) {
return null;
}
// If the specified string is null, or it is equal to a string,
// or the sensitive flag has not been toggled,
// we've already parsed, skip it.
if ((spec == null || spec.equals(traceString)) && Tr.activeTraceSpec.isSensitiveTraceSuppressed() == suppressSensitiveTrace) {
return null;
}
traceString = spec;
// Parse the trace specification string, this will gather
// exceptions that occur for different elements of the string
TraceSpecification newTs = new TraceSpecification(spec, safeLevelsIndex, suppressSensitiveTrace);
TraceSpecificationException tex = newTs.getExceptions();
if (tex != null) {
do {
tex.warning(loggingConfig.get() != null);
tex = tex.getPreviousException();
} while (tex != null);
}
Tr.setTraceSpec(newTs);
// Return the new/updated TraceSpecification to the caller. The caller can
// then determine whether or not all elements of the TraceSpecification
// were known to the system or not.
return newTs;
} | [
"synchronized",
"static",
"TraceSpecification",
"setTraceSpec",
"(",
"String",
"spec",
")",
"{",
"// If logger is used & configured by logger properties, ",
"// we're done as far as trace string processing is concerned",
"if",
"(",
"WsLogManager",
".",
"isConfiguredByLoggingProperties"... | Set the trace specification of the service to the input value.
@param spec New string trace specification
@return new TraceSpecification, or null if unchanged | [
"Set",
"the",
"trace",
"specification",
"of",
"the",
"service",
"to",
"the",
"input",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TrConfigurator.java#L271-L305 |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.notifyConsumer | private void notifyConsumer( AbstractMessage message )
{
consumersLock.readLock().lock();
try
{
switch (localConsumers.size())
{
case 0 : return; // Nobody's listening
case 1 :
notifySingleConsumer(localConsumers.get(0),message);
break;
default : // Multiple consumers
notifyNextConsumer(localConsumers,message);
break;
}
}
finally
{
consumersLock.readLock().unlock();
}
} | java | private void notifyConsumer( AbstractMessage message )
{
consumersLock.readLock().lock();
try
{
switch (localConsumers.size())
{
case 0 : return; // Nobody's listening
case 1 :
notifySingleConsumer(localConsumers.get(0),message);
break;
default : // Multiple consumers
notifyNextConsumer(localConsumers,message);
break;
}
}
finally
{
consumersLock.readLock().unlock();
}
} | [
"private",
"void",
"notifyConsumer",
"(",
"AbstractMessage",
"message",
")",
"{",
"consumersLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"switch",
"(",
"localConsumers",
".",
"size",
"(",
")",
")",
"{",
"case",
"0",
":",
"r... | Notify a consumer that a message is probably available for it to retrieve | [
"Notify",
"a",
"consumer",
"that",
"a",
"message",
"is",
"probably",
"available",
"for",
"it",
"to",
"retrieve"
] | train | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L706-L726 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/io/FileSupport.java | FileSupport.getDirectoriesInDirectoryTree | public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
File file = new File(path);
return getContentsInDirectoryTree(file, "*", false, true);
} | java | public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
File file = new File(path);
return getContentsInDirectoryTree(file, "*", false, true);
} | [
"public",
"static",
"ArrayList",
"<",
"File",
">",
"getDirectoriesInDirectoryTree",
"(",
"String",
"path",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"return",
"getContentsInDirectoryTree",
"(",
"file",
",",
"\"*\"",
",",
"false",
"... | Retrieves all directories from a directory and its subdirectories.
@param path path to directory
@return A list containing the found directories | [
"Retrieves",
"all",
"directories",
"from",
"a",
"directory",
"and",
"its",
"subdirectories",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L170-L173 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.startsWith | public Criteria startsWith(String s) {
assertNoBlankInWildcardedQuery(s, false, true);
predicates.add(new Predicate(OperationKey.STARTS_WITH, s));
return this;
} | java | public Criteria startsWith(String s) {
assertNoBlankInWildcardedQuery(s, false, true);
predicates.add(new Predicate(OperationKey.STARTS_WITH, s));
return this;
} | [
"public",
"Criteria",
"startsWith",
"(",
"String",
"s",
")",
"{",
"assertNoBlankInWildcardedQuery",
"(",
"s",
",",
"false",
",",
"true",
")",
";",
"predicates",
".",
"add",
"(",
"new",
"Predicate",
"(",
"OperationKey",
".",
"STARTS_WITH",
",",
"s",
")",
")... | Crates new {@link Predicate} with trailing wildcard <br/>
<strong>NOTE: </strong>Strings will not be automatically split on whitespace.
@param s
@return
@throws InvalidDataAccessApiUsageException for strings with whitespace | [
"Crates",
"new",
"{",
"@link",
"Predicate",
"}",
"with",
"trailing",
"wildcard",
"<br",
"/",
">",
"<strong",
">",
"NOTE",
":",
"<",
"/",
"strong",
">",
"Strings",
"will",
"not",
"be",
"automatically",
"split",
"on",
"whitespace",
"."
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L220-L225 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.setIgnoreIncludeServletPath | public static void setIgnoreIncludeServletPath( ServletRequest request, boolean ignore )
{
Integer depth = ( Integer ) request.getAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR );
if ( ignore )
{
if ( depth == null ) depth = new Integer( 0 );
request.setAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR, new Integer( depth.intValue() + 1 ) );
}
else
{
assert depth != null : "call to setIgnoreIncludeServletPath() was imbalanced";
depth = new Integer( depth.intValue() - 1 );
if ( depth.intValue() == 0 )
{
request.removeAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR );
}
else
{
request.setAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR, depth );
}
}
} | java | public static void setIgnoreIncludeServletPath( ServletRequest request, boolean ignore )
{
Integer depth = ( Integer ) request.getAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR );
if ( ignore )
{
if ( depth == null ) depth = new Integer( 0 );
request.setAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR, new Integer( depth.intValue() + 1 ) );
}
else
{
assert depth != null : "call to setIgnoreIncludeServletPath() was imbalanced";
depth = new Integer( depth.intValue() - 1 );
if ( depth.intValue() == 0 )
{
request.removeAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR );
}
else
{
request.setAttribute( IGNORE_INCLUDE_SERVLET_PATH_ATTR, depth );
}
}
} | [
"public",
"static",
"void",
"setIgnoreIncludeServletPath",
"(",
"ServletRequest",
"request",
",",
"boolean",
"ignore",
")",
"{",
"Integer",
"depth",
"=",
"(",
"Integer",
")",
"request",
".",
"getAttribute",
"(",
"IGNORE_INCLUDE_SERVLET_PATH_ATTR",
")",
";",
"if",
... | Tell {@link #getDecodedServletPath} (and all that call it) to ignore the attribute that specifies the Servlet
Include path, which is set when a Servlet include is done through RequestDispatcher. Normally,
getDecodedServletPath tries the Servlet Include path before falling back to getServletPath() on the request.
Note that this is basically a stack of instructions to ignore the include path, and this method expects each
call with <code>ignore</code>==<code>true</code> to be balanced by a call with
<code>ignore</code>==<code>false</code>. | [
"Tell",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L1100-L1123 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java | DefaultIncrementalAttributesMapper.lookupAttributes | public static Attributes lookupAttributes(LdapOperations ldapOperations, Name dn, String[] attributes) {
return loopForAllAttributeValues(ldapOperations, dn, attributes).getCollectedAttributes();
} | java | public static Attributes lookupAttributes(LdapOperations ldapOperations, Name dn, String[] attributes) {
return loopForAllAttributeValues(ldapOperations, dn, attributes).getCollectedAttributes();
} | [
"public",
"static",
"Attributes",
"lookupAttributes",
"(",
"LdapOperations",
"ldapOperations",
",",
"Name",
"dn",
",",
"String",
"[",
"]",
"attributes",
")",
"{",
"return",
"loopForAllAttributeValues",
"(",
"ldapOperations",
",",
"dn",
",",
"attributes",
")",
".",... | Lookup all values for the specified attributes, looping through the results incrementally if necessary.
@param ldapOperations The instance to use for performing the actual lookup.
@param dn The distinguished name of the object to find.
@param attributes names of the attributes to request.
@return an Attributes instance, populated with all found values for the requested attributes.
Never <code>null</code>, though the actual attributes may not be set if they was not
set on the requested object. | [
"Lookup",
"all",
"values",
"for",
"the",
"specified",
"attributes",
"looping",
"through",
"the",
"results",
"incrementally",
"if",
"necessary",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java#L304-L306 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsToolBar.java | CmsToolBar.openFavoriteDialog | public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
} | java | public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
} | [
"public",
"static",
"void",
"openFavoriteDialog",
"(",
"CmsFileExplorer",
"explorer",
")",
"{",
"try",
"{",
"CmsExplorerFavoriteContext",
"context",
"=",
"new",
"CmsExplorerFavoriteContext",
"(",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
",",
"explorer",
")",
";",
... | Opens the favorite dialog.
@param explorer the explorer instance (null if not currently in explorer) | [
"Opens",
"the",
"favorite",
"dialog",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsToolBar.java#L294-L307 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java | LockFile.writeHeartbeat | private final void writeHeartbeat()
throws LockFile.FileSecurityException,
LockFile.UnexpectedEndOfFileException,
LockFile.UnexpectedFileIOException {
try {
raf.seek(MAGIC.length);
raf.writeLong(System.currentTimeMillis());
} catch (SecurityException ex) {
throw new FileSecurityException(this, "writeHeartbeat", ex);
} catch (EOFException ex) {
throw new UnexpectedEndOfFileException(this, "writeHeartbeat", ex);
} catch (IOException ex) {
throw new UnexpectedFileIOException(this, "writeHeartbeat", ex);
}
} | java | private final void writeHeartbeat()
throws LockFile.FileSecurityException,
LockFile.UnexpectedEndOfFileException,
LockFile.UnexpectedFileIOException {
try {
raf.seek(MAGIC.length);
raf.writeLong(System.currentTimeMillis());
} catch (SecurityException ex) {
throw new FileSecurityException(this, "writeHeartbeat", ex);
} catch (EOFException ex) {
throw new UnexpectedEndOfFileException(this, "writeHeartbeat", ex);
} catch (IOException ex) {
throw new UnexpectedFileIOException(this, "writeHeartbeat", ex);
}
} | [
"private",
"final",
"void",
"writeHeartbeat",
"(",
")",
"throws",
"LockFile",
".",
"FileSecurityException",
",",
"LockFile",
".",
"UnexpectedEndOfFileException",
",",
"LockFile",
".",
"UnexpectedFileIOException",
"{",
"try",
"{",
"raf",
".",
"seek",
"(",
"MAGIC",
... | Writes the current hearbeat timestamp value to this object's lock
file. <p>
@throws FileSecurityException possibly never (seek and write are native
methods whose JavaDoc entries do not actually specifiy throwing
<tt>SecurityException</tt>). However, it is conceivable that these
native methods may, in turn, access Java methods that do throw
<tt>SecurityException</tt>. In this case, a
<tt>SecurityException</tt> might be thrown if a required system
property value cannot be accessed, or if a security manager exists
and its <tt>{@link
java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)}</tt>
method denies write access to the file
@throws UnexpectedEndOfFileException if an end of file exception is
thrown while attepting to write the heartbeat timestamp value to
the target file (typically, this cannot happen, but the case is
included to distiguish it from the general IOException case).
@throws UnexpectedFileIOException if the current heartbeat timestamp
value cannot be written due to an underlying I/O error | [
"Writes",
"the",
"current",
"hearbeat",
"timestamp",
"value",
"to",
"this",
"object",
"s",
"lock",
"file",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java#L1259-L1274 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java | PatternMatchingFunctions.regexpContains | public static Expression regexpContains(String expression, String pattern) {
return regexpContains(x(expression), pattern);
} | java | public static Expression regexpContains(String expression, String pattern) {
return regexpContains(x(expression), pattern);
} | [
"public",
"static",
"Expression",
"regexpContains",
"(",
"String",
"expression",
",",
"String",
"pattern",
")",
"{",
"return",
"regexpContains",
"(",
"x",
"(",
"expression",
")",
",",
"pattern",
")",
";",
"}"
] | Returned expression results in True if the string value contains the regular expression pattern. | [
"Returned",
"expression",
"results",
"in",
"True",
"if",
"the",
"string",
"value",
"contains",
"the",
"regular",
"expression",
"pattern",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L49-L51 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.commercialRange_commercialRangeName_GET | public OvhCommercialRange commercialRange_commercialRangeName_GET(String commercialRangeName) throws IOException {
String qPath = "/dedicatedCloud/commercialRange/{commercialRangeName}";
StringBuilder sb = path(qPath, commercialRangeName);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCommercialRange.class);
} | java | public OvhCommercialRange commercialRange_commercialRangeName_GET(String commercialRangeName) throws IOException {
String qPath = "/dedicatedCloud/commercialRange/{commercialRangeName}";
StringBuilder sb = path(qPath, commercialRangeName);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCommercialRange.class);
} | [
"public",
"OvhCommercialRange",
"commercialRange_commercialRangeName_GET",
"(",
"String",
"commercialRangeName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/commercialRange/{commercialRangeName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",... | Get this object properties
REST: GET /dedicatedCloud/commercialRange/{commercialRangeName}
@param commercialRangeName [required] The name of this commercial range | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L3119-L3124 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java | Document.setTimex2 | public void setTimex2(int i, Timex2 v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_timex2 == null)
jcasType.jcas.throwFeatMissing("timex2", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_timex2), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_timex2), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setTimex2(int i, Timex2 v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_timex2 == null)
jcasType.jcas.throwFeatMissing("timex2", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_timex2), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_timex2), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setTimex2",
"(",
"int",
"i",
",",
"Timex2",
"v",
")",
"{",
"if",
"(",
"Document_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Document_Type",
")",
"jcasType",
")",
".",
"casFeat_timex2",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"... | indexed setter for timex2 - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"timex2",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java#L226-L230 |
google/flogger | api/src/main/java/com/google/common/flogger/LogContext.java | LogContext.logImpl | @SuppressWarnings("ReferenceEquality")
private void logImpl(String message, Object... args) {
this.args = args;
// Evaluate any (rare) LazyArg instances early. This may throw exceptions from user code, but
// it seems reasonable to propagate them in this case (they would have been thrown if the
// argument was evaluated at the call site anyway).
for (int n = 0; n < args.length; n++) {
if (args[n] instanceof LazyArg) {
args[n] = ((LazyArg<?>) args[n]).evaluate();
}
}
// Using "!=" is fast and sufficient here because the only real case this should be skipping
// is when we called log(String) or log(), which should not result in a template being created.
// DO NOT replace this with a string instance which can be interned, or use equals() here,
// since that could mistakenly treat other calls to log(String, Object...) incorrectly.
if (message != LITERAL_VALUE_MESSAGE) {
this.templateContext = new TemplateContext(getMessageParser(), message);
}
getLogger().write(this);
} | java | @SuppressWarnings("ReferenceEquality")
private void logImpl(String message, Object... args) {
this.args = args;
// Evaluate any (rare) LazyArg instances early. This may throw exceptions from user code, but
// it seems reasonable to propagate them in this case (they would have been thrown if the
// argument was evaluated at the call site anyway).
for (int n = 0; n < args.length; n++) {
if (args[n] instanceof LazyArg) {
args[n] = ((LazyArg<?>) args[n]).evaluate();
}
}
// Using "!=" is fast and sufficient here because the only real case this should be skipping
// is when we called log(String) or log(), which should not result in a template being created.
// DO NOT replace this with a string instance which can be interned, or use equals() here,
// since that could mistakenly treat other calls to log(String, Object...) incorrectly.
if (message != LITERAL_VALUE_MESSAGE) {
this.templateContext = new TemplateContext(getMessageParser(), message);
}
getLogger().write(this);
} | [
"@",
"SuppressWarnings",
"(",
"\"ReferenceEquality\"",
")",
"private",
"void",
"logImpl",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"this",
".",
"args",
"=",
"args",
";",
"// Evaluate any (rare) LazyArg instances early. This may throw exceptions ... | Make the backend logging call. This is the point at which we have paid the price of creating a
varargs array and doing any necessary auto-boxing. | [
"Make",
"the",
"backend",
"logging",
"call",
".",
"This",
"is",
"the",
"point",
"at",
"which",
"we",
"have",
"paid",
"the",
"price",
"of",
"creating",
"a",
"varargs",
"array",
"and",
"doing",
"any",
"necessary",
"auto",
"-",
"boxing",
"."
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/LogContext.java#L548-L567 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java | DirectoryRegistrationService.setUserPermission | public void setUserPermission(String userName, Permission permission){
if(permission == null){
permission = Permission.NONE;
}
getServiceDirectoryClient().setACL(new ACL(AuthScheme.DIRECTORY, userName, permission.getId()));
} | java | public void setUserPermission(String userName, Permission permission){
if(permission == null){
permission = Permission.NONE;
}
getServiceDirectoryClient().setACL(new ACL(AuthScheme.DIRECTORY, userName, permission.getId()));
} | [
"public",
"void",
"setUserPermission",
"(",
"String",
"userName",
",",
"Permission",
"permission",
")",
"{",
"if",
"(",
"permission",
"==",
"null",
")",
"{",
"permission",
"=",
"Permission",
".",
"NONE",
";",
"}",
"getServiceDirectoryClient",
"(",
")",
".",
... | Set the user permission.
@param userName
the user name.
@param permission
the user permission. | [
"Set",
"the",
"user",
"permission",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L265-L270 |
peholmst/vaadin4spring | addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java | I18N.getWithLocale | @Deprecated
public String getWithLocale(String code, Locale locale, Object... arguments) {
return get(code, locale, arguments);
} | java | @Deprecated
public String getWithLocale(String code, Locale locale, Object... arguments) {
return get(code, locale, arguments);
} | [
"@",
"Deprecated",
"public",
"String",
"getWithLocale",
"(",
"String",
"code",
",",
"Locale",
"locale",
",",
"Object",
"...",
"arguments",
")",
"{",
"return",
"get",
"(",
"code",
",",
"locale",
",",
"arguments",
")",
";",
"}"
] | Tries to resolve the specified message for the given locale.
@param code the code to lookup up, such as 'calculator.noRateSet', never {@code null}.
@param locale The Locale for which it is tried to look up the code. Must not be null
@param arguments Array of arguments that will be filled in for params within the message (params look like "{0}",
"{1,date}", "{2,time}"), or {@code null} if none.
@throws IllegalArgumentException if the given Locale is null
@return the resolved message, or the message code prepended with an exclamation mark if the lookup fails.
@see org.springframework.context.ApplicationContext#getMessage(String, Object[], java.util.Locale)
@see java.util.Locale
@deprecated Use {@link #get(String, Locale, Object...)} instead. | [
"Tries",
"to",
"resolve",
"the",
"specified",
"message",
"for",
"the",
"given",
"locale",
"."
] | train | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java#L138-L141 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/NotesApi.java | NotesApi.getMergeRequestNote | public Note getMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId);
return (response.readEntity(Note.class));
} | java | public Note getMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId);
return (response.readEntity(Note.class));
} | [
"public",
"Note",
"getMergeRequestNote",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
",",
"Integer",
"noteId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
... | Get the specified merge request's note.
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param mergeRequestIid the merge request IID to get the notes for
@param noteId the ID of the Note to get
@return a Note instance for the specified IDs
@throws GitLabApiException if any exception occurs | [
"Get",
"the",
"specified",
"merge",
"request",
"s",
"note",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L371-L375 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java | SDValidation.validateNumerical | protected static void validateNumerical(String opName, SDVariable v1, SDVariable v2) {
if (v1.dataType() == DataType.BOOL || v1.dataType() == DataType.UTF8 || v2.dataType() == DataType.BOOL || v2.dataType() == DataType.UTF8)
throw new IllegalStateException("Cannot perform operation \"" + opName + "\" on variables \"" + v1.getVarName() + "\" and \"" +
v2.getVarName() + "\" if one or both variables are non-numerical: " + v1.dataType() + " and " + v2.dataType());
} | java | protected static void validateNumerical(String opName, SDVariable v1, SDVariable v2) {
if (v1.dataType() == DataType.BOOL || v1.dataType() == DataType.UTF8 || v2.dataType() == DataType.BOOL || v2.dataType() == DataType.UTF8)
throw new IllegalStateException("Cannot perform operation \"" + opName + "\" on variables \"" + v1.getVarName() + "\" and \"" +
v2.getVarName() + "\" if one or both variables are non-numerical: " + v1.dataType() + " and " + v2.dataType());
} | [
"protected",
"static",
"void",
"validateNumerical",
"(",
"String",
"opName",
",",
"SDVariable",
"v1",
",",
"SDVariable",
"v2",
")",
"{",
"if",
"(",
"v1",
".",
"dataType",
"(",
")",
"==",
"DataType",
".",
"BOOL",
"||",
"v1",
".",
"dataType",
"(",
")",
"... | Validate that the operation is being applied on numerical SDVariables (not boolean or utf8).
Some operations (such as sum, norm2, add(Number) etc don't make sense when applied to boolean/utf8 arrays
@param opName Operation name to print in the exception
@param v1 Variable to validate datatype for (input to operation)
@param v2 Variable to validate datatype for (input to operation) | [
"Validate",
"that",
"the",
"operation",
"is",
"being",
"applied",
"on",
"numerical",
"SDVariables",
"(",
"not",
"boolean",
"or",
"utf8",
")",
".",
"Some",
"operations",
"(",
"such",
"as",
"sum",
"norm2",
"add",
"(",
"Number",
")",
"etc",
"don",
"t",
"mak... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L50-L54 |
classgraph/classgraph | src/main/java/io/github/classgraph/PackageInfo.java | PackageInfo.getChildren | public PackageInfoList getChildren() {
if (children == null) {
return PackageInfoList.EMPTY_LIST;
}
final PackageInfoList childrenSorted = new PackageInfoList(children);
// Ensure children are sorted
CollectionUtils.sortIfNotEmpty(childrenSorted, new Comparator<PackageInfo>() {
@Override
public int compare(final PackageInfo o1, final PackageInfo o2) {
return o1.name.compareTo(o2.name);
}
});
return childrenSorted;
} | java | public PackageInfoList getChildren() {
if (children == null) {
return PackageInfoList.EMPTY_LIST;
}
final PackageInfoList childrenSorted = new PackageInfoList(children);
// Ensure children are sorted
CollectionUtils.sortIfNotEmpty(childrenSorted, new Comparator<PackageInfo>() {
@Override
public int compare(final PackageInfo o1, final PackageInfo o2) {
return o1.name.compareTo(o2.name);
}
});
return childrenSorted;
} | [
"public",
"PackageInfoList",
"getChildren",
"(",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"return",
"PackageInfoList",
".",
"EMPTY_LIST",
";",
"}",
"final",
"PackageInfoList",
"childrenSorted",
"=",
"new",
"PackageInfoList",
"(",
"children",
")",... | The child packages of this package, or the empty list if none.
@return the child packages, or the empty list if none. | [
"The",
"child",
"packages",
"of",
"this",
"package",
"or",
"the",
"empty",
"list",
"if",
"none",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/PackageInfo.java#L166-L179 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.getNumber | public Number getNumber(int index) throws JSONException {
Object object = this.get(index);
try {
if (object instanceof Number) {
return (Number)object;
}
return JSONObject.stringToNumber(object.toString());
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.", e);
}
} | java | public Number getNumber(int index) throws JSONException {
Object object = this.get(index);
try {
if (object instanceof Number) {
return (Number)object;
}
return JSONObject.stringToNumber(object.toString());
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.", e);
}
} | [
"public",
"Number",
"getNumber",
"(",
"int",
"index",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"this",
".",
"get",
"(",
"index",
")",
";",
"try",
"{",
"if",
"(",
"object",
"instanceof",
"Number",
")",
"{",
"return",
"(",
"Number",
... | Get the Number value associated with a key.
@param index
The index must be between 0 and length() - 1.
@return The numeric value.
@throws JSONException
if the key is not found or if the value is not a Number
object and cannot be converted to a number. | [
"Get",
"the",
"Number",
"value",
"associated",
"with",
"a",
"key",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L293-L303 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java | AtomCache.getStructureForCathDomain | public Structure getStructureForCathDomain(StructureName structureName, CathDatabase cathInstall) throws IOException, StructureException {
CathDomain cathDomain = cathInstall.getDomainByCathId(structureName.getIdentifier());
Structure s = getStructureForPdbId(cathDomain.getIdentifier());
Structure n = cathDomain.reduce(s);
// add the ligands of the chain...
Chain newChain = n.getPolyChainByPDB(structureName.getChainId());
List<Chain> origChains = s.getNonPolyChainsByPDB(structureName.getChainId());
for ( Chain origChain : origChains) {
List<Group> ligands = origChain.getAtomGroups();
for (Group g : ligands) {
if (!newChain.getAtomGroups().contains(g)) {
newChain.addGroup(g);
}
}
}
return n;
} | java | public Structure getStructureForCathDomain(StructureName structureName, CathDatabase cathInstall) throws IOException, StructureException {
CathDomain cathDomain = cathInstall.getDomainByCathId(structureName.getIdentifier());
Structure s = getStructureForPdbId(cathDomain.getIdentifier());
Structure n = cathDomain.reduce(s);
// add the ligands of the chain...
Chain newChain = n.getPolyChainByPDB(structureName.getChainId());
List<Chain> origChains = s.getNonPolyChainsByPDB(structureName.getChainId());
for ( Chain origChain : origChains) {
List<Group> ligands = origChain.getAtomGroups();
for (Group g : ligands) {
if (!newChain.getAtomGroups().contains(g)) {
newChain.addGroup(g);
}
}
}
return n;
} | [
"public",
"Structure",
"getStructureForCathDomain",
"(",
"StructureName",
"structureName",
",",
"CathDatabase",
"cathInstall",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"CathDomain",
"cathDomain",
"=",
"cathInstall",
".",
"getDomainByCathId",
"(",
"str... | Returns a {@link Structure} corresponding to the CATH identifier supplied in {@code structureName}, using the specified {@link CathDatabase}. | [
"Returns",
"a",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L824-L846 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setCertificateIssuerAsync | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | java | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"IssuerBundle",
">",
"setCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
",",
"String",
"provider",
",",
"IssuerCredentials",
"credentials",
",",
"OrganizationDetails",
"organizationDetails",
",",
"Issue... | Sets the specified certificate issuer.
The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@param credentials The credentials to be used for the issuer.
@param organizationDetails Details of the organization as provided to the issuer.
@param attributes Attributes of the issuer object.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Sets",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"SetCertificateIssuer",
"operation",
"adds",
"or",
"updates",
"the",
"specified",
"certificate",
"issuer",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"setissuers",
"permission",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6017-L6019 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/inventory/message/UpdateInventorySlotsMessage.java | UpdateInventorySlotsMessage.updatePickedItemStack | public static void updatePickedItemStack(ItemStack itemStack, EntityPlayerMP player, int windowId)
{
Packet packet = new Packet(PICKEDITEM, windowId);
packet.draggedItemStack(itemStack);
MalisisCore.network.sendTo(packet, player);
} | java | public static void updatePickedItemStack(ItemStack itemStack, EntityPlayerMP player, int windowId)
{
Packet packet = new Packet(PICKEDITEM, windowId);
packet.draggedItemStack(itemStack);
MalisisCore.network.sendTo(packet, player);
} | [
"public",
"static",
"void",
"updatePickedItemStack",
"(",
"ItemStack",
"itemStack",
",",
"EntityPlayerMP",
"player",
",",
"int",
"windowId",
")",
"{",
"Packet",
"packet",
"=",
"new",
"Packet",
"(",
"PICKEDITEM",
",",
"windowId",
")",
";",
"packet",
".",
"dragg... | Sends a {@link Packet} to player to update the picked {@link ItemStack}.
@param itemStack the item stack
@param player the player
@param windowId the window id | [
"Sends",
"a",
"{",
"@link",
"Packet",
"}",
"to",
"player",
"to",
"update",
"the",
"picked",
"{",
"@link",
"ItemStack",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/UpdateInventorySlotsMessage.java#L106-L111 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/color/ColorLab.java | ColorLab.srgbToLab | public static void srgbToLab( float r , float g , float b , float lab[] ) {
ColorXyz.srgbToXyz(r,g,b,lab);
float X = lab[0];
float Y = lab[1];
float Z = lab[2];
float xr = X/Xr_f;
float yr = Y/Yr_f;
float zr = Z/Zr_f;
float fx, fy, fz;
if(xr > epsilon_f) fx = (float)Math.pow(xr, 1.0f/3.0f);
else fx = (kappa_f*xr + 16.0f)/116.0f;
if(yr > epsilon_f) fy = (float)Math.pow(yr, 1.0/3.0f);
else fy = (kappa_f*yr + 16.0f)/116.0f;
if(zr > epsilon_f) fz = (float)Math.pow(zr, 1.0/3.0f);
else fz = (kappa_f*zr + 16.0f)/116.0f;
lab[0] = 116.0f*fy-16.0f;
lab[1] = 500.0f*(fx-fy);
lab[2] = 200.0f*(fy-fz);
} | java | public static void srgbToLab( float r , float g , float b , float lab[] ) {
ColorXyz.srgbToXyz(r,g,b,lab);
float X = lab[0];
float Y = lab[1];
float Z = lab[2];
float xr = X/Xr_f;
float yr = Y/Yr_f;
float zr = Z/Zr_f;
float fx, fy, fz;
if(xr > epsilon_f) fx = (float)Math.pow(xr, 1.0f/3.0f);
else fx = (kappa_f*xr + 16.0f)/116.0f;
if(yr > epsilon_f) fy = (float)Math.pow(yr, 1.0/3.0f);
else fy = (kappa_f*yr + 16.0f)/116.0f;
if(zr > epsilon_f) fz = (float)Math.pow(zr, 1.0/3.0f);
else fz = (kappa_f*zr + 16.0f)/116.0f;
lab[0] = 116.0f*fy-16.0f;
lab[1] = 500.0f*(fx-fy);
lab[2] = 200.0f*(fy-fz);
} | [
"public",
"static",
"void",
"srgbToLab",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"lab",
"[",
"]",
")",
"{",
"ColorXyz",
".",
"srgbToXyz",
"(",
"r",
",",
"g",
",",
"b",
",",
"lab",
")",
";",
"float",
"X",
"=",
"lab... | Conversion from normalized RGB into LAB. Normalized RGB values have a range of 0:1 | [
"Conversion",
"from",
"normalized",
"RGB",
"into",
"LAB",
".",
"Normalized",
"RGB",
"values",
"have",
"a",
"range",
"of",
"0",
":",
"1"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorLab.java#L93-L115 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newAgent | public Agent newAgent(QualifiedName id, Collection<Attribute> attributes) {
Agent res = newAgent(id);
setAttributes(res, attributes);
return res;
} | java | public Agent newAgent(QualifiedName id, Collection<Attribute> attributes) {
Agent res = newAgent(id);
setAttributes(res, attributes);
return res;
} | [
"public",
"Agent",
"newAgent",
"(",
"QualifiedName",
"id",
",",
"Collection",
"<",
"Attribute",
">",
"attributes",
")",
"{",
"Agent",
"res",
"=",
"newAgent",
"(",
"id",
")",
";",
"setAttributes",
"(",
"res",
",",
"attributes",
")",
";",
"return",
"res",
... | Creates a new {@link Agent} with provided identifier and attributes
@param id a {@link QualifiedName} for the agent
@param attributes a collection of {@link Attribute} for the agent
@return an object of type {@link Agent} | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L447-L451 |
jenkinsci/jenkins | core/src/main/java/hudson/util/FormValidation.java | FormValidation.validateIntegerInRange | public static FormValidation validateIntegerInRange(String value, int lower, int upper) {
try {
int intValue = Integer.parseInt(value);
if (intValue < lower) {
return error(hudson.model.Messages.Hudson_MustBeAtLeast(lower));
}
if (intValue > upper) {
return error(hudson.model.Messages.Hudson_MustBeAtMost(upper));
}
return ok();
} catch (NumberFormatException e) {
return error(hudson.model.Messages.Hudson_NotANumber());
}
} | java | public static FormValidation validateIntegerInRange(String value, int lower, int upper) {
try {
int intValue = Integer.parseInt(value);
if (intValue < lower) {
return error(hudson.model.Messages.Hudson_MustBeAtLeast(lower));
}
if (intValue > upper) {
return error(hudson.model.Messages.Hudson_MustBeAtMost(upper));
}
return ok();
} catch (NumberFormatException e) {
return error(hudson.model.Messages.Hudson_NotANumber());
}
} | [
"public",
"static",
"FormValidation",
"validateIntegerInRange",
"(",
"String",
"value",
",",
"int",
"lower",
",",
"int",
"upper",
")",
"{",
"try",
"{",
"int",
"intValue",
"=",
"Integer",
".",
"parseInt",
"(",
"value",
")",
";",
"if",
"(",
"intValue",
"<",
... | Make sure that the given string is an integer in the range specified by the lower and upper bounds (both inclusive)
@param value the value to check
@param lower the lower bound (inclusive)
@param upper the upper bound (inclusive)
@since 2.104 | [
"Make",
"sure",
"that",
"the",
"given",
"string",
"is",
"an",
"integer",
"in",
"the",
"range",
"specified",
"by",
"the",
"lower",
"and",
"upper",
"bounds",
"(",
"both",
"inclusive",
")"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/FormValidation.java#L407-L420 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.useSequenceForOrderNumber | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException
{
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsIgnoreCase(JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO))
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
else
{
return wsConfig.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER);
}
}
catch (RepositoryConfigurationException e)
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
} | java | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException
{
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsIgnoreCase(JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO))
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
else
{
return wsConfig.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER);
}
}
catch (RepositoryConfigurationException e)
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
} | [
"public",
"static",
"boolean",
"useSequenceForOrderNumber",
"(",
"WorkspaceEntry",
"wsConfig",
",",
"String",
"dbDialect",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"if",
"(",
"wsConfig",
".",
"getContainer",
"(",
")",
".",
"getParameterValue... | Use sequence for order number.
@param wsConfig The workspace configuration.
@return true if the sequence are enable. False otherwise. | [
"Use",
"sequence",
"for",
"order",
"number",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L395-L412 |
groupon/monsoon | history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java | ToXdr.string_index_ | private int string_index_(dictionary_delta dict_delta, MetricValue str) {
assert(str.getStrValue() != null);
final BiMap<MetricValue, Integer> dict = from_.getStrvalDict().inverse();
final Integer resolved = dict.get(str);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(str, allocated);
// Create new pdd for serialization.
strval_dictionary_delta sdd = new strval_dictionary_delta();
sdd.id = allocated;
sdd.value = str.getStrValue();
// Append new entry to array.
dict_delta.sdd = Stream.concat(Arrays.stream(dict_delta.sdd), Stream.of(sdd))
.toArray(strval_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.sdd: {0} items (added {1})", new Object[]{dict_delta.sdd.length, quotedString(sdd.value)});
return allocated;
} | java | private int string_index_(dictionary_delta dict_delta, MetricValue str) {
assert(str.getStrValue() != null);
final BiMap<MetricValue, Integer> dict = from_.getStrvalDict().inverse();
final Integer resolved = dict.get(str);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(str, allocated);
// Create new pdd for serialization.
strval_dictionary_delta sdd = new strval_dictionary_delta();
sdd.id = allocated;
sdd.value = str.getStrValue();
// Append new entry to array.
dict_delta.sdd = Stream.concat(Arrays.stream(dict_delta.sdd), Stream.of(sdd))
.toArray(strval_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.sdd: {0} items (added {1})", new Object[]{dict_delta.sdd.length, quotedString(sdd.value)});
return allocated;
} | [
"private",
"int",
"string_index_",
"(",
"dictionary_delta",
"dict_delta",
",",
"MetricValue",
"str",
")",
"{",
"assert",
"(",
"str",
".",
"getStrValue",
"(",
")",
"!=",
"null",
")",
";",
"final",
"BiMap",
"<",
"MetricValue",
",",
"Integer",
">",
"dict",
"=... | Lookup the index for the argument, or if it isn't present, create one. | [
"Lookup",
"the",
"index",
"for",
"the",
"argument",
"or",
"if",
"it",
"isn",
"t",
"present",
"create",
"one",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java#L185-L204 |
knowm/XChange | xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/service/QuadrigaCxAccountService.java | QuadrigaCxAccountService.requestDepositAddress | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
if (currency.equals(Currency.BTC))
return getQuadrigaCxBitcoinDepositAddress().getDepositAddress();
else if (currency.equals(Currency.ETH))
return getQuadrigaCxEtherDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BCH))
return getQuadrigaCxBitcoinCachDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BTG))
return getQuadrigaCxBitcoinGoldDepositAddress().getDepositAddress();
else if (currency.equals(Currency.LTC))
return getQuadrigaCxLitecoinDepositAddress().getDepositAddress();
else throw new IllegalStateException("unsupported ccy " + currency);
} | java | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
if (currency.equals(Currency.BTC))
return getQuadrigaCxBitcoinDepositAddress().getDepositAddress();
else if (currency.equals(Currency.ETH))
return getQuadrigaCxEtherDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BCH))
return getQuadrigaCxBitcoinCachDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BTG))
return getQuadrigaCxBitcoinGoldDepositAddress().getDepositAddress();
else if (currency.equals(Currency.LTC))
return getQuadrigaCxLitecoinDepositAddress().getDepositAddress();
else throw new IllegalStateException("unsupported ccy " + currency);
} | [
"@",
"Override",
"public",
"String",
"requestDepositAddress",
"(",
"Currency",
"currency",
",",
"String",
"...",
"arguments",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"BTC",
")",
")",
"return",
"getQuadriga... | This returns the currently set deposit address. It will not generate a new address (ie.
repeated calls will return the same address). | [
"This",
"returns",
"the",
"currently",
"set",
"deposit",
"address",
".",
"It",
"will",
"not",
"generate",
"a",
"new",
"address",
"(",
"ie",
".",
"repeated",
"calls",
"will",
"return",
"the",
"same",
"address",
")",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/service/QuadrigaCxAccountService.java#L60-L73 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java | AbstractLogger.enter | protected EntryMessage enter(final String fqcn, final String format, final Supplier<?>... paramSuppliers) {
EntryMessage entryMsg = null;
if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object) null, null)) {
logMessageSafely(fqcn, Level.TRACE, ENTRY_MARKER, entryMsg = entryMsg(format, paramSuppliers), null);
}
return entryMsg;
} | java | protected EntryMessage enter(final String fqcn, final String format, final Supplier<?>... paramSuppliers) {
EntryMessage entryMsg = null;
if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object) null, null)) {
logMessageSafely(fqcn, Level.TRACE, ENTRY_MARKER, entryMsg = entryMsg(format, paramSuppliers), null);
}
return entryMsg;
} | [
"protected",
"EntryMessage",
"enter",
"(",
"final",
"String",
"fqcn",
",",
"final",
"String",
"format",
",",
"final",
"Supplier",
"<",
"?",
">",
"...",
"paramSuppliers",
")",
"{",
"EntryMessage",
"entryMsg",
"=",
"null",
";",
"if",
"(",
"isEnabled",
"(",
"... | Logs entry to a method with location information.
@param fqcn The fully qualified class name of the <b>caller</b>.
@param format Format String for the parameters.
@param paramSuppliers The Suppliers of the parameters. | [
"Logs",
"entry",
"to",
"a",
"method",
"with",
"location",
"information",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L507-L513 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanDescriptor.java | DefaultBeanDescriptor.extractPropertyDescriptor | protected void extractPropertyDescriptor(java.beans.PropertyDescriptor propertyDescriptor, Object defaultInstance)
{
DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor();
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod != null) {
Method readMethod = propertyDescriptor.getReadMethod();
// is parameter hidden
PropertyHidden parameterHidden = extractPropertyAnnotation(writeMethod, readMethod, PropertyHidden.class);
if (parameterHidden == null) {
// get parameter id
PropertyId propertyId = extractPropertyAnnotation(writeMethod, readMethod, PropertyId.class);
desc.setId(propertyId != null ? propertyId.value() : propertyDescriptor.getName());
// set parameter type
Type propertyType;
if (readMethod != null) {
propertyType = readMethod.getGenericReturnType();
} else {
propertyType = writeMethod.getGenericParameterTypes()[0];
}
desc.setPropertyType(propertyType);
// get parameter display name
PropertyName parameterName = extractPropertyAnnotation(writeMethod, readMethod, PropertyName.class);
desc.setName(parameterName != null ? parameterName.value() : desc.getId());
// get parameter description
PropertyDescription parameterDescription =
extractPropertyAnnotation(writeMethod, readMethod, PropertyDescription.class);
desc.setDescription(parameterDescription != null ? parameterDescription.value() : propertyDescriptor
.getShortDescription());
Map<Class, Annotation> annotations = new HashMap<>();
COMMON_ANNOTATION_CLASSES.forEach(aClass ->
annotations.put(aClass, extractPropertyAnnotation(writeMethod, readMethod, aClass))
);
setCommonProperties(desc, annotations);
if (defaultInstance != null && readMethod != null) {
// get default value
try {
desc.setDefaultValue(readMethod.invoke(defaultInstance));
} catch (Exception e) {
LOGGER.error(MessageFormat.format(
"Failed to get default property value from getter {0} in class {1}",
readMethod.getName(),
this.beanClass), e);
}
}
desc.setWriteMethod(writeMethod);
desc.setReadMethod(readMethod);
this.parameterDescriptorMap.put(desc.getId(), desc);
}
}
} | java | protected void extractPropertyDescriptor(java.beans.PropertyDescriptor propertyDescriptor, Object defaultInstance)
{
DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor();
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod != null) {
Method readMethod = propertyDescriptor.getReadMethod();
// is parameter hidden
PropertyHidden parameterHidden = extractPropertyAnnotation(writeMethod, readMethod, PropertyHidden.class);
if (parameterHidden == null) {
// get parameter id
PropertyId propertyId = extractPropertyAnnotation(writeMethod, readMethod, PropertyId.class);
desc.setId(propertyId != null ? propertyId.value() : propertyDescriptor.getName());
// set parameter type
Type propertyType;
if (readMethod != null) {
propertyType = readMethod.getGenericReturnType();
} else {
propertyType = writeMethod.getGenericParameterTypes()[0];
}
desc.setPropertyType(propertyType);
// get parameter display name
PropertyName parameterName = extractPropertyAnnotation(writeMethod, readMethod, PropertyName.class);
desc.setName(parameterName != null ? parameterName.value() : desc.getId());
// get parameter description
PropertyDescription parameterDescription =
extractPropertyAnnotation(writeMethod, readMethod, PropertyDescription.class);
desc.setDescription(parameterDescription != null ? parameterDescription.value() : propertyDescriptor
.getShortDescription());
Map<Class, Annotation> annotations = new HashMap<>();
COMMON_ANNOTATION_CLASSES.forEach(aClass ->
annotations.put(aClass, extractPropertyAnnotation(writeMethod, readMethod, aClass))
);
setCommonProperties(desc, annotations);
if (defaultInstance != null && readMethod != null) {
// get default value
try {
desc.setDefaultValue(readMethod.invoke(defaultInstance));
} catch (Exception e) {
LOGGER.error(MessageFormat.format(
"Failed to get default property value from getter {0} in class {1}",
readMethod.getName(),
this.beanClass), e);
}
}
desc.setWriteMethod(writeMethod);
desc.setReadMethod(readMethod);
this.parameterDescriptorMap.put(desc.getId(), desc);
}
}
} | [
"protected",
"void",
"extractPropertyDescriptor",
"(",
"java",
".",
"beans",
".",
"PropertyDescriptor",
"propertyDescriptor",
",",
"Object",
"defaultInstance",
")",
"{",
"DefaultPropertyDescriptor",
"desc",
"=",
"new",
"DefaultPropertyDescriptor",
"(",
")",
";",
"Method... | Extract provided properties information and insert it in {@link #parameterDescriptorMap}.
@param propertyDescriptor the JAVA bean property descriptor.
@param defaultInstance the default instance of bean class. | [
"Extract",
"provided",
"properties",
"information",
"and",
"insert",
"it",
"in",
"{",
"@link",
"#parameterDescriptorMap",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanDescriptor.java#L140-L204 |
JodaOrg/joda-money | src/main/java/org/joda/money/Money.java | Money.plus | public Money plus(BigDecimal amountToAdd, RoundingMode roundingMode) {
return with(money.plusRetainScale(amountToAdd, roundingMode));
} | java | public Money plus(BigDecimal amountToAdd, RoundingMode roundingMode) {
return with(money.plusRetainScale(amountToAdd, roundingMode));
} | [
"public",
"Money",
"plus",
"(",
"BigDecimal",
"amountToAdd",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"with",
"(",
"money",
".",
"plusRetainScale",
"(",
"amountToAdd",
",",
"roundingMode",
")",
")",
";",
"}"
] | Returns a copy of this monetary value with the amount added.
<p>
This adds the specified amount to this monetary amount, returning a new object.
If the amount to add exceeds the scale of the currency, then the
rounding mode will be used to adjust the result.
<p>
This instance is immutable and unaffected by this method.
@param amountToAdd the monetary value to add, not null
@param roundingMode the rounding mode to use, not null
@return the new instance with the input amount added, never null | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"with",
"the",
"amount",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"specified",
"amount",
"to",
"this",
"monetary",
"amount",
"returning",
"a",
"new",
"object",
".",
"If",
"the",
"amount",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L777-L779 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/beldata/namespace/NamespaceHeaderParser.java | NamespaceHeaderParser.parseNamespace | public NamespaceHeader parseNamespace(String resourceLocation,
File namespaceFile) throws IOException,
BELDataMissingPropertyException,
BELDataConversionException {
if (namespaceFile == null) {
throw new InvalidArgument("namespaceFile", namespaceFile);
}
if (!namespaceFile.exists()) {
throw new InvalidArgument("namespaceFile does not exist");
}
if (!namespaceFile.canRead()) {
throw new InvalidArgument("namespaceFile cannot be read");
}
Map<String, Properties> blockProperties = parse(namespaceFile);
NamespaceBlock nsblock = NamespaceBlock.create(resourceLocation,
blockProperties.get(NamespaceBlock.BLOCK_NAME));
AuthorBlock authorblock = AuthorBlock.create(resourceLocation,
blockProperties.get(AuthorBlock.BLOCK_NAME));
CitationBlock citationBlock = CitationBlock.create(resourceLocation,
blockProperties.get(CitationBlock.BLOCK_NAME));
ProcessingBlock processingBlock = ProcessingBlock.create(
resourceLocation,
blockProperties.get(ProcessingBlock.BLOCK_NAME));
return new NamespaceHeader(nsblock, authorblock, citationBlock,
processingBlock);
} | java | public NamespaceHeader parseNamespace(String resourceLocation,
File namespaceFile) throws IOException,
BELDataMissingPropertyException,
BELDataConversionException {
if (namespaceFile == null) {
throw new InvalidArgument("namespaceFile", namespaceFile);
}
if (!namespaceFile.exists()) {
throw new InvalidArgument("namespaceFile does not exist");
}
if (!namespaceFile.canRead()) {
throw new InvalidArgument("namespaceFile cannot be read");
}
Map<String, Properties> blockProperties = parse(namespaceFile);
NamespaceBlock nsblock = NamespaceBlock.create(resourceLocation,
blockProperties.get(NamespaceBlock.BLOCK_NAME));
AuthorBlock authorblock = AuthorBlock.create(resourceLocation,
blockProperties.get(AuthorBlock.BLOCK_NAME));
CitationBlock citationBlock = CitationBlock.create(resourceLocation,
blockProperties.get(CitationBlock.BLOCK_NAME));
ProcessingBlock processingBlock = ProcessingBlock.create(
resourceLocation,
blockProperties.get(ProcessingBlock.BLOCK_NAME));
return new NamespaceHeader(nsblock, authorblock, citationBlock,
processingBlock);
} | [
"public",
"NamespaceHeader",
"parseNamespace",
"(",
"String",
"resourceLocation",
",",
"File",
"namespaceFile",
")",
"throws",
"IOException",
",",
"BELDataMissingPropertyException",
",",
"BELDataConversionException",
"{",
"if",
"(",
"namespaceFile",
"==",
"null",
")",
"... | Parses the namespace {@link File} into a {@link NamespaceHeader} object.
@param namespaceFile {@link File}, the namespace file, which cannot be
null, must exist, and must be readable
@return {@link NamespaceHeader}, the parsed namespace header
@throws IOException Thrown if an IO error occurred reading the
<tt>namespaceFile</tt>
@throws BELDataConversionException
@throws BELDataMissingPropertyException
@throws InvalidArgument Thrown if the <tt>namespaceFile</tt> is null,
does not exist, or cannot be read | [
"Parses",
"the",
"namespace",
"{",
"@link",
"File",
"}",
"into",
"a",
"{",
"@link",
"NamespaceHeader",
"}",
"object",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/beldata/namespace/NamespaceHeaderParser.java#L72-L105 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsEditorBase.java | CmsEditorBase.renderEntityForm | public void renderEntityForm(String entityId, List<CmsTabInfo> tabInfos, Panel context, Element scrollParent) {
CmsEntity entity = m_entityBackend.getEntity(entityId);
if (entity != null) {
boolean initUndo = (m_entity == null) || !entity.getId().equals(m_entity.getId());
m_entity = entity;
CmsType type = m_entityBackend.getType(m_entity.getTypeName());
m_formPanel = new FlowPanel();
context.add(m_formPanel);
CmsAttributeHandler.setScrollElement(scrollParent);
CmsButtonBarHandler.INSTANCE.setWidgetService(m_widgetService);
if (m_rootHandler == null) {
m_rootHandler = new CmsRootHandler();
} else {
m_rootHandler.clearHandlers();
}
m_tabInfos = tabInfos;
m_formTabs = m_widgetService.getRendererForType(
type).renderForm(m_entity, m_tabInfos, m_formPanel, m_rootHandler, 0);
m_validationHandler.registerEntity(m_entity);
m_validationHandler.setRootHandler(m_rootHandler);
m_validationHandler.setFormTabPanel(m_formTabs);
if (initUndo) {
CmsUndoRedoHandler.getInstance().initialize(m_entity, this, m_rootHandler);
}
// trigger validation right away
m_validationHandler.validate(m_entity);
}
} | java | public void renderEntityForm(String entityId, List<CmsTabInfo> tabInfos, Panel context, Element scrollParent) {
CmsEntity entity = m_entityBackend.getEntity(entityId);
if (entity != null) {
boolean initUndo = (m_entity == null) || !entity.getId().equals(m_entity.getId());
m_entity = entity;
CmsType type = m_entityBackend.getType(m_entity.getTypeName());
m_formPanel = new FlowPanel();
context.add(m_formPanel);
CmsAttributeHandler.setScrollElement(scrollParent);
CmsButtonBarHandler.INSTANCE.setWidgetService(m_widgetService);
if (m_rootHandler == null) {
m_rootHandler = new CmsRootHandler();
} else {
m_rootHandler.clearHandlers();
}
m_tabInfos = tabInfos;
m_formTabs = m_widgetService.getRendererForType(
type).renderForm(m_entity, m_tabInfos, m_formPanel, m_rootHandler, 0);
m_validationHandler.registerEntity(m_entity);
m_validationHandler.setRootHandler(m_rootHandler);
m_validationHandler.setFormTabPanel(m_formTabs);
if (initUndo) {
CmsUndoRedoHandler.getInstance().initialize(m_entity, this, m_rootHandler);
}
// trigger validation right away
m_validationHandler.validate(m_entity);
}
} | [
"public",
"void",
"renderEntityForm",
"(",
"String",
"entityId",
",",
"List",
"<",
"CmsTabInfo",
">",
"tabInfos",
",",
"Panel",
"context",
",",
"Element",
"scrollParent",
")",
"{",
"CmsEntity",
"entity",
"=",
"m_entityBackend",
".",
"getEntity",
"(",
"entityId",... | Renders the entity form within the given context.<p>
@param entityId the entity id
@param tabInfos the tab informations
@param context the context element
@param scrollParent the scroll element to be used for automatic scrolling during drag and drop | [
"Renders",
"the",
"entity",
"form",
"within",
"the",
"given",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L384-L412 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java | ExternalChildResourcesCachedImpl.prepareInlineRemove | protected final void prepareInlineRemove(String name, String key) {
FluentModelTImpl childResource = find(key);
if (childResource == null
|| childResource.pendingOperation() == ExternalChildResourceImpl.PendingOperation.ToBeCreated) {
throw new IllegalArgumentException("A child resource ('" + childResourceName + "') with name (key) '" + name + " (" + key + ")' not found");
}
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeRemoved);
super.prepareForFutureCommitOrPostRun(childResource);
} | java | protected final void prepareInlineRemove(String name, String key) {
FluentModelTImpl childResource = find(key);
if (childResource == null
|| childResource.pendingOperation() == ExternalChildResourceImpl.PendingOperation.ToBeCreated) {
throw new IllegalArgumentException("A child resource ('" + childResourceName + "') with name (key) '" + name + " (" + key + ")' not found");
}
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeRemoved);
super.prepareForFutureCommitOrPostRun(childResource);
} | [
"protected",
"final",
"void",
"prepareInlineRemove",
"(",
"String",
"name",
",",
"String",
"key",
")",
"{",
"FluentModelTImpl",
"childResource",
"=",
"find",
"(",
"key",
")",
";",
"if",
"(",
"childResource",
"==",
"null",
"||",
"childResource",
".",
"pendingOp... | Prepare for inline removal of an external child resource (along with the update of parent resource).
@param name the name of the external child resource
@param key the key | [
"Prepare",
"for",
"inline",
"removal",
"of",
"an",
"external",
"child",
"resource",
"(",
"along",
"with",
"the",
"update",
"of",
"parent",
"resource",
")",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourcesCachedImpl.java#L146-L154 |
sockeqwe/mosby | sample-mail/src/main/java/com/hannesdorfmann/mosby3/sample/mail/utils/DimensUtils.java | DimensUtils.pxToDp | public static int pxToDp(Context context, int px) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((px / displayMetrics.density) + 0.5);
} | java | public static int pxToDp(Context context, int px) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((px / displayMetrics.density) + 0.5);
} | [
"public",
"static",
"int",
"pxToDp",
"(",
"Context",
"context",
",",
"int",
"px",
")",
"{",
"DisplayMetrics",
"displayMetrics",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"... | Converts pixel in dp
@param context The context
@param px the pixel value
@return value in dp | [
"Converts",
"pixel",
"in",
"dp"
] | train | https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/sample-mail/src/main/java/com/hannesdorfmann/mosby3/sample/mail/utils/DimensUtils.java#L33-L36 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResult.java | CreateIntegrationResult.withRequestParameters | public CreateIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | java | public CreateIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | [
"public",
"CreateIntegrationResult",
"withRequestParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"setRequestParameters",
"(",
"requestParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map specifying request parameters that are passed from the method request to the backend. The key is
an integration request parameter name and the associated value is a method request parameter value or static
value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request
parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring,
path, or header; and {name} must be a valid and unique method request parameter name.
</p>
@param requestParameters
A key-value map specifying request parameters that are passed from the method request to the backend. The
key is an integration request parameter name and the associated value is a method request parameter value
or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The
method request parameter value must match the pattern of method.request.{location}.{name} , where
{location} is querystring, path, or header; and {name} must be a valid and unique method request parameter
name.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"request",
"parameters",
"that",
"are",
"passed",
"from",
"the",
"method",
"request",
"to",
"the",
"backend",
".",
"The",
"key",
"is",
"an",
"integration",
"request",
"parameter",
"name",
"and",
"th... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResult.java#L1146-L1149 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/view/template/FreemarkerTemplateEngine.java | FreemarkerTemplateEngine.setFreemarkerManager | @Inject
public void setFreemarkerManager(FreemarkerManager mgr) {
this.freemarkerManager = mgr;
if (null != freemarkerManager) {
Configuration old = freemarkerManager.getConfig();
if (null != old) {
config = (Configuration) freemarkerManager.getConfig().clone();
config.setTemplateLoader(new HierarchicalTemplateLoader(this, config.getTemplateLoader()));
} else {
config = new Configuration(Configuration.VERSION_2_3_28);
config.setTemplateLoader(new HierarchicalTemplateLoader(this, new BeangleClassTemplateLoader(null)));
}
// Disable freemarker localized lookup
config.setLocalizedLookup(false);
config.setEncoding(config.getLocale(), "UTF-8");
config.setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX);
// Cache one hour(7200s) and Strong cache
config.setTemplateUpdateDelayMilliseconds(7200 * 1000);
// config.setCacheStorage(new MruCacheStorage(100,250));
config.setCacheStorage(new StrongCacheStorage());
// Disable auto imports and includes
config.setAutoImports(CollectUtils.newHashMap());
config.setAutoIncludes(CollectUtils.newArrayList(0));
}
} | java | @Inject
public void setFreemarkerManager(FreemarkerManager mgr) {
this.freemarkerManager = mgr;
if (null != freemarkerManager) {
Configuration old = freemarkerManager.getConfig();
if (null != old) {
config = (Configuration) freemarkerManager.getConfig().clone();
config.setTemplateLoader(new HierarchicalTemplateLoader(this, config.getTemplateLoader()));
} else {
config = new Configuration(Configuration.VERSION_2_3_28);
config.setTemplateLoader(new HierarchicalTemplateLoader(this, new BeangleClassTemplateLoader(null)));
}
// Disable freemarker localized lookup
config.setLocalizedLookup(false);
config.setEncoding(config.getLocale(), "UTF-8");
config.setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX);
// Cache one hour(7200s) and Strong cache
config.setTemplateUpdateDelayMilliseconds(7200 * 1000);
// config.setCacheStorage(new MruCacheStorage(100,250));
config.setCacheStorage(new StrongCacheStorage());
// Disable auto imports and includes
config.setAutoImports(CollectUtils.newHashMap());
config.setAutoIncludes(CollectUtils.newArrayList(0));
}
} | [
"@",
"Inject",
"public",
"void",
"setFreemarkerManager",
"(",
"FreemarkerManager",
"mgr",
")",
"{",
"this",
".",
"freemarkerManager",
"=",
"mgr",
";",
"if",
"(",
"null",
"!=",
"freemarkerManager",
")",
"{",
"Configuration",
"old",
"=",
"freemarkerManager",
".",
... | Clone configuration from FreemarkerManager,but custmize in
<ul>
<li>Disable freemarker localized lookup
<li>Cache two hour(7200s) and Strong cache
<li>Disable auto imports and includes
</ul> | [
"Clone",
"configuration",
"from",
"FreemarkerManager",
"but",
"custmize",
"in",
"<ul",
">",
"<li",
">",
"Disable",
"freemarker",
"localized",
"lookup",
"<li",
">",
"Cache",
"two",
"hour",
"(",
"7200s",
")",
"and",
"Strong",
"cache",
"<li",
">",
"Disable",
"a... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/template/FreemarkerTemplateEngine.java#L80-L105 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/BaseScriptPlugin.java | BaseScriptPlugin.createScriptArgsList | protected ExecArgList createScriptArgsList(final Map<String, Map<String, String>> dataContext) {
final ScriptPluginProvider plugin = getProvider();
final File scriptfile = plugin.getScriptFile();
final String scriptargs = null != plugin.getScriptArgs() ?
DataContextUtils.replaceDataReferencesInString(plugin.getScriptArgs(), dataContext) :
null;
final String[] scriptargsarr = null!=plugin.getScriptArgsArray() ?
DataContextUtils.replaceDataReferencesInArray(plugin.getScriptArgsArray(), dataContext) :
null;
final String scriptinterpreter = plugin.getScriptInterpreter();
final boolean interpreterargsquoted = plugin.getInterpreterArgsQuoted();
return getScriptExecHelper().createScriptArgList(scriptfile.getAbsolutePath(),
scriptargs, scriptargsarr, scriptinterpreter, interpreterargsquoted);
} | java | protected ExecArgList createScriptArgsList(final Map<String, Map<String, String>> dataContext) {
final ScriptPluginProvider plugin = getProvider();
final File scriptfile = plugin.getScriptFile();
final String scriptargs = null != plugin.getScriptArgs() ?
DataContextUtils.replaceDataReferencesInString(plugin.getScriptArgs(), dataContext) :
null;
final String[] scriptargsarr = null!=plugin.getScriptArgsArray() ?
DataContextUtils.replaceDataReferencesInArray(plugin.getScriptArgsArray(), dataContext) :
null;
final String scriptinterpreter = plugin.getScriptInterpreter();
final boolean interpreterargsquoted = plugin.getInterpreterArgsQuoted();
return getScriptExecHelper().createScriptArgList(scriptfile.getAbsolutePath(),
scriptargs, scriptargsarr, scriptinterpreter, interpreterargsquoted);
} | [
"protected",
"ExecArgList",
"createScriptArgsList",
"(",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"dataContext",
")",
"{",
"final",
"ScriptPluginProvider",
"plugin",
"=",
"getProvider",
"(",
")",
";",
"final",
"File",
... | Create the command array for the data context.
@param dataContext data
@return arglist | [
"Create",
"the",
"command",
"array",
"for",
"the",
"data",
"context",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/BaseScriptPlugin.java#L198-L214 |
Alluxio/alluxio | underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AInputStream.java | S3AInputStream.openStream | private void openStream() throws IOException {
if (mIn != null) { // stream is already open
return;
}
GetObjectRequest getReq = new GetObjectRequest(mBucketName, mKey);
// If the position is 0, setting range is redundant and causes an error if the file is 0 length
if (mPos > 0) {
getReq.setRange(mPos);
}
AmazonS3Exception lastException = null;
while (mRetryPolicy.attempt()) {
try {
mIn = mClient.getObject(getReq).getObjectContent();
return;
} catch (AmazonS3Exception e) {
LOG.warn("Attempt {} to open key {} in bucket {} failed with exception : {}",
mRetryPolicy.getAttemptCount(), mKey, mBucketName, e.toString());
if (e.getStatusCode() != HttpStatus.SC_NOT_FOUND) {
throw new IOException(e);
}
// Key does not exist
lastException = e;
}
}
// Failed after retrying key does not exist
throw new IOException(lastException);
} | java | private void openStream() throws IOException {
if (mIn != null) { // stream is already open
return;
}
GetObjectRequest getReq = new GetObjectRequest(mBucketName, mKey);
// If the position is 0, setting range is redundant and causes an error if the file is 0 length
if (mPos > 0) {
getReq.setRange(mPos);
}
AmazonS3Exception lastException = null;
while (mRetryPolicy.attempt()) {
try {
mIn = mClient.getObject(getReq).getObjectContent();
return;
} catch (AmazonS3Exception e) {
LOG.warn("Attempt {} to open key {} in bucket {} failed with exception : {}",
mRetryPolicy.getAttemptCount(), mKey, mBucketName, e.toString());
if (e.getStatusCode() != HttpStatus.SC_NOT_FOUND) {
throw new IOException(e);
}
// Key does not exist
lastException = e;
}
}
// Failed after retrying key does not exist
throw new IOException(lastException);
} | [
"private",
"void",
"openStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mIn",
"!=",
"null",
")",
"{",
"// stream is already open",
"return",
";",
"}",
"GetObjectRequest",
"getReq",
"=",
"new",
"GetObjectRequest",
"(",
"mBucketName",
",",
"mKey",
"... | Opens a new stream at mPos if the wrapped stream mIn is null. | [
"Opens",
"a",
"new",
"stream",
"at",
"mPos",
"if",
"the",
"wrapped",
"stream",
"mIn",
"is",
"null",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AInputStream.java#L136-L162 |
AltBeacon/android-beacon-library | lib/src/main/java/org/altbeacon/beacon/Identifier.java | Identifier.fromBytes | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static Identifier fromBytes(byte[] bytes, int start, int end, boolean littleEndian) {
if (bytes == null) {
throw new NullPointerException("Identifiers cannot be constructed from null pointers but \"bytes\" is null.");
}
if (start < 0 || start > bytes.length) {
throw new ArrayIndexOutOfBoundsException("start < 0 || start > bytes.length");
}
if (end > bytes.length) {
throw new ArrayIndexOutOfBoundsException("end > bytes.length");
}
if (start > end) {
throw new IllegalArgumentException("start > end");
}
byte[] byteRange = Arrays.copyOfRange(bytes, start, end);
if (littleEndian) {
reverseArray(byteRange);
}
return new Identifier(byteRange);
} | java | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static Identifier fromBytes(byte[] bytes, int start, int end, boolean littleEndian) {
if (bytes == null) {
throw new NullPointerException("Identifiers cannot be constructed from null pointers but \"bytes\" is null.");
}
if (start < 0 || start > bytes.length) {
throw new ArrayIndexOutOfBoundsException("start < 0 || start > bytes.length");
}
if (end > bytes.length) {
throw new ArrayIndexOutOfBoundsException("end > bytes.length");
}
if (start > end) {
throw new IllegalArgumentException("start > end");
}
byte[] byteRange = Arrays.copyOfRange(bytes, start, end);
if (littleEndian) {
reverseArray(byteRange);
}
return new Identifier(byteRange);
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"GINGERBREAD",
")",
"public",
"static",
"Identifier",
"fromBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"start",
",",
"int",
"end",
",",
"boolean",
"littleEndian",
")",
"{",
"if",
"(",
"by... | Creates an Identifier from the specified byte array.
@param bytes array to copy from
@param start the start index, inclusive
@param end the end index, exclusive
@param littleEndian whether the bytes are ordered in little endian
@return a new Identifier
@throws java.lang.NullPointerException <code>bytes</code> must not be <code>null</code>
@throws java.lang.ArrayIndexOutOfBoundsException start or end are outside the bounds of the array
@throws java.lang.IllegalArgumentException start is larger than end | [
"Creates",
"an",
"Identifier",
"from",
"the",
"specified",
"byte",
"array",
"."
] | train | https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/Identifier.java#L171-L191 |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/DSUtil.java | DSUtil.iterableSizeEq | public static <E> boolean iterableSizeEq(Iterable<E> itrbl, int k) {
// 1) try to iterate k times over itrbl;
Iterator<E> it = itrbl.iterator();
for(int i = 0; i < k; i++) {
if(!it.hasNext()) return false;
it.next();
}
// 2) next check that there are no more elements in itrbl
return !it.hasNext();
} | java | public static <E> boolean iterableSizeEq(Iterable<E> itrbl, int k) {
// 1) try to iterate k times over itrbl;
Iterator<E> it = itrbl.iterator();
for(int i = 0; i < k; i++) {
if(!it.hasNext()) return false;
it.next();
}
// 2) next check that there are no more elements in itrbl
return !it.hasNext();
} | [
"public",
"static",
"<",
"E",
">",
"boolean",
"iterableSizeEq",
"(",
"Iterable",
"<",
"E",
">",
"itrbl",
",",
"int",
"k",
")",
"{",
"// 1) try to iterate k times over itrbl;",
"Iterator",
"<",
"E",
">",
"it",
"=",
"itrbl",
".",
"iterator",
"(",
")",
";",
... | Checks whether the iterable <code>itrbl</code> has exactly
<code>k</code> elements. Instead of computing the length of
<code>itrbl</code> (complexity: linear in the length) and
comparing it with <code>k</code>, we try to iterate exactly
<code>k</code> times and next check that <code>itrbl</code> is
exhausted.
Complexity: linear in <code>k</code>. Hence, this test is
very fast for small <code>k</code>s. | [
"Checks",
"whether",
"the",
"iterable",
"<code",
">",
"itrbl<",
"/",
"code",
">",
"has",
"exactly",
"<code",
">",
"k<",
"/",
"code",
">",
"elements",
".",
"Instead",
"of",
"computing",
"the",
"length",
"of",
"<code",
">",
"itrbl<",
"/",
"code",
">",
"(... | train | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/DSUtil.java#L97-L106 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.closureCollector | public Collector<Type, ClosureHolder, List<Type>> closureCollector(boolean minClosure, BiPredicate<Type, Type> shouldSkip) {
return Collector.of(() -> new ClosureHolder(minClosure, shouldSkip),
ClosureHolder::add,
ClosureHolder::merge,
ClosureHolder::closure);
} | java | public Collector<Type, ClosureHolder, List<Type>> closureCollector(boolean minClosure, BiPredicate<Type, Type> shouldSkip) {
return Collector.of(() -> new ClosureHolder(minClosure, shouldSkip),
ClosureHolder::add,
ClosureHolder::merge,
ClosureHolder::closure);
} | [
"public",
"Collector",
"<",
"Type",
",",
"ClosureHolder",
",",
"List",
"<",
"Type",
">",
">",
"closureCollector",
"(",
"boolean",
"minClosure",
",",
"BiPredicate",
"<",
"Type",
",",
"Type",
">",
"shouldSkip",
")",
"{",
"return",
"Collector",
".",
"of",
"("... | Collect types into a new closure (using a @code{ClosureHolder}) | [
"Collect",
"types",
"into",
"a",
"new",
"closure",
"(",
"using",
"a"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3436-L3441 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TaiwanCalendar.java | TaiwanCalendar.handleGetLimit | protected int handleGetLimit(int field, int limitType) {
if (field == ERA) {
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return BEFORE_MINGUO;
} else {
return MINGUO;
}
}
return super.handleGetLimit(field, limitType);
} | java | protected int handleGetLimit(int field, int limitType) {
if (field == ERA) {
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return BEFORE_MINGUO;
} else {
return MINGUO;
}
}
return super.handleGetLimit(field, limitType);
} | [
"protected",
"int",
"handleGetLimit",
"(",
"int",
"field",
",",
"int",
"limitType",
")",
"{",
"if",
"(",
"field",
"==",
"ERA",
")",
"{",
"if",
"(",
"limitType",
"==",
"MINIMUM",
"||",
"limitType",
"==",
"GREATEST_MINIMUM",
")",
"{",
"return",
"BEFORE_MINGU... | Override GregorianCalendar. There is only one Taiwan ERA. We
should really handle YEAR, YEAR_WOY, and EXTENDED_YEAR here too to
implement the 1..5000000 range, but it's not critical. | [
"Override",
"GregorianCalendar",
".",
"There",
"is",
"only",
"one",
"Taiwan",
"ERA",
".",
"We",
"should",
"really",
"handle",
"YEAR",
"YEAR_WOY",
"and",
"EXTENDED_YEAR",
"here",
"too",
"to",
"implement",
"the",
"1",
"..",
"5000000",
"range",
"but",
"it",
"s"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TaiwanCalendar.java#L221-L230 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ReflectionUtil.java | ReflectionUtil.invokeMethod | public static <T> T invokeMethod(Method method, Object target, Object... args) {
if (method == null) {
return null;
}
method.setAccessible(true);
try {
@SuppressWarnings("unchecked")
T result = (T) method.invoke(target, args);
return result;
} catch (Exception e) {
throw new RuntimeValidateException(e);
}
} | java | public static <T> T invokeMethod(Method method, Object target, Object... args) {
if (method == null) {
return null;
}
method.setAccessible(true);
try {
@SuppressWarnings("unchecked")
T result = (T) method.invoke(target, args);
return result;
} catch (Exception e) {
throw new RuntimeValidateException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Method",
"method",
",",
"Object",
"target",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"method",
".",
"setAccessible",
... | 方法调用,如果<code>clazz</code>为<code>null</code>,返回<code>null</code>;
<p/>
如果<code>method</code>为<code>null</code>,返回<code>null</code>
<p/>
如果<code>target</code>为<code>null</code>,则为静态方法
@param method 调用的方法
@param target 目标对象
@param args 方法的参数值
@return 调用结果 | [
"方法调用,如果<code",
">",
"clazz<",
"/",
"code",
">",
"为<code",
">",
"null<",
"/",
"code",
">",
",返回<code",
">",
"null<",
"/",
"code",
">",
";",
"<p",
"/",
">",
"如果<code",
">",
"method<",
"/",
"code",
">",
"为<code",
">",
"null<",
"/",
"code",
">",
",返回<... | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ReflectionUtil.java#L174-L187 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/util/UtilityElf.java | UtilityElf.createInstance | public static <T> T createInstance(final String className, final Class<T> clazz, final Object... args)
{
if (className == null) {
return null;
}
try {
Class<?> loaded = UtilityElf.class.getClassLoader().loadClass(className);
if (args.length == 0) {
return clazz.cast(loaded.newInstance());
}
Class<?>[] argClasses = new Class<?>[args.length];
for (int i = 0; i < args.length; i++) {
argClasses[i] = args[i].getClass();
}
Constructor<?> constructor = loaded.getConstructor(argClasses);
return clazz.cast(constructor.newInstance(args));
}
catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static <T> T createInstance(final String className, final Class<T> clazz, final Object... args)
{
if (className == null) {
return null;
}
try {
Class<?> loaded = UtilityElf.class.getClassLoader().loadClass(className);
if (args.length == 0) {
return clazz.cast(loaded.newInstance());
}
Class<?>[] argClasses = new Class<?>[args.length];
for (int i = 0; i < args.length; i++) {
argClasses[i] = args[i].getClass();
}
Constructor<?> constructor = loaded.getConstructor(argClasses);
return clazz.cast(constructor.newInstance(args));
}
catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"final",
"String",
"className",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"return",
"... | Create and instance of the specified class using the constructor matching the specified
arguments.
@param <T> the class type
@param className the name of the class to instantiate
@param clazz a class to cast the result as
@param args arguments to a constructor
@return an instance of the specified class | [
"Create",
"and",
"instance",
"of",
"the",
"specified",
"class",
"using",
"the",
"constructor",
"matching",
"the",
"specified",
"arguments",
"."
] | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L92-L114 |
jbundle/jbundle | base/message/core/src/main/java/org/jbundle/base/message/core/tree/TreeMessageFilterList.java | TreeMessageFilterList.removeMessageFilter | public boolean removeMessageFilter(Integer intFilterID, boolean bFreeFilter)
{
BaseMessageFilter messageFilter = this.getMessageFilter(intFilterID);
if (messageFilter == null)
return false; // It is possible for a client to try to remove it's remote filter that was removed as a duplicate filter.
boolean bRemoved = this.getRegistry().removeMessageFilter(messageFilter);
if (!bRemoved)
System.out.println("Filter not found on remove");
bRemoved = super.removeMessageFilter(intFilterID, bFreeFilter);
return bRemoved; // Success.
} | java | public boolean removeMessageFilter(Integer intFilterID, boolean bFreeFilter)
{
BaseMessageFilter messageFilter = this.getMessageFilter(intFilterID);
if (messageFilter == null)
return false; // It is possible for a client to try to remove it's remote filter that was removed as a duplicate filter.
boolean bRemoved = this.getRegistry().removeMessageFilter(messageFilter);
if (!bRemoved)
System.out.println("Filter not found on remove");
bRemoved = super.removeMessageFilter(intFilterID, bFreeFilter);
return bRemoved; // Success.
} | [
"public",
"boolean",
"removeMessageFilter",
"(",
"Integer",
"intFilterID",
",",
"boolean",
"bFreeFilter",
")",
"{",
"BaseMessageFilter",
"messageFilter",
"=",
"this",
".",
"getMessageFilter",
"(",
"intFilterID",
")",
";",
"if",
"(",
"messageFilter",
"==",
"null",
... | Remove this message filter from this queue.
Note: This will remove a filter that equals this filter, accounting for a copy
passed from a remote client.
@param messageFilter The message filter to remove.
@param bFreeFilter If true, free this filter.
@return True if successful. | [
"Remove",
"this",
"message",
"filter",
"from",
"this",
"queue",
".",
"Note",
":",
"This",
"will",
"remove",
"a",
"filter",
"that",
"equals",
"this",
"filter",
"accounting",
"for",
"a",
"copy",
"passed",
"from",
"a",
"remote",
"client",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/TreeMessageFilterList.java#L74-L84 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java | SendSoapFaultActionParser.parseFault | private void parseFault(BeanDefinitionBuilder builder, Element faultElement) {
if (faultElement != null) {
Element faultCodeElement = DomUtils.getChildElementByTagName(faultElement, "fault-code");
if (faultCodeElement != null) {
builder.addPropertyValue("faultCode", DomUtils.getTextValue(faultCodeElement).trim());
}
Element faultStringElement = DomUtils.getChildElementByTagName(faultElement, "fault-string");
if (faultStringElement != null) {
builder.addPropertyValue("faultString", DomUtils.getTextValue(faultStringElement).trim());
}
Element faultActorElement = DomUtils.getChildElementByTagName(faultElement, "fault-actor");
if (faultActorElement != null) {
builder.addPropertyValue("faultActor", DomUtils.getTextValue(faultActorElement).trim());
}
parseFaultDetail(builder, faultElement);
}
} | java | private void parseFault(BeanDefinitionBuilder builder, Element faultElement) {
if (faultElement != null) {
Element faultCodeElement = DomUtils.getChildElementByTagName(faultElement, "fault-code");
if (faultCodeElement != null) {
builder.addPropertyValue("faultCode", DomUtils.getTextValue(faultCodeElement).trim());
}
Element faultStringElement = DomUtils.getChildElementByTagName(faultElement, "fault-string");
if (faultStringElement != null) {
builder.addPropertyValue("faultString", DomUtils.getTextValue(faultStringElement).trim());
}
Element faultActorElement = DomUtils.getChildElementByTagName(faultElement, "fault-actor");
if (faultActorElement != null) {
builder.addPropertyValue("faultActor", DomUtils.getTextValue(faultActorElement).trim());
}
parseFaultDetail(builder, faultElement);
}
} | [
"private",
"void",
"parseFault",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"Element",
"faultElement",
")",
"{",
"if",
"(",
"faultElement",
"!=",
"null",
")",
"{",
"Element",
"faultCodeElement",
"=",
"DomUtils",
".",
"getChildElementByTagName",
"(",
"faultElement... | Parses the SOAP fault information.
@param builder
@param faultElement | [
"Parses",
"the",
"SOAP",
"fault",
"information",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java#L52-L71 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_responder_account_DELETE | public OvhTaskSpecialAccount domain_responder_account_DELETE(String domain, String account) throws IOException {
String qPath = "/email/domain/{domain}/responder/{account}";
StringBuilder sb = path(qPath, domain, account);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | java | public OvhTaskSpecialAccount domain_responder_account_DELETE(String domain, String account) throws IOException {
String qPath = "/email/domain/{domain}/responder/{account}";
StringBuilder sb = path(qPath, domain, account);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | [
"public",
"OvhTaskSpecialAccount",
"domain_responder_account_DELETE",
"(",
"String",
"domain",
",",
"String",
"account",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/responder/{account}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"... | Delete an existing responder in server
REST: DELETE /email/domain/{domain}/responder/{account}
@param domain [required] Name of your domain name
@param account [required] Name of account | [
"Delete",
"an",
"existing",
"responder",
"in",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L978-L983 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.nextBigInteger | public BigInteger nextBigInteger(int radix) {
// Check cached result
if ((typeCache != null) && (typeCache instanceof BigInteger)
&& this.radix == radix) {
BigInteger val = (BigInteger)typeCache;
useTypeCache();
return val;
}
setRadix(radix);
clearCaches();
// Search for next int
try {
String s = next(integerPattern());
if (matcher.group(SIMPLE_GROUP_INDEX) == null)
s = processIntegerToken(s);
return new BigInteger(s, radix);
} catch (NumberFormatException nfe) {
position = matcher.start(); // don't skip bad token
throw new InputMismatchException(nfe.getMessage());
}
} | java | public BigInteger nextBigInteger(int radix) {
// Check cached result
if ((typeCache != null) && (typeCache instanceof BigInteger)
&& this.radix == radix) {
BigInteger val = (BigInteger)typeCache;
useTypeCache();
return val;
}
setRadix(radix);
clearCaches();
// Search for next int
try {
String s = next(integerPattern());
if (matcher.group(SIMPLE_GROUP_INDEX) == null)
s = processIntegerToken(s);
return new BigInteger(s, radix);
} catch (NumberFormatException nfe) {
position = matcher.start(); // don't skip bad token
throw new InputMismatchException(nfe.getMessage());
}
} | [
"public",
"BigInteger",
"nextBigInteger",
"(",
"int",
"radix",
")",
"{",
"// Check cached result",
"if",
"(",
"(",
"typeCache",
"!=",
"null",
")",
"&&",
"(",
"typeCache",
"instanceof",
"BigInteger",
")",
"&&",
"this",
".",
"radix",
"==",
"radix",
")",
"{",
... | Scans the next token of the input as a {@link java.math.BigInteger
BigInteger}.
<p> If the next token matches the <a
href="#Integer-regex"><i>Integer</i></a> regular expression defined
above then the token is converted into a <tt>BigInteger</tt> value as if
by removing all group separators, mapping non-ASCII digits into ASCII
digits via the {@link Character#digit Character.digit}, and passing the
resulting string to the {@link
java.math.BigInteger#BigInteger(java.lang.String)
BigInteger(String, int)} constructor with the specified radix.
@param radix the radix used to interpret the token
@return the <tt>BigInteger</tt> scanned from the input
@throws InputMismatchException
if the next token does not match the <i>Integer</i>
regular expression, or is out of range
@throws NoSuchElementException if the input is exhausted
@throws IllegalStateException if this scanner is closed | [
"Scans",
"the",
"next",
"token",
"of",
"the",
"input",
"as",
"a",
"{",
"@link",
"java",
".",
"math",
".",
"BigInteger",
"BigInteger",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L2479-L2499 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamper.java | PdfStamper.setEncryption | public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException {
if (stamper.isAppend())
throw new DocumentException("Append mode does not support changing the encryption status.");
if (stamper.isContentWritten())
throw new DocumentException("Content was already written to the output.");
stamper.setEncryption(userPassword, ownerPassword, permissions, encryptionType);
} | java | public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException {
if (stamper.isAppend())
throw new DocumentException("Append mode does not support changing the encryption status.");
if (stamper.isContentWritten())
throw new DocumentException("Content was already written to the output.");
stamper.setEncryption(userPassword, ownerPassword, permissions, encryptionType);
} | [
"public",
"void",
"setEncryption",
"(",
"byte",
"userPassword",
"[",
"]",
",",
"byte",
"ownerPassword",
"[",
"]",
",",
"int",
"permissions",
",",
"int",
"encryptionType",
")",
"throws",
"DocumentException",
"{",
"if",
"(",
"stamper",
".",
"isAppend",
"(",
")... | Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open | [
"Sets",
"the",
"encryption",
"options",
"for",
"this",
"document",
".",
"The",
"userPassword",
"and",
"the",
"ownerPassword",
"can",
"be",
"null",
"or",
"have",
"zero",
"length",
".",
"In",
"this",
"case",
"the",
"ownerPassword",
"is",
"replaced",
"by",
"a",... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L290-L296 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toTempFile | public static void toTempFile(final HttpConfig config, final String contentType) {
try {
toFile(config, contentType, File.createTempFile("tmp", ".tmp"));
}
catch(IOException ioe) {
throw new TransportingException(ioe);
}
} | java | public static void toTempFile(final HttpConfig config, final String contentType) {
try {
toFile(config, contentType, File.createTempFile("tmp", ".tmp"));
}
catch(IOException ioe) {
throw new TransportingException(ioe);
}
} | [
"public",
"static",
"void",
"toTempFile",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"String",
"contentType",
")",
"{",
"try",
"{",
"toFile",
"(",
"config",
",",
"contentType",
",",
"File",
".",
"createTempFile",
"(",
"\"tmp\"",
",",
"\".tmp\"",
")"... | Downloads the content to a temporary file (*.tmp in the system temp directory) with the specified content type.
@param config the `HttpConfig` instance
@param contentType the content type | [
"Downloads",
"the",
"content",
"to",
"a",
"temporary",
"file",
"(",
"*",
".",
"tmp",
"in",
"the",
"system",
"temp",
"directory",
")",
"with",
"the",
"specified",
"content",
"type",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L66-L73 |
apigee/usergrid-java-sdk | src/main/java/org/usergrid/java/client/Client.java | Client.createGroup | public ApiResponse createGroup(String groupPath, String groupTitle, String groupName){
Map<String, Object> data = new HashMap<String, Object>();
data.put("type", "group");
data.put("path", groupPath);
if (groupTitle != null) {
data.put("title", groupTitle);
}
if(groupName != null){
data.put("name", groupName);
}
return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "groups");
} | java | public ApiResponse createGroup(String groupPath, String groupTitle, String groupName){
Map<String, Object> data = new HashMap<String, Object>();
data.put("type", "group");
data.put("path", groupPath);
if (groupTitle != null) {
data.put("title", groupTitle);
}
if(groupName != null){
data.put("name", groupName);
}
return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "groups");
} | [
"public",
"ApiResponse",
"createGroup",
"(",
"String",
"groupPath",
",",
"String",
"groupTitle",
",",
"String",
"groupName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
"... | Create a group with a path, title and name
@param groupPath
@param groupTitle
@param groupName
@return | [
"Create",
"a",
"group",
"with",
"a",
"path",
"title",
"and",
"name"
] | train | https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L912-L926 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Completable.java | Completable.concatWith | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatWith(CompletableSource other) {
ObjectHelper.requireNonNull(other, "other is null");
return concatArray(this, other);
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatWith(CompletableSource other) {
ObjectHelper.requireNonNull(other, "other is null");
return concatArray(this, other);
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Completable",
"concatWith",
"(",
"CompletableSource",
"other",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"other",
",",
"\"other is null\"",
"... | Concatenates this Completable with another Completable.
<p>
<img width="640" height="317" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.concatWith.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param other the other Completable, not null
@return the new Completable which subscribes to this and then the other Completable
@throws NullPointerException if other is null
@see #andThen(MaybeSource)
@see #andThen(ObservableSource)
@see #andThen(SingleSource)
@see #andThen(Publisher) | [
"Concatenates",
"this",
"Completable",
"with",
"another",
"Completable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"317",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1320-L1325 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java | PartnersInner.listContentCallbackUrlAsync | public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String partnerName, GetCallbackUrlParameters listContentCallbackUrl) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrl).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() {
@Override
public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String partnerName, GetCallbackUrlParameters listContentCallbackUrl) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrl).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() {
@Override
public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowTriggerCallbackUrlInner",
">",
"listContentCallbackUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"partnerName",
",",
"GetCallbackUrlParameters",
"listContentCallbackUrl",
")",
"{",
... | Get the content callback url.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param partnerName The integration account partner name.
@param listContentCallbackUrl the GetCallbackUrlParameters value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowTriggerCallbackUrlInner object | [
"Get",
"the",
"content",
"callback",
"url",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java#L672-L679 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsSecure.java | CmsSecure.getPropertyInheritanceInfo | public String getPropertyInheritanceInfo(String propName) throws CmsException {
String folderName = CmsResource.getParentFolder(getParamResource());
String folderPropVal = null;
while (CmsStringUtil.isNotEmpty(folderName)) {
CmsProperty prop = getCms().readPropertyObject(folderName, propName, false);
folderPropVal = prop.getValue();
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
break;
}
folderName = CmsResource.getParentFolder(folderName);
}
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
return key(Messages.GUI_SECURE_INHERIT_FROM_2, new Object[] {folderPropVal, folderName});
} else {
return key(Messages.GUI_SECURE_NOT_SET_0);
}
} | java | public String getPropertyInheritanceInfo(String propName) throws CmsException {
String folderName = CmsResource.getParentFolder(getParamResource());
String folderPropVal = null;
while (CmsStringUtil.isNotEmpty(folderName)) {
CmsProperty prop = getCms().readPropertyObject(folderName, propName, false);
folderPropVal = prop.getValue();
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
break;
}
folderName = CmsResource.getParentFolder(folderName);
}
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
return key(Messages.GUI_SECURE_INHERIT_FROM_2, new Object[] {folderPropVal, folderName});
} else {
return key(Messages.GUI_SECURE_NOT_SET_0);
}
} | [
"public",
"String",
"getPropertyInheritanceInfo",
"(",
"String",
"propName",
")",
"throws",
"CmsException",
"{",
"String",
"folderName",
"=",
"CmsResource",
".",
"getParentFolder",
"(",
"getParamResource",
"(",
")",
")",
";",
"String",
"folderPropVal",
"=",
"null",
... | Returns the information from which the property is inherited.<p>
@param propName the name of the property
@return a String containing the information from which the property is inherited and inherited value
@throws CmsException if the reading of the Property fails | [
"Returns",
"the",
"information",
"from",
"which",
"the",
"property",
"is",
"inherited",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsSecure.java#L217-L235 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.waitForFragmentByTag | public boolean waitForFragmentByTag(String tag, int timeout){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\", "+timeout+")");
}
return waiter.waitForFragment(tag, 0, timeout);
} | java | public boolean waitForFragmentByTag(String tag, int timeout){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\", "+timeout+")");
}
return waiter.waitForFragment(tag, 0, timeout);
} | [
"public",
"boolean",
"waitForFragmentByTag",
"(",
"String",
"tag",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"waitForFragmentByTag(\\\"\"",
"+",
"tag"... | Waits for a Fragment matching the specified tag.
@param tag the name of the tag
@param timeout the amount of time in milliseconds to wait
@return {@code true} if fragment appears and {@code false} if it does not appear before the timeout | [
"Waits",
"for",
"a",
"Fragment",
"matching",
"the",
"specified",
"tag",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3678-L3684 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.executeSearchOperation | public static Response<SearchResult> executeSearchOperation(final ConnectionFactory connectionFactory,
final String baseDn,
final SearchFilter filter) throws LdapException {
return executeSearchOperation(connectionFactory, baseDn, filter, ReturnAttributes.ALL_USER.value(), ReturnAttributes.ALL_USER.value());
} | java | public static Response<SearchResult> executeSearchOperation(final ConnectionFactory connectionFactory,
final String baseDn,
final SearchFilter filter) throws LdapException {
return executeSearchOperation(connectionFactory, baseDn, filter, ReturnAttributes.ALL_USER.value(), ReturnAttributes.ALL_USER.value());
} | [
"public",
"static",
"Response",
"<",
"SearchResult",
">",
"executeSearchOperation",
"(",
"final",
"ConnectionFactory",
"connectionFactory",
",",
"final",
"String",
"baseDn",
",",
"final",
"SearchFilter",
"filter",
")",
"throws",
"LdapException",
"{",
"return",
"execut... | Execute search operation response.
@param connectionFactory the connection factory
@param baseDn the base dn
@param filter the filter
@return the response
@throws LdapException the ldap exception | [
"Execute",
"search",
"operation",
"response",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L268-L272 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java | AsciiArtUtils.printAsciiArtWarning | @SneakyThrows
public static void printAsciiArtWarning(final Logger out, final String asciiArt, final String additional) {
out.warn(ANSI_CYAN);
out.warn("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.warn(ANSI_RESET);
} | java | @SneakyThrows
public static void printAsciiArtWarning(final Logger out, final String asciiArt, final String additional) {
out.warn(ANSI_CYAN);
out.warn("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.warn(ANSI_RESET);
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"printAsciiArtWarning",
"(",
"final",
"Logger",
"out",
",",
"final",
"String",
"asciiArt",
",",
"final",
"String",
"additional",
")",
"{",
"out",
".",
"warn",
"(",
"ANSI_CYAN",
")",
";",
"out",
".",
"warn",
... | Print ascii art.
@param out the out
@param asciiArt the ascii art
@param additional the additional | [
"Print",
"ascii",
"art",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java#L58-L63 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Byte.java | Byte.valueOf | public static Byte valueOf(String s, int radix)
throws NumberFormatException {
return valueOf(parseByte(s, radix));
} | java | public static Byte valueOf(String s, int radix)
throws NumberFormatException {
return valueOf(parseByte(s, radix));
} | [
"public",
"static",
"Byte",
"valueOf",
"(",
"String",
"s",
",",
"int",
"radix",
")",
"throws",
"NumberFormatException",
"{",
"return",
"valueOf",
"(",
"parseByte",
"(",
"s",
",",
"radix",
")",
")",
";",
"}"
] | Returns a {@code Byte} object holding the value
extracted from the specified {@code String} when parsed
with the radix given by the second argument. The first argument
is interpreted as representing a signed {@code byte} in
the radix specified by the second argument, exactly as if the
argument were given to the {@link #parseByte(java.lang.String,
int)} method. The result is a {@code Byte} object that
represents the {@code byte} value specified by the string.
<p> In other words, this method returns a {@code Byte} object
equal to the value of:
<blockquote>
{@code new Byte(Byte.parseByte(s, radix))}
</blockquote>
@param s the string to be parsed
@param radix the radix to be used in interpreting {@code s}
@return a {@code Byte} object holding the value
represented by the string argument in the
specified radix.
@throws NumberFormatException If the {@code String} does
not contain a parsable {@code byte}. | [
"Returns",
"a",
"{",
"@code",
"Byte",
"}",
"object",
"holding",
"the",
"value",
"extracted",
"from",
"the",
"specified",
"{",
"@code",
"String",
"}",
"when",
"parsed",
"with",
"the",
"radix",
"given",
"by",
"the",
"second",
"argument",
".",
"The",
"first",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Byte.java#L215-L218 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java | MsgPackOutput.writePositiveExtensionInt | void writePositiveExtensionInt(int extensionType, int reference) throws IOException {
if (reference < 0) {
throw new IllegalArgumentException("Can only serialize positive references: " + reference);
}
if (reference < 0xFF) {
output.write(FIX_EXT_1);
output.write(extensionType);
output.writeByte((byte) reference);
} else if (reference < 0xFFFF) {
output.writeByte(FIX_EXT_2);
output.write(extensionType);
output.writeShort((short) reference);
} else {
output.writeByte(FIX_EXT_4);
output.write(extensionType);
output.writeInt(reference);
}
} | java | void writePositiveExtensionInt(int extensionType, int reference) throws IOException {
if (reference < 0) {
throw new IllegalArgumentException("Can only serialize positive references: " + reference);
}
if (reference < 0xFF) {
output.write(FIX_EXT_1);
output.write(extensionType);
output.writeByte((byte) reference);
} else if (reference < 0xFFFF) {
output.writeByte(FIX_EXT_2);
output.write(extensionType);
output.writeShort((short) reference);
} else {
output.writeByte(FIX_EXT_4);
output.write(extensionType);
output.writeInt(reference);
}
} | [
"void",
"writePositiveExtensionInt",
"(",
"int",
"extensionType",
",",
"int",
"reference",
")",
"throws",
"IOException",
"{",
"if",
"(",
"reference",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can only serialize positive references: \"",
"... | Writes an extension reference of a positive integer using FIX_EXT data types.
@param extensionType the type
@param reference the positive integer reference to write as the data
@throws IOException if an error occurs | [
"Writes",
"an",
"extension",
"reference",
"of",
"a",
"positive",
"integer",
"using",
"FIX_EXT",
"data",
"types",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java#L310-L327 |
jenkinsci/jenkins | core/src/main/java/hudson/EnvVars.java | EnvVars.getRemote | public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException {
if(channel==null)
return new EnvVars("N/A","N/A");
return channel.call(new GetEnvVars());
} | java | public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException {
if(channel==null)
return new EnvVars("N/A","N/A");
return channel.call(new GetEnvVars());
} | [
"public",
"static",
"EnvVars",
"getRemote",
"(",
"VirtualChannel",
"channel",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"return",
"new",
"EnvVars",
"(",
"\"N/A\"",
",",
"\"N/A\"",
")",
";",
"return... | Obtains the environment variables of a remote peer.
@param channel
Can be null, in which case the map indicating "N/A" will be returned.
@return
A fresh copy that can be owned and modified by the caller. | [
"Obtains",
"the",
"environment",
"variables",
"of",
"a",
"remote",
"peer",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L424-L428 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java | MatrixFeatures_ZDRM.isUpperTriangle | public static boolean isUpperTriangle(ZMatrixRMaj A , int hessenberg , double tol ) {
tol *= tol;
for( int i = hessenberg+1; i < A.numRows; i++ ) {
int maxCol = Math.min(i-hessenberg, A.numCols);
for( int j = 0; j < maxCol; j++ ) {
int index = (i*A.numCols+j)*2;
double real = A.data[index];
double imag = A.data[index+1];
double mag = real*real + imag*imag;
if( !(mag <= tol) ) {
return false;
}
}
}
return true;
} | java | public static boolean isUpperTriangle(ZMatrixRMaj A , int hessenberg , double tol ) {
tol *= tol;
for( int i = hessenberg+1; i < A.numRows; i++ ) {
int maxCol = Math.min(i-hessenberg, A.numCols);
for( int j = 0; j < maxCol; j++ ) {
int index = (i*A.numCols+j)*2;
double real = A.data[index];
double imag = A.data[index+1];
double mag = real*real + imag*imag;
if( !(mag <= tol) ) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isUpperTriangle",
"(",
"ZMatrixRMaj",
"A",
",",
"int",
"hessenberg",
",",
"double",
"tol",
")",
"{",
"tol",
"*=",
"tol",
";",
"for",
"(",
"int",
"i",
"=",
"hessenberg",
"+",
"1",
";",
"i",
"<",
"A",
".",
"numRows",
";"... | <p>
Checks to see if a matrix is upper triangular or Hessenberg. A Hessenberg matrix of degree N
has the following property:<br>
<br>
a<sub>ij</sub> ≤ 0 for all i < j+N<br>
<br>
A triangular matrix is a Hessenberg matrix of degree 0.
</p>
@param A Matrix being tested. Not modified.
@param hessenberg The degree of being hessenberg.
@param tol How close to zero the lower left elements need to be.
@return If it is an upper triangular/hessenberg matrix or not. | [
"<p",
">",
"Checks",
"to",
"see",
"if",
"a",
"matrix",
"is",
"upper",
"triangular",
"or",
"Hessenberg",
".",
"A",
"Hessenberg",
"matrix",
"of",
"degree",
"N",
"has",
"the",
"following",
"property",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L366-L383 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.upload | public boolean upload(String path, String fileName, File file) {
try (InputStream in = FileUtil.getInputStream(file)) {
return upload(path, fileName, in);
} catch (IOException e) {
throw new FtpException(e);
}
} | java | public boolean upload(String path, String fileName, File file) {
try (InputStream in = FileUtil.getInputStream(file)) {
return upload(path, fileName, in);
} catch (IOException e) {
throw new FtpException(e);
}
} | [
"public",
"boolean",
"upload",
"(",
"String",
"path",
",",
"String",
"fileName",
",",
"File",
"file",
")",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"FileUtil",
".",
"getInputStream",
"(",
"file",
")",
")",
"{",
"return",
"upload",
"(",
"path",
",",
"... | 上传文件到指定目录,可选:
<pre>
1. path为null或""上传到当前路径
2. path为相对路径则相对于当前路径的子路径
3. path为绝对路径则上传到此路径
</pre>
@param file 文件
@param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径
@param fileName 自定义在服务端保存的文件名
@return 是否上传成功 | [
"上传文件到指定目录,可选:"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L382-L388 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.setPerspectiveRect | public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar, boolean zZeroToOne) {
this.zero();
this._m00((zNear + zNear) / width);
this._m11((zNear + zNear) / height);
boolean farInf = zFar > 0 && Double.isInfinite(zFar);
boolean nearInf = zNear > 0 && Double.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
double e = 1E-6;
this._m22(e - 1.0);
this._m32((e - (zZeroToOne ? 1.0 : 2.0)) * zNear);
} else if (nearInf) {
double e = 1E-6f;
this._m22((zZeroToOne ? 0.0 : 1.0) - e);
this._m32(((zZeroToOne ? 1.0 : 2.0) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(-1.0);
properties = PROPERTY_PERSPECTIVE;
return this;
} | java | public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar, boolean zZeroToOne) {
this.zero();
this._m00((zNear + zNear) / width);
this._m11((zNear + zNear) / height);
boolean farInf = zFar > 0 && Double.isInfinite(zFar);
boolean nearInf = zNear > 0 && Double.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
double e = 1E-6;
this._m22(e - 1.0);
this._m32((e - (zZeroToOne ? 1.0 : 2.0)) * zNear);
} else if (nearInf) {
double e = 1E-6f;
this._m22((zZeroToOne ? 0.0 : 1.0) - e);
this._m32(((zZeroToOne ? 1.0 : 2.0) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(-1.0);
properties = PROPERTY_PERSPECTIVE;
return this;
} | [
"public",
"Matrix4d",
"setPerspectiveRect",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"this",
".",
"zero",
"(",
")",
";",
"this",
".",
"_m00",
"(",
"(",
"zNear"... | Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveRect(double, double, double, double, boolean) perspectiveRect()}.
@see #perspectiveRect(double, double, double, double, boolean)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"In",
"order",
"to",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12656-L12678 |
epam/parso | src/main/java/com/epam/parso/impl/AbstractCSVWriter.java | AbstractCSVWriter.checkSurroundByQuotesAndWrite | static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException {
writer.write(checkSurroundByQuotes(delimiter, trimmedText));
} | java | static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException {
writer.write(checkSurroundByQuotes(delimiter, trimmedText));
} | [
"static",
"void",
"checkSurroundByQuotesAndWrite",
"(",
"Writer",
"writer",
",",
"String",
"delimiter",
",",
"String",
"trimmedText",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"checkSurroundByQuotes",
"(",
"delimiter",
",",
"trimmedText",
")",
... | The method to write a text represented by an array of bytes using writer.
If the text contains the delimiter, line breaks, tabulation characters, and double quotes, the text is stropped.
@param writer the variable to output data.
@param delimiter if trimmedText contains this delimiter it will be stropped.
@param trimmedText the array of bytes that contains the text to output.
@throws java.io.IOException appears if the output into writer is impossible. | [
"The",
"method",
"to",
"write",
"a",
"text",
"represented",
"by",
"an",
"array",
"of",
"bytes",
"using",
"writer",
".",
"If",
"the",
"text",
"contains",
"the",
"delimiter",
"line",
"breaks",
"tabulation",
"characters",
"and",
"double",
"quotes",
"the",
"text... | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/AbstractCSVWriter.java#L120-L122 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java | WordLemmaTagFactory.newLabelFromString | public Label newLabelFromString(String labelStr) {
int first = labelStr.indexOf(divider);
int second = labelStr.lastIndexOf(divider);
if (first == second) {
return new WordLemmaTag(labelStr.substring(0, first), Morphology.stemStatic(labelStr.substring(0, first), labelStr.substring(first + 1)).word(), labelStr.substring(first + 1));
} else if (first >= 0) {
return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1));
} else {
return new WordLemmaTag(labelStr);
}
} | java | public Label newLabelFromString(String labelStr) {
int first = labelStr.indexOf(divider);
int second = labelStr.lastIndexOf(divider);
if (first == second) {
return new WordLemmaTag(labelStr.substring(0, first), Morphology.stemStatic(labelStr.substring(0, first), labelStr.substring(first + 1)).word(), labelStr.substring(first + 1));
} else if (first >= 0) {
return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1));
} else {
return new WordLemmaTag(labelStr);
}
} | [
"public",
"Label",
"newLabelFromString",
"(",
"String",
"labelStr",
")",
"{",
"int",
"first",
"=",
"labelStr",
".",
"indexOf",
"(",
"divider",
")",
";",
"int",
"second",
"=",
"labelStr",
".",
"lastIndexOf",
"(",
"divider",
")",
";",
"if",
"(",
"first",
"... | Create a new word, where the label is formed from
the <code>String</code> passed in. The String is divided according
to the divider character. We assume that we can always just
divide on the rightmost divider character, rather than trying to
parse up escape sequences. If the divider character isn't found
in the word, then the whole string becomes the word, and lemma and tag
are <code>null</code>.
We assume that if only one divider character is found, word and tag are presents in
the String, and lemma will be computed.
@param labelStr The word that will go into the <code>Word</code>
@return The new WordLemmaTag | [
"Create",
"a",
"new",
"word",
"where",
"the",
"label",
"is",
"formed",
"from",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"passed",
"in",
".",
"The",
"String",
"is",
"divided",
"according",
"to",
"the",
"divider",
"character",
".",
"We",
"assume",... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java#L87-L97 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java | GridDialects.getDialectFacetOrNull | static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) {
if ( hasFacet( gridDialect, facetType ) ) {
@SuppressWarnings("unchecked")
T asFacet = (T) gridDialect;
return asFacet;
}
return null;
} | java | static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) {
if ( hasFacet( gridDialect, facetType ) ) {
@SuppressWarnings("unchecked")
T asFacet = (T) gridDialect;
return asFacet;
}
return null;
} | [
"static",
"<",
"T",
"extends",
"GridDialect",
">",
"T",
"getDialectFacetOrNull",
"(",
"GridDialect",
"gridDialect",
",",
"Class",
"<",
"T",
">",
"facetType",
")",
"{",
"if",
"(",
"hasFacet",
"(",
"gridDialect",
",",
"facetType",
")",
")",
"{",
"@",
"Suppre... | Returns the given dialect, narrowed down to the given dialect facet in case it is implemented by the dialect.
@param gridDialect the dialect of interest
@param facetType the dialect facet type of interest
@return the given dialect, narrowed down to the given dialect facet or {@code null} in case the given dialect
does not implement the given facet | [
"Returns",
"the",
"given",
"dialect",
"narrowed",
"down",
"to",
"the",
"given",
"dialect",
"facet",
"in",
"case",
"it",
"is",
"implemented",
"by",
"the",
"dialect",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java#L37-L45 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException {
byte[] buf = new byte[1024];
while (true) {
int count = in.read(buf, 0, buf.length);
if (count == -1) break;
if (count == 0) {
Thread.yield();
continue;
}
self.write(buf, 0, count);
}
self.flush();
return self;
} | java | public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException {
byte[] buf = new byte[1024];
while (true) {
int count = in.read(buf, 0, buf.length);
if (count == -1) break;
if (count == 0) {
Thread.yield();
continue;
}
self.write(buf, 0, count);
}
self.flush();
return self;
} | [
"public",
"static",
"OutputStream",
"leftShift",
"(",
"OutputStream",
"self",
",",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"while",
"(",
"true",
")",
"{",
"int",
"count",... | Pipe an InputStream into an OutputStream for efficient stream copying.
@param self stream on which to write
@param in stream to read from
@return the outputstream itself
@throws IOException if an I/O error occurs.
@since 1.0 | [
"Pipe",
"an",
"InputStream",
"into",
"an",
"OutputStream",
"for",
"efficient",
"stream",
"copying",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L231-L244 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/engine/Codecs.java | Codecs.ofSubSet | public static <T> Codec<ISeq<T>, BitGene> ofSubSet(
final ISeq<? extends T> basicSet
) {
requireNonNull(basicSet);
require.positive(basicSet.length());
return Codec.of(
Genotype.of(BitChromosome.of(basicSet.length())),
gt -> gt.getChromosome()
.as(BitChromosome.class).ones()
.<T>mapToObj(basicSet)
.collect(ISeq.toISeq())
);
} | java | public static <T> Codec<ISeq<T>, BitGene> ofSubSet(
final ISeq<? extends T> basicSet
) {
requireNonNull(basicSet);
require.positive(basicSet.length());
return Codec.of(
Genotype.of(BitChromosome.of(basicSet.length())),
gt -> gt.getChromosome()
.as(BitChromosome.class).ones()
.<T>mapToObj(basicSet)
.collect(ISeq.toISeq())
);
} | [
"public",
"static",
"<",
"T",
">",
"Codec",
"<",
"ISeq",
"<",
"T",
">",
",",
"BitGene",
">",
"ofSubSet",
"(",
"final",
"ISeq",
"<",
"?",
"extends",
"T",
">",
"basicSet",
")",
"{",
"requireNonNull",
"(",
"basicSet",
")",
";",
"require",
".",
"positive... | The subset {@code Codec} can be used for problems where it is required to
find the best <b>variable-sized</b> subset from given basic set. A typical
usage example of the returned {@code Codec} is the Knapsack problem.
<p>
The following code snippet shows a simplified variation of the Knapsack
problem.
<pre>{@code
public final class Main {
// The basic set from where to choose an 'optimal' subset.
private final static ISeq<Integer> SET =
ISeq.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
// Fitness function directly takes an 'int' value.
private static int fitness(final ISeq<Integer> subset) {
assert(subset.size() <= SET.size());
final int size = subset.stream()
.collect(Collectors.summingInt(Integer::intValue));
return size <= 20 ? size : 0;
}
public static void main(final String[] args) {
final Engine<BitGene, Double> engine = Engine
.builder(Main::fitness, codec.ofSubSet(SET))
.build();
...
}
}
}</pre>
@param <T> the element type of the basic set
@param basicSet the basic set, from where to choose the <i>optimal</i>
subset.
@return a new codec which can be used for modelling <i>subset</i>
problems.
@throws NullPointerException if the given {@code basicSet} is
{@code null}; {@code null} elements are allowed.
@throws IllegalArgumentException if the {@code basicSet} size is smaller
than one. | [
"The",
"subset",
"{",
"@code",
"Codec",
"}",
"can",
"be",
"used",
"for",
"problems",
"where",
"it",
"is",
"required",
"to",
"find",
"the",
"best",
"<b",
">",
"variable",
"-",
"sized<",
"/",
"b",
">",
"subset",
"from",
"given",
"basic",
"set",
".",
"A... | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Codecs.java#L770-L783 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/models/CUploadRequest.java | CUploadRequest.getByteSource | public ByteSource getByteSource()
{
ByteSource bs = byteSource;
if ( progressListener != null ) {
bs = new ProgressByteSource( bs, progressListener );
}
return bs;
} | java | public ByteSource getByteSource()
{
ByteSource bs = byteSource;
if ( progressListener != null ) {
bs = new ProgressByteSource( bs, progressListener );
}
return bs;
} | [
"public",
"ByteSource",
"getByteSource",
"(",
")",
"{",
"ByteSource",
"bs",
"=",
"byteSource",
";",
"if",
"(",
"progressListener",
"!=",
"null",
")",
"{",
"bs",
"=",
"new",
"ProgressByteSource",
"(",
"bs",
",",
"progressListener",
")",
";",
"}",
"return",
... | If no progress listener has been set, return the byte source set in constructor, otherwise decorate it for
progress.
@return the byte source to be used for upload operation. | [
"If",
"no",
"progress",
"listener",
"has",
"been",
"set",
"return",
"the",
"byte",
"source",
"set",
"in",
"constructor",
"otherwise",
"decorate",
"it",
"for",
"progress",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CUploadRequest.java#L114-L121 |
jenkinsci/jenkins | core/src/main/java/hudson/tools/ToolLocationNodeProperty.java | ToolLocationNodeProperty.getToolHome | @Deprecated
public static String getToolHome(Node node, ToolInstallation installation, TaskListener log) throws IOException, InterruptedException {
String result = null;
// node-specific configuration takes precedence
ToolLocationNodeProperty property = node.getNodeProperties().get(ToolLocationNodeProperty.class);
if (property != null) {
result = property.getHome(installation);
}
if (result != null) {
return result;
}
// consult translators
for (ToolLocationTranslator t : ToolLocationTranslator.all()) {
result = t.getToolHome(node, installation, log);
if (result != null) {
return result;
}
}
// fall back is no-op
return installation.getHome();
} | java | @Deprecated
public static String getToolHome(Node node, ToolInstallation installation, TaskListener log) throws IOException, InterruptedException {
String result = null;
// node-specific configuration takes precedence
ToolLocationNodeProperty property = node.getNodeProperties().get(ToolLocationNodeProperty.class);
if (property != null) {
result = property.getHome(installation);
}
if (result != null) {
return result;
}
// consult translators
for (ToolLocationTranslator t : ToolLocationTranslator.all()) {
result = t.getToolHome(node, installation, log);
if (result != null) {
return result;
}
}
// fall back is no-op
return installation.getHome();
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getToolHome",
"(",
"Node",
"node",
",",
"ToolInstallation",
"installation",
",",
"TaskListener",
"log",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"String",
"result",
"=",
"null",
";",
"// node... | Checks if the location of the tool is overridden for the given node, and if so,
return the node-specific home directory. Otherwise return {@code installation.getHome()}
<p>
This is the core logic behind {@link NodeSpecific#forNode(Node, TaskListener)} for {@link ToolInstallation}.
@return
never null.
@deprecated since 2009-04-09.
Use {@link ToolInstallation#translateFor(Node,TaskListener)} | [
"Checks",
"if",
"the",
"location",
"of",
"the",
"tool",
"is",
"overridden",
"for",
"the",
"given",
"node",
"and",
"if",
"so",
"return",
"the",
"node",
"-",
"specific",
"home",
"directory",
".",
"Otherwise",
"return",
"{",
"@code",
"installation",
".",
"get... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tools/ToolLocationNodeProperty.java#L94-L117 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotationZYX | public Matrix4f rotationZYX(float angleZ, float angleY, float angleX) {
float sinX = (float) Math.sin(angleX);
float cosX = (float) Math.cosFromSin(sinX, angleX);
float sinY = (float) Math.sin(angleY);
float cosY = (float) Math.cosFromSin(sinY, angleY);
float sinZ = (float) Math.sin(angleZ);
float cosZ = (float) Math.cosFromSin(sinZ, angleZ);
float m_sinZ = -sinZ;
float m_sinY = -sinY;
float m_sinX = -sinX;
// rotateZ
float nm00 = cosZ;
float nm01 = sinZ;
float nm10 = m_sinZ;
float nm11 = cosZ;
// rotateY
float nm20 = nm00 * sinY;
float nm21 = nm01 * sinY;
float nm22 = cosY;
this._m00(nm00 * cosY);
this._m01(nm01 * cosY);
this._m02(m_sinY);
this._m03(0.0f);
// rotateX
this._m10(nm10 * cosX + nm20 * sinX);
this._m11(nm11 * cosX + nm21 * sinX);
this._m12(nm22 * sinX);
this._m13(0.0f);
this._m20(nm10 * m_sinX + nm20 * cosX);
this._m21(nm11 * m_sinX + nm21 * cosX);
this._m22(nm22 * cosX);
this._m23(0.0f);
// set last column to identity
this._m30(0.0f);
this._m31(0.0f);
this._m32(0.0f);
this._m33(1.0f);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | java | public Matrix4f rotationZYX(float angleZ, float angleY, float angleX) {
float sinX = (float) Math.sin(angleX);
float cosX = (float) Math.cosFromSin(sinX, angleX);
float sinY = (float) Math.sin(angleY);
float cosY = (float) Math.cosFromSin(sinY, angleY);
float sinZ = (float) Math.sin(angleZ);
float cosZ = (float) Math.cosFromSin(sinZ, angleZ);
float m_sinZ = -sinZ;
float m_sinY = -sinY;
float m_sinX = -sinX;
// rotateZ
float nm00 = cosZ;
float nm01 = sinZ;
float nm10 = m_sinZ;
float nm11 = cosZ;
// rotateY
float nm20 = nm00 * sinY;
float nm21 = nm01 * sinY;
float nm22 = cosY;
this._m00(nm00 * cosY);
this._m01(nm01 * cosY);
this._m02(m_sinY);
this._m03(0.0f);
// rotateX
this._m10(nm10 * cosX + nm20 * sinX);
this._m11(nm11 * cosX + nm21 * sinX);
this._m12(nm22 * sinX);
this._m13(0.0f);
this._m20(nm10 * m_sinX + nm20 * cosX);
this._m21(nm11 * m_sinX + nm21 * cosX);
this._m22(nm22 * cosX);
this._m23(0.0f);
// set last column to identity
this._m30(0.0f);
this._m31(0.0f);
this._m32(0.0f);
this._m33(1.0f);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | [
"public",
"Matrix4f",
"rotationZYX",
"(",
"float",
"angleZ",
",",
"float",
"angleY",
",",
"float",
"angleX",
")",
"{",
"float",
"sinX",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"angleX",
")",
";",
"float",
"cosX",
"=",
"(",
"float",
")",
"Mat... | Set this matrix to a rotation of <code>angleZ</code> radians about the Z axis, followed by a rotation
of <code>angleY</code> radians about the Y axis and followed by a rotation of <code>angleX</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>rotationZ(angleZ).rotateY(angleY).rotateX(angleX)</code>
@param angleZ
the angle to rotate about Z
@param angleY
the angle to rotate about Y
@param angleX
the angle to rotate about X
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"rotation",
"of",
"<code",
">",
"angleZ<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L3664-L3704 |
xm-online/xm-commons | xm-commons-tenant/src/main/java/com/icthh/xm/commons/tenant/TenantContextUtils.java | TenantContextUtils.setTenant | public static void setTenant(TenantContextHolder holder, String tenantKeyValue) {
holder.getPrivilegedContext().setTenant(buildTenant(tenantKeyValue));
} | java | public static void setTenant(TenantContextHolder holder, String tenantKeyValue) {
holder.getPrivilegedContext().setTenant(buildTenant(tenantKeyValue));
} | [
"public",
"static",
"void",
"setTenant",
"(",
"TenantContextHolder",
"holder",
",",
"String",
"tenantKeyValue",
")",
"{",
"holder",
".",
"getPrivilegedContext",
"(",
")",
".",
"setTenant",
"(",
"buildTenant",
"(",
"tenantKeyValue",
")",
")",
";",
"}"
] | Sets current thread tenant.
@param holder tenant contexts holder
@param tenantKeyValue tenant key value | [
"Sets",
"current",
"thread",
"tenant",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-tenant/src/main/java/com/icthh/xm/commons/tenant/TenantContextUtils.java#L67-L69 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java | ClientFactory.getNamedLoadBalancer | public static synchronized ILoadBalancer getNamedLoadBalancer(String name, Class<? extends IClientConfig> configClass) {
ILoadBalancer lb = namedLBMap.get(name);
if (lb != null) {
return lb;
} else {
try {
lb = registerNamedLoadBalancerFromProperties(name, configClass);
} catch (ClientException e) {
throw new RuntimeException("Unable to create load balancer", e);
}
return lb;
}
} | java | public static synchronized ILoadBalancer getNamedLoadBalancer(String name, Class<? extends IClientConfig> configClass) {
ILoadBalancer lb = namedLBMap.get(name);
if (lb != null) {
return lb;
} else {
try {
lb = registerNamedLoadBalancerFromProperties(name, configClass);
} catch (ClientException e) {
throw new RuntimeException("Unable to create load balancer", e);
}
return lb;
}
} | [
"public",
"static",
"synchronized",
"ILoadBalancer",
"getNamedLoadBalancer",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"IClientConfig",
">",
"configClass",
")",
"{",
"ILoadBalancer",
"lb",
"=",
"namedLBMap",
".",
"get",
"(",
"name",
")",
";",
"... | Get the load balancer associated with the name, or create one with an instance of configClass if does not exist
@throws RuntimeException if any error occurs
@see #registerNamedLoadBalancerFromProperties(String, Class) | [
"Get",
"the",
"load",
"balancer",
"associated",
"with",
"the",
"name",
"or",
"create",
"one",
"with",
"an",
"instance",
"of",
"configClass",
"if",
"does",
"not",
"exist"
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L158-L170 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPSpecificationOptionWrapper.java | CPSpecificationOptionWrapper.getDescription | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpSpecificationOption.getDescription(languageId, useDefault);
} | java | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpSpecificationOption.getDescription(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getDescription",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpSpecificationOption",
".",
"getDescription",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized description of this cp specification option in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized description of this cp specification option | [
"Returns",
"the",
"localized",
"description",
"of",
"this",
"cp",
"specification",
"option",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPSpecificationOptionWrapper.java#L287-L290 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_network_private_networkId_DELETE | public void project_serviceName_network_private_networkId_DELETE(String serviceName, String networkId) throws IOException {
String qPath = "/cloud/project/{serviceName}/network/private/{networkId}";
StringBuilder sb = path(qPath, serviceName, networkId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void project_serviceName_network_private_networkId_DELETE(String serviceName, String networkId) throws IOException {
String qPath = "/cloud/project/{serviceName}/network/private/{networkId}";
StringBuilder sb = path(qPath, serviceName, networkId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"project_serviceName_network_private_networkId_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"networkId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/network/private/{networkId}\"",
";",
"StringBuilder",
"... | Delete private network
REST: DELETE /cloud/project/{serviceName}/network/private/{networkId}
@param networkId [required] Network id
@param serviceName [required] Project name | [
"Delete",
"private",
"network"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L768-L772 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.redeployAsync | public Observable<OperationStatusResponseInner> redeployAsync(String resourceGroupName, String vmScaleSetName) {
return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> redeployAsync(String resourceGroupName, String vmScaleSetName) {
return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"redeployAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"redeployWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map"... | Redeploy one or more virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Redeploy",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L2889-L2896 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Stats.java | Stats.nashsut | public static double nashsut(double[] prediction, double[] validation, double pow) {
int pre_size = prediction.length;
int val_size = validation.length;
int steps = 0;
double sum_td = 0;
double sum_vd = 0;
/** checking if both data arrays have the same number of elements*/
if (pre_size != val_size) {
System.err.println("Prediction data and validation data are not consistent!");
return -9999;
} else {
steps = pre_size;
}
/**summing up both data sets */
for (int i = 0; i < steps; i++) {
sum_td = sum_td + prediction[i];
sum_vd = sum_vd + validation[i];
}
/** calculating mean values for both data sets */
double mean_td = sum_td / steps;
double mean_vd = sum_vd / steps;
/** calculating mean pow deviations */
double td_vd = 0;
double vd_mean = 0;
for (int i = 0; i < steps; i++) {
td_vd = td_vd + (Math.pow((Math.abs(validation[i] - prediction[i])), pow));
vd_mean = vd_mean + (Math.pow((Math.abs(validation[i] - mean_vd)), pow));
}
/** calculating efficiency after Nash & Sutcliffe (1970) */
double efficiency = 1 - (td_vd / vd_mean);
return efficiency;
} | java | public static double nashsut(double[] prediction, double[] validation, double pow) {
int pre_size = prediction.length;
int val_size = validation.length;
int steps = 0;
double sum_td = 0;
double sum_vd = 0;
/** checking if both data arrays have the same number of elements*/
if (pre_size != val_size) {
System.err.println("Prediction data and validation data are not consistent!");
return -9999;
} else {
steps = pre_size;
}
/**summing up both data sets */
for (int i = 0; i < steps; i++) {
sum_td = sum_td + prediction[i];
sum_vd = sum_vd + validation[i];
}
/** calculating mean values for both data sets */
double mean_td = sum_td / steps;
double mean_vd = sum_vd / steps;
/** calculating mean pow deviations */
double td_vd = 0;
double vd_mean = 0;
for (int i = 0; i < steps; i++) {
td_vd = td_vd + (Math.pow((Math.abs(validation[i] - prediction[i])), pow));
vd_mean = vd_mean + (Math.pow((Math.abs(validation[i] - mean_vd)), pow));
}
/** calculating efficiency after Nash & Sutcliffe (1970) */
double efficiency = 1 - (td_vd / vd_mean);
return efficiency;
} | [
"public",
"static",
"double",
"nashsut",
"(",
"double",
"[",
"]",
"prediction",
",",
"double",
"[",
"]",
"validation",
",",
"double",
"pow",
")",
"{",
"int",
"pre_size",
"=",
"prediction",
".",
"length",
";",
"int",
"val_size",
"=",
"validation",
".",
"l... | Calculates the efficiency between a test data set and a verification data set
after Nash & Sutcliffe (1970). The efficiency is described as the proportion of
the cumulated cubic deviation between both data sets and the cumulated cubic
deviation between the verification data set and its mean value.
@param prediction the simulation data set
@param validation the validation (observed) data set
@param pow the power for the deviation terms
@return the calculated efficiency or -9999 if an error occurs | [
"Calculates",
"the",
"efficiency",
"between",
"a",
"test",
"data",
"set",
"and",
"a",
"verification",
"data",
"set",
"after",
"Nash",
"&",
"Sutcliffe",
"(",
"1970",
")",
".",
"The",
"efficiency",
"is",
"described",
"as",
"the",
"proportion",
"of",
"the",
"... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Stats.java#L186-L223 |
actframework/actframework | src/main/java/act/data/ApacheMultipartParser.java | ApacheMultipartParser.parseHeaderLine | private void parseHeaderLine(Map<String, String> headers, String header) {
final int colonOffset = header.indexOf(':');
if (colonOffset == -1) {
// This header line is malformed, skip it.
return;
}
String headerName = header.substring(0, colonOffset).trim().toLowerCase();
String headerValue = header.substring(header.indexOf(':') + 1).trim();
if (getHeader(headers, headerName) != null) {
// More that one heder of that name exists,
// append to the list.
headers.put(headerName, getHeader(headers, headerName) + ',' + headerValue);
} else {
headers.put(headerName, headerValue);
}
} | java | private void parseHeaderLine(Map<String, String> headers, String header) {
final int colonOffset = header.indexOf(':');
if (colonOffset == -1) {
// This header line is malformed, skip it.
return;
}
String headerName = header.substring(0, colonOffset).trim().toLowerCase();
String headerValue = header.substring(header.indexOf(':') + 1).trim();
if (getHeader(headers, headerName) != null) {
// More that one heder of that name exists,
// append to the list.
headers.put(headerName, getHeader(headers, headerName) + ',' + headerValue);
} else {
headers.put(headerName, headerValue);
}
} | [
"private",
"void",
"parseHeaderLine",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"header",
")",
"{",
"final",
"int",
"colonOffset",
"=",
"header",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"colonOffset",
"==",
"-... | Reads the next header line.
@param headers String with all headers.
@param header Map where to store the current header. | [
"Reads",
"the",
"next",
"header",
"line",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L296-L311 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java | CollectionUtil.mergeArrays | @SuppressWarnings({"SuspiciousSystemArraycopy"})
public static Object mergeArrays(Object pArray1, int pOffset1, int pLength1, Object pArray2, int pOffset2, int pLength2) {
Class class1 = pArray1.getClass();
Class type = class1.getComponentType();
// Create new array of the new length
Object array = Array.newInstance(type, pLength1 + pLength2);
System.arraycopy(pArray1, pOffset1, array, 0, pLength1);
System.arraycopy(pArray2, pOffset2, array, pLength1, pLength2);
return array;
} | java | @SuppressWarnings({"SuspiciousSystemArraycopy"})
public static Object mergeArrays(Object pArray1, int pOffset1, int pLength1, Object pArray2, int pOffset2, int pLength2) {
Class class1 = pArray1.getClass();
Class type = class1.getComponentType();
// Create new array of the new length
Object array = Array.newInstance(type, pLength1 + pLength2);
System.arraycopy(pArray1, pOffset1, array, 0, pLength1);
System.arraycopy(pArray2, pOffset2, array, pLength1, pLength2);
return array;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"SuspiciousSystemArraycopy\"",
"}",
")",
"public",
"static",
"Object",
"mergeArrays",
"(",
"Object",
"pArray1",
",",
"int",
"pOffset1",
",",
"int",
"pLength1",
",",
"Object",
"pArray2",
",",
"int",
"pOffset2",
",",
"int",
"... | Merges two arrays into a new array. Elements from pArray1 and pArray2 will
be copied into a new array, that has pLength1 + pLength2 elements.
@param pArray1 First array
@param pOffset1 the offset into the first array
@param pLength1 the number of elements to copy from the first array
@param pArray2 Second array, must be compatible with (assignable from)
the first array
@param pOffset2 the offset into the second array
@param pLength2 the number of elements to copy from the second array
@return A new array, containing the values of pArray1 and pArray2. The
array (wrapped as an object), will have the length of pArray1 +
pArray2, and can be safely cast to the type of the pArray1
parameter.
@see java.lang.System#arraycopy(Object,int,Object,int,int) | [
"Merges",
"two",
"arrays",
"into",
"a",
"new",
"array",
".",
"Elements",
"from",
"pArray1",
"and",
"pArray2",
"will",
"be",
"copied",
"into",
"a",
"new",
"array",
"that",
"has",
"pLength1",
"+",
"pLength2",
"elements",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L246-L257 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.findSourceFile | private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile;
}
}
return null;
} | java | private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile;
}
}
return null;
} | [
"private",
"File",
"findSourceFile",
"(",
"final",
"String",
"filename",
")",
"{",
"final",
"Collection",
"<",
"File",
">",
"sourceRoots",
"=",
"this",
".",
"nonGeneratedSourceRoots",
";",
"for",
"(",
"final",
"File",
"sourceRoot",
":",
"sourceRoots",
")",
"{"... | Determines whether the specified source file is already present in any of the
compile source roots registered with the current Maven project.
@param filename
The source filename to check, relative to a source root, must not be
<code>null</code>.
@return The (absolute) path to the existing source file if any,
<code>null</code> otherwise. | [
"Determines",
"whether",
"the",
"specified",
"source",
"file",
"is",
"already",
"present",
"in",
"any",
"of",
"the",
"compile",
"source",
"roots",
"registered",
"with",
"the",
"current",
"Maven",
"project",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L693-L705 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getCustomBundleBooleanProperty | public boolean getCustomBundleBooleanProperty(String bundleName, String key) {
return Boolean.parseBoolean(props.getProperty(
prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key, "false"));
} | java | public boolean getCustomBundleBooleanProperty(String bundleName, String key) {
return Boolean.parseBoolean(props.getProperty(
prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key, "false"));
} | [
"public",
"boolean",
"getCustomBundleBooleanProperty",
"(",
"String",
"bundleName",
",",
"String",
"key",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"props",
".",
"getProperty",
"(",
"prefix",
"+",
"PropertiesBundleConstant",
".",
"BUNDLE_FACTORY_CUSTOM_... | Returns the value of the custom bundle boolean property, or <b>false</b>
if no value is defined
@param bundleName
the bundle name
@param key
the key of the property
@return the value of the custom bundle property | [
"Returns",
"the",
"value",
"of",
"the",
"custom",
"bundle",
"boolean",
"property",
"or",
"<b",
">",
"false<",
"/",
"b",
">",
"if",
"no",
"value",
"is",
"defined"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L167-L170 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsXmlContentEditor.java | CmsXmlContentEditor.actionCopyElementLocale | public void actionCopyElementLocale() throws JspException {
try {
setEditorValues(getElementLocale());
if (!hasValidationErrors()) {
// save content of the editor only to the temporary file
writeContent();
CmsObject cloneCms = getCloneCms();
CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId();
cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId));
// remove eventual release & expiration date from temporary file to make preview work
cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false);
cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false);
}
} catch (CmsException e) {
// show error page
showErrorPage(this, e);
}
} | java | public void actionCopyElementLocale() throws JspException {
try {
setEditorValues(getElementLocale());
if (!hasValidationErrors()) {
// save content of the editor only to the temporary file
writeContent();
CmsObject cloneCms = getCloneCms();
CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId();
cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId));
// remove eventual release & expiration date from temporary file to make preview work
cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false);
cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false);
}
} catch (CmsException e) {
// show error page
showErrorPage(this, e);
}
} | [
"public",
"void",
"actionCopyElementLocale",
"(",
")",
"throws",
"JspException",
"{",
"try",
"{",
"setEditorValues",
"(",
"getElementLocale",
"(",
")",
")",
";",
"if",
"(",
"!",
"hasValidationErrors",
"(",
")",
")",
"{",
"// save content of the editor only to the te... | Performs the copy locale action.<p>
@throws JspException if something goes wrong | [
"Performs",
"the",
"copy",
"locale",
"action",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L334-L352 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlAbstractReport.java | HtmlAbstractReport.getFormattedString | static String getFormattedString(String key, Object... arguments) {
return I18N.getFormattedString(key, arguments);
} | java | static String getFormattedString(String key, Object... arguments) {
return I18N.getFormattedString(key, arguments);
} | [
"static",
"String",
"getFormattedString",
"(",
"String",
"key",
",",
"Object",
"...",
"arguments",
")",
"{",
"return",
"I18N",
".",
"getFormattedString",
"(",
"key",
",",
"arguments",
")",
";",
"}"
] | Retourne une traduction dans la locale courante et insère les arguments aux positions {i}.
@param key clé d'un libellé dans les fichiers de traduction
@param arguments Valeur à inclure dans le résultat
@return String | [
"Retourne",
"une",
"traduction",
"dans",
"la",
"locale",
"courante",
"et",
"insère",
"les",
"arguments",
"aux",
"positions",
"{",
"i",
"}",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlAbstractReport.java#L159-L161 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlContentDefinition.java | CmsXmlContentDefinition.createDocument | public Document createDocument(CmsObject cms, I_CmsXmlDocument document, Locale locale) {
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement(getOuterName());
root.add(I_CmsXmlSchemaType.XSI_NAMESPACE);
root.addAttribute(I_CmsXmlSchemaType.XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION, getSchemaLocation());
createLocale(cms, document, root, locale);
return doc;
} | java | public Document createDocument(CmsObject cms, I_CmsXmlDocument document, Locale locale) {
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement(getOuterName());
root.add(I_CmsXmlSchemaType.XSI_NAMESPACE);
root.addAttribute(I_CmsXmlSchemaType.XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION, getSchemaLocation());
createLocale(cms, document, root, locale);
return doc;
} | [
"public",
"Document",
"createDocument",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlDocument",
"document",
",",
"Locale",
"locale",
")",
"{",
"Document",
"doc",
"=",
"DocumentHelper",
".",
"createDocument",
"(",
")",
";",
"Element",
"root",
"=",
"doc",
".",
"addEle... | Generates a valid XML document according to the XML schema of this content definition.<p>
@param cms the current users OpenCms context
@param document the OpenCms XML document the XML is created for
@param locale the locale to create the default element in the document with
@return a valid XML document according to the XML schema of this content definition | [
"Generates",
"a",
"valid",
"XML",
"document",
"according",
"to",
"the",
"XML",
"schema",
"of",
"this",
"content",
"definition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1215-L1226 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java | DynamicByteBufferHelper._idx | public static void _idx(final byte[] array, int startIndex, byte[] input) {
try {
System.arraycopy(input, 0, array, startIndex, input.length);
} catch (Exception ex) {
throw new KriptonRuntimeException(String.format("array size %d, startIndex %d, input length %d", array.length, startIndex, input.length), ex);
}
} | java | public static void _idx(final byte[] array, int startIndex, byte[] input) {
try {
System.arraycopy(input, 0, array, startIndex, input.length);
} catch (Exception ex) {
throw new KriptonRuntimeException(String.format("array size %d, startIndex %d, input length %d", array.length, startIndex, input.length), ex);
}
} | [
"public",
"static",
"void",
"_idx",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"int",
"startIndex",
",",
"byte",
"[",
"]",
"input",
")",
"{",
"try",
"{",
"System",
".",
"arraycopy",
"(",
"input",
",",
"0",
",",
"array",
",",
"startIndex",
",",
"... | Idx.
@param array the array
@param startIndex the start index
@param input the input | [
"Idx",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java#L1061-L1068 |
landawn/AbacusUtil | src/com/landawn/abacus/util/StringUtil.java | StringUtil.ordinalIndexOf | public static int ordinalIndexOf(final String str, final String substr, final int ordinal) {
return ordinalIndexOf(str, substr, ordinal, false);
} | java | public static int ordinalIndexOf(final String str, final String substr, final int ordinal) {
return ordinalIndexOf(str, substr, ordinal, false);
} | [
"public",
"static",
"int",
"ordinalIndexOf",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"substr",
",",
"final",
"int",
"ordinal",
")",
"{",
"return",
"ordinalIndexOf",
"(",
"str",
",",
"substr",
",",
"ordinal",
",",
"false",
")",
";",
"}"
] | <p>
Finds the n-th index within a String, handling {@code null}.
</p>
@param str
@param substr
@param ordinal
the n-th {@code searchStr} to find
@return the n-th index of the search String, {@code -1} (
{@code N.INDEX_NOT_FOUND}) if no match or {@code null} or empty
string input | [
"<p",
">",
"Finds",
"the",
"n",
"-",
"th",
"index",
"within",
"a",
"String",
"handling",
"{",
"@code",
"null",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L3609-L3611 |
Pixplicity/EasyPrefs | library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java | Prefs.putOrderedStringSet | @SuppressWarnings("WeakerAccess")
public static void putOrderedStringSet(String key, Set<String> value) {
final Editor editor = getPreferences().edit();
int stringSetLength = 0;
if (mPrefs.contains(key + LENGTH)) {
// First read what the value was
stringSetLength = mPrefs.getInt(key + LENGTH, -1);
}
editor.putInt(key + LENGTH, value.size());
int i = 0;
for (String aValue : value) {
editor.putString(key + "[" + i + "]", aValue);
i++;
}
for (; i < stringSetLength; i++) {
// Remove any remaining values
editor.remove(key + "[" + i + "]");
}
editor.apply();
} | java | @SuppressWarnings("WeakerAccess")
public static void putOrderedStringSet(String key, Set<String> value) {
final Editor editor = getPreferences().edit();
int stringSetLength = 0;
if (mPrefs.contains(key + LENGTH)) {
// First read what the value was
stringSetLength = mPrefs.getInt(key + LENGTH, -1);
}
editor.putInt(key + LENGTH, value.size());
int i = 0;
for (String aValue : value) {
editor.putString(key + "[" + i + "]", aValue);
i++;
}
for (; i < stringSetLength; i++) {
// Remove any remaining values
editor.remove(key + "[" + i + "]");
}
editor.apply();
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"void",
"putOrderedStringSet",
"(",
"String",
"key",
",",
"Set",
"<",
"String",
">",
"value",
")",
"{",
"final",
"Editor",
"editor",
"=",
"getPreferences",
"(",
")",
".",
"edit",
"(",... | Stores a Set of Strings, preserving the order.
Note that this method is heavier that the native implementation {@link #putStringSet(String,
Set)} (which does not reliably preserve the order of the Set). To preserve the order of the
items in the Set, the Set implementation must be one that as an iterator with predictable
order, such as {@link LinkedHashSet}.
@param key The name of the preference to modify.
@param value The new value for the preference.
@see #putStringSet(String, Set)
@see #getOrderedStringSet(String, Set) | [
"Stores",
"a",
"Set",
"of",
"Strings",
"preserving",
"the",
"order",
".",
"Note",
"that",
"this",
"method",
"is",
"heavier",
"that",
"the",
"native",
"implementation",
"{",
"@link",
"#putStringSet",
"(",
"String",
"Set",
")",
"}",
"(",
"which",
"does",
"no... | train | https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L385-L404 |
apereo/cas | support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java | GoogleAuthenticatorTokenCouchDbRepository.findOneByUidForOtp | @View(name = "by_uid_otp", map = "function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }")
public CouchDbGoogleAuthenticatorToken findOneByUidForOtp(final String uid, final Integer otp) {
val view = createQuery("by_uid_otp").key(ComplexKey.of(uid, otp)).limit(1);
return db.queryView(view, CouchDbGoogleAuthenticatorToken.class).stream().findFirst().orElse(null);
} | java | @View(name = "by_uid_otp", map = "function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }")
public CouchDbGoogleAuthenticatorToken findOneByUidForOtp(final String uid, final Integer otp) {
val view = createQuery("by_uid_otp").key(ComplexKey.of(uid, otp)).limit(1);
return db.queryView(view, CouchDbGoogleAuthenticatorToken.class).stream().findFirst().orElse(null);
} | [
"@",
"View",
"(",
"name",
"=",
"\"by_uid_otp\"",
",",
"map",
"=",
"\"function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }\"",
")",
"public",
"CouchDbGoogleAuthenticatorToken",
"findOneByUidForOtp",
"(",
"final",
"String",
"uid",
",",
"final",
"... | Find first by uid, otp pair.
@param uid uid to search
@param otp otp to search
@return token for uid, otp pair | [
"Find",
"first",
"by",
"uid",
"otp",
"pair",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java#L33-L37 |
renepickhardt/metalcon | graphityServer/src/main/java/de/metalcon/server/tomcat/NSSP/create/CreateRequest.java | CreateRequest.checkRequest | public static CreateRequest checkRequest(final HttpServletRequest request,
final DiskFileItemFactory factory,
final CreateResponse createResponse) throws FileUploadException {
final FormItemList formItemList = FormItemList.extractFormItems(
request, factory);
return checkRequest(formItemList, createResponse);
} | java | public static CreateRequest checkRequest(final HttpServletRequest request,
final DiskFileItemFactory factory,
final CreateResponse createResponse) throws FileUploadException {
final FormItemList formItemList = FormItemList.extractFormItems(
request, factory);
return checkRequest(formItemList, createResponse);
} | [
"public",
"static",
"CreateRequest",
"checkRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"DiskFileItemFactory",
"factory",
",",
"final",
"CreateResponse",
"createResponse",
")",
"throws",
"FileUploadException",
"{",
"final",
"FormItemList",
"formI... | check a create request for validity concerning NSSP
@param request
Tomcat servlet request
@param factory
disk file item factory
@param createResponse
create response object
@return create request object<br>
<b>null</b> if the create request is invalid
@throws FileUploadException
if errors encountered while processing the request | [
"check",
"a",
"create",
"request",
"for",
"validity",
"concerning",
"NSSP"
] | train | https://github.com/renepickhardt/metalcon/blob/26a7bd89d2225fe2172dc958d10f64a1bd9cf52f/graphityServer/src/main/java/de/metalcon/server/tomcat/NSSP/create/CreateRequest.java#L56-L62 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadImage | public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) {
BufferedImage img = loadImage(fileName);
if( img == null )
return null;
return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
} | java | public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) {
BufferedImage img = loadImage(fileName);
if( img == null )
return null;
return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"T",
"loadImage",
"(",
"String",
"fileName",
",",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"BufferedImage",
"img",
"=",
"loadImage",
"(",
"fileName",
")",
";",
"if",
"(",
... | Loads the image and converts into the specified image type.
@param fileName Path to image file.
@param imageType Type of image that should be returned.
@return The image or null if the image could not be loaded. | [
"Loads",
"the",
"image",
"and",
"converts",
"into",
"the",
"specified",
"image",
"type",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L121-L127 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_PUT | public void organizationName_service_exchangeService_domain_domainName_PUT(String organizationName, String exchangeService, String domainName, OvhDomain body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_domain_domainName_PUT(String organizationName, String exchangeService, String domainName, OvhDomain body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_domain_domainName_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"domainName",
",",
"OvhDomain",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/e... | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L500-L504 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/HierarchicalUriComponents.java | HierarchicalUriComponents.encodeUriComponent | static String encodeUriComponent(String source, String encoding, Type type)
throws UnsupportedEncodingException {
if (source == null) {
return null;
}
Misc.checkNotNull(encoding, "Encoding");
Misc.checkArgument(!encoding.isEmpty(), "Encoding must not be empty");
byte[] bytes = encodeBytes(source.getBytes(encoding), type);
return new String(bytes, "US-ASCII");
} | java | static String encodeUriComponent(String source, String encoding, Type type)
throws UnsupportedEncodingException {
if (source == null) {
return null;
}
Misc.checkNotNull(encoding, "Encoding");
Misc.checkArgument(!encoding.isEmpty(), "Encoding must not be empty");
byte[] bytes = encodeBytes(source.getBytes(encoding), type);
return new String(bytes, "US-ASCII");
} | [
"static",
"String",
"encodeUriComponent",
"(",
"String",
"source",
",",
"String",
"encoding",
",",
"Type",
"type",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Misc",
".",
"chec... | Encode the given source into an encoded String using the rules specified
by the given component and with the given options.
@param source the source string
@param encoding the encoding of the source string
@param type the URI component for the source
@return the encoded URI
@throws IllegalArgumentException when the given uri parameter is not a valid URI | [
"Encode",
"the",
"given",
"source",
"into",
"an",
"encoded",
"String",
"using",
"the",
"rules",
"specified",
"by",
"the",
"given",
"component",
"and",
"with",
"the",
"given",
"options",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/HierarchicalUriComponents.java#L42-L52 |
b3dgs/lionengine | lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java | ScreenFullAwt.initFullscreen | private void initFullscreen(Resolution output, int depth)
{
final java.awt.Window window = new java.awt.Window(frame, conf);
window.setBackground(Color.BLACK);
window.setIgnoreRepaint(true);
window.setPreferredSize(new Dimension(output.getWidth(), output.getHeight()));
dev.setFullScreenWindow(window);
final DisplayMode disp = isSupported(new DisplayMode(output.getWidth(),
output.getHeight(),
depth,
output.getRate()));
if (disp == null)
{
throw new LionEngineException(ScreenFullAwt.ERROR_UNSUPPORTED_FULLSCREEN
+ formatResolution(output, depth)
+ getSupportedResolutions());
}
if (!dev.isDisplayChangeSupported())
{
throw new LionEngineException(ScreenFullAwt.ERROR_SWITCH);
}
dev.setDisplayMode(disp);
window.validate();
ToolsAwt.createBufferStrategy(window, conf);
buf = window.getBufferStrategy();
// Set input listeners
componentForKeyboard = frame;
componentForMouse = window;
componentForCursor = window;
frame.validate();
} | java | private void initFullscreen(Resolution output, int depth)
{
final java.awt.Window window = new java.awt.Window(frame, conf);
window.setBackground(Color.BLACK);
window.setIgnoreRepaint(true);
window.setPreferredSize(new Dimension(output.getWidth(), output.getHeight()));
dev.setFullScreenWindow(window);
final DisplayMode disp = isSupported(new DisplayMode(output.getWidth(),
output.getHeight(),
depth,
output.getRate()));
if (disp == null)
{
throw new LionEngineException(ScreenFullAwt.ERROR_UNSUPPORTED_FULLSCREEN
+ formatResolution(output, depth)
+ getSupportedResolutions());
}
if (!dev.isDisplayChangeSupported())
{
throw new LionEngineException(ScreenFullAwt.ERROR_SWITCH);
}
dev.setDisplayMode(disp);
window.validate();
ToolsAwt.createBufferStrategy(window, conf);
buf = window.getBufferStrategy();
// Set input listeners
componentForKeyboard = frame;
componentForMouse = window;
componentForCursor = window;
frame.validate();
} | [
"private",
"void",
"initFullscreen",
"(",
"Resolution",
"output",
",",
"int",
"depth",
")",
"{",
"final",
"java",
".",
"awt",
".",
"Window",
"window",
"=",
"new",
"java",
".",
"awt",
".",
"Window",
"(",
"frame",
",",
"conf",
")",
";",
"window",
".",
... | Prepare fullscreen mode.
@param output The output resolution
@param depth The bit depth color.
@throws LionEngineException If unsupported resolution. | [
"Prepare",
"fullscreen",
"mode",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java#L88-L121 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Element.java | Element.appendElement | public Element appendElement(String tagName) {
Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri());
appendChild(child);
return child;
} | java | public Element appendElement(String tagName) {
Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri());
appendChild(child);
return child;
} | [
"public",
"Element",
"appendElement",
"(",
"String",
"tagName",
")",
"{",
"Element",
"child",
"=",
"new",
"Element",
"(",
"Tag",
".",
"valueOf",
"(",
"tagName",
",",
"NodeUtils",
".",
"parser",
"(",
"this",
")",
".",
"settings",
"(",
")",
")",
",",
"ba... | Create a new element by tag name, and add it as the last child.
@param tagName the name of the tag (e.g. {@code div}).
@return the new element, to allow you to add content to it, e.g.:
{@code parent.appendElement("h1").attr("id", "header").text("Welcome");} | [
"Create",
"a",
"new",
"element",
"by",
"tag",
"name",
"and",
"add",
"it",
"as",
"the",
"last",
"child",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L494-L498 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addBooleanValue | protected void addBooleanValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN));
} | java | protected void addBooleanValue(Document doc, String fieldName, Object internalValue)
{
doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN));
} | [
"protected",
"void",
"addBooleanValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"(",
"fieldName",
",",
"internalValue",
".",
"toString",
"(",
")",
",",
"Pr... | Adds the string representation of the boolean value to the document as
the named field.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"string",
"representation",
"of",
"the",
"boolean",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L695-L698 |
beanshell/beanshell | src/main/java/bsh/engine/BshScriptEngine.java | BshScriptEngine.getInterface | @Override
public <T> T getInterface(Object thiz, Class<T> clasz) {
if (!(thiz instanceof bsh.This)) {
throw new IllegalArgumentException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass()));
}
bsh.This bshThis = (bsh.This) thiz;
return clasz.cast(bshThis.getInterface(clasz));
} | java | @Override
public <T> T getInterface(Object thiz, Class<T> clasz) {
if (!(thiz instanceof bsh.This)) {
throw new IllegalArgumentException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass()));
}
bsh.This bshThis = (bsh.This) thiz;
return clasz.cast(bshThis.getInterface(clasz));
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"getInterface",
"(",
"Object",
"thiz",
",",
"Class",
"<",
"T",
">",
"clasz",
")",
"{",
"if",
"(",
"!",
"(",
"thiz",
"instanceof",
"bsh",
".",
"This",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcept... | Returns an implementation of an interface using member functions of a
scripting object compiled in the interpreter. The methods of the interface
may be implemented using invoke(Object, String, Object...) method.
@param thiz The scripting object whose member functions are used to
implement the methods of the interface.
@param clasz The {@code Class} object of the interface to return.
@return An instance of requested interface - null if the requested
interface is unavailable, i. e. if compiled methods in the
{@code ScriptEngine} cannot be found matching the ones in the
requested interface.
@throws IllegalArgumentException if the specified {@code Class} object
does not exist or is not an interface, or if the specified Object is null
or does not represent a scripting object. | [
"Returns",
"an",
"implementation",
"of",
"an",
"interface",
"using",
"member",
"functions",
"of",
"a",
"scripting",
"object",
"compiled",
"in",
"the",
"interpreter",
".",
"The",
"methods",
"of",
"the",
"interface",
"may",
"be",
"implemented",
"using",
"invoke",
... | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/BshScriptEngine.java#L343-L351 |
apache/incubator-druid | server/src/main/java/org/apache/druid/server/coordinator/helper/SegmentCompactorUtil.java | SegmentCompactorUtil.removeIntervalFromEnd | static Interval removeIntervalFromEnd(Interval largeInterval, Interval smallInterval)
{
Preconditions.checkArgument(
largeInterval.getEnd().equals(smallInterval.getEnd()),
"end should be same. largeInterval[%s] smallInterval[%s]",
largeInterval,
smallInterval
);
return new Interval(largeInterval.getStart(), smallInterval.getStart());
} | java | static Interval removeIntervalFromEnd(Interval largeInterval, Interval smallInterval)
{
Preconditions.checkArgument(
largeInterval.getEnd().equals(smallInterval.getEnd()),
"end should be same. largeInterval[%s] smallInterval[%s]",
largeInterval,
smallInterval
);
return new Interval(largeInterval.getStart(), smallInterval.getStart());
} | [
"static",
"Interval",
"removeIntervalFromEnd",
"(",
"Interval",
"largeInterval",
",",
"Interval",
"smallInterval",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"largeInterval",
".",
"getEnd",
"(",
")",
".",
"equals",
"(",
"smallInterval",
".",
"getEnd",
"... | Removes {@code smallInterval} from {@code largeInterval}. The end of both intervals should be same.
@return an interval of {@code largeInterval} - {@code smallInterval}. | [
"Removes",
"{",
"@code",
"smallInterval",
"}",
"from",
"{",
"@code",
"largeInterval",
"}",
".",
"The",
"end",
"of",
"both",
"intervals",
"should",
"be",
"same",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/helper/SegmentCompactorUtil.java#L45-L54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.