repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java | BatchStatusValidator.validateStatusAtInstanceRestart | public static void validateStatusAtInstanceRestart(long jobInstanceId, Properties restartJobParameters) throws JobRestartException, JobExecutionAlreadyCompleteException {
IPersistenceManagerService iPers = ServicesManagerStaticAnchor.getServicesManager().getPersistenceManagerService();
WSJobInstance jobInstance = iPers.getJobInstance(jobInstanceId);
Helper helper = new Helper(jobInstance, restartJobParameters);
if (!StringUtils.isEmpty(jobInstance.getJobXml())) {
helper.validateRestartableFalseJobsDoNotRestart();
}
helper.validateJobInstanceFailedOrStopped();
} | java | public static void validateStatusAtInstanceRestart(long jobInstanceId, Properties restartJobParameters) throws JobRestartException, JobExecutionAlreadyCompleteException {
IPersistenceManagerService iPers = ServicesManagerStaticAnchor.getServicesManager().getPersistenceManagerService();
WSJobInstance jobInstance = iPers.getJobInstance(jobInstanceId);
Helper helper = new Helper(jobInstance, restartJobParameters);
if (!StringUtils.isEmpty(jobInstance.getJobXml())) {
helper.validateRestartableFalseJobsDoNotRestart();
}
helper.validateJobInstanceFailedOrStopped();
} | [
"public",
"static",
"void",
"validateStatusAtInstanceRestart",
"(",
"long",
"jobInstanceId",
",",
"Properties",
"restartJobParameters",
")",
"throws",
"JobRestartException",
",",
"JobExecutionAlreadyCompleteException",
"{",
"IPersistenceManagerService",
"iPers",
"=",
"ServicesM... | validates job is restart-able,
validates the jobInstance is in failed or stopped | [
"validates",
"job",
"is",
"restart",
"-",
"able",
"validates",
"the",
"jobInstance",
"is",
"in",
"failed",
"or",
"stopped"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java#L48-L58 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateCustomPrebuiltEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updateCustomPrebuiltEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateCustomPrebuiltEntityRoleOptionalParameter != null ? updateCustomPrebuiltEntityRoleOptionalParameter.name() : null;
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | java | public Observable<ServiceResponse<OperationStatus>> updateCustomPrebuiltEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updateCustomPrebuiltEntityRoleOptionalParameter != null ? updateCustomPrebuiltEntityRoleOptionalParameter.name() : null;
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updateCustomPrebuiltEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdateCustomPrebuiltEntityRo... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateCustomPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13714-L13733 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java | UniversalTimeScale.toBigDecimalTrunc | @Deprecated
public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale)
{
TimeScaleData data = getTimeScaleData(timeScale);
BigDecimal units = new BigDecimal(data.units);
BigDecimal epochOffset = new BigDecimal(data.epochOffset);
return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset);
} | java | @Deprecated
public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale)
{
TimeScaleData data = getTimeScaleData(timeScale);
BigDecimal units = new BigDecimal(data.units);
BigDecimal epochOffset = new BigDecimal(data.epochOffset);
return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset);
} | [
"@",
"Deprecated",
"public",
"static",
"BigDecimal",
"toBigDecimalTrunc",
"(",
"BigDecimal",
"universalTime",
",",
"int",
"timeScale",
")",
"{",
"TimeScaleData",
"data",
"=",
"getTimeScaleData",
"(",
"timeScale",
")",
";",
"BigDecimal",
"units",
"=",
"new",
"BigDe... | Convert a time in the Universal Time Scale into another time
scale. The division used to do the conversion rounds down.
NOTE: This is an internal routine used by the tool that
generates the to and from limits. Use it at your own risk.
@param universalTime the time in the Universal Time scale
@param timeScale the time scale to convert to
@return the time in the given time scale
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Convert",
"a",
"time",
"in",
"the",
"Universal",
"Time",
"Scale",
"into",
"another",
"time",
"scale",
".",
"The",
"division",
"used",
"to",
"do",
"the",
"conversion",
"rounds",
"down",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L598-L606 |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.isNotModified | public static boolean isNotModified(Context context, long lastModified, String etag) {
// First check etag. Important, if there is an If-None-Match header, we MUST not check the
// If-Modified-Since header, regardless of whether If-None-Match matches or not. This is in
// accordance with section 14.26 of RFC2616.
final String browserEtag = context.header(HeaderNames.IF_NONE_MATCH);
if (browserEtag != null) {
// We check the given etag against the given one.
// If the given one is null, that means that etags are disabled.
return browserEtag.equals(etag);
}
// IF_NONE_MATCH not set, check IF_MODIFIED_SINCE
final String ifModifiedSince = context.header(HeaderNames.IF_MODIFIED_SINCE);
if (ifModifiedSince != null && lastModified > 0 && !ifModifiedSince.isEmpty()) {
try {
// We do a double check here because the time granularity is important here.
// If the written date headers are still the same, we are unchanged (the granularity is the
// second).
return ifModifiedSince.equals(DateUtil.formatForHttpHeader(lastModified));
} catch (IllegalArgumentException ex) {
LoggerFactory.getLogger(CacheUtils.class)
.error("Cannot build the date string for {}", lastModified, ex);
return true;
}
}
return false;
} | java | public static boolean isNotModified(Context context, long lastModified, String etag) {
// First check etag. Important, if there is an If-None-Match header, we MUST not check the
// If-Modified-Since header, regardless of whether If-None-Match matches or not. This is in
// accordance with section 14.26 of RFC2616.
final String browserEtag = context.header(HeaderNames.IF_NONE_MATCH);
if (browserEtag != null) {
// We check the given etag against the given one.
// If the given one is null, that means that etags are disabled.
return browserEtag.equals(etag);
}
// IF_NONE_MATCH not set, check IF_MODIFIED_SINCE
final String ifModifiedSince = context.header(HeaderNames.IF_MODIFIED_SINCE);
if (ifModifiedSince != null && lastModified > 0 && !ifModifiedSince.isEmpty()) {
try {
// We do a double check here because the time granularity is important here.
// If the written date headers are still the same, we are unchanged (the granularity is the
// second).
return ifModifiedSince.equals(DateUtil.formatForHttpHeader(lastModified));
} catch (IllegalArgumentException ex) {
LoggerFactory.getLogger(CacheUtils.class)
.error("Cannot build the date string for {}", lastModified, ex);
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isNotModified",
"(",
"Context",
"context",
",",
"long",
"lastModified",
",",
"String",
"etag",
")",
"{",
"// First check etag. Important, if there is an If-None-Match header, we MUST not check the",
"// If-Modified-Since header, regardless of whether I... | Check whether the request can send a NOT_MODIFIED response.
@param context the context
@param lastModified the last modification date
@param etag the etag.
@return true if the content is modified | [
"Check",
"whether",
"the",
"request",
"can",
"send",
"a",
"NOT_MODIFIED",
"response",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L73-L100 |
app55/app55-java | src/support/java/org/apache/harmony/beans/internal/nls/Messages.java | Messages.getString | static public String getString(String msg, Object arg1, Object arg2)
{
return getString(msg, new Object[] { arg1, arg2 });
} | java | static public String getString(String msg, Object arg1, Object arg2)
{
return getString(msg, new Object[] { arg1, arg2 });
} | [
"static",
"public",
"String",
"getString",
"(",
"String",
"msg",
",",
"Object",
"arg1",
",",
"Object",
"arg2",
")",
"{",
"return",
"getString",
"(",
"msg",
",",
"new",
"Object",
"[",
"]",
"{",
"arg1",
",",
"arg2",
"}",
")",
";",
"}"
] | Retrieves a message which takes 2 arguments.
@param msg
String the key to look up.
@param arg1
Object an object to insert in the formatted output.
@param arg2
Object another object to insert in the formatted output.
@return String the message for that key in the system message bundle. | [
"Retrieves",
"a",
"message",
"which",
"takes",
"2",
"arguments",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/internal/nls/Messages.java#L119-L122 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/Util.java | Util.buildStackTraceString | public static String buildStackTraceString(final Throwable ex) {
final StringBuilder context = new StringBuilder(ex.toString());
final StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw, true));
context.append('\n');
context.append(sw.toString());
return context.toString();
} | java | public static String buildStackTraceString(final Throwable ex) {
final StringBuilder context = new StringBuilder(ex.toString());
final StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw, true));
context.append('\n');
context.append(sw.toString());
return context.toString();
} | [
"public",
"static",
"String",
"buildStackTraceString",
"(",
"final",
"Throwable",
"ex",
")",
"{",
"final",
"StringBuilder",
"context",
"=",
"new",
"StringBuilder",
"(",
"ex",
".",
"toString",
"(",
")",
")",
";",
"final",
"StringWriter",
"sw",
"=",
"new",
"St... | finds out the stack trace up to where the exception was thrown.
@return String that contains the stack trace | [
"finds",
"out",
"the",
"stack",
"trace",
"up",
"to",
"where",
"the",
"exception",
"was",
"thrown",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/Util.java#L110-L118 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java | SimpleDateFormat.subFormat | protected String subFormat(char ch, int count, int beginOffset,
FieldPosition pos, DateFormatSymbols fmtData,
Calendar cal)
throws IllegalArgumentException
{
// Note: formatData is ignored
return subFormat(ch, count, beginOffset, 0, DisplayContext.CAPITALIZATION_NONE, pos, cal);
} | java | protected String subFormat(char ch, int count, int beginOffset,
FieldPosition pos, DateFormatSymbols fmtData,
Calendar cal)
throws IllegalArgumentException
{
// Note: formatData is ignored
return subFormat(ch, count, beginOffset, 0, DisplayContext.CAPITALIZATION_NONE, pos, cal);
} | [
"protected",
"String",
"subFormat",
"(",
"char",
"ch",
",",
"int",
"count",
",",
"int",
"beginOffset",
",",
"FieldPosition",
"pos",
",",
"DateFormatSymbols",
"fmtData",
",",
"Calendar",
"cal",
")",
"throws",
"IllegalArgumentException",
"{",
"// Note: formatData is i... | Formats a single field, given its pattern character. Subclasses may
override this method in order to modify or add formatting
capabilities.
@param ch the pattern character
@param count the number of times ch is repeated in the pattern
@param beginOffset the offset of the output string at the start of
this field; used to set pos when appropriate
@param pos receives the position of a field, when appropriate
@param fmtData the symbols for this formatter | [
"Formats",
"a",
"single",
"field",
"given",
"its",
"pattern",
"character",
".",
"Subclasses",
"may",
"override",
"this",
"method",
"in",
"order",
"to",
"modify",
"or",
"add",
"formatting",
"capabilities",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1501-L1508 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.getPageIdsContainingTemplateFragments | public List<Integer> getPageIdsContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredPageIds(templateFragments,true);
} | java | public List<Integer> getPageIdsContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredPageIds(templateFragments,true);
} | [
"public",
"List",
"<",
"Integer",
">",
"getPageIdsContainingTemplateFragments",
"(",
"List",
"<",
"String",
">",
"templateFragments",
")",
"throws",
"WikiApiException",
"{",
"return",
"getFragmentFilteredPageIds",
"(",
"templateFragments",
",",
"true",
")",
";",
"}"
] | Returns a list containing the ids of all pages that contain a
template the name of which starts with any of the given Strings.
@param templateFragments
the beginning of the templates that have to be matched
@return An list with the ids of the pages that contain templates
beginning with any String in templateFragments
@throws WikiApiException
If there was any error retrieving the page object (most
likely if the template templates are corrupted) | [
"Returns",
"a",
"list",
"containing",
"the",
"ids",
"of",
"all",
"pages",
"that",
"contain",
"a",
"template",
"the",
"name",
"of",
"which",
"starts",
"with",
"any",
"of",
"the",
"given",
"Strings",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L705-L707 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/ConcatVectorTable.java | ConcatVectorTable.valueEquals | public boolean valueEquals(ConcatVectorTable other, double tolerance) {
if (!Arrays.equals(other.getDimensions(), getDimensions())) return false;
for (int[] assignment : this) {
if (!getAssignmentValue(assignment).get().valueEquals(other.getAssignmentValue(assignment).get(), tolerance)) {
return false;
}
}
return true;
} | java | public boolean valueEquals(ConcatVectorTable other, double tolerance) {
if (!Arrays.equals(other.getDimensions(), getDimensions())) return false;
for (int[] assignment : this) {
if (!getAssignmentValue(assignment).get().valueEquals(other.getAssignmentValue(assignment).get(), tolerance)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"valueEquals",
"(",
"ConcatVectorTable",
"other",
",",
"double",
"tolerance",
")",
"{",
"if",
"(",
"!",
"Arrays",
".",
"equals",
"(",
"other",
".",
"getDimensions",
"(",
")",
",",
"getDimensions",
"(",
")",
")",
")",
"return",
"false",... | Deep comparison for equality of value, plus tolerance, for every concatvector in the table, plus dimensional
arrangement. This is mostly useful for testing.
@param other the vector table to compare against
@param tolerance the tolerance to use in value comparisons
@return whether the two tables are equivalent by value | [
"Deep",
"comparison",
"for",
"equality",
"of",
"value",
"plus",
"tolerance",
"for",
"every",
"concatvector",
"in",
"the",
"table",
"plus",
"dimensional",
"arrangement",
".",
"This",
"is",
"mostly",
"useful",
"for",
"testing",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/ConcatVectorTable.java#L95-L103 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getHexEncoded | @Nonnull
public static String getHexEncoded (@Nonnull final String sInput, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (sInput, "Input");
ValueEnforcer.notNull (aCharset, "Charset");
return getHexEncoded (sInput.getBytes (aCharset));
} | java | @Nonnull
public static String getHexEncoded (@Nonnull final String sInput, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (sInput, "Input");
ValueEnforcer.notNull (aCharset, "Charset");
return getHexEncoded (sInput.getBytes (aCharset));
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getHexEncoded",
"(",
"@",
"Nonnull",
"final",
"String",
"sInput",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sInput",
",",
"\"Input\"",
")",
";",
"Value... | Convert a string to a byte array and than to a hexadecimal encoded string.
@param sInput
The source string. May not be <code>null</code>.
@param aCharset
The charset to use. May not be <code>null</code>.
@return The String representation of the byte array of the string. | [
"Convert",
"a",
"string",
"to",
"a",
"byte",
"array",
"and",
"than",
"to",
"a",
"hexadecimal",
"encoded",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L601-L608 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java | LoaderUtil.newCheckedInstanceOf | public static <T> T newCheckedInstanceOf(final String className, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
return clazz.cast(newInstanceOf(className));
} | java | public static <T> T newCheckedInstanceOf(final String className, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
return clazz.cast(newInstanceOf(className));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newCheckedInstanceOf",
"(",
"final",
"String",
"className",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InvocationTargetException",
",",
"Insta... | Loads and instantiates a derived class using its default constructor.
@param className The class name.
@param clazz The class to cast it to.
@param <T> The type of the class to check.
@return new instance of the class cast to {@code T}
@throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
@throws IllegalAccessException if the class can't be instantiated through a public constructor
@throws InstantiationException if there was an exception whilst instantiating the class
@throws NoSuchMethodException if there isn't a no-args constructor on the class
@throws InvocationTargetException if there was an exception whilst constructing the class
@throws ClassCastException if the constructed object isn't type compatible with {@code T}
@since 2.1 | [
"Loads",
"and",
"instantiates",
"a",
"derived",
"class",
"using",
"its",
"default",
"constructor",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java#L198-L202 |
lagom/lagom | service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java | Descriptor.withExceptionSerializer | public Descriptor withExceptionSerializer(ExceptionSerializer exceptionSerializer) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | java | public Descriptor withExceptionSerializer(ExceptionSerializer exceptionSerializer) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | [
"public",
"Descriptor",
"withExceptionSerializer",
"(",
"ExceptionSerializer",
"exceptionSerializer",
")",
"{",
"return",
"new",
"Descriptor",
"(",
"name",
",",
"calls",
",",
"pathParamSerializers",
",",
"messageSerializers",
",",
"serializerFactory",
",",
"exceptionSeria... | Use the given exception serializer to serialize and deserialized exceptions handled by this service.
@param exceptionSerializer The exception handler to use.
@return A copy of this descriptor. | [
"Use",
"the",
"given",
"exception",
"serializer",
"to",
"serialize",
"and",
"deserialized",
"exceptions",
"handled",
"by",
"this",
"service",
"."
] | train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L760-L762 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.detectIfNone | @Deprecated
public static Character detectIfNone(String string, CharPredicate predicate, String resultIfNone)
{
return StringIterate.detectCharIfNone(string, predicate, resultIfNone);
} | java | @Deprecated
public static Character detectIfNone(String string, CharPredicate predicate, String resultIfNone)
{
return StringIterate.detectCharIfNone(string, predicate, resultIfNone);
} | [
"@",
"Deprecated",
"public",
"static",
"Character",
"detectIfNone",
"(",
"String",
"string",
",",
"CharPredicate",
"predicate",
",",
"String",
"resultIfNone",
")",
"{",
"return",
"StringIterate",
".",
"detectCharIfNone",
"(",
"string",
",",
"predicate",
",",
"resu... | Find the first element that returns true for the specified {@code predicate}. Return the first char of the
default string if no value is found.
@deprecated since 7.0. Use {@link #detectCharIfNone(String, CharPredicate, String)} instead. | [
"Find",
"the",
"first",
"element",
"that",
"returns",
"true",
"for",
"the",
"specified",
"{",
"@code",
"predicate",
"}",
".",
"Return",
"the",
"first",
"char",
"of",
"the",
"default",
"string",
"if",
"no",
"value",
"is",
"found",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L704-L708 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.GET | public <T> Optional<T> GET(String partialUrl, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType)
{
URI uri = buildUri(partialUrl);
return executeGetRequest(uri, headers, queryParams, returnType);
} | java | public <T> Optional<T> GET(String partialUrl, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType)
{
URI uri = buildUri(partialUrl);
return executeGetRequest(uri, headers, queryParams, returnType);
} | [
"public",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"GET",
"(",
"String",
"partialUrl",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"List",
"<",
"String",
">",
"queryParams",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")",
"{... | Execute a GET call against the partial URL and deserialize the results.
@param <T> The type parameter used for the return object
@param partialUrl The partial URL to build
@param returnType The expected return type
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
@return The return type | [
"Execute",
"a",
"GET",
"call",
"against",
"the",
"partial",
"URL",
"and",
"deserialize",
"the",
"results",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L124-L129 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/CrsUtilities.java | CrsUtilities.getMetersAsWGS84 | public static double getMetersAsWGS84( double meters, Coordinate c ) {
GeodeticCalculator gc = new GeodeticCalculator(DefaultGeographicCRS.WGS84);
gc.setStartingGeographicPoint(c.x, c.y);
gc.setDirection(90, meters);
Point2D destinationGeographicPoint = gc.getDestinationGeographicPoint();
double degrees = Math.abs(destinationGeographicPoint.getX() - c.x);
return degrees;
} | java | public static double getMetersAsWGS84( double meters, Coordinate c ) {
GeodeticCalculator gc = new GeodeticCalculator(DefaultGeographicCRS.WGS84);
gc.setStartingGeographicPoint(c.x, c.y);
gc.setDirection(90, meters);
Point2D destinationGeographicPoint = gc.getDestinationGeographicPoint();
double degrees = Math.abs(destinationGeographicPoint.getX() - c.x);
return degrees;
} | [
"public",
"static",
"double",
"getMetersAsWGS84",
"(",
"double",
"meters",
",",
"Coordinate",
"c",
")",
"{",
"GeodeticCalculator",
"gc",
"=",
"new",
"GeodeticCalculator",
"(",
"DefaultGeographicCRS",
".",
"WGS84",
")",
";",
"gc",
".",
"setStartingGeographicPoint",
... | Converts meters to degrees, based on a given coordinate in 90 degrees direction.
@param meters the meters to convert.
@param c the position to consider.
@return the converted degrees. | [
"Converts",
"meters",
"to",
"degrees",
"based",
"on",
"a",
"given",
"coordinate",
"in",
"90",
"degrees",
"direction",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/CrsUtilities.java#L249-L256 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/optimization/AbstractStochasticCachingDiffUpdateFunction.java | AbstractStochasticCachingDiffUpdateFunction.calculateStochasticUpdate | public double calculateStochasticUpdate(double[] x, double xscale, int batchSize, double gain) {
getBatch(batchSize);
return calculateStochasticUpdate(x, xscale, thisBatch, gain);
} | java | public double calculateStochasticUpdate(double[] x, double xscale, int batchSize, double gain) {
getBatch(batchSize);
return calculateStochasticUpdate(x, xscale, thisBatch, gain);
} | [
"public",
"double",
"calculateStochasticUpdate",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"xscale",
",",
"int",
"batchSize",
",",
"double",
"gain",
")",
"{",
"getBatch",
"(",
"batchSize",
")",
";",
"return",
"calculateStochasticUpdate",
"(",
"x",
",",
"x... | Performs stochastic update of weights x (scaled by xscale) based
on next batch of batchSize
@param x - unscaled weights
@param xscale - how much to scale x by when performing calculations
@param batchSize - number of samples to pick next
@param gain - how much to scale adjustments to x
@return value of function at specified x (scaled by xscale) for samples | [
"Performs",
"stochastic",
"update",
"of",
"weights",
"x",
"(",
"scaled",
"by",
"xscale",
")",
"based",
"on",
"next",
"batch",
"of",
"batchSize"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/optimization/AbstractStochasticCachingDiffUpdateFunction.java#L60-L63 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Parameters.java | Parameters.setDouble | @NonNull
public Parameters setDouble(@NonNull String name, double value) {
return setValue(name, value);
} | java | @NonNull
public Parameters setDouble(@NonNull String name, double value) {
return setValue(name, value);
} | [
"@",
"NonNull",
"public",
"Parameters",
"setDouble",
"(",
"@",
"NonNull",
"String",
"name",
",",
"double",
"value",
")",
"{",
"return",
"setValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set a double value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The double value.
@return The self object. | [
"Set",
"a",
"double",
"value",
"to",
"the",
"query",
"parameter",
"referenced",
"by",
"the",
"given",
"name",
".",
"A",
"query",
"parameter",
"is",
"defined",
"by",
"using",
"the",
"Expression",
"s",
"parameter",
"(",
"String",
"name",
")",
"function",
"."... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L144-L147 |
palaima/AndroidSmoothBluetooth | library/src/main/java/io/palaima/smoothbluetooth/BluetoothService.java | BluetoothService.start | public synchronized void start(boolean android, boolean secure) {
isAndroid = android;
mIsSecure = secure;
// Cancel any thread attempting to make a connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
setState(BluetoothService.STATE_LISTEN);
// Start the thread to listen on a BluetoothServerSocket
if (mSecureAcceptThread == null) {
mSecureAcceptThread = new AcceptThread(isAndroid, mIsSecure);
mSecureAcceptThread.start();
}
} | java | public synchronized void start(boolean android, boolean secure) {
isAndroid = android;
mIsSecure = secure;
// Cancel any thread attempting to make a connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
setState(BluetoothService.STATE_LISTEN);
// Start the thread to listen on a BluetoothServerSocket
if (mSecureAcceptThread == null) {
mSecureAcceptThread = new AcceptThread(isAndroid, mIsSecure);
mSecureAcceptThread.start();
}
} | [
"public",
"synchronized",
"void",
"start",
"(",
"boolean",
"android",
",",
"boolean",
"secure",
")",
"{",
"isAndroid",
"=",
"android",
";",
"mIsSecure",
"=",
"secure",
";",
"// Cancel any thread attempting to make a connection",
"if",
"(",
"mConnectThread",
"!=",
"n... | session in listening (server) mode. Called by the Activity onResume() | [
"session",
"in",
"listening",
"(",
"server",
")",
"mode",
".",
"Called",
"by",
"the",
"Activity",
"onResume",
"()"
] | train | https://github.com/palaima/AndroidSmoothBluetooth/blob/0109c8c4e281765fe1ac7f8090c2d6db295a07c8/library/src/main/java/io/palaima/smoothbluetooth/BluetoothService.java#L91-L106 |
MenoData/Time4J | base/src/main/java/net/time4j/range/Weeks.java | Weeks.between | public static Weeks between(CalendarWeek w1, CalendarWeek w2) {
PlainDate d1 = w1.at(Weekday.MONDAY);
PlainDate d2 = w2.at(Weekday.MONDAY);
return Weeks.between(d1, d2);
} | java | public static Weeks between(CalendarWeek w1, CalendarWeek w2) {
PlainDate d1 = w1.at(Weekday.MONDAY);
PlainDate d2 = w2.at(Weekday.MONDAY);
return Weeks.between(d1, d2);
} | [
"public",
"static",
"Weeks",
"between",
"(",
"CalendarWeek",
"w1",
",",
"CalendarWeek",
"w2",
")",
"{",
"PlainDate",
"d1",
"=",
"w1",
".",
"at",
"(",
"Weekday",
".",
"MONDAY",
")",
";",
"PlainDate",
"d2",
"=",
"w2",
".",
"at",
"(",
"Weekday",
".",
"M... | /*[deutsch]
<p>Bestimmt die Differenz zwischen den angegebenen Kalenderwochen. </p>
@param w1 first calendar week
@param w2 second calendar week
@return difference in weeks | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Bestimmt",
"die",
"Differenz",
"zwischen",
"den",
"angegebenen",
"Kalenderwochen",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Weeks.java#L140-L146 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UcsApi.java | UcsApi.updateContact | public ApiSuccessResponse updateContact(String id, UpdateContactData updateContactData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = updateContactWithHttpInfo(id, updateContactData);
return resp.getData();
} | java | public ApiSuccessResponse updateContact(String id, UpdateContactData updateContactData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = updateContactWithHttpInfo(id, updateContactData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"updateContact",
"(",
"String",
"id",
",",
"UpdateContactData",
"updateContactData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"updateContactWithHttpInfo",
"(",
"id",
",",
"updateConta... | Update attributes of an existing contact
@param id id of the Contact (required)
@param updateContactData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Update",
"attributes",
"of",
"an",
"existing",
"contact"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L2176-L2179 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/util/DebugUtils.java | DebugUtils.traceView | private static void traceView(String additionalMsg, UIViewRoot viewRoot)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
if (additionalMsg != null)
{
ps.println(additionalMsg);
}
ps.println("========================================");
printView(viewRoot, ps);
ps.println("========================================");
ps.close();
log.finest(baos.toString());
} | java | private static void traceView(String additionalMsg, UIViewRoot viewRoot)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
if (additionalMsg != null)
{
ps.println(additionalMsg);
}
ps.println("========================================");
printView(viewRoot, ps);
ps.println("========================================");
ps.close();
log.finest(baos.toString());
} | [
"private",
"static",
"void",
"traceView",
"(",
"String",
"additionalMsg",
",",
"UIViewRoot",
"viewRoot",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"PrintStream",
"ps",
"=",
"new",
"PrintStream",
"(",
"baos",
"... | Be careful, when using this version of traceView: Some component properties (e.g. getRenderer) assume, that there
is a valid viewRoot set in the FacesContext!
@param additionalMsg
@param viewRoot | [
"Be",
"careful",
"when",
"using",
"this",
"version",
"of",
"traceView",
":",
"Some",
"component",
"properties",
"(",
"e",
".",
"g",
".",
"getRenderer",
")",
"assume",
"that",
"there",
"is",
"a",
"valid",
"viewRoot",
"set",
"in",
"the",
"FacesContext!"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/util/DebugUtils.java#L131-L144 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java | GELFMessage.getJSON | public String getJSON(long maxBytes) {
try {
switch (getGELFType()) {
case ZLIB:
return Tools.decompressZlib(payload, maxBytes);
case GZIP:
return Tools.decompressGzip(payload, maxBytes);
case UNCOMPRESSED:
return new String(payload, StandardCharsets.UTF_8);
case CHUNKED:
case UNSUPPORTED:
throw new IllegalStateException("Unknown GELF type. Not supported.");
}
} catch (final IOException e) {
// Note that the UnsupportedEncodingException thrown by 'new String' can never happen because UTF-8
// is a mandatory JRE encoding which is always present. So we only need to mention the decompress exceptions here.
throw new IllegalStateException("Failed to decompress the GELF message payload", e);
}
return null;
} | java | public String getJSON(long maxBytes) {
try {
switch (getGELFType()) {
case ZLIB:
return Tools.decompressZlib(payload, maxBytes);
case GZIP:
return Tools.decompressGzip(payload, maxBytes);
case UNCOMPRESSED:
return new String(payload, StandardCharsets.UTF_8);
case CHUNKED:
case UNSUPPORTED:
throw new IllegalStateException("Unknown GELF type. Not supported.");
}
} catch (final IOException e) {
// Note that the UnsupportedEncodingException thrown by 'new String' can never happen because UTF-8
// is a mandatory JRE encoding which is always present. So we only need to mention the decompress exceptions here.
throw new IllegalStateException("Failed to decompress the GELF message payload", e);
}
return null;
} | [
"public",
"String",
"getJSON",
"(",
"long",
"maxBytes",
")",
"{",
"try",
"{",
"switch",
"(",
"getGELFType",
"(",
")",
")",
"{",
"case",
"ZLIB",
":",
"return",
"Tools",
".",
"decompressZlib",
"(",
"payload",
",",
"maxBytes",
")",
";",
"case",
"GZIP",
":... | Return the JSON payload of the GELF message.
@param maxBytes The maximum number of bytes to read from a compressed GELF payload. {@code -1} means unlimited.
@return The extracted JSON payload of the GELF message.
@see Tools#decompressGzip(byte[], long)
@see Tools#decompressZlib(byte[], long) | [
"Return",
"the",
"JSON",
"payload",
"of",
"the",
"GELF",
"message",
"."
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java#L70-L89 |
podio/podio-java | src/main/java/com/podio/item/ItemAPI.java | ItemAPI.getItemRevision | public ItemRevision getItemRevision(int itemId, int revisionId) {
return getResourceFactory().getApiResource(
"/item/" + itemId + "/revision/" + revisionId).get(
ItemRevision.class);
} | java | public ItemRevision getItemRevision(int itemId, int revisionId) {
return getResourceFactory().getApiResource(
"/item/" + itemId + "/revision/" + revisionId).get(
ItemRevision.class);
} | [
"public",
"ItemRevision",
"getItemRevision",
"(",
"int",
"itemId",
",",
"int",
"revisionId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/item/\"",
"+",
"itemId",
"+",
"\"/revision/\"",
"+",
"revisionId",
")",
".",
"get",
... | Returns the data about the specific revision on an item
@param itemId
The id of the item
@param revisionId
The running revision number, starts at 0 for the initial
revision
@return The revision | [
"Returns",
"the",
"data",
"about",
"the",
"specific",
"revision",
"on",
"an",
"item"
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/item/ItemAPI.java#L230-L234 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/AgreementsInner.java | AgreementsInner.createOrUpdate | public IntegrationAccountAgreementInner createOrUpdate(String resourceGroupName, String integrationAccountName, String agreementName, IntegrationAccountAgreementInner agreement) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, agreementName, agreement).toBlocking().single().body();
} | java | public IntegrationAccountAgreementInner createOrUpdate(String resourceGroupName, String integrationAccountName, String agreementName, IntegrationAccountAgreementInner agreement) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, agreementName, agreement).toBlocking().single().body();
} | [
"public",
"IntegrationAccountAgreementInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"agreementName",
",",
"IntegrationAccountAgreementInner",
"agreement",
")",
"{",
"return",
"createOrUpdateWithServiceRespons... | Creates or updates an integration account agreement.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param agreementName The integration account agreement name.
@param agreement The integration account agreement.
@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 IntegrationAccountAgreementInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"integration",
"account",
"agreement",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/AgreementsInner.java#L448-L450 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassPathUtils.java | ClassPathUtils.toFullyQualifiedName | @GwtIncompatible("incompatible method")
public static String toFullyQualifiedName(final Package context, final String resourceName) {
Validate.notNull(context, "Parameter '%s' must not be null!", "context" );
Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName");
return context.getName() + "." + resourceName;
} | java | @GwtIncompatible("incompatible method")
public static String toFullyQualifiedName(final Package context, final String resourceName) {
Validate.notNull(context, "Parameter '%s' must not be null!", "context" );
Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName");
return context.getName() + "." + resourceName;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"String",
"toFullyQualifiedName",
"(",
"final",
"Package",
"context",
",",
"final",
"String",
"resourceName",
")",
"{",
"Validate",
".",
"notNull",
"(",
"context",
",",
"\"Parameter '%s... | Returns the fully qualified name for the resource with name {@code resourceName} relative to the given context.
<p>Note that this method does not check whether the resource actually exists.
It only constructs the name.
Null inputs are not allowed.</p>
<pre>
ClassPathUtils.toFullyQualifiedName(StringUtils.class.getPackage(), "StringUtils.properties") = "org.apache.commons.lang3.StringUtils.properties"
</pre>
@param context The context for constructing the name.
@param resourceName the resource name to construct the fully qualified name for.
@return the fully qualified name of the resource with name {@code resourceName}.
@throws java.lang.NullPointerException if either {@code context} or {@code resourceName} is null. | [
"Returns",
"the",
"fully",
"qualified",
"name",
"for",
"the",
"resource",
"with",
"name",
"{",
"@code",
"resourceName",
"}",
"relative",
"to",
"the",
"given",
"context",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassPathUtils.java#L82-L87 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/ReservedDBWords.java | ReservedDBWords.isReservedWord | public static boolean isReservedWord(Dialect dialect, String word) {
if (!isReservedWord(word))
return false;
String fitDatabases = RESERVED_WORDS.get(word.toUpperCase()).toUpperCase();
if (fitDatabases.contains("ANSI"))
return true;
String dia = dialect.toString().replace("Dialect", "").toUpperCase();
if (dia.length() >= 4)
dia = dia.substring(0, 4);// only compare first 4 letters
return (fitDatabases.contains(dia));
} | java | public static boolean isReservedWord(Dialect dialect, String word) {
if (!isReservedWord(word))
return false;
String fitDatabases = RESERVED_WORDS.get(word.toUpperCase()).toUpperCase();
if (fitDatabases.contains("ANSI"))
return true;
String dia = dialect.toString().replace("Dialect", "").toUpperCase();
if (dia.length() >= 4)
dia = dia.substring(0, 4);// only compare first 4 letters
return (fitDatabases.contains(dia));
} | [
"public",
"static",
"boolean",
"isReservedWord",
"(",
"Dialect",
"dialect",
",",
"String",
"word",
")",
"{",
"if",
"(",
"!",
"isReservedWord",
"(",
"word",
")",
")",
"return",
"false",
";",
"String",
"fitDatabases",
"=",
"RESERVED_WORDS",
".",
"get",
"(",
... | Check if is a dialect reserved word of ANSI-SQL reserved word
@return false:not reserved word. true:reserved by dialect or ANSI-SQL | [
"Check",
"if",
"is",
"a",
"dialect",
"reserved",
"word",
"of",
"ANSI",
"-",
"SQL",
"reserved",
"word"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/ReservedDBWords.java#L306-L316 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/NativeQuery.java | NativeQuery.withResultSetAsyncListener | public NativeQuery withResultSetAsyncListener(Function<ResultSet, ResultSet> resultSetAsyncListener) {
this.options.setResultSetAsyncListeners(Optional.of(asList(resultSetAsyncListener)));
return this;
} | java | public NativeQuery withResultSetAsyncListener(Function<ResultSet, ResultSet> resultSetAsyncListener) {
this.options.setResultSetAsyncListeners(Optional.of(asList(resultSetAsyncListener)));
return this;
} | [
"public",
"NativeQuery",
"withResultSetAsyncListener",
"(",
"Function",
"<",
"ResultSet",
",",
"ResultSet",
">",
"resultSetAsyncListener",
")",
"{",
"this",
".",
"options",
".",
"setResultSetAsyncListeners",
"(",
"Optional",
".",
"of",
"(",
"asList",
"(",
"resultSet... | Add the given async listener on the {@link com.datastax.driver.core.ResultSet} object.
Example of usage:
<pre class="code"><code class="java">
.withResultSetAsyncListener(resultSet -> {
//Do something with the resultSet object here
})
</code></pre>
Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong> | [
"Add",
"the",
"given",
"async",
"listener",
"on",
"the",
"{",
"@link",
"com",
".",
"datastax",
".",
"driver",
".",
"core",
".",
"ResultSet",
"}",
"object",
".",
"Example",
"of",
"usage",
":",
"<pre",
"class",
"=",
"code",
">",
"<code",
"class",
"=",
... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/NativeQuery.java#L144-L147 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java | CommerceSubscriptionEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceSubscriptionEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceSubscriptionEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceSubscriptionEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
... | Returns all the commerce subscription entries where groupId = ?.
@param groupId the group ID
@return the matching commerce subscription entries | [
"Returns",
"all",
"the",
"commerce",
"subscription",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L1536-L1539 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java | GuiStandardUtils.createDialogTitle | public static String createDialogTitle(String appName, String dialogName) {
if (appName != null) {
StringBuffer buf = new StringBuffer(appName);
buf.append(": ");
buf.append(dialogName);
return buf.toString();
}
return dialogName;
} | java | public static String createDialogTitle(String appName, String dialogName) {
if (appName != null) {
StringBuffer buf = new StringBuffer(appName);
buf.append(": ");
buf.append(dialogName);
return buf.toString();
}
return dialogName;
} | [
"public",
"static",
"String",
"createDialogTitle",
"(",
"String",
"appName",
",",
"String",
"dialogName",
")",
"{",
"if",
"(",
"appName",
"!=",
"null",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"appName",
")",
";",
"buf",
".",
"appe... | Return text which conforms to the Look and Feel Design Guidelines for the
title of a dialog : the application name, a colon, then the name of the
specific dialog.
@param dialogName
the short name of the dialog. | [
"Return",
"text",
"which",
"conforms",
"to",
"the",
"Look",
"and",
"Feel",
"Design",
"Guidelines",
"for",
"the",
"title",
"of",
"a",
"dialog",
":",
"the",
"application",
"name",
"a",
"colon",
"then",
"the",
"name",
"of",
"the",
"specific",
"dialog",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/GuiStandardUtils.java#L95-L104 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java | FormatUtil.findSplitpoint | public static int findSplitpoint(String s, int width) {
// the newline (or EOS) is the fallback split position.
int in = s.indexOf(NEWLINE);
in = in < 0 ? s.length() : in;
// Good enough?
if(in < width) {
return in;
}
// otherwise, search for whitespace
int iw = s.lastIndexOf(' ', width);
// good whitespace found?
if(iw >= 0 && iw < width) {
return iw;
}
// sub-optimal splitpoint - retry AFTER the given position
int bp = nextPosition(s.indexOf(' ', width), s.indexOf(NEWLINE, width));
if(bp >= 0) {
return bp;
}
// even worse - can't split!
return s.length();
} | java | public static int findSplitpoint(String s, int width) {
// the newline (or EOS) is the fallback split position.
int in = s.indexOf(NEWLINE);
in = in < 0 ? s.length() : in;
// Good enough?
if(in < width) {
return in;
}
// otherwise, search for whitespace
int iw = s.lastIndexOf(' ', width);
// good whitespace found?
if(iw >= 0 && iw < width) {
return iw;
}
// sub-optimal splitpoint - retry AFTER the given position
int bp = nextPosition(s.indexOf(' ', width), s.indexOf(NEWLINE, width));
if(bp >= 0) {
return bp;
}
// even worse - can't split!
return s.length();
} | [
"public",
"static",
"int",
"findSplitpoint",
"(",
"String",
"s",
",",
"int",
"width",
")",
"{",
"// the newline (or EOS) is the fallback split position.",
"int",
"in",
"=",
"s",
".",
"indexOf",
"(",
"NEWLINE",
")",
";",
"in",
"=",
"in",
"<",
"0",
"?",
"s",
... | Find the first space before position w or if there is none after w.
@param s String
@param width Width
@return index of best whitespace or <code>-1</code> if no whitespace was
found. | [
"Find",
"the",
"first",
"space",
"before",
"position",
"w",
"or",
"if",
"there",
"is",
"none",
"after",
"w",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L764-L785 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceMessages.java | CmsWorkplaceMessages.getNewResourceTitle | public static String getNewResourceTitle(CmsWorkplace wp, String name) {
// try to find the localized key
String title = wp.key(GUI_NEW_RESOURCE_TITLE_PREFIX + name.toLowerCase());
if (CmsMessages.isUnknownKey(title)) {
// still unknown - use default title
title = wp.key(org.opencms.workplace.explorer.Messages.GUI_TITLE_NEWFILEOTHER_0);
}
return title;
} | java | public static String getNewResourceTitle(CmsWorkplace wp, String name) {
// try to find the localized key
String title = wp.key(GUI_NEW_RESOURCE_TITLE_PREFIX + name.toLowerCase());
if (CmsMessages.isUnknownKey(title)) {
// still unknown - use default title
title = wp.key(org.opencms.workplace.explorer.Messages.GUI_TITLE_NEWFILEOTHER_0);
}
return title;
} | [
"public",
"static",
"String",
"getNewResourceTitle",
"(",
"CmsWorkplace",
"wp",
",",
"String",
"name",
")",
"{",
"// try to find the localized key",
"String",
"title",
"=",
"wp",
".",
"key",
"(",
"GUI_NEW_RESOURCE_TITLE_PREFIX",
"+",
"name",
".",
"toLowerCase",
"(",... | Returns the title for the "new resource" dialog.<p>
It will look up a key with the prefix {@link #GUI_NEW_RESOURCE_TITLE_PREFIX}
and the given name appended (converted to lower case).<p>
If this key is not found, the value of
{@link org.opencms.workplace.explorer.Messages#GUI_TITLE_NEWFILEOTHER_0} will be returned.<p>
@param wp an instance of a {@link CmsWorkplace} to resolve the key name with
@param name the type to generate the title for
@return the title for the "new resource" dialog | [
"Returns",
"the",
"title",
"for",
"the",
"new",
"resource",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceMessages.java#L111-L120 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.setDnsCachePolicy | public static void setDnsCachePolicy(int cacheSeconds) {
try {
InetAddressCacheUtil.setDnsCachePolicy(cacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsCachePolicy, cause: " + e.toString(), e);
}
} | java | public static void setDnsCachePolicy(int cacheSeconds) {
try {
InetAddressCacheUtil.setDnsCachePolicy(cacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsCachePolicy, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"void",
"setDnsCachePolicy",
"(",
"int",
"cacheSeconds",
")",
"{",
"try",
"{",
"InetAddressCacheUtil",
".",
"setDnsCachePolicy",
"(",
"cacheSeconds",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulato... | Set JVM DNS cache policy
<p>
NOTE: if Security Manage is turn on, JVM DNS cache policy set will not take effective. You can check by method {@link #getDnsCachePolicy()}.
@param cacheSeconds set default dns cache time. Special input case:
<ul>
<li> {@code -1} means never expired.(In effect, all negative value)</li>
<li> {@code 0} never cached.</li>
</ul>
@throws DnsCacheManipulatorException Operation fail
@since 1.3.0 | [
"Set",
"JVM",
"DNS",
"cache",
"policy",
"<p",
">",
"NOTE",
":",
"if",
"Security",
"Manage",
"is",
"turn",
"on",
"JVM",
"DNS",
"cache",
"policy",
"set",
"will",
"not",
"take",
"effective",
".",
"You",
"can",
"check",
"by",
"method",
"{",
"@link",
"#getD... | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L247-L253 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.findByIdLoadColumns | public M findByIdLoadColumns(Object[] idValues, String columns) {
Table table = _getTable();
if (table.getPrimaryKey().length != idValues.length)
throw new IllegalArgumentException("id values error, need " + table.getPrimaryKey().length + " id value");
Config config = _getConfig();
String sql = config.dialect.forModelFindById(table, columns);
List<M> result = find(config, sql, idValues);
return result.size() > 0 ? result.get(0) : null;
} | java | public M findByIdLoadColumns(Object[] idValues, String columns) {
Table table = _getTable();
if (table.getPrimaryKey().length != idValues.length)
throw new IllegalArgumentException("id values error, need " + table.getPrimaryKey().length + " id value");
Config config = _getConfig();
String sql = config.dialect.forModelFindById(table, columns);
List<M> result = find(config, sql, idValues);
return result.size() > 0 ? result.get(0) : null;
} | [
"public",
"M",
"findByIdLoadColumns",
"(",
"Object",
"[",
"]",
"idValues",
",",
"String",
"columns",
")",
"{",
"Table",
"table",
"=",
"_getTable",
"(",
")",
";",
"if",
"(",
"table",
".",
"getPrimaryKey",
"(",
")",
".",
"length",
"!=",
"idValues",
".",
... | Find model by composite id values and load specific columns only.
<pre>
Example:
User user = User.dao.findByIdLoadColumns(new Object[]{123, 456}, "name, age");
</pre>
@param idValues the composite id values of the model
@param columns the specific columns to load | [
"Find",
"model",
"by",
"composite",
"id",
"values",
"and",
"load",
"specific",
"columns",
"only",
".",
"<pre",
">",
"Example",
":",
"User",
"user",
"=",
"User",
".",
"dao",
".",
"findByIdLoadColumns",
"(",
"new",
"Object",
"[]",
"{",
"123",
"456",
"}",
... | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L784-L793 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsToolManager.java | CmsToolManager.setBaseToolPath | public void setBaseToolPath(CmsWorkplace wp, String baseToolPath) {
// use last used base if param empty
if (CmsStringUtil.isEmpty(baseToolPath) || baseToolPath.trim().equals("null")) {
baseToolPath = getBaseToolPath(wp);
}
baseToolPath = repairPath(wp, baseToolPath);
// set it
CmsToolUserData userData = getUserData(wp);
userData.setBaseTool(userData.getRootKey(), baseToolPath);
} | java | public void setBaseToolPath(CmsWorkplace wp, String baseToolPath) {
// use last used base if param empty
if (CmsStringUtil.isEmpty(baseToolPath) || baseToolPath.trim().equals("null")) {
baseToolPath = getBaseToolPath(wp);
}
baseToolPath = repairPath(wp, baseToolPath);
// set it
CmsToolUserData userData = getUserData(wp);
userData.setBaseTool(userData.getRootKey(), baseToolPath);
} | [
"public",
"void",
"setBaseToolPath",
"(",
"CmsWorkplace",
"wp",
",",
"String",
"baseToolPath",
")",
"{",
"// use last used base if param empty",
"if",
"(",
"CmsStringUtil",
".",
"isEmpty",
"(",
"baseToolPath",
")",
"||",
"baseToolPath",
".",
"trim",
"(",
")",
".",... | Sets the base tool path.<p>
@param wp the workplace object
@param baseToolPath the base tool path to set | [
"Sets",
"the",
"base",
"tool",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L535-L545 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getLong | public static long getLong(@NotNull ServletRequest request, @NotNull String param, long defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toLong(value, defaultValue);
} | java | public static long getLong(@NotNull ServletRequest request, @NotNull String param, long defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toLong(value, defaultValue);
} | [
"public",
"static",
"long",
"getLong",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"long",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"return",
... | Returns a request parameter as long.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or is not a number. | [
"Returns",
"a",
"request",
"parameter",
"as",
"long",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L178-L181 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java | ActorSDK.startAuthActivity | public void startAuthActivity(Context context, Bundle extras) {
if (!startDelegateActivity(context, delegate.getAuthStartIntent(), extras)) {
startActivity(context, extras, AuthActivity.class);
}
} | java | public void startAuthActivity(Context context, Bundle extras) {
if (!startDelegateActivity(context, delegate.getAuthStartIntent(), extras)) {
startActivity(context, extras, AuthActivity.class);
}
} | [
"public",
"void",
"startAuthActivity",
"(",
"Context",
"context",
",",
"Bundle",
"extras",
")",
"{",
"if",
"(",
"!",
"startDelegateActivity",
"(",
"context",
",",
"delegate",
".",
"getAuthStartIntent",
"(",
")",
",",
"extras",
")",
")",
"{",
"startActivity",
... | Method is used internally for starting default activity or activity added in delegate
@param context current context
@param extras activity extras | [
"Method",
"is",
"used",
"internally",
"for",
"starting",
"default",
"activity",
"or",
"activity",
"added",
"in",
"delegate"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java#L891-L895 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteEntityRole | public OperationStatus deleteEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return deleteEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | java | public OperationStatus deleteEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return deleteEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deleteEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"deleteEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
... | Delete an entity role.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Delete",
"an",
"entity",
"role",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11047-L11049 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetEndpointAttributesResult.java | GetEndpointAttributesResult.withAttributes | public GetEndpointAttributesResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public GetEndpointAttributesResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"GetEndpointAttributesResult",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Attributes include the following:
</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use this
data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false
when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true,
typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device. This is
returned from the notification service when an app and mobile device are registered with the notification
service.
</p>
</li>
</ul>
@param attributes
Attributes include the following:</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use
this data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to
false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it
back to true, typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device.
This is returned from the notification service when an app and mobile device are registered with the
notification service.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Attributes",
"include",
"the",
"following",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<p",
">",
"<code",
">",
"CustomUserData<",
"/",
"code",
">",
"–",
"arbitrary",
"user",
"data",
"to",
"associate",
"with",
"the",
"endpoint",
".",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetEndpointAttributesResult.java#L225-L228 |
netty/netty | common/src/main/java/io/netty/util/ResourceLeakDetectorFactory.java | ResourceLeakDetectorFactory.newResourceLeakDetector | @SuppressWarnings("deprecation")
public <T> ResourceLeakDetector<T> newResourceLeakDetector(Class<T> resource, int samplingInterval) {
return newResourceLeakDetector(resource, ResourceLeakDetector.SAMPLING_INTERVAL, Long.MAX_VALUE);
} | java | @SuppressWarnings("deprecation")
public <T> ResourceLeakDetector<T> newResourceLeakDetector(Class<T> resource, int samplingInterval) {
return newResourceLeakDetector(resource, ResourceLeakDetector.SAMPLING_INTERVAL, Long.MAX_VALUE);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"<",
"T",
">",
"ResourceLeakDetector",
"<",
"T",
">",
"newResourceLeakDetector",
"(",
"Class",
"<",
"T",
">",
"resource",
",",
"int",
"samplingInterval",
")",
"{",
"return",
"newResourceLeakDetector",... | Returns a new instance of a {@link ResourceLeakDetector} with the given resource class.
@param resource the resource class used to initialize the {@link ResourceLeakDetector}
@param samplingInterval the interval on which sampling takes place
@param <T> the type of the resource class
@return a new instance of {@link ResourceLeakDetector} | [
"Returns",
"a",
"new",
"instance",
"of",
"a",
"{",
"@link",
"ResourceLeakDetector",
"}",
"with",
"the",
"given",
"resource",
"class",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ResourceLeakDetectorFactory.java#L91-L94 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arraylike/ArrayLikeUtil.java | ArrayLikeUtil.getIndexOfMaximum | public static <A> int getIndexOfMaximum(A array, NumberArrayAdapter<?, A> adapter) throws IndexOutOfBoundsException {
final int size = adapter.size(array);
int index = 0;
double max = adapter.getDouble(array, 0);
for (int i = 1; i < size; i++) {
double val = adapter.getDouble(array, i);
if (val > max) {
max = val;
index = i;
}
}
return index;
} | java | public static <A> int getIndexOfMaximum(A array, NumberArrayAdapter<?, A> adapter) throws IndexOutOfBoundsException {
final int size = adapter.size(array);
int index = 0;
double max = adapter.getDouble(array, 0);
for (int i = 1; i < size; i++) {
double val = adapter.getDouble(array, i);
if (val > max) {
max = val;
index = i;
}
}
return index;
} | [
"public",
"static",
"<",
"A",
">",
"int",
"getIndexOfMaximum",
"(",
"A",
"array",
",",
"NumberArrayAdapter",
"<",
"?",
",",
"A",
">",
"adapter",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"final",
"int",
"size",
"=",
"adapter",
".",
"size",
"(",
"arr... | Returns the index of the maximum of the given values. If no value is bigger
than the first, the index of the first entry is returned.
@param <A> array type
@param array Array to inspect
@param adapter API adapter class
@return the index of the maximum in the given values
@throws IndexOutOfBoundsException if the length of the array is 0. | [
"Returns",
"the",
"index",
"of",
"the",
"maximum",
"of",
"the",
"given",
"values",
".",
"If",
"no",
"value",
"is",
"bigger",
"than",
"the",
"first",
"the",
"index",
"of",
"the",
"first",
"entry",
"is",
"returned",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arraylike/ArrayLikeUtil.java#L120-L132 |
xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/action/SafetyChecker.java | SafetyChecker.doCheck | public static UnitResponse doCheck(WhereAction action, Map map) {
String[] whereArray = action.searchConditions();
if (whereArray != null) {
for (String whereFragment : whereArray) {
if (!action.ignoreWhereFragment(whereFragment, map)) {
return UnitResponse.createSuccess("db safety check passed.");
}
}
}
String wheres = Arrays.toString(whereArray);
String errMsg = String.format("安全检查不通过...检查where语句%s发现它很可能是一个全表操作!参数=%s", wheres, map);
return UnitResponse.createError(DaoGroup.CODE_SQL_ERROR, JdbcPatternUtil.getCamelKeys(wheres), errMsg);
} | java | public static UnitResponse doCheck(WhereAction action, Map map) {
String[] whereArray = action.searchConditions();
if (whereArray != null) {
for (String whereFragment : whereArray) {
if (!action.ignoreWhereFragment(whereFragment, map)) {
return UnitResponse.createSuccess("db safety check passed.");
}
}
}
String wheres = Arrays.toString(whereArray);
String errMsg = String.format("安全检查不通过...检查where语句%s发现它很可能是一个全表操作!参数=%s", wheres, map);
return UnitResponse.createError(DaoGroup.CODE_SQL_ERROR, JdbcPatternUtil.getCamelKeys(wheres), errMsg);
} | [
"public",
"static",
"UnitResponse",
"doCheck",
"(",
"WhereAction",
"action",
",",
"Map",
"map",
")",
"{",
"String",
"[",
"]",
"whereArray",
"=",
"action",
".",
"searchConditions",
"(",
")",
";",
"if",
"(",
"whereArray",
"!=",
"null",
")",
"{",
"for",
"("... | Check whether where claus is ignored.
@param action the where action
@param map parameter map
@return succeeded response for checking pass, and failure response for checking not passed. | [
"Check",
"whether",
"where",
"claus",
"is",
"ignored",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/action/SafetyChecker.java#L41-L53 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_bill_GET | public ArrayList<OvhBill> project_serviceName_bill_GET(String serviceName, Date from, Date to) throws IOException {
String qPath = "/cloud/project/{serviceName}/bill";
StringBuilder sb = path(qPath, serviceName);
query(sb, "from", from);
query(sb, "to", to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t19);
} | java | public ArrayList<OvhBill> project_serviceName_bill_GET(String serviceName, Date from, Date to) throws IOException {
String qPath = "/cloud/project/{serviceName}/bill";
StringBuilder sb = path(qPath, serviceName);
query(sb, "from", from);
query(sb, "to", to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t19);
} | [
"public",
"ArrayList",
"<",
"OvhBill",
">",
"project_serviceName_bill_GET",
"(",
"String",
"serviceName",
",",
"Date",
"from",
",",
"Date",
"to",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/bill\"",
";",
"StringBuilder",
... | Get your project bills
REST: GET /cloud/project/{serviceName}/bill
@param to [required] Get bills to
@param from [required] Get bills from
@param serviceName [required] The project id | [
"Get",
"your",
"project",
"bills"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1691-L1698 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/MySQLQueryFactory.java | MySQLQueryFactory.insertOnDuplicateKeyUpdate | public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?>... clauses) {
SQLInsertClause insert = insert(entity);
StringBuilder flag = new StringBuilder(" on duplicate key update ");
for (int i = 0; i < clauses.length; i++) {
flag.append(i > 0 ? ", " : "").append("{" + i + "}");
}
insert.addFlag(Position.END, ExpressionUtils.template(String.class, flag.toString(), clauses));
return insert;
} | java | public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?>... clauses) {
SQLInsertClause insert = insert(entity);
StringBuilder flag = new StringBuilder(" on duplicate key update ");
for (int i = 0; i < clauses.length; i++) {
flag.append(i > 0 ? ", " : "").append("{" + i + "}");
}
insert.addFlag(Position.END, ExpressionUtils.template(String.class, flag.toString(), clauses));
return insert;
} | [
"public",
"SQLInsertClause",
"insertOnDuplicateKeyUpdate",
"(",
"RelationalPath",
"<",
"?",
">",
"entity",
",",
"Expression",
"<",
"?",
">",
"...",
"clauses",
")",
"{",
"SQLInsertClause",
"insert",
"=",
"insert",
"(",
"entity",
")",
";",
"StringBuilder",
"flag",... | Create a INSERT ... ON DUPLICATE KEY UPDATE clause
@param entity table to insert to
@param clauses clauses
@return insert clause | [
"Create",
"a",
"INSERT",
"...",
"ON",
"DUPLICATE",
"KEY",
"UPDATE",
"clause"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/MySQLQueryFactory.java#L93-L101 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/RecordList.java | RecordList.addRecord | public void addRecord(Rec record, boolean bMainQuery)
{
if (record == null)
return;
if (this.contains(record))
{ // Don't add this twice.
if (!bMainQuery)
return;
this.removeRecord(record); // Change order
}
if (bMainQuery)
this.insertElementAt(record, 0);
else
this.addElement(record);
} | java | public void addRecord(Rec record, boolean bMainQuery)
{
if (record == null)
return;
if (this.contains(record))
{ // Don't add this twice.
if (!bMainQuery)
return;
this.removeRecord(record); // Change order
}
if (bMainQuery)
this.insertElementAt(record, 0);
else
this.addElement(record);
} | [
"public",
"void",
"addRecord",
"(",
"Rec",
"record",
",",
"boolean",
"bMainQuery",
")",
"{",
"if",
"(",
"record",
"==",
"null",
")",
"return",
";",
"if",
"(",
"this",
".",
"contains",
"(",
"record",
")",
")",
"{",
"// Don't add this twice.",
"if",
"(",
... | Add this record to this list.
@param record The record to add.
@param bMainQuery If this is the main record. | [
"Add",
"this",
"record",
"to",
"this",
"list",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/RecordList.java#L102-L116 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.adjustLinks | public void adjustLinks(Map<String, String> sourceTargetMap, String targetParentFolder) throws CmsException {
CmsObject cms = OpenCms.initCmsObject(this);
cms.getRequestContext().setSiteRoot("");
List<CmsPair<String, String>> sourcesAndTargets = new ArrayList<CmsPair<String, String>>();
for (Map.Entry<String, String> entry : sourceTargetMap.entrySet()) {
String rootSource = addSiteRoot(entry.getKey());
String rootTarget = addSiteRoot(entry.getValue());
sourcesAndTargets.add(CmsPair.create(rootSource, rootTarget));
}
String rootTargetParentFolder = addSiteRoot(targetParentFolder);
CmsLinkRewriter rewriter = new CmsLinkRewriter(cms, rootTargetParentFolder, sourcesAndTargets);
rewriter.rewriteLinks();
} | java | public void adjustLinks(Map<String, String> sourceTargetMap, String targetParentFolder) throws CmsException {
CmsObject cms = OpenCms.initCmsObject(this);
cms.getRequestContext().setSiteRoot("");
List<CmsPair<String, String>> sourcesAndTargets = new ArrayList<CmsPair<String, String>>();
for (Map.Entry<String, String> entry : sourceTargetMap.entrySet()) {
String rootSource = addSiteRoot(entry.getKey());
String rootTarget = addSiteRoot(entry.getValue());
sourcesAndTargets.add(CmsPair.create(rootSource, rootTarget));
}
String rootTargetParentFolder = addSiteRoot(targetParentFolder);
CmsLinkRewriter rewriter = new CmsLinkRewriter(cms, rootTargetParentFolder, sourcesAndTargets);
rewriter.rewriteLinks();
} | [
"public",
"void",
"adjustLinks",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"sourceTargetMap",
",",
"String",
"targetParentFolder",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"this",
")",
";",
"cms",
... | This method works just like {@link CmsObject#adjustLinks(String, String)}, but instead of specifying
a single source and target folder, you can specify multiple sources and the corresponding targets in
a map of strings.
@param sourceTargetMap a map with the source files as keys and the corresponding targets as values
@param targetParentFolder the folder into which the source files have been copied
@throws CmsException if something goes wrong | [
"This",
"method",
"works",
"just",
"like",
"{",
"@link",
"CmsObject#adjustLinks",
"(",
"String",
"String",
")",
"}",
"but",
"instead",
"of",
"specifying",
"a",
"single",
"source",
"and",
"target",
"folder",
"you",
"can",
"specify",
"multiple",
"sources",
"and"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L212-L225 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java | ComponentEnhancer.injectComponent | @SuppressWarnings("unchecked")
private static void injectComponent(final FacadeReady<?> component, final Field field, final Object... keyParts) {
try {
if (Command.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().commandFacade().retrieve((Class<Command>) field.getType(), keyParts));
} else if (Service.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().serviceFacade().retrieve((Class<Service>) field.getType(), keyParts));
} else if (Model.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().uiFacade().retrieve((Class<Model>) field.getType(), keyParts));
}
} catch (IllegalArgumentException | CoreException e) {
LOGGER.error(COMPONENT_INJECTION_FAILURE, component.getClass(), e);
}
} | java | @SuppressWarnings("unchecked")
private static void injectComponent(final FacadeReady<?> component, final Field field, final Object... keyParts) {
try {
if (Command.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().commandFacade().retrieve((Class<Command>) field.getType(), keyParts));
} else if (Service.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().serviceFacade().retrieve((Class<Service>) field.getType(), keyParts));
} else if (Model.class.isAssignableFrom(field.getType())) {
ClassUtility.setFieldValue(field, component, component.localFacade().globalFacade().uiFacade().retrieve((Class<Model>) field.getType(), keyParts));
}
} catch (IllegalArgumentException | CoreException e) {
LOGGER.error(COMPONENT_INJECTION_FAILURE, component.getClass(), e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"injectComponent",
"(",
"final",
"FacadeReady",
"<",
"?",
">",
"component",
",",
"final",
"Field",
"field",
",",
"final",
"Object",
"...",
"keyParts",
")",
"{",
"try",
"{",
"if"... | Inject a component into the property of an other.
@param component the component
@param field the field
@param keyParts the key parts | [
"Inject",
"a",
"component",
"into",
"the",
"property",
"of",
"an",
"other",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java#L137-L152 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java | HttpSessionContextImpl.getIHttpSession | public HttpSession getIHttpSession(HttpServletRequest _request, HttpServletResponse _response, boolean create)
{
return getIHttpSession(_request, _response, create, false);
} | java | public HttpSession getIHttpSession(HttpServletRequest _request, HttpServletResponse _response, boolean create)
{
return getIHttpSession(_request, _response, create, false);
} | [
"public",
"HttpSession",
"getIHttpSession",
"(",
"HttpServletRequest",
"_request",
",",
"HttpServletResponse",
"_response",
",",
"boolean",
"create",
")",
"{",
"return",
"getIHttpSession",
"(",
"_request",
",",
"_response",
",",
"create",
",",
"false",
")",
";",
"... | /*
This method called by webcontainer when app requests session. We always
pass false as cacheOnly parm; we need to search for existing session in
cache and persistent stores when the app requests session | [
"/",
"*",
"This",
"method",
"called",
"by",
"webcontainer",
"when",
"app",
"requests",
"session",
".",
"We",
"always",
"pass",
"false",
"as",
"cacheOnly",
"parm",
";",
"we",
"need",
"to",
"search",
"for",
"existing",
"session",
"in",
"cache",
"and",
"persi... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java#L659-L662 |
fnklabs/draenei | src/main/java/com/fnklabs/draenei/analytics/TextUtils.java | TextUtils.isNormalWord | public boolean isNormalWord(@NotNull String word, @NotNull Language language) {
Timer timer = MetricsFactory.getMetrics().getTimer(MetricsType.TEXT_UTILS_IS_NORMAL_WORD.name());
if (StringUtils.isEmpty(word)) {
return false;
}
try {
Timer morphTimer = MetricsFactory.getMetrics().getTimer(MetricsType.TEXT_UTILS_GET_MORPH_INFO.name());
List<String> morphInfo = MorphologyFactory.getMorphology(language).getMorphInfo(word);
morphTimer.stop();
return morphInfo.stream()
.allMatch(new MorphRulesPredicate());
} catch (Exception e) {
LOGGER.warn("Can't get morph info: {" + word + "} ", e);
} finally {
timer.stop();
}
return false;
} | java | public boolean isNormalWord(@NotNull String word, @NotNull Language language) {
Timer timer = MetricsFactory.getMetrics().getTimer(MetricsType.TEXT_UTILS_IS_NORMAL_WORD.name());
if (StringUtils.isEmpty(word)) {
return false;
}
try {
Timer morphTimer = MetricsFactory.getMetrics().getTimer(MetricsType.TEXT_UTILS_GET_MORPH_INFO.name());
List<String> morphInfo = MorphologyFactory.getMorphology(language).getMorphInfo(word);
morphTimer.stop();
return morphInfo.stream()
.allMatch(new MorphRulesPredicate());
} catch (Exception e) {
LOGGER.warn("Can't get morph info: {" + word + "} ", e);
} finally {
timer.stop();
}
return false;
} | [
"public",
"boolean",
"isNormalWord",
"(",
"@",
"NotNull",
"String",
"word",
",",
"@",
"NotNull",
"Language",
"language",
")",
"{",
"Timer",
"timer",
"=",
"MetricsFactory",
".",
"getMetrics",
"(",
")",
".",
"getTimer",
"(",
"MetricsType",
".",
"TEXT_UTILS_IS_NO... | Check if word is normal word
@param word Checked word
@return True if it normal form of word | [
"Check",
"if",
"word",
"is",
"normal",
"word"
] | train | https://github.com/fnklabs/draenei/blob/0a8cac54f1f635be3e2950375a23291d38453ae8/src/main/java/com/fnklabs/draenei/analytics/TextUtils.java#L90-L112 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/util/PropertyUtils.java | PropertyUtils.loadGradleProperties | private static Properties loadGradleProperties(FilePath gradlePropertiesFilePath)
throws IOException, InterruptedException {
return gradlePropertiesFilePath.act(new MasterToSlaveFileCallable<Properties>() {
public Properties invoke(File gradlePropertiesFile, VirtualChannel channel) throws IOException, InterruptedException {
Properties gradleProps = new Properties();
if (gradlePropertiesFile.exists()) {
debuggingLogger.fine("Gradle properties file exists at: " + gradlePropertiesFile.getAbsolutePath());
FileInputStream stream = null;
try {
stream = new FileInputStream(gradlePropertiesFile);
gradleProps.load(stream);
} catch (IOException e) {
debuggingLogger.fine("IO exception occurred while trying to read properties file from: " +
gradlePropertiesFile.getAbsolutePath());
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return gradleProps;
}
});
} | java | private static Properties loadGradleProperties(FilePath gradlePropertiesFilePath)
throws IOException, InterruptedException {
return gradlePropertiesFilePath.act(new MasterToSlaveFileCallable<Properties>() {
public Properties invoke(File gradlePropertiesFile, VirtualChannel channel) throws IOException, InterruptedException {
Properties gradleProps = new Properties();
if (gradlePropertiesFile.exists()) {
debuggingLogger.fine("Gradle properties file exists at: " + gradlePropertiesFile.getAbsolutePath());
FileInputStream stream = null;
try {
stream = new FileInputStream(gradlePropertiesFile);
gradleProps.load(stream);
} catch (IOException e) {
debuggingLogger.fine("IO exception occurred while trying to read properties file from: " +
gradlePropertiesFile.getAbsolutePath());
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return gradleProps;
}
});
} | [
"private",
"static",
"Properties",
"loadGradleProperties",
"(",
"FilePath",
"gradlePropertiesFilePath",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"gradlePropertiesFilePath",
".",
"act",
"(",
"new",
"MasterToSlaveFileCallable",
"<",
"Propertie... | Load a properties file from a file path
@param gradlePropertiesFilePath The file path where the gradle.properties is located.
@return The loaded properties.
@throws IOException In case an error occurs while reading the properties file, this exception is thrown. | [
"Load",
"a",
"properties",
"file",
"from",
"a",
"file",
"path"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/PropertyUtils.java#L81-L104 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.bigDecimalSum | public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalSum() {
return new AggregationAdapter(new BigDecimalSumAggregation<Key, Value>());
} | java | public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalSum() {
return new AggregationAdapter(new BigDecimalSumAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"BigDecimal",
",",
"BigDecimal",
">",
"bigDecimalSum",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"BigDecimalSumAggregation",
"<",
"Key",
",",
"Value",
... | Returns an aggregation to calculate the {@link java.math.BigDecimal} sum
of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT SUM(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the sum over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"calculate",
"the",
"{",
"@link",
"java",
".",
"math",
".",
"BigDecimal",
"}",
"sum",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELECT",... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L260-L262 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/pbx/internal/activity/RedirectToActivityImpl.java | RedirectToActivityImpl.splitTwo | private boolean splitTwo() throws PBXException
{
final AsteriskSettings profile = PBXFactory.getActiveProfile();
AsteriskPBX pbx = (AsteriskPBX) PBXFactory.getActivePBX();
List<Channel> channels = new LinkedList<>();
channels.add(channel1);
if (!pbx.waitForChannelsToQuiescent(channels, 3000))
{
logger.error(callSite, callSite);
throw new PBXException("Channel: " + channel1 + " cannot be split as they are still in transition.");
}
/*
* redirects the specified channels to the specified endpoints. Returns
* true or false reflecting success.
*/
AgiChannelActivityHold agi1 = new AgiChannelActivityHold();
pbx.setVariable(channel1, "proxyId", "" + ((ChannelProxy) channel1).getIdentity());
channel1.setCurrentActivityAction(agi1);
final String agiExten = profile.getAgiExtension();
final String agiContext = profile.getManagementContext();
logger.debug("redirect channel lhs:" + channel1 + " to " + agiExten + " in context " + agiContext);
final EndPoint extensionAgi = pbx.getExtensionAgi();
final RedirectAction redirect = new RedirectAction(channel1, agiContext, extensionAgi, 1);
// logger.error(redirect);
boolean ret = false;
{
try
{
// final ManagerResponse response =
pbx.sendAction(redirect, 1000);
double ctr = 0;
while (!agi1.hasCallReachedAgi() && ctr < 10)
{
Thread.sleep(100);
ctr += 100.0 / 1000.0;
if (!agi1.hasCallReachedAgi())
{
logger.warn("Waiting on (agi1) " + channel1);
}
}
ret = agi1.hasCallReachedAgi();
}
catch (final Exception e)
{
logger.error(e, e);
}
}
return ret;
} | java | private boolean splitTwo() throws PBXException
{
final AsteriskSettings profile = PBXFactory.getActiveProfile();
AsteriskPBX pbx = (AsteriskPBX) PBXFactory.getActivePBX();
List<Channel> channels = new LinkedList<>();
channels.add(channel1);
if (!pbx.waitForChannelsToQuiescent(channels, 3000))
{
logger.error(callSite, callSite);
throw new PBXException("Channel: " + channel1 + " cannot be split as they are still in transition.");
}
/*
* redirects the specified channels to the specified endpoints. Returns
* true or false reflecting success.
*/
AgiChannelActivityHold agi1 = new AgiChannelActivityHold();
pbx.setVariable(channel1, "proxyId", "" + ((ChannelProxy) channel1).getIdentity());
channel1.setCurrentActivityAction(agi1);
final String agiExten = profile.getAgiExtension();
final String agiContext = profile.getManagementContext();
logger.debug("redirect channel lhs:" + channel1 + " to " + agiExten + " in context " + agiContext);
final EndPoint extensionAgi = pbx.getExtensionAgi();
final RedirectAction redirect = new RedirectAction(channel1, agiContext, extensionAgi, 1);
// logger.error(redirect);
boolean ret = false;
{
try
{
// final ManagerResponse response =
pbx.sendAction(redirect, 1000);
double ctr = 0;
while (!agi1.hasCallReachedAgi() && ctr < 10)
{
Thread.sleep(100);
ctr += 100.0 / 1000.0;
if (!agi1.hasCallReachedAgi())
{
logger.warn("Waiting on (agi1) " + channel1);
}
}
ret = agi1.hasCallReachedAgi();
}
catch (final Exception e)
{
logger.error(e, e);
}
}
return ret;
} | [
"private",
"boolean",
"splitTwo",
"(",
")",
"throws",
"PBXException",
"{",
"final",
"AsteriskSettings",
"profile",
"=",
"PBXFactory",
".",
"getActiveProfile",
"(",
")",
";",
"AsteriskPBX",
"pbx",
"=",
"(",
"AsteriskPBX",
")",
"PBXFactory",
".",
"getActivePBX",
"... | Splits two channels moving them to defined endpoints.
@param lhs
@param lhsTarget
@param lhsTargetContext
@param rhs
@param rhsTarget
@param rhsTargetContext
@return
@throws PBXException | [
"Splits",
"two",
"channels",
"moving",
"them",
"to",
"defined",
"endpoints",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/pbx/internal/activity/RedirectToActivityImpl.java#L138-L197 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java | ReplyFactory.addAirlineItineraryTemplate | public static ReceiptTemplateBuilder addAirlineItineraryTemplate(
String recipientName, String orderNumber, String currency,
String paymentMethod) {
return new ReceiptTemplateBuilder(recipientName, orderNumber, currency,
paymentMethod);
} | java | public static ReceiptTemplateBuilder addAirlineItineraryTemplate(
String recipientName, String orderNumber, String currency,
String paymentMethod) {
return new ReceiptTemplateBuilder(recipientName, orderNumber, currency,
paymentMethod);
} | [
"public",
"static",
"ReceiptTemplateBuilder",
"addAirlineItineraryTemplate",
"(",
"String",
"recipientName",
",",
"String",
"orderNumber",
",",
"String",
"currency",
",",
"String",
"paymentMethod",
")",
"{",
"return",
"new",
"ReceiptTemplateBuilder",
"(",
"recipientName",... | Adds a Receipt Template to the response.
@param recipientName
the recipient's name.
@param orderNumber
the order number.Must be unique for each user.
@param currency
the currency for the price. It can't be empty. The currency
must be a three digit ISO-4217-3 code in format [A-Z]{3}. For
more information see <a href=
"https://developers.facebook.com/docs/payments/reference/supportedcurrencies"
> Facebook's currency support</a>
@param paymentMethod
the payment method details. This can be a custom string. ex:
"Visa 1234". You may insert an arbitrary string here but we
recommend providing enough information for the person to
decipher which payment method and account they used (e.g., the
name of the payment method and partial account number).
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template"
> Facebook's Messenger Receipt Template Documentation</a> | [
"Adds",
"a",
"Receipt",
"Template",
"to",
"the",
"response",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L259-L264 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.multiply | public static String multiply(CharSequence self, Number factor) {
String s = self.toString();
int size = factor.intValue();
if (size == 0)
return "";
else if (size < 0) {
throw new IllegalArgumentException("multiply() should be called with a number of 0 or greater not: " + size);
}
StringBuilder answer = new StringBuilder(s);
for (int i = 1; i < size; i++) {
answer.append(s);
}
return answer.toString();
} | java | public static String multiply(CharSequence self, Number factor) {
String s = self.toString();
int size = factor.intValue();
if (size == 0)
return "";
else if (size < 0) {
throw new IllegalArgumentException("multiply() should be called with a number of 0 or greater not: " + size);
}
StringBuilder answer = new StringBuilder(s);
for (int i = 1; i < size; i++) {
answer.append(s);
}
return answer.toString();
} | [
"public",
"static",
"String",
"multiply",
"(",
"CharSequence",
"self",
",",
"Number",
"factor",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"size",
"=",
"factor",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"size",
"==... | Repeat a CharSequence a certain number of times.
@param self a CharSequence to be repeated
@param factor the number of times the CharSequence should be repeated
@return a String composed of a repetition
@throws IllegalArgumentException if the number of repetitions is < 0
@since 1.8.2 | [
"Repeat",
"a",
"CharSequence",
"a",
"certain",
"number",
"of",
"times",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2042-L2055 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.getTopFeatures | public List<Triple<F,L,Double>> getTopFeatures(double threshold, boolean useMagnitude, int numFeatures)
{
return getTopFeatures(null, threshold, useMagnitude, numFeatures, true);
} | java | public List<Triple<F,L,Double>> getTopFeatures(double threshold, boolean useMagnitude, int numFeatures)
{
return getTopFeatures(null, threshold, useMagnitude, numFeatures, true);
} | [
"public",
"List",
"<",
"Triple",
"<",
"F",
",",
"L",
",",
"Double",
">",
">",
"getTopFeatures",
"(",
"double",
"threshold",
",",
"boolean",
"useMagnitude",
",",
"int",
"numFeatures",
")",
"{",
"return",
"getTopFeatures",
"(",
"null",
",",
"threshold",
",",... | Returns list of top features with weight above a certain threshold
(list is descending and across all labels)
@param threshold Threshold above which we will count the feature
@param useMagnitude Whether the notion of "large" should ignore
the sign of the feature weight.
@param numFeatures How many top features to return (-1 for unlimited)
@return List of triples indicating feature, label, weight | [
"Returns",
"list",
"of",
"top",
"features",
"with",
"weight",
"above",
"a",
"certain",
"threshold",
"(",
"list",
"is",
"descending",
"and",
"across",
"all",
"labels",
")"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L435-L438 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java | ContainerGroupsInner.stopAsync | public Observable<Void> stopAsync(String resourceGroupName, String containerGroupName) {
return stopWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> stopAsync(String resourceGroupName, String containerGroupName) {
return stopWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"stopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
")",
"{",
"return",
"stopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
")",
".",
"map",
"(",
"new",
"Fun... | Stops all containers in a container group.
Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stops",
"all",
"containers",
"in",
"a",
"container",
"group",
".",
"Stops",
"all",
"containers",
"in",
"a",
"container",
"group",
".",
"Compute",
"resources",
"will",
"be",
"deallocated",
"and",
"billing",
"will",
"stop",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java#L1009-L1016 |
RallyTools/RallyRestToolkitForJava | src/main/java/com/rallydev/rest/request/GetRequest.java | GetRequest.toUrl | @Override
public String toUrl() {
List<NameValuePair> params = new ArrayList<NameValuePair>(getParams());
params.add(new BasicNameValuePair("fetch", fetch.toString()));
return String.format("%s.js?%s", getEndpoint(),
URLEncodedUtils.format(params, "utf-8"));
} | java | @Override
public String toUrl() {
List<NameValuePair> params = new ArrayList<NameValuePair>(getParams());
params.add(new BasicNameValuePair("fetch", fetch.toString()));
return String.format("%s.js?%s", getEndpoint(),
URLEncodedUtils.format(params, "utf-8"));
} | [
"@",
"Override",
"public",
"String",
"toUrl",
"(",
")",
"{",
"List",
"<",
"NameValuePair",
">",
"params",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
"getParams",
"(",
")",
")",
";",
"params",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(... | <p>Convert this request into a url compatible with the WSAPI.</p>
The current fetch and any other parameters will be included.
@return the url representing this request. | [
"<p",
">",
"Convert",
"this",
"request",
"into",
"a",
"url",
"compatible",
"with",
"the",
"WSAPI",
".",
"<",
"/",
"p",
">",
"The",
"current",
"fetch",
"and",
"any",
"other",
"parameters",
"will",
"be",
"included",
"."
] | train | https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/request/GetRequest.java#L55-L61 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.getInternalState | public static <T> T getInternalState(Object object, String fieldName, Class<?> where) {
return WhiteboxImpl.getInternalState(object, fieldName, where);
} | java | public static <T> T getInternalState(Object object, String fieldName, Class<?> where) {
return WhiteboxImpl.getInternalState(object, fieldName, where);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getInternalState",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"return",
"WhiteboxImpl",
".",
"getInternalState",
"(",
"object",
",",
"fieldName",
",",
"where... | Get the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. This might be useful
when you have mocked the instance you are trying to access.
@param object
the object to modify
@param fieldName
the name of the field
@param where
which class the field is defined | [
"Get",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"specify",
"in",
"which",
"class",
"the",
"field",
"is",
"declared",
".",
"This",
"might",
"be",
"useful",
"when",
"you",
"have",... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L307-L309 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.renderWithTransformToHTML | public static String renderWithTransformToHTML(final Request request, final WComponent component, final boolean includePageShell) {
// Setup a context (if needed)
boolean needsContext = UIContextHolder.getCurrent() == null;
if (needsContext) {
UIContextHolder.pushContext(new UIContextImpl());
}
try {
// Link Interceptors
InterceptorComponent templateRender = new TemplateRenderInterceptor();
InterceptorComponent transformXML = new TransformXMLInterceptor();
templateRender.setBackingComponent(transformXML);
if (includePageShell) {
transformXML.setBackingComponent(new PageShellInterceptor());
}
// Attach Component and Mock Response
InterceptorComponent chain = templateRender;
chain.attachUI(component);
chain.attachResponse(new MockResponse());
// Render chain
StringWriter buffer = new StringWriter();
chain.preparePaint(request);
try (PrintWriter writer = new PrintWriter(buffer)) {
chain.paint(new WebXmlRenderContext(writer));
}
return buffer.toString();
} finally {
if (needsContext) {
UIContextHolder.popContext();
}
}
} | java | public static String renderWithTransformToHTML(final Request request, final WComponent component, final boolean includePageShell) {
// Setup a context (if needed)
boolean needsContext = UIContextHolder.getCurrent() == null;
if (needsContext) {
UIContextHolder.pushContext(new UIContextImpl());
}
try {
// Link Interceptors
InterceptorComponent templateRender = new TemplateRenderInterceptor();
InterceptorComponent transformXML = new TransformXMLInterceptor();
templateRender.setBackingComponent(transformXML);
if (includePageShell) {
transformXML.setBackingComponent(new PageShellInterceptor());
}
// Attach Component and Mock Response
InterceptorComponent chain = templateRender;
chain.attachUI(component);
chain.attachResponse(new MockResponse());
// Render chain
StringWriter buffer = new StringWriter();
chain.preparePaint(request);
try (PrintWriter writer = new PrintWriter(buffer)) {
chain.paint(new WebXmlRenderContext(writer));
}
return buffer.toString();
} finally {
if (needsContext) {
UIContextHolder.popContext();
}
}
} | [
"public",
"static",
"String",
"renderWithTransformToHTML",
"(",
"final",
"Request",
"request",
",",
"final",
"WComponent",
"component",
",",
"final",
"boolean",
"includePageShell",
")",
"{",
"// Setup a context (if needed)",
"boolean",
"needsContext",
"=",
"UIContextHolde... | Renders and transforms the given WComponent to a HTML String outside of the context of a Servlet.
@param request the request being responded to
@param component the root WComponent to render
@param includePageShell true if include page shell
@return the rendered output as a String. | [
"Renders",
"and",
"transforms",
"the",
"given",
"WComponent",
"to",
"a",
"HTML",
"String",
"outside",
"of",
"the",
"context",
"of",
"a",
"Servlet",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L766-L801 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java | BitfinexClientFactory.newSimpleClient | public static BitfinexWebsocketClient newSimpleClient(final BitfinexWebsocketConfiguration config) {
final BitfinexApiCallbackRegistry callbackRegistry = new BitfinexApiCallbackRegistry();
final SequenceNumberAuditor sequenceNumberAuditor = new SequenceNumberAuditor();
sequenceNumberAuditor.setErrorPolicy(config.getErrorPolicy());
return new SimpleBitfinexApiBroker(config, callbackRegistry, sequenceNumberAuditor, false);
} | java | public static BitfinexWebsocketClient newSimpleClient(final BitfinexWebsocketConfiguration config) {
final BitfinexApiCallbackRegistry callbackRegistry = new BitfinexApiCallbackRegistry();
final SequenceNumberAuditor sequenceNumberAuditor = new SequenceNumberAuditor();
sequenceNumberAuditor.setErrorPolicy(config.getErrorPolicy());
return new SimpleBitfinexApiBroker(config, callbackRegistry, sequenceNumberAuditor, false);
} | [
"public",
"static",
"BitfinexWebsocketClient",
"newSimpleClient",
"(",
"final",
"BitfinexWebsocketConfiguration",
"config",
")",
"{",
"final",
"BitfinexApiCallbackRegistry",
"callbackRegistry",
"=",
"new",
"BitfinexApiCallbackRegistry",
"(",
")",
";",
"final",
"SequenceNumber... | bitfinex client
@param config - config
@return {@link SimpleBitfinexApiBroker} client | [
"bitfinex",
"client"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java#L27-L34 |
radkovo/SwingBox | src/main/java/org/fit/cssbox/swingbox/BrowserPane.java | BrowserPane.tryScrollToReference | public boolean tryScrollToReference(String reference)
{
Element dst = findElementToScroll(reference, getDocument().getDefaultRootElement());
if (dst != null)
{
try
{
Rectangle bottom = new Rectangle(0, getHeight() - 1, 1, 1);
Rectangle rec = modelToView(dst.getStartOffset());
if (rec != null)
{
scrollRectToVisible(bottom); //move to the bottom and back in order to put the reference to the window top
scrollRectToVisible(rec);
}
return true;
} catch (BadLocationException e)
{
UIManager.getLookAndFeel().provideErrorFeedback(this);
return false;
}
}
else
return false;
} | java | public boolean tryScrollToReference(String reference)
{
Element dst = findElementToScroll(reference, getDocument().getDefaultRootElement());
if (dst != null)
{
try
{
Rectangle bottom = new Rectangle(0, getHeight() - 1, 1, 1);
Rectangle rec = modelToView(dst.getStartOffset());
if (rec != null)
{
scrollRectToVisible(bottom); //move to the bottom and back in order to put the reference to the window top
scrollRectToVisible(rec);
}
return true;
} catch (BadLocationException e)
{
UIManager.getLookAndFeel().provideErrorFeedback(this);
return false;
}
}
else
return false;
} | [
"public",
"boolean",
"tryScrollToReference",
"(",
"String",
"reference",
")",
"{",
"Element",
"dst",
"=",
"findElementToScroll",
"(",
"reference",
",",
"getDocument",
"(",
")",
".",
"getDefaultRootElement",
"(",
")",
")",
";",
"if",
"(",
"dst",
"!=",
"null",
... | This method has the same purpose as {@link BrowserPane#scrollToReference(String)}.
However, it allows checking whether the reference exists in the document.
@param reference the named location to scroll to
@return <code>true</code> when the location exists in the document, <code>false</code> when not found. | [
"This",
"method",
"has",
"the",
"same",
"purpose",
"as",
"{"
] | train | https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/BrowserPane.java#L331-L354 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/rectify/RectifyFundamental.java | RectifyFundamental.translateToOrigin | private SimpleMatrix translateToOrigin( int x0 , int y0 ) {
SimpleMatrix T = SimpleMatrix.identity(3);
T.set(0, 2, -x0);
T.set(1, 2, -y0);
return T;
} | java | private SimpleMatrix translateToOrigin( int x0 , int y0 ) {
SimpleMatrix T = SimpleMatrix.identity(3);
T.set(0, 2, -x0);
T.set(1, 2, -y0);
return T;
} | [
"private",
"SimpleMatrix",
"translateToOrigin",
"(",
"int",
"x0",
",",
"int",
"y0",
")",
"{",
"SimpleMatrix",
"T",
"=",
"SimpleMatrix",
".",
"identity",
"(",
"3",
")",
";",
"T",
".",
"set",
"(",
"0",
",",
"2",
",",
"-",
"x0",
")",
";",
"T",
".",
... | Create a transform which will move the specified point to the origin | [
"Create",
"a",
"transform",
"which",
"will",
"move",
"the",
"specified",
"point",
"to",
"the",
"origin"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/rectify/RectifyFundamental.java#L118-L126 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDateTime.java | LocalDateTime.withField | public LocalDateTime withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | java | public LocalDateTime withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | [
"public",
"LocalDateTime",
"withField",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"value",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field must not be null\"",
")",
";",
"}",
"long",
"i... | Returns a copy of this datetime with the specified field set to a new value.
<p>
For example, if the field type is <code>hourOfDay</code> then the hour of day
field would be changed in the returned instance.
If the field type is null, then <code>this</code> is returned.
<p>
These three lines are equivalent:
<pre>
LocalDateTime updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
LocalDateTime updated = dt.dayOfMonth().setCopy(6);
LocalDateTime updated = dt.property(DateTimeFieldType.dayOfMonth()).setCopy(6);
</pre>
@param fieldType the field type to set, not null
@param value the value to set
@return a copy of this datetime with the field set
@throws IllegalArgumentException if the value is null or invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"datetime",
"with",
"the",
"specified",
"field",
"set",
"to",
"a",
"new",
"value",
".",
"<p",
">",
"For",
"example",
"if",
"the",
"field",
"type",
"is",
"<code",
">",
"hourOfDay<",
"/",
"code",
">",
"then",
"the",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L986-L992 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java | CheckInstrumentableClassAdapter.visit | @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classInternalName = name;
this.isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
this.isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0;
super.visit(version, access, name, signature, superName, interfaces);
} | java | @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classInternalName = name;
this.isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
this.isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0;
super.visit(version, access, name, signature, superName, interfaces);
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"int",
"version",
",",
"int",
"access",
",",
"String",
"name",
",",
"String",
"signature",
",",
"String",
"superName",
",",
"String",
"[",
"]",
"interfaces",
")",
"{",
"this",
".",
"classInternalName",
"=",
... | Begin processing a class. We save some of the header information that
we only get from the header to assist with processing. | [
"Begin",
"processing",
"a",
"class",
".",
"We",
"save",
"some",
"of",
"the",
"header",
"information",
"that",
"we",
"only",
"get",
"from",
"the",
"header",
"to",
"assist",
"with",
"processing",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java#L52-L59 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/KriptonDatabaseWrapper.java | KriptonDatabaseWrapper.updateDelete | public static int updateDelete(SQLiteStatement ps, KriptonContentValues contentValues) {
contentValues.bind(ps);
return ps.executeUpdateDelete();
} | java | public static int updateDelete(SQLiteStatement ps, KriptonContentValues contentValues) {
contentValues.bind(ps);
return ps.executeUpdateDelete();
} | [
"public",
"static",
"int",
"updateDelete",
"(",
"SQLiteStatement",
"ps",
",",
"KriptonContentValues",
"contentValues",
")",
"{",
"contentValues",
".",
"bind",
"(",
"ps",
")",
";",
"return",
"ps",
".",
"executeUpdateDelete",
"(",
")",
";",
"}"
] | Update delete.
@param ps the ps
@param contentValues the content values
@return the int | [
"Update",
"delete",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/KriptonDatabaseWrapper.java#L77-L82 |
kaichunlin/android-transition | core/src/main/java/com/kaichunlin/transition/ViewTransitionBuilder.java | ViewTransitionBuilder.transitViewGroup | public ViewTransitionBuilder transitViewGroup(@NonNull ViewGroupTransition viewGroupTransition) {
ViewGroup vg = (ViewGroup) mView;
int total = vg.getChildCount();
View view;
ViewGroupTransitionConfig config = new ViewGroupTransitionConfig(vg, total);
for (int i = 0; i < total; i++) {
view = vg.getChildAt(i);
config.childView = view;
config.index = i;
viewGroupTransition.transit(target(view), config);
}
return self();
} | java | public ViewTransitionBuilder transitViewGroup(@NonNull ViewGroupTransition viewGroupTransition) {
ViewGroup vg = (ViewGroup) mView;
int total = vg.getChildCount();
View view;
ViewGroupTransitionConfig config = new ViewGroupTransitionConfig(vg, total);
for (int i = 0; i < total; i++) {
view = vg.getChildAt(i);
config.childView = view;
config.index = i;
viewGroupTransition.transit(target(view), config);
}
return self();
} | [
"public",
"ViewTransitionBuilder",
"transitViewGroup",
"(",
"@",
"NonNull",
"ViewGroupTransition",
"viewGroupTransition",
")",
"{",
"ViewGroup",
"vg",
"=",
"(",
"ViewGroup",
")",
"mView",
";",
"int",
"total",
"=",
"vg",
".",
"getChildCount",
"(",
")",
";",
"View... | The view previously set (through {@link #target(View)}) is casted as a ViewGroup, and the specified
{@link ViewGroupTransition} will {@link ViewGroupTransition#transit(ViewTransitionBuilder, ViewGroupTransitionConfig)}
all the children views.
@param viewGroupTransition
@return
@throws ClassCastException If the target view is not a ViewGroup. | [
"The",
"view",
"previously",
"set",
"(",
"through",
"{",
"@link",
"#target",
"(",
"View",
")",
"}",
")",
"is",
"casted",
"as",
"a",
"ViewGroup",
"and",
"the",
"specified",
"{",
"@link",
"ViewGroupTransition",
"}",
"will",
"{",
"@link",
"ViewGroupTransition#t... | train | https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/ViewTransitionBuilder.java#L495-L507 |
StripesFramework/stripes-stuff | src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java | SecurityInterceptor.handleAccessDenied | protected Resolution handleAccessDenied(ActionBean bean, Method handler)
{
Resolution resolution;
if (securityManager instanceof SecurityHandler)
{
resolution = ((SecurityHandler)securityManager).handleAccessDenied(bean, handler);
}
else
{
resolution = new ErrorResolution(HttpServletResponse.SC_UNAUTHORIZED);
}
return resolution;
} | java | protected Resolution handleAccessDenied(ActionBean bean, Method handler)
{
Resolution resolution;
if (securityManager instanceof SecurityHandler)
{
resolution = ((SecurityHandler)securityManager).handleAccessDenied(bean, handler);
}
else
{
resolution = new ErrorResolution(HttpServletResponse.SC_UNAUTHORIZED);
}
return resolution;
} | [
"protected",
"Resolution",
"handleAccessDenied",
"(",
"ActionBean",
"bean",
",",
"Method",
"handler",
")",
"{",
"Resolution",
"resolution",
";",
"if",
"(",
"securityManager",
"instanceof",
"SecurityHandler",
")",
"{",
"resolution",
"=",
"(",
"(",
"SecurityHandler",
... | Determine what to do when access has been denied. If the SecurityManager implements the optional interface
[@Link SecurityHandler}, ask the SecurityManager. Otherwise, return the HTTP error "forbidden".
@param bean the action bean to which access was denied
@param handler the event handler to which access was denied
@return the Resolution to be executed when access has been denied | [
"Determine",
"what",
"to",
"do",
"when",
"access",
"has",
"been",
"denied",
".",
"If",
"the",
"SecurityManager",
"implements",
"the",
"optional",
"interface",
"[",
"@Link",
"SecurityHandler",
"}",
"ask",
"the",
"SecurityManager",
".",
"Otherwise",
"return",
"the... | train | https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java#L267-L279 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/Index.java | Index.dropNamedPrimaryIndex | public static UsingPath dropNamedPrimaryIndex(String namespace, String keyspace, String customPrimaryName) {
//N1QL syntax for dropping a primary with a name is actually similar to dropping secondary index
return new DefaultDropPath().drop(namespace, keyspace, customPrimaryName);
} | java | public static UsingPath dropNamedPrimaryIndex(String namespace, String keyspace, String customPrimaryName) {
//N1QL syntax for dropping a primary with a name is actually similar to dropping secondary index
return new DefaultDropPath().drop(namespace, keyspace, customPrimaryName);
} | [
"public",
"static",
"UsingPath",
"dropNamedPrimaryIndex",
"(",
"String",
"namespace",
",",
"String",
"keyspace",
",",
"String",
"customPrimaryName",
")",
"{",
"//N1QL syntax for dropping a primary with a name is actually similar to dropping secondary index",
"return",
"new",
"Def... | Drop the primary index of the given namespace:keyspace that has a custom name.
@param namespace the namespace prefix (will be escaped).
@param keyspace the keyspace (bucket, will be escaped).
@param customPrimaryName the custom name for the primary index (will be escaped). | [
"Drop",
"the",
"primary",
"index",
"of",
"the",
"given",
"namespace",
":",
"keyspace",
"that",
"has",
"a",
"custom",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/Index.java#L128-L131 |
sporniket/core | sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java | ComponentFactory.getImageIcon | public static Icon getImageIcon(UrlProvider urlProvider, String fileName) throws UrlProviderException
{
URL _icon = urlProvider.getUrl(fileName);
return new ImageIcon(_icon);
} | java | public static Icon getImageIcon(UrlProvider urlProvider, String fileName) throws UrlProviderException
{
URL _icon = urlProvider.getUrl(fileName);
return new ImageIcon(_icon);
} | [
"public",
"static",
"Icon",
"getImageIcon",
"(",
"UrlProvider",
"urlProvider",
",",
"String",
"fileName",
")",
"throws",
"UrlProviderException",
"{",
"URL",
"_icon",
"=",
"urlProvider",
".",
"getUrl",
"(",
"fileName",
")",
";",
"return",
"new",
"ImageIcon",
"(",... | Create an Image based icon from a String.
@param urlProvider
The URL provider.
@param fileName
the name of the file.
@return an Icon.
@throws UrlProviderException if there is a problem to deal with. | [
"Create",
"an",
"Image",
"based",
"icon",
"from",
"a",
"String",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java#L119-L123 |
aboutsip/pkts | pkts-buffers/src/main/java/io/pkts/buffer/Buffers.java | Buffers.wrap | public static Buffer wrap(final Buffer one, final Buffer two) {
// TODO: create an actual composite buffer.
final int size1 = one != null ? one.getReadableBytes() : 0;
final int size2 = two != null ? two.getReadableBytes() : 0;
if (size1 == 0 && size2 > 0) {
return two.slice();
} else if (size2 == 0 && size1 > 0) {
return one.slice();
} else if (size2 == 0 && size1 == 0) {
return Buffers.EMPTY_BUFFER;
}
final Buffer composite = Buffers.createBuffer(size1 + size2);
one.getBytes(composite);
two.getBytes(composite);
return composite;
} | java | public static Buffer wrap(final Buffer one, final Buffer two) {
// TODO: create an actual composite buffer.
final int size1 = one != null ? one.getReadableBytes() : 0;
final int size2 = two != null ? two.getReadableBytes() : 0;
if (size1 == 0 && size2 > 0) {
return two.slice();
} else if (size2 == 0 && size1 > 0) {
return one.slice();
} else if (size2 == 0 && size1 == 0) {
return Buffers.EMPTY_BUFFER;
}
final Buffer composite = Buffers.createBuffer(size1 + size2);
one.getBytes(composite);
two.getBytes(composite);
return composite;
} | [
"public",
"static",
"Buffer",
"wrap",
"(",
"final",
"Buffer",
"one",
",",
"final",
"Buffer",
"two",
")",
"{",
"// TODO: create an actual composite buffer. ",
"final",
"int",
"size1",
"=",
"one",
"!=",
"null",
"?",
"one",
".",
"getReadableBytes",
"(",
")",
":",... | Combine two buffers into one. The resulting buffer will share the
underlying byte storage so changing the value in one will affect the
other. However, the original two buffers will still have their own reader
and writer index.
@param one
@param two
@return | [
"Combine",
"two",
"buffers",
"into",
"one",
".",
"The",
"resulting",
"buffer",
"will",
"share",
"the",
"underlying",
"byte",
"storage",
"so",
"changing",
"the",
"value",
"in",
"one",
"will",
"affect",
"the",
"other",
".",
"However",
"the",
"original",
"two",... | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-buffers/src/main/java/io/pkts/buffer/Buffers.java#L142-L158 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.getAnnotation | public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedElement, Class<T> annotationType) {
try {
T ann = annotatedElement.getAnnotation(annotationType);
if (ann == null) {
for (Annotation metaAnn : annotatedElement.getAnnotations()) {
ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
break;
}
}
}
return ann;
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(annotatedElement, ex);
return null;
}
} | java | public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedElement, Class<T> annotationType) {
try {
T ann = annotatedElement.getAnnotation(annotationType);
if (ann == null) {
for (Annotation metaAnn : annotatedElement.getAnnotations()) {
ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
break;
}
}
}
return ann;
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(annotatedElement, ex);
return null;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"AnnotatedElement",
"annotatedElement",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"try",
"{",
"T",
"ann",
"=",
"annotatedElement",
".",
"getAnnotation",
"(",
... | Get a single {@link Annotation} of {@code annotationType} from the supplied
Method, Constructor or Field. Meta-annotations will be searched if the annotation
is not declared locally on the supplied element.
@param annotatedElement the Method, Constructor or Field from which to get the annotation
@param annotationType the annotation type to look for, both locally and as a meta-annotation
@return the matching annotation, or {@code null} if none found
@since 3.1 | [
"Get",
"a",
"single",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L107-L125 |
datacleaner/DataCleaner | engine/env/spark/src/main/java/org/datacleaner/spark/functions/RowProcessingFunction.java | RowProcessingFunction.createReplacementDatastore | private ResourceDatastore createReplacementDatastore(final ComponentBuilder cb, final ResourceDatastore datastore,
final Resource replacementResource) {
final String name = datastore.getName();
if (datastore instanceof CsvDatastore) {
final CsvConfiguration csvConfiguration = ((CsvDatastore) datastore).getCsvConfiguration();
return new CsvDatastore(name, replacementResource, csvConfiguration);
}
if (datastore instanceof JsonDatastore) {
return new JsonDatastore(name, replacementResource, ((JsonDatastore) datastore).getSchemaBuilder());
}
logger.warn("Could not replace datastore '{}' because it is of an unsupported type: ", name,
datastore.getClass().getSimpleName());
return datastore;
} | java | private ResourceDatastore createReplacementDatastore(final ComponentBuilder cb, final ResourceDatastore datastore,
final Resource replacementResource) {
final String name = datastore.getName();
if (datastore instanceof CsvDatastore) {
final CsvConfiguration csvConfiguration = ((CsvDatastore) datastore).getCsvConfiguration();
return new CsvDatastore(name, replacementResource, csvConfiguration);
}
if (datastore instanceof JsonDatastore) {
return new JsonDatastore(name, replacementResource, ((JsonDatastore) datastore).getSchemaBuilder());
}
logger.warn("Could not replace datastore '{}' because it is of an unsupported type: ", name,
datastore.getClass().getSimpleName());
return datastore;
} | [
"private",
"ResourceDatastore",
"createReplacementDatastore",
"(",
"final",
"ComponentBuilder",
"cb",
",",
"final",
"ResourceDatastore",
"datastore",
",",
"final",
"Resource",
"replacementResource",
")",
"{",
"final",
"String",
"name",
"=",
"datastore",
".",
"getName",
... | Creates a {@link Datastore} replacement to use for configured properties
@param cb
@param datastore
@param replacementResource
@return a replacement datastore, or null if it shouldn't be replaced | [
"Creates",
"a",
"{",
"@link",
"Datastore",
"}",
"replacement",
"to",
"use",
"for",
"configured",
"properties"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/env/spark/src/main/java/org/datacleaner/spark/functions/RowProcessingFunction.java#L216-L230 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/compress/CompressionCodecFactory.java | CompressionCodecFactory.getCodecClasses | public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf) {
String codecsString = conf.get("io.compression.codecs");
if (codecsString != null) {
List<Class<? extends CompressionCodec>> result
= new ArrayList<Class<? extends CompressionCodec>>();
StringTokenizer codecSplit = new StringTokenizer(codecsString, ",");
while (codecSplit.hasMoreElements()) {
String codecSubstring = codecSplit.nextToken();
if (codecSubstring.length() != 0) {
try {
Class<?> cls = conf.getClassByName(codecSubstring);
if (!CompressionCodec.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Class " + codecSubstring +
" is not a CompressionCodec");
}
result.add(cls.asSubclass(CompressionCodec.class));
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException("Compression codec " +
codecSubstring + " not found.",
ex);
}
}
}
return result;
} else {
return null;
}
} | java | public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf) {
String codecsString = conf.get("io.compression.codecs");
if (codecsString != null) {
List<Class<? extends CompressionCodec>> result
= new ArrayList<Class<? extends CompressionCodec>>();
StringTokenizer codecSplit = new StringTokenizer(codecsString, ",");
while (codecSplit.hasMoreElements()) {
String codecSubstring = codecSplit.nextToken();
if (codecSubstring.length() != 0) {
try {
Class<?> cls = conf.getClassByName(codecSubstring);
if (!CompressionCodec.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Class " + codecSubstring +
" is not a CompressionCodec");
}
result.add(cls.asSubclass(CompressionCodec.class));
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException("Compression codec " +
codecSubstring + " not found.",
ex);
}
}
}
return result;
} else {
return null;
}
} | [
"public",
"static",
"List",
"<",
"Class",
"<",
"?",
"extends",
"CompressionCodec",
">",
">",
"getCodecClasses",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"codecsString",
"=",
"conf",
".",
"get",
"(",
"\"io.compression.codecs\"",
")",
";",
"if",
"(",
... | Get the list of codecs listed in the configuration
@param conf the configuration to look in
@return a list of the Configuration classes or null if the attribute
was not set | [
"Get",
"the",
"list",
"of",
"codecs",
"listed",
"in",
"the",
"configuration"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/compress/CompressionCodecFactory.java#L85-L112 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/internal/util/Checks.java | Checks.checkMinMax | public static void checkMinMax(int min, int max) {
checkMin(min);
checkMax(max);
checkArgument(min <= max, "min > max");
} | java | public static void checkMinMax(int min, int max) {
checkMin(min);
checkMax(max);
checkArgument(min <= max, "min > max");
} | [
"public",
"static",
"void",
"checkMinMax",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"checkMin",
"(",
"min",
")",
";",
"checkMax",
"(",
"max",
")",
";",
"checkArgument",
"(",
"min",
"<=",
"max",
",",
"\"min > max\"",
")",
";",
"}"
] | Checks that neither {@code min} or {@code max} is negative and {@code min <= max}. | [
"Checks",
"that",
"neither",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/internal/util/Checks.java#L124-L128 |
zaproxy/zaproxy | src/org/parosproxy/paros/model/HistoryList.java | HistoryList.removeRange | @Override
public void removeRange(int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException("fromIndex must be <= toIndex");
}
for (int i = toIndex; i >= fromIndex; i--) {
removeElementAt(i);
}
fireIntervalRemoved(this, fromIndex, toIndex);
} | java | @Override
public void removeRange(int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException("fromIndex must be <= toIndex");
}
for (int i = toIndex; i >= fromIndex; i--) {
removeElementAt(i);
}
fireIntervalRemoved(this, fromIndex, toIndex);
} | [
"@",
"Override",
"public",
"void",
"removeRange",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"if",
"(",
"fromIndex",
">",
"toIndex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"fromIndex must be <= toIndex\"",
")",
";",
"}",
"f... | Note: implementation copied from base class (DefaultListModel) but changed to call the local method removeElementAt(int) | [
"Note",
":",
"implementation",
"copied",
"from",
"base",
"class",
"(",
"DefaultListModel",
")",
"but",
"changed",
"to",
"call",
"the",
"local",
"method",
"removeElementAt",
"(",
"int",
")"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/model/HistoryList.java#L115-L124 |
kikinteractive/ice | ice/src/main/java/com/kik/config/ice/ConfigSystem.java | ConfigSystem.overrideModule | public static <C> Module overrideModule(
final Class<C> configInterface,
final OverrideConsumer<C> overrideConsumer)
{
return overrideModule(configInterface, Optional.empty(), overrideConsumer);
} | java | public static <C> Module overrideModule(
final Class<C> configInterface,
final OverrideConsumer<C> overrideConsumer)
{
return overrideModule(configInterface, Optional.empty(), overrideConsumer);
} | [
"public",
"static",
"<",
"C",
">",
"Module",
"overrideModule",
"(",
"final",
"Class",
"<",
"C",
">",
"configInterface",
",",
"final",
"OverrideConsumer",
"<",
"C",
">",
"overrideConsumer",
")",
"{",
"return",
"overrideModule",
"(",
"configInterface",
",",
"Opt... | Generates a Guice Module for use with Injector creation. The module created is intended to be used in a
<code>Modules.override</code> manner, to produce overrides for static configuration.
@param configInterface The configuration interface type for which values are to be overridden
@param overrideConsumer a lambda which is given an instance of {@link OverrideModule} which can be used to build
type-safe overrides
@param <C> The configuration interface type
@return a module to install in your Guice Injector positioned to override an earlier module created via
{@link #configModule(Class)} | [
"Generates",
"a",
"Guice",
"Module",
"for",
"use",
"with",
"Injector",
"creation",
".",
"The",
"module",
"created",
"is",
"intended",
"to",
"be",
"used",
"in",
"a",
"<code",
">",
"Modules",
".",
"override<",
"/",
"code",
">",
"manner",
"to",
"produce",
"... | train | https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/ConfigSystem.java#L169-L174 |
nicoulaj/commons-dbcp-jmx | jdbc4/src/main/java/org/apache/commons/dbcp/ManagedBasicDataSourceFactory.java | ManagedBasicDataSourceFactory.getObjectInstance | @Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
// We only know how to deal with <code>javax.naming.Reference</code>s
// that specify a class name of "javax.sql.DataSource"
if ((obj == null) || !(obj instanceof Reference)) {
return null;
}
Reference ref = (Reference) obj;
if (!"javax.sql.DataSource".equals(ref.getClassName())) {
return null;
}
Properties properties = new Properties();
for (int i = 0; i < ALL_PROPERTIES.length; i++) {
String propertyName = ALL_PROPERTIES[i];
RefAddr ra = ref.get(propertyName);
if (ra != null) {
String propertyValue = ra.getContent().toString();
properties.setProperty(propertyName, propertyValue);
}
}
return createDataSource(properties);
} | java | @Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
// We only know how to deal with <code>javax.naming.Reference</code>s
// that specify a class name of "javax.sql.DataSource"
if ((obj == null) || !(obj instanceof Reference)) {
return null;
}
Reference ref = (Reference) obj;
if (!"javax.sql.DataSource".equals(ref.getClassName())) {
return null;
}
Properties properties = new Properties();
for (int i = 0; i < ALL_PROPERTIES.length; i++) {
String propertyName = ALL_PROPERTIES[i];
RefAddr ra = ref.get(propertyName);
if (ra != null) {
String propertyValue = ra.getContent().toString();
properties.setProperty(propertyName, propertyValue);
}
}
return createDataSource(properties);
} | [
"@",
"Override",
"public",
"Object",
"getObjectInstance",
"(",
"Object",
"obj",
",",
"Name",
"name",
",",
"Context",
"nameCtx",
",",
"Hashtable",
"environment",
")",
"throws",
"Exception",
"{",
"// We only know how to deal with <code>javax.naming.Reference</code>s",
"// t... | Create and return a new {@link org.apache.commons.dbcp.ManagedBasicDataSource} instance. If no instance can be created, return <code>null</code>
instead.
@param obj The possibly null object containing location or reference information that can be used in creating an object.
@param name The name of this object relative to <code>nameCtx</code>.
@param nameCtx The context relative to which the <code>name</code> parameter is specified, or <code>null</code> if <code>name</code> is
relative to the default initial context.
@param environment The possibly null environment that is used in creating this object.
@throws Exception if an exception occurs creating the instance. | [
"Create",
"and",
"return",
"a",
"new",
"{",
"@link",
"org",
".",
"apache",
".",
"commons",
".",
"dbcp",
".",
"ManagedBasicDataSource",
"}",
"instance",
".",
"If",
"no",
"instance",
"can",
"be",
"created",
"return",
"<code",
">",
"null<",
"/",
"code",
">"... | train | https://github.com/nicoulaj/commons-dbcp-jmx/blob/be8716526698da2f6dac817c95343b539ac5e3d9/jdbc4/src/main/java/org/apache/commons/dbcp/ManagedBasicDataSourceFactory.java#L240-L264 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.queueExists | public boolean queueExists(String queueName, String queueOwnerAccountId) throws JMSException {
try {
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName);
getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId);
prepareRequest(getQueueUrlRequest);
amazonSQSClient.getQueueUrl(getQueueUrlRequest);
return true;
} catch (QueueDoesNotExistException e) {
return false;
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | java | public boolean queueExists(String queueName, String queueOwnerAccountId) throws JMSException {
try {
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName);
getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId);
prepareRequest(getQueueUrlRequest);
amazonSQSClient.getQueueUrl(getQueueUrlRequest);
return true;
} catch (QueueDoesNotExistException e) {
return false;
} catch (AmazonClientException e) {
throw handleException(e, "getQueueUrl");
}
} | [
"public",
"boolean",
"queueExists",
"(",
"String",
"queueName",
",",
"String",
"queueOwnerAccountId",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"GetQueueUrlRequest",
"getQueueUrlRequest",
"=",
"new",
"GetQueueUrlRequest",
"(",
"queueName",
")",
";",
"getQueueUrl... | Check if the requested queue exists. This function calls
<code>GetQueueUrl</code> for the given queue name with the given owner
accountId, returning true on success, false if it gets
<code>QueueDoesNotExistException</code>.
@param queueName
the queue to check
@param queueOwnerAccountId
The AWS accountId of the account that created the queue
@return true if the queue exists, false if it doesn't.
@throws JMSException | [
"Check",
"if",
"the",
"requested",
"queue",
"exists",
".",
"This",
"function",
"calls",
"<code",
">",
"GetQueueUrl<",
"/",
"code",
">",
"for",
"the",
"given",
"queue",
"name",
"with",
"the",
"given",
"owner",
"accountId",
"returning",
"true",
"on",
"success"... | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L242-L254 |
cdk/cdk | display/render/src/main/java/org/openscience/cdk/renderer/color/CPKAtomColors.java | CPKAtomColors.getAtomColor | @Override
public Color getAtomColor(IAtom atom, Color defaultColor) {
Color color = defaultColor;
String symbol = atom.getSymbol().toUpperCase();
if (atom.getAtomicNumber() != null && ATOM_COLORS_MASSNUM.containsKey(atom.getAtomicNumber())) {
color = ATOM_COLORS_MASSNUM.get(atom.getAtomicNumber()); // lookup by atomic number.
} else if (ATOM_COLORS_SYMBOL.containsKey(symbol)) {
color = ATOM_COLORS_SYMBOL.get(symbol); // lookup by atomic symbol.
}
return new Color(color.getRed(), color.getGreen(), color.getBlue()); // return atom copy.
} | java | @Override
public Color getAtomColor(IAtom atom, Color defaultColor) {
Color color = defaultColor;
String symbol = atom.getSymbol().toUpperCase();
if (atom.getAtomicNumber() != null && ATOM_COLORS_MASSNUM.containsKey(atom.getAtomicNumber())) {
color = ATOM_COLORS_MASSNUM.get(atom.getAtomicNumber()); // lookup by atomic number.
} else if (ATOM_COLORS_SYMBOL.containsKey(symbol)) {
color = ATOM_COLORS_SYMBOL.get(symbol); // lookup by atomic symbol.
}
return new Color(color.getRed(), color.getGreen(), color.getBlue()); // return atom copy.
} | [
"@",
"Override",
"public",
"Color",
"getAtomColor",
"(",
"IAtom",
"atom",
",",
"Color",
"defaultColor",
")",
"{",
"Color",
"color",
"=",
"defaultColor",
";",
"String",
"symbol",
"=",
"atom",
".",
"getSymbol",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
... | Returns the font color for atom given atom.
@param atom the atom.
@param defaultColor atom default color.
@return A color for the atom. The default colour is used if none is
found for the atom. | [
"Returns",
"the",
"font",
"color",
"for",
"atom",
"given",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/render/src/main/java/org/openscience/cdk/renderer/color/CPKAtomColors.java#L152-L163 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/OTAUpdateFile.java | OTAUpdateFile.withAttributes | public OTAUpdateFile withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public OTAUpdateFile withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"OTAUpdateFile",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A list of name/attribute pairs.
</p>
@param attributes
A list of name/attribute pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"list",
"of",
"name",
"/",
"attribute",
"pairs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/OTAUpdateFile.java#L254-L257 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java | JobOperatorImpl.publishEvent | private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) {
if (eventsPublisher != null) {
eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId);
}
} | java | private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) {
if (eventsPublisher != null) {
eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId);
}
} | [
"private",
"void",
"publishEvent",
"(",
"WSJobExecution",
"jobEx",
",",
"String",
"topicToPublish",
",",
"String",
"correlationId",
")",
"{",
"if",
"(",
"eventsPublisher",
"!=",
"null",
")",
"{",
"eventsPublisher",
".",
"publishJobExecutionEvent",
"(",
"jobEx",
",... | Helper method to publish event
@param jobEx
@param topicToPublish
@param correlationId | [
"Helper",
"method",
"to",
"publish",
"event"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L369-L373 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.codePointCount | public static int codePointCount(CharSequence text, int start, int limit) {
if (start < 0 || limit < start || limit > text.length()) {
throw new IndexOutOfBoundsException("start (" + start +
") or limit (" + limit +
") invalid or out of range 0, " + text.length());
}
int len = limit - start;
while (limit > start) {
char ch = text.charAt(--limit);
while (ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE && limit > start) {
ch = text.charAt(--limit);
if (ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE) {
--len;
break;
}
}
}
return len;
} | java | public static int codePointCount(CharSequence text, int start, int limit) {
if (start < 0 || limit < start || limit > text.length()) {
throw new IndexOutOfBoundsException("start (" + start +
") or limit (" + limit +
") invalid or out of range 0, " + text.length());
}
int len = limit - start;
while (limit > start) {
char ch = text.charAt(--limit);
while (ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE && limit > start) {
ch = text.charAt(--limit);
if (ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE) {
--len;
break;
}
}
}
return len;
} | [
"public",
"static",
"int",
"codePointCount",
"(",
"CharSequence",
"text",
",",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"start",
"<",
"0",
"||",
"limit",
"<",
"start",
"||",
"limit",
">",
"text",
".",
"length",
"(",
")",
")",
"{",
... | Equivalent to the {@link Character#codePointCount(CharSequence, int, int)}
method, for convenience. Counts the number of code points in the range
of text.
@param text the characters to check
@param start the start of the range
@param limit the limit of the range
@return the number of code points in the range | [
"Equivalent",
"to",
"the",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L5510-L5529 |
jmxtrans/jmxtrans | jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/support/opentsdb/OpenTSDBMessageFormatter.java | OpenTSDBMessageFormatter.addTags | void addTags(StringBuilder resultString, Server server) {
if (hostnameTag) {
addTag(resultString, "host", server.getLabel());
}
// Add the constant tag names and values.
for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
addTag(resultString, tagEntry.getKey(), tagEntry.getValue());
}
} | java | void addTags(StringBuilder resultString, Server server) {
if (hostnameTag) {
addTag(resultString, "host", server.getLabel());
}
// Add the constant tag names and values.
for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
addTag(resultString, tagEntry.getKey(), tagEntry.getValue());
}
} | [
"void",
"addTags",
"(",
"StringBuilder",
"resultString",
",",
"Server",
"server",
")",
"{",
"if",
"(",
"hostnameTag",
")",
"{",
"addTag",
"(",
"resultString",
",",
"\"host\"",
",",
"server",
".",
"getLabel",
"(",
")",
")",
";",
"}",
"// Add the constant tag ... | Add tags to the given result string, including a "host" tag with the name of the server and all of the tags
defined in the "settings" entry in the configuration file within the "tag" element.
@param resultString - the string containing the metric name, timestamp, value, and possibly other content. | [
"Add",
"tags",
"to",
"the",
"given",
"result",
"string",
"including",
"a",
"host",
"tag",
"with",
"the",
"name",
"of",
"the",
"server",
"and",
"all",
"of",
"the",
"tags",
"defined",
"in",
"the",
"settings",
"entry",
"in",
"the",
"configuration",
"file",
... | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/support/opentsdb/OpenTSDBMessageFormatter.java#L102-L111 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java | SqlKit.getSqlParaByString | public SqlPara getSqlParaByString(String content, Map data) {
Template template = engine.getTemplateByString(content);
SqlPara sqlPara = new SqlPara();
data.put(SQL_PARA_KEY, sqlPara);
sqlPara.setSql(template.renderToString(data));
data.remove(SQL_PARA_KEY); // 避免污染传入的 Map
return sqlPara;
} | java | public SqlPara getSqlParaByString(String content, Map data) {
Template template = engine.getTemplateByString(content);
SqlPara sqlPara = new SqlPara();
data.put(SQL_PARA_KEY, sqlPara);
sqlPara.setSql(template.renderToString(data));
data.remove(SQL_PARA_KEY); // 避免污染传入的 Map
return sqlPara;
} | [
"public",
"SqlPara",
"getSqlParaByString",
"(",
"String",
"content",
",",
"Map",
"data",
")",
"{",
"Template",
"template",
"=",
"engine",
".",
"getTemplateByString",
"(",
"content",
")",
";",
"SqlPara",
"sqlPara",
"=",
"new",
"SqlPara",
"(",
")",
";",
"data"... | 通过 String 内容获取 SqlPara 对象
<pre>
例子:
String content = "select * from user where id = #para(id)";
SqlPara sqlPara = getSqlParaByString(content, Kv.by("id", 123));
特别注意:content 参数中不能包含 #sql 指令
</pre> | [
"通过",
"String",
"内容获取",
"SqlPara",
"对象"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java#L219-L227 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.valueArrayOf | @Override
public INDArray valueArrayOf(long rows, long columns, double value) {
INDArray create = createUninitialized(new long[] {rows, columns}, Nd4j.order());
create.assign(value);
return create;
} | java | @Override
public INDArray valueArrayOf(long rows, long columns, double value) {
INDArray create = createUninitialized(new long[] {rows, columns}, Nd4j.order());
create.assign(value);
return create;
} | [
"@",
"Override",
"public",
"INDArray",
"valueArrayOf",
"(",
"long",
"rows",
",",
"long",
"columns",
",",
"double",
"value",
")",
"{",
"INDArray",
"create",
"=",
"createUninitialized",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",
",",
"columns",
"}",
",",
"... | Creates a row vector with the specified number of columns
@param rows the number of rows in the matrix
@param columns the columns of the ndarray
@param value the value to assign
@return the created ndarray | [
"Creates",
"a",
"row",
"vector",
"with",
"the",
"specified",
"number",
"of",
"columns"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L828-L833 |
MarkusBernhardt/xml-doclet | src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java | XmlDoclet.parseCommandLine | public static CommandLine parseCommandLine(String[][] optionsArrayArray) {
try {
List<String> argumentList = new ArrayList<String>();
for (String[] optionsArray : optionsArrayArray) {
argumentList.addAll(Arrays.asList(optionsArray));
}
CommandLineParser commandLineParser = new BasicParser() {
@Override
protected void processOption(final String arg, @SuppressWarnings("rawtypes") final ListIterator iter)
throws ParseException {
boolean hasOption = getOptions().hasOption(arg);
if (hasOption) {
super.processOption(arg, iter);
}
}
};
CommandLine commandLine = commandLineParser.parse(options, argumentList.toArray(new String[] {}));
return commandLine;
} catch (ParseException e) {
LoggingOutputStream loggingOutputStream = new LoggingOutputStream(log, LoggingLevelEnum.INFO);
PrintWriter printWriter = new PrintWriter(loggingOutputStream);
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(printWriter, 74, "javadoc -doclet " + XmlDoclet.class.getName() + " [options]",
null, options, 1, 3, null, false);
return null;
}
} | java | public static CommandLine parseCommandLine(String[][] optionsArrayArray) {
try {
List<String> argumentList = new ArrayList<String>();
for (String[] optionsArray : optionsArrayArray) {
argumentList.addAll(Arrays.asList(optionsArray));
}
CommandLineParser commandLineParser = new BasicParser() {
@Override
protected void processOption(final String arg, @SuppressWarnings("rawtypes") final ListIterator iter)
throws ParseException {
boolean hasOption = getOptions().hasOption(arg);
if (hasOption) {
super.processOption(arg, iter);
}
}
};
CommandLine commandLine = commandLineParser.parse(options, argumentList.toArray(new String[] {}));
return commandLine;
} catch (ParseException e) {
LoggingOutputStream loggingOutputStream = new LoggingOutputStream(log, LoggingLevelEnum.INFO);
PrintWriter printWriter = new PrintWriter(loggingOutputStream);
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(printWriter, 74, "javadoc -doclet " + XmlDoclet.class.getName() + " [options]",
null, options, 1, 3, null, false);
return null;
}
} | [
"public",
"static",
"CommandLine",
"parseCommandLine",
"(",
"String",
"[",
"]",
"[",
"]",
"optionsArrayArray",
")",
"{",
"try",
"{",
"List",
"<",
"String",
">",
"argumentList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Stri... | Parse the given options.
@param optionsArrayArray
The two dimensional array of options.
@return the parsed command line arguments. | [
"Parse",
"the",
"given",
"options",
"."
] | train | https://github.com/MarkusBernhardt/xml-doclet/blob/6bb0cc1ff82b2e20787b93252c6b294d0eb31622/src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java#L232-L260 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java | Reflection.setValue | public static void setValue(Object instance, String fieldName, Object value) {
try {
Field f = findFieldRecursively(instance.getClass(), fieldName);
if (f == null)
throw new NoSuchMethodException("Cannot find field " + fieldName + " on " + instance.getClass() + " or superclasses");
f.setAccessible(true);
f.set(instance, value);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static void setValue(Object instance, String fieldName, Object value) {
try {
Field f = findFieldRecursively(instance.getClass(), fieldName);
if (f == null)
throw new NoSuchMethodException("Cannot find field " + fieldName + " on " + instance.getClass() + " or superclasses");
f.setAccessible(true);
f.set(instance, value);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"setValue",
"(",
"Object",
"instance",
",",
"String",
"fieldName",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"Field",
"f",
"=",
"findFieldRecursively",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"fieldName",
")",
";",
... | Sets the value of a field of an object instance via reflection
@param instance to inspect
@param fieldName name of field to set
@param value the value to set | [
"Sets",
"the",
"value",
"of",
"a",
"field",
"of",
"an",
"object",
"instance",
"via",
"reflection"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L211-L221 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/minimizer/Minimizer.java | Minimizer.updateBlockReferences | private static <S, L> void updateBlockReferences(Block<S, L> block) {
UnorderedCollection<State<S, L>> states = block.getStates();
for (ElementReference ref : states.references()) {
State<S, L> state = states.get(ref);
state.setBlockReference(ref);
state.setBlock(block);
}
} | java | private static <S, L> void updateBlockReferences(Block<S, L> block) {
UnorderedCollection<State<S, L>> states = block.getStates();
for (ElementReference ref : states.references()) {
State<S, L> state = states.get(ref);
state.setBlockReference(ref);
state.setBlock(block);
}
} | [
"private",
"static",
"<",
"S",
",",
"L",
">",
"void",
"updateBlockReferences",
"(",
"Block",
"<",
"S",
",",
"L",
">",
"block",
")",
"{",
"UnorderedCollection",
"<",
"State",
"<",
"S",
",",
"L",
">",
">",
"states",
"=",
"block",
".",
"getStates",
"(",... | Sets the blockReference-attribute of each state in the collection to the corresponding ElementReference of the
collection. | [
"Sets",
"the",
"blockReference",
"-",
"attribute",
"of",
"each",
"state",
"in",
"the",
"collection",
"to",
"the",
"corresponding",
"ElementReference",
"of",
"the",
"collection",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/minimizer/Minimizer.java#L442-L449 |
line/armeria | jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java | JettyService.forServer | public static JettyService forServer(Server jettyServer) {
requireNonNull(jettyServer, "jettyServer");
return new JettyService(null, blockingTaskExecutor -> jettyServer);
} | java | public static JettyService forServer(Server jettyServer) {
requireNonNull(jettyServer, "jettyServer");
return new JettyService(null, blockingTaskExecutor -> jettyServer);
} | [
"public",
"static",
"JettyService",
"forServer",
"(",
"Server",
"jettyServer",
")",
"{",
"requireNonNull",
"(",
"jettyServer",
",",
"\"jettyServer\"",
")",
";",
"return",
"new",
"JettyService",
"(",
"null",
",",
"blockingTaskExecutor",
"->",
"jettyServer",
")",
";... | Creates a new {@link JettyService} from an existing Jetty {@link Server}.
@param jettyServer the Jetty {@link Server} | [
"Creates",
"a",
"new",
"{",
"@link",
"JettyService",
"}",
"from",
"an",
"existing",
"Jetty",
"{",
"@link",
"Server",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java#L83-L86 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/image/ImageBuilder.java | ImageBuilder.buildLocalImage | private Image buildLocalImage(final AbstractBaseImage jrImage, final boolean skipImagesFolder) {
final StringBuilder sb = new StringBuilder();
if (jrImage.path() != null && !jrImage.path().isEmpty()) {
sb.append(jrImage.path()).append(Resources.PATH_SEP);
}
sb.append(jrImage.name());
if (jrImage.extension() != null) {
sb.append(jrImage.extension());
}
return loadImage(sb.toString(), skipImagesFolder);
} | java | private Image buildLocalImage(final AbstractBaseImage jrImage, final boolean skipImagesFolder) {
final StringBuilder sb = new StringBuilder();
if (jrImage.path() != null && !jrImage.path().isEmpty()) {
sb.append(jrImage.path()).append(Resources.PATH_SEP);
}
sb.append(jrImage.name());
if (jrImage.extension() != null) {
sb.append(jrImage.extension());
}
return loadImage(sb.toString(), skipImagesFolder);
} | [
"private",
"Image",
"buildLocalImage",
"(",
"final",
"AbstractBaseImage",
"jrImage",
",",
"final",
"boolean",
"skipImagesFolder",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"jrImage",
".",
"path",
"(",
")",... | Build a local image with its local path.
@param jrImage the local image params
@param skipImagesFolder skip imagesFolder prefix addition
@return the JavaFX image object | [
"Build",
"a",
"local",
"image",
"with",
"its",
"local",
"path",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/image/ImageBuilder.java#L94-L107 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/gui/AbstractComponent.java | AbstractComponent.mouseReleased | public void mouseReleased(int button, int x, int y) {
setFocus(Rectangle.contains(x, y, getX(), getY(), getWidth(),
getHeight()));
} | java | public void mouseReleased(int button, int x, int y) {
setFocus(Rectangle.contains(x, y, getX(), getY(), getWidth(),
getHeight()));
} | [
"public",
"void",
"mouseReleased",
"(",
"int",
"button",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"setFocus",
"(",
"Rectangle",
".",
"contains",
"(",
"x",
",",
"y",
",",
"getX",
"(",
")",
",",
"getY",
"(",
")",
",",
"getWidth",
"(",
")",
",",
... | Gives the focus to this component with a click of the mouse.
@see org.newdawn.slick.gui.AbstractComponent#mouseReleased(int, int, int) | [
"Gives",
"the",
"focus",
"to",
"this",
"component",
"with",
"a",
"click",
"of",
"the",
"mouse",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/gui/AbstractComponent.java#L178-L181 |
netceteragroup/valdr-bean-validation | valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java | AnnotationUtils.getAnnotation | public static <T extends Annotation> T getAnnotation(AnnotatedElement ae, Class<T> annotationType) {
T ann = ae.getAnnotation(annotationType);
if (ann == null) {
for (Annotation metaAnn : ae.getAnnotations()) {
ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
break;
}
}
}
return ann;
} | java | public static <T extends Annotation> T getAnnotation(AnnotatedElement ae, Class<T> annotationType) {
T ann = ae.getAnnotation(annotationType);
if (ann == null) {
for (Annotation metaAnn : ae.getAnnotations()) {
ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
break;
}
}
}
return ann;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"AnnotatedElement",
"ae",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"T",
"ann",
"=",
"ae",
".",
"getAnnotation",
"(",
"annotationType",
")",
";",
"if",
... | Get a single {@link java.lang.annotation.Annotation} of {@code annotationType} from the supplied
Method, Constructor or Field. Meta-annotations will be searched if the annotation
is not declared locally on the supplied element.
@param ae the Method, Constructor or Field from which to get the annotation
@param annotationType the annotation class to look for, both locally and as a meta-annotation
@param <T> annotation type
@return the matching annotation or {@code null} if not found
@since 3.1 | [
"Get",
"a",
"single",
"{"
] | train | https://github.com/netceteragroup/valdr-bean-validation/blob/3f49f1357c575a11331be2de867cf47809a83823/valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java#L69-L80 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java | ListManagementTermListsImpl.createAsync | public Observable<TermList> createAsync(String contentType, BodyModel bodyParameter) {
return createWithServiceResponseAsync(contentType, bodyParameter).map(new Func1<ServiceResponse<TermList>, TermList>() {
@Override
public TermList call(ServiceResponse<TermList> response) {
return response.body();
}
});
} | java | public Observable<TermList> createAsync(String contentType, BodyModel bodyParameter) {
return createWithServiceResponseAsync(contentType, bodyParameter).map(new Func1<ServiceResponse<TermList>, TermList>() {
@Override
public TermList call(ServiceResponse<TermList> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TermList",
">",
"createAsync",
"(",
"String",
"contentType",
",",
"BodyModel",
"bodyParameter",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"contentType",
",",
"bodyParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",... | Creates a Term List.
@param contentType The content type.
@param bodyParameter Schema of the body.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TermList object | [
"Creates",
"a",
"Term",
"List",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java#L372-L379 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java | PropertySheetTable.getCellEditor | @Override
public TableCellEditor getCellEditor(int row, int column) {
if (column == 0) {
return null;
}
Item item = getSheetModel().getPropertySheetElement(row);
if (!item.isProperty()) {
return null;
}
TableCellEditor result = null;
Property propery = item.getProperty();
PropertyEditor editor = getEditorFactory().createPropertyEditor(propery);
if (editor != null) {
result = new CellEditorAdapter(editor);
}
return result;
} | java | @Override
public TableCellEditor getCellEditor(int row, int column) {
if (column == 0) {
return null;
}
Item item = getSheetModel().getPropertySheetElement(row);
if (!item.isProperty()) {
return null;
}
TableCellEditor result = null;
Property propery = item.getProperty();
PropertyEditor editor = getEditorFactory().createPropertyEditor(propery);
if (editor != null) {
result = new CellEditorAdapter(editor);
}
return result;
} | [
"@",
"Override",
"public",
"TableCellEditor",
"getCellEditor",
"(",
"int",
"row",
",",
"int",
"column",
")",
"{",
"if",
"(",
"column",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"Item",
"item",
"=",
"getSheetModel",
"(",
")",
".",
"getPropertySheet... | Gets the CellEditor for the given row and column. It uses the editor
registry to find a suitable editor for the property.
@return
@see javax.swing.JTable#getCellEditor(int, int) | [
"Gets",
"the",
"CellEditor",
"for",
"the",
"given",
"row",
"and",
"column",
".",
"It",
"uses",
"the",
"editor",
"registry",
"to",
"find",
"a",
"suitable",
"editor",
"for",
"the",
"property",
"."
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L337-L356 |
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.listQueryResultsForManagementGroup | public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) {
return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body();
} | java | public PolicyEventsQueryResultsInner listQueryResultsForManagementGroup(String managementGroupName, QueryOptions queryOptions) {
return listQueryResultsForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyEventsQueryResultsInner",
"listQueryResultsForManagementGroup",
"(",
"String",
"managementGroupName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForManagementGroupWithServiceResponseAsync",
"(",
"managementGroupName",
",",
"queryOptions... | Queries policy events for the resources under the management group.
@param managementGroupName Management group name.
@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",
"management",
"group",
"."
] | 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#L185-L187 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/IntArray.java | IntArray.getInstance | public static IntArray getInstance(short[] buffer, int offset, int length)
{
return getInstance(ShortBuffer.wrap(buffer, offset, length));
} | java | public static IntArray getInstance(short[] buffer, int offset, int length)
{
return getInstance(ShortBuffer.wrap(buffer, offset, length));
} | [
"public",
"static",
"IntArray",
"getInstance",
"(",
"short",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"ShortBuffer",
".",
"wrap",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
")",
";",
... | Creates IntArray backed by short array
@param buffer
@param offset
@param length
@return | [
"Creates",
"IntArray",
"backed",
"by",
"short",
"array"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L117-L120 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.inferVector | public INDArray inferVector(LabelledDocument document) {
return inferVector(document, this.learningRate.get(), this.minLearningRate,
this.numEpochs * this.numIterations);
} | java | public INDArray inferVector(LabelledDocument document) {
return inferVector(document, this.learningRate.get(), this.minLearningRate,
this.numEpochs * this.numIterations);
} | [
"public",
"INDArray",
"inferVector",
"(",
"LabelledDocument",
"document",
")",
"{",
"return",
"inferVector",
"(",
"document",
",",
"this",
".",
"learningRate",
".",
"get",
"(",
")",
",",
"this",
".",
"minLearningRate",
",",
"this",
".",
"numEpochs",
"*",
"th... | This method calculates inferred vector for given document, with default parameters for learning rate and iterations
@param document
@return | [
"This",
"method",
"calculates",
"inferred",
"vector",
"for",
"given",
"document",
"with",
"default",
"parameters",
"for",
"learning",
"rate",
"and",
"iterations"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L302-L305 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.hosting_web_serviceName_changeMainDomain_duration_POST | public OvhOrder hosting_web_serviceName_changeMainDomain_duration_POST(String serviceName, String duration, String domain, OvhMxPlanEnum mxplan) throws IOException {
String qPath = "/order/hosting/web/{serviceName}/changeMainDomain/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "mxplan", mxplan);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder hosting_web_serviceName_changeMainDomain_duration_POST(String serviceName, String duration, String domain, OvhMxPlanEnum mxplan) throws IOException {
String qPath = "/order/hosting/web/{serviceName}/changeMainDomain/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "mxplan", mxplan);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"hosting_web_serviceName_changeMainDomain_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"String",
"domain",
",",
"OvhMxPlanEnum",
"mxplan",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/hosting/w... | Create order
REST: POST /order/hosting/web/{serviceName}/changeMainDomain/{duration}
@param domain [required] New domain for change the main domain
@param mxplan [required] MX plan linked to the odl main domain
@param serviceName [required] The internal name of your hosting
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4908-L4916 |
googleads/googleads-java-lib | extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ApiRetryStrategyManager.java | ApiRetryStrategyManager.getRateLimitBucket | private static @Nullable ApiRateLimitBucket getRateLimitBucket(String name, boolean isUtility) {
if (isUtility) {
// For utilities, we only support ReportDownloader but not others (such as BatchJobHelper).
return reportingClasses.contains(name) ? ApiRateLimitBucket.REPORTING : null;
} else {
// For all AdWords API services, share the "OTHERS" bucket.
return ApiRateLimitBucket.OTHERS;
}
} | java | private static @Nullable ApiRateLimitBucket getRateLimitBucket(String name, boolean isUtility) {
if (isUtility) {
// For utilities, we only support ReportDownloader but not others (such as BatchJobHelper).
return reportingClasses.contains(name) ? ApiRateLimitBucket.REPORTING : null;
} else {
// For all AdWords API services, share the "OTHERS" bucket.
return ApiRateLimitBucket.OTHERS;
}
} | [
"private",
"static",
"@",
"Nullable",
"ApiRateLimitBucket",
"getRateLimitBucket",
"(",
"String",
"name",
",",
"boolean",
"isUtility",
")",
"{",
"if",
"(",
"isUtility",
")",
"{",
"// For utilities, we only support ReportDownloader but not others (such as BatchJobHelper).",
"re... | Get the {@link ApiRateLimitBucket} for the specified AdWords API service / utility name.
@param name the specified AdWords API service / utility name
@param isUtility whether this is for some AdWords API utility
@return the corresponding {@link ApiRateLimitBucket} enum, or null if it's not supported by
this rate limiter extension | [
"Get",
"the",
"{",
"@link",
"ApiRateLimitBucket",
"}",
"for",
"the",
"specified",
"AdWords",
"API",
"service",
"/",
"utility",
"name",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ApiRetryStrategyManager.java#L45-L53 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jpa/HibernateMetrics.java | HibernateMetrics.monitor | public static void monitor(MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, Iterable<Tag> tags) {
new HibernateMetrics(sessionFactory, sessionFactoryName, tags).bindTo(registry);
} | java | public static void monitor(MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, Iterable<Tag> tags) {
new HibernateMetrics(sessionFactory, sessionFactoryName, tags).bindTo(registry);
} | [
"public",
"static",
"void",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"SessionFactory",
"sessionFactory",
",",
"String",
"sessionFactoryName",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"new",
"HibernateMetrics",
"(",
"sessionFactory",
",",
"sessi... | Create {@code HibernateMetrics} and bind to the specified meter registry.
@param registry meter registry to use
@param sessionFactory session factory to use
@param sessionFactoryName session factory name as a tag value
@param tags additional tags | [
"Create",
"{",
"@code",
"HibernateMetrics",
"}",
"and",
"bind",
"to",
"the",
"specified",
"meter",
"registry",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jpa/HibernateMetrics.java#L70-L72 |
PureSolTechnologies/parsers | parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java | GrammarConverter.getTokenDefinition | private TokenDefinition getTokenDefinition(ParseTreeNode tokenDefinition,
Map<String, ParseTreeNode> helpers, Map<String, ParseTreeNode> tokens)
throws GrammarException, TreeException {
String tokenName = tokenDefinition.getChild("IDENTIFIER").getText();
String pattern = createTokenDefinitionPattern(tokenDefinition, helpers,
tokens);
boolean ignoreCase = Boolean.valueOf((String) options
.get("grammar.ignore-case"));
if (tokenVisibility.get(tokenName) != null) {
return new TokenDefinition(tokenName, pattern,
tokenVisibility.get(tokenName), ignoreCase);
} else {
return new TokenDefinition(tokenName, pattern, ignoreCase);
}
} | java | private TokenDefinition getTokenDefinition(ParseTreeNode tokenDefinition,
Map<String, ParseTreeNode> helpers, Map<String, ParseTreeNode> tokens)
throws GrammarException, TreeException {
String tokenName = tokenDefinition.getChild("IDENTIFIER").getText();
String pattern = createTokenDefinitionPattern(tokenDefinition, helpers,
tokens);
boolean ignoreCase = Boolean.valueOf((String) options
.get("grammar.ignore-case"));
if (tokenVisibility.get(tokenName) != null) {
return new TokenDefinition(tokenName, pattern,
tokenVisibility.get(tokenName), ignoreCase);
} else {
return new TokenDefinition(tokenName, pattern, ignoreCase);
}
} | [
"private",
"TokenDefinition",
"getTokenDefinition",
"(",
"ParseTreeNode",
"tokenDefinition",
",",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"helpers",
",",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"tokens",
")",
"throws",
"GrammarException",
",",
"T... | This is the method which merges all tokens with their helpers.
@param tokenName
@param helpers
@param tokens
@return
@throws GrammarException
@throws TreeException | [
"This",
"is",
"the",
"method",
"which",
"merges",
"all",
"tokens",
"with",
"their",
"helpers",
"."
] | train | https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L214-L228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.