repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.prepareGetActual | protected void prepareGetActual(int field, boolean isMinimum) {
set(MILLISECONDS_IN_DAY, 0);
switch (field) {
case YEAR:
case EXTENDED_YEAR:
set(DAY_OF_YEAR, getGreatestMinimum(DAY_OF_YEAR));
break;
case YEAR_WOY:
set(WEEK_OF_YEAR, getGreatestMinimum(WEEK_OF_YEAR));
break;
case MONTH:
set(DAY_OF_MONTH, getGreatestMinimum(DAY_OF_MONTH));
break;
case DAY_OF_WEEK_IN_MONTH:
// For dowim, the maximum occurs for the DOW of the first of the
// month.
set(DAY_OF_MONTH, 1);
set(DAY_OF_WEEK, get(DAY_OF_WEEK)); // Make this user set
break;
case WEEK_OF_MONTH:
case WEEK_OF_YEAR:
// If we're counting weeks, set the day of the week to either the
// first or last localized DOW. We know the last week of a month
// or year will contain the first day of the week, and that the
// first week will contain the last DOW.
{
int dow = firstDayOfWeek;
if (isMinimum) {
dow = (dow + 6) % 7; // set to last DOW
if (dow < SUNDAY) {
dow += 7;
}
}
set(DAY_OF_WEEK, dow);
}
break;
}
// Do this last to give it the newest time stamp
set(field, getGreatestMinimum(field));
} | java | protected void prepareGetActual(int field, boolean isMinimum) {
set(MILLISECONDS_IN_DAY, 0);
switch (field) {
case YEAR:
case EXTENDED_YEAR:
set(DAY_OF_YEAR, getGreatestMinimum(DAY_OF_YEAR));
break;
case YEAR_WOY:
set(WEEK_OF_YEAR, getGreatestMinimum(WEEK_OF_YEAR));
break;
case MONTH:
set(DAY_OF_MONTH, getGreatestMinimum(DAY_OF_MONTH));
break;
case DAY_OF_WEEK_IN_MONTH:
// For dowim, the maximum occurs for the DOW of the first of the
// month.
set(DAY_OF_MONTH, 1);
set(DAY_OF_WEEK, get(DAY_OF_WEEK)); // Make this user set
break;
case WEEK_OF_MONTH:
case WEEK_OF_YEAR:
// If we're counting weeks, set the day of the week to either the
// first or last localized DOW. We know the last week of a month
// or year will contain the first day of the week, and that the
// first week will contain the last DOW.
{
int dow = firstDayOfWeek;
if (isMinimum) {
dow = (dow + 6) % 7; // set to last DOW
if (dow < SUNDAY) {
dow += 7;
}
}
set(DAY_OF_WEEK, dow);
}
break;
}
// Do this last to give it the newest time stamp
set(field, getGreatestMinimum(field));
} | [
"protected",
"void",
"prepareGetActual",
"(",
"int",
"field",
",",
"boolean",
"isMinimum",
")",
"{",
"set",
"(",
"MILLISECONDS_IN_DAY",
",",
"0",
")",
";",
"switch",
"(",
"field",
")",
"{",
"case",
"YEAR",
":",
"case",
"EXTENDED_YEAR",
":",
"set",
"(",
"... | Prepare this calendar for computing the actual minimum or maximum.
This method modifies this calendar's fields; it is called on a
temporary calendar.
<p>Rationale: The semantics of getActualXxx() is to return the
maximum or minimum value that the given field can take, taking into
account other relevant fields. In general these other fields are
larger fields. For example, when computing the actual maximum
DAY_OF_MONTH, the current value of DAY_OF_MONTH itself is ignored,
as is the value of any field smaller.
<p>The time fields all have fixed minima and maxima, so we don't
need to worry about them. This also lets us set the
MILLISECONDS_IN_DAY to zero to erase any effects the time fields
might have when computing date fields.
<p>DAY_OF_WEEK is adjusted specially for the WEEK_OF_MONTH and
WEEK_OF_YEAR fields to ensure that they are computed correctly. | [
"Prepare",
"this",
"calendar",
"for",
"computing",
"the",
"actual",
"minimum",
"or",
"maximum",
".",
"This",
"method",
"modifies",
"this",
"calendar",
"s",
"fields",
";",
"it",
"is",
"called",
"on",
"a",
"temporary",
"calendar",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L2510-L2555 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/DependentLoadingTaskSpawner.java | DependentLoadingTaskSpawner.createDependentKeyIndex | public DependentKeyIndex createDependentKeyIndex(CacheLoaderEngine cacheLoaderEngine, Extractor[] keyExtractors, Operation ownerObjectFilter)
{
DependentKeyIndex dependentKeyIndex = null;
for (DependentKeyIndex each : this.dependentKeyIndexes)
{
if (Arrays.equals(each.getKeyExtractors(), keyExtractors))
{
dependentKeyIndex = each;
break;
}
}
if (dependentKeyIndex == null)
{
dependentKeyIndex = (keyExtractors.length > 1)
? new DependentTupleKeyIndex(cacheLoaderEngine, this, keyExtractors)
: new DependentSingleKeyIndex(cacheLoaderEngine, this, keyExtractors);
dependentKeyIndex.setOwnerObjectFilter(ownerObjectFilter);
final LoadingTaskThreadPoolHolder threadPoolHolder = cacheLoaderEngine.getOrCreateThreadPool(this.getThreadPoolName());
dependentKeyIndex.setLoadingTaskThreadPoolHolder(threadPoolHolder);
threadPoolHolder.addDependentKeyIndex(dependentKeyIndex);
this.dependentKeyIndexes.add(dependentKeyIndex);
}
else
{
dependentKeyIndex.orOwnerObjectFilter(ownerObjectFilter);
}
return dependentKeyIndex;
} | java | public DependentKeyIndex createDependentKeyIndex(CacheLoaderEngine cacheLoaderEngine, Extractor[] keyExtractors, Operation ownerObjectFilter)
{
DependentKeyIndex dependentKeyIndex = null;
for (DependentKeyIndex each : this.dependentKeyIndexes)
{
if (Arrays.equals(each.getKeyExtractors(), keyExtractors))
{
dependentKeyIndex = each;
break;
}
}
if (dependentKeyIndex == null)
{
dependentKeyIndex = (keyExtractors.length > 1)
? new DependentTupleKeyIndex(cacheLoaderEngine, this, keyExtractors)
: new DependentSingleKeyIndex(cacheLoaderEngine, this, keyExtractors);
dependentKeyIndex.setOwnerObjectFilter(ownerObjectFilter);
final LoadingTaskThreadPoolHolder threadPoolHolder = cacheLoaderEngine.getOrCreateThreadPool(this.getThreadPoolName());
dependentKeyIndex.setLoadingTaskThreadPoolHolder(threadPoolHolder);
threadPoolHolder.addDependentKeyIndex(dependentKeyIndex);
this.dependentKeyIndexes.add(dependentKeyIndex);
}
else
{
dependentKeyIndex.orOwnerObjectFilter(ownerObjectFilter);
}
return dependentKeyIndex;
} | [
"public",
"DependentKeyIndex",
"createDependentKeyIndex",
"(",
"CacheLoaderEngine",
"cacheLoaderEngine",
",",
"Extractor",
"[",
"]",
"keyExtractors",
",",
"Operation",
"ownerObjectFilter",
")",
"{",
"DependentKeyIndex",
"dependentKeyIndex",
"=",
"null",
";",
"for",
"(",
... | executed from a single thread during the cacheloader startup. | [
"executed",
"from",
"a",
"single",
"thread",
"during",
"the",
"cacheloader",
"startup",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/DependentLoadingTaskSpawner.java#L163-L194 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java | NaaccrStreamConfiguration.registerNamespace | public void registerNamespace(String namespacePrefix, String namespaceUri) {
if (_namespaces.containsKey(namespacePrefix))
throw new RuntimeException("Namespace prefix '" + namespacePrefix + "' has already been registered");
_namespaces.put(namespacePrefix, namespaceUri);
} | java | public void registerNamespace(String namespacePrefix, String namespaceUri) {
if (_namespaces.containsKey(namespacePrefix))
throw new RuntimeException("Namespace prefix '" + namespacePrefix + "' has already been registered");
_namespaces.put(namespacePrefix, namespaceUri);
} | [
"public",
"void",
"registerNamespace",
"(",
"String",
"namespacePrefix",
",",
"String",
"namespaceUri",
")",
"{",
"if",
"(",
"_namespaces",
".",
"containsKey",
"(",
"namespacePrefix",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Namespace prefix '\"",
"+",
... | Registers a namespace for a given namespace prefix. This method must be called before registering any tags or attributes
for that namespace. Note that extensions require namespaces to work properly.
@param namespacePrefix the namespace prefix, cannot be null
@param namespaceUri the namespace URI, cannot be null | [
"Registers",
"a",
"namespace",
"for",
"a",
"given",
"namespace",
"prefix",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"registering",
"any",
"tags",
"or",
"attributes",
"for",
"that",
"namespace",
".",
"Note",
"that",
"extensions",
"require",
"nam... | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java#L236-L240 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java | AbstractAddStepHandler.createResource | protected Resource createResource(final OperationContext context, final ModelNode operation) {
ImmutableManagementResourceRegistration registration = context.getResourceRegistration();
if (registration != null) {
Set<String> orderedChildTypes = registration.getOrderedChildTypes();
boolean orderedChildResource = registration.isOrderedChildResource();
if (orderedChildResource || orderedChildTypes.size() > 0) {
return new OrderedResourceCreator(orderedChildResource, orderedChildTypes).createResource(context, operation);
}
}
return createResource(context);
} | java | protected Resource createResource(final OperationContext context, final ModelNode operation) {
ImmutableManagementResourceRegistration registration = context.getResourceRegistration();
if (registration != null) {
Set<String> orderedChildTypes = registration.getOrderedChildTypes();
boolean orderedChildResource = registration.isOrderedChildResource();
if (orderedChildResource || orderedChildTypes.size() > 0) {
return new OrderedResourceCreator(orderedChildResource, orderedChildTypes).createResource(context, operation);
}
}
return createResource(context);
} | [
"protected",
"Resource",
"createResource",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"ModelNode",
"operation",
")",
"{",
"ImmutableManagementResourceRegistration",
"registration",
"=",
"context",
".",
"getResourceRegistration",
"(",
")",
";",
"if",
"(",... | Create the {@link Resource} that the {@link AbstractAddStepHandler#execute(OperationContext, ModelNode)}
method operates on. This method is invoked during {@link org.jboss.as.controller.OperationContext.Stage#MODEL}.
<p>
This default implementation uses the {@link org.jboss.as.controller.OperationContext#createResource(PathAddress)
default resource creation facility exposed by the context}. Subclasses wishing to create a custom resource
type can override this method.
@param context the operation context
@param operation the operation | [
"Create",
"the",
"{",
"@link",
"Resource",
"}",
"that",
"the",
"{",
"@link",
"AbstractAddStepHandler#execute",
"(",
"OperationContext",
"ModelNode",
")",
"}",
"method",
"operates",
"on",
".",
"This",
"method",
"is",
"invoked",
"during",
"{",
"@link",
"org",
".... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java#L183-L193 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ListTriggersRequest.java | ListTriggersRequest.withTags | public ListTriggersRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public ListTriggersRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"ListTriggersRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies to return only these tagged resources.
</p>
@param tags
Specifies to return only these tagged resources.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"to",
"return",
"only",
"these",
"tagged",
"resources",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ListTriggersRequest.java#L215-L218 |
infinispan/infinispan | client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/TransactionContext.java | TransactionContext.prepareContext | int prepareContext(Xid xid, boolean onePhaseCommit, long timeout) {
PrepareTransactionOperation operation;
Collection<Modification> modifications;
try {
modifications = toModification();
if (trace) {
log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName,
modifications.size());
}
if (modifications.isEmpty()) {
return XAResource.XA_RDONLY;
}
} catch (Exception e) {
return Integer.MIN_VALUE;
}
try {
int xaReturnCode;
do {
operation = operationsFactory
.newPrepareTransactionOperation(xid, onePhaseCommit, modifications, recoverable, timeout);
xaReturnCode = operation.execute().get();
} while (operation.shouldRetry());
return xaReturnCode;
} catch (Exception e) {
log.exceptionDuringPrepare(xid, e);
return XAException.XA_RBROLLBACK;
}
} | java | int prepareContext(Xid xid, boolean onePhaseCommit, long timeout) {
PrepareTransactionOperation operation;
Collection<Modification> modifications;
try {
modifications = toModification();
if (trace) {
log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName,
modifications.size());
}
if (modifications.isEmpty()) {
return XAResource.XA_RDONLY;
}
} catch (Exception e) {
return Integer.MIN_VALUE;
}
try {
int xaReturnCode;
do {
operation = operationsFactory
.newPrepareTransactionOperation(xid, onePhaseCommit, modifications, recoverable, timeout);
xaReturnCode = operation.execute().get();
} while (operation.shouldRetry());
return xaReturnCode;
} catch (Exception e) {
log.exceptionDuringPrepare(xid, e);
return XAException.XA_RBROLLBACK;
}
} | [
"int",
"prepareContext",
"(",
"Xid",
"xid",
",",
"boolean",
"onePhaseCommit",
",",
"long",
"timeout",
")",
"{",
"PrepareTransactionOperation",
"operation",
";",
"Collection",
"<",
"Modification",
">",
"modifications",
";",
"try",
"{",
"modifications",
"=",
"toModi... | Prepares the {@link Transaction} in the server and returns the {@link XAResource} code.
<p>
A special value {@link Integer#MIN_VALUE} is used to signal an error before contacting the server (for example, it
wasn't able to marshall the key/value) | [
"Prepares",
"the",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/TransactionContext.java#L176-L203 |
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/AddDynamicSearchAdsCampaign.java | AddDynamicSearchAdsCampaign.runExample | public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session)
throws RemoteException {
Budget budget = createBudget(adWordsServices, session);
Campaign campaign = createCampaign(adWordsServices, session, budget);
AdGroup adGroup = createAdGroup(adWordsServices, session, campaign);
createExpandedDSA(adWordsServices, session, adGroup);
addWebPageCriteria(adWordsServices, session, adGroup);
} | java | public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session)
throws RemoteException {
Budget budget = createBudget(adWordsServices, session);
Campaign campaign = createCampaign(adWordsServices, session, budget);
AdGroup adGroup = createAdGroup(adWordsServices, session, campaign);
createExpandedDSA(adWordsServices, session, adGroup);
addWebPageCriteria(adWordsServices, session, adGroup);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdWordsServicesInterface",
"adWordsServices",
",",
"AdWordsSession",
"session",
")",
"throws",
"RemoteException",
"{",
"Budget",
"budget",
"=",
"createBudget",
"(",
"adWordsServices",
",",
"session",
")",
";",
"Campaign"... | Runs the example.
@param adWordsServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/AddDynamicSearchAdsCampaign.java#L142-L150 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForSubscription | public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body();
} | java | public PolicyEventsQueryResultsInner listQueryResultsForSubscription(String subscriptionId, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyEventsQueryResultsInner",
"listQueryResultsForSubscription",
"(",
"String",
"subscriptionId",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForSubscriptionWithServiceResponseAsync",
"(",
"subscriptionId",
",",
"queryOptions",
")",
".",... | Queries policy events for the resources under the subscription.
@param subscriptionId Microsoft Azure subscription ID.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyEventsQueryResultsInner object if successful. | [
"Queries",
"policy",
"events",
"for",
"the",
"resources",
"under",
"the",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L374-L376 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/RequiresNew.java | RequiresNew.requiresNew | @AroundInvoke
public Object requiresNew(final InvocationContext context) throws Exception {
return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, false, context, "REQUIRES_NEW");
} | java | @AroundInvoke
public Object requiresNew(final InvocationContext context) throws Exception {
return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, false, context, "REQUIRES_NEW");
} | [
"@",
"AroundInvoke",
"public",
"Object",
"requiresNew",
"(",
"final",
"InvocationContext",
"context",
")",
"throws",
"Exception",
"{",
"return",
"runUnderUOWManagingEnablement",
"(",
"UOWSynchronizationRegistry",
".",
"UOW_TYPE_GLOBAL_TRANSACTION",
",",
"false",
",",
"con... | <p>If called outside a transaction context, the interceptor must begin a new
JTA transaction, the managed bean method execution must then continue
inside this transaction context, and the transaction must be completed by
the interceptor.</p>
<p>If called inside a transaction context, the current transaction context must
be suspended, a new JTA transaction will begin, the managed bean method
execution must then continue inside this transaction context, the transaction
must be completed, and the previously suspended transaction must be resumed.</p> | [
"<p",
">",
"If",
"called",
"outside",
"a",
"transaction",
"context",
"the",
"interceptor",
"must",
"begin",
"a",
"new",
"JTA",
"transaction",
"the",
"managed",
"bean",
"method",
"execution",
"must",
"then",
"continue",
"inside",
"this",
"transaction",
"context",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/RequiresNew.java#L39-L44 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java | ModelControllerImpl.executeReadOnlyOperation | @SuppressWarnings("deprecation")
protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {
final AbstractOperationContext delegateContext = getDelegateContext(operationId);
CurrentOperationIdHolder.setCurrentOperationID(operationId);
try {
return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);
} finally {
CurrentOperationIdHolder.setCurrentOperationID(null);
}
} | java | @SuppressWarnings("deprecation")
protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {
final AbstractOperationContext delegateContext = getDelegateContext(operationId);
CurrentOperationIdHolder.setCurrentOperationID(operationId);
try {
return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);
} finally {
CurrentOperationIdHolder.setCurrentOperationID(null);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"ModelNode",
"executeReadOnlyOperation",
"(",
"final",
"ModelNode",
"operation",
",",
"final",
"OperationMessageHandler",
"handler",
",",
"final",
"OperationTransactionControl",
"control",
",",
"final",
"O... | Executes an operation on the controller latching onto an existing transaction
@param operation the operation
@param handler the handler
@param control the transaction control
@param prepareStep the prepare step to be executed before any other steps
@param operationId the id of the current transaction
@return the result of the operation | [
"Executes",
"an",
"operation",
"on",
"the",
"controller",
"latching",
"onto",
"an",
"existing",
"transaction"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L271-L280 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java | PhaseThreeApplication.stage5Statement | private void stage5Statement(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} else {
stageOutput("Skipping statement equivalencing");
}
} | java | private void stage5Statement(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} else {
stageOutput("Skipping statement equivalencing");
}
} | [
"private",
"void",
"stage5Statement",
"(",
"final",
"ProtoNetwork",
"network",
",",
"int",
"pct",
")",
"{",
"if",
"(",
"pct",
">",
"0",
")",
"{",
"stageOutput",
"(",
"\"Equivalencing statements\"",
")",
";",
"int",
"sct",
"=",
"p2",
".",
"stage3EquivalenceSt... | Stage five statement equivalencing.
@param network the {@link ProtoNetwork network} to equivalence
@param pct the parameter equivalencing count to control output | [
"Stage",
"five",
"statement",
"equivalencing",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1263-L1271 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/range/IntegerRangeRandomizer.java | IntegerRangeRandomizer.aNewIntegerRangeRandomizer | public static IntegerRangeRandomizer aNewIntegerRangeRandomizer(final Integer min, final Integer max, final long seed) {
return new IntegerRangeRandomizer(min, max, seed);
} | java | public static IntegerRangeRandomizer aNewIntegerRangeRandomizer(final Integer min, final Integer max, final long seed) {
return new IntegerRangeRandomizer(min, max, seed);
} | [
"public",
"static",
"IntegerRangeRandomizer",
"aNewIntegerRangeRandomizer",
"(",
"final",
"Integer",
"min",
",",
"final",
"Integer",
"max",
",",
"final",
"long",
"seed",
")",
"{",
"return",
"new",
"IntegerRangeRandomizer",
"(",
"min",
",",
"max",
",",
"seed",
")... | Create a new {@link IntegerRangeRandomizer}.
@param min min value
@param max max value
@param seed initial seed
@return a new {@link IntegerRangeRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"IntegerRangeRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/IntegerRangeRandomizer.java#L73-L75 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.maxIndex | public static Integer maxIndex(HashMap<String, String> properties) {
Integer max = null;
for (String key : properties.keySet()) {
Matcher m = INDEX_PATTERN.matcher(key);
if (m.matches()) {
int index = Integer.parseInt(m.group(1));
if (max == null || index > max) {
max = index;
}
}
}
return max;
} | java | public static Integer maxIndex(HashMap<String, String> properties) {
Integer max = null;
for (String key : properties.keySet()) {
Matcher m = INDEX_PATTERN.matcher(key);
if (m.matches()) {
int index = Integer.parseInt(m.group(1));
if (max == null || index > max) {
max = index;
}
}
}
return max;
} | [
"public",
"static",
"Integer",
"maxIndex",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"Integer",
"max",
"=",
"null",
";",
"for",
"(",
"String",
"key",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"Matcher",
"m",... | Ermittelt den maximalen Index aller indizierten Properties. Nicht indizierte Properties
werden ignoriert.
@param properties die Properties, mit denen gearbeitet werden soll
@return Maximaler Index, oder {@code null}, wenn keine indizierten Properties gefunden wurden | [
"Ermittelt",
"den",
"maximalen",
"Index",
"aller",
"indizierten",
"Properties",
".",
"Nicht",
"indizierte",
"Properties",
"werden",
"ignoriert",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L99-L111 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authorization.jacc/src/com/ibm/ws/security/authorization/jacc/internal/JaccServiceImpl.java | JaccServiceImpl.checkDataConstraints | protected boolean checkDataConstraints(String applicationName, String moduleName, String uriName, String methodName, Object req, String transportType) {
boolean result = false;
WebSecurityValidator wsv = getWsv(servletServiceRef.getService());
if (wsv != null) {
result = checkDataConstraints(wsv, applicationName, moduleName, uriName, methodName, req, transportType);
} else {
Tr.error(tc, "JACC_NO_WEB_PLUGIN");
}
return result;
} | java | protected boolean checkDataConstraints(String applicationName, String moduleName, String uriName, String methodName, Object req, String transportType) {
boolean result = false;
WebSecurityValidator wsv = getWsv(servletServiceRef.getService());
if (wsv != null) {
result = checkDataConstraints(wsv, applicationName, moduleName, uriName, methodName, req, transportType);
} else {
Tr.error(tc, "JACC_NO_WEB_PLUGIN");
}
return result;
} | [
"protected",
"boolean",
"checkDataConstraints",
"(",
"String",
"applicationName",
",",
"String",
"moduleName",
",",
"String",
"uriName",
",",
"String",
"methodName",
",",
"Object",
"req",
",",
"String",
"transportType",
")",
"{",
"boolean",
"result",
"=",
"false",... | /*
check DataConstraints
true if permission is is implied.
false otherwise. | [
"/",
"*",
"check",
"DataConstraints",
"true",
"if",
"permission",
"is",
"is",
"implied",
".",
"false",
"otherwise",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.jacc/src/com/ibm/ws/security/authorization/jacc/internal/JaccServiceImpl.java#L303-L312 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java | KSIBuilder.setPublicationsFilePkiTrustStore | public KSIBuilder setPublicationsFilePkiTrustStore(File file, String password) throws KSIException {
if (file == null) {
throw new KSIException("Invalid input parameter. Trust store file is null");
}
FileInputStream input = null;
try {
this.trustStore = KeyStore.getInstance("JKS");
char[] passwordCharArray = password == null ? null : password.toCharArray();
input = new FileInputStream(file);
trustStore.load(input, passwordCharArray);
} catch (GeneralSecurityException | IOException e) {
throw new KSIException("Loading java key store with path " + file + " failed", e);
} finally {
Util.closeQuietly(input);
}
return this;
} | java | public KSIBuilder setPublicationsFilePkiTrustStore(File file, String password) throws KSIException {
if (file == null) {
throw new KSIException("Invalid input parameter. Trust store file is null");
}
FileInputStream input = null;
try {
this.trustStore = KeyStore.getInstance("JKS");
char[] passwordCharArray = password == null ? null : password.toCharArray();
input = new FileInputStream(file);
trustStore.load(input, passwordCharArray);
} catch (GeneralSecurityException | IOException e) {
throw new KSIException("Loading java key store with path " + file + " failed", e);
} finally {
Util.closeQuietly(input);
}
return this;
} | [
"public",
"KSIBuilder",
"setPublicationsFilePkiTrustStore",
"(",
"File",
"file",
",",
"String",
"password",
")",
"throws",
"KSIException",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Invalid input parameter. Trust store file... | Loads the {@link KeyStore} from the file system and sets the {@link KeyStore} to be used as a truststore to verify
the certificate that was used to sign the publications file.
@param file
keystore file on disk, not null.
@param password
password of the keystore, null if keystore isn't protected by password.
@return Instance of {@link KSIBuilder}.
@throws KSIException
when any error occurs. | [
"Loads",
"the",
"{",
"@link",
"KeyStore",
"}",
"from",
"the",
"file",
"system",
"and",
"sets",
"the",
"{",
"@link",
"KeyStore",
"}",
"to",
"be",
"used",
"as",
"a",
"truststore",
"to",
"verify",
"the",
"certificate",
"that",
"was",
"used",
"to",
"sign",
... | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L191-L207 |
apache/groovy | src/main/java/org/apache/groovy/util/SystemUtil.java | SystemUtil.getIntegerSafe | public static Integer getIntegerSafe(String name, Integer def) {
try {
return Integer.getInteger(name, def);
} catch (SecurityException ignore) {
// suppress exception
}
return def;
} | java | public static Integer getIntegerSafe(String name, Integer def) {
try {
return Integer.getInteger(name, def);
} catch (SecurityException ignore) {
// suppress exception
}
return def;
} | [
"public",
"static",
"Integer",
"getIntegerSafe",
"(",
"String",
"name",
",",
"Integer",
"def",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"getInteger",
"(",
"name",
",",
"def",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"ignore",
")",
"{",
"/... | Retrieves an Integer System property
@param name the name of the system property.
@param def the default value
@return value of the Integer system property or false | [
"Retrieves",
"an",
"Integer",
"System",
"property"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/util/SystemUtil.java#L130-L138 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.unset_resource | protected base_response unset_resource(nitro_service service, String args[]) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action("unset");
base_response response = unset_request(service, option, args);
return response;
} | java | protected base_response unset_resource(nitro_service service, String args[]) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action("unset");
base_response response = unset_request(service, option, args);
return response;
} | [
"protected",
"base_response",
"unset_resource",
"(",
"nitro_service",
"service",
",",
"String",
"args",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",
"... | Use this method to perform an Unset operation on netscaler resource.
@param service nitro_service object.
@param args Array of args that are to be unset.
@return status of the operation performed.
@throws Exception Nitro exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"an",
"Unset",
"operation",
"on",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L477-L486 |
revelc/formatter-maven-plugin | src/main/java/net/revelc/code/formatter/FormatterMojo.java | FormatterMojo.getOptionsFromPropertiesFile | private Map<String, String> getOptionsFromPropertiesFile(String newPropertiesFile) throws MojoExecutionException {
this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath());
this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath());
Properties properties = new Properties();
try {
properties.load(this.resourceManager.getResourceAsInputStream(newPropertiesFile));
} catch (ResourceNotFoundException e) {
getLog().debug("Property file [" + newPropertiesFile + "] cannot be found", e);
return new HashMap<>();
} catch (IOException e) {
throw new MojoExecutionException("Cannot read config file [" + newPropertiesFile + "]", e);
}
final Map<String, String> map = new HashMap<>();
for (final String name : properties.stringPropertyNames()) {
map.put(name, properties.getProperty(name));
}
return map;
} | java | private Map<String, String> getOptionsFromPropertiesFile(String newPropertiesFile) throws MojoExecutionException {
this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath());
this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath());
Properties properties = new Properties();
try {
properties.load(this.resourceManager.getResourceAsInputStream(newPropertiesFile));
} catch (ResourceNotFoundException e) {
getLog().debug("Property file [" + newPropertiesFile + "] cannot be found", e);
return new HashMap<>();
} catch (IOException e) {
throw new MojoExecutionException("Cannot read config file [" + newPropertiesFile + "]", e);
}
final Map<String, String> map = new HashMap<>();
for (final String name : properties.stringPropertyNames()) {
map.put(name, properties.getProperty(name));
}
return map;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getOptionsFromPropertiesFile",
"(",
"String",
"newPropertiesFile",
")",
"throws",
"MojoExecutionException",
"{",
"this",
".",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Using search path at: \"",
"+",
"this",
".... | Read properties file and return the properties as {@link Map}.
@return the options from properties file or null if not properties file found
@throws MojoExecutionException
the mojo execution exception | [
"Read",
"properties",
"file",
"and",
"return",
"the",
"properties",
"as",
"{",
"@link",
"Map",
"}",
"."
] | train | https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L723-L743 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.getAsync | public <T> CompletableFuture<T> getAsync(final Class<T> type, final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> get(type, configuration), getExecutor());
} | java | public <T> CompletableFuture<T> getAsync(final Class<T> type, final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> get(type, configuration), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"getAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Consumer",
"<",
"HttpConfig",
">",
"configuration",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",... | Executes asynchronous GET request on the configured URI (alias for the `get(Class, Consumer)` method), with additional configuration provided by
the configuration function. The result will be cast to the specified `type`.
This method is generally meant for use with standard Java.
[source,groovy]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
String result = http.get(String.class, config -> {
config.getRequest().getUri().setPath("/foo");
});
----
@param type the type of the response content
@param configuration the additional configuration function (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} for the resulting content cast to the specified type | [
"Executes",
"asynchronous",
"GET",
"request",
"on",
"the",
"configured",
"URI",
"(",
"alias",
"for",
"the",
"get",
"(",
"Class",
"Consumer",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"function",
".",
"... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L489-L491 |
windup/windup | rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java | JmsDestinationService.getTypeFromClass | public static JmsDestinationType getTypeFromClass(String aClass)
{
if (StringUtils.equals(aClass, "javax.jms.Queue") || StringUtils.equals(aClass, "javax.jms.QueueConnectionFactory"))
{
return JmsDestinationType.QUEUE;
}
else if (StringUtils.equals(aClass, "javax.jms.Topic") || StringUtils.equals(aClass, "javax.jms.TopicConnectionFactory"))
{
return JmsDestinationType.TOPIC;
}
else
{
return null;
}
} | java | public static JmsDestinationType getTypeFromClass(String aClass)
{
if (StringUtils.equals(aClass, "javax.jms.Queue") || StringUtils.equals(aClass, "javax.jms.QueueConnectionFactory"))
{
return JmsDestinationType.QUEUE;
}
else if (StringUtils.equals(aClass, "javax.jms.Topic") || StringUtils.equals(aClass, "javax.jms.TopicConnectionFactory"))
{
return JmsDestinationType.TOPIC;
}
else
{
return null;
}
} | [
"public",
"static",
"JmsDestinationType",
"getTypeFromClass",
"(",
"String",
"aClass",
")",
"{",
"if",
"(",
"StringUtils",
".",
"equals",
"(",
"aClass",
",",
"\"javax.jms.Queue\"",
")",
"||",
"StringUtils",
".",
"equals",
"(",
"aClass",
",",
"\"javax.jms.QueueConn... | Gets JmsDestinationType from java class name
Returns null for unrecognized class | [
"Gets",
"JmsDestinationType",
"from",
"java",
"class",
"name"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java#L75-L89 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Transloadit.java | Transloadit.deleteTemplate | public Response deleteTemplate(String id)
throws RequestException, LocalOperationException {
Request request = new Request(this);
return new Response(request.delete("/templates/" + id, new HashMap<String, Object>()));
} | java | public Response deleteTemplate(String id)
throws RequestException, LocalOperationException {
Request request = new Request(this);
return new Response(request.delete("/templates/" + id, new HashMap<String, Object>()));
} | [
"public",
"Response",
"deleteTemplate",
"(",
"String",
"id",
")",
"throws",
"RequestException",
",",
"LocalOperationException",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"this",
")",
";",
"return",
"new",
"Response",
"(",
"request",
".",
"delete",
... | Deletes a template.
@param id id of the template to delete.
@return {@link Response}
@throws RequestException if request to transloadit server fails.
@throws LocalOperationException if something goes wrong while running non-http operations. | [
"Deletes",
"a",
"template",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Transloadit.java#L225-L229 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/ProxyProvider.java | ProxyProvider.newProxyHandler | public final ProxyHandler newProxyHandler() {
InetSocketAddress proxyAddr = this.address.get();
String username = this.username;
String password = Objects.nonNull(username) && Objects.nonNull(this.password) ?
this.password.apply(username) : null;
switch (this.type) {
case HTTP:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new HttpProxyHandler(proxyAddr, username, password, this.httpHeaders.get()) :
new HttpProxyHandler(proxyAddr, this.httpHeaders.get());
case SOCKS4:
return Objects.nonNull(username) ? new Socks4ProxyHandler(proxyAddr, username) :
new Socks4ProxyHandler(proxyAddr);
case SOCKS5:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new Socks5ProxyHandler(proxyAddr, username, password) :
new Socks5ProxyHandler(proxyAddr);
}
throw new IllegalArgumentException("Proxy type unsupported : " + this.type);
} | java | public final ProxyHandler newProxyHandler() {
InetSocketAddress proxyAddr = this.address.get();
String username = this.username;
String password = Objects.nonNull(username) && Objects.nonNull(this.password) ?
this.password.apply(username) : null;
switch (this.type) {
case HTTP:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new HttpProxyHandler(proxyAddr, username, password, this.httpHeaders.get()) :
new HttpProxyHandler(proxyAddr, this.httpHeaders.get());
case SOCKS4:
return Objects.nonNull(username) ? new Socks4ProxyHandler(proxyAddr, username) :
new Socks4ProxyHandler(proxyAddr);
case SOCKS5:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new Socks5ProxyHandler(proxyAddr, username, password) :
new Socks5ProxyHandler(proxyAddr);
}
throw new IllegalArgumentException("Proxy type unsupported : " + this.type);
} | [
"public",
"final",
"ProxyHandler",
"newProxyHandler",
"(",
")",
"{",
"InetSocketAddress",
"proxyAddr",
"=",
"this",
".",
"address",
".",
"get",
"(",
")",
";",
"String",
"username",
"=",
"this",
".",
"username",
";",
"String",
"password",
"=",
"Objects",
".",... | Return a new eventual {@link ProxyHandler}
@return a new eventual {@link ProxyHandler} | [
"Return",
"a",
"new",
"eventual",
"{",
"@link",
"ProxyHandler",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/ProxyProvider.java#L145-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_senders_sender_PUT | public void serviceName_senders_sender_PUT(String serviceName, String sender, OvhSender body) throws IOException {
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_senders_sender_PUT(String serviceName, String sender, OvhSender body) throws IOException {
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_senders_sender_PUT",
"(",
"String",
"serviceName",
",",
"String",
"sender",
",",
"OvhSender",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/senders/{sender}\"",
";",
"StringBuilder",
"sb",
"=",
... | Alter this object properties
REST: PUT /sms/{serviceName}/senders/{sender}
@param body [required] New object properties
@param serviceName [required] The internal name of your SMS offer
@param sender [required] The sms sender | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L197-L201 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/FormatUtils.java | FormatUtils.getIndexedFormat | public static String getIndexedFormat(int index, String format) {
if (index < 1)
throw new IllegalArgumentException();
if (format == null)
throw new NullPointerException();
if (format.length() == 0)
throw new IllegalArgumentException();
return String.format(INDEXED_FORMAT, index, format);
} | java | public static String getIndexedFormat(int index, String format) {
if (index < 1)
throw new IllegalArgumentException();
if (format == null)
throw new NullPointerException();
if (format.length() == 0)
throw new IllegalArgumentException();
return String.format(INDEXED_FORMAT, index, format);
} | [
"public",
"static",
"String",
"getIndexedFormat",
"(",
"int",
"index",
",",
"String",
"format",
")",
"{",
"if",
"(",
"index",
"<",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"throw",
"new"... | Returns an indexed format by placing the specified index before the given
format.
@param index
Desired index for the given format
@param format
Format to be indexed
@return The format <code>format</code> indexed with <code>index</code> | [
"Returns",
"an",
"indexed",
"format",
"by",
"placing",
"the",
"specified",
"index",
"before",
"the",
"given",
"format",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L184-L192 |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java | JDK8TriggerBuilder.withIdentity | @Nonnull
public JDK8TriggerBuilder <T> withIdentity (final String name, final String group)
{
m_aTriggerKey = new TriggerKey (name, group);
return this;
} | java | @Nonnull
public JDK8TriggerBuilder <T> withIdentity (final String name, final String group)
{
m_aTriggerKey = new TriggerKey (name, group);
return this;
} | [
"@",
"Nonnull",
"public",
"JDK8TriggerBuilder",
"<",
"T",
">",
"withIdentity",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"group",
")",
"{",
"m_aTriggerKey",
"=",
"new",
"TriggerKey",
"(",
"name",
",",
"group",
")",
";",
"return",
"this",
";",... | Use a TriggerKey with the given name and group to identify the Trigger.
<p>
If none of the 'withIdentity' methods are set on the JDK8TriggerBuilder,
then a random, unique TriggerKey will be generated.
</p>
@param name
the name element for the Trigger's TriggerKey
@param group
the group element for the Trigger's TriggerKey
@return the updated JDK8TriggerBuilder
@see TriggerKey
@see ITrigger#getKey() | [
"Use",
"a",
"TriggerKey",
"with",
"the",
"given",
"name",
"and",
"group",
"to",
"identify",
"the",
"Trigger",
".",
"<p",
">",
"If",
"none",
"of",
"the",
"withIdentity",
"methods",
"are",
"set",
"on",
"the",
"JDK8TriggerBuilder",
"then",
"a",
"random",
"uni... | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java#L165-L170 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.renameTo | public static boolean renameTo(final Path self, URI newPathName) {
try {
Files.move(self, Paths.get(newPathName));
return true;
} catch (IOException e) {
return false;
}
} | java | public static boolean renameTo(final Path self, URI newPathName) {
try {
Files.move(self, Paths.get(newPathName));
return true;
} catch (IOException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"renameTo",
"(",
"final",
"Path",
"self",
",",
"URI",
"newPathName",
")",
"{",
"try",
"{",
"Files",
".",
"move",
"(",
"self",
",",
"Paths",
".",
"get",
"(",
"newPathName",
")",
")",
";",
"return",
"true",
";",
"}",
"cat... | Renames a file.
@param self a Path
@param newPathName The new target path specified as a URI object
@return <code>true</code> if and only if the renaming succeeded;
<code>false</code> otherwise
@since 2.3.0 | [
"Renames",
"a",
"file",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1341-L1348 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateTowards | public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest) {
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | java | public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest) {
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | [
"public",
"Matrix3f",
"rotateTowards",
"(",
"Vector3fc",
"direction",
",",
"Vector3fc",
"up",
",",
"Matrix3f",
"dest",
")",
"{",
"return",
"rotateTowards",
"(",
"direction",
".",
"x",
"(",
")",
",",
"direction",
".",
"y",
"(",
")",
",",
"direction",
".",
... | Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>direction</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(Vector3fc, Vector3fc) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert(), dest)</code>
@see #rotateTowards(float, float, float, float, float, float, Matrix3f)
@see #rotationTowards(Vector3fc, Vector3fc)
@param direction
the direction to rotate towards
@param up
the model's up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"model",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"+",
"Z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"direction<",
"/",
"co... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L3860-L3862 |
gini/dropwizard-gelf | src/main/java/net/gini/dropwizard/gelf/filters/GelfLoggingFilter.java | GelfLoggingFilter.doFilter | @Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// It's quite safe to assume that we only receive HTTP requests
final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = (HttpServletResponse) response;
final StringBuilder buf = new StringBuilder(256);
final Optional<String> address = Optional.ofNullable(httpRequest.getHeader(HttpHeaders.X_FORWARDED_FOR));
final String clientAddress = address.orElse(request.getRemoteAddr());
buf.append(clientAddress);
buf.append(" - ");
final String authType = httpRequest.getAuthType();
if (authType != null) {
buf.append(httpRequest.getUserPrincipal().getName());
} else {
buf.append("-");
}
buf.append(" \"");
buf.append(httpRequest.getMethod());
buf.append(' ');
buf.append(httpRequest.getRequestURI());
buf.append(' ');
buf.append(request.getProtocol());
buf.append("\" ");
final CountingHttpServletResponseWrapper responseWrapper = new CountingHttpServletResponseWrapper(httpResponse);
final Stopwatch stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
try {
chain.doFilter(request, responseWrapper);
} finally {
if (request.isAsyncStarted()) {
final AsyncListener listener =
new LoggingAsyncListener(buf, stopwatch, authType, clientAddress, httpRequest,
responseWrapper);
request.getAsyncContext().addListener(listener);
} else {
logRequest(buf, stopwatch, authType, clientAddress, httpRequest, responseWrapper);
}
}
} | java | @Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// It's quite safe to assume that we only receive HTTP requests
final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = (HttpServletResponse) response;
final StringBuilder buf = new StringBuilder(256);
final Optional<String> address = Optional.ofNullable(httpRequest.getHeader(HttpHeaders.X_FORWARDED_FOR));
final String clientAddress = address.orElse(request.getRemoteAddr());
buf.append(clientAddress);
buf.append(" - ");
final String authType = httpRequest.getAuthType();
if (authType != null) {
buf.append(httpRequest.getUserPrincipal().getName());
} else {
buf.append("-");
}
buf.append(" \"");
buf.append(httpRequest.getMethod());
buf.append(' ');
buf.append(httpRequest.getRequestURI());
buf.append(' ');
buf.append(request.getProtocol());
buf.append("\" ");
final CountingHttpServletResponseWrapper responseWrapper = new CountingHttpServletResponseWrapper(httpResponse);
final Stopwatch stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
try {
chain.doFilter(request, responseWrapper);
} finally {
if (request.isAsyncStarted()) {
final AsyncListener listener =
new LoggingAsyncListener(buf, stopwatch, authType, clientAddress, httpRequest,
responseWrapper);
request.getAsyncContext().addListener(listener);
} else {
logRequest(buf, stopwatch, authType, clientAddress, httpRequest, responseWrapper);
}
}
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"final",
"ServletRequest",
"request",
",",
"final",
"ServletResponse",
"response",
",",
"final",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// It's quite safe to assume that we... | The <code>doFilter</code> method of the Filter is called by the
container each time a request/response pair is passed through the
chain due to a client request for a resource at the end of the chain.
The FilterChain passed in to this method allows the Filter to pass
on the request and response to the next entity in the chain.
<p>A typical implementation of this method would follow the following
pattern:
<ol>
<li>Examine the request
<li>Optionally wrap the request object with a custom implementation to
filter content or headers for input filtering
<li>Optionally wrap the response object with a custom implementation to
filter content or headers for output filtering
<li>
<ul>
<li><strong>Either</strong> invoke the next entity in the chain
using the FilterChain object
(<code>chain.doFilter()</code>),
<li><strong>or</strong> not pass on the request/response pair to
the next entity in the filter chain to
block the request processing
</ul>
<li>Directly set headers on the response after invocation of the
next entity in the filter chain.
</ol> | [
"The",
"<code",
">",
"doFilter<",
"/",
"code",
">",
"method",
"of",
"the",
"Filter",
"is",
"called",
"by",
"the",
"container",
"each",
"time",
"a",
"request",
"/",
"response",
"pair",
"is",
"passed",
"through",
"the",
"chain",
"due",
"to",
"a",
"client",... | train | https://github.com/gini/dropwizard-gelf/blob/0182f61b3ebdf417f174f6860d6a813c10853d31/src/main/java/net/gini/dropwizard/gelf/filters/GelfLoggingFilter.java#L83-L129 |
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/RubyObject.java | RubyObject.send | public static <E> E send(Object o, String methodName, Double arg) {
return send(o, methodName, (Object) arg);
} | java | public static <E> E send(Object o, String methodName, Double arg) {
return send(o, methodName, (Object) arg);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"send",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Double",
"arg",
")",
"{",
"return",
"send",
"(",
"o",
",",
"methodName",
",",
"(",
"Object",
")",
"arg",
")",
";",
"}"
] | Executes a method of any Object by Java reflection.
@param o
an Object
@param methodName
name of the method
@param arg
a Double
@return the result of the method called | [
"Executes",
"a",
"method",
"of",
"any",
"Object",
"by",
"Java",
"reflection",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L291-L293 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.split | public static List<String> split(final CharSequence str, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(str)) {
return new ArrayList<>();
}
return split(str, 0, str.length(), size);
} | java | public static List<String> split(final CharSequence str, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(str)) {
return new ArrayList<>();
}
return split(str, 0, str.length(), size);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The parameter 'size' can not be zero... | Returns consecutive substring of the specified string, each of the same length (the final list may be smaller),
or an empty array if the specified string is null or empty.
@param str
@param size
@return | [
"Returns",
"consecutive",
"substring",
"of",
"the",
"specified",
"string",
"each",
"of",
"the",
"same",
"length",
"(",
"the",
"final",
"list",
"may",
"be",
"smaller",
")",
"or",
"an",
"empty",
"array",
"if",
"the",
"specified",
"string",
"is",
"null",
"or"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18738-L18748 |
apereo/cas | support/cas-server-support-throttle-core/src/main/java/org/apereo/cas/web/support/AbstractThrottledSubmissionHandlerInterceptorAdapter.java | AbstractThrottledSubmissionHandlerInterceptorAdapter.throttleRequest | protected boolean throttleRequest(final HttpServletRequest request, final HttpServletResponse response) {
return configurationContext.getThrottledRequestExecutor() != null
&& configurationContext.getThrottledRequestExecutor().throttle(request, response);
} | java | protected boolean throttleRequest(final HttpServletRequest request, final HttpServletResponse response) {
return configurationContext.getThrottledRequestExecutor() != null
&& configurationContext.getThrottledRequestExecutor().throttle(request, response);
} | [
"protected",
"boolean",
"throttleRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"return",
"configurationContext",
".",
"getThrottledRequestExecutor",
"(",
")",
"!=",
"null",
"&&",
"configurationContext",... | Is request throttled.
@param request the request
@param response the response
@return true if the request is throttled. False otherwise, letting it proceed. | [
"Is",
"request",
"throttled",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-throttle-core/src/main/java/org/apereo/cas/web/support/AbstractThrottledSubmissionHandlerInterceptorAdapter.java#L86-L89 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.getRelativeTimeSpanString | public static CharSequence getRelativeTimeSpanString(Context ctx, ReadablePartial time, boolean withPreposition) {
return getRelativeTimeSpanString(ctx, time.toDateTime(DateTime.now()), withPreposition);
} | java | public static CharSequence getRelativeTimeSpanString(Context ctx, ReadablePartial time, boolean withPreposition) {
return getRelativeTimeSpanString(ctx, time.toDateTime(DateTime.now()), withPreposition);
} | [
"public",
"static",
"CharSequence",
"getRelativeTimeSpanString",
"(",
"Context",
"ctx",
",",
"ReadablePartial",
"time",
",",
"boolean",
"withPreposition",
")",
"{",
"return",
"getRelativeTimeSpanString",
"(",
"ctx",
",",
"time",
".",
"toDateTime",
"(",
"DateTime",
"... | Returns a relative time string to display the time expressed by millis.
Missing fields from 'time' are filled in with values from the current time.
See {@link android.text.format.DateUtils#getRelativeTimeSpanString} for full docs.
@param withPreposition If true, the string returned will include the correct
preposition ("at 9:20am", "on 10/12/2008" or "on May 29"). | [
"Returns",
"a",
"relative",
"time",
"string",
"to",
"display",
"the",
"time",
"expressed",
"by",
"millis",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L351-L353 |
rythmengine/rythmengine | src/main/java/org/rythmengine/template/TemplateBase.java | TemplateBase.__render | protected RawData __render(String template, Object... args) {
if (null == template) return new RawData("");
return S.raw(__engine.sandbox().render(template, args));
} | java | protected RawData __render(String template, Object... args) {
if (null == template) return new RawData("");
return S.raw(__engine.sandbox().render(template, args));
} | [
"protected",
"RawData",
"__render",
"(",
"String",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"null",
"==",
"template",
")",
"return",
"new",
"RawData",
"(",
"\"\"",
")",
";",
"return",
"S",
".",
"raw",
"(",
"__engine",
".",
"sandbo... | Render another template from this template. Could be used in template authoring.
For example:
<p/>
<pre><code>
{@literal @}args String customTemplate, Map<String, Object> customParams
{@literal @}{ Object renderResult = render(customTemplate, customParams);
}
<p class="customer_content">@renderResult</p>
</code></pre>
@param template
@param args
@return render result | [
"Render",
"another",
"template",
"from",
"this",
"template",
".",
"Could",
"be",
"used",
"in",
"template",
"authoring",
".",
"For",
"example",
":",
"<p",
"/",
">",
"<pre",
">",
"<code",
">",
"{",
"@literal",
"@",
"}",
"args",
"String",
"customTemplate",
... | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L280-L283 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.getCenterPoint | public static Coordinate getCenterPoint(Bbox bbox) {
double centerX = (bbox.getWidth() == 0 ? bbox.getX() : bbox.getX() + bbox.getWidth() / 2);
double centerY = (bbox.getHeight() == 0 ? bbox.getY() : bbox.getY() + bbox.getHeight() / 2);
return new Coordinate(centerX, centerY);
} | java | public static Coordinate getCenterPoint(Bbox bbox) {
double centerX = (bbox.getWidth() == 0 ? bbox.getX() : bbox.getX() + bbox.getWidth() / 2);
double centerY = (bbox.getHeight() == 0 ? bbox.getY() : bbox.getY() + bbox.getHeight() / 2);
return new Coordinate(centerX, centerY);
} | [
"public",
"static",
"Coordinate",
"getCenterPoint",
"(",
"Bbox",
"bbox",
")",
"{",
"double",
"centerX",
"=",
"(",
"bbox",
".",
"getWidth",
"(",
")",
"==",
"0",
"?",
"bbox",
".",
"getX",
"(",
")",
":",
"bbox",
".",
"getX",
"(",
")",
"+",
"bbox",
"."... | Get the center of the bounding box as a Coordinate.
@param bbox
The bounding box to get the center point for.
@return The center of the given bounding box as a new coordinate. | [
"Get",
"the",
"center",
"of",
"the",
"bounding",
"box",
"as",
"a",
"Coordinate",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L65-L69 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.lindex | @SuppressWarnings("unchecked")
/**
* 返回列表 key 中,下标为 index 的元素。
* 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,
* 以 1 表示列表的第二个元素,以此类推。
* 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。
* 如果 key 不是列表类型,返回一个错误。
*/
public <T> T lindex(Object key, long index) {
Jedis jedis = getJedis();
try {
return (T)valueFromBytes(jedis.lindex(keyToBytes(key), index));
}
finally {close(jedis);}
} | java | @SuppressWarnings("unchecked")
/**
* 返回列表 key 中,下标为 index 的元素。
* 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,
* 以 1 表示列表的第二个元素,以此类推。
* 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。
* 如果 key 不是列表类型,返回一个错误。
*/
public <T> T lindex(Object key, long index) {
Jedis jedis = getJedis();
try {
return (T)valueFromBytes(jedis.lindex(keyToBytes(key), index));
}
finally {close(jedis);}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"/**\r\n\t * 返回列表 key 中,下标为 index 的元素。\r\n\t * 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,\r\n\t * 以 1 表示列表的第二个元素,以此类推。\r\n\t * 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。\r\n\t * 如果 key 不是列表类型,返回一个错误。\r\n\t */",
"public",
"<",
"T"... | 返回列表 key 中,下标为 index 的元素。
下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,以 1 表示列表的第二个元素,以此类推。
你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。
如果 key 不是列表类型,返回一个错误。 | [
"返回列表",
"key",
"中,下标为",
"index",
"的元素。",
"下标",
"(",
"index",
")",
"参数",
"start",
"和",
"stop",
"都以",
"0",
"为底,也就是说,以",
"0",
"表示列表的第一个元素,以",
"1",
"表示列表的第二个元素,以此类推。",
"你也可以使用负数下标,以",
"-",
"1",
"表示列表的最后一个元素,",
"-",
"2",
"表示列表的倒数第二个元素,以此类推。",
"如果",
"key",
"不是列表类型... | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L611-L626 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.setEndpoint | public void setEndpoint(String endpoint, String serviceName, String regionId) throws IllegalArgumentException {
setEndpoint(endpoint);
signer.setServiceName(serviceName);
signer.setRegionName(regionId);
} | java | public void setEndpoint(String endpoint, String serviceName, String regionId) throws IllegalArgumentException {
setEndpoint(endpoint);
signer.setServiceName(serviceName);
signer.setRegionName(regionId);
} | [
"public",
"void",
"setEndpoint",
"(",
"String",
"endpoint",
",",
"String",
"serviceName",
",",
"String",
"regionId",
")",
"throws",
"IllegalArgumentException",
"{",
"setEndpoint",
"(",
"endpoint",
")",
";",
"signer",
".",
"setServiceName",
"(",
"serviceName",
")",... | Overrides the default endpoint for this client ("http://dynamodb.us-east-1.amazonaws.com/") and explicitly provides
an AWS region ID and AWS service name to use when the client calculates a signature
for requests. In almost all cases, this region ID and service name
are automatically determined from the endpoint, and callers should use the simpler
one-argument form of setEndpoint instead of this method.
<p>
<b>This method is not threadsafe. Endpoints should be configured when the
client is created and before any service requests are made. Changing it
afterwards creates inevitable race conditions for any service requests in
transit.</b>
<p>
Callers can pass in just the endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full
URL, including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/"). If the
protocol is not specified here, the default protocol from this client's
{@link ClientConfiguration} will be used, which by default is HTTPS.
<p>
For more information on using AWS regions with the AWS SDK for Java, and
a complete list of all available endpoints for all AWS services, see:
<a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912">
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912</a>
@param endpoint
The endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full URL,
including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/") of
the region specific AWS endpoint this client will communicate
with.
@param serviceName
The name of the AWS service to use when signing requests.
@param regionId
The ID of the region in which this service resides.
@throws IllegalArgumentException
If any problems are detected with the specified endpoint.
@see AmazonDynamoDB#setRegion(Region) | [
"Overrides",
"the",
"default",
"endpoint",
"for",
"this",
"client",
"(",
"http",
":",
"//",
"dynamodb",
".",
"us",
"-",
"east",
"-",
"1",
".",
"amazonaws",
".",
"com",
"/",
")",
"and",
"explicitly",
"provides",
"an",
"AWS",
"region",
"ID",
"and",
"AWS"... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L981-L985 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Color.java | Color.addToCopy | public Color addToCopy(Color c) {
Color copy = new Color(r,g,b,a);
copy.r += c.r;
copy.g += c.g;
copy.b += c.b;
copy.a += c.a;
return copy;
} | java | public Color addToCopy(Color c) {
Color copy = new Color(r,g,b,a);
copy.r += c.r;
copy.g += c.g;
copy.b += c.b;
copy.a += c.a;
return copy;
} | [
"public",
"Color",
"addToCopy",
"(",
"Color",
"c",
")",
"{",
"Color",
"copy",
"=",
"new",
"Color",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"copy",
".",
"r",
"+=",
"c",
".",
"r",
";",
"copy",
".",
"g",
"+=",
"c",
".",
"g",
";",
"... | Add another colour to this one
@param c The colour to add
@return The copy which has had the color added to it | [
"Add",
"another",
"colour",
"to",
"this",
"one"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Color.java#L367-L375 |
apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.validateServiceTicket | protected Assertion validateServiceTicket(final WebApplicationService service, final String serviceTicketId) {
return serviceValidateConfigurationContext.getCentralAuthenticationService().validateServiceTicket(serviceTicketId, service);
} | java | protected Assertion validateServiceTicket(final WebApplicationService service, final String serviceTicketId) {
return serviceValidateConfigurationContext.getCentralAuthenticationService().validateServiceTicket(serviceTicketId, service);
} | [
"protected",
"Assertion",
"validateServiceTicket",
"(",
"final",
"WebApplicationService",
"service",
",",
"final",
"String",
"serviceTicketId",
")",
"{",
"return",
"serviceValidateConfigurationContext",
".",
"getCentralAuthenticationService",
"(",
")",
".",
"validateServiceTi... | Validate service ticket assertion.
@param service the service
@param serviceTicketId the service ticket id
@return the assertion | [
"Validate",
"service",
"ticket",
"assertion",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L225-L227 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.notEmpty | public static void notEmpty(Map<?, ?> map, String message, Object... arguments) {
notEmpty(map, new IllegalArgumentException(format(message, arguments)));
} | java | public static void notEmpty(Map<?, ?> map, String message, Object... arguments) {
notEmpty(map, new IllegalArgumentException(format(message, arguments)));
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"String",
"message",
",",
"Object",
"...",
"arguments",
")",
"{",
"notEmpty",
"(",
"map",
",",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"message",
",",... | Asserts that the {@link Map} is not empty.
The assertion holds if and only if the {@link Map} is not {@literal null}
and contains at least 1 key/value mapping.
@param map {@link Map} to evaluate.
@param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown
if the assertion fails.
@param arguments array of {@link Object arguments} used as placeholder values
when formatting the {@link String message}.
@throws java.lang.IllegalArgumentException if the {@link Map} is {@literal null} or empty.
@see #notEmpty(java.util.Map, RuntimeException)
@see java.util.Map#isEmpty() | [
"Asserts",
"that",
"the",
"{",
"@link",
"Map",
"}",
"is",
"not",
"empty",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L1113-L1115 |
EasyinnovaSL/Tiff-Library-4J | src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java | TiffITProfile.validateIfdSD | private void validateIfdSD(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 2) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
} | java | private void validateIfdSD(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 2) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
} | [
"private",
"void",
"validateIfdSD",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
... | Validate Screened Data image.
@param ifd the ifd
@param p the profile (default = 0, P2 = 2) | [
"Validate",
"Screened",
"Data",
"image",
"."
] | train | https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L551-L581 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/AbstractHttpService.java | AbstractHttpService.doDelete | protected HttpResponse doDelete(ServiceRequestContext ctx, HttpRequest req) throws Exception {
final HttpResponseWriter res = HttpResponse.streaming();
doDelete(ctx, req, res);
return res;
} | java | protected HttpResponse doDelete(ServiceRequestContext ctx, HttpRequest req) throws Exception {
final HttpResponseWriter res = HttpResponse.streaming();
doDelete(ctx, req, res);
return res;
} | [
"protected",
"HttpResponse",
"doDelete",
"(",
"ServiceRequestContext",
"ctx",
",",
"HttpRequest",
"req",
")",
"throws",
"Exception",
"{",
"final",
"HttpResponseWriter",
"res",
"=",
"HttpResponse",
".",
"streaming",
"(",
")",
";",
"doDelete",
"(",
"ctx",
",",
"re... | Handles a {@link HttpMethod#DELETE DELETE} request.
This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. | [
"Handles",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/AbstractHttpService.java#L238-L242 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Templates.java | Templates.hasExpression | public static boolean hasExpression(final Template template, final String expression) {
final TemplateElement rootTreeNode = template.getRootTreeNode();
return hasExpression(template, expression, rootTreeNode);
} | java | public static boolean hasExpression(final Template template, final String expression) {
final TemplateElement rootTreeNode = template.getRootTreeNode();
return hasExpression(template, expression, rootTreeNode);
} | [
"public",
"static",
"boolean",
"hasExpression",
"(",
"final",
"Template",
"template",
",",
"final",
"String",
"expression",
")",
"{",
"final",
"TemplateElement",
"rootTreeNode",
"=",
"template",
".",
"getRootTreeNode",
"(",
")",
";",
"return",
"hasExpression",
"("... | Determines whether exists a variable specified by the given expression
in the specified template.
@param template the specified template
@param expression the given expression, for example,
"${aVariable}", "<#list recentComments as comment>"
@return {@code true} if it exists, returns {@code false} otherwise | [
"Determines",
"whether",
"exists",
"a",
"variable",
"specified",
"by",
"the",
"given",
"expression",
"in",
"the",
"specified",
"template",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Templates.java#L53-L57 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraph.java | ManagementGraph.getGroupVerticesInTopologicalOrder | public List<ManagementGroupVertex> getGroupVerticesInTopologicalOrder() {
final List<ManagementGroupVertex> topologicalSort = new ArrayList<ManagementGroupVertex>();
final Deque<ManagementGroupVertex> noIncomingEdges = new ArrayDeque<ManagementGroupVertex>();
final Map<ManagementGroupVertex, Integer> indegrees = new HashMap<ManagementGroupVertex, Integer>();
final Iterator<ManagementGroupVertex> it = new ManagementGroupVertexIterator(this, true, -1);
while (it.hasNext()) {
final ManagementGroupVertex groupVertex = it.next();
indegrees.put(groupVertex, Integer.valueOf(groupVertex.getNumberOfBackwardEdges()));
if (groupVertex.getNumberOfBackwardEdges() == 0) {
noIncomingEdges.add(groupVertex);
}
}
while (!noIncomingEdges.isEmpty()) {
final ManagementGroupVertex groupVertex = noIncomingEdges.removeFirst();
topologicalSort.add(groupVertex);
// Decrease indegree of connected vertices
for (int i = 0; i < groupVertex.getNumberOfForwardEdges(); i++) {
final ManagementGroupVertex targetVertex = groupVertex.getForwardEdge(i).getTarget();
Integer indegree = indegrees.get(targetVertex);
indegree = Integer.valueOf(indegree.intValue() - 1);
indegrees.put(targetVertex, indegree);
if (indegree.intValue() == 0) {
noIncomingEdges.add(targetVertex);
}
}
}
return topologicalSort;
} | java | public List<ManagementGroupVertex> getGroupVerticesInTopologicalOrder() {
final List<ManagementGroupVertex> topologicalSort = new ArrayList<ManagementGroupVertex>();
final Deque<ManagementGroupVertex> noIncomingEdges = new ArrayDeque<ManagementGroupVertex>();
final Map<ManagementGroupVertex, Integer> indegrees = new HashMap<ManagementGroupVertex, Integer>();
final Iterator<ManagementGroupVertex> it = new ManagementGroupVertexIterator(this, true, -1);
while (it.hasNext()) {
final ManagementGroupVertex groupVertex = it.next();
indegrees.put(groupVertex, Integer.valueOf(groupVertex.getNumberOfBackwardEdges()));
if (groupVertex.getNumberOfBackwardEdges() == 0) {
noIncomingEdges.add(groupVertex);
}
}
while (!noIncomingEdges.isEmpty()) {
final ManagementGroupVertex groupVertex = noIncomingEdges.removeFirst();
topologicalSort.add(groupVertex);
// Decrease indegree of connected vertices
for (int i = 0; i < groupVertex.getNumberOfForwardEdges(); i++) {
final ManagementGroupVertex targetVertex = groupVertex.getForwardEdge(i).getTarget();
Integer indegree = indegrees.get(targetVertex);
indegree = Integer.valueOf(indegree.intValue() - 1);
indegrees.put(targetVertex, indegree);
if (indegree.intValue() == 0) {
noIncomingEdges.add(targetVertex);
}
}
}
return topologicalSort;
} | [
"public",
"List",
"<",
"ManagementGroupVertex",
">",
"getGroupVerticesInTopologicalOrder",
"(",
")",
"{",
"final",
"List",
"<",
"ManagementGroupVertex",
">",
"topologicalSort",
"=",
"new",
"ArrayList",
"<",
"ManagementGroupVertex",
">",
"(",
")",
";",
"final",
"Dequ... | Returns a list of group vertices sorted in topological order.
@return a list of group vertices sorted in topological order | [
"Returns",
"a",
"list",
"of",
"group",
"vertices",
"sorted",
"in",
"topological",
"order",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraph.java#L332-L365 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/OverlayItem.java | OverlayItem.getMarker | public Drawable getMarker(final int stateBitset) {
// marker not specified
if (mMarker == null) {
return null;
}
// set marker state appropriately
setState(mMarker, stateBitset);
return mMarker;
} | java | public Drawable getMarker(final int stateBitset) {
// marker not specified
if (mMarker == null) {
return null;
}
// set marker state appropriately
setState(mMarker, stateBitset);
return mMarker;
} | [
"public",
"Drawable",
"getMarker",
"(",
"final",
"int",
"stateBitset",
")",
"{",
"// marker not specified",
"if",
"(",
"mMarker",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// set marker state appropriately",
"setState",
"(",
"mMarker",
",",
"stateBitset... | /*
(copied from Google API docs) Returns the marker that should be used when drawing this item
on the map. A null value means that the default marker should be drawn. Different markers can
be returned for different states. The different markers can have different bounds. The
default behavior is to call {@link setState(android.graphics.drawable.Drawable, int)} on the
overlay item's marker, if it exists, and then return it.
@param stateBitset The current state.
@return The marker for the current state, or null if the default marker for the overlay
should be used. | [
"/",
"*",
"(",
"copied",
"from",
"Google",
"API",
"docs",
")",
"Returns",
"the",
"marker",
"that",
"should",
"be",
"used",
"when",
"drawing",
"this",
"item",
"on",
"the",
"map",
".",
"A",
"null",
"value",
"means",
"that",
"the",
"default",
"marker",
"s... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/OverlayItem.java#L104-L113 |
reactor/reactor-netty | src/main/java/reactor/netty/FutureMono.java | FutureMono.disposableWriteAndFlush | public static Mono<Void> disposableWriteAndFlush(Channel channel,
Publisher<?> dataStream) {
return new DeferredWriteMono(channel, dataStream);
} | java | public static Mono<Void> disposableWriteAndFlush(Channel channel,
Publisher<?> dataStream) {
return new DeferredWriteMono(channel, dataStream);
} | [
"public",
"static",
"Mono",
"<",
"Void",
">",
"disposableWriteAndFlush",
"(",
"Channel",
"channel",
",",
"Publisher",
"<",
"?",
">",
"dataStream",
")",
"{",
"return",
"new",
"DeferredWriteMono",
"(",
"channel",
",",
"dataStream",
")",
";",
"}"
] | Write the passed {@link Publisher} and return a disposable {@link Mono}.
<p>
In addition, current method allows interaction with downstream context, so it
may be transferred to implicitly connected upstream
<p>
Example:
<p>
<pre><code>
Flux<String> dataStream = Flux.just("a", "b", "c");
FutureMono.deferFutureWithContext((subscriberContext) ->
context().channel()
.writeAndFlush(PublisherContext.withContext(dataStream, subscriberContext)));
</code></pre>
@param dataStream the publisher to write
@return A {@link Mono} forwarding {@link Future} success, failure and cancel | [
"Write",
"the",
"passed",
"{",
"@link",
"Publisher",
"}",
"and",
"return",
"a",
"disposable",
"{",
"@link",
"Mono",
"}",
".",
"<p",
">",
"In",
"addition",
"current",
"method",
"allows",
"interaction",
"with",
"downstream",
"context",
"so",
"it",
"may",
"be... | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/FutureMono.java#L100-L103 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java | TransactionEventListener.addMeterValueToTransaction | private void addMeterValueToTransaction(final Transaction transaction, final MeterValue meterValue) {
if (meterValue.getUnit() == UnitOfMeasure.WATT_HOUR || meterValue.getUnit() == UnitOfMeasure.KILOWATT_HOUR) {
try {
transaction.getMeterValues().add(toOperatorApiMeterValue(meterValue));
} catch (Throwable t) {
// Catching a Throwable here because we want to ensure other MeterValues are processed even if this one
// fails (for whatever reason!).
LOG.info(String.format("Skipping adding MeterValue [%s] to Transaction [%s] because an Exception was thrown", meterValue, transaction.getTransactionId()), t);
}
} else {
LOG.info("Skipping adding MeterValue [{}] to Transaction [{}] because UnitOfMeasure is not WATT_HOUR or KILOWATT_HOUR", meterValue, transaction.getTransactionId());
}
} | java | private void addMeterValueToTransaction(final Transaction transaction, final MeterValue meterValue) {
if (meterValue.getUnit() == UnitOfMeasure.WATT_HOUR || meterValue.getUnit() == UnitOfMeasure.KILOWATT_HOUR) {
try {
transaction.getMeterValues().add(toOperatorApiMeterValue(meterValue));
} catch (Throwable t) {
// Catching a Throwable here because we want to ensure other MeterValues are processed even if this one
// fails (for whatever reason!).
LOG.info(String.format("Skipping adding MeterValue [%s] to Transaction [%s] because an Exception was thrown", meterValue, transaction.getTransactionId()), t);
}
} else {
LOG.info("Skipping adding MeterValue [{}] to Transaction [{}] because UnitOfMeasure is not WATT_HOUR or KILOWATT_HOUR", meterValue, transaction.getTransactionId());
}
} | [
"private",
"void",
"addMeterValueToTransaction",
"(",
"final",
"Transaction",
"transaction",
",",
"final",
"MeterValue",
"meterValue",
")",
"{",
"if",
"(",
"meterValue",
".",
"getUnit",
"(",
")",
"==",
"UnitOfMeasure",
".",
"WATT_HOUR",
"||",
"meterValue",
".",
... | Adds a single {@code MeterValue} to the {@code Transaction}.
<p/>
If a {@code MeterValue} cannot be added this method will skip adding it, won't throw an exception, and log that
this occurred and why.
@param transaction the {@code Transaction} to which to add the {@code MeterValue}.
@param meterValue the {@code MeterValue} to add. | [
"Adds",
"a",
"single",
"{",
"@code",
"MeterValue",
"}",
"to",
"the",
"{",
"@code",
"Transaction",
"}",
".",
"<p",
"/",
">",
"If",
"a",
"{",
"@code",
"MeterValue",
"}",
"cannot",
"be",
"added",
"this",
"method",
"will",
"skip",
"adding",
"it",
"won",
... | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java#L102-L114 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java | MeasureUnit.resolveUnitPerUnit | @Deprecated
public static MeasureUnit resolveUnitPerUnit(MeasureUnit unit, MeasureUnit perUnit) {
return unitPerUnitToSingleUnit.get(Pair.of(unit, perUnit));
} | java | @Deprecated
public static MeasureUnit resolveUnitPerUnit(MeasureUnit unit, MeasureUnit perUnit) {
return unitPerUnitToSingleUnit.get(Pair.of(unit, perUnit));
} | [
"@",
"Deprecated",
"public",
"static",
"MeasureUnit",
"resolveUnitPerUnit",
"(",
"MeasureUnit",
"unit",
",",
"MeasureUnit",
"perUnit",
")",
"{",
"return",
"unitPerUnitToSingleUnit",
".",
"get",
"(",
"Pair",
".",
"of",
"(",
"unit",
",",
"perUnit",
")",
")",
";"... | For ICU use only.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"For",
"ICU",
"use",
"only",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java#L199-L202 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java | ESFilterBuilder.populateLikeQuery | private QueryBuilder populateLikeQuery(LikeExpression likeExpression, EntityMetadata metadata)
{
Expression patternValue = likeExpression.getPatternValue();
String field = likeExpression.getStringExpression().toString();
String likePattern = (patternValue instanceof InputParameter) ? kunderaQuery.getParametersMap()
.get((patternValue).toParsedText()).toString() : patternValue.toParsedText().toString();
String jpaField = getField(field);
log.debug("Pattern value for field " + field + " is: " + patternValue);
QueryBuilder filterBuilder = getQueryBuilder(kunderaQuery.new FilterClause(jpaField, Expression.LIKE,
likePattern, field), metadata);
return filterBuilder;
} | java | private QueryBuilder populateLikeQuery(LikeExpression likeExpression, EntityMetadata metadata)
{
Expression patternValue = likeExpression.getPatternValue();
String field = likeExpression.getStringExpression().toString();
String likePattern = (patternValue instanceof InputParameter) ? kunderaQuery.getParametersMap()
.get((patternValue).toParsedText()).toString() : patternValue.toParsedText().toString();
String jpaField = getField(field);
log.debug("Pattern value for field " + field + " is: " + patternValue);
QueryBuilder filterBuilder = getQueryBuilder(kunderaQuery.new FilterClause(jpaField, Expression.LIKE,
likePattern, field), metadata);
return filterBuilder;
} | [
"private",
"QueryBuilder",
"populateLikeQuery",
"(",
"LikeExpression",
"likeExpression",
",",
"EntityMetadata",
"metadata",
")",
"{",
"Expression",
"patternValue",
"=",
"likeExpression",
".",
"getPatternValue",
"(",
")",
";",
"String",
"field",
"=",
"likeExpression",
... | Populate like query.
@param likeExpression
the like expression
@param metadata
the metadata
@return the filter builder | [
"Populate",
"like",
"query",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L150-L164 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/meta/AlternateContentConfigProcessor.java | AlternateContentConfigProcessor.getAlternateContentDirectory | public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory());
}
} catch(Exception e) {
logger.warn("Failed to process config: "+ configuration.getPattern()+"->"+ configuration.getContentDirectory(), e);
}
}
return null;
} | java | public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory());
}
} catch(Exception e) {
logger.warn("Failed to process config: "+ configuration.getPattern()+"->"+ configuration.getContentDirectory(), e);
}
}
return null;
} | [
"public",
"File",
"getAlternateContentDirectory",
"(",
"String",
"userAgent",
")",
"{",
"Configuration",
"config",
"=",
"liveConfig",
";",
"for",
"(",
"AlternateContent",
"configuration",
":",
"config",
".",
"configs",
")",
"{",
"try",
"{",
"if",
"(",
"configura... | Iterates through AlternateContent objects trying to match against their pre compiled pattern.
@param userAgent The userAgent request header.
@return the ContentDirectory of the matched AlternateContent instance or null if none are found. | [
"Iterates",
"through",
"AlternateContent",
"objects",
"trying",
"to",
"match",
"against",
"their",
"pre",
"compiled",
"pattern",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/meta/AlternateContentConfigProcessor.java#L75-L87 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/metric/directed/EdgeMetrics.java | EdgeMetrics.run | @Override
public EdgeMetrics<K, VV, EV> run(Graph<K, VV, EV> input)
throws Exception {
super.run(input);
// s, t, (d(s), d(t))
DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> edgeDegreesPair = input
.run(new EdgeDegreesPair<K, VV, EV>()
.setParallelism(parallelism));
// s, d(s), count of (u, v) where deg(u) < deg(v) or (deg(u) == deg(v) and u < v)
DataSet<Tuple3<K, Degrees, LongValue>> edgeStats = edgeDegreesPair
.flatMap(new EdgeStats<>())
.setParallelism(parallelism)
.name("Edge stats")
.groupBy(0, 1)
.reduceGroup(new ReduceEdgeStats<>())
.setParallelism(parallelism)
.name("Reduce edge stats")
.groupBy(0)
.reduce(new SumEdgeStats<>())
.setCombineHint(CombineHint.HASH)
.setParallelism(parallelism)
.name("Sum edge stats");
edgeMetricsHelper = new EdgeMetricsHelper<>();
edgeStats
.output(edgeMetricsHelper)
.setParallelism(parallelism)
.name("Edge metrics");
return this;
} | java | @Override
public EdgeMetrics<K, VV, EV> run(Graph<K, VV, EV> input)
throws Exception {
super.run(input);
// s, t, (d(s), d(t))
DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> edgeDegreesPair = input
.run(new EdgeDegreesPair<K, VV, EV>()
.setParallelism(parallelism));
// s, d(s), count of (u, v) where deg(u) < deg(v) or (deg(u) == deg(v) and u < v)
DataSet<Tuple3<K, Degrees, LongValue>> edgeStats = edgeDegreesPair
.flatMap(new EdgeStats<>())
.setParallelism(parallelism)
.name("Edge stats")
.groupBy(0, 1)
.reduceGroup(new ReduceEdgeStats<>())
.setParallelism(parallelism)
.name("Reduce edge stats")
.groupBy(0)
.reduce(new SumEdgeStats<>())
.setCombineHint(CombineHint.HASH)
.setParallelism(parallelism)
.name("Sum edge stats");
edgeMetricsHelper = new EdgeMetricsHelper<>();
edgeStats
.output(edgeMetricsHelper)
.setParallelism(parallelism)
.name("Edge metrics");
return this;
} | [
"@",
"Override",
"public",
"EdgeMetrics",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"run",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"input",
")",
"throws",
"Exception",
"{",
"super",
".",
"run",
"(",
"input",
")",
";",
"// s, t, (d(s), d(t))",
... | /*
Implementation notes:
<p>Use aggregator to replace SumEdgeStats when aggregators are rewritten to use
a hash-combineable hashable-reduce.
<p>Use distinct to replace ReduceEdgeStats when the combiner can be disabled
with a sorted-reduce forced. | [
"/",
"*",
"Implementation",
"notes",
":"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/metric/directed/EdgeMetrics.java#L83-L116 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookUpdater.java | WebhookUpdater.setAvatar | public WebhookUpdater setAvatar(BufferedImage avatar, String fileType) {
delegate.setAvatar(avatar, fileType);
return this;
} | java | public WebhookUpdater setAvatar(BufferedImage avatar, String fileType) {
delegate.setAvatar(avatar, fileType);
return this;
} | [
"public",
"WebhookUpdater",
"setAvatar",
"(",
"BufferedImage",
"avatar",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setAvatar",
"(",
"avatar",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Queues the avatar to be updated.
@param avatar The avatar to set.
@param fileType The type of the avatar, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Queues",
"the",
"avatar",
"to",
"be",
"updated",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookUpdater.java#L85-L88 |
notnoop/java-apns | src/main/java/com/notnoop/apns/ApnsServiceBuilder.java | ApnsServiceBuilder.withAuthProxy | public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) {
this.proxy = proxy;
this.proxyUsername = proxyUsername;
this.proxyPassword = proxyPassword;
return this;
} | java | public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) {
this.proxy = proxy;
this.proxyUsername = proxyUsername;
this.proxyPassword = proxyPassword;
return this;
} | [
"public",
"ApnsServiceBuilder",
"withAuthProxy",
"(",
"Proxy",
"proxy",
",",
"String",
"proxyUsername",
",",
"String",
"proxyPassword",
")",
"{",
"this",
".",
"proxy",
"=",
"proxy",
";",
"this",
".",
"proxyUsername",
"=",
"proxyUsername",
";",
"this",
".",
"pr... | Specify the proxy and the authentication parameters to be used
to establish the connections to Apple Servers.
<p>Read the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html">
Java Networking and Proxies</a> guide to understand the
proxies complexity.
@param proxy the proxy object to be used to create connections
@param proxyUsername a String object representing the username of the proxy server
@param proxyPassword a String object representing the password of the proxy server
@return this | [
"Specify",
"the",
"proxy",
"and",
"the",
"authentication",
"parameters",
"to",
"be",
"used",
"to",
"establish",
"the",
"connections",
"to",
"Apple",
"Servers",
"."
] | train | https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/ApnsServiceBuilder.java#L488-L493 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/Ansi.java | Ansi.outFormat | public void outFormat(String format, Object... args){
format(System.out, format, args);
} | java | public void outFormat(String format, Object... args){
format(System.out, format, args);
} | [
"public",
"void",
"outFormat",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"format",
"(",
"System",
".",
"out",
",",
"format",
",",
"args",
")",
";",
"}"
] | Prints formatted and colorized {@code format} to {@link System#out}
@param format A format string whose output to be colorized
@param args Arguments referenced by the format specifiers in the format | [
"Prints",
"formatted",
"and",
"colorized",
"{",
"@code",
"format",
"}",
"to",
"{",
"@link",
"System#out",
"}"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/Ansi.java#L306-L308 |
AgNO3/jcifs-ng | src/main/java/jcifs/internal/smb1/AndXServerMessageBlock.java | AndXServerMessageBlock.encode | @Override
public int encode ( byte[] dst, int dstIndex ) {
int start = this.headerStart = dstIndex;
dstIndex += writeHeaderWireFormat(dst, dstIndex);
dstIndex += writeAndXWireFormat(dst, dstIndex);
this.length = dstIndex - start;
if ( this.digest != null ) {
this.digest.sign(dst, this.headerStart, this.length, this, this.getResponse());
}
return this.length;
} | java | @Override
public int encode ( byte[] dst, int dstIndex ) {
int start = this.headerStart = dstIndex;
dstIndex += writeHeaderWireFormat(dst, dstIndex);
dstIndex += writeAndXWireFormat(dst, dstIndex);
this.length = dstIndex - start;
if ( this.digest != null ) {
this.digest.sign(dst, this.headerStart, this.length, this, this.getResponse());
}
return this.length;
} | [
"@",
"Override",
"public",
"int",
"encode",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstIndex",
")",
"{",
"int",
"start",
"=",
"this",
".",
"headerStart",
"=",
"dstIndex",
";",
"dstIndex",
"+=",
"writeHeaderWireFormat",
"(",
"dst",
",",
"dstIndex",
")"... | /*
We overload this method from ServerMessageBlock because
we want writeAndXWireFormat to write the parameterWords
and bytes. This is so we can write batched smbs because
all but the first smb of the chaain do not have a header
and therefore we do not want to writeHeaderWireFormat. We
just recursivly call writeAndXWireFormat. | [
"/",
"*",
"We",
"overload",
"this",
"method",
"from",
"ServerMessageBlock",
"because",
"we",
"want",
"writeAndXWireFormat",
"to",
"write",
"the",
"parameterWords",
"and",
"bytes",
".",
"This",
"is",
"so",
"we",
"can",
"write",
"batched",
"smbs",
"because",
"al... | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/internal/smb1/AndXServerMessageBlock.java#L135-L148 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Assert.java | Assert.notEmpty | public static void notEmpty(Map map, String message) {
if (Collections.isEmpty(map)) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(Map map, String message) {
if (Collections.isEmpty(map)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Map",
"map",
",",
"String",
"message",
")",
"{",
"if",
"(",
"Collections",
".",
"isEmpty",
"(",
"map",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] | Assert that a Map has entries; that is, it must not be <code>null</code>
and must have at least one entry.
<pre class="code">Assert.notEmpty(map, "Map must have entries");</pre>
@param map the map to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the map is <code>null</code> or has no entries | [
"Assert",
"that",
"a",
"Map",
"has",
"entries",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"must",
"have",
"at",
"least",
"one",
"entry",
".",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
"not... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L268-L272 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ARGBColorUtil.java | ARGBColorUtil.composite | public static int composite(final int foreground, final int background) {
double fA = getAlpha(foreground) / 255.0;
double bA = getAlpha(background) / 255.0;
if (bA <= 0.0001) return foreground;
else if (fA <= 0.0001) return background;
final double alphaA = bA * (1 - fA);
return getColor(
(int) (255 * (fA + alphaA)), // ALPHA
(int) (fA * getRed(foreground) + alphaA * getRed(background)), // RED
(int) (fA * getGreen(foreground) + alphaA * getGreen(background)), // GREEN
(int) (fA * getBlue(foreground) + alphaA * getBlue(background))); // BLUE
} | java | public static int composite(final int foreground, final int background) {
double fA = getAlpha(foreground) / 255.0;
double bA = getAlpha(background) / 255.0;
if (bA <= 0.0001) return foreground;
else if (fA <= 0.0001) return background;
final double alphaA = bA * (1 - fA);
return getColor(
(int) (255 * (fA + alphaA)), // ALPHA
(int) (fA * getRed(foreground) + alphaA * getRed(background)), // RED
(int) (fA * getGreen(foreground) + alphaA * getGreen(background)), // GREEN
(int) (fA * getBlue(foreground) + alphaA * getBlue(background))); // BLUE
} | [
"public",
"static",
"int",
"composite",
"(",
"final",
"int",
"foreground",
",",
"final",
"int",
"background",
")",
"{",
"double",
"fA",
"=",
"getAlpha",
"(",
"foreground",
")",
"/",
"255.0",
";",
"double",
"bA",
"=",
"getAlpha",
"(",
"background",
")",
"... | Composes two colors with the ARGB format: <br>
The format of the color integer is as follows: 0xAARRGGBB
Where:
<ol>
<li>AA is the alpha component (0-255)</li>
<li>RR is the red component (0-255)</li>
<li>GG is the green component (0-255)</li>
<li>BB is the blue component (0-255)</li>
</ol>
NOTE: The source of this method is quite obscure, but it's done this way because it's performance-critical (this method could be run thousands of times per second!)<br>
The code (unobscured) does this: <br><br>
<code>
double alpha1 = getAlpha(foreground) / 256.0;<br>
double alpha2 = getAlpha(background) / 256.0;<br>
<br>
if (alpha1 == 1.0 || alpha2 == 0) return foreground;<br>
else if (alpha1 == 0) return background;<br>
<br>
int red1 = getRed(foreground);<br>
int red2 = getRed(background);<br>
int green1 = getGreen(foreground);<br>
int green2 = getGreen(background);<br>
int blue1 = getBlue(foreground);<br>
int blue2 = getBlue(background);<br>
<br>
double doubleAlpha = (alpha1 + alpha2 * (1 - alpha1));<br>
int finalAlpha = (int) (doubleAlpha * 256);<br>
<br>
double cAlpha2 = alpha2 * (1 - alpha1) * 0.5;<br>
<br>
int finalRed = (int) (red1 * alpha1 + red2 * cAlpha2);<br>
int finalGreen = (int) (green1 * alpha1 + green2 * cAlpha2);<br>
int finalBlue = (int) (blue1 * alpha1 + blue2 * cAlpha2);<br>
return getColor(finalAlpha, finalRed, finalGreen, finalBlue);<br><br>
</code>
@param foreground The foreground color (above)
@param background The background color (below)
@return A composition of both colors, in ARGB format | [
"Composes",
"two",
"colors",
"with",
"the",
"ARGB",
"format",
":",
"<br",
">",
"The",
"format",
"of",
"the",
"color",
"integer",
"is",
"as",
"follows",
":",
"0xAARRGGBB",
"Where",
":",
"<ol",
">",
"<li",
">",
"AA",
"is",
"the",
"alpha",
"component",
"(... | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ARGBColorUtil.java#L89-L103 |
icode/ameba | src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java | AbstractTemplateProcessor.setContentType | protected Charset setContentType(MediaType mediaType, MultivaluedMap<String, Object> httpHeaders) {
String charset = mediaType.getParameters().get("charset");
Charset encoding;
MediaType finalMediaType;
if (charset == null) {
encoding = this.getEncoding();
HashMap<String, String> typeList = Maps.newHashMap(mediaType.getParameters());
typeList.put("charset", encoding.name());
finalMediaType = new MediaType(mediaType.getType(), mediaType.getSubtype(), typeList);
} else {
try {
encoding = Charset.forName(charset);
} catch (Exception e) {
encoding = Charsets.UTF_8;
}
finalMediaType = mediaType;
}
List<Object> typeList = Lists.newArrayListWithCapacity(1);
typeList.add(finalMediaType.toString());
httpHeaders.put("Content-Type", typeList);
return encoding;
} | java | protected Charset setContentType(MediaType mediaType, MultivaluedMap<String, Object> httpHeaders) {
String charset = mediaType.getParameters().get("charset");
Charset encoding;
MediaType finalMediaType;
if (charset == null) {
encoding = this.getEncoding();
HashMap<String, String> typeList = Maps.newHashMap(mediaType.getParameters());
typeList.put("charset", encoding.name());
finalMediaType = new MediaType(mediaType.getType(), mediaType.getSubtype(), typeList);
} else {
try {
encoding = Charset.forName(charset);
} catch (Exception e) {
encoding = Charsets.UTF_8;
}
finalMediaType = mediaType;
}
List<Object> typeList = Lists.newArrayListWithCapacity(1);
typeList.add(finalMediaType.toString());
httpHeaders.put("Content-Type", typeList);
return encoding;
} | [
"protected",
"Charset",
"setContentType",
"(",
"MediaType",
"mediaType",
",",
"MultivaluedMap",
"<",
"String",
",",
"Object",
">",
"httpHeaders",
")",
"{",
"String",
"charset",
"=",
"mediaType",
".",
"getParameters",
"(",
")",
".",
"get",
"(",
"\"charset\"",
"... | <p>setContentType.</p>
@param mediaType a {@link javax.ws.rs.core.MediaType} object.
@param httpHeaders a {@link javax.ws.rs.core.MultivaluedMap} object.
@return a {@link java.nio.charset.Charset} object.
@since 0.1.6e | [
"<p",
">",
"setContentType",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java#L166-L188 |
alkacon/opencms-core | src/org/opencms/search/CmsSearch.java | CmsSearch.addFieldQueryMustNot | public void addFieldQueryMustNot(String fieldName, String searchQuery) {
addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST_NOT);
} | java | public void addFieldQueryMustNot(String fieldName, String searchQuery) {
addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST_NOT);
} | [
"public",
"void",
"addFieldQueryMustNot",
"(",
"String",
"fieldName",
",",
"String",
"searchQuery",
")",
"{",
"addFieldQuery",
"(",
"fieldName",
",",
"searchQuery",
",",
"BooleanClause",
".",
"Occur",
".",
"MUST_NOT",
")",
";",
"}"
] | Adds an individual query for a search field that MUST NOT occur.<p>
If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])}
will be ignored and only the individual field search settings will be used.<p>
When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind:
All SHOULD clauses will be grouped and wrapped in one query,
all MUST and MUST_NOT clauses will be grouped in another query.
This means that at least one of the terms which are given as a SHOULD query must occur in the
search result.<p>
@param fieldName the field name
@param searchQuery the search query
@since 7.5.1 | [
"Adds",
"an",
"individual",
"query",
"for",
"a",
"search",
"field",
"that",
"MUST",
"NOT",
"occur",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearch.java#L209-L212 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/Environment.java | Environment.getAs | public <T> T getAs(String environmentVariableName, Class<T> type, T defaultValue) {
return environmentVariables().getAsType(environmentVariableName, type, defaultValue);
} | java | public <T> T getAs(String environmentVariableName, Class<T> type, T defaultValue) {
return environmentVariables().getAsType(environmentVariableName, type, defaultValue);
} | [
"public",
"<",
"T",
">",
"T",
"getAs",
"(",
"String",
"environmentVariableName",
",",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"defaultValue",
")",
"{",
"return",
"environmentVariables",
"(",
")",
".",
"getAsType",
"(",
"environmentVariableName",
",",
"type... | Returns the value set for the environment variable identified by the given name as the given {@link Class} type.
Returns the {@code defaultValue} if the named environment variable is not set.
@param <T> {@link Class} type to convert the environment variable value to.
@param environmentVariableName {@link String} name of the environment variable.
@param type {@link Class} type to convert the environment variable value to.
@param defaultValue the default value to return if the specified environment variable is not set.
@return the value set the environment variable identified by the given name as the given {@link Class} type
or {@code defaultValue} if the named environment variable is not set.
@see #environmentVariables() | [
"Returns",
"the",
"value",
"set",
"for",
"the",
"environment",
"variable",
"identified",
"by",
"the",
"given",
"name",
"as",
"the",
"given",
"{",
"@link",
"Class",
"}",
"type",
".",
"Returns",
"the",
"{",
"@code",
"defaultValue",
"}",
"if",
"the",
"named",... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/Environment.java#L263-L265 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java | JsonSerializationContext.addObjectId | public void addObjectId( Object object, ObjectIdSerializer<?> id ) {
if ( null == mapObjectId ) {
if ( useEqualityForObjectId ) {
mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>();
} else {
mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>();
}
}
mapObjectId.put( object, id );
} | java | public void addObjectId( Object object, ObjectIdSerializer<?> id ) {
if ( null == mapObjectId ) {
if ( useEqualityForObjectId ) {
mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>();
} else {
mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>();
}
}
mapObjectId.put( object, id );
} | [
"public",
"void",
"addObjectId",
"(",
"Object",
"object",
",",
"ObjectIdSerializer",
"<",
"?",
">",
"id",
")",
"{",
"if",
"(",
"null",
"==",
"mapObjectId",
")",
"{",
"if",
"(",
"useEqualityForObjectId",
")",
"{",
"mapObjectId",
"=",
"new",
"HashMap",
"<",
... | <p>addObjectId</p>
@param object a {@link java.lang.Object} object.
@param id a {@link com.github.nmorel.gwtjackson.client.ser.bean.ObjectIdSerializer} object. | [
"<p",
">",
"addObjectId<",
"/",
"p",
">"
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L574-L583 |
alkacon/opencms-core | src-modules/org/opencms/workplace/help/CmsHelpTemplateBean.java | CmsHelpTemplateBean.buildHtmlHelpStart | public String buildHtmlHelpStart(String cssFile, boolean transitional) {
StringBuffer result = new StringBuffer(8);
if (transitional) {
result.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
} else {
result.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n");
}
result.append("<html>\n");
result.append("<head>\n");
result.append("\t<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8");
result.append("\">\n");
result.append("\t<title>");
if (CmsStringUtil.isNotEmpty(getParamHelpresource())) {
result.append(getJsp().property(
CmsPropertyDefinition.PROPERTY_TITLE,
getParamHelpresource(),
key(Messages.GUI_HELP_FRAMESET_TITLE_0)));
} else {
result.append(key(Messages.GUI_HELP_FRAMESET_TITLE_0));
}
result.append("</title>\n");
result.append("\t<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(getStyleUri(getJsp(), cssFile)).append("\">\n");
result.append("</head>\n");
return result.toString();
} | java | public String buildHtmlHelpStart(String cssFile, boolean transitional) {
StringBuffer result = new StringBuffer(8);
if (transitional) {
result.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
} else {
result.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n");
}
result.append("<html>\n");
result.append("<head>\n");
result.append("\t<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8");
result.append("\">\n");
result.append("\t<title>");
if (CmsStringUtil.isNotEmpty(getParamHelpresource())) {
result.append(getJsp().property(
CmsPropertyDefinition.PROPERTY_TITLE,
getParamHelpresource(),
key(Messages.GUI_HELP_FRAMESET_TITLE_0)));
} else {
result.append(key(Messages.GUI_HELP_FRAMESET_TITLE_0));
}
result.append("</title>\n");
result.append("\t<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(getStyleUri(getJsp(), cssFile)).append("\">\n");
result.append("</head>\n");
return result.toString();
} | [
"public",
"String",
"buildHtmlHelpStart",
"(",
"String",
"cssFile",
",",
"boolean",
"transitional",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"8",
")",
";",
"if",
"(",
"transitional",
")",
"{",
"result",
".",
"append",
"(",
"\"<!DO... | Returns the HTML for the start of the page.<p>
@param cssFile the CSS file name to use
@param transitional if true, transitional doctype is used
@return the HTML for the start of the page | [
"Returns",
"the",
"HTML",
"for",
"the",
"start",
"of",
"the",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/help/CmsHelpTemplateBean.java#L216-L242 |
CloudSlang/cs-actions | cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java | WSManRemoteShellService.executionIsTimedOut | private boolean executionIsTimedOut(long aStartTime, int aTimeout) {
if (aTimeout != 0) {
long now = System.currentTimeMillis() / 1000;
if ((now - aStartTime) >= aTimeout) {
return true;
}
}
return false;
} | java | private boolean executionIsTimedOut(long aStartTime, int aTimeout) {
if (aTimeout != 0) {
long now = System.currentTimeMillis() / 1000;
if ((now - aStartTime) >= aTimeout) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"executionIsTimedOut",
"(",
"long",
"aStartTime",
",",
"int",
"aTimeout",
")",
"{",
"if",
"(",
"aTimeout",
"!=",
"0",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
";",
"if",
"(",
"(",
"n... | Check whether or not the command execution reach the timeout value.
@param aStartTime A start time in seconds.
@param aTimeout A timeout value in seconds.
@return true if it reaches timeout. | [
"Check",
"whether",
"or",
"not",
"the",
"command",
"execution",
"reach",
"the",
"timeout",
"value",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L381-L389 |
jblas-project/jblas | src/main/java/org/jblas/ComplexFloat.java | ComplexFloat.addi | public ComplexFloat addi(float a, ComplexFloat result) {
if (this == result) {
r += a;
} else {
result.r = r + a;
result.i = i;
}
return result;
} | java | public ComplexFloat addi(float a, ComplexFloat result) {
if (this == result) {
r += a;
} else {
result.r = r + a;
result.i = i;
}
return result;
} | [
"public",
"ComplexFloat",
"addi",
"(",
"float",
"a",
",",
"ComplexFloat",
"result",
")",
"{",
"if",
"(",
"this",
"==",
"result",
")",
"{",
"r",
"+=",
"a",
";",
"}",
"else",
"{",
"result",
".",
"r",
"=",
"r",
"+",
"a",
";",
"result",
".",
"i",
"... | Add a real number to a complex number in-place.
@param a real number to add
@param result complex number to hold result
@return same as result | [
"Add",
"a",
"real",
"number",
"to",
"a",
"complex",
"number",
"in",
"-",
"place",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexFloat.java#L139-L147 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.executePut | private HttpResponse executePut(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap, Object data, int length)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
return executePut(bucketName, objectName, headerMap, queryParamMap, getRegion(bucketName), data, length);
} | java | private HttpResponse executePut(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap, Object data, int length)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
return executePut(bucketName, objectName, headerMap, queryParamMap, getRegion(bucketName), data, length);
} | [
"private",
"HttpResponse",
"executePut",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParamMap",
",",
"Object",
"data",
",",
"int",
... | Executes PUT method for given request parameters.
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@param headerMap Map of HTTP headers for the request.
@param queryParamMap Map of HTTP query parameters of the request.
@param data HTTP request body data.
@param length Length of HTTP request body data. | [
"Executes",
"PUT",
"method",
"for",
"given",
"request",
"parameters",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1422-L1428 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java | ExecutorServiceMetrics.monitor | public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Iterable<Tag> tags) {
if (executor instanceof ExecutorService) {
return monitor(registry, (ExecutorService) executor, executorName, tags);
}
return new TimedExecutor(registry, executor, executorName, tags);
} | java | public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Iterable<Tag> tags) {
if (executor instanceof ExecutorService) {
return monitor(registry, (ExecutorService) executor, executorName, tags);
}
return new TimedExecutor(registry, executor, executorName, tags);
} | [
"public",
"static",
"Executor",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"Executor",
"executor",
",",
"String",
"executorName",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"if",
"(",
"executor",
"instanceof",
"ExecutorService",
")",
"{",
"retu... | Record metrics on the use of an {@link Executor}.
@param registry The registry to bind metrics to.
@param executor The executor to instrument.
@param executorName Will be used to tag metrics with "name".
@param tags Tags to apply to all recorded metrics.
@return The instrumented executor, proxied. | [
"Record",
"metrics",
"on",
"the",
"use",
"of",
"an",
"{",
"@link",
"Executor",
"}",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L62-L67 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatter.java | DateTimeFormatter.parseDateTime | public DateTime parseDateTime(String text) {
InternalParser parser = requireParser();
Chronology chrono = selectChronology(null);
DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
int newPos = parser.parseInto(bucket, text, 0);
if (newPos >= 0) {
if (newPos >= text.length()) {
long millis = bucket.computeMillis(true, text);
if (iOffsetParsed && bucket.getOffsetInteger() != null) {
int parsedOffset = bucket.getOffsetInteger();
DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset);
chrono = chrono.withZone(parsedZone);
} else if (bucket.getZone() != null) {
chrono = chrono.withZone(bucket.getZone());
}
DateTime dt = new DateTime(millis, chrono);
if (iZone != null) {
dt = dt.withZone(iZone);
}
return dt;
}
} else {
newPos = ~newPos;
}
throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
} | java | public DateTime parseDateTime(String text) {
InternalParser parser = requireParser();
Chronology chrono = selectChronology(null);
DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
int newPos = parser.parseInto(bucket, text, 0);
if (newPos >= 0) {
if (newPos >= text.length()) {
long millis = bucket.computeMillis(true, text);
if (iOffsetParsed && bucket.getOffsetInteger() != null) {
int parsedOffset = bucket.getOffsetInteger();
DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset);
chrono = chrono.withZone(parsedZone);
} else if (bucket.getZone() != null) {
chrono = chrono.withZone(bucket.getZone());
}
DateTime dt = new DateTime(millis, chrono);
if (iZone != null) {
dt = dt.withZone(iZone);
}
return dt;
}
} else {
newPos = ~newPos;
}
throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
} | [
"public",
"DateTime",
"parseDateTime",
"(",
"String",
"text",
")",
"{",
"InternalParser",
"parser",
"=",
"requireParser",
"(",
")",
";",
"Chronology",
"chrono",
"=",
"selectChronology",
"(",
"null",
")",
";",
"DateTimeParserBucket",
"bucket",
"=",
"new",
"DateTi... | Parses a date-time from the given text, returning a new DateTime.
<p>
The parse will use the zone and chronology specified on this formatter.
<p>
If the text contains a time zone string then that will be taken into
account in adjusting the time of day as follows.
If the {@link #withOffsetParsed()} has been called, then the resulting
DateTime will have a fixed offset based on the parsed time zone.
Otherwise the resulting DateTime will have the zone of this formatter,
but the parsed zone may have caused the time to be adjusted.
@param text the text to parse, not null
@return the parsed date-time, never null
@throws UnsupportedOperationException if parsing is not supported
@throws IllegalArgumentException if the text to parse is invalid | [
"Parses",
"a",
"date",
"-",
"time",
"from",
"the",
"given",
"text",
"returning",
"a",
"new",
"DateTime",
".",
"<p",
">",
"The",
"parse",
"will",
"use",
"the",
"zone",
"and",
"chronology",
"specified",
"on",
"this",
"formatter",
".",
"<p",
">",
"If",
"t... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L920-L946 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.removeControlCharacters | public static String removeControlCharacters(String s, boolean removeCR)
{
String ret = s;
if(ret != null)
{
ret = ret.replaceAll("_x000D_","");
if(removeCR)
ret = ret.replaceAll("\r","");
}
return ret;
} | java | public static String removeControlCharacters(String s, boolean removeCR)
{
String ret = s;
if(ret != null)
{
ret = ret.replaceAll("_x000D_","");
if(removeCR)
ret = ret.replaceAll("\r","");
}
return ret;
} | [
"public",
"static",
"String",
"removeControlCharacters",
"(",
"String",
"s",
",",
"boolean",
"removeCR",
")",
"{",
"String",
"ret",
"=",
"s",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"ret",
"=",
"ret",
".",
"replaceAll",
"(",
"\"_x000D_\"",
",",
... | Remove any extraneous control characters from text fields.
@param s The string to have control characters removed
@param removeCR <CODE>true</CODE> if carriage returns should be removed
@return The given string with all control characters removed | [
"Remove",
"any",
"extraneous",
"control",
"characters",
"from",
"text",
"fields",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L538-L548 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.registerDefault | public Serializer registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
registry.registerDefault(baseType, serializer);
return this;
} | java | public Serializer registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
registry.registerDefault(baseType, serializer);
return this;
} | [
"public",
"Serializer",
"registerDefault",
"(",
"Class",
"<",
"?",
">",
"baseType",
",",
"Class",
"<",
"?",
"extends",
"TypeSerializer",
">",
"serializer",
")",
"{",
"registry",
".",
"registerDefault",
"(",
"baseType",
",",
"serializer",
")",
";",
"return",
... | Registers a default type serializer for the given base type.
<p>
Default serializers are used to serialize types for which no specific {@link TypeSerializer} is provided.
When a serializable type is {@link #register(Class) registered} without a {@link TypeSerializer}, the
first default serializer found for the given type is assigned as the serializer for that type. Default
serializers are evaluated against registered types in reverse insertion order, so default serializers
registered more recently take precedence over default serializers registered earlier.
<pre>
{@code
serializer.registerDefault(Serializable.class, SerializableSerializer.class);
serializer.register(SomeSerializable.class, 1);
}
</pre>
If an object of a type that has not been {@link #register(Class) registered} is
{@link #writeObject(Object) serialized} and {@link #isWhitelistRequired() whitelisting} is disabled,
the object will be serialized with the class name and a default serializer if one is found.
@param baseType The base type for which to register the default serializer. Types that extend the base
type and are registered without a specific {@link TypeSerializer} will be serialized
using the registered default {@link TypeSerializer}.
@param serializer The default type serializer with which to serialize instances of the base type.
@return The serializer.
@throws NullPointerException if either argument is {@code null} | [
"Registers",
"a",
"default",
"type",
"serializer",
"for",
"the",
"given",
"base",
"type",
".",
"<p",
">",
"Default",
"serializers",
"are",
"used",
"to",
"serialize",
"types",
"for",
"which",
"no",
"specific",
"{",
"@link",
"TypeSerializer",
"}",
"is",
"provi... | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L611-L614 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.setParameter | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + parameterIndex
+ " (values was " + holder.toString() + ")\n"
+ "Query - conn:" + protocol.getServerThreadId()
+ "(" + (protocol.isMasterConnection() ? "M" : "S") + ") ";
if (options.maxQuerySizeToLog > 0) {
error += " - \"";
if (sqlQuery.length() < options.maxQuerySizeToLog) {
error += sqlQuery;
} else {
error += sqlQuery.substring(0, options.maxQuerySizeToLog) + "...";
}
error += "\"";
} else {
error += " - \"" + sqlQuery + "\"";
}
logger.error(error);
throw ExceptionMapper.getSqlException(error);
}
} | java | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + parameterIndex
+ " (values was " + holder.toString() + ")\n"
+ "Query - conn:" + protocol.getServerThreadId()
+ "(" + (protocol.isMasterConnection() ? "M" : "S") + ") ";
if (options.maxQuerySizeToLog > 0) {
error += " - \"";
if (sqlQuery.length() < options.maxQuerySizeToLog) {
error += sqlQuery;
} else {
error += sqlQuery.substring(0, options.maxQuerySizeToLog) + "...";
}
error += "\"";
} else {
error += " - \"" + sqlQuery + "\"";
}
logger.error(error);
throw ExceptionMapper.getSqlException(error);
}
} | [
"public",
"void",
"setParameter",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"ParameterHolder",
"holder",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"parameterIndex",
">=",
"1",
"&&",
"parameterIndex",
"<",
"prepareResult",
".",
"getParamCount",
"(",... | Set parameter.
@param parameterIndex index
@param holder parameter holder
@throws SQLException if index position doesn't correspond to query parameters | [
"Set",
"parameter",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L442-L467 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java | GeometryTypeFromConstraint.geometryTypeFromConstraint | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
if(constraint.isEmpty() && numericPrecision > GeometryTypeCodes.GEOMETRYZM) {
return GeometryTypeCodes.GEOMETRY;
}
// Use Domain given parameters
if(numericPrecision <= GeometryTypeCodes.GEOMETRYZM) {
return numericPrecision;
}
// Use user defined constraint. Does not work with VIEW TABLE
Matcher matcher = TYPE_CODE_PATTERN.matcher(constraint);
if(matcher.find()) {
return Integer.valueOf(matcher.group(CODE_GROUP_ID));
} else {
return GeometryTypeCodes.GEOMETRY;
}
} | java | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
if(constraint.isEmpty() && numericPrecision > GeometryTypeCodes.GEOMETRYZM) {
return GeometryTypeCodes.GEOMETRY;
}
// Use Domain given parameters
if(numericPrecision <= GeometryTypeCodes.GEOMETRYZM) {
return numericPrecision;
}
// Use user defined constraint. Does not work with VIEW TABLE
Matcher matcher = TYPE_CODE_PATTERN.matcher(constraint);
if(matcher.find()) {
return Integer.valueOf(matcher.group(CODE_GROUP_ID));
} else {
return GeometryTypeCodes.GEOMETRY;
}
} | [
"public",
"static",
"int",
"geometryTypeFromConstraint",
"(",
"String",
"constraint",
",",
"int",
"numericPrecision",
")",
"{",
"if",
"(",
"constraint",
".",
"isEmpty",
"(",
")",
"&&",
"numericPrecision",
">",
"GeometryTypeCodes",
".",
"GEOMETRYZM",
")",
"{",
"r... | Convert H2 constraint string into a OGC geometry type index.
@param constraint SQL Constraint ex: ST_GeometryTypeCode(the_geom) = 5
@param numericPrecision This parameter is available if the user give domain
@return Geometry type code {@link org.h2gis.utilities.GeometryTypeCodes} | [
"Convert",
"H2",
"constraint",
"string",
"into",
"a",
"OGC",
"geometry",
"type",
"index",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java#L57-L72 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java | CxSmilesParser.processPositionalVariation | private static boolean processPositionalVariation(CharIter iter, CxSmilesState state) {
if (state.positionVar == null)
state.positionVar = new TreeMap<>();
while (iter.hasNext()) {
if (isDigit(iter.curr())) {
final int beg = processUnsignedInt(iter);
if (!iter.nextIf(':'))
return false;
List<Integer> endpoints = new ArrayList<>(6);
if (!processIntList(iter, DOT_SEPARATOR, endpoints))
return false;
iter.nextIf(',');
state.positionVar.put(beg, endpoints);
} else {
return true;
}
}
return false;
} | java | private static boolean processPositionalVariation(CharIter iter, CxSmilesState state) {
if (state.positionVar == null)
state.positionVar = new TreeMap<>();
while (iter.hasNext()) {
if (isDigit(iter.curr())) {
final int beg = processUnsignedInt(iter);
if (!iter.nextIf(':'))
return false;
List<Integer> endpoints = new ArrayList<>(6);
if (!processIntList(iter, DOT_SEPARATOR, endpoints))
return false;
iter.nextIf(',');
state.positionVar.put(beg, endpoints);
} else {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"processPositionalVariation",
"(",
"CharIter",
"iter",
",",
"CxSmilesState",
"state",
")",
"{",
"if",
"(",
"state",
".",
"positionVar",
"==",
"null",
")",
"state",
".",
"positionVar",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";"... | Positional variation/multi centre bonding. Describe as a begin atom and one or more end points.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not) | [
"Positional",
"variation",
"/",
"multi",
"centre",
"bonding",
".",
"Describe",
"as",
"a",
"begin",
"atom",
"and",
"one",
"or",
"more",
"end",
"points",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java#L337-L355 |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java | ConfigEvaluator.processReference | private ConfigElement.Reference processReference(ConfigElement.Reference reference, EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
// Note, ref attributes don't correspond to an attribute definition, so we will always resolve variables (ie, there is no way to specify
// substitution="deferred" for a ref attribute.
String resolvedId = context.resolveString(reference.getId(), ignoreWarnings);
if (reference.getId().equals(resolvedId)) {
return reference;
} else {
return new ConfigElement.Reference(reference.getPid(), resolvedId);
}
} | java | private ConfigElement.Reference processReference(ConfigElement.Reference reference, EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
// Note, ref attributes don't correspond to an attribute definition, so we will always resolve variables (ie, there is no way to specify
// substitution="deferred" for a ref attribute.
String resolvedId = context.resolveString(reference.getId(), ignoreWarnings);
if (reference.getId().equals(resolvedId)) {
return reference;
} else {
return new ConfigElement.Reference(reference.getPid(), resolvedId);
}
} | [
"private",
"ConfigElement",
".",
"Reference",
"processReference",
"(",
"ConfigElement",
".",
"Reference",
"reference",
",",
"EvaluationContext",
"context",
",",
"boolean",
"ignoreWarnings",
")",
"throws",
"ConfigEvaluatorException",
"{",
"// Note, ref attributes don't corresp... | Note, the "reference" here is something of the form:
<parent>
<child ref="someOtherElement"/>
</parent>
<otherElement id="someOtherElement"/>
This is not called for ibm:type="pid" references.
This method will resolve any variables in the ref attribute and return a new ConfigElement.Reference if anything changed.
@param reference The ConfigElement reference. Contains the element name and the ref attribute value
@param context
@param ignoreWarnings
@return
@throws ConfigEvaluatorException | [
"Note",
"the",
"reference",
"here",
"is",
"something",
"of",
"the",
"form",
":",
"<parent",
">",
"<child",
"ref",
"=",
"someOtherElement",
"/",
">",
"<",
"/",
"parent",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java#L1363-L1372 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/utils/ExpressionUtils.java | ExpressionUtils.getDateFormatter | public static DateTimeFormatter getDateFormatter(DateStyle dateStyle, boolean incTime) {
String format = dateStyle.equals(DateStyle.DAY_FIRST) ? "dd-MM-yyyy" : "MM-dd-yyyy";
return DateTimeFormatter.ofPattern(incTime ? format + " HH:mm" : format);
} | java | public static DateTimeFormatter getDateFormatter(DateStyle dateStyle, boolean incTime) {
String format = dateStyle.equals(DateStyle.DAY_FIRST) ? "dd-MM-yyyy" : "MM-dd-yyyy";
return DateTimeFormatter.ofPattern(incTime ? format + " HH:mm" : format);
} | [
"public",
"static",
"DateTimeFormatter",
"getDateFormatter",
"(",
"DateStyle",
"dateStyle",
",",
"boolean",
"incTime",
")",
"{",
"String",
"format",
"=",
"dateStyle",
".",
"equals",
"(",
"DateStyle",
".",
"DAY_FIRST",
")",
"?",
"\"dd-MM-yyyy\"",
":",
"\"MM-dd-yyyy... | Gets a formatter for dates or datetimes
@param dateStyle whether parsing should be day-first or month-first
@param incTime whether to include time
@return the formatter | [
"Gets",
"a",
"formatter",
"for",
"dates",
"or",
"datetimes"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/utils/ExpressionUtils.java#L105-L108 |
alkacon/opencms-core | src/org/opencms/ade/publish/CmsDirectPublishProject.java | CmsDirectPublishProject.addSubResources | protected void addSubResources(CmsObject cms, Set<CmsResource> resources) throws CmsException {
List<CmsResource> subResources = new ArrayList<CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(cms);
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource res : resources) {
if (res.isFolder()) {
try {
List<CmsResource> childrenOfCurrentResource = rootCms.readResources(
res.getRootPath(),
CmsResourceFilter.ALL,
true);
subResources.addAll(childrenOfCurrentResource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
resources.addAll(subResources);
} | java | protected void addSubResources(CmsObject cms, Set<CmsResource> resources) throws CmsException {
List<CmsResource> subResources = new ArrayList<CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(cms);
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource res : resources) {
if (res.isFolder()) {
try {
List<CmsResource> childrenOfCurrentResource = rootCms.readResources(
res.getRootPath(),
CmsResourceFilter.ALL,
true);
subResources.addAll(childrenOfCurrentResource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
resources.addAll(subResources);
} | [
"protected",
"void",
"addSubResources",
"(",
"CmsObject",
"cms",
",",
"Set",
"<",
"CmsResource",
">",
"resources",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsResource",
">",
"subResources",
"=",
"new",
"ArrayList",
"<",
"CmsResource",
">",
"(",
")",
... | Adds contents of folders to a list of resources.<p>
@param cms the CMS context to use
@param resources the resource list to which to add the folder contents
@throws CmsException if something goes wrong | [
"Adds",
"contents",
"of",
"folders",
"to",
"a",
"list",
"of",
"resources",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsDirectPublishProject.java#L146-L165 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.updateTable | private void updateTable(KsDef ksDef, TableInfo tableInfo) throws Exception
{
for (CfDef cfDef : ksDef.getCf_defs())
{
if (cfDef.getName().equals(tableInfo.getTableName())
&& cfDef.getColumn_type().equals(ColumnFamilyType.getInstanceOf(tableInfo.getType()).name()))
{
boolean toUpdate = false;
if (cfDef.getColumn_type().equals(STANDARDCOLUMNFAMILY))
{
for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
{
toUpdate = isCfDefUpdated(columnInfo, cfDef, isCql3Enabled(tableInfo),
isCounterColumnType(tableInfo, null), tableInfo) ? true : toUpdate;
}
}
if (toUpdate)
{
cassandra_client.system_update_column_family(cfDef);
}
createIndexUsingThrift(tableInfo, cfDef);
break;
}
}
} | java | private void updateTable(KsDef ksDef, TableInfo tableInfo) throws Exception
{
for (CfDef cfDef : ksDef.getCf_defs())
{
if (cfDef.getName().equals(tableInfo.getTableName())
&& cfDef.getColumn_type().equals(ColumnFamilyType.getInstanceOf(tableInfo.getType()).name()))
{
boolean toUpdate = false;
if (cfDef.getColumn_type().equals(STANDARDCOLUMNFAMILY))
{
for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
{
toUpdate = isCfDefUpdated(columnInfo, cfDef, isCql3Enabled(tableInfo),
isCounterColumnType(tableInfo, null), tableInfo) ? true : toUpdate;
}
}
if (toUpdate)
{
cassandra_client.system_update_column_family(cfDef);
}
createIndexUsingThrift(tableInfo, cfDef);
break;
}
}
} | [
"private",
"void",
"updateTable",
"(",
"KsDef",
"ksDef",
",",
"TableInfo",
"tableInfo",
")",
"throws",
"Exception",
"{",
"for",
"(",
"CfDef",
"cfDef",
":",
"ksDef",
".",
"getCf_defs",
"(",
")",
")",
"{",
"if",
"(",
"cfDef",
".",
"getName",
"(",
")",
".... | Update table.
@param ksDef
the ks def
@param tableInfo
the table info
@throws Exception
the exception | [
"Update",
"table",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L1969-L1993 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java | DocFile.readResource | private static int readResource(DocPath resource, InputStream in, byte[] buf) throws ResourceIOException {
try {
return in.read(buf);
} catch (IOException e) {
throw new ResourceIOException(resource, e);
}
} | java | private static int readResource(DocPath resource, InputStream in, byte[] buf) throws ResourceIOException {
try {
return in.read(buf);
} catch (IOException e) {
throw new ResourceIOException(resource, e);
}
} | [
"private",
"static",
"int",
"readResource",
"(",
"DocPath",
"resource",
",",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buf",
")",
"throws",
"ResourceIOException",
"{",
"try",
"{",
"return",
"in",
".",
"read",
"(",
"buf",
")",
";",
"}",
"catch",
"(",
... | Reads from an input stream opened from a given resource into a given buffer.
If an IOException occurs, it is wrapped in a ResourceIOException.
@param resource the resource for the stream
@param in the stream
@param buf the buffer
@return the number of bytes read, or -1 if at end of file
@throws ResourceIOException if an exception occurred while reading the stream | [
"Reads",
"from",
"an",
"input",
"stream",
"opened",
"from",
"a",
"given",
"resource",
"into",
"a",
"given",
"buffer",
".",
"If",
"an",
"IOException",
"occurs",
"it",
"is",
"wrapped",
"in",
"a",
"ResourceIOException",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java#L335-L341 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateObject | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateObject",
"(",
"int",
"arg0",
",",
"Object",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateObject",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"catch",
"(",
"SQLEx... | Updates a column with an Object value. The updateXXX methods are used to update column values in
the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnIndex - the first column is 1, the second is 2, ...
x - the new column value
scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after
the decimal. For all other types this value will be ignored.
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"an",
"Object",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do",
"not",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4113-L4123 |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/AmazonEC2Client.java | AmazonEC2Client.dryRun | public <X extends AmazonWebServiceRequest> DryRunResult<X> dryRun(DryRunSupportedRequest<X> request) throws AmazonServiceException, AmazonClientException {
Request<X> dryRunRequest = request.getDryRunRequest();
ExecutionContext executionContext = createExecutionContext(dryRunRequest);
try {
invoke(dryRunRequest, new StaxResponseHandler<Void>(new VoidStaxUnmarshaller<Void>()), executionContext);
throw new AmazonClientException("Unrecognized service response for the dry-run request.");
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equals("DryRunOperation") && ase.getStatusCode() == 412) {
return new DryRunResult<X>(true, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("UnauthorizedOperation") && ase.getStatusCode() == 403) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("AuthFailure")) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
}
throw new AmazonClientException("Unrecognized service response for the dry-run request.", ase);
}
} | java | public <X extends AmazonWebServiceRequest> DryRunResult<X> dryRun(DryRunSupportedRequest<X> request) throws AmazonServiceException, AmazonClientException {
Request<X> dryRunRequest = request.getDryRunRequest();
ExecutionContext executionContext = createExecutionContext(dryRunRequest);
try {
invoke(dryRunRequest, new StaxResponseHandler<Void>(new VoidStaxUnmarshaller<Void>()), executionContext);
throw new AmazonClientException("Unrecognized service response for the dry-run request.");
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equals("DryRunOperation") && ase.getStatusCode() == 412) {
return new DryRunResult<X>(true, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("UnauthorizedOperation") && ase.getStatusCode() == 403) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("AuthFailure")) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
}
throw new AmazonClientException("Unrecognized service response for the dry-run request.", ase);
}
} | [
"public",
"<",
"X",
"extends",
"AmazonWebServiceRequest",
">",
"DryRunResult",
"<",
"X",
">",
"dryRun",
"(",
"DryRunSupportedRequest",
"<",
"X",
">",
"request",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"Request",
"<",
"X",
">",
... | Checks whether you have the required permissions for the provided Amazon EC2 operation, without actually running
it. The returned DryRunResult object contains the information of whether the dry-run was successful. This method
will throw exception when the service response does not clearly indicate whether you have the permission.
@param request
The request object for any Amazon EC2 operation supported with dry-run.
@return A DryRunResult object that contains the information of whether the dry-run was successful.
@throws AmazonClientException
If any internal errors are encountered inside the client while attempting to make the request or handle
the response. Or if the service response does not clearly indicate whether you have the permission.
@throws AmazonServiceException
If an error response is returned by Amazon EC2 indicating either a problem with the data in the request,
or a server side issue. | [
"Checks",
"whether",
"you",
"have",
"the",
"required",
"permissions",
"for",
"the",
"provided",
"Amazon",
"EC2",
"operation",
"without",
"actually",
"running",
"it",
".",
"The",
"returned",
"DryRunResult",
"object",
"contains",
"the",
"information",
"of",
"whether... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/AmazonEC2Client.java#L20301-L20317 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.updateServiceInstanceUri | public void updateServiceInstanceUri(String serviceName, String instanceId, String uri, final RegistrationCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceUri);
UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | java | public void updateServiceInstanceUri(String serviceName, String instanceId, String uri, final RegistrationCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceUri);
UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | [
"public",
"void",
"updateServiceInstanceUri",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"String",
"uri",
",",
"final",
"RegistrationCallback",
"cb",
",",
"Object",
"context",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
... | Update ServiceInstance URI in Callback.
@param serviceName
the service name.
@param instanceId
the instanceId.
@param uri
the new URI.
@param cb
the Callback.
@param context
the object context. | [
"Update",
"ServiceInstance",
"URI",
"in",
"Callback",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L614-L629 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.java | BaseMenuPresenter.getItemView | public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) {
MenuView.ItemView itemView;
if (convertView instanceof MenuView.ItemView) {
itemView = (MenuView.ItemView) convertView;
} else {
itemView = createItemView(parent);
}
bindItemView(item, itemView);
return (View) itemView;
} | java | public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) {
MenuView.ItemView itemView;
if (convertView instanceof MenuView.ItemView) {
itemView = (MenuView.ItemView) convertView;
} else {
itemView = createItemView(parent);
}
bindItemView(item, itemView);
return (View) itemView;
} | [
"public",
"View",
"getItemView",
"(",
"MenuItemImpl",
"item",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"MenuView",
".",
"ItemView",
"itemView",
";",
"if",
"(",
"convertView",
"instanceof",
"MenuView",
".",
"ItemView",
")",
"{",
"itemVi... | Prepare an item view for use. See AdapterView for the basic idea at work here.
This may require creating a new item view, but well-behaved implementations will
re-use the view passed as convertView if present. The returned view will be populated
with data from the item parameter.
@param item Item to present
@param convertView Existing view to reuse
@param parent Intended parent view - use for inflation.
@return View that presents the requested menu item | [
"Prepare",
"an",
"item",
"view",
"for",
"use",
".",
"See",
"AdapterView",
"for",
"the",
"basic",
"idea",
"at",
"work",
"here",
".",
"This",
"may",
"require",
"creating",
"a",
"new",
"item",
"view",
"but",
"well",
"-",
"behaved",
"implementations",
"will",
... | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.java#L169-L178 |
GumTreeDiff/gumtree | core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java | SequenceAlgorithms.longestCommonSubsequenceWithIsomorphism | public static List<int[]> longestCommonSubsequenceWithIsomorphism(List<ITree> s0, List<ITree> s1) {
int[][] lengths = new int[s0.size() + 1][s1.size() + 1];
for (int i = 0; i < s0.size(); i++)
for (int j = 0; j < s1.size(); j++)
if (s0.get(i).isIsomorphicTo(s1.get(j)))
lengths[i + 1][j + 1] = lengths[i][j] + 1;
else
lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]);
return extractIndexes(lengths, s0.size(), s1.size());
} | java | public static List<int[]> longestCommonSubsequenceWithIsomorphism(List<ITree> s0, List<ITree> s1) {
int[][] lengths = new int[s0.size() + 1][s1.size() + 1];
for (int i = 0; i < s0.size(); i++)
for (int j = 0; j < s1.size(); j++)
if (s0.get(i).isIsomorphicTo(s1.get(j)))
lengths[i + 1][j + 1] = lengths[i][j] + 1;
else
lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]);
return extractIndexes(lengths, s0.size(), s1.size());
} | [
"public",
"static",
"List",
"<",
"int",
"[",
"]",
">",
"longestCommonSubsequenceWithIsomorphism",
"(",
"List",
"<",
"ITree",
">",
"s0",
",",
"List",
"<",
"ITree",
">",
"s1",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"lengths",
"=",
"new",
"int",
"[",
"s0"... | Returns the longest common subsequence between the two list of nodes. This version use
isomorphism to ensure equality.
@see ITree#isIsomorphicTo(ITree)
@return a list of size 2 int arrays that corresponds
to match of index in sequence 1 to index in sequence 2. | [
"Returns",
"the",
"longest",
"common",
"subsequence",
"between",
"the",
"two",
"list",
"of",
"nodes",
".",
"This",
"version",
"use",
"isomorphism",
"to",
"ensure",
"equality",
"."
] | train | https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java#L131-L141 |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.newPost | public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException {
T post = klass.newInstance();
post.setClient(this);
post.setBlogName(blogName);
return post;
} | java | public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException {
T post = klass.newInstance();
post.setClient(this);
post.setBlogName(blogName);
return post;
} | [
"public",
"<",
"T",
"extends",
"Post",
">",
"T",
"newPost",
"(",
"String",
"blogName",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"T",
"post",
"=",
"klass",
".",
"newInstance",
"(",
")... | Set up a new post of a given type
@param blogName the name of the blog for this post (or null)
@param klass the type of Post to instantiate
@param <T> the type of Post to instantiate
@return the new post with the client set
@throws IllegalAccessException if class instantiation fails
@throws InstantiationException if class instantiation fails | [
"Set",
"up",
"a",
"new",
"post",
"of",
"a",
"given",
"type"
] | train | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L397-L402 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java | ProductSortDefinitionUrl.addProductSortDefinitionUrl | public static MozuUrl addProductSortDefinitionUrl(String responseFields, Boolean useProvidedId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvidedId}&responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("useProvidedId", useProvidedId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addProductSortDefinitionUrl(String responseFields, Boolean useProvidedId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvidedId}&responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("useProvidedId", useProvidedId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addProductSortDefinitionUrl",
"(",
"String",
"responseFields",
",",
"Boolean",
"useProvidedId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvide... | Get Resource Url for AddProductSortDefinition
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param useProvidedId If true, the provided Id value will be used as the ProductSortDefinitionId. If omitted or false, the system will generate a ProductSortDefinitionId
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddProductSortDefinition"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java#L56-L62 |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.fromJson | public static <T> T fromJson(final String json, final JavaType type) {
try {
return createObjectMapper().readValue(json, type);
} catch (Exception e) {
throw new ParseException(e);
}
} | java | public static <T> T fromJson(final String json, final JavaType type) {
try {
return createObjectMapper().readValue(json, type);
} catch (Exception e) {
throw new ParseException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"final",
"String",
"json",
",",
"final",
"JavaType",
"type",
")",
"{",
"try",
"{",
"return",
"createObjectMapper",
"(",
")",
".",
"readValue",
"(",
"json",
",",
"type",
")",
";",
"}",
"catch",
... | Convert a string to a Java value
@param json Json value to convert.
@param type Expected Java value type.
@param <T> type of return object
@return casted value of given json object
@throws ParseException to runtime if json node can't be casted to clazz. | [
"Convert",
"a",
"string",
"to",
"a",
"Java",
"value"
] | train | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L44-L50 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/UpdatableHeap.java | UpdatableHeap.offerAt | protected void offerAt(final int pos, O e) {
if(pos == NO_VALUE) {
// resize when needed
if(size + 1 > queue.length) {
resize(size + 1);
}
index.put(e, size);
size++;
heapifyUp(size - 1, e);
heapModified();
return;
}
assert (pos >= 0) : "Unexpected negative position.";
assert (queue[pos].equals(e));
// Did the value improve?
if(comparator.compare(e, queue[pos]) >= 0) {
return;
}
heapifyUp(pos, e);
heapModified();
return;
} | java | protected void offerAt(final int pos, O e) {
if(pos == NO_VALUE) {
// resize when needed
if(size + 1 > queue.length) {
resize(size + 1);
}
index.put(e, size);
size++;
heapifyUp(size - 1, e);
heapModified();
return;
}
assert (pos >= 0) : "Unexpected negative position.";
assert (queue[pos].equals(e));
// Did the value improve?
if(comparator.compare(e, queue[pos]) >= 0) {
return;
}
heapifyUp(pos, e);
heapModified();
return;
} | [
"protected",
"void",
"offerAt",
"(",
"final",
"int",
"pos",
",",
"O",
"e",
")",
"{",
"if",
"(",
"pos",
"==",
"NO_VALUE",
")",
"{",
"// resize when needed",
"if",
"(",
"size",
"+",
"1",
">",
"queue",
".",
"length",
")",
"{",
"resize",
"(",
"size",
"... | Offer element at the given position.
@param pos Position
@param e Element | [
"Offer",
"element",
"at",
"the",
"given",
"position",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/UpdatableHeap.java#L111-L132 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java | BridgedTransportManager.sessionEstablished | @Override
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
} | java | @Override
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
} | [
"@",
"Override",
"public",
"void",
"sessionEstablished",
"(",
"PayloadType",
"pt",
",",
"TransportCandidate",
"rc",
",",
"TransportCandidate",
"lc",
",",
"JingleSession",
"jingleSession",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"RTPBrid... | Implement a Session Listener to relay candidates after establishment | [
"Implement",
"a",
"Session",
"Listener",
"to",
"relay",
"candidates",
"after",
"establishment"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java#L58-L61 |
alkacon/opencms-core | src/org/opencms/file/wrapper/A_CmsResourceExtensionWrapper.java | A_CmsResourceExtensionWrapper.getResource | private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) {
CmsResource res = null;
try {
res = cms.readResource(
CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()),
filter);
} catch (CmsException ex) {
return null;
}
if (checkTypeId(res.getTypeId())) {
return res;
}
return null;
} | java | private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) {
CmsResource res = null;
try {
res = cms.readResource(
CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()),
filter);
} catch (CmsException ex) {
return null;
}
if (checkTypeId(res.getTypeId())) {
return res;
}
return null;
} | [
"private",
"CmsResource",
"getResource",
"(",
"CmsObject",
"cms",
",",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"CmsResource",
"res",
"=",
"null",
";",
"try",
"{",
"res",
"=",
"cms",
".",
"readResource",
"(",
"CmsResourceWrapperUti... | Trys to read the resourcename after removing the file extension and return the
resource if the type id is correct.<p>
@param cms the initialized CmsObject
@param resourcename the name of the resource to read
@param filter the resource filter to use while reading
@return the resource or null if not found | [
"Trys",
"to",
"read",
"the",
"resourcename",
"after",
"removing",
"the",
"file",
"extension",
"and",
"return",
"the",
"resource",
"if",
"the",
"type",
"id",
"is",
"correct",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/A_CmsResourceExtensionWrapper.java#L335-L352 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.beginCreateOrUpdate | public ApplicationGatewayInner beginCreateOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().single().body();
} | java | public ApplicationGatewayInner beginCreateOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().single().body();
} | [
"public",
"ApplicationGatewayInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
",",
"ApplicationGatewayInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Creates or updates the specified application gateway.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@param parameters Parameters supplied to the create or update application gateway operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ApplicationGatewayInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"application",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L481-L483 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/UsersApi.java | UsersApi.getUsersWithHttpInfo | public ApiResponse<GetUsersSuccessResponse> getUsersWithHttpInfo(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException {
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null);
Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java | public ApiResponse<GetUsersSuccessResponse> getUsersWithHttpInfo(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException {
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null);
Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | [
"public",
"ApiResponse",
"<",
"GetUsersSuccessResponse",
">",
"getUsersWithHttpInfo",
"(",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"String",
"order",
",",
"String",
"sortBy",
",",
"String",
"filterName",
",",
"String",
"filterParameters",
",",
"String",
... | Get users.
Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters.
@param limit Limit the number of users the Provisioning API should return. (optional)
@param offset The number of matches the Provisioning API should skip in the returned users. (optional)
@param order The sort order. (optional)
@param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional)
@param filterName The name of a filter to use on the results. (optional)
@param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional)
@param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional)
@param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional)
@param userEnabled Return only enabled or disabled users. (optional)
@param userValid Return only valid or invalid users. (optional)
@return ApiResponse<GetUsersSuccessResponse>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"users",
".",
"Get",
"[",
"CfgPerson",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"genesys",
".",
"com",
"/",
"Documentation",
"/",
"PSDK",
"/",
"latest",
"/",
"ConfigLayerRef",
"/",
"CfgPerson",
")",
"objects",
"based",
"on",
"the",
"specified",
... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L673-L677 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java | WishlistUrl.getWishlistByNameUrl | public static MozuUrl getWishlistByNameUrl(Integer customerAccountId, String responseFields, String wishlistName)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}?responseFields={responseFields}");
formatter.formatUrl("customerAccountId", customerAccountId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("wishlistName", wishlistName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getWishlistByNameUrl(Integer customerAccountId, String responseFields, String wishlistName)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}?responseFields={responseFields}");
formatter.formatUrl("customerAccountId", customerAccountId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("wishlistName", wishlistName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getWishlistByNameUrl",
"(",
"Integer",
"customerAccountId",
",",
"String",
"responseFields",
",",
"String",
"wishlistName",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/wishlists/customers/{customer... | Get Resource Url for GetWishlistByName
@param customerAccountId The unique identifier of the customer account for which to retrieve wish lists.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param wishlistName The name of the wish list to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetWishlistByName"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java#L61-L68 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.write | public void write(@NonNull Normalizer normalizer, @NonNull String path) throws IOException {
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(path))) {
write(normalizer, out);
}
} | java | public void write(@NonNull Normalizer normalizer, @NonNull String path) throws IOException {
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(path))) {
write(normalizer, out);
}
} | [
"public",
"void",
"write",
"(",
"@",
"NonNull",
"Normalizer",
"normalizer",
",",
"@",
"NonNull",
"String",
"path",
")",
"throws",
"IOException",
"{",
"try",
"(",
"OutputStream",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"p... | Serialize a normalizer to the given file path
@param normalizer the normalizer
@param path the destination file path
@throws IOException | [
"Serialize",
"a",
"normalizer",
"to",
"the",
"given",
"file",
"path"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L59-L63 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java | StringUtil.replaceIgnoreCase | public static String replaceIgnoreCase(String pSource, String pPattern, String pReplace) {
if (pPattern.length() == 0) {
return pSource;// Special case: No pattern to replace
}
int match;
int offset = 0;
StringBuilder result = new StringBuilder();
while ((match = indexOfIgnoreCase(pSource, pPattern, offset)) != -1) {
result.append(pSource.substring(offset, match));
result.append(pReplace);
offset = match + pPattern.length();
}
result.append(pSource.substring(offset));
return result.toString();
} | java | public static String replaceIgnoreCase(String pSource, String pPattern, String pReplace) {
if (pPattern.length() == 0) {
return pSource;// Special case: No pattern to replace
}
int match;
int offset = 0;
StringBuilder result = new StringBuilder();
while ((match = indexOfIgnoreCase(pSource, pPattern, offset)) != -1) {
result.append(pSource.substring(offset, match));
result.append(pReplace);
offset = match + pPattern.length();
}
result.append(pSource.substring(offset));
return result.toString();
} | [
"public",
"static",
"String",
"replaceIgnoreCase",
"(",
"String",
"pSource",
",",
"String",
"pPattern",
",",
"String",
"pReplace",
")",
"{",
"if",
"(",
"pPattern",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"pSource",
";",
"// Special case: No p... | Replaces a substring of a string with another string, ignoring case.
All matches are replaced.
@param pSource The source String
@param pPattern The pattern to replace
@param pReplace The new String to be inserted instead of the
replace String
@return The new String with the pattern replaced
@see #replace(String,String,String) | [
"Replaces",
"a",
"substring",
"of",
"a",
"string",
"with",
"another",
"string",
"ignoring",
"case",
".",
"All",
"matches",
"are",
"replaced",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L659-L674 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.getKeyValues | public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid, boolean convertToSql) throws PersistenceBrokerException
{
FieldDescriptor[] pkFields = cld.getPkFields();
ValueContainer[] result = new ValueContainer[pkFields.length];
Object[] pkValues = oid.getPrimaryKeyValues();
try
{
for(int i = 0; i < result.length; i++)
{
FieldDescriptor fd = pkFields[i];
Object cv = pkValues[i];
if(convertToSql)
{
// BRJ : apply type and value mapping
cv = fd.getFieldConversion().javaToSql(cv);
}
result[i] = new ValueContainer(cv, fd.getJdbcType());
}
}
catch(Exception e)
{
throw new PersistenceBrokerException("Can't generate primary key values for given Identity " + oid, e);
}
return result;
} | java | public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid, boolean convertToSql) throws PersistenceBrokerException
{
FieldDescriptor[] pkFields = cld.getPkFields();
ValueContainer[] result = new ValueContainer[pkFields.length];
Object[] pkValues = oid.getPrimaryKeyValues();
try
{
for(int i = 0; i < result.length; i++)
{
FieldDescriptor fd = pkFields[i];
Object cv = pkValues[i];
if(convertToSql)
{
// BRJ : apply type and value mapping
cv = fd.getFieldConversion().javaToSql(cv);
}
result[i] = new ValueContainer(cv, fd.getJdbcType());
}
}
catch(Exception e)
{
throw new PersistenceBrokerException("Can't generate primary key values for given Identity " + oid, e);
}
return result;
} | [
"public",
"ValueContainer",
"[",
"]",
"getKeyValues",
"(",
"ClassDescriptor",
"cld",
",",
"Identity",
"oid",
",",
"boolean",
"convertToSql",
")",
"throws",
"PersistenceBrokerException",
"{",
"FieldDescriptor",
"[",
"]",
"pkFields",
"=",
"cld",
".",
"getPkFields",
... | Return key Values of an Identity
@param cld
@param oid
@param convertToSql
@return Object[]
@throws PersistenceBrokerException | [
"Return",
"key",
"Values",
"of",
"an",
"Identity"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L203-L228 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/ProtoUtils.java | ProtoUtils.getBuildMethod | private static MethodRef getBuildMethod(Descriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor);
TypeInfo builder = builderRuntimeType(descriptor);
return MethodRef.createInstanceMethod(
builder, new Method("build", message.type(), NO_METHOD_ARGS))
.asNonNullable();
} | java | private static MethodRef getBuildMethod(Descriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor);
TypeInfo builder = builderRuntimeType(descriptor);
return MethodRef.createInstanceMethod(
builder, new Method("build", message.type(), NO_METHOD_ARGS))
.asNonNullable();
} | [
"private",
"static",
"MethodRef",
"getBuildMethod",
"(",
"Descriptor",
"descriptor",
")",
"{",
"TypeInfo",
"message",
"=",
"messageRuntimeType",
"(",
"descriptor",
")",
";",
"TypeInfo",
"builder",
"=",
"builderRuntimeType",
"(",
"descriptor",
")",
";",
"return",
"... | Returns the {@link MethodRef} for the generated build method. | [
"Returns",
"the",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L1289-L1295 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java | CharSequences.getChars | public static void getChars(CharSequence csq, int srcBegin, int srcEnd, char dst[], int dstBegin) {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
((String)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuffer.class) {
((StringBuffer)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuilder.class) {
((StringBuilder)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csq instanceof CharArrayAccessible) {
((CharArrayAccessible)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else {
String str = csq.subSequence(srcBegin, srcEnd).toString();
str.getChars(0, str.length(), dst, dstBegin);
}
} | java | public static void getChars(CharSequence csq, int srcBegin, int srcEnd, char dst[], int dstBegin) {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
((String)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuffer.class) {
((StringBuffer)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuilder.class) {
((StringBuilder)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csq instanceof CharArrayAccessible) {
((CharArrayAccessible)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else {
String str = csq.subSequence(srcBegin, srcEnd).toString();
str.getChars(0, str.length(), dst, dstBegin);
}
} | [
"public",
"static",
"void",
"getChars",
"(",
"CharSequence",
"csq",
",",
"int",
"srcBegin",
",",
"int",
"srcEnd",
",",
"char",
"dst",
"[",
"]",
",",
"int",
"dstBegin",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"csqClass",
"=",
"csq",
".",
"getClass",
... | Provides an optimized way to copy CharSequence content to target array.
Uses getChars method available on String, StringBuilder and StringBuffer classes.
Characters are copied from the source sequence <code>csq</code> into the
destination character array <code>dst</code>. The first character to
be copied is at index <code>srcBegin</code>; the last character to
be copied is at index <code>srcEnd-1</code>. The total number of
characters to be copied is <code>srcEnd-srcBegin</code>. The
characters are copied into the subarray of <code>dst</code> starting
at index <code>dstBegin</code> and ending at index:
<p><blockquote><pre>
dstbegin + (srcEnd-srcBegin) - 1
</pre></blockquote>
@param csq the source CharSequence instance.
@param srcBegin start copying at this offset.
@param srcEnd stop copying at this offset.
@param dst the array to copy the data into.
@param dstBegin offset into <code>dst</code>.
@throws NullPointerException if <code>dst</code> is
<code>null</code>.
@throws IndexOutOfBoundsException if any of the following is true:
<ul>
<li><code>srcBegin</code> is negative
<li><code>dstBegin</code> is negative
<li>the <code>srcBegin</code> argument is greater than
the <code>srcEnd</code> argument.
<li><code>srcEnd</code> is greater than
<code>this.length()</code>.
<li><code>dstBegin+srcEnd-srcBegin</code> is greater than
<code>dst.length</code>
</ul> | [
"Provides",
"an",
"optimized",
"way",
"to",
"copy",
"CharSequence",
"content",
"to",
"target",
"array",
".",
"Uses",
"getChars",
"method",
"available",
"on",
"String",
"StringBuilder",
"and",
"StringBuffer",
"classes",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java#L150-L168 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java | DimensionHandlerUtils.createColumnSelectorPlus | public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy> ColumnSelectorPlus<ColumnSelectorStrategyClass> createColumnSelectorPlus(
ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory,
DimensionSpec dimensionSpec,
ColumnSelectorFactory cursor
)
{
return createColumnSelectorPluses(strategyFactory, ImmutableList.of(dimensionSpec), cursor)[0];
} | java | public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy> ColumnSelectorPlus<ColumnSelectorStrategyClass> createColumnSelectorPlus(
ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory,
DimensionSpec dimensionSpec,
ColumnSelectorFactory cursor
)
{
return createColumnSelectorPluses(strategyFactory, ImmutableList.of(dimensionSpec), cursor)[0];
} | [
"public",
"static",
"<",
"ColumnSelectorStrategyClass",
"extends",
"ColumnSelectorStrategy",
">",
"ColumnSelectorPlus",
"<",
"ColumnSelectorStrategyClass",
">",
"createColumnSelectorPlus",
"(",
"ColumnSelectorStrategyFactory",
"<",
"ColumnSelectorStrategyClass",
">",
"strategyFacto... | Convenience function equivalent to calling
{@link #createColumnSelectorPluses(ColumnSelectorStrategyFactory, List, ColumnSelectorFactory)} with a singleton
list of dimensionSpecs and then retrieving the only element in the returned array.
@param <ColumnSelectorStrategyClass> The strategy type created by the provided strategy factory.
@param strategyFactory A factory provided by query engines that generates type-handling strategies
@param dimensionSpec column to generate a ColumnSelectorPlus object for
@param cursor Used to create value selectors for columns.
@return A ColumnSelectorPlus object | [
"Convenience",
"function",
"equivalent",
"to",
"calling",
"{",
"@link",
"#createColumnSelectorPluses",
"(",
"ColumnSelectorStrategyFactory",
"List",
"ColumnSelectorFactory",
")",
"}",
"with",
"a",
"singleton",
"list",
"of",
"dimensionSpecs",
"and",
"then",
"retrieving",
... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java#L117-L124 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java | Stanza.hasExtension | public boolean hasExtension(String elementName, String namespace) {
if (elementName == null) {
return hasExtension(namespace);
}
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.containsKey(key);
}
} | java | public boolean hasExtension(String elementName, String namespace) {
if (elementName == null) {
return hasExtension(namespace);
}
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.containsKey(key);
}
} | [
"public",
"boolean",
"hasExtension",
"(",
"String",
"elementName",
",",
"String",
"namespace",
")",
"{",
"if",
"(",
"elementName",
"==",
"null",
")",
"{",
"return",
"hasExtension",
"(",
"namespace",
")",
";",
"}",
"String",
"key",
"=",
"XmppStringUtils",
"."... | Check if a stanza extension with the given element and namespace exists.
<p>
The argument <code>elementName</code> may be null.
</p>
@param elementName
@param namespace
@return true if a stanza extension exists, false otherwise. | [
"Check",
"if",
"a",
"stanza",
"extension",
"with",
"the",
"given",
"element",
"and",
"namespace",
"exists",
".",
"<p",
">",
"The",
"argument",
"<code",
">",
"elementName<",
"/",
"code",
">",
"may",
"be",
"null",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java#L428-L436 |
alkacon/opencms-core | src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java | CmsGitToolOptionsPanel.setUserInfo | private void setUserInfo(CmsUser user, String key, String value) {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
user.getAdditionalInfo().put(key, value);
}
} | java | private void setUserInfo(CmsUser user, String key, String value) {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
user.getAdditionalInfo().put(key, value);
}
} | [
"private",
"void",
"setUserInfo",
"(",
"CmsUser",
"user",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"value",
")",
")",
"{",
"user",
".",
"getAdditionalInfo",
"(",
")",
".",... | Sets an additional info value if it's not empty.<p>
@param user the user on which to set the additional info
@param key the additional info key
@param value the additional info value | [
"Sets",
"an",
"additional",
"info",
"value",
"if",
"it",
"s",
"not",
"empty",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java#L773-L778 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/installation/LayersFactory.java | LayersFactory.createPatchableTarget | static AbstractLazyPatchableTarget createPatchableTarget(final String name, final LayerPathConfig layer, final File metadata, final InstalledImage image) throws IOException {
// patchable target
return new AbstractLazyPatchableTarget() {
@Override
public InstalledImage getInstalledImage() {
return image;
}
@Override
public File getModuleRoot() {
return layer.modulePath;
}
@Override
public File getBundleRepositoryRoot() {
return layer.bundlePath;
}
public File getPatchesMetadata() {
return metadata;
}
@Override
public String getName() {
return name;
}
};
} | java | static AbstractLazyPatchableTarget createPatchableTarget(final String name, final LayerPathConfig layer, final File metadata, final InstalledImage image) throws IOException {
// patchable target
return new AbstractLazyPatchableTarget() {
@Override
public InstalledImage getInstalledImage() {
return image;
}
@Override
public File getModuleRoot() {
return layer.modulePath;
}
@Override
public File getBundleRepositoryRoot() {
return layer.bundlePath;
}
public File getPatchesMetadata() {
return metadata;
}
@Override
public String getName() {
return name;
}
};
} | [
"static",
"AbstractLazyPatchableTarget",
"createPatchableTarget",
"(",
"final",
"String",
"name",
",",
"final",
"LayerPathConfig",
"layer",
",",
"final",
"File",
"metadata",
",",
"final",
"InstalledImage",
"image",
")",
"throws",
"IOException",
"{",
"// patchable target... | Create the actual patchable target.
@param name the layer name
@param layer the layer path config
@param metadata the metadata location for this target
@param image the installed image
@return the patchable target
@throws IOException | [
"Create",
"the",
"actual",
"patchable",
"target",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/LayersFactory.java#L205-L233 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java | SnapToEllipseEdge.computePointsAndWeights | void computePointsAndWeights(EllipseRotated_F64 ellipse) {
// use the semi-major axis to scale the input points for numerical stability
double localScale = ellipse.a;
samplePts.reset();
weights.reset();
int numSamples = radialSamples * 2 + 2;
int numPts = numSamples - 1;
Point2D_F64 sample = new Point2D_F64();
for (int i = 0; i < numSampleContour; i++) {
// find a point along the ellipse at evenly spaced angles
double theta = 2.0 * Math.PI * i / numSampleContour;
UtilEllipse_F64.computePoint(theta, ellipse, sample);
// compute the unit tangent along the ellipse at this point
double tanX = sample.x - ellipse.center.x;
double tanY = sample.y - ellipse.center.y;
double r = Math.sqrt(tanX * tanX + tanY * tanY);
tanX /= r;
tanY /= r;
// define the line it will sample along
double x = sample.x - numSamples * tanX / 2.0;
double y = sample.y - numSamples * tanY / 2.0;
double lengthX = numSamples * tanX;
double lengthY = numSamples * tanY;
// Unless all the sample points are inside the image, ignore this point
if (!integral.isInside(x, y) || !integral.isInside(x + lengthX, y + lengthY))
continue;
double sample0 = integral.compute(x, y, x + tanX, y + tanY);
x += tanX;
y += tanY;
for (int j = 0; j < numPts; j++) {
double sample1 = integral.compute(x, y, x + tanX, y + tanY);
double w = sample0 - sample1;
if (w < 0) w = -w;
if (w > 0) {
// convert into a local coordinate so make the linear fitting more numerically stable and
// independent on position in the image
samplePts.grow().set((x - ellipse.center.x) / localScale, (y - ellipse.center.y) / localScale);
weights.add(w);
}
x += tanX;
y += tanY;
sample0 = sample1;
}
}
} | java | void computePointsAndWeights(EllipseRotated_F64 ellipse) {
// use the semi-major axis to scale the input points for numerical stability
double localScale = ellipse.a;
samplePts.reset();
weights.reset();
int numSamples = radialSamples * 2 + 2;
int numPts = numSamples - 1;
Point2D_F64 sample = new Point2D_F64();
for (int i = 0; i < numSampleContour; i++) {
// find a point along the ellipse at evenly spaced angles
double theta = 2.0 * Math.PI * i / numSampleContour;
UtilEllipse_F64.computePoint(theta, ellipse, sample);
// compute the unit tangent along the ellipse at this point
double tanX = sample.x - ellipse.center.x;
double tanY = sample.y - ellipse.center.y;
double r = Math.sqrt(tanX * tanX + tanY * tanY);
tanX /= r;
tanY /= r;
// define the line it will sample along
double x = sample.x - numSamples * tanX / 2.0;
double y = sample.y - numSamples * tanY / 2.0;
double lengthX = numSamples * tanX;
double lengthY = numSamples * tanY;
// Unless all the sample points are inside the image, ignore this point
if (!integral.isInside(x, y) || !integral.isInside(x + lengthX, y + lengthY))
continue;
double sample0 = integral.compute(x, y, x + tanX, y + tanY);
x += tanX;
y += tanY;
for (int j = 0; j < numPts; j++) {
double sample1 = integral.compute(x, y, x + tanX, y + tanY);
double w = sample0 - sample1;
if (w < 0) w = -w;
if (w > 0) {
// convert into a local coordinate so make the linear fitting more numerically stable and
// independent on position in the image
samplePts.grow().set((x - ellipse.center.x) / localScale, (y - ellipse.center.y) / localScale);
weights.add(w);
}
x += tanX;
y += tanY;
sample0 = sample1;
}
}
} | [
"void",
"computePointsAndWeights",
"(",
"EllipseRotated_F64",
"ellipse",
")",
"{",
"// use the semi-major axis to scale the input points for numerical stability",
"double",
"localScale",
"=",
"ellipse",
".",
"a",
";",
"samplePts",
".",
"reset",
"(",
")",
";",
"weights",
"... | Computes the location of points along the line and their weights | [
"Computes",
"the",
"location",
"of",
"points",
"along",
"the",
"line",
"and",
"their",
"weights"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java#L134-L192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.