repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java | EJBApplicationMetaData.finishStarting | private void finishStarting() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finishStarting: " + ivName);
// NOTE - Any state that is cleared here should also be cleared in
// stoppingModule.
if (ivModules != null) { // F743-26072
notifyApplicationEventListeners(ivModules, true);
}
// Signal that the application is "fully started".
unblockThreadsWaitingForStart(); // F743-15941
synchronized (this) {
// F743-506 - Now that the application is fully started, start the
// queued non-persistent timers.
if (ivQueuedNonPersistentTimers != null) {
startQueuedNonPersistentTimerAlarms();
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finishStarting");
} | java | private void finishStarting() throws RuntimeWarning {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finishStarting: " + ivName);
// NOTE - Any state that is cleared here should also be cleared in
// stoppingModule.
if (ivModules != null) { // F743-26072
notifyApplicationEventListeners(ivModules, true);
}
// Signal that the application is "fully started".
unblockThreadsWaitingForStart(); // F743-15941
synchronized (this) {
// F743-506 - Now that the application is fully started, start the
// queued non-persistent timers.
if (ivQueuedNonPersistentTimers != null) {
startQueuedNonPersistentTimerAlarms();
ivQueuedNonPersistentTimers = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finishStarting");
} | [
"private",
"void",
"finishStarting",
"(",
")",
"throws",
"RuntimeWarning",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"en... | Notification that the application is about to finish starting. Performs processing of
singletons after all modules have been started but before the application has
finished starting. Module references are resolved, and startup singletons are
started.
@throws RuntimeWarning
if a dependency reference cannot be resolved or a startup singleton fails
to initialize | [
"Notification",
"that",
"the",
"application",
"is",
"about",
"to",
"finish",
"starting",
".",
"Performs",
"processing",
"of",
"singletons",
"after",
"all",
"modules",
"have",
"been",
"started",
"but",
"before",
"the",
"application",
"has",
"finished",
"starting",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/EJBApplicationMetaData.java#L621-L647 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getAzureReachabilityReport | public AzureReachabilityReportInner getAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) {
return getAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | java | public AzureReachabilityReportInner getAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) {
return getAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | [
"public",
"AzureReachabilityReportInner",
"getAzureReachabilityReport",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"AzureReachabilityReportParameters",
"parameters",
")",
"{",
"return",
"getAzureReachabilityReportWithServiceResponseAsync",
"(",
"r... | Gets the relative latency score for internet service providers from a specified location to Azure regions.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that determine Azure reachability report configuration.
@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 AzureReachabilityReportInner object if successful. | [
"Gets",
"the",
"relative",
"latency",
"score",
"for",
"internet",
"service",
"providers",
"from",
"a",
"specified",
"location",
"to",
"Azure",
"regions",
"."
] | 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/NetworkWatchersInner.java#L2308-L2310 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/RandomUtils.java | RandomUtils.randomLongBetween | public static long randomLongBetween(long lowerBound, long upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException("lower bound higher than upper bound");
}
return lowerBound + (long) (rand.nextDouble() * (upperBound - lowerBound));
} | java | public static long randomLongBetween(long lowerBound, long upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException("lower bound higher than upper bound");
}
return lowerBound + (long) (rand.nextDouble() * (upperBound - lowerBound));
} | [
"public",
"static",
"long",
"randomLongBetween",
"(",
"long",
"lowerBound",
",",
"long",
"upperBound",
")",
"{",
"if",
"(",
"upperBound",
"<",
"lowerBound",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"lower bound higher than upper bound\"",
")",
";... | Returns a random <code>long</code> value out of a specified range
@param lowerBound Lower bound of the target range (inclusive)
@param upperBound Upper bound of the target range (exclusive)
@return A random <code>long</code> value out of a specified range | [
"Returns",
"a",
"random",
"<code",
">",
"long<",
"/",
"code",
">",
"value",
"out",
"of",
"a",
"specified",
"range"
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/RandomUtils.java#L91-L96 |
apereo/cas | support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/UrlResourceMetadataResolver.java | UrlResourceMetadataResolver.getBackupMetadataFilenamePrefix | @SneakyThrows
protected String getBackupMetadataFilenamePrefix(final AbstractResource metadataResource, final SamlRegisteredService service) {
val mdFileName = metadataResource.getFilename();
if (StringUtils.isBlank(mdFileName)) {
throw new FileNotFoundException("Unable to determine filename for " + metadataResource);
}
val fileName = service.getMetadataLocation();
val sha = DigestUtils.sha(fileName);
LOGGER.trace("Metadata backup file for metadata location [{}] is linked to [{}]", fileName, sha);
return sha;
} | java | @SneakyThrows
protected String getBackupMetadataFilenamePrefix(final AbstractResource metadataResource, final SamlRegisteredService service) {
val mdFileName = metadataResource.getFilename();
if (StringUtils.isBlank(mdFileName)) {
throw new FileNotFoundException("Unable to determine filename for " + metadataResource);
}
val fileName = service.getMetadataLocation();
val sha = DigestUtils.sha(fileName);
LOGGER.trace("Metadata backup file for metadata location [{}] is linked to [{}]", fileName, sha);
return sha;
} | [
"@",
"SneakyThrows",
"protected",
"String",
"getBackupMetadataFilenamePrefix",
"(",
"final",
"AbstractResource",
"metadataResource",
",",
"final",
"SamlRegisteredService",
"service",
")",
"{",
"val",
"mdFileName",
"=",
"metadataResource",
".",
"getFilename",
"(",
")",
"... | Gets backup metadata filename prefix.
<p>
The metadata source may be an aggregate, representing more than on entity id
inside the single registered service definition. Therefor, using the service's
name or id may not be appropriate choice as compounds in the metadata file name.
@param metadataResource the metadata resource
@param service the service
@return the backup metadata filename prefix | [
"Gets",
"backup",
"metadata",
"filename",
"prefix",
".",
"<p",
">",
"The",
"metadata",
"source",
"may",
"be",
"an",
"aggregate",
"representing",
"more",
"than",
"on",
"entity",
"id",
"inside",
"the",
"single",
"registered",
"service",
"definition",
".",
"There... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/UrlResourceMetadataResolver.java#L211-L221 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/StreamUtil.java | StreamUtil.toLinkedMap | public static <T, K, U> Collector<T, ?, LinkedHashMap<K, U>> toLinkedMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends U> valueMapper) {
BinaryOperator<U> mergeFunction = throwingMerger();
return toLinkedMap(keyMapper, valueMapper, mergeFunction);
} | java | public static <T, K, U> Collector<T, ?, LinkedHashMap<K, U>> toLinkedMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends U> valueMapper) {
BinaryOperator<U> mergeFunction = throwingMerger();
return toLinkedMap(keyMapper, valueMapper, mergeFunction);
} | [
"public",
"static",
"<",
"T",
",",
"K",
",",
"U",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"LinkedHashMap",
"<",
"K",
",",
"U",
">",
">",
"toLinkedMap",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"keyMapper",
",",
... | Collects a stream to a LinkedHashMap, each stream element is expected to produce map entry.
@param keyMapper function to deal with keys.
@param valueMapper function to deal with values.
@param <T> type of element in input stream.
@param <K> type of key for created map.
@param <U> type of value for created map.
@return map with a key/value for each item in the stream.
@throws IllegalArgumentException if keyMapper produces the same key multiple times. | [
"Collects",
"a",
"stream",
"to",
"a",
"LinkedHashMap",
"each",
"stream",
"element",
"is",
"expected",
"to",
"produce",
"map",
"entry",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/StreamUtil.java#L27-L31 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.elementExp | public static void elementExp(DMatrixD1 A , DMatrixD1 C ) {
if( A.numCols != C.numCols || A.numRows != C.numRows ) {
throw new MatrixDimensionException("All matrices must be the same shape");
}
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
C.data[i] = Math.exp(A.data[i]);
}
} | java | public static void elementExp(DMatrixD1 A , DMatrixD1 C ) {
if( A.numCols != C.numCols || A.numRows != C.numRows ) {
throw new MatrixDimensionException("All matrices must be the same shape");
}
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
C.data[i] = Math.exp(A.data[i]);
}
} | [
"public",
"static",
"void",
"elementExp",
"(",
"DMatrixD1",
"A",
",",
"DMatrixD1",
"C",
")",
"{",
"if",
"(",
"A",
".",
"numCols",
"!=",
"C",
".",
"numCols",
"||",
"A",
".",
"numRows",
"!=",
"C",
".",
"numRows",
")",
"{",
"throw",
"new",
"MatrixDimens... | <p>
Element-wise exp operation <br>
c<sub>ij</sub> = Math.log(a<sub>ij</sub>)
<p>
@param A input
@param C output (modified) | [
"<p",
">",
"Element",
"-",
"wise",
"exp",
"operation",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"Math",
".",
"log",
"(",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
")",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1728-L1738 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.openDatabase | public static SQLiteDatabase openDatabase(String path, CursorFactory factory, int flags,
DatabaseErrorHandler errorHandler) {
SQLiteDatabase db = new SQLiteDatabase(path, flags, factory, errorHandler);
db.open();
return db;
} | java | public static SQLiteDatabase openDatabase(String path, CursorFactory factory, int flags,
DatabaseErrorHandler errorHandler) {
SQLiteDatabase db = new SQLiteDatabase(path, flags, factory, errorHandler);
db.open();
return db;
} | [
"public",
"static",
"SQLiteDatabase",
"openDatabase",
"(",
"String",
"path",
",",
"CursorFactory",
"factory",
",",
"int",
"flags",
",",
"DatabaseErrorHandler",
"errorHandler",
")",
"{",
"SQLiteDatabase",
"db",
"=",
"new",
"SQLiteDatabase",
"(",
"path",
",",
"flags... | Open the database according to the flags {@link #OPEN_READWRITE}
{@link #OPEN_READONLY} {@link #CREATE_IF_NECESSARY} and/or {@link #NO_LOCALIZED_COLLATORS}.
<p>Sets the locale of the database to the the system's current locale.
Call {@link #setLocale} if you would like something else.</p>
<p>Accepts input param: a concrete instance of {@link DatabaseErrorHandler} to be
used to handle corruption when sqlite reports database corruption.</p>
@param path to database file to open and/or create
@param factory an optional factory class that is called to instantiate a
cursor when query is called, or null for default
@param flags to control database access mode
@param errorHandler the {@link DatabaseErrorHandler} obj to be used to handle corruption
when sqlite reports database corruption
@return the newly opened database
@throws SQLiteException if the database cannot be opened | [
"Open",
"the",
"database",
"according",
"to",
"the",
"flags",
"{",
"@link",
"#OPEN_READWRITE",
"}",
"{",
"@link",
"#OPEN_READONLY",
"}",
"{",
"@link",
"#CREATE_IF_NECESSARY",
"}",
"and",
"/",
"or",
"{",
"@link",
"#NO_LOCALIZED_COLLATORS",
"}",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L695-L700 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java | CPSpecificationOptionPersistenceImpl.findByG_K | @Override
public CPSpecificationOption findByG_K(long groupId, String key)
throws NoSuchCPSpecificationOptionException {
CPSpecificationOption cpSpecificationOption = fetchByG_K(groupId, key);
if (cpSpecificationOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPSpecificationOptionException(msg.toString());
}
return cpSpecificationOption;
} | java | @Override
public CPSpecificationOption findByG_K(long groupId, String key)
throws NoSuchCPSpecificationOptionException {
CPSpecificationOption cpSpecificationOption = fetchByG_K(groupId, key);
if (cpSpecificationOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPSpecificationOptionException(msg.toString());
}
return cpSpecificationOption;
} | [
"@",
"Override",
"public",
"CPSpecificationOption",
"findByG_K",
"(",
"long",
"groupId",
",",
"String",
"key",
")",
"throws",
"NoSuchCPSpecificationOptionException",
"{",
"CPSpecificationOption",
"cpSpecificationOption",
"=",
"fetchByG_K",
"(",
"groupId",
",",
"key",
")... | Returns the cp specification option where groupId = ? and key = ? or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found.
@param groupId the group ID
@param key the key
@return the matching cp specification option
@throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found | [
"Returns",
"the",
"cp",
"specification",
"option",
"where",
"groupId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPSpecificationOptionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L2551-L2577 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/models/LIBORMarketModelFromCovarianceModel.java | LIBORMarketModelFromCovarianceModel.getOnePlusInterpolatedLIBORDt | private RandomVariable getOnePlusInterpolatedLIBORDt(int timeIndex, double periodStartTime, int liborPeriodIndex) throws CalculationException
{
double tenorPeriodStartTime = getLiborPeriod(liborPeriodIndex);
double tenorPeriodEndTime = getLiborPeriod(liborPeriodIndex + 1);
double tenorDt = tenorPeriodEndTime - tenorPeriodStartTime;
if(tenorPeriodStartTime < getTime(timeIndex)) {
// Fixed at Long LIBOR period Start.
timeIndex = Math.min(timeIndex, getTimeIndex(tenorPeriodStartTime));
if(timeIndex < 0) {
// timeIndex = -timeIndex-2; // mapping to last known fixing.
throw new IllegalArgumentException("Tenor discretization not part of time discretization.");
}
}
RandomVariable onePlusLongLIBORDt = getLIBOR(timeIndex , liborPeriodIndex).mult(tenorDt).add(1.0);
double smallDt = tenorPeriodEndTime - periodStartTime;
double alpha = smallDt / tenorDt;
RandomVariable onePlusInterpolatedLIBORDt;
switch(interpolationMethod)
{
case LINEAR:
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.mult(alpha).add(1 - alpha);
break;
case LOG_LINEAR_UNCORRECTED:
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.log().mult(alpha).exp();
break;
case LOG_LINEAR_CORRECTED:
double adjustmentCoefficient = 0.5 * smallDt * (tenorPeriodStartTime - periodStartTime);
RandomVariable adjustment = getInterpolationDriftAdjustment(timeIndex, liborPeriodIndex);
adjustment = adjustment.mult(adjustmentCoefficient);
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.log().mult(alpha).sub(adjustment).exp();
break;
default: throw new IllegalArgumentException("Method for enum " + interpolationMethod.name() + " not implemented!");
}
// Analytic adjustment for the interpolation
// @TODO reference to AnalyticModelFromCuvesAndVols must not be null
// @TODO This adjustment only applies if the corresponding adjustment in getNumeraire is enabled
double analyticOnePlusLongLIBORDt = 1 + getForwardRateCurve().getForward(getAnalyticModel(), tenorPeriodStartTime, tenorDt) * tenorDt;
double analyticOnePlusShortLIBORDt = 1 + getForwardRateCurve().getForward(getAnalyticModel(), periodStartTime, smallDt) * smallDt;
double analyticOnePlusInterpolatedLIBORDt;
switch(interpolationMethod)
{
case LINEAR:
analyticOnePlusInterpolatedLIBORDt = analyticOnePlusLongLIBORDt * alpha + (1-alpha);
break;
case LOG_LINEAR_UNCORRECTED:
case LOG_LINEAR_CORRECTED:
analyticOnePlusInterpolatedLIBORDt = Math.exp(Math.log(analyticOnePlusLongLIBORDt) * alpha);
break;
default: throw new IllegalArgumentException("Method for enum " + interpolationMethod.name() + " not implemented!");
}
onePlusInterpolatedLIBORDt = onePlusInterpolatedLIBORDt.mult(analyticOnePlusShortLIBORDt / analyticOnePlusInterpolatedLIBORDt);
return onePlusInterpolatedLIBORDt;
} | java | private RandomVariable getOnePlusInterpolatedLIBORDt(int timeIndex, double periodStartTime, int liborPeriodIndex) throws CalculationException
{
double tenorPeriodStartTime = getLiborPeriod(liborPeriodIndex);
double tenorPeriodEndTime = getLiborPeriod(liborPeriodIndex + 1);
double tenorDt = tenorPeriodEndTime - tenorPeriodStartTime;
if(tenorPeriodStartTime < getTime(timeIndex)) {
// Fixed at Long LIBOR period Start.
timeIndex = Math.min(timeIndex, getTimeIndex(tenorPeriodStartTime));
if(timeIndex < 0) {
// timeIndex = -timeIndex-2; // mapping to last known fixing.
throw new IllegalArgumentException("Tenor discretization not part of time discretization.");
}
}
RandomVariable onePlusLongLIBORDt = getLIBOR(timeIndex , liborPeriodIndex).mult(tenorDt).add(1.0);
double smallDt = tenorPeriodEndTime - periodStartTime;
double alpha = smallDt / tenorDt;
RandomVariable onePlusInterpolatedLIBORDt;
switch(interpolationMethod)
{
case LINEAR:
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.mult(alpha).add(1 - alpha);
break;
case LOG_LINEAR_UNCORRECTED:
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.log().mult(alpha).exp();
break;
case LOG_LINEAR_CORRECTED:
double adjustmentCoefficient = 0.5 * smallDt * (tenorPeriodStartTime - periodStartTime);
RandomVariable adjustment = getInterpolationDriftAdjustment(timeIndex, liborPeriodIndex);
adjustment = adjustment.mult(adjustmentCoefficient);
onePlusInterpolatedLIBORDt = onePlusLongLIBORDt.log().mult(alpha).sub(adjustment).exp();
break;
default: throw new IllegalArgumentException("Method for enum " + interpolationMethod.name() + " not implemented!");
}
// Analytic adjustment for the interpolation
// @TODO reference to AnalyticModelFromCuvesAndVols must not be null
// @TODO This adjustment only applies if the corresponding adjustment in getNumeraire is enabled
double analyticOnePlusLongLIBORDt = 1 + getForwardRateCurve().getForward(getAnalyticModel(), tenorPeriodStartTime, tenorDt) * tenorDt;
double analyticOnePlusShortLIBORDt = 1 + getForwardRateCurve().getForward(getAnalyticModel(), periodStartTime, smallDt) * smallDt;
double analyticOnePlusInterpolatedLIBORDt;
switch(interpolationMethod)
{
case LINEAR:
analyticOnePlusInterpolatedLIBORDt = analyticOnePlusLongLIBORDt * alpha + (1-alpha);
break;
case LOG_LINEAR_UNCORRECTED:
case LOG_LINEAR_CORRECTED:
analyticOnePlusInterpolatedLIBORDt = Math.exp(Math.log(analyticOnePlusLongLIBORDt) * alpha);
break;
default: throw new IllegalArgumentException("Method for enum " + interpolationMethod.name() + " not implemented!");
}
onePlusInterpolatedLIBORDt = onePlusInterpolatedLIBORDt.mult(analyticOnePlusShortLIBORDt / analyticOnePlusInterpolatedLIBORDt);
return onePlusInterpolatedLIBORDt;
} | [
"private",
"RandomVariable",
"getOnePlusInterpolatedLIBORDt",
"(",
"int",
"timeIndex",
",",
"double",
"periodStartTime",
",",
"int",
"liborPeriodIndex",
")",
"throws",
"CalculationException",
"{",
"double",
"tenorPeriodStartTime",
"=",
"getLiborPeriod",
"(",
"liborPeriodInd... | Implement the interpolation of the forward rate in tenor time.
The method provides the forward rate \( F(t_{i}, S, T_{j+1}) \) where \( S \in [T_{j}, T_{j+1}] \).
@param timeIndex The time index associated with the simulation time. The index i in \( t_{i} \).
@param periodStartTime The period start time S (on which we interpolate).
@param liborPeriodIndex The period index j for which \( S \in [T_{j}, T_{j+1}] \) (to avoid another lookup).
@return The interpolated forward rate.
@throws CalculationException Thrown if valuation failed. | [
"Implement",
"the",
"interpolation",
"of",
"the",
"forward",
"rate",
"in",
"tenor",
"time",
".",
"The",
"method",
"provides",
"the",
"forward",
"rate",
"\\",
"(",
"F",
"(",
"t_",
"{",
"i",
"}",
"S",
"T_",
"{",
"j",
"+",
"1",
"}",
")",
"\\",
")",
... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/models/LIBORMarketModelFromCovarianceModel.java#L1304-L1361 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/PeerGroup.java | PeerGroup.setStallThreshold | public void setStallThreshold(int periodSecs, int bytesPerSecond) {
lock.lock();
try {
stallPeriodSeconds = periodSecs;
stallMinSpeedBytesSec = bytesPerSecond;
} finally {
lock.unlock();
}
} | java | public void setStallThreshold(int periodSecs, int bytesPerSecond) {
lock.lock();
try {
stallPeriodSeconds = periodSecs;
stallMinSpeedBytesSec = bytesPerSecond;
} finally {
lock.unlock();
}
} | [
"public",
"void",
"setStallThreshold",
"(",
"int",
"periodSecs",
",",
"int",
"bytesPerSecond",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"stallPeriodSeconds",
"=",
"periodSecs",
";",
"stallMinSpeedBytesSec",
"=",
"bytesPerSecond",
";",
"}",
"fi... | Configures the stall speed: the speed at which a peer is considered to be serving us the block chain
unacceptably slowly. Once a peer has served us data slower than the given data rate for the given
number of seconds, it is considered stalled and will be disconnected, forcing the chain download to continue
from a different peer. The defaults are chosen conservatively, but if you are running on a platform that is
CPU constrained or on a very slow network e.g. EDGE, the default settings may need adjustment to
avoid false stalls.
@param periodSecs How many seconds the download speed must be below blocksPerSec, defaults to 10.
@param bytesPerSecond Download speed (only blocks/txns count) must be consistently below this for a stall, defaults to the bandwidth required for 10 block headers per second. | [
"Configures",
"the",
"stall",
"speed",
":",
"the",
"speed",
"at",
"which",
"a",
"peer",
"is",
"considered",
"to",
"be",
"serving",
"us",
"the",
"block",
"chain",
"unacceptably",
"slowly",
".",
"Once",
"a",
"peer",
"has",
"served",
"us",
"data",
"slower",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L1718-L1726 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/Converter.java | Converter.fromDomain | public OrmExtracted fromDomain(T domainObject, Namespace namespace, BinaryValue key)
{
BinaryValue bucketName = namespace != null ? namespace.getBucketName() : null;
BinaryValue bucketType = namespace != null ? namespace.getBucketType() : null;
key = AnnotationUtil.getKey(domainObject, key);
bucketName = AnnotationUtil.getBucketName(domainObject, bucketName);
bucketType = AnnotationUtil.getBucketType(domainObject, bucketType);
if (bucketName == null)
{
throw new ConversionException("Bucket name not provided via namespace or domain object");
}
VClock vclock = AnnotationUtil.getVClock(domainObject);
String contentType =
AnnotationUtil.getContentType(domainObject, RiakObject.DEFAULT_CONTENT_TYPE);
RiakObject riakObject = new RiakObject();
AnnotationUtil.getUsermetaData(riakObject.getUserMeta(), domainObject);
AnnotationUtil.getIndexes(riakObject.getIndexes(), domainObject);
AnnotationUtil.getLinks(riakObject.getLinks(), domainObject);
ContentAndType cAndT = fromDomain(domainObject);
contentType = cAndT.contentType != null ? cAndT.contentType : contentType;
riakObject.setContentType(contentType)
.setValue(cAndT.content)
.setVClock(vclock);
// We allow an annotated object to omit @BucketType and get the default
Namespace ns;
if (bucketType == null)
{
ns = new Namespace(bucketName);
}
else
{
ns = new Namespace(bucketType, bucketName);
}
OrmExtracted extracted = new OrmExtracted(riakObject, ns, key);
return extracted;
} | java | public OrmExtracted fromDomain(T domainObject, Namespace namespace, BinaryValue key)
{
BinaryValue bucketName = namespace != null ? namespace.getBucketName() : null;
BinaryValue bucketType = namespace != null ? namespace.getBucketType() : null;
key = AnnotationUtil.getKey(domainObject, key);
bucketName = AnnotationUtil.getBucketName(domainObject, bucketName);
bucketType = AnnotationUtil.getBucketType(domainObject, bucketType);
if (bucketName == null)
{
throw new ConversionException("Bucket name not provided via namespace or domain object");
}
VClock vclock = AnnotationUtil.getVClock(domainObject);
String contentType =
AnnotationUtil.getContentType(domainObject, RiakObject.DEFAULT_CONTENT_TYPE);
RiakObject riakObject = new RiakObject();
AnnotationUtil.getUsermetaData(riakObject.getUserMeta(), domainObject);
AnnotationUtil.getIndexes(riakObject.getIndexes(), domainObject);
AnnotationUtil.getLinks(riakObject.getLinks(), domainObject);
ContentAndType cAndT = fromDomain(domainObject);
contentType = cAndT.contentType != null ? cAndT.contentType : contentType;
riakObject.setContentType(contentType)
.setValue(cAndT.content)
.setVClock(vclock);
// We allow an annotated object to omit @BucketType and get the default
Namespace ns;
if (bucketType == null)
{
ns = new Namespace(bucketName);
}
else
{
ns = new Namespace(bucketType, bucketName);
}
OrmExtracted extracted = new OrmExtracted(riakObject, ns, key);
return extracted;
} | [
"public",
"OrmExtracted",
"fromDomain",
"(",
"T",
"domainObject",
",",
"Namespace",
"namespace",
",",
"BinaryValue",
"key",
")",
"{",
"BinaryValue",
"bucketName",
"=",
"namespace",
"!=",
"null",
"?",
"namespace",
".",
"getBucketName",
"(",
")",
":",
"null",
";... | Convert from a domain object to a RiakObject.
<p>
The domain object itself may be completely annotated with everything
required to produce a RiakObject except for the value portion.
This will prefer annotated
items over the {@code Location} passed in.
</p>
@param domainObject a domain object to be stored in Riak.
@param namespace the namespace in Riak
@param key the key for the object
@return data to be stored in Riak. | [
"Convert",
"from",
"a",
"domain",
"object",
"to",
"a",
"RiakObject",
".",
"<p",
">",
"The",
"domain",
"object",
"itself",
"may",
"be",
"completely",
"annotated",
"with",
"everything",
"required",
"to",
"produce",
"a",
"RiakObject",
"except",
"for",
"the",
"v... | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/Converter.java#L128-L172 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/AbstractMap.java | AbstractMap.chooseGrowCapacity | protected int chooseGrowCapacity(int size, double minLoad, double maxLoad) {
return nextPrime(Math.max(size+1, (int) ((4*size / (3*minLoad+maxLoad)))));
} | java | protected int chooseGrowCapacity(int size, double minLoad, double maxLoad) {
return nextPrime(Math.max(size+1, (int) ((4*size / (3*minLoad+maxLoad)))));
} | [
"protected",
"int",
"chooseGrowCapacity",
"(",
"int",
"size",
",",
"double",
"minLoad",
",",
"double",
"maxLoad",
")",
"{",
"return",
"nextPrime",
"(",
"Math",
".",
"max",
"(",
"size",
"+",
"1",
",",
"(",
"int",
")",
"(",
"(",
"4",
"*",
"size",
"/",
... | Chooses a new prime table capacity optimized for growing that (approximately) satisfies the invariant
<tt>c * minLoadFactor <= size <= c * maxLoadFactor</tt>
and has at least one FREE slot for the given size. | [
"Chooses",
"a",
"new",
"prime",
"table",
"capacity",
"optimized",
"for",
"growing",
"that",
"(",
"approximately",
")",
"satisfies",
"the",
"invariant",
"<tt",
">",
"c",
"*",
"minLoadFactor",
"<",
"=",
"size",
"<",
"=",
"c",
"*",
"maxLoadFactor<",
"/",
"tt"... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractMap.java#L61-L63 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.getView | public <T extends View> T getView(Class<T> viewClass, int index){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getView("+viewClass+", "+index+")");
}
return waiter.waitForAndGetView(index, viewClass);
} | java | public <T extends View> T getView(Class<T> viewClass, int index){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getView("+viewClass+", "+index+")");
}
return waiter.waitForAndGetView(index, viewClass);
} | [
"public",
"<",
"T",
"extends",
"View",
">",
"T",
"getView",
"(",
"Class",
"<",
"T",
">",
"viewClass",
",",
"int",
"index",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
... | Returns a View matching the specified class and index.
@param viewClass the class of the requested view
@param index the index of the {@link View}. {@code 0} if only one is available
@return a {@link View} matching the specified class and index | [
"Returns",
"a",
"View",
"matching",
"the",
"specified",
"class",
"and",
"index",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3158-L3164 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java | MFVec2f.insertValue | public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
} | java | public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
} | [
"public",
"void",
"insertValue",
"(",
"int",
"index",
",",
"float",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"newValue",
".",
"length",
"==",
"2",
")",
"{",
"try",
"{",
"value",
".",
"add",
"(",
"index",
",",
"new",
"SFVec2f",
"(",
"newValue",
"[... | Insert a new value prior to the index location in the existing value array,
increasing the field length accordingly.
@param index - where the new values in an SFVec2f object will be placed in the array list
@param newValue - the new x, y value for the array list | [
"Insert",
"a",
"new",
"value",
"prior",
"to",
"the",
"index",
"location",
"in",
"the",
"existing",
"value",
"array",
"increasing",
"the",
"field",
"length",
"accordingly",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L134-L149 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.findBeanForMethodArgument | @SuppressWarnings("WeakerAccess")
@Internal
protected final Optional findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) ->
((DefaultBeanContext) context).findBean(resolutionContext, beanType, qualifier)
);
} | java | @SuppressWarnings("WeakerAccess")
@Internal
protected final Optional findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) ->
((DefaultBeanContext) context).findBean(resolutionContext, beanType, qualifier)
);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"protected",
"final",
"Optional",
"findBeanForMethodArgument",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"MethodInjectionPoint",
"injectionPoint",
",",
"Argu... | Obtains an optional bean for the method at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The method injection point
@param argument The argument
@return The resolved bean | [
"Obtains",
"an",
"optional",
"bean",
"for",
"the",
"method",
"at",
"the",
"given",
"index",
"and",
"the",
"argument",
"at",
"the",
"given",
"index",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and",
... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L908-L914 |
Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java | GrpcServerBuilder.keepAliveTimeout | public GrpcServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
mNettyServerBuilder = mNettyServerBuilder.keepAliveTimeout(keepAliveTimeout, timeUnit);
return this;
} | java | public GrpcServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) {
mNettyServerBuilder = mNettyServerBuilder.keepAliveTimeout(keepAliveTimeout, timeUnit);
return this;
} | [
"public",
"GrpcServerBuilder",
"keepAliveTimeout",
"(",
"long",
"keepAliveTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"mNettyServerBuilder",
"=",
"mNettyServerBuilder",
".",
"keepAliveTimeout",
"(",
"keepAliveTimeout",
",",
"timeUnit",
")",
";",
"return",
"this",
... | Sets the keep alive timeout.
@param keepAliveTimeout time to wait after pinging client before closing the connection
@param timeUnit unit of the timeout
@return an updated instance of this {@link GrpcServerBuilder} | [
"Sets",
"the",
"keep",
"alive",
"timeout",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java#L134-L137 |
apache/groovy | src/main/groovy/groovy/lang/MetaMethod.java | MetaMethod.compatibleModifiers | private static boolean compatibleModifiers(int modifiersA, int modifiersB) {
int mask = Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC | Modifier.STATIC;
return (modifiersA & mask) == (modifiersB & mask);
} | java | private static boolean compatibleModifiers(int modifiersA, int modifiersB) {
int mask = Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC | Modifier.STATIC;
return (modifiersA & mask) == (modifiersB & mask);
} | [
"private",
"static",
"boolean",
"compatibleModifiers",
"(",
"int",
"modifiersA",
",",
"int",
"modifiersB",
")",
"{",
"int",
"mask",
"=",
"Modifier",
".",
"PRIVATE",
"|",
"Modifier",
".",
"PROTECTED",
"|",
"Modifier",
".",
"PUBLIC",
"|",
"Modifier",
".",
"STA... | Checks the compatibility between two modifier masks. Checks that they are equal
with regards to access and static modifier.
@return true if the modifiers are compatible | [
"Checks",
"the",
"compatibility",
"between",
"two",
"modifier",
"masks",
".",
"Checks",
"that",
"they",
"are",
"equal",
"with",
"regards",
"to",
"access",
"and",
"static",
"modifier",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaMethod.java#L229-L232 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asDivFunction | public static VectorFunction asDivFunction(final double arg) {
return new VectorFunction() {
@Override
public double evaluate(int i, double value) {
return value / arg;
}
};
} | java | public static VectorFunction asDivFunction(final double arg) {
return new VectorFunction() {
@Override
public double evaluate(int i, double value) {
return value / arg;
}
};
} | [
"public",
"static",
"VectorFunction",
"asDivFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"VectorFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"double",
"value",
")",
"{",
"return",
... | Creates a div function that divides it's argument by given {@code value}.
@param arg a divisor value
@return a closure that does {@code _ / _} | [
"Creates",
"a",
"div",
"function",
"that",
"divides",
"it",
"s",
"argument",
"by",
"given",
"{",
"@code",
"value",
"}",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L202-L209 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UcsApi.java | UcsApi.getInteractionDetails | public ApiSuccessResponse getInteractionDetails(String id, InteractionDetailsData interactionDetailsData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getInteractionDetailsWithHttpInfo(id, interactionDetailsData);
return resp.getData();
} | java | public ApiSuccessResponse getInteractionDetails(String id, InteractionDetailsData interactionDetailsData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getInteractionDetailsWithHttpInfo(id, interactionDetailsData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"getInteractionDetails",
"(",
"String",
"id",
",",
"InteractionDetailsData",
"interactionDetailsData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"getInteractionDetailsWithHttpInfo",
"(",
"... | Get the content of the interaction
@param id id of the Interaction (required)
@param interactionDetailsData (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"content",
"of",
"the",
"interaction"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L1160-L1163 |
cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TasksModel.java | TasksModel.createServerURI | private URI createServerURI()
throws URISyntaxException {
// We store this in plain text for the purposes of simple demonstration,
// you might want to use something more secure.
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.mContext);
String username = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_USER, "");
String dbName = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_DB, "");
String apiKey = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_API_KEY, "");
String apiSecret = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_API_SECRET, "");
String host = username + ".cloudant.com";
// We recommend always using HTTPS to talk to Cloudant.
return new URI("https", apiKey + ":" + apiSecret, host, 443, "/" + dbName, null, null);
} | java | private URI createServerURI()
throws URISyntaxException {
// We store this in plain text for the purposes of simple demonstration,
// you might want to use something more secure.
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.mContext);
String username = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_USER, "");
String dbName = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_DB, "");
String apiKey = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_API_KEY, "");
String apiSecret = sharedPref.getString(TodoActivity.SETTINGS_CLOUDANT_API_SECRET, "");
String host = username + ".cloudant.com";
// We recommend always using HTTPS to talk to Cloudant.
return new URI("https", apiKey + ":" + apiSecret, host, 443, "/" + dbName, null, null);
} | [
"private",
"URI",
"createServerURI",
"(",
")",
"throws",
"URISyntaxException",
"{",
"// We store this in plain text for the purposes of simple demonstration,",
"// you might want to use something more secure.",
"SharedPreferences",
"sharedPref",
"=",
"PreferenceManager",
".",
"getDefau... | <p>Returns the URI for the remote database, based on the app's
configuration.</p>
@return the remote database's URI
@throws URISyntaxException if the settings give an invalid URI | [
"<p",
">",
"Returns",
"the",
"URI",
"for",
"the",
"remote",
"database",
"based",
"on",
"the",
"app",
"s",
"configuration",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L259-L272 |
cdapio/tigon | tigon-yarn/src/main/java/co/cask/tigon/conf/Configuration.java | Configuration.getEnum | public <T extends Enum<T>> T getEnum(String name, Class<T> declaringClass) {
final String val = get(name);
Preconditions.checkNotNull(val);
return Enum.valueOf(declaringClass, val);
} | java | public <T extends Enum<T>> T getEnum(String name, Class<T> declaringClass) {
final String val = get(name);
Preconditions.checkNotNull(val);
return Enum.valueOf(declaringClass, val);
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnum",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"declaringClass",
")",
"{",
"final",
"String",
"val",
"=",
"get",
"(",
"name",
")",
";",
"Preconditions",
".",
"checkNotNul... | Return value matching this enumerated type.
@param name Property name
@throws NullPointerException if the configuration property does not exist
@throws IllegalArgumentException If mapping is illegal for the type
provided | [
"Return",
"value",
"matching",
"this",
"enumerated",
"type",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/conf/Configuration.java#L910-L914 |
stickfigure/batchfb | src/main/java/com/googlecode/batchfb/util/RequestBuilder.java | RequestBuilder.addParam | public void addParam(String name, InputStream stream, String contentType, String filename) {
if (this.method != HttpMethod.POST)
throw new IllegalStateException("May only add binary attachment to POST, not to " + this.method);
this.params.put(name, new BinaryAttachment(stream, contentType, filename));
this.hasBinaryAttachments = true;
} | java | public void addParam(String name, InputStream stream, String contentType, String filename) {
if (this.method != HttpMethod.POST)
throw new IllegalStateException("May only add binary attachment to POST, not to " + this.method);
this.params.put(name, new BinaryAttachment(stream, contentType, filename));
this.hasBinaryAttachments = true;
} | [
"public",
"void",
"addParam",
"(",
"String",
"name",
",",
"InputStream",
"stream",
",",
"String",
"contentType",
",",
"String",
"filename",
")",
"{",
"if",
"(",
"this",
".",
"method",
"!=",
"HttpMethod",
".",
"POST",
")",
"throw",
"new",
"IllegalStateExcepti... | Adds a binary attachment. Request method must be POST; causes the type to be multipart/form-data | [
"Adds",
"a",
"binary",
"attachment",
".",
"Request",
"method",
"must",
"be",
"POST",
";",
"causes",
"the",
"type",
"to",
"be",
"multipart",
"/",
"form",
"-",
"data"
] | train | https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/util/RequestBuilder.java#L110-L116 |
wildfly/wildfly-build-tools | provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java | ZipFileSubsystemInputStreamSources.addAllSubsystemFileSourcesFromModule | public void addAllSubsystemFileSourcesFromModule(FeaturePack.Module module, ArtifactFileResolver artifactFileResolver, boolean transitive) throws IOException {
// the subsystem templates are included in module artifacts files
for (ModuleParseResult.ArtifactName artifactName : module.getModuleParseResult().getArtifacts()) {
// resolve the artifact
Artifact artifact = module.getFeaturePack().getArtifactResolver().getArtifact(artifactName.getArtifact());
if (artifact == null) {
throw new RuntimeException("Could not resolve module resource artifact " + artifactName.getArtifactCoords() + " for feature pack " + module.getFeaturePack().getFeaturePackFile());
}
// resolve the artifact file
File artifactFile = artifactFileResolver.getArtifactFile(artifact);
// get the subsystem templates
addAllSubsystemFileSourcesFromZipFile(artifactFile);
}
if (transitive) {
for (FeaturePack.Module dependency : module.getDependencies().values()) {
addAllSubsystemFileSourcesFromModule(dependency, artifactFileResolver, false);
}
}
} | java | public void addAllSubsystemFileSourcesFromModule(FeaturePack.Module module, ArtifactFileResolver artifactFileResolver, boolean transitive) throws IOException {
// the subsystem templates are included in module artifacts files
for (ModuleParseResult.ArtifactName artifactName : module.getModuleParseResult().getArtifacts()) {
// resolve the artifact
Artifact artifact = module.getFeaturePack().getArtifactResolver().getArtifact(artifactName.getArtifact());
if (artifact == null) {
throw new RuntimeException("Could not resolve module resource artifact " + artifactName.getArtifactCoords() + " for feature pack " + module.getFeaturePack().getFeaturePackFile());
}
// resolve the artifact file
File artifactFile = artifactFileResolver.getArtifactFile(artifact);
// get the subsystem templates
addAllSubsystemFileSourcesFromZipFile(artifactFile);
}
if (transitive) {
for (FeaturePack.Module dependency : module.getDependencies().values()) {
addAllSubsystemFileSourcesFromModule(dependency, artifactFileResolver, false);
}
}
} | [
"public",
"void",
"addAllSubsystemFileSourcesFromModule",
"(",
"FeaturePack",
".",
"Module",
"module",
",",
"ArtifactFileResolver",
"artifactFileResolver",
",",
"boolean",
"transitive",
")",
"throws",
"IOException",
"{",
"// the subsystem templates are included in module artifact... | Adds all file sources in the specified module's artifacts.
@param module
@param artifactFileResolver
@param transitive
@throws IOException | [
"Adds",
"all",
"file",
"sources",
"in",
"the",
"specified",
"module",
"s",
"artifacts",
"."
] | train | https://github.com/wildfly/wildfly-build-tools/blob/520a5f2e58e6a24097d63fd65c51a8fc29847a61/provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java#L110-L128 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java | DisksInner.beginCreateOrUpdateAsync | public Observable<DiskInner> beginCreateOrUpdateAsync(String resourceGroupName, String diskName, DiskInner disk) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() {
@Override
public DiskInner call(ServiceResponse<DiskInner> response) {
return response.body();
}
});
} | java | public Observable<DiskInner> beginCreateOrUpdateAsync(String resourceGroupName, String diskName, DiskInner disk) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() {
@Override
public DiskInner call(ServiceResponse<DiskInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DiskInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
",",
"DiskInner",
"disk",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName"... | Creates or updates a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param disk Disk object supplied in the body of the Put disk operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DiskInner object | [
"Creates",
"or",
"updates",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L248-L255 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java | PJsonArray.getJSONObject | public final PJsonObject getJSONObject(final int i) {
JSONObject val = this.array.optJSONObject(i);
final String context = "[" + i + "]";
if (val == null) {
throw new ObjectMissingException(this, context);
}
return new PJsonObject(this, val, context);
} | java | public final PJsonObject getJSONObject(final int i) {
JSONObject val = this.array.optJSONObject(i);
final String context = "[" + i + "]";
if (val == null) {
throw new ObjectMissingException(this, context);
}
return new PJsonObject(this, val, context);
} | [
"public",
"final",
"PJsonObject",
"getJSONObject",
"(",
"final",
"int",
"i",
")",
"{",
"JSONObject",
"val",
"=",
"this",
".",
"array",
".",
"optJSONObject",
"(",
"i",
")",
";",
"final",
"String",
"context",
"=",
"\"[\"",
"+",
"i",
"+",
"\"]\"",
";",
"i... | Get the element at the index as a json object.
@param i the index of the object to access | [
"Get",
"the",
"element",
"at",
"the",
"index",
"as",
"a",
"json",
"object",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L52-L59 |
jglobus/JGlobus | gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java | SSLUtil.toInt | public static int toInt(byte[] buf, int off) {
int lg = (buf[off] & 0xff) << 24;
lg |= (buf[off+1] & 0xff) << 16;
lg |= (buf[off+2] & 0xff) << 8;
lg |= (buf[off+3] & 0xff);
return lg;
} | java | public static int toInt(byte[] buf, int off) {
int lg = (buf[off] & 0xff) << 24;
lg |= (buf[off+1] & 0xff) << 16;
lg |= (buf[off+2] & 0xff) << 8;
lg |= (buf[off+3] & 0xff);
return lg;
} | [
"public",
"static",
"int",
"toInt",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
")",
"{",
"int",
"lg",
"=",
"(",
"buf",
"[",
"off",
"]",
"&",
"0xff",
")",
"<<",
"24",
";",
"lg",
"|=",
"(",
"buf",
"[",
"off",
"+",
"1",
"]",
"&",
"0xff",... | Converts 4 bytes to an <code>int</code> at
the specified offset in the given byte array.
@param buf the byte array containing the 4 bytes
to be converted to an <code>int</code>.
@param off offset in the byte array
@return the <code>int</code> value of the 4 bytes. | [
"Converts",
"4",
"bytes",
"to",
"an",
"<code",
">",
"int<",
"/",
"code",
">",
"at",
"the",
"specified",
"offset",
"in",
"the",
"given",
"byte",
"array",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java#L166-L172 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java | QrCodePositionPatternDetector.process | public void process(T gray, GrayU8 binary ) {
configureContourDetector(gray);
recycleData();
positionPatterns.reset();
interpolate.setImage(gray);
// detect squares
squareDetector.process(gray,binary);
long time0 = System.nanoTime();
squaresToPositionList();
long time1 = System.nanoTime();
// Create graph of neighboring squares
createPositionPatternGraph();
// long time2 = System.nanoTime(); // doesn't take very long
double milli = (time1-time0)*1e-6;
milliGraph.update(milli);
if( profiler ) {
DetectPolygonFromContour<T> detectorPoly = squareDetector.getDetector();
System.out.printf(" contour %5.1f shapes %5.1f adjust_bias %5.2f PosPat %6.2f",
detectorPoly.getMilliContour(), detectorPoly.getMilliShapes(), squareDetector.getMilliAdjustBias(),
milliGraph.getAverage());
}
} | java | public void process(T gray, GrayU8 binary ) {
configureContourDetector(gray);
recycleData();
positionPatterns.reset();
interpolate.setImage(gray);
// detect squares
squareDetector.process(gray,binary);
long time0 = System.nanoTime();
squaresToPositionList();
long time1 = System.nanoTime();
// Create graph of neighboring squares
createPositionPatternGraph();
// long time2 = System.nanoTime(); // doesn't take very long
double milli = (time1-time0)*1e-6;
milliGraph.update(milli);
if( profiler ) {
DetectPolygonFromContour<T> detectorPoly = squareDetector.getDetector();
System.out.printf(" contour %5.1f shapes %5.1f adjust_bias %5.2f PosPat %6.2f",
detectorPoly.getMilliContour(), detectorPoly.getMilliShapes(), squareDetector.getMilliAdjustBias(),
milliGraph.getAverage());
}
} | [
"public",
"void",
"process",
"(",
"T",
"gray",
",",
"GrayU8",
"binary",
")",
"{",
"configureContourDetector",
"(",
"gray",
")",
";",
"recycleData",
"(",
")",
";",
"positionPatterns",
".",
"reset",
"(",
")",
";",
"interpolate",
".",
"setImage",
"(",
"gray",... | Detects position patterns inside the image and forms a graph.
@param gray Gray scale input image
@param binary Thresholed version of gray image. | [
"Detects",
"position",
"patterns",
"inside",
"the",
"image",
"and",
"forms",
"a",
"graph",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java#L121-L149 |
opsgenie/opsgenieclient | sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java | AlertApi.listRecipients | public ListAlertRecipientsResponse listRecipients(String identifier, String identifierType) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'identifier' is set
if (identifier == null) {
throw new ApiException(400, "Missing the required parameter 'identifier' when calling listRecipients");
}
// create path and map variables
String localVarPath = "/v2/alerts/{identifier}/recipients"
.replaceAll("\\{" + "identifier" + "\\}", apiClient.escapeString(identifier.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "identifierType", identifierType));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"GenieKey"};
GenericType<ListAlertRecipientsResponse> localVarReturnType = new GenericType<ListAlertRecipientsResponse>() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public ListAlertRecipientsResponse listRecipients(String identifier, String identifierType) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'identifier' is set
if (identifier == null) {
throw new ApiException(400, "Missing the required parameter 'identifier' when calling listRecipients");
}
// create path and map variables
String localVarPath = "/v2/alerts/{identifier}/recipients"
.replaceAll("\\{" + "identifier" + "\\}", apiClient.escapeString(identifier.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "identifierType", identifierType));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"GenieKey"};
GenericType<ListAlertRecipientsResponse> localVarReturnType = new GenericType<ListAlertRecipientsResponse>() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"ListAlertRecipientsResponse",
"listRecipients",
"(",
"String",
"identifier",
",",
"String",
"identifierType",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"null",
";",
"// verify the required parameter 'identifier' is set",
"if",
"(",
"i... | List Alert Recipients
List alert recipients for the given alert identifier
@param identifier Identifier of alert which could be alert id, tiny id or alert alias (required)
@param identifierType Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or 'tiny' (optional, default to id)
@return ListAlertRecipientsResponse
@throws ApiException if fails to make API call | [
"List",
"Alert",
"Recipients",
"List",
"alert",
"recipients",
"for",
"the",
"given",
"alert",
"identifier",
"@param",
"identifier",
"Identifier",
"of",
"alert",
"which",
"could",
"be",
"alert",
"id",
"tiny",
"id",
"or",
"alert",
"alias",
"(",
"required",
")",
... | train | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java#L1349-L1386 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/EpicsApi.java | EpicsApi.createEpic | public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", epic.getTitle(), true)
.withParam("labels", epic.getLabels())
.withParam("description", epic.getDescription())
.withParam("start_date", epic.getStartDate())
.withParam("end_date", epic.getEndDate());
Response response = post(Response.Status.CREATED, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "epics");
return (response.readEntity(Epic.class));
} | java | public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", epic.getTitle(), true)
.withParam("labels", epic.getLabels())
.withParam("description", epic.getDescription())
.withParam("start_date", epic.getStartDate())
.withParam("end_date", epic.getEndDate());
Response response = post(Response.Status.CREATED, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "epics");
return (response.readEntity(Epic.class));
} | [
"public",
"Epic",
"createEpic",
"(",
"Object",
"groupIdOrPath",
",",
"Epic",
"epic",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"title\"",
",",
"epic",
".",
"getTitle",
"(",
"... | Creates a new epic using the information contained in the provided Epic instance. Only the following
fields from the Epic instance are used:
<pre><code>
title - the title of the epic (required)
labels - comma separated list of labels (optional)
description - the description of the epic (optional)
startDate - the start date of the epic (optional)
endDate - the end date of the epic (optional)
</code></pre>
<pre><code>GitLab Endpoint: POST /groups/:id/epics</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epic the Epic instance with information for the new epic
@return an Epic instance containing info on the newly created epic
@throws GitLabApiException if any exception occurs | [
"Creates",
"a",
"new",
"epic",
"using",
"the",
"information",
"contained",
"in",
"the",
"provided",
"Epic",
"instance",
".",
"Only",
"the",
"following",
"fields",
"from",
"the",
"Epic",
"instance",
"are",
"used",
":",
"<pre",
">",
"<code",
">",
"title",
"-... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L260-L270 |
imsweb/seerapi-client-java | src/main/java/com/imsweb/seerapi/client/staging/SchemaLookup.java | SchemaLookup.setInput | public void setInput(String key, String value) {
if (getAllowedKeys() != null && !getAllowedKeys().contains(key))
throw new IllegalStateException("The input key " + key + " is not allowed for lookups");
_inputs.put(key, value);
} | java | public void setInput(String key, String value) {
if (getAllowedKeys() != null && !getAllowedKeys().contains(key))
throw new IllegalStateException("The input key " + key + " is not allowed for lookups");
_inputs.put(key, value);
} | [
"public",
"void",
"setInput",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"getAllowedKeys",
"(",
")",
"!=",
"null",
"&&",
"!",
"getAllowedKeys",
"(",
")",
".",
"contains",
"(",
"key",
")",
")",
"throw",
"new",
"IllegalStateExceptio... | Set the value of a single input.
@param key key of input
@param value value of input | [
"Set",
"the",
"value",
"of",
"a",
"single",
"input",
"."
] | train | https://github.com/imsweb/seerapi-client-java/blob/04f509961c3a5ece7b232ecb8d8cb8f89d810a85/src/main/java/com/imsweb/seerapi/client/staging/SchemaLookup.java#L69-L74 |
roboconf/roboconf-platform | core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java | Ec2MachineConfigurator.tagResource | private boolean tagResource(String resourceId, String tagName) {
boolean result = false;
if(! Utils.isEmptyOrWhitespaces(tagName)) {
Tag tag = new Tag( "Name", tagName );
CreateTagsRequest ctr = new CreateTagsRequest(Collections.singletonList(resourceId), Arrays.asList( tag ));
try {
this.ec2Api.createTags( ctr );
} catch(Exception e) {
this.logger.warning("Error tagging resource " + resourceId + " with name=" + tagName + ": " + e);
}
result = true;
}
return result;
} | java | private boolean tagResource(String resourceId, String tagName) {
boolean result = false;
if(! Utils.isEmptyOrWhitespaces(tagName)) {
Tag tag = new Tag( "Name", tagName );
CreateTagsRequest ctr = new CreateTagsRequest(Collections.singletonList(resourceId), Arrays.asList( tag ));
try {
this.ec2Api.createTags( ctr );
} catch(Exception e) {
this.logger.warning("Error tagging resource " + resourceId + " with name=" + tagName + ": " + e);
}
result = true;
}
return result;
} | [
"private",
"boolean",
"tagResource",
"(",
"String",
"resourceId",
",",
"String",
"tagName",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"Utils",
".",
"isEmptyOrWhitespaces",
"(",
"tagName",
")",
")",
"{",
"Tag",
"tag",
"=",
"new",
"... | Tags the specified resource, eg. a VM or volume (basically, it gives it a name).
@param resourceId The ID of the resource to tag
@param tagName The resource's name
@return true if the tag was done, false otherwise | [
"Tags",
"the",
"specified",
"resource",
"eg",
".",
"a",
"VM",
"or",
"volume",
"(",
"basically",
"it",
"gives",
"it",
"a",
"name",
")",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java#L188-L201 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java | PersistenceValidator.onValidateEmbeddable | private void onValidateEmbeddable(Object embeddedObject, EmbeddableType embeddedColumn)
{
if (embeddedObject instanceof Collection)
{
for (Object obj : (Collection) embeddedObject)
{
for (Object column : embeddedColumn.getAttributes())
{
Attribute columnAttribute = (Attribute) column;
Field f = (Field) columnAttribute.getJavaMember();
this.factory.validate(f, embeddedObject, new AttributeConstraintRule());
}
}
}
else
{
for (Object column : embeddedColumn.getAttributes())
{
Attribute columnAttribute = (Attribute) column;
Field f = (Field) ((Field) columnAttribute.getJavaMember());
this.factory.validate(f, embeddedObject, new AttributeConstraintRule());
}
}
} | java | private void onValidateEmbeddable(Object embeddedObject, EmbeddableType embeddedColumn)
{
if (embeddedObject instanceof Collection)
{
for (Object obj : (Collection) embeddedObject)
{
for (Object column : embeddedColumn.getAttributes())
{
Attribute columnAttribute = (Attribute) column;
Field f = (Field) columnAttribute.getJavaMember();
this.factory.validate(f, embeddedObject, new AttributeConstraintRule());
}
}
}
else
{
for (Object column : embeddedColumn.getAttributes())
{
Attribute columnAttribute = (Attribute) column;
Field f = (Field) ((Field) columnAttribute.getJavaMember());
this.factory.validate(f, embeddedObject, new AttributeConstraintRule());
}
}
} | [
"private",
"void",
"onValidateEmbeddable",
"(",
"Object",
"embeddedObject",
",",
"EmbeddableType",
"embeddedColumn",
")",
"{",
"if",
"(",
"embeddedObject",
"instanceof",
"Collection",
")",
"{",
"for",
"(",
"Object",
"obj",
":",
"(",
"Collection",
")",
"embeddedObj... | Checks constraints present on embeddable attributes
@param embeddedObject
@param embeddedColumn
@param embeddedFieldName | [
"Checks",
"constraints",
"present",
"on",
"embeddable",
"attributes"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java#L163-L191 |
craterdog/java-general-utilities | src/main/java/craterdog/utils/ByteUtils.java | ByteUtils.intToBytes | static public int intToBytes(int i, byte[] buffer, int index) {
int length = buffer.length - index;
if (length > 4) length = 4;
for (int j = 0; j < length; j++) {
buffer[index + length - j - 1] = (byte) (i >> (j * 8));
}
return length;
} | java | static public int intToBytes(int i, byte[] buffer, int index) {
int length = buffer.length - index;
if (length > 4) length = 4;
for (int j = 0; j < length; j++) {
buffer[index + length - j - 1] = (byte) (i >> (j * 8));
}
return length;
} | [
"static",
"public",
"int",
"intToBytes",
"(",
"int",
"i",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"int",
"length",
"=",
"buffer",
".",
"length",
"-",
"index",
";",
"if",
"(",
"length",
">",
"4",
")",
"length",
"=",
"4",
";... | This function converts a integer into its corresponding byte format and inserts
it into the specified buffer at the specified index.
@param i The integer to be converted.
@param buffer The byte array.
@param index The index in the array to begin inserting bytes.
@return The number of bytes inserted. | [
"This",
"function",
"converts",
"a",
"integer",
"into",
"its",
"corresponding",
"byte",
"format",
"and",
"inserts",
"it",
"into",
"the",
"specified",
"buffer",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L203-L210 |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.validateChecksum | static void validateChecksum(int expectedChecksum, ByteBuf data) {
validateChecksum(expectedChecksum, data, data.readerIndex(), data.readableBytes());
} | java | static void validateChecksum(int expectedChecksum, ByteBuf data) {
validateChecksum(expectedChecksum, data, data.readerIndex(), data.readableBytes());
} | [
"static",
"void",
"validateChecksum",
"(",
"int",
"expectedChecksum",
",",
"ByteBuf",
"data",
")",
"{",
"validateChecksum",
"(",
"expectedChecksum",
",",
"data",
",",
"data",
".",
"readerIndex",
"(",
")",
",",
"data",
".",
"readableBytes",
"(",
")",
")",
";"... | Computes the CRC32C checksum of the supplied data, performs the "mask" operation
on the computed checksum, and then compares the resulting masked checksum to the
supplied checksum.
@param expectedChecksum The checksum decoded from the stream to compare against
@param data The input data to calculate the CRC32C checksum of
@throws DecompressionException If the calculated and supplied checksums do not match | [
"Computes",
"the",
"CRC32C",
"checksum",
"of",
"the",
"supplied",
"data",
"performs",
"the",
"mask",
"operation",
"on",
"the",
"computed",
"checksum",
"and",
"then",
"compares",
"the",
"resulting",
"masked",
"checksum",
"to",
"the",
"supplied",
"checksum",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L625-L627 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java | MessageFormat.writeObject | private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
// ICU 4.8 custom serialization.
// locale as a BCP 47 language tag
out.writeObject(ulocale.toLanguageTag());
// ApostropheMode
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
out.writeObject(msgPattern.getApostropheMode());
// message pattern string
out.writeObject(msgPattern.getPatternString());
// custom formatters
if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) {
out.writeInt(0);
} else {
out.writeInt(customFormatArgStarts.size());
int formatIndex = 0;
for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
if (customFormatArgStarts.contains(partIndex)) {
out.writeInt(formatIndex);
out.writeObject(cachedFormatters.get(partIndex));
}
++formatIndex;
}
}
// number of future (int, Object) pairs
out.writeInt(0);
} | java | private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
// ICU 4.8 custom serialization.
// locale as a BCP 47 language tag
out.writeObject(ulocale.toLanguageTag());
// ApostropheMode
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
out.writeObject(msgPattern.getApostropheMode());
// message pattern string
out.writeObject(msgPattern.getPatternString());
// custom formatters
if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) {
out.writeInt(0);
} else {
out.writeInt(customFormatArgStarts.size());
int formatIndex = 0;
for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
if (customFormatArgStarts.contains(partIndex)) {
out.writeInt(formatIndex);
out.writeObject(cachedFormatters.get(partIndex));
}
++formatIndex;
}
}
// number of future (int, Object) pairs
out.writeInt(0);
} | [
"private",
"void",
"writeObject",
"(",
"java",
".",
"io",
".",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"// ICU 4.8 custom serialization.",
"// locale as a BCP 47 language tag",
"out",
".",
"write... | Custom serialization, new in ICU 4.8.
We do not want to use default serialization because we only have a small
amount of persistent state which is better expressed explicitly
rather than via writing field objects.
@param out The output stream.
@serialData Writes the locale as a BCP 47 language tag string,
the MessagePattern.ApostropheMode as an object,
and the pattern string (null if none was applied).
Followed by an int with the number of (int formatIndex, Object formatter) pairs,
and that many such pairs, corresponding to previous setFormat() calls for custom formats.
Followed by an int with the number of (int, Object) pairs,
and that many such pairs, for future (post-ICU 4.8) extension of the serialization format. | [
"Custom",
"serialization",
"new",
"in",
"ICU",
"4",
".",
"8",
".",
"We",
"do",
"not",
"want",
"to",
"use",
"default",
"serialization",
"because",
"we",
"only",
"have",
"a",
"small",
"amount",
"of",
"persistent",
"state",
"which",
"is",
"better",
"expressed... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2294-L2322 |
VoltDB/voltdb | src/frontend/org/voltdb/exportclient/ExportEncoder.java | ExportEncoder.encodeTimestamp | static public void encodeTimestamp(final FastSerializer fs, TimestampType value)
throws IOException {
final long lvalue = value.getTime();
fs.writeLong(lvalue);
} | java | static public void encodeTimestamp(final FastSerializer fs, TimestampType value)
throws IOException {
final long lvalue = value.getTime();
fs.writeLong(lvalue);
} | [
"static",
"public",
"void",
"encodeTimestamp",
"(",
"final",
"FastSerializer",
"fs",
",",
"TimestampType",
"value",
")",
"throws",
"IOException",
"{",
"final",
"long",
"lvalue",
"=",
"value",
".",
"getTime",
"(",
")",
";",
"fs",
".",
"writeLong",
"(",
"lvalu... | Read a timestamp according to the Export encoding specification.
@param fds
@throws IOException | [
"Read",
"a",
"timestamp",
"according",
"to",
"the",
"Export",
"encoding",
"specification",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportEncoder.java#L248-L252 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/internal/util/Objects.java | Objects.in | public static boolean in(Object obj, Object... array) {
for (Object expected : array) {
if (obj == expected) {
return true;
}
}
return false;
} | java | public static boolean in(Object obj, Object... array) {
for (Object expected : array) {
if (obj == expected) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"in",
"(",
"Object",
"obj",
",",
"Object",
"...",
"array",
")",
"{",
"for",
"(",
"Object",
"expected",
":",
"array",
")",
"{",
"if",
"(",
"obj",
"==",
"expected",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"... | Checks whether {@code obj} is one of the elements of {@code array}. | [
"Checks",
"whether",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/internal/util/Objects.java#L38-L45 |
citrusframework/citrus | modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java | DataSetCreator.marshalResponse | private DataSet marshalResponse(final Message response, final MessageType messageType) throws SQLException {
String dataSet = null;
if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) {
dataSet = response.getPayload(OperationResult.class).getDataSet();
} else {
try {
JdbcMarshaller jdbcMarshaller = new JdbcMarshaller();
jdbcMarshaller.setType(messageType.name());
Object object = jdbcMarshaller.unmarshal(new StringSource(response.getPayload(String.class)));
if (object instanceof OperationResult && StringUtils.hasText(((OperationResult) object).getDataSet())) {
dataSet = ((OperationResult) object).getDataSet();
}
} catch (CitrusRuntimeException e) {
dataSet = response.getPayload(String.class);
}
}
if (isJsonResponse(messageType)) {
return new JsonDataSetProducer(Optional.ofNullable(dataSet).orElse("[]")).produce();
} else if (isXmlResponse(messageType)) {
return new XmlDataSetProducer(Optional.ofNullable(dataSet).orElse("<dataset></dataset>")).produce();
} else {
throw new CitrusRuntimeException("Unable to create dataSet from data type " + messageType.name());
}
} | java | private DataSet marshalResponse(final Message response, final MessageType messageType) throws SQLException {
String dataSet = null;
if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) {
dataSet = response.getPayload(OperationResult.class).getDataSet();
} else {
try {
JdbcMarshaller jdbcMarshaller = new JdbcMarshaller();
jdbcMarshaller.setType(messageType.name());
Object object = jdbcMarshaller.unmarshal(new StringSource(response.getPayload(String.class)));
if (object instanceof OperationResult && StringUtils.hasText(((OperationResult) object).getDataSet())) {
dataSet = ((OperationResult) object).getDataSet();
}
} catch (CitrusRuntimeException e) {
dataSet = response.getPayload(String.class);
}
}
if (isJsonResponse(messageType)) {
return new JsonDataSetProducer(Optional.ofNullable(dataSet).orElse("[]")).produce();
} else if (isXmlResponse(messageType)) {
return new XmlDataSetProducer(Optional.ofNullable(dataSet).orElse("<dataset></dataset>")).produce();
} else {
throw new CitrusRuntimeException("Unable to create dataSet from data type " + messageType.name());
}
} | [
"private",
"DataSet",
"marshalResponse",
"(",
"final",
"Message",
"response",
",",
"final",
"MessageType",
"messageType",
")",
"throws",
"SQLException",
"{",
"String",
"dataSet",
"=",
"null",
";",
"if",
"(",
"response",
"instanceof",
"JdbcMessage",
"||",
"response... | Marshals the given message to the requested MessageType
@param response The response to marshal
@param messageType The requested MessageType
@return A DataSet representing the message
@throws SQLException In case the marshalling failed | [
"Marshals",
"the",
"given",
"message",
"to",
"the",
"requested",
"MessageType"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java#L63-L88 |
jglobus/JGlobus | gss/src/main/java/org/globus/net/ServerSocketFactory.java | ServerSocketFactory.createServerSocket | public ServerSocket createServerSocket(int port, int backlog,
InetAddress bindAddr)
throws IOException {
if (this.portRange.isEnabled() && port == 0) {
return createServerSocket(backlog, bindAddr);
} else {
return new ServerSocket(port, backlog, bindAddr);
}
} | java | public ServerSocket createServerSocket(int port, int backlog,
InetAddress bindAddr)
throws IOException {
if (this.portRange.isEnabled() && port == 0) {
return createServerSocket(backlog, bindAddr);
} else {
return new ServerSocket(port, backlog, bindAddr);
}
} | [
"public",
"ServerSocket",
"createServerSocket",
"(",
"int",
"port",
",",
"int",
"backlog",
",",
"InetAddress",
"bindAddr",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"portRange",
".",
"isEnabled",
"(",
")",
"&&",
"port",
"==",
"0",
")",
"{"... | Create a server with the specified port, listen backlog, and
local IP address to bind to. The <i>bindAddr</i> argument
can be used on a multi-homed host for a ServerSocket that
will only accept connect requests to one of its addresses.
If <i>bindAddr</i> is null, it will default accepting
connections on any/all local addresses.
The port must be between 0 and 65535, inclusive.
@param port the local TCP port
@param backlog the listen backlog
@param bindAddr the local InetAddress the server will bind to
@exception IOException if an I/O error occurs when opening the socket. | [
"Create",
"a",
"server",
"with",
"the",
"specified",
"port",
"listen",
"backlog",
"and",
"local",
"IP",
"address",
"to",
"bind",
"to",
".",
"The",
"<i",
">",
"bindAddr<",
"/",
"i",
">",
"argument",
"can",
"be",
"used",
"on",
"a",
"multi",
"-",
"homed",... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/net/ServerSocketFactory.java#L107-L115 |
kiswanij/jk-util | src/main/java/com/jk/util/JK.java | JK.toMap | public static Map toMap(Object[] keys, Object[] values) {
Map map = new HashMap<>();
int i = 0;
for (Object key : keys) {
map.put(key, values[i++]);
}
return map;
} | java | public static Map toMap(Object[] keys, Object[] values) {
Map map = new HashMap<>();
int i = 0;
for (Object key : keys) {
map.put(key, values[i++]);
}
return map;
} | [
"public",
"static",
"Map",
"toMap",
"(",
"Object",
"[",
"]",
"keys",
",",
"Object",
"[",
"]",
"values",
")",
"{",
"Map",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Object",
"key",
":",
"keys",
")"... | To map.
@param keys the keys
@param values the values
@return the map | [
"To",
"map",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L250-L257 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.getTopFeatures | public List<Triple<F,L,Double>> getTopFeatures(Set<L> labels,
double threshold, boolean useMagnitude, int numFeatures,
boolean descending)
{
if (labels != null) {
Set<Integer> iLabels = getLabelIndices(labels);
return getTopFeaturesLabelIndices(iLabels, threshold, useMagnitude, numFeatures, descending);
} else {
return getTopFeaturesLabelIndices(null, threshold, useMagnitude, numFeatures, descending);
}
} | java | public List<Triple<F,L,Double>> getTopFeatures(Set<L> labels,
double threshold, boolean useMagnitude, int numFeatures,
boolean descending)
{
if (labels != null) {
Set<Integer> iLabels = getLabelIndices(labels);
return getTopFeaturesLabelIndices(iLabels, threshold, useMagnitude, numFeatures, descending);
} else {
return getTopFeaturesLabelIndices(null, threshold, useMagnitude, numFeatures, descending);
}
} | [
"public",
"List",
"<",
"Triple",
"<",
"F",
",",
"L",
",",
"Double",
">",
">",
"getTopFeatures",
"(",
"Set",
"<",
"L",
">",
"labels",
",",
"double",
"threshold",
",",
"boolean",
"useMagnitude",
",",
"int",
"numFeatures",
",",
"boolean",
"descending",
")",... | Returns list of top features with weight above a certain threshold
@param labels Set of labels we care about when getting features
Use null to get features across all labels
@param threshold Threshold above which we will count the feature
@param useMagnitude Whether the notion of "large" should ignore
the sign of the feature weight.
@param numFeatures How many top features to return (-1 for unlimited)
@param descending Return weights in descending order
@return List of triples indicating feature, label, weight | [
"Returns",
"list",
"of",
"top",
"features",
"with",
"weight",
"above",
"a",
"certain",
"threshold"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L451-L461 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | MultiUserChat.fireInvitationRejectionListeners | private void fireInvitationRejectionListeners(Message message, MUCUser.Decline rejection) {
EntityBareJid invitee = rejection.getFrom();
String reason = rejection.getReason();
InvitationRejectionListener[] listeners;
synchronized (invitationRejectionListeners) {
listeners = new InvitationRejectionListener[invitationRejectionListeners.size()];
invitationRejectionListeners.toArray(listeners);
}
for (InvitationRejectionListener listener : listeners) {
listener.invitationDeclined(invitee, reason, message, rejection);
}
} | java | private void fireInvitationRejectionListeners(Message message, MUCUser.Decline rejection) {
EntityBareJid invitee = rejection.getFrom();
String reason = rejection.getReason();
InvitationRejectionListener[] listeners;
synchronized (invitationRejectionListeners) {
listeners = new InvitationRejectionListener[invitationRejectionListeners.size()];
invitationRejectionListeners.toArray(listeners);
}
for (InvitationRejectionListener listener : listeners) {
listener.invitationDeclined(invitee, reason, message, rejection);
}
} | [
"private",
"void",
"fireInvitationRejectionListeners",
"(",
"Message",
"message",
",",
"MUCUser",
".",
"Decline",
"rejection",
")",
"{",
"EntityBareJid",
"invitee",
"=",
"rejection",
".",
"getFrom",
"(",
")",
";",
"String",
"reason",
"=",
"rejection",
".",
"getR... | Fires invitation rejection listeners.
@param invitee the user being invited.
@param reason the reason for the rejection | [
"Fires",
"invitation",
"rejection",
"listeners",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L988-L999 |
watson-developer-cloud/java-sdk | speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java | SpeechToText.recognizeUsingWebSocket | public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) {
Validator.notNull(recognizeOptions, "recognizeOptions cannot be null");
Validator.notNull(recognizeOptions.audio(), "audio cannot be null");
Validator.notNull(callback, "callback cannot be null");
HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder();
if (recognizeOptions.model() != null) {
urlBuilder.addQueryParameter("model", recognizeOptions.model());
}
if (recognizeOptions.customizationId() != null) {
urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId());
}
if (recognizeOptions.languageCustomizationId() != null) {
urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId());
}
if (recognizeOptions.acousticCustomizationId() != null) {
urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId());
}
if (recognizeOptions.baseModelVersion() != null) {
urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion());
}
String url = urlBuilder.toString().replace("https://", "wss://");
Request.Builder builder = new Request.Builder().url(url);
setAuthentication(builder);
setDefaultHeaders(builder);
OkHttpClient client = configureHttpClient();
return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback));
} | java | public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) {
Validator.notNull(recognizeOptions, "recognizeOptions cannot be null");
Validator.notNull(recognizeOptions.audio(), "audio cannot be null");
Validator.notNull(callback, "callback cannot be null");
HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder();
if (recognizeOptions.model() != null) {
urlBuilder.addQueryParameter("model", recognizeOptions.model());
}
if (recognizeOptions.customizationId() != null) {
urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId());
}
if (recognizeOptions.languageCustomizationId() != null) {
urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId());
}
if (recognizeOptions.acousticCustomizationId() != null) {
urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId());
}
if (recognizeOptions.baseModelVersion() != null) {
urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion());
}
String url = urlBuilder.toString().replace("https://", "wss://");
Request.Builder builder = new Request.Builder().url(url);
setAuthentication(builder);
setDefaultHeaders(builder);
OkHttpClient client = configureHttpClient();
return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback));
} | [
"public",
"WebSocket",
"recognizeUsingWebSocket",
"(",
"RecognizeOptions",
"recognizeOptions",
",",
"RecognizeCallback",
"callback",
")",
"{",
"Validator",
".",
"notNull",
"(",
"recognizeOptions",
",",
"\"recognizeOptions cannot be null\"",
")",
";",
"Validator",
".",
"no... | Sends audio and returns transcription results for recognition requests over a WebSocket connection. Requests and
responses are enabled over a single TCP connection that abstracts much of the complexity of the request to offer
efficient implementation, low latency, high throughput, and an asynchronous response. By default, only final
results are returned for any request; to enable interim results, set the interimResults parameter to true.
The service imposes a data size limit of 100 MB per utterance (per recognition request). You can send multiple
utterances over a single WebSocket connection. The service automatically detects the endianness of the incoming
audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding.
(For the audio/l16 format, you can specify the endianness.)
@param recognizeOptions the recognize options
@param callback the {@link RecognizeCallback} instance where results will be sent
@return the {@link WebSocket} | [
"Sends",
"audio",
"and",
"returns",
"transcription",
"results",
"for",
"recognition",
"requests",
"over",
"a",
"WebSocket",
"connection",
".",
"Requests",
"and",
"responses",
"are",
"enabled",
"over",
"a",
"single",
"TCP",
"connection",
"that",
"abstracts",
"much"... | train | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java#L381-L412 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getDetailedGuildInfo | public void getDetailedGuildInfo(String id, String api, Callback<Guild> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getDetailedGuildInfo(id, api).enqueue(callback);
} | java | public void getDetailedGuildInfo(String id, String api, Callback<Guild> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getDetailedGuildInfo(id, api).enqueue(callback);
} | [
"public",
"void",
"getDetailedGuildInfo",
"(",
"String",
"id",
",",
"String",
"api",
",",
"Callback",
"<",
"Guild",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ParamType... | For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/>
Note: if the given account is not a member, sometime endpoint will return general guild info instead of detailed info
@param id guild id
@param api Guild Wars 2 API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see Guild guild info | [
"For",
"more",
"info",
"on",
"guild",
"upgrades",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"guild",
"/",
"upgrades",
">",
"here<",
"/",
"a",
">",
"<br",
"/"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1451-L1454 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.updateSpaceConsumed | void updateSpaceConsumed(String path, INode[] inodes, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
writeLock();
try {
if (inodes == null) {
inodes = rootDir.getExistingPathINodes(path);
}
int len = inodes.length;
if (inodes[len - 1] == null) {
throw new FileNotFoundException(path +
" does not exist under rootDir.");
}
updateCount(inodes, len-1, nsDelta, dsDelta, true);
} finally {
writeUnlock();
}
} | java | void updateSpaceConsumed(String path, INode[] inodes, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
writeLock();
try {
if (inodes == null) {
inodes = rootDir.getExistingPathINodes(path);
}
int len = inodes.length;
if (inodes[len - 1] == null) {
throw new FileNotFoundException(path +
" does not exist under rootDir.");
}
updateCount(inodes, len-1, nsDelta, dsDelta, true);
} finally {
writeUnlock();
}
} | [
"void",
"updateSpaceConsumed",
"(",
"String",
"path",
",",
"INode",
"[",
"]",
"inodes",
",",
"long",
"nsDelta",
",",
"long",
"dsDelta",
")",
"throws",
"QuotaExceededException",
",",
"FileNotFoundException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
... | Updates namespace and diskspace consumed for all
directories until the parent directory of file represented by path.
@param path path for the file.
@param inodes inode array representation of the path
@param nsDelta the delta change of namespace
@param dsDelta the delta change of diskspace
@throws QuotaExceededException if the new count violates any quota limit
@throws FileNotFound if path does not exist. | [
"Updates",
"namespace",
"and",
"diskspace",
"consumed",
"for",
"all",
"directories",
"until",
"the",
"parent",
"directory",
"of",
"file",
"represented",
"by",
"path",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2070-L2087 |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/status/domain/ClusterInfo.java | ClusterInfo.clusterInfo | public static ClusterInfo clusterInfo(final Supplier<String> colorSupplier, final Supplier<String> colorStateSupplier) {
return new ClusterInfo(colorSupplier, colorStateSupplier);
} | java | public static ClusterInfo clusterInfo(final Supplier<String> colorSupplier, final Supplier<String> colorStateSupplier) {
return new ClusterInfo(colorSupplier, colorStateSupplier);
} | [
"public",
"static",
"ClusterInfo",
"clusterInfo",
"(",
"final",
"Supplier",
"<",
"String",
">",
"colorSupplier",
",",
"final",
"Supplier",
"<",
"String",
">",
"colorStateSupplier",
")",
"{",
"return",
"new",
"ClusterInfo",
"(",
"colorSupplier",
",",
"colorStateSup... | Creates a ClusterInfo instance with {@link Supplier suppliers} for color and colorState information.
@param colorSupplier the Supplier for the color of the cluster in Blue/Green deployment scenarios.
@param colorStateSupplier the Supplier for the state of the cluster, for example "staged" or "live",
to determine if the color is currently in production, or not.
@return ClusterInfo with color and state provided by suppliers | [
"Creates",
"a",
"ClusterInfo",
"instance",
"with",
"{",
"@link",
"Supplier",
"suppliers",
"}",
"for",
"color",
"and",
"colorState",
"information",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/domain/ClusterInfo.java#L65-L67 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseUtil.java | DatabaseUtil.getObjectsByLabelMatch | public static ArrayModifiableDBIDs getObjectsByLabelMatch(Database database, Pattern name_pattern) {
Relation<String> relation = guessLabelRepresentation(database);
if(name_pattern == null) {
return DBIDUtil.newArray();
}
ArrayModifiableDBIDs ret = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(name_pattern.matcher(relation.get(iditer)).find()) {
ret.add(iditer);
}
}
return ret;
} | java | public static ArrayModifiableDBIDs getObjectsByLabelMatch(Database database, Pattern name_pattern) {
Relation<String> relation = guessLabelRepresentation(database);
if(name_pattern == null) {
return DBIDUtil.newArray();
}
ArrayModifiableDBIDs ret = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(name_pattern.matcher(relation.get(iditer)).find()) {
ret.add(iditer);
}
}
return ret;
} | [
"public",
"static",
"ArrayModifiableDBIDs",
"getObjectsByLabelMatch",
"(",
"Database",
"database",
",",
"Pattern",
"name_pattern",
")",
"{",
"Relation",
"<",
"String",
">",
"relation",
"=",
"guessLabelRepresentation",
"(",
"database",
")",
";",
"if",
"(",
"name_patt... | Find object by matching their labels.
@param database Database to search in
@param name_pattern Name to match against class or object label
@return found cluster or it throws an exception. | [
"Find",
"object",
"by",
"matching",
"their",
"labels",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseUtil.java#L166-L178 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.executeGet | private HttpResponse executeGet(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
return execute(Method.GET, getRegion(bucketName), bucketName, objectName, headerMap, queryParamMap, null, 0);
} | java | private HttpResponse executeGet(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
return execute(Method.GET, getRegion(bucketName), bucketName, objectName, headerMap, queryParamMap, null, 0);
} | [
"private",
"HttpResponse",
"executeGet",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParamMap",
")",
"throws",
"InvalidBucketNameExcept... | Executes GET method for given request parameters.
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@param headerMap Map of HTTP headers for the request.
@param queryParamMap Map of HTTP query parameters of the request. | [
"Executes",
"GET",
"method",
"for",
"given",
"request",
"parameters",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1293-L1299 |
blackdoor/blackdoor | src/main/java/black/door/struct/SortedArrayList.java | SortedArrayList.addSorted | public boolean addSorted(E element, boolean allowDuplicates) {
boolean added = false;
if(!allowDuplicates){
if(this.contains(element)){
System.err.println("item is a duplicate");
return added;
}}
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i > 0 && cmp.compareTo(get(i - 1)) < 0; i--)
Collections.swap(this, i, i - 1);
return added;
} | java | public boolean addSorted(E element, boolean allowDuplicates) {
boolean added = false;
if(!allowDuplicates){
if(this.contains(element)){
System.err.println("item is a duplicate");
return added;
}}
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i > 0 && cmp.compareTo(get(i - 1)) < 0; i--)
Collections.swap(this, i, i - 1);
return added;
} | [
"public",
"boolean",
"addSorted",
"(",
"E",
"element",
",",
"boolean",
"allowDuplicates",
")",
"{",
"boolean",
"added",
"=",
"false",
";",
"if",
"(",
"!",
"allowDuplicates",
")",
"{",
"if",
"(",
"this",
".",
"contains",
"(",
"element",
")",
")",
"{",
"... | adds an element to the list in its place based on natural order.
@param element
element to be appended to this list
@param allowDuplicates if true will allow multiple of the same item to be added, else returns false.
@return true if this collection changed as a result of the call | [
"adds",
"an",
"element",
"to",
"the",
"list",
"in",
"its",
"place",
"based",
"on",
"natural",
"order",
"."
] | train | https://github.com/blackdoor/blackdoor/blob/060c7a71dfafb85e10e8717736e6d3160262e96b/src/main/java/black/door/struct/SortedArrayList.java#L43-L55 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4Connection.java | JDBC4Connection.prepareCall | @Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"CallableStatement",
"prepareCall",
"(",
"String",
"sql",
",",
"int",
"resultSetType",
",",
"int",
"resultSetConcurrency",
",",
"int",
"resultSetHoldability",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQ... | Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. | [
"Creates",
"a",
"CallableStatement",
"object",
"that",
"will",
"generate",
"ResultSet",
"objects",
"with",
"the",
"given",
"type",
"and",
"concurrency",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L354-L359 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/filter/Filters.java | Filters.replaceInString | public static Filter replaceInString(
final Pattern regexp,
final String replacement,
final int overlap) {
return new FilterAdapter() {
private String string;
@Override
protected String doBeforeAppend(String string, StringBuilder buffer) {
this.string = string;
return string;
}
@Override
protected boolean doAfterAppend(StringBuilder buffer) {
int pos = string == null
? 0
: Math.max(0, buffer.length() - string.length() - overlap);
final Matcher matcher = regexp.matcher(buffer.substring(pos));
final String str = matcher.replaceAll(replacement);
buffer.replace(pos, buffer.length(), str);
return false;
}
};
} | java | public static Filter replaceInString(
final Pattern regexp,
final String replacement,
final int overlap) {
return new FilterAdapter() {
private String string;
@Override
protected String doBeforeAppend(String string, StringBuilder buffer) {
this.string = string;
return string;
}
@Override
protected boolean doAfterAppend(StringBuilder buffer) {
int pos = string == null
? 0
: Math.max(0, buffer.length() - string.length() - overlap);
final Matcher matcher = regexp.matcher(buffer.substring(pos));
final String str = matcher.replaceAll(replacement);
buffer.replace(pos, buffer.length(), str);
return false;
}
};
} | [
"public",
"static",
"Filter",
"replaceInString",
"(",
"final",
"Pattern",
"regexp",
",",
"final",
"String",
"replacement",
",",
"final",
"int",
"overlap",
")",
"{",
"return",
"new",
"FilterAdapter",
"(",
")",
"{",
"private",
"String",
"string",
";",
"@",
"Ov... | Creates a filter which replaces every substring in the input string that matches the given
regular expression
and replaces it with given replacement.
<p/>
The method just calls {@link String#replaceAll(String, String)} for the input string.
@param regexp the regular expression
@param replacement the string to be substituted for each match
@param overlap the number of characters prepended to the matching string from the
previous data chunk before match
@return the filter | [
"Creates",
"a",
"filter",
"which",
"replaces",
"every",
"substring",
"in",
"the",
"input",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"and",
"replaces",
"it",
"with",
"given",
"replacement",
".",
"<p",
"/",
">",
"The",
"method",
"j... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/filter/Filters.java#L77-L103 |
ModeShape/modeshape | modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrMetaData.java | JcrMetaData.getExportedKeys | @Override
public ResultSet getExportedKeys( String catalog,
String schema,
String table ) throws SQLException {
return getImportedKeys(catalog, schema, table); // empty, but same resultsetmetadata
} | java | @Override
public ResultSet getExportedKeys( String catalog,
String schema,
String table ) throws SQLException {
return getImportedKeys(catalog, schema, table); // empty, but same resultsetmetadata
} | [
"@",
"Override",
"public",
"ResultSet",
"getExportedKeys",
"(",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"return",
"getImportedKeys",
"(",
"catalog",
",",
"schema",
",",
"table",
")",
";",
"// em... | {@inheritDoc}
<p>
This driver maps REFERENCE properties as keys, and therefore it represents as imported keys those REFERENCE properties on
the type identified by the table name.
</p>
@see java.sql.DatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String, java.lang.String) | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"This",
"driver",
"maps",
"REFERENCE",
"properties",
"as",
"keys",
"and",
"therefore",
"it",
"represents",
"as",
"imported",
"keys",
"those",
"REFERENCE",
"properties",
"on",
"the",
"type",
"identified",
"by",
"the",
"table"... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrMetaData.java#L523-L528 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.getFirstRootFileByName | public static AbstractFile getFirstRootFileByName(final SecurityContext securityContext, final String name) {
logger.debug("Search for file with name: {}", name);
try {
final List<AbstractFile> files = StructrApp.getInstance(securityContext).nodeQuery(AbstractFile.class).andName(name).getAsList();
for (final AbstractFile file : files) {
if (file.getParent() == null) {
return file;
}
}
} catch (FrameworkException fex) {
logger.warn("Unable to find a file for name {}: {}", name, fex.getMessage());
}
return null;
} | java | public static AbstractFile getFirstRootFileByName(final SecurityContext securityContext, final String name) {
logger.debug("Search for file with name: {}", name);
try {
final List<AbstractFile> files = StructrApp.getInstance(securityContext).nodeQuery(AbstractFile.class).andName(name).getAsList();
for (final AbstractFile file : files) {
if (file.getParent() == null) {
return file;
}
}
} catch (FrameworkException fex) {
logger.warn("Unable to find a file for name {}: {}", name, fex.getMessage());
}
return null;
} | [
"public",
"static",
"AbstractFile",
"getFirstRootFileByName",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"String",
"name",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Search for file with name: {}\"",
",",
"name",
")",
";",
"try",
"{",
"final",
... | Find the first file with given name on root level (without parent folder).
@param securityContext
@param name
@return file | [
"Find",
"the",
"first",
"file",
"with",
"given",
"name",
"on",
"root",
"level",
"(",
"without",
"parent",
"folder",
")",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L686-L707 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Utils.java | Utils.escapeIdentifier | public static StringBuilder escapeIdentifier(StringBuilder sbuf, String value)
throws SQLException {
if (sbuf == null) {
sbuf = new StringBuilder(2 + (value.length() + 10) / 10 * 11); // Add 10% for escaping.
}
doAppendEscapedIdentifier(sbuf, value);
return sbuf;
} | java | public static StringBuilder escapeIdentifier(StringBuilder sbuf, String value)
throws SQLException {
if (sbuf == null) {
sbuf = new StringBuilder(2 + (value.length() + 10) / 10 * 11); // Add 10% for escaping.
}
doAppendEscapedIdentifier(sbuf, value);
return sbuf;
} | [
"public",
"static",
"StringBuilder",
"escapeIdentifier",
"(",
"StringBuilder",
"sbuf",
",",
"String",
"value",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"sbuf",
"==",
"null",
")",
"{",
"sbuf",
"=",
"new",
"StringBuilder",
"(",
"2",
"+",
"(",
"value",
... | Escape the given identifier <tt>value</tt> and append it to the string builder <tt>sbuf</tt>.
If <tt>sbuf</tt> is <tt>null</tt>, a new StringBuilder will be returned. This method is
different from appendEscapedLiteral in that it includes the quoting required for the identifier
while {@link #escapeLiteral(StringBuilder, String, boolean)} does not.
@param sbuf the string builder to append to; or <tt>null</tt>
@param value the string value
@return the sbuf argument; or a new string builder for sbuf == null
@throws SQLException if the string contains a <tt>\0</tt> character | [
"Escape",
"the",
"given",
"identifier",
"<tt",
">",
"value<",
"/",
"tt",
">",
"and",
"append",
"it",
"to",
"the",
"string",
"builder",
"<tt",
">",
"sbuf<",
"/",
"tt",
">",
".",
"If",
"<tt",
">",
"sbuf<",
"/",
"tt",
">",
"is",
"<tt",
">",
"null<",
... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Utils.java#L136-L143 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java | MetadataAwareClassVisitor.onVisitTypeAnnotation | protected AnnotationVisitor onVisitTypeAnnotation(int typeReference, TypePath typePath, String descriptor, boolean visible) {
return super.visitTypeAnnotation(typeReference, typePath, descriptor, visible);
} | java | protected AnnotationVisitor onVisitTypeAnnotation(int typeReference, TypePath typePath, String descriptor, boolean visible) {
return super.visitTypeAnnotation(typeReference, typePath, descriptor, visible);
} | [
"protected",
"AnnotationVisitor",
"onVisitTypeAnnotation",
"(",
"int",
"typeReference",
",",
"TypePath",
"typePath",
",",
"String",
"descriptor",
",",
"boolean",
"visible",
")",
"{",
"return",
"super",
".",
"visitTypeAnnotation",
"(",
"typeReference",
",",
"typePath",... | An order-sensitive invocation of {@link ClassVisitor#visitTypeAnnotation(int, TypePath, String, boolean)}.
@param typeReference The type reference of the type annotation.
@param typePath The type path of the type annotation.
@param descriptor The descriptor of the annotation type.
@param visible {@code true} if the annotation is visible at runtime.
@return An annotation visitor or {@code null} if the annotation should be ignored. | [
"An",
"order",
"-",
"sensitive",
"invocation",
"of",
"{",
"@link",
"ClassVisitor#visitTypeAnnotation",
"(",
"int",
"TypePath",
"String",
"boolean",
")",
"}",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java#L165-L167 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/handler/ReadHandler.java | ReadHandler.doHandleRequest | @Override
public Object doHandleRequest(MBeanServerConnection pServer, JmxReadRequest pRequest)
throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException {
checkRestriction(pRequest.getObjectName(), pRequest.getAttributeName());
return pServer.getAttribute(pRequest.getObjectName(), pRequest.getAttributeName());
} | java | @Override
public Object doHandleRequest(MBeanServerConnection pServer, JmxReadRequest pRequest)
throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException {
checkRestriction(pRequest.getObjectName(), pRequest.getAttributeName());
return pServer.getAttribute(pRequest.getObjectName(), pRequest.getAttributeName());
} | [
"@",
"Override",
"public",
"Object",
"doHandleRequest",
"(",
"MBeanServerConnection",
"pServer",
",",
"JmxReadRequest",
"pRequest",
")",
"throws",
"InstanceNotFoundException",
",",
"AttributeNotFoundException",
",",
"ReflectionException",
",",
"MBeanException",
",",
"IOExce... | Used for a request to a single attribute from a single MBean. Merging of MBeanServers is done
one layer above.
@param pServer server on which to request the attribute
@param pRequest the request itself.
@return the attribute's value | [
"Used",
"for",
"a",
"request",
"to",
"a",
"single",
"attribute",
"from",
"a",
"single",
"MBean",
".",
"Merging",
"of",
"MBeanServers",
"is",
"done",
"one",
"layer",
"above",
"."
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/ReadHandler.java#L102-L107 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.rotationTowards | public Matrix4x3d rotationTowards(Vector3dc dir, Vector3dc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | java | public Matrix4x3d rotationTowards(Vector3dc dir, Vector3dc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | [
"public",
"Matrix4x3d",
"rotationTowards",
"(",
"Vector3dc",
"dir",
",",
"Vector3dc",
"up",
")",
"{",
"return",
"rotationTowards",
"(",
"dir",
".",
"x",
"(",
")",
",",
"dir",
".",
"y",
"(",
")",
",",
"dir",
".",
"z",
"(",
")",
",",
"up",
".",
"x",
... | Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local <code>-z</code> axis with <code>dir</code>.
<p>
In order to apply the rotation transformation to a previous existing transformation,
use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}.
<p>
This method is equivalent to calling: <code>setLookAt(new Vector3d(), new Vector3d(dir).negate(), up).invert()</code>
@see #rotationTowards(Vector3dc, Vector3dc)
@see #rotateTowards(double, double, double, double, double, double)
@param dir
the direction to orient the local -z axis towards
@param up
the up vector
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"model",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"dir<",
"/",
"code",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L9731-L9733 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_firewall_ipOnFirewall_rule_GET | public ArrayList<Long> ip_firewall_ipOnFirewall_rule_GET(String ip, String ipOnFirewall, OvhFirewallRuleStateEnum state) throws IOException {
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}/rule";
StringBuilder sb = path(qPath, ip, ipOnFirewall);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<Long> ip_firewall_ipOnFirewall_rule_GET(String ip, String ipOnFirewall, OvhFirewallRuleStateEnum state) throws IOException {
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}/rule";
StringBuilder sb = path(qPath, ip, ipOnFirewall);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"ip_firewall_ipOnFirewall_rule_GET",
"(",
"String",
"ip",
",",
"String",
"ipOnFirewall",
",",
"OvhFirewallRuleStateEnum",
"state",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/firewall/{ipOnFirewall}/rule\... | Rules for this IP
REST: GET /ip/{ip}/firewall/{ipOnFirewall}/rule
@param state [required] Filter the value of state property (=)
@param ip [required]
@param ipOnFirewall [required] | [
"Rules",
"for",
"this",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1078-L1084 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java | ChatChannelManager.resolutionComplete | protected void resolutionComplete (ChatChannel channel, Set<Integer> parts)
{
// map the participants of our now resolved channel
ChannelInfo info = new ChannelInfo();
info.channel = channel;
info.participants = parts;
_channels.put(channel, info);
// dispatch any pending messages now that we know where they go
for (UserMessage msg : _resolving.remove(channel)) {
dispatchSpeak(channel, msg);
}
} | java | protected void resolutionComplete (ChatChannel channel, Set<Integer> parts)
{
// map the participants of our now resolved channel
ChannelInfo info = new ChannelInfo();
info.channel = channel;
info.participants = parts;
_channels.put(channel, info);
// dispatch any pending messages now that we know where they go
for (UserMessage msg : _resolving.remove(channel)) {
dispatchSpeak(channel, msg);
}
} | [
"protected",
"void",
"resolutionComplete",
"(",
"ChatChannel",
"channel",
",",
"Set",
"<",
"Integer",
">",
"parts",
")",
"{",
"// map the participants of our now resolved channel",
"ChannelInfo",
"info",
"=",
"new",
"ChannelInfo",
"(",
")",
";",
"info",
".",
"channe... | This should be called when a channel's participant set has been resolved. | [
"This",
"should",
"be",
"called",
"when",
"a",
"channel",
"s",
"participant",
"set",
"has",
"been",
"resolved",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/ChatChannelManager.java#L253-L265 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.getTableAliasForPath | private TableAlias getTableAliasForPath(String aPath, List hintClasses)
{
return (TableAlias) m_pathToAlias.get(buildAliasKey(aPath, hintClasses));
} | java | private TableAlias getTableAliasForPath(String aPath, List hintClasses)
{
return (TableAlias) m_pathToAlias.get(buildAliasKey(aPath, hintClasses));
} | [
"private",
"TableAlias",
"getTableAliasForPath",
"(",
"String",
"aPath",
",",
"List",
"hintClasses",
")",
"{",
"return",
"(",
"TableAlias",
")",
"m_pathToAlias",
".",
"get",
"(",
"buildAliasKey",
"(",
"aPath",
",",
"hintClasses",
")",
")",
";",
"}"
] | Answer the TableAlias for aPath
@param aPath
@param hintClasses
@return TableAlias, null if none | [
"Answer",
"the",
"TableAlias",
"for",
"aPath"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1359-L1362 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java | MemberSummaryBuilder.buildAnnotationTypeFieldsSummary | public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} | java | public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} | [
"public",
"void",
"buildAnnotationTypeFieldsSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"memberSummaryTree",
")",
"{",
"MemberSummaryWriter",
"writer",
"=",
"memberSummaryWriters",
".",
"get",
"(",
"VisibleMemberMap",
".",
"Kind",
".",
"ANNOTATION_TYPE_FIELDS",
")... | Build the summary for fields.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added | [
"Build",
"the",
"summary",
"for",
"fields",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L223-L229 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/IDCreator.java | IDCreator.setID | private static int setID(String prefix, int identifier, IChemObject object, List<String> tabuList) {
identifier += 1;
while (tabuList.contains(prefix + identifier)) {
identifier += 1;
}
object.setID(prefix + identifier);
tabuList.add(prefix + identifier);
return identifier;
} | java | private static int setID(String prefix, int identifier, IChemObject object, List<String> tabuList) {
identifier += 1;
while (tabuList.contains(prefix + identifier)) {
identifier += 1;
}
object.setID(prefix + identifier);
tabuList.add(prefix + identifier);
return identifier;
} | [
"private",
"static",
"int",
"setID",
"(",
"String",
"prefix",
",",
"int",
"identifier",
",",
"IChemObject",
"object",
",",
"List",
"<",
"String",
">",
"tabuList",
")",
"{",
"identifier",
"+=",
"1",
";",
"while",
"(",
"tabuList",
".",
"contains",
"(",
"pr... | Sets the ID on the object and adds it to the tabu list.
@param object IChemObject to set the ID for
@param tabuList Tabu list to add the ID to | [
"Sets",
"the",
"ID",
"on",
"the",
"object",
"and",
"adds",
"it",
"to",
"the",
"tabu",
"list",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/IDCreator.java#L174-L182 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java | OtpConnection.sendBuf | public void sendBuf(final String dest, final OtpOutputStream payload)
throws IOException {
super.sendBuf(self.pid(), dest, payload);
} | java | public void sendBuf(final String dest, final OtpOutputStream payload)
throws IOException {
super.sendBuf(self.pid(), dest, payload);
} | [
"public",
"void",
"sendBuf",
"(",
"final",
"String",
"dest",
",",
"final",
"OtpOutputStream",
"payload",
")",
"throws",
"IOException",
"{",
"super",
".",
"sendBuf",
"(",
"self",
".",
"pid",
"(",
")",
",",
"dest",
",",
"payload",
")",
";",
"}"
] | Send a pre-encoded message to a named process on a remote node.
@param dest
the name of the remote process.
@param payload
the encoded message to send.
@exception java.io.IOException
if the connection is not active or a communication error
occurs. | [
"Send",
"a",
"pre",
"-",
"encoded",
"message",
"to",
"a",
"named",
"process",
"on",
"a",
"remote",
"node",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpConnection.java#L395-L398 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapHostManagerImpl.java | ImapHostManagerImpl.getQualifiedMailboxName | private String getQualifiedMailboxName(GreenMailUser user, String mailboxName) {
String userNamespace = user.getQualifiedMailboxName();
if ("INBOX".equalsIgnoreCase(mailboxName)) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + INBOX_NAME;
}
if (mailboxName.startsWith(NAMESPACE_PREFIX)) {
return mailboxName;
} else {
if (mailboxName.length() == 0) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace;
} else {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + mailboxName;
}
}
} | java | private String getQualifiedMailboxName(GreenMailUser user, String mailboxName) {
String userNamespace = user.getQualifiedMailboxName();
if ("INBOX".equalsIgnoreCase(mailboxName)) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + INBOX_NAME;
}
if (mailboxName.startsWith(NAMESPACE_PREFIX)) {
return mailboxName;
} else {
if (mailboxName.length() == 0) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace;
} else {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + mailboxName;
}
}
} | [
"private",
"String",
"getQualifiedMailboxName",
"(",
"GreenMailUser",
"user",
",",
"String",
"mailboxName",
")",
"{",
"String",
"userNamespace",
"=",
"user",
".",
"getQualifiedMailboxName",
"(",
")",
";",
"if",
"(",
"\"INBOX\"",
".",
"equalsIgnoreCase",
"(",
"mail... | Convert a user specified store name into a server absolute name.
If the mailboxName begins with the namespace token,
return as-is.
If not, need to resolve the Mailbox name for this user.
Example:
<br> Convert "INBOX" for user "Fred.Flinstone" into
absolute name: "#user.Fred.Flintstone.INBOX"
@return String of absoluteName, null if not valid selection | [
"Convert",
"a",
"user",
"specified",
"store",
"name",
"into",
"a",
"server",
"absolute",
"name",
".",
"If",
"the",
"mailboxName",
"begins",
"with",
"the",
"namespace",
"token",
"return",
"as",
"-",
"is",
".",
"If",
"not",
"need",
"to",
"resolve",
"the",
... | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapHostManagerImpl.java#L276-L294 |
j-easy/easy-batch | easybatch-core/src/main/java/org/easybatch/core/mapper/ObjectMapper.java | ObjectMapper.mapObject | public T mapObject(final Map<String, String> values) throws Exception {
T result = createInstance();
// for each field
for (Map.Entry<String, String> entry : values.entrySet()) {
String field = entry.getKey();
//get field raw value
String value = values.get(field);
Method setter = setters.get(field);
if (setter == null) {
LOGGER.warn("No public setter found for field {}, this field will be set to null (if object type) or default value (if primitive type)", field);
continue;
}
Class<?> type = setter.getParameterTypes()[0];
TypeConverter<String, ?> typeConverter = typeConverters.get(type);
if (typeConverter == null) {
LOGGER.warn(
"Type conversion not supported for type {}, field {} will be set to null (if object type) or default value (if primitive type)",
type, field);
continue;
}
if (value == null) {
LOGGER.warn("Attempting to convert null to type {} for field {}, this field will be set to null (if object type) or default value (if primitive type)", type, field);
continue;
}
if (value.isEmpty()) {
LOGGER.debug("Attempting to convert an empty string to type {} for field {}, this field will be ignored", type, field);
continue;
}
convertValue(result, field, value, setter, type, typeConverter);
}
return result;
} | java | public T mapObject(final Map<String, String> values) throws Exception {
T result = createInstance();
// for each field
for (Map.Entry<String, String> entry : values.entrySet()) {
String field = entry.getKey();
//get field raw value
String value = values.get(field);
Method setter = setters.get(field);
if (setter == null) {
LOGGER.warn("No public setter found for field {}, this field will be set to null (if object type) or default value (if primitive type)", field);
continue;
}
Class<?> type = setter.getParameterTypes()[0];
TypeConverter<String, ?> typeConverter = typeConverters.get(type);
if (typeConverter == null) {
LOGGER.warn(
"Type conversion not supported for type {}, field {} will be set to null (if object type) or default value (if primitive type)",
type, field);
continue;
}
if (value == null) {
LOGGER.warn("Attempting to convert null to type {} for field {}, this field will be set to null (if object type) or default value (if primitive type)", type, field);
continue;
}
if (value.isEmpty()) {
LOGGER.debug("Attempting to convert an empty string to type {} for field {}, this field will be ignored", type, field);
continue;
}
convertValue(result, field, value, setter, type, typeConverter);
}
return result;
} | [
"public",
"T",
"mapObject",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"throws",
"Exception",
"{",
"T",
"result",
"=",
"createInstance",
"(",
")",
";",
"// for each field",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
... | Map values to fields of the target object type.
@param values fields values
@return A populated instance of the target type.
@throws Exception if values cannot be mapped to target object fields | [
"Map",
"values",
"to",
"fields",
"of",
"the",
"target",
"object",
"type",
"."
] | train | https://github.com/j-easy/easy-batch/blob/46286e1091dae1206674e2a30e0609c31feae36c/easybatch-core/src/main/java/org/easybatch/core/mapper/ObjectMapper.java#L77-L118 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.scaleAround | public Matrix4d scaleAround(double sx, double sy, double sz, double ox, double oy, double oz) {
return scaleAround(sx, sy, sz, ox, oy, oz, this);
} | java | public Matrix4d scaleAround(double sx, double sy, double sz, double ox, double oy, double oz) {
return scaleAround(sx, sy, sz, ox, oy, oz, this);
} | [
"public",
"Matrix4d",
"scaleAround",
"(",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"sz",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"oz",
")",
"{",
"return",
"scaleAround",
"(",
"sx",
",",
"sy",
",",
"sz",
",",
"ox",
",",
"... | Apply scaling to this matrix by scaling the base axes by the given sx,
sy and sz factors while using <code>(ox, oy, oz)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param sz
the scaling factor of the z component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return this | [
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"sy",
"and",
"sz",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4478-L4480 |
samskivert/samskivert | src/main/java/com/samskivert/util/ConfigUtil.java | ConfigUtil.parseMetaData | protected static PropRecord parseMetaData (String path, URL sourceURL)
throws IOException
{
InputStream input = sourceURL.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(input));
try {
PropRecord record = new PropRecord(path, sourceURL);
boolean started = false;
String line;
while ((line = bin.readLine()) != null) {
if (line.startsWith(PACKAGE_KEY)) {
record._package = parseValue(line);
started = true;
} else if (line.startsWith(EXTENDS_KEY)) {
record._extends = parseValue(line);
started = true;
} else if (line.startsWith(OVERRIDES_KEY)) {
record._overrides = parseValues(line);
started = true;
} else if (started) {
break;
}
}
return record;
} finally {
StreamUtil.close(bin);
}
} | java | protected static PropRecord parseMetaData (String path, URL sourceURL)
throws IOException
{
InputStream input = sourceURL.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(input));
try {
PropRecord record = new PropRecord(path, sourceURL);
boolean started = false;
String line;
while ((line = bin.readLine()) != null) {
if (line.startsWith(PACKAGE_KEY)) {
record._package = parseValue(line);
started = true;
} else if (line.startsWith(EXTENDS_KEY)) {
record._extends = parseValue(line);
started = true;
} else if (line.startsWith(OVERRIDES_KEY)) {
record._overrides = parseValues(line);
started = true;
} else if (started) {
break;
}
}
return record;
} finally {
StreamUtil.close(bin);
}
} | [
"protected",
"static",
"PropRecord",
"parseMetaData",
"(",
"String",
"path",
",",
"URL",
"sourceURL",
")",
"throws",
"IOException",
"{",
"InputStream",
"input",
"=",
"sourceURL",
".",
"openStream",
"(",
")",
";",
"BufferedReader",
"bin",
"=",
"new",
"BufferedRea... | Performs simple processing of the supplied input stream to obtain inheritance metadata from
the properties file. | [
"Performs",
"simple",
"processing",
"of",
"the",
"supplied",
"input",
"stream",
"to",
"obtain",
"inheritance",
"metadata",
"from",
"the",
"properties",
"file",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L410-L437 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/DBConnection.java | DBConnection.checkValidity | private PreparedStatement checkValidity(PreparedStatement ps, String key) {
long currentTime = currentTimeMillis();
Long lastChecked = threadedPsTimeMap.get().get(key);
if (lastChecked == null) {
// if never checked, setting to 0 ensures check will occur
// (as long as we're not less than 10min past 1 Jan 1970)
lastChecked = 0L;
}
if (currentTime - lastChecked.longValue() > VALIDITY_CHECK_INTERVAL) {
try {
Connection psConn = ps.getConnection();
if (psConn == null || psConn.isClosed()
|| !psConn.isValid(VALIDITY_TIMEOUT)) {
logger.info("Connection for PreparedStatement is closed or "
+ "invalid; removing from cache");
// remove the prepared statement w/ invalid connection
threadedPsMap.get().remove(key);
ps = null;
}
} catch (SQLException e) {
logger.info("Failed to check Prepared Statement validity.", e);
ps = null;
}
}
return ps;
} | java | private PreparedStatement checkValidity(PreparedStatement ps, String key) {
long currentTime = currentTimeMillis();
Long lastChecked = threadedPsTimeMap.get().get(key);
if (lastChecked == null) {
// if never checked, setting to 0 ensures check will occur
// (as long as we're not less than 10min past 1 Jan 1970)
lastChecked = 0L;
}
if (currentTime - lastChecked.longValue() > VALIDITY_CHECK_INTERVAL) {
try {
Connection psConn = ps.getConnection();
if (psConn == null || psConn.isClosed()
|| !psConn.isValid(VALIDITY_TIMEOUT)) {
logger.info("Connection for PreparedStatement is closed or "
+ "invalid; removing from cache");
// remove the prepared statement w/ invalid connection
threadedPsMap.get().remove(key);
ps = null;
}
} catch (SQLException e) {
logger.info("Failed to check Prepared Statement validity.", e);
ps = null;
}
}
return ps;
} | [
"private",
"PreparedStatement",
"checkValidity",
"(",
"PreparedStatement",
"ps",
",",
"String",
"key",
")",
"{",
"long",
"currentTime",
"=",
"currentTimeMillis",
"(",
")",
";",
"Long",
"lastChecked",
"=",
"threadedPsTimeMap",
".",
"get",
"(",
")",
".",
"get",
... | Validate the {@link Connection} backing a {@link PreparedStatement}.
@param ps
@param key
@return the provided {@link PreparedStatement} if valid,
<code>null</code> if the statement's {@link Connection} was
invalid. | [
"Validate",
"the",
"{",
"@link",
"Connection",
"}",
"backing",
"a",
"{",
"@link",
"PreparedStatement",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/DBConnection.java#L291-L316 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/Vertigo.java | Vertigo.deployNetwork | public Vertigo deployNetwork(String cluster, String name) {
return deployNetwork(cluster, name, null);
} | java | public Vertigo deployNetwork(String cluster, String name) {
return deployNetwork(cluster, name, null);
} | [
"public",
"Vertigo",
"deployNetwork",
"(",
"String",
"cluster",
",",
"String",
"name",
")",
"{",
"return",
"deployNetwork",
"(",
"cluster",
",",
"name",
",",
"null",
")",
";",
"}"
] | Deploys a bare network to a specific cluster.<p>
The network will be deployed with no components and no connections. You
can add components and connections to the network with an {@link ActiveNetwork}
instance.
@param cluster The cluster to which to deploy the network.
@param name The name of the network to deploy.
@return The Vertigo instance. | [
"Deploys",
"a",
"bare",
"network",
"to",
"a",
"specific",
"cluster",
".",
"<p",
">"
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/Vertigo.java#L455-L457 |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.fromBytes | public static UTF8String fromBytes(byte[] bytes) {
if (bytes != null) {
return new UTF8String(bytes, BYTE_ARRAY_OFFSET, bytes.length);
} else {
return null;
}
} | java | public static UTF8String fromBytes(byte[] bytes) {
if (bytes != null) {
return new UTF8String(bytes, BYTE_ARRAY_OFFSET, bytes.length);
} else {
return null;
}
} | [
"public",
"static",
"UTF8String",
"fromBytes",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
"!=",
"null",
")",
"{",
"return",
"new",
"UTF8String",
"(",
"bytes",
",",
"BYTE_ARRAY_OFFSET",
",",
"bytes",
".",
"length",
")",
";",
"}",
"els... | Creates an UTF8String from byte array, which should be encoded in UTF-8.
Note: `bytes` will be hold by returned UTF8String. | [
"Creates",
"an",
"UTF8String",
"from",
"byte",
"array",
"which",
"should",
"be",
"encoded",
"in",
"UTF",
"-",
"8",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L110-L116 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java | CodeBuilderFactory.createOverridingInjector | public static Injector createOverridingInjector(Injector originalInjector, com.google.inject.Module module) {
final Map<Key<?>, Binding<?>> bindings = originalInjector.getBindings();
return Guice.createInjector(Modules2.mixin((binder) -> {
for(Binding<?> binding: bindings.values()) {
final Type typeLiteral = binding.getKey().getTypeLiteral().getType();
if (typeLiteral != null) {
final String typeName = typeLiteral.getTypeName();
if (isValid(typeName)) {
binding.applyTo(binder);
}
}
}
} | java | public static Injector createOverridingInjector(Injector originalInjector, com.google.inject.Module module) {
final Map<Key<?>, Binding<?>> bindings = originalInjector.getBindings();
return Guice.createInjector(Modules2.mixin((binder) -> {
for(Binding<?> binding: bindings.values()) {
final Type typeLiteral = binding.getKey().getTypeLiteral().getType();
if (typeLiteral != null) {
final String typeName = typeLiteral.getTypeName();
if (isValid(typeName)) {
binding.applyTo(binder);
}
}
}
} | [
"public",
"static",
"Injector",
"createOverridingInjector",
"(",
"Injector",
"originalInjector",
",",
"com",
".",
"google",
".",
"inject",
".",
"Module",
"module",
")",
"{",
"final",
"Map",
"<",
"Key",
"<",
"?",
">",
",",
"Binding",
"<",
"?",
">",
">",
"... | Create an injector that override the given injectors with the modules.
@param originalInjector the original injector.
@param modules the overriding modules.
@return the new injector. | [
"Create",
"an",
"injector",
"that",
"override",
"the",
"given",
"injectors",
"with",
"the",
"modules",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java#L204-L216 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java | PrepareRequestInterceptor.prepareIPSUri | private String prepareIPSUri(String action, Context context) throws FMSException {
StringBuilder uri = new StringBuilder();
uri.append(Config.getProperty(Config.BASE_URL_PLATFORMSERVICE)).append("/").append(context.getAppDBID())
.append("?act=").append(action).append("&token=").append(context.getAppToken());
return uri.toString();
} | java | private String prepareIPSUri(String action, Context context) throws FMSException {
StringBuilder uri = new StringBuilder();
uri.append(Config.getProperty(Config.BASE_URL_PLATFORMSERVICE)).append("/").append(context.getAppDBID())
.append("?act=").append(action).append("&token=").append(context.getAppToken());
return uri.toString();
} | [
"private",
"String",
"prepareIPSUri",
"(",
"String",
"action",
",",
"Context",
"context",
")",
"throws",
"FMSException",
"{",
"StringBuilder",
"uri",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"uri",
".",
"append",
"(",
"Config",
".",
"getProperty",
"(",
"C... | Method to construct the IPS URI
@param action
the entity name
@param context
the context
@return the IPS URI
@throws FMSException
the FMSException | [
"Method",
"to",
"construct",
"the",
"IPS",
"URI"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L411-L416 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPUtils.java | RTMPUtils.encodeHeaderByte | public static void encodeHeaderByte(IoBuffer out, byte headerSize, int channelId) {
if (channelId <= 63) {
out.put((byte) ((headerSize << 6) + channelId));
} else if (channelId <= 319) {
out.put((byte) (headerSize << 6));
out.put((byte) (channelId - 64));
} else {
out.put((byte) ((headerSize << 6) | 1));
channelId -= 64;
out.put((byte) (channelId & 0xff));
out.put((byte) (channelId >> 8));
}
} | java | public static void encodeHeaderByte(IoBuffer out, byte headerSize, int channelId) {
if (channelId <= 63) {
out.put((byte) ((headerSize << 6) + channelId));
} else if (channelId <= 319) {
out.put((byte) (headerSize << 6));
out.put((byte) (channelId - 64));
} else {
out.put((byte) ((headerSize << 6) | 1));
channelId -= 64;
out.put((byte) (channelId & 0xff));
out.put((byte) (channelId >> 8));
}
} | [
"public",
"static",
"void",
"encodeHeaderByte",
"(",
"IoBuffer",
"out",
",",
"byte",
"headerSize",
",",
"int",
"channelId",
")",
"{",
"if",
"(",
"channelId",
"<=",
"63",
")",
"{",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"(",
"headerSize",
"<<",
... | Encodes header size marker and channel id into header marker.
@param out output buffer
@param headerSize Header size marker
@param channelId Channel used | [
"Encodes",
"header",
"size",
"marker",
"and",
"channel",
"id",
"into",
"header",
"marker",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPUtils.java#L124-L136 |
OpenBEL/openbel-framework | org.openbel.framework.api/src/main/java/org/openbel/framework/api/OrthologizedKam.java | OrthologizedKam.wrapEdge | private KamEdge wrapEdge(KamEdge kamEdge) {
if (kamEdge == null) {
return null;
}
TermParameter param = etp.get(kamEdge.getId());
if (param != null) {
return new OrthologousEdge(kamEdge, param);
}
return kamEdge;
} | java | private KamEdge wrapEdge(KamEdge kamEdge) {
if (kamEdge == null) {
return null;
}
TermParameter param = etp.get(kamEdge.getId());
if (param != null) {
return new OrthologousEdge(kamEdge, param);
}
return kamEdge;
} | [
"private",
"KamEdge",
"wrapEdge",
"(",
"KamEdge",
"kamEdge",
")",
"{",
"if",
"(",
"kamEdge",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"TermParameter",
"param",
"=",
"etp",
".",
"get",
"(",
"kamEdge",
".",
"getId",
"(",
")",
")",
";",
"if",... | Wrap a {@link KamEdge} as an {@link OrthologousEdge} to allow conversion
of the edge label by the {@link SpeciesDialect}. The edge's
{@link KamNode}s are also wrapped.
@param kamEdge {@link KamEdge}
@return the wrapped kam edge,
<ol>
<li>{@code null} if {@code kamEdge} input is {@code null}</li>
<li>{@link OrthologousEdge} if {@code kamEdge} has orthologized</li>
<li>the original {@code kamEdge} input if it has not orthologized</li>
</ol> | [
"Wrap",
"a",
"{",
"@link",
"KamEdge",
"}",
"as",
"an",
"{",
"@link",
"OrthologousEdge",
"}",
"to",
"allow",
"conversion",
"of",
"the",
"edge",
"label",
"by",
"the",
"{",
"@link",
"SpeciesDialect",
"}",
".",
"The",
"edge",
"s",
"{",
"@link",
"KamNode",
... | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/OrthologizedKam.java#L552-L563 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/BaseLevel.java | BaseLevel.getClosestSpecNodeByTargetId | public SpecNode getClosestSpecNodeByTargetId(final String targetId, final SpecNode callerNode, final boolean checkParentNode) {
final SpecNode retValue = super.getClosestSpecNodeByTargetId(targetId, callerNode, checkParentNode);
if (retValue != null) {
return retValue;
} else {
// Look up the metadata topics
final ContentSpec contentSpec = getContentSpec();
for (final Node contentSpecNode : contentSpec.getNodes()) {
if (contentSpecNode instanceof KeyValueNode && ((KeyValueNode) contentSpecNode).getValue() instanceof SpecTopic) {
final SpecTopic childTopic = (SpecTopic) ((KeyValueNode) contentSpecNode).getValue();
if (childTopic.getTargetId() != null && childTopic.getTargetId().equals(targetId)) {
return childTopic;
}
}
}
return null;
}
} | java | public SpecNode getClosestSpecNodeByTargetId(final String targetId, final SpecNode callerNode, final boolean checkParentNode) {
final SpecNode retValue = super.getClosestSpecNodeByTargetId(targetId, callerNode, checkParentNode);
if (retValue != null) {
return retValue;
} else {
// Look up the metadata topics
final ContentSpec contentSpec = getContentSpec();
for (final Node contentSpecNode : contentSpec.getNodes()) {
if (contentSpecNode instanceof KeyValueNode && ((KeyValueNode) contentSpecNode).getValue() instanceof SpecTopic) {
final SpecTopic childTopic = (SpecTopic) ((KeyValueNode) contentSpecNode).getValue();
if (childTopic.getTargetId() != null && childTopic.getTargetId().equals(targetId)) {
return childTopic;
}
}
}
return null;
}
} | [
"public",
"SpecNode",
"getClosestSpecNodeByTargetId",
"(",
"final",
"String",
"targetId",
",",
"final",
"SpecNode",
"callerNode",
",",
"final",
"boolean",
"checkParentNode",
")",
"{",
"final",
"SpecNode",
"retValue",
"=",
"super",
".",
"getClosestSpecNodeByTargetId",
... | This function checks the levels nodes and child nodes to see if it can match a spec topic for a topic database id.
@param targetId The topic database id
@param callerNode The node that called this function so that it isn't rechecked
@param checkParentNode If the function should check the levels parents as well
@return The closest available SpecTopic that matches the DBId otherwise null. | [
"This",
"function",
"checks",
"the",
"levels",
"nodes",
"and",
"child",
"nodes",
"to",
"see",
"if",
"it",
"can",
"match",
"a",
"spec",
"topic",
"for",
"a",
"topic",
"database",
"id",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/BaseLevel.java#L101-L119 |
apache/flink | flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getPasswordFromCredentialProviders | protected char[] getPasswordFromCredentialProviders(String name)
throws IOException {
char[] pass = null;
try {
List<CredentialProvider> providers =
CredentialProviderFactory.getProviders(this);
if (providers != null) {
for (CredentialProvider provider : providers) {
try {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
pass = entry.getCredential();
break;
}
}
catch (IOException ioe) {
throw new IOException("Can't get key " + name + " from key provider" +
"of type: " + provider.getClass().getName() + ".", ioe);
}
}
}
}
catch (IOException ioe) {
throw new IOException("Configuration problem with provider path.", ioe);
}
return pass;
} | java | protected char[] getPasswordFromCredentialProviders(String name)
throws IOException {
char[] pass = null;
try {
List<CredentialProvider> providers =
CredentialProviderFactory.getProviders(this);
if (providers != null) {
for (CredentialProvider provider : providers) {
try {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
pass = entry.getCredential();
break;
}
}
catch (IOException ioe) {
throw new IOException("Can't get key " + name + " from key provider" +
"of type: " + provider.getClass().getName() + ".", ioe);
}
}
}
}
catch (IOException ioe) {
throw new IOException("Configuration problem with provider path.", ioe);
}
return pass;
} | [
"protected",
"char",
"[",
"]",
"getPasswordFromCredentialProviders",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"char",
"[",
"]",
"pass",
"=",
"null",
";",
"try",
"{",
"List",
"<",
"CredentialProvider",
">",
"providers",
"=",
"CredentialProviderFa... | Try and resolve the provided element name as a credential provider
alias.
@param name alias of the provisioned credential
@return password or null if not found
@throws IOException | [
"Try",
"and",
"resolve",
"the",
"provided",
"element",
"name",
"as",
"a",
"credential",
"provider",
"alias",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java#L1929-L1957 |
JodaOrg/joda-time | src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java | DateTimeZoneBuilder.writeTo | public void writeTo(String zoneID, DataOutput out) throws IOException {
// pass false so zone id is not written out
DateTimeZone zone = toDateTimeZone(zoneID, false);
if (zone instanceof FixedDateTimeZone) {
out.writeByte('F'); // 'F' for fixed
out.writeUTF(zone.getNameKey(0));
writeMillis(out, zone.getOffset(0));
writeMillis(out, zone.getStandardOffset(0));
} else {
if (zone instanceof CachedDateTimeZone) {
out.writeByte('C'); // 'C' for cached, precalculated
zone = ((CachedDateTimeZone)zone).getUncachedZone();
} else {
out.writeByte('P'); // 'P' for precalculated, uncached
}
((PrecalculatedZone)zone).writeTo(out);
}
} | java | public void writeTo(String zoneID, DataOutput out) throws IOException {
// pass false so zone id is not written out
DateTimeZone zone = toDateTimeZone(zoneID, false);
if (zone instanceof FixedDateTimeZone) {
out.writeByte('F'); // 'F' for fixed
out.writeUTF(zone.getNameKey(0));
writeMillis(out, zone.getOffset(0));
writeMillis(out, zone.getStandardOffset(0));
} else {
if (zone instanceof CachedDateTimeZone) {
out.writeByte('C'); // 'C' for cached, precalculated
zone = ((CachedDateTimeZone)zone).getUncachedZone();
} else {
out.writeByte('P'); // 'P' for precalculated, uncached
}
((PrecalculatedZone)zone).writeTo(out);
}
} | [
"public",
"void",
"writeTo",
"(",
"String",
"zoneID",
",",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"// pass false so zone id is not written out",
"DateTimeZone",
"zone",
"=",
"toDateTimeZone",
"(",
"zoneID",
",",
"false",
")",
";",
"if",
"(",
"zone... | Encodes a built DateTimeZone to the given stream. Call readFrom to
decode the data into a DateTimeZone object.
@param out the output stream to receive the encoded DateTimeZone
@since 1.5 (parameter added) | [
"Encodes",
"a",
"built",
"DateTimeZone",
"to",
"the",
"given",
"stream",
".",
"Call",
"readFrom",
"to",
"decode",
"the",
"data",
"into",
"a",
"DateTimeZone",
"object",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java#L464-L482 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java | HeadersImpl.addUniqueHeadLine | @Override
public void addUniqueHeadLine(final String type, final String aLine) {
ArrayList<String> lines = headers.get(type);
if (lines == null) {
lines = new ArrayList<>();
lines.add(aLine);
headers.put(type, lines);
} else if (!lines.contains(aLine)) {
lines.add(aLine);
}
} | java | @Override
public void addUniqueHeadLine(final String type, final String aLine) {
ArrayList<String> lines = headers.get(type);
if (lines == null) {
lines = new ArrayList<>();
lines.add(aLine);
headers.put(type, lines);
} else if (!lines.contains(aLine)) {
lines.add(aLine);
}
} | [
"@",
"Override",
"public",
"void",
"addUniqueHeadLine",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"aLine",
")",
"{",
"ArrayList",
"<",
"String",
">",
"lines",
"=",
"headers",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"lines",
"==",
"n... | Records a line for inclusion in the html/head, if it has not already been included.
@param type the type of line.
@param aLine the line to include. | [
"Records",
"a",
"line",
"for",
"inclusion",
"in",
"the",
"html",
"/",
"head",
"if",
"it",
"has",
"not",
"already",
"been",
"included",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java#L80-L91 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.hasPathAsItemId | public static boolean hasPathAsItemId(Container cnt, String path) {
return cnt.containsId(path) || cnt.containsId(CmsFileUtil.toggleTrailingSeparator(path));
} | java | public static boolean hasPathAsItemId(Container cnt, String path) {
return cnt.containsId(path) || cnt.containsId(CmsFileUtil.toggleTrailingSeparator(path));
} | [
"public",
"static",
"boolean",
"hasPathAsItemId",
"(",
"Container",
"cnt",
",",
"String",
"path",
")",
"{",
"return",
"cnt",
".",
"containsId",
"(",
"path",
")",
"||",
"cnt",
".",
"containsId",
"(",
"CmsFileUtil",
".",
"toggleTrailingSeparator",
"(",
"path",
... | Checks if path is itemid in container.<p>
@param cnt to be checked
@param path as itemid
@return true id path is itemid in container | [
"Checks",
"if",
"path",
"is",
"itemid",
"in",
"container",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L948-L951 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/util/ClassUtils.java | ClassUtils.findPossibleConstructor | @SuppressWarnings({"unchecked"})
public static <T> Constructor<T> findPossibleConstructor( Class<T> klass, Object... args ) throws NoSuchMethodException
{
for (Constructor constructor : klass.getConstructors())
{
if (arityMatches(constructor, args)) return constructor;
}
throw noSuitableConstructorException(klass, args);
} | java | @SuppressWarnings({"unchecked"})
public static <T> Constructor<T> findPossibleConstructor( Class<T> klass, Object... args ) throws NoSuchMethodException
{
for (Constructor constructor : klass.getConstructors())
{
if (arityMatches(constructor, args)) return constructor;
}
throw noSuitableConstructorException(klass, args);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"findPossibleConstructor",
"(",
"Class",
"<",
"T",
">",
"klass",
",",
"Object",
"...",
"args",
")",
"throws",
"NoSuchMethodExceptio... | <p>findPossibleConstructor.</p>
@param klass a {@link java.lang.Class} object.
@param args a {@link java.lang.Object} object.
@param <T> a T object.
@return a {@link java.lang.reflect.Constructor} object.
@throws java.lang.NoSuchMethodException if any. | [
"<p",
">",
"findPossibleConstructor",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/ClassUtils.java#L83-L92 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java | JsonWriter.marshallEnum | private void marshallEnum(Object value, EnumType enumType) throws IOException {
LOG.trace("Enum value: {} of type: {}", value, enumType);
jsonGenerator.writeString(value.toString());
} | java | private void marshallEnum(Object value, EnumType enumType) throws IOException {
LOG.trace("Enum value: {} of type: {}", value, enumType);
jsonGenerator.writeString(value.toString());
} | [
"private",
"void",
"marshallEnum",
"(",
"Object",
"value",
",",
"EnumType",
"enumType",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"trace",
"(",
"\"Enum value: {} of type: {}\"",
",",
"value",
",",
"enumType",
")",
";",
"jsonGenerator",
".",
"writeString",
"... | Marshall an enum value.
@param value The value to marshall. Can be {@code null}.
@param enumType The OData enum type. | [
"Marshall",
"an",
"enum",
"value",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java#L446-L449 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/core/Config.java | Config.get | public static Object get(ServletContext context, String name) {
return context.getAttribute(name + APPLICATION_SCOPE_SUFFIX);
} | java | public static Object get(ServletContext context, String name) {
return context.getAttribute(name + APPLICATION_SCOPE_SUFFIX);
} | [
"public",
"static",
"Object",
"get",
"(",
"ServletContext",
"context",
",",
"String",
"name",
")",
"{",
"return",
"context",
".",
"getAttribute",
"(",
"name",
"+",
"APPLICATION_SCOPE_SUFFIX",
")",
";",
"}"
] | Looks up a configuration variable in the "application" scope.
<p> The lookup of configuration variables is performed as if each scope
had its own name space, that is, the same configuration variable name
in one scope does not replace one stored in a different scope.
@param context Servlet context in which the configuration variable is
to be looked up
@param name Configuration variable name
@return The <tt>java.lang.Object</tt> associated with the configuration
variable, or null if it is not defined. | [
"Looks",
"up",
"a",
"configuration",
"variable",
"in",
"the",
"application",
"scope",
".",
"<p",
">",
"The",
"lookup",
"of",
"configuration",
"variables",
"is",
"performed",
"as",
"if",
"each",
"scope",
"had",
"its",
"own",
"name",
"space",
"that",
"is",
"... | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/core/Config.java#L165-L167 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java | ChartComputator.setCurrentViewport | public void setCurrentViewport(float left, float top, float right, float bottom) {
constrainViewport(left, top, right, bottom);
} | java | public void setCurrentViewport(float left, float top, float right, float bottom) {
constrainViewport(left, top, right, bottom);
} | [
"public",
"void",
"setCurrentViewport",
"(",
"float",
"left",
",",
"float",
"top",
",",
"float",
"right",
",",
"float",
"bottom",
")",
"{",
"constrainViewport",
"(",
"left",
",",
"top",
",",
"right",
",",
"bottom",
")",
";",
"}"
] | Set new values for curent viewport, that will change what part of chart is visible. Current viewport must be
equal or smaller than maximum viewport. | [
"Set",
"new",
"values",
"for",
"curent",
"viewport",
"that",
"will",
"change",
"what",
"part",
"of",
"chart",
"is",
"visible",
".",
"Current",
"viewport",
"must",
"be",
"equal",
"or",
"smaller",
"than",
"maximum",
"viewport",
"."
] | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java#L256-L258 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java | SocketBindingJBossASClient.addStandardSocketBinding | public void addStandardSocketBinding(String socketBindingName, String sysPropName, int port) throws Exception {
addSocketBinding(STANDARD_SOCKETS, socketBindingName, sysPropName, port);
} | java | public void addStandardSocketBinding(String socketBindingName, String sysPropName, int port) throws Exception {
addSocketBinding(STANDARD_SOCKETS, socketBindingName, sysPropName, port);
} | [
"public",
"void",
"addStandardSocketBinding",
"(",
"String",
"socketBindingName",
",",
"String",
"sysPropName",
",",
"int",
"port",
")",
"throws",
"Exception",
"{",
"addSocketBinding",
"(",
"STANDARD_SOCKETS",
",",
"socketBindingName",
",",
"sysPropName",
",",
"port",... | Adds a socket binding to the standard bindings group.
See {@link #addSocketBinding(String, String, String, int)} for parameter definitions.
If a socket binding with the given name already exists, this method does nothing.
@param socketBindingName the name of the socket binding to be created with the given port
@param sysPropName the name of the system property whose value is to be the port number
@param port the default port number if the sysPropName is not defined
@throws Exception any error | [
"Adds",
"a",
"socket",
"binding",
"to",
"the",
"standard",
"bindings",
"group",
".",
"See",
"{",
"@link",
"#addSocketBinding",
"(",
"String",
"String",
"String",
"int",
")",
"}",
"for",
"parameter",
"definitions",
".",
"If",
"a",
"socket",
"binding",
"with",... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L103-L105 |
ZuInnoTe/hadoopoffice | fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java | HadoopKeyStoreManager.setPassword | public void setPassword(String alias, String password, String passwordPassword) throws NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException {
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBE");
SecretKey pSecret = skf.generateSecret(new PBEKeySpec(password.toCharArray()));
KeyStore.PasswordProtection kspp = new KeyStore.PasswordProtection(passwordPassword.toCharArray());
this.keystore.setEntry(alias, new KeyStore.SecretKeyEntry(pSecret), kspp);
} | java | public void setPassword(String alias, String password, String passwordPassword) throws NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException {
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBE");
SecretKey pSecret = skf.generateSecret(new PBEKeySpec(password.toCharArray()));
KeyStore.PasswordProtection kspp = new KeyStore.PasswordProtection(passwordPassword.toCharArray());
this.keystore.setEntry(alias, new KeyStore.SecretKeyEntry(pSecret), kspp);
} | [
"public",
"void",
"setPassword",
"(",
"String",
"alias",
",",
"String",
"password",
",",
"String",
"passwordPassword",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
",",
"KeyStoreException",
"{",
"SecretKeyFactory",
"skf",
"=",
"SecretKeyFac... | Sets the password in the currently openend keystore. Do not forget to store it afterwards
@param alias
@param password to store
@param passwordPassword password for encrypting password. You can use the same as the keystore password
@throws NoSuchAlgorithmException
@throws InvalidKeySpecException
@throws KeyStoreException | [
"Sets",
"the",
"password",
"in",
"the",
"currently",
"openend",
"keystore",
".",
"Do",
"not",
"forget",
"to",
"store",
"it",
"afterwards"
] | train | https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java#L147-L152 |
GerdHolz/TOVAL | src/de/invation/code/toval/os/WindowsRegistry.java | WindowsRegistry.readValue | public static String readValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
return fromByteArray(invoke(Methods.REG_QUERY_VALUE_EX.get(), key.id, toByteArray(valueName)));
}
} | java | public static String readValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
return fromByteArray(invoke(Methods.REG_QUERY_VALUE_EX.get(), key.id, toByteArray(valueName)));
}
} | [
"public",
"static",
"String",
"readValue",
"(",
"String",
"keyName",
",",
"String",
"valueName",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_READ",
")",
")",
"{",
"return",
"fromByte... | Reads a string value from the given key and value name.
@param keyName Name of the key, which contains the value to read.
@param valueName Name of the value to read.
@return Content of the specified value.
@throws RegistryException | [
"Reads",
"a",
"string",
"value",
"from",
"the",
"given",
"key",
"and",
"value",
"name",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L249-L253 |
Blazebit/blaze-utils | blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java | ReflectionUtils.getGetter | public static Method getGetter(Class<?> clazz, String fieldName) {
StringBuilder sb = new StringBuilder("get").append(
Character.toUpperCase(fieldName.charAt(0))).append(fieldName,
1, fieldName.length());
final String internedGetName = sb.toString().intern();
final String internedIsName = sb.replace(0, 3, "is").toString().intern();
return traverseHierarchy(clazz, new TraverseTask<Method>() {
@Override
public Method run(Class<?> clazz) {
Method[] methods = clazz.getDeclaredMethods();
Method res = null;
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
if (isGetterSignature(m)) {
if (m.getName() == internedGetName
&& (res == null
|| res.getReturnType().isAssignableFrom(m.getReturnType()))) {
res = m;
}
if (m.getName() == internedIsName
&& (res == null
|| res.getReturnType().isAssignableFrom(m.getReturnType()))) {
res = m;
}
}
}
return res;
}
});
} | java | public static Method getGetter(Class<?> clazz, String fieldName) {
StringBuilder sb = new StringBuilder("get").append(
Character.toUpperCase(fieldName.charAt(0))).append(fieldName,
1, fieldName.length());
final String internedGetName = sb.toString().intern();
final String internedIsName = sb.replace(0, 3, "is").toString().intern();
return traverseHierarchy(clazz, new TraverseTask<Method>() {
@Override
public Method run(Class<?> clazz) {
Method[] methods = clazz.getDeclaredMethods();
Method res = null;
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
if (isGetterSignature(m)) {
if (m.getName() == internedGetName
&& (res == null
|| res.getReturnType().isAssignableFrom(m.getReturnType()))) {
res = m;
}
if (m.getName() == internedIsName
&& (res == null
|| res.getReturnType().isAssignableFrom(m.getReturnType()))) {
res = m;
}
}
}
return res;
}
});
} | [
"public",
"static",
"Method",
"getGetter",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"get\"",
")",
".",
"append",
"(",
"Character",
".",
"toUpperCase",
"(",
"field... | Retrieves the getter method of the given class for the specified field
name. The method first tries to find the getFieldName method of the class
and if it can not find that method it looks for the isFieldName method.
If this method also can not be found, null is returned.
<p>
This method uses #
{@link ReflectionUtils#getMethodReturnType(Class, String, Class...)} to
retrieve the getter.
<p>
A getter must not have any parameters and must have a return type that is
different from void.
@param clazz The class within to look for the getter method
@param fieldName The field name for which to find the getter method
@return The getter method for the given fieldName if it can be found,
otherwise null | [
"Retrieves",
"the",
"getter",
"method",
"of",
"the",
"given",
"class",
"for",
"the",
"specified",
"field",
"name",
".",
"The",
"method",
"first",
"tries",
"to",
"find",
"the",
"getFieldName",
"method",
"of",
"the",
"class",
"and",
"if",
"it",
"can",
"not",... | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L1014-L1046 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java | HttpAuthServiceBuilder.addOAuth2 | public HttpAuthServiceBuilder addOAuth2(Authorizer<? super OAuth2Token> authorizer, AsciiString header) {
return addTokenAuthorizer(new OAuth2TokenExtractor(requireNonNull(header, "header")),
requireNonNull(authorizer, "authorizer"));
} | java | public HttpAuthServiceBuilder addOAuth2(Authorizer<? super OAuth2Token> authorizer, AsciiString header) {
return addTokenAuthorizer(new OAuth2TokenExtractor(requireNonNull(header, "header")),
requireNonNull(authorizer, "authorizer"));
} | [
"public",
"HttpAuthServiceBuilder",
"addOAuth2",
"(",
"Authorizer",
"<",
"?",
"super",
"OAuth2Token",
">",
"authorizer",
",",
"AsciiString",
"header",
")",
"{",
"return",
"addTokenAuthorizer",
"(",
"new",
"OAuth2TokenExtractor",
"(",
"requireNonNull",
"(",
"header",
... | Adds an OAuth2 {@link Authorizer} for the given {@code header}. | [
"Adds",
"an",
"OAuth2",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java#L116-L119 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeByteObjDesc | public static Byte decodeByteObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int b = src[srcOffset];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
return decodeByteDesc(src, srcOffset + 1);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static Byte decodeByteObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int b = src[srcOffset];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
return decodeByteDesc(src, srcOffset + 1);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"Byte",
"decodeByteObjDesc",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"int",
"b",
"=",
"src",
"[",
"srcOffset",
"]",
";",
"if",
"(",
"b",
"==",
"NULL_BYTE_HIGH",
... | Decodes a signed Byte object from exactly 1 or 2 bytes, as encoded for
descending order. If null is returned, then 1 byte was read.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed Byte object or null | [
"Decodes",
"a",
"signed",
"Byte",
"object",
"from",
"exactly",
"1",
"or",
"2",
"bytes",
"as",
"encoded",
"for",
"descending",
"order",
".",
"If",
"null",
"is",
"returned",
"then",
"1",
"byte",
"was",
"read",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L134-L146 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/FleetsApi.java | FleetsApi.getFleetsFleetId | public FleetResponse getFleetsFleetId(Long fleetId, String datasource, String ifNoneMatch, String token)
throws ApiException {
ApiResponse<FleetResponse> resp = getFleetsFleetIdWithHttpInfo(fleetId, datasource, ifNoneMatch, token);
return resp.getData();
} | java | public FleetResponse getFleetsFleetId(Long fleetId, String datasource, String ifNoneMatch, String token)
throws ApiException {
ApiResponse<FleetResponse> resp = getFleetsFleetIdWithHttpInfo(fleetId, datasource, ifNoneMatch, token);
return resp.getData();
} | [
"public",
"FleetResponse",
"getFleetsFleetId",
"(",
"Long",
"fleetId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
",",
"String",
"token",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"FleetResponse",
">",
"resp",
"=",
"getFleetsFleetIdWith... | Get fleet information Return details about a fleet --- This route is
cached for up to 5 seconds SSO Scope: esi-fleets.read_fleet.v1
@param fleetId
ID for a fleet (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@param token
Access token to use if unable to set a header (optional)
@return FleetResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"fleet",
"information",
"Return",
"details",
"about",
"a",
"fleet",
"---",
"This",
"route",
"is",
"cached",
"for",
"up",
"to",
"5",
"seconds",
"SSO",
"Scope",
":",
"esi",
"-",
"fleets",
".",
"read_fleet",
".",
"v1"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L792-L796 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoaderUtil.java | MapKeyLoaderUtil.toBatches | static Iterator<Map<Integer, List<Data>>> toBatches(final Iterator<Entry<Integer, Data>> entries,
final int maxBatch) {
return new UnmodifiableIterator<Map<Integer, List<Data>>>() {
@Override
public boolean hasNext() {
return entries.hasNext();
}
@Override
public Map<Integer, List<Data>> next() {
if (!entries.hasNext()) {
throw new NoSuchElementException();
}
return nextBatch(entries, maxBatch);
}
};
} | java | static Iterator<Map<Integer, List<Data>>> toBatches(final Iterator<Entry<Integer, Data>> entries,
final int maxBatch) {
return new UnmodifiableIterator<Map<Integer, List<Data>>>() {
@Override
public boolean hasNext() {
return entries.hasNext();
}
@Override
public Map<Integer, List<Data>> next() {
if (!entries.hasNext()) {
throw new NoSuchElementException();
}
return nextBatch(entries, maxBatch);
}
};
} | [
"static",
"Iterator",
"<",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Data",
">",
">",
">",
"toBatches",
"(",
"final",
"Iterator",
"<",
"Entry",
"<",
"Integer",
",",
"Data",
">",
">",
"entries",
",",
"final",
"int",
"maxBatch",
")",
"{",
"return",
"ne... | Transforms an iterator of entries to an iterator of entry batches
where each batch is represented as a map from entry key to
list of entry values.
The maximum size of the entry value list in any batch is
determined by the {@code maxBatch} parameter. Only one
entry value list may have the {@code maxBatch} size, other
lists will be smaller.
@param entries the entries to be batched
@param maxBatch the maximum size of an entry group in a single batch
@return an iterator with entry batches | [
"Transforms",
"an",
"iterator",
"of",
"entries",
"to",
"an",
"iterator",
"of",
"entry",
"batches",
"where",
"each",
"batch",
"is",
"represented",
"as",
"a",
"map",
"from",
"entry",
"key",
"to",
"list",
"of",
"entry",
"values",
".",
"The",
"maximum",
"size"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoaderUtil.java#L89-L105 |
h2oai/h2o-3 | h2o-core/src/main/java/hex/Distribution.java | Distribution.initFNum | public double initFNum(double w, double o, double y) {
switch (distribution) {
case AUTO:
case gaussian:
case bernoulli:
case quasibinomial:
case multinomial:
return w*(y-o);
case poisson:
return w*y;
case gamma:
return w*y*linkInv(-o);
case tweedie:
return w*y*exp(o*(1- tweediePower));
case modified_huber:
return y==1 ? w : 0;
default:
throw H2O.unimpl();
}
} | java | public double initFNum(double w, double o, double y) {
switch (distribution) {
case AUTO:
case gaussian:
case bernoulli:
case quasibinomial:
case multinomial:
return w*(y-o);
case poisson:
return w*y;
case gamma:
return w*y*linkInv(-o);
case tweedie:
return w*y*exp(o*(1- tweediePower));
case modified_huber:
return y==1 ? w : 0;
default:
throw H2O.unimpl();
}
} | [
"public",
"double",
"initFNum",
"(",
"double",
"w",
",",
"double",
"o",
",",
"double",
"y",
")",
"{",
"switch",
"(",
"distribution",
")",
"{",
"case",
"AUTO",
":",
"case",
"gaussian",
":",
"case",
"bernoulli",
":",
"case",
"quasibinomial",
":",
"case",
... | Contribution to numerator for initial value computation
@param w weight
@param o offset
@param y response
@return weighted contribution to numerator | [
"Contribution",
"to",
"numerator",
"for",
"initial",
"value",
"computation"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/Distribution.java#L204-L223 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.addFile | private static void addFile(InputStream in, String path, ZipOutputStream out) throws UtilException {
if (null == in) {
return;
}
try {
out.putNextEntry(new ZipEntry(path));
IoUtil.copy(in, out);
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | java | private static void addFile(InputStream in, String path, ZipOutputStream out) throws UtilException {
if (null == in) {
return;
}
try {
out.putNextEntry(new ZipEntry(path));
IoUtil.copy(in, out);
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | [
"private",
"static",
"void",
"addFile",
"(",
"InputStream",
"in",
",",
"String",
"path",
",",
"ZipOutputStream",
"out",
")",
"throws",
"UtilException",
"{",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"return",
";",
"}",
"try",
"{",
"out",
".",
"putNextEntr... | 添加文件流到压缩包,不关闭输入流
@param in 需要压缩的输入流
@param path 压缩的路径
@param out 压缩文件存储对象
@throws UtilException IO异常 | [
"添加文件流到压缩包,不关闭输入流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L820-L832 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java | WatchServiceImpl.addForeignWatch | public void addForeignWatch(TableKraken table, byte []key, String serverId)
{
WatchForeign watch = new WatchForeign(key, table, serverId);
WatchTable watchTable = getWatchTable(table);
watchTable.addWatchForeign(watch, key);
} | java | public void addForeignWatch(TableKraken table, byte []key, String serverId)
{
WatchForeign watch = new WatchForeign(key, table, serverId);
WatchTable watchTable = getWatchTable(table);
watchTable.addWatchForeign(watch, key);
} | [
"public",
"void",
"addForeignWatch",
"(",
"TableKraken",
"table",
",",
"byte",
"[",
"]",
"key",
",",
"String",
"serverId",
")",
"{",
"WatchForeign",
"watch",
"=",
"new",
"WatchForeign",
"(",
"key",
",",
"table",
",",
"serverId",
")",
";",
"WatchTable",
"wa... | Adds a watch from a foreign server. Remote notifications will send a copy
to the foreign server. | [
"Adds",
"a",
"watch",
"from",
"a",
"foreign",
"server",
".",
"Remote",
"notifications",
"will",
"send",
"a",
"copy",
"to",
"the",
"foreign",
"server",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java#L197-L204 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java | Util.generateCacheFileFullPath | public static String generateCacheFileFullPath(String url, File cacheDir) {
String fileName = md5(url);
File cacheFile = new File(cacheDir, fileName);
return cacheFile.getPath();
} | java | public static String generateCacheFileFullPath(String url, File cacheDir) {
String fileName = md5(url);
File cacheFile = new File(cacheDir, fileName);
return cacheFile.getPath();
} | [
"public",
"static",
"String",
"generateCacheFileFullPath",
"(",
"String",
"url",
",",
"File",
"cacheDir",
")",
"{",
"String",
"fileName",
"=",
"md5",
"(",
"url",
")",
";",
"File",
"cacheFile",
"=",
"new",
"File",
"(",
"cacheDir",
",",
"fileName",
")",
";",... | /*
Generate cached file name use md5 from image originalPath and image created time | [
"/",
"*",
"Generate",
"cached",
"file",
"name",
"use",
"md5",
"from",
"image",
"originalPath",
"and",
"image",
"created",
"time"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L590-L594 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public <V extends ViewGroup> void setTypeface(V viewGroup, String typefaceName, int style) {
int count = viewGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = viewGroup.getChildAt(i);
if (child instanceof ViewGroup) {
setTypeface((ViewGroup) child, typefaceName, style);
continue;
}
if (!(child instanceof TextView)) {
continue;
}
setTypeface((TextView) child, typefaceName, style);
}
} | java | public <V extends ViewGroup> void setTypeface(V viewGroup, String typefaceName, int style) {
int count = viewGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = viewGroup.getChildAt(i);
if (child instanceof ViewGroup) {
setTypeface((ViewGroup) child, typefaceName, style);
continue;
}
if (!(child instanceof TextView)) {
continue;
}
setTypeface((TextView) child, typefaceName, style);
}
} | [
"public",
"<",
"V",
"extends",
"ViewGroup",
">",
"void",
"setTypeface",
"(",
"V",
"viewGroup",
",",
"String",
"typefaceName",
",",
"int",
"style",
")",
"{",
"int",
"count",
"=",
"viewGroup",
".",
"getChildCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
... | Set the typeface to the all text views belong to the view group.
Note that this method recursively trace the child view groups and set typeface for the text views.
@param viewGroup the view group that contains text views.
@param typefaceName typeface name.
@param style the typeface style.
@param <V> view group parameter. | [
"Set",
"the",
"typeface",
"to",
"the",
"all",
"text",
"views",
"belong",
"to",
"the",
"view",
"group",
".",
"Note",
"that",
"this",
"method",
"recursively",
"trace",
"the",
"child",
"view",
"groups",
"and",
"set",
"typeface",
"for",
"the",
"text",
"views",... | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L163-L176 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginUpdateInstances | public OperationStatusResponseInner beginUpdateInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body();
} | java | public OperationStatusResponseInner beginUpdateInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body();
} | [
"public",
"OperationStatusResponseInner",
"beginUpdateInstances",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"List",
"<",
"String",
">",
"instanceIds",
")",
"{",
"return",
"beginUpdateInstancesWithServiceResponseAsync",
"(",
"resourceGroupName",... | Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceIds The virtual machine scale set instance ids.
@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 OperationStatusResponseInner object if successful. | [
"Upgrades",
"one",
"or",
"more",
"virtual",
"machines",
"to",
"the",
"latest",
"SKU",
"set",
"in",
"the",
"VM",
"scale",
"set",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L2793-L2795 |
phax/ph-commons | ph-json/src/main/java/com/helger/json/serialize/JsonReader.java | JsonReader.readFromFile | @Nullable
public static IJson readFromFile (@Nonnull final File aFile, @Nonnull final Charset aFallbackCharset)
{
return readFromFile (aFile, aFallbackCharset, null);
} | java | @Nullable
public static IJson readFromFile (@Nonnull final File aFile, @Nonnull final Charset aFallbackCharset)
{
return readFromFile (aFile, aFallbackCharset, null);
} | [
"@",
"Nullable",
"public",
"static",
"IJson",
"readFromFile",
"(",
"@",
"Nonnull",
"final",
"File",
"aFile",
",",
"@",
"Nonnull",
"final",
"Charset",
"aFallbackCharset",
")",
"{",
"return",
"readFromFile",
"(",
"aFile",
",",
"aFallbackCharset",
",",
"null",
")... | Read the Json from the passed File.
@param aFile
The file containing the Json to be parsed. May not be
<code>null</code>.
@param aFallbackCharset
The charset to be used in case no is BOM is present. May not be
<code>null</code>.
@return <code>null</code> if reading failed, the Json declarations
otherwise. | [
"Read",
"the",
"Json",
"from",
"the",
"passed",
"File",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L487-L491 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java | WikiUser.getUser | public static WikiUser getUser(String wikiId, String siteurl) {
WikiUser result = null;
try {
Properties props = getProperties(wikiId);
result = new WikiUser();
result.setUsername(props.getProperty("user"));
result.setEmail(props.getProperty("email"));
Crypt pcf = new Crypt(props.getProperty("cypher"),
props.getProperty("salt"));
result.setPassword(pcf.decrypt(props.getProperty("secret")));
} catch (FileNotFoundException e) {
String msg = help(wikiId, siteurl);
LOGGER.log(Level.SEVERE, msg);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e.getMessage());
} catch (GeneralSecurityException e) {
LOGGER.log(Level.SEVERE, e.getMessage());
}
return result;
} | java | public static WikiUser getUser(String wikiId, String siteurl) {
WikiUser result = null;
try {
Properties props = getProperties(wikiId);
result = new WikiUser();
result.setUsername(props.getProperty("user"));
result.setEmail(props.getProperty("email"));
Crypt pcf = new Crypt(props.getProperty("cypher"),
props.getProperty("salt"));
result.setPassword(pcf.decrypt(props.getProperty("secret")));
} catch (FileNotFoundException e) {
String msg = help(wikiId, siteurl);
LOGGER.log(Level.SEVERE, msg);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e.getMessage());
} catch (GeneralSecurityException e) {
LOGGER.log(Level.SEVERE, e.getMessage());
}
return result;
} | [
"public",
"static",
"WikiUser",
"getUser",
"(",
"String",
"wikiId",
",",
"String",
"siteurl",
")",
"{",
"WikiUser",
"result",
"=",
"null",
";",
"try",
"{",
"Properties",
"props",
"=",
"getProperties",
"(",
"wikiId",
")",
";",
"result",
"=",
"new",
"WikiUse... | get the Wiki user for the given wikiid
@param wikiId
- the id of the wiki
@param siteurl
- the siteurl
@return a Wikiuser for this site | [
"get",
"the",
"Wiki",
"user",
"for",
"the",
"given",
"wikiid"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L134-L154 |
undertow-io/undertow | core/src/main/java/io/undertow/server/protocol/framed/AbstractFramedStreamSinkChannel.java | AbstractFramedStreamSinkChannel.getFrameHeader | final SendFrameHeader getFrameHeader() throws IOException {
if (header == null) {
header = createFrameHeader();
if (header == null) {
header = new SendFrameHeader(0, null);
}
}
return header;
} | java | final SendFrameHeader getFrameHeader() throws IOException {
if (header == null) {
header = createFrameHeader();
if (header == null) {
header = new SendFrameHeader(0, null);
}
}
return header;
} | [
"final",
"SendFrameHeader",
"getFrameHeader",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"header",
"=",
"createFrameHeader",
"(",
")",
";",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"header",
"=",
"new",
"Send... | Returns the header for the current frame.
This consists of the frame data, and also an integer specifying how much data is remaining in the buffer.
If this is non-zero then this method must adjust the buffers limit accordingly.
It is expected that this will be used when limits on the size of a data frame prevent the whole buffer from
being sent at once.
@return The header for the current frame, or null | [
"Returns",
"the",
"header",
"for",
"the",
"current",
"frame",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/protocol/framed/AbstractFramedStreamSinkChannel.java#L143-L151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.