repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.isEncrypted | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | java | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | [
"public",
"static",
"boolean",
"isEncrypted",
"(",
"ByteBuf",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"readableBytes",
"(",
")",
"<",
"SslUtils",
".",
"SSL_RECORD_HEADER_LENGTH",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"buffer must have ... | Returns {@code true} if the given {@link ByteBuf} is encrypted. Be aware that this method
will not increase the readerIndex of the given {@link ByteBuf}.
@param buffer
The {@link ByteBuf} to read from. Be aware that it must have at least 5 bytes to read,
otherwise it will throw an {@link IllegalArgumentException}.
@return encrypted
{@code true} if the {@link ByteBuf} is encrypted, {@code false} otherwise.
@throws IllegalArgumentException
Is thrown if the given {@link ByteBuf} has not at least 5 bytes to read. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"is",
"encrypted",
".",
"Be",
"aware",
"that",
"this",
"method",
"will",
"not",
"increase",
"the",
"readerIndex",
"of",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}"... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1181-L1187 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.toMap | @CheckReturnValue
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@SchedulerSupport(SchedulerSupport.NONE)
public final <K> Single<Map<K, T>> toMap(final Function<? super T, ? extends K> keySelector) {
ObjectHelper.requireNonNull(keySelector, "keySelector is null");
return collect(HashMapSupplier.<K, T>asCallable(), Functions.toMapKeySelector(keySelector));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@SchedulerSupport(SchedulerSupport.NONE)
public final <K> Single<Map<K, T>> toMap(final Function<? super T, ? extends K> keySelector) {
ObjectHelper.requireNonNull(keySelector, "keySelector is null");
return collect(HashMapSupplier.<K, T>asCallable(), Functions.toMapKeySelector(keySelector));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"UNBOUNDED_IN",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"K",
">",
"Single",
"<",
"Map",
"<",
"K",
",",
"T",
">",
">",
... | Returns a Single that emits a single HashMap containing all items emitted by the finite source Publisher,
mapped by the keys returned by a specified {@code keySelector} function.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMap.png" alt="">
<p>
If more than one source item maps to the same key, the HashMap will contain the latest of those items.
<p>
Note that this operator requires the upstream to signal {@code onComplete} for the accumulated map to
be emitted. Sources that are infinite and never complete will never emit anything through this
operator and an infinite source may lead to a fatal {@code OutOfMemoryError}.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an
unbounded manner (i.e., without applying backpressure to it).</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code toMap} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <K> the key type of the Map
@param keySelector
the function that extracts the key from a source item to be used in the HashMap
@return a Single that emits a single item: a HashMap containing the mapped items from the source
Publisher
@see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> | [
"Returns",
"a",
"Single",
"that",
"emits",
"a",
"single",
"HashMap",
"containing",
"all",
"items",
"emitted",
"by",
"the",
"finite",
"source",
"Publisher",
"mapped",
"by",
"the",
"keys",
"returned",
"by",
"a",
"specified",
"{",
"@code",
"keySelector",
"}",
"... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L16572-L16578 |
acromusashi/acromusashi-stream-ml | src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java | LofCalculator.mergeDataSet | public static LofDataSet mergeDataSet(LofDataSet baseDataSet, LofDataSet targetDataSet, int max)
{
Collection<LofPoint> basePointList = baseDataSet.getDataMap().values();
Collection<LofPoint> targetPointList = targetDataSet.getDataMap().values();
// LOFの対象点を時刻でソートしたリストを生成する。
List<LofPoint> mergedList = new ArrayList<>();
mergedList.addAll(basePointList);
mergedList.addAll(targetPointList);
Collections.sort(mergedList, new LofPointComparator());
// ソート後、新しい方から扱うため順番を逆にする。
Collections.reverse(mergedList);
// 新しいデータから順にマージ後のモデルに反映する。
// 但し、お互いに非同期でマージが行われるため同様のIDを持つデータが複数存在するケースがある。
// そのため、IDを比較してそれまでに取得していないデータの追加のみを行う。
Set<String> registeredId = new HashSet<>();
int addedCount = 0;
LofDataSet resultDataSet = new LofDataSet();
for (LofPoint targetPoint : mergedList)
{
if (registeredId.contains(targetPoint.getDataId()) == true)
{
continue;
}
registeredId.add(targetPoint.getDataId());
resultDataSet.addData(targetPoint);
addedCount++;
if (addedCount >= max)
{
break;
}
}
return resultDataSet;
} | java | public static LofDataSet mergeDataSet(LofDataSet baseDataSet, LofDataSet targetDataSet, int max)
{
Collection<LofPoint> basePointList = baseDataSet.getDataMap().values();
Collection<LofPoint> targetPointList = targetDataSet.getDataMap().values();
// LOFの対象点を時刻でソートしたリストを生成する。
List<LofPoint> mergedList = new ArrayList<>();
mergedList.addAll(basePointList);
mergedList.addAll(targetPointList);
Collections.sort(mergedList, new LofPointComparator());
// ソート後、新しい方から扱うため順番を逆にする。
Collections.reverse(mergedList);
// 新しいデータから順にマージ後のモデルに反映する。
// 但し、お互いに非同期でマージが行われるため同様のIDを持つデータが複数存在するケースがある。
// そのため、IDを比較してそれまでに取得していないデータの追加のみを行う。
Set<String> registeredId = new HashSet<>();
int addedCount = 0;
LofDataSet resultDataSet = new LofDataSet();
for (LofPoint targetPoint : mergedList)
{
if (registeredId.contains(targetPoint.getDataId()) == true)
{
continue;
}
registeredId.add(targetPoint.getDataId());
resultDataSet.addData(targetPoint);
addedCount++;
if (addedCount >= max)
{
break;
}
}
return resultDataSet;
} | [
"public",
"static",
"LofDataSet",
"mergeDataSet",
"(",
"LofDataSet",
"baseDataSet",
",",
"LofDataSet",
"targetDataSet",
",",
"int",
"max",
")",
"{",
"Collection",
"<",
"LofPoint",
">",
"basePointList",
"=",
"baseDataSet",
".",
"getDataMap",
"(",
")",
".",
"value... | 学習データのマージを行う。<br>
中間データは生成されないため、必要な場合は本メソッド実行後に{@link #initDataSet(int, LofDataSet)}メソッドを実行すること。
@param baseDataSet マージのベース学習データ
@param targetDataSet マージ対象の学習データ
@param max データ保持数最大値
@return マージ後の学習データ | [
"学習データのマージを行う。<br",
">",
"中間データは生成されないため、必要な場合は本メソッド実行後に",
"{",
"@link",
"#initDataSet",
"(",
"int",
"LofDataSet",
")",
"}",
"メソッドを実行すること。"
] | train | https://github.com/acromusashi/acromusashi-stream-ml/blob/26d6799a917cacda68e21d506c75cfeb17d832a6/src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java#L214-L253 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.feed_publishTemplatizedAction | public boolean feed_publishTemplatizedAction(CharSequence titleTemplate)
throws FacebookException, IOException {
return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, /*pageActorId*/ null);
} | java | public boolean feed_publishTemplatizedAction(CharSequence titleTemplate)
throws FacebookException, IOException {
return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, /*pageActorId*/ null);
} | [
"public",
"boolean",
"feed_publishTemplatizedAction",
"(",
"CharSequence",
"titleTemplate",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"feed_publishTemplatizedAction",
"(",
"titleTemplate",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
... | Publishes a Mini-Feed story describing an action taken by the logged-in user, and
publishes aggregating News Feed stories to their friends.
Stories are identified as being combinable if they have matching templates and substituted values.
@param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title
section. Must include the token <code>{actor}</code>.
@return whether the action story was successfully published; false in case
of a permission error
@see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction">
Developers Wiki: Feed.publishTemplatizedAction</a>
@see <a href="http://developers.facebook.com/tools.php?feed">
Developers Resources: Feed Preview Console </a> | [
"Publishes",
"a",
"Mini",
"-",
"Feed",
"story",
"describing",
"an",
"action",
"taken",
"by",
"the",
"logged",
"-",
"in",
"user",
"and",
"publishes",
"aggregating",
"News",
"Feed",
"stories",
"to",
"their",
"friends",
".",
"Stories",
"are",
"identified",
"as"... | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L407-L410 |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java | TeaToolsUtils.createPropertyDescriptions | public PropertyDescription[] createPropertyDescriptions(
PropertyDescriptor[] pds) {
if (pds == null) {
return null;
}
PropertyDescription[] descriptions =
new PropertyDescription[pds.length];
for (int i = 0; i < pds.length; i++) {
descriptions[i] = new PropertyDescription(pds[i], this);
}
return descriptions;
} | java | public PropertyDescription[] createPropertyDescriptions(
PropertyDescriptor[] pds) {
if (pds == null) {
return null;
}
PropertyDescription[] descriptions =
new PropertyDescription[pds.length];
for (int i = 0; i < pds.length; i++) {
descriptions[i] = new PropertyDescription(pds[i], this);
}
return descriptions;
} | [
"public",
"PropertyDescription",
"[",
"]",
"createPropertyDescriptions",
"(",
"PropertyDescriptor",
"[",
"]",
"pds",
")",
"{",
"if",
"(",
"pds",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"PropertyDescription",
"[",
"]",
"descriptions",
"=",
"new",
... | Returns an array of PropertyDescriptions to wrap and describe the
specified PropertyDescriptors. | [
"Returns",
"an",
"array",
"of",
"PropertyDescriptions",
"to",
"wrap",
"and",
"describe",
"the",
"specified",
"PropertyDescriptors",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L105-L120 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.migrateGroup | void migrateGroup(Node oldGroupNode) throws Exception
{
String groupName = oldGroupNode.getName();
String desc = utils.readString(oldGroupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(oldGroupNode, GroupProperties.JOS_LABEL);
String parentId = utils.readString(oldGroupNode, MigrationTool.JOS_PARENT_ID);
GroupImpl group = new GroupImpl(groupName, parentId);
group.setDescription(desc);
group.setLabel(label);
Group parentGroup = findGroupById(group.getParentId());
if (findGroupById(group.getId()) != null)
{
removeGroup(group, false);
}
addChild(parentGroup, group, false);
} | java | void migrateGroup(Node oldGroupNode) throws Exception
{
String groupName = oldGroupNode.getName();
String desc = utils.readString(oldGroupNode, GroupProperties.JOS_DESCRIPTION);
String label = utils.readString(oldGroupNode, GroupProperties.JOS_LABEL);
String parentId = utils.readString(oldGroupNode, MigrationTool.JOS_PARENT_ID);
GroupImpl group = new GroupImpl(groupName, parentId);
group.setDescription(desc);
group.setLabel(label);
Group parentGroup = findGroupById(group.getParentId());
if (findGroupById(group.getId()) != null)
{
removeGroup(group, false);
}
addChild(parentGroup, group, false);
} | [
"void",
"migrateGroup",
"(",
"Node",
"oldGroupNode",
")",
"throws",
"Exception",
"{",
"String",
"groupName",
"=",
"oldGroupNode",
".",
"getName",
"(",
")",
";",
"String",
"desc",
"=",
"utils",
".",
"readString",
"(",
"oldGroupNode",
",",
"GroupProperties",
"."... | Method for group migration.
@param oldGroupNode
the node where group properties are stored (from old structure) | [
"Method",
"for",
"group",
"migration",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L443-L462 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java | ClustersInner.beginUpdateGatewaySettingsAsync | public Observable<Void> beginUpdateGatewaySettingsAsync(String resourceGroupName, String clusterName, UpdateGatewaySettingsParameters parameters) {
return beginUpdateGatewaySettingsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginUpdateGatewaySettingsAsync(String resourceGroupName, String clusterName, UpdateGatewaySettingsParameters parameters) {
return beginUpdateGatewaySettingsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginUpdateGatewaySettingsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"UpdateGatewaySettingsParameters",
"parameters",
")",
"{",
"return",
"beginUpdateGatewaySettingsWithServiceResponseAsync",
"(",
... | Configures the gateway settings on the specified cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param parameters The cluster configurations.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Configures",
"the",
"gateway",
"settings",
"on",
"the",
"specified",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1652-L1659 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java | HadoopJobUtils.constructHadoopTags | public static String constructHadoopTags(Props props, String[] keys) {
String[] keysAndValues = new String[keys.length];
for (int i = 0; i < keys.length; i++) {
if (props.containsKey(keys[i])) {
keysAndValues[i] = keys[i] + ":" + props.get(keys[i]);
}
}
Joiner joiner = Joiner.on(',').skipNulls();
return joiner.join(keysAndValues);
} | java | public static String constructHadoopTags(Props props, String[] keys) {
String[] keysAndValues = new String[keys.length];
for (int i = 0; i < keys.length; i++) {
if (props.containsKey(keys[i])) {
keysAndValues[i] = keys[i] + ":" + props.get(keys[i]);
}
}
Joiner joiner = Joiner.on(',').skipNulls();
return joiner.join(keysAndValues);
} | [
"public",
"static",
"String",
"constructHadoopTags",
"(",
"Props",
"props",
",",
"String",
"[",
"]",
"keys",
")",
"{",
"String",
"[",
"]",
"keysAndValues",
"=",
"new",
"String",
"[",
"keys",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Construct a CSV of tags for the Hadoop application.
@param props job properties
@param keys list of keys to construct tags from.
@return a CSV of tags | [
"Construct",
"a",
"CSV",
"of",
"tags",
"for",
"the",
"Hadoop",
"application",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L581-L590 |
hawkular/hawkular-apm | server/infinispan/src/main/java/org/hawkular/apm/server/infinispan/InfinispanSpanCache.java | InfinispanSpanCache.get | @Override
public Span get(String tenantId, String id) {
Span span = spansCache.get(id);
log.debugf("Get span [id=%s] = %s", id, span);
return span;
} | java | @Override
public Span get(String tenantId, String id) {
Span span = spansCache.get(id);
log.debugf("Get span [id=%s] = %s", id, span);
return span;
} | [
"@",
"Override",
"public",
"Span",
"get",
"(",
"String",
"tenantId",
",",
"String",
"id",
")",
"{",
"Span",
"span",
"=",
"spansCache",
".",
"get",
"(",
"id",
")",
";",
"log",
".",
"debugf",
"(",
"\"Get span [id=%s] = %s\"",
",",
"id",
",",
"span",
")",... | Note that method assumes that span id was changed with {@link SpanUniqueIdGenerator#toUnique(Span)}. | [
"Note",
"that",
"method",
"assumes",
"that",
"span",
"id",
"was",
"changed",
"with",
"{"
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/infinispan/src/main/java/org/hawkular/apm/server/infinispan/InfinispanSpanCache.java#L85-L90 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java | MediaServicesInner.listKeys | public ServiceKeysInner listKeys(String resourceGroupName, String mediaServiceName) {
return listKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName).toBlocking().single().body();
} | java | public ServiceKeysInner listKeys(String resourceGroupName, String mediaServiceName) {
return listKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName).toBlocking().single().body();
} | [
"public",
"ServiceKeysInner",
"listKeys",
"(",
"String",
"resourceGroupName",
",",
"String",
"mediaServiceName",
")",
"{",
"return",
"listKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"mediaServiceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Lists the keys for a Media Service.
@param resourceGroupName Name of the resource group within the Azure subscription.
@param mediaServiceName Name of the Media Service.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServiceKeysInner object if successful. | [
"Lists",
"the",
"keys",
"for",
"a",
"Media",
"Service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L741-L743 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java | TmdbDiscover.getDiscoverMovies | public ResultList<MovieBasic> getDiscoverMovies(Discover discover) throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.MOVIE).buildUrl(discover.getParams());
String webpage = httpTools.getRequest(url);
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
return wrapper.getResultsList();
} | java | public ResultList<MovieBasic> getDiscoverMovies(Discover discover) throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.MOVIE).buildUrl(discover.getParams());
String webpage = httpTools.getRequest(url);
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"MovieBasic",
">",
"getDiscoverMovies",
"(",
"Discover",
"discover",
")",
"throws",
"MovieDbException",
"{",
"URL",
"url",
"=",
"new",
"ApiUrl",
"(",
"apiKey",
",",
"MethodBase",
".",
"DISCOVER",
")",
".",
"subMethod",
"(",
"Method... | Discover movies by different types of data like average rating, number of votes, genres and certifications.
@param discover A discover object containing the search criteria required
@return
@throws MovieDbException | [
"Discover",
"movies",
"by",
"different",
"types",
"of",
"data",
"like",
"average",
"rating",
"number",
"of",
"votes",
"genres",
"and",
"certifications",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java#L58-L63 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getNodesCount | public long getNodesCount() throws RepositoryException
{
try
{
ResultSet countNodes = findNodesCount();
try
{
if (countNodes.next())
{
return countNodes.getLong(1);
}
else
{
throw new SQLException("ResultSet has't records.");
}
}
finally
{
JDBCUtils.freeResources(countNodes, null, null);
}
}
catch (SQLException e)
{
throw new RepositoryException("Can not calculate nodes count", e);
}
} | java | public long getNodesCount() throws RepositoryException
{
try
{
ResultSet countNodes = findNodesCount();
try
{
if (countNodes.next())
{
return countNodes.getLong(1);
}
else
{
throw new SQLException("ResultSet has't records.");
}
}
finally
{
JDBCUtils.freeResources(countNodes, null, null);
}
}
catch (SQLException e)
{
throw new RepositoryException("Can not calculate nodes count", e);
}
} | [
"public",
"long",
"getNodesCount",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"ResultSet",
"countNodes",
"=",
"findNodesCount",
"(",
")",
";",
"try",
"{",
"if",
"(",
"countNodes",
".",
"next",
"(",
")",
")",
"{",
"return",
"countNodes",
".... | Reads count of nodes in workspace.
@return
nodes count
@throws RepositoryException
if a database access error occurs | [
"Reads",
"count",
"of",
"nodes",
"in",
"workspace",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1533-L1558 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.getRelativeDateTimeString | public static CharSequence getRelativeDateTimeString(Context context, ReadablePartial time,
ReadablePeriod transitionResolution, int flags) {
if (!time.isSupported(DateTimeFieldType.hourOfDay())
|| !time.isSupported(DateTimeFieldType.minuteOfHour())) {
throw new IllegalArgumentException("getRelativeDateTimeString() must be passed a ReadablePartial that " +
"supports time, otherwise it makes no sense");
}
return getRelativeDateTimeString(context, time.toDateTime(DateTime.now()), transitionResolution, flags);
} | java | public static CharSequence getRelativeDateTimeString(Context context, ReadablePartial time,
ReadablePeriod transitionResolution, int flags) {
if (!time.isSupported(DateTimeFieldType.hourOfDay())
|| !time.isSupported(DateTimeFieldType.minuteOfHour())) {
throw new IllegalArgumentException("getRelativeDateTimeString() must be passed a ReadablePartial that " +
"supports time, otherwise it makes no sense");
}
return getRelativeDateTimeString(context, time.toDateTime(DateTime.now()), transitionResolution, flags);
} | [
"public",
"static",
"CharSequence",
"getRelativeDateTimeString",
"(",
"Context",
"context",
",",
"ReadablePartial",
"time",
",",
"ReadablePeriod",
"transitionResolution",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"!",
"time",
".",
"isSupported",
"(",
"DateTimeFieldT... | Return string describing the time until/elapsed time since 'time' formatted like
"[relative time/date], [time]".
See {@link android.text.format.DateUtils#getRelativeDateTimeString} for full docs.
@throws IllegalArgumentException if using a ReadablePartial without a time component
@see #getRelativeDateTimeString(Context, ReadableInstant, ReadablePeriod, int) | [
"Return",
"string",
"describing",
"the",
"time",
"until",
"/",
"elapsed",
"time",
"since",
"time",
"formatted",
"like",
"[",
"relative",
"time",
"/",
"date",
"]",
"[",
"time",
"]",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L406-L415 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java | DoubleMatrix.set | public void set(int i, int j, DoubleMatrix B)
{
int m = B.rows();
int n = B.columns();
for (int ii = 0; ii < m; ii++)
{
for (int jj = 0; jj < n; jj++)
{
set(i+ii, j+jj, B.get(ii, jj));
}
}
} | java | public void set(int i, int j, DoubleMatrix B)
{
int m = B.rows();
int n = B.columns();
for (int ii = 0; ii < m; ii++)
{
for (int jj = 0; jj < n; jj++)
{
set(i+ii, j+jj, B.get(ii, jj));
}
}
} | [
"public",
"void",
"set",
"(",
"int",
"i",
",",
"int",
"j",
",",
"DoubleMatrix",
"B",
")",
"{",
"int",
"m",
"=",
"B",
".",
"rows",
"(",
")",
";",
"int",
"n",
"=",
"B",
".",
"columns",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
... | Assign matrix A items starting at i,j
@param i
@param j
@param B | [
"Assign",
"matrix",
"A",
"items",
"starting",
"at",
"i",
"j"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L92-L103 |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmExtensionService.java | XmExtensionService.getResourceKey | @Override
public UrlLepResourceKey getResourceKey(LepKey extensionKey, Version extensionResourceVersion) {
if (extensionKey == null) {
return null;
}
LepKey groupKey = extensionKey.getGroupKey();
String extensionKeyId = extensionKey.getId();
String extensionName;
String[] groupSegments;
if (groupKey == null) {
groupSegments = EMPTY_GROUP_SEGMENTS;
extensionName = extensionKeyId;
} else {
groupSegments = groupKey.getId().split(EXTENSION_KEY_SEPARATOR_REGEXP);
// remove group from id
extensionName = extensionKeyId.replace(groupKey.getId(), "");
if (extensionName.startsWith(XmLepConstants.EXTENSION_KEY_SEPARATOR)) {
extensionName = extensionName.substring(XmLepConstants.EXTENSION_KEY_SEPARATOR.length());
}
}
// change script name: capitalize first character & add script type extension
String scriptName = extensionName.replaceAll(EXTENSION_KEY_SEPARATOR_REGEXP, SCRIPT_NAME_SEPARATOR_REGEXP);
scriptName = StringUtils.capitalize(scriptName);
String urlPath = URL_DELIMITER;
if (groupSegments.length > 0) {
urlPath += String.join(URL_DELIMITER, groupSegments) + URL_DELIMITER;
}
urlPath += scriptName + SCRIPT_EXTENSION_SEPARATOR + SCRIPT_EXTENSION_GROOVY;
// TODO if possible add check that returned resourceKey contains resources (for speed up executor reaction)
// Check example : return isResourceExists(resourceKey) ? resourceKey : null;
UrlLepResourceKey urlLepResourceKey = UrlLepResourceKey.valueOfUrlResourcePath(urlPath);
if (extensionResourceVersion == null) {
log.debug("LEP extension key: '{}' translated to --> composite resource key: '{}'", extensionKey, urlLepResourceKey);
} else {
log.debug("LEP extension 'key: {}, v{}' translated to --> composite resource key: '{}'", extensionKey,
extensionResourceVersion, urlLepResourceKey);
}
return urlLepResourceKey;
} | java | @Override
public UrlLepResourceKey getResourceKey(LepKey extensionKey, Version extensionResourceVersion) {
if (extensionKey == null) {
return null;
}
LepKey groupKey = extensionKey.getGroupKey();
String extensionKeyId = extensionKey.getId();
String extensionName;
String[] groupSegments;
if (groupKey == null) {
groupSegments = EMPTY_GROUP_SEGMENTS;
extensionName = extensionKeyId;
} else {
groupSegments = groupKey.getId().split(EXTENSION_KEY_SEPARATOR_REGEXP);
// remove group from id
extensionName = extensionKeyId.replace(groupKey.getId(), "");
if (extensionName.startsWith(XmLepConstants.EXTENSION_KEY_SEPARATOR)) {
extensionName = extensionName.substring(XmLepConstants.EXTENSION_KEY_SEPARATOR.length());
}
}
// change script name: capitalize first character & add script type extension
String scriptName = extensionName.replaceAll(EXTENSION_KEY_SEPARATOR_REGEXP, SCRIPT_NAME_SEPARATOR_REGEXP);
scriptName = StringUtils.capitalize(scriptName);
String urlPath = URL_DELIMITER;
if (groupSegments.length > 0) {
urlPath += String.join(URL_DELIMITER, groupSegments) + URL_DELIMITER;
}
urlPath += scriptName + SCRIPT_EXTENSION_SEPARATOR + SCRIPT_EXTENSION_GROOVY;
// TODO if possible add check that returned resourceKey contains resources (for speed up executor reaction)
// Check example : return isResourceExists(resourceKey) ? resourceKey : null;
UrlLepResourceKey urlLepResourceKey = UrlLepResourceKey.valueOfUrlResourcePath(urlPath);
if (extensionResourceVersion == null) {
log.debug("LEP extension key: '{}' translated to --> composite resource key: '{}'", extensionKey, urlLepResourceKey);
} else {
log.debug("LEP extension 'key: {}, v{}' translated to --> composite resource key: '{}'", extensionKey,
extensionResourceVersion, urlLepResourceKey);
}
return urlLepResourceKey;
} | [
"@",
"Override",
"public",
"UrlLepResourceKey",
"getResourceKey",
"(",
"LepKey",
"extensionKey",
",",
"Version",
"extensionResourceVersion",
")",
"{",
"if",
"(",
"extensionKey",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"LepKey",
"groupKey",
"=",
"exte... | Return composite resource key for specified extension key.
If extension has no resource or extension with specified key doesn't exist the method
returns {@code null}.
@param extensionKey the extension key
@param extensionResourceVersion ignored in current implementation
@return composite resource key or {@code null} if not found | [
"Return",
"composite",
"resource",
"key",
"for",
"specified",
"extension",
"key",
".",
"If",
"extension",
"has",
"no",
"resource",
"or",
"extension",
"with",
"specified",
"key",
"doesn",
"t",
"exist",
"the",
"method",
"returns",
"{",
"@code",
"null",
"}",
".... | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmExtensionService.java#L41-L85 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java | CompactDecimalDataCache.checkForOtherVariants | private static void checkForOtherVariants(Data data, ULocale locale, String style) {
DecimalFormat.Unit[] otherByBase = data.units.get(OTHER);
if (otherByBase == null) {
throw new IllegalArgumentException("No 'other' plural variants defined in "
+ localeAndStyle(locale, style));
}
// Check all other plural variants, and make sure that if any of them are populated, then
// other is also populated
for (Map.Entry<String, Unit[]> entry : data.units.entrySet()) {
if (entry.getKey() == OTHER) continue;
DecimalFormat.Unit[] variantByBase = entry.getValue();
for (int log10Value = 0; log10Value < MAX_DIGITS; log10Value++) {
if (variantByBase[log10Value] != null && otherByBase[log10Value] == null) {
throw new IllegalArgumentException(
"No 'other' plural variant defined for 10^" + log10Value
+ " but a '" + entry.getKey() + "' variant is defined"
+ " in " +localeAndStyle(locale, style));
}
}
}
} | java | private static void checkForOtherVariants(Data data, ULocale locale, String style) {
DecimalFormat.Unit[] otherByBase = data.units.get(OTHER);
if (otherByBase == null) {
throw new IllegalArgumentException("No 'other' plural variants defined in "
+ localeAndStyle(locale, style));
}
// Check all other plural variants, and make sure that if any of them are populated, then
// other is also populated
for (Map.Entry<String, Unit[]> entry : data.units.entrySet()) {
if (entry.getKey() == OTHER) continue;
DecimalFormat.Unit[] variantByBase = entry.getValue();
for (int log10Value = 0; log10Value < MAX_DIGITS; log10Value++) {
if (variantByBase[log10Value] != null && otherByBase[log10Value] == null) {
throw new IllegalArgumentException(
"No 'other' plural variant defined for 10^" + log10Value
+ " but a '" + entry.getKey() + "' variant is defined"
+ " in " +localeAndStyle(locale, style));
}
}
}
} | [
"private",
"static",
"void",
"checkForOtherVariants",
"(",
"Data",
"data",
",",
"ULocale",
"locale",
",",
"String",
"style",
")",
"{",
"DecimalFormat",
".",
"Unit",
"[",
"]",
"otherByBase",
"=",
"data",
".",
"units",
".",
"get",
"(",
"OTHER",
")",
";",
"... | Checks to make sure that an "other" variant is present in all powers of 10.
@param data | [
"Checks",
"to",
"make",
"sure",
"that",
"an",
"other",
"variant",
"is",
"present",
"in",
"all",
"powers",
"of",
"10",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L413-L435 |
alkacon/opencms-core | src/org/opencms/ade/contenteditor/CmsContentService.java | CmsContentService.transferSettingValues | private void transferSettingValues(CmsEntity source, CmsEntity target) {
for (CmsEntityAttribute attr : source.getAttributes()) {
if (isSettingsAttribute(attr.getAttributeName())) {
if (attr.isSimpleValue()) {
target.addAttributeValue(attr.getAttributeName(), attr.getSimpleValue());
} else {
CmsEntity nestedSource = attr.getComplexValue();
CmsEntity nested = new CmsEntity(nestedSource.getId(), nestedSource.getTypeName());
for (CmsEntityAttribute nestedAttr : nestedSource.getAttributes()) {
nested.addAttributeValue(nestedAttr.getAttributeName(), nestedAttr.getSimpleValue());
}
target.addAttributeValue(attr.getAttributeName(), nested);
}
}
}
} | java | private void transferSettingValues(CmsEntity source, CmsEntity target) {
for (CmsEntityAttribute attr : source.getAttributes()) {
if (isSettingsAttribute(attr.getAttributeName())) {
if (attr.isSimpleValue()) {
target.addAttributeValue(attr.getAttributeName(), attr.getSimpleValue());
} else {
CmsEntity nestedSource = attr.getComplexValue();
CmsEntity nested = new CmsEntity(nestedSource.getId(), nestedSource.getTypeName());
for (CmsEntityAttribute nestedAttr : nestedSource.getAttributes()) {
nested.addAttributeValue(nestedAttr.getAttributeName(), nestedAttr.getSimpleValue());
}
target.addAttributeValue(attr.getAttributeName(), nested);
}
}
}
} | [
"private",
"void",
"transferSettingValues",
"(",
"CmsEntity",
"source",
",",
"CmsEntity",
"target",
")",
"{",
"for",
"(",
"CmsEntityAttribute",
"attr",
":",
"source",
".",
"getAttributes",
"(",
")",
")",
"{",
"if",
"(",
"isSettingsAttribute",
"(",
"attr",
".",... | Transfers settings attribute values from one entity to another.<p>
@param source the source entity
@param target the target entity | [
"Transfers",
"settings",
"attribute",
"values",
"from",
"one",
"entity",
"to",
"another",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L2437-L2454 |
jenkinsci/jenkins | core/src/main/java/jenkins/util/SystemProperties.java | SystemProperties.getInteger | public static Integer getInteger(String name, Integer def, Level logLevel) {
String v = getString(name);
if (v != null) {
try {
return Integer.decode(v);
} catch (NumberFormatException e) {
// Ignore, fallback to default
if (LOGGER.isLoggable(logLevel)) {
LOGGER.log(logLevel, "Property. Value is not integer: {0} => {1}", new Object[] {name, v});
}
}
}
return def;
} | java | public static Integer getInteger(String name, Integer def, Level logLevel) {
String v = getString(name);
if (v != null) {
try {
return Integer.decode(v);
} catch (NumberFormatException e) {
// Ignore, fallback to default
if (LOGGER.isLoggable(logLevel)) {
LOGGER.log(logLevel, "Property. Value is not integer: {0} => {1}", new Object[] {name, v});
}
}
}
return def;
} | [
"public",
"static",
"Integer",
"getInteger",
"(",
"String",
"name",
",",
"Integer",
"def",
",",
"Level",
"logLevel",
")",
"{",
"String",
"v",
"=",
"getString",
"(",
"name",
")",
";",
"if",
"(",
"v",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Inte... | Determines the integer value of the system property with the
specified name, or a default value.
This behaves just like <code>Integer.getInteger(String,Integer)</code>, except that it
also consults the <code>ServletContext</code>'s "init" parameters. If neither exist,
return the default value.
@param name property name.
@param def a default value.
@param logLevel the level of the log if the provided system property name cannot be decoded into Integer.
@return the {@code Integer} value of the property.
If the property is missing, return the default value.
Result may be {@code null} only if the default value is {@code null}. | [
"Determines",
"the",
"integer",
"value",
"of",
"the",
"system",
"property",
"with",
"the",
"specified",
"name",
"or",
"a",
"default",
"value",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/SystemProperties.java#L366-L380 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java | CmsResourceWrapperXmlPage.getUriStyleSheet | protected String getUriStyleSheet(CmsObject cms, CmsResource res) {
String result = "";
try {
String currentTemplate = getUriTemplate(cms, res);
if (!"".equals(currentTemplate)) {
// read the stylesheet from the template file
result = cms.readPropertyObject(
currentTemplate,
CmsPropertyDefinition.PROPERTY_TEMPLATE,
false).getValue("");
}
} catch (CmsException e) {
// noop
}
return result;
} | java | protected String getUriStyleSheet(CmsObject cms, CmsResource res) {
String result = "";
try {
String currentTemplate = getUriTemplate(cms, res);
if (!"".equals(currentTemplate)) {
// read the stylesheet from the template file
result = cms.readPropertyObject(
currentTemplate,
CmsPropertyDefinition.PROPERTY_TEMPLATE,
false).getValue("");
}
} catch (CmsException e) {
// noop
}
return result;
} | [
"protected",
"String",
"getUriStyleSheet",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"res",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"try",
"{",
"String",
"currentTemplate",
"=",
"getUriTemplate",
"(",
"cms",
",",
"res",
")",
";",
"if",
"(",
"!",... | Returns the OpenCms VFS uri of the style sheet of the resource.<p>
@param cms the initialized CmsObject
@param res the resource where to read the style sheet for
@return the OpenCms VFS uri of the style sheet of resource | [
"Returns",
"the",
"OpenCms",
"VFS",
"uri",
"of",
"the",
"style",
"sheet",
"of",
"the",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java#L839-L855 |
duracloud/duracloud-db | account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java | UserFinderUtil.annotateAddressRange | private String annotateAddressRange(AccountInfo accountInfo, String baseRange) {
if (null == baseRange || baseRange.equals("")) {
return baseRange;
} else {
return baseRange; // delimeter + elasticIp + "/32";
}
} | java | private String annotateAddressRange(AccountInfo accountInfo, String baseRange) {
if (null == baseRange || baseRange.equals("")) {
return baseRange;
} else {
return baseRange; // delimeter + elasticIp + "/32";
}
} | [
"private",
"String",
"annotateAddressRange",
"(",
"AccountInfo",
"accountInfo",
",",
"String",
"baseRange",
")",
"{",
"if",
"(",
"null",
"==",
"baseRange",
"||",
"baseRange",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"baseRange",
";",
"}",
"else",... | For a user account with an IP limitation, this method is used to update
the list of allowed IPs to include the IP of the DuraCloud instance itself.
This is required to allow the calls made between applications (like those
made from DurAdmin to DuraStore) to pass through the IP range check.
@param baseRange set of IP ranges set by the user
@return baseRange plus the instance elastic IP, or null if baseRange is null | [
"For",
"a",
"user",
"account",
"with",
"an",
"IP",
"limitation",
"this",
"method",
"is",
"used",
"to",
"update",
"the",
"list",
"of",
"allowed",
"IPs",
"to",
"include",
"the",
"IP",
"of",
"the",
"DuraCloud",
"instance",
"itself",
".",
"This",
"is",
"requ... | train | https://github.com/duracloud/duracloud-db/blob/0328c322b2e4538ab6aa82cd16237be89cbe72fb/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java#L126-L132 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java | TemplateTypeMapReplacer.isRecursive | private boolean isRecursive(TemplateType currentType, JSType replacementType) {
TemplatizedType replacementTemplatizedType =
replacementType.restrictByNotNullOrUndefined().toMaybeTemplatizedType();
if (replacementTemplatizedType == null) {
return false;
}
Iterable<JSType> replacementTemplateTypes = replacementTemplatizedType.getTemplateTypes();
for (JSType replacementTemplateType : replacementTemplateTypes) {
if (replacementTemplateType.isTemplateType()
&& isSameType(currentType, replacementTemplateType.toMaybeTemplateType())) {
return true;
}
}
return false;
} | java | private boolean isRecursive(TemplateType currentType, JSType replacementType) {
TemplatizedType replacementTemplatizedType =
replacementType.restrictByNotNullOrUndefined().toMaybeTemplatizedType();
if (replacementTemplatizedType == null) {
return false;
}
Iterable<JSType> replacementTemplateTypes = replacementTemplatizedType.getTemplateTypes();
for (JSType replacementTemplateType : replacementTemplateTypes) {
if (replacementTemplateType.isTemplateType()
&& isSameType(currentType, replacementTemplateType.toMaybeTemplateType())) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isRecursive",
"(",
"TemplateType",
"currentType",
",",
"JSType",
"replacementType",
")",
"{",
"TemplatizedType",
"replacementTemplatizedType",
"=",
"replacementType",
".",
"restrictByNotNullOrUndefined",
"(",
")",
".",
"toMaybeTemplatizedType",
"(",
... | Returns whether the replacement type is a templatized type which contains the current type.
e.g. current type T is being replaced with Foo<T> | [
"Returns",
"whether",
"the",
"replacement",
"type",
"is",
"a",
"templatized",
"type",
"which",
"contains",
"the",
"current",
"type",
".",
"e",
".",
"g",
".",
"current",
"type",
"T",
"is",
"being",
"replaced",
"with",
"Foo<T",
">"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java#L116-L132 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java | LinearRing.getBestOffset | private void getBestOffset(final Projection pProjection, final PointL pOffset) {
final double powerDifference = pProjection.getProjectedPowerDifference();
final PointL center = pProjection.getLongPixelsFromProjected(
mProjectedCenter, powerDifference, false, null);
final Rect screenRect = pProjection.getIntrinsicScreenRect();
final double screenCenterX = (screenRect.left + screenRect.right) / 2.;
final double screenCenterY = (screenRect.top + screenRect.bottom) / 2.;
final double worldSize = TileSystem.MapSize(pProjection.getZoomLevel());
getBestOffset(center.x, center.y, screenCenterX, screenCenterY, worldSize, pOffset);
} | java | private void getBestOffset(final Projection pProjection, final PointL pOffset) {
final double powerDifference = pProjection.getProjectedPowerDifference();
final PointL center = pProjection.getLongPixelsFromProjected(
mProjectedCenter, powerDifference, false, null);
final Rect screenRect = pProjection.getIntrinsicScreenRect();
final double screenCenterX = (screenRect.left + screenRect.right) / 2.;
final double screenCenterY = (screenRect.top + screenRect.bottom) / 2.;
final double worldSize = TileSystem.MapSize(pProjection.getZoomLevel());
getBestOffset(center.x, center.y, screenCenterX, screenCenterY, worldSize, pOffset);
} | [
"private",
"void",
"getBestOffset",
"(",
"final",
"Projection",
"pProjection",
",",
"final",
"PointL",
"pOffset",
")",
"{",
"final",
"double",
"powerDifference",
"=",
"pProjection",
".",
"getProjectedPowerDifference",
"(",
")",
";",
"final",
"PointL",
"center",
"=... | Compute the pixel offset so that a list of pixel segments display in the best possible way:
the center of all pixels is as close to the screen center as possible
This notion of pixel offset only has a meaning on very low zoom level,
when a GeoPoint can be projected on different places on the screen. | [
"Compute",
"the",
"pixel",
"offset",
"so",
"that",
"a",
"list",
"of",
"pixel",
"segments",
"display",
"in",
"the",
"best",
"possible",
"way",
":",
"the",
"center",
"of",
"all",
"pixels",
"is",
"as",
"close",
"to",
"the",
"screen",
"center",
"as",
"possib... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java#L235-L244 |
Ashok-Varma/BottomNavigation | bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationHelper.java | BottomNavigationHelper.bindTabWithData | static void bindTabWithData(BottomNavigationItem bottomNavigationItem, BottomNavigationTab bottomNavigationTab, BottomNavigationBar bottomNavigationBar) {
Context context = bottomNavigationBar.getContext();
bottomNavigationTab.setLabel(bottomNavigationItem.getTitle(context));
bottomNavigationTab.setIcon(bottomNavigationItem.getIcon(context));
int activeColor = bottomNavigationItem.getActiveColor(context);
int inActiveColor = bottomNavigationItem.getInActiveColor(context);
if (activeColor != Utils.NO_COLOR) {
bottomNavigationTab.setActiveColor(activeColor);
} else {
bottomNavigationTab.setActiveColor(bottomNavigationBar.getActiveColor());
}
if (inActiveColor != Utils.NO_COLOR) {
bottomNavigationTab.setInactiveColor(inActiveColor);
} else {
bottomNavigationTab.setInactiveColor(bottomNavigationBar.getInActiveColor());
}
if (bottomNavigationItem.isInActiveIconAvailable()) {
Drawable inactiveDrawable = bottomNavigationItem.getInactiveIcon(context);
if (inactiveDrawable != null) {
bottomNavigationTab.setInactiveIcon(inactiveDrawable);
}
}
bottomNavigationTab.setItemBackgroundColor(bottomNavigationBar.getBackgroundColor());
BadgeItem badgeItem = bottomNavigationItem.getBadgeItem();
if (badgeItem != null) {
badgeItem.bindToBottomTab(bottomNavigationTab);
}
} | java | static void bindTabWithData(BottomNavigationItem bottomNavigationItem, BottomNavigationTab bottomNavigationTab, BottomNavigationBar bottomNavigationBar) {
Context context = bottomNavigationBar.getContext();
bottomNavigationTab.setLabel(bottomNavigationItem.getTitle(context));
bottomNavigationTab.setIcon(bottomNavigationItem.getIcon(context));
int activeColor = bottomNavigationItem.getActiveColor(context);
int inActiveColor = bottomNavigationItem.getInActiveColor(context);
if (activeColor != Utils.NO_COLOR) {
bottomNavigationTab.setActiveColor(activeColor);
} else {
bottomNavigationTab.setActiveColor(bottomNavigationBar.getActiveColor());
}
if (inActiveColor != Utils.NO_COLOR) {
bottomNavigationTab.setInactiveColor(inActiveColor);
} else {
bottomNavigationTab.setInactiveColor(bottomNavigationBar.getInActiveColor());
}
if (bottomNavigationItem.isInActiveIconAvailable()) {
Drawable inactiveDrawable = bottomNavigationItem.getInactiveIcon(context);
if (inactiveDrawable != null) {
bottomNavigationTab.setInactiveIcon(inactiveDrawable);
}
}
bottomNavigationTab.setItemBackgroundColor(bottomNavigationBar.getBackgroundColor());
BadgeItem badgeItem = bottomNavigationItem.getBadgeItem();
if (badgeItem != null) {
badgeItem.bindToBottomTab(bottomNavigationTab);
}
} | [
"static",
"void",
"bindTabWithData",
"(",
"BottomNavigationItem",
"bottomNavigationItem",
",",
"BottomNavigationTab",
"bottomNavigationTab",
",",
"BottomNavigationBar",
"bottomNavigationBar",
")",
"{",
"Context",
"context",
"=",
"bottomNavigationBar",
".",
"getContext",
"(",
... | Used to get set data to the Tab views from navigation items
@param bottomNavigationItem holds all the data
@param bottomNavigationTab view to which data need to be set
@param bottomNavigationBar view which holds all the tabs | [
"Used",
"to",
"get",
"set",
"data",
"to",
"the",
"Tab",
"views",
"from",
"navigation",
"items"
] | train | https://github.com/Ashok-Varma/BottomNavigation/blob/a5c486a6dfa1ebe7049e2e025e0d967111ecfd0b/bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationHelper.java#L115-L150 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java | UserHandlerImpl.postSave | private void postSave(User user, boolean isNew) throws Exception
{
for (UserEventListener listener : listeners)
{
listener.postSave(user, isNew);
}
} | java | private void postSave(User user, boolean isNew) throws Exception
{
for (UserEventListener listener : listeners)
{
listener.postSave(user, isNew);
}
} | [
"private",
"void",
"postSave",
"(",
"User",
"user",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postSave",
"(",
"user",
",",
"isNew",
")",
";",
"}",
... | Notifying listeners after user creation.
@param user
the user which is used in create operation
@param isNew
true, if we have a deal with new user, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"user",
"creation",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java#L670-L676 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLock | public <E> E updateWithOptimisticLock(E entity) {
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | java | public <E> E updateWithOptimisticLock(E entity) {
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | [
"public",
"<",
"E",
">",
"E",
"updateWithOptimisticLock",
"(",
"E",
"entity",
")",
"{",
"PropertyMetadata",
"versionMetadata",
"=",
"EntityIntrospector",
".",
"getVersionMetadata",
"(",
"entity",
")",
";",
"if",
"(",
"versionMetadata",
"==",
"null",
")",
"{",
... | Updates the given entity with optimistic locking, if the entity is set up to support optimistic
locking. Otherwise, a normal update is performed.
@param entity
the entity to update
@return the updated entity which may be different than the given entity. | [
"Updates",
"the",
"given",
"entity",
"with",
"optimistic",
"locking",
"if",
"the",
"entity",
"is",
"set",
"up",
"to",
"support",
"optimistic",
"locking",
".",
"Otherwise",
"a",
"normal",
"update",
"is",
"performed",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L217-L225 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionI | public static int checkPostconditionI(
final int value,
final IntPredicate predicate,
final IntFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Integer.valueOf(value),
singleViolation(failedPredicate(e)));
}
return innerCheckI(value, ok, describer);
} | java | public static int checkPostconditionI(
final int value,
final IntPredicate predicate,
final IntFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Integer.valueOf(value),
singleViolation(failedPredicate(e)));
}
return innerCheckI(value, ok, describer);
} | [
"public",
"static",
"int",
"checkPostconditionI",
"(",
"final",
"int",
"value",
",",
"final",
"IntPredicate",
"predicate",
",",
"final",
"IntFunction",
"<",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";",
"try",
"{",
"ok",
"=",
"predicat... | An {@code int} specialized version of {@link #checkPostcondition(Object,
ContractConditionType)}.
@param value The value
@param predicate The predicate
@param describer The describer for the predicate
@return value
@throws PostconditionViolationException If the predicate is false | [
"An",
"{",
"@code",
"int",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostcondition",
"(",
"Object",
"ContractConditionType",
")",
"}",
"."
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L372-L388 |
ksoichiro/Android-ObservableScrollView | library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java | ScrollUtils.mixColors | public static int mixColors(int fromColor, int toColor, float toAlpha) {
float[] fromCmyk = ScrollUtils.cmykFromRgb(fromColor);
float[] toCmyk = ScrollUtils.cmykFromRgb(toColor);
float[] result = new float[4];
for (int i = 0; i < 4; i++) {
result[i] = Math.min(1, fromCmyk[i] * (1 - toAlpha) + toCmyk[i] * toAlpha);
}
return 0xff000000 + (0x00ffffff & ScrollUtils.rgbFromCmyk(result));
} | java | public static int mixColors(int fromColor, int toColor, float toAlpha) {
float[] fromCmyk = ScrollUtils.cmykFromRgb(fromColor);
float[] toCmyk = ScrollUtils.cmykFromRgb(toColor);
float[] result = new float[4];
for (int i = 0; i < 4; i++) {
result[i] = Math.min(1, fromCmyk[i] * (1 - toAlpha) + toCmyk[i] * toAlpha);
}
return 0xff000000 + (0x00ffffff & ScrollUtils.rgbFromCmyk(result));
} | [
"public",
"static",
"int",
"mixColors",
"(",
"int",
"fromColor",
",",
"int",
"toColor",
",",
"float",
"toAlpha",
")",
"{",
"float",
"[",
"]",
"fromCmyk",
"=",
"ScrollUtils",
".",
"cmykFromRgb",
"(",
"fromColor",
")",
";",
"float",
"[",
"]",
"toCmyk",
"="... | Mix two colors.
<p>{@code toColor} will be {@code toAlpha/1} percent,
and {@code fromColor} will be {@code (1-toAlpha)/1} percent.</p>
@param fromColor First color to be mixed.
@param toColor Second color to be mixed.
@param toAlpha Alpha value of toColor, 0.0f to 1.0f.
@return Mixed color value in ARGB. Alpha is fixed value (255). | [
"Mix",
"two",
"colors",
".",
"<p",
">",
"{",
"@code",
"toColor",
"}",
"will",
"be",
"{",
"@code",
"toAlpha",
"/",
"1",
"}",
"percent",
"and",
"{",
"@code",
"fromColor",
"}",
"will",
"be",
"{",
"@code",
"(",
"1",
"-",
"toAlpha",
")",
"/",
"1",
"}"... | train | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java#L93-L101 |
square/dagger | core/src/main/java/dagger/internal/Keys.java | Keys.extractKey | private static String extractKey(String key, int start, String delegatePrefix, String prefix) {
return delegatePrefix + key.substring(start + prefix.length(), key.length() - 1);
} | java | private static String extractKey(String key, int start, String delegatePrefix, String prefix) {
return delegatePrefix + key.substring(start + prefix.length(), key.length() - 1);
} | [
"private",
"static",
"String",
"extractKey",
"(",
"String",
"key",
",",
"int",
"start",
",",
"String",
"delegatePrefix",
",",
"String",
"prefix",
")",
"{",
"return",
"delegatePrefix",
"+",
"key",
".",
"substring",
"(",
"start",
"+",
"prefix",
".",
"length",
... | Returns an unwrapped key (the key for T from a Provider<T> for example),
removing all wrapping key information, but preserving annotations or known
prefixes.
@param key the key from which the delegate key should be extracted.
@param start
an index into the key representing the key's "real" start after
any annotations.
@param delegatePrefix
key prefix elements extracted from the underlying delegate
(annotations, "members/", etc.)
@param prefix the prefix to strip. | [
"Returns",
"an",
"unwrapped",
"key",
"(",
"the",
"key",
"for",
"T",
"from",
"a",
"Provider<T",
">",
"for",
"example",
")",
"removing",
"all",
"wrapping",
"key",
"information",
"but",
"preserving",
"annotations",
"or",
"known",
"prefixes",
"."
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L227-L229 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaDispatchEndpointActivation.java | SibRaDispatchEndpointActivation.closeConnection | protected void closeConnection(final String meUuid, boolean alreadyClosed) {
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, meUuid);
}
synchronized (_sessionsByMeUuid) {
super.closeConnection(meUuid, alreadyClosed);
_sessionsByMeUuid.remove(meUuid);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | protected void closeConnection(final String meUuid, boolean alreadyClosed) {
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, meUuid);
}
synchronized (_sessionsByMeUuid) {
super.closeConnection(meUuid, alreadyClosed);
_sessionsByMeUuid.remove(meUuid);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"protected",
"void",
"closeConnection",
"(",
"final",
"String",
"meUuid",
",",
"boolean",
"alreadyClosed",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"closeConnection\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",... | Closes the connection for the given messaging engine if there is one
open. Removes any corresponding sessions from the maps.
@param meUuid
the UUID for the messaging engine to close the connection for | [
"Closes",
"the",
"connection",
"for",
"the",
"given",
"messaging",
"engine",
"if",
"there",
"is",
"one",
"open",
".",
"Removes",
"any",
"corresponding",
"sessions",
"from",
"the",
"maps",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaDispatchEndpointActivation.java#L427-L446 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/Util.java | Util.setBitmapRangeAndCardinalityChange | @Deprecated
public static int setBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) {
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
setBitmapRange(bitmap, start,end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} | java | @Deprecated
public static int setBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) {
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
setBitmapRange(bitmap, start,end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"setBitmapRangeAndCardinalityChange",
"(",
"long",
"[",
"]",
"bitmap",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"cardbefore",
"=",
"cardinalityInBitmapWordRange",
"(",
"bitmap",
",",
"start",
",",
"... | set bits at start, start+1,..., end-1 and report the
cardinality change
@param bitmap array of words to be modified
@param start first index to be modified (inclusive)
@param end last index to be modified (exclusive)
@return cardinality change | [
"set",
"bits",
"at",
"start",
"start",
"+",
"1",
"...",
"end",
"-",
"1",
"and",
"report",
"the",
"cardinality",
"change"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L527-L533 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.loadPath | public void loadPath(final String sitePath, final AsyncCallback<CmsClientSitemapEntry> callback) {
loadPath(sitePath, false, callback);
} | java | public void loadPath(final String sitePath, final AsyncCallback<CmsClientSitemapEntry> callback) {
loadPath(sitePath, false, callback);
} | [
"public",
"void",
"loadPath",
"(",
"final",
"String",
"sitePath",
",",
"final",
"AsyncCallback",
"<",
"CmsClientSitemapEntry",
">",
"callback",
")",
"{",
"loadPath",
"(",
"sitePath",
",",
"false",
",",
"callback",
")",
";",
"}"
] | Loads the sitemap entry for the given site path.<p>
@param sitePath the site path
@param callback the callback | [
"Loads",
"the",
"sitemap",
"entry",
"for",
"the",
"given",
"site",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1571-L1574 |
spring-projects/spring-security-oauth | spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/filter/CoreOAuthProviderSupport.java | CoreOAuthProviderSupport.normalizeUrl | protected String normalizeUrl(String url) {
try {
URL requestURL = new URL(url);
StringBuilder normalized = new StringBuilder(requestURL.getProtocol().toLowerCase()).append("://").append(requestURL.getHost().toLowerCase());
if ((requestURL.getPort() >= 0) && (requestURL.getPort() != requestURL.getDefaultPort())) {
normalized.append(":").append(requestURL.getPort());
}
normalized.append(requestURL.getPath());
return normalized.toString();
}
catch (MalformedURLException e) {
throw new IllegalStateException("Illegal URL for calculating the OAuth signature.", e);
}
} | java | protected String normalizeUrl(String url) {
try {
URL requestURL = new URL(url);
StringBuilder normalized = new StringBuilder(requestURL.getProtocol().toLowerCase()).append("://").append(requestURL.getHost().toLowerCase());
if ((requestURL.getPort() >= 0) && (requestURL.getPort() != requestURL.getDefaultPort())) {
normalized.append(":").append(requestURL.getPort());
}
normalized.append(requestURL.getPath());
return normalized.toString();
}
catch (MalformedURLException e) {
throw new IllegalStateException("Illegal URL for calculating the OAuth signature.", e);
}
} | [
"protected",
"String",
"normalizeUrl",
"(",
"String",
"url",
")",
"{",
"try",
"{",
"URL",
"requestURL",
"=",
"new",
"URL",
"(",
"url",
")",
";",
"StringBuilder",
"normalized",
"=",
"new",
"StringBuilder",
"(",
"requestURL",
".",
"getProtocol",
"(",
")",
".... | Normalize the URL for use in the signature. The OAuth spec says the URL protocol and host are to be lower-case,
and the query and fragments are to be stripped.
@param url The URL.
@return The URL normalized for use in the signature. | [
"Normalize",
"the",
"URL",
"for",
"use",
"in",
"the",
"signature",
".",
"The",
"OAuth",
"spec",
"says",
"the",
"URL",
"protocol",
"and",
"host",
"are",
"to",
"be",
"lower",
"-",
"case",
"and",
"the",
"query",
"and",
"fragments",
"are",
"to",
"be",
"str... | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/filter/CoreOAuthProviderSupport.java#L154-L167 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java | MariaDbPooledConnection.fireStatementErrorOccured | public void fireStatementErrorOccured(Statement st, SQLException ex) {
if (st instanceof PreparedStatement) {
StatementEvent event = new StatementEvent(this, (PreparedStatement) st, ex);
for (StatementEventListener listener : statementEventListeners) {
listener.statementErrorOccurred(event);
}
}
} | java | public void fireStatementErrorOccured(Statement st, SQLException ex) {
if (st instanceof PreparedStatement) {
StatementEvent event = new StatementEvent(this, (PreparedStatement) st, ex);
for (StatementEventListener listener : statementEventListeners) {
listener.statementErrorOccurred(event);
}
}
} | [
"public",
"void",
"fireStatementErrorOccured",
"(",
"Statement",
"st",
",",
"SQLException",
"ex",
")",
"{",
"if",
"(",
"st",
"instanceof",
"PreparedStatement",
")",
"{",
"StatementEvent",
"event",
"=",
"new",
"StatementEvent",
"(",
"this",
",",
"(",
"PreparedSta... | Fire statement error to listeners.
@param st statement
@param ex exception | [
"Fire",
"statement",
"error",
"to",
"listeners",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L204-L211 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateSimulationJobRequest.java | CreateSimulationJobRequest.withTags | public CreateSimulationJobRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateSimulationJobRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateSimulationJobRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map that contains tag keys and tag values that are attached to the simulation job.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the simulation job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"that",
"contains",
"tag",
"keys",
"and",
"tag",
"values",
"that",
"are",
"attached",
"to",
"the",
"simulation",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateSimulationJobRequest.java#L622-L625 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java | Quaternion.setEulerAngles | public void setEulerAngles(double attitude, double bank, double heading, CoordinateSystem3D system) {
CoordinateSystem3D cs = (system == null) ? CoordinateSystem3D.getDefaultCoordinateSystem() : system;
double c1 = Math.cos(heading / 2.);
double s1 = Math.sin(heading / 2.);
double c2 = Math.cos(attitude / 2.);
double s2 = Math.sin(attitude / 2.);
double c3 = Math.cos(bank / 2.);
double s3 = Math.sin(bank / 2.);
double x1, y1, z1, w1;
// Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
// Standard used: XZY_RIGHT_HAND
double c1c2 = c1 * c2;
double s1s2 = s1 * s2;
w1 = c1c2 * c3 - s1s2 * s3;
x1 = c1c2 * s3 + s1s2 * c3;
y1 = s1 * c2 * c3 + c1 * s2 * s3;
z1 = c1 * s2 * c3 - s1 * c2 * s3;
set(x1, y1, z1, w1);
CoordinateSystem3D.XZY_RIGHT_HAND.toSystem(this, cs);
} | java | public void setEulerAngles(double attitude, double bank, double heading, CoordinateSystem3D system) {
CoordinateSystem3D cs = (system == null) ? CoordinateSystem3D.getDefaultCoordinateSystem() : system;
double c1 = Math.cos(heading / 2.);
double s1 = Math.sin(heading / 2.);
double c2 = Math.cos(attitude / 2.);
double s2 = Math.sin(attitude / 2.);
double c3 = Math.cos(bank / 2.);
double s3 = Math.sin(bank / 2.);
double x1, y1, z1, w1;
// Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
// Standard used: XZY_RIGHT_HAND
double c1c2 = c1 * c2;
double s1s2 = s1 * s2;
w1 = c1c2 * c3 - s1s2 * s3;
x1 = c1c2 * s3 + s1s2 * c3;
y1 = s1 * c2 * c3 + c1 * s2 * s3;
z1 = c1 * s2 * c3 - s1 * c2 * s3;
set(x1, y1, z1, w1);
CoordinateSystem3D.XZY_RIGHT_HAND.toSystem(this, cs);
} | [
"public",
"void",
"setEulerAngles",
"(",
"double",
"attitude",
",",
"double",
"bank",
",",
"double",
"heading",
",",
"CoordinateSystem3D",
"system",
")",
"{",
"CoordinateSystem3D",
"cs",
"=",
"(",
"system",
"==",
"null",
")",
"?",
"CoordinateSystem3D",
".",
"g... | Set the quaternion with the Euler angles.
@param attitude is the rotation around left vector.
@param bank is the rotation around front vector.
@param heading is the rotation around top vector.
@param system the coordinate system to use for applying the Euler angles.
@see <a href="http://en.wikipedia.org/wiki/Euler_angles">Euler Angles</a>
@see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">Euler to Quaternion</a> | [
"Set",
"the",
"quaternion",
"with",
"the",
"Euler",
"angles",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L853-L876 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationDemo.java | DurationDemo.initializeComponents | private void initializeComponents() {
// Set up the form which holds the date picker components.
setTitle("LGoodDatePicker Basic Demo " + InternalUtilities.getProjectVersionString());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
setSize(new Dimension(640, 480));
setLocationRelativeTo(null);
// Create a duration picker, and add it to the form.
DurationPicker durationPicker1 = new DurationPicker();
add(durationPicker1);
/**
* The code below shows: 1) How to create a DateTimePicker (with default settings), 2) How
* to create a DatePicker with some custom settings, and 3) How to create a TimePicker with
* some custom settings. To keep the Basic Demo interface simpler, the lines for adding
* these components to the form have been commented out.
*/
// Create a DateTimePicker. (But don't add it to the form).
DateTimePicker dateTimePicker1 = new DateTimePicker();
// To display this picker, uncomment this line.
// add(dateTimePicker1);
// Create a date picker with some custom settings.
DatePickerSettings dateSettings = new DatePickerSettings();
dateSettings.setFirstDayOfWeek(DayOfWeek.MONDAY);
DatePicker datePicker2 = new DatePicker(dateSettings);
// To display this picker, uncomment this line.
// add(datePicker2);
// Create a time picker with some custom settings.
TimePickerSettings timeSettings = new TimePickerSettings();
timeSettings.setColor(TimeArea.TimePickerTextValidTime, Color.blue);
timeSettings.initialTime = LocalTime.now();
TimePicker timePicker2 = new TimePicker(timeSettings);
// To display this picker, uncomment this line.
// add(timePicker2);
} | java | private void initializeComponents() {
// Set up the form which holds the date picker components.
setTitle("LGoodDatePicker Basic Demo " + InternalUtilities.getProjectVersionString());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
setSize(new Dimension(640, 480));
setLocationRelativeTo(null);
// Create a duration picker, and add it to the form.
DurationPicker durationPicker1 = new DurationPicker();
add(durationPicker1);
/**
* The code below shows: 1) How to create a DateTimePicker (with default settings), 2) How
* to create a DatePicker with some custom settings, and 3) How to create a TimePicker with
* some custom settings. To keep the Basic Demo interface simpler, the lines for adding
* these components to the form have been commented out.
*/
// Create a DateTimePicker. (But don't add it to the form).
DateTimePicker dateTimePicker1 = new DateTimePicker();
// To display this picker, uncomment this line.
// add(dateTimePicker1);
// Create a date picker with some custom settings.
DatePickerSettings dateSettings = new DatePickerSettings();
dateSettings.setFirstDayOfWeek(DayOfWeek.MONDAY);
DatePicker datePicker2 = new DatePicker(dateSettings);
// To display this picker, uncomment this line.
// add(datePicker2);
// Create a time picker with some custom settings.
TimePickerSettings timeSettings = new TimePickerSettings();
timeSettings.setColor(TimeArea.TimePickerTextValidTime, Color.blue);
timeSettings.initialTime = LocalTime.now();
TimePicker timePicker2 = new TimePicker(timeSettings);
// To display this picker, uncomment this line.
// add(timePicker2);
} | [
"private",
"void",
"initializeComponents",
"(",
")",
"{",
"// Set up the form which holds the date picker components. ",
"setTitle",
"(",
"\"LGoodDatePicker Basic Demo \"",
"+",
"InternalUtilities",
".",
"getProjectVersionString",
"(",
")",
")",
";",
"setDefaultCloseOperation",
... | initializeComponents, This creates the user interface for the basic demo. | [
"initializeComponents",
"This",
"creates",
"the",
"user",
"interface",
"for",
"the",
"basic",
"demo",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationDemo.java#L49-L86 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SourcedTFIDF.java | SourcedTFIDF.explainScore | public String explainScore(StringWrapper s, StringWrapper t)
{
BagOfSourcedTokens sBag = (BagOfSourcedTokens)s;
BagOfSourcedTokens tBag = (BagOfSourcedTokens)t;
StringBuffer buf = new StringBuffer("");
PrintfFormat fmt = new PrintfFormat("%.3f");
buf.append("Common tokens: ");
for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) {
SourcedToken sTok = (SourcedToken)i.next();
SourcedToken tTok = null;
if ((tTok = tBag.getEquivalentToken(sTok))!=null) {
buf.append(" "+sTok.getValue()+": ");
buf.append(fmt.sprintf(sBag.getWeight(sTok)));
buf.append("*");
buf.append(fmt.sprintf(tBag.getWeight(tTok)));
}
}
buf.append("\nscore = "+score(s,t));
return buf.toString();
} | java | public String explainScore(StringWrapper s, StringWrapper t)
{
BagOfSourcedTokens sBag = (BagOfSourcedTokens)s;
BagOfSourcedTokens tBag = (BagOfSourcedTokens)t;
StringBuffer buf = new StringBuffer("");
PrintfFormat fmt = new PrintfFormat("%.3f");
buf.append("Common tokens: ");
for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) {
SourcedToken sTok = (SourcedToken)i.next();
SourcedToken tTok = null;
if ((tTok = tBag.getEquivalentToken(sTok))!=null) {
buf.append(" "+sTok.getValue()+": ");
buf.append(fmt.sprintf(sBag.getWeight(sTok)));
buf.append("*");
buf.append(fmt.sprintf(tBag.getWeight(tTok)));
}
}
buf.append("\nscore = "+score(s,t));
return buf.toString();
} | [
"public",
"String",
"explainScore",
"(",
"StringWrapper",
"s",
",",
"StringWrapper",
"t",
")",
"{",
"BagOfSourcedTokens",
"sBag",
"=",
"(",
"BagOfSourcedTokens",
")",
"s",
";",
"BagOfSourcedTokens",
"tBag",
"=",
"(",
"BagOfSourcedTokens",
")",
"t",
";",
"StringB... | Explain how the distance was computed.
In the output, the tokens in S and T are listed, and the
common tokens are marked with an asterisk. | [
"Explain",
"how",
"the",
"distance",
"was",
"computed",
".",
"In",
"the",
"output",
"the",
"tokens",
"in",
"S",
"and",
"T",
"are",
"listed",
"and",
"the",
"common",
"tokens",
"are",
"marked",
"with",
"an",
"asterisk",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SourcedTFIDF.java#L137-L156 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FloatingDecimal.java | FloatingDecimal.getBinaryToASCIIConverter | static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
long dBits = Double.doubleToRawLongBits(d);
boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
int binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
// Discover obvious special cases of NaN and Infinity.
if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
if ( fractBits == 0L ){
return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY;
} else {
return B2AC_NOT_A_NUMBER;
}
}
// Finish unpacking
// Normalize denormalized numbers.
// Insert assumed high-order bit for normalized numbers.
// Subtract exponent bias.
int nSignificantBits;
if ( binExp == 0 ){
if ( fractBits == 0L ){
// not a denorm, just a 0!
return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO;
}
int leadingZeros = Long.numberOfLeadingZeros(fractBits);
int shift = leadingZeros-(63-EXP_SHIFT);
fractBits <<= shift;
binExp = 1 - shift;
nSignificantBits = 64-leadingZeros; // recall binExp is - shift count.
} else {
fractBits |= FRACT_HOB;
nSignificantBits = EXP_SHIFT+1;
}
binExp -= DoubleConsts.EXP_BIAS;
BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
buf.setSign(isNegative);
// call the routine that actually does all the hard work.
buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
return buf;
} | java | static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
long dBits = Double.doubleToRawLongBits(d);
boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
int binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
// Discover obvious special cases of NaN and Infinity.
if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
if ( fractBits == 0L ){
return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY;
} else {
return B2AC_NOT_A_NUMBER;
}
}
// Finish unpacking
// Normalize denormalized numbers.
// Insert assumed high-order bit for normalized numbers.
// Subtract exponent bias.
int nSignificantBits;
if ( binExp == 0 ){
if ( fractBits == 0L ){
// not a denorm, just a 0!
return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO;
}
int leadingZeros = Long.numberOfLeadingZeros(fractBits);
int shift = leadingZeros-(63-EXP_SHIFT);
fractBits <<= shift;
binExp = 1 - shift;
nSignificantBits = 64-leadingZeros; // recall binExp is - shift count.
} else {
fractBits |= FRACT_HOB;
nSignificantBits = EXP_SHIFT+1;
}
binExp -= DoubleConsts.EXP_BIAS;
BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
buf.setSign(isNegative);
// call the routine that actually does all the hard work.
buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
return buf;
} | [
"static",
"BinaryToASCIIConverter",
"getBinaryToASCIIConverter",
"(",
"double",
"d",
",",
"boolean",
"isCompatibleFormat",
")",
"{",
"long",
"dBits",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"d",
")",
";",
"boolean",
"isNegative",
"=",
"(",
"dBits",
"&",
... | Returns a <code>BinaryToASCIIConverter</code> for a <code>double</code>.
The returned object is a <code>ThreadLocal</code> variable of this class.
@param d The double precision value to convert.
@param isCompatibleFormat
@return The converter. | [
"Returns",
"a",
"<code",
">",
"BinaryToASCIIConverter<",
"/",
"code",
">",
"for",
"a",
"<code",
">",
"double<",
"/",
"code",
">",
".",
"The",
"returned",
"object",
"is",
"a",
"<code",
">",
"ThreadLocal<",
"/",
"code",
">",
"variable",
"of",
"this",
"clas... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FloatingDecimal.java#L1742-L1780 |
avaje-common/avaje-jetty-runner | src/main/java/org/avaje/jettyrunner/RunWar.java | RunWar.setupForWar | protected void setupForWar() {
// Identify the war file that contains this class
ProtectionDomain protectionDomain = RunWar.class.getProtectionDomain();
URL location = protectionDomain.getCodeSource().getLocation();
String warFilePath = trimToFile(location.toExternalForm());
File warFile = new File(warFilePath);
if (!warFile.exists()) {
throw new IllegalStateException("war file not found: " + warFilePath);
}
webapp.setWar(warFilePath);
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());
if (!Boolean.getBoolean("webapp.extractWar")) {
try {
webapp.setExtractWAR(false);
webapp.setBaseResource(JarResource.newJarResource(Resource.newResource(warFile)));
} catch (IOException e) {
throw new RuntimeException("Error setting base resource to:" + warFilePath, e);
}
}
if (log().isDebugEnabled()) {
ClassLoader classLoader = webapp.getClassLoader();
log().debug("webapp classLoader: " + classLoader);
if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
log().debug("webapp classLoader URLs: " + Arrays.toString(urls));
}
}
} | java | protected void setupForWar() {
// Identify the war file that contains this class
ProtectionDomain protectionDomain = RunWar.class.getProtectionDomain();
URL location = protectionDomain.getCodeSource().getLocation();
String warFilePath = trimToFile(location.toExternalForm());
File warFile = new File(warFilePath);
if (!warFile.exists()) {
throw new IllegalStateException("war file not found: " + warFilePath);
}
webapp.setWar(warFilePath);
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());
if (!Boolean.getBoolean("webapp.extractWar")) {
try {
webapp.setExtractWAR(false);
webapp.setBaseResource(JarResource.newJarResource(Resource.newResource(warFile)));
} catch (IOException e) {
throw new RuntimeException("Error setting base resource to:" + warFilePath, e);
}
}
if (log().isDebugEnabled()) {
ClassLoader classLoader = webapp.getClassLoader();
log().debug("webapp classLoader: " + classLoader);
if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
log().debug("webapp classLoader URLs: " + Arrays.toString(urls));
}
}
} | [
"protected",
"void",
"setupForWar",
"(",
")",
"{",
"// Identify the war file that contains this class",
"ProtectionDomain",
"protectionDomain",
"=",
"RunWar",
".",
"class",
".",
"getProtectionDomain",
"(",
")",
";",
"URL",
"location",
"=",
"protectionDomain",
".",
"getC... | Setup the webapp pointing to the war file that contains this class. | [
"Setup",
"the",
"webapp",
"pointing",
"to",
"the",
"war",
"file",
"that",
"contains",
"this",
"class",
"."
] | train | https://github.com/avaje-common/avaje-jetty-runner/blob/acddc23754facc339233fa0b9736e94abc8ae842/src/main/java/org/avaje/jettyrunner/RunWar.java#L47-L78 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java | VelocityParser.getMethodParameters | public int getMethodParameters(char[] array, int currentIndex, StringBuffer velocityBlock,
VelocityParserContext context)
{
return getParameters(array, currentIndex, velocityBlock, ')', context);
} | java | public int getMethodParameters(char[] array, int currentIndex, StringBuffer velocityBlock,
VelocityParserContext context)
{
return getParameters(array, currentIndex, velocityBlock, ')', context);
} | [
"public",
"int",
"getMethodParameters",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"currentIndex",
",",
"StringBuffer",
"velocityBlock",
",",
"VelocityParserContext",
"context",
")",
"{",
"return",
"getParameters",
"(",
"array",
",",
"currentIndex",
",",
"velocit... | Get the Velocity method parameters (including <code>(</code> and <code>)</code>).
@param array the source to parse
@param currentIndex the current index in the <code>array</code>
@param velocityBlock the buffer where to append matched velocity block
@param context the parser context to put some informations
@return the index in the <code>array</code> after the matched block | [
"Get",
"the",
"Velocity",
"method",
"parameters",
"(",
"including",
"<code",
">",
"(",
"<",
"/",
"code",
">",
"and",
"<code",
">",
")",
"<",
"/",
"code",
">",
")",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java#L532-L536 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.setReader | public void setReader(String chain, String type, String path, boolean recursive, Map<String, String> params)
throws Exception {
if ((type != null && !"".equals(type.trim())) || (path != null && !"".equals(path.trim()))) {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.setReader(chain, type, path, recursive, params);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
} | java | public void setReader(String chain, String type, String path, boolean recursive, Map<String, String> params)
throws Exception {
if ((type != null && !"".equals(type.trim())) || (path != null && !"".equals(path.trim()))) {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.setReader(chain, type, path, recursive, params);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
}
} | [
"public",
"void",
"setReader",
"(",
"String",
"chain",
",",
"String",
"type",
",",
"String",
"path",
",",
"boolean",
"recursive",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"Exception",
"{",
"if",
"(",
"(",
"type",
"!=",
"n... | Sets an specific reader for an specific chain.
@param chain
Chain to apply the writer
@param type
Reader type to set
@param path
Reader path to set
@param recursive
If to set the reader to all the submodules.
@param params
Reader parameters
@throws Exception
if the walkmod configuration file can't be read. | [
"Sets",
"an",
"specific",
"reader",
"for",
"an",
"specific",
"chain",
"."
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L806-L829 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.createPreparedQueryCommand | protected AbstractQueryCommand createPreparedQueryCommand(String sql, List<Object> queryParams) {
return new PreparedQueryCommand(sql, queryParams);
} | java | protected AbstractQueryCommand createPreparedQueryCommand(String sql, List<Object> queryParams) {
return new PreparedQueryCommand(sql, queryParams);
} | [
"protected",
"AbstractQueryCommand",
"createPreparedQueryCommand",
"(",
"String",
"sql",
",",
"List",
"<",
"Object",
">",
"queryParams",
")",
"{",
"return",
"new",
"PreparedQueryCommand",
"(",
"sql",
",",
"queryParams",
")",
";",
"}"
] | Factory for the PreparedQueryCommand command pattern object allows subclass to supply implementations
of the command class.
@param sql statement to be executed, including optional parameter placeholders (?)
@param queryParams List of parameter values corresponding to parameter placeholders
@return a command - invoke its execute() and closeResource() methods
@see #createQueryCommand(String) | [
"Factory",
"for",
"the",
"PreparedQueryCommand",
"command",
"pattern",
"object",
"allows",
"subclass",
"to",
"supply",
"implementations",
"of",
"the",
"command",
"class",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L4765-L4767 |
liferay/com-liferay-commerce | commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceListUtil.java | CommercePriceListUtil.findByUUID_G | public static CommercePriceList findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.price.list.exception.NoSuchPriceListException {
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CommercePriceList findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.price.list.exception.NoSuchPriceListException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CommercePriceList",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"price",
".",
"list",
".",
"exception",
".",
"NoSuchPriceListException",
"{",
"return",
"getPersis... | Returns the commerce price list where uuid = ? and groupId = ? or throws a {@link NoSuchPriceListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce price list
@throws NoSuchPriceListException if a matching commerce price list could not be found | [
"Returns",
"the",
"commerce",
"price",
"list",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchPriceListException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceListUtil.java#L280-L283 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/triggers/TriggerExecutor.java | TriggerExecutor.executeInternal | private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily)
{
Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers();
if (triggers.isEmpty())
return null;
List<Mutation> tmutations = Lists.newLinkedList();
Thread.currentThread().setContextClassLoader(customClassLoader);
try
{
for (TriggerDefinition td : triggers.values())
{
ITrigger trigger = cachedTriggers.get(td.classOption);
if (trigger == null)
{
trigger = loadTriggerInstance(td.classOption);
cachedTriggers.put(td.classOption, trigger);
}
Collection<Mutation> temp = trigger.augment(key, columnFamily);
if (temp != null)
tmutations.addAll(temp);
}
return tmutations;
}
catch (Exception ex)
{
throw new RuntimeException(String.format("Exception while creating trigger on CF with ID: %s", columnFamily.id()), ex);
}
finally
{
Thread.currentThread().setContextClassLoader(parent);
}
} | java | private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily)
{
Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers();
if (triggers.isEmpty())
return null;
List<Mutation> tmutations = Lists.newLinkedList();
Thread.currentThread().setContextClassLoader(customClassLoader);
try
{
for (TriggerDefinition td : triggers.values())
{
ITrigger trigger = cachedTriggers.get(td.classOption);
if (trigger == null)
{
trigger = loadTriggerInstance(td.classOption);
cachedTriggers.put(td.classOption, trigger);
}
Collection<Mutation> temp = trigger.augment(key, columnFamily);
if (temp != null)
tmutations.addAll(temp);
}
return tmutations;
}
catch (Exception ex)
{
throw new RuntimeException(String.format("Exception while creating trigger on CF with ID: %s", columnFamily.id()), ex);
}
finally
{
Thread.currentThread().setContextClassLoader(parent);
}
} | [
"private",
"List",
"<",
"Mutation",
">",
"executeInternal",
"(",
"ByteBuffer",
"key",
",",
"ColumnFamily",
"columnFamily",
")",
"{",
"Map",
"<",
"String",
",",
"TriggerDefinition",
">",
"triggers",
"=",
"columnFamily",
".",
"metadata",
"(",
")",
".",
"getTrigg... | Switch class loader before using the triggers for the column family, if
not loaded them with the custom class loader. | [
"Switch",
"class",
"loader",
"before",
"using",
"the",
"triggers",
"for",
"the",
"column",
"family",
"if",
"not",
"loaded",
"them",
"with",
"the",
"custom",
"class",
"loader",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/triggers/TriggerExecutor.java#L174-L205 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java | RuntimeExceptionsFactory.newNoSuchElementException | public static NoSuchElementException newNoSuchElementException(String message, Object... args) {
return newNoSuchElementException(null, message, args);
} | java | public static NoSuchElementException newNoSuchElementException(String message, Object... args) {
return newNoSuchElementException(null, message, args);
} | [
"public",
"static",
"NoSuchElementException",
"newNoSuchElementException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newNoSuchElementException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link NoSuchElementException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link NoSuchElementException}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link NoSuchElementException} with the given {@link String message}.
@see #newNoSuchElementException(Throwable, String, Object...)
@see java.util.NoSuchElementException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"NoSuchElementException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java#L134-L136 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Envelope2D.java | Envelope2D.sqrDistance | public double sqrDistance(double xmin_, double ymin_, double xmax_, double ymax_)
{
double dx = 0;
double dy = 0;
double nn;
nn = xmin - xmax_;
if (nn > dx)
dx = nn;
nn = ymin - ymax_;
if (nn > dy)
dy = nn;
nn = xmin_ - xmax;
if (nn > dx)
dx = nn;
nn = ymin_ - ymax;
if (nn > dy)
dy = nn;
return dx * dx + dy * dy;
} | java | public double sqrDistance(double xmin_, double ymin_, double xmax_, double ymax_)
{
double dx = 0;
double dy = 0;
double nn;
nn = xmin - xmax_;
if (nn > dx)
dx = nn;
nn = ymin - ymax_;
if (nn > dy)
dy = nn;
nn = xmin_ - xmax;
if (nn > dx)
dx = nn;
nn = ymin_ - ymax;
if (nn > dy)
dy = nn;
return dx * dx + dy * dy;
} | [
"public",
"double",
"sqrDistance",
"(",
"double",
"xmin_",
",",
"double",
"ymin_",
",",
"double",
"xmax_",
",",
"double",
"ymax_",
")",
"{",
"double",
"dx",
"=",
"0",
";",
"double",
"dy",
"=",
"0",
";",
"double",
"nn",
";",
"nn",
"=",
"xmin",
"-",
... | Calculates minimum squared distance from this envelope to the other.
Returns 0 for empty envelopes.
@param xmin_
@param ymin_
@param xmax_
@param ymax_
@return Returns the squared distance. | [
"Calculates",
"minimum",
"squared",
"distance",
"from",
"this",
"envelope",
"to",
"the",
"other",
".",
"Returns",
"0",
"for",
"empty",
"envelopes",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Envelope2D.java#L1160-L1183 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java | FileSystemView.checkEmpty | private void checkEmpty(Directory dir, Path pathForException) throws FileSystemException {
if (!dir.isEmpty()) {
throw new DirectoryNotEmptyException(pathForException.toString());
}
} | java | private void checkEmpty(Directory dir, Path pathForException) throws FileSystemException {
if (!dir.isEmpty()) {
throw new DirectoryNotEmptyException(pathForException.toString());
}
} | [
"private",
"void",
"checkEmpty",
"(",
"Directory",
"dir",
",",
"Path",
"pathForException",
")",
"throws",
"FileSystemException",
"{",
"if",
"(",
"!",
"dir",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"DirectoryNotEmptyException",
"(",
"pathForException"... | Checks that given directory is empty, throwing {@link DirectoryNotEmptyException} if not. | [
"Checks",
"that",
"given",
"directory",
"is",
"empty",
"throwing",
"{"
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L491-L495 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/SetUtils.java | SetUtils.getRandomSubsetMax | public static <T> Set<T> getRandomSubsetMax(Set<T> set, int maxCount) {
int count = rand.nextInt(maxCount) + 1;
return getRandomSubset(set, count);
} | java | public static <T> Set<T> getRandomSubsetMax(Set<T> set, int maxCount) {
int count = rand.nextInt(maxCount) + 1;
return getRandomSubset(set, count);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getRandomSubsetMax",
"(",
"Set",
"<",
"T",
">",
"set",
",",
"int",
"maxCount",
")",
"{",
"int",
"count",
"=",
"rand",
".",
"nextInt",
"(",
"maxCount",
")",
"+",
"1",
";",
"return",
"getRando... | Generates a random subset of <code>set</code>, that contains at most
<code>maxCount</code> elements.
@param <T>
Type of set elements
@param set
Basic set for operation
@param maxCount
Maximum number of items
@return A subset with at most <code>maxCount</code> elements | [
"Generates",
"a",
"random",
"subset",
"of",
"<code",
">",
"set<",
"/",
"code",
">",
"that",
"contains",
"at",
"most",
"<code",
">",
"maxCount<",
"/",
"code",
">",
"elements",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/SetUtils.java#L46-L49 |
avaje-common/avaje-resteasy-guice | src/main/java/org/avaje/resteasy/Bootstrap.java | Bootstrap.registerWebSocketEndpoint | protected void registerWebSocketEndpoint(Binding<?> binding) {//}, ServerEndpoint serverEndpoint) {
Object instance = binding.getProvider().get();
Class<?> instanceClass = instance.getClass();
ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class);
if (serverEndpoint != null) {
try {
// register with the servlet container such that the Guice created singleton instance
// is the instance that is used (and not an instance created per request etc)
log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass);
BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance);
serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator));
} catch (Exception e) {
log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e);
}
}
} | java | protected void registerWebSocketEndpoint(Binding<?> binding) {//}, ServerEndpoint serverEndpoint) {
Object instance = binding.getProvider().get();
Class<?> instanceClass = instance.getClass();
ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class);
if (serverEndpoint != null) {
try {
// register with the servlet container such that the Guice created singleton instance
// is the instance that is used (and not an instance created per request etc)
log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass);
BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance);
serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator));
} catch (Exception e) {
log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e);
}
}
} | [
"protected",
"void",
"registerWebSocketEndpoint",
"(",
"Binding",
"<",
"?",
">",
"binding",
")",
"{",
"//}, ServerEndpoint serverEndpoint) {",
"Object",
"instance",
"=",
"binding",
".",
"getProvider",
"(",
")",
".",
"get",
"(",
")",
";",
"Class",
"<",
"?",
">"... | Check if the binding is a WebSocket endpoint. If it is then register the webSocket
server endpoint with the servlet container. | [
"Check",
"if",
"the",
"binding",
"is",
"a",
"WebSocket",
"endpoint",
".",
"If",
"it",
"is",
"then",
"register",
"the",
"webSocket",
"server",
"endpoint",
"with",
"the",
"servlet",
"container",
"."
] | train | https://github.com/avaje-common/avaje-resteasy-guice/blob/a585d8c6b0a6d4fb5ffb679d8950e41a03795929/src/main/java/org/avaje/resteasy/Bootstrap.java#L91-L108 |
modelmapper/modelmapper | core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java | PropertyInfoRegistry.accessorFor | static synchronized Accessor accessorFor(Class<?> type, Method method,
Configuration configuration, String name) {
PropertyInfoKey key = new PropertyInfoKey(type, name, configuration);
Accessor accessor = ACCESSOR_CACHE.get(key);
if (accessor == null) {
accessor = new MethodAccessor(type, method, name);
ACCESSOR_CACHE.put(key, accessor);
}
return accessor;
} | java | static synchronized Accessor accessorFor(Class<?> type, Method method,
Configuration configuration, String name) {
PropertyInfoKey key = new PropertyInfoKey(type, name, configuration);
Accessor accessor = ACCESSOR_CACHE.get(key);
if (accessor == null) {
accessor = new MethodAccessor(type, method, name);
ACCESSOR_CACHE.put(key, accessor);
}
return accessor;
} | [
"static",
"synchronized",
"Accessor",
"accessorFor",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Method",
"method",
",",
"Configuration",
"configuration",
",",
"String",
"name",
")",
"{",
"PropertyInfoKey",
"key",
"=",
"new",
"PropertyInfoKey",
"(",
"type",
","... | Returns an Accessor for the given accessor method. The method must be externally validated to
ensure that it accepts zero arguments and does not return void.class. | [
"Returns",
"an",
"Accessor",
"for",
"the",
"given",
"accessor",
"method",
".",
"The",
"method",
"must",
"be",
"externally",
"validated",
"to",
"ensure",
"that",
"it",
"accepts",
"zero",
"arguments",
"and",
"does",
"not",
"return",
"void",
".",
"class",
"."
] | train | https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java#L98-L108 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsEditor.java | CmsEditor.getFileEncoding | protected String getFileEncoding(CmsObject cms, String filename) {
try {
return cms.readPropertyObject(filename, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue(
OpenCms.getSystemInfo().getDefaultEncoding());
} catch (CmsException e) {
return OpenCms.getSystemInfo().getDefaultEncoding();
}
} | java | protected String getFileEncoding(CmsObject cms, String filename) {
try {
return cms.readPropertyObject(filename, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue(
OpenCms.getSystemInfo().getDefaultEncoding());
} catch (CmsException e) {
return OpenCms.getSystemInfo().getDefaultEncoding();
}
} | [
"protected",
"String",
"getFileEncoding",
"(",
"CmsObject",
"cms",
",",
"String",
"filename",
")",
"{",
"try",
"{",
"return",
"cms",
".",
"readPropertyObject",
"(",
"filename",
",",
"CmsPropertyDefinition",
".",
"PROPERTY_CONTENT_ENCODING",
",",
"true",
")",
".",
... | Helper method to determine the encoding of the given file in the VFS,
which must be set using the "content-encoding" property.<p>
@param cms the CmsObject
@param filename the name of the file which is to be checked
@return the encoding for the file | [
"Helper",
"method",
"to",
"determine",
"the",
"encoding",
"of",
"the",
"given",
"file",
"in",
"the",
"VFS",
"which",
"must",
"be",
"set",
"using",
"the",
"content",
"-",
"encoding",
"property",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditor.java#L984-L992 |
kevinherron/opc-ua-stack | stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java | CertificateUtil.decodeCertificates | public static List<X509Certificate> decodeCertificates(byte[] certificateBytes) throws UaException {
Preconditions.checkNotNull(certificateBytes, "certificateBytes cannot be null");
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_InternalError, e);
}
try {
Collection<? extends Certificate> certificates =
factory.generateCertificates(new ByteArrayInputStream(certificateBytes));
return certificates.stream()
.map(X509Certificate.class::cast)
.collect(Collectors.toList());
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_CertificateInvalid, e);
}
} | java | public static List<X509Certificate> decodeCertificates(byte[] certificateBytes) throws UaException {
Preconditions.checkNotNull(certificateBytes, "certificateBytes cannot be null");
CertificateFactory factory;
try {
factory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_InternalError, e);
}
try {
Collection<? extends Certificate> certificates =
factory.generateCertificates(new ByteArrayInputStream(certificateBytes));
return certificates.stream()
.map(X509Certificate.class::cast)
.collect(Collectors.toList());
} catch (CertificateException e) {
throw new UaException(StatusCodes.Bad_CertificateInvalid, e);
}
} | [
"public",
"static",
"List",
"<",
"X509Certificate",
">",
"decodeCertificates",
"(",
"byte",
"[",
"]",
"certificateBytes",
")",
"throws",
"UaException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"certificateBytes",
",",
"\"certificateBytes cannot be null\"",
")",
... | Decode either a sequence of DER-encoded X.509 certificates or a PKCS#7 certificate chain.
@param certificateBytes the byte[] to decode from.
@return a {@link List} of certificates deocded from {@code certificateBytes}.
@throws UaException if decoding fails. | [
"Decode",
"either",
"a",
"sequence",
"of",
"DER",
"-",
"encoded",
"X",
".",
"509",
"certificates",
"or",
"a",
"PKCS#7",
"certificate",
"chain",
"."
] | train | https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateUtil.java#L87-L108 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdateAsync | public Observable<RedisFirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String cacheName, String ruleName, RedisFirewallRuleCreateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, cacheName, ruleName, parameters).map(new Func1<ServiceResponse<RedisFirewallRuleInner>, RedisFirewallRuleInner>() {
@Override
public RedisFirewallRuleInner call(ServiceResponse<RedisFirewallRuleInner> response) {
return response.body();
}
});
} | java | public Observable<RedisFirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String cacheName, String ruleName, RedisFirewallRuleCreateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, cacheName, ruleName, parameters).map(new Func1<ServiceResponse<RedisFirewallRuleInner>, RedisFirewallRuleInner>() {
@Override
public RedisFirewallRuleInner call(ServiceResponse<RedisFirewallRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RedisFirewallRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"cacheName",
",",
"String",
"ruleName",
",",
"RedisFirewallRuleCreateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServi... | Create or update a redis cache firewall rule.
@param resourceGroupName The name of the resource group.
@param cacheName The name of the Redis cache.
@param ruleName The name of the firewall rule.
@param parameters Parameters supplied to the create or update redis firewall rule operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisFirewallRuleInner object | [
"Create",
"or",
"update",
"a",
"redis",
"cache",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java#L251-L258 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/core/memory/MemorySegment.java | MemorySegment.copyTo | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
// system arraycopy does the boundary checks anyways, no need to check extra
System.arraycopy(this.memory, offset, target.memory, targetOffset, numBytes);
} | java | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
// system arraycopy does the boundary checks anyways, no need to check extra
System.arraycopy(this.memory, offset, target.memory, targetOffset, numBytes);
} | [
"public",
"final",
"void",
"copyTo",
"(",
"int",
"offset",
",",
"MemorySegment",
"target",
",",
"int",
"targetOffset",
",",
"int",
"numBytes",
")",
"{",
"// system arraycopy does the boundary checks anyways, no need to check extra",
"System",
".",
"arraycopy",
"(",
"thi... | Bulk copy method. Copies {@code numBytes} bytes from this memory segment, starting at position
{@code offset} to the target memory segment. The bytes will be put into the target segment
starting at position {@code targetOffset}.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The memory segment to copy the bytes to.
@param targetOffset The position in the target memory segment to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If either of the offsets is invalid, or the source segment does not
contain the given number of bytes (starting from offset), or the target segment does
not have enough space for the bytes (counting from targetOffset). | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"from",
"this",
"memory",
"segment",
"starting",
"at",
"position",
"{",
"@code",
"offset",
"}",
"to",
"the",
"target",
"memory",
"segment",
".",
"The",
"bytes",
"will",
"be",
... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/core/memory/MemorySegment.java#L933-L936 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.errorf | public void errorf(Throwable t, String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1 }, t);
}
} | java | public void errorf(Throwable t, String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1 }, t);
}
} | [
"public",
"void",
"errorf",
"(",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"ERROR",
")",
")",
"{",
"doLogf",
"(",
"Level",
".",
"ERROR",
",",
"FQCN",
",",
"format",
",",
... | Issue a formatted log message with a level of ERROR.
@param t the throwable
@param format the format string, as per {@link String#format(String, Object...)}
@param param1 the sole parameter | [
"Issue",
"a",
"formatted",
"log",
"message",
"with",
"a",
"level",
"of",
"ERROR",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1727-L1731 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java | CPDefinitionLinkPersistenceImpl.findAll | @Override
public List<CPDefinitionLink> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPDefinitionLink> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionLink",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp definition links.
@return the cp definition links | [
"Returns",
"all",
"the",
"cp",
"definition",
"links",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L4721-L4724 |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java | SelfExtractRun.disable2PC | private static void disable2PC(String extractDirectory, String serverName) throws IOException {
String fileName = extractDirectory + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + serverName + File.separator
+ "jvm.options";
BufferedReader br = null;
BufferedWriter bw = null;
StringBuffer sb = new StringBuffer();
try {
String sCurrentLine;
File file = new File(fileName);
// if file doesnt exists, then create it
if (!file.exists()) {
boolean success = file.createNewFile();
if (!success) {
throw new IOException("Failed to create file " + fileName);
}
} else {
// read existing file content
br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
while ((sCurrentLine = br.readLine()) != null) {
sb.append(sCurrentLine + "\n");
}
}
// write property to disable 2PC commit
String content = "-Dcom.ibm.tx.jta.disable2PC=true";
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"));
bw.write(sb.toString());
bw.write(content);
} finally {
if (br != null)
br.close();
if (bw != null)
bw.close();
}
} | java | private static void disable2PC(String extractDirectory, String serverName) throws IOException {
String fileName = extractDirectory + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + serverName + File.separator
+ "jvm.options";
BufferedReader br = null;
BufferedWriter bw = null;
StringBuffer sb = new StringBuffer();
try {
String sCurrentLine;
File file = new File(fileName);
// if file doesnt exists, then create it
if (!file.exists()) {
boolean success = file.createNewFile();
if (!success) {
throw new IOException("Failed to create file " + fileName);
}
} else {
// read existing file content
br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
while ((sCurrentLine = br.readLine()) != null) {
sb.append(sCurrentLine + "\n");
}
}
// write property to disable 2PC commit
String content = "-Dcom.ibm.tx.jta.disable2PC=true";
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"));
bw.write(sb.toString());
bw.write(content);
} finally {
if (br != null)
br.close();
if (bw != null)
bw.close();
}
} | [
"private",
"static",
"void",
"disable2PC",
"(",
"String",
"extractDirectory",
",",
"String",
"serverName",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"extractDirectory",
"+",
"File",
".",
"separator",
"+",
"\"wlp\"",
"+",
"File",
".",
"separat... | Write property into jvm.options to disable 2PC transactions.
2PC transactions are disabled by default because default transaction
log is stored in extract directory and therefore foils transaction
recovery if the server terminates unexpectedly.
@param extractDirectory
@param serverName
@throws IOException | [
"Write",
"property",
"into",
"jvm",
".",
"options",
"to",
"disable",
"2PC",
"transactions",
".",
"2PC",
"transactions",
"are",
"disabled",
"by",
"default",
"because",
"default",
"transaction",
"log",
"is",
"stored",
"in",
"extract",
"directory",
"and",
"therefor... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java#L176-L218 |
minio/minio-java | api/src/main/java/io/minio/messages/S3Key.java | S3Key.setRule | private void setRule(String name, String value) throws InvalidArgumentException, XmlPullParserException {
if (value.length() > 1024) {
throw new InvalidArgumentException("value '" + value + "' is more than 1024 long");
}
for (FilterRule rule: filterRuleList) {
// Remove rule.name is same as given name.
if (rule.name().equals(name)) {
filterRuleList.remove(rule);
}
}
FilterRule newRule = new FilterRule();
newRule.setName(name);
newRule.setValue(value);
filterRuleList.add(newRule);
} | java | private void setRule(String name, String value) throws InvalidArgumentException, XmlPullParserException {
if (value.length() > 1024) {
throw new InvalidArgumentException("value '" + value + "' is more than 1024 long");
}
for (FilterRule rule: filterRuleList) {
// Remove rule.name is same as given name.
if (rule.name().equals(name)) {
filterRuleList.remove(rule);
}
}
FilterRule newRule = new FilterRule();
newRule.setName(name);
newRule.setValue(value);
filterRuleList.add(newRule);
} | [
"private",
"void",
"setRule",
"(",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"InvalidArgumentException",
",",
"XmlPullParserException",
"{",
"if",
"(",
"value",
".",
"length",
"(",
")",
">",
"1024",
")",
"{",
"throw",
"new",
"InvalidArgumentExce... | Sets filter rule to list.
As per Amazon AWS S3 server behavior, its not possible to set more than one rule for "prefix" or "suffix".
However the spec http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTnotification.html
is not clear about this behavior. | [
"Sets",
"filter",
"rule",
"to",
"list",
".",
"As",
"per",
"Amazon",
"AWS",
"S3",
"server",
"behavior",
"its",
"not",
"possible",
"to",
"set",
"more",
"than",
"one",
"rule",
"for",
"prefix",
"or",
"suffix",
".",
"However",
"the",
"spec",
"http",
":",
"/... | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/messages/S3Key.java#L58-L74 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/CachingAndArtifactsManager.java | CachingAndArtifactsManager.updateCachingAndArtifacts | public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) {
CommandContext commandContext = Context.getCommandContext();
final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache
= processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache();
DeploymentEntity deployment = parsedDeployment.getDeployment();
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition);
Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition);
ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process);
processDefinitionCache.add(processDefinition.getId(), cacheEntry);
addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext);
// Add to deployment for further usage
deployment.addDeployedArtifact(processDefinition);
}
} | java | public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) {
CommandContext commandContext = Context.getCommandContext();
final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache
= processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache();
DeploymentEntity deployment = parsedDeployment.getDeployment();
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition);
Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition);
ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process);
processDefinitionCache.add(processDefinition.getId(), cacheEntry);
addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext);
// Add to deployment for further usage
deployment.addDeployedArtifact(processDefinition);
}
} | [
"public",
"void",
"updateCachingAndArtifacts",
"(",
"ParsedDeployment",
"parsedDeployment",
")",
"{",
"CommandContext",
"commandContext",
"=",
"Context",
".",
"getCommandContext",
"(",
")",
";",
"final",
"ProcessEngineConfigurationImpl",
"processEngineConfiguration",
"=",
"... | Ensures that the process definition is cached in the appropriate places, including the
deployment's collection of deployed artifacts and the deployment manager's cache, as well
as caching any ProcessDefinitionInfos. | [
"Ensures",
"that",
"the",
"process",
"definition",
"is",
"cached",
"in",
"the",
"appropriate",
"places",
"including",
"the",
"deployment",
"s",
"collection",
"of",
"deployed",
"artifacts",
"and",
"the",
"deployment",
"manager",
"s",
"cache",
"as",
"well",
"as",
... | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/CachingAndArtifactsManager.java#L44-L61 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_mailingList_name_GET | public OvhMailingList domain_mailingList_name_GET(String domain, String name) throws IOException {
String qPath = "/email/domain/{domain}/mailingList/{name}";
StringBuilder sb = path(qPath, domain, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMailingList.class);
} | java | public OvhMailingList domain_mailingList_name_GET(String domain, String name) throws IOException {
String qPath = "/email/domain/{domain}/mailingList/{name}";
StringBuilder sb = path(qPath, domain, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMailingList.class);
} | [
"public",
"OvhMailingList",
"domain_mailingList_name_GET",
"(",
"String",
"domain",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/mailingList/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | Get this object properties
REST: GET /email/domain/{domain}/mailingList/{name}
@param domain [required] Name of your domain name
@param name [required] Name of mailing list | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1526-L1531 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/Type.java | Type.getMethodDescriptor | public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder);
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} | java | public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder);
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"getMethodDescriptor",
"(",
"final",
"Type",
"returnType",
",",
"final",
"Type",
"...",
"argumentTypes",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"stringBuilder",
".",
"append",
"(",
"'... | Returns the descriptor corresponding to the given argument and return types.
@param returnType the return type of the method.
@param argumentTypes the argument types of the method.
@return the descriptor corresponding to the given argument and return types. | [
"Returns",
"the",
"descriptor",
"corresponding",
"to",
"the",
"given",
"argument",
"and",
"return",
"types",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/Type.java#L600-L609 |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.isRootResource | public boolean isRootResource(final Graph graph, final Node subject) {
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | java | public boolean isRootResource(final Graph graph, final Node subject) {
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | [
"public",
"boolean",
"isRootResource",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"String",
"rootRes",
"=",
"graph",
".",
"getPrefixMapping",
"(",
")",
".",
"expandPrefix",
"(",
"FEDORA_REPOSITORY_ROOT",
")",
";",
"fina... | Is the subject the repository root resource.
@param graph The graph
@param subject The current subject
@return true if has rdf:type http://fedora.info/definitions/v4/repository#RepositoryRoot | [
"Is",
"the",
"subject",
"the",
"repository",
"root",
"resource",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L386-L390 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javah/Gen.java | Gen.writeIfChanged | private void writeIfChanged(byte[] b, FileObject file) throws IOException {
boolean mustWrite = false;
String event = "[No need to update file ";
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
InputStream in;
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
in = file.openInputStream();
a = readBytes(in);
if (!Arrays.equals(a, b)) {
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (util.verbose)
util.log(event + file + "]");
if (mustWrite) {
OutputStream out = file.openOutputStream();
out.write(b); /* No buffering, just one big write! */
out.close();
}
} | java | private void writeIfChanged(byte[] b, FileObject file) throws IOException {
boolean mustWrite = false;
String event = "[No need to update file ";
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
InputStream in;
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
in = file.openInputStream();
a = readBytes(in);
if (!Arrays.equals(a, b)) {
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (util.verbose)
util.log(event + file + "]");
if (mustWrite) {
OutputStream out = file.openOutputStream();
out.write(b); /* No buffering, just one big write! */
out.close();
}
} | [
"private",
"void",
"writeIfChanged",
"(",
"byte",
"[",
"]",
"b",
",",
"FileObject",
"file",
")",
"throws",
"IOException",
"{",
"boolean",
"mustWrite",
"=",
"false",
";",
"String",
"event",
"=",
"\"[No need to update file \"",
";",
"if",
"(",
"force",
")",
"{... | /*
Write the contents of byte[] b to a file named file. Writing
is done if either the file doesn't exist or if the contents are
different. | [
"/",
"*",
"Write",
"the",
"contents",
"of",
"byte",
"[]",
"b",
"to",
"a",
"file",
"named",
"file",
".",
"Writing",
"is",
"done",
"if",
"either",
"the",
"file",
"doesn",
"t",
"exist",
"or",
"if",
"the",
"contents",
"are",
"different",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javah/Gen.java#L186-L221 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java | RepositoryApplicationConfiguration.actionCleanup | @Bean
CleanupTask actionCleanup(final DeploymentManagement deploymentManagement,
final TenantConfigurationManagement configManagement) {
return new AutoActionCleanup(deploymentManagement, configManagement);
} | java | @Bean
CleanupTask actionCleanup(final DeploymentManagement deploymentManagement,
final TenantConfigurationManagement configManagement) {
return new AutoActionCleanup(deploymentManagement, configManagement);
} | [
"@",
"Bean",
"CleanupTask",
"actionCleanup",
"(",
"final",
"DeploymentManagement",
"deploymentManagement",
",",
"final",
"TenantConfigurationManagement",
"configManagement",
")",
"{",
"return",
"new",
"AutoActionCleanup",
"(",
"deploymentManagement",
",",
"configManagement",
... | {@link AutoActionCleanup} bean.
@param deploymentManagement
Deployment management service
@param configManagement
Tenant configuration service
@return a new {@link AutoActionCleanup} bean | [
"{",
"@link",
"AutoActionCleanup",
"}",
"bean",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L805-L809 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseLVals | private Tuple<LVal> parseLVals(EnclosingScope scope) {
int start = index;
ArrayList<LVal> elements = new ArrayList<>();
elements.add(parseLVal(index, scope));
// Check whether we have a multiple lvals or not
while (tryAndMatch(true, Comma) != null) {
// Add all expressions separated by a comma
elements.add(parseLVal(index, scope));
// Done
}
return new Tuple<>(elements);
} | java | private Tuple<LVal> parseLVals(EnclosingScope scope) {
int start = index;
ArrayList<LVal> elements = new ArrayList<>();
elements.add(parseLVal(index, scope));
// Check whether we have a multiple lvals or not
while (tryAndMatch(true, Comma) != null) {
// Add all expressions separated by a comma
elements.add(parseLVal(index, scope));
// Done
}
return new Tuple<>(elements);
} | [
"private",
"Tuple",
"<",
"LVal",
">",
"parseLVals",
"(",
"EnclosingScope",
"scope",
")",
"{",
"int",
"start",
"=",
"index",
";",
"ArrayList",
"<",
"LVal",
">",
"elements",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"elements",
".",
"add",
"(",
"pars... | Parse an "lval" expression, which is a subset of the possible expressions
forms permitted on the left-hand side of an assignment. LVals are of the
form:
<pre>
LVal ::= LValTerm (',' LValTerm)* ')'
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@return | [
"Parse",
"an",
"lval",
"expression",
"which",
"is",
"a",
"subset",
"of",
"the",
"possible",
"expressions",
"forms",
"permitted",
"on",
"the",
"left",
"-",
"hand",
"side",
"of",
"an",
"assignment",
".",
"LVals",
"are",
"of",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1447-L1460 |
rythmengine/rythmengine | src/main/java/org/rythmengine/RythmEngine.java | RythmEngine.accept | @Override
public Object accept(IEvent event, Object param) {
return eventDispatcher().accept(event, param);
} | java | @Override
public Object accept(IEvent event, Object param) {
return eventDispatcher().accept(event, param);
} | [
"@",
"Override",
"public",
"Object",
"accept",
"(",
"IEvent",
"event",
",",
"Object",
"param",
")",
"{",
"return",
"eventDispatcher",
"(",
")",
".",
"accept",
"(",
"event",
",",
"param",
")",
";",
"}"
] | Not an API for user application
@param event
@param param
@return event handler process result | [
"Not",
"an",
"API",
"for",
"user",
"application"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1986-L1989 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readPropertyObject | public CmsProperty readPropertyObject(String resourcePath, String property, boolean search) throws CmsException {
CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.readPropertyObject(m_context, resource, property, search);
} | java | public CmsProperty readPropertyObject(String resourcePath, String property, boolean search) throws CmsException {
CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.readPropertyObject(m_context, resource, property, search);
} | [
"public",
"CmsProperty",
"readPropertyObject",
"(",
"String",
"resourcePath",
",",
"String",
"property",
",",
"boolean",
"search",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourcePath",
",",
"CmsResourceFilter",
".",
... | Reads a property object from a resource specified by a property name.<p>
Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
@param resourcePath the name of resource where the property is attached to
@param property the property name
@param search if true, the property is searched on all parent folders of the resource,
if it's not found attached directly to the resource
@return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
@throws CmsException if something goes wrong | [
"Reads",
"a",
"property",
"object",
"from",
"a",
"resource",
"specified",
"by",
"a",
"property",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2942-L2946 |
code4everything/util | src/main/java/com/zhazhapan/util/dialog/Dialogs.java | Dialogs.getDialog | public static Dialog<String[]> getDialog(String title, ButtonType ok) {
Dialog<String[]> dialog = new Dialog<>();
dialog.setTitle(title);
dialog.setHeaderText(null);
dialog.initModality(Modality.APPLICATION_MODAL);
// 自定义确认和取消按钮
ButtonType cancel = new ButtonType(CANCEL_BUTTON_TEXT, ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(ok, cancel);
return dialog;
} | java | public static Dialog<String[]> getDialog(String title, ButtonType ok) {
Dialog<String[]> dialog = new Dialog<>();
dialog.setTitle(title);
dialog.setHeaderText(null);
dialog.initModality(Modality.APPLICATION_MODAL);
// 自定义确认和取消按钮
ButtonType cancel = new ButtonType(CANCEL_BUTTON_TEXT, ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(ok, cancel);
return dialog;
} | [
"public",
"static",
"Dialog",
"<",
"String",
"[",
"]",
">",
"getDialog",
"(",
"String",
"title",
",",
"ButtonType",
"ok",
")",
"{",
"Dialog",
"<",
"String",
"[",
"]",
">",
"dialog",
"=",
"new",
"Dialog",
"<>",
"(",
")",
";",
"dialog",
".",
"setTitle"... | 获得一个{@link Dialog}对象
@param title 标题
@param ok 确认按钮
@return {@link Dialog} | [
"获得一个",
"{",
"@link",
"Dialog",
"}",
"对象"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Dialogs.java#L63-L74 |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java | HazardCurve.createHazardCurveFromHazardRate | public static HazardCurve createHazardCurveFromHazardRate(String name, double[] times, double[] givenHazardRates){
double[] givenSurvivalProbabilities = new double[givenHazardRates.length];
if(givenHazardRates[0]<0) {
throw new IllegalArgumentException("First hazard rate is not positive");
}
//initialize the term structure
givenSurvivalProbabilities[0] = Math.exp(- givenHazardRates[0] * times[0]);
/*
* Construct the hazard curve by numerically integrating the hazard rates.
* At each step check if the input hazard rate is positive.
*/
for(int timeIndex=1; timeIndex<times.length;timeIndex++) {
if(givenHazardRates[timeIndex]<0) {
throw new IllegalArgumentException("The " + timeIndex + "-th hazard rate is not positive");
}
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
}
return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities);
} | java | public static HazardCurve createHazardCurveFromHazardRate(String name, double[] times, double[] givenHazardRates){
double[] givenSurvivalProbabilities = new double[givenHazardRates.length];
if(givenHazardRates[0]<0) {
throw new IllegalArgumentException("First hazard rate is not positive");
}
//initialize the term structure
givenSurvivalProbabilities[0] = Math.exp(- givenHazardRates[0] * times[0]);
/*
* Construct the hazard curve by numerically integrating the hazard rates.
* At each step check if the input hazard rate is positive.
*/
for(int timeIndex=1; timeIndex<times.length;timeIndex++) {
if(givenHazardRates[timeIndex]<0) {
throw new IllegalArgumentException("The " + timeIndex + "-th hazard rate is not positive");
}
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
}
return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities);
} | [
"public",
"static",
"HazardCurve",
"createHazardCurveFromHazardRate",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenHazardRates",
")",
"{",
"double",
"[",
"]",
"givenSurvivalProbabilities",
"=",
"new",
"double",
"[",
"gi... | Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenSurvivalProbabilities[timeIndex] = givenSurvivalProbabilities[timeIndex-1] * Math.exp(- givenHazardRates[timeIndex] * (times[timeIndex]-times[timeIndex-1]));
</code>
@param name The name of this discount curve.
@param times Array of times as doubles.
@param givenHazardRates Array of corresponding zero rates.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"times",
"and",
"given",
"zero",
"rates",
"using",
"default",
"interpolation",
"and",
"extrapolation",
"methods",
".",
"The",
"discount",
"factor",
"is",
"determined",
"by",
"<code",
">",
"givenSurvivalProbabili... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java#L296-L321 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java | ConsumerUtil.getSigningKey | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | java | Key getSigningKey(JwtConsumerConfig config, JwtContext jwtContext, Map properties) throws KeyException {
Key signingKey = null;
if (config == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "JWT consumer config object is null");
}
return null;
}
signingKey = getSigningKeyBasedOnSignatureAlgorithm(config, jwtContext, properties);
if (signingKey == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "A signing key could not be found");
}
}
return signingKey;
} | [
"Key",
"getSigningKey",
"(",
"JwtConsumerConfig",
"config",
",",
"JwtContext",
"jwtContext",
",",
"Map",
"properties",
")",
"throws",
"KeyException",
"{",
"Key",
"signingKey",
"=",
"null",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
... | Get the appropriate signing key based on the signature algorithm specified in
the config. | [
"Get",
"the",
"appropriate",
"signing",
"key",
"based",
"on",
"the",
"signature",
"algorithm",
"specified",
"in",
"the",
"config",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L122-L137 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentErrorHandler.java | CmsXmlContentErrorHandler.addWarning | public void addWarning(I_CmsXmlContentValue value, String message) {
m_hasWarnings = true;
Locale locale = value.getLocale();
Map<String, String> localeWarnings = getLocalIssueMap(m_warnings, locale);
localeWarnings.put(value.getPath(), message);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_WARN_2, value.getPath(), message));
}
} | java | public void addWarning(I_CmsXmlContentValue value, String message) {
m_hasWarnings = true;
Locale locale = value.getLocale();
Map<String, String> localeWarnings = getLocalIssueMap(m_warnings, locale);
localeWarnings.put(value.getPath(), message);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_WARN_2, value.getPath(), message));
}
} | [
"public",
"void",
"addWarning",
"(",
"I_CmsXmlContentValue",
"value",
",",
"String",
"message",
")",
"{",
"m_hasWarnings",
"=",
"true",
";",
"Locale",
"locale",
"=",
"value",
".",
"getLocale",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"local... | Adds an warning message to the internal list of errors,
also raised the "has warning" flag.<p>
@param value the value that contians the warning
@param message the warning message to add | [
"Adds",
"an",
"warning",
"message",
"to",
"the",
"internal",
"list",
"of",
"errors",
"also",
"raised",
"the",
"has",
"warning",
"flag",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentErrorHandler.java#L98-L109 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.multiHeadDotProductAttention | public SDVariable multiHeadDotProductAttention(String name, SDVariable queries, SDVariable keys, SDVariable values, SDVariable Wq, SDVariable Wk, SDVariable Wv, SDVariable Wo, SDVariable mask, boolean scaled){
final SDVariable result = f().multiHeadDotProductAttention(queries, keys, values, Wq, Wk, Wv, Wo, mask, scaled);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable multiHeadDotProductAttention(String name, SDVariable queries, SDVariable keys, SDVariable values, SDVariable Wq, SDVariable Wk, SDVariable Wv, SDVariable Wo, SDVariable mask, boolean scaled){
final SDVariable result = f().multiHeadDotProductAttention(queries, keys, values, Wq, Wk, Wv, Wo, mask, scaled);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"multiHeadDotProductAttention",
"(",
"String",
"name",
",",
"SDVariable",
"queries",
",",
"SDVariable",
"keys",
",",
"SDVariable",
"values",
",",
"SDVariable",
"Wq",
",",
"SDVariable",
"Wk",
",",
"SDVariable",
"Wv",
",",
"SDVariable",
"Wo",... | This performs multi-headed dot product attention on the given timeseries input
@see #multiHeadDotProductAttention(String, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, boolean, boolean) | [
"This",
"performs",
"multi",
"-",
"headed",
"dot",
"product",
"attention",
"on",
"the",
"given",
"timeseries",
"input"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L914-L917 |
requery/requery | requery/src/main/java/io/requery/proxy/EntityProxy.java | EntityProxy.getState | public PropertyState getState(Attribute<E, ?> attribute) {
if (stateless) {
return null;
}
PropertyState state = attribute.getPropertyState().get(entity);
return state == null ? PropertyState.FETCH : state;
} | java | public PropertyState getState(Attribute<E, ?> attribute) {
if (stateless) {
return null;
}
PropertyState state = attribute.getPropertyState().get(entity);
return state == null ? PropertyState.FETCH : state;
} | [
"public",
"PropertyState",
"getState",
"(",
"Attribute",
"<",
"E",
",",
"?",
">",
"attribute",
")",
"{",
"if",
"(",
"stateless",
")",
"{",
"return",
"null",
";",
"}",
"PropertyState",
"state",
"=",
"attribute",
".",
"getPropertyState",
"(",
")",
".",
"ge... | Gets the current {@link PropertyState} of a given {@link Attribute}.
@param attribute to get
@return the state of the attribute | [
"Gets",
"the",
"current",
"{",
"@link",
"PropertyState",
"}",
"of",
"a",
"given",
"{",
"@link",
"Attribute",
"}",
"."
] | train | https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery/src/main/java/io/requery/proxy/EntityProxy.java#L231-L237 |
logic-ng/LogicNG | src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java | BDDKernel.satOneSet | public int satOneSet(final int r, final int var, final int pol) {
if (isZero(r))
return r;
if (!isConst(pol))
throw new IllegalArgumentException("polarity for satOneSet must be a constant");
initRef();
return satOneSetRec(r, var, pol);
} | java | public int satOneSet(final int r, final int var, final int pol) {
if (isZero(r))
return r;
if (!isConst(pol))
throw new IllegalArgumentException("polarity for satOneSet must be a constant");
initRef();
return satOneSetRec(r, var, pol);
} | [
"public",
"int",
"satOneSet",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"var",
",",
"final",
"int",
"pol",
")",
"{",
"if",
"(",
"isZero",
"(",
"r",
")",
")",
"return",
"r",
";",
"if",
"(",
"!",
"isConst",
"(",
"pol",
")",
")",
"throw",
"ne... | Returns an arbitrary model for a given BDD or {@code null} which contains at least the given variables. If a variable
is a don't care variable, it will be assigned with the given default value.
@param r the BDD root node
@param var the set of variable which has to be contained in the model as a BDD
@param pol the default value for don't care variables as a BDD
@return an arbitrary model of this BDD | [
"Returns",
"an",
"arbitrary",
"model",
"for",
"a",
"given",
"BDD",
"or",
"{"
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L819-L826 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateTableRow | public static boolean validateTableRow(final Node row, final int numColumns) {
assert row != null;
assert row.getNodeName().equals("row") || row.getNodeName().equals("tr");
if (row.getNodeName().equals("row")) {
final List<Node> entries = XMLUtilities.getDirectChildNodes(row, "entry");
final List<Node> entryTbls = XMLUtilities.getDirectChildNodes(row, "entrytbl");
if ((entries.size() + entryTbls.size()) <= numColumns) {
for (final Node entryTbl : entryTbls) {
if (!validateEntryTbl((Element) entryTbl)) return false;
}
return true;
} else {
return false;
}
} else {
final List<Node> nodes = XMLUtilities.getDirectChildNodes(row, "td", "th");
return nodes.size() <= numColumns;
}
} | java | public static boolean validateTableRow(final Node row, final int numColumns) {
assert row != null;
assert row.getNodeName().equals("row") || row.getNodeName().equals("tr");
if (row.getNodeName().equals("row")) {
final List<Node> entries = XMLUtilities.getDirectChildNodes(row, "entry");
final List<Node> entryTbls = XMLUtilities.getDirectChildNodes(row, "entrytbl");
if ((entries.size() + entryTbls.size()) <= numColumns) {
for (final Node entryTbl : entryTbls) {
if (!validateEntryTbl((Element) entryTbl)) return false;
}
return true;
} else {
return false;
}
} else {
final List<Node> nodes = XMLUtilities.getDirectChildNodes(row, "td", "th");
return nodes.size() <= numColumns;
}
} | [
"public",
"static",
"boolean",
"validateTableRow",
"(",
"final",
"Node",
"row",
",",
"final",
"int",
"numColumns",
")",
"{",
"assert",
"row",
"!=",
"null",
";",
"assert",
"row",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"row\"",
")",
"||",
"row... | Check to ensure that a docbook row has the required number of columns for a table.
@param row The DOM row element to be checked.
@param numColumns The number of entry elements that should exist in the row.
@return True if the row has the required number of entries, otherwise false. | [
"Check",
"to",
"ensure",
"that",
"a",
"docbook",
"row",
"has",
"the",
"required",
"number",
"of",
"columns",
"for",
"a",
"table",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3122-L3143 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/Ansi.java | Ansi.println | public void println(PrintStream ps, String message){
print(ps, message);
ps.println();
} | java | public void println(PrintStream ps, String message){
print(ps, message);
ps.println();
} | [
"public",
"void",
"println",
"(",
"PrintStream",
"ps",
",",
"String",
"message",
")",
"{",
"print",
"(",
"ps",
",",
"message",
")",
";",
"ps",
".",
"println",
"(",
")",
";",
"}"
] | Prints colorized {@code message} to specified {@code ps} followed by newline.
<p>
if {@link #SUPPORTED} is false, it prints raw {@code message} to {@code ps} followed by newline.
@param ps stream to print
@param message message to be colorized | [
"Prints",
"colorized",
"{",
"@code",
"message",
"}",
"to",
"specified",
"{",
"@code",
"ps",
"}",
"followed",
"by",
"newline",
".",
"<p",
">",
"if",
"{",
"@link",
"#SUPPORTED",
"}",
"is",
"false",
"it",
"prints",
"raw",
"{",
"@code",
"message",
"}",
"to... | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/Ansi.java#L258-L261 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobClient.java | JobClient.listEvents | private void listEvents(JobID jobId, int fromEventId, int numEvents)
throws IOException {
TaskCompletionEvent[] events =
jobSubmitClient.getTaskCompletionEvents(jobId, fromEventId, numEvents);
System.out.println("Task completion events for " + jobId);
System.out.println("Number of events (from " + fromEventId +
") are: " + events.length);
for(TaskCompletionEvent event: events) {
System.out.println(event.getTaskStatus() + " " + event.getTaskAttemptId() + " " +
getTaskLogURL(event.getTaskAttemptId(),
event.getTaskTrackerHttp()));
}
} | java | private void listEvents(JobID jobId, int fromEventId, int numEvents)
throws IOException {
TaskCompletionEvent[] events =
jobSubmitClient.getTaskCompletionEvents(jobId, fromEventId, numEvents);
System.out.println("Task completion events for " + jobId);
System.out.println("Number of events (from " + fromEventId +
") are: " + events.length);
for(TaskCompletionEvent event: events) {
System.out.println(event.getTaskStatus() + " " + event.getTaskAttemptId() + " " +
getTaskLogURL(event.getTaskAttemptId(),
event.getTaskTrackerHttp()));
}
} | [
"private",
"void",
"listEvents",
"(",
"JobID",
"jobId",
",",
"int",
"fromEventId",
",",
"int",
"numEvents",
")",
"throws",
"IOException",
"{",
"TaskCompletionEvent",
"[",
"]",
"events",
"=",
"jobSubmitClient",
".",
"getTaskCompletionEvents",
"(",
"jobId",
",",
"... | List the events for the given job
@param jobId the job id for the job's events to list
@throws IOException | [
"List",
"the",
"events",
"for",
"the",
"given",
"job"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobClient.java#L2335-L2347 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java | ModelSerializer.restoreComputationGraphAndNormalizer | public static Pair<ComputationGraph, Normalizer> restoreComputationGraphAndNormalizer(
@NonNull InputStream is, boolean loadUpdater) throws IOException {
checkInputStream(is);
File tmpFile = null;
try {
tmpFile = tempFileFromStream(is);
return restoreComputationGraphAndNormalizer(tmpFile, loadUpdater);
} finally {
if (tmpFile != null) {
tmpFile.delete();
}
}
} | java | public static Pair<ComputationGraph, Normalizer> restoreComputationGraphAndNormalizer(
@NonNull InputStream is, boolean loadUpdater) throws IOException {
checkInputStream(is);
File tmpFile = null;
try {
tmpFile = tempFileFromStream(is);
return restoreComputationGraphAndNormalizer(tmpFile, loadUpdater);
} finally {
if (tmpFile != null) {
tmpFile.delete();
}
}
} | [
"public",
"static",
"Pair",
"<",
"ComputationGraph",
",",
"Normalizer",
">",
"restoreComputationGraphAndNormalizer",
"(",
"@",
"NonNull",
"InputStream",
"is",
",",
"boolean",
"loadUpdater",
")",
"throws",
"IOException",
"{",
"checkInputStream",
"(",
"is",
")",
";",
... | Restore a ComputationGraph and Normalizer (if present - null if not) from the InputStream.
Note: the input stream is read fully and closed by this method. Consequently, the input stream cannot be re-used.
@param is Input stream to read from
@param loadUpdater Whether to load the updater from the model or not
@return Model and normalizer, if present
@throws IOException If an error occurs when reading from the stream | [
"Restore",
"a",
"ComputationGraph",
"and",
"Normalizer",
"(",
"if",
"present",
"-",
"null",
"if",
"not",
")",
"from",
"the",
"InputStream",
".",
"Note",
":",
"the",
"input",
"stream",
"is",
"read",
"fully",
"and",
"closed",
"by",
"this",
"method",
".",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L510-L523 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updateCustomField | public CustomFields updateCustomField(String accountId, String customFieldId, CustomField customField) throws ApiException {
return updateCustomField(accountId, customFieldId, customField, null);
} | java | public CustomFields updateCustomField(String accountId, String customFieldId, CustomField customField) throws ApiException {
return updateCustomField(accountId, customFieldId, customField, null);
} | [
"public",
"CustomFields",
"updateCustomField",
"(",
"String",
"accountId",
",",
"String",
"customFieldId",
",",
"CustomField",
"customField",
")",
"throws",
"ApiException",
"{",
"return",
"updateCustomField",
"(",
"accountId",
",",
"customFieldId",
",",
"customField",
... | Updates an existing account custom field.
@param accountId The external account number (int) or account ID Guid. (required)
@param customFieldId (required)
@param customField (optional)
@return CustomFields | [
"Updates",
"an",
"existing",
"account",
"custom",
"field",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2736-L2738 |
auth0/auth0-java | src/main/java/com/auth0/client/auth/AuthorizeUrlBuilder.java | AuthorizeUrlBuilder.newInstance | static AuthorizeUrlBuilder newInstance(HttpUrl baseUrl, String clientId, String redirectUri) {
return new AuthorizeUrlBuilder(baseUrl, clientId, redirectUri);
} | java | static AuthorizeUrlBuilder newInstance(HttpUrl baseUrl, String clientId, String redirectUri) {
return new AuthorizeUrlBuilder(baseUrl, clientId, redirectUri);
} | [
"static",
"AuthorizeUrlBuilder",
"newInstance",
"(",
"HttpUrl",
"baseUrl",
",",
"String",
"clientId",
",",
"String",
"redirectUri",
")",
"{",
"return",
"new",
"AuthorizeUrlBuilder",
"(",
"baseUrl",
",",
"clientId",
",",
"redirectUri",
")",
";",
"}"
] | Creates an instance of the {@link AuthorizeUrlBuilder} using the given domain and base parameters.
@param baseUrl the base url constructed from a valid domain.
@param clientId the application's client_id value to set
@param redirectUri the redirect_uri value to set. Must be already URL Encoded and must be white-listed in your Auth0's dashboard.
@return a new instance of the {@link AuthorizeUrlBuilder} to configure. | [
"Creates",
"an",
"instance",
"of",
"the",
"{",
"@link",
"AuthorizeUrlBuilder",
"}",
"using",
"the",
"given",
"domain",
"and",
"base",
"parameters",
"."
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthorizeUrlBuilder.java#L27-L29 |
amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.foldRight | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | java | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | [
"public",
"<",
"U",
">",
"U",
"foldRight",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"U",
",",
"U",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
"(",
"list",
"->",
"{",
"U",
"result",
"=",
"seed",
";",
"for",
"... | Folds the elements of this stream using the provided seed object and
accumulation function, going right to left.
<p>
This is a terminal operation.
<p>
As this method must process elements strictly right to left, it cannot
start processing till all the previous stream stages complete. Also it
requires intermediate memory to store the whole content of the stream as
the stream natural order is left to right. If your accumulator function
is associative and you can provide a combiner function, consider using
{@link #reduce(Object, BiFunction, BinaryOperator)} method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param <U> The type of the result
@param seed the starting value
@param accumulator a <a
href="package-summary.html#NonInterference">non-interfering </a>,
<a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #foldLeft(Object, BiFunction)
@see #reduce(Object, BinaryOperator)
@see #reduce(Object, BiFunction, BinaryOperator)
@since 0.2.2 | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1437-L1444 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.buildRows | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", BindException.Type.SERIALIZATION);
}
int numRows = columns.get(0).data.size();
// every column should have the same number of binds
for (int i = 0; i < numColumns; i++)
{
int iNumRows = columns.get(i).data.size();
if (columns.get(i).data.size() != numRows)
{
throw new BindException(
String.format("Column %d has a different number of binds (%d) than column 1 (%d)", i, iNumRows, numRows), BindException.Type.SERIALIZATION);
}
}
for (int rowIdx = 0; rowIdx < numRows; rowIdx++)
{
String[] row = new String[numColumns];
for (int colIdx = 0; colIdx < numColumns; colIdx++)
{
row[colIdx] = columns.get(colIdx).data.get(rowIdx);
}
rows.add(row);
}
return rows;
} | java | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", BindException.Type.SERIALIZATION);
}
int numRows = columns.get(0).data.size();
// every column should have the same number of binds
for (int i = 0; i < numColumns; i++)
{
int iNumRows = columns.get(i).data.size();
if (columns.get(i).data.size() != numRows)
{
throw new BindException(
String.format("Column %d has a different number of binds (%d) than column 1 (%d)", i, iNumRows, numRows), BindException.Type.SERIALIZATION);
}
}
for (int rowIdx = 0; rowIdx < numRows; rowIdx++)
{
String[] row = new String[numColumns];
for (int colIdx = 0; colIdx < numColumns; colIdx++)
{
row[colIdx] = columns.get(colIdx).data.get(rowIdx);
}
rows.add(row);
}
return rows;
} | [
"private",
"List",
"<",
"String",
"[",
"]",
">",
"buildRows",
"(",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
")",
"throws",
"BindException",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int"... | Transpose a list of columns and their values to a list of rows
@param columns the list of columns to transpose
@return list of rows
@throws BindException if columns improperly formed | [
"Transpose",
"a",
"list",
"of",
"columns",
"and",
"their",
"values",
"to",
"a",
"list",
"of",
"rows"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L280-L314 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.replaceFromVariableStatement | public String replaceFromVariableStatement(JQLContext context, String jql, final JQLReplacerListener listener) {
JQLRewriterListener rewriterListener = new JQLRewriterListener();
rewriterListener.init(listener);
return replaceFromVariableStatementInternal(context, jql, replace, rewriterListener);
} | java | public String replaceFromVariableStatement(JQLContext context, String jql, final JQLReplacerListener listener) {
JQLRewriterListener rewriterListener = new JQLRewriterListener();
rewriterListener.init(listener);
return replaceFromVariableStatementInternal(context, jql, replace, rewriterListener);
} | [
"public",
"String",
"replaceFromVariableStatement",
"(",
"JQLContext",
"context",
",",
"String",
"jql",
",",
"final",
"JQLReplacerListener",
"listener",
")",
"{",
"JQLRewriterListener",
"rewriterListener",
"=",
"new",
"JQLRewriterListener",
"(",
")",
";",
"rewriterListe... | Replace place holder with element passed by listener.
@param context
the context
@param jql
the jql
@param listener
the listener
@return string obtained by replacements | [
"Replace",
"place",
"holder",
"with",
"element",
"passed",
"by",
"listener",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L393-L398 |
skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.removeIdentical | private void removeIdentical(List<Box> containerProducts, Box currentBox) {
for(int i = 0; i < containerProducts.size(); i++) {
if(containerProducts.get(i) == currentBox) {
containerProducts.remove(i);
return;
}
}
throw new IllegalArgumentException();
} | java | private void removeIdentical(List<Box> containerProducts, Box currentBox) {
for(int i = 0; i < containerProducts.size(); i++) {
if(containerProducts.get(i) == currentBox) {
containerProducts.remove(i);
return;
}
}
throw new IllegalArgumentException();
} | [
"private",
"void",
"removeIdentical",
"(",
"List",
"<",
"Box",
">",
"containerProducts",
",",
"Box",
"currentBox",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"containerProducts",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
... | Remove from list, more explicit implementation than {@linkplain List#remove} with no equals.
@param containerProducts list of products
@param currentBox item to remove | [
"Remove",
"from",
"list",
"more",
"explicit",
"implementation",
"than",
"{"
] | train | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L163-L172 |
Stratio/deep-spark | deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java | UtilJdbc.getCellsFromObject | public static<T extends DeepJobConfig> Cells getCellsFromObject(Map<String, Object> row, DeepJobConfig<Cells, T> config) {
Cells result = new Cells(config.getCatalog() + "." + config.getTable());
for(Map.Entry<String, Object> entry:row.entrySet()) {
Cell cell = Cell.create(entry.getKey(), entry.getValue());
result.add(cell);
}
return result;
} | java | public static<T extends DeepJobConfig> Cells getCellsFromObject(Map<String, Object> row, DeepJobConfig<Cells, T> config) {
Cells result = new Cells(config.getCatalog() + "." + config.getTable());
for(Map.Entry<String, Object> entry:row.entrySet()) {
Cell cell = Cell.create(entry.getKey(), entry.getValue());
result.add(cell);
}
return result;
} | [
"public",
"static",
"<",
"T",
"extends",
"DeepJobConfig",
">",
"Cells",
"getCellsFromObject",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
",",
"DeepJobConfig",
"<",
"Cells",
",",
"T",
">",
"config",
")",
"{",
"Cells",
"result",
"=",
"new",
"Cel... | Returns a Cells object from a JDBC row data structure.
@param row JDBC row data structure as a Map.
@param config JDBC Deep Job config.
@return Cells object from a JDBC row data structure. | [
"Returns",
"a",
"Cells",
"object",
"from",
"a",
"JDBC",
"row",
"data",
"structure",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java#L109-L116 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java | AsiExtraField.parseFromLocalFileData | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChecksum = crc.getValue();
if (givenChecksum != realChecksum) {
throw new ZipException("bad CRC checksum "
+ Long.toHexString(givenChecksum)
+ " instead of "
+ Long.toHexString(realChecksum));
}
int newMode = ZipShort.getValue(tmp, 0);
// CheckStyle:MagicNumber OFF
byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
uid = ZipShort.getValue(tmp, 6);
gid = ZipShort.getValue(tmp, 8);
if (linkArray.length == 0) {
link = "";
}
else {
System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
link = new String(linkArray); // Uses default charset - see class Javadoc
}
// CheckStyle:MagicNumber ON
setDirectory((newMode & DIR_FLAG) != 0);
setMode(newMode);
} | java | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChecksum = crc.getValue();
if (givenChecksum != realChecksum) {
throw new ZipException("bad CRC checksum "
+ Long.toHexString(givenChecksum)
+ " instead of "
+ Long.toHexString(realChecksum));
}
int newMode = ZipShort.getValue(tmp, 0);
// CheckStyle:MagicNumber OFF
byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
uid = ZipShort.getValue(tmp, 6);
gid = ZipShort.getValue(tmp, 8);
if (linkArray.length == 0) {
link = "";
}
else {
System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
link = new String(linkArray); // Uses default charset - see class Javadoc
}
// CheckStyle:MagicNumber ON
setDirectory((newMode & DIR_FLAG) != 0);
setMode(newMode);
} | [
"public",
"void",
"parseFromLocalFileData",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"ZipException",
"{",
"long",
"givenChecksum",
"=",
"ZipLong",
".",
"getValue",
"(",
"data",
",",
"offset",
")",
";",
"byte... | Populate data from this array as if it was in local file data.
@param data an array of bytes
@param offset the start offset
@param length the number of bytes in the array from offset
@since 1.1
@throws ZipException on error | [
"Populate",
"data",
"from",
"this",
"array",
"as",
"if",
"it",
"was",
"in",
"local",
"file",
"data",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java#L369-L401 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java | ConnectionsInner.createOrUpdateAsync | public Observable<ConnectionInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ConnectionInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"connectionName",
",",
"ConnectionCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpd... | Create or update a connection.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param connectionName The parameters supplied to the create or update connection operation.
@param parameters The parameters supplied to the create or update connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionInner object | [
"Create",
"or",
"update",
"a",
"connection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java#L317-L324 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/ReflectionHelper.java | ReflectionHelper.invokeMethod | public static Object invokeMethod(Class<?> type,Object instance,String methodName,Class<?>[] inputTypes,Object[] input)
{
Method method=null;
try
{
//get method
method=type.getDeclaredMethod(methodName,inputTypes);
}
catch(Exception exception)
{
throw new FaxException("Unable to extract method: "+methodName+" from type: "+type,exception);
}
//set accessible
method.setAccessible(true);
Object output=null;
try
{
//invoke method
output=method.invoke(instance,input);
}
catch(Exception exception)
{
throw new FaxException("Unable to invoke method: "+methodName+" of type: "+type,exception);
}
return output;
} | java | public static Object invokeMethod(Class<?> type,Object instance,String methodName,Class<?>[] inputTypes,Object[] input)
{
Method method=null;
try
{
//get method
method=type.getDeclaredMethod(methodName,inputTypes);
}
catch(Exception exception)
{
throw new FaxException("Unable to extract method: "+methodName+" from type: "+type,exception);
}
//set accessible
method.setAccessible(true);
Object output=null;
try
{
//invoke method
output=method.invoke(instance,input);
}
catch(Exception exception)
{
throw new FaxException("Unable to invoke method: "+methodName+" of type: "+type,exception);
}
return output;
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"instance",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"inputTypes",
",",
"Object",
"[",
"]",
"input",
")",
"{",
"Method",
"metho... | This function invokes the requested method.
@param type
The class type
@param instance
The instance
@param methodName
The method name to invoke
@param inputTypes
An array of input types
@param input
The method input
@return The method output | [
"This",
"function",
"invokes",
"the",
"requested",
"method",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/ReflectionHelper.java#L118-L146 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setIntent | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0);
for (int i = 0; i < resolveInfos.size(); i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
addItem(i, resolveInfo.loadLabel(packageManager), resolveInfo.loadIcon(packageManager));
}
setOnItemClickListener(
createIntentClickListener(activity, (Intent) intent.clone(), resolveInfos));
} | java | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0);
for (int i = 0; i < resolveInfos.size(); i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
addItem(i, resolveInfo.loadLabel(packageManager), resolveInfo.loadIcon(packageManager));
}
setOnItemClickListener(
createIntentClickListener(activity, (Intent) intent.clone(), resolveInfos));
} | [
"public",
"final",
"void",
"setIntent",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"final",
"Intent",
"intent",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"activity",
",",
"\"The activity may not be null\"",
... | Adds the apps, which are able to handle a specific intent, as items to the bottom sheet. This
causes all previously added items to be removed. When an item is clicked, the corresponding
app is started.
@param activity
The activity, the bottom sheet belongs to, as an instance of the class {@link
Activity}. The activity may not be null
@param intent
The intent as an instance of the class {@link Intent}. The intent may not be null | [
"Adds",
"the",
"apps",
"which",
"are",
"able",
"to",
"handle",
"a",
"specific",
"intent",
"as",
"items",
"to",
"the",
"bottom",
"sheet",
".",
"This",
"causes",
"all",
"previously",
"added",
"items",
"to",
"be",
"removed",
".",
"When",
"an",
"item",
"is",... | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2315-L2329 |
alkacon/opencms-core | src/org/opencms/ade/upload/CmsUploadBean.java | CmsUploadBean.getNewResourceName | public static String getNewResourceName(CmsObject cms, String fileName, String folder) {
String newResname = CmsResource.getName(fileName.replace('\\', '/'));
newResname = cms.getRequestContext().getFileTranslator().translateResource(newResname);
newResname = folder + newResname;
return newResname;
} | java | public static String getNewResourceName(CmsObject cms, String fileName, String folder) {
String newResname = CmsResource.getName(fileName.replace('\\', '/'));
newResname = cms.getRequestContext().getFileTranslator().translateResource(newResname);
newResname = folder + newResname;
return newResname;
} | [
"public",
"static",
"String",
"getNewResourceName",
"(",
"CmsObject",
"cms",
",",
"String",
"fileName",
",",
"String",
"folder",
")",
"{",
"String",
"newResname",
"=",
"CmsResource",
".",
"getName",
"(",
"fileName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
... | Returns the VFS path for the given filename and folder.<p>
@param cms the cms object
@param fileName the filename to combine with the folder
@param folder the folder to combine with the filename
@return the VFS path for the given filename and folder | [
"Returns",
"the",
"VFS",
"path",
"for",
"the",
"given",
"filename",
"and",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/upload/CmsUploadBean.java#L161-L167 |
b3dgs/lionengine | lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java | ScreenFullAwt.formatResolution | private static String formatResolution(Resolution resolution, int depth)
{
return new StringBuilder(MIN_LENGTH).append(String.valueOf(resolution.getWidth()))
.append(Constant.STAR)
.append(String.valueOf(resolution.getHeight()))
.append(Constant.STAR)
.append(depth)
.append(Constant.SPACE)
.append(Constant.AT)
.append(String.valueOf(resolution.getRate()))
.append(Constant.UNIT_RATE)
.toString();
} | java | private static String formatResolution(Resolution resolution, int depth)
{
return new StringBuilder(MIN_LENGTH).append(String.valueOf(resolution.getWidth()))
.append(Constant.STAR)
.append(String.valueOf(resolution.getHeight()))
.append(Constant.STAR)
.append(depth)
.append(Constant.SPACE)
.append(Constant.AT)
.append(String.valueOf(resolution.getRate()))
.append(Constant.UNIT_RATE)
.toString();
} | [
"private",
"static",
"String",
"formatResolution",
"(",
"Resolution",
"resolution",
",",
"int",
"depth",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
"MIN_LENGTH",
")",
".",
"append",
"(",
"String",
".",
"valueOf",
"(",
"resolution",
".",
"getWidth",
"(",
... | Format resolution to string.
@param resolution The resolution reference.
@param depth The depth reference.
@return The formatted string. | [
"Format",
"resolution",
"to",
"string",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java#L54-L66 |
baratine/baratine | web/src/main/java/com/caucho/v5/health/warning/WarningSystem.java | WarningSystem.sendWarning | public void sendWarning(Object source, String msg)
{
try {
String s = getClass().getSimpleName() + ": " + msg;
// if warning is high-priority then send to high priority handlers first
System.err.println(s);
for (WarningHandler handler : _priorityHandlers) {
handler.warning(source, msg);
}
// now send to the all handlers regardless of if its high priority
for (WarningHandler handler : _handlers) {
handler.warning(source, msg);
}
log.warning(msg);
} catch (Throwable e) {
// WarningService must not throw exception
log.log(Level.WARNING, e.toString(), e);
}
} | java | public void sendWarning(Object source, String msg)
{
try {
String s = getClass().getSimpleName() + ": " + msg;
// if warning is high-priority then send to high priority handlers first
System.err.println(s);
for (WarningHandler handler : _priorityHandlers) {
handler.warning(source, msg);
}
// now send to the all handlers regardless of if its high priority
for (WarningHandler handler : _handlers) {
handler.warning(source, msg);
}
log.warning(msg);
} catch (Throwable e) {
// WarningService must not throw exception
log.log(Level.WARNING, e.toString(), e);
}
} | [
"public",
"void",
"sendWarning",
"(",
"Object",
"source",
",",
"String",
"msg",
")",
"{",
"try",
"{",
"String",
"s",
"=",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"msg",
";",
"// if warning is high-priority then send to high pr... | Send a warning message to any registered handlers. A high priority warning
only goes to all handlers, high priority first. High priority handlers do
not receive non-high priority warnings.
@param source source of the message, usually you
@param msg test to print or send as an alert
@param isHighPriority set true to send to high priority warning handlers | [
"Send",
"a",
"warning",
"message",
"to",
"any",
"registered",
"handlers",
".",
"A",
"high",
"priority",
"warning",
"only",
"goes",
"to",
"all",
"handlers",
"high",
"priority",
"first",
".",
"High",
"priority",
"handlers",
"do",
"not",
"receive",
"non",
"-",
... | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/health/warning/WarningSystem.java#L84-L106 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/parser/ParseUtils.java | ParseUtils.parsePage | private static Object parsePage(AstVisitor v, String text, String title, long revision) throws LinkTargetException, EngineException, FileNotFoundException, JAXBException{
// Use the provided visitor to parse the page
return v.go(getCompiledPage(text, title, revision).getPage());
} | java | private static Object parsePage(AstVisitor v, String text, String title, long revision) throws LinkTargetException, EngineException, FileNotFoundException, JAXBException{
// Use the provided visitor to parse the page
return v.go(getCompiledPage(text, title, revision).getPage());
} | [
"private",
"static",
"Object",
"parsePage",
"(",
"AstVisitor",
"v",
",",
"String",
"text",
",",
"String",
"title",
",",
"long",
"revision",
")",
"throws",
"LinkTargetException",
",",
"EngineException",
",",
"FileNotFoundException",
",",
"JAXBException",
"{",
"// U... | Parses the page with the Sweble parser using a SimpleWikiConfiguration
and the provided visitor.
@return the parsed page. The actual return type depends on the provided
visitor. You have to cast the return type according to the return
type of the go() method of your visitor.
@throws EngineException if the wiki page could not be compiled by the parser | [
"Parses",
"the",
"page",
"with",
"the",
"Sweble",
"parser",
"using",
"a",
"SimpleWikiConfiguration",
"and",
"the",
"provided",
"visitor",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/parser/ParseUtils.java#L92-L95 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupBean.java | CmsSetupBean.saveProperties | public void saveProperties(CmsParameterConfiguration properties, String file, boolean backup) {
if (new File(m_configRfsPath + file).isFile()) {
String backupFile = file + CmsConfigurationManager.POSTFIX_ORI;
String tempFile = file + ".tmp";
m_errors.clear();
if (backup) {
// make a backup copy
copyFile(file, FOLDER_BACKUP + backupFile);
}
//save to temporary file
copyFile(file, tempFile);
// save properties
save(properties, tempFile, file, null);
// delete temp file
File temp = new File(m_configRfsPath + tempFile);
temp.delete();
} else {
m_errors.add("No valid file: " + file + "\n");
}
} | java | public void saveProperties(CmsParameterConfiguration properties, String file, boolean backup) {
if (new File(m_configRfsPath + file).isFile()) {
String backupFile = file + CmsConfigurationManager.POSTFIX_ORI;
String tempFile = file + ".tmp";
m_errors.clear();
if (backup) {
// make a backup copy
copyFile(file, FOLDER_BACKUP + backupFile);
}
//save to temporary file
copyFile(file, tempFile);
// save properties
save(properties, tempFile, file, null);
// delete temp file
File temp = new File(m_configRfsPath + tempFile);
temp.delete();
} else {
m_errors.add("No valid file: " + file + "\n");
}
} | [
"public",
"void",
"saveProperties",
"(",
"CmsParameterConfiguration",
"properties",
",",
"String",
"file",
",",
"boolean",
"backup",
")",
"{",
"if",
"(",
"new",
"File",
"(",
"m_configRfsPath",
"+",
"file",
")",
".",
"isFile",
"(",
")",
")",
"{",
"String",
... | Saves properties to specified file.<p>
@param properties the properties to be saved
@param file the file to save the properties to
@param backup if true, create a backupfile | [
"Saves",
"properties",
"to",
"specified",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1732-L1758 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java | StatementDMQL.isGroupByColumn | static boolean isGroupByColumn(QuerySpecification select, int index) {
if (!select.isGrouped) {
return false;
}
for (int ii = 0; ii < select.groupIndex.getColumnCount(); ii++) {
if (index == select.groupIndex.getColumns()[ii]) {
return true;
}
}
return false;
} | java | static boolean isGroupByColumn(QuerySpecification select, int index) {
if (!select.isGrouped) {
return false;
}
for (int ii = 0; ii < select.groupIndex.getColumnCount(); ii++) {
if (index == select.groupIndex.getColumns()[ii]) {
return true;
}
}
return false;
} | [
"static",
"boolean",
"isGroupByColumn",
"(",
"QuerySpecification",
"select",
",",
"int",
"index",
")",
"{",
"if",
"(",
"!",
"select",
".",
"isGrouped",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"select",
... | Returns true if the specified exprColumn index is in the list of column indices specified by groupIndex
@return true/false | [
"Returns",
"true",
"if",
"the",
"specified",
"exprColumn",
"index",
"is",
"in",
"the",
"list",
"of",
"column",
"indices",
"specified",
"by",
"groupIndex"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java#L854-L864 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getTeams | public Future<Map<String, RankedTeam>> getTeams(String... teamIds) {
return new ApiFuture<>(() -> handler.getTeams(teamIds));
} | java | public Future<Map<String, RankedTeam>> getTeams(String... teamIds) {
return new ApiFuture<>(() -> handler.getTeams(teamIds));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"RankedTeam",
">",
">",
"getTeams",
"(",
"String",
"...",
"teamIds",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getTeams",
"(",
"teamIds",
")",
")",
";",
"}"... | Retrieve information for the specified ranked teams
@param teamIds The ids of the teams
@return A map, mapping team ids to team information
@see <a href=https://developer.riotgames.com/api/methods#!/594/1866>Official API documentation</a> | [
"Retrieve",
"information",
"for",
"the",
"specified",
"ranked",
"teams"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1225-L1227 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/revisions/RevisionUtils.java | RevisionUtils.getDiscussionRevisionForArticleRevision | public Revision getDiscussionRevisionForArticleRevision(int revisionId) throws WikiApiException, WikiPageNotFoundException{
//get article revision
Revision rev = revApi.getRevision(revisionId);
Timestamp revTime = rev.getTimeStamp();
//get corresponding discussion page
Page discussion = wiki.getDiscussionPage(rev.getArticleID());
/*
* find correct revision of discussion page
*/
List<Timestamp> discussionTs = revApi.getRevisionTimestamps(discussion.getPageId());
// sort in reverse order - newest first
Collections.sort(discussionTs, new Comparator<Timestamp>()
{
public int compare(Timestamp ts1, Timestamp ts2)
{
return ts2.compareTo(ts1);
}
});
//find first timestamp equal to or before the article revision timestamp
for(Timestamp curDiscTime:discussionTs){
if(curDiscTime==revTime||curDiscTime.before(revTime)){
return revApi.getRevision(discussion.getPageId(), curDiscTime);
}
}
throw new WikiPageNotFoundException("Not discussion page was available at the time of the given article revision");
} | java | public Revision getDiscussionRevisionForArticleRevision(int revisionId) throws WikiApiException, WikiPageNotFoundException{
//get article revision
Revision rev = revApi.getRevision(revisionId);
Timestamp revTime = rev.getTimeStamp();
//get corresponding discussion page
Page discussion = wiki.getDiscussionPage(rev.getArticleID());
/*
* find correct revision of discussion page
*/
List<Timestamp> discussionTs = revApi.getRevisionTimestamps(discussion.getPageId());
// sort in reverse order - newest first
Collections.sort(discussionTs, new Comparator<Timestamp>()
{
public int compare(Timestamp ts1, Timestamp ts2)
{
return ts2.compareTo(ts1);
}
});
//find first timestamp equal to or before the article revision timestamp
for(Timestamp curDiscTime:discussionTs){
if(curDiscTime==revTime||curDiscTime.before(revTime)){
return revApi.getRevision(discussion.getPageId(), curDiscTime);
}
}
throw new WikiPageNotFoundException("Not discussion page was available at the time of the given article revision");
} | [
"public",
"Revision",
"getDiscussionRevisionForArticleRevision",
"(",
"int",
"revisionId",
")",
"throws",
"WikiApiException",
",",
"WikiPageNotFoundException",
"{",
"//get article revision\r",
"Revision",
"rev",
"=",
"revApi",
".",
"getRevision",
"(",
"revisionId",
")",
"... | For a given article revision, the method returns the revision of the article discussion
page which was current at the time the revision was created.
@param revisionId revision of the article for which the talk page revision should be retrieved
@return the revision of the talk page that was current at the creation time of the given article revision
@throws WikiApiException if any error occurred accessing the Wiki db
@throws WikiPageNotFoundException if no discussion page was available at the time of the given article revision | [
"For",
"a",
"given",
"article",
"revision",
"the",
"method",
"returns",
"the",
"revision",
"of",
"the",
"article",
"discussion",
"page",
"which",
"was",
"current",
"at",
"the",
"time",
"the",
"revision",
"was",
"created",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/revisions/RevisionUtils.java#L64-L94 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java | ExpressionUtil.visitLine | public static void visitLine(BytecodeContext bc, Position pos) {
if (pos != null) {
visitLine(bc, pos.line);
}
} | java | public static void visitLine(BytecodeContext bc, Position pos) {
if (pos != null) {
visitLine(bc, pos.line);
}
} | [
"public",
"static",
"void",
"visitLine",
"(",
"BytecodeContext",
"bc",
",",
"Position",
"pos",
")",
"{",
"if",
"(",
"pos",
"!=",
"null",
")",
"{",
"visitLine",
"(",
"bc",
",",
"pos",
".",
"line",
")",
";",
"}",
"}"
] | visit line number
@param adapter
@param line
@param silent id silent this is ignored for log | [
"visit",
"line",
"number"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java#L72-L76 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.toJsonString | public static String toJsonString(Object object, FieldModifier modifier, JsonMethod method) throws IllegalAccessException {
JSONObject jsonObject = new JSONObject();
StringBuilder builder = new StringBuilder("{");
boolean isManual = false;
if (Checker.isNotNull(object)) {
Class<?> bean = object.getClass();
Field[] fields = bean.getDeclaredFields();
for (Field field : fields) {
int mod = field.getModifiers();
boolean addable =
modifier == FieldModifier.ALL || (modifier == FieldModifier.PRIVATE && Modifier.isPrivate(mod)) || (modifier == FieldModifier.PUBLIC && Modifier.isPublic(mod));
if (addable) {
field.setAccessible(true);
isManual = Checker.isIn(method, METHODS);
if (isManual) {
Object f = field.get(object);
if (Checker.isNotNull(f)) {
builder.append(converter(field.getName(), f));
}
} else {
jsonObject.put(field.getName(), field.get(object));
}
}
}
}
return isManual ? builder.substring(0, builder.length() - 1) + "}" : jsonObject.toString();
} | java | public static String toJsonString(Object object, FieldModifier modifier, JsonMethod method) throws IllegalAccessException {
JSONObject jsonObject = new JSONObject();
StringBuilder builder = new StringBuilder("{");
boolean isManual = false;
if (Checker.isNotNull(object)) {
Class<?> bean = object.getClass();
Field[] fields = bean.getDeclaredFields();
for (Field field : fields) {
int mod = field.getModifiers();
boolean addable =
modifier == FieldModifier.ALL || (modifier == FieldModifier.PRIVATE && Modifier.isPrivate(mod)) || (modifier == FieldModifier.PUBLIC && Modifier.isPublic(mod));
if (addable) {
field.setAccessible(true);
isManual = Checker.isIn(method, METHODS);
if (isManual) {
Object f = field.get(object);
if (Checker.isNotNull(f)) {
builder.append(converter(field.getName(), f));
}
} else {
jsonObject.put(field.getName(), field.get(object));
}
}
}
}
return isManual ? builder.substring(0, builder.length() - 1) + "}" : jsonObject.toString();
} | [
"public",
"static",
"String",
"toJsonString",
"(",
"Object",
"object",
",",
"FieldModifier",
"modifier",
",",
"JsonMethod",
"method",
")",
"throws",
"IllegalAccessException",
"{",
"JSONObject",
"jsonObject",
"=",
"new",
"JSONObject",
"(",
")",
";",
"StringBuilder",
... | 将Bean类指定修饰符的属性转换成JSON字符串
@param object Bean对象
@param modifier 属性的权限修饰符
@param method {@link JsonMethod}
@return 没有格式化的JSON字符串
@throws IllegalAccessException 异常 | [
"将Bean类指定修饰符的属性转换成JSON字符串"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L301-L327 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.JensenShannonDivergence | public static double JensenShannonDivergence(double[] p, double[] q) {
double[] m = new double[p.length];
for (int i = 0; i < m.length; i++) {
m[i] = (p[i] + q[i]) / 2;
}
return (KullbackLeiblerDivergence(p, m) + KullbackLeiblerDivergence(q, m)) / 2;
} | java | public static double JensenShannonDivergence(double[] p, double[] q) {
double[] m = new double[p.length];
for (int i = 0; i < m.length; i++) {
m[i] = (p[i] + q[i]) / 2;
}
return (KullbackLeiblerDivergence(p, m) + KullbackLeiblerDivergence(q, m)) / 2;
} | [
"public",
"static",
"double",
"JensenShannonDivergence",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"double",
"[",
"]",
"m",
"=",
"new",
"double",
"[",
"p",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Gets the Jensen Shannon divergence.
@param p U vector.
@param q V vector.
@return The Jensen Shannon divergence between u and v. | [
"Gets",
"the",
"Jensen",
"Shannon",
"divergence",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L509-L516 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.