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 |
|---|---|---|---|---|---|---|---|---|---|---|
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.swapRow | public static void swapRow(Matrix A, int j, int k, int start, int to)
{
double t;
for(int i = start; i < to; i++)
{
t = A.get(j, i);
A.set(j, i, A.get(k, i));
A.set(k, i, t);
}
} | java | public static void swapRow(Matrix A, int j, int k, int start, int to)
{
double t;
for(int i = start; i < to; i++)
{
t = A.get(j, i);
A.set(j, i, A.get(k, i));
A.set(k, i, t);
}
} | [
"public",
"static",
"void",
"swapRow",
"(",
"Matrix",
"A",
",",
"int",
"j",
",",
"int",
"k",
",",
"int",
"start",
",",
"int",
"to",
")",
"{",
"double",
"t",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"to",
";",
"i",
"++",
")",
... | Swaps the rows <tt>j</tt> and <tt>k</tt> in the given matrix.
@param A the matrix to perform he update on
@param j the first row to swap
@param k the second row to swap
@param start the first column that will be included in the swap (inclusive)
@param to the last column to be included in the swap (exclusive) | [
"Swaps",
"the",
"rows",
"<tt",
">",
"j<",
"/",
"tt",
">",
"and",
"<tt",
">",
"k<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L388-L397 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java | URAPIs_UserGroupSearchBases.setupldapServer | private static void setupldapServer() throws Exception {
ds = new InMemoryLDAPServer(SUB_DN);
Entry entry = new Entry(SUB_DN);
entry.addAttribute("objectclass", "top");
entry.addAttribute("objectclass", "domain");
ds.add(entry);
/*
* Add the partition entries.
*/
entry = new Entry("ou=Test,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
ds.add(entry);
entry = new Entry(USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
entry.addAttribute("ou", "TestUsers");
ds.add(entry);
entry = new Entry(BAD_USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "BadUsers");
ds.add(entry);
entry = new Entry("ou=Dev,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
ds.add(entry);
entry = new Entry(GROUP_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
entry.addAttribute("ou", "DevGroups");
ds.add(entry);
/*
* Create the user and group.
*/
entry = new Entry(USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", USER);
entry.addAttribute("sn", USER);
entry.addAttribute("cn", USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(BAD_USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", BAD_USER);
entry.addAttribute("sn", BAD_USER);
entry.addAttribute("cn", BAD_USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(GROUP_DN);
entry.addAttribute("objectclass", "groupofnames");
entry.addAttribute("cn", GROUP);
entry.addAttribute("member", USER_DN);
entry.addAttribute("member", BAD_USER_DN);
ds.add(entry);
} | java | private static void setupldapServer() throws Exception {
ds = new InMemoryLDAPServer(SUB_DN);
Entry entry = new Entry(SUB_DN);
entry.addAttribute("objectclass", "top");
entry.addAttribute("objectclass", "domain");
ds.add(entry);
/*
* Add the partition entries.
*/
entry = new Entry("ou=Test,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
ds.add(entry);
entry = new Entry(USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Test");
entry.addAttribute("ou", "TestUsers");
ds.add(entry);
entry = new Entry(BAD_USER_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "BadUsers");
ds.add(entry);
entry = new Entry("ou=Dev,o=ibm,c=us");
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
ds.add(entry);
entry = new Entry(GROUP_BASE_DN);
entry.addAttribute("objectclass", "organizationalunit");
entry.addAttribute("ou", "Dev");
entry.addAttribute("ou", "DevGroups");
ds.add(entry);
/*
* Create the user and group.
*/
entry = new Entry(USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", USER);
entry.addAttribute("sn", USER);
entry.addAttribute("cn", USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(BAD_USER_DN);
entry.addAttribute("objectclass", "inetorgperson");
entry.addAttribute("uid", BAD_USER);
entry.addAttribute("sn", BAD_USER);
entry.addAttribute("cn", BAD_USER);
entry.addAttribute("userPassword", "password");
ds.add(entry);
entry = new Entry(GROUP_DN);
entry.addAttribute("objectclass", "groupofnames");
entry.addAttribute("cn", GROUP);
entry.addAttribute("member", USER_DN);
entry.addAttribute("member", BAD_USER_DN);
ds.add(entry);
} | [
"private",
"static",
"void",
"setupldapServer",
"(",
")",
"throws",
"Exception",
"{",
"ds",
"=",
"new",
"InMemoryLDAPServer",
"(",
"SUB_DN",
")",
";",
"Entry",
"entry",
"=",
"new",
"Entry",
"(",
"SUB_DN",
")",
";",
"entry",
".",
"addAttribute",
"(",
"\"obj... | Configure the embedded LDAP server.
@throws Exception If the server failed to start for some reason. | [
"Configure",
"the",
"embedded",
"LDAP",
"server",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/URAPIs_UserGroupSearchBases.java#L153-L216 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java | SystemProperties.setPropertyValue | @Nonnull
public static EChange setPropertyValue (@Nonnull final String sKey, final long nValue)
{
return setPropertyValue (sKey, Long.toString (nValue));
} | java | @Nonnull
public static EChange setPropertyValue (@Nonnull final String sKey, final long nValue)
{
return setPropertyValue (sKey, Long.toString (nValue));
} | [
"@",
"Nonnull",
"public",
"static",
"EChange",
"setPropertyValue",
"(",
"@",
"Nonnull",
"final",
"String",
"sKey",
",",
"final",
"long",
"nValue",
")",
"{",
"return",
"setPropertyValue",
"(",
"sKey",
",",
"Long",
".",
"toString",
"(",
"nValue",
")",
")",
"... | Set a system property value under consideration of an eventually present
{@link SecurityManager}.
@param sKey
The key of the system property. May not be <code>null</code>.
@param nValue
The value of the system property.
@since 8.5.7
@return {@link EChange} | [
"Set",
"a",
"system",
"property",
"value",
"under",
"consideration",
"of",
"an",
"eventually",
"present",
"{",
"@link",
"SecurityManager",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java#L179-L183 |
hoary/JavaAV | JavaAV/src/main/java/com/github/hoary/javaav/Audio.java | Audio.getValue | public static Number getValue(ByteBuffer buffer, SampleFormat format, int index) {
switch (format) {
case U8:
case U8P:
return buffer.get(index);
case S16:
case S16P:
return buffer.getShort(index);
case S32:
case S32P:
return buffer.getInt(index);
case FLT:
case FLTP:
return buffer.getFloat(index);
case DBL:
case DBLP:
return buffer.getDouble(index);
default:
return 0;
}
} | java | public static Number getValue(ByteBuffer buffer, SampleFormat format, int index) {
switch (format) {
case U8:
case U8P:
return buffer.get(index);
case S16:
case S16P:
return buffer.getShort(index);
case S32:
case S32P:
return buffer.getInt(index);
case FLT:
case FLTP:
return buffer.getFloat(index);
case DBL:
case DBLP:
return buffer.getDouble(index);
default:
return 0;
}
} | [
"public",
"static",
"Number",
"getValue",
"(",
"ByteBuffer",
"buffer",
",",
"SampleFormat",
"format",
",",
"int",
"index",
")",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"U8",
":",
"case",
"U8P",
":",
"return",
"buffer",
".",
"get",
"(",
"index",
... | Read a {@code Number} at specified index from {@code ByteBuffer} for specified
{@code SampleFormat}. Depending on the sample format the value is represented by
a {@code byte, short, integer, float or double} number.
@param buffer {@code ByteBuffer} with audio samples.
@param format {@code SampleFormat} of audio samples in the buffer.
@param index the position in the buffer.
@return a value for a sample format represented by a {@code Number}, or {@code zero}
if sample format is unknown. | [
"Read",
"a",
"{",
"@code",
"Number",
"}",
"at",
"specified",
"index",
"from",
"{",
"@code",
"ByteBuffer",
"}",
"for",
"specified",
"{",
"@code",
"SampleFormat",
"}",
".",
"Depending",
"on",
"the",
"sample",
"format",
"the",
"value",
"is",
"represented",
"b... | train | https://github.com/hoary/JavaAV/blob/2d42b53d618ba0c663ae9abfd177b3ace41264cb/JavaAV/src/main/java/com/github/hoary/javaav/Audio.java#L83-L104 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readFolder | public CmsFolder readFolder(CmsRequestContext context, String resourcename, CmsResourceFilter filter)
throws CmsException {
CmsFolder result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
result = readFolder(dbc, resourcename, filter);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_FOLDER_2, resourcename, filter), e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsFolder readFolder(CmsRequestContext context, String resourcename, CmsResourceFilter filter)
throws CmsException {
CmsFolder result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
result = readFolder(dbc, resourcename, filter);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_FOLDER_2, resourcename, filter), e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsFolder",
"readFolder",
"(",
"CmsRequestContext",
"context",
",",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"CmsFolder",
"result",
"=",
"null",
";",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
... | Reads a folder resource from the VFS,
using the specified resource filter.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param context the current request context
@param resourcename the name of the folder to read (full path)
@param filter the resource filter to use while reading
@return the folder that was read
@throws CmsException if something goes wrong | [
"Reads",
"a",
"folder",
"resource",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4305-L4318 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgObject.java | JsMsgObject.encodePartToBuffer | private final int encodePartToBuffer(JsMsgPart jsPart, boolean header, byte[] buffer, int offset) throws MessageEncodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodePartToBuffer", new Object[]{jsPart, header, buffer, offset});
JMFMessage msg = (JMFMessage)jsPart.jmfPart;
int length = 0;
int newOffset = offset;
try {
length = msg.getEncodedLength();
// If this is a header (or only) part it also needs a 4 byte length field at the start
// containing the header length
if (header) {
ArrayUtil.writeInt(buffer, offset, length);
newOffset += ArrayUtil.INT_SIZE;
}
msg.toByteArray(buffer, newOffset, length);
}
catch (Exception e) {
// Dump the message part, and whatever we've managed to encode so far.
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodePartToBuffer", "jmo600", this,
new Object[] {
new Object[] { MfpConstants.DM_MESSAGE, msg, theMessage },
new Object[] { MfpConstants.DM_BUFFER, buffer, Integer.valueOf(offset), Integer.valueOf(length+ArrayUtil.INT_SIZE) }
}
);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encodePartToBuffer encode failed: " + e);
throw new MessageEncodeFailedException(e);
}
length += (newOffset - offset);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodePartToBuffer", Integer.valueOf(length));
return length;
} | java | private final int encodePartToBuffer(JsMsgPart jsPart, boolean header, byte[] buffer, int offset) throws MessageEncodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodePartToBuffer", new Object[]{jsPart, header, buffer, offset});
JMFMessage msg = (JMFMessage)jsPart.jmfPart;
int length = 0;
int newOffset = offset;
try {
length = msg.getEncodedLength();
// If this is a header (or only) part it also needs a 4 byte length field at the start
// containing the header length
if (header) {
ArrayUtil.writeInt(buffer, offset, length);
newOffset += ArrayUtil.INT_SIZE;
}
msg.toByteArray(buffer, newOffset, length);
}
catch (Exception e) {
// Dump the message part, and whatever we've managed to encode so far.
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodePartToBuffer", "jmo600", this,
new Object[] {
new Object[] { MfpConstants.DM_MESSAGE, msg, theMessage },
new Object[] { MfpConstants.DM_BUFFER, buffer, Integer.valueOf(offset), Integer.valueOf(length+ArrayUtil.INT_SIZE) }
}
);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encodePartToBuffer encode failed: " + e);
throw new MessageEncodeFailedException(e);
}
length += (newOffset - offset);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodePartToBuffer", Integer.valueOf(length));
return length;
} | [
"private",
"final",
"int",
"encodePartToBuffer",
"(",
"JsMsgPart",
"jsPart",
",",
"boolean",
"header",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"throws",
"MessageEncodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled... | Encode the message part into a byte array buffer.
The buffer will be used for transmitting over the wire, hardening
into a database and any other need for 'serialization'
Locking: The caller MUST have already synchronized on getPartLockArtefact(jsPart)
before calling this method. (This would have to be true in any case,
as the caller must call getEncodedLength to determine the buffer
size needed.
@param jsPart The message part to be encoded.
@param header True if this is the header/first message part, otherwise false.
@param buffer The buffer to encode the part into.
@param offset The offset in the buffer at which to start writing the encoded message
@return the number of bytes written to the buffer.
@exception MessageEncodeFailedException is thrown if the message part failed to encode. | [
"Encode",
"the",
"message",
"part",
"into",
"a",
"byte",
"array",
"buffer",
".",
"The",
"buffer",
"will",
"be",
"used",
"for",
"transmitting",
"over",
"the",
"wire",
"hardening",
"into",
"a",
"database",
"and",
"any",
"other",
"need",
"for",
"serialization",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgObject.java#L1091-L1129 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/block/ArrayBlock.java | ArrayBlock.createArrayBlockInternal | static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
{
validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
} | java | static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
{
validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
} | [
"static",
"ArrayBlock",
"createArrayBlockInternal",
"(",
"int",
"arrayOffset",
",",
"int",
"positionCount",
",",
"@",
"Nullable",
"boolean",
"[",
"]",
"valueIsNull",
",",
"int",
"[",
"]",
"offsets",
",",
"Block",
"values",
")",
"{",
"validateConstructorArguments",... | Create an array block directly without per element validations. | [
"Create",
"an",
"array",
"block",
"directly",
"without",
"per",
"element",
"validations",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/ArrayBlock.java#L65-L69 |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java | ModelFactory.setModelClass | @SuppressWarnings("unchecked")
public static void setModelClass(Class<?> modelClass) throws IllegalArgumentException {
if (!DefaultModelImpl.class.isAssignableFrom(modelClass)) {
throw new IllegalArgumentException("Modelclass, " + modelClass.getName() + ", is not a subtype of " + DefaultModelImpl.class.getName());
}
ModelFactory.modelClass = (Class<DefaultModelImpl>)modelClass;
} | java | @SuppressWarnings("unchecked")
public static void setModelClass(Class<?> modelClass) throws IllegalArgumentException {
if (!DefaultModelImpl.class.isAssignableFrom(modelClass)) {
throw new IllegalArgumentException("Modelclass, " + modelClass.getName() + ", is not a subtype of " + DefaultModelImpl.class.getName());
}
ModelFactory.modelClass = (Class<DefaultModelImpl>)modelClass;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"setModelClass",
"(",
"Class",
"<",
"?",
">",
"modelClass",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"DefaultModelImpl",
".",
"class",
".",
"isAssignableFrom",
... | Register a custom model class, must be a subclass to DefaultModelImpl.
@param modelClass
@throws IllegalArgumentException if supplied class is not a subclass of DefaultModelImpl | [
"Register",
"a",
"custom",
"model",
"class",
"must",
"be",
"a",
"subclass",
"to",
"DefaultModelImpl",
"."
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java#L49-L55 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java | Assertions.fail | @Nonnull
public static Error fail(@Nullable final String message) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "failed"));
MetaErrorListeners.fireError("Asserion error", error);
if (true) {
throw error;
}
return error;
} | java | @Nonnull
public static Error fail(@Nullable final String message) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "failed"));
MetaErrorListeners.fireError("Asserion error", error);
if (true) {
throw error;
}
return error;
} | [
"@",
"Nonnull",
"public",
"static",
"Error",
"fail",
"(",
"@",
"Nullable",
"final",
"String",
"message",
")",
"{",
"final",
"AssertionError",
"error",
"=",
"new",
"AssertionError",
"(",
"GetUtils",
".",
"ensureNonNull",
"(",
"message",
",",
"\"failed\"",
")",
... | Throw assertion error for some cause
@param message description of the cause.
@return generated error, but it throws AssertionError before return so that the value just for IDE.
@throws AssertionError will be thrown
@since 1.0 | [
"Throw",
"assertion",
"error",
"for",
"some",
"cause"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L56-L64 |
datumbox/lpsolve | src/main/java/lpsolve/LpSolve.java | LpSolve.putBbBranchfunc | public void putBbBranchfunc(BbListener listener, Object userhandle) throws LpSolveException {
bbBranchListener = listener;
bbBranchUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerBbBranchfunc();
} | java | public void putBbBranchfunc(BbListener listener, Object userhandle) throws LpSolveException {
bbBranchListener = listener;
bbBranchUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerBbBranchfunc();
} | [
"public",
"void",
"putBbBranchfunc",
"(",
"BbListener",
"listener",
",",
"Object",
"userhandle",
")",
"throws",
"LpSolveException",
"{",
"bbBranchListener",
"=",
"listener",
";",
"bbBranchUserhandle",
"=",
"(",
"listener",
"!=",
"null",
")",
"?",
"userhandle",
":"... | Register an <code>BbBranchListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call | [
"Register",
"an",
"<code",
">",
"BbBranchListener<",
"/",
"code",
">",
"for",
"callback",
"."
] | train | https://github.com/datumbox/lpsolve/blob/201b3e99153d907bb99c189e5647bc71a3a1add6/src/main/java/lpsolve/LpSolve.java#L1649-L1654 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/database/MonitoringDataSource.java | MonitoringDataSource.doConnectionMonitoring | private void doConnectionMonitoring(long startingInstant, String monitorSuffix) {
InApplicationMonitor.getInstance()
.addTimerMeasurement(this.monitorBaseName + monitorSuffix,
System.currentTimeMillis() - startingInstant);
int noCurrentConnections = this.currentConnections.incrementAndGet();
if (noCurrentConnections > this.maxConnections.get()) {
this.maxConnections.set(noCurrentConnections);
}
} | java | private void doConnectionMonitoring(long startingInstant, String monitorSuffix) {
InApplicationMonitor.getInstance()
.addTimerMeasurement(this.monitorBaseName + monitorSuffix,
System.currentTimeMillis() - startingInstant);
int noCurrentConnections = this.currentConnections.incrementAndGet();
if (noCurrentConnections > this.maxConnections.get()) {
this.maxConnections.set(noCurrentConnections);
}
} | [
"private",
"void",
"doConnectionMonitoring",
"(",
"long",
"startingInstant",
",",
"String",
"monitorSuffix",
")",
"{",
"InApplicationMonitor",
".",
"getInstance",
"(",
")",
".",
"addTimerMeasurement",
"(",
"this",
".",
"monitorBaseName",
"+",
"monitorSuffix",
",",
"... | Handles the monitoring for retrieving connections and adapts the <i>max connection</i> counter if appropriate.
@param startingInstant
the instant a database connection was requested
@param monitorSuffix
the suffix for the monitor name to increase | [
"Handles",
"the",
"monitoring",
"for",
"retrieving",
"connections",
"and",
"adapts",
"the",
"<i",
">",
"max",
"connection<",
"/",
"i",
">",
"counter",
"if",
"appropriate",
"."
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/database/MonitoringDataSource.java#L185-L194 |
apache/flink | flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java | MetricConfig.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Boolean.parseBoolean(argument);
} | java | public boolean getBoolean(String key, boolean defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Boolean.parseBoolean(argument);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"argument",
"=",
"getProperty",
"(",
"key",
",",
"null",
")",
";",
"return",
"argument",
"==",
"null",
"?",
"defaultValue",
":",
"Boolean",
".",
"p... | Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
@param key the hashtable key.
@param defaultValue a default value.
@return the value in this property list with the specified key value parsed as a boolean. | [
"Searches",
"for",
"the",
"property",
"with",
"the",
"specified",
"key",
"in",
"this",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"rec... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L110-L115 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.handleGetFileContentWithMetaData | protected FileWrapper handleGetFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
FileWrapper fileWrapper = null;
try {
FileContent fileContent = this.handleGetFileContent(type, entityId, fileId);
List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
FileMeta correctMetaData = null;
for (FileMeta metaData : metaDataList) {
if (fileId.equals(metaData.getId())) {
correctMetaData = metaData;
break;
}
}
fileWrapper = new StandardFileWrapper(fileContent, correctMetaData);
} catch (Exception e) {
log.error("Error getting file with id: " + fileId + " for " + type.getSimpleName() + " with id:" + entityId);
}
return fileWrapper;
} | java | protected FileWrapper handleGetFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
FileWrapper fileWrapper = null;
try {
FileContent fileContent = this.handleGetFileContent(type, entityId, fileId);
List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
FileMeta correctMetaData = null;
for (FileMeta metaData : metaDataList) {
if (fileId.equals(metaData.getId())) {
correctMetaData = metaData;
break;
}
}
fileWrapper = new StandardFileWrapper(fileContent, correctMetaData);
} catch (Exception e) {
log.error("Error getting file with id: " + fileId + " for " + type.getSimpleName() + " with id:" + entityId);
}
return fileWrapper;
} | [
"protected",
"FileWrapper",
"handleGetFileContentWithMetaData",
"(",
"Class",
"<",
"?",
"extends",
"FileEntity",
">",
"type",
",",
"Integer",
"entityId",
",",
"Integer",
"fileId",
")",
"{",
"FileWrapper",
"fileWrapper",
"=",
"null",
";",
"try",
"{",
"FileContent",... | Makes the api call to get both the file content and filemeta data, and combines those two to a FileWrapper
@param type
@param entityId
@param fileId
@return | [
"Makes",
"the",
"api",
"call",
"to",
"get",
"both",
"the",
"file",
"content",
"and",
"filemeta",
"data",
"and",
"combines",
"those",
"two",
"to",
"a",
"FileWrapper"
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1549-L1569 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java | ResourceUtils.prepareClasspathResourceIfNeeded | public static Resource prepareClasspathResourceIfNeeded(final Resource resource) {
if (resource == null) {
LOGGER.debug("No resource defined to prepare. Returning null");
return null;
}
return prepareClasspathResourceIfNeeded(resource, false, resource.getFilename());
} | java | public static Resource prepareClasspathResourceIfNeeded(final Resource resource) {
if (resource == null) {
LOGGER.debug("No resource defined to prepare. Returning null");
return null;
}
return prepareClasspathResourceIfNeeded(resource, false, resource.getFilename());
} | [
"public",
"static",
"Resource",
"prepareClasspathResourceIfNeeded",
"(",
"final",
"Resource",
"resource",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"No resource defined to prepare. Returning null\"",
")",
";",
"return",
... | Prepare classpath resource if needed file.
@param resource the resource
@return the file | [
"Prepare",
"classpath",
"resource",
"if",
"needed",
"file",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L138-L144 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStats.java | UicStats.addStats | private void addStats(final Map<WComponent, Stat> statsMap, final WComponent comp) {
Stat stat = createStat(comp);
statsMap.put(comp, stat);
if (comp instanceof Container) {
Container container = (Container) comp;
int childCount = container.getChildCount();
for (int i = 0; i < childCount; i++) {
WComponent child = container.getChildAt(i);
addStats(statsMap, child);
}
}
} | java | private void addStats(final Map<WComponent, Stat> statsMap, final WComponent comp) {
Stat stat = createStat(comp);
statsMap.put(comp, stat);
if (comp instanceof Container) {
Container container = (Container) comp;
int childCount = container.getChildCount();
for (int i = 0; i < childCount; i++) {
WComponent child = container.getChildAt(i);
addStats(statsMap, child);
}
}
} | [
"private",
"void",
"addStats",
"(",
"final",
"Map",
"<",
"WComponent",
",",
"Stat",
">",
"statsMap",
",",
"final",
"WComponent",
"comp",
")",
"{",
"Stat",
"stat",
"=",
"createStat",
"(",
"comp",
")",
";",
"statsMap",
".",
"put",
"(",
"comp",
",",
"stat... | Recursively adds statistics for a component and its children to the stats map.
@param statsMap the stats map to add to.
@param comp the component to analyse. | [
"Recursively",
"adds",
"statistics",
"for",
"a",
"component",
"and",
"its",
"children",
"to",
"the",
"stats",
"map",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStats.java#L147-L160 |
google/error-prone | check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java | NullnessPropagationTransfer.visitFieldAccess | @Override
Nullness visitFieldAccess(
FieldAccessNode node, Updates updates, AccessPathValues<Nullness> store) {
if (!node.isStatic()) {
setNonnullIfTrackable(updates, node.getReceiver());
}
ClassAndField accessed = tryGetFieldSymbol(node.getTree());
return fieldNullness(accessed, AccessPath.fromFieldAccess(node), store);
} | java | @Override
Nullness visitFieldAccess(
FieldAccessNode node, Updates updates, AccessPathValues<Nullness> store) {
if (!node.isStatic()) {
setNonnullIfTrackable(updates, node.getReceiver());
}
ClassAndField accessed = tryGetFieldSymbol(node.getTree());
return fieldNullness(accessed, AccessPath.fromFieldAccess(node), store);
} | [
"@",
"Override",
"Nullness",
"visitFieldAccess",
"(",
"FieldAccessNode",
"node",
",",
"Updates",
"updates",
",",
"AccessPathValues",
"<",
"Nullness",
">",
"store",
")",
"{",
"if",
"(",
"!",
"node",
".",
"isStatic",
"(",
")",
")",
"{",
"setNonnullIfTrackable",
... | Refines the receiver of a field access to type non-null after a successful field access, and
refines the value of the expression as a whole to non-null if applicable (e.g., if the field
has a primitive type or the {@code store}) has a non-null value for this access path.
<p>Note: If the field access occurs when the node is an l-value, the analysis won't call this
method. Instead, it will call {@link #visitAssignment}. | [
"Refines",
"the",
"receiver",
"of",
"a",
"field",
"access",
"to",
"type",
"non",
"-",
"null",
"after",
"a",
"successful",
"field",
"access",
"and",
"refines",
"the",
"value",
"of",
"the",
"expression",
"as",
"a",
"whole",
"to",
"non",
"-",
"null",
"if",
... | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java#L535-L543 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getCountMatchPattern | XPath getCountMatchPattern(XPathContext support, int contextNode)
throws javax.xml.transform.TransformerException
{
XPath countMatchPattern = m_countMatchPattern;
DTM dtm = support.getDTM(contextNode);
if (null == countMatchPattern)
{
switch (dtm.getNodeType(contextNode))
{
case DTM.ELEMENT_NODE :
MyPrefixResolver resolver;
if (dtm.getNamespaceURI(contextNode) == null) {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, false);
} else {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, true);
}
countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, resolver,
XPath.MATCH, support.getErrorListener());
break;
case DTM.ATTRIBUTE_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this,
this, XPath.MATCH, support.getErrorListener());
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("text()", this);
countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.COMMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("comment()", this);
countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.DOCUMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("/", this);
countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode)
+ ")", this, this, XPath.MATCH, support.getErrorListener());
break;
default :
countMatchPattern = null;
}
}
return countMatchPattern;
} | java | XPath getCountMatchPattern(XPathContext support, int contextNode)
throws javax.xml.transform.TransformerException
{
XPath countMatchPattern = m_countMatchPattern;
DTM dtm = support.getDTM(contextNode);
if (null == countMatchPattern)
{
switch (dtm.getNodeType(contextNode))
{
case DTM.ELEMENT_NODE :
MyPrefixResolver resolver;
if (dtm.getNamespaceURI(contextNode) == null) {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, false);
} else {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, true);
}
countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, resolver,
XPath.MATCH, support.getErrorListener());
break;
case DTM.ATTRIBUTE_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this,
this, XPath.MATCH, support.getErrorListener());
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("text()", this);
countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.COMMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("comment()", this);
countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.DOCUMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("/", this);
countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode)
+ ")", this, this, XPath.MATCH, support.getErrorListener());
break;
default :
countMatchPattern = null;
}
}
return countMatchPattern;
} | [
"XPath",
"getCountMatchPattern",
"(",
"XPathContext",
"support",
",",
"int",
"contextNode",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"XPath",
"countMatchPattern",
"=",
"m_countMatchPattern",
";",
"DTM",
"dtm",
"=",
"s... | Get the count match pattern, or a default value.
@param support The XPath runtime state for this.
@param contextNode The node that "." expresses.
@return the count match pattern, or a default value.
@throws javax.xml.transform.TransformerException | [
"Get",
"the",
"count",
"match",
"pattern",
"or",
"a",
"default",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L718-L775 |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.updateFromFormPostMultiPart | @Transactional
@PostMapping(
value = "/{entityTypeId}/{id}",
params = "_method=PUT",
headers = "Content-Type=multipart/form-data")
@ResponseStatus(NO_CONTENT)
public void updateFromFormPostMultiPart(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("id") String untypedId,
MultipartHttpServletRequest request) {
Map<String, Object> paramMap = new HashMap<>();
for (String param : request.getParameterMap().keySet()) {
String[] values = request.getParameterValues(param);
String value = values != null ? StringUtils.join(values, ',') : null;
paramMap.put(param, value);
}
// add files to param map
for (Entry<String, List<MultipartFile>> entry : request.getMultiFileMap().entrySet()) {
String param = entry.getKey();
List<MultipartFile> files = entry.getValue();
if (files != null && files.size() > 1) {
throw new IllegalArgumentException("Multiple file input not supported");
}
paramMap.put(param, files != null && !files.isEmpty() ? files.get(0) : null);
}
updateInternal(entityTypeId, untypedId, paramMap);
} | java | @Transactional
@PostMapping(
value = "/{entityTypeId}/{id}",
params = "_method=PUT",
headers = "Content-Type=multipart/form-data")
@ResponseStatus(NO_CONTENT)
public void updateFromFormPostMultiPart(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("id") String untypedId,
MultipartHttpServletRequest request) {
Map<String, Object> paramMap = new HashMap<>();
for (String param : request.getParameterMap().keySet()) {
String[] values = request.getParameterValues(param);
String value = values != null ? StringUtils.join(values, ',') : null;
paramMap.put(param, value);
}
// add files to param map
for (Entry<String, List<MultipartFile>> entry : request.getMultiFileMap().entrySet()) {
String param = entry.getKey();
List<MultipartFile> files = entry.getValue();
if (files != null && files.size() > 1) {
throw new IllegalArgumentException("Multiple file input not supported");
}
paramMap.put(param, files != null && !files.isEmpty() ? files.get(0) : null);
}
updateInternal(entityTypeId, untypedId, paramMap);
} | [
"@",
"Transactional",
"@",
"PostMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/{id}\"",
",",
"params",
"=",
"\"_method=PUT\"",
",",
"headers",
"=",
"\"Content-Type=multipart/form-data\"",
")",
"@",
"ResponseStatus",
"(",
"NO_CONTENT",
")",
"public",
"void",
"updateFr... | Updates an entity from a html form post.
<p>Tunnels PUT through POST
<p>Example url: /api/v1/person/99?_method=PUT | [
"Updates",
"an",
"entity",
"from",
"a",
"html",
"form",
"post",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L632-L659 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java | WsSessions.removeSession | public void removeSession(String key, Session doomedSession) {
SessionEntry removedEntry = null;
// If no session was passed in, remove any session associated with the given key.
// If a session was passed in, only remove it if the key is associated with that session.
// This is to support the need to close extra sessions a feed might have created.
sessionsLockWrite.lock();
try {
if (doomedSession == null) {
removedEntry = this.sessions.remove(key);
} else {
/* here between sessions.get() and sessions.remove() the write lock is especially important */
SessionEntry existingEntry = this.sessions.get(key);
if (existingEntry != null && existingEntry.getSession().getId().equals(doomedSession.getId())) {
removedEntry = this.sessions.remove(key);
}
}
if (removedEntry != null) {
/* we really removed a session, let's call its listeners */
removedEntry.removed();
log.debugf(
"WebSocket Session [%s] of [%s] with key [%s] has been removed."
+ " The endpoint has now [%d] sessions",
removedEntry.getSession().getId(), endpoint, key, this.sessions.size());
}
} finally {
sessionsLockWrite.unlock();
}
} | java | public void removeSession(String key, Session doomedSession) {
SessionEntry removedEntry = null;
// If no session was passed in, remove any session associated with the given key.
// If a session was passed in, only remove it if the key is associated with that session.
// This is to support the need to close extra sessions a feed might have created.
sessionsLockWrite.lock();
try {
if (doomedSession == null) {
removedEntry = this.sessions.remove(key);
} else {
/* here between sessions.get() and sessions.remove() the write lock is especially important */
SessionEntry existingEntry = this.sessions.get(key);
if (existingEntry != null && existingEntry.getSession().getId().equals(doomedSession.getId())) {
removedEntry = this.sessions.remove(key);
}
}
if (removedEntry != null) {
/* we really removed a session, let's call its listeners */
removedEntry.removed();
log.debugf(
"WebSocket Session [%s] of [%s] with key [%s] has been removed."
+ " The endpoint has now [%d] sessions",
removedEntry.getSession().getId(), endpoint, key, this.sessions.size());
}
} finally {
sessionsLockWrite.unlock();
}
} | [
"public",
"void",
"removeSession",
"(",
"String",
"key",
",",
"Session",
"doomedSession",
")",
"{",
"SessionEntry",
"removedEntry",
"=",
"null",
";",
"// If no session was passed in, remove any session associated with the given key.",
"// If a session was passed in, only remove it ... | Removes the session associated with the given {@code key}. If {@code doomedSession} is not {@code null}, the
session matching the given {@code key} in {@link #sessions} will only be removed if that session has the same ID
as the given {@code doomedSession}.
<p>
When removing a known session, that doomed session's websocket session listeners will be told via
{@link WsSessionListener#sessionRemoved()}.
@param key identifies the session to be removed
@param doomedSession if not null, ensures that only this session will be removed
@return the removed session or null if nothing was removed | [
"Removes",
"the",
"session",
"associated",
"with",
"the",
"given",
"{",
"@code",
"key",
"}",
".",
"If",
"{",
"@code",
"doomedSession",
"}",
"is",
"not",
"{",
"@code",
"null",
"}",
"the",
"session",
"matching",
"the",
"given",
"{",
"@code",
"key",
"}",
... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java#L213-L244 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java | AlternativeAlignment.toPDB | public String toPDB(Structure s1, Structure s2){
Structure newpdb = getAlignedStructure(s1, s2);
return newpdb.toPDB();
} | java | public String toPDB(Structure s1, Structure s2){
Structure newpdb = getAlignedStructure(s1, s2);
return newpdb.toPDB();
} | [
"public",
"String",
"toPDB",
"(",
"Structure",
"s1",
",",
"Structure",
"s2",
")",
"{",
"Structure",
"newpdb",
"=",
"getAlignedStructure",
"(",
"s1",
",",
"s2",
")",
";",
"return",
"newpdb",
".",
"toPDB",
"(",
")",
";",
"}"
] | converts the alignment to a PDB file
each of the structures will be represented as a model.
@param s1
@param s2
@return a PDB file as a String | [
"converts",
"the",
"alignment",
"to",
"a",
"PDB",
"file",
"each",
"of",
"the",
"structures",
"will",
"be",
"represented",
"as",
"a",
"model",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L878-L884 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java | OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSymmetricObjectPropertyAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSymmetricObjectPropertyAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLSymmetricObjectPropertyAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
... | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java#L94-L97 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuFuncSetAttribute | public static int cuFuncSetAttribute(CUfunction hfunc, int attrib, int value)
{
return checkResult(cuFuncSetAttributeNative(hfunc, attrib, value));
} | java | public static int cuFuncSetAttribute(CUfunction hfunc, int attrib, int value)
{
return checkResult(cuFuncSetAttributeNative(hfunc, attrib, value));
} | [
"public",
"static",
"int",
"cuFuncSetAttribute",
"(",
"CUfunction",
"hfunc",
",",
"int",
"attrib",
",",
"int",
"value",
")",
"{",
"return",
"checkResult",
"(",
"cuFuncSetAttributeNative",
"(",
"hfunc",
",",
"attrib",
",",
"value",
")",
")",
";",
"}"
] | Sets information about a function.<br>
<br>
This call sets the value of a specified attribute attrib on the kernel given
by hfunc to an integer value specified by val
This function returns CUDA_SUCCESS if the new value of the attribute could be
successfully set. If the set fails, this call will return an error.
Not all attributes can have values set. Attempting to set a value on a read-only
attribute will result in an error (CUDA_ERROR_INVALID_VALUE)
<br>
Supported attributes for the cuFuncSetAttribute call are:
<ul>
<li>CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: This maximum size in bytes of
dynamically-allocated shared memory. The value should contain the requested
maximum size of dynamically-allocated shared memory. The sum of this value and
the function attribute ::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES cannot exceed the
device attribute ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN.
The maximal size of requestable dynamic shared memory may differ by GPU
architecture.
</li>
<li>CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: On devices where the L1
cache and shared memory use the same hardware resources, this sets the shared memory
carveout preference, in percent of the total resources. This is only a hint, and the
driver can choose a different ratio if required to execute the function.
</li>
</ul>
@param hfunc Function to query attribute of
@param attrib Attribute requested
@param value The value to set
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuCtxGetCacheConfig
@see JCudaDriver#cuCtxSetCacheConfig
@see JCudaDriver#cuFuncSetCacheConfig
@see JCudaDriver#cuLaunchKernel
@see JCuda#cudaFuncGetAttributes
@see JCuda#cudaFuncSetAttribute | [
"Sets",
"information",
"about",
"a",
"function",
".",
"<br",
">",
"<br",
">",
"This",
"call",
"sets",
"the",
"value",
"of",
"a",
"specified",
"attribute",
"attrib",
"on",
"the",
"kernel",
"given",
"by",
"hfunc",
"to",
"an",
"integer",
"value",
"specified",... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L8162-L8165 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java | CommerceDiscountRelPersistenceImpl.findByCD_CN | @Override
public List<CommerceDiscountRel> findByCD_CN(long commerceDiscountId,
long classNameId, int start, int end) {
return findByCD_CN(commerceDiscountId, classNameId, start, end, null);
} | java | @Override
public List<CommerceDiscountRel> findByCD_CN(long commerceDiscountId,
long classNameId, int start, int end) {
return findByCD_CN(commerceDiscountId, classNameId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountRel",
">",
"findByCD_CN",
"(",
"long",
"commerceDiscountId",
",",
"long",
"classNameId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCD_CN",
"(",
"commerceDiscountId",
",",
"classNam... | Returns a range of all the commerce discount rels where commerceDiscountId = ? and classNameId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceDiscountId the commerce discount ID
@param classNameId the class name ID
@param start the lower bound of the range of commerce discount rels
@param end the upper bound of the range of commerce discount rels (not inclusive)
@return the range of matching commerce discount rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"rels",
"where",
"commerceDiscountId",
"=",
"?",
";",
"and",
"classNameId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java#L670-L674 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/Img.java | Img.draw | private static BufferedImage draw(BufferedImage backgroundImg, Image img, Rectangle rectangle, float alpha) {
final Graphics2D g = backgroundImg.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g.drawImage(img, rectangle.x, rectangle.y, rectangle.width, rectangle.height, null); // 绘制切割后的图
g.dispose();
return backgroundImg;
} | java | private static BufferedImage draw(BufferedImage backgroundImg, Image img, Rectangle rectangle, float alpha) {
final Graphics2D g = backgroundImg.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g.drawImage(img, rectangle.x, rectangle.y, rectangle.width, rectangle.height, null); // 绘制切割后的图
g.dispose();
return backgroundImg;
} | [
"private",
"static",
"BufferedImage",
"draw",
"(",
"BufferedImage",
"backgroundImg",
",",
"Image",
"img",
",",
"Rectangle",
"rectangle",
",",
"float",
"alpha",
")",
"{",
"final",
"Graphics2D",
"g",
"=",
"backgroundImg",
".",
"createGraphics",
"(",
")",
";",
"g... | 将图片绘制在背景上
@param backgroundImg 背景图片
@param img 要绘制的图片
@param rectangle 矩形对象,表示矩形区域的x,y,width,height,x,y从背景图片中心计算
@return 绘制后的背景 | [
"将图片绘制在背景上"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L574-L580 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureRight | public static String ensureRight(final String value, final String suffix) {
return ensureRight(value, suffix, true);
} | java | public static String ensureRight(final String value, final String suffix) {
return ensureRight(value, suffix, true);
} | [
"public",
"static",
"String",
"ensureRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"ensureRight",
"(",
"value",
",",
"suffix",
",",
"true",
")",
";",
"}"
] | Ensures that the value ends with suffix. If it doesn't, it's appended. This operation is case sensitive.
@param value The input String
@param suffix The substr to be ensured to be right
@return The string which is guarenteed to start with substr | [
"Ensures",
"that",
"the",
"value",
"ends",
"with",
"suffix",
".",
"If",
"it",
"doesn",
"t",
"it",
"s",
"appended",
".",
"This",
"operation",
"is",
"case",
"sensitive",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L391-L393 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByUuid_C(uuid,
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByUuid_C(uuid,
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPFriendlyURLEntry",
"cpFriendlyURLEntry",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"... | Removes all the cp friendly url entries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L1411-L1417 |
Cleveroad/AdaptiveTableLayout | library/src/main/java/com/cleveroad/adaptivetablelayout/BaseDataAdaptiveTableLayoutAdapter.java | BaseDataAdaptiveTableLayoutAdapter.switchTwoRows | void switchTwoRows(int rowIndex, int rowToIndex) {
for (int i = 0; i < getItems().length; i++) {
Object cellData = getItems()[rowToIndex][i];
getItems()[rowToIndex][i] = getItems()[rowIndex][i];
getItems()[rowIndex][i] = cellData;
}
} | java | void switchTwoRows(int rowIndex, int rowToIndex) {
for (int i = 0; i < getItems().length; i++) {
Object cellData = getItems()[rowToIndex][i];
getItems()[rowToIndex][i] = getItems()[rowIndex][i];
getItems()[rowIndex][i] = cellData;
}
} | [
"void",
"switchTwoRows",
"(",
"int",
"rowIndex",
",",
"int",
"rowToIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getItems",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"cellData",
"=",
"getItems",
"(",
")",
... | Switch 2 rows with data
@param rowIndex row from
@param rowToIndex row to | [
"Switch",
"2",
"rows",
"with",
"data"
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/BaseDataAdaptiveTableLayoutAdapter.java#L71-L77 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/StoreException.java | StoreException.create | public static StoreException create(final Type type, final Throwable cause, final String errorMessage) {
Preconditions.checkArgument(cause != null || (errorMessage != null && !errorMessage.isEmpty()),
"Either cause or errorMessage should be non-empty");
StoreException exception;
switch (type) {
case DATA_EXISTS:
exception = new DataExistsException(errorMessage, cause);
break;
case DATA_NOT_FOUND:
exception = new DataNotFoundException(errorMessage, cause);
break;
case DATA_CONTAINS_ELEMENTS:
exception = new DataNotEmptyException(errorMessage, cause);
break;
case WRITE_CONFLICT:
exception = new WriteConflictException(errorMessage, cause);
break;
case ILLEGAL_STATE:
exception = new IllegalStateException(errorMessage, cause);
break;
case OPERATION_NOT_ALLOWED:
exception = new OperationNotAllowedException(errorMessage, cause);
break;
case CONNECTION_ERROR:
exception = new StoreConnectionException(errorMessage, cause);
break;
case UNKNOWN:
exception = new UnknownException(errorMessage, cause);
break;
default:
throw new IllegalArgumentException("Invalid exception type");
}
return exception;
} | java | public static StoreException create(final Type type, final Throwable cause, final String errorMessage) {
Preconditions.checkArgument(cause != null || (errorMessage != null && !errorMessage.isEmpty()),
"Either cause or errorMessage should be non-empty");
StoreException exception;
switch (type) {
case DATA_EXISTS:
exception = new DataExistsException(errorMessage, cause);
break;
case DATA_NOT_FOUND:
exception = new DataNotFoundException(errorMessage, cause);
break;
case DATA_CONTAINS_ELEMENTS:
exception = new DataNotEmptyException(errorMessage, cause);
break;
case WRITE_CONFLICT:
exception = new WriteConflictException(errorMessage, cause);
break;
case ILLEGAL_STATE:
exception = new IllegalStateException(errorMessage, cause);
break;
case OPERATION_NOT_ALLOWED:
exception = new OperationNotAllowedException(errorMessage, cause);
break;
case CONNECTION_ERROR:
exception = new StoreConnectionException(errorMessage, cause);
break;
case UNKNOWN:
exception = new UnknownException(errorMessage, cause);
break;
default:
throw new IllegalArgumentException("Invalid exception type");
}
return exception;
} | [
"public",
"static",
"StoreException",
"create",
"(",
"final",
"Type",
"type",
",",
"final",
"Throwable",
"cause",
",",
"final",
"String",
"errorMessage",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"cause",
"!=",
"null",
"||",
"(",
"errorMessage",
"!... | Factory method to construct Store exceptions.
@param type Type of Exception.
@param cause Exception cause.
@param errorMessage The detailed error message.
@return Instance of type of StoreException. | [
"Factory",
"method",
"to",
"construct",
"Store",
"exceptions",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/StoreException.java#L81-L114 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java | FileUtils.byteBufferToInputStream | public static InputStream byteBufferToInputStream(final ByteBuffer byteBuffer) {
// https://stackoverflow.com/questions/4332264/wrapping-a-bytebuffer-with-an-inputstream/6603018#6603018
return new InputStream() {
/** The intermediate buffer. */
final ByteBuffer buf = byteBuffer;
@Override
public int read() {
if (!buf.hasRemaining()) {
return -1;
}
return buf.get() & 0xFF;
}
@Override
public int read(final byte[] bytes, final int off, final int len) {
if (!buf.hasRemaining()) {
return -1;
}
final int bytesRead = Math.min(len, buf.remaining());
buf.get(bytes, off, bytesRead);
return bytesRead;
}
};
} | java | public static InputStream byteBufferToInputStream(final ByteBuffer byteBuffer) {
// https://stackoverflow.com/questions/4332264/wrapping-a-bytebuffer-with-an-inputstream/6603018#6603018
return new InputStream() {
/** The intermediate buffer. */
final ByteBuffer buf = byteBuffer;
@Override
public int read() {
if (!buf.hasRemaining()) {
return -1;
}
return buf.get() & 0xFF;
}
@Override
public int read(final byte[] bytes, final int off, final int len) {
if (!buf.hasRemaining()) {
return -1;
}
final int bytesRead = Math.min(len, buf.remaining());
buf.get(bytes, off, bytesRead);
return bytesRead;
}
};
} | [
"public",
"static",
"InputStream",
"byteBufferToInputStream",
"(",
"final",
"ByteBuffer",
"byteBuffer",
")",
"{",
"// https://stackoverflow.com/questions/4332264/wrapping-a-bytebuffer-with-an-inputstream/6603018#6603018",
"return",
"new",
"InputStream",
"(",
")",
"{",
"/** The inte... | Produce an {@link InputStream} that is able to read from a {@link ByteBuffer}.
@param byteBuffer
The {@link ByteBuffer}.
@return An {@link InputStream} that reads from the {@link ByteBuffer}. | [
"Produce",
"an",
"{",
"@link",
"InputStream",
"}",
"that",
"is",
"able",
"to",
"read",
"from",
"a",
"{",
"@link",
"ByteBuffer",
"}",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java#L258-L283 |
ysc/word | src/main/java/org/apdplat/word/WordFrequencyStatistics.java | WordFrequencyStatistics.statistics | private void statistics(String word, int times, Map<String, AtomicInteger> container){
container.putIfAbsent(word, new AtomicInteger());
container.get(word).addAndGet(times);
} | java | private void statistics(String word, int times, Map<String, AtomicInteger> container){
container.putIfAbsent(word, new AtomicInteger());
container.get(word).addAndGet(times);
} | [
"private",
"void",
"statistics",
"(",
"String",
"word",
",",
"int",
"times",
",",
"Map",
"<",
"String",
",",
"AtomicInteger",
">",
"container",
")",
"{",
"container",
".",
"putIfAbsent",
"(",
"word",
",",
"new",
"AtomicInteger",
"(",
")",
")",
";",
"cont... | 统计词频
@param word 词
@param times 词频
@param container 内存中保存词频的数据结构 | [
"统计词频"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/WordFrequencyStatistics.java#L164-L167 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/FileIoUtil.java | FileIoUtil.readTextFileFromStream | public static List<String> readTextFileFromStream(InputStream _input, Charset _charset, boolean _silent) {
if (_input == null) {
return null;
}
try {
List<String> fileContent;
try (BufferedReader dis = new BufferedReader(new InputStreamReader(_input, _charset))) {
String s;
fileContent = new ArrayList<>();
while ((s = dis.readLine()) != null) {
fileContent.add(s);
}
}
return fileContent.size() > 0 ? fileContent : null;
} catch (IOException _ex) {
if (!_silent) {
LOGGER.warn("Error while reading file:", _ex);
}
}
return null;
} | java | public static List<String> readTextFileFromStream(InputStream _input, Charset _charset, boolean _silent) {
if (_input == null) {
return null;
}
try {
List<String> fileContent;
try (BufferedReader dis = new BufferedReader(new InputStreamReader(_input, _charset))) {
String s;
fileContent = new ArrayList<>();
while ((s = dis.readLine()) != null) {
fileContent.add(s);
}
}
return fileContent.size() > 0 ? fileContent : null;
} catch (IOException _ex) {
if (!_silent) {
LOGGER.warn("Error while reading file:", _ex);
}
}
return null;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readTextFileFromStream",
"(",
"InputStream",
"_input",
",",
"Charset",
"_charset",
",",
"boolean",
"_silent",
")",
"{",
"if",
"(",
"_input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
... | Reads a text file from given {@link InputStream} using the given {@link Charset}.
@param _input stream to read
@param _charset charset to use
@param _silent true to disable exception logging, false otherwise
@return List of string or null on error | [
"Reads",
"a",
"text",
"file",
"from",
"given",
"{"
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L210-L232 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java | HexUtils.readBigInteger | public static BigInteger readBigInteger(DataInputStream dis)
throws IOException {
short i = dis.readShort();
if (i < 0)
throw new IOException("Invalid BigInteger length: " + i);
byte[] buf = new byte[i];
dis.readFully(buf);
return new BigInteger(1, buf);
} | java | public static BigInteger readBigInteger(DataInputStream dis)
throws IOException {
short i = dis.readShort();
if (i < 0)
throw new IOException("Invalid BigInteger length: " + i);
byte[] buf = new byte[i];
dis.readFully(buf);
return new BigInteger(1, buf);
} | [
"public",
"static",
"BigInteger",
"readBigInteger",
"(",
"DataInputStream",
"dis",
")",
"throws",
"IOException",
"{",
"short",
"i",
"=",
"dis",
".",
"readShort",
"(",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"throw",
"new",
"IOException",
"(",
"\"Invalid B... | Read a (reasonably short) BigInteger from a DataInputStream
@param dis the stream to read from
@return a BigInteger
@throws IOException I/O exception | [
"Read",
"a",
"(",
"reasonably",
"short",
")",
"BigInteger",
"from",
"a",
"DataInputStream"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java#L165-L173 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/InternationalFixedDate.java | InternationalFixedDate.create | static InternationalFixedDate create(int prolepticYear, int month, int dayOfMonth) {
YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA);
MONTH_OF_YEAR_RANGE.checkValidValue(month, ChronoField.MONTH_OF_YEAR);
DAY_OF_MONTH_RANGE.checkValidValue(dayOfMonth, ChronoField.DAY_OF_MONTH);
if (dayOfMonth == DAYS_IN_LONG_MONTH && month != 6 && month != MONTHS_IN_YEAR) {
throw new DateTimeException("Invalid date: " + prolepticYear + '/' + month + '/' + dayOfMonth);
}
if (month == 6 && dayOfMonth == DAYS_IN_LONG_MONTH && !INSTANCE.isLeapYear(prolepticYear)) {
throw new DateTimeException("Invalid Leap Day as '" + prolepticYear + "' is not a leap year");
}
return new InternationalFixedDate(prolepticYear, month, dayOfMonth);
} | java | static InternationalFixedDate create(int prolepticYear, int month, int dayOfMonth) {
YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA);
MONTH_OF_YEAR_RANGE.checkValidValue(month, ChronoField.MONTH_OF_YEAR);
DAY_OF_MONTH_RANGE.checkValidValue(dayOfMonth, ChronoField.DAY_OF_MONTH);
if (dayOfMonth == DAYS_IN_LONG_MONTH && month != 6 && month != MONTHS_IN_YEAR) {
throw new DateTimeException("Invalid date: " + prolepticYear + '/' + month + '/' + dayOfMonth);
}
if (month == 6 && dayOfMonth == DAYS_IN_LONG_MONTH && !INSTANCE.isLeapYear(prolepticYear)) {
throw new DateTimeException("Invalid Leap Day as '" + prolepticYear + "' is not a leap year");
}
return new InternationalFixedDate(prolepticYear, month, dayOfMonth);
} | [
"static",
"InternationalFixedDate",
"create",
"(",
"int",
"prolepticYear",
",",
"int",
"month",
",",
"int",
"dayOfMonth",
")",
"{",
"YEAR_RANGE",
".",
"checkValidValue",
"(",
"prolepticYear",
",",
"ChronoField",
".",
"YEAR_OF_ERA",
")",
";",
"MONTH_OF_YEAR_RANGE",
... | Factory method, validates the given triplet year, month and dayOfMonth.
@param prolepticYear the International fixed proleptic-year
@param month the International fixed month, from 1 to 13
@param dayOfMonth the International fixed day-of-month, from 1 to 28 (29 for Leap Day or Year Day)
@return the International fixed date
@throws DateTimeException if the date is invalid | [
"Factory",
"method",
"validates",
"the",
"given",
"triplet",
"year",
"month",
"and",
"dayOfMonth",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/InternationalFixedDate.java#L335-L347 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/common/Timestamp.java | Timestamp.fromMillis | public static Timestamp fromMillis(long epochMilli) {
long secs = floorDiv(epochMilli, MILLIS_PER_SECOND);
int mos = (int) floorMod(epochMilli, MILLIS_PER_SECOND);
return create(secs, (int) (mos * NANOS_PER_MILLI)); // Safe int * NANOS_PER_MILLI
} | java | public static Timestamp fromMillis(long epochMilli) {
long secs = floorDiv(epochMilli, MILLIS_PER_SECOND);
int mos = (int) floorMod(epochMilli, MILLIS_PER_SECOND);
return create(secs, (int) (mos * NANOS_PER_MILLI)); // Safe int * NANOS_PER_MILLI
} | [
"public",
"static",
"Timestamp",
"fromMillis",
"(",
"long",
"epochMilli",
")",
"{",
"long",
"secs",
"=",
"floorDiv",
"(",
"epochMilli",
",",
"MILLIS_PER_SECOND",
")",
";",
"int",
"mos",
"=",
"(",
"int",
")",
"floorMod",
"(",
"epochMilli",
",",
"MILLIS_PER_SE... | Creates a new timestamp from the given milliseconds.
@param epochMilli the timestamp represented in milliseconds since epoch.
@return new {@code Timestamp} with specified fields.
@throws IllegalArgumentException if the number of milliseconds is out of the range that can be
represented by {@code Timestamp}.
@since 0.5 | [
"Creates",
"a",
"new",
"timestamp",
"from",
"the",
"given",
"milliseconds",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/common/Timestamp.java#L85-L89 |
apiman/apiman | common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java | AuthenticationFilter.wrapTheRequest | private HttpServletRequest wrapTheRequest(final ServletRequest request, final AuthPrincipal principal) {
HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest) request) {
@Override
public Principal getUserPrincipal() {
return principal;
}
@Override
public boolean isUserInRole(String role) {
return principal.getRoles().contains(role);
}
@Override
public String getRemoteUser() {
return principal.getName();
}
};
return wrapper;
} | java | private HttpServletRequest wrapTheRequest(final ServletRequest request, final AuthPrincipal principal) {
HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest) request) {
@Override
public Principal getUserPrincipal() {
return principal;
}
@Override
public boolean isUserInRole(String role) {
return principal.getRoles().contains(role);
}
@Override
public String getRemoteUser() {
return principal.getName();
}
};
return wrapper;
} | [
"private",
"HttpServletRequest",
"wrapTheRequest",
"(",
"final",
"ServletRequest",
"request",
",",
"final",
"AuthPrincipal",
"principal",
")",
"{",
"HttpServletRequestWrapper",
"wrapper",
"=",
"new",
"HttpServletRequestWrapper",
"(",
"(",
"HttpServletRequest",
")",
"reque... | Wrap the request to provide the principal.
@param request the request
@param principal the principal | [
"Wrap",
"the",
"request",
"to",
"provide",
"the",
"principal",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java#L285-L303 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java | PropertyColumnTableDescription.addPropertyColumn | public void addPropertyColumn(String propertyName, Class propertyType, int minWidth, int maxWidth)
{
addPropertyColumn(propertyName).withMinWidth(minWidth).withMaxWidth(maxWidth);
} | java | public void addPropertyColumn(String propertyName, Class propertyType, int minWidth, int maxWidth)
{
addPropertyColumn(propertyName).withMinWidth(minWidth).withMaxWidth(maxWidth);
} | [
"public",
"void",
"addPropertyColumn",
"(",
"String",
"propertyName",
",",
"Class",
"propertyType",
",",
"int",
"minWidth",
",",
"int",
"maxWidth",
")",
"{",
"addPropertyColumn",
"(",
"propertyName",
")",
".",
"withMinWidth",
"(",
"minWidth",
")",
".",
"withMaxW... | WARNING: propertyType is discarded, it should be fetched from the entityType through introspection.
@deprecated
@see #addPropertyColumn(String)
@see PropertyColumn#withMinWidth(int)
@see PropertyColumn#withMaxWidth(int) | [
"WARNING",
":",
"propertyType",
"is",
"discarded",
"it",
"should",
"be",
"fetched",
"from",
"the",
"entityType",
"through",
"introspection",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java#L265-L268 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.getComputeNodeRemoteDesktop | public String getComputeNodeRemoteDesktop(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeGetRemoteDesktopOptions options = new ComputeNodeGetRemoteDesktopOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
this.parentBatchClient.protocolLayer().computeNodes().getRemoteDesktop(poolId, nodeId, options, outputStream);
String rdpContent = outputStream.toString("UTF-8");
outputStream.close();
return rdpContent;
} | java | public String getComputeNodeRemoteDesktop(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeGetRemoteDesktopOptions options = new ComputeNodeGetRemoteDesktopOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
this.parentBatchClient.protocolLayer().computeNodes().getRemoteDesktop(poolId, nodeId, options, outputStream);
String rdpContent = outputStream.toString("UTF-8");
outputStream.close();
return rdpContent;
} | [
"public",
"String",
"getComputeNodeRemoteDesktop",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"ComputeNodeGetRemoteDesktopOptions",... | Gets a Remote Desktop Protocol (RDP) file for the specified node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node for which to get a Remote Desktop file.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return The RDP file contents.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"a",
"Remote",
"Desktop",
"Protocol",
"(",
"RDP",
")",
"file",
"for",
"the",
"specified",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L455-L465 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_doc_image.java | ns_doc_image.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_doc_image_responses result = (ns_doc_image_responses) service.get_payload_formatter().string_to_resource(ns_doc_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_doc_image_response_array);
}
ns_doc_image[] result_ns_doc_image = new ns_doc_image[result.ns_doc_image_response_array.length];
for(int i = 0; i < result.ns_doc_image_response_array.length; i++)
{
result_ns_doc_image[i] = result.ns_doc_image_response_array[i].ns_doc_image[0];
}
return result_ns_doc_image;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_doc_image_responses result = (ns_doc_image_responses) service.get_payload_formatter().string_to_resource(ns_doc_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_doc_image_response_array);
}
ns_doc_image[] result_ns_doc_image = new ns_doc_image[result.ns_doc_image_response_array.length];
for(int i = 0; i < result.ns_doc_image_response_array.length; i++)
{
result_ns_doc_image[i] = result.ns_doc_image_response_array[i].ns_doc_image[0];
}
return result_ns_doc_image;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_doc_image_responses",
"result",
"=",
"(",
"ns_doc_image_responses",
")",
"service",
".",
"get_payload_form... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_doc_image.java#L265-L282 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java | UpdateUtils.updateFileFromInputStream | public static void updateFileFromInputStream(final InputStream input, final String destinationFilePath) throws
UpdateException {
update(new FileStreamUpdater(input), new File(destinationFilePath));
} | java | public static void updateFileFromInputStream(final InputStream input, final String destinationFilePath) throws
UpdateException {
update(new FileStreamUpdater(input), new File(destinationFilePath));
} | [
"public",
"static",
"void",
"updateFileFromInputStream",
"(",
"final",
"InputStream",
"input",
",",
"final",
"String",
"destinationFilePath",
")",
"throws",
"UpdateException",
"{",
"update",
"(",
"new",
"FileStreamUpdater",
"(",
"input",
")",
",",
"new",
"File",
"... | Get the source URL and store it to a destination file path
@param input input stream
@param destinationFilePath destination
@throws UpdateException on error | [
"Get",
"the",
"source",
"URL",
"and",
"store",
"it",
"to",
"a",
"destination",
"file",
"path"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java#L96-L99 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.invertPinhole | public static void invertPinhole( DMatrix3x3 K , DMatrix3x3 Kinv) {
double fx = K.a11;
double skew = K.a12;
double cx = K.a13;
double fy = K.a22;
double cy = K.a23;
Kinv.a11 = 1.0/fx;
Kinv.a12 = -skew/(fx*fy);
Kinv.a13 = (skew*cy - cx*fy)/(fx*fy);
Kinv.a22 = 1.0/fy;
Kinv.a23 = -cy/fy;
Kinv.a33 = 1;
} | java | public static void invertPinhole( DMatrix3x3 K , DMatrix3x3 Kinv) {
double fx = K.a11;
double skew = K.a12;
double cx = K.a13;
double fy = K.a22;
double cy = K.a23;
Kinv.a11 = 1.0/fx;
Kinv.a12 = -skew/(fx*fy);
Kinv.a13 = (skew*cy - cx*fy)/(fx*fy);
Kinv.a22 = 1.0/fy;
Kinv.a23 = -cy/fy;
Kinv.a33 = 1;
} | [
"public",
"static",
"void",
"invertPinhole",
"(",
"DMatrix3x3",
"K",
",",
"DMatrix3x3",
"Kinv",
")",
"{",
"double",
"fx",
"=",
"K",
".",
"a11",
";",
"double",
"skew",
"=",
"K",
".",
"a12",
";",
"double",
"cx",
"=",
"K",
".",
"a13",
";",
"double",
"... | Analytic matrix inversion to 3x3 camera calibration matrix. Input and output
can be the same matrix. Zeros are not set.
@param K (Input) Calibration matrix
@param Kinv (Output) inverse. | [
"Analytic",
"matrix",
"inversion",
"to",
"3x3",
"camera",
"calibration",
"matrix",
".",
"Input",
"and",
"output",
"can",
"be",
"the",
"same",
"matrix",
".",
"Zeros",
"are",
"not",
"set",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L223-L235 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.fetchByG_Tw | @Override
public CommerceCountry fetchByG_Tw(long groupId, String twoLettersISOCode) {
return fetchByG_Tw(groupId, twoLettersISOCode, true);
} | java | @Override
public CommerceCountry fetchByG_Tw(long groupId, String twoLettersISOCode) {
return fetchByG_Tw(groupId, twoLettersISOCode, true);
} | [
"@",
"Override",
"public",
"CommerceCountry",
"fetchByG_Tw",
"(",
"long",
"groupId",
",",
"String",
"twoLettersISOCode",
")",
"{",
"return",
"fetchByG_Tw",
"(",
"groupId",
",",
"twoLettersISOCode",
",",
"true",
")",
";",
"}"
] | Returns the commerce country where groupId = ? and twoLettersISOCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param twoLettersISOCode the two letters iso code
@return the matching commerce country, or <code>null</code> if a matching commerce country could not be found | [
"Returns",
"the",
"commerce",
"country",
"where",
"groupId",
"=",
"?",
";",
"and",
"twoLettersISOCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder"... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2044-L2047 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java | JMElasticsearchSearchAndCount.getSearchRequestBuilder | public SearchRequestBuilder getSearchRequestBuilder(QueryBuilder
queryBuilder, String... indices) {
return getSearchRequestBuilder(indices, null, queryBuilder);
} | java | public SearchRequestBuilder getSearchRequestBuilder(QueryBuilder
queryBuilder, String... indices) {
return getSearchRequestBuilder(indices, null, queryBuilder);
} | [
"public",
"SearchRequestBuilder",
"getSearchRequestBuilder",
"(",
"QueryBuilder",
"queryBuilder",
",",
"String",
"...",
"indices",
")",
"{",
"return",
"getSearchRequestBuilder",
"(",
"indices",
",",
"null",
",",
"queryBuilder",
")",
";",
"}"
] | Gets search request builder.
@param queryBuilder the query builder
@param indices the indices
@return the search request builder | [
"Gets",
"search",
"request",
"builder",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L124-L127 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java | CommonConfigUtils.getRequiredConfigAttributeWithConfigId | public String getRequiredConfigAttributeWithConfigId(Map<String, Object> props, String key, String configId) {
return getRequiredConfigAttributeWithDefaultValueAndConfigId(props, key, null, configId);
} | java | public String getRequiredConfigAttributeWithConfigId(Map<String, Object> props, String key, String configId) {
return getRequiredConfigAttributeWithDefaultValueAndConfigId(props, key, null, configId);
} | [
"public",
"String",
"getRequiredConfigAttributeWithConfigId",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
",",
"String",
"key",
",",
"String",
"configId",
")",
"{",
"return",
"getRequiredConfigAttributeWithDefaultValueAndConfigId",
"(",
"props",
",",
"key"... | Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the
resulting value will be {@code null} and an error message will be logged. | [
"Returns",
"the",
"value",
"for",
"the",
"configuration",
"attribute",
"matching",
"the",
"key",
"provided",
".",
"If",
"the",
"value",
"does",
"not",
"exist",
"or",
"is",
"empty",
"the",
"resulting",
"value",
"will",
"be",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L68-L70 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/producttypes/ProductTypeOptionUrl.java | ProductTypeOptionUrl.getOptionUrl | public static MozuUrl getOptionUrl(String attributeFQN, Integer productTypeId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productTypeId", productTypeId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getOptionUrl(String attributeFQN, Integer productTypeId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productTypeId", productTypeId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getOptionUrl",
"(",
"String",
"attributeFQN",
",",
"Integer",
"productTypeId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/product... | Get Resource Url for GetOption
@param attributeFQN Fully qualified name for an attribute.
@param productTypeId Identifier of the product type.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetOption"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/producttypes/ProductTypeOptionUrl.java#L35-L42 |
wcm-io/wcm-io-handler | link/src/main/java/io/wcm/handler/link/type/ExternalLinkType.java | ExternalLinkType.getSyntheticLinkResource | public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String url) {
Map<String, Object> map = new HashMap<>();
map.put(LinkNameConstants.PN_LINK_TYPE, ID);
map.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, url);
return new SyntheticLinkResource(resourceResolver, map);
} | java | public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String url) {
Map<String, Object> map = new HashMap<>();
map.put(LinkNameConstants.PN_LINK_TYPE, ID);
map.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, url);
return new SyntheticLinkResource(resourceResolver, map);
} | [
"public",
"static",
"@",
"NotNull",
"Resource",
"getSyntheticLinkResource",
"(",
"@",
"NotNull",
"ResourceResolver",
"resourceResolver",
",",
"@",
"NotNull",
"String",
"url",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"HashMap",
"<>... | Get synthetic link resource for this link type.
@param resourceResolver Resource resolver
@param url Link URL
@return Synthetic link resource | [
"Get",
"synthetic",
"link",
"resource",
"for",
"this",
"link",
"type",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/ExternalLinkType.java#L113-L118 |
stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | SpiceManager.removeDataFromCache | public <T> Future<?> removeDataFromCache(final Class<T> clazz, final Object cacheKey) {
if (clazz == null || cacheKey == null) {
throw new IllegalArgumentException("Both parameters must be non null.");
}
return executeCommand(new RemoveDataFromCacheCommand(this, clazz, cacheKey));
} | java | public <T> Future<?> removeDataFromCache(final Class<T> clazz, final Object cacheKey) {
if (clazz == null || cacheKey == null) {
throw new IllegalArgumentException("Both parameters must be non null.");
}
return executeCommand(new RemoveDataFromCacheCommand(this, clazz, cacheKey));
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"?",
">",
"removeDataFromCache",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"cacheKey",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
"||",
"cacheKey",
"==",
"null",
")",
"{",
"throw",... | Remove some specific content from cache
@param clazz
the Type of data you want to remove from cache
@param cacheKey
the key of the object in cache | [
"Remove",
"some",
"specific",
"content",
"from",
"cache"
] | train | https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java#L976-L982 |
lemire/JavaFastPFOR | src/main/java/me/lemire/integercompression/S16.java | S16.estimatecompress | public static int estimatecompress(final int[] in, int currentPos, int inlength) {
final int finalin = currentPos + inlength;
int counter = 0;
while (currentPos < finalin) {
int inoffset = fakecompressblock(in, currentPos, inlength);
if (inoffset == -1)
throw new RuntimeException("Too big a number");
currentPos += inoffset;
inlength -= inoffset;
++counter;
}
return counter;
} | java | public static int estimatecompress(final int[] in, int currentPos, int inlength) {
final int finalin = currentPos + inlength;
int counter = 0;
while (currentPos < finalin) {
int inoffset = fakecompressblock(in, currentPos, inlength);
if (inoffset == -1)
throw new RuntimeException("Too big a number");
currentPos += inoffset;
inlength -= inoffset;
++counter;
}
return counter;
} | [
"public",
"static",
"int",
"estimatecompress",
"(",
"final",
"int",
"[",
"]",
"in",
",",
"int",
"currentPos",
",",
"int",
"inlength",
")",
"{",
"final",
"int",
"finalin",
"=",
"currentPos",
"+",
"inlength",
";",
"int",
"counter",
"=",
"0",
";",
"while",
... | Estimate size of the compressed output.
@param in
array to compress
@param currentPos
where to start reading
@param inlength
how many integers to read
@return estimated size of the output (in 32-bit integers) | [
"Estimate",
"size",
"of",
"the",
"compressed",
"output",
"."
] | train | https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/S16.java#L58-L70 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java | MemorizeTransactionProxy.memorize | protected static CallableStatement memorize(final CallableStatement target, final ConnectionHandle connectionHandle) {
return (CallableStatement) Proxy.newProxyInstance(
CallableStatementProxy.class.getClassLoader(),
new Class[] {CallableStatementProxy.class},
new MemorizeTransactionProxy(target, connectionHandle));
} | java | protected static CallableStatement memorize(final CallableStatement target, final ConnectionHandle connectionHandle) {
return (CallableStatement) Proxy.newProxyInstance(
CallableStatementProxy.class.getClassLoader(),
new Class[] {CallableStatementProxy.class},
new MemorizeTransactionProxy(target, connectionHandle));
} | [
"protected",
"static",
"CallableStatement",
"memorize",
"(",
"final",
"CallableStatement",
"target",
",",
"final",
"ConnectionHandle",
"connectionHandle",
")",
"{",
"return",
"(",
"CallableStatement",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"CallableStatementProxy",
... | Wrap CallableStatement with a proxy.
@param target statement handle
@param connectionHandle originating bonecp connection
@return Proxy to a Callablestatement. | [
"Wrap",
"CallableStatement",
"with",
"a",
"proxy",
"."
] | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L117-L122 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.loopBlocks | public static void loopBlocks(int start , int endExclusive , int minBlock,
IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive);
int block = selectBlockSize(range,minBlock,numThreads);
try {
pool.submit(new IntRangeTask(start,endExclusive,block,consumer)).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | java | public static void loopBlocks(int start , int endExclusive , int minBlock,
IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive);
int block = selectBlockSize(range,minBlock,numThreads);
try {
pool.submit(new IntRangeTask(start,endExclusive,block,consumer)).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | [
"public",
"static",
"void",
"loopBlocks",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"int",
"minBlock",
",",
"IntRangeConsumer",
"consumer",
")",
"{",
"final",
"ForkJoinPool",
"pool",
"=",
"BoofConcurrency",
".",
"pool",
";",
"int",
"numThreads",
"=... | Automatically breaks the problem up into blocks based on the number of threads available. It is assumed
that there is some cost associated with processing a block and the number of blocks is minimized.
Examples:
<ul>
<li>Given a range of 0 to 100, and minBlock is 5, and 10 threads. Blocks will be size 10.</li>
<li>Given a range of 0 to 100, and minBlock is 20, and 10 threads. Blocks will be size 20.</li>
<li>Given a range of 0 to 100, and minBlock is 15, and 10 threads. Blocks will be size 16 and 20.</li>
<li>Given a range of 0 to 100, and minBlock is 80, and 10 threads. Blocks will be size 100.</li>
</ul>
@param start First index, inclusive
@param endExclusive Last index, exclusive
@param minBlock Minimum size of a block
@param consumer The consumer | [
"Automatically",
"breaks",
"the",
"problem",
"up",
"into",
"blocks",
"based",
"on",
"the",
"number",
"of",
"threads",
"available",
".",
"It",
"is",
"assumed",
"that",
"there",
"is",
"some",
"cost",
"associated",
"with",
"processing",
"a",
"block",
"and",
"th... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L101-L119 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.currentRecordId | public RecordId currentRecordId() {
int id = rp.currentId();
return new RecordId(new BlockId(fileName, currentBlkNum), id);
} | java | public RecordId currentRecordId() {
int id = rp.currentId();
return new RecordId(new BlockId(fileName, currentBlkNum), id);
} | [
"public",
"RecordId",
"currentRecordId",
"(",
")",
"{",
"int",
"id",
"=",
"rp",
".",
"currentId",
"(",
")",
";",
"return",
"new",
"RecordId",
"(",
"new",
"BlockId",
"(",
"fileName",
",",
"currentBlkNum",
")",
",",
"id",
")",
";",
"}"
] | Returns the record ID of the current record.
@return a record ID | [
"Returns",
"the",
"record",
"ID",
"of",
"the",
"current",
"record",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L340-L343 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.deleteRecursively | public static void deleteRecursively(File file, FilenameFilter filter) throws IOException {
if (file == null) { return; }
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
if (SystemUtils.IS_OS_UNIX && filter == null) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
} catch (IOException e) {
logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
"Falling back to Java IO way", file.getAbsolutePath(), e);
}
}
deleteRecursivelyUsingJavaIO(file, filter);
} | java | public static void deleteRecursively(File file, FilenameFilter filter) throws IOException {
if (file == null) { return; }
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
if (SystemUtils.IS_OS_UNIX && filter == null) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
} catch (IOException e) {
logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
"Falling back to Java IO way", file.getAbsolutePath(), e);
}
}
deleteRecursivelyUsingJavaIO(file, filter);
} | [
"public",
"static",
"void",
"deleteRecursively",
"(",
"File",
"file",
",",
"FilenameFilter",
"filter",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// On Unix systems, use operating system command to run faster",
... | Delete a file or directory and its contents recursively.
Don't follow directories if they are symlinks.
@param file Input file / dir to be deleted
@param filter A filename filter that make sure only files / dirs with the satisfied filenames
are deleted.
@throws IOException if deletion is unsuccessful | [
"Delete",
"a",
"file",
"or",
"directory",
"and",
"its",
"contents",
"recursively",
".",
"Don",
"t",
"follow",
"directories",
"if",
"they",
"are",
"symlinks",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L103-L119 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java | AnnotationUtils.hasStereotype | protected boolean hasStereotype(Element element, List<String> stereotypes) {
if (element == null) {
return false;
}
if (stereotypes.contains(element.toString())) {
return true;
}
AnnotationMetadata annotationMetadata = getAnnotationMetadata(element);
for (String stereotype : stereotypes) {
if (annotationMetadata.hasStereotype(stereotype)) {
return true;
}
}
return false;
} | java | protected boolean hasStereotype(Element element, List<String> stereotypes) {
if (element == null) {
return false;
}
if (stereotypes.contains(element.toString())) {
return true;
}
AnnotationMetadata annotationMetadata = getAnnotationMetadata(element);
for (String stereotype : stereotypes) {
if (annotationMetadata.hasStereotype(stereotype)) {
return true;
}
}
return false;
} | [
"protected",
"boolean",
"hasStereotype",
"(",
"Element",
"element",
",",
"List",
"<",
"String",
">",
"stereotypes",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"stereotypes",
".",
"contains",
"(",
"elem... | Return whether the given element is annotated with any of the given annotation stereotypes.
@param element The element
@param stereotypes The stereotypes
@return True if it is | [
"Return",
"whether",
"the",
"given",
"element",
"is",
"annotated",
"with",
"any",
"of",
"the",
"given",
"annotation",
"stereotypes",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java#L162-L176 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java | JRebirth.runIntoJIT | public static void runIntoJIT(final String runnableName, final PriorityLevel runnablePriority, final Runnable runnable) {
runIntoJIT(new JrbReferenceRunnable(runnableName, runnablePriority, runnable));
} | java | public static void runIntoJIT(final String runnableName, final PriorityLevel runnablePriority, final Runnable runnable) {
runIntoJIT(new JrbReferenceRunnable(runnableName, runnablePriority, runnable));
} | [
"public",
"static",
"void",
"runIntoJIT",
"(",
"final",
"String",
"runnableName",
",",
"final",
"PriorityLevel",
"runnablePriority",
",",
"final",
"Runnable",
"runnable",
")",
"{",
"runIntoJIT",
"(",
"new",
"JrbReferenceRunnable",
"(",
"runnableName",
",",
"runnable... | Run into the JRebirth Internal Thread [JIT].
Actually only few methods are allowed to execute themselves into JRebirthThread.
<ul>
<li>Uncaught Exception Handler initialization</li>
<li>Wave queuing</li>
<li>Run a default Command (neither UI nor Pooled)</li>
<li>Listen a Wave Type</li>
<li>UnListen a Wave Type</li>
</ul>
Be careful this method can be called through any thread.
@param runnableName the name of the runnable for logging purpose
@param runnablePriority the priority to try to apply to the runnable
@param runnable the task to run | [
"Run",
"into",
"the",
"JRebirth",
"Internal",
"Thread",
"[",
"JIT",
"]",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L251-L253 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getNotEmpty | @Nullable
public static CharSequence getNotEmpty (@Nullable final CharSequence s, @Nullable final CharSequence sDefaultIfEmpty)
{
return hasNoText (s) ? sDefaultIfEmpty : s;
} | java | @Nullable
public static CharSequence getNotEmpty (@Nullable final CharSequence s, @Nullable final CharSequence sDefaultIfEmpty)
{
return hasNoText (s) ? sDefaultIfEmpty : s;
} | [
"@",
"Nullable",
"public",
"static",
"CharSequence",
"getNotEmpty",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"s",
",",
"@",
"Nullable",
"final",
"CharSequence",
"sDefaultIfEmpty",
")",
"{",
"return",
"hasNoText",
"(",
"s",
")",
"?",
"sDefaultIfEmpty",
":",... | Get the passed string but never return an empty char sequence. If the passed
parameter is <code>null</code> or empty the second parameter is returned.
@param s
The parameter to be not <code>null</code> nor empty.
@param sDefaultIfEmpty
The value to be used of the first parameter is <code>null</code> or
empty. May be <code>null</code> but in this case the call to this
method is obsolete.
@return The passed default value if the char sequence is <code>null</code> or
empty, otherwise the input char sequence. | [
"Get",
"the",
"passed",
"string",
"but",
"never",
"return",
"an",
"empty",
"char",
"sequence",
".",
"If",
"the",
"passed",
"parameter",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"or",
"empty",
"the",
"second",
"parameter",
"is",
"returned",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4600-L4604 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java | DefaultAnnotationMetadata.addRepeatableStereotype | protected void addRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue) {
Map<String, Map<CharSequence, Object>> allStereotypes = getAllStereotypes();
List<String> annotationList = getAnnotationsByStereotypeInternal(stereotype);
for (String parentAnnotation : parents) {
if (!annotationList.contains(parentAnnotation)) {
annotationList.add(parentAnnotation);
}
}
addRepeatableInternal(stereotype, annotationValue, allStereotypes);
} | java | protected void addRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue) {
Map<String, Map<CharSequence, Object>> allStereotypes = getAllStereotypes();
List<String> annotationList = getAnnotationsByStereotypeInternal(stereotype);
for (String parentAnnotation : parents) {
if (!annotationList.contains(parentAnnotation)) {
annotationList.add(parentAnnotation);
}
}
addRepeatableInternal(stereotype, annotationValue, allStereotypes);
} | [
"protected",
"void",
"addRepeatableStereotype",
"(",
"List",
"<",
"String",
">",
"parents",
",",
"String",
"stereotype",
",",
"io",
".",
"micronaut",
".",
"core",
".",
"annotation",
".",
"AnnotationValue",
"annotationValue",
")",
"{",
"Map",
"<",
"String",
","... | Adds a repeatable stereotype value. If a value already exists will be added
@param parents The parent annotations
@param stereotype The annotation name
@param annotationValue The annotation value | [
"Adds",
"a",
"repeatable",
"stereotype",
"value",
".",
"If",
"a",
"value",
"already",
"exists",
"will",
"be",
"added"
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java#L565-L575 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Actors.java | Actors.updateActorPosition | public static void updateActorPosition(final Actor actor, final Vector2 newScreenSizeInStageCoords) {
if (actor != null) {
updateActorPosition(actor, actor.getStage(), newScreenSizeInStageCoords);
}
} | java | public static void updateActorPosition(final Actor actor, final Vector2 newScreenSizeInStageCoords) {
if (actor != null) {
updateActorPosition(actor, actor.getStage(), newScreenSizeInStageCoords);
}
} | [
"public",
"static",
"void",
"updateActorPosition",
"(",
"final",
"Actor",
"actor",
",",
"final",
"Vector2",
"newScreenSizeInStageCoords",
")",
"{",
"if",
"(",
"actor",
"!=",
"null",
")",
"{",
"updateActorPosition",
"(",
"actor",
",",
"actor",
".",
"getStage",
... | When called BEFORE resizing the stage, moves the actor to match the same aspect ratio as before. Useful for
windows and dialogs in screen viewports.
@param actor will be repositioned. Can be null, method invocation will be ignored.
@param newScreenSizeInStageCoords screen coords processed by stage. | [
"When",
"called",
"BEFORE",
"resizing",
"the",
"stage",
"moves",
"the",
"actor",
"to",
"match",
"the",
"same",
"aspect",
"ratio",
"as",
"before",
".",
"Useful",
"for",
"windows",
"and",
"dialogs",
"in",
"screen",
"viewports",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Actors.java#L72-L76 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.copyAccessControlEntries | public void copyAccessControlEntries(
CmsDbContext dbc,
CmsResource source,
CmsResource destination,
boolean updateLastModifiedInfo)
throws CmsException {
// get the entries to copy
ListIterator<CmsAccessControlEntry> aceList = getUserDriver(
dbc).readAccessControlEntries(dbc, dbc.currentProject(), source.getResourceId(), false).listIterator();
// remove the current entries from the destination
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), destination.getResourceId());
// now write the new entries
while (aceList.hasNext()) {
CmsAccessControlEntry ace = aceList.next();
getUserDriver(dbc).createAccessControlEntry(
dbc,
dbc.currentProject(),
destination.getResourceId(),
ace.getPrincipal(),
ace.getPermissions().getAllowedPermissions(),
ace.getPermissions().getDeniedPermissions(),
ace.getFlags());
}
// log it
log(
dbc,
new CmsLogEntry(
dbc,
destination.getStructureId(),
CmsLogEntryType.RESOURCE_PERMISSIONS,
new String[] {destination.getRootPath()}),
false);
// update the "last modified" information
if (updateLastModifiedInfo) {
setDateLastModified(dbc, destination, destination.getDateLastModified());
}
// clear the cache
m_monitor.clearAccessControlListCache();
// fire a resource modification event
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, destination);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_ACCESSCONTROL));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
} | java | public void copyAccessControlEntries(
CmsDbContext dbc,
CmsResource source,
CmsResource destination,
boolean updateLastModifiedInfo)
throws CmsException {
// get the entries to copy
ListIterator<CmsAccessControlEntry> aceList = getUserDriver(
dbc).readAccessControlEntries(dbc, dbc.currentProject(), source.getResourceId(), false).listIterator();
// remove the current entries from the destination
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), destination.getResourceId());
// now write the new entries
while (aceList.hasNext()) {
CmsAccessControlEntry ace = aceList.next();
getUserDriver(dbc).createAccessControlEntry(
dbc,
dbc.currentProject(),
destination.getResourceId(),
ace.getPrincipal(),
ace.getPermissions().getAllowedPermissions(),
ace.getPermissions().getDeniedPermissions(),
ace.getFlags());
}
// log it
log(
dbc,
new CmsLogEntry(
dbc,
destination.getStructureId(),
CmsLogEntryType.RESOURCE_PERMISSIONS,
new String[] {destination.getRootPath()}),
false);
// update the "last modified" information
if (updateLastModifiedInfo) {
setDateLastModified(dbc, destination, destination.getDateLastModified());
}
// clear the cache
m_monitor.clearAccessControlListCache();
// fire a resource modification event
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, destination);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_ACCESSCONTROL));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
} | [
"public",
"void",
"copyAccessControlEntries",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"source",
",",
"CmsResource",
"destination",
",",
"boolean",
"updateLastModifiedInfo",
")",
"throws",
"CmsException",
"{",
"// get the entries to copy",
"ListIterator",
"<",
"Cms... | Copies the access control entries of a given resource to a destination resource.<p>
Already existing access control entries of the destination resource are removed.<p>
@param dbc the current database context
@param source the resource to copy the access control entries from
@param destination the resource to which the access control entries are copied
@param updateLastModifiedInfo if true, user and date "last modified" information on the target resource will be updated
@throws CmsException if something goes wrong | [
"Copies",
"the",
"access",
"control",
"entries",
"of",
"a",
"given",
"resource",
"to",
"a",
"destination",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L1027-L1077 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java | ReadUtil.safeRead | public static int safeRead(final InputStream inputStream, final byte[] buffer) throws IOException {
int readBytes = inputStream.read(buffer);
if(readBytes == -1) {
return -1;
}
if(readBytes < buffer.length) {
int offset = readBytes;
int left = buffer.length;
left = left - readBytes;
do {
try {
final int nr = inputStream.read(buffer, offset, left);
if (nr == -1) {
return nr;
}
offset += nr;
left -= nr;
} catch (InterruptedIOException exp) {
/* Ignore, just retry */
}
} while (left > 0);
}
return buffer.length;
} | java | public static int safeRead(final InputStream inputStream, final byte[] buffer) throws IOException {
int readBytes = inputStream.read(buffer);
if(readBytes == -1) {
return -1;
}
if(readBytes < buffer.length) {
int offset = readBytes;
int left = buffer.length;
left = left - readBytes;
do {
try {
final int nr = inputStream.read(buffer, offset, left);
if (nr == -1) {
return nr;
}
offset += nr;
left -= nr;
} catch (InterruptedIOException exp) {
/* Ignore, just retry */
}
} while (left > 0);
}
return buffer.length;
} | [
"public",
"static",
"int",
"safeRead",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"readBytes",
"=",
"inputStream",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"readBy... | Read a number of bytes from the stream and store it in the buffer, and fix the problem with "incomplete" reads by
doing another read if we don't have all of the data yet.
@param inputStream the input stream to read from
@param buffer where to store the data
@return the number of bytes read (should be == length if we didn't hit EOF)
@throws java.io.IOException if an error occurs while reading the stream | [
"Read",
"a",
"number",
"of",
"bytes",
"from",
"the",
"stream",
"and",
"store",
"it",
"in",
"the",
"buffer",
"and",
"fix",
"the",
"problem",
"with",
"incomplete",
"reads",
"by",
"doing",
"another",
"read",
"if",
"we",
"don",
"t",
"have",
"all",
"of",
"t... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java#L51-L74 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/parser/TokenMgrError.java | TokenMgrError.LexicalError | protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
return ("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
} | java | protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
return ("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
} | [
"protected",
"static",
"String",
"LexicalError",
"(",
"boolean",
"EOFSeen",
",",
"int",
"lexState",
",",
"int",
"errorLine",
",",
"int",
"errorColumn",
",",
"String",
"errorAfter",
",",
"char",
"curChar",
")",
"{",
"return",
"(",
"\"Lexical error at line \"",
"+... | Returns a detailed message for the Error when it is thrown by the
token manager to indicate a lexical error.
Parameters :
EOFSeen : indicates if EOF caused the lexicl error
curLexState : lexical state in which this error occured
errorLine : line number when the error occured
errorColumn : column number when the error occured
errorAfter : prefix that was seen before this error occured
curchar : the offending character
Note: You can customize the lexical error message by modifying this method. | [
"Returns",
"a",
"detailed",
"message",
"for",
"the",
"Error",
"when",
"it",
"is",
"thrown",
"by",
"the",
"token",
"manager",
"to",
"indicate",
"a",
"lexical",
"error",
".",
"Parameters",
":",
"EOFSeen",
":",
"indicates",
"if",
"EOF",
"caused",
"the",
"lexi... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/parser/TokenMgrError.java#L116-L122 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleWebhooks.java | ModuleWebhooks.fetchAll | public CMAArray<CMAWebhook> fetchAll(Map<String, String> query) {
throwIfEnvironmentIdIsSet();
return fetchAll(spaceId, query);
} | java | public CMAArray<CMAWebhook> fetchAll(Map<String, String> query) {
throwIfEnvironmentIdIsSet();
return fetchAll(spaceId, query);
} | [
"public",
"CMAArray",
"<",
"CMAWebhook",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"throwIfEnvironmentIdIsSet",
"(",
")",
";",
"return",
"fetchAll",
"(",
"spaceId",
",",
"query",
")",
";",
"}"
] | Retrieve specific webhooks matching a query for this space.
@param query Specifying the criteria on which webhooks to return.
@return An {@link CMAArray} containing all found webhooks for this space.
@throws IllegalArgumentException if configured spaceId is null.
@throws CMANotWithEnvironmentsException if environmentId was set using
{@link CMAClient.Builder#setEnvironmentId(String)}.
@see CMAClient.Builder#setSpaceId(String) | [
"Retrieve",
"specific",
"webhooks",
"matching",
"a",
"query",
"for",
"this",
"space",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleWebhooks.java#L171-L175 |
alkacon/opencms-core | src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java | CmsJSONSearchConfigurationParser.parseOptionalStringValue | protected static String parseOptionalStringValue(JSONObject json, String key) {
try {
return json.getString(key);
} catch (JSONException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_MISSING_1, key), e);
return null;
}
} | java | protected static String parseOptionalStringValue(JSONObject json, String key) {
try {
return json.getString(key);
} catch (JSONException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_MISSING_1, key), e);
return null;
}
} | [
"protected",
"static",
"String",
"parseOptionalStringValue",
"(",
"JSONObject",
"json",
",",
"String",
"key",
")",
"{",
"try",
"{",
"return",
"json",
".",
"getString",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"... | Helper for reading an optional String value - returning <code>null</code> if parsing fails.
@param json The JSON object where the value should be read from.
@param key The key of the value to read.
@return The value from the JSON, or <code>null</code> if the value does not exist. | [
"Helper",
"for",
"reading",
"an",
"optional",
"String",
"value",
"-",
"returning",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"parsing",
"fails",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L299-L307 |
app55/app55-java | src/support/java/com/googlecode/openbeans/PrimitiveWrapperPersistenceDelegate.java | PrimitiveWrapperPersistenceDelegate.mutatesTo | @Override
protected boolean mutatesTo(Object o1, Object o2)
{
if (null == o2)
{
return false;
}
return o1.equals(o2);
} | java | @Override
protected boolean mutatesTo(Object o1, Object o2)
{
if (null == o2)
{
return false;
}
return o1.equals(o2);
} | [
"@",
"Override",
"protected",
"boolean",
"mutatesTo",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"if",
"(",
"null",
"==",
"o2",
")",
"{",
"return",
"false",
";",
"}",
"return",
"o1",
".",
"equals",
"(",
"o2",
")",
";",
"}"
] | /*
Two wrapper objects are regarded mutatable if they are equal. | [
"/",
"*",
"Two",
"wrapper",
"objects",
"are",
"regarded",
"mutatable",
"if",
"they",
"are",
"equal",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/PrimitiveWrapperPersistenceDelegate.java#L54-L62 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java | ProcessApplicationContext.withProcessApplicationContext | public static <T> T withProcessApplicationContext(Callable<T> callable, ProcessApplicationReference reference) throws Exception {
try {
setCurrentProcessApplication(reference);
return callable.call();
}
finally {
clear();
}
} | java | public static <T> T withProcessApplicationContext(Callable<T> callable, ProcessApplicationReference reference) throws Exception {
try {
setCurrentProcessApplication(reference);
return callable.call();
}
finally {
clear();
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withProcessApplicationContext",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"ProcessApplicationReference",
"reference",
")",
"throws",
"Exception",
"{",
"try",
"{",
"setCurrentProcessApplication",
"(",
"reference",
")",
... | <p>Takes a callable and executes all engine API invocations within that callable in the context
of the given process application
<p>Equivalent to
<pre>
try {
ProcessApplicationContext.setCurrentProcessApplication("someProcessApplication");
callable.call();
} finally {
ProcessApplicationContext.clear();
}
</pre>
@param callable the callable to execute
@param reference a reference of the process application to switch into | [
"<p",
">",
"Takes",
"a",
"callable",
"and",
"executes",
"all",
"engine",
"API",
"invocations",
"within",
"that",
"callable",
"in",
"the",
"context",
"of",
"the",
"given",
"process",
"application"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java#L147-L155 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/scheduler/SystemClock.java | SystemClock.internalToTime | public static Double internalToTime(TimeUnit unit, long internalTime)
{
return Math.round(internalTime * TimeUnit.nanosecond.getValue()
/ unit.getValue() * PRECISION)
/ PRECISION;
} | java | public static Double internalToTime(TimeUnit unit, long internalTime)
{
return Math.round(internalTime * TimeUnit.nanosecond.getValue()
/ unit.getValue() * PRECISION)
/ PRECISION;
} | [
"public",
"static",
"Double",
"internalToTime",
"(",
"TimeUnit",
"unit",
",",
"long",
"internalTime",
")",
"{",
"return",
"Math",
".",
"round",
"(",
"internalTime",
"*",
"TimeUnit",
".",
"nanosecond",
".",
"getValue",
"(",
")",
"/",
"unit",
".",
"getValue",
... | Utility method to convert the internal time to the given unit.
@param unit
The unit to convert the internal time to
@param internalTime
The internal time
@return The internal time representation of the parameter | [
"Utility",
"method",
"to",
"convert",
"the",
"internal",
"time",
"to",
"the",
"given",
"unit",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/scheduler/SystemClock.java#L130-L135 |
ltearno/hexa.tools | hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java | Properties.getValue | public static <T> T getValue( Object object, String name )
{
return propertyValues.getValue(object, name);
} | java | public static <T> T getValue( Object object, String name )
{
return propertyValues.getValue(object, name);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getValue",
"(",
"Object",
"object",
",",
"String",
"name",
")",
"{",
"return",
"propertyValues",
".",
"getValue",
"(",
"object",
",",
"name",
")",
";",
"}"
] | Gets the property's value from an object
@param object
The object
@param name
Property name
@return | [
"Gets",
"the",
"property",
"s",
"value",
"from",
"an",
"object"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java#L40-L43 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/Bootstrap.java | Bootstrap.fromDnsSrv | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure) throws NamingException {
return fromDnsSrv(serviceName, full, secure, null);
} | java | public static List<String> fromDnsSrv(final String serviceName, boolean full, boolean secure) throws NamingException {
return fromDnsSrv(serviceName, full, secure, null);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"fromDnsSrv",
"(",
"final",
"String",
"serviceName",
",",
"boolean",
"full",
",",
"boolean",
"secure",
")",
"throws",
"NamingException",
"{",
"return",
"fromDnsSrv",
"(",
"serviceName",
",",
"full",
",",
"secure"... | Fetch a bootstrap list from DNS SRV using default OS name resolution.
@param serviceName the DNS SRV locator.
@param full if the service name is the full one or needs to be enriched by the couchbase prefixes.
@param secure if the secure service prefix should be used.
@return a list of DNS SRV records.
@throws NamingException if something goes wrong during the load process. | [
"Fetch",
"a",
"bootstrap",
"list",
"from",
"DNS",
"SRV",
"using",
"default",
"OS",
"name",
"resolution",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/Bootstrap.java#L74-L76 |
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.forceRecoveryServiceFabricPlatformUpdateDomainWalk | public RecoveryWalkResponseInner forceRecoveryServiceFabricPlatformUpdateDomainWalk(String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) {
return forceRecoveryServiceFabricPlatformUpdateDomainWalkWithServiceResponseAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain).toBlocking().single().body();
} | java | public RecoveryWalkResponseInner forceRecoveryServiceFabricPlatformUpdateDomainWalk(String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) {
return forceRecoveryServiceFabricPlatformUpdateDomainWalkWithServiceResponseAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain).toBlocking().single().body();
} | [
"public",
"RecoveryWalkResponseInner",
"forceRecoveryServiceFabricPlatformUpdateDomainWalk",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"int",
"platformUpdateDomain",
")",
"{",
"return",
"forceRecoveryServiceFabricPlatformUpdateDomainWalkWithServiceRespon... | Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param platformUpdateDomain The platform update domain for which a manual recovery walk is requested
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RecoveryWalkResponseInner object if successful. | [
"Manual",
"platform",
"update",
"domain",
"walk",
"to",
"update",
"virtual",
"machines",
"in",
"a",
"service",
"fabric",
"virtual",
"machine",
"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#L4357-L4359 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ling/WordTagFactory.java | WordTagFactory.newLabel | public Label newLabel(String labelStr, int options) {
if (options == TaggedWordFactory.TAG_LABEL) {
return new WordTag(null, labelStr);
} else {
return new WordTag(labelStr);
}
} | java | public Label newLabel(String labelStr, int options) {
if (options == TaggedWordFactory.TAG_LABEL) {
return new WordTag(null, labelStr);
} else {
return new WordTag(labelStr);
}
} | [
"public",
"Label",
"newLabel",
"(",
"String",
"labelStr",
",",
"int",
"options",
")",
"{",
"if",
"(",
"options",
"==",
"TaggedWordFactory",
".",
"TAG_LABEL",
")",
"{",
"return",
"new",
"WordTag",
"(",
"null",
",",
"labelStr",
")",
";",
"}",
"else",
"{",
... | Make a new label with this <code>String</code> as a value component.
Any other fields of the label would normally be null.
@param labelStr The String that will be used for value
@param options what to make (use labelStr as word or tag)
@return The new WordTag (tag or word will be <code>null</code>) | [
"Make",
"a",
"new",
"label",
"with",
"this",
"<code",
">",
"String<",
"/",
"code",
">",
"as",
"a",
"value",
"component",
".",
"Any",
"other",
"fields",
"of",
"the",
"label",
"would",
"normally",
"be",
"null",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/WordTagFactory.java#L61-L67 |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.optimizePathTopology | boolean optimizePathTopology(NavMeshQuery navquery, QueryFilter filter) {
if (m_path.size() < 3) {
return false;
}
final int MAX_ITER = 32;
navquery.initSlicedFindPath(m_path.get(0), m_path.get(m_path.size() - 1), m_pos, m_target, filter, 0);
navquery.updateSlicedFindPath(MAX_ITER);
Result<List<Long>> fpr = navquery.finalizeSlicedFindPathPartial(m_path);
if (fpr.succeeded() && fpr.result.size() > 0) {
m_path = mergeCorridorStartShortcut(m_path, fpr.result);
return true;
}
return false;
} | java | boolean optimizePathTopology(NavMeshQuery navquery, QueryFilter filter) {
if (m_path.size() < 3) {
return false;
}
final int MAX_ITER = 32;
navquery.initSlicedFindPath(m_path.get(0), m_path.get(m_path.size() - 1), m_pos, m_target, filter, 0);
navquery.updateSlicedFindPath(MAX_ITER);
Result<List<Long>> fpr = navquery.finalizeSlicedFindPathPartial(m_path);
if (fpr.succeeded() && fpr.result.size() > 0) {
m_path = mergeCorridorStartShortcut(m_path, fpr.result);
return true;
}
return false;
} | [
"boolean",
"optimizePathTopology",
"(",
"NavMeshQuery",
"navquery",
",",
"QueryFilter",
"filter",
")",
"{",
"if",
"(",
"m_path",
".",
"size",
"(",
")",
"<",
"3",
")",
"{",
"return",
"false",
";",
"}",
"final",
"int",
"MAX_ITER",
"=",
"32",
";",
"navquery... | Attempts to optimize the path using a local area search. (Partial replanning.)
Inaccurate locomotion or dynamic obstacle avoidance can force the agent position significantly outside the
original corridor. Over time this can result in the formation of a non-optimal corridor. This function will use a
local area path search to try to re-optimize the corridor.
The more inaccurate the agent movement, the more beneficial this function becomes. Simply adjust the frequency of
the call to match the needs to the agent.
@param navquery
The query object used to build the corridor.
@param filter
The filter to apply to the operation. | [
"Attempts",
"to",
"optimize",
"the",
"path",
"using",
"a",
"local",
"area",
"search",
".",
"(",
"Partial",
"replanning",
".",
")"
] | train | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L311-L328 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_device_identity_PUT | public void organizationName_service_exchangeService_device_identity_PUT(String organizationName, String exchangeService, String identity, OvhExchangeServiceDevice body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}";
StringBuilder sb = path(qPath, organizationName, exchangeService, identity);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_device_identity_PUT(String organizationName, String exchangeService, String identity, OvhExchangeServiceDevice body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}";
StringBuilder sb = path(qPath, organizationName, exchangeService, identity);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_device_identity_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"identity",
",",
"OvhExchangeServiceDevice",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"... | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/device/{identity}
@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 identity [required] Exchange identity | [
"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#L2234-L2238 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.getDefaultValue | public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) {
if (annotationType == null || !StringUtils.hasLength(attributeName)) {
return null;
}
try {
return annotationType.getDeclaredMethod(attributeName).getDefaultValue();
}
catch (Exception ex) {
return null;
}
} | java | public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) {
if (annotationType == null || !StringUtils.hasLength(attributeName)) {
return null;
}
try {
return annotationType.getDeclaredMethod(attributeName).getDefaultValue();
}
catch (Exception ex) {
return null;
}
} | [
"public",
"static",
"Object",
"getDefaultValue",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"String",
"attributeName",
")",
"{",
"if",
"(",
"annotationType",
"==",
"null",
"||",
"!",
"StringUtils",
".",
"hasLength",
"(",
"attr... | Retrieve the <em>default value</em> of a named attribute, given the
{@link Class annotation type}.
@param annotationType the <em>annotation type</em> for which the default value should be retrieved
@param attributeName the name of the attribute value to retrieve.
@return the default value of the named attribute, or {@code null} if not found
@see #getDefaultValue(Annotation, String) | [
"Retrieve",
"the",
"<em",
">",
"default",
"value<",
"/",
"em",
">",
"of",
"a",
"named",
"attribute",
"given",
"the",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L694-L704 |
sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java | AutocropOps.scanright | public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) {
if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height))))
return col;
else
return scanright(color, height, width, col + 1, f, tolerance);
} | java | public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) {
if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height))))
return col;
else
return scanright(color, height, width, col + 1, f, tolerance);
} | [
"public",
"static",
"int",
"scanright",
"(",
"Color",
"color",
",",
"int",
"height",
",",
"int",
"width",
",",
"int",
"col",
",",
"PixelsExtractor",
"f",
",",
"int",
"tolerance",
")",
"{",
"if",
"(",
"col",
"==",
"width",
"||",
"!",
"PixelTools",
".",
... | Starting with the given column index, will return the first column index
which contains a colour that does not match the given color. | [
"Starting",
"with",
"the",
"given",
"column",
"index",
"will",
"return",
"the",
"first",
"column",
"index",
"which",
"contains",
"a",
"colour",
"that",
"does",
"not",
"match",
"the",
"given",
"color",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AutocropOps.java#L9-L14 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.toJsonObject | public static JSONObject toJsonObject(Map<String, ?> map) {
JSONObject jsonObject = new JSONObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
Object value = wrap(entry.getValue());
try {
jsonObject.put(entry.getKey(), value);
} catch (JSONException ignored) {
// Ignore values that JSONObject doesn't accept.
}
}
return jsonObject;
} | java | public static JSONObject toJsonObject(Map<String, ?> map) {
JSONObject jsonObject = new JSONObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
Object value = wrap(entry.getValue());
try {
jsonObject.put(entry.getKey(), value);
} catch (JSONException ignored) {
// Ignore values that JSONObject doesn't accept.
}
}
return jsonObject;
} | [
"public",
"static",
"JSONObject",
"toJsonObject",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
")",
"{",
"JSONObject",
"jsonObject",
"=",
"new",
"JSONObject",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"entry",
... | Return a copy of the contents of the given map as a {@link JSONObject}. Instead of failing on
{@code null} values like the {@link JSONObject} map constructor, it cleans them up and
correctly converts them to {@link JSONObject#NULL}. | [
"Return",
"a",
"copy",
"of",
"the",
"contents",
"of",
"the",
"given",
"map",
"as",
"a",
"{"
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L398-L409 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java | Character.codePointBefore | public static int codePointBefore(char[] a, int index, int start) {
if (index <= start || start < 0 || start >= a.length) {
throw new IndexOutOfBoundsException();
}
return codePointBeforeImpl(a, index, start);
} | java | public static int codePointBefore(char[] a, int index, int start) {
if (index <= start || start < 0 || start >= a.length) {
throw new IndexOutOfBoundsException();
}
return codePointBeforeImpl(a, index, start);
} | [
"public",
"static",
"int",
"codePointBefore",
"(",
"char",
"[",
"]",
"a",
",",
"int",
"index",
",",
"int",
"start",
")",
"{",
"if",
"(",
"index",
"<=",
"start",
"||",
"start",
"<",
"0",
"||",
"start",
">=",
"a",
".",
"length",
")",
"{",
"throw",
... | Returns the code point preceding the given index of the
{@code char} array, where only array elements with
{@code index} greater than or equal to {@code start}
can be used. If the {@code char} value at {@code (index - 1)}
in the {@code char} array is in the
low-surrogate range, {@code (index - 2)} is not less than
{@code start}, and the {@code char} value at
{@code (index - 2)} in the {@code char} array is in
the high-surrogate range, then the supplementary code point
corresponding to this surrogate pair is returned. Otherwise,
the {@code char} value at {@code (index - 1)} is
returned.
@param a the {@code char} array
@param index the index following the code point that should be returned
@param start the index of the first array element in the
{@code char} array
@return the Unicode code point value before the given index.
@exception NullPointerException if {@code a} is null.
@exception IndexOutOfBoundsException if the {@code index}
argument is not greater than the {@code start} argument or
is greater than the length of the {@code char} array, or
if the {@code start} argument is negative or not less than
the length of the {@code char} array.
@since 1.5 | [
"Returns",
"the",
"code",
"point",
"preceding",
"the",
"given",
"index",
"of",
"the",
"{",
"@code",
"char",
"}",
"array",
"where",
"only",
"array",
"elements",
"with",
"{",
"@code",
"index",
"}",
"greater",
"than",
"or",
"equal",
"to",
"{",
"@code",
"sta... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5090-L5095 |
arquillian/arquillian-extension-warp | spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManagerStore.java | LifecycleManagerStore.get | public static <T> LifecycleManager get(Class<T> type, T boundObject) throws ObjectNotAssociatedException {
return getCurrentStore().obtain(type, boundObject);
} | java | public static <T> LifecycleManager get(Class<T> type, T boundObject) throws ObjectNotAssociatedException {
return getCurrentStore().obtain(type, boundObject);
} | [
"public",
"static",
"<",
"T",
">",
"LifecycleManager",
"get",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"boundObject",
")",
"throws",
"ObjectNotAssociatedException",
"{",
"return",
"getCurrentStore",
"(",
")",
".",
"obtain",
"(",
"type",
",",
"boundObje... | Retrieves instance of {@link LifecycleManager} for given instance of given class.
@param clazz the class used as denominator during retrieval
@param boundObject the object used as key for retriving {@link LifecycleManager}
@return the bound instance of {@link LifecycleManager}
@throws ObjectNotAssociatedException when instance of no such class and class' instance was associated with any
{@link LifecycleManager} | [
"Retrieves",
"instance",
"of",
"{",
"@link",
"LifecycleManager",
"}",
"for",
"given",
"instance",
"of",
"given",
"class",
"."
] | train | https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManagerStore.java#L68-L70 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getFieldEx | public static Field getFieldEx(Class<?> clazz, String fieldName) throws NoSuchFieldException
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException e) {
Class<?> superclass = clazz.getSuperclass();
if(superclass != null && clazz.getPackage().equals(superclass.getPackage())) {
return getFieldEx(superclass, fieldName);
}
throw e;
}
catch(SecurityException e) {
throw new BugError(e);
}
} | java | public static Field getFieldEx(Class<?> clazz, String fieldName) throws NoSuchFieldException
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException e) {
Class<?> superclass = clazz.getSuperclass();
if(superclass != null && clazz.getPackage().equals(superclass.getPackage())) {
return getFieldEx(superclass, fieldName);
}
throw e;
}
catch(SecurityException e) {
throw new BugError(e);
}
} | [
"public",
"static",
"Field",
"getFieldEx",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"throws",
"NoSuchFieldException",
"{",
"try",
"{",
"Field",
"field",
"=",
"clazz",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"field",... | Get named field of requested class class or its super-classes package hierarchy, with checked exception. Tries to
get requested field from given class; if not found try with super-classes hierarchy but limited to requested class
package. If field still not found throw {@link NoSuchFieldException}.
<p>
Implementation note: if field not found on requested class this method is executed recursively as long as
superclass is in the same package as requested base class. Is not possible to retrieve inherited fields if
superclass descendant is in different package.
@param clazz class to search for named field,
@param fieldName the name of field to retrieve.
@return requested field.
@throws NoSuchFieldException if class or super-class package hierarchy has no field with requested name. | [
"Get",
"named",
"field",
"of",
"requested",
"class",
"class",
"or",
"its",
"super",
"-",
"classes",
"package",
"hierarchy",
"with",
"checked",
"exception",
".",
"Tries",
"to",
"get",
"requested",
"field",
"from",
"given",
"class",
";",
"if",
"not",
"found",
... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L658-L675 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java | GridBagLayoutBuilder.appendSeparator | public GridBagLayoutBuilder appendSeparator(String labelKey) {
if (this.currentRowList.size() > 0) {
nextLine();
}
final JComponent separator = getComponentFactory().createLabeledSeparator(labelKey);
return append(separator, 1, 1, true, false).nextLine();
} | java | public GridBagLayoutBuilder appendSeparator(String labelKey) {
if (this.currentRowList.size() > 0) {
nextLine();
}
final JComponent separator = getComponentFactory().createLabeledSeparator(labelKey);
return append(separator, 1, 1, true, false).nextLine();
} | [
"public",
"GridBagLayoutBuilder",
"appendSeparator",
"(",
"String",
"labelKey",
")",
"{",
"if",
"(",
"this",
".",
"currentRowList",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"nextLine",
"(",
")",
";",
"}",
"final",
"JComponent",
"separator",
"=",
"getComp... | Appends a seperator (usually a horizonal line) using the provided string
as the key to look in the
{@link #setComponentFactory(ComponentFactory) ComponentFactory's}message
bundle for the text to put along with the seperator. Has an implicit
{@link #nextLine()}before and after it.
@return "this" to make it easier to string together append calls | [
"Appends",
"a",
"seperator",
"(",
"usually",
"a",
"horizonal",
"line",
")",
"using",
"the",
"provided",
"string",
"as",
"the",
"key",
"to",
"look",
"in",
"the",
"{",
"@link",
"#setComponentFactory",
"(",
"ComponentFactory",
")",
"ComponentFactory",
"s",
"}",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L585-L591 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getDiagnosticsItem | public HostingEnvironmentDiagnosticsInner getDiagnosticsItem(String resourceGroupName, String name, String diagnosticsName) {
return getDiagnosticsItemWithServiceResponseAsync(resourceGroupName, name, diagnosticsName).toBlocking().single().body();
} | java | public HostingEnvironmentDiagnosticsInner getDiagnosticsItem(String resourceGroupName, String name, String diagnosticsName) {
return getDiagnosticsItemWithServiceResponseAsync(resourceGroupName, name, diagnosticsName).toBlocking().single().body();
} | [
"public",
"HostingEnvironmentDiagnosticsInner",
"getDiagnosticsItem",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"diagnosticsName",
")",
"{",
"return",
"getDiagnosticsItemWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"... | Get a diagnostics item for an App Service Environment.
Get a diagnostics item for an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param diagnosticsName Name of the diagnostics item.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the HostingEnvironmentDiagnosticsInner object if successful. | [
"Get",
"a",
"diagnostics",
"item",
"for",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"a",
"diagnostics",
"item",
"for",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1607-L1609 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/SimulationJob.java | SimulationJob.withTags | public SimulationJob withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public SimulationJob withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"SimulationJob",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map that contains tag keys and tag values that are attached to the simulation job.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the simulation job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"that",
"contains",
"tag",
"keys",
"and",
"tag",
"values",
"that",
"are",
"attached",
"to",
"the",
"simulation",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/SimulationJob.java#L984-L987 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java | LocaleHelper.getLocaleNativeDisplayName | @Nonnull
public static String getLocaleNativeDisplayName (@Nonnull final Locale aLocale)
{
ValueEnforcer.notNull (aLocale, "Locale");
return getLocaleDisplayName (aLocale, aLocale);
} | java | @Nonnull
public static String getLocaleNativeDisplayName (@Nonnull final Locale aLocale)
{
ValueEnforcer.notNull (aLocale, "Locale");
return getLocaleDisplayName (aLocale, aLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getLocaleNativeDisplayName",
"(",
"@",
"Nonnull",
"final",
"Locale",
"aLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aLocale",
",",
"\"Locale\"",
")",
";",
"return",
"getLocaleDisplayName",
"(",
"aLocale",... | Get the display name of the passed locale <em>in</em> the passed locale.
@param aLocale
The locale to use. May not be <code>null</code>.
@return The native display name of the passed locale. | [
"Get",
"the",
"display",
"name",
"of",
"the",
"passed",
"locale",
"<em",
">",
"in<",
"/",
"em",
">",
"the",
"passed",
"locale",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java#L165-L170 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/AmountFormats.java | AmountFormats.wordBased | public static String wordBased(Period period, Duration duration, Locale locale) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(duration, "duration must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_YEAR),
UnitFormat.of(bundle, WORDBASED_MONTH),
UnitFormat.of(bundle, WORDBASED_WEEK),
UnitFormat.of(bundle, WORDBASED_DAY),
UnitFormat.of(bundle, WORDBASED_HOUR),
UnitFormat.of(bundle, WORDBASED_MINUTE),
UnitFormat.of(bundle, WORDBASED_SECOND),
UnitFormat.of(bundle, WORDBASED_MILLISECOND)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
Period normPeriod = oppositeSigns(period.getMonths(), period.getYears()) ? period.normalized() : period;
int weeks = 0, days = 0;
if (normPeriod.getDays() % DAYS_PER_WEEK == 0) {
weeks = normPeriod.getDays() / DAYS_PER_WEEK;
} else {
days = normPeriod.getDays();
}
long totalHours = duration.toHours();
days += (int) (totalHours / HOURS_PER_DAY);
int hours = (int) (totalHours % HOURS_PER_DAY);
int mins = (int) (duration.toMinutes() % MINUTES_PER_HOUR);
int secs = (int) (duration.getSeconds() % SECONDS_PER_MINUTE);
int millis = duration.getNano() / NANOS_PER_MILLIS;
int[] values = {
normPeriod.getYears(), normPeriod.getMonths(), weeks, days,
(int) hours, mins, secs, millis};
return wb.format(values);
} | java | public static String wordBased(Period period, Duration duration, Locale locale) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(duration, "duration must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_YEAR),
UnitFormat.of(bundle, WORDBASED_MONTH),
UnitFormat.of(bundle, WORDBASED_WEEK),
UnitFormat.of(bundle, WORDBASED_DAY),
UnitFormat.of(bundle, WORDBASED_HOUR),
UnitFormat.of(bundle, WORDBASED_MINUTE),
UnitFormat.of(bundle, WORDBASED_SECOND),
UnitFormat.of(bundle, WORDBASED_MILLISECOND)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
Period normPeriod = oppositeSigns(period.getMonths(), period.getYears()) ? period.normalized() : period;
int weeks = 0, days = 0;
if (normPeriod.getDays() % DAYS_PER_WEEK == 0) {
weeks = normPeriod.getDays() / DAYS_PER_WEEK;
} else {
days = normPeriod.getDays();
}
long totalHours = duration.toHours();
days += (int) (totalHours / HOURS_PER_DAY);
int hours = (int) (totalHours % HOURS_PER_DAY);
int mins = (int) (duration.toMinutes() % MINUTES_PER_HOUR);
int secs = (int) (duration.getSeconds() % SECONDS_PER_MINUTE);
int millis = duration.getNano() / NANOS_PER_MILLIS;
int[] values = {
normPeriod.getYears(), normPeriod.getMonths(), weeks, days,
(int) hours, mins, secs, millis};
return wb.format(values);
} | [
"public",
"static",
"String",
"wordBased",
"(",
"Period",
"period",
",",
"Duration",
"duration",
",",
"Locale",
"locale",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"period",
",",
"\"period must not be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"... | Formats a period and duration to a string in a localized word-based format.
<p>
This returns a word-based format for the period.
The year and month are printed as supplied unless the signs differ, in which case they are normalized.
The words are configured in a resource bundle text file -
{@code org.threeten.extra.wordbased.properties} - with overrides per language.
@param period the period to format
@param duration the duration to format
@param locale the locale to use
@return the localized word-based format for the period and duration | [
"Formats",
"a",
"period",
"and",
"duration",
"to",
"a",
"string",
"in",
"a",
"localized",
"word",
"-",
"based",
"format",
".",
"<p",
">",
"This",
"returns",
"a",
"word",
"-",
"based",
"format",
"for",
"the",
"period",
".",
"The",
"year",
"and",
"month"... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/AmountFormats.java#L239-L272 |
Sciss/abc4j | abc/src/main/java/abc/ui/swing/ScoreTemplate.java | ScoreTemplate.setTextAttributes | public void setTextAttributes(byte[] fields, Hashtable attrib) {
for (byte field : fields) {
getFieldInfos(field).m_textAttributes = attrib;
}
notifyListeners();
} | java | public void setTextAttributes(byte[] fields, Hashtable attrib) {
for (byte field : fields) {
getFieldInfos(field).m_textAttributes = attrib;
}
notifyListeners();
} | [
"public",
"void",
"setTextAttributes",
"(",
"byte",
"[",
"]",
"fields",
",",
"Hashtable",
"attrib",
")",
"{",
"for",
"(",
"byte",
"field",
":",
"fields",
")",
"{",
"getFieldInfos",
"(",
"field",
")",
".",
"m_textAttributes",
"=",
"attrib",
";",
"}",
"not... | Sets the text attributes of several fields
@param fields
one of {@link ScoreElements} constants
@param attrib
Map of attributes
@see java.awt.font.TextAttribute | [
"Sets",
"the",
"text",
"attributes",
"of",
"several",
"fields"
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreTemplate.java#L881-L886 |
fuinorg/units4j | src/main/java/org/fuin/units4j/assertionrules/Utils.java | Utils.findOverrideMethods | public static List<MethodInfo> findOverrideMethods(final Index index, final MethodInfo method) {
return findOverrideMethods(index, method.declaringClass(), method, 0);
} | java | public static List<MethodInfo> findOverrideMethods(final Index index, final MethodInfo method) {
return findOverrideMethods(index, method.declaringClass(), method, 0);
} | [
"public",
"static",
"List",
"<",
"MethodInfo",
">",
"findOverrideMethods",
"(",
"final",
"Index",
"index",
",",
"final",
"MethodInfo",
"method",
")",
"{",
"return",
"findOverrideMethods",
"(",
"index",
",",
"method",
".",
"declaringClass",
"(",
")",
",",
"meth... | Returns a list of all methods the given one overrides. Such methods can be found in interfaces and super classes.
@param index
Index with all known classes.
@param method
Method signature to find.
@return List of methods the given one overrides. | [
"Returns",
"a",
"list",
"of",
"all",
"methods",
"the",
"given",
"one",
"overrides",
".",
"Such",
"methods",
"can",
"be",
"found",
"in",
"interfaces",
"and",
"super",
"classes",
"."
] | train | https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/assertionrules/Utils.java#L122-L126 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java | WebSocketHelper.sendSync | public void sendSync(Session session, BasicMessageWithExtraData<? extends BasicMessage> message)
throws IOException {
BinaryData binary = message.getBinaryData();
if (binary == null) {
sendBasicMessageSync(session, message.getBasicMessage());
} else {
// there is binary data to stream back - do it ourselves and don't return anything
BinaryData serialized = ApiDeserializer.toHawkularFormat(message.getBasicMessage(),
message.getBinaryData());
sendBinarySync(session, serialized);
}
} | java | public void sendSync(Session session, BasicMessageWithExtraData<? extends BasicMessage> message)
throws IOException {
BinaryData binary = message.getBinaryData();
if (binary == null) {
sendBasicMessageSync(session, message.getBasicMessage());
} else {
// there is binary data to stream back - do it ourselves and don't return anything
BinaryData serialized = ApiDeserializer.toHawkularFormat(message.getBasicMessage(),
message.getBinaryData());
sendBinarySync(session, serialized);
}
} | [
"public",
"void",
"sendSync",
"(",
"Session",
"session",
",",
"BasicMessageWithExtraData",
"<",
"?",
"extends",
"BasicMessage",
">",
"message",
")",
"throws",
"IOException",
"{",
"BinaryData",
"binary",
"=",
"message",
".",
"getBinaryData",
"(",
")",
";",
"if",
... | Delegates to either {@link #sendBasicMessageSync(Session, BasicMessage)} or
{@link #sendBinarySync(Session, InputStream)} based on {@code message.getBinaryData() == null}.
@param session the session to send to
@param message the message to send
@throws IOException | [
"Delegates",
"to",
"either",
"{",
"@link",
"#sendBasicMessageSync",
"(",
"Session",
"BasicMessage",
")",
"}",
"or",
"{",
"@link",
"#sendBinarySync",
"(",
"Session",
"InputStream",
")",
"}",
"based",
"on",
"{",
"@code",
"message",
".",
"getBinaryData",
"()",
"=... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L93-L104 |
jqm4gwt/jqm4gwt | plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java | JQMDataTable.setUseParentHeight | public void setUseParentHeight(boolean useParentHeight) {
this.useParentHeight = useParentHeight;
if (this.useParentHeight) {
if (useParentHeightDrawHandler == null) {
useParentHeightDrawHandler = new DrawHandler() {
@Override
public void afterDraw(Element tableElt, JavaScriptObject settings) {
if (JQMDataTable.this.useParentHeight) adjustToParentHeight();
}
@Override
public boolean beforeDraw(Element tableElt, JavaScriptObject settings) {
return true;
}};
JsDataTable.addDrawHandler(getElement(), useParentHeightDrawHandler);
}
if (loaded) {
initWindowResize();
initOrientationChange();
}
}
} | java | public void setUseParentHeight(boolean useParentHeight) {
this.useParentHeight = useParentHeight;
if (this.useParentHeight) {
if (useParentHeightDrawHandler == null) {
useParentHeightDrawHandler = new DrawHandler() {
@Override
public void afterDraw(Element tableElt, JavaScriptObject settings) {
if (JQMDataTable.this.useParentHeight) adjustToParentHeight();
}
@Override
public boolean beforeDraw(Element tableElt, JavaScriptObject settings) {
return true;
}};
JsDataTable.addDrawHandler(getElement(), useParentHeightDrawHandler);
}
if (loaded) {
initWindowResize();
initOrientationChange();
}
}
} | [
"public",
"void",
"setUseParentHeight",
"(",
"boolean",
"useParentHeight",
")",
"{",
"this",
".",
"useParentHeight",
"=",
"useParentHeight",
";",
"if",
"(",
"this",
".",
"useParentHeight",
")",
"{",
"if",
"(",
"useParentHeightDrawHandler",
"==",
"null",
")",
"{"... | Takes all parent height. Only works when scrollY is set to some value, for example: 1px
<br> And scrollY value will be used as min-height for scrolling area. | [
"Takes",
"all",
"parent",
"height",
".",
"Only",
"works",
"when",
"scrollY",
"is",
"set",
"to",
"some",
"value",
"for",
"example",
":",
"1px",
"<br",
">",
"And",
"scrollY",
"value",
"will",
"be",
"used",
"as",
"min",
"-",
"height",
"for",
"scrolling",
... | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java#L802-L824 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setIdleMaxAge | public void setIdleMaxAge(long idleMaxAge, TimeUnit timeUnit) {
this.idleMaxAgeInSeconds = TimeUnit.SECONDS.convert(idleMaxAge, checkNotNull(timeUnit));
} | java | public void setIdleMaxAge(long idleMaxAge, TimeUnit timeUnit) {
this.idleMaxAgeInSeconds = TimeUnit.SECONDS.convert(idleMaxAge, checkNotNull(timeUnit));
} | [
"public",
"void",
"setIdleMaxAge",
"(",
"long",
"idleMaxAge",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"idleMaxAgeInSeconds",
"=",
"TimeUnit",
".",
"SECONDS",
".",
"convert",
"(",
"idleMaxAge",
",",
"checkNotNull",
"(",
"timeUnit",
")",
")",
";",
... | Sets Idle max age.
The time, for a connection to remain unused before it is closed off. Do not use aggressive values here!
@param idleMaxAge time after which a connection is closed off
@param timeUnit idleMaxAge time granularity. | [
"Sets",
"Idle",
"max",
"age",
"."
] | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L490-L492 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java | Cursor.setPosition | public void setPosition(float x, float y, float z) {
if (isActive()) {
mIODevice.setPosition(x, y, z);
}
} | java | public void setPosition(float x, float y, float z) {
if (isActive()) {
mIODevice.setPosition(x, y, z);
}
} | [
"public",
"void",
"setPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"mIODevice",
".",
"setPosition",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"}",
"}"
] | Set a new Cursor position if active and enabled.
@param x x value of the position
@param y y value of the position
@param z z value of the position | [
"Set",
"a",
"new",
"Cursor",
"position",
"if",
"active",
"and",
"enabled",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java#L201-L205 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java | EventServiceSegment.pingNotifiableEventListenerInternal | private void pingNotifiableEventListenerInternal(Object object, String topic, Registration registration, boolean register) {
if (!(object instanceof NotifiableEventListener)) {
return;
}
NotifiableEventListener listener = ((NotifiableEventListener) object);
if (register) {
listener.onRegister(service, serviceName, topic, registration);
} else {
listener.onDeregister(service, serviceName, topic, registration);
}
} | java | private void pingNotifiableEventListenerInternal(Object object, String topic, Registration registration, boolean register) {
if (!(object instanceof NotifiableEventListener)) {
return;
}
NotifiableEventListener listener = ((NotifiableEventListener) object);
if (register) {
listener.onRegister(service, serviceName, topic, registration);
} else {
listener.onDeregister(service, serviceName, topic, registration);
}
} | [
"private",
"void",
"pingNotifiableEventListenerInternal",
"(",
"Object",
"object",
",",
"String",
"topic",
",",
"Registration",
"registration",
",",
"boolean",
"register",
")",
"{",
"if",
"(",
"!",
"(",
"object",
"instanceof",
"NotifiableEventListener",
")",
")",
... | Notifies the object of an event in the lifecycle of the listener. The listener may have
been registered or deregistered. The object must implement {@link NotifiableEventListener} if
it wants to be notified.
@param object the object to notified. It must implement {@link NotifiableEventListener} to be notified
@param topic the event topic name
@param registration the listener registration
@param register whether the listener was registered or not | [
"Notifies",
"the",
"object",
"of",
"an",
"event",
"in",
"the",
"lifecycle",
"of",
"the",
"listener",
".",
"The",
"listener",
"may",
"have",
"been",
"registered",
"or",
"deregistered",
".",
"The",
"object",
"must",
"implement",
"{",
"@link",
"NotifiableEventLis... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L101-L112 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.searchSynonyms | public JSONObject searchSynonyms(SynonymQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
JSONObject body = new JSONObject().put("query", query.getQueryString());
if (query.hasTypes()) {
StringBuilder type = new StringBuilder();
boolean first = true;
for (SynonymQuery.SynonymType t : query.getTypes()) {
if (!first) {
type.append(",");
}
type.append(t.name);
first = false;
}
body = body.put("type", type.toString());
}
if (query.getPage() != null) {
body = body.put("page", query.getPage());
}
if (query.getHitsPerPage() != null) {
body = body.put("hitsPerPage", query.getHitsPerPage());
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/search", body.toString(), false, true, requestOptions);
} | java | public JSONObject searchSynonyms(SynonymQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
JSONObject body = new JSONObject().put("query", query.getQueryString());
if (query.hasTypes()) {
StringBuilder type = new StringBuilder();
boolean first = true;
for (SynonymQuery.SynonymType t : query.getTypes()) {
if (!first) {
type.append(",");
}
type.append(t.name);
first = false;
}
body = body.put("type", type.toString());
}
if (query.getPage() != null) {
body = body.put("page", query.getPage());
}
if (query.getHitsPerPage() != null) {
body = body.put("hitsPerPage", query.getHitsPerPage());
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/search", body.toString(), false, true, requestOptions);
} | [
"public",
"JSONObject",
"searchSynonyms",
"(",
"SynonymQuery",
"query",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
",",
"JSONException",
"{",
"JSONObject",
"body",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"query\"",
"... | Search for synonyms
@param query the query
@param requestOptions Options to pass to this request | [
"Search",
"for",
"synonyms"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1431-L1453 |
rubenlagus/TelegramBots | telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java | BaseAbilityBot.reportCommands | public Ability reportCommands() {
return builder()
.name(REPORT)
.locality(ALL)
.privacy(CREATOR)
.input(0)
.action(ctx -> {
String commands = abilities.entrySet().stream()
.filter(entry -> nonNull(entry.getValue().info()))
.map(entry -> {
String name = entry.getValue().name();
String info = entry.getValue().info();
return format("%s - %s", name, info);
})
.sorted()
.reduce((a, b) -> format("%s%n%s", a, b))
.orElse(getLocalizedMessage(ABILITY_COMMANDS_NOT_FOUND, ctx.user().getLanguageCode()));
silent.send(commands, ctx.chatId());
})
.build();
} | java | public Ability reportCommands() {
return builder()
.name(REPORT)
.locality(ALL)
.privacy(CREATOR)
.input(0)
.action(ctx -> {
String commands = abilities.entrySet().stream()
.filter(entry -> nonNull(entry.getValue().info()))
.map(entry -> {
String name = entry.getValue().name();
String info = entry.getValue().info();
return format("%s - %s", name, info);
})
.sorted()
.reduce((a, b) -> format("%s%n%s", a, b))
.orElse(getLocalizedMessage(ABILITY_COMMANDS_NOT_FOUND, ctx.user().getLanguageCode()));
silent.send(commands, ctx.chatId());
})
.build();
} | [
"public",
"Ability",
"reportCommands",
"(",
")",
"{",
"return",
"builder",
"(",
")",
".",
"name",
"(",
"REPORT",
")",
".",
"locality",
"(",
"ALL",
")",
".",
"privacy",
"(",
"CREATOR",
")",
".",
"input",
"(",
"0",
")",
".",
"action",
"(",
"ctx",
"->... | <p>
Format of the report:
<p>
[command1] - [description1]
<p>
[command2] - [description2]
<p>
...
<p>
Once you invoke it, the bot will send the available commands to the chat. This is a public ability so anyone can invoke it.
<p>
Usage: <code>/commands</code>
@return the ability to report commands defined by the child bot. | [
"<p",
">",
"Format",
"of",
"the",
"report",
":",
"<p",
">",
"[",
"command1",
"]",
"-",
"[",
"description1",
"]",
"<p",
">",
"[",
"command2",
"]",
"-",
"[",
"description2",
"]",
"<p",
">",
"...",
"<p",
">",
"Once",
"you",
"invoke",
"it",
"the",
"b... | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L304-L325 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/HistoryService.java | HistoryService.clearHistory | public void clearHistory(int profileId, String clientUUID) {
PreparedStatement query = null;
try (Connection sqlConnection = sqlService.getConnection()) {
String sqlQuery = "DELETE FROM " + Constants.DB_TABLE_HISTORY + " ";
// see if profileId is null or not (-1)
if (profileId != -1) {
sqlQuery += "WHERE " + Constants.GENERIC_PROFILE_ID + "=" + profileId;
}
// see if clientUUID is null or not
if (clientUUID != null && clientUUID.compareTo("") != 0) {
sqlQuery += " AND " + Constants.GENERIC_CLIENT_UUID + "='" + clientUUID + "'";
}
sqlQuery += ";";
logger.info("Query: {}", sqlQuery);
query = sqlConnection.prepareStatement(sqlQuery);
query.executeUpdate();
} catch (Exception e) {
} finally {
try {
if (query != null) {
query.close();
}
} catch (Exception e) {
}
}
} | java | public void clearHistory(int profileId, String clientUUID) {
PreparedStatement query = null;
try (Connection sqlConnection = sqlService.getConnection()) {
String sqlQuery = "DELETE FROM " + Constants.DB_TABLE_HISTORY + " ";
// see if profileId is null or not (-1)
if (profileId != -1) {
sqlQuery += "WHERE " + Constants.GENERIC_PROFILE_ID + "=" + profileId;
}
// see if clientUUID is null or not
if (clientUUID != null && clientUUID.compareTo("") != 0) {
sqlQuery += " AND " + Constants.GENERIC_CLIENT_UUID + "='" + clientUUID + "'";
}
sqlQuery += ";";
logger.info("Query: {}", sqlQuery);
query = sqlConnection.prepareStatement(sqlQuery);
query.executeUpdate();
} catch (Exception e) {
} finally {
try {
if (query != null) {
query.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"clearHistory",
"(",
"int",
"profileId",
",",
"String",
"clientUUID",
")",
"{",
"PreparedStatement",
"query",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
"String",
... | Clear history for a client
@param profileId ID of profile
@param clientUUID UUID of client | [
"Clear",
"history",
"for",
"a",
"client"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/HistoryService.java#L518-L548 |
Arasthel/AsyncJobLibrary | AsyncJob/src/main/java/com/arasthel/asyncjob/AsyncJob.java | AsyncJob.doInBackground | public static FutureTask doInBackground(final OnBackgroundJob onBackgroundJob, ExecutorService executor) {
FutureTask task = (FutureTask) executor.submit(new Runnable() {
@Override
public void run() {
onBackgroundJob.doOnBackground();
}
});
return task;
} | java | public static FutureTask doInBackground(final OnBackgroundJob onBackgroundJob, ExecutorService executor) {
FutureTask task = (FutureTask) executor.submit(new Runnable() {
@Override
public void run() {
onBackgroundJob.doOnBackground();
}
});
return task;
} | [
"public",
"static",
"FutureTask",
"doInBackground",
"(",
"final",
"OnBackgroundJob",
"onBackgroundJob",
",",
"ExecutorService",
"executor",
")",
"{",
"FutureTask",
"task",
"=",
"(",
"FutureTask",
")",
"executor",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
... | Executes the provided code immediately on a background thread that will be submitted to the
provided ExecutorService
@param onBackgroundJob Interface that wraps the code to execute
@param executor Will queue the provided code | [
"Executes",
"the",
"provided",
"code",
"immediately",
"on",
"a",
"background",
"thread",
"that",
"will",
"be",
"submitted",
"to",
"the",
"provided",
"ExecutorService"
] | train | https://github.com/Arasthel/AsyncJobLibrary/blob/64299f642724274c7805a69ee0d693ce7a0425b8/AsyncJob/src/main/java/com/arasthel/asyncjob/AsyncJob.java#L70-L79 |
voldemort/voldemort | src/java/voldemort/utils/ByteUtils.java | ByteUtils.readUnsignedInt | public static long readUnsignedInt(byte[] bytes, int offset) {
return (((bytes[offset + 0] & 0xffL) << 24) | ((bytes[offset + 1] & 0xffL) << 16)
| ((bytes[offset + 2] & 0xffL) << 8) | (bytes[offset + 3] & 0xffL));
} | java | public static long readUnsignedInt(byte[] bytes, int offset) {
return (((bytes[offset + 0] & 0xffL) << 24) | ((bytes[offset + 1] & 0xffL) << 16)
| ((bytes[offset + 2] & 0xffL) << 8) | (bytes[offset + 3] & 0xffL));
} | [
"public",
"static",
"long",
"readUnsignedInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"(",
"bytes",
"[",
"offset",
"+",
"0",
"]",
"&",
"0xff",
"L",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"bytes",
"[",
... | Read an unsigned integer from the given byte array
@param bytes The bytes to read from
@param offset The offset to begin reading at
@return The integer as a long | [
"Read",
"an",
"unsigned",
"integer",
"from",
"the",
"given",
"byte",
"array"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L191-L194 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public <V extends ViewGroup> void setTypeface(V viewGroup, @StringRes int strResId) {
setTypeface(viewGroup, mApplication.getString(strResId));
} | java | public <V extends ViewGroup> void setTypeface(V viewGroup, @StringRes int strResId) {
setTypeface(viewGroup, mApplication.getString(strResId));
} | [
"public",
"<",
"V",
"extends",
"ViewGroup",
">",
"void",
"setTypeface",
"(",
"V",
"viewGroup",
",",
"@",
"StringRes",
"int",
"strResId",
")",
"{",
"setTypeface",
"(",
"viewGroup",
",",
"mApplication",
".",
"getString",
"(",
"strResId",
")",
")",
";",
"}"
] | Set the typeface to the all text views belong to the view group.
Note that this method recursively trace the child view groups and set typeface for the text views.
@param viewGroup the view group that contains text views.
@param strResId string resource containing typeface name.
@param <V> view group parameter. | [
"Set",
"the",
"typeface",
"to",
"the",
"all",
"text",
"views",
"belong",
"to",
"the",
"view",
"group",
".",
"Note",
"that",
"this",
"method",
"recursively",
"trace",
"the",
"child",
"view",
"groups",
"and",
"set",
"typeface",
"for",
"the",
"text",
"views",... | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L151-L153 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java | MeasureUnit.internalGetInstance | @Deprecated
public static MeasureUnit internalGetInstance(String type, String subType) {
if (type == null || subType == null) {
throw new NullPointerException("Type and subType must be non-null");
}
if (!"currency".equals(type)) {
if (!ASCII.containsAll(type) || !ASCII_HYPHEN_DIGITS.containsAll(subType)) {
throw new IllegalArgumentException("The type or subType are invalid.");
}
}
Factory factory;
if ("currency".equals(type)) {
factory = CURRENCY_FACTORY;
} else if ("duration".equals(type)) {
factory = TIMEUNIT_FACTORY;
} else {
factory = UNIT_FACTORY;
}
return MeasureUnit.addUnit(type, subType, factory);
} | java | @Deprecated
public static MeasureUnit internalGetInstance(String type, String subType) {
if (type == null || subType == null) {
throw new NullPointerException("Type and subType must be non-null");
}
if (!"currency".equals(type)) {
if (!ASCII.containsAll(type) || !ASCII_HYPHEN_DIGITS.containsAll(subType)) {
throw new IllegalArgumentException("The type or subType are invalid.");
}
}
Factory factory;
if ("currency".equals(type)) {
factory = CURRENCY_FACTORY;
} else if ("duration".equals(type)) {
factory = TIMEUNIT_FACTORY;
} else {
factory = UNIT_FACTORY;
}
return MeasureUnit.addUnit(type, subType, factory);
} | [
"@",
"Deprecated",
"public",
"static",
"MeasureUnit",
"internalGetInstance",
"(",
"String",
"type",
",",
"String",
"subType",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"subType",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"... | Create a MeasureUnit instance (creates a singleton instance).
<p>
Normally this method should not be used, since there will be no formatting data
available for it, and it may not be returned by getAvailable().
However, for special purposes (such as CLDR tooling), it is available.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Create",
"a",
"MeasureUnit",
"instance",
"(",
"creates",
"a",
"singleton",
"instance",
")",
".",
"<p",
">",
"Normally",
"this",
"method",
"should",
"not",
"be",
"used",
"since",
"there",
"will",
"be",
"no",
"formatting",
"data",
"available",
"for",
"it",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java#L172-L191 |
m-m-m/util | core/src/main/java/net/sf/mmm/util/transformer/base/StringTransformerChain.java | StringTransformerChain.transformRecursive | private String transformRecursive(String original, State state) {
String value = original;
if (this.parent != null) {
value = this.parent.transformRecursive(original, state);
if (state.stop) {
return value;
}
}
for (StringTransformerRule rule : this.rules) {
String transformed = rule.transform(value);
if ((transformed != value) && (rule.isStopOnMatch())) {
state.stop = true;
return transformed;
}
value = transformed;
}
return value;
} | java | private String transformRecursive(String original, State state) {
String value = original;
if (this.parent != null) {
value = this.parent.transformRecursive(original, state);
if (state.stop) {
return value;
}
}
for (StringTransformerRule rule : this.rules) {
String transformed = rule.transform(value);
if ((transformed != value) && (rule.isStopOnMatch())) {
state.stop = true;
return transformed;
}
value = transformed;
}
return value;
} | [
"private",
"String",
"transformRecursive",
"(",
"String",
"original",
",",
"State",
"state",
")",
"{",
"String",
"value",
"=",
"original",
";",
"if",
"(",
"this",
".",
"parent",
"!=",
"null",
")",
"{",
"value",
"=",
"this",
".",
"parent",
".",
"transform... | This method implements {@link #transform(String)} recursively.
@param original is the original value.
@param state is the {@link State} used to indicate if a {@link StringTransformerRule rule} causes the chain to
{@link State#stop}.
@return the transformed result. | [
"This",
"method",
"implements",
"{",
"@link",
"#transform",
"(",
"String",
")",
"}",
"recursively",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/core/src/main/java/net/sf/mmm/util/transformer/base/StringTransformerChain.java#L88-L106 |
tomgibara/bits | src/main/java/com/tomgibara/bits/BitVector.java | BitVector.resizedCopy | public BitVector resizedCopy(int newSize, boolean anchorLeft) {
if (newSize < 0) throw new IllegalArgumentException();
final int size = finish - start;
if (newSize == size) return duplicate(true, true);
int from;
int to;
if (anchorLeft) {
from = size - newSize;
to = size;
} else {
from = 0;
to = newSize;
}
if (newSize < size) return new BitVector(start + from, start + to, bits, mutable).duplicate(true, true);
final BitVector copy = new BitVector(newSize);
copy.perform(SET, -from, this);
return copy;
} | java | public BitVector resizedCopy(int newSize, boolean anchorLeft) {
if (newSize < 0) throw new IllegalArgumentException();
final int size = finish - start;
if (newSize == size) return duplicate(true, true);
int from;
int to;
if (anchorLeft) {
from = size - newSize;
to = size;
} else {
from = 0;
to = newSize;
}
if (newSize < size) return new BitVector(start + from, start + to, bits, mutable).duplicate(true, true);
final BitVector copy = new BitVector(newSize);
copy.perform(SET, -from, this);
return copy;
} | [
"public",
"BitVector",
"resizedCopy",
"(",
"int",
"newSize",
",",
"boolean",
"anchorLeft",
")",
"{",
"if",
"(",
"newSize",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"final",
"int",
"size",
"=",
"finish",
"-",
"start",
";",
... | Creates a mutable copy of this {@link BitVector} that may have a
different size.
@param newSize
the size of the returned {@link BitVector}
@param anchorLeft
true if the most-significant bit of this {@link BitVector}
remains the most-significant bit of the returned
{@link BitVector}, false if the least-significant bit of this
{@link BitVector} remains the least-significant bit of the
returned {@link BitVector}.
@return a resized mutable copy of this {@link BitVector} | [
"Creates",
"a",
"mutable",
"copy",
"of",
"this",
"{",
"@link",
"BitVector",
"}",
"that",
"may",
"have",
"a",
"different",
"size",
"."
] | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L941-L958 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/config/producers/MBeanProducerConfig.java | MBeanProducerConfig.isMBeanRequired | public boolean isMBeanRequired(final String domainName, final String className) {
if(domains == null || domains.length == 0)
return true; // No domain configuration set. All domains should pass
for(MBeanProducerDomainConfig domainConfig : domains)
if(domainConfig.getName().equalsIgnoreCase(domainName)) {
// Domain was found in configuration. Now checking mbean class.
return ArrayUtils.contains(domainConfig.getClasses(), className);
}
// mbean with given domain and class is not required by configuration
return false;
} | java | public boolean isMBeanRequired(final String domainName, final String className) {
if(domains == null || domains.length == 0)
return true; // No domain configuration set. All domains should pass
for(MBeanProducerDomainConfig domainConfig : domains)
if(domainConfig.getName().equalsIgnoreCase(domainName)) {
// Domain was found in configuration. Now checking mbean class.
return ArrayUtils.contains(domainConfig.getClasses(), className);
}
// mbean with given domain and class is not required by configuration
return false;
} | [
"public",
"boolean",
"isMBeanRequired",
"(",
"final",
"String",
"domainName",
",",
"final",
"String",
"className",
")",
"{",
"if",
"(",
"domains",
"==",
"null",
"||",
"domains",
".",
"length",
"==",
"0",
")",
"return",
"true",
";",
"// No domain configuration ... | Checks is mbean with given domain and class required by
this configuration.
@param domainName name of mbean domain
@param className class name of mbean
@return true - configuration require to add this mbean as producer.
false - mbean should be skipped. | [
"Checks",
"is",
"mbean",
"with",
"given",
"domain",
"and",
"class",
"required",
"by",
"this",
"configuration",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/config/producers/MBeanProducerConfig.java#L69-L84 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/locking/consistentkey/ConsistentKeyLocker.java | ConsistentKeyLocker.writeSingleLock | @Override
protected ConsistentKeyLockStatus writeSingleLock(KeyColumn lockID, StoreTransaction txh) throws Throwable {
final StaticBuffer lockKey = serializer.toLockKey(lockID.getKey(), lockID.getColumn());
StaticBuffer oldLockCol = null;
for (int i = 0; i < lockRetryCount; i++) {
WriteResult wr = tryWriteLockOnce(lockKey, oldLockCol, txh);
if (wr.isSuccessful() && wr.getDuration().compareTo(lockWait) <= 0) {
final Instant writeInstant = wr.getWriteTimestamp();
final Instant expireInstant = writeInstant.plus(lockExpire);
return new ConsistentKeyLockStatus(writeInstant, expireInstant);
}
oldLockCol = wr.getLockCol();
handleMutationFailure(lockID, lockKey, wr, txh);
}
tryDeleteLockOnce(lockKey, oldLockCol, txh);
// TODO log exception or successful too-slow write here
throw new TemporaryBackendException("Lock write retry count exceeded");
} | java | @Override
protected ConsistentKeyLockStatus writeSingleLock(KeyColumn lockID, StoreTransaction txh) throws Throwable {
final StaticBuffer lockKey = serializer.toLockKey(lockID.getKey(), lockID.getColumn());
StaticBuffer oldLockCol = null;
for (int i = 0; i < lockRetryCount; i++) {
WriteResult wr = tryWriteLockOnce(lockKey, oldLockCol, txh);
if (wr.isSuccessful() && wr.getDuration().compareTo(lockWait) <= 0) {
final Instant writeInstant = wr.getWriteTimestamp();
final Instant expireInstant = writeInstant.plus(lockExpire);
return new ConsistentKeyLockStatus(writeInstant, expireInstant);
}
oldLockCol = wr.getLockCol();
handleMutationFailure(lockID, lockKey, wr, txh);
}
tryDeleteLockOnce(lockKey, oldLockCol, txh);
// TODO log exception or successful too-slow write here
throw new TemporaryBackendException("Lock write retry count exceeded");
} | [
"@",
"Override",
"protected",
"ConsistentKeyLockStatus",
"writeSingleLock",
"(",
"KeyColumn",
"lockID",
",",
"StoreTransaction",
"txh",
")",
"throws",
"Throwable",
"{",
"final",
"StaticBuffer",
"lockKey",
"=",
"serializer",
".",
"toLockKey",
"(",
"lockID",
".",
"get... | Try to write a lock record remotely up to the configured number of
times. If the store produces
{@link TemporaryLockingException}, then we'll call mutate again to add a
new column with an updated timestamp and to delete the column that tried
to write when the store threw an exception. We continue like that up to
the retry limit. If the store throws anything else, such as an unchecked
exception or a {@link com.thinkaurelius.titan.diskstorage.PermanentBackendException}, then we'll try to
delete whatever we added and return without further retries.
@param lockID lock to acquire
@param txh transaction
@return the timestamp, in nanoseconds since UNIX Epoch, on the lock
column that we successfully wrote to the store
@throws TemporaryLockingException if the lock retry count is exceeded without successfully
writing the lock in less than the wait limit
@throws Throwable if the storage layer throws anything else | [
"Try",
"to",
"write",
"a",
"lock",
"record",
"remotely",
"up",
"to",
"the",
"configured",
"number",
"of",
"times",
".",
"If",
"the",
"store",
"produces",
"{",
"@link",
"TemporaryLockingException",
"}",
"then",
"we",
"ll",
"call",
"mutate",
"again",
"to",
"... | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/locking/consistentkey/ConsistentKeyLocker.java#L307-L326 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java | ResourceTable.restoreMainRecord | public void restoreMainRecord(Record record, boolean altMatchesToNull)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record2 = table.getRecord();
this.restoreMainRecord(record2, record, altMatchesToNull);
}
}
} | java | public void restoreMainRecord(Record record, boolean altMatchesToNull)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record2 = table.getRecord();
this.restoreMainRecord(record2, record, altMatchesToNull);
}
}
} | [
"public",
"void",
"restoreMainRecord",
"(",
"Record",
"record",
",",
"boolean",
"altMatchesToNull",
")",
"{",
"Iterator",
"<",
"BaseTable",
">",
"iterator",
"=",
"this",
".",
"getTables",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
"... | Restore the unchangeable info from the buffer to this main record.
@param record The main record
@param altMatchesToNull If the alternate field is the same as the main field, set it to null (no change). | [
"Restore",
"the",
"unchangeable",
"info",
"from",
"the",
"buffer",
"to",
"this",
"main",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java#L175-L187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.