repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toFile | public static File toFile(Object obj, File defaultValue) {
if (obj instanceof File) return (File) obj;
String str = Caster.toString(obj, null);
if (str == null) return defaultValue;
return FileUtil.toFile(str);
} | java | public static File toFile(Object obj, File defaultValue) {
if (obj instanceof File) return (File) obj;
String str = Caster.toString(obj, null);
if (str == null) return defaultValue;
return FileUtil.toFile(str);
} | [
"public",
"static",
"File",
"toFile",
"(",
"Object",
"obj",
",",
"File",
"defaultValue",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"File",
")",
"return",
"(",
"File",
")",
"obj",
";",
"String",
"str",
"=",
"Caster",
".",
"toString",
"(",
"obj",
",",
... | convert a object to a File
@param obj
@param defaultValue
@return File | [
"convert",
"a",
"object",
"to",
"a",
"File"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4171-L4176 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java | UCharacterName.setGroup | boolean setGroup(char group[], byte groupstring[])
{
if (group != null && groupstring != null && group.length > 0 &&
groupstring.length > 0) {
m_groupinfo_ = group;
m_groupstring_ = groupstring;
return true;
}
return false;
} | java | boolean setGroup(char group[], byte groupstring[])
{
if (group != null && groupstring != null && group.length > 0 &&
groupstring.length > 0) {
m_groupinfo_ = group;
m_groupstring_ = groupstring;
return true;
}
return false;
} | [
"boolean",
"setGroup",
"(",
"char",
"group",
"[",
"]",
",",
"byte",
"groupstring",
"[",
"]",
")",
"{",
"if",
"(",
"group",
"!=",
"null",
"&&",
"groupstring",
"!=",
"null",
"&&",
"group",
".",
"length",
">",
"0",
"&&",
"groupstring",
".",
"length",
">... | Sets the group name data
@param group index information array
@param groupstring name information array
@return false if there is a data error | [
"Sets",
"the",
"group",
"name",
"data"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L1012-L1021 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/ColumnMajorSparseMatrix.java | ColumnMajorSparseMatrix.randomSymmetric | public static ColumnMajorSparseMatrix randomSymmetric(int size, double density, Random random) {
return CCSMatrix.randomSymmetric(size, density, random);
} | java | public static ColumnMajorSparseMatrix randomSymmetric(int size, double density, Random random) {
return CCSMatrix.randomSymmetric(size, density, random);
} | [
"public",
"static",
"ColumnMajorSparseMatrix",
"randomSymmetric",
"(",
"int",
"size",
",",
"double",
"density",
",",
"Random",
"random",
")",
"{",
"return",
"CCSMatrix",
".",
"randomSymmetric",
"(",
"size",
",",
"density",
",",
"random",
")",
";",
"}"
] | Creates a random symmetric {@link ColumnMajorSparseMatrix} of the given {@code size}. | [
"Creates",
"a",
"random",
"symmetric",
"{"
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/ColumnMajorSparseMatrix.java#L91-L93 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java | ConnectionFactoryDBCPImpl.wrapAsDataSource | protected DataSource wrapAsDataSource(JdbcConnectionDescriptor jcd,
ObjectPool connectionPool)
{
final boolean allowConnectionUnwrap;
if (jcd == null)
{
allowConnectionUnwrap = false;
}
else
{
final Properties properties = jcd.getConnectionPoolDescriptor().getDbcpProperties();
final String allowConnectionUnwrapParam;
allowConnectionUnwrapParam = properties.getProperty(PARAM_NAME_UNWRAP_ALLOWED);
allowConnectionUnwrap = allowConnectionUnwrapParam != null &&
Boolean.valueOf(allowConnectionUnwrapParam).booleanValue();
}
final PoolingDataSource dataSource;
dataSource = new PoolingDataSource(connectionPool);
dataSource.setAccessToUnderlyingConnectionAllowed(allowConnectionUnwrap);
if(jcd != null)
{
final AbandonedConfig ac = jcd.getConnectionPoolDescriptor().getAbandonedConfig();
if (ac.getRemoveAbandoned() && ac.getLogAbandoned()) {
final LoggerWrapperPrintWriter loggerPiggyBack;
loggerPiggyBack = new LoggerWrapperPrintWriter(log, Logger.ERROR);
dataSource.setLogWriter(loggerPiggyBack);
}
}
return dataSource;
} | java | protected DataSource wrapAsDataSource(JdbcConnectionDescriptor jcd,
ObjectPool connectionPool)
{
final boolean allowConnectionUnwrap;
if (jcd == null)
{
allowConnectionUnwrap = false;
}
else
{
final Properties properties = jcd.getConnectionPoolDescriptor().getDbcpProperties();
final String allowConnectionUnwrapParam;
allowConnectionUnwrapParam = properties.getProperty(PARAM_NAME_UNWRAP_ALLOWED);
allowConnectionUnwrap = allowConnectionUnwrapParam != null &&
Boolean.valueOf(allowConnectionUnwrapParam).booleanValue();
}
final PoolingDataSource dataSource;
dataSource = new PoolingDataSource(connectionPool);
dataSource.setAccessToUnderlyingConnectionAllowed(allowConnectionUnwrap);
if(jcd != null)
{
final AbandonedConfig ac = jcd.getConnectionPoolDescriptor().getAbandonedConfig();
if (ac.getRemoveAbandoned() && ac.getLogAbandoned()) {
final LoggerWrapperPrintWriter loggerPiggyBack;
loggerPiggyBack = new LoggerWrapperPrintWriter(log, Logger.ERROR);
dataSource.setLogWriter(loggerPiggyBack);
}
}
return dataSource;
} | [
"protected",
"DataSource",
"wrapAsDataSource",
"(",
"JdbcConnectionDescriptor",
"jcd",
",",
"ObjectPool",
"connectionPool",
")",
"{",
"final",
"boolean",
"allowConnectionUnwrap",
";",
"if",
"(",
"jcd",
"==",
"null",
")",
"{",
"allowConnectionUnwrap",
"=",
"false",
"... | Wraps the specified object pool for connections as a DataSource.
@param jcd the OJB connection descriptor for the pool to be wrapped
@param connectionPool the connection pool to be wrapped
@return a DataSource attached to the connection pool.
Connections will be wrapped using DBCP PoolGuard, that will not allow
unwrapping unless the "accessToUnderlyingConnectionAllowed=true" configuration
is specified. | [
"Wraps",
"the",
"specified",
"object",
"pool",
"for",
"connections",
"as",
"a",
"DataSource",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java#L306-L336 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java | MetadataFinder.attachMetadataCacheInternal | void attachMetadataCacheInternal(SlotReference slot, MetadataCache cache) {
MetadataCache oldCache = metadataCacheFiles.put(slot, cache);
if (oldCache != null) {
try {
oldCache.close();
} catch (IOException e) {
logger.error("Problem closing previous metadata cache", e);
}
}
deliverCacheUpdate(slot, cache);
} | java | void attachMetadataCacheInternal(SlotReference slot, MetadataCache cache) {
MetadataCache oldCache = metadataCacheFiles.put(slot, cache);
if (oldCache != null) {
try {
oldCache.close();
} catch (IOException e) {
logger.error("Problem closing previous metadata cache", e);
}
}
deliverCacheUpdate(slot, cache);
} | [
"void",
"attachMetadataCacheInternal",
"(",
"SlotReference",
"slot",
",",
"MetadataCache",
"cache",
")",
"{",
"MetadataCache",
"oldCache",
"=",
"metadataCacheFiles",
".",
"put",
"(",
"slot",
",",
"cache",
")",
";",
"if",
"(",
"oldCache",
"!=",
"null",
")",
"{"... | Finishes the process of attaching a metadata cache file once it has been opened and validated.
@param slot the slot to which the cache should be attached
@param cache the opened, validated metadata cache file | [
"Finishes",
"the",
"process",
"of",
"attaching",
"a",
"metadata",
"cache",
"file",
"once",
"it",
"has",
"been",
"opened",
"and",
"validated",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L571-L582 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/fingerprint/FingerprinterTool.java | FingerprinterTool.makeBitFingerprint | public static IBitFingerprint makeBitFingerprint(final Map<String,Integer> features, int len) {
return makeBitFingerprint(features, len, 1);
} | java | public static IBitFingerprint makeBitFingerprint(final Map<String,Integer> features, int len) {
return makeBitFingerprint(features, len, 1);
} | [
"public",
"static",
"IBitFingerprint",
"makeBitFingerprint",
"(",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"features",
",",
"int",
"len",
")",
"{",
"return",
"makeBitFingerprint",
"(",
"features",
",",
"len",
",",
"1",
")",
";",
"}"
] | Convert a mapping of features and their counts to a binary fingerprint. A single bit is
set for each pattern.
@param features features to include
@param len fingerprint length
@return the continuous fingerprint
@see #makeBitFingerprint(java.util.Map, int, int) | [
"Convert",
"a",
"mapping",
"of",
"features",
"and",
"their",
"counts",
"to",
"a",
"binary",
"fingerprint",
".",
"A",
"single",
"bit",
"is",
"set",
"for",
"each",
"pattern",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/fingerprint/FingerprinterTool.java#L144-L146 |
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library | src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java | LolChat.getFriend | public Friend getFriend(Filter<Friend> filter) {
for (final RosterEntry e : connection.getRoster().getEntries()) {
final Friend f = new Friend(this, connection, e);
if (filter.accept(f)) {
return f;
}
}
return null;
} | java | public Friend getFriend(Filter<Friend> filter) {
for (final RosterEntry e : connection.getRoster().getEntries()) {
final Friend f = new Friend(this, connection, e);
if (filter.accept(f)) {
return f;
}
}
return null;
} | [
"public",
"Friend",
"getFriend",
"(",
"Filter",
"<",
"Friend",
">",
"filter",
")",
"{",
"for",
"(",
"final",
"RosterEntry",
"e",
":",
"connection",
".",
"getRoster",
"(",
")",
".",
"getEntries",
"(",
")",
")",
"{",
"final",
"Friend",
"f",
"=",
"new",
... | Gets a friend based on a given filter.
@param filter
The filter defines conditions that your Friend must meet.
@return The first Friend that meets the conditions or null if not found. | [
"Gets",
"a",
"friend",
"based",
"on",
"a",
"given",
"filter",
"."
] | train | https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java#L439-L447 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings_service_binding.java | lbmonbindings_service_binding.count_filtered | public static long count_filtered(nitro_service service, String monitorname, String filter) throws Exception{
lbmonbindings_service_binding obj = new lbmonbindings_service_binding();
obj.set_monitorname(monitorname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
lbmonbindings_service_binding[] response = (lbmonbindings_service_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String monitorname, String filter) throws Exception{
lbmonbindings_service_binding obj = new lbmonbindings_service_binding();
obj.set_monitorname(monitorname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
lbmonbindings_service_binding[] response = (lbmonbindings_service_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"monitorname",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"lbmonbindings_service_binding",
"obj",
"=",
"new",
"lbmonbindings_service_binding",
"(",
")",
";",
... | Use this API to count the filtered set of lbmonbindings_service_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"lbmonbindings_service_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings_service_binding.java#L214-L225 |
Triple-T/simpleprovider | simpleprovider/src/main/java/de/triplet/simpleprovider/SelectionBuilder.java | SelectionBuilder.where | public SelectionBuilder where(String selection, String... selectionArgs) {
if (TextUtils.isEmpty(selection)) {
if (selectionArgs != null && selectionArgs.length > 0) {
throw new IllegalArgumentException(
"Valid selection required when including arguments=");
}
// Shortcut when clause is empty
return this;
}
if (mSelection.length() > 0) {
mSelection.append(" AND ");
}
mSelection.append("(").append(selection).append(")");
if (selectionArgs != null) {
Collections.addAll(mSelectionArgs, selectionArgs);
}
return this;
} | java | public SelectionBuilder where(String selection, String... selectionArgs) {
if (TextUtils.isEmpty(selection)) {
if (selectionArgs != null && selectionArgs.length > 0) {
throw new IllegalArgumentException(
"Valid selection required when including arguments=");
}
// Shortcut when clause is empty
return this;
}
if (mSelection.length() > 0) {
mSelection.append(" AND ");
}
mSelection.append("(").append(selection).append(")");
if (selectionArgs != null) {
Collections.addAll(mSelectionArgs, selectionArgs);
}
return this;
} | [
"public",
"SelectionBuilder",
"where",
"(",
"String",
"selection",
",",
"String",
"...",
"selectionArgs",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"selection",
")",
")",
"{",
"if",
"(",
"selectionArgs",
"!=",
"null",
"&&",
"selectionArgs",
".",... | Append the given selection clause to the internal state. Each clause is
surrounded with parenthesis and combined using {@code AND}. | [
"Append",
"the",
"given",
"selection",
"clause",
"to",
"the",
"internal",
"state",
".",
"Each",
"clause",
"is",
"surrounded",
"with",
"parenthesis",
"and",
"combined",
"using",
"{"
] | train | https://github.com/Triple-T/simpleprovider/blob/c6d957ceca2e5c97dbd5092327aa90899a64a6ec/simpleprovider/src/main/java/de/triplet/simpleprovider/SelectionBuilder.java#L67-L88 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putTicketGrantingTicketInScopes | public static void putTicketGrantingTicketInScopes(final RequestContext context, final String ticketValue) {
putTicketGrantingTicketIntoMap(context.getRequestScope(), ticketValue);
putTicketGrantingTicketIntoMap(context.getFlowScope(), ticketValue);
var session = context.getFlowExecutionContext().getActiveSession().getParent();
while (session != null) {
putTicketGrantingTicketIntoMap(session.getScope(), ticketValue);
session = session.getParent();
}
} | java | public static void putTicketGrantingTicketInScopes(final RequestContext context, final String ticketValue) {
putTicketGrantingTicketIntoMap(context.getRequestScope(), ticketValue);
putTicketGrantingTicketIntoMap(context.getFlowScope(), ticketValue);
var session = context.getFlowExecutionContext().getActiveSession().getParent();
while (session != null) {
putTicketGrantingTicketIntoMap(session.getScope(), ticketValue);
session = session.getParent();
}
} | [
"public",
"static",
"void",
"putTicketGrantingTicketInScopes",
"(",
"final",
"RequestContext",
"context",
",",
"final",
"String",
"ticketValue",
")",
"{",
"putTicketGrantingTicketIntoMap",
"(",
"context",
".",
"getRequestScope",
"(",
")",
",",
"ticketValue",
")",
";",... | Put ticket granting ticket in request and flow scopes.
@param context the context
@param ticketValue the ticket value | [
"Put",
"ticket",
"granting",
"ticket",
"in",
"request",
"and",
"flow",
"scopes",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L179-L188 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrIndex.java | CmsSolrIndex.gallerySearch | public CmsGallerySearchResultList gallerySearch(CmsObject cms, CmsGallerySearchParameters params) {
CmsGallerySearchResultList resultList = new CmsGallerySearchResultList();
try {
CmsSolrResultList list = search(
cms,
params.getQuery(cms),
false,
null,
true,
CmsResourceFilter.ONLY_VISIBLE_NO_DELETED,
MAX_RESULTS_GALLERY); // ignore the maximally searched number of contents.
if (null == list) {
return null;
}
resultList.setHitCount(Long.valueOf(list.getNumFound()).intValue());
for (CmsSearchResource resource : list) {
I_CmsSearchDocument document = resource.getDocument();
Locale locale = CmsLocaleManager.getLocale(params.getLocale());
CmsGallerySearchResult result = new CmsGallerySearchResult(
document,
cms,
(int)document.getScore(),
locale);
resultList.add(result);
}
} catch (CmsSearchException e) {
LOG.error(e.getMessage(), e);
}
return resultList;
} | java | public CmsGallerySearchResultList gallerySearch(CmsObject cms, CmsGallerySearchParameters params) {
CmsGallerySearchResultList resultList = new CmsGallerySearchResultList();
try {
CmsSolrResultList list = search(
cms,
params.getQuery(cms),
false,
null,
true,
CmsResourceFilter.ONLY_VISIBLE_NO_DELETED,
MAX_RESULTS_GALLERY); // ignore the maximally searched number of contents.
if (null == list) {
return null;
}
resultList.setHitCount(Long.valueOf(list.getNumFound()).intValue());
for (CmsSearchResource resource : list) {
I_CmsSearchDocument document = resource.getDocument();
Locale locale = CmsLocaleManager.getLocale(params.getLocale());
CmsGallerySearchResult result = new CmsGallerySearchResult(
document,
cms,
(int)document.getScore(),
locale);
resultList.add(result);
}
} catch (CmsSearchException e) {
LOG.error(e.getMessage(), e);
}
return resultList;
} | [
"public",
"CmsGallerySearchResultList",
"gallerySearch",
"(",
"CmsObject",
"cms",
",",
"CmsGallerySearchParameters",
"params",
")",
"{",
"CmsGallerySearchResultList",
"resultList",
"=",
"new",
"CmsGallerySearchResultList",
"(",
")",
";",
"try",
"{",
"CmsSolrResultList",
"... | Performs a search with according to the gallery search parameters.<p>
@param cms the cms context
@param params the search parameters
@return the search result | [
"Performs",
"a",
"search",
"with",
"according",
"to",
"the",
"gallery",
"search",
"parameters",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L457-L492 |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionException.java | SessionException.fromThrowable | public static SessionException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionException && Objects.equals(message, cause.getMessage()))
? (SessionException) cause
: new SessionException(message, cause);
} | java | public static SessionException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionException && Objects.equals(message, cause.getMessage()))
? (SessionException) cause
: new SessionException(message, cause);
} | [
"public",
"static",
"SessionException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"("... | Converts a Throwable to a SessionException with the specified detail message. If the
Throwable is a SessionException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionException.java#L65-L69 |
elki-project/elki | addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java | XSplitter.getRatioOfDataInIntersectionVolume | public double getRatioOfDataInIntersectionVolume(List<SpatialEntry>[] split, HyperBoundingBox[] mbrs) {
final ModifiableHyperBoundingBox xMBR = SpatialUtil.intersection(mbrs[0], mbrs[1]);
if(xMBR == null) {
return 0.;
}
// Total number of entries, intersecting entries
int[] numOf = { 0, 0 };
countXingDataEntries(split[0], xMBR, numOf);
countXingDataEntries(split[1], xMBR, numOf);
return numOf[1] / (double) numOf[0];
} | java | public double getRatioOfDataInIntersectionVolume(List<SpatialEntry>[] split, HyperBoundingBox[] mbrs) {
final ModifiableHyperBoundingBox xMBR = SpatialUtil.intersection(mbrs[0], mbrs[1]);
if(xMBR == null) {
return 0.;
}
// Total number of entries, intersecting entries
int[] numOf = { 0, 0 };
countXingDataEntries(split[0], xMBR, numOf);
countXingDataEntries(split[1], xMBR, numOf);
return numOf[1] / (double) numOf[0];
} | [
"public",
"double",
"getRatioOfDataInIntersectionVolume",
"(",
"List",
"<",
"SpatialEntry",
">",
"[",
"]",
"split",
",",
"HyperBoundingBox",
"[",
"]",
"mbrs",
")",
"{",
"final",
"ModifiableHyperBoundingBox",
"xMBR",
"=",
"SpatialUtil",
".",
"intersection",
"(",
"m... | Get the ratio of data objects in the intersection volume (weighted
overlap).
@param split two entry lists representing the given split
@param mbrs the MBRs for the given split
@return the ration of data objects in the intersection volume as value
between 0 and 1 | [
"Get",
"the",
"ratio",
"of",
"data",
"objects",
"in",
"the",
"intersection",
"volume",
"(",
"weighted",
"overlap",
")",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L742-L753 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.addEntries | public Jar addEntries(Path path, Path dirOrZip, Filter filter) throws IOException {
if (Files.isDirectory(dirOrZip))
addDir(path, dirOrZip, filter, true);
else {
try (JarInputStream jis1 = newJarInputStream(Files.newInputStream(dirOrZip))) {
addEntries(path, jis1, filter);
}
}
return this;
} | java | public Jar addEntries(Path path, Path dirOrZip, Filter filter) throws IOException {
if (Files.isDirectory(dirOrZip))
addDir(path, dirOrZip, filter, true);
else {
try (JarInputStream jis1 = newJarInputStream(Files.newInputStream(dirOrZip))) {
addEntries(path, jis1, filter);
}
}
return this;
} | [
"public",
"Jar",
"addEntries",
"(",
"Path",
"path",
",",
"Path",
"dirOrZip",
",",
"Filter",
"filter",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"isDirectory",
"(",
"dirOrZip",
")",
")",
"addDir",
"(",
"path",
",",
"dirOrZip",
",",
"filt... | Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR.
@param path the path within the JAR where the root of the directory will be placed, or {@code null} for the JAR's root
@param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries
@param filter a filter to select particular classes
@return {@code this} | [
"Adds",
"a",
"directory",
"(",
"with",
"all",
"its",
"subdirectories",
")",
"or",
"the",
"contents",
"of",
"a",
"zip",
"/",
"JAR",
"to",
"this",
"JAR",
"."
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L392-L401 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java | JMElasticsearchIndex.sendData | public String sendData(Map<String, ?> source, String index,
String type) {
return sendData(source, index, type, null).getId();
} | java | public String sendData(Map<String, ?> source, String index,
String type) {
return sendData(source, index, type, null).getId();
} | [
"public",
"String",
"sendData",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"source",
",",
"String",
"index",
",",
"String",
"type",
")",
"{",
"return",
"sendData",
"(",
"source",
",",
"index",
",",
"type",
",",
"null",
")",
".",
"getId",
"(",
")",
"... | Send data string.
@param source the source
@param index the index
@param type the type
@return the string | [
"Send",
"data",
"string",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L221-L224 |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/PortletDescriptorImpl.java | PortletDescriptorImpl.addNamespace | public PortletDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | java | public PortletDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | [
"public",
"PortletDescriptor",
"addNamespace",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"model",
".",
"attribute",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new namespace
@return the current instance of <code>PortletDescriptor</code> | [
"Adds",
"a",
"new",
"namespace"
] | train | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/PortletDescriptorImpl.java#L93-L97 |
TomasMikula/EasyBind | src/main/java/org/fxmisc/easybind/EasyBind.java | EasyBind.includeWhen | public static <T> Subscription includeWhen(
Collection<T> collection,
T element,
ObservableValue<Boolean> condition) {
return subscribe(condition, new Consumer<Boolean>() {
private boolean included = false;
@Override
public void accept(Boolean value) {
if(value && !included) {
included = collection.add(element);
} else if(!value && included) {
collection.remove(element);
included = false;
}
}
});
} | java | public static <T> Subscription includeWhen(
Collection<T> collection,
T element,
ObservableValue<Boolean> condition) {
return subscribe(condition, new Consumer<Boolean>() {
private boolean included = false;
@Override
public void accept(Boolean value) {
if(value && !included) {
included = collection.add(element);
} else if(!value && included) {
collection.remove(element);
included = false;
}
}
});
} | [
"public",
"static",
"<",
"T",
">",
"Subscription",
"includeWhen",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"T",
"element",
",",
"ObservableValue",
"<",
"Boolean",
">",
"condition",
")",
"{",
"return",
"subscribe",
"(",
"condition",
",",
"new",
... | Adds {@code element} to {@code collection} when {@code condition} is
{@code true} and removes it from {@code collection} when
{@code condition} is {@code false}.
@return a subscription that can be used to stop observing
{@code condition} and manipulating {@code collection}. | [
"Adds",
"{"
] | train | https://github.com/TomasMikula/EasyBind/blob/516947dec9de4977d8a817b7d1dfd320cc644298/src/main/java/org/fxmisc/easybind/EasyBind.java#L272-L289 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java | StructureTools.getAtomsInContact | public static AtomContactSet getAtomsInContact(Chain chain1, Chain chain2,
double cutoff, boolean hetAtoms) {
return getAtomsInContact(chain1, chain2, null, cutoff, hetAtoms);
} | java | public static AtomContactSet getAtomsInContact(Chain chain1, Chain chain2,
double cutoff, boolean hetAtoms) {
return getAtomsInContact(chain1, chain2, null, cutoff, hetAtoms);
} | [
"public",
"static",
"AtomContactSet",
"getAtomsInContact",
"(",
"Chain",
"chain1",
",",
"Chain",
"chain2",
",",
"double",
"cutoff",
",",
"boolean",
"hetAtoms",
")",
"{",
"return",
"getAtomsInContact",
"(",
"chain1",
",",
"chain2",
",",
"null",
",",
"cutoff",
"... | Returns the set of inter-chain contacts between the two given chains for
all non-H atoms. Uses a geometric hashing algorithm that speeds up the
calculation without need of full distance matrix. The parsing mode
{@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to
true for this to work.
@param chain1
@param chain2
@param cutoff
@param hetAtoms
if true HET atoms are included, if false they are not
@return | [
"Returns",
"the",
"set",
"of",
"inter",
"-",
"chain",
"contacts",
"between",
"the",
"two",
"given",
"chains",
"for",
"all",
"non",
"-",
"H",
"atoms",
".",
"Uses",
"a",
"geometric",
"hashing",
"algorithm",
"that",
"speeds",
"up",
"the",
"calculation",
"with... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L1533-L1536 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java | EncodingUtils.encodeBase64 | public static String encodeBase64(final byte[] data, final boolean chunked) {
if (data != null && data.length > 0) {
if (chunked) {
return BASE64_CHUNKED_ENCODER.encodeToString(data).trim();
}
return BASE64_UNCHUNKED_ENCODER.encodeToString(data).trim();
}
return StringUtils.EMPTY;
} | java | public static String encodeBase64(final byte[] data, final boolean chunked) {
if (data != null && data.length > 0) {
if (chunked) {
return BASE64_CHUNKED_ENCODER.encodeToString(data).trim();
}
return BASE64_UNCHUNKED_ENCODER.encodeToString(data).trim();
}
return StringUtils.EMPTY;
} | [
"public",
"static",
"String",
"encodeBase64",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"boolean",
"chunked",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"chunked",
")",
"{",
"r... | Base64-encode the given byte[] as a string.
@param data the byte array to encode
@param chunked the chunked
@return the encoded string | [
"Base64",
"-",
"encode",
"the",
"given",
"byte",
"[]",
"as",
"a",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L149-L157 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/date/GosuDateUtil.java | GosuDateUtil.addDays | public static Date addDays(Date date, int iDays) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.DATE, iDays);
return dateTime.getTime();
} | java | public static Date addDays(Date date, int iDays) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.DATE, iDays);
return dateTime.getTime();
} | [
"public",
"static",
"Date",
"addDays",
"(",
"Date",
"date",
",",
"int",
"iDays",
")",
"{",
"Calendar",
"dateTime",
"=",
"dateToCalendar",
"(",
"date",
")",
";",
"dateTime",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"iDays",
")",
";",
"return",
"da... | Adds the specified (signed) amount of days to the given date. For
example, to subtract 5 days from the current date, you can
achieve it by calling: <code>addDays(Date, -5)</code>.
@param date The time.
@param iDays The amount of days to add.
@return A new date with the days added. | [
"Adds",
"the",
"specified",
"(",
"signed",
")",
"amount",
"of",
"days",
"to",
"the",
"given",
"date",
".",
"For",
"example",
"to",
"subtract",
"5",
"days",
"from",
"the",
"current",
"date",
"you",
"can",
"achieve",
"it",
"by",
"calling",
":",
"<code",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L77-L81 |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java | WriteQueue.getStatistics | synchronized QueueStats getStatistics() {
int size = this.writes.size();
double fillRatio = calculateFillRatio(this.totalLength, size);
int processingTime = this.lastDurationMillis;
if (processingTime == 0 && size > 0) {
// We get in here when this method is invoked prior to any operation being completed. Since lastDurationMillis
// is only set when an item is completed, in this special case we just estimate based on the amount of time
// the first item in the queue has been added.
processingTime = (int) ((this.timeSupplier.get() - this.writes.peekFirst().getQueueAddedTimestamp()) / AbstractTimer.NANOS_TO_MILLIS);
}
return new QueueStats(size, fillRatio, processingTime);
} | java | synchronized QueueStats getStatistics() {
int size = this.writes.size();
double fillRatio = calculateFillRatio(this.totalLength, size);
int processingTime = this.lastDurationMillis;
if (processingTime == 0 && size > 0) {
// We get in here when this method is invoked prior to any operation being completed. Since lastDurationMillis
// is only set when an item is completed, in this special case we just estimate based on the amount of time
// the first item in the queue has been added.
processingTime = (int) ((this.timeSupplier.get() - this.writes.peekFirst().getQueueAddedTimestamp()) / AbstractTimer.NANOS_TO_MILLIS);
}
return new QueueStats(size, fillRatio, processingTime);
} | [
"synchronized",
"QueueStats",
"getStatistics",
"(",
")",
"{",
"int",
"size",
"=",
"this",
".",
"writes",
".",
"size",
"(",
")",
";",
"double",
"fillRatio",
"=",
"calculateFillRatio",
"(",
"this",
".",
"totalLength",
",",
"size",
")",
";",
"int",
"processin... | Gets a snapshot of the queue internals.
@return The snapshot, including Queue Size, Item Fill Rate and elapsed time of the oldest item. | [
"Gets",
"a",
"snapshot",
"of",
"the",
"queue",
"internals",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java#L77-L89 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jAssociationQueries.java | EmbeddedNeo4jAssociationQueries.createRelationshipForEmbeddedAssociation | public Relationship createRelationshipForEmbeddedAssociation(GraphDatabaseService executionEngine, AssociationKey associationKey, EntityKey embeddedKey) {
String query = initCreateEmbeddedAssociationQuery( associationKey, embeddedKey );
Object[] queryValues = createRelationshipForEmbeddedQueryValues( associationKey, embeddedKey );
return executeQuery( executionEngine, query, queryValues );
} | java | public Relationship createRelationshipForEmbeddedAssociation(GraphDatabaseService executionEngine, AssociationKey associationKey, EntityKey embeddedKey) {
String query = initCreateEmbeddedAssociationQuery( associationKey, embeddedKey );
Object[] queryValues = createRelationshipForEmbeddedQueryValues( associationKey, embeddedKey );
return executeQuery( executionEngine, query, queryValues );
} | [
"public",
"Relationship",
"createRelationshipForEmbeddedAssociation",
"(",
"GraphDatabaseService",
"executionEngine",
",",
"AssociationKey",
"associationKey",
",",
"EntityKey",
"embeddedKey",
")",
"{",
"String",
"query",
"=",
"initCreateEmbeddedAssociationQuery",
"(",
"associat... | Give an embedded association, creates all the nodes and relationships required to represent it.
It assumes that the entity node containing the association already exists in the db.
@param executionEngine the {@link GraphDatabaseService} to run the query
@param associationKey the {@link AssociationKey} identifying the association
@param embeddedKey the {@link EntityKey} identifying the embedded component
@return the created {@link Relationship} that represents the association | [
"Give",
"an",
"embedded",
"association",
"creates",
"all",
"the",
"nodes",
"and",
"relationships",
"required",
"to",
"represent",
"it",
".",
"It",
"assumes",
"that",
"the",
"entity",
"node",
"containing",
"the",
"association",
"already",
"exists",
"in",
"the",
... | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jAssociationQueries.java#L136-L140 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPonctualElement.java | MapPonctualElement.contains | @Pure
@Override
public boolean contains(Point2D<?, ?> point, double delta) {
return this.position.getDistance(point) <= delta;
} | java | @Pure
@Override
public boolean contains(Point2D<?, ?> point, double delta) {
return this.position.getDistance(point) <= delta;
} | [
"@",
"Pure",
"@",
"Override",
"public",
"boolean",
"contains",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
",",
"double",
"delta",
")",
"{",
"return",
"this",
".",
"position",
".",
"getDistance",
"(",
"point",
")",
"<=",
"delta",
";",
"}"
] | Replies if the specified point (<var>x</var>,<var>y</var>)
was inside the figure of this MapElement.
@param point is a geo-referenced coordinate
@param delta is the geo-referenced distance that corresponds to a approximation
distance in the screen coordinate system
@return <code>true</code> if the specified point has a distance nearest than delta
to this element, otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"point",
"(",
"<var",
">",
"x<",
"/",
"var",
">",
"<var",
">",
"y<",
"/",
"var",
">",
")",
"was",
"inside",
"the",
"figure",
"of",
"this",
"MapElement",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPonctualElement.java#L210-L214 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java | PdfFileSpecification.setUnicodeFileName | public void setUnicodeFileName(String filename, boolean unicode) {
put(PdfName.UF, new PdfString(filename, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING));
} | java | public void setUnicodeFileName(String filename, boolean unicode) {
put(PdfName.UF, new PdfString(filename, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING));
} | [
"public",
"void",
"setUnicodeFileName",
"(",
"String",
"filename",
",",
"boolean",
"unicode",
")",
"{",
"put",
"(",
"PdfName",
".",
"UF",
",",
"new",
"PdfString",
"(",
"filename",
",",
"unicode",
"?",
"PdfObject",
".",
"TEXT_UNICODE",
":",
"PdfObject",
".",
... | Adds the unicode file name (the key /UF). This entry was introduced
in PDF 1.7. The filename must have the slash and backslash escaped
according to the file specification rules.
@param filename the filename
@param unicode if true, the filename is UTF-16BE encoded; otherwise PDFDocEncoding is used; | [
"Adds",
"the",
"unicode",
"file",
"name",
"(",
"the",
"key",
"/",
"UF",
")",
".",
"This",
"entry",
"was",
"introduced",
"in",
"PDF",
"1",
".",
"7",
".",
"The",
"filename",
"must",
"have",
"the",
"slash",
"and",
"backslash",
"escaped",
"according",
"to"... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L269-L271 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java | ValueMap.withNumberSet | public ValueMap withNumberSet(String key, Number ... val) {
super.put(key, InternalUtils.toBigDecimalSet(val));
return this;
} | java | public ValueMap withNumberSet(String key, Number ... val) {
super.put(key, InternalUtils.toBigDecimalSet(val));
return this;
} | [
"public",
"ValueMap",
"withNumberSet",
"(",
"String",
"key",
",",
"Number",
"...",
"val",
")",
"{",
"super",
".",
"put",
"(",
"key",
",",
"InternalUtils",
".",
"toBigDecimalSet",
"(",
"val",
")",
")",
";",
"return",
"this",
";",
"}"
] | Sets the value of the specified key in the current ValueMap to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"key",
"in",
"the",
"current",
"ValueMap",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L131-L134 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final int r, final int g, final int b) throws IOException
{
if (_isOutside255Interval (r) || _isOutside255Interval (g) || _isOutside255Interval (b))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" + r + "," + g + "," + b + ")");
}
writeOperand (r / 255f);
writeOperand (g / 255f);
writeOperand (b / 255f);
writeOperator ((byte) 'r', (byte) 'g');
} | java | public void setNonStrokingColor (final int r, final int g, final int b) throws IOException
{
if (_isOutside255Interval (r) || _isOutside255Interval (g) || _isOutside255Interval (b))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" + r + "," + g + "," + b + ")");
}
writeOperand (r / 255f);
writeOperand (g / 255f);
writeOperand (b / 255f);
writeOperator ((byte) 'r', (byte) 'g');
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"g",
",",
"final",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutside255Interval",
"(",
"r",
")",
"||",
"_isOutside255Interval",
"(",
"g",
")",
"||",... | Set the non-stroking color in the DeviceRGB color space. Range is 0..255.
@param r
The red value.
@param g
The green value.
@param b
The blue value.
@throws IOException
If an IO error occurs while writing to the stream.
@throws IllegalArgumentException
If the parameters are invalid. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"in",
"the",
"DeviceRGB",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"255",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L952-L962 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_voipLine_services_POST | public OvhVoIPLineOrder packName_voipLine_services_POST(String packName, String[] hardwareNames, String mondialRelayId, String shippingId) throws IOException {
String qPath = "/pack/xdsl/{packName}/voipLine/services";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "hardwareNames", hardwareNames);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "shippingId", shippingId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhVoIPLineOrder.class);
} | java | public OvhVoIPLineOrder packName_voipLine_services_POST(String packName, String[] hardwareNames, String mondialRelayId, String shippingId) throws IOException {
String qPath = "/pack/xdsl/{packName}/voipLine/services";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "hardwareNames", hardwareNames);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "shippingId", shippingId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhVoIPLineOrder.class);
} | [
"public",
"OvhVoIPLineOrder",
"packName_voipLine_services_POST",
"(",
"String",
"packName",
",",
"String",
"[",
"]",
"hardwareNames",
",",
"String",
"mondialRelayId",
",",
"String",
"shippingId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl... | Activate a voip line service
REST: POST /pack/xdsl/{packName}/voipLine/services
@param mondialRelayId [required] Mondial relay ID
@param hardwareNames [required] List of names from hardwares call
@param shippingId [required] Shipping ID for the order
@param packName [required] The internal name of your pack | [
"Activate",
"a",
"voip",
"line",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L256-L265 |
rholder/guava-retrying | src/main/java/com/github/rholder/retry/WaitStrategies.java | WaitStrategies.exponentialWait | public static WaitStrategy exponentialWait(long maximumTime,
@Nonnull TimeUnit maximumTimeUnit) {
Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null");
return new ExponentialWaitStrategy(1, maximumTimeUnit.toMillis(maximumTime));
} | java | public static WaitStrategy exponentialWait(long maximumTime,
@Nonnull TimeUnit maximumTimeUnit) {
Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null");
return new ExponentialWaitStrategy(1, maximumTimeUnit.toMillis(maximumTime));
} | [
"public",
"static",
"WaitStrategy",
"exponentialWait",
"(",
"long",
"maximumTime",
",",
"@",
"Nonnull",
"TimeUnit",
"maximumTimeUnit",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"maximumTimeUnit",
",",
"\"The maximum time unit may not be null\"",
")",
";",
"re... | Returns a strategy which sleeps for an exponential amount of time after the first failed attempt,
and in exponentially incrementing amounts after each failed attempt up to the maximumTime.
@param maximumTime the maximum time to sleep
@param maximumTimeUnit the unit of the maximum time
@return a wait strategy that increments with each failed attempt using exponential backoff | [
"Returns",
"a",
"strategy",
"which",
"sleeps",
"for",
"an",
"exponential",
"amount",
"of",
"time",
"after",
"the",
"first",
"failed",
"attempt",
"and",
"in",
"exponentially",
"incrementing",
"amounts",
"after",
"each",
"failed",
"attempt",
"up",
"to",
"the",
"... | train | https://github.com/rholder/guava-retrying/blob/177b6c9b9f3e7957f404f0bdb8e23374cb1de43f/src/main/java/com/github/rholder/retry/WaitStrategies.java#L136-L140 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/MenuUtil.java | MenuUtil.addMenuItem | public static JMenuItem addMenuItem (
ActionListener l, JMenu menu, String name, int mnem)
{
return addMenuItem(l, menu, name, Integer.valueOf(mnem), null);
} | java | public static JMenuItem addMenuItem (
ActionListener l, JMenu menu, String name, int mnem)
{
return addMenuItem(l, menu, name, Integer.valueOf(mnem), null);
} | [
"public",
"static",
"JMenuItem",
"addMenuItem",
"(",
"ActionListener",
"l",
",",
"JMenu",
"menu",
",",
"String",
"name",
",",
"int",
"mnem",
")",
"{",
"return",
"addMenuItem",
"(",
"l",
",",
"menu",
",",
"name",
",",
"Integer",
".",
"valueOf",
"(",
"mnem... | Adds a new menu item to the menu with the specified name and
attributes.
@param l the action listener.
@param menu the menu to add the item to.
@param name the item name.
@param mnem the mnemonic key for the item.
@return the new menu item. | [
"Adds",
"a",
"new",
"menu",
"item",
"to",
"the",
"menu",
"with",
"the",
"specified",
"name",
"and",
"attributes",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/MenuUtil.java#L84-L88 |
roboconf/roboconf-platform | core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpUtils.java | HttpUtils.sendAsynchronously | public static void sendAsynchronously( Message message, RemoteEndpoint remoteEndpoint )
throws IOException {
Future<Void> fut = null;
Exception exception = null;
try {
byte[] rawData = SerializationUtils.serializeObject( message );
ByteBuffer data = ByteBuffer.wrap( rawData );
fut = remoteEndpoint.sendBytesByFuture( data );
// Wait for completion (timeout)
fut.get( 8, TimeUnit.SECONDS );
} catch( ExecutionException | InterruptedException e ) {
exception = e;
} catch( TimeoutException e ) {
exception = e;
final Logger logger = Logger.getLogger( HttpUtils.class.getName());
logger.warning( "A message could not be sent to a remote end-point (HTTP messaging). Sending timed out." );
// FIXME: should we send the message once again?
if( fut != null )
fut.cancel(true);
} finally {
if( exception != null )
throw new IOException( exception );
}
} | java | public static void sendAsynchronously( Message message, RemoteEndpoint remoteEndpoint )
throws IOException {
Future<Void> fut = null;
Exception exception = null;
try {
byte[] rawData = SerializationUtils.serializeObject( message );
ByteBuffer data = ByteBuffer.wrap( rawData );
fut = remoteEndpoint.sendBytesByFuture( data );
// Wait for completion (timeout)
fut.get( 8, TimeUnit.SECONDS );
} catch( ExecutionException | InterruptedException e ) {
exception = e;
} catch( TimeoutException e ) {
exception = e;
final Logger logger = Logger.getLogger( HttpUtils.class.getName());
logger.warning( "A message could not be sent to a remote end-point (HTTP messaging). Sending timed out." );
// FIXME: should we send the message once again?
if( fut != null )
fut.cancel(true);
} finally {
if( exception != null )
throw new IOException( exception );
}
} | [
"public",
"static",
"void",
"sendAsynchronously",
"(",
"Message",
"message",
",",
"RemoteEndpoint",
"remoteEndpoint",
")",
"throws",
"IOException",
"{",
"Future",
"<",
"Void",
">",
"fut",
"=",
"null",
";",
"Exception",
"exception",
"=",
"null",
";",
"try",
"{"... | Sends a message asynchronously to a remote end point.
<p>
Asynchronous sending is necessary since we may have several threads that
use the same messaging client. Blocking sending may result in issues such
as #598.
</p>
@param message the message to send
@param remoteEndpoint the remote end-point
@throws IOException if something went wrong | [
"Sends",
"a",
"message",
"asynchronously",
"to",
"a",
"remote",
"end",
"point",
".",
"<p",
">",
"Asynchronous",
"sending",
"is",
"necessary",
"since",
"we",
"may",
"have",
"several",
"threads",
"that",
"use",
"the",
"same",
"messaging",
"client",
".",
"Block... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpUtils.java#L86-L115 |
alkacon/opencms-core | src/org/opencms/widgets/A_CmsFormatterWidget.java | A_CmsFormatterWidget.getWidgetOptionForType | public static CmsSelectWidgetOption getWidgetOptionForType(CmsObject cms, String typeName) {
String niceTypeName = typeName;
try {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
niceTypeName = CmsWorkplaceMessages.getResourceTypeName(locale, typeName);
} catch (@SuppressWarnings("unused") Exception e) {
// resource type name will be used as a fallback
}
CmsSelectWidgetOption option = new CmsSelectWidgetOption(
CmsFormatterChangeSet.keyForType(typeName),
false,
getMessage(cms, Messages.GUI_SCHEMA_FORMATTER_OPTION_1, niceTypeName));
return option;
} | java | public static CmsSelectWidgetOption getWidgetOptionForType(CmsObject cms, String typeName) {
String niceTypeName = typeName;
try {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
niceTypeName = CmsWorkplaceMessages.getResourceTypeName(locale, typeName);
} catch (@SuppressWarnings("unused") Exception e) {
// resource type name will be used as a fallback
}
CmsSelectWidgetOption option = new CmsSelectWidgetOption(
CmsFormatterChangeSet.keyForType(typeName),
false,
getMessage(cms, Messages.GUI_SCHEMA_FORMATTER_OPTION_1, niceTypeName));
return option;
} | [
"public",
"static",
"CmsSelectWidgetOption",
"getWidgetOptionForType",
"(",
"CmsObject",
"cms",
",",
"String",
"typeName",
")",
"{",
"String",
"niceTypeName",
"=",
"typeName",
";",
"try",
"{",
"Locale",
"locale",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")... | Creates a widget option for a resource type.<p>
@param cms the current CMS context
@param typeName the type for which we want a widget option
@return the created widget option | [
"Creates",
"a",
"widget",
"option",
"for",
"a",
"resource",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsFormatterWidget.java#L123-L137 |
js-lib-com/commons | src/main/java/js/util/Strings.java | Strings.setPrefix | public static String setPrefix(String text, String prefix)
{
if(text == null) {
return null;
}
if(!text.startsWith(prefix)) {
text = prefix + text;
}
return text;
} | java | public static String setPrefix(String text, String prefix)
{
if(text == null) {
return null;
}
if(!text.startsWith(prefix)) {
text = prefix + text;
}
return text;
} | [
"public",
"static",
"String",
"setPrefix",
"(",
"String",
"text",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"text",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"te... | Ensure a given text start with requested prefix. If <code>text</code> argument is empty returns given prefix;
returns null if <code>text</code> argument is null.
@param text text to add prefix to, null accepted,
@param prefix prefix to force on text start.
@return prefixed text or null. | [
"Ensure",
"a",
"given",
"text",
"start",
"with",
"requested",
"prefix",
".",
"If",
"<code",
">",
"text<",
"/",
"code",
">",
"argument",
"is",
"empty",
"returns",
"given",
"prefix",
";",
"returns",
"null",
"if",
"<code",
">",
"text<",
"/",
"code",
">",
... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1551-L1560 |
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.createContainerView | public ContainerView createContainerView(SoftwareSystem softwareSystem, String key, String description) {
assertThatTheSoftwareSystemIsNotNull(softwareSystem);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
ContainerView view = new ContainerView(softwareSystem, key, description);
view.setViewSet(this);
containerViews.add(view);
return view;
} | java | public ContainerView createContainerView(SoftwareSystem softwareSystem, String key, String description) {
assertThatTheSoftwareSystemIsNotNull(softwareSystem);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
ContainerView view = new ContainerView(softwareSystem, key, description);
view.setViewSet(this);
containerViews.add(view);
return view;
} | [
"public",
"ContainerView",
"createContainerView",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"String",
"key",
",",
"String",
"description",
")",
"{",
"assertThatTheSoftwareSystemIsNotNull",
"(",
"softwareSystem",
")",
";",
"assertThatTheViewKeyIsSpecifiedAndUnique",
"(",
... | Creates a container view, where the scope of the view is the specified software system.
@param softwareSystem the SoftwareSystem object representing the scope of the view
@param key the key for the view (must be unique)
@param description a description of the view
@return a ContainerView object
@throws IllegalArgumentException if the software system is null or the key is not unique | [
"Creates",
"a",
"container",
"view",
"where",
"the",
"scope",
"of",
"the",
"view",
"is",
"the",
"specified",
"software",
"system",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L90-L98 |
hector-client/hector | core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java | ColumnFamilyTemplate.queryColumns | public <T> T queryColumns(K key, List<N> columns,
ColumnFamilyRowMapper<K, N, T> mapper) {
HSlicePredicate<N> predicate = new HSlicePredicate<N>(topSerializer);
predicate.setColumnNames(columns);
return doExecuteSlice(key, predicate, mapper);
} | java | public <T> T queryColumns(K key, List<N> columns,
ColumnFamilyRowMapper<K, N, T> mapper) {
HSlicePredicate<N> predicate = new HSlicePredicate<N>(topSerializer);
predicate.setColumnNames(columns);
return doExecuteSlice(key, predicate, mapper);
} | [
"public",
"<",
"T",
">",
"T",
"queryColumns",
"(",
"K",
"key",
",",
"List",
"<",
"N",
">",
"columns",
",",
"ColumnFamilyRowMapper",
"<",
"K",
",",
"N",
",",
"T",
">",
"mapper",
")",
"{",
"HSlicePredicate",
"<",
"N",
">",
"predicate",
"=",
"new",
"H... | Queries all columns at a given key and maps them to an object of type OBJ
using the given mapping object
@param <T>
@param key
@param columns
@param mapper
@return | [
"Queries",
"all",
"columns",
"at",
"a",
"given",
"key",
"and",
"maps",
"them",
"to",
"an",
"object",
"of",
"type",
"OBJ",
"using",
"the",
"given",
"mapping",
"object"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java#L150-L155 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/cache/CacheRegistration.java | CacheRegistration.onStartup | public void onStartup() {
try {
preloadCaches();
SpringAppContext.getInstance().loadPackageContexts(); // trigger dynamic context loading
preloadDynamicCaches();
// implementor cache relies on kotlin from preloadDynamicCaches()
ImplementorCache implementorCache = new ImplementorCache();
implementorCache.loadCache();
allCaches.put(ImplementorCache.class.getSimpleName(), implementorCache);
}
catch (Exception ex){
String message = "Failed to load caches";
logger.severeException(message, ex);
throw new StartupException(message, ex);
}
} | java | public void onStartup() {
try {
preloadCaches();
SpringAppContext.getInstance().loadPackageContexts(); // trigger dynamic context loading
preloadDynamicCaches();
// implementor cache relies on kotlin from preloadDynamicCaches()
ImplementorCache implementorCache = new ImplementorCache();
implementorCache.loadCache();
allCaches.put(ImplementorCache.class.getSimpleName(), implementorCache);
}
catch (Exception ex){
String message = "Failed to load caches";
logger.severeException(message, ex);
throw new StartupException(message, ex);
}
} | [
"public",
"void",
"onStartup",
"(",
")",
"{",
"try",
"{",
"preloadCaches",
"(",
")",
";",
"SpringAppContext",
".",
"getInstance",
"(",
")",
".",
"loadPackageContexts",
"(",
")",
";",
"// trigger dynamic context loading",
"preloadDynamicCaches",
"(",
")",
";",
"/... | Method that gets invoked when the server comes up
Load all the cache objects when the server starts
@throws StartupException | [
"Method",
"that",
"gets",
"invoked",
"when",
"the",
"server",
"comes",
"up",
"Load",
"all",
"the",
"cache",
"objects",
"when",
"the",
"server",
"starts"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/cache/CacheRegistration.java#L78-L93 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java | AuthenticateApi.simpleLogout | public void simpleLogout(HttpServletRequest req, HttpServletResponse res) {
createSubjectAndPushItOnThreadAsNeeded(req, res);
AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, subjectManager.getCallerSubject());
authResult.setAuditCredType(req.getAuthType());
authResult.setAuditOutcome(AuditEvent.OUTCOME_SUCCESS);
Audit.audit(Audit.EventID.SECURITY_API_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
removeEntryFromAuthCacheForUser(req, res);
invalidateSession(req);
ssoCookieHelper.removeSSOCookieFromResponse(res);
ssoCookieHelper.createLogoutCookies(req, res);
subjectManager.clearSubjects();
} | java | public void simpleLogout(HttpServletRequest req, HttpServletResponse res) {
createSubjectAndPushItOnThreadAsNeeded(req, res);
AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, subjectManager.getCallerSubject());
authResult.setAuditCredType(req.getAuthType());
authResult.setAuditOutcome(AuditEvent.OUTCOME_SUCCESS);
Audit.audit(Audit.EventID.SECURITY_API_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
removeEntryFromAuthCacheForUser(req, res);
invalidateSession(req);
ssoCookieHelper.removeSSOCookieFromResponse(res);
ssoCookieHelper.createLogoutCookies(req, res);
subjectManager.clearSubjects();
} | [
"public",
"void",
"simpleLogout",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"{",
"createSubjectAndPushItOnThreadAsNeeded",
"(",
"req",
",",
"res",
")",
";",
"AuthenticationResult",
"authResult",
"=",
"new",
"AuthenticationResult",
"(",
... | Perform logout an user by doing the following:
1) Invalidate the session
2) Remove cookie if SSO is enabled
3) Clear out the client subject
@param req
@param res | [
"Perform",
"logout",
"an",
"user",
"by",
"doing",
"the",
"following",
":",
"1",
")",
"Invalidate",
"the",
"session",
"2",
")",
"Remove",
"cookie",
"if",
"SSO",
"is",
"enabled",
"3",
")",
"Clear",
"out",
"the",
"client",
"subject"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java#L289-L303 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java | KeyRange.openClosed | public static KeyRange openClosed(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.OPEN, checkNotNull(end), Endpoint.CLOSED);
} | java | public static KeyRange openClosed(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.OPEN, checkNotNull(end), Endpoint.CLOSED);
} | [
"public",
"static",
"KeyRange",
"openClosed",
"(",
"Key",
"start",
",",
"Key",
"end",
")",
"{",
"return",
"new",
"KeyRange",
"(",
"checkNotNull",
"(",
"start",
")",
",",
"Endpoint",
".",
"OPEN",
",",
"checkNotNull",
"(",
"end",
")",
",",
"Endpoint",
".",... | Returns a key range from {@code start} exclusive to {@code end} inclusive. | [
"Returns",
"a",
"key",
"range",
"from",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java#L167-L169 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java | PathMetadataFactory.forMapAccess | public static <KT> PathMetadata forMapAccess(Path<?> parent, Expression<KT> key) {
return new PathMetadata(parent, key, PathType.MAPVALUE);
} | java | public static <KT> PathMetadata forMapAccess(Path<?> parent, Expression<KT> key) {
return new PathMetadata(parent, key, PathType.MAPVALUE);
} | [
"public",
"static",
"<",
"KT",
">",
"PathMetadata",
"forMapAccess",
"(",
"Path",
"<",
"?",
">",
"parent",
",",
"Expression",
"<",
"KT",
">",
"key",
")",
"{",
"return",
"new",
"PathMetadata",
"(",
"parent",
",",
"key",
",",
"PathType",
".",
"MAPVALUE",
... | Create a new PathMetadata instance for key based map access
@param parent parent path
@param key key for map access
@return map access path | [
"Create",
"a",
"new",
"PathMetadata",
"instance",
"for",
"key",
"based",
"map",
"access"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java#L97-L99 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_user_userId_objectRight_objectRightId_GET | public OvhObjectRight serviceName_user_userId_objectRight_objectRightId_GET(String serviceName, Long userId, Long objectRightId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/objectRight/{objectRightId}";
StringBuilder sb = path(qPath, serviceName, userId, objectRightId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhObjectRight.class);
} | java | public OvhObjectRight serviceName_user_userId_objectRight_objectRightId_GET(String serviceName, Long userId, Long objectRightId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/objectRight/{objectRightId}";
StringBuilder sb = path(qPath, serviceName, userId, objectRightId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhObjectRight.class);
} | [
"public",
"OvhObjectRight",
"serviceName_user_userId_objectRight_objectRightId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"userId",
",",
"Long",
"objectRightId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/user/{userId}/obje... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/user/{userId}/objectRight/{objectRightId}
@param serviceName [required] Domain of the service
@param userId [required]
@param objectRightId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L686-L691 |
knowm/Sundial | src/main/java/org/knowm/sundial/SundialJobScheduler.java | SundialJobScheduler.startJob | public static void startJob(String jobName, Map<String, Object> params)
throws SundialSchedulerException {
try {
JobDataMap jobDataMap = new JobDataMap();
for (String key : params.keySet()) {
// logger.debug("key= " + key);
// logger.debug("value= " + pParams.get(key));
jobDataMap.put(key, params.get(key));
}
getScheduler().triggerJob(jobName, jobDataMap);
} catch (SchedulerException e) {
throw new SundialSchedulerException("ERROR STARTING JOB!!!", e);
}
} | java | public static void startJob(String jobName, Map<String, Object> params)
throws SundialSchedulerException {
try {
JobDataMap jobDataMap = new JobDataMap();
for (String key : params.keySet()) {
// logger.debug("key= " + key);
// logger.debug("value= " + pParams.get(key));
jobDataMap.put(key, params.get(key));
}
getScheduler().triggerJob(jobName, jobDataMap);
} catch (SchedulerException e) {
throw new SundialSchedulerException("ERROR STARTING JOB!!!", e);
}
} | [
"public",
"static",
"void",
"startJob",
"(",
"String",
"jobName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"SundialSchedulerException",
"{",
"try",
"{",
"JobDataMap",
"jobDataMap",
"=",
"new",
"JobDataMap",
"(",
")",
";",
"for"... | Starts a Job matching the the given Job Name found in jobs.xml or jobs manually added.
@param jobName | [
"Starts",
"a",
"Job",
"matching",
"the",
"the",
"given",
"Job",
"Name",
"found",
"in",
"jobs",
".",
"xml",
"or",
"jobs",
"manually",
"added",
"."
] | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L299-L314 |
OpenLiberty/open-liberty | dev/com.ibm.ws.junit.extensions/src/com/ibm/websphere/ras/CapturedOutputHolder.java | CapturedOutputHolder.publishTraceLogRecord | @Override
protected void publishTraceLogRecord(TraceWriter detailLog, LogRecord logRecord, Object id, String formattedMsg, String formattedVerboseMsg) {
if (formattedVerboseMsg == null) {
formattedVerboseMsg = formatter.formatVerboseMessage(logRecord, formattedMsg, false);
}
Level level = logRecord.getLevel();
int levelVal = level.intValue();
String traceDetail = formatter.traceLogFormat(logRecord, id, formattedMsg, formattedVerboseMsg);
invokeTraceRouters(new RoutedMessageImpl(formattedMsg, formattedVerboseMsg, traceDetail, logRecord));
if (traceDetail.contains("x.com.ibm")) {
return;
}
if (detailLog == systemOut || detailLog == systemErr) {
if (levelVal == WsLevel.ERROR.intValue() || levelVal == WsLevel.SEVERE.intValue()) {
writeStreamOutput(systemErr, traceDetail, false);
} else {
writeStreamOutput((SystemLogHolder) detailLog, traceDetail, false);
}
} else {
detailLog.writeRecord(traceDetail);
}
} | java | @Override
protected void publishTraceLogRecord(TraceWriter detailLog, LogRecord logRecord, Object id, String formattedMsg, String formattedVerboseMsg) {
if (formattedVerboseMsg == null) {
formattedVerboseMsg = formatter.formatVerboseMessage(logRecord, formattedMsg, false);
}
Level level = logRecord.getLevel();
int levelVal = level.intValue();
String traceDetail = formatter.traceLogFormat(logRecord, id, formattedMsg, formattedVerboseMsg);
invokeTraceRouters(new RoutedMessageImpl(formattedMsg, formattedVerboseMsg, traceDetail, logRecord));
if (traceDetail.contains("x.com.ibm")) {
return;
}
if (detailLog == systemOut || detailLog == systemErr) {
if (levelVal == WsLevel.ERROR.intValue() || levelVal == WsLevel.SEVERE.intValue()) {
writeStreamOutput(systemErr, traceDetail, false);
} else {
writeStreamOutput((SystemLogHolder) detailLog, traceDetail, false);
}
} else {
detailLog.writeRecord(traceDetail);
}
} | [
"@",
"Override",
"protected",
"void",
"publishTraceLogRecord",
"(",
"TraceWriter",
"detailLog",
",",
"LogRecord",
"logRecord",
",",
"Object",
"id",
",",
"String",
"formattedMsg",
",",
"String",
"formattedVerboseMsg",
")",
"{",
"if",
"(",
"formattedVerboseMsg",
"==",... | Overwritten for old BaseTraceService behaviour for publishTraceLogRecord | [
"Overwritten",
"for",
"old",
"BaseTraceService",
"behaviour",
"for",
"publishTraceLogRecord"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.junit.extensions/src/com/ibm/websphere/ras/CapturedOutputHolder.java#L135-L157 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Registry.java | Registry.setAction | public void setAction(String action) throws ApplicationException {
action = action.toLowerCase().trim();
if (action.equals("getall")) this.action = ACTION_GET_ALL;
else if (action.equals("get")) this.action = ACTION_GET;
else if (action.equals("set")) this.action = ACTION_SET;
else if (action.equals("delete")) this.action = ACTION_DELETE;
else throw new ApplicationException("attribute action of the tag registry has an invalid value [" + action + "], valid values are [getAll, get, set, delete]");
} | java | public void setAction(String action) throws ApplicationException {
action = action.toLowerCase().trim();
if (action.equals("getall")) this.action = ACTION_GET_ALL;
else if (action.equals("get")) this.action = ACTION_GET;
else if (action.equals("set")) this.action = ACTION_SET;
else if (action.equals("delete")) this.action = ACTION_DELETE;
else throw new ApplicationException("attribute action of the tag registry has an invalid value [" + action + "], valid values are [getAll, get, set, delete]");
} | [
"public",
"void",
"setAction",
"(",
"String",
"action",
")",
"throws",
"ApplicationException",
"{",
"action",
"=",
"action",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"action",
".",
"equals",
"(",
"\"getall\"",
")",
")",
"this"... | set the value action action to the registry
@param action value to set
@throws ApplicationException | [
"set",
"the",
"value",
"action",
"action",
"to",
"the",
"registry"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Registry.java#L115-L122 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java | ColorConverter.parseRGB | protected Color parseRGB(String value)
{
StringTokenizer items = new StringTokenizer(value, ",");
try {
int red = 0;
if (items.hasMoreTokens()) {
red = Integer.parseInt(items.nextToken().trim());
}
int green = 0;
if (items.hasMoreTokens()) {
green = Integer.parseInt(items.nextToken().trim());
}
int blue = 0;
if (items.hasMoreTokens()) {
blue = Integer.parseInt(items.nextToken().trim());
}
return new Color(red, green, blue);
} catch (NumberFormatException ex) {
throw new ConversionException(value + "is not a valid RGB colo", ex);
}
} | java | protected Color parseRGB(String value)
{
StringTokenizer items = new StringTokenizer(value, ",");
try {
int red = 0;
if (items.hasMoreTokens()) {
red = Integer.parseInt(items.nextToken().trim());
}
int green = 0;
if (items.hasMoreTokens()) {
green = Integer.parseInt(items.nextToken().trim());
}
int blue = 0;
if (items.hasMoreTokens()) {
blue = Integer.parseInt(items.nextToken().trim());
}
return new Color(red, green, blue);
} catch (NumberFormatException ex) {
throw new ConversionException(value + "is not a valid RGB colo", ex);
}
} | [
"protected",
"Color",
"parseRGB",
"(",
"String",
"value",
")",
"{",
"StringTokenizer",
"items",
"=",
"new",
"StringTokenizer",
"(",
"value",
",",
"\",\"",
")",
";",
"try",
"{",
"int",
"red",
"=",
"0",
";",
"if",
"(",
"items",
".",
"hasMoreTokens",
"(",
... | Parsers a String in the form "x, y, z" into an SWT RGB class.
@param value the color as String
@return RGB | [
"Parsers",
"a",
"String",
"in",
"the",
"form",
"x",
"y",
"z",
"into",
"an",
"SWT",
"RGB",
"class",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java#L73-L97 |
kaazing/java.client | transport/src/main/java/org/kaazing/gateway/client/transport/ws/WsFrameEncodingSupport.java | WsFrameEncodingSupport.doEncodeOpcode | private static byte doEncodeOpcode(byte b, WsMessage message) {
switch (message.getKind()) {
case TEXT: {
b |= Opcode.TEXT.getCode();
break;
}
case BINARY: {
b |= Opcode.BINARY.getCode();
break;
}
case PING: {
b |= Opcode.PING.getCode();
break;
}
case PONG: {
b |= Opcode.PONG.getCode();
break;
}
case CLOSE: {
b |= Opcode.CLOSE.getCode();
break;
}
default:
throw new IllegalArgumentException("Unrecognized frame type: " + message.getKind());
}
return b;
} | java | private static byte doEncodeOpcode(byte b, WsMessage message) {
switch (message.getKind()) {
case TEXT: {
b |= Opcode.TEXT.getCode();
break;
}
case BINARY: {
b |= Opcode.BINARY.getCode();
break;
}
case PING: {
b |= Opcode.PING.getCode();
break;
}
case PONG: {
b |= Opcode.PONG.getCode();
break;
}
case CLOSE: {
b |= Opcode.CLOSE.getCode();
break;
}
default:
throw new IllegalArgumentException("Unrecognized frame type: " + message.getKind());
}
return b;
} | [
"private",
"static",
"byte",
"doEncodeOpcode",
"(",
"byte",
"b",
",",
"WsMessage",
"message",
")",
"{",
"switch",
"(",
"message",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"TEXT",
":",
"{",
"b",
"|=",
"Opcode",
".",
"TEXT",
".",
"getCode",
"(",
")"... | Encode a WebSocket opcode onto a byte that might have some high bits set.
@param b
@param message
@return | [
"Encode",
"a",
"WebSocket",
"opcode",
"onto",
"a",
"byte",
"that",
"might",
"have",
"some",
"high",
"bits",
"set",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/transport/src/main/java/org/kaazing/gateway/client/transport/ws/WsFrameEncodingSupport.java#L119-L145 |
jruby/jcodings | src/org/jcodings/AbstractEncoding.java | AbstractEncoding.caseFoldCodesByString | @Override
public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) {
return asciiCaseFoldCodesByString(flag, bytes, p, end);
} | java | @Override
public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) {
return asciiCaseFoldCodesByString(flag, bytes, p, end);
} | [
"@",
"Override",
"public",
"CaseFoldCodeItem",
"[",
"]",
"caseFoldCodesByString",
"(",
"int",
"flag",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"p",
",",
"int",
"end",
")",
"{",
"return",
"asciiCaseFoldCodesByString",
"(",
"flag",
",",
"bytes",
",",
"p",... | onigenc_ascii_get_case_fold_codes_by_str / used also by multibyte encodings | [
"onigenc_ascii_get_case_fold_codes_by_str",
"/",
"used",
"also",
"by",
"multibyte",
"encodings"
] | train | https://github.com/jruby/jcodings/blob/8e09c6caab59f9a0b9760e57d2708eea185c2de1/src/org/jcodings/AbstractEncoding.java#L102-L105 |
elki-project/elki | elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java | FastMultidimensionalScalingTransform.randomInitialization | protected void randomInitialization(double[] out, Random rnd) {
double l2 = 0.;
while(!(l2 > 0)) {
for(int d = 0; d < out.length; d++) {
final double val = rnd.nextDouble();
out[d] = val;
l2 += val * val;
}
}
// Standardize:
final double s = 1. / FastMath.sqrt(l2);
for(int d = 0; d < out.length; d++) {
out[d] *= s;
}
} | java | protected void randomInitialization(double[] out, Random rnd) {
double l2 = 0.;
while(!(l2 > 0)) {
for(int d = 0; d < out.length; d++) {
final double val = rnd.nextDouble();
out[d] = val;
l2 += val * val;
}
}
// Standardize:
final double s = 1. / FastMath.sqrt(l2);
for(int d = 0; d < out.length; d++) {
out[d] *= s;
}
} | [
"protected",
"void",
"randomInitialization",
"(",
"double",
"[",
"]",
"out",
",",
"Random",
"rnd",
")",
"{",
"double",
"l2",
"=",
"0.",
";",
"while",
"(",
"!",
"(",
"l2",
">",
"0",
")",
")",
"{",
"for",
"(",
"int",
"d",
"=",
"0",
";",
"d",
"<",... | Choose a random vector of unit norm for power iterations.
@param out Output storage
@param rnd Random source. | [
"Choose",
"a",
"random",
"vector",
"of",
"unit",
"norm",
"for",
"power",
"iterations",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java#L212-L226 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/dump/codec/DataFileEncoder.java | DataFileEncoder.encodeDiff | protected String encodeDiff(final Task<Diff> task, final Diff diff)
throws ConfigurationException, UnsupportedEncodingException,
DecodingException, EncodingException, SQLConsumerException
{
RevisionCodecData codecData = diff.getCodecData();
String encoding = encoder.encodeDiff(codecData, diff);
return encoding;
} | java | protected String encodeDiff(final Task<Diff> task, final Diff diff)
throws ConfigurationException, UnsupportedEncodingException,
DecodingException, EncodingException, SQLConsumerException
{
RevisionCodecData codecData = diff.getCodecData();
String encoding = encoder.encodeDiff(codecData, diff);
return encoding;
} | [
"protected",
"String",
"encodeDiff",
"(",
"final",
"Task",
"<",
"Diff",
">",
"task",
",",
"final",
"Diff",
"diff",
")",
"throws",
"ConfigurationException",
",",
"UnsupportedEncodingException",
",",
"DecodingException",
",",
"EncodingException",
",",
"SQLConsumerExcept... | Encodes the diff.
@param task
Reference to the DiffTask
@param diff
Diff to encode
@return Base 64 encoded Diff
@throws ConfigurationException
if an error occurred while accessing the configuration
@throws UnsupportedEncodingException
if the character encoding is unsupported
@throws DecodingException
if the decoding failed
@throws EncodingException
if the encoding failed
@throws SQLConsumerException
if an error occurred while encoding the diff | [
"Encodes",
"the",
"diff",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/dump/codec/DataFileEncoder.java#L97-L106 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java | PoissonDistribution.devianceTerm | @Reference(title = "Fast and accurate computation of binomial probabilities", //
authors = "C. Loader", booktitle = "", //
url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", //
bibkey = "web/Loader00")
private static double devianceTerm(double x, double np) {
if(Math.abs(x - np) < 0.1 * (x + np)) {
final double v = (x - np) / (x + np);
double s = (x - np) * v;
double ej = 2.0d * x * v;
for(int j = 1;; j++) {
ej *= v * v;
final double s1 = s + ej / (2 * j + 1);
if(s1 == s) {
return s1;
}
s = s1;
}
}
return x * FastMath.log(x / np) + np - x;
} | java | @Reference(title = "Fast and accurate computation of binomial probabilities", //
authors = "C. Loader", booktitle = "", //
url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", //
bibkey = "web/Loader00")
private static double devianceTerm(double x, double np) {
if(Math.abs(x - np) < 0.1 * (x + np)) {
final double v = (x - np) / (x + np);
double s = (x - np) * v;
double ej = 2.0d * x * v;
for(int j = 1;; j++) {
ej *= v * v;
final double s1 = s + ej / (2 * j + 1);
if(s1 == s) {
return s1;
}
s = s1;
}
}
return x * FastMath.log(x / np) + np - x;
} | [
"@",
"Reference",
"(",
"title",
"=",
"\"Fast and accurate computation of binomial probabilities\"",
",",
"//",
"authors",
"=",
"\"C. Loader\"",
",",
"booktitle",
"=",
"\"\"",
",",
"//",
"url",
"=",
"\"http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf\... | Evaluate the deviance term of the saddle point approximation.
<p>
bd0(x,np) = x*ln(x/np)+np-x
@param x probability density function position
@param np product of trials and success probability: n*p
@return Deviance term | [
"Evaluate",
"the",
"deviance",
"term",
"of",
"the",
"saddle",
"point",
"approximation",
".",
"<p",
">",
"bd0",
"(",
"x",
"np",
")",
"=",
"x",
"*",
"ln",
"(",
"x",
"/",
"np",
")",
"+",
"np",
"-",
"x"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java#L403-L423 |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/StatusData.java | StatusData.putAll | public void putAll(Map<? extends T, ?> m) {
for (Map.Entry<? extends T, ?> e : m.entrySet()) {
put(e.getKey(), e.getValue());
}
} | java | public void putAll(Map<? extends T, ?> m) {
for (Map.Entry<? extends T, ?> e : m.entrySet()) {
put(e.getKey(), e.getValue());
}
} | [
"public",
"void",
"putAll",
"(",
"Map",
"<",
"?",
"extends",
"T",
",",
"?",
">",
"m",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
"extends",
"T",
",",
"?",
">",
"e",
":",
"m",
".",
"entrySet",
"(",
")",
")",
"{",
"put",
"(",
"e",
... | Stores every mapping from the given map.
Implemented in 'fail-fast' manner: no rollbacks of already stored mappings, fails at first occurred violation.
@param m map containing data to put in this StatusData.
@throws IllegalArgumentException if any mapping in the given map violates this class restrictions. | [
"Stores",
"every",
"mapping",
"from",
"the",
"given",
"map",
".",
"Implemented",
"in",
"fail",
"-",
"fast",
"manner",
":",
"no",
"rollbacks",
"of",
"already",
"stored",
"mappings",
"fails",
"at",
"first",
"occurred",
"violation",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/StatusData.java#L41-L45 |
eurekaclinical/datastore | src/main/java/org/eurekaclinical/datastore/bdb/BdbUtil.java | BdbUtil.uniqueEnvironment | public static String uniqueEnvironment(String prefix, String suffix,
File directory) throws IOException {
File tmpDir =
UNIQUE_DIRECTORY_CREATOR.create(prefix, suffix, directory);
String randomFilename = UUID.randomUUID().toString();
File envNameAsFile = new File(tmpDir, randomFilename);
return envNameAsFile.getAbsolutePath();
} | java | public static String uniqueEnvironment(String prefix, String suffix,
File directory) throws IOException {
File tmpDir =
UNIQUE_DIRECTORY_CREATOR.create(prefix, suffix, directory);
String randomFilename = UUID.randomUUID().toString();
File envNameAsFile = new File(tmpDir, randomFilename);
return envNameAsFile.getAbsolutePath();
} | [
"public",
"static",
"String",
"uniqueEnvironment",
"(",
"String",
"prefix",
",",
"String",
"suffix",
",",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"File",
"tmpDir",
"=",
"UNIQUE_DIRECTORY_CREATOR",
".",
"create",
"(",
"prefix",
",",
"suffix",
",",... | Creates a unique directory for housing a BDB environment, and returns
its name.
@param prefix a prefix for the temporary directory's name. Cannot be
<code>null</code>.
@param suffix a suffix for the temporary directory's name.
@return the environment name to use.
@param directory the parent directory to use.
@throws IOException if an error occurred in creating the temporary
directory. | [
"Creates",
"a",
"unique",
"directory",
"for",
"housing",
"a",
"BDB",
"environment",
"and",
"returns",
"its",
"name",
"."
] | train | https://github.com/eurekaclinical/datastore/blob/a03a70819bb562ba45eac66ca49f778035ee45e0/src/main/java/org/eurekaclinical/datastore/bdb/BdbUtil.java#L48-L55 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java | KunderaQuery.setParameter | public final void setParameter(String name, Object value) {
if (isNative()) {
bindParameters.add(new BindParameter(name, value));
} else {
setParameterValue(":" + name, value);
}
parametersMap.put(":" + name, value);
} | java | public final void setParameter(String name, Object value) {
if (isNative()) {
bindParameters.add(new BindParameter(name, value));
} else {
setParameterValue(":" + name, value);
}
parametersMap.put(":" + name, value);
} | [
"public",
"final",
"void",
"setParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"isNative",
"(",
")",
")",
"{",
"bindParameters",
".",
"add",
"(",
"new",
"BindParameter",
"(",
"name",
",",
"value",
")",
")",
";",
"}",
"... | Sets the parameter.
@param name
the name
@param value
the value | [
"Sets",
"the",
"parameter",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java#L821-L829 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/writers/AbstractFormatPatternWriter.java | AbstractFormatPatternWriter.createByteArrayWriter | protected static ByteArrayWriter createByteArrayWriter(final String fileName, final boolean append, final boolean buffered,
final boolean threadSafe, final boolean shared) throws FileNotFoundException {
File file = new File(fileName).getAbsoluteFile();
file.getParentFile().mkdirs();
FileOutputStream stream = new FileOutputStream(file, append);
ByteArrayWriter writer = shared ? new LockedFileOutputStreamWriter(stream) : new OutputStreamWriter(stream);
if (buffered) {
writer = new BufferedWriterDecorator(writer);
}
if (threadSafe) {
writer = new SynchronizedWriterDecorator(writer, stream);
}
return writer;
} | java | protected static ByteArrayWriter createByteArrayWriter(final String fileName, final boolean append, final boolean buffered,
final boolean threadSafe, final boolean shared) throws FileNotFoundException {
File file = new File(fileName).getAbsoluteFile();
file.getParentFile().mkdirs();
FileOutputStream stream = new FileOutputStream(file, append);
ByteArrayWriter writer = shared ? new LockedFileOutputStreamWriter(stream) : new OutputStreamWriter(stream);
if (buffered) {
writer = new BufferedWriterDecorator(writer);
}
if (threadSafe) {
writer = new SynchronizedWriterDecorator(writer, stream);
}
return writer;
} | [
"protected",
"static",
"ByteArrayWriter",
"createByteArrayWriter",
"(",
"final",
"String",
"fileName",
",",
"final",
"boolean",
"append",
",",
"final",
"boolean",
"buffered",
",",
"final",
"boolean",
"threadSafe",
",",
"final",
"boolean",
"shared",
")",
"throws",
... | Creates a {@link ByteArrayWriter} for a file.
@param fileName
Name of file to open for writing
@param append
An already existing file should be continued
@param buffered
Output should be buffered
@param threadSafe
Created writer must be thread-safe
@param shared
Output file is shared with other processes
@return Writer for writing to passed file
@throws FileNotFoundException
File does not exist or cannot be opened for any other reason | [
"Creates",
"a",
"{",
"@link",
"ByteArrayWriter",
"}",
"for",
"a",
"file",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/AbstractFormatPatternWriter.java#L125-L142 |
dbracewell/mango | src/main/java/com/davidbracewell/config/Config.java | Config.loadDefaultConf | protected static boolean loadDefaultConf(String packageName) throws ParseException {
if (packageName.endsWith(".conf")) {
return false;
}
packageName = packageName.replaceAll("\\$[0-9]+$", "");
Resource defaultConf = new ClasspathResource((packageName.replaceAll("\\.",
"/"
) + "/" + DEFAULT_CONFIG_FILE_NAME).trim(),
Config.getDefaultClassLoader()
);
// Go through each level of the package until we find one that
// has a default properties file or we cannot go any further.
while (!defaultConf.exists()) {
int idx = packageName.lastIndexOf('.');
if (idx == -1) {
defaultConf = new ClasspathResource(packageName + "/" + DEFAULT_CONFIG_FILE_NAME,
Config.getDefaultClassLoader()
);
break;
}
packageName = packageName.substring(0, idx);
defaultConf = new ClasspathResource(packageName.replaceAll("\\.", "/") + "/" + DEFAULT_CONFIG_FILE_NAME,
Config.getDefaultClassLoader()
);
}
if (defaultConf.exists()) {
loadConfig(defaultConf);
return true;
}
return false;
} | java | protected static boolean loadDefaultConf(String packageName) throws ParseException {
if (packageName.endsWith(".conf")) {
return false;
}
packageName = packageName.replaceAll("\\$[0-9]+$", "");
Resource defaultConf = new ClasspathResource((packageName.replaceAll("\\.",
"/"
) + "/" + DEFAULT_CONFIG_FILE_NAME).trim(),
Config.getDefaultClassLoader()
);
// Go through each level of the package until we find one that
// has a default properties file or we cannot go any further.
while (!defaultConf.exists()) {
int idx = packageName.lastIndexOf('.');
if (idx == -1) {
defaultConf = new ClasspathResource(packageName + "/" + DEFAULT_CONFIG_FILE_NAME,
Config.getDefaultClassLoader()
);
break;
}
packageName = packageName.substring(0, idx);
defaultConf = new ClasspathResource(packageName.replaceAll("\\.", "/") + "/" + DEFAULT_CONFIG_FILE_NAME,
Config.getDefaultClassLoader()
);
}
if (defaultConf.exists()) {
loadConfig(defaultConf);
return true;
}
return false;
} | [
"protected",
"static",
"boolean",
"loadDefaultConf",
"(",
"String",
"packageName",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"packageName",
".",
"endsWith",
"(",
"\".conf\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"packageName",
"=",
"packageName",
... | Load default conf.
@param packageName the package name
@return the boolean
@throws ParseException the parse exception | [
"Load",
"default",
"conf",
"."
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/config/Config.java#L584-L622 |
apereo/cas | support/cas-server-support-spnego/src/main/java/org/apereo/cas/support/spnego/authentication/handler/support/JcifsSpnegoAuthenticationHandler.java | JcifsSpnegoAuthenticationHandler.getPrincipal | protected Principal getPrincipal(final String name, final boolean isNtlm) {
if (this.principalWithDomainName) {
return this.principalFactory.createPrincipal(name);
}
if (isNtlm) {
if (Pattern.matches("\\S+\\\\\\S+", name)) {
val splitList = Splitter.on(Pattern.compile("\\\\")).splitToList(name);
if (splitList.size() == 2) {
return this.principalFactory.createPrincipal(splitList.get(1));
}
}
return this.principalFactory.createPrincipal(name);
}
val splitList = Splitter.on("@").splitToList(name);
return this.principalFactory.createPrincipal(splitList.get(0));
} | java | protected Principal getPrincipal(final String name, final boolean isNtlm) {
if (this.principalWithDomainName) {
return this.principalFactory.createPrincipal(name);
}
if (isNtlm) {
if (Pattern.matches("\\S+\\\\\\S+", name)) {
val splitList = Splitter.on(Pattern.compile("\\\\")).splitToList(name);
if (splitList.size() == 2) {
return this.principalFactory.createPrincipal(splitList.get(1));
}
}
return this.principalFactory.createPrincipal(name);
}
val splitList = Splitter.on("@").splitToList(name);
return this.principalFactory.createPrincipal(splitList.get(0));
} | [
"protected",
"Principal",
"getPrincipal",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"isNtlm",
")",
"{",
"if",
"(",
"this",
".",
"principalWithDomainName",
")",
"{",
"return",
"this",
".",
"principalFactory",
".",
"createPrincipal",
"(",
"name",
... | Gets the principal from the given name. The principal
is created by the factory instance.
@param name the name
@param isNtlm the is ntlm
@return the simple principal | [
"Gets",
"the",
"principal",
"from",
"the",
"given",
"name",
".",
"The",
"principal",
"is",
"created",
"by",
"the",
"factory",
"instance",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-spnego/src/main/java/org/apereo/cas/support/spnego/authentication/handler/support/JcifsSpnegoAuthenticationHandler.java#L121-L136 |
apache/incubator-gobblin | gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java | HttpUtils.createR2ClientLimiterKey | public static String createR2ClientLimiterKey(Config config) {
String urlTemplate = config.getString(HttpConstants.URL_TEMPLATE);
try {
String escaped = URIUtil.encodeQuery(urlTemplate);
URI uri = new URI(escaped);
if (uri.getHost() == null)
throw new RuntimeException("Cannot get host part from uri" + urlTemplate);
String key = uri.getScheme() + "/" + uri.getHost();
if (uri.getPort() > 0) {
key = key + "/" + uri.getPort();
}
log.info("Get limiter key [" + key + "]");
return key;
} catch (Exception e) {
throw new RuntimeException("Cannot create R2 limiter key", e);
}
} | java | public static String createR2ClientLimiterKey(Config config) {
String urlTemplate = config.getString(HttpConstants.URL_TEMPLATE);
try {
String escaped = URIUtil.encodeQuery(urlTemplate);
URI uri = new URI(escaped);
if (uri.getHost() == null)
throw new RuntimeException("Cannot get host part from uri" + urlTemplate);
String key = uri.getScheme() + "/" + uri.getHost();
if (uri.getPort() > 0) {
key = key + "/" + uri.getPort();
}
log.info("Get limiter key [" + key + "]");
return key;
} catch (Exception e) {
throw new RuntimeException("Cannot create R2 limiter key", e);
}
} | [
"public",
"static",
"String",
"createR2ClientLimiterKey",
"(",
"Config",
"config",
")",
"{",
"String",
"urlTemplate",
"=",
"config",
".",
"getString",
"(",
"HttpConstants",
".",
"URL_TEMPLATE",
")",
";",
"try",
"{",
"String",
"escaped",
"=",
"URIUtil",
".",
"e... | Convert D2 URL template into a string used for throttling limiter
Valid:
d2://host/${resource-id}
Invalid:
d2://host${resource-id}, because we cannot differentiate the host | [
"Convert",
"D2",
"URL",
"template",
"into",
"a",
"string",
"used",
"for",
"throttling",
"limiter"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java#L204-L222 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeValueForTrafficDirection | @Pure
public static String getPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder b = new StringBuilder();
b.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
b.append(direction.name());
b.append("_"); //$NON-NLS-1$
b.append(index);
final String v = prefs.get(b.toString(), null);
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
try {
return getSystemDefault(direction, index);
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
return null;
}
} | java | @Pure
public static String getPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder b = new StringBuilder();
b.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
b.append(direction.name());
b.append("_"); //$NON-NLS-1$
b.append(index);
final String v = prefs.get(b.toString(), null);
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
try {
return getSystemDefault(direction, index);
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
return null;
}
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeValueForTrafficDirection",
"(",
"TrafficDirection",
"direction",
",",
"int",
"index",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
... | Replies the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@return the preferred name for the traffic direction on the roads,
or <code>null</code> if there is no string value for the given index. | [
"Replies",
"the",
"preferred",
"value",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L391-L412 |
jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/status/sources/ManuallyEnteredCommitContextSource.java | ManuallyEnteredCommitContextSource.context | @Override
public String context(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener) {
try {
return new ExpandableMessage(context).expandAll(run, listener);
} catch (Exception e) {
LOG.debug("Can't expand context, returning as is", e);
return context;
}
} | java | @Override
public String context(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener) {
try {
return new ExpandableMessage(context).expandAll(run, listener);
} catch (Exception e) {
LOG.debug("Can't expand context, returning as is", e);
return context;
}
} | [
"@",
"Override",
"public",
"String",
"context",
"(",
"@",
"Nonnull",
"Run",
"<",
"?",
",",
"?",
">",
"run",
",",
"@",
"Nonnull",
"TaskListener",
"listener",
")",
"{",
"try",
"{",
"return",
"new",
"ExpandableMessage",
"(",
"context",
")",
".",
"expandAll"... | Just returns what user entered. Expands env vars and token macro | [
"Just",
"returns",
"what",
"user",
"entered",
".",
"Expands",
"env",
"vars",
"and",
"token",
"macro"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/status/sources/ManuallyEnteredCommitContextSource.java#L38-L46 |
AgNO3/jcifs-ng | src/main/java/jcifs/ntlmssp/Type2Message.java | Type2Message.getDefaultFlags | public static int getDefaultFlags ( CIFSContext tc, Type1Message type1 ) {
if ( type1 == null )
return getDefaultFlags(tc);
int flags = NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION;
int type1Flags = type1.getFlags();
flags |= ( ( type1Flags & NTLMSSP_NEGOTIATE_UNICODE ) != 0 ) ? NTLMSSP_NEGOTIATE_UNICODE : NTLMSSP_NEGOTIATE_OEM;
if ( ( type1Flags & NTLMSSP_REQUEST_TARGET ) != 0 ) {
String domain = tc.getConfig().getDefaultDomain();
if ( domain != null ) {
flags |= NTLMSSP_REQUEST_TARGET | NTLMSSP_TARGET_TYPE_DOMAIN;
}
}
return flags;
} | java | public static int getDefaultFlags ( CIFSContext tc, Type1Message type1 ) {
if ( type1 == null )
return getDefaultFlags(tc);
int flags = NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION;
int type1Flags = type1.getFlags();
flags |= ( ( type1Flags & NTLMSSP_NEGOTIATE_UNICODE ) != 0 ) ? NTLMSSP_NEGOTIATE_UNICODE : NTLMSSP_NEGOTIATE_OEM;
if ( ( type1Flags & NTLMSSP_REQUEST_TARGET ) != 0 ) {
String domain = tc.getConfig().getDefaultDomain();
if ( domain != null ) {
flags |= NTLMSSP_REQUEST_TARGET | NTLMSSP_TARGET_TYPE_DOMAIN;
}
}
return flags;
} | [
"public",
"static",
"int",
"getDefaultFlags",
"(",
"CIFSContext",
"tc",
",",
"Type1Message",
"type1",
")",
"{",
"if",
"(",
"type1",
"==",
"null",
")",
"return",
"getDefaultFlags",
"(",
"tc",
")",
";",
"int",
"flags",
"=",
"NTLMSSP_NEGOTIATE_NTLM",
"|",
"NTLM... | Returns the default flags for a Type-2 message created in response
to the given Type-1 message in the current environment.
@param tc
context to use
@param type1
request message
@return An <code>int</code> containing the default flags. | [
"Returns",
"the",
"default",
"flags",
"for",
"a",
"Type",
"-",
"2",
"message",
"created",
"in",
"response",
"to",
"the",
"given",
"Type",
"-",
"1",
"message",
"in",
"the",
"current",
"environment",
"."
] | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/ntlmssp/Type2Message.java#L217-L230 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/compat/ASpatialDb.java | ASpatialDb.insertGeometry | public void insertGeometry( String tableName, Geometry geometry, String epsg ) throws Exception {
String epsgStr = "4326";
if (epsg == null) {
epsgStr = epsg;
}
GeometryColumn gc = getGeometryColumnsForTable(tableName);
String sql = "INSERT INTO " + tableName + " (" + gc.geometryColumnName + ") VALUES (ST_GeomFromText(?, " + epsgStr + "))";
execOnConnection(connection -> {
try (IHMPreparedStatement pStmt = connection.prepareStatement(sql)) {
pStmt.setString(1, geometry.toText());
pStmt.executeUpdate();
}
return null;
});
} | java | public void insertGeometry( String tableName, Geometry geometry, String epsg ) throws Exception {
String epsgStr = "4326";
if (epsg == null) {
epsgStr = epsg;
}
GeometryColumn gc = getGeometryColumnsForTable(tableName);
String sql = "INSERT INTO " + tableName + " (" + gc.geometryColumnName + ") VALUES (ST_GeomFromText(?, " + epsgStr + "))";
execOnConnection(connection -> {
try (IHMPreparedStatement pStmt = connection.prepareStatement(sql)) {
pStmt.setString(1, geometry.toText());
pStmt.executeUpdate();
}
return null;
});
} | [
"public",
"void",
"insertGeometry",
"(",
"String",
"tableName",
",",
"Geometry",
"geometry",
",",
"String",
"epsg",
")",
"throws",
"Exception",
"{",
"String",
"epsgStr",
"=",
"\"4326\"",
";",
"if",
"(",
"epsg",
"==",
"null",
")",
"{",
"epsgStr",
"=",
"epsg... | Insert a geometry into a table.
@param tableName
the table to use.
@param geometry
the geometry to insert.
@param epsg
the optional epsg.
@throws Exception | [
"Insert",
"a",
"geometry",
"into",
"a",
"table",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/compat/ASpatialDb.java#L193-L210 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java | DefaultRule.apply | @Override
public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) {
boolean defaultPresent = node != null && isNotEmpty(node.asText());
String fieldType = field.type().fullName();
if (defaultPresent && !field.type().isPrimitive() && node.isNull()) {
field.init(JExpr._null());
} else if (fieldType.startsWith(List.class.getName())) {
field.init(getDefaultList(field.type(), node));
} else if (fieldType.startsWith(Set.class.getName())) {
field.init(getDefaultSet(field.type(), node));
} else if (fieldType.startsWith(String.class.getName()) && node != null ) {
field.init(getDefaultValue(field.type(), node));
} else if (defaultPresent) {
field.init(getDefaultValue(field.type(), node));
}
return field;
} | java | @Override
public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) {
boolean defaultPresent = node != null && isNotEmpty(node.asText());
String fieldType = field.type().fullName();
if (defaultPresent && !field.type().isPrimitive() && node.isNull()) {
field.init(JExpr._null());
} else if (fieldType.startsWith(List.class.getName())) {
field.init(getDefaultList(field.type(), node));
} else if (fieldType.startsWith(Set.class.getName())) {
field.init(getDefaultSet(field.type(), node));
} else if (fieldType.startsWith(String.class.getName()) && node != null ) {
field.init(getDefaultValue(field.type(), node));
} else if (defaultPresent) {
field.init(getDefaultValue(field.type(), node));
}
return field;
} | [
"@",
"Override",
"public",
"JFieldVar",
"apply",
"(",
"String",
"nodeName",
",",
"JsonNode",
"node",
",",
"JsonNode",
"parent",
",",
"JFieldVar",
"field",
",",
"Schema",
"currentSchema",
")",
"{",
"boolean",
"defaultPresent",
"=",
"node",
"!=",
"null",
"&&",
... | Applies this schema rule to take the required code generation steps.
<p>
Default values are implemented by assigning an expression to the given
field (so when instances of the generated POJO are created, its fields
will then contain their default values).
<p>
Collections (Lists and Sets) are initialized to an empty collection, even
when no default value is present in the schema (node is null).
@param nodeName
the name of the property which has (or may have) a default
@param node
the default node (may be null if no default node was present
for this property)
@param field
the Java field that has added to a generated type to represent
this property
@return field, which will have an init expression is appropriate | [
"Applies",
"this",
"schema",
"rule",
"to",
"take",
"the",
"required",
"code",
"generation",
"steps",
".",
"<p",
">",
"Default",
"values",
"are",
"implemented",
"by",
"assigning",
"an",
"expression",
"to",
"the",
"given",
"field",
"(",
"so",
"when",
"instance... | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java#L84-L107 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.listConnectionsAsync | public Observable<Page<VirtualNetworkGatewayConnectionListEntityInner>> listConnectionsAsync(final String resourceGroupName, final String virtualNetworkGatewayName) {
return listConnectionsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>, Page<VirtualNetworkGatewayConnectionListEntityInner>>() {
@Override
public Page<VirtualNetworkGatewayConnectionListEntityInner> call(ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<VirtualNetworkGatewayConnectionListEntityInner>> listConnectionsAsync(final String resourceGroupName, final String virtualNetworkGatewayName) {
return listConnectionsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>, Page<VirtualNetworkGatewayConnectionListEntityInner>>() {
@Override
public Page<VirtualNetworkGatewayConnectionListEntityInner> call(ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"VirtualNetworkGatewayConnectionListEntityInner",
">",
">",
"listConnectionsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"listConnectionsWithServiceRespo... | Gets all the connections in a virtual network gateway.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkGatewayConnectionListEntityInner> object | [
"Gets",
"all",
"the",
"connections",
"in",
"a",
"virtual",
"network",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1077-L1085 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java | JMElasticsearchSearchAndCount.searchAllWithTargetCount | public SearchResponse searchAllWithTargetCount(String index, String type,
AggregationBuilder[] aggregationBuilders) {
return searchAllWithTargetCount(index, type, null, aggregationBuilders);
} | java | public SearchResponse searchAllWithTargetCount(String index, String type,
AggregationBuilder[] aggregationBuilders) {
return searchAllWithTargetCount(index, type, null, aggregationBuilders);
} | [
"public",
"SearchResponse",
"searchAllWithTargetCount",
"(",
"String",
"index",
",",
"String",
"type",
",",
"AggregationBuilder",
"[",
"]",
"aggregationBuilders",
")",
"{",
"return",
"searchAllWithTargetCount",
"(",
"index",
",",
"type",
",",
"null",
",",
"aggregati... | Search all with target count search response.
@param index the index
@param type the type
@param aggregationBuilders the aggregation builders
@return the search response | [
"Search",
"all",
"with",
"target",
"count",
"search",
"response",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L664-L667 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java | SwingBindingFactory.createBoundList | public Binding createBoundList(String selectionFormProperty, Object selectableItems,
String renderedProperty, Integer forceSelectMode) {
final Map context = new HashMap();
if (forceSelectMode != null) {
context.put(ListBinder.SELECTION_MODE_KEY, forceSelectMode);
}
context.put(ListBinder.SELECTABLE_ITEMS_KEY, selectableItems);
if (renderedProperty != null) {
context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
}
return createBinding(JList.class, selectionFormProperty, context);
} | java | public Binding createBoundList(String selectionFormProperty, Object selectableItems,
String renderedProperty, Integer forceSelectMode) {
final Map context = new HashMap();
if (forceSelectMode != null) {
context.put(ListBinder.SELECTION_MODE_KEY, forceSelectMode);
}
context.put(ListBinder.SELECTABLE_ITEMS_KEY, selectableItems);
if (renderedProperty != null) {
context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
}
return createBinding(JList.class, selectionFormProperty, context);
} | [
"public",
"Binding",
"createBoundList",
"(",
"String",
"selectionFormProperty",
",",
"Object",
"selectableItems",
",",
"String",
"renderedProperty",
",",
"Integer",
"forceSelectMode",
")",
"{",
"final",
"Map",
"context",
"=",
"new",
"HashMap",
"(",
")",
";",
"if",... | Binds the value(s) specified in <code>selectableItems</code> to
a {@link JList}, with any
user selection being placed in the form property referred to by
<code>selectionFormProperty</code>. Each item in the list will be
rendered by looking up a property on the item by the name contained
in <code>renderedProperty</code>, retrieving the value of the property,
and rendering that value in the UI. Note that the selection in the
bound list will track any changes to the
<code>selectionFormProperty</code>. This is especially useful to
preselect items in the list - if <code>selectionFormProperty</code>
is not empty when the list is bound, then its content will be used
for the initial selection.
@param selectionFormProperty form property to hold user's selection.
This property must either be compatible
with the item objects contained in
<code>selectableItemsHolder</code> (in
which case only single selection makes
sense), or must be a
<code>Collection</code> type, which allows
for multiple selection.
@param selectableItems <code>Object</code> containing the
item(s) with which to populate the list.
Can be an instance Collection, Object[],
a ValueModel or Object
@param renderedProperty the property to be queried for each item
in the list, the result of which will be
used to render that item in the UI.
May be null, in which case the selectable
items will be rendered as strings.
@param forceSelectMode forces the list selection mode. Must be
one of the constants defined in
{@link javax.swing.ListSelectionModel} or
<code>null</code> for default behavior.
If <code>null</code>, then
{@link javax.swing.ListSelectionModel#MULTIPLE_INTERVAL_SELECTION}
will be used if
<code>selectionFormProperty</code> refers
to a {@link java.util.Collection} type
property, otherwise
{@link javax.swing.ListSelectionModel#SINGLE_SELECTION}
will be used.
@return | [
"Binds",
"the",
"value",
"(",
"s",
")",
"specified",
"in",
"<code",
">",
"selectableItems<",
"/",
"code",
">",
"to",
"a",
"{",
"@link",
"JList",
"}",
"with",
"any",
"user",
"selection",
"being",
"placed",
"in",
"the",
"form",
"property",
"referred",
"to"... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java#L310-L322 |
lucee/Lucee | core/src/main/java/lucee/transformer/cfml/script/AbstrCFMLScriptTransformer.java | AbstrCFMLScriptTransformer.returnStatement | private final Return returnStatement(Data data) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoVarExt("return")) return null;
Position line = data.srcCode.getPosition();
Return rtn;
comments(data);
if (checkSemiColonLineFeed(data, false, false, false)) rtn = new Return(data.factory, line, data.srcCode.getPosition());
else {
Expression expr = expression(data);
checkSemiColonLineFeed(data, true, true, false);
rtn = new Return(expr, line, data.srcCode.getPosition());
}
comments(data);
return rtn;
} | java | private final Return returnStatement(Data data) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoVarExt("return")) return null;
Position line = data.srcCode.getPosition();
Return rtn;
comments(data);
if (checkSemiColonLineFeed(data, false, false, false)) rtn = new Return(data.factory, line, data.srcCode.getPosition());
else {
Expression expr = expression(data);
checkSemiColonLineFeed(data, true, true, false);
rtn = new Return(expr, line, data.srcCode.getPosition());
}
comments(data);
return rtn;
} | [
"private",
"final",
"Return",
"returnStatement",
"(",
"Data",
"data",
")",
"throws",
"TemplateException",
"{",
"if",
"(",
"!",
"data",
".",
"srcCode",
".",
"forwardIfCurrentAndNoVarExt",
"(",
"\"return\"",
")",
")",
"return",
"null",
";",
"Position",
"line",
"... | Liest ein return Statement ein. <br />
EBNF:<br />
<code>spaces expressionStatement spaces;</code>
@return return Statement
@throws TemplateException | [
"Liest",
"ein",
"return",
"Statement",
"ein",
".",
"<br",
"/",
">",
"EBNF",
":",
"<br",
"/",
">",
"<code",
">",
"spaces",
"expressionStatement",
"spaces",
";",
"<",
"/",
"code",
">"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/script/AbstrCFMLScriptTransformer.java#L1760-L1776 |
ironjacamar/ironjacamar | tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java | HTMLReport.writeString | static void writeString(FileWriter fw, String s) throws Exception
{
for (int i = 0; i < s.length(); i++)
{
fw.write((int)s.charAt(i));
}
} | java | static void writeString(FileWriter fw, String s) throws Exception
{
for (int i = 0; i < s.length(); i++)
{
fw.write((int)s.charAt(i));
}
} | [
"static",
"void",
"writeString",
"(",
"FileWriter",
"fw",
",",
"String",
"s",
")",
"throws",
"Exception",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"fw",
".",
"write",
"(",
"("... | Write string
@param fw The file writer
@param s The string
@exception Exception If an error occurs | [
"Write",
"string"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java#L52-L58 |
leancloud/java-sdk-all | android-sdk/storage-android/src/main/java/cn/leancloud/AVManifestUtils.java | AVManifestUtils.checkPermission | public static boolean checkPermission(Context context, String permission) {
boolean hasPermission =
(PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(permission));
if (!hasPermission) {
printErrorLog("permission " + permission + " is missing!");
}
return hasPermission;
} | java | public static boolean checkPermission(Context context, String permission) {
boolean hasPermission =
(PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(permission));
if (!hasPermission) {
printErrorLog("permission " + permission + " is missing!");
}
return hasPermission;
} | [
"public",
"static",
"boolean",
"checkPermission",
"(",
"Context",
"context",
",",
"String",
"permission",
")",
"{",
"boolean",
"hasPermission",
"=",
"(",
"PackageManager",
".",
"PERMISSION_GRANTED",
"==",
"context",
".",
"checkCallingOrSelfPermission",
"(",
"permissio... | 判断 Mainifest 中是否包含对应到 permission
如有,则返回 true,反之,则返回 false 并输出日志
@param context
@param permission
@return | [
"判断",
"Mainifest",
"中是否包含对应到",
"permission",
"如有,则返回",
"true,反之,则返回",
"false",
"并输出日志"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/storage-android/src/main/java/cn/leancloud/AVManifestUtils.java#L28-L35 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/argparser/ClassFinder.java | ClassFinder.scanDir | protected void scanDir(final File file, final String path) {
for ( final File child: file.listFiles() ) {
final String newPath = (path==null ? child.getName() : path + '/' + child.getName() );
if ( child.isDirectory() ) {
scanDir(child, newPath);
}
else {
handleItem(newPath);
}
}
} | java | protected void scanDir(final File file, final String path) {
for ( final File child: file.listFiles() ) {
final String newPath = (path==null ? child.getName() : path + '/' + child.getName() );
if ( child.isDirectory() ) {
scanDir(child, newPath);
}
else {
handleItem(newPath);
}
}
} | [
"protected",
"void",
"scanDir",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"path",
")",
"{",
"for",
"(",
"final",
"File",
"child",
":",
"file",
".",
"listFiles",
"(",
")",
")",
"{",
"final",
"String",
"newPath",
"=",
"(",
"path",
"==",
"nu... | Scans a directory on the filesystem for classes.
@param file the directory or file to examine
@param path the package path acculmulated so far (e.g. edu/mit/broad) | [
"Scans",
"a",
"directory",
"on",
"the",
"filesystem",
"for",
"classes",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/ClassFinder.java#L124-L134 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java | ConfigurationReader.parseInputConfig | private void parseInputConfig(final Node node, final ConfigSettings config)
{
String name, value;
Node nnode;
NodeList list = node.getChildNodes();
int length = list.getLength();
for (int i = 0; i < length; i++) {
nnode = list.item(i);
name = nnode.getNodeName().toUpperCase();
if (name.equals(KEY_WIKIPEDIA_ENCODING)) {
value = nnode.getChildNodes().item(0).getNodeValue();
config.setConfigParameter(ConfigurationKeys.WIKIPEDIA_ENCODING,
value);
}
else if (name.equals(KEY_MODE_SURROGATES)) {
SurrogateModes oValue = SurrogateModes.parse(nnode
.getChildNodes().item(0).getNodeValue());
config.setConfigParameter(ConfigurationKeys.MODE_SURROGATES,
oValue);
}
else if (name.equals(SUBSECTION_ARCHIVE)) {
parseInputArchive(nnode, config);
}
}
} | java | private void parseInputConfig(final Node node, final ConfigSettings config)
{
String name, value;
Node nnode;
NodeList list = node.getChildNodes();
int length = list.getLength();
for (int i = 0; i < length; i++) {
nnode = list.item(i);
name = nnode.getNodeName().toUpperCase();
if (name.equals(KEY_WIKIPEDIA_ENCODING)) {
value = nnode.getChildNodes().item(0).getNodeValue();
config.setConfigParameter(ConfigurationKeys.WIKIPEDIA_ENCODING,
value);
}
else if (name.equals(KEY_MODE_SURROGATES)) {
SurrogateModes oValue = SurrogateModes.parse(nnode
.getChildNodes().item(0).getNodeValue());
config.setConfigParameter(ConfigurationKeys.MODE_SURROGATES,
oValue);
}
else if (name.equals(SUBSECTION_ARCHIVE)) {
parseInputArchive(nnode, config);
}
}
} | [
"private",
"void",
"parseInputConfig",
"(",
"final",
"Node",
"node",
",",
"final",
"ConfigSettings",
"config",
")",
"{",
"String",
"name",
",",
"value",
";",
"Node",
"nnode",
";",
"NodeList",
"list",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"int",... | Parses the input parameter section.
@param node
Reference to the current used xml node
@param config
Reference to the ConfigSettings | [
"Parses",
"the",
"input",
"parameter",
"section",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java#L405-L438 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/spout/AmBaseSpout.java | AmBaseSpout.emitWithNoKeyIdAndGroupingStream | protected void emitWithNoKeyIdAndGroupingStream(StreamMessage message, String groupingKey,
String streamId)
{
this.getCollector().emit(streamId, new Values(groupingKey, message));
} | java | protected void emitWithNoKeyIdAndGroupingStream(StreamMessage message, String groupingKey,
String streamId)
{
this.getCollector().emit(streamId, new Values(groupingKey, message));
} | [
"protected",
"void",
"emitWithNoKeyIdAndGroupingStream",
"(",
"StreamMessage",
"message",
",",
"String",
"groupingKey",
",",
"String",
"streamId",
")",
"{",
"this",
".",
"getCollector",
"(",
")",
".",
"emit",
"(",
"streamId",
",",
"new",
"Values",
"(",
"grouping... | Not use this class's key history function, and not use MessageId(Id identify by storm).<br>
Send message to downstream component with grouping key and streamId.<br>
Use following situation.
<ol>
<li>Not use this class's key history function.</li>
<li>Not use storm's fault detect function.</li>
</ol>
@param message sending message
@param groupingKey grouping key
@param streamId streamId | [
"Not",
"use",
"this",
"class",
"s",
"key",
"history",
"function",
"and",
"not",
"use",
"MessageId",
"(",
"Id",
"identify",
"by",
"storm",
")",
".",
"<br",
">",
"Send",
"message",
"to",
"downstream",
"component",
"with",
"grouping",
"key",
"and",
"streamId"... | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L407-L411 |
knowm/Sundial | src/main/java/org/quartz/QuartzScheduler.java | QuartzScheduler.triggerJob | @Override
public void triggerJob(String jobKey, JobDataMap data) throws SchedulerException {
validateState();
OperableTrigger operableTrigger =
simpleTriggerBuilder()
.withIdentity(jobKey + "-trigger")
.forJob(jobKey)
.startAt(new Date())
.build();
// OperableTrigger operableTrigger = TriggerBuilder.newTriggerBuilder().withIdentity(jobKey +
// "-trigger").forJob(jobKey)
//
// .withTriggerImplementation(SimpleScheduleBuilder.simpleScheduleBuilderBuilder().instantiate()).startAt(new Date()).build();
// TODO what does this accomplish??? Seems to sets it's next fire time internally
operableTrigger.computeFirstFireTime(null);
if (data != null) {
operableTrigger.setJobDataMap(data);
}
boolean collision = true;
while (collision) {
try {
quartzSchedulerResources.getJobStore().storeTrigger(operableTrigger, false);
collision = false;
} catch (ObjectAlreadyExistsException oaee) {
operableTrigger.setName(newTriggerId());
}
}
notifySchedulerThread(operableTrigger.getNextFireTime().getTime());
notifySchedulerListenersScheduled(operableTrigger);
} | java | @Override
public void triggerJob(String jobKey, JobDataMap data) throws SchedulerException {
validateState();
OperableTrigger operableTrigger =
simpleTriggerBuilder()
.withIdentity(jobKey + "-trigger")
.forJob(jobKey)
.startAt(new Date())
.build();
// OperableTrigger operableTrigger = TriggerBuilder.newTriggerBuilder().withIdentity(jobKey +
// "-trigger").forJob(jobKey)
//
// .withTriggerImplementation(SimpleScheduleBuilder.simpleScheduleBuilderBuilder().instantiate()).startAt(new Date()).build();
// TODO what does this accomplish??? Seems to sets it's next fire time internally
operableTrigger.computeFirstFireTime(null);
if (data != null) {
operableTrigger.setJobDataMap(data);
}
boolean collision = true;
while (collision) {
try {
quartzSchedulerResources.getJobStore().storeTrigger(operableTrigger, false);
collision = false;
} catch (ObjectAlreadyExistsException oaee) {
operableTrigger.setName(newTriggerId());
}
}
notifySchedulerThread(operableTrigger.getNextFireTime().getTime());
notifySchedulerListenersScheduled(operableTrigger);
} | [
"@",
"Override",
"public",
"void",
"triggerJob",
"(",
"String",
"jobKey",
",",
"JobDataMap",
"data",
")",
"throws",
"SchedulerException",
"{",
"validateState",
"(",
")",
";",
"OperableTrigger",
"operableTrigger",
"=",
"simpleTriggerBuilder",
"(",
")",
".",
"withId... | Trigger the identified <code>{@link org.quartz.jobs.Job}</code> (execute it now) - with a
non-volatile trigger. | [
"Trigger",
"the",
"identified",
"<code",
">",
"{"
] | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/quartz/QuartzScheduler.java#L581-L617 |
Comcast/jrugged | jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java | DiscreteInterval.minus | public DiscreteInterval minus(DiscreteInterval other) {
return new DiscreteInterval(this.min - other.max, this.max - other.min);
} | java | public DiscreteInterval minus(DiscreteInterval other) {
return new DiscreteInterval(this.min - other.max, this.max - other.min);
} | [
"public",
"DiscreteInterval",
"minus",
"(",
"DiscreteInterval",
"other",
")",
"{",
"return",
"new",
"DiscreteInterval",
"(",
"this",
".",
"min",
"-",
"other",
".",
"max",
",",
"this",
".",
"max",
"-",
"other",
".",
"min",
")",
";",
"}"
] | Returns an interval representing the subtraction of the
given interval from this one.
@param other interval to subtract from this one
@return result of subtraction | [
"Returns",
"an",
"interval",
"representing",
"the",
"subtraction",
"of",
"the",
"given",
"interval",
"from",
"this",
"one",
"."
] | train | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java#L91-L93 |
apache/incubator-gobblin | gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java | HiveAvroSerDeManager.addSerDeProperties | @Override
public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException {
Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory.");
Schema schema;
try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) {
schema = getDirectorySchema(path);
}
if (schema == null) {
return;
}
hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName());
hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName());
hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName());
addSchemaProperties(path, hiveUnit, schema);
} | java | @Override
public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException {
Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory.");
Schema schema;
try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) {
schema = getDirectorySchema(path);
}
if (schema == null) {
return;
}
hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName());
hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName());
hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName());
addSchemaProperties(path, hiveUnit, schema);
} | [
"@",
"Override",
"public",
"void",
"addSerDeProperties",
"(",
"Path",
"path",
",",
"HiveRegistrationUnit",
"hiveUnit",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"this",
".",
"fs",
".",
"getFileStatus",
"(",
"path",
")",
".",
... | Add an Avro {@link Schema} to the given {@link HiveRegistrationUnit}.
<p>
If {@link #USE_SCHEMA_FILE} is true, the schema will be added via {@link #SCHEMA_URL} pointing to
the schema file named {@link #SCHEMA_FILE_NAME}.
</p>
<p>
If {@link #USE_SCHEMA_FILE} is false, the schema will be obtained by {@link #getDirectorySchema(Path)}.
If the length of the schema is less than {@link #SCHEMA_LITERAL_LENGTH_LIMIT}, it will be added via
{@link #SCHEMA_LITERAL}. Otherwise, the schema will be written to {@link #SCHEMA_FILE_NAME} and added
via {@link #SCHEMA_URL}.
</p> | [
"Add",
"an",
"Avro",
"{",
"@link",
"Schema",
"}",
"to",
"the",
"given",
"{",
"@link",
"HiveRegistrationUnit",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/avro/HiveAvroSerDeManager.java#L112-L127 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSecretAsync | public Observable<DeletedSecretBundle> getDeletedSecretAsync(String vaultBaseUrl, String secretName) {
return getDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<DeletedSecretBundle>, DeletedSecretBundle>() {
@Override
public DeletedSecretBundle call(ServiceResponse<DeletedSecretBundle> response) {
return response.body();
}
});
} | java | public Observable<DeletedSecretBundle> getDeletedSecretAsync(String vaultBaseUrl, String secretName) {
return getDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<DeletedSecretBundle>, DeletedSecretBundle>() {
@Override
public DeletedSecretBundle call(ServiceResponse<DeletedSecretBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeletedSecretBundle",
">",
"getDeletedSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
")",
"{",
"return",
"getDeletedSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretName",
")",
".",
"map",
"(",
... | Gets the specified deleted secret.
The Get Deleted Secret operation returns the specified deleted secret along with its attributes. This operation requires the secrets/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedSecretBundle object | [
"Gets",
"the",
"specified",
"deleted",
"secret",
".",
"The",
"Get",
"Deleted",
"Secret",
"operation",
"returns",
"the",
"specified",
"deleted",
"secret",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"get",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4670-L4677 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.removeControlListener | public boolean removeControlListener(String name, Widget.OnTouchListener listener) {
Widget control = findChildByName(name);
if (control != null) {
return control.removeTouchListener(listener);
}
return false;
} | java | public boolean removeControlListener(String name, Widget.OnTouchListener listener) {
Widget control = findChildByName(name);
if (control != null) {
return control.removeTouchListener(listener);
}
return false;
} | [
"public",
"boolean",
"removeControlListener",
"(",
"String",
"name",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"return",
"con... | Remove a touch listener for the button specified by {@code name}.
@param name The {@linkplain Widget#getName() name} of the button to listen to
@param listener A valid listener or null to clear | [
"Remove",
"a",
"touch",
"listener",
"for",
"the",
"button",
"specified",
"by",
"{",
"@code",
"name",
"}",
".",
"@param",
"name",
"The",
"{",
"@linkplain",
"Widget#getName",
"()",
"name",
"}",
"of",
"the",
"button",
"to",
"listen",
"to",
"@param",
"listener... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L246-L252 |
threerings/nenya | core/src/main/java/com/threerings/miso/util/MisoUtil.java | MisoUtil.getTilePolygon | public static Polygon getTilePolygon (
MisoSceneMetrics metrics, int x, int y)
{
return getFootprintPolygon(metrics, x, y, 1, 1);
} | java | public static Polygon getTilePolygon (
MisoSceneMetrics metrics, int x, int y)
{
return getFootprintPolygon(metrics, x, y, 1, 1);
} | [
"public",
"static",
"Polygon",
"getTilePolygon",
"(",
"MisoSceneMetrics",
"metrics",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"return",
"getFootprintPolygon",
"(",
"metrics",
",",
"x",
",",
"y",
",",
"1",
",",
"1",
")",
";",
"}"
] | Return a polygon framing the specified tile.
@param x the tile x-position coordinate.
@param y the tile y-position coordinate. | [
"Return",
"a",
"polygon",
"framing",
"the",
"specified",
"tile",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L407-L411 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/Pager.java | Pager.getIntHeaderValue | private int getIntHeaderValue(Response response, String key) throws GitLabApiException {
String value = getHeaderValue(response, key);
if (value == null) {
return -1;
}
try {
return (Integer.parseInt(value));
} catch (NumberFormatException nfe) {
throw new GitLabApiException("Invalid '" + key + "' header value (" + value + ") from server");
}
} | java | private int getIntHeaderValue(Response response, String key) throws GitLabApiException {
String value = getHeaderValue(response, key);
if (value == null) {
return -1;
}
try {
return (Integer.parseInt(value));
} catch (NumberFormatException nfe) {
throw new GitLabApiException("Invalid '" + key + "' header value (" + value + ") from server");
}
} | [
"private",
"int",
"getIntHeaderValue",
"(",
"Response",
"response",
",",
"String",
"key",
")",
"throws",
"GitLabApiException",
"{",
"String",
"value",
"=",
"getHeaderValue",
"(",
"response",
",",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
... | Get the specified integer header value from the Response instance.
@param response the Response instance to get the value from
@param key the HTTP header key to get the value for
@return the specified integer header value from the Response instance, or -1 if the header is not present
@throws GitLabApiException if any error occurs | [
"Get",
"the",
"specified",
"integer",
"header",
"value",
"from",
"the",
"Response",
"instance",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/Pager.java#L158-L170 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java | HttpAuthServiceBuilder.addBasicAuth | public HttpAuthServiceBuilder addBasicAuth(Authorizer<? super BasicToken> authorizer, AsciiString header) {
return addTokenAuthorizer(new BasicTokenExtractor(requireNonNull(header, "header")),
requireNonNull(authorizer, "authorizer"));
} | java | public HttpAuthServiceBuilder addBasicAuth(Authorizer<? super BasicToken> authorizer, AsciiString header) {
return addTokenAuthorizer(new BasicTokenExtractor(requireNonNull(header, "header")),
requireNonNull(authorizer, "authorizer"));
} | [
"public",
"HttpAuthServiceBuilder",
"addBasicAuth",
"(",
"Authorizer",
"<",
"?",
"super",
"BasicToken",
">",
"authorizer",
",",
"AsciiString",
"header",
")",
"{",
"return",
"addTokenAuthorizer",
"(",
"new",
"BasicTokenExtractor",
"(",
"requireNonNull",
"(",
"header",
... | Adds an HTTP basic {@link Authorizer} for the given {@code header}. | [
"Adds",
"an",
"HTTP",
"basic",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java#L85-L88 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.removeByUUID_G | @Override
public CommerceTierPriceEntry removeByUUID_G(String uuid, long groupId)
throws NoSuchTierPriceEntryException {
CommerceTierPriceEntry commerceTierPriceEntry = findByUUID_G(uuid,
groupId);
return remove(commerceTierPriceEntry);
} | java | @Override
public CommerceTierPriceEntry removeByUUID_G(String uuid, long groupId)
throws NoSuchTierPriceEntryException {
CommerceTierPriceEntry commerceTierPriceEntry = findByUUID_G(uuid,
groupId);
return remove(commerceTierPriceEntry);
} | [
"@",
"Override",
"public",
"CommerceTierPriceEntry",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchTierPriceEntryException",
"{",
"CommerceTierPriceEntry",
"commerceTierPriceEntry",
"=",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",... | Removes the commerce tier price entry where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the commerce tier price entry that was removed | [
"Removes",
"the",
"commerce",
"tier",
"price",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L818-L825 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.drawImage | public void drawImage(Image image, float x, float y, Color col) {
predraw();
image.draw(x, y, col);
currentColor.bind();
postdraw();
} | java | public void drawImage(Image image, float x, float y, Color col) {
predraw();
image.draw(x, y, col);
currentColor.bind();
postdraw();
} | [
"public",
"void",
"drawImage",
"(",
"Image",
"image",
",",
"float",
"x",
",",
"float",
"y",
",",
"Color",
"col",
")",
"{",
"predraw",
"(",
")",
";",
"image",
".",
"draw",
"(",
"x",
",",
"y",
",",
"col",
")",
";",
"currentColor",
".",
"bind",
"(",... | Draw an image to the screen
@param image
The image to draw to the screen
@param x
The x location at which to draw the image
@param y
The y location at which to draw the image
@param col
The color to apply to the image as a filter | [
"Draw",
"an",
"image",
"to",
"the",
"screen"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1382-L1387 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java | Cipher.getInstance | public static final Cipher getInstance(String transformation,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException,
NoSuchPaddingException
{
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("Missing provider");
}
Provider p = Security.getProvider(provider);
if (p == null) {
throw new NoSuchProviderException("No such provider: " +
provider);
}
return createCipher(transformation, p);
} | java | public static final Cipher getInstance(String transformation,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException,
NoSuchPaddingException
{
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("Missing provider");
}
Provider p = Security.getProvider(provider);
if (p == null) {
throw new NoSuchProviderException("No such provider: " +
provider);
}
return createCipher(transformation, p);
} | [
"public",
"static",
"final",
"Cipher",
"getInstance",
"(",
"String",
"transformation",
",",
"String",
"provider",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
",",
"NoSuchPaddingException",
"{",
"if",
"(",
"(",
"provider",
"==",
"null",
... | Returns a <code>Cipher</code> object that implements the specified
transformation.
<p> A new Cipher object encapsulating the
CipherSpi implementation from the specified provider
is returned. The specified provider must be registered
in the security provider list.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param transformation the name of the transformation,
e.g., <i>DES/CBC/PKCS5Padding</i>.
See the Cipher section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Cipher">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard transformation names.
@param provider the name of the provider.
@return a cipher that implements the requested transformation.
@exception NoSuchAlgorithmException if <code>transformation</code>
is null, empty, in an invalid format,
or if a CipherSpi implementation for the specified algorithm
is not available from the specified provider.
@exception NoSuchProviderException if the specified provider is not
registered in the security provider list.
@exception NoSuchPaddingException if <code>transformation</code>
contains a padding scheme that is not available.
@exception IllegalArgumentException if the <code>provider</code>
is null or empty.
@see java.security.Provider | [
"Returns",
"a",
"<code",
">",
"Cipher<",
"/",
"code",
">",
"object",
"that",
"implements",
"the",
"specified",
"transformation",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java#L852-L866 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java | ConfigRestClientUtil.executeHttp | public String executeHttp(String path, String templateName,Map params, String action) throws ElasticSearchException{
return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, params), action);
} | java | public String executeHttp(String path, String templateName,Map params, String action) throws ElasticSearchException{
return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, params), action);
} | [
"public",
"String",
"executeHttp",
"(",
"String",
"path",
",",
"String",
"templateName",
",",
"Map",
"params",
",",
"String",
"action",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"super",
".",
"executeHttp",
"(",
"path",
",",
"ESTemplateHelper",
"."... | 发送es restful请求,获取String类型json报文
@param path
@param templateName 请求报文
@param action get,post,put,delete
@return
@throws ElasticSearchException | [
"发送es",
"restful请求,获取String类型json报文"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L367-L369 |
aws/aws-sdk-java | src/samples/AmazonEC2SpotInstances-Advanced/GettingStartedApp.java | GettingStartedApp.main | public static void main(String[] args) throws Exception {
System.out.println("===========================================");
System.out.println("Welcome to the AWS Java SDK!");
System.out.println("===========================================");
/*
* Amazon EC2
*
* The AWS EC2 client allows you to create, delete, and administer
* instances programmatically.
*
* In this sample, we use an EC2 client to submit a Spot request,
* wait for it to reach the active state, and then cancel and terminate
* the associated instance.
*/
try {
// Setup the helper object that will perform all of the API calls.
Requests requests = new Requests("t1.micro","ami-8c1fece5","0.03","GettingStartedGroup");
// Submit all of the requests.
requests.submitRequests();
// Create the list of tags we want to create and tag any associated requests.
ArrayList<Tag> tags = new ArrayList<Tag>();
tags.add(new Tag("keyname1","value1"));
requests.tagRequests(tags);
// Initialize the timer to now.
Calendar startTimer = Calendar.getInstance();
Calendar nowTimer = null;
// Loop through all of the requests until all bids are in the active state
// (or at least not in the open state).
do
{
// Sleep for 60 seconds.
Thread.sleep(SLEEP_CYCLE);
// Initialize the timer to now, and then subtract 15 minutes, so we can
// compare to see if we have exceeded 15 minutes compared to the startTime.
nowTimer = Calendar.getInstance();
nowTimer.add(Calendar.MINUTE, -15);
} while (requests.areAnyOpen() && !nowTimer.after(startTimer));
// If we couldn't launch Spot within the timeout period, then we should launch an On-Demand
// Instance.
if (nowTimer.after(startTimer)) {
// Cancel all requests because we timed out.
requests.cleanup();
// Launch On-Demand instances instead
requests.launchOnDemand();
}
// Tag any created instances.
requests.tagInstances(tags);
// Cancel all requests and terminate all running instances.
requests.cleanup();
} catch (AmazonServiceException ase) {
// Write out any exceptions that may have occurred.
System.out.println("Caught Exception: " + ase.getMessage());
System.out.println("Reponse Status Code: " + ase.getStatusCode());
System.out.println("Error Code: " + ase.getErrorCode());
System.out.println("Request ID: " + ase.getRequestId());
}
} | java | public static void main(String[] args) throws Exception {
System.out.println("===========================================");
System.out.println("Welcome to the AWS Java SDK!");
System.out.println("===========================================");
/*
* Amazon EC2
*
* The AWS EC2 client allows you to create, delete, and administer
* instances programmatically.
*
* In this sample, we use an EC2 client to submit a Spot request,
* wait for it to reach the active state, and then cancel and terminate
* the associated instance.
*/
try {
// Setup the helper object that will perform all of the API calls.
Requests requests = new Requests("t1.micro","ami-8c1fece5","0.03","GettingStartedGroup");
// Submit all of the requests.
requests.submitRequests();
// Create the list of tags we want to create and tag any associated requests.
ArrayList<Tag> tags = new ArrayList<Tag>();
tags.add(new Tag("keyname1","value1"));
requests.tagRequests(tags);
// Initialize the timer to now.
Calendar startTimer = Calendar.getInstance();
Calendar nowTimer = null;
// Loop through all of the requests until all bids are in the active state
// (or at least not in the open state).
do
{
// Sleep for 60 seconds.
Thread.sleep(SLEEP_CYCLE);
// Initialize the timer to now, and then subtract 15 minutes, so we can
// compare to see if we have exceeded 15 minutes compared to the startTime.
nowTimer = Calendar.getInstance();
nowTimer.add(Calendar.MINUTE, -15);
} while (requests.areAnyOpen() && !nowTimer.after(startTimer));
// If we couldn't launch Spot within the timeout period, then we should launch an On-Demand
// Instance.
if (nowTimer.after(startTimer)) {
// Cancel all requests because we timed out.
requests.cleanup();
// Launch On-Demand instances instead
requests.launchOnDemand();
}
// Tag any created instances.
requests.tagInstances(tags);
// Cancel all requests and terminate all running instances.
requests.cleanup();
} catch (AmazonServiceException ase) {
// Write out any exceptions that may have occurred.
System.out.println("Caught Exception: " + ase.getMessage());
System.out.println("Reponse Status Code: " + ase.getStatusCode());
System.out.println("Error Code: " + ase.getErrorCode());
System.out.println("Request ID: " + ase.getRequestId());
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"===========================================\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Welcome ... | /*
Before running the code:
Fill in your AWS access credentials in the provided credentials
file template, and be sure to move the file to the default location
(~/.aws/credentials) where the sample code will load the
credentials from.
https://console.aws.amazon.com/iam/home?#security_credential
WARNING:
To avoid accidental leakage of your credentials, DO NOT keep
the credentials file in your source directory. | [
"/",
"*",
"Before",
"running",
"the",
"code",
":",
"Fill",
"in",
"your",
"AWS",
"access",
"credentials",
"in",
"the",
"provided",
"credentials",
"file",
"template",
"and",
"be",
"sure",
"to",
"move",
"the",
"file",
"to",
"the",
"default",
"location",
"(",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/src/samples/AmazonEC2SpotInstances-Advanced/GettingStartedApp.java#L57-L125 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Annotations.java | Annotations.playsAll | public static boolean playsAll(Role role, String... r) {
if (role == null) {
return false;
}
for (String s : r) {
if (!role.value().contains(s)) {
return false;
}
}
return true;
} | java | public static boolean playsAll(Role role, String... r) {
if (role == null) {
return false;
}
for (String s : r) {
if (!role.value().contains(s)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"playsAll",
"(",
"Role",
"role",
",",
"String",
"...",
"r",
")",
"{",
"if",
"(",
"role",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"String",
"s",
":",
"r",
")",
"{",
"if",
"(",
"!",
"role",
... | Checks if all roles are played.
@param role the role to check.
@param r the roles that all have to be played
@return true or false. | [
"Checks",
"if",
"all",
"roles",
"are",
"played",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Annotations.java#L25-L35 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3URI.java | AmazonS3URI.preprocessUrlStr | private static String preprocessUrlStr(final String str, final boolean encode) {
if (encode) {
try {
return (URLEncoder.encode(str, "UTF-8")
.replace("%3A", ":")
.replace("%2F", "/")
.replace("+", "%20"));
} catch (UnsupportedEncodingException e) {
// This should never happen unless there is something
// fundamentally broken with the running JVM.
throw new RuntimeException(e);
}
}
return str;
} | java | private static String preprocessUrlStr(final String str, final boolean encode) {
if (encode) {
try {
return (URLEncoder.encode(str, "UTF-8")
.replace("%3A", ":")
.replace("%2F", "/")
.replace("+", "%20"));
} catch (UnsupportedEncodingException e) {
// This should never happen unless there is something
// fundamentally broken with the running JVM.
throw new RuntimeException(e);
}
}
return str;
} | [
"private",
"static",
"String",
"preprocessUrlStr",
"(",
"final",
"String",
"str",
",",
"final",
"boolean",
"encode",
")",
"{",
"if",
"(",
"encode",
")",
"{",
"try",
"{",
"return",
"(",
"URLEncoder",
".",
"encode",
"(",
"str",
",",
"\"UTF-8\"",
")",
".",
... | URL encodes the given string. This allows us to pass special characters
that would otherwise be rejected when building a URI instance. Because we
need to retain the URI's path structure we subsequently need to replace
percent encoded path delimiters back to their decoded counterparts.
@param str the string to encode
@return the encoded string | [
"URL",
"encodes",
"the",
"given",
"string",
".",
"This",
"allows",
"us",
"to",
"pass",
"special",
"characters",
"that",
"would",
"otherwise",
"be",
"rejected",
"when",
"building",
"a",
"URI",
"instance",
".",
"Because",
"we",
"need",
"to",
"retain",
"the",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3URI.java#L258-L272 |
whitesource/agents | wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java | RequestFactory.newUpdateInventoryRequest | @Deprecated
public UpdateInventoryRequest newUpdateInventoryRequest(String orgToken,
UpdateType updateType,
String requesterEmail,
String product,
String productVersion,
Collection<AgentProjectInfo> projects,
String userKey,
String logData) {
UpdateInventoryRequest updateInventoryRequest = new UpdateInventoryRequest(projects, updateType);
return (UpdateInventoryRequest) prepareRequest(updateInventoryRequest, orgToken, requesterEmail, product, productVersion, userKey,
false, false, null, null, logData, null, null, null);
} | java | @Deprecated
public UpdateInventoryRequest newUpdateInventoryRequest(String orgToken,
UpdateType updateType,
String requesterEmail,
String product,
String productVersion,
Collection<AgentProjectInfo> projects,
String userKey,
String logData) {
UpdateInventoryRequest updateInventoryRequest = new UpdateInventoryRequest(projects, updateType);
return (UpdateInventoryRequest) prepareRequest(updateInventoryRequest, orgToken, requesterEmail, product, productVersion, userKey,
false, false, null, null, logData, null, null, null);
} | [
"@",
"Deprecated",
"public",
"UpdateInventoryRequest",
"newUpdateInventoryRequest",
"(",
"String",
"orgToken",
",",
"UpdateType",
"updateType",
",",
"String",
"requesterEmail",
",",
"String",
"product",
",",
"String",
"productVersion",
",",
"Collection",
"<",
"AgentProj... | Create new Inventory Update request.
@param orgToken WhiteSource organization token.
@param updateType Request UpdateType
@param requesterEmail Email of the WhiteSource user that requests to update WhiteSource.
@param product Name or WhiteSource service token of the product to update.
@param productVersion Version of the product to update.
@param projects Projects status statement to update.
@param userKey user key uniquely identifying the account at white source.
@param logData scan log data
@return Newly created request to update organization inventory. | [
"Create",
"new",
"Inventory",
"Update",
"request",
"."
] | train | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java#L100-L112 |
geomajas/geomajas-project-client-gwt2 | plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java | AttributeWidgetFactory.addAttributeBuilder | public void addAttributeBuilder(Class<? extends Attribute> clazz, AttributeWidgetBuilder builder) {
builders.put(clazz, builder);
} | java | public void addAttributeBuilder(Class<? extends Attribute> clazz, AttributeWidgetBuilder builder) {
builders.put(clazz, builder);
} | [
"public",
"void",
"addAttributeBuilder",
"(",
"Class",
"<",
"?",
"extends",
"Attribute",
">",
"clazz",
",",
"AttributeWidgetBuilder",
"builder",
")",
"{",
"builders",
".",
"put",
"(",
"clazz",
",",
"builder",
")",
";",
"}"
] | Add an attribute builder to the collection. Attributes with the given class will
have their widgets build by this builder.
<p/>
If there is already a builder for the given class it will be overwritten.
@param clazz the class of the attribute that is handled by the builder.
@param builder the builder. | [
"Add",
"an",
"attribute",
"builder",
"to",
"the",
"collection",
".",
"Attributes",
"with",
"the",
"given",
"class",
"will",
"have",
"their",
"widgets",
"build",
"by",
"this",
"builder",
".",
"<p",
"/",
">",
"If",
"there",
"is",
"already",
"a",
"builder",
... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java#L79-L81 |
NoraUi/NoraUi | src/main/java/com/github/noraui/browser/DriverFactory.java | DriverFactory.generateGoogleChromeDriver | private WebDriver generateGoogleChromeDriver() throws TechnicalException {
final String pathWebdriver = DriverFactory.getPath(Driver.CHROME);
if (!new File(pathWebdriver).setExecutable(true)) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
}
logger.info("Generating Chrome driver ({}) ...", pathWebdriver);
System.setProperty(Driver.CHROME.getDriverName(), pathWebdriver);
final ChromeOptions chromeOptions = new ChromeOptions();
final DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
setLoggingLevel(capabilities);
if (Context.isHeadless()) {
chromeOptions.addArguments("--headless");
}
// Proxy configuration
if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
}
setChromeOptions(capabilities, chromeOptions);
final String withWhitelistedIps = Context.getWebdriversProperties("withWhitelistedIps");
if (withWhitelistedIps != null && !"".equals(withWhitelistedIps)) {
final ChromeDriverService service = new ChromeDriverService.Builder().withWhitelistedIps(withWhitelistedIps).withVerbose(false).build();
return new ChromeDriver(service, capabilities);
} else {
return new ChromeDriver(capabilities);
}
} | java | private WebDriver generateGoogleChromeDriver() throws TechnicalException {
final String pathWebdriver = DriverFactory.getPath(Driver.CHROME);
if (!new File(pathWebdriver).setExecutable(true)) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
}
logger.info("Generating Chrome driver ({}) ...", pathWebdriver);
System.setProperty(Driver.CHROME.getDriverName(), pathWebdriver);
final ChromeOptions chromeOptions = new ChromeOptions();
final DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
setLoggingLevel(capabilities);
if (Context.isHeadless()) {
chromeOptions.addArguments("--headless");
}
// Proxy configuration
if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
}
setChromeOptions(capabilities, chromeOptions);
final String withWhitelistedIps = Context.getWebdriversProperties("withWhitelistedIps");
if (withWhitelistedIps != null && !"".equals(withWhitelistedIps)) {
final ChromeDriverService service = new ChromeDriverService.Builder().withWhitelistedIps(withWhitelistedIps).withVerbose(false).build();
return new ChromeDriver(service, capabilities);
} else {
return new ChromeDriver(capabilities);
}
} | [
"private",
"WebDriver",
"generateGoogleChromeDriver",
"(",
")",
"throws",
"TechnicalException",
"{",
"final",
"String",
"pathWebdriver",
"=",
"DriverFactory",
".",
"getPath",
"(",
"Driver",
".",
"CHROME",
")",
";",
"if",
"(",
"!",
"new",
"File",
"(",
"pathWebdri... | Generates a chrome webdriver.
@return
A chrome webdriver
@throws TechnicalException
if an error occured when Webdriver setExecutable to true. | [
"Generates",
"a",
"chrome",
"webdriver",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/browser/DriverFactory.java#L142-L176 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/ReflectUtil.java | ReflectUtil.findMatchingMethod | public static Method findMatchingMethod(Class<?> clazz, String name, Object... args) {
for (Method m : clazz.getMethods()) {
if (!m.getName().equals(name)) {
continue;
}
if (isMatch(m.getParameterTypes(), args)) {
return m;
}
}
return null;
} | java | public static Method findMatchingMethod(Class<?> clazz, String name, Object... args) {
for (Method m : clazz.getMethods()) {
if (!m.getName().equals(name)) {
continue;
}
if (isMatch(m.getParameterTypes(), args)) {
return m;
}
}
return null;
} | [
"public",
"static",
"Method",
"findMatchingMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"clazz",
".",
"getMethods",
"(",
")",
")",
"{",
"if",
"(",
"!",
... | See {@link #findMethod(Class, String, Class...)}. This variation does not required the types of input parameters,
but can handle the actual objects, which should be passed to the method.
@param clazz
the class which should be scanned for methods
@param name
the name of the method
@param args
the objects that should be passed to the method
@return A method that is able to accept of the specified objects, {@code null} if such a method could not be
found. | [
"See",
"{",
"@link",
"#findMethod",
"(",
"Class",
"String",
"Class",
"...",
")",
"}",
".",
"This",
"variation",
"does",
"not",
"required",
"the",
"types",
"of",
"input",
"parameters",
"but",
"can",
"handle",
"the",
"actual",
"objects",
"which",
"should",
"... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/ReflectUtil.java#L117-L129 |
jingwei/krati | krati-main/src/main/java/krati/core/array/entry/EntryValueShortFactory.java | EntryValueShortFactory.reinitValue | @Override
public void reinitValue(DataReader in, EntryValueShort value) throws IOException {
value.reinit(in.readInt(), /* array position */
in.readShort(), /* data value */
in.readLong() /* SCN value */);
} | java | @Override
public void reinitValue(DataReader in, EntryValueShort value) throws IOException {
value.reinit(in.readInt(), /* array position */
in.readShort(), /* data value */
in.readLong() /* SCN value */);
} | [
"@",
"Override",
"public",
"void",
"reinitValue",
"(",
"DataReader",
"in",
",",
"EntryValueShort",
"value",
")",
"throws",
"IOException",
"{",
"value",
".",
"reinit",
"(",
"in",
".",
"readInt",
"(",
")",
",",
"/* array position */",
"in",
".",
"readShort",
"... | Read data from stream to populate an EntryValueShort.
@param in
data reader for EntryValueShort.
@param value
an EntryValue to populate.
@throws IOException | [
"Read",
"data",
"from",
"stream",
"to",
"populate",
"an",
"EntryValueShort",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryValueShortFactory.java#L67-L72 |
zxing/zxing | core/src/main/java/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java | AlignmentPatternFinder.handlePossibleCenter | private AlignmentPattern handlePossibleCenter(int[] stateCount, int i, int j) {
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
float centerJ = centerFromEnd(stateCount, j);
float centerI = crossCheckVertical(i, (int) centerJ, 2 * stateCount[1], stateCountTotal);
if (!Float.isNaN(centerI)) {
float estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
for (AlignmentPattern center : possibleCenters) {
// Look for about the same center and module size:
if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
}
}
// Hadn't found this before; save it
AlignmentPattern point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);
possibleCenters.add(point);
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(point);
}
}
return null;
} | java | private AlignmentPattern handlePossibleCenter(int[] stateCount, int i, int j) {
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
float centerJ = centerFromEnd(stateCount, j);
float centerI = crossCheckVertical(i, (int) centerJ, 2 * stateCount[1], stateCountTotal);
if (!Float.isNaN(centerI)) {
float estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
for (AlignmentPattern center : possibleCenters) {
// Look for about the same center and module size:
if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
}
}
// Hadn't found this before; save it
AlignmentPattern point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);
possibleCenters.add(point);
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(point);
}
}
return null;
} | [
"private",
"AlignmentPattern",
"handlePossibleCenter",
"(",
"int",
"[",
"]",
"stateCount",
",",
"int",
"i",
",",
"int",
"j",
")",
"{",
"int",
"stateCountTotal",
"=",
"stateCount",
"[",
"0",
"]",
"+",
"stateCount",
"[",
"1",
"]",
"+",
"stateCount",
"[",
"... | <p>This is called when a horizontal scan finds a possible alignment pattern. It will
cross check with a vertical scan, and if successful, will see if this pattern had been
found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
found the alignment pattern.</p>
@param stateCount reading state module counts from horizontal scan
@param i row where alignment pattern may be found
@param j end of possible alignment pattern in row
@return {@link AlignmentPattern} if we have found the same pattern twice, or null if not | [
"<p",
">",
"This",
"is",
"called",
"when",
"a",
"horizontal",
"scan",
"finds",
"a",
"possible",
"alignment",
"pattern",
".",
"It",
"will",
"cross",
"check",
"with",
"a",
"vertical",
"scan",
"and",
"if",
"successful",
"will",
"see",
"if",
"this",
"pattern",... | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java#L255-L275 |
czyzby/gdx-lml | lml-uedi/src/main/java/com/github/czyzby/lml/uedi/i18n/LocalePreference.java | LocalePreference.fromString | public static Locale fromString(final String locale) {
final String[] data = Strings.split(locale, '_');
if (data.length == 1) {
return new Locale(data[0]);
} else if (data.length == 2) {
return new Locale(data[0], data[1]);
} else if (data.length == 3) {
return new Locale(data[0], data[1], data[2]);
}
throw new IllegalArgumentException("Invalid locale string: " + locale);
} | java | public static Locale fromString(final String locale) {
final String[] data = Strings.split(locale, '_');
if (data.length == 1) {
return new Locale(data[0]);
} else if (data.length == 2) {
return new Locale(data[0], data[1]);
} else if (data.length == 3) {
return new Locale(data[0], data[1], data[2]);
}
throw new IllegalArgumentException("Invalid locale string: " + locale);
} | [
"public",
"static",
"Locale",
"fromString",
"(",
"final",
"String",
"locale",
")",
"{",
"final",
"String",
"[",
"]",
"data",
"=",
"Strings",
".",
"split",
"(",
"locale",
",",
"'",
"'",
")",
";",
"if",
"(",
"data",
".",
"length",
"==",
"1",
")",
"{"... | A safe, cross-platform way of converting serialized locale string to {@link Locale} instance. Matches
{@link #toString(Locale)} serialization implementation.
@param locale locale converted to string.
@return {@link Locale} stored the deserialized data. | [
"A",
"safe",
"cross",
"-",
"platform",
"way",
"of",
"converting",
"serialized",
"locale",
"string",
"to",
"{",
"@link",
"Locale",
"}",
"instance",
".",
"Matches",
"{",
"@link",
"#toString",
"(",
"Locale",
")",
"}",
"serialization",
"implementation",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-uedi/src/main/java/com/github/czyzby/lml/uedi/i18n/LocalePreference.java#L83-L93 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sdx_license.java | sdx_license.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
sdx_license_responses result = (sdx_license_responses) service.get_payload_formatter().string_to_resource(sdx_license_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sdx_license_response_array);
}
sdx_license[] result_sdx_license = new sdx_license[result.sdx_license_response_array.length];
for(int i = 0; i < result.sdx_license_response_array.length; i++)
{
result_sdx_license[i] = result.sdx_license_response_array[i].sdx_license[0];
}
return result_sdx_license;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
sdx_license_responses result = (sdx_license_responses) service.get_payload_formatter().string_to_resource(sdx_license_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sdx_license_response_array);
}
sdx_license[] result_sdx_license = new sdx_license[result.sdx_license_response_array.length];
for(int i = 0; i < result.sdx_license_response_array.length; i++)
{
result_sdx_license[i] = result.sdx_license_response_array[i].sdx_license[0];
}
return result_sdx_license;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"sdx_license_responses",
"result",
"=",
"(",
"sdx_license_responses",
")",
"service",
".",
"get_payload_format... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sdx_license.java#L311-L328 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.convertJsonToJava | @Override
public Object convertJsonToJava(String jsonArg, Type paramType, Annotation[] parameterAnnotations) throws JsonUnmarshallingException, JsonMarshallerException {
if ("null".equals(jsonArg)) {
return null;
}
JsonUnmarshaller juma = getJsonUnmarshallerAnnotation(parameterAnnotations);
if (null != juma) {
Object result = getResult(jsonArg, argumentServices.getIJsonMarshallerInstance(juma.value()), juma.type());
argumentServices.checkType(result, paramType);
return result;
} else {
return convertArgument(jsonArg, paramType);
}
} | java | @Override
public Object convertJsonToJava(String jsonArg, Type paramType, Annotation[] parameterAnnotations) throws JsonUnmarshallingException, JsonMarshallerException {
if ("null".equals(jsonArg)) {
return null;
}
JsonUnmarshaller juma = getJsonUnmarshallerAnnotation(parameterAnnotations);
if (null != juma) {
Object result = getResult(jsonArg, argumentServices.getIJsonMarshallerInstance(juma.value()), juma.type());
argumentServices.checkType(result, paramType);
return result;
} else {
return convertArgument(jsonArg, paramType);
}
} | [
"@",
"Override",
"public",
"Object",
"convertJsonToJava",
"(",
"String",
"jsonArg",
",",
"Type",
"paramType",
",",
"Annotation",
"[",
"]",
"parameterAnnotations",
")",
"throws",
"JsonUnmarshallingException",
",",
"JsonMarshallerException",
"{",
"if",
"(",
"\"null\"",
... | Convert json to Java
@param jsonArg
@param paramType
@param parameterAnnotations
@return
@throws org.ocelotds.marshalling.exceptions.JsonUnmarshallingException
@throws org.ocelotds.marshalling.exceptions.JsonMarshallerException | [
"Convert",
"json",
"to",
"Java"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L57-L70 |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchLong | private boolean matchLong(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final long lMask) throws IOException {
bbuf.order(bo);
long got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = Long.parseLong(testContent.substring(2), 16);
} else if (testContent.startsWith("&")) {
got = Long.parseLong(testContent.substring(3), 16);
} else {
got = Long.parseLong(testContent);
}
long found = bbuf.getInt();
if (needMask) {
found = (short) (found & lMask);
}
if (got != found) {
return false;
}
return true;
} | java | private boolean matchLong(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final long lMask) throws IOException {
bbuf.order(bo);
long got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = Long.parseLong(testContent.substring(2), 16);
} else if (testContent.startsWith("&")) {
got = Long.parseLong(testContent.substring(3), 16);
} else {
got = Long.parseLong(testContent);
}
long found = bbuf.getInt();
if (needMask) {
found = (short) (found & lMask);
}
if (got != found) {
return false;
}
return true;
} | [
"private",
"boolean",
"matchLong",
"(",
"final",
"ByteBuffer",
"bbuf",
",",
"final",
"ByteOrder",
"bo",
",",
"final",
"boolean",
"needMask",
",",
"final",
"long",
"lMask",
")",
"throws",
"IOException",
"{",
"bbuf",
".",
"order",
"(",
"bo",
")",
";",
"long"... | Match long.
@param bbuf the bbuf
@param bo the bo
@param needMask the need mask
@param lMask the l mask
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"long",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L556-L579 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | MethodUtils.invokeStaticMethod | public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeStaticMethod(cls, methodName, args, parameterTypes);
} | java | public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeStaticMethod(cls, methodName, args, parameterTypes);
} | [
"public",
"static",
"Object",
"invokeStaticMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetExceptio... | <p>Invokes a named {@code static} method whose parameter type matches the object type.</p>
<p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
<p>This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a {@code Boolean} class
would match a {@code boolean} primitive.</p>
<p>This is a convenient wrapper for
{@link #invokeStaticMethod(Class, String, Object[], Class[])}.
</p>
@param cls invoke static method on this class
@param methodName get method with this name
@param args use these arguments - treat {@code null} as empty array
@return The value returned by the invoked method
@throws NoSuchMethodException if there is no such accessible method
@throws InvocationTargetException wraps an exception thrown by the
method invoked
@throws IllegalAccessException if the requested method is not accessible
via reflection | [
"<p",
">",
"Invokes",
"a",
"named",
"{",
"@code",
"static",
"}",
"method",
"whose",
"parameter",
"type",
"matches",
"the",
"object",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java#L403-L409 |
JOML-CI/JOML | src/org/joml/Matrix3x2f.java | Matrix3x2f.translateLocal | public Matrix3x2f translateLocal(float x, float y, Matrix3x2f dest) {
dest.m00 = m00;
dest.m01 = m01;
dest.m10 = m10;
dest.m11 = m11;
dest.m20 = m20 + x;
dest.m21 = m21 + y;
return dest;
} | java | public Matrix3x2f translateLocal(float x, float y, Matrix3x2f dest) {
dest.m00 = m00;
dest.m01 = m01;
dest.m10 = m10;
dest.m11 = m11;
dest.m20 = m20 + x;
dest.m21 = m21 + y;
return dest;
} | [
"public",
"Matrix3x2f",
"translateLocal",
"(",
"float",
"x",
",",
"float",
"y",
",",
"Matrix3x2f",
"dest",
")",
"{",
"dest",
".",
"m00",
"=",
"m00",
";",
"dest",
".",
"m01",
"=",
"m01",
";",
"dest",
".",
"m10",
"=",
"m10",
";",
"dest",
".",
"m11",
... | Pre-multiply a translation to this matrix by translating by the given number of
units in x and y and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation
matrix, then the new matrix will be <code>T * M</code>. So when
transforming a vector <code>v</code> with the new matrix by using
<code>T * M * v</code>, the translation will be applied last!
<p>
In order to set the matrix to a translation transformation without pre-multiplying
it, use {@link #translation(float, float)}.
@see #translation(float, float)
@param x
the offset to translate in x
@param y
the offset to translate in y
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"translation",
"to",
"this",
"matrix",
"by",
"translating",
"by",
"the",
"given",
"number",
"of",
"units",
"in",
"x",
"and",
"y",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L686-L694 |
bazaarvoice/emodb | sor-api/src/main/java/com/bazaarvoice/emodb/sor/delta/impl/LiteralImpl.java | LiteralImpl.areClassesEqual | private boolean areClassesEqual(Class<?> c1, Class<?> c2) {
if (isMap(c1)) {
return isMap(c2);
} else if (isList(c1)) {
return isList(c2);
} else {
return c1.equals(c2);
}
} | java | private boolean areClassesEqual(Class<?> c1, Class<?> c2) {
if (isMap(c1)) {
return isMap(c2);
} else if (isList(c1)) {
return isList(c2);
} else {
return c1.equals(c2);
}
} | [
"private",
"boolean",
"areClassesEqual",
"(",
"Class",
"<",
"?",
">",
"c1",
",",
"Class",
"<",
"?",
">",
"c2",
")",
"{",
"if",
"(",
"isMap",
"(",
"c1",
")",
")",
"{",
"return",
"isMap",
"(",
"c2",
")",
";",
"}",
"else",
"if",
"(",
"isList",
"("... | When comparing literals allow subclasses of Maps and Lists to be directly compared even if they have
different implementations. | [
"When",
"comparing",
"literals",
"allow",
"subclasses",
"of",
"Maps",
"and",
"Lists",
"to",
"be",
"directly",
"compared",
"even",
"if",
"they",
"have",
"different",
"implementations",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-api/src/main/java/com/bazaarvoice/emodb/sor/delta/impl/LiteralImpl.java#L139-L147 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/PropertiesLoader.java | PropertiesLoader.getTokenizedProperty | public String[] getTokenizedProperty(final String key, final String separator) {
final List<String> entriesList = new ArrayList<String>();
for (final Properties property : properties) {
final String values = property.getProperty(key);
if (values != null) {
final StringTokenizer st = new StringTokenizer(values, separator);
while (st.hasMoreTokens()) {
final String token = st.nextToken();
entriesList.add(token);
}
}
}
final String[] entries = new String[entriesList.size()];
entriesList.toArray(entries);
return entries;
} | java | public String[] getTokenizedProperty(final String key, final String separator) {
final List<String> entriesList = new ArrayList<String>();
for (final Properties property : properties) {
final String values = property.getProperty(key);
if (values != null) {
final StringTokenizer st = new StringTokenizer(values, separator);
while (st.hasMoreTokens()) {
final String token = st.nextToken();
entriesList.add(token);
}
}
}
final String[] entries = new String[entriesList.size()];
entriesList.toArray(entries);
return entries;
} | [
"public",
"String",
"[",
"]",
"getTokenizedProperty",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"separator",
")",
"{",
"final",
"List",
"<",
"String",
">",
"entriesList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"("... | Returns an array of tokenized values stored under a property key in all
properties files. If the master file has this property its tokens will be
the first ones in the array.
<p>
@param key
property key to retrieve values
@param separator
String with all separator characters to tokenize from the
values in all properties files.
@return all the tokens for the given property key from all the properties
files. | [
"Returns",
"an",
"array",
"of",
"tokenized",
"values",
"stored",
"under",
"a",
"property",
"key",
"in",
"all",
"properties",
"files",
".",
"If",
"the",
"master",
"file",
"has",
"this",
"property",
"its",
"tokens",
"will",
"be",
"the",
"first",
"ones",
"in"... | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/PropertiesLoader.java#L138-L153 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.div | public static BigDecimal div(Number v1, Number v2) {
return div(v1, v2, DEFAUT_DIV_SCALE);
} | java | public static BigDecimal div(Number v1, Number v2) {
return div(v1, v2, DEFAUT_DIV_SCALE);
} | [
"public",
"static",
"BigDecimal",
"div",
"(",
"Number",
"v1",
",",
"Number",
"v2",
")",
"{",
"return",
"div",
"(",
"v1",
",",
"v2",
",",
"DEFAUT_DIV_SCALE",
")",
";",
"}"
] | 提供(相对)精确的除法运算,当发生除不尽的情况的时候,精确到小数点后10位,后面的四舍五入
@param v1 被除数
@param v2 除数
@return 两个参数的商
@since 3.1.0 | [
"提供",
"(",
"相对",
")",
"精确的除法运算",
"当发生除不尽的情况的时候",
"精确到小数点后10位",
"后面的四舍五入"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L539-L541 |
dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addMimeMapping | public void addMimeMapping(String extension, String type) {
handler.getMimeTypes().addMimeMapping(extension, type);
} | java | public void addMimeMapping(String extension, String type) {
handler.getMimeTypes().addMimeMapping(extension, type);
} | [
"public",
"void",
"addMimeMapping",
"(",
"String",
"extension",
",",
"String",
"type",
")",
"{",
"handler",
".",
"getMimeTypes",
"(",
")",
".",
"addMimeMapping",
"(",
"extension",
",",
"type",
")",
";",
"}"
] | Set a mime mapping.
@param extension Extension
@param type Mime type | [
"Set",
"a",
"mime",
"mapping",
"."
] | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L207-L209 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.