repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
sculptor/sculptor | sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java | HelperBase.substringBetween | public String substringBetween(String string, String begin, String end, boolean includeBoundaries) {
if (string == null || begin == null || end == null) {
return null;
}
int startPos = string.indexOf(begin);
if (startPos != -1) {
if (includeBoundaries)
startPos = startPos - begin.length();
int endPos = string.lastIndexOf(end);
if (endPos != -1) {
if (includeBoundaries)
endPos = endPos + end.length();
return string.substring(startPos + begin.length(), endPos);
}
}
return null;
} | java | public String substringBetween(String string, String begin, String end, boolean includeBoundaries) {
if (string == null || begin == null || end == null) {
return null;
}
int startPos = string.indexOf(begin);
if (startPos != -1) {
if (includeBoundaries)
startPos = startPos - begin.length();
int endPos = string.lastIndexOf(end);
if (endPos != -1) {
if (includeBoundaries)
endPos = endPos + end.length();
return string.substring(startPos + begin.length(), endPos);
}
}
return null;
} | [
"public",
"String",
"substringBetween",
"(",
"String",
"string",
",",
"String",
"begin",
",",
"String",
"end",
",",
"boolean",
"includeBoundaries",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"begin",
"==",
"null",
"||",
"end",
"==",
"null",
")",
... | Gets a substring between the begin and end boundaries
@param string
original string
@param begin
start boundary
@param end
end boundary
@param includeBoundaries
include the boundaries in substring
@return substring between boundaries | [
"Gets",
"a",
"substring",
"between",
"the",
"begin",
"and",
"end",
"boundaries"
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java#L540-L556 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptActionsInner.java | ScriptActionsInner.listByClusterAsync | public Observable<Page<RuntimeScriptActionDetailInner>> listByClusterAsync(final String resourceGroupName, final String clusterName) {
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName)
.map(new Func1<ServiceResponse<Page<RuntimeScriptActionDetailInner>>, Page<RuntimeScriptActionDetailInner>>() {
@Override
public Page<RuntimeScriptActionDetailInner> call(ServiceResponse<Page<RuntimeScriptActionDetailInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RuntimeScriptActionDetailInner>> listByClusterAsync(final String resourceGroupName, final String clusterName) {
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName)
.map(new Func1<ServiceResponse<Page<RuntimeScriptActionDetailInner>>, Page<RuntimeScriptActionDetailInner>>() {
@Override
public Page<RuntimeScriptActionDetailInner> call(ServiceResponse<Page<RuntimeScriptActionDetailInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RuntimeScriptActionDetailInner",
">",
">",
"listByClusterAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"clusterName",
")",
"{",
"return",
"listByClusterWithServiceResponseAsync",
"(",
"resourceGroup... | Lists all the persisted script actions for the specified cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RuntimeScriptActionDetailInner> object | [
"Lists",
"all",
"the",
"persisted",
"script",
"actions",
"for",
"the",
"specified",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptActionsInner.java#L220-L228 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/NumberField.java | NumberField.setState | public int setState(boolean state, boolean bDisplayOption, int moveMode)
{
double value = 0;
if (state)
value = 1;
return this.setValue(value, bDisplayOption, moveMode); // Move value to this field
} | java | public int setState(boolean state, boolean bDisplayOption, int moveMode)
{
double value = 0;
if (state)
value = 1;
return this.setValue(value, bDisplayOption, moveMode); // Move value to this field
} | [
"public",
"int",
"setState",
"(",
"boolean",
"state",
",",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"{",
"double",
"value",
"=",
"0",
";",
"if",
"(",
"state",
")",
"value",
"=",
"1",
";",
"return",
"this",
".",
"setValue",
"(",
"value"... | For binary fields, set the current state.
@param state The state to set this field.
@param bDisplayOption Display changed fields if true.
@param iMoveMode The move mode.
@return The error code (or NORMAL_RETURN). | [
"For",
"binary",
"fields",
"set",
"the",
"current",
"state",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/NumberField.java#L155-L161 |
mozilla/rhino | src/org/mozilla/javascript/NativeJavaObject.java | NativeJavaObject.coerceType | @Deprecated
public static Object coerceType(Class<?> type, Object value)
{
return coerceTypeImpl(type, value);
} | java | @Deprecated
public static Object coerceType(Class<?> type, Object value)
{
return coerceTypeImpl(type, value);
} | [
"@",
"Deprecated",
"public",
"static",
"Object",
"coerceType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"value",
")",
"{",
"return",
"coerceTypeImpl",
"(",
"type",
",",
"value",
")",
";",
"}"
] | Not intended for public use. Callers should use the
public API Context.toType.
@deprecated as of 1.5 Release 4
@see org.mozilla.javascript.Context#jsToJava(Object, Class) | [
"Not",
"intended",
"for",
"public",
"use",
".",
"Callers",
"should",
"use",
"the",
"public",
"API",
"Context",
".",
"toType",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeJavaObject.java#L496-L500 |
qos-ch/slf4j | slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java | ProjectConverter.scanFile | private void scanFile(File file) {
try {
InplaceFileConverter fc = new InplaceFileConverter(ruleSet, progressListener);
fc.convert(file);
} catch (IOException exc) {
addException(new ConversionException(exc.toString()));
}
} | java | private void scanFile(File file) {
try {
InplaceFileConverter fc = new InplaceFileConverter(ruleSet, progressListener);
fc.convert(file);
} catch (IOException exc) {
addException(new ConversionException(exc.toString()));
}
} | [
"private",
"void",
"scanFile",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"InplaceFileConverter",
"fc",
"=",
"new",
"InplaceFileConverter",
"(",
"ruleSet",
",",
"progressListener",
")",
";",
"fc",
".",
"convert",
"(",
"file",
")",
";",
"}",
"catch",
"(",
... | Convert the specified file Read each line and ask matcher implementation
for conversion Rewrite the line returned by matcher
@param file | [
"Convert",
"the",
"specified",
"file",
"Read",
"each",
"line",
"and",
"ask",
"matcher",
"implementation",
"for",
"conversion",
"Rewrite",
"the",
"line",
"returned",
"by",
"matcher"
] | train | https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java#L100-L107 |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/job/runner/AnalysisRunnerJobDelegate.java | AnalysisRunnerJobDelegate.scheduleRowProcessing | private void scheduleRowProcessing(RowProcessingPublishers publishers, LifeCycleHelper lifeCycleHelper,
JobCompletionTaskListener jobCompletionTaskListener, AnalysisJobMetrics analysisJobMetrics) {
logger.info("Created {} row processor publishers", publishers.size());
final List<TaskRunnable> finalTasks = new ArrayList<TaskRunnable>(2);
finalTasks.add(new TaskRunnable(null, jobCompletionTaskListener));
finalTasks.add(new TaskRunnable(null, new CloseReferenceDataTaskListener(lifeCycleHelper)));
final ForkTaskListener finalTaskListener = new ForkTaskListener("All row consumers finished", _taskRunner,
finalTasks);
final TaskListener rowProcessorPublishersDoneCompletionListener = new JoinTaskListener(publishers.size(),
finalTaskListener);
final Collection<RowProcessingPublisher> rowProcessingPublishers = publishers.getRowProcessingPublishers();
for (RowProcessingPublisher rowProcessingPublisher : rowProcessingPublishers) {
logger.debug("Scheduling row processing publisher: {}", rowProcessingPublisher);
rowProcessingPublisher.runRowProcessing(_resultQueue, rowProcessorPublishersDoneCompletionListener);
}
} | java | private void scheduleRowProcessing(RowProcessingPublishers publishers, LifeCycleHelper lifeCycleHelper,
JobCompletionTaskListener jobCompletionTaskListener, AnalysisJobMetrics analysisJobMetrics) {
logger.info("Created {} row processor publishers", publishers.size());
final List<TaskRunnable> finalTasks = new ArrayList<TaskRunnable>(2);
finalTasks.add(new TaskRunnable(null, jobCompletionTaskListener));
finalTasks.add(new TaskRunnable(null, new CloseReferenceDataTaskListener(lifeCycleHelper)));
final ForkTaskListener finalTaskListener = new ForkTaskListener("All row consumers finished", _taskRunner,
finalTasks);
final TaskListener rowProcessorPublishersDoneCompletionListener = new JoinTaskListener(publishers.size(),
finalTaskListener);
final Collection<RowProcessingPublisher> rowProcessingPublishers = publishers.getRowProcessingPublishers();
for (RowProcessingPublisher rowProcessingPublisher : rowProcessingPublishers) {
logger.debug("Scheduling row processing publisher: {}", rowProcessingPublisher);
rowProcessingPublisher.runRowProcessing(_resultQueue, rowProcessorPublishersDoneCompletionListener);
}
} | [
"private",
"void",
"scheduleRowProcessing",
"(",
"RowProcessingPublishers",
"publishers",
",",
"LifeCycleHelper",
"lifeCycleHelper",
",",
"JobCompletionTaskListener",
"jobCompletionTaskListener",
",",
"AnalysisJobMetrics",
"analysisJobMetrics",
")",
"{",
"logger",
".",
"info",
... | Starts row processing job flows.
@param publishers
@param analysisJobMetrics
@param injectionManager | [
"Starts",
"row",
"processing",
"job",
"flows",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/job/runner/AnalysisRunnerJobDelegate.java#L157-L177 |
gocd/gocd | common/src/main/java/com/thoughtworks/go/util/URLService.java | URLService.getPropertiesUrl | public String getPropertiesUrl(JobIdentifier jobIdentifier, String propertyName) {
return format("%s/%s/%s/%s",
baseRemotingURL, "remoting", "properties", jobIdentifier.propertyLocator(propertyName));
} | java | public String getPropertiesUrl(JobIdentifier jobIdentifier, String propertyName) {
return format("%s/%s/%s/%s",
baseRemotingURL, "remoting", "properties", jobIdentifier.propertyLocator(propertyName));
} | [
"public",
"String",
"getPropertiesUrl",
"(",
"JobIdentifier",
"jobIdentifier",
",",
"String",
"propertyName",
")",
"{",
"return",
"format",
"(",
"\"%s/%s/%s/%s\"",
",",
"baseRemotingURL",
",",
"\"remoting\"",
",",
"\"properties\"",
",",
"jobIdentifier",
".",
"property... | /*
Agent will use this method, the baseUrl will be injected from config xml in agent side.
This is used to fix security issues with the agent uploading artifacts when security is enabled. | [
"/",
"*",
"Agent",
"will",
"use",
"this",
"method",
"the",
"baseUrl",
"will",
"be",
"injected",
"from",
"config",
"xml",
"in",
"agent",
"side",
".",
"This",
"is",
"used",
"to",
"fix",
"security",
"issues",
"with",
"the",
"agent",
"uploading",
"artifacts",
... | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/common/src/main/java/com/thoughtworks/go/util/URLService.java#L90-L93 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.unsubscribeAllDeletedResources | public void unsubscribeAllDeletedResources(CmsDbContext dbc, String poolName, long deletedTo) throws CmsException {
getSubscriptionDriver().unsubscribeAllDeletedResources(dbc, poolName, deletedTo);
} | java | public void unsubscribeAllDeletedResources(CmsDbContext dbc, String poolName, long deletedTo) throws CmsException {
getSubscriptionDriver().unsubscribeAllDeletedResources(dbc, poolName, deletedTo);
} | [
"public",
"void",
"unsubscribeAllDeletedResources",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"poolName",
",",
"long",
"deletedTo",
")",
"throws",
"CmsException",
"{",
"getSubscriptionDriver",
"(",
")",
".",
"unsubscribeAllDeletedResources",
"(",
"dbc",
",",
"poolNam... | Unsubscribes all deleted resources that were deleted before the specified time stamp.<p>
@param dbc the database context
@param poolName the name of the database pool to use
@param deletedTo the time stamp to which the resources have been deleted
@throws CmsException if something goes wrong | [
"Unsubscribes",
"all",
"deleted",
"resources",
"that",
"were",
"deleted",
"before",
"the",
"specified",
"time",
"stamp",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9248-L9251 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.traceAsync | public <T> CompletableFuture<T> traceAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> trace(type, closure), getExecutor());
} | java | public <T> CompletableFuture<T> traceAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> trace(type, closure), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"traceAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",
... | Executes an asynchronous TRACE request on the configured URI (asynchronous alias to the `trace(Class,Closure)` method), with additional
configuration provided by the configuration closure. The result will be cast to the specified `type`.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101/date'
}
CompletableFuture future = http.traceAsync(Date){
response.success { FromServer fromServer ->
Date.parse('yyyy.MM.dd HH:mm', fromServer.headers.find { it.key == 'stamp' }.value)
}
}
Date result = future.get()
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param type the type of the response content
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return a {@link CompletableFuture} which may be used to access the resulting content (if present) | [
"Executes",
"an",
"asynchronous",
"TRACE",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"trace",
"(",
"Class",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuratio... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L2192-L2194 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java | MurmurHashUtil.hashBytes | public static int hashBytes(MemorySegment segment, int offset, int lengthInBytes) {
return hashBytes(segment, offset, lengthInBytes, DEFAULT_SEED);
} | java | public static int hashBytes(MemorySegment segment, int offset, int lengthInBytes) {
return hashBytes(segment, offset, lengthInBytes, DEFAULT_SEED);
} | [
"public",
"static",
"int",
"hashBytes",
"(",
"MemorySegment",
"segment",
",",
"int",
"offset",
",",
"int",
"lengthInBytes",
")",
"{",
"return",
"hashBytes",
"(",
"segment",
",",
"offset",
",",
"lengthInBytes",
",",
"DEFAULT_SEED",
")",
";",
"}"
] | Hash bytes in MemorySegment.
@param segment segment.
@param offset offset for MemorySegment
@param lengthInBytes length in MemorySegment
@return hash code | [
"Hash",
"bytes",
"in",
"MemorySegment",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L73-L75 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, @ClosureParams(value=SimpleType.class, options="java.sql.ResultSetMetaData") Closure metaClosure,
@ClosureParams(value=SimpleType.class, options="groovy.sql.GroovyResultSet") Closure rowClosure) throws SQLException {
eachRow(sql, metaClosure, 0, 0, rowClosure);
} | java | public void eachRow(String sql, @ClosureParams(value=SimpleType.class, options="java.sql.ResultSetMetaData") Closure metaClosure,
@ClosureParams(value=SimpleType.class, options="groovy.sql.GroovyResultSet") Closure rowClosure) throws SQLException {
eachRow(sql, metaClosure, 0, 0, rowClosure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.sql.ResultSetMetaData\"",
")",
"Closure",
"metaClosure",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"Si... | Performs the given SQL query calling the given <code>rowClosure</code> with each row of the
result set.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
In addition, the <code>metaClosure</code> will be called once passing in the
<code>ResultSetMetaData</code> as argument.
<p>
Example usage:
<pre>
def printColNames = { meta {@code ->}
(1..meta.columnCount).each {
print meta.getColumnLabel(it).padRight(20)
}
println()
}
def printRow = { row {@code ->}
row.toRowResult().values().each{ print it.toString().padRight(20) }
println()
}
sql.eachRow("select * from PERSON", printColNames, printRow)
</pre>
<p>
Resource handling is performed automatically where appropriate.
@param sql the sql statement
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"<code",
">",
"rowClosure<",
"/",
"code",
">",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
".",
"The",
"row",
"will",
"be",
"a",
"<code",
">",
"GroovyResultSet<",
"/",
"code"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1175-L1178 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBitOutputStream.java | NonBlockingBitOutputStream.writeBits | public void writeBits (final int aValue, @Nonnegative final int nNumBits) throws IOException
{
ValueEnforcer.isBetweenInclusive (nNumBits, "NumberOfBits", 1, CGlobal.BITS_PER_INT);
for (int i = nNumBits - 1; i >= 0; i--)
writeBit ((aValue >> i) & 1);
}
/**
* Write the current cache to the stream and reset the buffer.
*
* @throws IOException
* In case writing to the output stream failed
*/
public void flush () throws IOException
{
if (m_nBufferedBitCount > 0)
{
if (m_nBufferedBitCount != CGlobal.BITS_PER_BYTE)
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Flushing BitOutputStream with only " + m_nBufferedBitCount + " bits");
m_aOS.write ((byte) m_nBuffer);
m_nBufferedBitCount = 0;
m_nBuffer = 0;
}
}
/**
* Flush the data and close the underlying output stream.
*/
public void close ()
{
StreamHelper.flush (this);
StreamHelper.close (m_aOS);
m_aOS = null;
}
@Override
public String toString ()
{
return new ToStringGenerator (this).append ("OS", m_aOS)
.append ("highOrderBitFirst", m_bHighOrderBitFirst)
.append ("buffer", m_nBuffer)
.append ("bitCount", m_nBufferedBitCount)
.getToString ();
}
} | java | public void writeBits (final int aValue, @Nonnegative final int nNumBits) throws IOException
{
ValueEnforcer.isBetweenInclusive (nNumBits, "NumberOfBits", 1, CGlobal.BITS_PER_INT);
for (int i = nNumBits - 1; i >= 0; i--)
writeBit ((aValue >> i) & 1);
}
/**
* Write the current cache to the stream and reset the buffer.
*
* @throws IOException
* In case writing to the output stream failed
*/
public void flush () throws IOException
{
if (m_nBufferedBitCount > 0)
{
if (m_nBufferedBitCount != CGlobal.BITS_PER_BYTE)
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Flushing BitOutputStream with only " + m_nBufferedBitCount + " bits");
m_aOS.write ((byte) m_nBuffer);
m_nBufferedBitCount = 0;
m_nBuffer = 0;
}
}
/**
* Flush the data and close the underlying output stream.
*/
public void close ()
{
StreamHelper.flush (this);
StreamHelper.close (m_aOS);
m_aOS = null;
}
@Override
public String toString ()
{
return new ToStringGenerator (this).append ("OS", m_aOS)
.append ("highOrderBitFirst", m_bHighOrderBitFirst)
.append ("buffer", m_nBuffer)
.append ("bitCount", m_nBufferedBitCount)
.getToString ();
}
} | [
"public",
"void",
"writeBits",
"(",
"final",
"int",
"aValue",
",",
"@",
"Nonnegative",
"final",
"int",
"nNumBits",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"isBetweenInclusive",
"(",
"nNumBits",
",",
"\"NumberOfBits\"",
",",
"1",
",",
"CGlobal",
... | Write the specified number of bits from the int value to the stream.
Corresponding to the InputStream, the bits are written starting at the
highest bit ( >> aNumberOfBits ), going down to the lowest bit (
>> 0 ).
@param aValue
the int containing the bits that should be written to the stream.
@param nNumBits
how many bits of the integer should be written to the stream.
@throws IOException
In case writing to the output stream failed | [
"Write",
"the",
"specified",
"number",
"of",
"bits",
"from",
"the",
"int",
"value",
"to",
"the",
"stream",
".",
"Corresponding",
"to",
"the",
"InputStream",
"the",
"bits",
"are",
"written",
"starting",
"at",
"the",
"highest",
"bit",
"(",
">",
";",
">",... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBitOutputStream.java#L138-L184 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java | FixDependencyChecker.isUninstallable | public boolean isUninstallable(UninstallAsset uninstallAsset, Set<IFixInfo> installedFixes, List<UninstallAsset> uninstallAssets) {
if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) {
return true;
}
IFixInfo fixToBeUninstalled = uninstallAsset.getIFixInfo();
for (IFixInfo fix : installedFixes) {
if (!(fixToBeUninstalled.getId().equals(fix.getId()))) {
if ((!confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) &&
(!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems())))
if (!isToBeUninstalled(fix.getId(), uninstallAssets))
return false;
}
}
return true;
} | java | public boolean isUninstallable(UninstallAsset uninstallAsset, Set<IFixInfo> installedFixes, List<UninstallAsset> uninstallAssets) {
if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) {
return true;
}
IFixInfo fixToBeUninstalled = uninstallAsset.getIFixInfo();
for (IFixInfo fix : installedFixes) {
if (!(fixToBeUninstalled.getId().equals(fix.getId()))) {
if ((!confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) &&
(!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems())))
if (!isToBeUninstalled(fix.getId(), uninstallAssets))
return false;
}
}
return true;
} | [
"public",
"boolean",
"isUninstallable",
"(",
"UninstallAsset",
"uninstallAsset",
",",
"Set",
"<",
"IFixInfo",
">",
"installedFixes",
",",
"List",
"<",
"UninstallAsset",
">",
"uninstallAssets",
")",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"System",
".",
... | Verfiy whether the fix is uninstallable and there is no other installed
fix still require this feature.
@param uninstallAsset fix to be uninstalled
@param installedFixes installed fixes
@param uninstallAssets the list of fixes that is to be uninstalled
@return the true if there is no fix that depends on the uninstall asset. return false otherwise | [
"Verfiy",
"whether",
"the",
"fix",
"is",
"uninstallable",
"and",
"there",
"is",
"no",
"other",
"installed",
"fix",
"still",
"require",
"this",
"feature",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java#L74-L90 |
lemire/sparsebitmap | src/main/java/sparsebitmap/SparseBitmap.java | SparseBitmap.match | public static boolean match(SkippableIterator o1, SkippableIterator o2) {
while (o1.getCurrentWordOffset() != o2.getCurrentWordOffset()) {
if (o1.getCurrentWordOffset() < o2.getCurrentWordOffset()) {
o1.advanceUntil(o2.getCurrentWordOffset());
if (!o1.hasValue())
return false;
}
if (o1.getCurrentWordOffset() > o2.getCurrentWordOffset()) {
o2.advanceUntil(o1.getCurrentWordOffset());
if (!o2.hasValue())
return false;
}
}
return true;
} | java | public static boolean match(SkippableIterator o1, SkippableIterator o2) {
while (o1.getCurrentWordOffset() != o2.getCurrentWordOffset()) {
if (o1.getCurrentWordOffset() < o2.getCurrentWordOffset()) {
o1.advanceUntil(o2.getCurrentWordOffset());
if (!o1.hasValue())
return false;
}
if (o1.getCurrentWordOffset() > o2.getCurrentWordOffset()) {
o2.advanceUntil(o1.getCurrentWordOffset());
if (!o2.hasValue())
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"match",
"(",
"SkippableIterator",
"o1",
",",
"SkippableIterator",
"o2",
")",
"{",
"while",
"(",
"o1",
".",
"getCurrentWordOffset",
"(",
")",
"!=",
"o2",
".",
"getCurrentWordOffset",
"(",
")",
")",
"{",
"if",
"(",
"o1",
".",
... | Synchronize two iterators
@param o1
the first iterator
@param o2
the second iterator
@return true, if successful | [
"Synchronize",
"two",
"iterators"
] | train | https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L1080-L1094 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java | JDBC4PreparedStatement.setBytes | @Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x;
} | java | @Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x;
} | [
"@",
"Override",
"public",
"void",
"setBytes",
"(",
"int",
"parameterIndex",
",",
"byte",
"[",
"]",
"x",
")",
"throws",
"SQLException",
"{",
"checkParameterBounds",
"(",
"parameterIndex",
")",
";",
"this",
".",
"parameters",
"[",
"parameterIndex",
"-",
"1",
... | Sets the designated parameter to the given Java array of bytes. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"Java",
"array",
"of",
"bytes",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L262-L267 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_firewall_ipOnFirewall_PUT | public void ip_firewall_ipOnFirewall_PUT(String ip, String ipOnFirewall, OvhFirewallIp body) throws IOException {
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}";
StringBuilder sb = path(qPath, ip, ipOnFirewall);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void ip_firewall_ipOnFirewall_PUT(String ip, String ipOnFirewall, OvhFirewallIp body) throws IOException {
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}";
StringBuilder sb = path(qPath, ip, ipOnFirewall);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"ip_firewall_ipOnFirewall_PUT",
"(",
"String",
"ip",
",",
"String",
"ipOnFirewall",
",",
"OvhFirewallIp",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/firewall/{ipOnFirewall}\"",
";",
"StringBuilder",
"sb",
"=",
"pat... | Alter this object properties
REST: PUT /ip/{ip}/firewall/{ipOnFirewall}
@param body [required] New object properties
@param ip [required]
@param ipOnFirewall [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1020-L1024 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/backend/MBeanServerHandler.java | MBeanServerHandler.detectServers | private ServerHandle detectServers(List<ServerDetector> pDetectors, LogHandler pLogHandler) {
// Now detect the server
for (ServerDetector detector : pDetectors) {
try {
ServerHandle info = detector.detect(mBeanServerManager);
if (info != null) {
return info;
}
} catch (Exception exp) {
// We are defensive here and wont stop the servlet because
// there is a problem with the server detection. A error will be logged
// nevertheless, though.
pLogHandler.error("Error while using detector " + detector.getClass().getSimpleName() + ": " + exp,exp);
}
}
return null;
} | java | private ServerHandle detectServers(List<ServerDetector> pDetectors, LogHandler pLogHandler) {
// Now detect the server
for (ServerDetector detector : pDetectors) {
try {
ServerHandle info = detector.detect(mBeanServerManager);
if (info != null) {
return info;
}
} catch (Exception exp) {
// We are defensive here and wont stop the servlet because
// there is a problem with the server detection. A error will be logged
// nevertheless, though.
pLogHandler.error("Error while using detector " + detector.getClass().getSimpleName() + ": " + exp,exp);
}
}
return null;
} | [
"private",
"ServerHandle",
"detectServers",
"(",
"List",
"<",
"ServerDetector",
">",
"pDetectors",
",",
"LogHandler",
"pLogHandler",
")",
"{",
"// Now detect the server",
"for",
"(",
"ServerDetector",
"detector",
":",
"pDetectors",
")",
"{",
"try",
"{",
"ServerHandl... | by a lookup mechanism, queried and thrown away after this method | [
"by",
"a",
"lookup",
"mechanism",
"queried",
"and",
"thrown",
"away",
"after",
"this",
"method"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/MBeanServerHandler.java#L287-L303 |
mike10004/common-helper | native-helper/src/main/java/com/github/mike10004/nativehelper/StandardWhicher.java | StandardWhicher.which | @Override
public Optional<File> which(Iterable<String> filenames) {
for (File parent : ImmutableList.copyOf(parents)) {
for (String filename : filenames) {
Iterable<String> filenameVariations = transform.apply(filename);
for (String filenameVariation : filenameVariations) {
File file = new File(parent, filenameVariation);
if (isValidResult(file)) {
return Optional.of(file);
}
}
}
}
return Optional.empty();
} | java | @Override
public Optional<File> which(Iterable<String> filenames) {
for (File parent : ImmutableList.copyOf(parents)) {
for (String filename : filenames) {
Iterable<String> filenameVariations = transform.apply(filename);
for (String filenameVariation : filenameVariations) {
File file = new File(parent, filenameVariation);
if (isValidResult(file)) {
return Optional.of(file);
}
}
}
}
return Optional.empty();
} | [
"@",
"Override",
"public",
"Optional",
"<",
"File",
">",
"which",
"(",
"Iterable",
"<",
"String",
">",
"filenames",
")",
"{",
"for",
"(",
"File",
"parent",
":",
"ImmutableList",
".",
"copyOf",
"(",
"parents",
")",
")",
"{",
"for",
"(",
"String",
"filen... | Returns the {@code File} object representing the pathname that is
the result of joining a parent pathname with the argument filename and
is valid for a given predicate. The predicate is checked with
{@link #isValidResult(java.io.File) }.
@param filenames the filenames to search for
@return the {@code File} object, or null if not found | [
"Returns",
"the",
"{"
] | train | https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/StandardWhicher.java#L58-L72 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/common/http/HttpInputStream.java | HttpInputStream.getResponseHeaderValue | public String getResponseHeaderValue(String name, String defaultVal) {
if (m_response.containsHeader(name)) {
return m_response.getFirstHeader(name).getValue();
} else {
return defaultVal;
}
} | java | public String getResponseHeaderValue(String name, String defaultVal) {
if (m_response.containsHeader(name)) {
return m_response.getFirstHeader(name).getValue();
} else {
return defaultVal;
}
} | [
"public",
"String",
"getResponseHeaderValue",
"(",
"String",
"name",
",",
"String",
"defaultVal",
")",
"{",
"if",
"(",
"m_response",
".",
"containsHeader",
"(",
"name",
")",
")",
"{",
"return",
"m_response",
".",
"getFirstHeader",
"(",
"name",
")",
".",
"get... | Return the first value of a header, or the default
if the fighter is not present
@param name the header name
@param defaultVal the default value
@return String | [
"Return",
"the",
"first",
"value",
"of",
"a",
"header",
"or",
"the",
"default",
"if",
"the",
"fighter",
"is",
"not",
"present"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/http/HttpInputStream.java#L101-L107 |
qatools/properties | src/main/java/ru/qatools/properties/PropertyLoader.java | PropertyLoader.checkRequired | protected void checkRequired(String key, AnnotatedElement element) {
if (isRequired(element)) {
throw new PropertyLoaderException(String.format("Required property <%s> doesn't exists", key));
}
} | java | protected void checkRequired(String key, AnnotatedElement element) {
if (isRequired(element)) {
throw new PropertyLoaderException(String.format("Required property <%s> doesn't exists", key));
}
} | [
"protected",
"void",
"checkRequired",
"(",
"String",
"key",
",",
"AnnotatedElement",
"element",
")",
"{",
"if",
"(",
"isRequired",
"(",
"element",
")",
")",
"{",
"throw",
"new",
"PropertyLoaderException",
"(",
"String",
".",
"format",
"(",
"\"Required property <... | Throws an exception if given element is required.
@see #isRequired(AnnotatedElement) | [
"Throws",
"an",
"exception",
"if",
"given",
"element",
"is",
"required",
"."
] | train | https://github.com/qatools/properties/blob/ae50b460a6bb4fcb21afe888b2e86a7613cd2115/src/main/java/ru/qatools/properties/PropertyLoader.java#L220-L224 |
toddfast/typeconverter | src/main/java/com/toddfast/util/convert/TypeConverter.java | TypeConverter.asString | public static String asString(Object value, String nullValue) {
value=convert(String.class,value);
return (value!=null)
? (String)value
: nullValue;
} | java | public static String asString(Object value, String nullValue) {
value=convert(String.class,value);
return (value!=null)
? (String)value
: nullValue;
} | [
"public",
"static",
"String",
"asString",
"(",
"Object",
"value",
",",
"String",
"nullValue",
")",
"{",
"value",
"=",
"convert",
"(",
"String",
".",
"class",
",",
"value",
")",
";",
"return",
"(",
"value",
"!=",
"null",
")",
"?",
"(",
"String",
")",
... | Return the value converted to a string
or the specified alternate value if the original value is null. Note,
this method still throws {@link IllegalArgumentException} if the value
is not null and could not be converted.
@param value
The value to be converted
@param nullValue
The value to be returned if {@link value} is null. Note, this
value will not be returned if the conversion fails otherwise.
@throws IllegalArgumentException
If the value cannot be converted | [
"Return",
"the",
"value",
"converted",
"to",
"a",
"string",
"or",
"the",
"specified",
"alternate",
"value",
"if",
"the",
"original",
"value",
"is",
"null",
".",
"Note",
"this",
"method",
"still",
"throws",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
... | train | https://github.com/toddfast/typeconverter/blob/44efa352254faa49edaba5c5935389705aa12b90/src/main/java/com/toddfast/util/convert/TypeConverter.java#L734-L739 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java | ImageIOGreyScale.getImageReadersBySuffix | public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) {
if (fileSuffix == null) {
throw new IllegalArgumentException("fileSuffix == null!");
}
// Ensure category is present
Iterator iter;
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | java | public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) {
if (fileSuffix == null) {
throw new IllegalArgumentException("fileSuffix == null!");
}
// Ensure category is present
Iterator iter;
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | [
"public",
"static",
"Iterator",
"<",
"ImageReader",
">",
"getImageReadersBySuffix",
"(",
"String",
"fileSuffix",
")",
"{",
"if",
"(",
"fileSuffix",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"fileSuffix == null!\"",
")",
";",
"}",
... | Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that
claim to be able to decode files with the given suffix.
@param fileSuffix
a <code>String</code> containing a file suffix (<i>e.g.</i>, "jpg" or "tiff").
@return an <code>Iterator</code> containing <code>ImageReader</code>s.
@exception IllegalArgumentException
if <code>fileSuffix</code> is <code>null</code>.
@see javax.imageio.spi.ImageReaderSpi#getFileSuffixes | [
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"containing",
"all",
"currently",
"registered",
"<code",
">",
"ImageReader<",
"/",
"code",
">",
"s",
"that",
"claim",
"to",
"be",
"able",
"to",
"decode",
"files",
"with",
"the",
"given",
"suffix... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L652-L664 |
VoltDB/voltdb | src/frontend/org/voltcore/agreement/RestrictedPriorityQueue.java | RestrictedPriorityQueue.gotFaultForInitiator | public void gotFaultForInitiator(long initiatorId) {
// calculate the next minimum transaction w/o our dead friend
noteTransactionRecievedAndReturnLastSeen(initiatorId, Long.MAX_VALUE, DtxnConstants.DUMMY_LAST_SEEN_TXN_ID);
// remove initiator from minimum. txnid scoreboard
LastInitiatorData remove = m_initiatorData.remove(initiatorId);
assert(remove != null);
} | java | public void gotFaultForInitiator(long initiatorId) {
// calculate the next minimum transaction w/o our dead friend
noteTransactionRecievedAndReturnLastSeen(initiatorId, Long.MAX_VALUE, DtxnConstants.DUMMY_LAST_SEEN_TXN_ID);
// remove initiator from minimum. txnid scoreboard
LastInitiatorData remove = m_initiatorData.remove(initiatorId);
assert(remove != null);
} | [
"public",
"void",
"gotFaultForInitiator",
"(",
"long",
"initiatorId",
")",
"{",
"// calculate the next minimum transaction w/o our dead friend",
"noteTransactionRecievedAndReturnLastSeen",
"(",
"initiatorId",
",",
"Long",
".",
"MAX_VALUE",
",",
"DtxnConstants",
".",
"DUMMY_LAST... | Remove all pending transactions from the specified initiator
and do not require heartbeats from that initiator to proceed.
@param initiatorId id of the failed initiator. | [
"Remove",
"all",
"pending",
"transactions",
"from",
"the",
"specified",
"initiator",
"and",
"do",
"not",
"require",
"heartbeats",
"from",
"that",
"initiator",
"to",
"proceed",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/RestrictedPriorityQueue.java#L195-L202 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java | AbstractMemberWriter.getSummaryTableTree | public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
} | java | public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
} | [
"public",
"Content",
"getSummaryTableTree",
"(",
"ClassDoc",
"classDoc",
",",
"List",
"<",
"Content",
">",
"tableContents",
")",
"{",
"return",
"writer",
".",
"getSummaryTableTree",
"(",
"this",
",",
"classDoc",
",",
"tableContents",
",",
"showTabs",
"(",
")",
... | Get the summary table tree for the given class.
@param classDoc the class for which the summary table is generated
@param tableContents list of contents to be displayed in the summary table
@return a content tree for the summary table | [
"Get",
"the",
"summary",
"table",
"tree",
"for",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java#L672-L674 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.coordinateFromColRow | public static Coordinate coordinateFromColRow( int col, int row, GridGeometry2D gridGeometry ) {
try {
GridCoordinates2D pos = new GridCoordinates2D(col, row);
DirectPosition gridToWorld = gridGeometry.gridToWorld(pos);
double[] coord = gridToWorld.getCoordinate();
return new Coordinate(coord[0], coord[1]);
} catch (InvalidGridGeometryException e) {
e.printStackTrace();
} catch (TransformException e) {
e.printStackTrace();
}
return null;
} | java | public static Coordinate coordinateFromColRow( int col, int row, GridGeometry2D gridGeometry ) {
try {
GridCoordinates2D pos = new GridCoordinates2D(col, row);
DirectPosition gridToWorld = gridGeometry.gridToWorld(pos);
double[] coord = gridToWorld.getCoordinate();
return new Coordinate(coord[0], coord[1]);
} catch (InvalidGridGeometryException e) {
e.printStackTrace();
} catch (TransformException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"Coordinate",
"coordinateFromColRow",
"(",
"int",
"col",
",",
"int",
"row",
",",
"GridGeometry2D",
"gridGeometry",
")",
"{",
"try",
"{",
"GridCoordinates2D",
"pos",
"=",
"new",
"GridCoordinates2D",
"(",
"col",
",",
"row",
")",
";",
"DirectP... | Utility method to get the coordinate of a col and row from a {@link GridGeometry2D}.
@param col the col to transform.
@param row the row to transform.
@param gridGeometry the gridgeometry to use.
@return the coordinate or <code>null</code> if something went wrong. | [
"Utility",
"method",
"to",
"get",
"the",
"coordinate",
"of",
"a",
"col",
"and",
"row",
"from",
"a",
"{",
"@link",
"GridGeometry2D",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1345-L1357 |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java | DOMJettyWebXmlParser.refObj | private Object refObj(Object obj, Element node) throws Exception {
String id = getAttribute(node, "id");
//CHECKSTYLE:OFF
obj = _idMap.get(id);
//CHECKSTYLE:ON
if (obj == null) {
throw new IllegalStateException("No object for id=" + id);
}
configure(obj, node, 0);
return obj;
} | java | private Object refObj(Object obj, Element node) throws Exception {
String id = getAttribute(node, "id");
//CHECKSTYLE:OFF
obj = _idMap.get(id);
//CHECKSTYLE:ON
if (obj == null) {
throw new IllegalStateException("No object for id=" + id);
}
configure(obj, node, 0);
return obj;
} | [
"private",
"Object",
"refObj",
"(",
"Object",
"obj",
",",
"Element",
"node",
")",
"throws",
"Exception",
"{",
"String",
"id",
"=",
"getAttribute",
"(",
"node",
",",
"\"id\"",
")",
";",
"//CHECKSTYLE:OFF",
"obj",
"=",
"_idMap",
".",
"get",
"(",
"id",
")",... | /*
Reference an id value object.
@param obj @param node @return @exception NoSuchMethodException
@exception ClassNotFoundException @exception InvocationTargetException | [
"/",
"*",
"Reference",
"an",
"id",
"value",
"object",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java#L573-L583 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.setElement | protected final void setElement(PriorityQueueNode node, int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)});
elements[pos] = node;
node.pos = pos;
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "setElement");
} | java | protected final void setElement(PriorityQueueNode node, int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)});
elements[pos] = node;
node.pos = pos;
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "setElement");
} | [
"protected",
"final",
"void",
"setElement",
"(",
"PriorityQueueNode",
"node",
",",
"int",
"pos",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"setElement\", new Object[] { node, new Integer(pos)});",
"elements",
"[",
"pos",
"]",
"=",
"node",
";",
"n... | Set an element in the queue.
@param node the element to place.
@param pos the position of the element. | [
"Set",
"an",
"element",
"in",
"the",
"queue",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L230-L240 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/gui/control/ConfigSettings.java | ConfigSettings.setConfigParameter | public void setConfigParameter(final ConfigurationKeys key, Object value)
{
// before setting parameter, check if paths have trailing File.separator
if (key == ConfigurationKeys.LOGGING_PATH_DEBUG
|| key == ConfigurationKeys.LOGGING_PATH_DIFFTOOL
|| key == ConfigurationKeys.PATH_OUTPUT_SQL_FILES) {
String v = (String) value;
// if we do not have a trailing file separator and the current
// path is compatible to the system that is running the config tool,
// then add a trailing separator
if (!v.endsWith(File.separator) && v.contains(File.separator)) {
value = v + File.separator;
}
}
this.parameterMap.put(key, value);
} | java | public void setConfigParameter(final ConfigurationKeys key, Object value)
{
// before setting parameter, check if paths have trailing File.separator
if (key == ConfigurationKeys.LOGGING_PATH_DEBUG
|| key == ConfigurationKeys.LOGGING_PATH_DIFFTOOL
|| key == ConfigurationKeys.PATH_OUTPUT_SQL_FILES) {
String v = (String) value;
// if we do not have a trailing file separator and the current
// path is compatible to the system that is running the config tool,
// then add a trailing separator
if (!v.endsWith(File.separator) && v.contains(File.separator)) {
value = v + File.separator;
}
}
this.parameterMap.put(key, value);
} | [
"public",
"void",
"setConfigParameter",
"(",
"final",
"ConfigurationKeys",
"key",
",",
"Object",
"value",
")",
"{",
"// before setting parameter, check if paths have trailing File.separator",
"if",
"(",
"key",
"==",
"ConfigurationKeys",
".",
"LOGGING_PATH_DEBUG",
"||",
"key... | Assigns the given value to the the given key.
@param key
configuration key
@param value
value | [
"Assigns",
"the",
"given",
"value",
"to",
"the",
"the",
"given",
"key",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/gui/control/ConfigSettings.java#L138-L155 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java | EventHubConnectionsInner.getAsync | public Observable<EventHubConnectionInner> getAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) {
return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<EventHubConnectionInner> getAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) {
return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventHubConnectionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"String",
"eventHubConnectionName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"re... | Returns an Event Hub connection.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param eventHubConnectionName The name of the event hub connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventHubConnectionInner object | [
"Returns",
"an",
"Event",
"Hub",
"connection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L341-L348 |
feroult/yawp | yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java | ResourceFinder.findAvailableImplementations | public List<Class> findAvailableImplementations(Class interfase) throws IOException {
resourcesNotLoaded.clear();
List<Class> implementations = new ArrayList<>();
List<String> strings = findAvailableStrings(interfase.getName());
for (String className : strings) {
try {
Class impl = classLoader.loadClass(className);
if (interfase.isAssignableFrom(impl)) {
implementations.add(impl);
} else {
resourcesNotLoaded.add(className);
}
} catch (Exception notAvailable) {
resourcesNotLoaded.add(className);
}
}
return implementations;
} | java | public List<Class> findAvailableImplementations(Class interfase) throws IOException {
resourcesNotLoaded.clear();
List<Class> implementations = new ArrayList<>();
List<String> strings = findAvailableStrings(interfase.getName());
for (String className : strings) {
try {
Class impl = classLoader.loadClass(className);
if (interfase.isAssignableFrom(impl)) {
implementations.add(impl);
} else {
resourcesNotLoaded.add(className);
}
} catch (Exception notAvailable) {
resourcesNotLoaded.add(className);
}
}
return implementations;
} | [
"public",
"List",
"<",
"Class",
">",
"findAvailableImplementations",
"(",
"Class",
"interfase",
")",
"throws",
"IOException",
"{",
"resourcesNotLoaded",
".",
"clear",
"(",
")",
";",
"List",
"<",
"Class",
">",
"implementations",
"=",
"new",
"ArrayList",
"<>",
"... | Assumes the class specified points to a file in the classpath that contains
the name of a class that implements or is a subclass of the specfied class.
<p/>
Any class that cannot be loaded or are not assignable to the specified class will be
skipped and placed in the 'resourcesNotLoaded' collection.
<p/>
Example classpath:
<p/>
META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream
META-INF/java.io.InputStream # contains the classname org.widget.NeatoInputStream
META-INF/java.io.InputStream # contains the classname com.foo.BarInputStream
<p/>
ResourceFinder finder = new ResourceFinder("META-INF/");
List classes = finder.findAllImplementations(java.io.InputStream.class);
classes.contains("org.acme.AcmeInputStream"); // true
classes.contains("org.widget.NeatoInputStream"); // true
classes.contains("com.foo.BarInputStream"); // true
@param interfase a superclass or interface
@return
@throws IOException if classLoader.getResources throws an exception | [
"Assumes",
"the",
"class",
"specified",
"points",
"to",
"a",
"file",
"in",
"the",
"classpath",
"that",
"contains",
"the",
"name",
"of",
"a",
"class",
"that",
"implements",
"or",
"is",
"a",
"subclass",
"of",
"the",
"specfied",
"class",
".",
"<p",
"/",
">"... | train | https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L532-L549 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.loadStaticField | public static InsnList loadStaticField(Field field) {
Validate.notNull(field);
Validate.isTrue((field.getModifiers() & Modifier.STATIC) != 0);
String owner = Type.getInternalName(field.getDeclaringClass());
String name = field.getName();
Type type = Type.getType(field.getType());
field.setAccessible(true);
InsnList ret = new InsnList();
switch (type.getSort()) {
case Type.BOOLEAN:
case Type.BYTE:
case Type.CHAR:
case Type.SHORT:
case Type.INT:
try {
ret.add(new LdcInsnNode(field.getInt(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.LONG:
try {
ret.add(new LdcInsnNode(field.getLong(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.FLOAT:
try {
ret.add(new LdcInsnNode(field.getFloat(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.DOUBLE:
try {
ret.add(new LdcInsnNode(field.getDouble(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.OBJECT:
case Type.ARRAY:
ret.add(new FieldInsnNode(Opcodes.GETSTATIC, owner, name, type.getDescriptor()));
break;
default:
throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid
// types aren't set
}
return ret;
} | java | public static InsnList loadStaticField(Field field) {
Validate.notNull(field);
Validate.isTrue((field.getModifiers() & Modifier.STATIC) != 0);
String owner = Type.getInternalName(field.getDeclaringClass());
String name = field.getName();
Type type = Type.getType(field.getType());
field.setAccessible(true);
InsnList ret = new InsnList();
switch (type.getSort()) {
case Type.BOOLEAN:
case Type.BYTE:
case Type.CHAR:
case Type.SHORT:
case Type.INT:
try {
ret.add(new LdcInsnNode(field.getInt(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.LONG:
try {
ret.add(new LdcInsnNode(field.getLong(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.FLOAT:
try {
ret.add(new LdcInsnNode(field.getFloat(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.DOUBLE:
try {
ret.add(new LdcInsnNode(field.getDouble(null)));
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae); // should never happen
}
break;
case Type.OBJECT:
case Type.ARRAY:
ret.add(new FieldInsnNode(Opcodes.GETSTATIC, owner, name, type.getDescriptor()));
break;
default:
throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid
// types aren't set
}
return ret;
} | [
"public",
"static",
"InsnList",
"loadStaticField",
"(",
"Field",
"field",
")",
"{",
"Validate",
".",
"notNull",
"(",
"field",
")",
";",
"Validate",
".",
"isTrue",
"(",
"(",
"field",
".",
"getModifiers",
"(",
")",
"&",
"Modifier",
".",
"STATIC",
")",
"!="... | Load a static field on to the stack. If the static field is of a primitive type, that primitive value will be directly loaded on to
the stack (the field won't be referenced). If the static field is an object type, the actual field will be loaded onto the stack.
@param field reflection reference to a static field
@return instructions to grab the object stored in the static field {@code field}
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if {@code field} is not static | [
"Load",
"a",
"static",
"field",
"on",
"to",
"the",
"stack",
".",
"If",
"the",
"static",
"field",
"is",
"of",
"a",
"primitive",
"type",
"that",
"primitive",
"value",
"will",
"be",
"directly",
"loaded",
"on",
"to",
"the",
"stack",
"(",
"the",
"field",
"w... | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L472-L526 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fn.java | Fn.sf | @Beta
public static <T, U, R> BiFunction<T, U, R> sf(final Object mutex, final BiFunction<T, U, R> biFunction) {
N.checkArgNotNull(mutex, "mutex");
N.checkArgNotNull(biFunction, "biFunction");
return new BiFunction<T, U, R>() {
@Override
public R apply(T t, U u) {
synchronized (mutex) {
return biFunction.apply(t, u);
}
}
};
} | java | @Beta
public static <T, U, R> BiFunction<T, U, R> sf(final Object mutex, final BiFunction<T, U, R> biFunction) {
N.checkArgNotNull(mutex, "mutex");
N.checkArgNotNull(biFunction, "biFunction");
return new BiFunction<T, U, R>() {
@Override
public R apply(T t, U u) {
synchronized (mutex) {
return biFunction.apply(t, u);
}
}
};
} | [
"@",
"Beta",
"public",
"static",
"<",
"T",
",",
"U",
",",
"R",
">",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"sf",
"(",
"final",
"Object",
"mutex",
",",
"final",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"biFunction",
")",
"{",
... | Synchronized {@code BiFunction}
@param mutex to synchronized on
@param biFunction
@return | [
"Synchronized",
"{",
"@code",
"BiFunction",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fn.java#L2953-L2966 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java | DateTimesHelper.toCalendar | public Calendar toCalendar(T dateTime, Locale locale) {
return toDateTime(dateTime).toCalendar(locale);
} | java | public Calendar toCalendar(T dateTime, Locale locale) {
return toDateTime(dateTime).toCalendar(locale);
} | [
"public",
"Calendar",
"toCalendar",
"(",
"T",
"dateTime",
",",
"Locale",
"locale",
")",
"{",
"return",
"toDateTime",
"(",
"dateTime",
")",
".",
"toCalendar",
"(",
"locale",
")",
";",
"}"
] | Gets a calendar for a {@code DateTime} in the supplied locale. | [
"Gets",
"a",
"calendar",
"for",
"a",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java#L184-L186 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java | ServerSecurityInterceptor.buildPolicyErrorMessage | private void buildPolicyErrorMessage(String msgKey, String defaultMessage, Object... arg1) {
/* The message need to be logged only for level below 'Warning' */
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
String messageFromBundle = Tr.formatMessage(tc, msgKey, arg1);
Tr.error(tc, messageFromBundle);
}
} | java | private void buildPolicyErrorMessage(String msgKey, String defaultMessage, Object... arg1) {
/* The message need to be logged only for level below 'Warning' */
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
String messageFromBundle = Tr.formatMessage(tc, msgKey, arg1);
Tr.error(tc, messageFromBundle);
}
} | [
"private",
"void",
"buildPolicyErrorMessage",
"(",
"String",
"msgKey",
",",
"String",
"defaultMessage",
",",
"Object",
"...",
"arg1",
")",
"{",
"/* The message need to be logged only for level below 'Warning' */",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"("... | Receives the message key like "CSIv2_COMMON_AUTH_LAYER_DISABLED"
from this key we extract the message from the NLS message bundle
which contains the message along with the CWWKS message code.
Example:
CSIv2_CLIENT_POLICY_DOESNT_EXIST_FAILED=CWWKS9568E: The client security policy does not exist.
@param msgCode | [
"Receives",
"the",
"message",
"key",
"like",
"CSIv2_COMMON_AUTH_LAYER_DISABLED",
"from",
"this",
"key",
"we",
"extract",
"the",
"message",
"from",
"the",
"NLS",
"message",
"bundle",
"which",
"contains",
"the",
"message",
"along",
"with",
"the",
"CWWKS",
"message",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java#L340-L346 |
twilio/twilio-java | src/main/java/com/twilio/rest/accounts/v1/credential/PublicKeyReader.java | PublicKeyReader.firstPage | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<PublicKey> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.ACCOUNTS.toString(),
"/v1/Credentials/PublicKeys",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | java | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<PublicKey> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.ACCOUNTS.toString(),
"/v1/Credentials/PublicKeys",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:linelength\"",
")",
"public",
"Page",
"<",
"PublicKey",
">",
"firstPage",
"(",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET... | Make the request to the Twilio API to perform the read.
@param client TwilioRestClient with which to make the request
@return PublicKey ResourceSet | [
"Make",
"the",
"request",
"to",
"the",
"Twilio",
"API",
"to",
"perform",
"the",
"read",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/accounts/v1/credential/PublicKeyReader.java#L40-L52 |
pawelprazak/java-extended | hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/IsThrowable.java | IsThrowable.withMessage | @Factory
public static <T extends Throwable> Matcher<T> withMessage(final Matcher<String> matcher) {
return new CustomTypeSafeMatcher<T>(CustomMatchers.fixedDescription("message ", matcher)) {
@Override
protected boolean matchesSafely(T item) {
return matcher.matches(item.getMessage());
}
public void describeMismatchSafely(T item, Description mismatchDescription) {
matcher.describeMismatch(item.getMessage(), mismatchDescription);
}
};
} | java | @Factory
public static <T extends Throwable> Matcher<T> withMessage(final Matcher<String> matcher) {
return new CustomTypeSafeMatcher<T>(CustomMatchers.fixedDescription("message ", matcher)) {
@Override
protected boolean matchesSafely(T item) {
return matcher.matches(item.getMessage());
}
public void describeMismatchSafely(T item, Description mismatchDescription) {
matcher.describeMismatch(item.getMessage(), mismatchDescription);
}
};
} | [
"@",
"Factory",
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"Matcher",
"<",
"T",
">",
"withMessage",
"(",
"final",
"Matcher",
"<",
"String",
">",
"matcher",
")",
"{",
"return",
"new",
"CustomTypeSafeMatcher",
"<",
"T",
">",
"(",
"CustomMatch... | Matches if value is a throwable with a message that matches the <tt>matcher</tt>
@param matcher message matcher
@param <T> the throwable type
@return the matcher | [
"Matches",
"if",
"value",
"is",
"a",
"throwable",
"with",
"a",
"message",
"that",
"matches",
"the",
"<tt",
">",
"matcher<",
"/",
"tt",
">"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/IsThrowable.java#L76-L88 |
petrbouda/joyrest | joyrest-core/src/main/java/org/joyrest/context/ApplicationContextImpl.java | ApplicationContextImpl.setExceptionHandlers | public void setExceptionHandlers(Map<Class<? extends Exception>, InternalExceptionHandler> handlers) {
requireNonNull(handlers);
this.exceptionHandlers = handlers;
} | java | public void setExceptionHandlers(Map<Class<? extends Exception>, InternalExceptionHandler> handlers) {
requireNonNull(handlers);
this.exceptionHandlers = handlers;
} | [
"public",
"void",
"setExceptionHandlers",
"(",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Exception",
">",
",",
"InternalExceptionHandler",
">",
"handlers",
")",
"{",
"requireNonNull",
"(",
"handlers",
")",
";",
"this",
".",
"exceptionHandlers",
"=",
"handlers",... | Adds a map of {@link ExceptionHandler} into the application
@param handlers configurations which keep given handlers | [
"Adds",
"a",
"map",
"of",
"{",
"@link",
"ExceptionHandler",
"}",
"into",
"the",
"application"
] | train | https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/context/ApplicationContextImpl.java#L64-L67 |
kite-sdk/kite | kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/com/google/common/reflect/FluentIterable.java | FluentIterable.transform | public final <T> FluentIterable<T> transform(Function<? super E, T> function) {
return from(Iterables.transform(iterable, function));
} | java | public final <T> FluentIterable<T> transform(Function<? super E, T> function) {
return from(Iterables.transform(iterable, function));
} | [
"public",
"final",
"<",
"T",
">",
"FluentIterable",
"<",
"T",
">",
"transform",
"(",
"Function",
"<",
"?",
"super",
"E",
",",
"T",
">",
"function",
")",
"{",
"return",
"from",
"(",
"Iterables",
".",
"transform",
"(",
"iterable",
",",
"function",
")",
... | Returns a fluent iterable that applies {@code function} to each element of this
fluent iterable.
<p>The returned fluent iterable's iterator supports {@code remove()} if this iterable's
iterator does. After a successful {@code remove()} call, this fluent iterable no longer
contains the corresponding element. | [
"Returns",
"a",
"fluent",
"iterable",
"that",
"applies",
"{",
"@code",
"function",
"}",
"to",
"each",
"element",
"of",
"this",
"fluent",
"iterable",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/com/google/common/reflect/FluentIterable.java#L203-L205 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.cloneExplorerTypeIcons | private void cloneExplorerTypeIcons(Map<String, String> iconPaths) throws CmsException {
for (Map.Entry<String, String> entry : iconPaths.entrySet()) {
String source = ICON_PATH + entry.getKey();
String target = ICON_PATH + entry.getValue();
if (getCms().existsResource(source) && !getCms().existsResource(target)) {
getCms().copyResource(source, target);
}
}
} | java | private void cloneExplorerTypeIcons(Map<String, String> iconPaths) throws CmsException {
for (Map.Entry<String, String> entry : iconPaths.entrySet()) {
String source = ICON_PATH + entry.getKey();
String target = ICON_PATH + entry.getValue();
if (getCms().existsResource(source) && !getCms().existsResource(target)) {
getCms().copyResource(source, target);
}
}
} | [
"private",
"void",
"cloneExplorerTypeIcons",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"iconPaths",
")",
"throws",
"CmsException",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"iconPaths",
".",
"entrySet",
"("... | Copies the explorer type icons.<p>
@param iconPaths the path to the location where the icons are located
@throws CmsException if something goes wrong | [
"Copies",
"the",
"explorer",
"type",
"icons",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L539-L548 |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java | SphericalUtil.computeAngleBetween | static double computeAngleBetween(IGeoPoint from, IGeoPoint to) {
return distanceRadians(toRadians(from.getLatitude()), toRadians(from.getLongitude()),
toRadians(to.getLatitude()), toRadians(to.getLongitude()));
} | java | static double computeAngleBetween(IGeoPoint from, IGeoPoint to) {
return distanceRadians(toRadians(from.getLatitude()), toRadians(from.getLongitude()),
toRadians(to.getLatitude()), toRadians(to.getLongitude()));
} | [
"static",
"double",
"computeAngleBetween",
"(",
"IGeoPoint",
"from",
",",
"IGeoPoint",
"to",
")",
"{",
"return",
"distanceRadians",
"(",
"toRadians",
"(",
"from",
".",
"getLatitude",
"(",
")",
")",
",",
"toRadians",
"(",
"from",
".",
"getLongitude",
"(",
")"... | Returns the angle between two IGeoPoints, in radians. This is the same as the distance
on the unit sphere. | [
"Returns",
"the",
"angle",
"between",
"two",
"IGeoPoints",
"in",
"radians",
".",
"This",
"is",
"the",
"same",
"as",
"the",
"distance",
"on",
"the",
"unit",
"sphere",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L265-L268 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/DefaultConfidentialStore.java | DefaultConfidentialStore.load | @Override
protected byte[] load(ConfidentialKey key) throws IOException {
try {
File f = getFileFor(key);
if (!f.exists()) return null;
Cipher sym = Secret.getCipher("AES");
sym.init(Cipher.DECRYPT_MODE, masterKey);
try (InputStream fis=Files.newInputStream(f.toPath());
CipherInputStream cis = new CipherInputStream(fis, sym)) {
byte[] bytes = IOUtils.toByteArray(cis);
return verifyMagic(bytes);
}
} catch (GeneralSecurityException e) {
throw new IOException("Failed to load the key: "+key.getId(),e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (IOException x) {
if (x.getCause() instanceof BadPaddingException) {
return null; // broken somehow
} else {
throw x;
}
}
} | java | @Override
protected byte[] load(ConfidentialKey key) throws IOException {
try {
File f = getFileFor(key);
if (!f.exists()) return null;
Cipher sym = Secret.getCipher("AES");
sym.init(Cipher.DECRYPT_MODE, masterKey);
try (InputStream fis=Files.newInputStream(f.toPath());
CipherInputStream cis = new CipherInputStream(fis, sym)) {
byte[] bytes = IOUtils.toByteArray(cis);
return verifyMagic(bytes);
}
} catch (GeneralSecurityException e) {
throw new IOException("Failed to load the key: "+key.getId(),e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (IOException x) {
if (x.getCause() instanceof BadPaddingException) {
return null; // broken somehow
} else {
throw x;
}
}
} | [
"@",
"Override",
"protected",
"byte",
"[",
"]",
"load",
"(",
"ConfidentialKey",
"key",
")",
"throws",
"IOException",
"{",
"try",
"{",
"File",
"f",
"=",
"getFileFor",
"(",
"key",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"return",
... | Reverse operation of {@link #store(ConfidentialKey, byte[])}
@return
null the data has not been previously persisted. | [
"Reverse",
"operation",
"of",
"{",
"@link",
"#store",
"(",
"ConfidentialKey",
"byte",
"[]",
")",
"}"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/DefaultConfidentialStore.java#L97-L121 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java | SecurityRulesInner.listAsync | public Observable<Page<SecurityRuleInner>> listAsync(final String resourceGroupName, final String networkSecurityGroupName) {
return listWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName)
.map(new Func1<ServiceResponse<Page<SecurityRuleInner>>, Page<SecurityRuleInner>>() {
@Override
public Page<SecurityRuleInner> call(ServiceResponse<Page<SecurityRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SecurityRuleInner>> listAsync(final String resourceGroupName, final String networkSecurityGroupName) {
return listWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName)
.map(new Func1<ServiceResponse<Page<SecurityRuleInner>>, Page<SecurityRuleInner>>() {
@Override
public Page<SecurityRuleInner> call(ServiceResponse<Page<SecurityRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SecurityRuleInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"networkSecurityGroupName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"n... | Gets all security rules in a network security group.
@param resourceGroupName The name of the resource group.
@param networkSecurityGroupName The name of the network security group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SecurityRuleInner> object | [
"Gets",
"all",
"security",
"rules",
"in",
"a",
"network",
"security",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java#L581-L589 |
jaxio/javaee-lab | javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java | GenericRepository.findUniqueOrNone | @Transactional
public E findUniqueOrNone(E entity, SearchParameters sp) {
// this code is an optimization to prevent using a count
sp.setFirst(0);
sp.setMaxResults(2);
List<E> results = find(entity, sp);
if (results == null || results.isEmpty()) {
return null;
} else if (results.size() > 1) {
throw new NonUniqueResultException("Developper: You expected 1 result but we found more ! sample: " + entity);
} else {
return results.iterator().next();
}
} | java | @Transactional
public E findUniqueOrNone(E entity, SearchParameters sp) {
// this code is an optimization to prevent using a count
sp.setFirst(0);
sp.setMaxResults(2);
List<E> results = find(entity, sp);
if (results == null || results.isEmpty()) {
return null;
} else if (results.size() > 1) {
throw new NonUniqueResultException("Developper: You expected 1 result but we found more ! sample: " + entity);
} else {
return results.iterator().next();
}
} | [
"@",
"Transactional",
"public",
"E",
"findUniqueOrNone",
"(",
"E",
"entity",
",",
"SearchParameters",
"sp",
")",
"{",
"// this code is an optimization to prevent using a count",
"sp",
".",
"setFirst",
"(",
"0",
")",
";",
"sp",
".",
"setMaxResults",
"(",
"2",
")",
... | /*
We request at most 2, if there's more than one then we throw a {@link javax.persistence.NonUniqueResultException}
@throws javax.persistence.NonUniqueResultException | [
"/",
"*",
"We",
"request",
"at",
"most",
"2",
"if",
"there",
"s",
"more",
"than",
"one",
"then",
"we",
"throw",
"a",
"{",
"@link",
"javax",
".",
"persistence",
".",
"NonUniqueResultException",
"}"
] | train | https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L469-L483 |
lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.when | public JsonUnitResultMatchers when(Option firstOption, Option... otherOptions) {
return new JsonUnitResultMatchers(path, configuration.withOptions(firstOption, otherOptions));
} | java | public JsonUnitResultMatchers when(Option firstOption, Option... otherOptions) {
return new JsonUnitResultMatchers(path, configuration.withOptions(firstOption, otherOptions));
} | [
"public",
"JsonUnitResultMatchers",
"when",
"(",
"Option",
"firstOption",
",",
"Option",
"...",
"otherOptions",
")",
"{",
"return",
"new",
"JsonUnitResultMatchers",
"(",
"path",
",",
"configuration",
".",
"withOptions",
"(",
"firstOption",
",",
"otherOptions",
")",
... | Sets options changing comparison behavior. For more
details see {@link net.javacrumbs.jsonunit.core.Option}
@see net.javacrumbs.jsonunit.core.Option | [
"Sets",
"options",
"changing",
"comparison",
"behavior",
".",
"For",
"more",
"details",
"see",
"{",
"@link",
"net",
".",
"javacrumbs",
".",
"jsonunit",
".",
"core",
".",
"Option",
"}"
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L276-L278 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CoffeeScriptCompilerMojo.java | CoffeeScriptCompilerMojo.execute | @Override
public void execute() throws MojoExecutionException {
coffee = npm(this, COFFEE_SCRIPT_NPM_NAME, coffeeScriptVersion);
try {
if (getInternalAssetsDirectory().isDirectory()) {
getLog().info("Compiling CoffeeScript files from " + getInternalAssetsDirectory().getAbsolutePath());
invokeCoffeeScriptCompiler(getInternalAssetsDirectory(), getInternalAssetOutputDirectory());
}
if (getExternalAssetsDirectory().isDirectory()) {
getLog().info("Compiling CoffeeScript files from " + getExternalAssetsDirectory().getAbsolutePath());
invokeCoffeeScriptCompiler(getExternalAssetsDirectory(), getExternalAssetsOutputDirectory());
}
} catch (WatchingException e) {
throw new MojoExecutionException("Error during the CoffeeScript compilation", e);
}
} | java | @Override
public void execute() throws MojoExecutionException {
coffee = npm(this, COFFEE_SCRIPT_NPM_NAME, coffeeScriptVersion);
try {
if (getInternalAssetsDirectory().isDirectory()) {
getLog().info("Compiling CoffeeScript files from " + getInternalAssetsDirectory().getAbsolutePath());
invokeCoffeeScriptCompiler(getInternalAssetsDirectory(), getInternalAssetOutputDirectory());
}
if (getExternalAssetsDirectory().isDirectory()) {
getLog().info("Compiling CoffeeScript files from " + getExternalAssetsDirectory().getAbsolutePath());
invokeCoffeeScriptCompiler(getExternalAssetsDirectory(), getExternalAssetsOutputDirectory());
}
} catch (WatchingException e) {
throw new MojoExecutionException("Error during the CoffeeScript compilation", e);
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"coffee",
"=",
"npm",
"(",
"this",
",",
"COFFEE_SCRIPT_NPM_NAME",
",",
"coffeeScriptVersion",
")",
";",
"try",
"{",
"if",
"(",
"getInternalAssetsDirectory",
"(",
")"... | Finds and compiles coffeescript files.
@throws MojoExecutionException if the compilation failed. | [
"Finds",
"and",
"compiles",
"coffeescript",
"files",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CoffeeScriptCompilerMojo.java#L72-L91 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsModelGroupHelper.java | CmsModelGroupHelper.createModelGroup | public static CmsResource createModelGroup(CmsObject cms, CmsADEConfigData configData) throws CmsException {
CmsResourceTypeConfig typeConfig = configData.getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
return typeConfig.createNewElement(cms, configData.getBasePath());
} | java | public static CmsResource createModelGroup(CmsObject cms, CmsADEConfigData configData) throws CmsException {
CmsResourceTypeConfig typeConfig = configData.getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
return typeConfig.createNewElement(cms, configData.getBasePath());
} | [
"public",
"static",
"CmsResource",
"createModelGroup",
"(",
"CmsObject",
"cms",
",",
"CmsADEConfigData",
"configData",
")",
"throws",
"CmsException",
"{",
"CmsResourceTypeConfig",
"typeConfig",
"=",
"configData",
".",
"getResourceType",
"(",
"CmsResourceTypeXmlContainerPage... | Creates a new model group resource.<p>
@param cms the current cms context
@param configData the configuration data
@return the new resource
@throws CmsException in case creating the resource fails | [
"Creates",
"a",
"new",
"model",
"group",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsModelGroupHelper.java#L133-L138 |
Harium/keel | src/main/java/jdt/triangulation/DelaunayTriangulation.java | DelaunayTriangulation.findConnectedTriangles | private List<Triangle> findConnectedTriangles(Vector3 point) {
// Getting one of the neigh
Triangle triangle = find(point);
// Validating find results.
if (!triangle.isCorner(point)) {
System.err.println("findConnectedTriangles: Could not find connected vertices since the first found triangle doesn't" +
" share the given point.");
return null;
}
return findTriangleNeighborhood(triangle, point);
} | java | private List<Triangle> findConnectedTriangles(Vector3 point) {
// Getting one of the neigh
Triangle triangle = find(point);
// Validating find results.
if (!triangle.isCorner(point)) {
System.err.println("findConnectedTriangles: Could not find connected vertices since the first found triangle doesn't" +
" share the given point.");
return null;
}
return findTriangleNeighborhood(triangle, point);
} | [
"private",
"List",
"<",
"Triangle",
">",
"findConnectedTriangles",
"(",
"Vector3",
"point",
")",
"{",
"// Getting one of the neigh\r",
"Triangle",
"triangle",
"=",
"find",
"(",
"point",
")",
";",
"// Validating find results.\r",
"if",
"(",
"!",
"triangle",
".",
"i... | /*
Receives a point and returns all the points of the triangles that
shares point as a corner (Connected vertices to this point).
By Doron Ganel & Eyal Roth | [
"/",
"*",
"Receives",
"a",
"point",
"and",
"returns",
"all",
"the",
"points",
"of",
"the",
"triangles",
"that",
"shares",
"point",
"as",
"a",
"corner",
"(",
"Connected",
"vertices",
"to",
"this",
"point",
")",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L1130-L1143 |
JCTools/JCTools | jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicArrayQueueGenerator.java | JavaParsingAtomicArrayQueueGenerator.processSpecialNodeTypes | void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
Type type = node.getType();
if ("buffer".equals(name) && isRefArray(type, "E")) {
node.setType(atomicRefArrayType((ArrayType) type));
} else if ("sBuffer".equals(name) && isLongArray(type)) {
node.setType(atomicLongArrayType());
} else if (PrimitiveType.longType().equals(type)) {
switch(name) {
case "mask":
case "offset":
case "seqOffset":
case "lookAheadSeqOffset":
case "lookAheadElementOffset":
node.setType(PrimitiveType.intType());
}
}
} | java | void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
Type type = node.getType();
if ("buffer".equals(name) && isRefArray(type, "E")) {
node.setType(atomicRefArrayType((ArrayType) type));
} else if ("sBuffer".equals(name) && isLongArray(type)) {
node.setType(atomicLongArrayType());
} else if (PrimitiveType.longType().equals(type)) {
switch(name) {
case "mask":
case "offset":
case "seqOffset":
case "lookAheadSeqOffset":
case "lookAheadElementOffset":
node.setType(PrimitiveType.intType());
}
}
} | [
"void",
"processSpecialNodeTypes",
"(",
"NodeWithType",
"<",
"?",
",",
"Type",
">",
"node",
",",
"String",
"name",
")",
"{",
"Type",
"type",
"=",
"node",
".",
"getType",
"(",
")",
";",
"if",
"(",
"\"buffer\"",
".",
"equals",
"(",
"name",
")",
"&&",
"... | Given a variable declaration of some sort, check it's name and type and
if it looks like any of the key type changes between unsafe and atomic
queues, perform the conversion to change it's type.
@param node
@param name | [
"Given",
"a",
"variable",
"declaration",
"of",
"some",
"sort",
"check",
"it",
"s",
"name",
"and",
"type",
"and",
"if",
"it",
"looks",
"like",
"any",
"of",
"the",
"key",
"type",
"changes",
"between",
"unsafe",
"and",
"atomic",
"queues",
"perform",
"the",
... | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicArrayQueueGenerator.java#L132-L148 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.checkIfPowerOf2 | public static void checkIfPowerOf2(final int v, final String argName) {
if ((v > 0) && ((v & (v - 1)) == 0)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
} | java | public static void checkIfPowerOf2(final int v, final String argName) {
if ((v > 0) && ((v & (v - 1)) == 0)) {
return;
}
throw new SketchesArgumentException("The value of the parameter \"" + argName
+ "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
} | [
"public",
"static",
"void",
"checkIfPowerOf2",
"(",
"final",
"int",
"v",
",",
"final",
"String",
"argName",
")",
"{",
"if",
"(",
"(",
"v",
">",
"0",
")",
"&&",
"(",
"(",
"v",
"&",
"(",
"v",
"-",
"1",
")",
")",
"==",
"0",
")",
")",
"{",
"retur... | Checks the given parameter to make sure it is positive, an integer-power of 2 and greater than
zero.
@param v The input argument.
@param argName Used in the thrown exception. | [
"Checks",
"the",
"given",
"parameter",
"to",
"make",
"sure",
"it",
"is",
"positive",
"an",
"integer",
"-",
"power",
"of",
"2",
"and",
"greater",
"than",
"zero",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L366-L372 |
markushi/android-ui | src/main/java/at/markushi/ui/ActionView.java | ActionView.setAction | public void setAction(final Action fromAction, final Action toAction, final int rotation, long delay) {
setAction(fromAction, false, ROTATE_CLOCKWISE);
postDelayed(new Runnable() {
@Override
public void run() {
if (!isAttachedToWindow()) {
return;
}
setAction(toAction, true, rotation);
}
}, delay);
} | java | public void setAction(final Action fromAction, final Action toAction, final int rotation, long delay) {
setAction(fromAction, false, ROTATE_CLOCKWISE);
postDelayed(new Runnable() {
@Override
public void run() {
if (!isAttachedToWindow()) {
return;
}
setAction(toAction, true, rotation);
}
}, delay);
} | [
"public",
"void",
"setAction",
"(",
"final",
"Action",
"fromAction",
",",
"final",
"Action",
"toAction",
",",
"final",
"int",
"rotation",
",",
"long",
"delay",
")",
"{",
"setAction",
"(",
"fromAction",
",",
"false",
",",
"ROTATE_CLOCKWISE",
")",
";",
"postDe... | Sets a new action transition.
@param fromAction The initial action.
@param toAction The target action.
@param rotation The rotation direction used for the transition {@link #ROTATE_CLOCKWISE} or {@link #ROTATE_COUNTER_CLOCKWISE}.
@param delay The delay in ms before the transition is started. | [
"Sets",
"a",
"new",
"action",
"transition",
"."
] | train | https://github.com/markushi/android-ui/blob/a589fad7b74ace063c2b0e90741d43225b200a18/src/main/java/at/markushi/ui/ActionView.java#L215-L226 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, String localeName){
return getBundleInstance(baseName, localeName, ICUResourceBundle.ICU_DATA_CLASS_LOADER,
false);
} | java | public static UResourceBundle getBundleInstance(String baseName, String localeName){
return getBundleInstance(baseName, localeName, ICUResourceBundle.ICU_DATA_CLASS_LOADER,
false);
} | [
"public",
"static",
"UResourceBundle",
"getBundleInstance",
"(",
"String",
"baseName",
",",
"String",
"localeName",
")",
"{",
"return",
"getBundleInstance",
"(",
"baseName",
",",
"localeName",
",",
"ICUResourceBundle",
".",
"ICU_DATA_CLASS_LOADER",
",",
"false",
")",
... | <strong>[icu]</strong> Creates a resource bundle using the specified base name and locale.
ICU_DATA_CLASS is used as the default root.
@param baseName string containing the name of the data package.
If null the default ICU package name is used.
@param localeName the locale for which a resource bundle is desired
@throws MissingResourceException If no resource bundle for the specified base name
can be found
@return a resource bundle for the given base name and locale | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Creates",
"a",
"resource",
"bundle",
"using",
"the",
"specified",
"base",
"name",
"and",
"locale",
".",
"ICU_DATA_CLASS",
"is",
"used",
"as",
"the",
"default",
"root",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L109-L112 |
alkacon/opencms-core | src/org/opencms/file/CmsProperty.java | CmsProperty.getLocalizedKey | public static String getLocalizedKey(Map<String, ?> propertiesMap, String key, Locale locale) {
List<String> localizedKeys = CmsLocaleManager.getLocaleVariants(key, locale, true, false);
for (String localizedKey : localizedKeys) {
if (propertiesMap.containsKey(localizedKey)) {
return localizedKey;
}
}
return key;
} | java | public static String getLocalizedKey(Map<String, ?> propertiesMap, String key, Locale locale) {
List<String> localizedKeys = CmsLocaleManager.getLocaleVariants(key, locale, true, false);
for (String localizedKey : localizedKeys) {
if (propertiesMap.containsKey(localizedKey)) {
return localizedKey;
}
}
return key;
} | [
"public",
"static",
"String",
"getLocalizedKey",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"propertiesMap",
",",
"String",
"key",
",",
"Locale",
"locale",
")",
"{",
"List",
"<",
"String",
">",
"localizedKeys",
"=",
"CmsLocaleManager",
".",
"getLocaleVariants",... | Returns the key for the best matching local-specific property version.
@param propertiesMap the "raw" property map
@param key the name of the property to search for
@param locale the locale to search for
@return the key for the best matching local-specific property version. | [
"Returns",
"the",
"key",
"for",
"the",
"best",
"matching",
"local",
"-",
"specific",
"property",
"version",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProperty.java#L328-L337 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java | ConfigurationImpl.getContent | @Override
public Content getContent(String key, Object o1, Object o2) {
return contents.getContent(key, o1, o2);
} | java | @Override
public Content getContent(String key, Object o1, Object o2) {
return contents.getContent(key, o1, o2);
} | [
"@",
"Override",
"public",
"Content",
"getContent",
"(",
"String",
"key",
",",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"return",
"contents",
".",
"getContent",
"(",
"key",
",",
"o1",
",",
"o2",
")",
";",
"}"
] | Get the configuration string as a content.
@param key the key to look for in the configuration file
@param o1 resource argument
@param o2 resource argument
@return a content tree for the text | [
"Get",
"the",
"configuration",
"string",
"as",
"a",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java#L501-L504 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ReferenceStreamLink.java | ReferenceStreamLink.addReference | public final void addReference(ItemReference reference, long lockID, Transaction transaction) throws OutOfCacheSpace, ProtocolException, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addReference", new Object[] { reference, transaction});
_references();
final MessageStoreImpl messageStore = getMessageStoreImpl();
int strategy = reference.getStorageStrategy();
final long itemID = messageStore.getUniqueValue(strategy);
TupleTypeEnum type = TupleTypeEnum.ITEM_REFERENCE;
reference.setSizeRefsByMsgSize(messageStore.getJdbcSpillSizeMsgRefsByMsgSize()); // PK57207
Persistable childPersistable = getTuple().createPersistable(itemID, type);
final AbstractItemLink link = new ItemReferenceLink(reference, this, childPersistable);
// Defect 463642
// Revert to using spill limits previously removed in SIB0112d.ms.2
link.setParentWasSpillingAtAddTime(getListStatistics().isSpilling());
messageStore.registerLink(link, reference);
link.cmdAdd(this, lockID, (PersistentTransaction)transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addReference");
} | java | public final void addReference(ItemReference reference, long lockID, Transaction transaction) throws OutOfCacheSpace, ProtocolException, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addReference", new Object[] { reference, transaction});
_references();
final MessageStoreImpl messageStore = getMessageStoreImpl();
int strategy = reference.getStorageStrategy();
final long itemID = messageStore.getUniqueValue(strategy);
TupleTypeEnum type = TupleTypeEnum.ITEM_REFERENCE;
reference.setSizeRefsByMsgSize(messageStore.getJdbcSpillSizeMsgRefsByMsgSize()); // PK57207
Persistable childPersistable = getTuple().createPersistable(itemID, type);
final AbstractItemLink link = new ItemReferenceLink(reference, this, childPersistable);
// Defect 463642
// Revert to using spill limits previously removed in SIB0112d.ms.2
link.setParentWasSpillingAtAddTime(getListStatistics().isSpilling());
messageStore.registerLink(link, reference);
link.cmdAdd(this, lockID, (PersistentTransaction)transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addReference");
} | [
"public",
"final",
"void",
"addReference",
"(",
"ItemReference",
"reference",
",",
"long",
"lockID",
",",
"Transaction",
"transaction",
")",
"throws",
"OutOfCacheSpace",
",",
"ProtocolException",
",",
"StreamIsFull",
",",
"TransactionException",
",",
"PersistenceExcepti... | @see com.ibm.ws.sib.msgstore.ItemCollection#addReference(com.ibm.ws.sib.msgstore.ItemReference, com.ibm.ws.sib.msgstore.transactions.Transaction)
@throws OutOfCacheSpace if there is not enough space in the
unstoredCache and the storage strategy is AbstractItem.STORE_NEVER.
@throws StreamIsFull if the size of the stream would exceed the
maximum permissable size if an add were performed.
@throws SevereMessageStoreException
@throws {@ProtocolException} Thrown if an add is attempted when the
transaction cannot allow any further work to be added i.e. after
completion of the transaction.
@throws {@TransactionException} Thrown if an unexpected error occurs. | [
"@see",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".",
"ItemCollection#addReference",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".",
"ItemReference",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ReferenceStreamLink.java#L189-L208 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.sendAndCloseNoEntityBodyResp | public static void sendAndCloseNoEntityBodyResp(ChannelHandlerContext ctx, HttpResponseStatus status,
HttpVersion httpVersion, String serverName) {
HttpResponse outboundResponse = new DefaultHttpResponse(httpVersion, status);
outboundResponse.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
outboundResponse.headers().set(HttpHeaderNames.CONNECTION.toString(), Constants.CONNECTION_CLOSE);
outboundResponse.headers().set(HttpHeaderNames.SERVER.toString(), serverName);
ChannelFuture outboundRespFuture = ctx.channel().writeAndFlush(outboundResponse);
outboundRespFuture.addListener(
(ChannelFutureListener) channelFuture -> LOG.warn("Failed to send {}", status.reasonPhrase()));
ctx.channel().close();
} | java | public static void sendAndCloseNoEntityBodyResp(ChannelHandlerContext ctx, HttpResponseStatus status,
HttpVersion httpVersion, String serverName) {
HttpResponse outboundResponse = new DefaultHttpResponse(httpVersion, status);
outboundResponse.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
outboundResponse.headers().set(HttpHeaderNames.CONNECTION.toString(), Constants.CONNECTION_CLOSE);
outboundResponse.headers().set(HttpHeaderNames.SERVER.toString(), serverName);
ChannelFuture outboundRespFuture = ctx.channel().writeAndFlush(outboundResponse);
outboundRespFuture.addListener(
(ChannelFutureListener) channelFuture -> LOG.warn("Failed to send {}", status.reasonPhrase()));
ctx.channel().close();
} | [
"public",
"static",
"void",
"sendAndCloseNoEntityBodyResp",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpResponseStatus",
"status",
",",
"HttpVersion",
"httpVersion",
",",
"String",
"serverName",
")",
"{",
"HttpResponse",
"outboundResponse",
"=",
"new",
"DefaultHttpResp... | Send back no entity body response and close the connection. This function is mostly used
when we send back error messages.
@param ctx connection
@param status response status
@param httpVersion of the response
@param serverName server name | [
"Send",
"back",
"no",
"entity",
"body",
"response",
"and",
"close",
"the",
"connection",
".",
"This",
"function",
"is",
"mostly",
"used",
"when",
"we",
"send",
"back",
"error",
"messages",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L612-L622 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/networking/nio/SelectorOptimizer.java | SelectorOptimizer.newSelector | static Selector newSelector(ILogger logger) {
checkNotNull(logger, "logger");
Selector selector;
try {
selector = Selector.open();
} catch (IOException e) {
throw new HazelcastException("Failed to open a Selector", e);
}
boolean optimize = Boolean.parseBoolean(System.getProperty("hazelcast.io.optimizeselector", "true"));
if (optimize) {
optimize(selector, logger);
}
return selector;
} | java | static Selector newSelector(ILogger logger) {
checkNotNull(logger, "logger");
Selector selector;
try {
selector = Selector.open();
} catch (IOException e) {
throw new HazelcastException("Failed to open a Selector", e);
}
boolean optimize = Boolean.parseBoolean(System.getProperty("hazelcast.io.optimizeselector", "true"));
if (optimize) {
optimize(selector, logger);
}
return selector;
} | [
"static",
"Selector",
"newSelector",
"(",
"ILogger",
"logger",
")",
"{",
"checkNotNull",
"(",
"logger",
",",
"\"logger\"",
")",
";",
"Selector",
"selector",
";",
"try",
"{",
"selector",
"=",
"Selector",
".",
"open",
"(",
")",
";",
"}",
"catch",
"(",
"IOE... | Creates a new Selector and will optimize it if possible.
@param logger the logger used for the optimization process.
@return the created Selector.
@throws NullPointerException if logger is null. | [
"Creates",
"a",
"new",
"Selector",
"and",
"will",
"optimize",
"it",
"if",
"possible",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/SelectorOptimizer.java#L55-L70 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseXcsrgemmNnz | public static int cusparseXcsrgemmNnz(
cusparseHandle handle,
int transA,
int transB,
int m,
int n,
int k,
cusparseMatDescr descrA,
int nnzA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseMatDescr descrB,
int nnzB,
Pointer csrSortedRowPtrB,
Pointer csrSortedColIndB,
cusparseMatDescr descrC,
Pointer csrSortedRowPtrC,
Pointer nnzTotalDevHostPtr)
{
return checkResult(cusparseXcsrgemmNnzNative(handle, transA, transB, m, n, k, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr));
} | java | public static int cusparseXcsrgemmNnz(
cusparseHandle handle,
int transA,
int transB,
int m,
int n,
int k,
cusparseMatDescr descrA,
int nnzA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseMatDescr descrB,
int nnzB,
Pointer csrSortedRowPtrB,
Pointer csrSortedColIndB,
cusparseMatDescr descrC,
Pointer csrSortedRowPtrC,
Pointer nnzTotalDevHostPtr)
{
return checkResult(cusparseXcsrgemmNnzNative(handle, transA, transB, m, n, k, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr));
} | [
"public",
"static",
"int",
"cusparseXcsrgemmNnz",
"(",
"cusparseHandle",
"handle",
",",
"int",
"transA",
",",
"int",
"transB",
",",
"int",
"m",
",",
"int",
"n",
",",
"int",
"k",
",",
"cusparseMatDescr",
"descrA",
",",
"int",
"nnzA",
",",
"Pointer",
"csrSor... | Description: Compute sparse - sparse matrix multiplication for matrices
stored in CSR format. | [
"Description",
":",
"Compute",
"sparse",
"-",
"sparse",
"matrix",
"multiplication",
"for",
"matrices",
"stored",
"in",
"CSR",
"format",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L9354-L9374 |
nakamura5akihito/six-util | src/main/java/jp/go/aist/six/util/core/web/spring/SpringHttpClientImpl.java | SpringHttpClientImpl.postByRead | public String postByRead(
final String url,
final InputStream input,
final String media_type
)
{
InputStreamRequestCallback callback =
new InputStreamRequestCallback( input, MediaType.valueOf( media_type ) );
String location = _execute( url, HttpMethod.POST,
callback,
new LocationHeaderResponseExtractor() );
return location;
} | java | public String postByRead(
final String url,
final InputStream input,
final String media_type
)
{
InputStreamRequestCallback callback =
new InputStreamRequestCallback( input, MediaType.valueOf( media_type ) );
String location = _execute( url, HttpMethod.POST,
callback,
new LocationHeaderResponseExtractor() );
return location;
} | [
"public",
"String",
"postByRead",
"(",
"final",
"String",
"url",
",",
"final",
"InputStream",
"input",
",",
"final",
"String",
"media_type",
")",
"{",
"InputStreamRequestCallback",
"callback",
"=",
"new",
"InputStreamRequestCallback",
"(",
"input",
",",
"MediaType",... | HTTP POST: Reads the contents from the specified stream and sends them to the URL.
@return
the location, as an URI, where the resource is created.
@throws HttpException
when an exceptional condition occurred during the HTTP method execution. | [
"HTTP",
"POST",
":",
"Reads",
"the",
"contents",
"from",
"the",
"specified",
"stream",
"and",
"sends",
"them",
"to",
"the",
"URL",
"."
] | train | https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/web/spring/SpringHttpClientImpl.java#L379-L392 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java | UTF16.findOffsetFromCodePoint | public static int findOffsetFromCodePoint(StringBuffer source, int offset32) {
char ch;
int size = source.length(), result = 0, count = offset32;
if (offset32 < 0 || offset32 > size) {
throw new StringIndexOutOfBoundsException(offset32);
}
while (result < size && count > 0) {
ch = source.charAt(result);
if (isLeadSurrogate(ch) && ((result + 1) < size)
&& isTrailSurrogate(source.charAt(result + 1))) {
result++;
}
count--;
result++;
}
if (count != 0) {
throw new StringIndexOutOfBoundsException(offset32);
}
return result;
} | java | public static int findOffsetFromCodePoint(StringBuffer source, int offset32) {
char ch;
int size = source.length(), result = 0, count = offset32;
if (offset32 < 0 || offset32 > size) {
throw new StringIndexOutOfBoundsException(offset32);
}
while (result < size && count > 0) {
ch = source.charAt(result);
if (isLeadSurrogate(ch) && ((result + 1) < size)
&& isTrailSurrogate(source.charAt(result + 1))) {
result++;
}
count--;
result++;
}
if (count != 0) {
throw new StringIndexOutOfBoundsException(offset32);
}
return result;
} | [
"public",
"static",
"int",
"findOffsetFromCodePoint",
"(",
"StringBuffer",
"source",
",",
"int",
"offset32",
")",
"{",
"char",
"ch",
";",
"int",
"size",
"=",
"source",
".",
"length",
"(",
")",
",",
"result",
"=",
"0",
",",
"count",
"=",
"offset32",
";",
... | Returns the UTF-16 offset that corresponds to a UTF-32 offset. Used for random access. See
the {@link UTF16 class description} for notes on roundtripping.
@param source The UTF-16 string buffer
@param offset32 UTF-32 offset
@return UTF-16 offset
@exception IndexOutOfBoundsException If offset32 is out of bounds. | [
"Returns",
"the",
"UTF",
"-",
"16",
"offset",
"that",
"corresponds",
"to",
"a",
"UTF",
"-",
"32",
"offset",
".",
"Used",
"for",
"random",
"access",
".",
"See",
"the",
"{",
"@link",
"UTF16",
"class",
"description",
"}",
"for",
"notes",
"on",
"roundtrippin... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L760-L780 |
grpc/grpc-java | examples/src/main/java/io/grpc/examples/advanced/JsonMarshaller.java | JsonMarshaller.jsonMarshaller | public static <T extends Message> Marshaller<T> jsonMarshaller(
final T defaultInstance, final Parser parser, final Printer printer) {
final Charset charset = Charset.forName("UTF-8");
return new Marshaller<T>() {
@Override
public InputStream stream(T value) {
try {
return new ByteArrayInputStream(printer.print(value).getBytes(charset));
} catch (InvalidProtocolBufferException e) {
throw Status.INTERNAL
.withCause(e)
.withDescription("Unable to print json proto")
.asRuntimeException();
}
}
@SuppressWarnings("unchecked")
@Override
public T parse(InputStream stream) {
Builder builder = defaultInstance.newBuilderForType();
Reader reader = new InputStreamReader(stream, charset);
T proto;
try {
parser.merge(reader, builder);
proto = (T) builder.build();
reader.close();
} catch (InvalidProtocolBufferException e) {
throw Status.INTERNAL.withDescription("Invalid protobuf byte sequence")
.withCause(e).asRuntimeException();
} catch (IOException e) {
// Same for now, might be unavailable
throw Status.INTERNAL.withDescription("Invalid protobuf byte sequence")
.withCause(e).asRuntimeException();
}
return proto;
}
};
} | java | public static <T extends Message> Marshaller<T> jsonMarshaller(
final T defaultInstance, final Parser parser, final Printer printer) {
final Charset charset = Charset.forName("UTF-8");
return new Marshaller<T>() {
@Override
public InputStream stream(T value) {
try {
return new ByteArrayInputStream(printer.print(value).getBytes(charset));
} catch (InvalidProtocolBufferException e) {
throw Status.INTERNAL
.withCause(e)
.withDescription("Unable to print json proto")
.asRuntimeException();
}
}
@SuppressWarnings("unchecked")
@Override
public T parse(InputStream stream) {
Builder builder = defaultInstance.newBuilderForType();
Reader reader = new InputStreamReader(stream, charset);
T proto;
try {
parser.merge(reader, builder);
proto = (T) builder.build();
reader.close();
} catch (InvalidProtocolBufferException e) {
throw Status.INTERNAL.withDescription("Invalid protobuf byte sequence")
.withCause(e).asRuntimeException();
} catch (IOException e) {
// Same for now, might be unavailable
throw Status.INTERNAL.withDescription("Invalid protobuf byte sequence")
.withCause(e).asRuntimeException();
}
return proto;
}
};
} | [
"public",
"static",
"<",
"T",
"extends",
"Message",
">",
"Marshaller",
"<",
"T",
">",
"jsonMarshaller",
"(",
"final",
"T",
"defaultInstance",
",",
"final",
"Parser",
"parser",
",",
"final",
"Printer",
"printer",
")",
"{",
"final",
"Charset",
"charset",
"=",
... | Create a {@code Marshaller} for json protos of the same type as {@code defaultInstance}.
<p>This is an unstable API and has not been optimized yet for performance. | [
"Create",
"a",
"{",
"@code",
"Marshaller",
"}",
"for",
"json",
"protos",
"of",
"the",
"same",
"type",
"as",
"{",
"@code",
"defaultInstance",
"}",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/examples/src/main/java/io/grpc/examples/advanced/JsonMarshaller.java#L58-L97 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.lastIndexOf | public static int lastIndexOf(final CharSequence seq, final int searchChar, final int startPos) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, startPos);
} | java | public static int lastIndexOf(final CharSequence seq, final int searchChar, final int startPos) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, startPos);
} | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"final",
"CharSequence",
"seq",
",",
"final",
"int",
"searchChar",
",",
"final",
"int",
"startPos",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"seq",
")",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"return",
... | Returns the index within <code>seq</code> of the last occurrence of
the specified character, searching backward starting at the
specified index. For values of <code>searchChar</code> in the range
from 0 to 0xFFFF (inclusive), the index returned is the largest
value <i>k</i> such that:
<blockquote><pre>
(this.charAt(<i>k</i>) == searchChar) && (<i>k</i> <= startPos)
</pre></blockquote>
is true. For other values of <code>searchChar</code>, it is the
largest value <i>k</i> such that:
<blockquote><pre>
(this.codePointAt(<i>k</i>) == searchChar) && (<i>k</i> <= startPos)
</pre></blockquote>
is true. In either case, if no such character occurs in <code>seq</code>
at or before position <code>startPos</code>, then
<code>-1</code> is returned. Furthermore, a {@code null} or empty ("")
<code>CharSequence</code> will return {@code -1}. A start position greater
than the string length searches the whole string.
The search starts at the <code>startPos</code> and works backwards;
matches starting after the start position are ignored.
<p>All indices are specified in <code>char</code> values
(Unicode code units).
<pre>
StringUtils.lastIndexOf(null, *, *) = -1
StringUtils.lastIndexOf("", *, *) = -1
StringUtils.lastIndexOf("aabaabaa", 'b', 8) = 5
StringUtils.lastIndexOf("aabaabaa", 'b', 4) = 2
StringUtils.lastIndexOf("aabaabaa", 'b', 0) = -1
StringUtils.lastIndexOf("aabaabaa", 'b', 9) = 5
StringUtils.lastIndexOf("aabaabaa", 'b', -1) = -1
StringUtils.lastIndexOf("aabaabaa", 'a', 0) = 0
</pre>
@param seq the CharSequence to check, may be null
@param searchChar the character to find
@param startPos the start position
@return the last index of the search character (always ≤ startPos),
-1 if no match or {@code null} string input
@since 2.0
@since 3.0 Changed signature from lastIndexOf(String, int, int) to lastIndexOf(CharSequence, int, int) | [
"Returns",
"the",
"index",
"within",
"<code",
">",
"seq<",
"/",
"code",
">",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"character",
"searching",
"backward",
"starting",
"at",
"the",
"specified",
"index",
".",
"For",
"values",
"of",
"<code"... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1726-L1731 |
k3po/k3po | specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java | Functions.acceptClientToken | @Function
public static boolean acceptClientToken(GSSContext context, byte[] token) {
try {
if (!context.isEstablished()) {
byte[] nextToken = context.acceptSecContext(token, 0, token.length);
return nextToken == null;
}
return true;
} catch (GSSException ex) {
throw new RuntimeException("Exception accepting client token", ex);
}
} | java | @Function
public static boolean acceptClientToken(GSSContext context, byte[] token) {
try {
if (!context.isEstablished()) {
byte[] nextToken = context.acceptSecContext(token, 0, token.length);
return nextToken == null;
}
return true;
} catch (GSSException ex) {
throw new RuntimeException("Exception accepting client token", ex);
}
} | [
"@",
"Function",
"public",
"static",
"boolean",
"acceptClientToken",
"(",
"GSSContext",
"context",
",",
"byte",
"[",
"]",
"token",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"context",
".",
"isEstablished",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"nextToken",
... | Accept a client token to establish a secure communication channel.
@param context GSSContext for which a connection has been established to the remote peer
@param token the client side token (client side, as in the token had
to be bootstrapped by the client and this peer uses that token
to update the GSSContext)
@return a boolean to indicate whether the token was used to successfully
establish a communication channel | [
"Accept",
"a",
"client",
"token",
"to",
"establish",
"a",
"secure",
"communication",
"channel",
"."
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L221-L232 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.queryAppStream | public GetAppStreamResponse queryAppStream(String app, String stream) {
GetAppStreamRequest request = new GetAppStreamRequest();
request.setApp(app);
request.setStream(stream);
return queryAppStream(request);
} | java | public GetAppStreamResponse queryAppStream(String app, String stream) {
GetAppStreamRequest request = new GetAppStreamRequest();
request.setApp(app);
request.setStream(stream);
return queryAppStream(request);
} | [
"public",
"GetAppStreamResponse",
"queryAppStream",
"(",
"String",
"app",
",",
"String",
"stream",
")",
"{",
"GetAppStreamRequest",
"request",
"=",
"new",
"GetAppStreamRequest",
"(",
")",
";",
"request",
".",
"setApp",
"(",
"app",
")",
";",
"request",
".",
"se... | get detail of your stream by app name and stream name
@param app app name
@param stream stream name
@return the response | [
"get",
"detail",
"of",
"your",
"stream",
"by",
"app",
"name",
"and",
"stream",
"name"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L834-L839 |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemMoved | public final void notifyContentItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition "
+ toPosition + " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "].");
}
notifyItemMoved(fromPosition + headerItemCount, toPosition + headerItemCount);
} | java | public final void notifyContentItemMoved(int fromPosition, int toPosition) {
if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) {
throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition "
+ toPosition + " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "].");
}
notifyItemMoved(fromPosition + headerItemCount, toPosition + headerItemCount);
} | [
"public",
"final",
"void",
"notifyContentItemMoved",
"(",
"int",
"fromPosition",
",",
"int",
"toPosition",
")",
"{",
"if",
"(",
"fromPosition",
"<",
"0",
"||",
"toPosition",
"<",
"0",
"||",
"fromPosition",
">=",
"contentItemCount",
"||",
"toPosition",
">=",
"c... | Notifies that an existing content item is moved to another position.
@param fromPosition the original position.
@param toPosition the new position. | [
"Notifies",
"that",
"an",
"existing",
"content",
"item",
"is",
"moved",
"to",
"another",
"position",
"."
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L269-L275 |
VoltDB/voltdb | src/frontend/org/voltdb/DefaultProcedureManager.java | DefaultProcedureManager.generateCrudReplicatedUpdate | private static String generateCrudReplicatedUpdate(Table table, Constraint pkey)
{
StringBuilder sb = new StringBuilder();
sb.append("UPDATE " + table.getTypeName() + " SET ");
generateCrudExpressionColumns(table, sb);
generateCrudPKeyWhereClause(null, pkey, sb);
sb.append(';');
return sb.toString();
} | java | private static String generateCrudReplicatedUpdate(Table table, Constraint pkey)
{
StringBuilder sb = new StringBuilder();
sb.append("UPDATE " + table.getTypeName() + " SET ");
generateCrudExpressionColumns(table, sb);
generateCrudPKeyWhereClause(null, pkey, sb);
sb.append(';');
return sb.toString();
} | [
"private",
"static",
"String",
"generateCrudReplicatedUpdate",
"(",
"Table",
"table",
",",
"Constraint",
"pkey",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"UPDATE \"",
"+",
"table",
".",
"getTypeNa... | Create a statement like:
"update <table> set {<each-column = ?>...} where {<pkey-column = ?>...}
for a replicated table. | [
"Create",
"a",
"statement",
"like",
":",
"update",
"<table",
">",
"set",
"{",
"<each",
"-",
"column",
"=",
"?",
">",
"...",
"}",
"where",
"{",
"<pkey",
"-",
"column",
"=",
"?",
">",
"...",
"}",
"for",
"a",
"replicated",
"table",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/DefaultProcedureManager.java#L415-L425 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEManager.java | CmsADEManager.findEntryPoint | public String findEntryPoint(CmsObject cms, String openPath) {
CmsADEConfigData configData = lookupConfiguration(cms, openPath);
String result = configData.getBasePath();
if (result == null) {
return cms.getRequestContext().addSiteRoot("/");
}
return result;
} | java | public String findEntryPoint(CmsObject cms, String openPath) {
CmsADEConfigData configData = lookupConfiguration(cms, openPath);
String result = configData.getBasePath();
if (result == null) {
return cms.getRequestContext().addSiteRoot("/");
}
return result;
} | [
"public",
"String",
"findEntryPoint",
"(",
"CmsObject",
"cms",
",",
"String",
"openPath",
")",
"{",
"CmsADEConfigData",
"configData",
"=",
"lookupConfiguration",
"(",
"cms",
",",
"openPath",
")",
";",
"String",
"result",
"=",
"configData",
".",
"getBasePath",
"(... | Finds the entry point to a sitemap.<p>
@param cms the CMS context
@param openPath the resource path to find the sitemap to
@return the sitemap entry point | [
"Finds",
"the",
"entry",
"point",
"to",
"a",
"sitemap",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L296-L304 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java | PermissionUtil.canInteract | public static boolean canInteract(Member issuer, Emote emote)
{
Checks.notNull(issuer, "Issuer Member");
Checks.notNull(emote, "Target Emote");
if (!issuer.getGuild().equals(emote.getGuild()))
throw new IllegalArgumentException("The issuer and target are not in the same Guild");
// We don't need to check based on the fact it is animated if it's a BOT account
// because BOT accounts cannot have nitro, and have access to animated Emotes naturally.
if (emote.isAnimated() && !issuer.getUser().isBot())
{
// This is a currently logged in client, meaning we can check if they have nitro or not.
// If this isn't the currently logged in account, we just check it like a normal emote,
// since there is no way to verify if they have nitro or not.
if (issuer.getUser() instanceof SelfUser)
{
// If they don't have nitro, we immediately return
// false, otherwise we proceed with the remaining checks.
if (!((SelfUser)issuer.getUser()).isNitro())
return false;
}
}
return emote.canProvideRoles() && (emote.getRoles().isEmpty() // Emote restricted to roles -> check if the issuer has them
|| CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles()));
} | java | public static boolean canInteract(Member issuer, Emote emote)
{
Checks.notNull(issuer, "Issuer Member");
Checks.notNull(emote, "Target Emote");
if (!issuer.getGuild().equals(emote.getGuild()))
throw new IllegalArgumentException("The issuer and target are not in the same Guild");
// We don't need to check based on the fact it is animated if it's a BOT account
// because BOT accounts cannot have nitro, and have access to animated Emotes naturally.
if (emote.isAnimated() && !issuer.getUser().isBot())
{
// This is a currently logged in client, meaning we can check if they have nitro or not.
// If this isn't the currently logged in account, we just check it like a normal emote,
// since there is no way to verify if they have nitro or not.
if (issuer.getUser() instanceof SelfUser)
{
// If they don't have nitro, we immediately return
// false, otherwise we proceed with the remaining checks.
if (!((SelfUser)issuer.getUser()).isNitro())
return false;
}
}
return emote.canProvideRoles() && (emote.getRoles().isEmpty() // Emote restricted to roles -> check if the issuer has them
|| CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles()));
} | [
"public",
"static",
"boolean",
"canInteract",
"(",
"Member",
"issuer",
",",
"Emote",
"emote",
")",
"{",
"Checks",
".",
"notNull",
"(",
"issuer",
",",
"\"Issuer Member\"",
")",
";",
"Checks",
".",
"notNull",
"(",
"emote",
",",
"\"Target Emote\"",
")",
";",
... | Check whether the provided {@link net.dv8tion.jda.core.entities.Member Member} can use the specified {@link net.dv8tion.jda.core.entities.Emote Emote}.
<p>If the specified Member is not in the emote's guild or the emote provided is fake this will return false.
Otherwise it will check if the emote is restricted to any roles and if that is the case if the Member has one of these.
<p>In the case of an {@link net.dv8tion.jda.core.entities.Emote#isAnimated() animated} Emote, this will
check if the issuer is the currently logged in account, and then check if the account has
{@link net.dv8tion.jda.core.entities.SelfUser#isNitro() nitro}, and return false if it doesn't.
<br>For other accounts, this method will not take into account whether the emote is animated, as there is
no real way to check if the Member can interact with them.
<br><b>Note</b>: This is not checking if the issuer owns the Guild or not.
@param issuer
The member that tries to interact with the Emote
@param emote
The emote that is the target interaction
@throws IllegalArgumentException
if any of the provided parameters is {@code null}
or the provided entities are not from the same guild
@return True, if the issuer can interact with the emote | [
"Check",
"whether",
"the",
"provided",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"Member",
"Member",
"}",
"can",
"use",
"the",
"specified",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L139-L165 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java | BigComplex.valueOf | public static BigComplex valueOf(double real, double imaginary) {
return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary));
} | java | public static BigComplex valueOf(double real, double imaginary) {
return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary));
} | [
"public",
"static",
"BigComplex",
"valueOf",
"(",
"double",
"real",
",",
"double",
"imaginary",
")",
"{",
"return",
"valueOf",
"(",
"BigDecimal",
".",
"valueOf",
"(",
"real",
")",
",",
"BigDecimal",
".",
"valueOf",
"(",
"imaginary",
")",
")",
";",
"}"
] | Returns a complex number with the specified real and imaginary {@code double} parts.
@param real the real {@code double} part
@param imaginary the imaginary {@code double} part
@return the complex number | [
"Returns",
"a",
"complex",
"number",
"with",
"the",
"specified",
"real",
"and",
"imaginary",
"{",
"@code",
"double",
"}",
"parts",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java#L508-L510 |
infinispan/infinispan | core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java | ScatteredConsistentHashFactory.updateMembers | @Override
public ScatteredConsistentHash updateMembers(ScatteredConsistentHash baseCH, List<Address> actualMembers,
Map<Address, Float> actualCapacityFactors) {
if (actualMembers.size() == 0)
throw new IllegalArgumentException("Can't construct a consistent hash without any members");
checkCapacityFactors(actualMembers, actualCapacityFactors);
boolean sameCapacityFactors = actualCapacityFactors == null ? baseCH.getCapacityFactors() == null :
actualCapacityFactors.equals(baseCH.getCapacityFactors());
if (actualMembers.equals(baseCH.getMembers()) && sameCapacityFactors)
return baseCH;
// The builder constructor automatically removes leavers
Builder builder = new Builder(baseCH, actualMembers, actualCapacityFactors);
return builder.build();
} | java | @Override
public ScatteredConsistentHash updateMembers(ScatteredConsistentHash baseCH, List<Address> actualMembers,
Map<Address, Float> actualCapacityFactors) {
if (actualMembers.size() == 0)
throw new IllegalArgumentException("Can't construct a consistent hash without any members");
checkCapacityFactors(actualMembers, actualCapacityFactors);
boolean sameCapacityFactors = actualCapacityFactors == null ? baseCH.getCapacityFactors() == null :
actualCapacityFactors.equals(baseCH.getCapacityFactors());
if (actualMembers.equals(baseCH.getMembers()) && sameCapacityFactors)
return baseCH;
// The builder constructor automatically removes leavers
Builder builder = new Builder(baseCH, actualMembers, actualCapacityFactors);
return builder.build();
} | [
"@",
"Override",
"public",
"ScatteredConsistentHash",
"updateMembers",
"(",
"ScatteredConsistentHash",
"baseCH",
",",
"List",
"<",
"Address",
">",
"actualMembers",
",",
"Map",
"<",
"Address",
",",
"Float",
">",
"actualCapacityFactors",
")",
"{",
"if",
"(",
"actual... | Leavers are removed and segments without owners are assigned new owners. Joiners might get some of the un-owned
segments but otherwise they are not taken into account (that should happen during a rebalance).
@param baseCH An existing consistent hash instance, should not be {@code null}
@param actualMembers A list of addresses representing the new cache members.
@return | [
"Leavers",
"are",
"removed",
"and",
"segments",
"without",
"owners",
"are",
"assigned",
"new",
"owners",
".",
"Joiners",
"might",
"get",
"some",
"of",
"the",
"un",
"-",
"owned",
"segments",
"but",
"otherwise",
"they",
"are",
"not",
"taken",
"into",
"account"... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java#L64-L80 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.ensureIndex | public void ensureIndex(DBObject keys, String name) throws MongoException {
ensureIndex(keys, name, false);
} | java | public void ensureIndex(DBObject keys, String name) throws MongoException {
ensureIndex(keys, name, false);
} | [
"public",
"void",
"ensureIndex",
"(",
"DBObject",
"keys",
",",
"String",
"name",
")",
"throws",
"MongoException",
"{",
"ensureIndex",
"(",
"keys",
",",
"name",
",",
"false",
")",
";",
"}"
] | calls {@link DBCollection#ensureIndex(com.mongodb.DBObject, java.lang.String, boolean)} with unique=false
@param keys fields to use for index
@param name an identifier for the index
@throws MongoException If an error occurred | [
"calls",
"{",
"@link",
"DBCollection#ensureIndex",
"(",
"com",
".",
"mongodb",
".",
"DBObject",
"java",
".",
"lang",
".",
"String",
"boolean",
")",
"}",
"with",
"unique",
"=",
"false"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L710-L712 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/scrollfire/MaterialScrollfire.java | MaterialScrollfire.apply | public static void apply(Element element, int offset, Functions.Func callback) {
MaterialScrollfire scrollfire = new MaterialScrollfire();
scrollfire.setElement(element);
scrollfire.setCallback(callback);
scrollfire.setOffset(offset);
scrollfire.apply();
} | java | public static void apply(Element element, int offset, Functions.Func callback) {
MaterialScrollfire scrollfire = new MaterialScrollfire();
scrollfire.setElement(element);
scrollfire.setCallback(callback);
scrollfire.setOffset(offset);
scrollfire.apply();
} | [
"public",
"static",
"void",
"apply",
"(",
"Element",
"element",
",",
"int",
"offset",
",",
"Functions",
".",
"Func",
"callback",
")",
"{",
"MaterialScrollfire",
"scrollfire",
"=",
"new",
"MaterialScrollfire",
"(",
")",
";",
"scrollfire",
".",
"setElement",
"("... | Executes callback method depending on how far into the page you've scrolled
@param element Target element that is being tracked
@param offset If this is 0, the callback will be fired when the selector element is at the very bottom of the user's window.
@param callback The method to be called when the scrollfire is applied | [
"Executes",
"callback",
"method",
"depending",
"on",
"how",
"far",
"into",
"the",
"page",
"you",
"ve",
"scrolled"
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/scrollfire/MaterialScrollfire.java#L108-L114 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_item_itemId_configuration_GET | public ArrayList<Long> cart_cartId_item_itemId_configuration_GET(String cartId, Long itemId, String label) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration";
StringBuilder sb = path(qPath, cartId, itemId);
query(sb, "label", label);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<Long> cart_cartId_item_itemId_configuration_GET(String cartId, Long itemId, String label) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration";
StringBuilder sb = path(qPath, cartId, itemId);
query(sb, "label", label);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"cart_cartId_item_itemId_configuration_GET",
"(",
"String",
"cartId",
",",
"Long",
"itemId",
",",
"String",
"label",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/item/{itemId}/configuration\"",... | Retrieve all configuration item of the cart item
REST: GET /order/cart/{cartId}/item/{itemId}/configuration
@param cartId [required] Cart identifier
@param itemId [required] Product item identifier
@param label [required] Filter the value of label property (=) | [
"Retrieve",
"all",
"configuration",
"item",
"of",
"the",
"cart",
"item"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8052-L8058 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/IntentUtils.java | IntentUtils.sendEmail | public static Intent sendEmail(String to, String subject, String text) {
return sendEmail(new String[]{to}, subject, text);
} | java | public static Intent sendEmail(String to, String subject, String text) {
return sendEmail(new String[]{to}, subject, text);
} | [
"public",
"static",
"Intent",
"sendEmail",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"text",
")",
"{",
"return",
"sendEmail",
"(",
"new",
"String",
"[",
"]",
"{",
"to",
"}",
",",
"subject",
",",
"text",
")",
";",
"}"
] | Send email message
@param to Receiver email
@param subject Message subject
@param text Message body
@see #sendEmail(String[], String, String) | [
"Send",
"email",
"message"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L78-L80 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java | CopyableFile.setFsDatasets | public void setFsDatasets(FileSystem originFs, FileSystem targetFs) {
/*
* By default, the raw Gobblin dataset for CopyableFile lineage is its parent folder
* if itself is not a folder
*/
boolean isDir = origin.isDirectory();
Path fullSourcePath = Path.getPathWithoutSchemeAndAuthority(origin.getPath());
String sourceDatasetName = isDir ? fullSourcePath.toString() : fullSourcePath.getParent().toString();
DatasetDescriptor sourceDataset = new DatasetDescriptor(originFs.getScheme(), sourceDatasetName);
sourceDataset.addMetadata(DatasetConstants.FS_URI, originFs.getUri().toString());
sourceData = sourceDataset;
Path fullDestinationPath = Path.getPathWithoutSchemeAndAuthority(destination);
String destinationDatasetName = isDir ? fullDestinationPath.toString() : fullDestinationPath.getParent().toString();
DatasetDescriptor destinationDataset = new DatasetDescriptor(targetFs.getScheme(), destinationDatasetName);
destinationDataset.addMetadata(DatasetConstants.FS_URI, targetFs.getUri().toString());
destinationData = destinationDataset;
} | java | public void setFsDatasets(FileSystem originFs, FileSystem targetFs) {
/*
* By default, the raw Gobblin dataset for CopyableFile lineage is its parent folder
* if itself is not a folder
*/
boolean isDir = origin.isDirectory();
Path fullSourcePath = Path.getPathWithoutSchemeAndAuthority(origin.getPath());
String sourceDatasetName = isDir ? fullSourcePath.toString() : fullSourcePath.getParent().toString();
DatasetDescriptor sourceDataset = new DatasetDescriptor(originFs.getScheme(), sourceDatasetName);
sourceDataset.addMetadata(DatasetConstants.FS_URI, originFs.getUri().toString());
sourceData = sourceDataset;
Path fullDestinationPath = Path.getPathWithoutSchemeAndAuthority(destination);
String destinationDatasetName = isDir ? fullDestinationPath.toString() : fullDestinationPath.getParent().toString();
DatasetDescriptor destinationDataset = new DatasetDescriptor(targetFs.getScheme(), destinationDatasetName);
destinationDataset.addMetadata(DatasetConstants.FS_URI, targetFs.getUri().toString());
destinationData = destinationDataset;
} | [
"public",
"void",
"setFsDatasets",
"(",
"FileSystem",
"originFs",
",",
"FileSystem",
"targetFs",
")",
"{",
"/*\n * By default, the raw Gobblin dataset for CopyableFile lineage is its parent folder\n * if itself is not a folder\n */",
"boolean",
"isDir",
"=",
"origin",
"."... | Set file system based source and destination dataset for this {@link CopyableFile}
@param originFs {@link FileSystem} where this {@link CopyableFile} origins
@param targetFs {@link FileSystem} where this {@link CopyableFile} is copied to | [
"Set",
"file",
"system",
"based",
"source",
"and",
"destination",
"dataset",
"for",
"this",
"{",
"@link",
"CopyableFile",
"}"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java#L130-L148 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.decodeFromFile | @Nonnull
@ReturnsMutableCopy
public static byte [] decodeFromFile (@Nonnull final String filename) throws IOException
{
// Setup some useful variables
final File file = new File (filename);
// Check for size of file
if (file.length () > Integer.MAX_VALUE)
throw new IOException ("File is too big for this convenience method (" + file.length () + " bytes).");
final byte [] buffer = new byte [(int) file.length ()];
// Open a stream
try (final Base64InputStream bis = new Base64InputStream (FileHelper.getBufferedInputStream (file), DECODE))
{
int nOfs = 0;
int numBytes;
// Read until done
while ((numBytes = bis.read (buffer, nOfs, 4096)) >= 0)
{
nOfs += numBytes;
}
// Save in a variable to return
final byte [] decodedData = new byte [nOfs];
System.arraycopy (buffer, 0, decodedData, 0, nOfs);
return decodedData;
}
} | java | @Nonnull
@ReturnsMutableCopy
public static byte [] decodeFromFile (@Nonnull final String filename) throws IOException
{
// Setup some useful variables
final File file = new File (filename);
// Check for size of file
if (file.length () > Integer.MAX_VALUE)
throw new IOException ("File is too big for this convenience method (" + file.length () + " bytes).");
final byte [] buffer = new byte [(int) file.length ()];
// Open a stream
try (final Base64InputStream bis = new Base64InputStream (FileHelper.getBufferedInputStream (file), DECODE))
{
int nOfs = 0;
int numBytes;
// Read until done
while ((numBytes = bis.read (buffer, nOfs, 4096)) >= 0)
{
nOfs += numBytes;
}
// Save in a variable to return
final byte [] decodedData = new byte [nOfs];
System.arraycopy (buffer, 0, decodedData, 0, nOfs);
return decodedData;
}
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"byte",
"[",
"]",
"decodeFromFile",
"(",
"@",
"Nonnull",
"final",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"// Setup some useful variables",
"final",
"File",
"file",
"=",
"new",
"File",... | Convenience method for reading a base64-encoded file and decoding it.
<p>
As of v 2.3, if there is a error, the method will throw an IOException.
<b>This is new to v2.3!</b> In earlier versions, it just returned false,
but in retrospect that's a pretty poor way to handle it.
</p>
@param filename
Filename for reading encoded data
@return decoded byte array
@throws IOException
if there is an error
@since 2.1 | [
"Convenience",
"method",
"for",
"reading",
"a",
"base64",
"-",
"encoded",
"file",
"and",
"decoding",
"it",
".",
"<p",
">",
"As",
"of",
"v",
"2",
".",
"3",
"if",
"there",
"is",
"a",
"error",
"the",
"method",
"will",
"throw",
"an",
"IOException",
".",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2413-L2443 |
m-m-m/util | version/src/main/java/net/sf/mmm/util/version/base/AbstractNameVersion.java | AbstractNameVersion.doWrite | protected void doWrite(Appendable appendable, boolean fromToString) throws IOException {
appendable.append(getName());
appendable.append(NAME_VERSION_SEPARATOR);
appendable.append(this.version);
} | java | protected void doWrite(Appendable appendable, boolean fromToString) throws IOException {
appendable.append(getName());
appendable.append(NAME_VERSION_SEPARATOR);
appendable.append(this.version);
} | [
"protected",
"void",
"doWrite",
"(",
"Appendable",
"appendable",
",",
"boolean",
"fromToString",
")",
"throws",
"IOException",
"{",
"appendable",
".",
"append",
"(",
"getName",
"(",
")",
")",
";",
"appendable",
".",
"append",
"(",
"NAME_VERSION_SEPARATOR",
")",
... | Called from {@link #write(Appendable)} or {@link #toString()} to write the serialized data of this
object.
@param appendable the {@link StringBuilder} where to {@link StringBuilder#append(String) append} to.
@param fromToString - {@code true} if called from {@link #toString()}, {@code false} otherwise. Can be
ignored if not relevant.
@throws IOException if an error occurred whilst writing the data. | [
"Called",
"from",
"{",
"@link",
"#write",
"(",
"Appendable",
")",
"}",
"or",
"{",
"@link",
"#toString",
"()",
"}",
"to",
"write",
"the",
"serialized",
"data",
"of",
"this",
"object",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/base/AbstractNameVersion.java#L67-L72 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java | TriggersInner.beginCreateOrUpdate | public TriggerInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().single().body();
} | java | public TriggerInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().single().body();
} | [
"public",
"TriggerInner",
"beginCreateOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"TriggerInner",
"trigger",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",... | Creates or updates a trigger.
@param deviceName Creates or updates a trigger
@param name The trigger name.
@param resourceGroupName The resource group name.
@param trigger The trigger.
@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 TriggerInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"trigger",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L528-L530 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java | JsDocInfoParser.parseParamTypeExpression | private Node parseParamTypeExpression(JsDocToken token) {
boolean restArg = false;
if (token == JsDocToken.ELLIPSIS) {
token = next();
if (token == JsDocToken.RIGHT_CURLY) {
restoreLookAhead(token);
// EMPTY represents the UNKNOWN type in the Type AST.
return wrapNode(Token.ELLIPSIS, IR.empty());
}
restArg = true;
}
Node typeNode = parseTopLevelTypeExpression(token);
if (typeNode != null) {
skipEOLs();
if (restArg) {
typeNode = wrapNode(Token.ELLIPSIS, typeNode);
} else if (match(JsDocToken.EQUALS)) {
next();
skipEOLs();
typeNode = wrapNode(Token.EQUALS, typeNode);
}
}
return typeNode;
} | java | private Node parseParamTypeExpression(JsDocToken token) {
boolean restArg = false;
if (token == JsDocToken.ELLIPSIS) {
token = next();
if (token == JsDocToken.RIGHT_CURLY) {
restoreLookAhead(token);
// EMPTY represents the UNKNOWN type in the Type AST.
return wrapNode(Token.ELLIPSIS, IR.empty());
}
restArg = true;
}
Node typeNode = parseTopLevelTypeExpression(token);
if (typeNode != null) {
skipEOLs();
if (restArg) {
typeNode = wrapNode(Token.ELLIPSIS, typeNode);
} else if (match(JsDocToken.EQUALS)) {
next();
skipEOLs();
typeNode = wrapNode(Token.EQUALS, typeNode);
}
}
return typeNode;
} | [
"private",
"Node",
"parseParamTypeExpression",
"(",
"JsDocToken",
"token",
")",
"{",
"boolean",
"restArg",
"=",
"false",
";",
"if",
"(",
"token",
"==",
"JsDocToken",
".",
"ELLIPSIS",
")",
"{",
"token",
"=",
"next",
"(",
")",
";",
"if",
"(",
"token",
"=="... | Parse a ParamTypeExpression:
<pre>
ParamTypeExpression :=
OptionalParameterType |
TopLevelTypeExpression |
'...' TopLevelTypeExpression
OptionalParameterType :=
TopLevelTypeExpression '='
</pre> | [
"Parse",
"a",
"ParamTypeExpression",
":"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L1973-L1998 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/MethodCallSavePointPlayer.java | MethodCallSavePointPlayer.playMethodCalls | public synchronized void playMethodCalls(Memento memento, String [] savePoints)
{
String savePoint = null;
MethodCallFact methodCallFact = null;
SummaryException exceptions = new SummaryException();
//loop thru savepoints
for (int i = 0; i < savePoints.length; i++)
{
savePoint = savePoints[i];
if(savePoint == null || savePoint.length() == 0 || savePoint.trim().length() == 0)
continue;
Debugger.println(this,"processing savepoint="+savePoint);
//get method call fact
methodCallFact = (MethodCallFact)memento.restore(savePoint, MethodCallFact.class);
try
{
ObjectProxy.executeMethod(prepareObject(methodCallFact,savePoint), methodCallFact);
}
catch(Exception e)
{
exceptions.addException(new SystemException("savePoint="+savePoint+" methodCallFact="+methodCallFact+" exception="+Debugger.stackTrace(e)));
throw new SystemException(e); // TODO:
}
}
if(!exceptions.isEmpty())
throw exceptions;
} | java | public synchronized void playMethodCalls(Memento memento, String [] savePoints)
{
String savePoint = null;
MethodCallFact methodCallFact = null;
SummaryException exceptions = new SummaryException();
//loop thru savepoints
for (int i = 0; i < savePoints.length; i++)
{
savePoint = savePoints[i];
if(savePoint == null || savePoint.length() == 0 || savePoint.trim().length() == 0)
continue;
Debugger.println(this,"processing savepoint="+savePoint);
//get method call fact
methodCallFact = (MethodCallFact)memento.restore(savePoint, MethodCallFact.class);
try
{
ObjectProxy.executeMethod(prepareObject(methodCallFact,savePoint), methodCallFact);
}
catch(Exception e)
{
exceptions.addException(new SystemException("savePoint="+savePoint+" methodCallFact="+methodCallFact+" exception="+Debugger.stackTrace(e)));
throw new SystemException(e); // TODO:
}
}
if(!exceptions.isEmpty())
throw exceptions;
} | [
"public",
"synchronized",
"void",
"playMethodCalls",
"(",
"Memento",
"memento",
",",
"String",
"[",
"]",
"savePoints",
")",
"{",
"String",
"savePoint",
"=",
"null",
";",
"MethodCallFact",
"methodCallFact",
"=",
"null",
";",
"SummaryException",
"exceptions",
"=",
... | Redo the method calls of a target object
@param memento the memento to restore MethodCallFact
@param savePoints the list of the MethodCallFact save points
@throws SummaryException | [
"Redo",
"the",
"method",
"calls",
"of",
"a",
"target",
"object"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/MethodCallSavePointPlayer.java#L38-L70 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java | SecStrucCalc.setSecStrucType | private void setSecStrucType(int pos, SecStrucType type){
SecStrucState ss = getSecStrucState(pos);
if (type.compareTo(ss.getType()) < 0) ss.setType(type);
} | java | private void setSecStrucType(int pos, SecStrucType type){
SecStrucState ss = getSecStrucState(pos);
if (type.compareTo(ss.getType()) < 0) ss.setType(type);
} | [
"private",
"void",
"setSecStrucType",
"(",
"int",
"pos",
",",
"SecStrucType",
"type",
")",
"{",
"SecStrucState",
"ss",
"=",
"getSecStrucState",
"(",
"pos",
")",
";",
"if",
"(",
"type",
".",
"compareTo",
"(",
"ss",
".",
"getType",
"(",
")",
")",
"<",
"0... | Set the new type only if it has more preference than the
current residue SS type.
@param pos
@param type | [
"Set",
"the",
"new",
"type",
"only",
"if",
"it",
"has",
"more",
"preference",
"than",
"the",
"current",
"residue",
"SS",
"type",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L1137-L1140 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/CmsWidgetSetEntryPoint.java | CmsWidgetSetEntryPoint.loadScriptDependencies | public static void loadScriptDependencies(final JsArrayString dependencies, final JavaScriptObject callback) {
if (dependencies.length() == 0) {
return;
}
final Set<String> absoluteUris = new HashSet<String>();
for (int i = 0; i < dependencies.length(); i++) {
absoluteUris.add(WidgetUtil.getAbsoluteUrl(dependencies.get(i)));
}
// Listener that loads the next when one is completed
ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
@Override
public void onError(ResourceLoadEvent event) {
CmsDebugLog.consoleLog(event.getResourceUrl() + " could not be loaded.");
// The show must go on
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
@Override
public void onLoad(ResourceLoadEvent event) {
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
};
ResourceLoader loader = ResourceLoader.get();
for (int i = 0; i < dependencies.length(); i++) {
String preloadUrl = dependencies.get(i);
loader.loadScript(preloadUrl, resourceLoadListener);
}
} | java | public static void loadScriptDependencies(final JsArrayString dependencies, final JavaScriptObject callback) {
if (dependencies.length() == 0) {
return;
}
final Set<String> absoluteUris = new HashSet<String>();
for (int i = 0; i < dependencies.length(); i++) {
absoluteUris.add(WidgetUtil.getAbsoluteUrl(dependencies.get(i)));
}
// Listener that loads the next when one is completed
ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
@Override
public void onError(ResourceLoadEvent event) {
CmsDebugLog.consoleLog(event.getResourceUrl() + " could not be loaded.");
// The show must go on
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
@Override
public void onLoad(ResourceLoadEvent event) {
absoluteUris.remove(event.getResourceUrl());
if (absoluteUris.isEmpty()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
callNativeFunction(callback);
}
});
}
}
};
ResourceLoader loader = ResourceLoader.get();
for (int i = 0; i < dependencies.length(); i++) {
String preloadUrl = dependencies.get(i);
loader.loadScript(preloadUrl, resourceLoadListener);
}
} | [
"public",
"static",
"void",
"loadScriptDependencies",
"(",
"final",
"JsArrayString",
"dependencies",
",",
"final",
"JavaScriptObject",
"callback",
")",
"{",
"if",
"(",
"dependencies",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"final",
... | Loads JavaScript resources into the window context.<p>
@param dependencies the dependencies to load
@param callback the callback to execute once the resources are loaded | [
"Loads",
"JavaScript",
"resources",
"into",
"the",
"window",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsWidgetSetEntryPoint.java#L57-L109 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java | FormatSet.getBasicDateFormatter | public static DateFormat getBasicDateFormatter() { // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | java | public static DateFormat getBasicDateFormatter() { // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | [
"public",
"static",
"DateFormat",
"getBasicDateFormatter",
"(",
")",
"{",
"// PK42263 - made static",
"// Retrieve a standard Java DateFormat object with desired format, using default locale",
"return",
"customizeDateFormat",
"(",
"DateFormat",
".",
"getDateTimeInstance",
"(",
"DateF... | Return a DateFormat object that can be used to format timestamps in the
System.out, System.err and TraceOutput logs. It will use the default date
format. | [
"Return",
"a",
"DateFormat",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"timestamps",
"in",
"the",
"System",
".",
"out",
"System",
".",
"err",
"and",
"TraceOutput",
"logs",
".",
"It",
"will",
"use",
"the",
"default",
"date",
"format",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java#L112-L115 |
duracloud/duracloud | chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java | DuracloudContentWriter.writeChunk | private void writeChunk(String spaceId, ChunkInputStream chunk)
throws NotFoundException {
// Write chunk as a temp file
String chunkId = chunk.getChunkId();
File chunkFile = IOUtil.writeStreamToFile(chunk);
try {
String chunkChecksum = getChunkChecksum(chunkFile);
// Write chunk if it is not already in storage (or jumpstart is enabled)
if (jumpStart || !chunkInStorage(spaceId, chunkId, chunkChecksum)) {
try {
createRetrier().execute(new Retriable() {
private int attempt = 0;
@Override
public Object retry() throws Exception {
attempt++;
try (InputStream chunkStream = new FileInputStream(chunkFile)) {
ChunkInputStream chunkFileStream =
new ChunkInputStream(chunkId,
chunkStream,
chunkFile.length(),
chunk.md5Preserved());
writeSingle(spaceId, chunkChecksum, chunkFileStream, attempt == getMaxRetries() + 1);
}
return "";
}
});
} catch (Exception e) {
String err = "Failed to store chunk with ID " + chunkId +
" in space " + spaceId + " after " + getMaxRetries() +
" attempts. Last error: " + e.getMessage();
throw new DuraCloudRuntimeException(err, e);
}
}
} finally {
if (null != chunkFile && chunkFile.exists()) {
FileUtils.deleteQuietly(chunkFile);
}
}
} | java | private void writeChunk(String spaceId, ChunkInputStream chunk)
throws NotFoundException {
// Write chunk as a temp file
String chunkId = chunk.getChunkId();
File chunkFile = IOUtil.writeStreamToFile(chunk);
try {
String chunkChecksum = getChunkChecksum(chunkFile);
// Write chunk if it is not already in storage (or jumpstart is enabled)
if (jumpStart || !chunkInStorage(spaceId, chunkId, chunkChecksum)) {
try {
createRetrier().execute(new Retriable() {
private int attempt = 0;
@Override
public Object retry() throws Exception {
attempt++;
try (InputStream chunkStream = new FileInputStream(chunkFile)) {
ChunkInputStream chunkFileStream =
new ChunkInputStream(chunkId,
chunkStream,
chunkFile.length(),
chunk.md5Preserved());
writeSingle(spaceId, chunkChecksum, chunkFileStream, attempt == getMaxRetries() + 1);
}
return "";
}
});
} catch (Exception e) {
String err = "Failed to store chunk with ID " + chunkId +
" in space " + spaceId + " after " + getMaxRetries() +
" attempts. Last error: " + e.getMessage();
throw new DuraCloudRuntimeException(err, e);
}
}
} finally {
if (null != chunkFile && chunkFile.exists()) {
FileUtils.deleteQuietly(chunkFile);
}
}
} | [
"private",
"void",
"writeChunk",
"(",
"String",
"spaceId",
",",
"ChunkInputStream",
"chunk",
")",
"throws",
"NotFoundException",
"{",
"// Write chunk as a temp file",
"String",
"chunkId",
"=",
"chunk",
".",
"getChunkId",
"(",
")",
";",
"File",
"chunkFile",
"=",
"I... | /*
Writes chunk to DuraCloud if it does not already exist in DuraCloud with a
matching checksum. Retry failed transfers. | [
"/",
"*",
"Writes",
"chunk",
"to",
"DuraCloud",
"if",
"it",
"does",
"not",
"already",
"exist",
"in",
"DuraCloud",
"with",
"a",
"matching",
"checksum",
".",
"Retry",
"failed",
"transfers",
"."
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java#L198-L240 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getStatsSummary | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | java | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | [
"public",
"Future",
"<",
"List",
"<",
"PlayerStats",
">",
">",
"getStatsSummary",
"(",
"long",
"summoner",
",",
"Season",
"season",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getStatsSummary",
"(",
"summoner",
",",
... | Get player stats for the player
@param summoner The id of the summoner
@param season The season
@return The player's stats
@see <a href=https://developer.riotgames.com/api/methods#!/622/1938>Official API documentation</a> | [
"Get",
"player",
"stats",
"for",
"the",
"player"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1076-L1078 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java | SightResourcesImpl.copySight | public Sight copySight(long sightId, ContainerDestination destination) throws SmartsheetException {
return this.createResource("sights/" + sightId + "/copy", Sight.class, destination);
} | java | public Sight copySight(long sightId, ContainerDestination destination) throws SmartsheetException {
return this.createResource("sights/" + sightId + "/copy", Sight.class, destination);
} | [
"public",
"Sight",
"copySight",
"(",
"long",
"sightId",
",",
"ContainerDestination",
"destination",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"sights/\"",
"+",
"sightId",
"+",
"\"/copy\"",
",",
"Sight",
".",
"class"... | Creates s copy of the specified Sight.
It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/copy
@param sightId the Id of the Sight
@param destination the destination to copy to
@return the newly created Sight resource.
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Creates",
"s",
"copy",
"of",
"the",
"specified",
"Sight",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java#L184-L186 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java | BasicEvaluationCtx.mapAttributes | private void mapAttributes(List<Attribute> input, Map<String, List<Attribute>> output) {
Iterator<Attribute> it = input.iterator();
while (it.hasNext()) {
Attribute attr = it.next();
String id = attr.getId().toString();
if (output.containsKey(id)) {
List<Attribute> list = output.get(id);
list.add(attr);
} else {
List list = new ArrayList<Attribute>();
list.add(attr);
output.put(id, list);
}
}
} | java | private void mapAttributes(List<Attribute> input, Map<String, List<Attribute>> output) {
Iterator<Attribute> it = input.iterator();
while (it.hasNext()) {
Attribute attr = it.next();
String id = attr.getId().toString();
if (output.containsKey(id)) {
List<Attribute> list = output.get(id);
list.add(attr);
} else {
List list = new ArrayList<Attribute>();
list.add(attr);
output.put(id, list);
}
}
} | [
"private",
"void",
"mapAttributes",
"(",
"List",
"<",
"Attribute",
">",
"input",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Attribute",
">",
">",
"output",
")",
"{",
"Iterator",
"<",
"Attribute",
">",
"it",
"=",
"input",
".",
"iterator",
"(",
")",
... | Generic routine for resource, attribute and environment attributes
to build the lookup map for each. The Form is a Map that is indexed
by the String form of the attribute ids, and that contains Sets at
each entry with all attributes that have that id | [
"Generic",
"routine",
"for",
"resource",
"attribute",
"and",
"environment",
"attributes",
"to",
"build",
"the",
"lookup",
"map",
"for",
"each",
".",
"The",
"Form",
"is",
"a",
"Map",
"that",
"is",
"indexed",
"by",
"the",
"String",
"form",
"of",
"the",
"attr... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java#L360-L375 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java | ShareSheetStyle.setCopyUrlStyle | public ShareSheetStyle setCopyUrlStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID, @StringRes int stringMessageID) {
copyUrlIcon_ = getDrawable(context_, drawableIconID);
copyURlText_ = context_.getResources().getString(stringLabelID);
urlCopiedMessage_ = context_.getResources().getString(stringMessageID);
return this;
} | java | public ShareSheetStyle setCopyUrlStyle(@DrawableRes int drawableIconID, @StringRes int stringLabelID, @StringRes int stringMessageID) {
copyUrlIcon_ = getDrawable(context_, drawableIconID);
copyURlText_ = context_.getResources().getString(stringLabelID);
urlCopiedMessage_ = context_.getResources().getString(stringMessageID);
return this;
} | [
"public",
"ShareSheetStyle",
"setCopyUrlStyle",
"(",
"@",
"DrawableRes",
"int",
"drawableIconID",
",",
"@",
"StringRes",
"int",
"stringLabelID",
",",
"@",
"StringRes",
"int",
"stringMessageID",
")",
"{",
"copyUrlIcon_",
"=",
"getDrawable",
"(",
"context_",
",",
"d... | <p> Set the icon, label and success message for copy url option. Default label is "Copy link".</p>
@param drawableIconID Resource ID for the drawable to set as the icon for copy url option. Default icon is system menu_save icon
@param stringLabelID Resource ID for the string label the copy url option. Default label is "Copy link"
@param stringMessageID Resource ID for the string message to show toast message displayed on copying a url
@return A {@link ShareSheetStyle} instance. | [
"<p",
">",
"Set",
"the",
"icon",
"label",
"and",
"success",
"message",
"for",
"copy",
"url",
"option",
".",
"Default",
"label",
"is",
"Copy",
"link",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java#L135-L140 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.rectangleGaussian | public static DMatrixRMaj rectangleGaussian(int numRow , int numCol , double mean , double stdev , Random rand )
{
DMatrixRMaj m = new DMatrixRMaj(numRow,numCol);
fillGaussian(m,mean,stdev,rand);
return m;
} | java | public static DMatrixRMaj rectangleGaussian(int numRow , int numCol , double mean , double stdev , Random rand )
{
DMatrixRMaj m = new DMatrixRMaj(numRow,numCol);
fillGaussian(m,mean,stdev,rand);
return m;
} | [
"public",
"static",
"DMatrixRMaj",
"rectangleGaussian",
"(",
"int",
"numRow",
",",
"int",
"numCol",
",",
"double",
"mean",
",",
"double",
"stdev",
",",
"Random",
"rand",
")",
"{",
"DMatrixRMaj",
"m",
"=",
"new",
"DMatrixRMaj",
"(",
"numRow",
",",
"numCol",
... | <p>
Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and
standard deviation
</p>
@param numRow Number of rows in the new matrix.
@param numCol Number of columns in the new matrix.
@param mean Mean value in the distribution
@param stdev Standard deviation in the distribution
@param rand Random number generator used to fill the matrix. | [
"<p",
">",
"Sets",
"each",
"element",
"in",
"the",
"matrix",
"to",
"a",
"value",
"drawn",
"from",
"an",
"Gaussian",
"distribution",
"with",
"the",
"specified",
"mean",
"and",
"standard",
"deviation",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L404-L409 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java | ImageIOGreyScale.getImageReadersByFormatName | public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | java | public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFormatNamesMethod, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageReaderIterator(iter);
} | [
"public",
"static",
"Iterator",
"<",
"ImageReader",
">",
"getImageReadersByFormatName",
"(",
"String",
"formatName",
")",
"{",
"if",
"(",
"formatName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"formatName == null!\"",
")",
";",
"}... | Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that
claim to be able to decode the named format.
@param formatName
a <code>String</code> containing the informal name of a format (<i>e.g.</i>, "jpeg" or
"tiff".
@return an <code>Iterator</code> containing <code>ImageReader</code>s.
@exception IllegalArgumentException
if <code>formatName</code> is <code>null</code>.
@see javax.imageio.spi.ImageReaderSpi#getFormatNames | [
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"containing",
"all",
"currently",
"registered",
"<code",
">",
"ImageReader<",
"/",
"code",
">",
"s",
"that",
"claim",
"to",
"be",
"able",
"to",
"decode",
"the",
"named",
"format",
"."
] | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L624-L636 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java | AudioFactory.loadAudio | public static synchronized Audio loadAudio(Media media)
{
Check.notNull(media);
final String extension = UtilFile.getExtension(media.getPath());
return Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media);
} | java | public static synchronized Audio loadAudio(Media media)
{
Check.notNull(media);
final String extension = UtilFile.getExtension(media.getPath());
return Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media);
} | [
"public",
"static",
"synchronized",
"Audio",
"loadAudio",
"(",
"Media",
"media",
")",
"{",
"Check",
".",
"notNull",
"(",
"media",
")",
";",
"final",
"String",
"extension",
"=",
"UtilFile",
".",
"getExtension",
"(",
"media",
".",
"getPath",
"(",
")",
")",
... | Load an audio file and prepare it to be played.
@param media The audio media (must not be <code>null</code>).
@return The loaded audio.
@throws LionEngineException If invalid audio. | [
"Load",
"an",
"audio",
"file",
"and",
"prepare",
"it",
"to",
"be",
"played",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java#L51-L59 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java | DBSCAN.runDBSCAN | protected void runDBSCAN(Relation<O> relation, RangeQuery<O> rangeQuery) {
final int size = relation.size();
FiniteProgress objprog = LOG.isVerbose() ? new FiniteProgress("Processing objects", size, LOG) : null;
IndefiniteProgress clusprog = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters", LOG) : null;
processedIDs = DBIDUtil.newHashSet(size);
ArrayModifiableDBIDs seeds = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(!processedIDs.contains(iditer)) {
expandCluster(relation, rangeQuery, iditer, seeds, objprog, clusprog);
}
if(objprog != null && clusprog != null) {
objprog.setProcessed(processedIDs.size(), LOG);
clusprog.setProcessed(resultList.size(), LOG);
}
if(processedIDs.size() == size) {
break;
}
}
// Finish progress logging
LOG.ensureCompleted(objprog);
LOG.setCompleted(clusprog);
} | java | protected void runDBSCAN(Relation<O> relation, RangeQuery<O> rangeQuery) {
final int size = relation.size();
FiniteProgress objprog = LOG.isVerbose() ? new FiniteProgress("Processing objects", size, LOG) : null;
IndefiniteProgress clusprog = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters", LOG) : null;
processedIDs = DBIDUtil.newHashSet(size);
ArrayModifiableDBIDs seeds = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(!processedIDs.contains(iditer)) {
expandCluster(relation, rangeQuery, iditer, seeds, objprog, clusprog);
}
if(objprog != null && clusprog != null) {
objprog.setProcessed(processedIDs.size(), LOG);
clusprog.setProcessed(resultList.size(), LOG);
}
if(processedIDs.size() == size) {
break;
}
}
// Finish progress logging
LOG.ensureCompleted(objprog);
LOG.setCompleted(clusprog);
} | [
"protected",
"void",
"runDBSCAN",
"(",
"Relation",
"<",
"O",
">",
"relation",
",",
"RangeQuery",
"<",
"O",
">",
"rangeQuery",
")",
"{",
"final",
"int",
"size",
"=",
"relation",
".",
"size",
"(",
")",
";",
"FiniteProgress",
"objprog",
"=",
"LOG",
".",
"... | Run the DBSCAN algorithm
@param relation Data relation
@param rangeQuery Range query class | [
"Run",
"the",
"DBSCAN",
"algorithm"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java#L175-L197 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicatedCloud_serviceName_upgradeRessource_GET | public ArrayList<String> dedicatedCloud_serviceName_upgradeRessource_GET(String serviceName, OvhUpgradeTypeEnum upgradeType, Long upgradedRessourceId, OvhUpgradeRessourceTypeEnum upgradedRessourceType) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/upgradeRessource";
StringBuilder sb = path(qPath, serviceName);
query(sb, "upgradeType", upgradeType);
query(sb, "upgradedRessourceId", upgradedRessourceId);
query(sb, "upgradedRessourceType", upgradedRessourceType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> dedicatedCloud_serviceName_upgradeRessource_GET(String serviceName, OvhUpgradeTypeEnum upgradeType, Long upgradedRessourceId, OvhUpgradeRessourceTypeEnum upgradedRessourceType) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/upgradeRessource";
StringBuilder sb = path(qPath, serviceName);
query(sb, "upgradeType", upgradeType);
query(sb, "upgradedRessourceId", upgradedRessourceId);
query(sb, "upgradedRessourceType", upgradedRessourceType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"dedicatedCloud_serviceName_upgradeRessource_GET",
"(",
"String",
"serviceName",
",",
"OvhUpgradeTypeEnum",
"upgradeType",
",",
"Long",
"upgradedRessourceId",
",",
"OvhUpgradeRessourceTypeEnum",
"upgradedRessourceType",
")",
"throws",
... | Get allowed durations for 'upgradeRessource' option
REST: GET /order/dedicatedCloud/{serviceName}/upgradeRessource
@param upgradedRessourceType [required] The type of ressource you want to upgrade.
@param upgradedRessourceId [required] The id of a particular ressource you want to upgrade in your Private Cloud (useless for "all" UpgradeRessourceTypeEnum)
@param upgradeType [required] The type of upgrade you want to process on the ressource(s)
@param serviceName [required] | [
"Get",
"allowed",
"durations",
"for",
"upgradeRessource",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5735-L5743 |
kiegroup/drools | drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/Providers.java | Providers.resourceProvider | public static Provider resourceProvider(String pathToResource, Charset encoding) throws IOException {
ClassLoader classLoader = Provider.class.getClassLoader();
return resourceProvider(classLoader, pathToResource, encoding);
} | java | public static Provider resourceProvider(String pathToResource, Charset encoding) throws IOException {
ClassLoader classLoader = Provider.class.getClassLoader();
return resourceProvider(classLoader, pathToResource, encoding);
} | [
"public",
"static",
"Provider",
"resourceProvider",
"(",
"String",
"pathToResource",
",",
"Charset",
"encoding",
")",
"throws",
"IOException",
"{",
"ClassLoader",
"classLoader",
"=",
"Provider",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"return",
"resour... | Provide a Provider from the resource found in the current class loader with the provided encoding.<br/> As
resource is accessed through a class loader, a leading "/" is not allowed in pathToResource | [
"Provide",
"a",
"Provider",
"from",
"the",
"resource",
"found",
"in",
"the",
"current",
"class",
"loader",
"with",
"the",
"provided",
"encoding",
".",
"<br",
"/",
">",
"As",
"resource",
"is",
"accessed",
"through",
"a",
"class",
"loader",
"a",
"leading",
"... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/Providers.java#L106-L109 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java | CommonsAssert.assertEquals | public static <T> void assertEquals (@Nullable final String sUserMsg, @Nullable final T x, @Nullable final T y)
{
if (!EqualsHelper.equals (x, y))
fail ("<" +
x +
"> is not equal to <" +
y +
">" +
(sUserMsg != null && sUserMsg.length () > 0 ? ": " + sUserMsg : ""));
} | java | public static <T> void assertEquals (@Nullable final String sUserMsg, @Nullable final T x, @Nullable final T y)
{
if (!EqualsHelper.equals (x, y))
fail ("<" +
x +
"> is not equal to <" +
y +
">" +
(sUserMsg != null && sUserMsg.length () > 0 ? ": " + sUserMsg : ""));
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertEquals",
"(",
"@",
"Nullable",
"final",
"String",
"sUserMsg",
",",
"@",
"Nullable",
"final",
"T",
"x",
",",
"@",
"Nullable",
"final",
"T",
"y",
")",
"{",
"if",
"(",
"!",
"EqualsHelper",
".",
"equals",
... | Like JUnit assertEquals but using {@link EqualsHelper}.
@param sUserMsg
Optional user message. May be <code>null</code>.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>. | [
"Like",
"JUnit",
"assertEquals",
"but",
"using",
"{",
"@link",
"EqualsHelper",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java#L185-L194 |
kirgor/enklib | ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java | Bean.afterInvoke | protected void afterInvoke(Method method, Object[] params) throws Exception {
// Close the session
if (session != null) {
session.close();
}
} | java | protected void afterInvoke(Method method, Object[] params) throws Exception {
// Close the session
if (session != null) {
session.close();
}
} | [
"protected",
"void",
"afterInvoke",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"Exception",
"{",
"// Close the session",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"session",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Called by interceptor after bean method has been invoked.
<p/>
It's important to call base method in override-method, since it closes SQL session.
@param method Method, which has just been invoked.
@param params Method params.
@throws Exception | [
"Called",
"by",
"interceptor",
"after",
"bean",
"method",
"has",
"been",
"invoked",
".",
"<p",
"/",
">",
"It",
"s",
"important",
"to",
"call",
"base",
"method",
"in",
"override",
"-",
"method",
"since",
"it",
"closes",
"SQL",
"session",
"."
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L143-L148 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSubdocumentResponseMessages | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request;
long cas = msg.getCAS();
short statusCode = msg.getStatus();
String bucket = request.bucket();
MutationToken mutationToken = null;
if (msg.getExtrasLength() > 0) {
mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition());
}
ByteBuf fragment;
if (msg.content() != null && msg.content().readableBytes() > 0) {
fragment = msg.content();
} else if (msg.content() != null) {
msg.content().release();
fragment = Unpooled.EMPTY_BUFFER;
} else {
fragment = Unpooled.EMPTY_BUFFER;
}
return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken);
} | java | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request;
long cas = msg.getCAS();
short statusCode = msg.getStatus();
String bucket = request.bucket();
MutationToken mutationToken = null;
if (msg.getExtrasLength() > 0) {
mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition());
}
ByteBuf fragment;
if (msg.content() != null && msg.content().readableBytes() > 0) {
fragment = msg.content();
} else if (msg.content() != null) {
msg.content().release();
fragment = Unpooled.EMPTY_BUFFER;
} else {
fragment = Unpooled.EMPTY_BUFFER;
}
return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken);
} | [
"private",
"static",
"CouchbaseResponse",
"handleSubdocumentResponseMessages",
"(",
"BinaryRequest",
"request",
",",
"FullBinaryMemcacheResponse",
"msg",
",",
"ChannelHandlerContext",
"ctx",
",",
"ResponseStatus",
"status",
",",
"boolean",
"seqOnMutation",
")",
"{",
"if",
... | Helper method to decode all simple subdocument response messages.
@param request the current request.
@param msg the current response message.
@param ctx the handler context.
@param status the response status code.
@return the decoded response or null if none did match. | [
"Helper",
"method",
"to",
"decode",
"all",
"simple",
"subdocument",
"response",
"messages",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1154-L1179 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.infov | public void infov(String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void infov(String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"infov",
"(",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"INFO",
")",
")",
"{",
"doLog",
"(",
"Level",
".",
"INFO",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"]",... | Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the sole parameter | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"INFO",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1032-L1036 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java | DecimalStyle.withZeroDigit | public DecimalStyle withZeroDigit(char zeroDigit) {
if (zeroDigit == this.zeroDigit) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | java | public DecimalStyle withZeroDigit(char zeroDigit) {
if (zeroDigit == this.zeroDigit) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | [
"public",
"DecimalStyle",
"withZeroDigit",
"(",
"char",
"zeroDigit",
")",
"{",
"if",
"(",
"zeroDigit",
"==",
"this",
".",
"zeroDigit",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"DecimalStyle",
"(",
"zeroDigit",
",",
"positiveSign",
",",
"negativ... | Returns a copy of the info with a new character that represents zero.
<p>
The character used to represent digits may vary by culture.
This method specifies the zero character to use, which implies the characters for one to nine.
@param zeroDigit the character for zero
@return a copy with a new character that represents zero, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"info",
"with",
"a",
"new",
"character",
"that",
"represents",
"zero",
".",
"<p",
">",
"The",
"character",
"used",
"to",
"represent",
"digits",
"may",
"vary",
"by",
"culture",
".",
"This",
"method",
"specifies",
"the",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L216-L221 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/PaymentSession.java | PaymentSession.presentShippingFlow | public void presentShippingFlow() {
final Intent intent = new Intent(mHostActivity, PaymentFlowActivity.class)
.putExtra(PAYMENT_SESSION_CONFIG, mPaymentSessionConfig)
.putExtra(PAYMENT_SESSION_DATA_KEY, mPaymentSessionData)
.putExtra(EXTRA_PAYMENT_SESSION_ACTIVE, true);
mHostActivity.startActivityForResult(intent, PAYMENT_SHIPPING_DETAILS_REQUEST);
} | java | public void presentShippingFlow() {
final Intent intent = new Intent(mHostActivity, PaymentFlowActivity.class)
.putExtra(PAYMENT_SESSION_CONFIG, mPaymentSessionConfig)
.putExtra(PAYMENT_SESSION_DATA_KEY, mPaymentSessionData)
.putExtra(EXTRA_PAYMENT_SESSION_ACTIVE, true);
mHostActivity.startActivityForResult(intent, PAYMENT_SHIPPING_DETAILS_REQUEST);
} | [
"public",
"void",
"presentShippingFlow",
"(",
")",
"{",
"final",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"mHostActivity",
",",
"PaymentFlowActivity",
".",
"class",
")",
".",
"putExtra",
"(",
"PAYMENT_SESSION_CONFIG",
",",
"mPaymentSessionConfig",
")",
".",
... | Launch the {@link PaymentFlowActivity} to allow the user to fill in payment details. | [
"Launch",
"the",
"{"
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/PaymentSession.java#L204-L210 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.padNext | public DateTimeFormatterBuilder padNext(int padWidth, char padChar) {
if (padWidth < 1) {
throw new IllegalArgumentException("The pad width must be at least one but was " + padWidth);
}
active.padNextWidth = padWidth;
active.padNextChar = padChar;
active.valueParserIndex = -1;
return this;
} | java | public DateTimeFormatterBuilder padNext(int padWidth, char padChar) {
if (padWidth < 1) {
throw new IllegalArgumentException("The pad width must be at least one but was " + padWidth);
}
active.padNextWidth = padWidth;
active.padNextChar = padChar;
active.valueParserIndex = -1;
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"padNext",
"(",
"int",
"padWidth",
",",
"char",
"padChar",
")",
"{",
"if",
"(",
"padWidth",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The pad width must be at least one but was \"",
"+",
"padWidth",
... | Causes the next added printer/parser to pad to a fixed width.
<p>
This padding is intended for padding other than zero-padding.
Zero-padding should be achieved using the appendValue methods.
<p>
During formatting, the decorated element will be output and then padded
to the specified width. An exception will be thrown during printing if
the pad width is exceeded.
<p>
During parsing, the padding and decorated element are parsed.
If parsing is lenient, then the pad width is treated as a maximum.
If parsing is case insensitive, then the pad character is matched ignoring case.
The padding is parsed greedily. Thus, if the decorated element starts with
the pad character, it will not be parsed.
@param padWidth the pad width, 1 or greater
@param padChar the pad character
@return this, for chaining, not null
@throws IllegalArgumentException if pad width is too small | [
"Causes",
"the",
"next",
"added",
"printer",
"/",
"parser",
"to",
"pad",
"to",
"a",
"fixed",
"width",
".",
"<p",
">",
"This",
"padding",
"is",
"intended",
"for",
"padding",
"other",
"than",
"zero",
"-",
"padding",
".",
"Zero",
"-",
"padding",
"should",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L1751-L1759 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.