repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java | StringUtils.findLongestOverlap | public static String findLongestOverlap(String first, String second) {
"""
Will find the longest suffix of the first sequence which is a prefix of the second.
@param first - first
@param second - second
@return - the longest overlap
"""
if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second))
return "";
int length = Math.min(first.length(), second.length());
for(int i = 0; i < length; i++){
String zw = first.substring(first.length() - length + i);
if(second.startsWith(zw))
return zw;
}
return "";
} | java | public static String findLongestOverlap(String first, String second){
if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second))
return "";
int length = Math.min(first.length(), second.length());
for(int i = 0; i < length; i++){
String zw = first.substring(first.length() - length + i);
if(second.startsWith(zw))
return zw;
}
return "";
} | [
"public",
"static",
"String",
"findLongestOverlap",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"if",
"(",
"org",
".",
"apache",
".",
"commons",
".",
"lang3",
".",
"StringUtils",
".",
"isEmpty",
"(",
"first",
")",
"||",
"org",
".",
"apache... | Will find the longest suffix of the first sequence which is a prefix of the second.
@param first - first
@param second - second
@return - the longest overlap | [
"Will",
"find",
"the",
"longest",
"suffix",
"of",
"the",
"first",
"sequence",
"which",
"is",
"a",
"prefix",
"of",
"the",
"second",
"."
] | train | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java#L43-L53 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java | SdkUtils.createDefaultThreadPoolExecutor | public static ThreadPoolExecutor createDefaultThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit) {
"""
Utility method to create a new StringMappedThreadPoolExecutor (which can be used to inspect runnables).
@param corePoolSize the number of threads to keep in the pool, even if they are idle, unless allowCoreThreadTimeOut is set
@param maximumPoolSize the maximum number of threads to allow in the pool
@param keepAliveTime when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
@param unit the time unit for the keepAliveTime argument
@return a StringMappedThreadPoolExecutor created from given arguments.
"""
return new StringMappedThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(),
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Thread(r);
}
});
} | java | public static ThreadPoolExecutor createDefaultThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit) {
return new StringMappedThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(),
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Thread(r);
}
});
} | [
"public",
"static",
"ThreadPoolExecutor",
"createDefaultThreadPoolExecutor",
"(",
"int",
"corePoolSize",
",",
"int",
"maximumPoolSize",
",",
"long",
"keepAliveTime",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"new",
"StringMappedThreadPoolExecutor",
"(",
"corePoolSize",... | Utility method to create a new StringMappedThreadPoolExecutor (which can be used to inspect runnables).
@param corePoolSize the number of threads to keep in the pool, even if they are idle, unless allowCoreThreadTimeOut is set
@param maximumPoolSize the maximum number of threads to allow in the pool
@param keepAliveTime when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
@param unit the time unit for the keepAliveTime argument
@return a StringMappedThreadPoolExecutor created from given arguments. | [
"Utility",
"method",
"to",
"create",
"a",
"new",
"StringMappedThreadPoolExecutor",
"(",
"which",
"can",
"be",
"used",
"to",
"inspect",
"runnables",
")",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L309-L321 |
yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.mergePropertiesIntoMap | @SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) {
"""
Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over. <p>Uses
{@code Properties.propertyNames()} to even catch default properties linked into the original Properties
instance.
@param props the Properties instance to merge (may be {@code null}).
@param map the target Map to merge the properties into.
"""
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements(); ) {
String key = (String)en.nextElement();
Object value = props.get(key);
if (value == null) {
// Allow for defaults fallback or potentially overridden accessor...
value = props.getProperty(key);
}
map.put((K)key, (V)value);
}
}
} | java | @SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements(); ) {
String key = (String)en.nextElement();
Object value = props.get(key);
if (value == null) {
// Allow for defaults fallback or potentially overridden accessor...
value = props.getProperty(key);
}
map.put((K)key, (V)value);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"mergePropertiesIntoMap",
"(",
"Properties",
"props",
",",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
... | Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over. <p>Uses
{@code Properties.propertyNames()} to even catch default properties linked into the original Properties
instance.
@param props the Properties instance to merge (may be {@code null}).
@param map the target Map to merge the properties into. | [
"Merge",
"the",
"given",
"Properties",
"instance",
"into",
"the",
"given",
"Map",
"copying",
"all",
"properties",
"(",
"key",
"-",
"value",
"pairs",
")",
"over",
".",
"<p",
">",
"Uses",
"{",
"@code",
"Properties",
".",
"propertyNames",
"()",
"}",
"to",
"... | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L102-L118 |
aws/aws-sdk-java | aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java | Budget.setCostFilters | public void setCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
"""
<p>
The cost filters, such as service or region, that are applied to a budget.
</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
</ul>
@param costFilters
The cost filters, such as service or region, that are applied to a budget.</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
"""
this.costFilters = costFilters;
} | java | public void setCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
this.costFilters = costFilters;
} | [
"public",
"void",
"setCostFilters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"costFilters",
")",
"{",
"this",
".",
"costFilters",
"=",
"costFilters",
";",
"}"
] | <p>
The cost filters, such as service or region, that are applied to a budget.
</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
</ul>
@param costFilters
The cost filters, such as service or region, that are applied to a budget.</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li> | [
"<p",
">",
"The",
"cost",
"filters",
"such",
"as",
"service",
"or",
"region",
"that",
"are",
"applied",
"to",
"a",
"budget",
".",
"<",
"/",
"p",
">",
"<p",
">",
"AWS",
"Budgets",
"supports",
"the",
"following",
"services",
"as",
"a",
"filter",
"for",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java#L401-L403 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.listByAccountAsync | public Observable<Page<FirewallRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
"""
Lists the Data Lake Store firewall rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object
"""
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FirewallRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"listByAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listByAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Lists the Data Lake Store firewall rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object | [
"Lists",
"the",
"Data",
"Lake",
"Store",
"firewall",
"rules",
"within",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L142-L150 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.apply | public void apply(int[] target) {
"""
Applies this index table to the specified target, putting {@code target}
into the same ordering as this IndexTable.
@param target the array to re-order into the sorted order defined by this index table
@throws RuntimeException if the length of the target array is not the same as the index table
"""
//use DoubleList view b/d we are only using set ops, so we wont run into an issue of re-allocating the array
apply(IntList.view(target, target.length), new IntList(target.length));
} | java | public void apply(int[] target)
{
//use DoubleList view b/d we are only using set ops, so we wont run into an issue of re-allocating the array
apply(IntList.view(target, target.length), new IntList(target.length));
} | [
"public",
"void",
"apply",
"(",
"int",
"[",
"]",
"target",
")",
"{",
"//use DoubleList view b/d we are only using set ops, so we wont run into an issue of re-allocating the array",
"apply",
"(",
"IntList",
".",
"view",
"(",
"target",
",",
"target",
".",
"length",
")",
"... | Applies this index table to the specified target, putting {@code target}
into the same ordering as this IndexTable.
@param target the array to re-order into the sorted order defined by this index table
@throws RuntimeException if the length of the target array is not the same as the index table | [
"Applies",
"this",
"index",
"table",
"to",
"the",
"specified",
"target",
"putting",
"{",
"@code",
"target",
"}",
"into",
"the",
"same",
"ordering",
"as",
"this",
"IndexTable",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L281-L285 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.setAttributeEnum | public static <T extends Enum<T>> boolean setAttributeEnum(Node document, Class<T> type, T value, String... path) {
"""
Write an enumeration value.
@param <T> is the type of the enumeration.
@param document is the XML document to explore.
@param type is the type of the enumeration.
@param value is the value to put in the document.
@param path is the list of and ended by the attribute's name.
@return <code>true</code> if written, <code>false</code> if not written.
"""
assert document != null : AssertMessages.notNullParameter(0);
return setAttributeEnum(document, type, true, value, path);
} | java | public static <T extends Enum<T>> boolean setAttributeEnum(Node document, Class<T> type, T value, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return setAttributeEnum(document, type, true, value, path);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"boolean",
"setAttributeEnum",
"(",
"Node",
"document",
",",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"value",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"... | Write an enumeration value.
@param <T> is the type of the enumeration.
@param document is the XML document to explore.
@param type is the type of the enumeration.
@param value is the value to put in the document.
@param path is the list of and ended by the attribute's name.
@return <code>true</code> if written, <code>false</code> if not written. | [
"Write",
"an",
"enumeration",
"value",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2202-L2205 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/AbstractDsAssignmentStrategy.java | AbstractDsAssignmentStrategy.closeObsoleteUpdateActions | protected List<Long> closeObsoleteUpdateActions(final Collection<Long> targetsIds) {
"""
Closes {@link Action}s that are no longer necessary without sending a
hint to the controller.
@param targetsIds
to override {@link Action}s
"""
// Figure out if there are potential target/action combinations that
// need to be considered for cancellation
final List<JpaAction> activeActions = actionRepository
.findByActiveAndTargetIdInAndDistributionSetNotRequiredMigrationStep(targetsIds);
return activeActions.stream().map(action -> {
action.setStatus(Status.CANCELED);
action.setActive(false);
// document that the status has been retrieved
actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELED, System.currentTimeMillis(),
RepositoryConstants.SERVER_MESSAGE_PREFIX + "close obsolete action due to new update"));
actionRepository.save(action);
return action.getTarget().getId();
}).collect(Collectors.toList());
} | java | protected List<Long> closeObsoleteUpdateActions(final Collection<Long> targetsIds) {
// Figure out if there are potential target/action combinations that
// need to be considered for cancellation
final List<JpaAction> activeActions = actionRepository
.findByActiveAndTargetIdInAndDistributionSetNotRequiredMigrationStep(targetsIds);
return activeActions.stream().map(action -> {
action.setStatus(Status.CANCELED);
action.setActive(false);
// document that the status has been retrieved
actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELED, System.currentTimeMillis(),
RepositoryConstants.SERVER_MESSAGE_PREFIX + "close obsolete action due to new update"));
actionRepository.save(action);
return action.getTarget().getId();
}).collect(Collectors.toList());
} | [
"protected",
"List",
"<",
"Long",
">",
"closeObsoleteUpdateActions",
"(",
"final",
"Collection",
"<",
"Long",
">",
"targetsIds",
")",
"{",
"// Figure out if there are potential target/action combinations that",
"// need to be considered for cancellation",
"final",
"List",
"<",
... | Closes {@link Action}s that are no longer necessary without sending a
hint to the controller.
@param targetsIds
to override {@link Action}s | [
"Closes",
"{",
"@link",
"Action",
"}",
"s",
"that",
"are",
"no",
"longer",
"necessary",
"without",
"sending",
"a",
"hint",
"to",
"the",
"controller",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/AbstractDsAssignmentStrategy.java#L186-L205 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java | HopcroftMinimization.minimizeMealy | public static <I, O> CompactMealy<I, O> minimizeMealy(MealyMachine<?, I, ?, O> mealy, Alphabet<I> alphabet) {
"""
Minimizes the given Mealy machine. The result is returned in the form of a {@link CompactMealy}, and pruning (see
above) is performed after computing state equivalences.
@param mealy
the Mealy machine to minimize
@param alphabet
the input alphabet (this will be the input alphabet of the resulting Mealy machine)
@return a minimized version of the specified Mealy machine
"""
return minimizeMealy(mealy, alphabet, PruningMode.PRUNE_AFTER);
} | java | public static <I, O> CompactMealy<I, O> minimizeMealy(MealyMachine<?, I, ?, O> mealy, Alphabet<I> alphabet) {
return minimizeMealy(mealy, alphabet, PruningMode.PRUNE_AFTER);
} | [
"public",
"static",
"<",
"I",
",",
"O",
">",
"CompactMealy",
"<",
"I",
",",
"O",
">",
"minimizeMealy",
"(",
"MealyMachine",
"<",
"?",
",",
"I",
",",
"?",
",",
"O",
">",
"mealy",
",",
"Alphabet",
"<",
"I",
">",
"alphabet",
")",
"{",
"return",
"min... | Minimizes the given Mealy machine. The result is returned in the form of a {@link CompactMealy}, and pruning (see
above) is performed after computing state equivalences.
@param mealy
the Mealy machine to minimize
@param alphabet
the input alphabet (this will be the input alphabet of the resulting Mealy machine)
@return a minimized version of the specified Mealy machine | [
"Minimizes",
"the",
"given",
"Mealy",
"machine",
".",
"The",
"result",
"is",
"returned",
"in",
"the",
"form",
"of",
"a",
"{",
"@link",
"CompactMealy",
"}",
"and",
"pruning",
"(",
"see",
"above",
")",
"is",
"performed",
"after",
"computing",
"state",
"equiv... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java#L71-L73 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/CollectionUtils.java | CollectionUtils.loadCollection | public static <T> void loadCollection(String fileName, Class<T> itemClass, Collection<T> collection) throws NoSuchMethodException, InstantiationException,
IllegalAccessException, InvocationTargetException, IOException {
"""
Adds the items from the file to the collection.
@param <T>
The type of the items.
@param fileName
The name of the file from which items should be loaded.
@param itemClass
The class of the items (must have a constructor that accepts a
String).
@param collection
The collection to which items should be added.
"""
loadCollection(new File(fileName), itemClass, collection);
} | java | public static <T> void loadCollection(String fileName, Class<T> itemClass, Collection<T> collection) throws NoSuchMethodException, InstantiationException,
IllegalAccessException, InvocationTargetException, IOException {
loadCollection(new File(fileName), itemClass, collection);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"loadCollection",
"(",
"String",
"fileName",
",",
"Class",
"<",
"T",
">",
"itemClass",
",",
"Collection",
"<",
"T",
">",
"collection",
")",
"throws",
"NoSuchMethodException",
",",
"InstantiationException",
",",
"Illeg... | Adds the items from the file to the collection.
@param <T>
The type of the items.
@param fileName
The name of the file from which items should be loaded.
@param itemClass
The class of the items (must have a constructor that accepts a
String).
@param collection
The collection to which items should be added. | [
"Adds",
"the",
"items",
"from",
"the",
"file",
"to",
"the",
"collection",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionUtils.java#L177-L180 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.withdrawal_withdrawalId_GET | public OvhWithdrawal withdrawal_withdrawalId_GET(String withdrawalId) throws IOException {
"""
Get this object properties
REST: GET /me/withdrawal/{withdrawalId}
@param withdrawalId [required]
"""
String qPath = "/me/withdrawal/{withdrawalId}";
StringBuilder sb = path(qPath, withdrawalId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhWithdrawal.class);
} | java | public OvhWithdrawal withdrawal_withdrawalId_GET(String withdrawalId) throws IOException {
String qPath = "/me/withdrawal/{withdrawalId}";
StringBuilder sb = path(qPath, withdrawalId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhWithdrawal.class);
} | [
"public",
"OvhWithdrawal",
"withdrawal_withdrawalId_GET",
"(",
"String",
"withdrawalId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/withdrawal/{withdrawalId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"withdrawalId",
")",
";... | Get this object properties
REST: GET /me/withdrawal/{withdrawalId}
@param withdrawalId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4345-L4350 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionUtils.java | TransitionUtils.createViewBitmap | @Nullable
public static Bitmap createViewBitmap(@NonNull View view, @NonNull Matrix matrix, @NonNull RectF bounds) {
"""
Creates a Bitmap of the given view, using the Matrix matrix to transform to the local
coordinates. <code>matrix</code> will be modified during the bitmap creation.
<p>If the bitmap is large, it will be scaled uniformly down to at most 1MB size.</p>
@param view The view to create a bitmap for.
@param matrix The matrix converting the view local coordinates to the coordinates that
the bitmap will be displayed in. <code>matrix</code> will be modified before
returning.
@param bounds The bounds of the bitmap in the destination coordinate system (where the
view should be presented. Typically, this is matrix.mapRect(viewBounds);
@return A bitmap of the given view or null if bounds has no width or height.
"""
Bitmap bitmap = null;
int bitmapWidth = Math.round(bounds.width());
int bitmapHeight = Math.round(bounds.height());
if (bitmapWidth > 0 && bitmapHeight > 0) {
float scale = Math.min(1f, ((float)MAX_IMAGE_SIZE) / (bitmapWidth * bitmapHeight));
bitmapWidth *= scale;
bitmapHeight *= scale;
matrix.postTranslate(-bounds.left, -bounds.top);
matrix.postScale(scale, scale);
try {
bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.concat(matrix);
view.draw(canvas);
} catch (OutOfMemoryError e) {
// ignore
}
}
return bitmap;
} | java | @Nullable
public static Bitmap createViewBitmap(@NonNull View view, @NonNull Matrix matrix, @NonNull RectF bounds) {
Bitmap bitmap = null;
int bitmapWidth = Math.round(bounds.width());
int bitmapHeight = Math.round(bounds.height());
if (bitmapWidth > 0 && bitmapHeight > 0) {
float scale = Math.min(1f, ((float)MAX_IMAGE_SIZE) / (bitmapWidth * bitmapHeight));
bitmapWidth *= scale;
bitmapHeight *= scale;
matrix.postTranslate(-bounds.left, -bounds.top);
matrix.postScale(scale, scale);
try {
bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.concat(matrix);
view.draw(canvas);
} catch (OutOfMemoryError e) {
// ignore
}
}
return bitmap;
} | [
"@",
"Nullable",
"public",
"static",
"Bitmap",
"createViewBitmap",
"(",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"Matrix",
"matrix",
",",
"@",
"NonNull",
"RectF",
"bounds",
")",
"{",
"Bitmap",
"bitmap",
"=",
"null",
";",
"int",
"bitmapWidth",
"... | Creates a Bitmap of the given view, using the Matrix matrix to transform to the local
coordinates. <code>matrix</code> will be modified during the bitmap creation.
<p>If the bitmap is large, it will be scaled uniformly down to at most 1MB size.</p>
@param view The view to create a bitmap for.
@param matrix The matrix converting the view local coordinates to the coordinates that
the bitmap will be displayed in. <code>matrix</code> will be modified before
returning.
@param bounds The bounds of the bitmap in the destination coordinate system (where the
view should be presented. Typically, this is matrix.mapRect(viewBounds);
@return A bitmap of the given view or null if bounds has no width or height. | [
"Creates",
"a",
"Bitmap",
"of",
"the",
"given",
"view",
"using",
"the",
"Matrix",
"matrix",
"to",
"transform",
"to",
"the",
"local",
"coordinates",
".",
"<code",
">",
"matrix<",
"/",
"code",
">",
"will",
"be",
"modified",
"during",
"the",
"bitmap",
"creati... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionUtils.java#L163-L184 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java | ClassContext.getMethodAnalysisNoException | private <Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) {
"""
/*
----------------------------------------------------------------------
Helper methods for getting an analysis object from the analysis cache.
----------------------------------------------------------------------
"""
try {
return getMethodAnalysis(analysisClass, method);
} catch (CheckedAnalysisException e) {
IllegalStateException ise = new IllegalStateException("should not happen");
ise.initCause(e);
throw ise;
}
} | java | private <Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) {
try {
return getMethodAnalysis(analysisClass, method);
} catch (CheckedAnalysisException e) {
IllegalStateException ise = new IllegalStateException("should not happen");
ise.initCause(e);
throw ise;
}
} | [
"private",
"<",
"Analysis",
">",
"Analysis",
"getMethodAnalysisNoException",
"(",
"Class",
"<",
"Analysis",
">",
"analysisClass",
",",
"Method",
"method",
")",
"{",
"try",
"{",
"return",
"getMethodAnalysis",
"(",
"analysisClass",
",",
"method",
")",
";",
"}",
... | /*
----------------------------------------------------------------------
Helper methods for getting an analysis object from the analysis cache.
---------------------------------------------------------------------- | [
"/",
"*",
"----------------------------------------------------------------------",
"Helper",
"methods",
"for",
"getting",
"an",
"analysis",
"object",
"from",
"the",
"analysis",
"cache",
".",
"----------------------------------------------------------------------"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java#L971-L979 |
datacleaner/DataCleaner | engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java | DomConfigurationWriter.removeHadoopClusterServerInformation | public boolean removeHadoopClusterServerInformation(final String serverName) {
"""
Removes a Hadoop cluster by its name, if it exists and is recognizeable by the externalizer.
@param serverName
@return true if a server information element was removed from the XML document.
"""
final Element serverInformationCatalogElement = getServerInformationCatalogElement();
final Element hadoopClustersElement =
getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters");
return removeChildElementByNameAttribute(serverName, hadoopClustersElement);
} | java | public boolean removeHadoopClusterServerInformation(final String serverName) {
final Element serverInformationCatalogElement = getServerInformationCatalogElement();
final Element hadoopClustersElement =
getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters");
return removeChildElementByNameAttribute(serverName, hadoopClustersElement);
} | [
"public",
"boolean",
"removeHadoopClusterServerInformation",
"(",
"final",
"String",
"serverName",
")",
"{",
"final",
"Element",
"serverInformationCatalogElement",
"=",
"getServerInformationCatalogElement",
"(",
")",
";",
"final",
"Element",
"hadoopClustersElement",
"=",
"g... | Removes a Hadoop cluster by its name, if it exists and is recognizeable by the externalizer.
@param serverName
@return true if a server information element was removed from the XML document. | [
"Removes",
"a",
"Hadoop",
"cluster",
"by",
"its",
"name",
"if",
"it",
"exists",
"and",
"is",
"recognizeable",
"by",
"the",
"externalizer",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L217-L222 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/Context.java | Context.isTMActive | public static boolean isTMActive()
throws EFapsException {
"""
Is the status of transaction manager active?
@return <i>true</i> if transaction manager is active, otherwise
<i>false</i>
@throws EFapsException if the status of the transaction manager could not
be evaluated
@see #TRANSMANAG
"""
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_ACTIVE;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMActive.SystemException", e);
}
} | java | public static boolean isTMActive()
throws EFapsException
{
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_ACTIVE;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMActive.SystemException", e);
}
} | [
"public",
"static",
"boolean",
"isTMActive",
"(",
")",
"throws",
"EFapsException",
"{",
"try",
"{",
"return",
"Context",
".",
"TRANSMANAG",
".",
"getStatus",
"(",
")",
"==",
"Status",
".",
"STATUS_ACTIVE",
";",
"}",
"catch",
"(",
"final",
"SystemException",
... | Is the status of transaction manager active?
@return <i>true</i> if transaction manager is active, otherwise
<i>false</i>
@throws EFapsException if the status of the transaction manager could not
be evaluated
@see #TRANSMANAG | [
"Is",
"the",
"status",
"of",
"transaction",
"manager",
"active?"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L1129-L1137 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java | ImageSegmentationOps.countRegionPixels | public static void countRegionPixels(GrayS32 labeled , int totalRegions , int counts[] ) {
"""
Counts the number of pixels in all regions. Regions must be have labels from 0 to totalRegions-1.
@param labeled (Input) labeled image
@param totalRegions Total number of regions
@param counts Storage for pixel counts
"""
Arrays.fill(counts,0,totalRegions,0);
for( int y = 0; y < labeled.height; y++ ) {
int index = labeled.startIndex + y*labeled.stride;
for( int x = 0; x < labeled.width; x++ ) {
counts[labeled.data[index++]]++;
}
}
} | java | public static void countRegionPixels(GrayS32 labeled , int totalRegions , int counts[] ) {
Arrays.fill(counts,0,totalRegions,0);
for( int y = 0; y < labeled.height; y++ ) {
int index = labeled.startIndex + y*labeled.stride;
for( int x = 0; x < labeled.width; x++ ) {
counts[labeled.data[index++]]++;
}
}
} | [
"public",
"static",
"void",
"countRegionPixels",
"(",
"GrayS32",
"labeled",
",",
"int",
"totalRegions",
",",
"int",
"counts",
"[",
"]",
")",
"{",
"Arrays",
".",
"fill",
"(",
"counts",
",",
"0",
",",
"totalRegions",
",",
"0",
")",
";",
"for",
"(",
"int"... | Counts the number of pixels in all regions. Regions must be have labels from 0 to totalRegions-1.
@param labeled (Input) labeled image
@param totalRegions Total number of regions
@param counts Storage for pixel counts | [
"Counts",
"the",
"number",
"of",
"pixels",
"in",
"all",
"regions",
".",
"Regions",
"must",
"be",
"have",
"labels",
"from",
"0",
"to",
"totalRegions",
"-",
"1",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L64-L74 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/CommitsApi.java | CommitsApi.getCommits | public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException {
"""
Get a Pager of repository commits in a project.
<pre><code>GitLab Endpoint: GET /projects/:id/repository/commits</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param ref the name of a repository branch or tag or if not given the default branch
@param since only commits after or on this date will be returned
@param until only commits before or on this date will be returned
@param itemsPerPage the number of Commit instances that will be fetched per page
@return a Pager containing the commits for the specified project ID
@throws GitLabApiException GitLabApiException if any exception occurs during execution
"""
return getCommits(projectIdOrPath, ref, since, until, null, itemsPerPage);
} | java | public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException {
return getCommits(projectIdOrPath, ref, since, until, null, itemsPerPage);
} | [
"public",
"Pager",
"<",
"Commit",
">",
"getCommits",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"ref",
",",
"Date",
"since",
",",
"Date",
"until",
",",
"int",
"itemsPerPage",
")",
"throws",
"GitLabApiException",
"{",
"return",
"getCommits",
"(",
"project... | Get a Pager of repository commits in a project.
<pre><code>GitLab Endpoint: GET /projects/:id/repository/commits</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param ref the name of a repository branch or tag or if not given the default branch
@param since only commits after or on this date will be returned
@param until only commits before or on this date will be returned
@param itemsPerPage the number of Commit instances that will be fetched per page
@return a Pager containing the commits for the specified project ID
@throws GitLabApiException GitLabApiException if any exception occurs during execution | [
"Get",
"a",
"Pager",
"of",
"repository",
"commits",
"in",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/CommitsApi.java#L227-L229 |
jenkinsci/pipeline-maven-plugin | jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java | WithMavenStepExecution2.createWrapperScript | private FilePath createWrapperScript(FilePath tempBinDir, String name, String content) throws IOException, InterruptedException {
"""
Creates the actual wrapper script file and sets the permissions.
@param tempBinDir dir to create the script file
@param name the script file name
@param content contents of the file
@return
@throws InterruptedException when processing remote calls
@throws IOException when reading files
"""
FilePath scriptFile = tempBinDir.child(name);
envOverride.put(MVN_CMD, scriptFile.getRemote());
scriptFile.write(content, getComputer().getDefaultCharset().name());
scriptFile.chmod(0755);
return scriptFile;
} | java | private FilePath createWrapperScript(FilePath tempBinDir, String name, String content) throws IOException, InterruptedException {
FilePath scriptFile = tempBinDir.child(name);
envOverride.put(MVN_CMD, scriptFile.getRemote());
scriptFile.write(content, getComputer().getDefaultCharset().name());
scriptFile.chmod(0755);
return scriptFile;
} | [
"private",
"FilePath",
"createWrapperScript",
"(",
"FilePath",
"tempBinDir",
",",
"String",
"name",
",",
"String",
"content",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"FilePath",
"scriptFile",
"=",
"tempBinDir",
".",
"child",
"(",
"name",
")... | Creates the actual wrapper script file and sets the permissions.
@param tempBinDir dir to create the script file
@param name the script file name
@param content contents of the file
@return
@throws InterruptedException when processing remote calls
@throws IOException when reading files | [
"Creates",
"the",
"actual",
"wrapper",
"script",
"file",
"and",
"sets",
"the",
"permissions",
"."
] | train | https://github.com/jenkinsci/pipeline-maven-plugin/blob/685d7dbb894fb4c976dbfa922e3caba8e8d5bed8/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L636-L644 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java | ContentSpecValidator.validateFixedUrl | protected boolean validateFixedUrl(final SpecNode specNode, final Set<String> processedFixedUrls) {
"""
Checks to make sure that a user defined fixed url is valid
@param specNode
@param processedFixedUrls
@return
"""
boolean valid = true;
if (!ProcessorConstants.VALID_FIXED_URL_PATTERN.matcher(specNode.getFixedUrl()).matches()) {
log.error(format(ProcessorConstants.ERROR_FIXED_URL_NOT_VALID, specNode.getLineNumber(), specNode.getText()));
valid = false;
} else if (processedFixedUrls.contains(specNode.getFixedUrl())) {
log.error(format(ProcessorConstants.ERROR_FIXED_URL_NOT_UNIQUE, specNode.getLineNumber(), specNode.getFixedUrl(),
specNode.getText()));
valid = false;
}
return valid;
} | java | protected boolean validateFixedUrl(final SpecNode specNode, final Set<String> processedFixedUrls) {
boolean valid = true;
if (!ProcessorConstants.VALID_FIXED_URL_PATTERN.matcher(specNode.getFixedUrl()).matches()) {
log.error(format(ProcessorConstants.ERROR_FIXED_URL_NOT_VALID, specNode.getLineNumber(), specNode.getText()));
valid = false;
} else if (processedFixedUrls.contains(specNode.getFixedUrl())) {
log.error(format(ProcessorConstants.ERROR_FIXED_URL_NOT_UNIQUE, specNode.getLineNumber(), specNode.getFixedUrl(),
specNode.getText()));
valid = false;
}
return valid;
} | [
"protected",
"boolean",
"validateFixedUrl",
"(",
"final",
"SpecNode",
"specNode",
",",
"final",
"Set",
"<",
"String",
">",
"processedFixedUrls",
")",
"{",
"boolean",
"valid",
"=",
"true",
";",
"if",
"(",
"!",
"ProcessorConstants",
".",
"VALID_FIXED_URL_PATTERN",
... | Checks to make sure that a user defined fixed url is valid
@param specNode
@param processedFixedUrls
@return | [
"Checks",
"to",
"make",
"sure",
"that",
"a",
"user",
"defined",
"fixed",
"url",
"is",
"valid"
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java#L1585-L1598 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java | AlignerHelper.setSteps | public static int[] setSteps(Last[][][] traceback, int[] xyMax, List<Step> sx, List<Step> sy) {
"""
Find local alignment path through traceback matrix
@param traceback
@param xyMax
@param sx
@param sy
@return
"""
return setSteps(traceback, true, xyMax, Last.SUBSTITUTION, sx, sy);
} | java | public static int[] setSteps(Last[][][] traceback, int[] xyMax, List<Step> sx, List<Step> sy) {
return setSteps(traceback, true, xyMax, Last.SUBSTITUTION, sx, sy);
} | [
"public",
"static",
"int",
"[",
"]",
"setSteps",
"(",
"Last",
"[",
"]",
"[",
"]",
"[",
"]",
"traceback",
",",
"int",
"[",
"]",
"xyMax",
",",
"List",
"<",
"Step",
">",
"sx",
",",
"List",
"<",
"Step",
">",
"sy",
")",
"{",
"return",
"setSteps",
"(... | Find local alignment path through traceback matrix
@param traceback
@param xyMax
@param sx
@param sy
@return | [
"Find",
"local",
"alignment",
"path",
"through",
"traceback",
"matrix"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L681-L683 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/fft/FastFourierTransform.java | FastFourierTransform.bitReverse | private static void bitReverse(DoubleVector vector, int power) {
"""
Reverses the bits, a step required for doing the FFT in place. This
implementation is significantly faster than {@link bitreverse}. This
implementation is based on the following paper:
</li style="font-family:Garamond, Georgia, serif">M. Rubio, P. Gomez,
and K. Drouice. "A new superfast bit reversal algorithm"
<i>International Journal of Adaptive Control and Signal Processing</i>
@param vector The vector to be permuted according to the bit reversal.
This vector's length must be a power of two
@param power The log of the vector's length
"""
vector.set(0, 0);
vector.set(1, 2 << (power - 1));
vector.set(2, 2 << (power - 2));
vector.set(3, 3 * 2 << (power - 2));
int prevN = 3;
for (int k = 3; k < power - 2; ++k) {
int currN = (2 << k) - 1;
vector.set(currN, vector.get(prevN) + (2 << (power - k)));
for (int l = 0; l < prevN - 1; ++l)
vector.set(currN - l, vector.get(currN) - vector.get(l));
prevN = currN;
}
} | java | private static void bitReverse(DoubleVector vector, int power) {
vector.set(0, 0);
vector.set(1, 2 << (power - 1));
vector.set(2, 2 << (power - 2));
vector.set(3, 3 * 2 << (power - 2));
int prevN = 3;
for (int k = 3; k < power - 2; ++k) {
int currN = (2 << k) - 1;
vector.set(currN, vector.get(prevN) + (2 << (power - k)));
for (int l = 0; l < prevN - 1; ++l)
vector.set(currN - l, vector.get(currN) - vector.get(l));
prevN = currN;
}
} | [
"private",
"static",
"void",
"bitReverse",
"(",
"DoubleVector",
"vector",
",",
"int",
"power",
")",
"{",
"vector",
".",
"set",
"(",
"0",
",",
"0",
")",
";",
"vector",
".",
"set",
"(",
"1",
",",
"2",
"<<",
"(",
"power",
"-",
"1",
")",
")",
";",
... | Reverses the bits, a step required for doing the FFT in place. This
implementation is significantly faster than {@link bitreverse}. This
implementation is based on the following paper:
</li style="font-family:Garamond, Georgia, serif">M. Rubio, P. Gomez,
and K. Drouice. "A new superfast bit reversal algorithm"
<i>International Journal of Adaptive Control and Signal Processing</i>
@param vector The vector to be permuted according to the bit reversal.
This vector's length must be a power of two
@param power The log of the vector's length | [
"Reverses",
"the",
"bits",
"a",
"step",
"required",
"for",
"doing",
"the",
"FFT",
"in",
"place",
".",
"This",
"implementation",
"is",
"significantly",
"faster",
"than",
"{",
"@link",
"bitreverse",
"}",
".",
"This",
"implementation",
"is",
"based",
"on",
"the... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/fft/FastFourierTransform.java#L235-L248 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java | PayloadSender.sendPayloadRequest | private synchronized void sendPayloadRequest(final PayloadData payload) {
"""
Creates and sends payload Http-request asynchronously (returns immediately)
@param payload
"""
ApptentiveLog.v(PAYLOADS, "Sending payload: %s", payload);
// create request object
final HttpRequest payloadRequest = requestSender.createPayloadSendRequest(payload, new HttpRequest.Listener<HttpRequest>() {
@Override
public void onFinish(HttpRequest request) {
try {
String json = StringUtils.isNullOrEmpty(request.getResponseData()) ? "{}" : request.getResponseData();
final JSONObject responseData = new JSONObject(json);
handleFinishSendingPayload(payload, false, null, request.getResponseCode(), responseData);
} catch (Exception e) {
// TODO: Stop assuming the response is JSON. In fact, just send bytes back, and whatever part of the SDK needs it can try to convert it to the desired format.
ApptentiveLog.e(PAYLOADS, e, "Exception while handling payload send response");
logException(e);
handleFinishSendingPayload(payload, false, null, -1, null);
}
}
@Override
public void onCancel(HttpRequest request) {
handleFinishSendingPayload(payload, true, null, request.getResponseCode(), null);
}
@Override
public void onFail(HttpRequest request, String reason) {
if (request.isAuthenticationFailure()) {
ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_AUTHENTICATION_FAILED, NOTIFICATION_KEY_CONVERSATION_ID, payload.getConversationId(), NOTIFICATION_KEY_AUTHENTICATION_FAILED_REASON, request.getAuthenticationFailedReason());
}
handleFinishSendingPayload(payload, false, reason, request.getResponseCode(), null);
}
});
// set 'retry' policy
payloadRequest.setRetryPolicy(requestRetryPolicy);
payloadRequest.setCallbackQueue(conversationQueue());
payloadRequest.start();
} | java | private synchronized void sendPayloadRequest(final PayloadData payload) {
ApptentiveLog.v(PAYLOADS, "Sending payload: %s", payload);
// create request object
final HttpRequest payloadRequest = requestSender.createPayloadSendRequest(payload, new HttpRequest.Listener<HttpRequest>() {
@Override
public void onFinish(HttpRequest request) {
try {
String json = StringUtils.isNullOrEmpty(request.getResponseData()) ? "{}" : request.getResponseData();
final JSONObject responseData = new JSONObject(json);
handleFinishSendingPayload(payload, false, null, request.getResponseCode(), responseData);
} catch (Exception e) {
// TODO: Stop assuming the response is JSON. In fact, just send bytes back, and whatever part of the SDK needs it can try to convert it to the desired format.
ApptentiveLog.e(PAYLOADS, e, "Exception while handling payload send response");
logException(e);
handleFinishSendingPayload(payload, false, null, -1, null);
}
}
@Override
public void onCancel(HttpRequest request) {
handleFinishSendingPayload(payload, true, null, request.getResponseCode(), null);
}
@Override
public void onFail(HttpRequest request, String reason) {
if (request.isAuthenticationFailure()) {
ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_AUTHENTICATION_FAILED, NOTIFICATION_KEY_CONVERSATION_ID, payload.getConversationId(), NOTIFICATION_KEY_AUTHENTICATION_FAILED_REASON, request.getAuthenticationFailedReason());
}
handleFinishSendingPayload(payload, false, reason, request.getResponseCode(), null);
}
});
// set 'retry' policy
payloadRequest.setRetryPolicy(requestRetryPolicy);
payloadRequest.setCallbackQueue(conversationQueue());
payloadRequest.start();
} | [
"private",
"synchronized",
"void",
"sendPayloadRequest",
"(",
"final",
"PayloadData",
"payload",
")",
"{",
"ApptentiveLog",
".",
"v",
"(",
"PAYLOADS",
",",
"\"Sending payload: %s\"",
",",
"payload",
")",
";",
"// create request object",
"final",
"HttpRequest",
"payloa... | Creates and sends payload Http-request asynchronously (returns immediately)
@param payload | [
"Creates",
"and",
"sends",
"payload",
"Http",
"-",
"request",
"asynchronously",
"(",
"returns",
"immediately",
")"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java#L104-L142 |
apache/incubator-gobblin | gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java | HttpUtils.buildURI | public static URI buildURI(String urlTemplate, Map<String, String> keys, Map<String, String> queryParams) {
"""
Given a url template, interpolate with keys and build the URI after adding query parameters
<p>
With url template: http://test.com/resource/(urn:${resourceId})/entities/(entity:${entityId}),
keys: { "resourceId": 123, "entityId": 456 }, queryParams: { "locale": "en_US" }, the outpuT URI is:
http://test.com/resource/(urn:123)/entities/(entity:456)?locale=en_US
</p>
@param urlTemplate url template
@param keys data map to interpolate url template
@param queryParams query parameters added to the url
@return a uri
"""
// Compute base url
String url = urlTemplate;
if (keys != null && keys.size() != 0) {
url = StrSubstitutor.replace(urlTemplate, keys);
}
try {
URIBuilder uriBuilder = new URIBuilder(url);
// Append query parameters
if (queryParams != null && queryParams.size() != 0) {
for (Map.Entry<String, String> entry : queryParams.entrySet()) {
uriBuilder.addParameter(entry.getKey(), entry.getValue());
}
}
return uriBuilder.build();
} catch (URISyntaxException e) {
throw new RuntimeException("Fail to build uri", e);
}
} | java | public static URI buildURI(String urlTemplate, Map<String, String> keys, Map<String, String> queryParams) {
// Compute base url
String url = urlTemplate;
if (keys != null && keys.size() != 0) {
url = StrSubstitutor.replace(urlTemplate, keys);
}
try {
URIBuilder uriBuilder = new URIBuilder(url);
// Append query parameters
if (queryParams != null && queryParams.size() != 0) {
for (Map.Entry<String, String> entry : queryParams.entrySet()) {
uriBuilder.addParameter(entry.getKey(), entry.getValue());
}
}
return uriBuilder.build();
} catch (URISyntaxException e) {
throw new RuntimeException("Fail to build uri", e);
}
} | [
"public",
"static",
"URI",
"buildURI",
"(",
"String",
"urlTemplate",
",",
"Map",
"<",
"String",
",",
"String",
">",
"keys",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"{",
"// Compute base url",
"String",
"url",
"=",
"urlTemplate",
... | Given a url template, interpolate with keys and build the URI after adding query parameters
<p>
With url template: http://test.com/resource/(urn:${resourceId})/entities/(entity:${entityId}),
keys: { "resourceId": 123, "entityId": 456 }, queryParams: { "locale": "en_US" }, the outpuT URI is:
http://test.com/resource/(urn:123)/entities/(entity:456)?locale=en_US
</p>
@param urlTemplate url template
@param keys data map to interpolate url template
@param queryParams query parameters added to the url
@return a uri | [
"Given",
"a",
"url",
"template",
"interpolate",
"with",
"keys",
"and",
"build",
"the",
"URI",
"after",
"adding",
"query",
"parameters"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java#L101-L120 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java | ProcessListenerEx.asString | public String asString(ProcessEvent e, int dptMainNumber, String dptID)
throws KNXException {
"""
Returns the ASDU of the received process event as datapoint value of the requested
DPT in String representation.
<p>
This method has to be invoked manually by the user (either in
{@link #groupReadResponse(ProcessEvent)} or
{@link ProcessListener#groupWrite(ProcessEvent)}), depending on the received
datapoint type.
@param e the process event with the ASDU to translate
@param dptMainNumber datapoint type main number, number >= 0; use 0 to infer
translator type from <code>dptID</code> argument only
@param dptID datapoint type ID for selecting a particular kind of value translation
@return the received value of the requested type as String representation
@throws KNXException on not supported or not available DPT
@see TranslatorTypes#createTranslator(int, String)
"""
final DPTXlator t = TranslatorTypes.createTranslator(dptMainNumber, dptID);
t.setData(e.getASDU());
return t.getValue();
} | java | public String asString(ProcessEvent e, int dptMainNumber, String dptID)
throws KNXException
{
final DPTXlator t = TranslatorTypes.createTranslator(dptMainNumber, dptID);
t.setData(e.getASDU());
return t.getValue();
} | [
"public",
"String",
"asString",
"(",
"ProcessEvent",
"e",
",",
"int",
"dptMainNumber",
",",
"String",
"dptID",
")",
"throws",
"KNXException",
"{",
"final",
"DPTXlator",
"t",
"=",
"TranslatorTypes",
".",
"createTranslator",
"(",
"dptMainNumber",
",",
"dptID",
")"... | Returns the ASDU of the received process event as datapoint value of the requested
DPT in String representation.
<p>
This method has to be invoked manually by the user (either in
{@link #groupReadResponse(ProcessEvent)} or
{@link ProcessListener#groupWrite(ProcessEvent)}), depending on the received
datapoint type.
@param e the process event with the ASDU to translate
@param dptMainNumber datapoint type main number, number >= 0; use 0 to infer
translator type from <code>dptID</code> argument only
@param dptID datapoint type ID for selecting a particular kind of value translation
@return the received value of the requested type as String representation
@throws KNXException on not supported or not available DPT
@see TranslatorTypes#createTranslator(int, String) | [
"Returns",
"the",
"ASDU",
"of",
"the",
"received",
"process",
"event",
"as",
"datapoint",
"value",
"of",
"the",
"requested",
"DPT",
"in",
"String",
"representation",
".",
"<p",
">",
"This",
"method",
"has",
"to",
"be",
"invoked",
"manually",
"by",
"the",
"... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java#L235-L241 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java | ClassFileVersion.of | public static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator) throws IOException {
"""
Extracts a class' class version.
@param type The type for which to locate a class file version.
@param classFileLocator The class file locator to query for a class file.
@return The type's class file version.
@throws IOException If an error occurs while reading the class file.
"""
return of(TypeDescription.ForLoadedType.of(type), classFileLocator);
} | java | public static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator) throws IOException {
return of(TypeDescription.ForLoadedType.of(type), classFileLocator);
} | [
"public",
"static",
"ClassFileVersion",
"of",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"ClassFileLocator",
"classFileLocator",
")",
"throws",
"IOException",
"{",
"return",
"of",
"(",
"TypeDescription",
".",
"ForLoadedType",
".",
"of",
"(",
"type",
")",
",",
... | Extracts a class' class version.
@param type The type for which to locate a class file version.
@param classFileLocator The class file locator to query for a class file.
@return The type's class file version.
@throws IOException If an error occurs while reading the class file. | [
"Extracts",
"a",
"class",
"class",
"version",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java#L285-L287 |
grpc/grpc-java | protobuf/src/main/java/io/grpc/protobuf/StatusProto.java | StatusProto.fromStatusAndTrailers | @Nullable
public static com.google.rpc.Status fromStatusAndTrailers(Status status, Metadata trailers) {
"""
Extracts the google.rpc.Status from trailers, and makes sure they match the gRPC
{@code status}.
@return the embedded google.rpc.Status or {@code null} if it is not present.
@since 1.11.0
"""
if (trailers != null) {
com.google.rpc.Status statusProto = trailers.get(STATUS_DETAILS_KEY);
if (statusProto != null) {
checkArgument(
status.getCode().value() == statusProto.getCode(),
"com.google.rpc.Status code must match gRPC status code");
return statusProto;
}
}
return null;
} | java | @Nullable
public static com.google.rpc.Status fromStatusAndTrailers(Status status, Metadata trailers) {
if (trailers != null) {
com.google.rpc.Status statusProto = trailers.get(STATUS_DETAILS_KEY);
if (statusProto != null) {
checkArgument(
status.getCode().value() == statusProto.getCode(),
"com.google.rpc.Status code must match gRPC status code");
return statusProto;
}
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"com",
".",
"google",
".",
"rpc",
".",
"Status",
"fromStatusAndTrailers",
"(",
"Status",
"status",
",",
"Metadata",
"trailers",
")",
"{",
"if",
"(",
"trailers",
"!=",
"null",
")",
"{",
"com",
".",
"google",
".",
"rpc"... | Extracts the google.rpc.Status from trailers, and makes sure they match the gRPC
{@code status}.
@return the embedded google.rpc.Status or {@code null} if it is not present.
@since 1.11.0 | [
"Extracts",
"the",
"google",
".",
"rpc",
".",
"Status",
"from",
"trailers",
"and",
"makes",
"sure",
"they",
"match",
"the",
"gRPC",
"{",
"@code",
"status",
"}",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/protobuf/src/main/java/io/grpc/protobuf/StatusProto.java#L156-L168 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java | SparseCpuLevel1.sroti | @Override
protected void sroti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) {
"""
Applies Givens rotation to sparse vectors one of which is in compressed form.
@param N The number of elements in vectors X and Y
@param X a float sparse vector
@param indexes The indexes of the sparse vector
@param Y a float full-storage vector
@param c a scalar
@param s a scalar
"""
cblas_sroti((int) N, (FloatPointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer().capacity(X.columns()),
(FloatPointer) Y.data().addressPointer(), (float) c, (float) s);
} | java | @Override
protected void sroti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) {
cblas_sroti((int) N, (FloatPointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer().capacity(X.columns()),
(FloatPointer) Y.data().addressPointer(), (float) c, (float) s);
} | [
"@",
"Override",
"protected",
"void",
"sroti",
"(",
"long",
"N",
",",
"INDArray",
"X",
",",
"DataBuffer",
"indexes",
",",
"INDArray",
"Y",
",",
"double",
"c",
",",
"double",
"s",
")",
"{",
"cblas_sroti",
"(",
"(",
"int",
")",
"N",
",",
"(",
"FloatPoi... | Applies Givens rotation to sparse vectors one of which is in compressed form.
@param N The number of elements in vectors X and Y
@param X a float sparse vector
@param indexes The indexes of the sparse vector
@param Y a float full-storage vector
@param c a scalar
@param s a scalar | [
"Applies",
"Givens",
"rotation",
"to",
"sparse",
"vectors",
"one",
"of",
"which",
"is",
"in",
"compressed",
"form",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L248-L252 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.findFacesFileInputAsync | public Observable<FoundFaces> findFacesFileInputAsync(byte[] imageStream, FindFacesFileInputOptionalParameter findFacesFileInputOptionalParameter) {
"""
Returns the list of faces found.
@param imageStream The image file.
@param findFacesFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FoundFaces object
"""
return findFacesFileInputWithServiceResponseAsync(imageStream, findFacesFileInputOptionalParameter).map(new Func1<ServiceResponse<FoundFaces>, FoundFaces>() {
@Override
public FoundFaces call(ServiceResponse<FoundFaces> response) {
return response.body();
}
});
} | java | public Observable<FoundFaces> findFacesFileInputAsync(byte[] imageStream, FindFacesFileInputOptionalParameter findFacesFileInputOptionalParameter) {
return findFacesFileInputWithServiceResponseAsync(imageStream, findFacesFileInputOptionalParameter).map(new Func1<ServiceResponse<FoundFaces>, FoundFaces>() {
@Override
public FoundFaces call(ServiceResponse<FoundFaces> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FoundFaces",
">",
"findFacesFileInputAsync",
"(",
"byte",
"[",
"]",
"imageStream",
",",
"FindFacesFileInputOptionalParameter",
"findFacesFileInputOptionalParameter",
")",
"{",
"return",
"findFacesFileInputWithServiceResponseAsync",
"(",
"imageStrea... | Returns the list of faces found.
@param imageStream The image file.
@param findFacesFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FoundFaces object | [
"Returns",
"the",
"list",
"of",
"faces",
"found",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L747-L754 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getUntilLastExcl | @Nullable
public static String getUntilLastExcl (@Nullable final String sStr, @Nullable final String sSearch) {
"""
Get everything from the string up to and excluding the first passed string.
@param sStr
The source string. May be <code>null</code>.
@param sSearch
The string to search. May be <code>null</code>.
@return <code>null</code> if the passed string does not contain the search
string. If the search string is empty, the empty string is returned.
"""
return _getUntilLast (sStr, sSearch, false);
} | java | @Nullable
public static String getUntilLastExcl (@Nullable final String sStr, @Nullable final String sSearch)
{
return _getUntilLast (sStr, sSearch, false);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getUntilLastExcl",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"_getUntilLast",
"(",
"sStr",
",",
"sSearch",
",",
"false",
")",
";",
... | Get everything from the string up to and excluding the first passed string.
@param sStr
The source string. May be <code>null</code>.
@param sSearch
The string to search. May be <code>null</code>.
@return <code>null</code> if the passed string does not contain the search
string. If the search string is empty, the empty string is returned. | [
"Get",
"everything",
"from",
"the",
"string",
"up",
"to",
"and",
"excluding",
"the",
"first",
"passed",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4907-L4911 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/rule/AndRule.java | AndRule.getRule | public static Rule getRule(final Stack stack) {
"""
Create rule from top two elements of stack.
@param stack stack of rules.
@return Rule that evaluates true only if both rules are true.
"""
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid AND rule - expected two rules but received "
+ stack.size());
}
Object o2 = stack.pop();
Object o1 = stack.pop();
if ((o2 instanceof Rule) && (o1 instanceof Rule)) {
Rule p2 = (Rule) o2;
Rule p1 = (Rule) o1;
return new AndRule(p1, p2);
}
throw new IllegalArgumentException("Invalid AND rule: " + o2 + "..." + o1);
} | java | public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid AND rule - expected two rules but received "
+ stack.size());
}
Object o2 = stack.pop();
Object o1 = stack.pop();
if ((o2 instanceof Rule) && (o1 instanceof Rule)) {
Rule p2 = (Rule) o2;
Rule p1 = (Rule) o1;
return new AndRule(p1, p2);
}
throw new IllegalArgumentException("Invalid AND rule: " + o2 + "..." + o1);
} | [
"public",
"static",
"Rule",
"getRule",
"(",
"final",
"Stack",
"stack",
")",
"{",
"if",
"(",
"stack",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid AND rule - expected two rules but received \"",
"+",
"stac... | Create rule from top two elements of stack.
@param stack stack of rules.
@return Rule that evaluates true only if both rules are true. | [
"Create",
"rule",
"from",
"top",
"two",
"elements",
"of",
"stack",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/AndRule.java#L65-L79 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java | AvatarShell.updateZooKeeper | public void updateZooKeeper(String serviceName, String instance) throws IOException {
"""
/*
This method tries to update the information in ZooKeeper
For every address of the NameNode it is being run for
(fs.default.name, dfs.namenode.dn-address, dfs.namenode.http.address)
if they are present.
It also creates information for aliases in ZooKeeper for lists of strings
in fs.default.name.aliases, dfs.namenode.dn-address.aliases and
dfs.namenode.http.address.aliases
Each address it transformed to the address of the zNode to be created by
substituting all . and : characters to /. The slash is also added in the
front to make it a valid zNode address.
So dfs.domain.com:9000 will be /dfs/domain/com/9000
If any part of the path does not exist it is created automatically
"""
Avatar avatar = avatarnode.getAvatar();
if (avatar != Avatar.ACTIVE) {
throw new IOException("Cannot update ZooKeeper information to point to " +
"the AvatarNode in Standby mode");
}
AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, true, serviceName, instance);
} | java | public void updateZooKeeper(String serviceName, String instance) throws IOException {
Avatar avatar = avatarnode.getAvatar();
if (avatar != Avatar.ACTIVE) {
throw new IOException("Cannot update ZooKeeper information to point to " +
"the AvatarNode in Standby mode");
}
AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, true, serviceName, instance);
} | [
"public",
"void",
"updateZooKeeper",
"(",
"String",
"serviceName",
",",
"String",
"instance",
")",
"throws",
"IOException",
"{",
"Avatar",
"avatar",
"=",
"avatarnode",
".",
"getAvatar",
"(",
")",
";",
"if",
"(",
"avatar",
"!=",
"Avatar",
".",
"ACTIVE",
")",
... | /*
This method tries to update the information in ZooKeeper
For every address of the NameNode it is being run for
(fs.default.name, dfs.namenode.dn-address, dfs.namenode.http.address)
if they are present.
It also creates information for aliases in ZooKeeper for lists of strings
in fs.default.name.aliases, dfs.namenode.dn-address.aliases and
dfs.namenode.http.address.aliases
Each address it transformed to the address of the zNode to be created by
substituting all . and : characters to /. The slash is also added in the
front to make it a valid zNode address.
So dfs.domain.com:9000 will be /dfs/domain/com/9000
If any part of the path does not exist it is created automatically | [
"/",
"*",
"This",
"method",
"tries",
"to",
"update",
"the",
"information",
"in",
"ZooKeeper",
"For",
"every",
"address",
"of",
"the",
"NameNode",
"it",
"is",
"being",
"run",
"for",
"(",
"fs",
".",
"default",
".",
"name",
"dfs",
".",
"namenode",
".",
"d... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java#L692-L699 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/converter/object/OpenTypeConverter.java | OpenTypeConverter.toJSON | protected JSONAware toJSON(Object pValue) {
"""
Convert to JSON. The given object must be either a valid JSON string or of type {@link JSONAware}, in which
case it is returned directly
@param pValue the value to parse (or to return directly if it is a {@link JSONAware}
@return the resulting value
"""
Class givenClass = pValue.getClass();
if (JSONAware.class.isAssignableFrom(givenClass)) {
return (JSONAware) pValue;
} else {
try {
return (JSONAware) new JSONParser().parse(pValue.toString());
} catch (ParseException e) {
throw new IllegalArgumentException("Cannot parse JSON " + pValue + ": " + e,e);
} catch (ClassCastException exp) {
throw new IllegalArgumentException("Given value " + pValue.toString() +
" cannot be parsed to JSONAware object: " + exp,exp);
}
}
} | java | protected JSONAware toJSON(Object pValue) {
Class givenClass = pValue.getClass();
if (JSONAware.class.isAssignableFrom(givenClass)) {
return (JSONAware) pValue;
} else {
try {
return (JSONAware) new JSONParser().parse(pValue.toString());
} catch (ParseException e) {
throw new IllegalArgumentException("Cannot parse JSON " + pValue + ": " + e,e);
} catch (ClassCastException exp) {
throw new IllegalArgumentException("Given value " + pValue.toString() +
" cannot be parsed to JSONAware object: " + exp,exp);
}
}
} | [
"protected",
"JSONAware",
"toJSON",
"(",
"Object",
"pValue",
")",
"{",
"Class",
"givenClass",
"=",
"pValue",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"JSONAware",
".",
"class",
".",
"isAssignableFrom",
"(",
"givenClass",
")",
")",
"{",
"return",
"(",
"... | Convert to JSON. The given object must be either a valid JSON string or of type {@link JSONAware}, in which
case it is returned directly
@param pValue the value to parse (or to return directly if it is a {@link JSONAware}
@return the resulting value | [
"Convert",
"to",
"JSON",
".",
"The",
"given",
"object",
"must",
"be",
"either",
"a",
"valid",
"JSON",
"string",
"or",
"of",
"type",
"{",
"@link",
"JSONAware",
"}",
"in",
"which",
"case",
"it",
"is",
"returned",
"directly"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/object/OpenTypeConverter.java#L71-L85 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java | QrCodeAlignmentPatternLocator.localize | boolean localize(QrCode.Alignment pattern, float guessY, float guessX) {
"""
Localizizes the alignment pattern crudely by searching for the black box in the center by looking
for its edges in the gray scale image
@return true if success or false if it doesn't resemble an alignment pattern
"""
// sample along the middle. Try to not sample the outside edges which could confuse it
for (int i = 0; i < arrayY.length; i++) {
float x = guessX - 1.5f + i*3f/12.0f;
float y = guessY - 1.5f + i*3f/12.0f;
arrayX[i] = reader.read(guessY,x);
arrayY[i] = reader.read(y,guessX);
}
// TODO turn this into an exhaustive search of the array for best up and down point?
int downX = greatestDown(arrayX);
if( downX == -1) return false;
int upX = greatestUp(arrayX,downX);
if( upX == -1) return false;
int downY = greatestDown(arrayY);
if( downY == -1 ) return false;
int upY = greatestUp(arrayY,downY);
if( upY == -1 ) return false;
pattern.moduleFound.x = guessX - 1.5f + (downX+upX)*3f/24.0f;
pattern.moduleFound.y = guessY - 1.5f + (downY+upY)*3f/24.0f;
reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel);
return true;
} | java | boolean localize(QrCode.Alignment pattern, float guessY, float guessX)
{
// sample along the middle. Try to not sample the outside edges which could confuse it
for (int i = 0; i < arrayY.length; i++) {
float x = guessX - 1.5f + i*3f/12.0f;
float y = guessY - 1.5f + i*3f/12.0f;
arrayX[i] = reader.read(guessY,x);
arrayY[i] = reader.read(y,guessX);
}
// TODO turn this into an exhaustive search of the array for best up and down point?
int downX = greatestDown(arrayX);
if( downX == -1) return false;
int upX = greatestUp(arrayX,downX);
if( upX == -1) return false;
int downY = greatestDown(arrayY);
if( downY == -1 ) return false;
int upY = greatestUp(arrayY,downY);
if( upY == -1 ) return false;
pattern.moduleFound.x = guessX - 1.5f + (downX+upX)*3f/24.0f;
pattern.moduleFound.y = guessY - 1.5f + (downY+upY)*3f/24.0f;
reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel);
return true;
} | [
"boolean",
"localize",
"(",
"QrCode",
".",
"Alignment",
"pattern",
",",
"float",
"guessY",
",",
"float",
"guessX",
")",
"{",
"// sample along the middle. Try to not sample the outside edges which could confuse it",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a... | Localizizes the alignment pattern crudely by searching for the black box in the center by looking
for its edges in the gray scale image
@return true if success or false if it doesn't resemble an alignment pattern | [
"Localizizes",
"the",
"alignment",
"pattern",
"crudely",
"by",
"searching",
"for",
"the",
"black",
"box",
"in",
"the",
"center",
"by",
"looking",
"for",
"its",
"edges",
"in",
"the",
"gray",
"scale",
"image"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L206-L234 |
openbase/jul | processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java | StringProcessor.fillWithSpaces | public static String fillWithSpaces(String input, int lenght) {
"""
Method fills the given input string with width-spaces until the given string length is reached.
<p>
Note: The origin input string will aligned to the left.
@param input the original input string
@param lenght the requested input string length.
@return the extended input string
"""
return fillWithSpaces(input, lenght, Alignment.LEFT);
} | java | public static String fillWithSpaces(String input, int lenght) {
return fillWithSpaces(input, lenght, Alignment.LEFT);
} | [
"public",
"static",
"String",
"fillWithSpaces",
"(",
"String",
"input",
",",
"int",
"lenght",
")",
"{",
"return",
"fillWithSpaces",
"(",
"input",
",",
"lenght",
",",
"Alignment",
".",
"LEFT",
")",
";",
"}"
] | Method fills the given input string with width-spaces until the given string length is reached.
<p>
Note: The origin input string will aligned to the left.
@param input the original input string
@param lenght the requested input string length.
@return the extended input string | [
"Method",
"fills",
"the",
"given",
"input",
"string",
"with",
"width",
"-",
"spaces",
"until",
"the",
"given",
"string",
"length",
"is",
"reached",
".",
"<p",
">",
"Note",
":",
"The",
"origin",
"input",
"string",
"will",
"aligned",
"to",
"the",
"left",
"... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java#L127-L129 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphNodeFindInClone | public static int cuGraphNodeFindInClone(CUgraphNode phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) {
"""
Finds a cloned version of a node.<br>
<br>
This function returns the node in \p hClonedGraph corresponding to \p hOriginalNode
in the original graph.<br>
<br>
\p hClonedGraph must have been cloned from \p hOriginalGraph via ::cuGraphClone.
\p hOriginalNode must have been in \p hOriginalGraph at the time of the call to
::cuGraphClone, and the corresponding cloned node in \p hClonedGraph must not have
been removed. The cloned node is then returned via \p phClonedNode.
@param phNode - Returns handle to the cloned node
@param hOriginalNode - Handle to the original node
@param hClonedGraph - Cloned graph to query
@return
CUDA_SUCCESS,
CUDA_ERROR_INVALID_VALUE,
@see
JCudaDriver#cuGraphClone
"""
return checkResult(cuGraphNodeFindInCloneNative(phNode, hOriginalNode, hClonedGraph));
} | java | public static int cuGraphNodeFindInClone(CUgraphNode phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph)
{
return checkResult(cuGraphNodeFindInCloneNative(phNode, hOriginalNode, hClonedGraph));
} | [
"public",
"static",
"int",
"cuGraphNodeFindInClone",
"(",
"CUgraphNode",
"phNode",
",",
"CUgraphNode",
"hOriginalNode",
",",
"CUgraph",
"hClonedGraph",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphNodeFindInCloneNative",
"(",
"phNode",
",",
"hOriginalNode",
",",
"h... | Finds a cloned version of a node.<br>
<br>
This function returns the node in \p hClonedGraph corresponding to \p hOriginalNode
in the original graph.<br>
<br>
\p hClonedGraph must have been cloned from \p hOriginalGraph via ::cuGraphClone.
\p hOriginalNode must have been in \p hOriginalGraph at the time of the call to
::cuGraphClone, and the corresponding cloned node in \p hClonedGraph must not have
been removed. The cloned node is then returned via \p phClonedNode.
@param phNode - Returns handle to the cloned node
@param hOriginalNode - Handle to the original node
@param hClonedGraph - Cloned graph to query
@return
CUDA_SUCCESS,
CUDA_ERROR_INVALID_VALUE,
@see
JCudaDriver#cuGraphClone | [
"Finds",
"a",
"cloned",
"version",
"of",
"a",
"node",
".",
"<br",
">",
"<br",
">",
"This",
"function",
"returns",
"the",
"node",
"in",
"\\",
"p",
"hClonedGraph",
"corresponding",
"to",
"\\",
"p",
"hOriginalNode",
"in",
"the",
"original",
"graph",
".",
"<... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12608-L12611 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImagesFromFilesAsync | public Observable<ImageCreateSummary> createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch) {
"""
Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param projectId The project id
@param batch The batch of image files to add. Limited to 64 images and 20 tags per batch
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object
"""
return createImagesFromFilesWithServiceResponseAsync(projectId, batch).map(new Func1<ServiceResponse<ImageCreateSummary>, ImageCreateSummary>() {
@Override
public ImageCreateSummary call(ServiceResponse<ImageCreateSummary> response) {
return response.body();
}
});
} | java | public Observable<ImageCreateSummary> createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch) {
return createImagesFromFilesWithServiceResponseAsync(projectId, batch).map(new Func1<ServiceResponse<ImageCreateSummary>, ImageCreateSummary>() {
@Override
public ImageCreateSummary call(ServiceResponse<ImageCreateSummary> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageCreateSummary",
">",
"createImagesFromFilesAsync",
"(",
"UUID",
"projectId",
",",
"ImageFileCreateBatch",
"batch",
")",
"{",
"return",
"createImagesFromFilesWithServiceResponseAsync",
"(",
"projectId",
",",
"batch",
")",
".",
"map",
"(... | Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param projectId The project id
@param batch The batch of image files to add. Limited to 64 images and 20 tags per batch
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageCreateSummary object | [
"Add",
"the",
"provided",
"batch",
"of",
"images",
"to",
"the",
"set",
"of",
"training",
"images",
".",
"This",
"API",
"accepts",
"a",
"batch",
"of",
"files",
"and",
"optionally",
"tags",
"to",
"create",
"images",
".",
"There",
"is",
"a",
"limit",
"of",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3955-L3962 |
julianhyde/sqlline | src/main/java/sqlline/Rows.java | Rows.getTablePrimaryKeys | private Set<String> getTablePrimaryKeys(
String catalog, String schema, String table) {
"""
Gets a set of primary key column names given a table key (i.e. catalog,
schema and table name). The returned set may be cached as a result of
previous requests for the same table key.
<p>The result cannot be considered authoritative as since it depends on
whether the JDBC driver property implements
{@link java.sql.ResultSetMetaData#getTableName} and many drivers/databases
do not.
@param catalog The catalog for the table. May be null.
@param schema The schema for the table. May be null.
@param table The name of table. May not be null.
@return A set of primary key column names. May be empty but
will never be null.
"""
TableKey tableKey = new TableKey(catalog, schema, table);
Set<String> primaryKeys = tablePrimaryKeysCache.get(tableKey);
if (primaryKeys == null) {
primaryKeys = loadAndCachePrimaryKeysForTable(tableKey);
}
return primaryKeys;
} | java | private Set<String> getTablePrimaryKeys(
String catalog, String schema, String table) {
TableKey tableKey = new TableKey(catalog, schema, table);
Set<String> primaryKeys = tablePrimaryKeysCache.get(tableKey);
if (primaryKeys == null) {
primaryKeys = loadAndCachePrimaryKeysForTable(tableKey);
}
return primaryKeys;
} | [
"private",
"Set",
"<",
"String",
">",
"getTablePrimaryKeys",
"(",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
")",
"{",
"TableKey",
"tableKey",
"=",
"new",
"TableKey",
"(",
"catalog",
",",
"schema",
",",
"table",
")",
";",
"Set",
... | Gets a set of primary key column names given a table key (i.e. catalog,
schema and table name). The returned set may be cached as a result of
previous requests for the same table key.
<p>The result cannot be considered authoritative as since it depends on
whether the JDBC driver property implements
{@link java.sql.ResultSetMetaData#getTableName} and many drivers/databases
do not.
@param catalog The catalog for the table. May be null.
@param schema The schema for the table. May be null.
@param table The name of table. May not be null.
@return A set of primary key column names. May be empty but
will never be null. | [
"Gets",
"a",
"set",
"of",
"primary",
"key",
"column",
"names",
"given",
"a",
"table",
"key",
"(",
"i",
".",
"e",
".",
"catalog",
"schema",
"and",
"table",
"name",
")",
".",
"The",
"returned",
"set",
"may",
"be",
"cached",
"as",
"a",
"result",
"of",
... | train | https://github.com/julianhyde/sqlline/blob/7577f3ebaca0897a9ff01d1553d4576487e1d2c3/src/main/java/sqlline/Rows.java#L383-L391 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sortValuableDesc | public static Comparator<? super MonetaryAmount> sortValuableDesc(
final ExchangeRateProvider provider) {
"""
Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)}
@param provider the rate provider to be used.
@return the Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)}
"""
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortValuable(provider).compare(o1, o2) * -1;
}
};
} | java | public static Comparator<? super MonetaryAmount> sortValuableDesc(
final ExchangeRateProvider provider) {
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortValuable(provider).compare(o1, o2) * -1;
}
};
} | [
"public",
"static",
"Comparator",
"<",
"?",
"super",
"MonetaryAmount",
">",
"sortValuableDesc",
"(",
"final",
"ExchangeRateProvider",
"provider",
")",
"{",
"return",
"new",
"Comparator",
"<",
"MonetaryAmount",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int"... | Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)}
@param provider the rate provider to be used.
@return the Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)} | [
"Descending",
"order",
"of",
"{"
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L98-L106 |
datoin/http-requests | src/main/java/org/datoin/net/http/Request.java | Request.setParam | public Request setParam(String name, String value) {
"""
set a request param and return modified request
@param name : name of teh request param
@param value : value of teh request param
@return : Request Object with request param name, value set
"""
this.params.put(name, value);
return this;
} | java | public Request setParam(String name, String value) {
this.params.put(name, value);
return this;
} | [
"public",
"Request",
"setParam",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"params",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | set a request param and return modified request
@param name : name of teh request param
@param value : value of teh request param
@return : Request Object with request param name, value set | [
"set",
"a",
"request",
"param",
"and",
"return",
"modified",
"request"
] | train | https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L313-L316 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java | IndexChangeAdapters.forNodePath | public static IndexChangeAdapter forNodePath( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
ProvidedIndex<?> index ) {
"""
Create an {@link IndexChangeAdapter} implementation that handles the "jcr:path" property.
@param context the execution context; may not be null
@param matcher the node type matcher used to determine which nodes should be included in the index; may not be null
@param workspaceName the name of the workspace; may not be null
@param index the local index that should be used; may not be null
@return the new {@link IndexChangeAdapter}; never null
"""
return new NodePathChangeAdapter(context, matcher, workspaceName, index);
} | java | public static IndexChangeAdapter forNodePath( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
ProvidedIndex<?> index ) {
return new NodePathChangeAdapter(context, matcher, workspaceName, index);
} | [
"public",
"static",
"IndexChangeAdapter",
"forNodePath",
"(",
"ExecutionContext",
"context",
",",
"NodeTypePredicate",
"matcher",
",",
"String",
"workspaceName",
",",
"ProvidedIndex",
"<",
"?",
">",
"index",
")",
"{",
"return",
"new",
"NodePathChangeAdapter",
"(",
"... | Create an {@link IndexChangeAdapter} implementation that handles the "jcr:path" property.
@param context the execution context; may not be null
@param matcher the node type matcher used to determine which nodes should be included in the index; may not be null
@param workspaceName the name of the workspace; may not be null
@param index the local index that should be used; may not be null
@return the new {@link IndexChangeAdapter}; never null | [
"Create",
"an",
"{",
"@link",
"IndexChangeAdapter",
"}",
"implementation",
"that",
"handles",
"the",
"jcr",
":",
"path",
"property",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L128-L133 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractModel.java | AbstractModel.listenObject | protected <T> void listenObject(ObjectProperty<T> objectProperty, Consumer<T> consumeOld, Consumer<T> consumeNew) {
"""
Listen object change.
@param objectProperty the object to listen
@param consumeOld process the old object
@param consumeNew process the new object
"""
objectProperty.addListener(
(final ObservableValue<? extends T> ov, final T old_val, final T new_val) -> {
if (old_val != null && consumeOld != null) {
consumeOld.accept(old_val);
}
if (new_val != null && consumeNew != null) {
consumeNew.accept(new_val);
}
});
} | java | protected <T> void listenObject(ObjectProperty<T> objectProperty, Consumer<T> consumeOld, Consumer<T> consumeNew) {
objectProperty.addListener(
(final ObservableValue<? extends T> ov, final T old_val, final T new_val) -> {
if (old_val != null && consumeOld != null) {
consumeOld.accept(old_val);
}
if (new_val != null && consumeNew != null) {
consumeNew.accept(new_val);
}
});
} | [
"protected",
"<",
"T",
">",
"void",
"listenObject",
"(",
"ObjectProperty",
"<",
"T",
">",
"objectProperty",
",",
"Consumer",
"<",
"T",
">",
"consumeOld",
",",
"Consumer",
"<",
"T",
">",
"consumeNew",
")",
"{",
"objectProperty",
".",
"addListener",
"(",
"("... | Listen object change.
@param objectProperty the object to listen
@param consumeOld process the old object
@param consumeNew process the new object | [
"Listen",
"object",
"change",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractModel.java#L178-L188 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableString.java | ReplaceableString.getChars | public void getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
"""
Copies characters from this object into the destination
character array. The first character to be copied is at index
<code>srcStart</code>; the last character to be copied is at
index <code>srcLimit-1</code> (thus the total number of
characters to be copied is <code>srcLimit-srcStart</code>). The
characters are copied into the subarray of <code>dst</code>
starting at index <code>dstStart</code> and ending at index
<code>dstStart + (srcLimit-srcStart) - 1</code>.
@param srcStart the beginning index to copy, inclusive; <code>0
<= start <= limit</code>.
@param srcLimit the ending index to copy, exclusive;
<code>start <= limit <= length()</code>.
@param dst the destination array.
@param dstStart the start offset in the destination array.
"""
if (srcStart != srcLimit) {
buf.getChars(srcStart, srcLimit, dst, dstStart);
}
} | java | public void getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
if (srcStart != srcLimit) {
buf.getChars(srcStart, srcLimit, dst, dstStart);
}
} | [
"public",
"void",
"getChars",
"(",
"int",
"srcStart",
",",
"int",
"srcLimit",
",",
"char",
"dst",
"[",
"]",
",",
"int",
"dstStart",
")",
"{",
"if",
"(",
"srcStart",
"!=",
"srcLimit",
")",
"{",
"buf",
".",
"getChars",
"(",
"srcStart",
",",
"srcLimit",
... | Copies characters from this object into the destination
character array. The first character to be copied is at index
<code>srcStart</code>; the last character to be copied is at
index <code>srcLimit-1</code> (thus the total number of
characters to be copied is <code>srcLimit-srcStart</code>). The
characters are copied into the subarray of <code>dst</code>
starting at index <code>dstStart</code> and ending at index
<code>dstStart + (srcLimit-srcStart) - 1</code>.
@param srcStart the beginning index to copy, inclusive; <code>0
<= start <= limit</code>.
@param srcLimit the ending index to copy, exclusive;
<code>start <= limit <= length()</code>.
@param dst the destination array.
@param dstStart the start offset in the destination array. | [
"Copies",
"characters",
"from",
"this",
"object",
"into",
"the",
"destination",
"character",
"array",
".",
"The",
"first",
"character",
"to",
"be",
"copied",
"is",
"at",
"index",
"<code",
">",
"srcStart<",
"/",
"code",
">",
";",
"the",
"last",
"character",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableString.java#L120-L124 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.eachFileRecurse | public static void eachFileRecurse(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException {
"""
Processes each descendant file in this directory and any sub-directories.
Processing consists of calling <code>closure</code> passing it the current
file (which may be a normal file or subdirectory) and then if a subdirectory was encountered,
recursively processing the subdirectory.
@param self a Path (that happens to be a folder/directory)
@param closure a Closure
@throws java.io.FileNotFoundException if the given directory does not exist
@throws IllegalArgumentException if the provided Path object does not represent a directory
@see #eachFileRecurse(Path, groovy.io.FileType, groovy.lang.Closure)
@since 2.3.0
""" // throws FileNotFoundException, IllegalArgumentException {
eachFileRecurse(self, FileType.ANY, closure);
} | java | public static void eachFileRecurse(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
eachFileRecurse(self, FileType.ANY, closure);
} | [
"public",
"static",
"void",
"eachFileRecurse",
"(",
"Path",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.nio.file.Path\"",
")",
"Closure",
"closure",
")",
"throws",
"IOException",
"{",
"// throws ... | Processes each descendant file in this directory and any sub-directories.
Processing consists of calling <code>closure</code> passing it the current
file (which may be a normal file or subdirectory) and then if a subdirectory was encountered,
recursively processing the subdirectory.
@param self a Path (that happens to be a folder/directory)
@param closure a Closure
@throws java.io.FileNotFoundException if the given directory does not exist
@throws IllegalArgumentException if the provided Path object does not represent a directory
@see #eachFileRecurse(Path, groovy.io.FileType, groovy.lang.Closure)
@since 2.3.0 | [
"Processes",
"each",
"descendant",
"file",
"in",
"this",
"directory",
"and",
"any",
"sub",
"-",
"directories",
".",
"Processing",
"consists",
"of",
"calling",
"<code",
">",
"closure<",
"/",
"code",
">",
"passing",
"it",
"the",
"current",
"file",
"(",
"which"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1169-L1171 |
alkacon/opencms-core | src/org/opencms/ui/apps/modules/CmsSiteSelectDialog.java | CmsSiteSelectDialog.openDialogInWindow | public static void openDialogInWindow(final I_Callback callback, String windowCaption) {
"""
Opens the site selection dialog in a window.<p>
@param callback the callback to call when the dialog finishes
@param windowCaption the window caption
"""
final Window window = CmsBasicDialog.prepareWindow();
window.setCaption(windowCaption);
CmsSiteSelectDialog dialog = new CmsSiteSelectDialog();
window.setContent(dialog);
dialog.setCallback(new I_Callback() {
public void onCancel() {
window.close();
callback.onCancel();
}
public void onSiteSelect(String site) {
window.close();
callback.onSiteSelect(site);
}
});
A_CmsUI.get().addWindow(window);
} | java | public static void openDialogInWindow(final I_Callback callback, String windowCaption) {
final Window window = CmsBasicDialog.prepareWindow();
window.setCaption(windowCaption);
CmsSiteSelectDialog dialog = new CmsSiteSelectDialog();
window.setContent(dialog);
dialog.setCallback(new I_Callback() {
public void onCancel() {
window.close();
callback.onCancel();
}
public void onSiteSelect(String site) {
window.close();
callback.onSiteSelect(site);
}
});
A_CmsUI.get().addWindow(window);
} | [
"public",
"static",
"void",
"openDialogInWindow",
"(",
"final",
"I_Callback",
"callback",
",",
"String",
"windowCaption",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
")",
";",
"window",
".",
"setCaption",
"(",
"window... | Opens the site selection dialog in a window.<p>
@param callback the callback to call when the dialog finishes
@param windowCaption the window caption | [
"Opens",
"the",
"site",
"selection",
"dialog",
"in",
"a",
"window",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsSiteSelectDialog.java#L124-L146 |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java | RichTextUtil.addParsedText | public static void addParsedText(@NotNull Element parent, @NotNull String text, boolean xhtmlEntities) throws JDOMException {
"""
Parses XHTML text string, and adds to parsed content to the given parent element.
@param parent Parent element to add parsed content to
@param text XHTML text string (root element not needed)
@param xhtmlEntities If set to true, Resolving of XHtml entities in XHtml fragment is supported.
@throws JDOMException Is thrown if the text could not be parsed as XHTML
"""
Element root = parseText(text, xhtmlEntities);
parent.addContent(root.cloneContent());
} | java | public static void addParsedText(@NotNull Element parent, @NotNull String text, boolean xhtmlEntities) throws JDOMException {
Element root = parseText(text, xhtmlEntities);
parent.addContent(root.cloneContent());
} | [
"public",
"static",
"void",
"addParsedText",
"(",
"@",
"NotNull",
"Element",
"parent",
",",
"@",
"NotNull",
"String",
"text",
",",
"boolean",
"xhtmlEntities",
")",
"throws",
"JDOMException",
"{",
"Element",
"root",
"=",
"parseText",
"(",
"text",
",",
"xhtmlEnt... | Parses XHTML text string, and adds to parsed content to the given parent element.
@param parent Parent element to add parsed content to
@param text XHTML text string (root element not needed)
@param xhtmlEntities If set to true, Resolving of XHtml entities in XHtml fragment is supported.
@throws JDOMException Is thrown if the text could not be parsed as XHTML | [
"Parses",
"XHTML",
"text",
"string",
"and",
"adds",
"to",
"parsed",
"content",
"to",
"the",
"given",
"parent",
"element",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java#L119-L122 |
knightliao/disconf | disconf-web/src/main/java/com/baidu/disconf/web/service/roleres/service/RoleResourceAspectMock.java | RoleResourceAspectMock.decideAccess | @Around("anyPublicMethod() && @annotation(requestMapping)")
public Object decideAccess(ProceedingJoinPoint pjp, RequestMapping requestMapping) throws Throwable {
"""
判断当前用户对访问的方法是否有权限
@param pjp 方法
@param requestMapping 方法上的annotation
@return
@throws Throwable
"""
Object rtnOb = null;
try {
// 执行方法
rtnOb = pjp.proceed();
} catch (Throwable t) {
LOG.info(t.getMessage());
throw t;
}
return rtnOb;
} | java | @Around("anyPublicMethod() && @annotation(requestMapping)")
public Object decideAccess(ProceedingJoinPoint pjp, RequestMapping requestMapping) throws Throwable {
Object rtnOb = null;
try {
// 执行方法
rtnOb = pjp.proceed();
} catch (Throwable t) {
LOG.info(t.getMessage());
throw t;
}
return rtnOb;
} | [
"@",
"Around",
"(",
"\"anyPublicMethod() && @annotation(requestMapping)\"",
")",
"public",
"Object",
"decideAccess",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"RequestMapping",
"requestMapping",
")",
"throws",
"Throwable",
"{",
"Object",
"rtnOb",
"=",
"null",
";",
"try",
... | 判断当前用户对访问的方法是否有权限
@param pjp 方法
@param requestMapping 方法上的annotation
@return
@throws Throwable | [
"判断当前用户对访问的方法是否有权限"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/disconf/web/service/roleres/service/RoleResourceAspectMock.java#L37-L51 |
HsiangLeekwok/hlklib | hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java | Utility.isItMobilePhone | public static boolean isItMobilePhone(String phone, boolean rigidRules) {
"""
正则检测字符串是否为手机号码
@param phone 手机号码
@param rigidRules 是否用严格的规则进行号码验证
"""
String temp = filterNumbers(phone);
Pattern p = Pattern.compile(rigidRules ? PHONE_REGEX : PHONE_REGEX);
Matcher m = p.matcher(temp);
return m.matches();
} | java | public static boolean isItMobilePhone(String phone, boolean rigidRules) {
String temp = filterNumbers(phone);
Pattern p = Pattern.compile(rigidRules ? PHONE_REGEX : PHONE_REGEX);
Matcher m = p.matcher(temp);
return m.matches();
} | [
"public",
"static",
"boolean",
"isItMobilePhone",
"(",
"String",
"phone",
",",
"boolean",
"rigidRules",
")",
"{",
"String",
"temp",
"=",
"filterNumbers",
"(",
"phone",
")",
";",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"rigidRules",
"?",
"PHONE_R... | 正则检测字符串是否为手机号码
@param phone 手机号码
@param rigidRules 是否用严格的规则进行号码验证 | [
"正则检测字符串是否为手机号码"
] | train | https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java#L153-L158 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java | DisasterRecoveryConfigurationsInner.beginCreateOrUpdate | public DisasterRecoveryConfigurationInner beginCreateOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) {
"""
Creates or updates a disaster recovery configuration.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DisasterRecoveryConfigurationInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body();
} | java | public DisasterRecoveryConfigurationInner beginCreateOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body();
} | [
"public",
"DisasterRecoveryConfigurationInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"disasterRecoveryConfigurationName",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Creates or updates a disaster recovery configuration.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DisasterRecoveryConfigurationInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"disaster",
"recovery",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L447-L449 |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Record.java | Record.equalsFields | public final boolean equalsFields(int[] positions, Value[] searchValues, Value[] deserializationHolders) {
"""
Checks the values of this record and a given list of values at specified positions for equality.
The values of this record are deserialized and compared against the corresponding search value.
The position specify which values are compared.
The method returns true if the values on all positions are equal and false otherwise.
@param positions The positions of the values to check for equality.
@param searchValues The values against which the values of this record are compared.
@param deserializationHolders An array to hold the deserialized values of this record.
@return True if all the values on all positions are equal, false otherwise.
"""
for (int i = 0; i < positions.length; i++) {
final Value v = getField(positions[i], deserializationHolders[i]);
if (v == null || (!v.equals(searchValues[i]))) {
return false;
}
}
return true;
} | java | public final boolean equalsFields(int[] positions, Value[] searchValues, Value[] deserializationHolders) {
for (int i = 0; i < positions.length; i++) {
final Value v = getField(positions[i], deserializationHolders[i]);
if (v == null || (!v.equals(searchValues[i]))) {
return false;
}
}
return true;
} | [
"public",
"final",
"boolean",
"equalsFields",
"(",
"int",
"[",
"]",
"positions",
",",
"Value",
"[",
"]",
"searchValues",
",",
"Value",
"[",
"]",
"deserializationHolders",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"positions",
".",
"len... | Checks the values of this record and a given list of values at specified positions for equality.
The values of this record are deserialized and compared against the corresponding search value.
The position specify which values are compared.
The method returns true if the values on all positions are equal and false otherwise.
@param positions The positions of the values to check for equality.
@param searchValues The values against which the values of this record are compared.
@param deserializationHolders An array to hold the deserialized values of this record.
@return True if all the values on all positions are equal, false otherwise. | [
"Checks",
"the",
"values",
"of",
"this",
"record",
"and",
"a",
"given",
"list",
"of",
"values",
"at",
"specified",
"positions",
"for",
"equality",
".",
"The",
"values",
"of",
"this",
"record",
"are",
"deserialized",
"and",
"compared",
"against",
"the",
"corr... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L910-L918 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java | RecommendationsInner.disableRecommendationForSiteAsync | public Observable<Void> disableRecommendationForSiteAsync(String resourceGroupName, String siteName, String name) {
"""
Disables the specific rule for a web site permanently.
Disables the specific rule for a web site permanently.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site name
@param name Rule name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> disableRecommendationForSiteAsync(String resourceGroupName, String siteName, String name) {
return disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableRecommendationForSiteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"name",
")",
"{",
"return",
"disableRecommendationForSiteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Disables the specific rule for a web site permanently.
Disables the specific rule for a web site permanently.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site name
@param name Rule name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Disables",
"the",
"specific",
"rule",
"for",
"a",
"web",
"site",
"permanently",
".",
"Disables",
"the",
"specific",
"rule",
"for",
"a",
"web",
"site",
"permanently",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1435-L1442 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java | ArrayHelper.contains | public static <ELEMENTTYPE> boolean contains (@Nullable final ELEMENTTYPE [] aValues,
@Nullable final ELEMENTTYPE aSearchValue) {
"""
Check if the passed search value is contained in the passed value array.
@param <ELEMENTTYPE>
Array element type
@param aValues
The value array to be searched. May be <code>null</code>.
@param aSearchValue
The value to be searched. May be <code>null</code>.
@return <code>true</code> if the value array is not empty and the search
value is contained - false otherwise.
"""
return getFirstIndex (aValues, aSearchValue) >= 0;
} | java | public static <ELEMENTTYPE> boolean contains (@Nullable final ELEMENTTYPE [] aValues,
@Nullable final ELEMENTTYPE aSearchValue)
{
return getFirstIndex (aValues, aSearchValue) >= 0;
} | [
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"boolean",
"contains",
"(",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aValues",
",",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"aSearchValue",
")",
"{",
"return",
"getFirstIndex",
"(",
"aValues",
",",
"aSea... | Check if the passed search value is contained in the passed value array.
@param <ELEMENTTYPE>
Array element type
@param aValues
The value array to be searched. May be <code>null</code>.
@param aSearchValue
The value to be searched. May be <code>null</code>.
@return <code>true</code> if the value array is not empty and the search
value is contained - false otherwise. | [
"Check",
"if",
"the",
"passed",
"search",
"value",
"is",
"contained",
"in",
"the",
"passed",
"value",
"array",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L806-L810 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/SchemaManager.java | SchemaManager.findUserTableForIndex | Table findUserTableForIndex(Session session, String name,
String schemaName) {
"""
Returns the table that has an index with the given name and schema.
"""
Schema schema = (Schema) schemaMap.get(schemaName);
HsqlName indexName = schema.indexLookup.getName(name);
if (indexName == null) {
return null;
}
return findUserTable(session, indexName.parent.name, schemaName);
} | java | Table findUserTableForIndex(Session session, String name,
String schemaName) {
Schema schema = (Schema) schemaMap.get(schemaName);
HsqlName indexName = schema.indexLookup.getName(name);
if (indexName == null) {
return null;
}
return findUserTable(session, indexName.parent.name, schemaName);
} | [
"Table",
"findUserTableForIndex",
"(",
"Session",
"session",
",",
"String",
"name",
",",
"String",
"schemaName",
")",
"{",
"Schema",
"schema",
"=",
"(",
"Schema",
")",
"schemaMap",
".",
"get",
"(",
"schemaName",
")",
";",
"HsqlName",
"indexName",
"=",
"schem... | Returns the table that has an index with the given name and schema. | [
"Returns",
"the",
"table",
"that",
"has",
"an",
"index",
"with",
"the",
"given",
"name",
"and",
"schema",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/SchemaManager.java#L957-L968 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/ZigZagEncoding.java | ZigZagEncoding.putInt | static void putInt(ByteBuffer buffer, int value) {
"""
Writes an int value to the given buffer in LEB128-64b9B ZigZag encoded format
@param buffer the buffer to write to
@param value the value to write to the buffer
"""
value = (value << 1) ^ (value >> 31);
if (value >>> 7 == 0) {
buffer.put((byte) value);
} else {
buffer.put((byte) ((value & 0x7F) | 0x80));
if (value >>> 14 == 0) {
buffer.put((byte) (value >>> 7));
} else {
buffer.put((byte) (value >>> 7 | 0x80));
if (value >>> 21 == 0) {
buffer.put((byte) (value >>> 14));
} else {
buffer.put((byte) (value >>> 14 | 0x80));
if (value >>> 28 == 0) {
buffer.put((byte) (value >>> 21));
} else {
buffer.put((byte) (value >>> 21 | 0x80));
buffer.put((byte) (value >>> 28));
}
}
}
}
} | java | static void putInt(ByteBuffer buffer, int value) {
value = (value << 1) ^ (value >> 31);
if (value >>> 7 == 0) {
buffer.put((byte) value);
} else {
buffer.put((byte) ((value & 0x7F) | 0x80));
if (value >>> 14 == 0) {
buffer.put((byte) (value >>> 7));
} else {
buffer.put((byte) (value >>> 7 | 0x80));
if (value >>> 21 == 0) {
buffer.put((byte) (value >>> 14));
} else {
buffer.put((byte) (value >>> 14 | 0x80));
if (value >>> 28 == 0) {
buffer.put((byte) (value >>> 21));
} else {
buffer.put((byte) (value >>> 21 | 0x80));
buffer.put((byte) (value >>> 28));
}
}
}
}
} | [
"static",
"void",
"putInt",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"value",
")",
"{",
"value",
"=",
"(",
"value",
"<<",
"1",
")",
"^",
"(",
"value",
">>",
"31",
")",
";",
"if",
"(",
"value",
">>>",
"7",
"==",
"0",
")",
"{",
"buffer",
".",
"pu... | Writes an int value to the given buffer in LEB128-64b9B ZigZag encoded format
@param buffer the buffer to write to
@param value the value to write to the buffer | [
"Writes",
"an",
"int",
"value",
"to",
"the",
"given",
"buffer",
"in",
"LEB128",
"-",
"64b9B",
"ZigZag",
"encoded",
"format"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/ZigZagEncoding.java#L85-L108 |
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library | src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java | LolChat.addFriendGroup | public FriendGroup addFriendGroup(String name) {
"""
Creates a new FriendGroup. If this FriendGroup contains no Friends when
you logout it will be erased from the server.
@param name
The name of this FriendGroup
@return The new FriendGroup or null if a FriendGroup with this name
already exists.
"""
final RosterGroup g = connection.getRoster().createGroup(name);
if (g != null) {
return new FriendGroup(this, connection, g);
}
return null;
} | java | public FriendGroup addFriendGroup(String name) {
final RosterGroup g = connection.getRoster().createGroup(name);
if (g != null) {
return new FriendGroup(this, connection, g);
}
return null;
} | [
"public",
"FriendGroup",
"addFriendGroup",
"(",
"String",
"name",
")",
"{",
"final",
"RosterGroup",
"g",
"=",
"connection",
".",
"getRoster",
"(",
")",
".",
"createGroup",
"(",
"name",
")",
";",
"if",
"(",
"g",
"!=",
"null",
")",
"{",
"return",
"new",
... | Creates a new FriendGroup. If this FriendGroup contains no Friends when
you logout it will be erased from the server.
@param name
The name of this FriendGroup
@return The new FriendGroup or null if a FriendGroup with this name
already exists. | [
"Creates",
"a",
"new",
"FriendGroup",
".",
"If",
"this",
"FriendGroup",
"contains",
"no",
"Friends",
"when",
"you",
"logout",
"it",
"will",
"be",
"erased",
"from",
"the",
"server",
"."
] | train | https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java#L292-L298 |
dmak/jaxb-xew-plugin | src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java | XmlElementWrapperPlugin.checkAnnotationReference | private void checkAnnotationReference(Map<String, Candidate> candidatesMap, JAnnotatable annotatable) {
"""
For the given annotatable check that all annotations (and all annotations within annotations recursively) do not
refer any candidate for removal.
"""
for (JAnnotationUse annotation : annotatable.annotations()) {
JAnnotationValue annotationMember = getAnnotationMember(annotation, "value");
if (annotationMember instanceof JAnnotationArrayMember) {
checkAnnotationReference(candidatesMap, (JAnnotationArrayMember) annotationMember);
continue;
}
JExpression type = getAnnotationMemberExpression(annotation, "type");
if (type == null) {
// Can be the case for @XmlElement(name = "publication-reference", namespace = "http://mycompany.org/exchange")
// or any other annotation without "type"
continue;
}
Candidate candidate = candidatesMap.get(generableToString(type).replace(".class", ""));
if (candidate != null) {
logger.debug("Candidate " + candidate.getClassName()
+ " is used in XmlElements/XmlElementRef and hence won't be removed.");
candidate.unmarkForRemoval();
}
}
} | java | private void checkAnnotationReference(Map<String, Candidate> candidatesMap, JAnnotatable annotatable) {
for (JAnnotationUse annotation : annotatable.annotations()) {
JAnnotationValue annotationMember = getAnnotationMember(annotation, "value");
if (annotationMember instanceof JAnnotationArrayMember) {
checkAnnotationReference(candidatesMap, (JAnnotationArrayMember) annotationMember);
continue;
}
JExpression type = getAnnotationMemberExpression(annotation, "type");
if (type == null) {
// Can be the case for @XmlElement(name = "publication-reference", namespace = "http://mycompany.org/exchange")
// or any other annotation without "type"
continue;
}
Candidate candidate = candidatesMap.get(generableToString(type).replace(".class", ""));
if (candidate != null) {
logger.debug("Candidate " + candidate.getClassName()
+ " is used in XmlElements/XmlElementRef and hence won't be removed.");
candidate.unmarkForRemoval();
}
}
} | [
"private",
"void",
"checkAnnotationReference",
"(",
"Map",
"<",
"String",
",",
"Candidate",
">",
"candidatesMap",
",",
"JAnnotatable",
"annotatable",
")",
"{",
"for",
"(",
"JAnnotationUse",
"annotation",
":",
"annotatable",
".",
"annotations",
"(",
")",
")",
"{"... | For the given annotatable check that all annotations (and all annotations within annotations recursively) do not
refer any candidate for removal. | [
"For",
"the",
"given",
"annotatable",
"check",
"that",
"all",
"annotations",
"(",
"and",
"all",
"annotations",
"within",
"annotations",
"recursively",
")",
"do",
"not",
"refer",
"any",
"candidate",
"for",
"removal",
"."
] | train | https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L968-L994 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/LoggerFactory.java | LoggerFactory.getLogger | public static Logger getLogger(final String aName, final String aBundleName) {
"""
Gets an {@link XMLResourceBundle} wrapped SLF4J {@link org.slf4j.Logger}.
@param aName A class to use for the logger name
@param aBundleName The name of the resource bundle to use
@return A resource bundle aware logger
"""
final ILoggerFactory factory = org.slf4j.LoggerFactory.getILoggerFactory();
final Logger logger;
if (aBundleName != null) {
logger = new Logger(factory.getLogger(aName), aBundleName);
} else {
logger = new Logger(factory.getLogger(aName));
}
return logger;
} | java | public static Logger getLogger(final String aName, final String aBundleName) {
final ILoggerFactory factory = org.slf4j.LoggerFactory.getILoggerFactory();
final Logger logger;
if (aBundleName != null) {
logger = new Logger(factory.getLogger(aName), aBundleName);
} else {
logger = new Logger(factory.getLogger(aName));
}
return logger;
} | [
"public",
"static",
"Logger",
"getLogger",
"(",
"final",
"String",
"aName",
",",
"final",
"String",
"aBundleName",
")",
"{",
"final",
"ILoggerFactory",
"factory",
"=",
"org",
".",
"slf4j",
".",
"LoggerFactory",
".",
"getILoggerFactory",
"(",
")",
";",
"final",... | Gets an {@link XMLResourceBundle} wrapped SLF4J {@link org.slf4j.Logger}.
@param aName A class to use for the logger name
@param aBundleName The name of the resource bundle to use
@return A resource bundle aware logger | [
"Gets",
"an",
"{",
"@link",
"XMLResourceBundle",
"}",
"wrapped",
"SLF4J",
"{",
"@link",
"org",
".",
"slf4j",
".",
"Logger",
"}",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/LoggerFactory.java#L54-L65 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/db/DBConfiguration.java | DBConfiguration.configureDB | public static void configureDB(JobConf job, String driverClass, String dbUrl) {
"""
Sets the DB access related fields in the JobConf.
@param job the job
@param driverClass JDBC Driver class name
@param dbUrl JDBC DB access URL.
"""
configureDB(job, driverClass, dbUrl, null, null);
} | java | public static void configureDB(JobConf job, String driverClass, String dbUrl) {
configureDB(job, driverClass, dbUrl, null, null);
} | [
"public",
"static",
"void",
"configureDB",
"(",
"JobConf",
"job",
",",
"String",
"driverClass",
",",
"String",
"dbUrl",
")",
"{",
"configureDB",
"(",
"job",
",",
"driverClass",
",",
"dbUrl",
",",
"null",
",",
"null",
")",
";",
"}"
] | Sets the DB access related fields in the JobConf.
@param job the job
@param driverClass JDBC Driver class name
@param dbUrl JDBC DB access URL. | [
"Sets",
"the",
"DB",
"access",
"related",
"fields",
"in",
"the",
"JobConf",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBConfiguration.java#L108-L110 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/MessagesApi.java | MessagesApi.getFieldPresence | public FieldPresenceEnvelope getFieldPresence(Long startDate, Long endDate, String interval, String sdid, String fieldPresence) throws ApiException {
"""
Get normalized message presence
Get normalized message presence.
@param startDate startDate (required)
@param endDate endDate (required)
@param interval String representing grouping interval. One of: 'minute' (1 hour limit), 'hour' (1 day limit), 'day' (31 days limit), 'month' (1 year limit), or 'year' (10 years limit). (required)
@param sdid Source device ID of the messages being searched. (optional)
@param fieldPresence String representing a field from the specified device ID. (optional)
@return FieldPresenceEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<FieldPresenceEnvelope> resp = getFieldPresenceWithHttpInfo(startDate, endDate, interval, sdid, fieldPresence);
return resp.getData();
} | java | public FieldPresenceEnvelope getFieldPresence(Long startDate, Long endDate, String interval, String sdid, String fieldPresence) throws ApiException {
ApiResponse<FieldPresenceEnvelope> resp = getFieldPresenceWithHttpInfo(startDate, endDate, interval, sdid, fieldPresence);
return resp.getData();
} | [
"public",
"FieldPresenceEnvelope",
"getFieldPresence",
"(",
"Long",
"startDate",
",",
"Long",
"endDate",
",",
"String",
"interval",
",",
"String",
"sdid",
",",
"String",
"fieldPresence",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"FieldPresenceEnvelope",
... | Get normalized message presence
Get normalized message presence.
@param startDate startDate (required)
@param endDate endDate (required)
@param interval String representing grouping interval. One of: 'minute' (1 hour limit), 'hour' (1 day limit), 'day' (31 days limit), 'month' (1 year limit), or 'year' (10 years limit). (required)
@param sdid Source device ID of the messages being searched. (optional)
@param fieldPresence String representing a field from the specified device ID. (optional)
@return FieldPresenceEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"normalized",
"message",
"presence",
"Get",
"normalized",
"message",
"presence",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L300-L303 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.providesIn | public static List<ProvidesDirective>
providesIn(Iterable<? extends Directive> directives) {
"""
Returns a list of {@code provides} directives in {@code directives}.
@return a list of {@code provides} directives in {@code directives}
@param directives the directives to filter
@since 9
@spec JPMS
"""
return listFilter(directives, DirectiveKind.PROVIDES, ProvidesDirective.class);
} | java | public static List<ProvidesDirective>
providesIn(Iterable<? extends Directive> directives) {
return listFilter(directives, DirectiveKind.PROVIDES, ProvidesDirective.class);
} | [
"public",
"static",
"List",
"<",
"ProvidesDirective",
">",
"providesIn",
"(",
"Iterable",
"<",
"?",
"extends",
"Directive",
">",
"directives",
")",
"{",
"return",
"listFilter",
"(",
"directives",
",",
"DirectiveKind",
".",
"PROVIDES",
",",
"ProvidesDirective",
"... | Returns a list of {@code provides} directives in {@code directives}.
@return a list of {@code provides} directives in {@code directives}
@param directives the directives to filter
@since 9
@spec JPMS | [
"Returns",
"a",
"list",
"of",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L266-L269 |
geomajas/geomajas-project-client-gwt2 | common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java | DomImpl.assembleId | public String assembleId(String id, String... suffixes) {
"""
Assemble an DOM id.
@param id
base id
@param suffixes
suffixes to add
@return id
"""
StringBuilder sb = new StringBuilder();
if (null != id) {
sb.append(id);
}
for (String s : suffixes) {
sb.append(Dom.ID_SEPARATOR);
sb.append(s);
}
return sb.toString();
} | java | public String assembleId(String id, String... suffixes) {
StringBuilder sb = new StringBuilder();
if (null != id) {
sb.append(id);
}
for (String s : suffixes) {
sb.append(Dom.ID_SEPARATOR);
sb.append(s);
}
return sb.toString();
} | [
"public",
"String",
"assembleId",
"(",
"String",
"id",
",",
"String",
"...",
"suffixes",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"id",
")",
"{",
"sb",
".",
"append",
"(",
"id",
")",
";",
... | Assemble an DOM id.
@param id
base id
@param suffixes
suffixes to add
@return id | [
"Assemble",
"an",
"DOM",
"id",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java#L49-L59 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.order_GET | public ArrayList<OvhOrder> order_GET(String planCode) throws IOException {
"""
Get all cloud pending orders
REST: GET /cloud/order
@param planCode [required] Order plan code
API beta
"""
String qPath = "/cloud/order";
StringBuilder sb = path(qPath);
query(sb, "planCode", planCode);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t25);
} | java | public ArrayList<OvhOrder> order_GET(String planCode) throws IOException {
String qPath = "/cloud/order";
StringBuilder sb = path(qPath);
query(sb, "planCode", planCode);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t25);
} | [
"public",
"ArrayList",
"<",
"OvhOrder",
">",
"order_GET",
"(",
"String",
"planCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/order\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\... | Get all cloud pending orders
REST: GET /cloud/order
@param planCode [required] Order plan code
API beta | [
"Get",
"all",
"cloud",
"pending",
"orders"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2339-L2345 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java | MimeMessageHelper.setAttachments | static void setAttachments(final Email email, final MimeMultipart multipartRoot)
throws MessagingException {
"""
Fills the {@link Message} instance with the attachments from the {@link Email}.
@param email The message in which the attachments are defined.
@param multipartRoot The branch in the email structure in which we'll stuff the attachments.
@throws MessagingException See {@link MimeMultipart#addBodyPart(BodyPart)} and {@link #getBodyPartFromDatasource(AttachmentResource, String)}
"""
for (final AttachmentResource resource : email.getAttachments()) {
multipartRoot.addBodyPart(getBodyPartFromDatasource(resource, Part.ATTACHMENT));
}
} | java | static void setAttachments(final Email email, final MimeMultipart multipartRoot)
throws MessagingException {
for (final AttachmentResource resource : email.getAttachments()) {
multipartRoot.addBodyPart(getBodyPartFromDatasource(resource, Part.ATTACHMENT));
}
} | [
"static",
"void",
"setAttachments",
"(",
"final",
"Email",
"email",
",",
"final",
"MimeMultipart",
"multipartRoot",
")",
"throws",
"MessagingException",
"{",
"for",
"(",
"final",
"AttachmentResource",
"resource",
":",
"email",
".",
"getAttachments",
"(",
")",
")",... | Fills the {@link Message} instance with the attachments from the {@link Email}.
@param email The message in which the attachments are defined.
@param multipartRoot The branch in the email structure in which we'll stuff the attachments.
@throws MessagingException See {@link MimeMultipart#addBodyPart(BodyPart)} and {@link #getBodyPartFromDatasource(AttachmentResource, String)} | [
"Fills",
"the",
"{",
"@link",
"Message",
"}",
"instance",
"with",
"the",
"attachments",
"from",
"the",
"{",
"@link",
"Email",
"}",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L172-L177 |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceOwnerGetApi | private <TResponse> TResponse callServiceOwnerGetApi(
String path, Class<TResponse> responseClass) throws AuthleteApiException {
"""
Call an API with HTTP GET method and Service Owner credentials (without query parameters).
"""
return callServiceOwnerGetApi(path, (Map<String, String>)null, responseClass);
} | java | private <TResponse> TResponse callServiceOwnerGetApi(
String path, Class<TResponse> responseClass) throws AuthleteApiException
{
return callServiceOwnerGetApi(path, (Map<String, String>)null, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callServiceOwnerGetApi",
"(",
"String",
"path",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"AuthleteApiException",
"{",
"return",
"callServiceOwnerGetApi",
"(",
"path",
",",
"(",
"Map",
"<",... | Call an API with HTTP GET method and Service Owner credentials (without query parameters). | [
"Call",
"an",
"API",
"with",
"HTTP",
"GET",
"method",
"and",
"Service",
"Owner",
"credentials",
"(",
"without",
"query",
"parameters",
")",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L252-L256 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java | AptUtils.getElementValue | public static <T> T getElementValue(AnnotationMirror anno, CharSequence name, Class<T> expectedType, boolean useDefaults) {
"""
Get the attribute with the name {@code name} of the annotation
{@code anno}. The result is expected to have type {@code expectedType}.
<em>Note 1</em>: The method does not work well for attributes of an array
type (as it would return a list of {@link AnnotationValue}s). Use
{@code getElementValueArray} instead.
<em>Note 2</em>: The method does not work for attributes of an enum type,
as the AnnotationValue is a VarSymbol and would be cast to the enum type,
which doesn't work. Use {@code getElementValueEnum} instead.
@param anno the annotation to disassemble
@param name the name of the attribute to access
@param expectedType the expected type used to cast the return type
@param useDefaults whether to apply default values to the attribute.
@return the value of the attribute with the given name
"""
Map<? extends ExecutableElement, ? extends AnnotationValue> valmap
= useDefaults
? getElementValuesWithDefaults(anno)
: anno.getElementValues();
for (ExecutableElement elem : valmap.keySet()) {
if (elem.getSimpleName().contentEquals(name)) {
AnnotationValue val = valmap.get(elem);
return expectedType.cast(val.getValue());
}
}
return null;
} | java | public static <T> T getElementValue(AnnotationMirror anno, CharSequence name, Class<T> expectedType, boolean useDefaults) {
Map<? extends ExecutableElement, ? extends AnnotationValue> valmap
= useDefaults
? getElementValuesWithDefaults(anno)
: anno.getElementValues();
for (ExecutableElement elem : valmap.keySet()) {
if (elem.getSimpleName().contentEquals(name)) {
AnnotationValue val = valmap.get(elem);
return expectedType.cast(val.getValue());
}
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getElementValue",
"(",
"AnnotationMirror",
"anno",
",",
"CharSequence",
"name",
",",
"Class",
"<",
"T",
">",
"expectedType",
",",
"boolean",
"useDefaults",
")",
"{",
"Map",
"<",
"?",
"extends",
"ExecutableElement",
",... | Get the attribute with the name {@code name} of the annotation
{@code anno}. The result is expected to have type {@code expectedType}.
<em>Note 1</em>: The method does not work well for attributes of an array
type (as it would return a list of {@link AnnotationValue}s). Use
{@code getElementValueArray} instead.
<em>Note 2</em>: The method does not work for attributes of an enum type,
as the AnnotationValue is a VarSymbol and would be cast to the enum type,
which doesn't work. Use {@code getElementValueEnum} instead.
@param anno the annotation to disassemble
@param name the name of the attribute to access
@param expectedType the expected type used to cast the return type
@param useDefaults whether to apply default values to the attribute.
@return the value of the attribute with the given name | [
"Get",
"the",
"attribute",
"with",
"the",
"name",
"{",
"@code",
"name",
"}",
"of",
"the",
"annotation",
"{",
"@code",
"anno",
"}",
".",
"The",
"result",
"is",
"expected",
"to",
"have",
"type",
"{",
"@code",
"expectedType",
"}",
"."
] | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java#L252-L266 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createConstructorCall | Node createConstructorCall(@Nullable JSType classType, Node callee, Node... args) {
"""
Create a call that returns an instance of the given class type.
<p>This method is intended for use in special cases, such as calling `super()` in a
constructor.
"""
Node result = NodeUtil.newCallNode(callee, args);
if (isAddingTypes()) {
checkNotNull(classType);
FunctionType constructorType = checkNotNull(classType.toMaybeFunctionType());
ObjectType instanceType = checkNotNull(constructorType.getInstanceType());
result.setJSType(instanceType);
}
return result;
} | java | Node createConstructorCall(@Nullable JSType classType, Node callee, Node... args) {
Node result = NodeUtil.newCallNode(callee, args);
if (isAddingTypes()) {
checkNotNull(classType);
FunctionType constructorType = checkNotNull(classType.toMaybeFunctionType());
ObjectType instanceType = checkNotNull(constructorType.getInstanceType());
result.setJSType(instanceType);
}
return result;
} | [
"Node",
"createConstructorCall",
"(",
"@",
"Nullable",
"JSType",
"classType",
",",
"Node",
"callee",
",",
"Node",
"...",
"args",
")",
"{",
"Node",
"result",
"=",
"NodeUtil",
".",
"newCallNode",
"(",
"callee",
",",
"args",
")",
";",
"if",
"(",
"isAddingType... | Create a call that returns an instance of the given class type.
<p>This method is intended for use in special cases, such as calling `super()` in a
constructor. | [
"Create",
"a",
"call",
"that",
"returns",
"an",
"instance",
"of",
"the",
"given",
"class",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L640-L649 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java | InternalLocaleBuilder.checkVariants | private int checkVariants(String variants, String sep) {
"""
/*
Check if the given variant subtags separated by the given
separator(s) are valid
"""
StringTokenIterator itr = new StringTokenIterator(variants, sep);
while (!itr.isDone()) {
String s = itr.current();
if (!LanguageTag.isVariant(s)) {
return itr.currentStart();
}
itr.next();
}
return -1;
} | java | private int checkVariants(String variants, String sep) {
StringTokenIterator itr = new StringTokenIterator(variants, sep);
while (!itr.isDone()) {
String s = itr.current();
if (!LanguageTag.isVariant(s)) {
return itr.currentStart();
}
itr.next();
}
return -1;
} | [
"private",
"int",
"checkVariants",
"(",
"String",
"variants",
",",
"String",
"sep",
")",
"{",
"StringTokenIterator",
"itr",
"=",
"new",
"StringTokenIterator",
"(",
"variants",
",",
"sep",
")",
";",
"while",
"(",
"!",
"itr",
".",
"isDone",
"(",
")",
")",
... | /*
Check if the given variant subtags separated by the given
separator(s) are valid | [
"/",
"*",
"Check",
"if",
"the",
"given",
"variant",
"subtags",
"separated",
"by",
"the",
"given",
"separator",
"(",
"s",
")",
"are",
"valid"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java#L575-L585 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java | FlowScopedContextImpl.getContextualStorage | protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId) {
"""
An implementation has to return the underlying storage which
contains the items held in the Context.
@param createIfNotExist whether a ContextualStorage shall get created if it doesn't yet exist.
@return the underlying storage
"""
//FacesContext facesContext = FacesContext.getCurrentInstance();
//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);
if (clientWindowFlowId == null)
{
throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow");
}
if (createIfNotExist)
{
return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId);
}
else
{
return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId);
}
} | java | protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId)
{
//FacesContext facesContext = FacesContext.getCurrentInstance();
//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);
if (clientWindowFlowId == null)
{
throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow");
}
if (createIfNotExist)
{
return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId);
}
else
{
return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId);
}
} | [
"protected",
"ContextualStorage",
"getContextualStorage",
"(",
"boolean",
"createIfNotExist",
",",
"String",
"clientWindowFlowId",
")",
"{",
"//FacesContext facesContext = FacesContext.getCurrentInstance();",
"//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);",
"if"... | An implementation has to return the underlying storage which
contains the items held in the Context.
@param createIfNotExist whether a ContextualStorage shall get created if it doesn't yet exist.
@return the underlying storage | [
"An",
"implementation",
"has",
"to",
"return",
"the",
"underlying",
"storage",
"which",
"contains",
"the",
"items",
"held",
"in",
"the",
"Context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java#L125-L142 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getRecipientInitialsImage | public byte[] getRecipientInitialsImage(String accountId, String envelopeId, String recipientId) throws ApiException {
"""
Gets the initials image for a user.
Retrieves the initials image for the specified user. The image is returned in the same format as it was uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image. The userId specified in the endpoint must match the authenticated user's user id and the user must be a member of the account. The `signatureIdOrName` paramter accepts signature ID or signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly URL encode. If you use the user name, it is likely that the name includes spaces and you might need to URL encode the name before using it in the endpoint. For example: \"Bob Smith\" to \"Bob%20Smith\" Older envelopes might only contain chromed images. If getting the non-chromed image fails, try getting the chromed image.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipientId The ID of the recipient being accessed. (required)
@return byte[]
"""
return getRecipientInitialsImage(accountId, envelopeId, recipientId, null);
} | java | public byte[] getRecipientInitialsImage(String accountId, String envelopeId, String recipientId) throws ApiException {
return getRecipientInitialsImage(accountId, envelopeId, recipientId, null);
} | [
"public",
"byte",
"[",
"]",
"getRecipientInitialsImage",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"getRecipientInitialsImage",
"(",
"accountId",
",",
"envelopeId",
",",
"reci... | Gets the initials image for a user.
Retrieves the initials image for the specified user. The image is returned in the same format as it was uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image. The userId specified in the endpoint must match the authenticated user's user id and the user must be a member of the account. The `signatureIdOrName` paramter accepts signature ID or signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly URL encode. If you use the user name, it is likely that the name includes spaces and you might need to URL encode the name before using it in the endpoint. For example: \"Bob Smith\" to \"Bob%20Smith\" Older envelopes might only contain chromed images. If getting the non-chromed image fails, try getting the chromed image.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipientId The ID of the recipient being accessed. (required)
@return byte[] | [
"Gets",
"the",
"initials",
"image",
"for",
"a",
"user",
".",
"Retrieves",
"the",
"initials",
"image",
"for",
"the",
"specified",
"user",
".",
"The",
"image",
"is",
"returned",
"in",
"the",
"same",
"format",
"as",
"it",
"was",
"uploaded",
".",
"In",
"the"... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L3216-L3218 |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.getResourceIpAddress | private static String getResourceIpAddress(HttpAcceptSession acceptSession, String parameterName) {
"""
Get the IP address of the resource based on the parameter name
@param acceptSession
@param parameterName can be either 'for' (the IP address of the client/server making the request to this
service), or 'by' (the IP address of this proxy)
@return the IP address based on the parameter name received
"""
String resourceIpAddress = null;
ResourceAddress resourceAddress = null;
switch (parameterName) {
case FORWARDED_FOR:
resourceAddress = acceptSession.getRemoteAddress();
break;
case FORWARDED_BY:
resourceAddress = acceptSession.getLocalAddress();
break;
}
ResourceAddress tcpResourceAddress = resourceAddress.findTransport("tcp");
if (tcpResourceAddress != null) {
URI resource = tcpResourceAddress.getResource();
resourceIpAddress = resource.getHost();
}
return resourceIpAddress;
} | java | private static String getResourceIpAddress(HttpAcceptSession acceptSession, String parameterName) {
String resourceIpAddress = null;
ResourceAddress resourceAddress = null;
switch (parameterName) {
case FORWARDED_FOR:
resourceAddress = acceptSession.getRemoteAddress();
break;
case FORWARDED_BY:
resourceAddress = acceptSession.getLocalAddress();
break;
}
ResourceAddress tcpResourceAddress = resourceAddress.findTransport("tcp");
if (tcpResourceAddress != null) {
URI resource = tcpResourceAddress.getResource();
resourceIpAddress = resource.getHost();
}
return resourceIpAddress;
} | [
"private",
"static",
"String",
"getResourceIpAddress",
"(",
"HttpAcceptSession",
"acceptSession",
",",
"String",
"parameterName",
")",
"{",
"String",
"resourceIpAddress",
"=",
"null",
";",
"ResourceAddress",
"resourceAddress",
"=",
"null",
";",
"switch",
"(",
"paramet... | Get the IP address of the resource based on the parameter name
@param acceptSession
@param parameterName can be either 'for' (the IP address of the client/server making the request to this
service), or 'by' (the IP address of this proxy)
@return the IP address based on the parameter name received | [
"Get",
"the",
"IP",
"address",
"of",
"the",
"resource",
"based",
"on",
"the",
"parameter",
"name"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L553-L571 |
phax/ph-commons | ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java | ScopeManager.onGlobalBegin | @Nonnull
public static IGlobalScope onGlobalBegin (@Nonnull @Nonempty final String sScopeID) {
"""
This method is used to set the initial global scope.
@param sScopeID
The scope ID to use
@return The created global scope object. Never <code>null</code>.
"""
return onGlobalBegin (sScopeID, GlobalScope::new);
} | java | @Nonnull
public static IGlobalScope onGlobalBegin (@Nonnull @Nonempty final String sScopeID)
{
return onGlobalBegin (sScopeID, GlobalScope::new);
} | [
"@",
"Nonnull",
"public",
"static",
"IGlobalScope",
"onGlobalBegin",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sScopeID",
")",
"{",
"return",
"onGlobalBegin",
"(",
"sScopeID",
",",
"GlobalScope",
"::",
"new",
")",
";",
"}"
] | This method is used to set the initial global scope.
@param sScopeID
The scope ID to use
@return The created global scope object. Never <code>null</code>. | [
"This",
"method",
"is",
"used",
"to",
"set",
"the",
"initial",
"global",
"scope",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java#L123-L127 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.supertypesFor | protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType,
Collection<JcrNodeType> pendingTypes ) throws RepositoryException {
"""
Returns the list of node types for the supertypes defined in the given node type.
@param nodeType a node type with a non-null array of supertypes
@param pendingTypes the list of types that have been processed in this type batch but not yet committed to the repository's
set of types
@return a list of node types where each element is the node type for the corresponding element of the array of supertype
names
@throws RepositoryException if any of the names in the array of supertype names does not correspond to an
already-registered node type or a node type that is pending registration
"""
assert nodeType != null;
List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>();
boolean isMixin = nodeType.isMixin();
boolean needsPrimaryAncestor = !isMixin;
String nodeTypeName = nodeType.getName();
for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) {
Name supertypeName = nameFactory.create(supertypeNameStr);
JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes);
if (supertype == null) {
throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName));
}
needsPrimaryAncestor &= supertype.isMixin();
supertypes.add(supertype);
}
// primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base
if (needsPrimaryAncestor) {
Name nodeName = nameFactory.create(nodeTypeName);
if (!JcrNtLexicon.BASE.equals(nodeName)) {
JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
assert ntBase != null;
supertypes.add(0, ntBase);
}
}
return supertypes;
} | java | protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType,
Collection<JcrNodeType> pendingTypes ) throws RepositoryException {
assert nodeType != null;
List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>();
boolean isMixin = nodeType.isMixin();
boolean needsPrimaryAncestor = !isMixin;
String nodeTypeName = nodeType.getName();
for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) {
Name supertypeName = nameFactory.create(supertypeNameStr);
JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes);
if (supertype == null) {
throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName));
}
needsPrimaryAncestor &= supertype.isMixin();
supertypes.add(supertype);
}
// primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base
if (needsPrimaryAncestor) {
Name nodeName = nameFactory.create(nodeTypeName);
if (!JcrNtLexicon.BASE.equals(nodeName)) {
JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
assert ntBase != null;
supertypes.add(0, ntBase);
}
}
return supertypes;
} | [
"protected",
"List",
"<",
"JcrNodeType",
">",
"supertypesFor",
"(",
"NodeTypeDefinition",
"nodeType",
",",
"Collection",
"<",
"JcrNodeType",
">",
"pendingTypes",
")",
"throws",
"RepositoryException",
"{",
"assert",
"nodeType",
"!=",
"null",
";",
"List",
"<",
"JcrN... | Returns the list of node types for the supertypes defined in the given node type.
@param nodeType a node type with a non-null array of supertypes
@param pendingTypes the list of types that have been processed in this type batch but not yet committed to the repository's
set of types
@return a list of node types where each element is the node type for the corresponding element of the array of supertype
names
@throws RepositoryException if any of the names in the array of supertype names does not correspond to an
already-registered node type or a node type that is pending registration | [
"Returns",
"the",
"list",
"of",
"node",
"types",
"for",
"the",
"supertypes",
"defined",
"in",
"the",
"given",
"node",
"type",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1899-L1929 |
upwork/java-upwork | src/com/Upwork/api/Routers/Messages.java | Messages.createRoom | public JSONObject createRoom(String company, HashMap<String, String> params) throws JSONException {
"""
Create a new room
@param company Company ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
"""
return oClient.post("/messages/v3/" + company + "/rooms", params);
} | java | public JSONObject createRoom(String company, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms", params);
} | [
"public",
"JSONObject",
"createRoom",
"(",
"String",
"company",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms\"",
","... | Create a new room
@param company Company ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Create",
"a",
"new",
"room"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L113-L115 |
tvesalainen/util | security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java | SSLSocketChannel.open | public static SSLSocketChannel open(String peer, int port) throws IOException {
"""
Creates connection to a named peer using default SSLContext. Connection
is in client mode but can be changed before read/write.
@param peer
@param port
@return
@throws IOException
"""
try
{
return open(peer, port, SSLContext.getDefault());
}
catch (NoSuchAlgorithmException ex)
{
throw new IOException(ex);
}
} | java | public static SSLSocketChannel open(String peer, int port) throws IOException
{
try
{
return open(peer, port, SSLContext.getDefault());
}
catch (NoSuchAlgorithmException ex)
{
throw new IOException(ex);
}
} | [
"public",
"static",
"SSLSocketChannel",
"open",
"(",
"String",
"peer",
",",
"int",
"port",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"open",
"(",
"peer",
",",
"port",
",",
"SSLContext",
".",
"getDefault",
"(",
")",
")",
";",
"}",
"catch",
... | Creates connection to a named peer using default SSLContext. Connection
is in client mode but can be changed before read/write.
@param peer
@param port
@return
@throws IOException | [
"Creates",
"connection",
"to",
"a",
"named",
"peer",
"using",
"default",
"SSLContext",
".",
"Connection",
"is",
"in",
"client",
"mode",
"but",
"can",
"be",
"changed",
"before",
"read",
"/",
"write",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java#L61-L71 |
google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteClass.java | Es6RewriteClass.getQualifiedMemberAccess | private Node getQualifiedMemberAccess(Node member, ClassDeclarationMetadata metadata) {
"""
Constructs a Node that represents an access to the given class member, qualified by either the
static or the instance access context, depending on whether the member is static.
<p><b>WARNING:</b> {@code member} may be modified/destroyed by this method, do not use it
afterwards.
"""
Node context =
member.isStaticMember()
? metadata.getFullClassNameNode().cloneTree()
: metadata.getClassPrototypeNode().cloneTree();
// context.useSourceInfoIfMissingFromForTree(member);
context.makeNonIndexableRecursive();
if (member.isComputedProp()) {
return astFactory
.createGetElem(context, member.removeFirstChild())
.useSourceInfoIfMissingFromForTree(member);
} else {
Node methodName = member.getFirstFirstChild();
return astFactory
.createGetProp(context, member.getString())
.useSourceInfoFromForTree(methodName);
}
} | java | private Node getQualifiedMemberAccess(Node member, ClassDeclarationMetadata metadata) {
Node context =
member.isStaticMember()
? metadata.getFullClassNameNode().cloneTree()
: metadata.getClassPrototypeNode().cloneTree();
// context.useSourceInfoIfMissingFromForTree(member);
context.makeNonIndexableRecursive();
if (member.isComputedProp()) {
return astFactory
.createGetElem(context, member.removeFirstChild())
.useSourceInfoIfMissingFromForTree(member);
} else {
Node methodName = member.getFirstFirstChild();
return astFactory
.createGetProp(context, member.getString())
.useSourceInfoFromForTree(methodName);
}
} | [
"private",
"Node",
"getQualifiedMemberAccess",
"(",
"Node",
"member",
",",
"ClassDeclarationMetadata",
"metadata",
")",
"{",
"Node",
"context",
"=",
"member",
".",
"isStaticMember",
"(",
")",
"?",
"metadata",
".",
"getFullClassNameNode",
"(",
")",
".",
"cloneTree"... | Constructs a Node that represents an access to the given class member, qualified by either the
static or the instance access context, depending on whether the member is static.
<p><b>WARNING:</b> {@code member} may be modified/destroyed by this method, do not use it
afterwards. | [
"Constructs",
"a",
"Node",
"that",
"represents",
"an",
"access",
"to",
"the",
"given",
"class",
"member",
"qualified",
"by",
"either",
"the",
"static",
"or",
"the",
"instance",
"access",
"context",
"depending",
"on",
"whether",
"the",
"member",
"is",
"static",... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteClass.java#L555-L572 |
janus-project/guava.janusproject.io | guava/src/com/google/common/io/CharStreams.java | CharStreams.copy | public static long copy(Readable from, Appendable to) throws IOException {
"""
Copies all characters between the {@link Readable} and {@link Appendable}
objects. Does not close or flush either object.
@param from the object to read from
@param to the object to write to
@return the number of characters copied
@throws IOException if an I/O error occurs
"""
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = CharBuffer.allocate(BUF_SIZE);
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | java | public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = CharBuffer.allocate(BUF_SIZE);
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | [
"public",
"static",
"long",
"copy",
"(",
"Readable",
"from",
",",
"Appendable",
"to",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"from",
")",
";",
"checkNotNull",
"(",
"to",
")",
";",
"CharBuffer",
"buf",
"=",
"CharBuffer",
".",
"allocate",
"(... | Copies all characters between the {@link Readable} and {@link Appendable}
objects. Does not close or flush either object.
@param from the object to read from
@param to the object to write to
@return the number of characters copied
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"characters",
"between",
"the",
"{",
"@link",
"Readable",
"}",
"and",
"{",
"@link",
"Appendable",
"}",
"objects",
".",
"Does",
"not",
"close",
"or",
"flush",
"either",
"object",
"."
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/io/CharStreams.java#L63-L75 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/db/mongo/JongoUtils.java | JongoUtils.generateQuery | public static String generateQuery(final String key, final Object value) {
"""
Generate a Jongo query with provided the parameter.
@param key
@param value
@return String
"""
final Map<String, Object> params = new HashMap<>();
params.put(key, value);
return generateQuery(params);
} | java | public static String generateQuery(final String key, final Object value) {
final Map<String, Object> params = new HashMap<>();
params.put(key, value);
return generateQuery(params);
} | [
"public",
"static",
"String",
"generateQuery",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",... | Generate a Jongo query with provided the parameter.
@param key
@param value
@return String | [
"Generate",
"a",
"Jongo",
"query",
"with",
"provided",
"the",
"parameter",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/mongo/JongoUtils.java#L55-L59 |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java | XmlDescriptorHelper.createIcon | public static IconDescriptor createIcon(IconType iconType, Store store) {
"""
Create an icon descriptor.
@param iconType
The XML icon type.
@param store
The store
@return The icon descriptor.
"""
IconDescriptor iconDescriptor = store.create(IconDescriptor.class);
iconDescriptor.setLang(iconType.getLang());
PathType largeIcon = iconType.getLargeIcon();
if (largeIcon != null) {
iconDescriptor.setLargeIcon(largeIcon.getValue());
}
PathType smallIcon = iconType.getSmallIcon();
if (smallIcon != null) {
iconDescriptor.setSmallIcon(smallIcon.getValue());
}
return iconDescriptor;
} | java | public static IconDescriptor createIcon(IconType iconType, Store store) {
IconDescriptor iconDescriptor = store.create(IconDescriptor.class);
iconDescriptor.setLang(iconType.getLang());
PathType largeIcon = iconType.getLargeIcon();
if (largeIcon != null) {
iconDescriptor.setLargeIcon(largeIcon.getValue());
}
PathType smallIcon = iconType.getSmallIcon();
if (smallIcon != null) {
iconDescriptor.setSmallIcon(smallIcon.getValue());
}
return iconDescriptor;
} | [
"public",
"static",
"IconDescriptor",
"createIcon",
"(",
"IconType",
"iconType",
",",
"Store",
"store",
")",
"{",
"IconDescriptor",
"iconDescriptor",
"=",
"store",
".",
"create",
"(",
"IconDescriptor",
".",
"class",
")",
";",
"iconDescriptor",
".",
"setLang",
"(... | Create an icon descriptor.
@param iconType
The XML icon type.
@param store
The store
@return The icon descriptor. | [
"Create",
"an",
"icon",
"descriptor",
"."
] | train | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java#L38-L50 |
sockeqwe/mosby | presentermanager/src/main/java/com/hannesdorfmann/mosby3/PresenterManager.java | PresenterManager.getViewState | @Nullable public static <VS> VS getViewState(@NonNull Activity activity, @NonNull String viewId) {
"""
Get the ViewState (see mosby viestate modlue) for the View with the given (Mosby - internal)
view Id or <code>null</code>
if no viewstate for the given view exists.
@param activity The Activity (used for scoping)
@param viewId The mosby internal View Id (unique among all {@link MvpView}
@param <VS> The type of the ViewState type
@return The Presenter or <code>null</code>
"""
if (activity == null) {
throw new NullPointerException("Activity is null");
}
if (viewId == null) {
throw new NullPointerException("View id is null");
}
ActivityScopedCache scopedCache = getActivityScope(activity);
return scopedCache == null ? null : (VS) scopedCache.getViewState(viewId);
} | java | @Nullable public static <VS> VS getViewState(@NonNull Activity activity, @NonNull String viewId) {
if (activity == null) {
throw new NullPointerException("Activity is null");
}
if (viewId == null) {
throw new NullPointerException("View id is null");
}
ActivityScopedCache scopedCache = getActivityScope(activity);
return scopedCache == null ? null : (VS) scopedCache.getViewState(viewId);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"VS",
">",
"VS",
"getViewState",
"(",
"@",
"NonNull",
"Activity",
"activity",
",",
"@",
"NonNull",
"String",
"viewId",
")",
"{",
"if",
"(",
"activity",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException"... | Get the ViewState (see mosby viestate modlue) for the View with the given (Mosby - internal)
view Id or <code>null</code>
if no viewstate for the given view exists.
@param activity The Activity (used for scoping)
@param viewId The mosby internal View Id (unique among all {@link MvpView}
@param <VS> The type of the ViewState type
@return The Presenter or <code>null</code> | [
"Get",
"the",
"ViewState",
"(",
"see",
"mosby",
"viestate",
"modlue",
")",
"for",
"the",
"View",
"with",
"the",
"given",
"(",
"Mosby",
"-",
"internal",
")",
"view",
"Id",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"viewstate",
"for",
... | train | https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/presentermanager/src/main/java/com/hannesdorfmann/mosby3/PresenterManager.java#L195-L206 |
JetBrains/xodus | entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java | PersistentEntityStoreImpl.clearProperties | @SuppressWarnings( {
"""
Clears all properties of specified entity.
@param entity to clear.
""""OverlyLongMethod"})
public void clearProperties(@NotNull final PersistentStoreTransaction txn, @NotNull final Entity entity) {
final Transaction envTxn = txn.getEnvironmentTransaction();
final PersistentEntityId id = (PersistentEntityId) entity.getId();
final int entityTypeId = id.getTypeId();
final long entityLocalId = id.getLocalId();
final PropertiesTable properties = getPropertiesTable(txn, entityTypeId);
final PropertyKey propertyKey = new PropertyKey(entityLocalId, 0);
try (Cursor cursor = getPrimaryPropertyIndexCursor(txn, properties)) {
for (boolean success = cursor.getSearchKeyRange(PropertyKey.propertyKeyToEntry(propertyKey)) != null;
success; success = cursor.getNext()) {
ByteIterable keyEntry = cursor.getKey();
final PropertyKey key = PropertyKey.entryToPropertyKey(keyEntry);
if (key.getEntityLocalId() != entityLocalId) {
break;
}
final int propertyId = key.getPropertyId();
final ByteIterable value = cursor.getValue();
final PropertyValue propValue = propertyTypes.entryToPropertyValue(value);
txn.propertyChanged(id, propertyId, propValue.getData(), null);
properties.deleteNoFail(txn, entityLocalId, value, propertyId, propValue.getType());
}
}
} | java | @SuppressWarnings({"OverlyLongMethod"})
public void clearProperties(@NotNull final PersistentStoreTransaction txn, @NotNull final Entity entity) {
final Transaction envTxn = txn.getEnvironmentTransaction();
final PersistentEntityId id = (PersistentEntityId) entity.getId();
final int entityTypeId = id.getTypeId();
final long entityLocalId = id.getLocalId();
final PropertiesTable properties = getPropertiesTable(txn, entityTypeId);
final PropertyKey propertyKey = new PropertyKey(entityLocalId, 0);
try (Cursor cursor = getPrimaryPropertyIndexCursor(txn, properties)) {
for (boolean success = cursor.getSearchKeyRange(PropertyKey.propertyKeyToEntry(propertyKey)) != null;
success; success = cursor.getNext()) {
ByteIterable keyEntry = cursor.getKey();
final PropertyKey key = PropertyKey.entryToPropertyKey(keyEntry);
if (key.getEntityLocalId() != entityLocalId) {
break;
}
final int propertyId = key.getPropertyId();
final ByteIterable value = cursor.getValue();
final PropertyValue propValue = propertyTypes.entryToPropertyValue(value);
txn.propertyChanged(id, propertyId, propValue.getData(), null);
properties.deleteNoFail(txn, entityLocalId, value, propertyId, propValue.getType());
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"OverlyLongMethod\"",
"}",
")",
"public",
"void",
"clearProperties",
"(",
"@",
"NotNull",
"final",
"PersistentStoreTransaction",
"txn",
",",
"@",
"NotNull",
"final",
"Entity",
"entity",
")",
"{",
"final",
"Transaction",
"envTxn... | Clears all properties of specified entity.
@param entity to clear. | [
"Clears",
"all",
"properties",
"of",
"specified",
"entity",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java#L967-L990 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java | ModeledUserGroup.setRestrictedAttributes | private void setRestrictedAttributes(Map<String, String> attributes) {
"""
Stores all restricted (privileged) attributes within the underlying user
group model, pulling the values of those attributes from the given Map.
@param attributes
The Map to pull all restricted attributes from.
"""
// Translate disabled attribute
getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));
} | java | private void setRestrictedAttributes(Map<String, String> attributes) {
// Translate disabled attribute
getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));
} | [
"private",
"void",
"setRestrictedAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"// Translate disabled attribute",
"getModel",
"(",
")",
".",
"setDisabled",
"(",
"\"true\"",
".",
"equals",
"(",
"attributes",
".",
"get",
"(",
... | Stores all restricted (privileged) attributes within the underlying user
group model, pulling the values of those attributes from the given Map.
@param attributes
The Map to pull all restricted attributes from. | [
"Stores",
"all",
"restricted",
"(",
"privileged",
")",
"attributes",
"within",
"the",
"underlying",
"user",
"group",
"model",
"pulling",
"the",
"values",
"of",
"those",
"attributes",
"from",
"the",
"given",
"Map",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java#L148-L153 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.updateAsync | public Observable<BlobContainerInner> updateAsync(String resourceGroupName, String accountName, String containerName) {
"""
Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BlobContainerInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() {
@Override
public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) {
return response.body();
}
});
} | java | public Observable<BlobContainerInner> updateAsync(String resourceGroupName, String accountName, String containerName) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() {
@Override
public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BlobContainerInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
"... | Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BlobContainerInner object | [
"Updates",
"container",
"properties",
"as",
"specified",
"in",
"request",
"body",
".",
"Properties",
"not",
"mentioned",
"in",
"the",
"request",
"will",
"be",
"unchanged",
".",
"Update",
"fails",
"if",
"the",
"specified",
"container",
"doesn",
"t",
"already",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L439-L446 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawImage | public void drawImage (final PDInlineImage inlineImage, final float x, final float y) throws IOException {
"""
Draw an inline image at the x,y coordinates, with the default size of the
image.
@param inlineImage
The inline image to draw.
@param x
The x-coordinate to draw the inline image.
@param y
The y-coordinate to draw the inline image.
@throws IOException
If there is an error writing to the stream.
"""
drawImage (inlineImage, x, y, inlineImage.getWidth (), inlineImage.getHeight ());
} | java | public void drawImage (final PDInlineImage inlineImage, final float x, final float y) throws IOException
{
drawImage (inlineImage, x, y, inlineImage.getWidth (), inlineImage.getHeight ());
} | [
"public",
"void",
"drawImage",
"(",
"final",
"PDInlineImage",
"inlineImage",
",",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"drawImage",
"(",
"inlineImage",
",",
"x",
",",
"y",
",",
"inlineImage",
".",
"getWidth",
... | Draw an inline image at the x,y coordinates, with the default size of the
image.
@param inlineImage
The inline image to draw.
@param x
The x-coordinate to draw the inline image.
@param y
The y-coordinate to draw the inline image.
@throws IOException
If there is an error writing to the stream. | [
"Draw",
"an",
"inline",
"image",
"at",
"the",
"x",
"y",
"coordinates",
"with",
"the",
"default",
"size",
"of",
"the",
"image",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L545-L548 |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java | BaseTransform.writeAttribute | protected void writeAttribute(OutputStream outputStream, String name, String value) {
"""
Write the attribute's name/value pair to the output stream.
@param outputStream The output stream.
@param name The attribute name.
@param value The attribute value.
"""
if (value != null) {
write(outputStream, " " + name + "=\"" + value + "\"");
}
} | java | protected void writeAttribute(OutputStream outputStream, String name, String value) {
if (value != null) {
write(outputStream, " " + name + "=\"" + value + "\"");
}
} | [
"protected",
"void",
"writeAttribute",
"(",
"OutputStream",
"outputStream",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"write",
"(",
"outputStream",
",",
"\" \"",
"+",
"name",
"+",
"\"=\\\"\"",
"+",... | Write the attribute's name/value pair to the output stream.
@param outputStream The output stream.
@param name The attribute name.
@param value The attribute value. | [
"Write",
"the",
"attribute",
"s",
"name",
"/",
"value",
"pair",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java#L98-L102 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java | RaftServiceContext.openSession | public long openSession(long index, long timestamp, RaftSession session) {
"""
Registers the given session.
@param index The index of the registration.
@param timestamp The timestamp of the registration.
@param session The session to register.
"""
log.debug("Opening session {}", session.sessionId());
// Update the state machine index/timestamp.
tick(index, timestamp);
// Set the session timestamp to the current service timestamp.
session.setLastUpdated(currentTimestamp);
// Expire sessions that have timed out.
expireSessions(currentTimestamp);
// Add the session to the sessions list.
session.open();
service.register(sessions.addSession(session));
// Commit the index, causing events to be sent to clients if necessary.
commit();
// Complete the future.
return session.sessionId().id();
} | java | public long openSession(long index, long timestamp, RaftSession session) {
log.debug("Opening session {}", session.sessionId());
// Update the state machine index/timestamp.
tick(index, timestamp);
// Set the session timestamp to the current service timestamp.
session.setLastUpdated(currentTimestamp);
// Expire sessions that have timed out.
expireSessions(currentTimestamp);
// Add the session to the sessions list.
session.open();
service.register(sessions.addSession(session));
// Commit the index, causing events to be sent to clients if necessary.
commit();
// Complete the future.
return session.sessionId().id();
} | [
"public",
"long",
"openSession",
"(",
"long",
"index",
",",
"long",
"timestamp",
",",
"RaftSession",
"session",
")",
"{",
"log",
".",
"debug",
"(",
"\"Opening session {}\"",
",",
"session",
".",
"sessionId",
"(",
")",
")",
";",
"// Update the state machine index... | Registers the given session.
@param index The index of the registration.
@param timestamp The timestamp of the registration.
@param session The session to register. | [
"Registers",
"the",
"given",
"session",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java#L326-L347 |
amzn/ion-java | src/com/amazon/ion/impl/IonReaderBinaryRawX.java | IonReaderBinaryRawX.readAll | public void readAll(byte[] buf, int offset, int len) throws IOException {
"""
Uses {@link #read(byte[], int, int)} until the entire length is read.
This method will block until the request is satisfied.
@param buf The buffer to read to.
@param offset The offset of the buffer to read from.
@param len The length of the data to read.
"""
int rem = len;
while (rem > 0)
{
int amount = read(buf, offset, rem);
if (amount <= 0)
{
throwUnexpectedEOFException();
}
rem -= amount;
offset += amount;
}
} | java | public void readAll(byte[] buf, int offset, int len) throws IOException
{
int rem = len;
while (rem > 0)
{
int amount = read(buf, offset, rem);
if (amount <= 0)
{
throwUnexpectedEOFException();
}
rem -= amount;
offset += amount;
}
} | [
"public",
"void",
"readAll",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"rem",
"=",
"len",
";",
"while",
"(",
"rem",
">",
"0",
")",
"{",
"int",
"amount",
"=",
"read",
"(",
"buf... | Uses {@link #read(byte[], int, int)} until the entire length is read.
This method will block until the request is satisfied.
@param buf The buffer to read to.
@param offset The offset of the buffer to read from.
@param len The length of the data to read. | [
"Uses",
"{",
"@link",
"#read",
"(",
"byte",
"[]",
"int",
"int",
")",
"}",
"until",
"the",
"entire",
"length",
"is",
"read",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"request",
"is",
"satisfied",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderBinaryRawX.java#L807-L820 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/history/CmsHistoryDialog.java | CmsHistoryDialog.openChildDialog | public static void openChildDialog(Component currentComponent, Component newView, String newCaption) {
"""
Replaces the contents of the window containing a given component with a basic dialog
consisting of a back button to restore the previous window state and another user provided widget.<p>
@param currentComponent the component whose parent window's content should be replaced
@param newView the user supplied part of the new window content
@param newCaption the caption for the child dialog
"""
final Window window = CmsVaadinUtils.getWindow(currentComponent);
final String oldCaption = window.getCaption();
CmsBasicDialog dialog = new CmsBasicDialog();
VerticalLayout vl = new VerticalLayout();
dialog.setContent(vl);
Button backButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_CHILD_DIALOG_GO_BACK_0));
HorizontalLayout buttonBar = new HorizontalLayout();
buttonBar.addComponent(backButton);
buttonBar.setMargin(true);
vl.addComponent(buttonBar);
vl.addComponent(newView);
final Component oldContent = window.getContent();
if (oldContent instanceof CmsBasicDialog) {
List<CmsResource> infoResources = ((CmsBasicDialog)oldContent).getInfoResources();
dialog.displayResourceInfo(infoResources);
if (oldContent instanceof CmsHistoryDialog) {
dialog.addButton(((CmsHistoryDialog)oldContent).createCloseButton());
}
}
backButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
window.setContent(oldContent);
window.setCaption(oldCaption);
window.center();
}
});
window.setContent(dialog);
window.setCaption(newCaption);
window.center();
} | java | public static void openChildDialog(Component currentComponent, Component newView, String newCaption) {
final Window window = CmsVaadinUtils.getWindow(currentComponent);
final String oldCaption = window.getCaption();
CmsBasicDialog dialog = new CmsBasicDialog();
VerticalLayout vl = new VerticalLayout();
dialog.setContent(vl);
Button backButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_CHILD_DIALOG_GO_BACK_0));
HorizontalLayout buttonBar = new HorizontalLayout();
buttonBar.addComponent(backButton);
buttonBar.setMargin(true);
vl.addComponent(buttonBar);
vl.addComponent(newView);
final Component oldContent = window.getContent();
if (oldContent instanceof CmsBasicDialog) {
List<CmsResource> infoResources = ((CmsBasicDialog)oldContent).getInfoResources();
dialog.displayResourceInfo(infoResources);
if (oldContent instanceof CmsHistoryDialog) {
dialog.addButton(((CmsHistoryDialog)oldContent).createCloseButton());
}
}
backButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
window.setContent(oldContent);
window.setCaption(oldCaption);
window.center();
}
});
window.setContent(dialog);
window.setCaption(newCaption);
window.center();
} | [
"public",
"static",
"void",
"openChildDialog",
"(",
"Component",
"currentComponent",
",",
"Component",
"newView",
",",
"String",
"newCaption",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsVaadinUtils",
".",
"getWindow",
"(",
"currentComponent",
")",
";",
"final... | Replaces the contents of the window containing a given component with a basic dialog
consisting of a back button to restore the previous window state and another user provided widget.<p>
@param currentComponent the component whose parent window's content should be replaced
@param newView the user supplied part of the new window content
@param newCaption the caption for the child dialog | [
"Replaces",
"the",
"contents",
"of",
"the",
"window",
"containing",
"a",
"given",
"component",
"with",
"a",
"basic",
"dialog",
"consisting",
"of",
"a",
"back",
"button",
"to",
"restore",
"the",
"previous",
"window",
"state",
"and",
"another",
"user",
"provided... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/history/CmsHistoryDialog.java#L206-L245 |
h2oai/h2o-3 | h2o-core/src/main/java/hex/ModelMetricsRegression.java | ModelMetricsRegression.make | static public ModelMetricsRegression make(Vec predicted, Vec actual, DistributionFamily family) {
"""
Build a Regression ModelMetrics object from predicted and actual targets
@param predicted A Vec containing predicted values
@param actual A Vec containing the actual target values
@return ModelMetrics object
"""
if (predicted == null || actual == null)
throw new IllegalArgumentException("Missing actual or predicted targets for regression metrics!");
if (!predicted.isNumeric())
throw new IllegalArgumentException("Predicted values must be numeric for regression metrics.");
if (!actual.isNumeric())
throw new IllegalArgumentException("Actual values must be numeric for regression metrics.");
if (family == DistributionFamily.quantile || family == DistributionFamily.tweedie || family == DistributionFamily.huber)
throw new IllegalArgumentException("Unsupported distribution family, requires additional parameters which cannot be specified right now.");
Frame predsActual = new Frame(predicted);
predsActual.add("actual", actual);
MetricBuilderRegression mb = new RegressionMetrics(family).doAll(predsActual)._mb;
ModelMetricsRegression mm = (ModelMetricsRegression)mb.makeModelMetrics(null, predsActual, null, null);
mm._description = "Computed on user-given predictions and targets, distribution: " + (family ==null? DistributionFamily.gaussian.toString(): family.toString()) + ".";
return mm;
} | java | static public ModelMetricsRegression make(Vec predicted, Vec actual, DistributionFamily family) {
if (predicted == null || actual == null)
throw new IllegalArgumentException("Missing actual or predicted targets for regression metrics!");
if (!predicted.isNumeric())
throw new IllegalArgumentException("Predicted values must be numeric for regression metrics.");
if (!actual.isNumeric())
throw new IllegalArgumentException("Actual values must be numeric for regression metrics.");
if (family == DistributionFamily.quantile || family == DistributionFamily.tweedie || family == DistributionFamily.huber)
throw new IllegalArgumentException("Unsupported distribution family, requires additional parameters which cannot be specified right now.");
Frame predsActual = new Frame(predicted);
predsActual.add("actual", actual);
MetricBuilderRegression mb = new RegressionMetrics(family).doAll(predsActual)._mb;
ModelMetricsRegression mm = (ModelMetricsRegression)mb.makeModelMetrics(null, predsActual, null, null);
mm._description = "Computed on user-given predictions and targets, distribution: " + (family ==null? DistributionFamily.gaussian.toString(): family.toString()) + ".";
return mm;
} | [
"static",
"public",
"ModelMetricsRegression",
"make",
"(",
"Vec",
"predicted",
",",
"Vec",
"actual",
",",
"DistributionFamily",
"family",
")",
"{",
"if",
"(",
"predicted",
"==",
"null",
"||",
"actual",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException... | Build a Regression ModelMetrics object from predicted and actual targets
@param predicted A Vec containing predicted values
@param actual A Vec containing the actual target values
@return ModelMetrics object | [
"Build",
"a",
"Regression",
"ModelMetrics",
"object",
"from",
"predicted",
"and",
"actual",
"targets"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/ModelMetricsRegression.java#L56-L71 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.isTrue | public static void isTrue (@Nonnull final BooleanSupplier aValue, final String sMsg) {
"""
Check that the passed value is <code>true</code>.
@param aValue
The value to check.
@param sMsg
The message to be emitted in case the value is <code>false</code>
@throws IllegalArgumentException
if the passed value is not <code>null</code>.
"""
if (isEnabled ())
isTrue (aValue, () -> sMsg);
} | java | public static void isTrue (@Nonnull final BooleanSupplier aValue, final String sMsg)
{
if (isEnabled ())
isTrue (aValue, () -> sMsg);
} | [
"public",
"static",
"void",
"isTrue",
"(",
"@",
"Nonnull",
"final",
"BooleanSupplier",
"aValue",
",",
"final",
"String",
"sMsg",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"isTrue",
"(",
"aValue",
",",
"(",
")",
"->",
"sMsg",
")",
";",
"}"
] | Check that the passed value is <code>true</code>.
@param aValue
The value to check.
@param sMsg
The message to be emitted in case the value is <code>false</code>
@throws IllegalArgumentException
if the passed value is not <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"<code",
">",
"true<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L119-L123 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/SSLSocketFactoryEx.java | SSLSocketFactoryEx.initSSLSocketFactoryEx | private void initSSLSocketFactoryEx(KeyManager[] km, TrustManager[] tm, SecureRandom random)
throws NoSuchAlgorithmException, KeyManagementException {
"""
Initializes the SSL Socket Factory Extension.
@param km the key managers
@param tm the trust managers
@param random the secure random number generator
@throws NoSuchAlgorithmException thrown when an algorithm is not
supported
@throws KeyManagementException thrown if initialization fails
"""
sslCtxt = SSLContext.getInstance("TLS");
sslCtxt.init(km, tm, random);
protocols = getProtocolList();
} | java | private void initSSLSocketFactoryEx(KeyManager[] km, TrustManager[] tm, SecureRandom random)
throws NoSuchAlgorithmException, KeyManagementException {
sslCtxt = SSLContext.getInstance("TLS");
sslCtxt.init(km, tm, random);
protocols = getProtocolList();
} | [
"private",
"void",
"initSSLSocketFactoryEx",
"(",
"KeyManager",
"[",
"]",
"km",
",",
"TrustManager",
"[",
"]",
"tm",
",",
"SecureRandom",
"random",
")",
"throws",
"NoSuchAlgorithmException",
",",
"KeyManagementException",
"{",
"sslCtxt",
"=",
"SSLContext",
".",
"g... | Initializes the SSL Socket Factory Extension.
@param km the key managers
@param tm the trust managers
@param random the secure random number generator
@throws NoSuchAlgorithmException thrown when an algorithm is not
supported
@throws KeyManagementException thrown if initialization fails | [
"Initializes",
"the",
"SSL",
"Socket",
"Factory",
"Extension",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/SSLSocketFactoryEx.java#L226-L232 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathFinderImpl.java | PathFinderImpl.isValidLocation | private boolean isValidLocation(Pathfindable mover, int stx, int sty, int dtx, int dty, boolean ignoreRef) {
"""
Check if a given location is valid for the supplied mover.
@param mover The mover that would hold a given location.
@param stx The starting x coordinate.
@param sty The starting y coordinate.
@param dtx The x coordinate of the location to check.
@param dty The y coordinate of the location to check.
@param ignoreRef The ignore map reference array checking.
@return <code>true</code> if the location is valid for the given mover, <code>false</code> else.
"""
boolean invalid = dtx < 0 || dty < 0 || dtx >= map.getInTileWidth() || dty >= map.getInTileHeight();
if (!invalid && (stx != dtx || sty != dty))
{
invalid = mapPath.isBlocked(mover, dtx, dty, ignoreRef);
}
return !invalid;
} | java | private boolean isValidLocation(Pathfindable mover, int stx, int sty, int dtx, int dty, boolean ignoreRef)
{
boolean invalid = dtx < 0 || dty < 0 || dtx >= map.getInTileWidth() || dty >= map.getInTileHeight();
if (!invalid && (stx != dtx || sty != dty))
{
invalid = mapPath.isBlocked(mover, dtx, dty, ignoreRef);
}
return !invalid;
} | [
"private",
"boolean",
"isValidLocation",
"(",
"Pathfindable",
"mover",
",",
"int",
"stx",
",",
"int",
"sty",
",",
"int",
"dtx",
",",
"int",
"dty",
",",
"boolean",
"ignoreRef",
")",
"{",
"boolean",
"invalid",
"=",
"dtx",
"<",
"0",
"||",
"dty",
"<",
"0",... | Check if a given location is valid for the supplied mover.
@param mover The mover that would hold a given location.
@param stx The starting x coordinate.
@param sty The starting y coordinate.
@param dtx The x coordinate of the location to check.
@param dty The y coordinate of the location to check.
@param ignoreRef The ignore map reference array checking.
@return <code>true</code> if the location is valid for the given mover, <code>false</code> else. | [
"Check",
"if",
"a",
"given",
"location",
"is",
"valid",
"for",
"the",
"supplied",
"mover",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathFinderImpl.java#L113-L123 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/util/TarUtils.java | TarUtils.writeTarGz | public static void writeTarGz(Path dirPath, OutputStream output)
throws IOException, InterruptedException {
"""
Creates a gzipped tar archive from the given path, streaming the data to the give output
stream.
@param dirPath the path to archive
@param output the output stream to write the data to
"""
GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(output);
TarArchiveOutputStream archiveStream = new TarArchiveOutputStream(zipStream);
for (Path subPath : Files.walk(dirPath).collect(toList())) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
File file = subPath.toFile();
TarArchiveEntry entry = new TarArchiveEntry(file, dirPath.relativize(subPath).toString());
archiveStream.putArchiveEntry(entry);
if (file.isFile()) {
try (InputStream fileIn = Files.newInputStream(subPath)) {
IOUtils.copy(fileIn, archiveStream);
}
}
archiveStream.closeArchiveEntry();
}
archiveStream.finish();
zipStream.finish();
} | java | public static void writeTarGz(Path dirPath, OutputStream output)
throws IOException, InterruptedException {
GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(output);
TarArchiveOutputStream archiveStream = new TarArchiveOutputStream(zipStream);
for (Path subPath : Files.walk(dirPath).collect(toList())) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
File file = subPath.toFile();
TarArchiveEntry entry = new TarArchiveEntry(file, dirPath.relativize(subPath).toString());
archiveStream.putArchiveEntry(entry);
if (file.isFile()) {
try (InputStream fileIn = Files.newInputStream(subPath)) {
IOUtils.copy(fileIn, archiveStream);
}
}
archiveStream.closeArchiveEntry();
}
archiveStream.finish();
zipStream.finish();
} | [
"public",
"static",
"void",
"writeTarGz",
"(",
"Path",
"dirPath",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"GzipCompressorOutputStream",
"zipStream",
"=",
"new",
"GzipCompressorOutputStream",
"(",
"output",
")",
";... | Creates a gzipped tar archive from the given path, streaming the data to the give output
stream.
@param dirPath the path to archive
@param output the output stream to write the data to | [
"Creates",
"a",
"gzipped",
"tar",
"archive",
"from",
"the",
"given",
"path",
"streaming",
"the",
"data",
"to",
"the",
"give",
"output",
"stream",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/util/TarUtils.java#L42-L62 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java | ExceptionRule.getMatchedDepth | private int getMatchedDepth(String exceptionType, Class<?> exceptionClass, int depth) {
"""
Returns the matched depth.
@param exceptionType the exception type
@param exceptionClass the exception class
@param depth the depth
@return the matched depth
"""
if (exceptionClass.getName().equals(exceptionType)) {
return depth;
}
if (exceptionClass.equals(Throwable.class)) {
return -1;
}
return getMatchedDepth(exceptionType, exceptionClass.getSuperclass(), depth + 1);
} | java | private int getMatchedDepth(String exceptionType, Class<?> exceptionClass, int depth) {
if (exceptionClass.getName().equals(exceptionType)) {
return depth;
}
if (exceptionClass.equals(Throwable.class)) {
return -1;
}
return getMatchedDepth(exceptionType, exceptionClass.getSuperclass(), depth + 1);
} | [
"private",
"int",
"getMatchedDepth",
"(",
"String",
"exceptionType",
",",
"Class",
"<",
"?",
">",
"exceptionClass",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"exceptionClass",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"exceptionType",
")",
")",
"{",
... | Returns the matched depth.
@param exceptionType the exception type
@param exceptionClass the exception class
@param depth the depth
@return the matched depth | [
"Returns",
"the",
"matched",
"depth",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java#L115-L123 |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Optionals.java | Optionals.isInstance | public static boolean isInstance(final @NonNull Optional<?> optional, final @NonNull Class<?> type) {
"""
Tests if the value held by {@code optional} is an instance of {@code type}.
@param optional the optional
@param type the type
@return {@code true} if the value held by {@code optional} is an instance of {@code type}, {@code false} otherwise
"""
return optional.isPresent() && type.isInstance(optional.get());
} | java | public static boolean isInstance(final @NonNull Optional<?> optional, final @NonNull Class<?> type) {
return optional.isPresent() && type.isInstance(optional.get());
} | [
"public",
"static",
"boolean",
"isInstance",
"(",
"final",
"@",
"NonNull",
"Optional",
"<",
"?",
">",
"optional",
",",
"final",
"@",
"NonNull",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"optional",
".",
"isPresent",
"(",
")",
"&&",
"type",
".... | Tests if the value held by {@code optional} is an instance of {@code type}.
@param optional the optional
@param type the type
@return {@code true} if the value held by {@code optional} is an instance of {@code type}, {@code false} otherwise | [
"Tests",
"if",
"the",
"value",
"held",
"by",
"{",
"@code",
"optional",
"}",
"is",
"an",
"instance",
"of",
"{",
"@code",
"type",
"}",
"."
] | train | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Optionals.java#L87-L89 |
rpuch/xremoting | xremoting-core/src/main/java/com/googlecode/xremoting/core/commonshttpclient/HttpClientBuilder.java | HttpClientBuilder.trustKeyStore | public HttpClientBuilder trustKeyStore(URL url, String password) {
"""
Configures a trust store for the current SSL host (see
{@link #ssl(String)}). If set, SSL client authentication will be used
when connecting to that host (i.e. the client certificate will be sent).
@param url URL from which to obtain trust store
@param password trust store password
@return this
@see #ssl(String)
@see #keyStore(URL, String)
"""
if (sslHostConfig == null) {
throw new IllegalStateException("ssl(String) must be called before this");
}
sslHostConfig.trustKeyStoreUrl = url;
sslHostConfig.trustKeyStorePassword = password;
return this;
} | java | public HttpClientBuilder trustKeyStore(URL url, String password) {
if (sslHostConfig == null) {
throw new IllegalStateException("ssl(String) must be called before this");
}
sslHostConfig.trustKeyStoreUrl = url;
sslHostConfig.trustKeyStorePassword = password;
return this;
} | [
"public",
"HttpClientBuilder",
"trustKeyStore",
"(",
"URL",
"url",
",",
"String",
"password",
")",
"{",
"if",
"(",
"sslHostConfig",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"ssl(String) must be called before this\"",
")",
";",
"}",
"... | Configures a trust store for the current SSL host (see
{@link #ssl(String)}). If set, SSL client authentication will be used
when connecting to that host (i.e. the client certificate will be sent).
@param url URL from which to obtain trust store
@param password trust store password
@return this
@see #ssl(String)
@see #keyStore(URL, String) | [
"Configures",
"a",
"trust",
"store",
"for",
"the",
"current",
"SSL",
"host",
"(",
"see",
"{",
"@link",
"#ssl",
"(",
"String",
")",
"}",
")",
".",
"If",
"set",
"SSL",
"client",
"authentication",
"will",
"be",
"used",
"when",
"connecting",
"to",
"that",
... | train | https://github.com/rpuch/xremoting/blob/519b640e5225652a8c23e10e5cab71827636a8b1/xremoting-core/src/main/java/com/googlecode/xremoting/core/commonshttpclient/HttpClientBuilder.java#L189-L196 |
dropwizard/metrics | metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java | SharedHealthCheckRegistries.setDefault | public static HealthCheckRegistry setDefault(String name, HealthCheckRegistry healthCheckRegistry) {
"""
Sets the provided registry as the default one under the provided name
@param name the default registry name
@param healthCheckRegistry the default registry
@throws IllegalStateException if the default registry has already been set
"""
if (defaultRegistryName.compareAndSet(null, name)) {
add(name, healthCheckRegistry);
return healthCheckRegistry;
}
throw new IllegalStateException("Default health check registry is already set.");
} | java | public static HealthCheckRegistry setDefault(String name, HealthCheckRegistry healthCheckRegistry) {
if (defaultRegistryName.compareAndSet(null, name)) {
add(name, healthCheckRegistry);
return healthCheckRegistry;
}
throw new IllegalStateException("Default health check registry is already set.");
} | [
"public",
"static",
"HealthCheckRegistry",
"setDefault",
"(",
"String",
"name",
",",
"HealthCheckRegistry",
"healthCheckRegistry",
")",
"{",
"if",
"(",
"defaultRegistryName",
".",
"compareAndSet",
"(",
"null",
",",
"name",
")",
")",
"{",
"add",
"(",
"name",
",",... | Sets the provided registry as the default one under the provided name
@param name the default registry name
@param healthCheckRegistry the default registry
@throws IllegalStateException if the default registry has already been set | [
"Sets",
"the",
"provided",
"registry",
"as",
"the",
"default",
"one",
"under",
"the",
"provided",
"name"
] | train | https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java#L72-L78 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java | FileSystemAdminShellUtils.compareTierNames | public static int compareTierNames(String a, String b) {
"""
Compares two tier names according to their rank values.
@param a one tier name
@param b another tier name
@return compared result
"""
int aValue = getTierRankValue(a);
int bValue = getTierRankValue(b);
if (aValue == bValue) {
return a.compareTo(b);
}
return aValue - bValue;
} | java | public static int compareTierNames(String a, String b) {
int aValue = getTierRankValue(a);
int bValue = getTierRankValue(b);
if (aValue == bValue) {
return a.compareTo(b);
}
return aValue - bValue;
} | [
"public",
"static",
"int",
"compareTierNames",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"int",
"aValue",
"=",
"getTierRankValue",
"(",
"a",
")",
";",
"int",
"bValue",
"=",
"getTierRankValue",
"(",
"b",
")",
";",
"if",
"(",
"aValue",
"==",
"bVa... | Compares two tier names according to their rank values.
@param a one tier name
@param b another tier name
@return compared result | [
"Compares",
"two",
"tier",
"names",
"according",
"to",
"their",
"rank",
"values",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java#L43-L50 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/SliceConsequence.java | SliceConsequence.evaluate | @Override
public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) {
"""
Called when there exist the minimum necessary number of intervals with
the specified proposition id in order to compute the temporal slice
corresponding to this rule.
@param arg0
a {@link KnowledgeHelper}
@param arg1
a {@link WorkingMemory}
@see JBossRuleCreator
"""
@SuppressWarnings("unchecked")
List<TemporalProposition> pl = (List<TemporalProposition>) arg0
.get(arg0.getDeclaration("result"));
Comparator<TemporalProposition> comp;
if (this.reverse) {
comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP;
} else {
comp = ProtempaUtil.TEMP_PROP_COMP;
}
Collections.sort(pl, comp);
this.copier.grab(arg0);
if (this.merged) {
mergedInterval(arg0, pl);
} else {
for (ListIterator<TemporalProposition> itr = pl
.listIterator(this.minIndex); itr.hasNext()
&& itr.nextIndex() < this.maxIndex;) {
TemporalProposition o = itr.next();
o.accept(this.copier);
}
}
this.copier.release();
} | java | @Override
public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) {
@SuppressWarnings("unchecked")
List<TemporalProposition> pl = (List<TemporalProposition>) arg0
.get(arg0.getDeclaration("result"));
Comparator<TemporalProposition> comp;
if (this.reverse) {
comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP;
} else {
comp = ProtempaUtil.TEMP_PROP_COMP;
}
Collections.sort(pl, comp);
this.copier.grab(arg0);
if (this.merged) {
mergedInterval(arg0, pl);
} else {
for (ListIterator<TemporalProposition> itr = pl
.listIterator(this.minIndex); itr.hasNext()
&& itr.nextIndex() < this.maxIndex;) {
TemporalProposition o = itr.next();
o.accept(this.copier);
}
}
this.copier.release();
} | [
"@",
"Override",
"public",
"void",
"evaluate",
"(",
"KnowledgeHelper",
"arg0",
",",
"WorkingMemory",
"arg1",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"TemporalProposition",
">",
"pl",
"=",
"(",
"List",
"<",
"TemporalProposition"... | Called when there exist the minimum necessary number of intervals with
the specified proposition id in order to compute the temporal slice
corresponding to this rule.
@param arg0
a {@link KnowledgeHelper}
@param arg1
a {@link WorkingMemory}
@see JBossRuleCreator | [
"Called",
"when",
"there",
"exist",
"the",
"minimum",
"necessary",
"number",
"of",
"intervals",
"with",
"the",
"specified",
"proposition",
"id",
"in",
"order",
"to",
"compute",
"the",
"temporal",
"slice",
"corresponding",
"to",
"this",
"rule",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/SliceConsequence.java#L123-L147 |
samskivert/samskivert | src/main/java/com/samskivert/velocity/I18nTool.java | I18nTool.xlate | public String xlate (String key, Object arg) {
"""
Looks up the specified message and creates the translation string
using the supplied argument.
"""
return _msgmgr.getMessage(_req, key, new Object[] { arg });
} | java | public String xlate (String key, Object arg)
{
return _msgmgr.getMessage(_req, key, new Object[] { arg });
} | [
"public",
"String",
"xlate",
"(",
"String",
"key",
",",
"Object",
"arg",
")",
"{",
"return",
"_msgmgr",
".",
"getMessage",
"(",
"_req",
",",
"key",
",",
"new",
"Object",
"[",
"]",
"{",
"arg",
"}",
")",
";",
"}"
] | Looks up the specified message and creates the translation string
using the supplied argument. | [
"Looks",
"up",
"the",
"specified",
"message",
"and",
"creates",
"the",
"translation",
"string",
"using",
"the",
"supplied",
"argument",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/I18nTool.java#L71-L74 |
anotheria/moskito | moskito-extensions/moskito-notification-providers/src/main/java/net/anotheria/moskito/extensions/notificationproviders/BulkSMSNotificationProvider.java | BulkSMSNotificationProvider.createMessage | private static String createMessage(final ThresholdAlert alert, final String template) {
"""
Create SMS message.
@param alert {@link net.anotheria.moskito.core.threshold.alerts.ThresholdAlert}
@param template {@link net.anotheria.moskito.extensions.notificationproviders.BulkSMSNotificationProvider#smsTemplate}
@return SMS
"""
// TODO: message should be encoded to apropriate encoding
//return alert.getThreshold().getName() + ": " + alert.getOldStatus() + "->" + alert.getNewStatus();
String message;
if(!StringUtils.isEmpty(template)) {
ThresholdAlertTemplate thresholdAlertTemplate = new ThresholdAlertTemplate(alert);
message = thresholdAlertTemplate.process(template);
} else {
message = ThresholdAlertConverter.toPlainText(alert);
}
return message;
} | java | private static String createMessage(final ThresholdAlert alert, final String template) {
// TODO: message should be encoded to apropriate encoding
//return alert.getThreshold().getName() + ": " + alert.getOldStatus() + "->" + alert.getNewStatus();
String message;
if(!StringUtils.isEmpty(template)) {
ThresholdAlertTemplate thresholdAlertTemplate = new ThresholdAlertTemplate(alert);
message = thresholdAlertTemplate.process(template);
} else {
message = ThresholdAlertConverter.toPlainText(alert);
}
return message;
} | [
"private",
"static",
"String",
"createMessage",
"(",
"final",
"ThresholdAlert",
"alert",
",",
"final",
"String",
"template",
")",
"{",
"// TODO: message should be encoded to apropriate encoding",
"//return alert.getThreshold().getName() + \": \" + alert.getOldStatus() + \"->\" + alert.... | Create SMS message.
@param alert {@link net.anotheria.moskito.core.threshold.alerts.ThresholdAlert}
@param template {@link net.anotheria.moskito.extensions.notificationproviders.BulkSMSNotificationProvider#smsTemplate}
@return SMS | [
"Create",
"SMS",
"message",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-notification-providers/src/main/java/net/anotheria/moskito/extensions/notificationproviders/BulkSMSNotificationProvider.java#L134-L145 |
Bernardo-MG/repository-pattern-java | src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java | JpaRepository.getAll | @SuppressWarnings("unchecked")
@Override
public final Collection<V> getAll(final PaginationData pagination) {
"""
Returns all the entities contained in the repository paginated.
<p>
The query used for this operation is the one received by the constructor.
@return all the entities contained in the repository paginated
"""
final Query builtQuery; // Query created from the query data
checkNotNull(pagination,
"Received a null pointer as the pagination data");
// Builds the query
builtQuery = getEntityManager().createQuery(getAllValuesQuery());
// Sets the pagination
applyPagination(builtQuery, pagination);
// Processes the query
return builtQuery.getResultList();
} | java | @SuppressWarnings("unchecked")
@Override
public final Collection<V> getAll(final PaginationData pagination) {
final Query builtQuery; // Query created from the query data
checkNotNull(pagination,
"Received a null pointer as the pagination data");
// Builds the query
builtQuery = getEntityManager().createQuery(getAllValuesQuery());
// Sets the pagination
applyPagination(builtQuery, pagination);
// Processes the query
return builtQuery.getResultList();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"final",
"Collection",
"<",
"V",
">",
"getAll",
"(",
"final",
"PaginationData",
"pagination",
")",
"{",
"final",
"Query",
"builtQuery",
";",
"// Query created from the query data",
"check... | Returns all the entities contained in the repository paginated.
<p>
The query used for this operation is the one received by the constructor.
@return all the entities contained in the repository paginated | [
"Returns",
"all",
"the",
"entities",
"contained",
"in",
"the",
"repository",
"paginated",
".",
"<p",
">",
"The",
"query",
"used",
"for",
"this",
"operation",
"is",
"the",
"one",
"received",
"by",
"the",
"constructor",
"."
] | train | https://github.com/Bernardo-MG/repository-pattern-java/blob/e94d5bbf9aeeb45acc8485f3686a6e791b082ea8/src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java#L168-L184 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.